12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614 |
- (function webpackUniversalModuleDefinition(root, factory) {
- if(typeof exports === 'object' && typeof module === 'object')
- module.exports = factory();
- else if(typeof define === 'function' && define.amd)
- define([], factory);
- else if(typeof exports === 'object')
- exports["expect"] = factory();
- else
- root["expect"] = factory();
- })(window, function() {
- return /******/ (function(modules) { // webpackBootstrap
- /******/ // The module cache
- /******/ var installedModules = {};
- /******/
- /******/ // The require function
- /******/ function __webpack_require__(moduleId) {
- /******/
- /******/ // Check if module is in cache
- /******/ if(installedModules[moduleId]) {
- /******/ return installedModules[moduleId].exports;
- /******/ }
- /******/ // Create a new module (and put it into the cache)
- /******/ var module = installedModules[moduleId] = {
- /******/ i: moduleId,
- /******/ l: false,
- /******/ exports: {}
- /******/ };
- /******/
- /******/ // Execute the module function
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- /******/
- /******/ // Flag the module as loaded
- /******/ module.l = true;
- /******/
- /******/ // Return the exports of the module
- /******/ return module.exports;
- /******/ }
- /******/
- /******/
- /******/ // expose the modules object (__webpack_modules__)
- /******/ __webpack_require__.m = modules;
- /******/
- /******/ // expose the module cache
- /******/ __webpack_require__.c = installedModules;
- /******/
- /******/ // define getter function for harmony exports
- /******/ __webpack_require__.d = function(exports, name, getter) {
- /******/ if(!__webpack_require__.o(exports, name)) {
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
- /******/ }
- /******/ };
- /******/
- /******/ // define __esModule on exports
- /******/ __webpack_require__.r = function(exports) {
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
- /******/ }
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
- /******/ };
- /******/
- /******/ // create a fake namespace object
- /******/ // mode & 1: value is a module id, require it
- /******/ // mode & 2: merge all properties of value into the ns
- /******/ // mode & 4: return value when already ns object
- /******/ // mode & 8|1: behave like require
- /******/ __webpack_require__.t = function(value, mode) {
- /******/ if(mode & 1) value = __webpack_require__(value);
- /******/ if(mode & 8) return value;
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
- /******/ var ns = Object.create(null);
- /******/ __webpack_require__.r(ns);
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
- /******/ return ns;
- /******/ };
- /******/
- /******/ // getDefaultExport function for compatibility with non-harmony modules
- /******/ __webpack_require__.n = function(module) {
- /******/ var getter = module && module.__esModule ?
- /******/ function getDefault() { return module['default']; } :
- /******/ function getModuleExports() { return module; };
- /******/ __webpack_require__.d(getter, 'a', getter);
- /******/ return getter;
- /******/ };
- /******/
- /******/ // Object.prototype.hasOwnProperty.call
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
- /******/
- /******/ // __webpack_public_path__
- /******/ __webpack_require__.p = "";
- /******/
- /******/
- /******/ // Load entry module and return exports
- /******/ return __webpack_require__(__webpack_require__.s = "./packages/expect/src/index.ts");
- /******/ })
- /************************************************************************/
- /******/ ({
- /***/ "./node_modules/@babel/code-frame/lib/index.js":
- /*!*****************************************************!*\
- !*** ./node_modules/@babel/code-frame/lib/index.js ***!
- \*****************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(process) {
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.codeFrameColumns = codeFrameColumns;
- exports.default = _default;
- function _highlight() {
- var data = _interopRequireWildcard(__webpack_require__(/*! @babel/highlight */ "./node_modules/@babel/highlight/lib/index.js"));
- _highlight = function _highlight() {
- return data;
- };
- return data;
- }
- function _interopRequireWildcard(obj) {
- if (obj && obj.__esModule) {
- return obj;
- } else {
- var newObj = {};
- if (obj != null) {
- for (var key in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
- if (desc.get || desc.set) {
- Object.defineProperty(newObj, key, desc);
- } else {
- newObj[key] = obj[key];
- }
- }
- }
- }
- newObj.default = obj;
- return newObj;
- }
- }
- var deprecationWarningShown = false;
- function getDefs(chalk) {
- return {
- gutter: chalk.grey,
- marker: chalk.red.bold,
- message: chalk.red.bold
- };
- }
- var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
- function getMarkerLines(loc, source, opts) {
- var startLoc = Object.assign({
- column: 0,
- line: -1
- }, loc.start);
- var endLoc = Object.assign({}, startLoc, loc.end);
- var _ref = opts || {},
- _ref$linesAbove = _ref.linesAbove,
- linesAbove = _ref$linesAbove === void 0 ? 2 : _ref$linesAbove,
- _ref$linesBelow = _ref.linesBelow,
- linesBelow = _ref$linesBelow === void 0 ? 3 : _ref$linesBelow;
- var startLine = startLoc.line;
- var startColumn = startLoc.column;
- var endLine = endLoc.line;
- var endColumn = endLoc.column;
- var start = Math.max(startLine - (linesAbove + 1), 0);
- var end = Math.min(source.length, endLine + linesBelow);
- if (startLine === -1) {
- start = 0;
- }
- if (endLine === -1) {
- end = source.length;
- }
- var lineDiff = endLine - startLine;
- var markerLines = {};
- if (lineDiff) {
- for (var i = 0; i <= lineDiff; i++) {
- var lineNumber = i + startLine;
- if (!startColumn) {
- markerLines[lineNumber] = true;
- } else if (i === 0) {
- var sourceLength = source[lineNumber - 1].length;
- markerLines[lineNumber] = [startColumn, sourceLength - startColumn];
- } else if (i === lineDiff) {
- markerLines[lineNumber] = [0, endColumn];
- } else {
- var _sourceLength = source[lineNumber - i].length;
- markerLines[lineNumber] = [0, _sourceLength];
- }
- }
- } else {
- if (startColumn === endColumn) {
- if (startColumn) {
- markerLines[startLine] = [startColumn, 0];
- } else {
- markerLines[startLine] = true;
- }
- } else {
- markerLines[startLine] = [startColumn, endColumn - startColumn];
- }
- }
- return {
- start: start,
- end: end,
- markerLines: markerLines
- };
- }
- function codeFrameColumns(rawLines, loc) {
- var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
- var highlighted = (opts.highlightCode || opts.forceColor) && (0, _highlight().shouldHighlight)(opts);
- var chalk = (0, _highlight().getChalk)(opts);
- var defs = getDefs(chalk);
- var maybeHighlight = function maybeHighlight(chalkFn, string) {
- return highlighted ? chalkFn(string) : string;
- };
- if (highlighted) rawLines = (0, _highlight().default)(rawLines, opts);
- var lines = rawLines.split(NEWLINE);
- var _getMarkerLines = getMarkerLines(loc, lines, opts),
- start = _getMarkerLines.start,
- end = _getMarkerLines.end,
- markerLines = _getMarkerLines.markerLines;
- var hasColumns = loc.start && typeof loc.start.column === "number";
- var numberMaxWidth = String(end).length;
- var frame = lines.slice(start, end).map(function (line, index) {
- var number = start + 1 + index;
- var paddedNumber = " ".concat(number).slice(-numberMaxWidth);
- var gutter = " ".concat(paddedNumber, " | ");
- var hasMarker = markerLines[number];
- var lastMarkerLine = !markerLines[number + 1];
- if (hasMarker) {
- var markerLine = "";
- if (Array.isArray(hasMarker)) {
- var markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
- var numberOfMarkers = hasMarker[1] || 1;
- markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
- if (lastMarkerLine && opts.message) {
- markerLine += " " + maybeHighlight(defs.message, opts.message);
- }
- }
- return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join("");
- } else {
- return " ".concat(maybeHighlight(defs.gutter, gutter)).concat(line);
- }
- }).join("\n");
- if (opts.message && !hasColumns) {
- frame = "".concat(" ".repeat(numberMaxWidth + 1)).concat(opts.message, "\n").concat(frame);
- }
- if (highlighted) {
- return chalk.reset(frame);
- } else {
- return frame;
- }
- }
- function _default(rawLines, lineNumber, colNumber) {
- var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
- if (!deprecationWarningShown) {
- deprecationWarningShown = true;
- var message = "Passing lineNumber and colNumber is deprecated to @babel/code-frame. Please use `codeFrameColumns`.";
- if (process.emitWarning) {
- process.emitWarning(message, "DeprecationWarning");
- } else {
- var deprecationError = new Error(message);
- deprecationError.name = "DeprecationWarning";
- console.warn(new Error(message));
- }
- }
- colNumber = Math.max(colNumber, 0);
- var location = {
- start: {
- column: colNumber,
- line: lineNumber
- }
- };
- return codeFrameColumns(rawLines, location, opts);
- }
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../process/browser.js */ "./node_modules/process/browser.js")))
- /***/ }),
- /***/ "./node_modules/@babel/highlight/lib/index.js":
- /*!****************************************************!*\
- !*** ./node_modules/@babel/highlight/lib/index.js ***!
- \****************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
- function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.shouldHighlight = shouldHighlight;
- exports.getChalk = getChalk;
- exports.default = highlight;
- function _jsTokens() {
- var data = _interopRequireWildcard(__webpack_require__(/*! js-tokens */ "./node_modules/js-tokens/index.js"));
- _jsTokens = function _jsTokens() {
- return data;
- };
- return data;
- }
- function _esutils() {
- var data = _interopRequireDefault(__webpack_require__(/*! esutils */ "./node_modules/esutils/lib/utils.js"));
- _esutils = function _esutils() {
- return data;
- };
- return data;
- }
- function _chalk() {
- var data = _interopRequireDefault(__webpack_require__(/*! chalk */ "./packages/expect/build/fakeChalk.js"));
- _chalk = function _chalk() {
- return data;
- };
- return data;
- }
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
- }
- function _interopRequireWildcard(obj) {
- if (obj && obj.__esModule) {
- return obj;
- } else {
- var newObj = {};
- if (obj != null) {
- for (var key in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
- if (desc.get || desc.set) {
- Object.defineProperty(newObj, key, desc);
- } else {
- newObj[key] = obj[key];
- }
- }
- }
- }
- newObj.default = obj;
- return newObj;
- }
- }
- function getDefs(chalk) {
- return {
- keyword: chalk.cyan,
- capitalized: chalk.yellow,
- jsx_tag: chalk.yellow,
- punctuator: chalk.yellow,
- number: chalk.magenta,
- string: chalk.green,
- regex: chalk.magenta,
- comment: chalk.grey,
- invalid: chalk.white.bgRed.bold
- };
- }
- var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
- var JSX_TAG = /^[a-z][\w-]*$/i;
- var BRACKET = /^[()[\]{}]$/;
- function getTokenType(match) {
- var _match$slice = match.slice(-2),
- _match$slice2 = _slicedToArray(_match$slice, 2),
- offset = _match$slice2[0],
- text = _match$slice2[1];
- var token = (0, _jsTokens().matchToToken)(match);
- if (token.type === "name") {
- if (_esutils().default.keyword.isReservedWordES6(token.value)) {
- return "keyword";
- }
- if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.substr(offset - 2, 2) == "</")) {
- return "jsx_tag";
- }
- if (token.value[0] !== token.value[0].toLowerCase()) {
- return "capitalized";
- }
- }
- if (token.type === "punctuator" && BRACKET.test(token.value)) {
- return "bracket";
- }
- if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
- return "punctuator";
- }
- return token.type;
- }
- function highlightTokens(defs, text) {
- return text.replace(_jsTokens().default, function () {
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- var type = getTokenType(args);
- var colorize = defs[type];
- if (colorize) {
- return args[0].split(NEWLINE).map(function (str) {
- return colorize(str);
- }).join("\n");
- } else {
- return args[0];
- }
- });
- }
- function shouldHighlight(options) {
- return _chalk().default.supportsColor || options.forceColor;
- }
- function getChalk(options) {
- var chalk = _chalk().default;
- if (options.forceColor) {
- chalk = new (_chalk().default.constructor)({
- enabled: true,
- level: 1
- });
- }
- return chalk;
- }
- function highlight(code) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- if (shouldHighlight(options)) {
- var chalk = getChalk(options);
- var defs = getDefs(chalk);
- return highlightTokens(defs, code);
- } else {
- return code;
- }
- }
- /***/ }),
- /***/ "./node_modules/ansi-regex/index.js":
- /*!******************************************!*\
- !*** ./node_modules/ansi-regex/index.js ***!
- \******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- module.exports = function (options) {
- options = Object.assign({
- onlyFirst: false
- }, options);
- var pattern = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'].join('|');
- return new RegExp(pattern, options.onlyFirst ? undefined : 'g');
- };
- /***/ }),
- /***/ "./node_modules/ansi-styles/index.js":
- /*!*******************************************!*\
- !*** ./node_modules/ansi-styles/index.js ***!
- \*******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(module) {
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- var colorConvert = __webpack_require__(/*! color-convert */ "./node_modules/color-convert/index.js");
- var wrapAnsi16 = function wrapAnsi16(fn, offset) {
- return function () {
- var code = fn.apply(colorConvert, arguments);
- return "\x1B[".concat(code + offset, "m");
- };
- };
- var wrapAnsi256 = function wrapAnsi256(fn, offset) {
- return function () {
- var code = fn.apply(colorConvert, arguments);
- return "\x1B[".concat(38 + offset, ";5;").concat(code, "m");
- };
- };
- var wrapAnsi16m = function wrapAnsi16m(fn, offset) {
- return function () {
- var rgb = fn.apply(colorConvert, arguments);
- return "\x1B[".concat(38 + offset, ";2;").concat(rgb[0], ";").concat(rgb[1], ";").concat(rgb[2], "m");
- };
- };
- function assembleStyles() {
- var codes = new Map();
- var styles = {
- modifier: {
- reset: [0, 0],
- // 21 isn't widely supported and 22 does the same thing
- 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],
- gray: [90, 39],
- // Bright color
- 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],
- // Bright color
- bgBlackBright: [100, 49],
- bgRedBright: [101, 49],
- bgGreenBright: [102, 49],
- bgYellowBright: [103, 49],
- bgBlueBright: [104, 49],
- bgMagentaBright: [105, 49],
- bgCyanBright: [106, 49],
- bgWhiteBright: [107, 49]
- }
- }; // Fix humans
- styles.color.grey = styles.color.gray;
- var _arr = Object.keys(styles);
- for (var _i = 0; _i < _arr.length; _i++) {
- var groupName = _arr[_i];
- var group = styles[groupName];
- var _arr3 = Object.keys(group);
- for (var _i3 = 0; _i3 < _arr3.length; _i3++) {
- var styleName = _arr3[_i3];
- var style = group[styleName];
- styles[styleName] = {
- open: "\x1B[".concat(style[0], "m"),
- close: "\x1B[".concat(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
- });
- }
- var ansi2ansi = function ansi2ansi(n) {
- return n;
- };
- var rgb2rgb = function rgb2rgb(r, g, b) {
- return [r, g, b];
- };
- styles.color.close = "\x1B[39m";
- styles.bgColor.close = "\x1B[49m";
- styles.color.ansi = {
- ansi: wrapAnsi16(ansi2ansi, 0)
- };
- styles.color.ansi256 = {
- ansi256: wrapAnsi256(ansi2ansi, 0)
- };
- styles.color.ansi16m = {
- rgb: wrapAnsi16m(rgb2rgb, 0)
- };
- styles.bgColor.ansi = {
- ansi: wrapAnsi16(ansi2ansi, 10)
- };
- styles.bgColor.ansi256 = {
- ansi256: wrapAnsi256(ansi2ansi, 10)
- };
- styles.bgColor.ansi16m = {
- rgb: wrapAnsi16m(rgb2rgb, 10)
- };
- var _arr2 = Object.keys(colorConvert);
- for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
- var key = _arr2[_i2];
- if (_typeof(colorConvert[key]) !== 'object') {
- continue;
- }
- var suite = colorConvert[key];
- if (key === 'ansi16') {
- key = 'ansi';
- }
- if ('ansi16' in suite) {
- styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0);
- styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10);
- }
- if ('ansi256' in suite) {
- styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0);
- styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10);
- }
- if ('rgb' in suite) {
- styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0);
- styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10);
- }
- }
- return styles;
- } // Make the export immutable
- Object.defineProperty(module, 'exports', {
- enumerable: true,
- get: assembleStyles
- });
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module)))
- /***/ }),
- /***/ "./node_modules/arr-diff/index.js":
- /*!****************************************!*\
- !*** ./node_modules/arr-diff/index.js ***!
- \****************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * arr-diff <https://github.com/jonschlinkert/arr-diff>
- *
- * Copyright (c) 2014-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- module.exports = function diff(arr
- /*, arrays*/
- ) {
- var len = arguments.length;
- var idx = 0;
- while (++idx < len) {
- arr = diffArray(arr, arguments[idx]);
- }
- return arr;
- };
- function diffArray(one, two) {
- if (!Array.isArray(two)) {
- return one.slice();
- }
- var tlen = two.length;
- var olen = one.length;
- var idx = -1;
- var arr = [];
- while (++idx < olen) {
- var ele = one[idx];
- var hasEle = false;
- for (var i = 0; i < tlen; i++) {
- var val = two[i];
- if (ele === val) {
- hasEle = true;
- break;
- }
- }
- if (hasEle === false) {
- arr.push(ele);
- }
- }
- return arr;
- }
- /***/ }),
- /***/ "./node_modules/arr-flatten/index.js":
- /*!*******************************************!*\
- !*** ./node_modules/arr-flatten/index.js ***!
- \*******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * arr-flatten <https://github.com/jonschlinkert/arr-flatten>
- *
- * Copyright (c) 2014-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- module.exports = function (arr) {
- return flat(arr, []);
- };
- function flat(arr, res) {
- var i = 0,
- cur;
- var len = arr.length;
- for (; i < len; i++) {
- cur = arr[i];
- Array.isArray(cur) ? flat(cur, res) : res.push(cur);
- }
- return res;
- }
- /***/ }),
- /***/ "./node_modules/arr-union/index.js":
- /*!*****************************************!*\
- !*** ./node_modules/arr-union/index.js ***!
- \*****************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- module.exports = function union(init) {
- if (!Array.isArray(init)) {
- throw new TypeError('arr-union expects the first argument to be an array.');
- }
- var len = arguments.length;
- var i = 0;
- while (++i < len) {
- var arg = arguments[i];
- if (!arg) continue;
- if (!Array.isArray(arg)) {
- arg = [arg];
- }
- for (var j = 0; j < arg.length; j++) {
- var ele = arg[j];
- if (init.indexOf(ele) >= 0) {
- continue;
- }
- init.push(ele);
- }
- }
- return init;
- };
- /***/ }),
- /***/ "./node_modules/array-unique/index.js":
- /*!********************************************!*\
- !*** ./node_modules/array-unique/index.js ***!
- \********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * array-unique <https://github.com/jonschlinkert/array-unique>
- *
- * Copyright (c) 2014-2015, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- module.exports = function unique(arr) {
- if (!Array.isArray(arr)) {
- throw new TypeError('array-unique expects an array.');
- }
- var len = arr.length;
- var i = -1;
- while (i++ < len) {
- var j = i + 1;
- for (; j < arr.length; ++j) {
- if (arr[i] === arr[j]) {
- arr.splice(j--, 1);
- }
- }
- }
- return arr;
- };
- module.exports.immutable = function uniqueImmutable(arr) {
- if (!Array.isArray(arr)) {
- throw new TypeError('array-unique expects an array.');
- }
- var arrLen = arr.length;
- var newArr = new Array(arrLen);
- for (var i = 0; i < arrLen; i++) {
- newArr[i] = arr[i];
- }
- return module.exports(newArr);
- };
- /***/ }),
- /***/ "./node_modules/assign-symbols/index.js":
- /*!**********************************************!*\
- !*** ./node_modules/assign-symbols/index.js ***!
- \**********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * assign-symbols <https://github.com/jonschlinkert/assign-symbols>
- *
- * Copyright (c) 2015, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- module.exports = function (receiver, objects) {
- if (receiver === null || typeof receiver === 'undefined') {
- throw new TypeError('expected first argument to be an object.');
- }
- if (typeof objects === 'undefined' || typeof Symbol === 'undefined') {
- return receiver;
- }
- if (typeof Object.getOwnPropertySymbols !== 'function') {
- return receiver;
- }
- var isEnumerable = Object.prototype.propertyIsEnumerable;
- var target = Object(receiver);
- var len = arguments.length,
- i = 0;
- while (++i < len) {
- var provider = Object(arguments[i]);
- var names = Object.getOwnPropertySymbols(provider);
- for (var j = 0; j < names.length; j++) {
- var key = names[j];
- if (isEnumerable.call(provider, key)) {
- target[key] = provider[key];
- }
- }
- }
- return target;
- };
- /***/ }),
- /***/ "./node_modules/base/index.js":
- /*!************************************!*\
- !*** ./node_modules/base/index.js ***!
- \************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var util = __webpack_require__(/*! util */ "./node_modules/util/util.js");
- var define = __webpack_require__(/*! define-property */ "./node_modules/base/node_modules/define-property/index.js");
- var CacheBase = __webpack_require__(/*! cache-base */ "./node_modules/cache-base/index.js");
- var Emitter = __webpack_require__(/*! component-emitter */ "./node_modules/base/node_modules/component-emitter/index.js");
- var isObject = __webpack_require__(/*! isobject */ "./node_modules/isobject/index.js");
- var merge = __webpack_require__(/*! mixin-deep */ "./node_modules/mixin-deep/index.js");
- var pascal = __webpack_require__(/*! pascalcase */ "./node_modules/pascalcase/index.js");
- var cu = __webpack_require__(/*! class-utils */ "./node_modules/class-utils/index.js");
- /**
- * Optionally define a custom `cache` namespace to use.
- */
- function namespace(name) {
- var Cache = name ? CacheBase.namespace(name) : CacheBase;
- var fns = [];
- /**
- * Create an instance of `Base` with the given `config` and `options`.
- *
- * ```js
- * // initialize with `config` and `options`
- * var app = new Base({isApp: true}, {abc: true});
- * app.set('foo', 'bar');
- *
- * // values defined with the given `config` object will be on the root of the instance
- * console.log(app.baz); //=> undefined
- * console.log(app.foo); //=> 'bar'
- * // or use `.get`
- * console.log(app.get('isApp')); //=> true
- * console.log(app.get('foo')); //=> 'bar'
- *
- * // values defined with the given `options` object will be on `app.options
- * console.log(app.options.abc); //=> true
- * ```
- *
- * @param {Object} `config` If supplied, this object is passed to [cache-base][] to merge onto the the instance upon instantiation.
- * @param {Object} `options` If supplied, this object is used to initialize the `base.options` object.
- * @api public
- */
- function Base(config, options) {
- if (!(this instanceof Base)) {
- return new Base(config, options);
- }
- Cache.call(this, config);
- this.is('base');
- this.initBase(config, options);
- }
- /**
- * Inherit cache-base
- */
- util.inherits(Base, Cache);
- /**
- * Add static emitter methods
- */
- Emitter(Base);
- /**
- * Initialize `Base` defaults with the given `config` object
- */
- Base.prototype.initBase = function (config, options) {
- this.options = merge({}, this.options, options);
- this.cache = this.cache || {};
- this.define('registered', {});
- if (name) this[name] = {}; // make `app._callbacks` non-enumerable
- this.define('_callbacks', this._callbacks);
- if (isObject(config)) {
- this.visit('set', config);
- }
- Base.run(this, 'use', fns);
- };
- /**
- * Set the given `name` on `app._name` and `app.is*` properties. Used for doing
- * lookups in plugins.
- *
- * ```js
- * app.is('foo');
- * console.log(app._name);
- * //=> 'foo'
- * console.log(app.isFoo);
- * //=> true
- * app.is('bar');
- * console.log(app.isFoo);
- * //=> true
- * console.log(app.isBar);
- * //=> true
- * console.log(app._name);
- * //=> 'bar'
- * ```
- * @name .is
- * @param {String} `name`
- * @return {Boolean}
- * @api public
- */
- Base.prototype.is = function (name) {
- if (typeof name !== 'string') {
- throw new TypeError('expected name to be a string');
- }
- this.define('is' + pascal(name), true);
- this.define('_name', name);
- this.define('_appname', name);
- return this;
- };
- /**
- * Returns true if a plugin has already been registered on an instance.
- *
- * Plugin implementors are encouraged to use this first thing in a plugin
- * to prevent the plugin from being called more than once on the same
- * instance.
- *
- * ```js
- * var base = new Base();
- * base.use(function(app) {
- * if (app.isRegistered('myPlugin')) return;
- * // do stuff to `app`
- * });
- *
- * // to also record the plugin as being registered
- * base.use(function(app) {
- * if (app.isRegistered('myPlugin', true)) return;
- * // do stuff to `app`
- * });
- * ```
- * @name .isRegistered
- * @emits `plugin` Emits the name of the plugin being registered. Useful for unit tests, to ensure plugins are only registered once.
- * @param {String} `name` The plugin name.
- * @param {Boolean} `register` If the plugin if not already registered, to record it as being registered pass `true` as the second argument.
- * @return {Boolean} Returns true if a plugin is already registered.
- * @api public
- */
- Base.prototype.isRegistered = function (name, register) {
- if (this.registered.hasOwnProperty(name)) {
- return true;
- }
- if (register !== false) {
- this.registered[name] = true;
- this.emit('plugin', name);
- }
- return false;
- };
- /**
- * Define a plugin function to be called immediately upon init. Plugins are chainable
- * and expose the following arguments to the plugin function:
- *
- * - `app`: the current instance of `Base`
- * - `base`: the [first ancestor instance](#base) of `Base`
- *
- * ```js
- * var app = new Base()
- * .use(foo)
- * .use(bar)
- * .use(baz)
- * ```
- * @name .use
- * @param {Function} `fn` plugin function to call
- * @return {Object} Returns the item instance for chaining.
- * @api public
- */
- Base.prototype.use = function (fn) {
- fn.call(this, this);
- return this;
- };
- /**
- * The `.define` method is used for adding non-enumerable property on the instance.
- * Dot-notation is **not supported** with `define`.
- *
- * ```js
- * // arbitrary `render` function using lodash `template`
- * app.define('render', function(str, locals) {
- * return _.template(str)(locals);
- * });
- * ```
- * @name .define
- * @param {String} `key` The name of the property to define.
- * @param {any} `value`
- * @return {Object} Returns the instance for chaining.
- * @api public
- */
- Base.prototype.define = function (key, val) {
- if (isObject(key)) {
- return this.visit('define', key);
- }
- define(this, key, val);
- return this;
- };
- /**
- * Mix property `key` onto the Base prototype. If base is inherited using
- * `Base.extend` this method will be overridden by a new `mixin` method that will
- * only add properties to the prototype of the inheriting application.
- *
- * ```js
- * app.mixin('foo', function() {
- * // do stuff
- * });
- * ```
- * @name .mixin
- * @param {String} `key`
- * @param {Object|Array} `val`
- * @return {Object} Returns the `base` instance for chaining.
- * @api public
- */
- Base.prototype.mixin = function (key, val) {
- Base.prototype[key] = val;
- return this;
- };
- /**
- * Non-enumberable mixin array, used by the static [Base.mixin]() method.
- */
- Base.prototype.mixins = Base.prototype.mixins || [];
- /**
- * Getter/setter used when creating nested instances of `Base`, for storing a reference
- * to the first ancestor instance. This works by setting an instance of `Base` on the `parent`
- * property of a "child" instance. The `base` property defaults to the current instance if
- * no `parent` property is defined.
- *
- * ```js
- * // create an instance of `Base`, this is our first ("base") instance
- * var first = new Base();
- * first.foo = 'bar'; // arbitrary property, to make it easier to see what's happening later
- *
- * // create another instance
- * var second = new Base();
- * // create a reference to the first instance (`first`)
- * second.parent = first;
- *
- * // create another instance
- * var third = new Base();
- * // create a reference to the previous instance (`second`)
- * // repeat this pattern every time a "child" instance is created
- * third.parent = second;
- *
- * // we can always access the first instance using the `base` property
- * console.log(first.base.foo);
- * //=> 'bar'
- * console.log(second.base.foo);
- * //=> 'bar'
- * console.log(third.base.foo);
- * //=> 'bar'
- * // and now you know how to get to third base ;)
- * ```
- * @name .base
- * @api public
- */
- Object.defineProperty(Base.prototype, 'base', {
- configurable: true,
- get: function get() {
- return this.parent ? this.parent.base : this;
- }
- });
- /**
- * Static method for adding global plugin functions that will
- * be added to an instance when created.
- *
- * ```js
- * Base.use(function(app) {
- * app.foo = 'bar';
- * });
- * var app = new Base();
- * console.log(app.foo);
- * //=> 'bar'
- * ```
- * @name #use
- * @param {Function} `fn` Plugin function to use on each instance.
- * @return {Object} Returns the `Base` constructor for chaining
- * @api public
- */
- define(Base, 'use', function (fn) {
- fns.push(fn);
- return Base;
- });
- /**
- * Run an array of functions by passing each function
- * to a method on the given object specified by the given property.
- *
- * @param {Object} `obj` Object containing method to use.
- * @param {String} `prop` Name of the method on the object to use.
- * @param {Array} `arr` Array of functions to pass to the method.
- */
- define(Base, 'run', function (obj, prop, arr) {
- var len = arr.length,
- i = 0;
- while (len--) {
- obj[prop](arr[i++]);
- }
- return Base;
- });
- /**
- * Static method for inheriting the prototype and static methods of the `Base` class.
- * This method greatly simplifies the process of creating inheritance-based applications.
- * See [static-extend][] for more details.
- *
- * ```js
- * var extend = cu.extend(Parent);
- * Parent.extend(Child);
- *
- * // optional methods
- * Parent.extend(Child, {
- * foo: function() {},
- * bar: function() {}
- * });
- * ```
- * @name #extend
- * @param {Function} `Ctor` constructor to extend
- * @param {Object} `methods` Optional prototype properties to mix in.
- * @return {Object} Returns the `Base` constructor for chaining
- * @api public
- */
- define(Base, 'extend', cu.extend(Base, function (Ctor, Parent) {
- Ctor.prototype.mixins = Ctor.prototype.mixins || [];
- define(Ctor, 'mixin', function (fn) {
- var mixin = fn(Ctor.prototype, Ctor);
- if (typeof mixin === 'function') {
- Ctor.prototype.mixins.push(mixin);
- }
- return Ctor;
- });
- define(Ctor, 'mixins', function (Child) {
- Base.run(Child, 'mixin', Ctor.prototype.mixins);
- return Ctor;
- });
- Ctor.prototype.mixin = function (key, value) {
- Ctor.prototype[key] = value;
- return this;
- };
- return Base;
- }));
- /**
- * Used for adding methods to the `Base` prototype, and/or to the prototype of child instances.
- * When a mixin function returns a function, the returned function is pushed onto the `.mixins`
- * array, making it available to be used on inheriting classes whenever `Base.mixins()` is
- * called (e.g. `Base.mixins(Child)`).
- *
- * ```js
- * Base.mixin(function(proto) {
- * proto.foo = function(msg) {
- * return 'foo ' + msg;
- * };
- * });
- * ```
- * @name #mixin
- * @param {Function} `fn` Function to call
- * @return {Object} Returns the `Base` constructor for chaining
- * @api public
- */
- define(Base, 'mixin', function (fn) {
- var mixin = fn(Base.prototype, Base);
- if (typeof mixin === 'function') {
- Base.prototype.mixins.push(mixin);
- }
- return Base;
- });
- /**
- * Static method for running global mixin functions against a child constructor.
- * Mixins must be registered before calling this method.
- *
- * ```js
- * Base.extend(Child);
- * Base.mixins(Child);
- * ```
- * @name #mixins
- * @param {Function} `Child` Constructor function of a child class
- * @return {Object} Returns the `Base` constructor for chaining
- * @api public
- */
- define(Base, 'mixins', function (Child) {
- Base.run(Child, 'mixin', Base.prototype.mixins);
- return Base;
- });
- /**
- * Similar to `util.inherit`, but copies all static properties, prototype properties, and
- * getters/setters from `Provider` to `Receiver`. See [class-utils][]{#inherit} for more details.
- *
- * ```js
- * Base.inherit(Foo, Bar);
- * ```
- * @name #inherit
- * @param {Function} `Receiver` Receiving (child) constructor
- * @param {Function} `Provider` Providing (parent) constructor
- * @return {Object} Returns the `Base` constructor for chaining
- * @api public
- */
- define(Base, 'inherit', cu.inherit);
- define(Base, 'bubble', cu.bubble);
- return Base;
- }
- /**
- * Expose `Base` with default settings
- */
- module.exports = namespace();
- /**
- * Allow users to define a namespace
- */
- module.exports.namespace = namespace;
- /***/ }),
- /***/ "./node_modules/base/node_modules/component-emitter/index.js":
- /*!*******************************************************************!*\
- !*** ./node_modules/base/node_modules/component-emitter/index.js ***!
- \*******************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /**
- * Expose `Emitter`.
- */
- if (true) {
- module.exports = Emitter;
- }
- /**
- * Initialize a new `Emitter`.
- *
- * @api public
- */
- function Emitter(obj) {
- if (obj) return mixin(obj);
- }
- ;
- /**
- * Mixin the emitter properties.
- *
- * @param {Object} obj
- * @return {Object}
- * @api private
- */
- function mixin(obj) {
- for (var key in Emitter.prototype) {
- obj[key] = Emitter.prototype[key];
- }
- return obj;
- }
- /**
- * Listen on the given `event` with `fn`.
- *
- * @param {String} event
- * @param {Function} fn
- * @return {Emitter}
- * @api public
- */
- Emitter.prototype.on = Emitter.prototype.addEventListener = function (event, fn) {
- this._callbacks = this._callbacks || {};
- (this._callbacks['$' + event] = this._callbacks['$' + event] || []).push(fn);
- return this;
- };
- /**
- * Adds an `event` listener that will be invoked a single
- * time then automatically removed.
- *
- * @param {String} event
- * @param {Function} fn
- * @return {Emitter}
- * @api public
- */
- Emitter.prototype.once = function (event, fn) {
- function on() {
- this.off(event, on);
- fn.apply(this, arguments);
- }
- on.fn = fn;
- this.on(event, on);
- return this;
- };
- /**
- * Remove the given callback for `event` or all
- * registered callbacks.
- *
- * @param {String} event
- * @param {Function} fn
- * @return {Emitter}
- * @api public
- */
- Emitter.prototype.off = Emitter.prototype.removeListener = Emitter.prototype.removeAllListeners = Emitter.prototype.removeEventListener = function (event, fn) {
- this._callbacks = this._callbacks || {}; // all
- if (0 == arguments.length) {
- this._callbacks = {};
- return this;
- } // specific event
- var callbacks = this._callbacks['$' + event];
- if (!callbacks) return this; // remove all handlers
- if (1 == arguments.length) {
- delete this._callbacks['$' + event];
- return this;
- } // remove specific handler
- var cb;
- for (var i = 0; i < callbacks.length; i++) {
- cb = callbacks[i];
- if (cb === fn || cb.fn === fn) {
- callbacks.splice(i, 1);
- break;
- }
- } // Remove event specific arrays for event types that no
- // one is subscribed for to avoid memory leak.
- if (callbacks.length === 0) {
- delete this._callbacks['$' + event];
- }
- return this;
- };
- /**
- * Emit `event` with the given args.
- *
- * @param {String} event
- * @param {Mixed} ...
- * @return {Emitter}
- */
- Emitter.prototype.emit = function (event) {
- this._callbacks = this._callbacks || {};
- var args = new Array(arguments.length - 1),
- callbacks = this._callbacks['$' + event];
- for (var i = 1; i < arguments.length; i++) {
- args[i - 1] = arguments[i];
- }
- if (callbacks) {
- callbacks = callbacks.slice(0);
- for (var i = 0, len = callbacks.length; i < len; ++i) {
- callbacks[i].apply(this, args);
- }
- }
- return this;
- };
- /**
- * Return array of callbacks for `event`.
- *
- * @param {String} event
- * @return {Array}
- * @api public
- */
- Emitter.prototype.listeners = function (event) {
- this._callbacks = this._callbacks || {};
- return this._callbacks['$' + event] || [];
- };
- /**
- * Check if this emitter has `event` handlers.
- *
- * @param {String} event
- * @return {Boolean}
- * @api public
- */
- Emitter.prototype.hasListeners = function (event) {
- return !!this.listeners(event).length;
- };
- /***/ }),
- /***/ "./node_modules/base/node_modules/define-property/index.js":
- /*!*****************************************************************!*\
- !*** ./node_modules/base/node_modules/define-property/index.js ***!
- \*****************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * define-property <https://github.com/jonschlinkert/define-property>
- *
- * Copyright (c) 2015, 2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- var isDescriptor = __webpack_require__(/*! is-descriptor */ "./node_modules/is-descriptor/index.js");
- module.exports = function defineProperty(obj, prop, val) {
- if (_typeof(obj) !== 'object' && typeof obj !== 'function') {
- throw new TypeError('expected an object or function.');
- }
- if (typeof prop !== 'string') {
- throw new TypeError('expected `prop` to be a string.');
- }
- if (isDescriptor(val) && ('set' in val || 'get' in val)) {
- return Object.defineProperty(obj, prop, val);
- }
- return Object.defineProperty(obj, prop, {
- configurable: true,
- enumerable: false,
- writable: true,
- value: val
- });
- };
- /***/ }),
- /***/ "./node_modules/braces/index.js":
- /*!**************************************!*\
- !*** ./node_modules/braces/index.js ***!
- \**************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /**
- * Module dependencies
- */
- var toRegex = __webpack_require__(/*! to-regex */ "./node_modules/to-regex/index.js");
- var unique = __webpack_require__(/*! array-unique */ "./node_modules/array-unique/index.js");
- var extend = __webpack_require__(/*! extend-shallow */ "./node_modules/extend-shallow/index.js");
- /**
- * Local dependencies
- */
- var compilers = __webpack_require__(/*! ./lib/compilers */ "./node_modules/braces/lib/compilers.js");
- var parsers = __webpack_require__(/*! ./lib/parsers */ "./node_modules/braces/lib/parsers.js");
- var Braces = __webpack_require__(/*! ./lib/braces */ "./node_modules/braces/lib/braces.js");
- var utils = __webpack_require__(/*! ./lib/utils */ "./node_modules/braces/lib/utils.js");
- var MAX_LENGTH = 1024 * 64;
- var cache = {};
- /**
- * Convert the given `braces` pattern into a regex-compatible string. By default, only one string is generated for every input string. Set `options.expand` to true to return an array of patterns (similar to Bash or minimatch. Before using `options.expand`, it's recommended that you read the [performance notes](#performance)).
- *
- * ```js
- * var braces = require('braces');
- * console.log(braces('{a,b,c}'));
- * //=> ['(a|b|c)']
- *
- * console.log(braces('{a,b,c}', {expand: true}));
- * //=> ['a', 'b', 'c']
- * ```
- * @param {String} `str`
- * @param {Object} `options`
- * @return {String}
- * @api public
- */
- function braces(pattern, options) {
- var key = utils.createKey(String(pattern), options);
- var arr = [];
- var disabled = options && options.cache === false;
- if (!disabled && cache.hasOwnProperty(key)) {
- return cache[key];
- }
- if (Array.isArray(pattern)) {
- for (var i = 0; i < pattern.length; i++) {
- arr.push.apply(arr, braces.create(pattern[i], options));
- }
- } else {
- arr = braces.create(pattern, options);
- }
- if (options && options.nodupes === true) {
- arr = unique(arr);
- }
- if (!disabled) {
- cache[key] = arr;
- }
- return arr;
- }
- /**
- * Expands a brace pattern into an array. This method is called by the main [braces](#braces) function when `options.expand` is true. Before using this method it's recommended that you read the [performance notes](#performance)) and advantages of using [.optimize](#optimize) instead.
- *
- * ```js
- * var braces = require('braces');
- * console.log(braces.expand('a/{b,c}/d'));
- * //=> ['a/b/d', 'a/c/d'];
- * ```
- * @param {String} `pattern` Brace pattern
- * @param {Object} `options`
- * @return {Array} Returns an array of expanded values.
- * @api public
- */
- braces.expand = function (pattern, options) {
- return braces.create(pattern, extend({}, options, {
- expand: true
- }));
- };
- /**
- * Expands a brace pattern into a regex-compatible, optimized string. This method is called by the main [braces](#braces) function by default.
- *
- * ```js
- * var braces = require('braces');
- * console.log(braces.expand('a/{b,c}/d'));
- * //=> ['a/(b|c)/d']
- * ```
- * @param {String} `pattern` Brace pattern
- * @param {Object} `options`
- * @return {Array} Returns an array of expanded values.
- * @api public
- */
- braces.optimize = function (pattern, options) {
- return braces.create(pattern, options);
- };
- /**
- * Processes a brace pattern and returns either an expanded array (if `options.expand` is true), a highly optimized regex-compatible string. This method is called by the main [braces](#braces) function.
- *
- * ```js
- * var braces = require('braces');
- * console.log(braces.create('user-{200..300}/project-{a,b,c}-{1..10}'))
- * //=> 'user-(20[0-9]|2[1-9][0-9]|300)/project-(a|b|c)-([1-9]|10)'
- * ```
- * @param {String} `pattern` Brace pattern
- * @param {Object} `options`
- * @return {Array} Returns an array of expanded values.
- * @api public
- */
- braces.create = function (pattern, options) {
- if (typeof pattern !== 'string') {
- throw new TypeError('expected a string');
- }
- var maxLength = options && options.maxLength || MAX_LENGTH;
- if (pattern.length >= maxLength) {
- throw new Error('expected pattern to be less than ' + maxLength + ' characters');
- }
- function create() {
- if (pattern === '' || pattern.length < 3) {
- return [pattern];
- }
- if (utils.isEmptySets(pattern)) {
- return [];
- }
- if (utils.isQuotedString(pattern)) {
- return [pattern.slice(1, -1)];
- }
- var proto = new Braces(options);
- var result = !options || options.expand !== true ? proto.optimize(pattern, options) : proto.expand(pattern, options); // get the generated pattern(s)
- var arr = result.output; // filter out empty strings if specified
- if (options && options.noempty === true) {
- arr = arr.filter(Boolean);
- } // filter out duplicates if specified
- if (options && options.nodupes === true) {
- arr = unique(arr);
- }
- Object.defineProperty(arr, 'result', {
- enumerable: false,
- value: result
- });
- return arr;
- }
- return memoize('create', pattern, options, create);
- };
- /**
- * Create a regular expression from the given string `pattern`.
- *
- * ```js
- * var braces = require('braces');
- *
- * console.log(braces.makeRe('id-{200..300}'));
- * //=> /^(?:id-(20[0-9]|2[1-9][0-9]|300))$/
- * ```
- * @param {String} `pattern` The pattern to convert to regex.
- * @param {Object} `options`
- * @return {RegExp}
- * @api public
- */
- braces.makeRe = function (pattern, options) {
- if (typeof pattern !== 'string') {
- throw new TypeError('expected a string');
- }
- var maxLength = options && options.maxLength || MAX_LENGTH;
- if (pattern.length >= maxLength) {
- throw new Error('expected pattern to be less than ' + maxLength + ' characters');
- }
- function makeRe() {
- var arr = braces(pattern, options);
- var opts = extend({
- strictErrors: false
- }, options);
- return toRegex(arr, opts);
- }
- return memoize('makeRe', pattern, options, makeRe);
- };
- /**
- * Parse the given `str` with the given `options`.
- *
- * ```js
- * var braces = require('braces');
- * var ast = braces.parse('a/{b,c}/d');
- * console.log(ast);
- * // { type: 'root',
- * // errors: [],
- * // input: 'a/{b,c}/d',
- * // nodes:
- * // [ { type: 'bos', val: '' },
- * // { type: 'text', val: 'a/' },
- * // { type: 'brace',
- * // nodes:
- * // [ { type: 'brace.open', val: '{' },
- * // { type: 'text', val: 'b,c' },
- * // { type: 'brace.close', val: '}' } ] },
- * // { type: 'text', val: '/d' },
- * // { type: 'eos', val: '' } ] }
- * ```
- * @param {String} `pattern` Brace pattern to parse
- * @param {Object} `options`
- * @return {Object} Returns an AST
- * @api public
- */
- braces.parse = function (pattern, options) {
- var proto = new Braces(options);
- return proto.parse(pattern, options);
- };
- /**
- * Compile the given `ast` or string with the given `options`.
- *
- * ```js
- * var braces = require('braces');
- * var ast = braces.parse('a/{b,c}/d');
- * console.log(braces.compile(ast));
- * // { options: { source: 'string' },
- * // state: {},
- * // compilers:
- * // { eos: [Function],
- * // noop: [Function],
- * // bos: [Function],
- * // brace: [Function],
- * // 'brace.open': [Function],
- * // text: [Function],
- * // 'brace.close': [Function] },
- * // output: [ 'a/(b|c)/d' ],
- * // ast:
- * // { ... },
- * // parsingErrors: [] }
- * ```
- * @param {Object|String} `ast` AST from [.parse](#parse). If a string is passed it will be parsed first.
- * @param {Object} `options`
- * @return {Object} Returns an object that has an `output` property with the compiled string.
- * @api public
- */
- braces.compile = function (ast, options) {
- var proto = new Braces(options);
- return proto.compile(ast, options);
- };
- /**
- * Clear the regex cache.
- *
- * ```js
- * braces.clearCache();
- * ```
- * @api public
- */
- braces.clearCache = function () {
- cache = braces.cache = {};
- };
- /**
- * Memoize a generated regex or function. A unique key is generated
- * from the method name, pattern, and user-defined options. Set
- * options.memoize to false to disable.
- */
- function memoize(type, pattern, options, fn) {
- var key = utils.createKey(type + ':' + pattern, options);
- var disabled = options && options.cache === false;
- if (disabled) {
- braces.clearCache();
- return fn(pattern, options);
- }
- if (cache.hasOwnProperty(key)) {
- return cache[key];
- }
- var res = fn(pattern, options);
- cache[key] = res;
- return res;
- }
- /**
- * Expose `Braces` constructor and methods
- * @type {Function}
- */
- braces.Braces = Braces;
- braces.compilers = compilers;
- braces.parsers = parsers;
- braces.cache = cache;
- /**
- * Expose `braces`
- * @type {Function}
- */
- module.exports = braces;
- /***/ }),
- /***/ "./node_modules/braces/lib/braces.js":
- /*!*******************************************!*\
- !*** ./node_modules/braces/lib/braces.js ***!
- \*******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- var extend = __webpack_require__(/*! extend-shallow */ "./node_modules/extend-shallow/index.js");
- var Snapdragon = __webpack_require__(/*! snapdragon */ "./node_modules/snapdragon/index.js");
- var compilers = __webpack_require__(/*! ./compilers */ "./node_modules/braces/lib/compilers.js");
- var parsers = __webpack_require__(/*! ./parsers */ "./node_modules/braces/lib/parsers.js");
- var utils = __webpack_require__(/*! ./utils */ "./node_modules/braces/lib/utils.js");
- /**
- * Customize Snapdragon parser and renderer
- */
- function Braces(options) {
- this.options = extend({}, options);
- }
- /**
- * Initialize braces
- */
- Braces.prototype.init = function (options) {
- if (this.isInitialized) return;
- this.isInitialized = true;
- var opts = utils.createOptions({}, this.options, options);
- this.snapdragon = this.options.snapdragon || new Snapdragon(opts);
- this.compiler = this.snapdragon.compiler;
- this.parser = this.snapdragon.parser;
- compilers(this.snapdragon, opts);
- parsers(this.snapdragon, opts);
- /**
- * Call Snapdragon `.parse` method. When AST is returned, we check to
- * see if any unclosed braces are left on the stack and, if so, we iterate
- * over the stack and correct the AST so that compilers are called in the correct
- * order and unbalance braces are properly escaped.
- */
- utils.define(this.snapdragon, 'parse', function (pattern, options) {
- var parsed = Snapdragon.prototype.parse.apply(this, arguments);
- this.parser.ast.input = pattern;
- var stack = this.parser.stack;
- while (stack.length) {
- addParent({
- type: 'brace.close',
- val: ''
- }, stack.pop());
- }
- function addParent(node, parent) {
- utils.define(node, 'parent', parent);
- parent.nodes.push(node);
- } // add non-enumerable parser reference
- utils.define(parsed, 'parser', this.parser);
- return parsed;
- });
- };
- /**
- * Decorate `.parse` method
- */
- Braces.prototype.parse = function (ast, options) {
- if (ast && _typeof(ast) === 'object' && ast.nodes) return ast;
- this.init(options);
- return this.snapdragon.parse(ast, options);
- };
- /**
- * Decorate `.compile` method
- */
- Braces.prototype.compile = function (ast, options) {
- if (typeof ast === 'string') {
- ast = this.parse(ast, options);
- } else {
- this.init(options);
- }
- return this.snapdragon.compile(ast, options);
- };
- /**
- * Expand
- */
- Braces.prototype.expand = function (pattern) {
- var ast = this.parse(pattern, {
- expand: true
- });
- return this.compile(ast, {
- expand: true
- });
- };
- /**
- * Optimize
- */
- Braces.prototype.optimize = function (pattern) {
- var ast = this.parse(pattern, {
- optimize: true
- });
- return this.compile(ast, {
- optimize: true
- });
- };
- /**
- * Expose `Braces`
- */
- module.exports = Braces;
- /***/ }),
- /***/ "./node_modules/braces/lib/compilers.js":
- /*!**********************************************!*\
- !*** ./node_modules/braces/lib/compilers.js ***!
- \**********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var utils = __webpack_require__(/*! ./utils */ "./node_modules/braces/lib/utils.js");
- module.exports = function (braces, options) {
- braces.compiler
- /**
- * bos
- */
- .set('bos', function () {
- if (this.output) return;
- this.ast.queue = isEscaped(this.ast) ? [this.ast.val] : [];
- this.ast.count = 1;
- })
- /**
- * Square brackets
- */
- .set('bracket', function (node) {
- var close = node.close;
- var open = !node.escaped ? '[' : '\\[';
- var negated = node.negated;
- var inner = node.inner;
- inner = inner.replace(/\\(?=[\\\w]|$)/g, '\\\\');
- if (inner === ']-') {
- inner = '\\]\\-';
- }
- if (negated && inner.indexOf('.') === -1) {
- inner += '.';
- }
- if (negated && inner.indexOf('/') === -1) {
- inner += '/';
- }
- var val = open + negated + inner + close;
- var queue = node.parent.queue;
- var last = utils.arrayify(queue.pop());
- queue.push(utils.join(last, val));
- queue.push.apply(queue, []);
- })
- /**
- * Brace
- */
- .set('brace', function (node) {
- node.queue = isEscaped(node) ? [node.val] : [];
- node.count = 1;
- return this.mapVisit(node.nodes);
- })
- /**
- * Open
- */
- .set('brace.open', function (node) {
- node.parent.open = node.val;
- })
- /**
- * Inner
- */
- .set('text', function (node) {
- var queue = node.parent.queue;
- var escaped = node.escaped;
- var segs = [node.val];
- if (node.optimize === false) {
- options = utils.extend({}, options, {
- optimize: false
- });
- }
- if (node.multiplier > 1) {
- node.parent.count *= node.multiplier;
- }
- if (options.quantifiers === true && utils.isQuantifier(node.val)) {
- escaped = true;
- } else if (node.val.length > 1) {
- if (isType(node.parent, 'brace') && !isEscaped(node)) {
- var expanded = utils.expand(node.val, options);
- segs = expanded.segs;
- if (expanded.isOptimized) {
- node.parent.isOptimized = true;
- } // if nothing was expanded, we probably have a literal brace
- if (!segs.length) {
- var val = expanded.val || node.val;
- if (options.unescape !== false) {
- // unescape unexpanded brace sequence/set separators
- val = val.replace(/\\([,.])/g, '$1'); // strip quotes
- val = val.replace(/["'`]/g, '');
- }
- segs = [val];
- escaped = true;
- }
- }
- } else if (node.val === ',') {
- if (options.expand) {
- node.parent.queue.push(['']);
- segs = [''];
- } else {
- segs = ['|'];
- }
- } else {
- escaped = true;
- }
- if (escaped && isType(node.parent, 'brace')) {
- if (node.parent.nodes.length <= 4 && node.parent.count === 1) {
- node.parent.escaped = true;
- } else if (node.parent.length <= 3) {
- node.parent.escaped = true;
- }
- }
- if (!hasQueue(node.parent)) {
- node.parent.queue = segs;
- return;
- }
- var last = utils.arrayify(queue.pop());
- if (node.parent.count > 1 && options.expand) {
- last = multiply(last, node.parent.count);
- node.parent.count = 1;
- }
- queue.push(utils.join(utils.flatten(last), segs.shift()));
- queue.push.apply(queue, segs);
- })
- /**
- * Close
- */
- .set('brace.close', function (node) {
- var queue = node.parent.queue;
- var prev = node.parent.parent;
- var last = prev.queue.pop();
- var open = node.parent.open;
- var close = node.val;
- if (open && close && isOptimized(node, options)) {
- open = '(';
- close = ')';
- } // if a close brace exists, and the previous segment is one character
- // don't wrap the result in braces or parens
- var ele = utils.last(queue);
- if (node.parent.count > 1 && options.expand) {
- ele = multiply(queue.pop(), node.parent.count);
- node.parent.count = 1;
- queue.push(ele);
- }
- if (close && typeof ele === 'string' && ele.length === 1) {
- open = '';
- close = '';
- }
- if ((isLiteralBrace(node, options) || noInner(node)) && !node.parent.hasEmpty) {
- queue.push(utils.join(open, queue.pop() || ''));
- queue = utils.flatten(utils.join(queue, close));
- }
- if (typeof last === 'undefined') {
- prev.queue = [queue];
- } else {
- prev.queue.push(utils.flatten(utils.join(last, queue)));
- }
- })
- /**
- * eos
- */
- .set('eos', function (node) {
- if (this.input) return;
- if (options.optimize !== false) {
- this.output = utils.last(utils.flatten(this.ast.queue));
- } else if (Array.isArray(utils.last(this.ast.queue))) {
- this.output = utils.flatten(this.ast.queue.pop());
- } else {
- this.output = utils.flatten(this.ast.queue);
- }
- if (node.parent.count > 1 && options.expand) {
- this.output = multiply(this.output, node.parent.count);
- }
- this.output = utils.arrayify(this.output);
- this.ast.queue = [];
- });
- };
- /**
- * Multiply the segments in the current brace level
- */
- function multiply(queue, n, options) {
- return utils.flatten(utils.repeat(utils.arrayify(queue), n));
- }
- /**
- * Return true if `node` is escaped
- */
- function isEscaped(node) {
- return node.escaped === true;
- }
- /**
- * Returns true if regex parens should be used for sets. If the parent `type`
- * is not `brace`, then we're on a root node, which means we should never
- * expand segments and open/close braces should be `{}` (since this indicates
- * a brace is missing from the set)
- */
- function isOptimized(node, options) {
- if (node.parent.isOptimized) return true;
- return isType(node.parent, 'brace') && !isEscaped(node.parent) && options.expand !== true;
- }
- /**
- * Returns true if the value in `node` should be wrapped in a literal brace.
- * @return {Boolean}
- */
- function isLiteralBrace(node, options) {
- return isEscaped(node.parent) || options.optimize !== false;
- }
- /**
- * Returns true if the given `node` does not have an inner value.
- * @return {Boolean}
- */
- function noInner(node, type) {
- if (node.parent.queue.length === 1) {
- return true;
- }
- var nodes = node.parent.nodes;
- return nodes.length === 3 && isType(nodes[0], 'brace.open') && !isType(nodes[1], 'text') && isType(nodes[2], 'brace.close');
- }
- /**
- * Returns true if the given `node` is the given `type`
- * @return {Boolean}
- */
- function isType(node, type) {
- return typeof node !== 'undefined' && node.type === type;
- }
- /**
- * Returns true if the given `node` has a non-empty queue.
- * @return {Boolean}
- */
- function hasQueue(node) {
- return Array.isArray(node.queue) && node.queue.length;
- }
- /***/ }),
- /***/ "./node_modules/braces/lib/parsers.js":
- /*!********************************************!*\
- !*** ./node_modules/braces/lib/parsers.js ***!
- \********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var Node = __webpack_require__(/*! snapdragon-node */ "./node_modules/snapdragon-node/index.js");
- var utils = __webpack_require__(/*! ./utils */ "./node_modules/braces/lib/utils.js");
- /**
- * Braces parsers
- */
- module.exports = function (braces, options) {
- braces.parser.set('bos', function () {
- if (!this.parsed) {
- this.ast = this.nodes[0] = new Node(this.ast);
- }
- })
- /**
- * Character parsers
- */
- .set('escape', function () {
- var pos = this.position();
- var m = this.match(/^(?:\\(.)|\$\{)/);
- if (!m) return;
- var prev = this.prev();
- var last = utils.last(prev.nodes);
- var node = pos(new Node({
- type: 'text',
- multiplier: 1,
- val: m[0]
- }));
- if (node.val === '\\\\') {
- return node;
- }
- if (node.val === '${') {
- var str = this.input;
- var idx = -1;
- var ch;
- while (ch = str[++idx]) {
- this.consume(1);
- node.val += ch;
- if (ch === '\\') {
- node.val += str[++idx];
- continue;
- }
- if (ch === '}') {
- break;
- }
- }
- }
- if (this.options.unescape !== false) {
- node.val = node.val.replace(/\\([{}])/g, '$1');
- }
- if (last.val === '"' && this.input.charAt(0) === '"') {
- last.val = node.val;
- this.consume(1);
- return;
- }
- return concatNodes.call(this, pos, node, prev, options);
- })
- /**
- * Brackets: "[...]" (basic, this is overridden by
- * other parsers in more advanced implementations)
- */
- .set('bracket', function () {
- var isInside = this.isInside('brace');
- var pos = this.position();
- var m = this.match(/^(?:\[([!^]?)([^\]]{2,}|\]-)(\]|[^*+?]+)|\[)/);
- if (!m) return;
- var prev = this.prev();
- var val = m[0];
- var negated = m[1] ? '^' : '';
- var inner = m[2] || '';
- var close = m[3] || '';
- if (isInside && prev.type === 'brace') {
- prev.text = prev.text || '';
- prev.text += val;
- }
- var esc = this.input.slice(0, 2);
- if (inner === '' && esc === '\\]') {
- inner += esc;
- this.consume(2);
- var str = this.input;
- var idx = -1;
- var ch;
- while (ch = str[++idx]) {
- this.consume(1);
- if (ch === ']') {
- close = ch;
- break;
- }
- inner += ch;
- }
- }
- return pos(new Node({
- type: 'bracket',
- val: val,
- escaped: close !== ']',
- negated: negated,
- inner: inner,
- close: close
- }));
- })
- /**
- * Empty braces (we capture these early to
- * speed up processing in the compiler)
- */
- .set('multiplier', function () {
- var isInside = this.isInside('brace');
- var pos = this.position();
- var m = this.match(/^\{((?:,|\{,+\})+)\}/);
- if (!m) return;
- this.multiplier = true;
- var prev = this.prev();
- var val = m[0];
- if (isInside && prev.type === 'brace') {
- prev.text = prev.text || '';
- prev.text += val;
- }
- var node = pos(new Node({
- type: 'text',
- multiplier: 1,
- match: m,
- val: val
- }));
- return concatNodes.call(this, pos, node, prev, options);
- })
- /**
- * Open
- */
- .set('brace.open', function () {
- var pos = this.position();
- var m = this.match(/^\{(?!(?:[^\\}]?|,+)\})/);
- if (!m) return;
- var prev = this.prev();
- var last = utils.last(prev.nodes); // if the last parsed character was an extglob character
- // we need to _not optimize_ the brace pattern because
- // it might be mistaken for an extglob by a downstream parser
- if (last && last.val && isExtglobChar(last.val.slice(-1))) {
- last.optimize = false;
- }
- var open = pos(new Node({
- type: 'brace.open',
- val: m[0]
- }));
- var node = pos(new Node({
- type: 'brace',
- nodes: []
- }));
- node.push(open);
- prev.push(node);
- this.push('brace', node);
- })
- /**
- * Close
- */
- .set('brace.close', function () {
- var pos = this.position();
- var m = this.match(/^\}/);
- if (!m || !m[0]) return;
- var brace = this.pop('brace');
- var node = pos(new Node({
- type: 'brace.close',
- val: m[0]
- }));
- if (!this.isType(brace, 'brace')) {
- if (this.options.strict) {
- throw new Error('missing opening "{"');
- }
- node.type = 'text';
- node.multiplier = 0;
- node.escaped = true;
- return node;
- }
- var prev = this.prev();
- var last = utils.last(prev.nodes);
- if (last.text) {
- var lastNode = utils.last(last.nodes);
- if (lastNode.val === ')' && /[!@*?+]\(/.test(last.text)) {
- var open = last.nodes[0];
- var text = last.nodes[1];
- if (open.type === 'brace.open' && text && text.type === 'text') {
- text.optimize = false;
- }
- }
- }
- if (brace.nodes.length > 2) {
- var first = brace.nodes[1];
- if (first.type === 'text' && first.val === ',') {
- brace.nodes.splice(1, 1);
- brace.nodes.push(first);
- }
- }
- brace.push(node);
- })
- /**
- * Capture boundary characters
- */
- .set('boundary', function () {
- var pos = this.position();
- var m = this.match(/^[$^](?!\{)/);
- if (!m) return;
- return pos(new Node({
- type: 'text',
- val: m[0]
- }));
- })
- /**
- * One or zero, non-comma characters wrapped in braces
- */
- .set('nobrace', function () {
- var isInside = this.isInside('brace');
- var pos = this.position();
- var m = this.match(/^\{[^,]?\}/);
- if (!m) return;
- var prev = this.prev();
- var val = m[0];
- if (isInside && prev.type === 'brace') {
- prev.text = prev.text || '';
- prev.text += val;
- }
- return pos(new Node({
- type: 'text',
- multiplier: 0,
- val: val
- }));
- })
- /**
- * Text
- */
- .set('text', function () {
- var isInside = this.isInside('brace');
- var pos = this.position();
- var m = this.match(/^((?!\\)[^${}[\]])+/);
- if (!m) return;
- var prev = this.prev();
- var val = m[0];
- if (isInside && prev.type === 'brace') {
- prev.text = prev.text || '';
- prev.text += val;
- }
- var node = pos(new Node({
- type: 'text',
- multiplier: 1,
- val: val
- }));
- return concatNodes.call(this, pos, node, prev, options);
- });
- };
- /**
- * Returns true if the character is an extglob character.
- */
- function isExtglobChar(ch) {
- return ch === '!' || ch === '@' || ch === '*' || ch === '?' || ch === '+';
- }
- /**
- * Combine text nodes, and calculate empty sets (`{,,}`)
- * @param {Function} `pos` Function to calculate node position
- * @param {Object} `node` AST node
- * @return {Object}
- */
- function concatNodes(pos, node, parent, options) {
- node.orig = node.val;
- var prev = this.prev();
- var last = utils.last(prev.nodes);
- var isEscaped = false;
- if (node.val.length > 1) {
- var a = node.val.charAt(0);
- var b = node.val.slice(-1);
- isEscaped = a === '"' && b === '"' || a === "'" && b === "'" || a === '`' && b === '`';
- }
- if (isEscaped && options.unescape !== false) {
- node.val = node.val.slice(1, node.val.length - 1);
- node.escaped = true;
- }
- if (node.match) {
- var match = node.match[1];
- if (!match || match.indexOf('}') === -1) {
- match = node.match[0];
- } // replace each set with a single ","
- var val = match.replace(/\{/g, ',').replace(/\}/g, '');
- node.multiplier *= val.length;
- node.val = '';
- }
- var simpleText = last.type === 'text' && last.multiplier === 1 && node.multiplier === 1 && node.val;
- if (simpleText) {
- last.val += node.val;
- return;
- }
- prev.push(node);
- }
- /***/ }),
- /***/ "./node_modules/braces/lib/utils.js":
- /*!******************************************!*\
- !*** ./node_modules/braces/lib/utils.js ***!
- \******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var splitString = __webpack_require__(/*! split-string */ "./node_modules/split-string/index.js");
- var utils = module.exports;
- /**
- * Module dependencies
- */
- utils.extend = __webpack_require__(/*! extend-shallow */ "./node_modules/extend-shallow/index.js");
- utils.flatten = __webpack_require__(/*! arr-flatten */ "./node_modules/arr-flatten/index.js");
- utils.isObject = __webpack_require__(/*! isobject */ "./node_modules/isobject/index.js");
- utils.fillRange = __webpack_require__(/*! fill-range */ "./node_modules/fill-range/index.js");
- utils.repeat = __webpack_require__(/*! repeat-element */ "./node_modules/repeat-element/index.js");
- utils.unique = __webpack_require__(/*! array-unique */ "./node_modules/array-unique/index.js");
- utils.define = function (obj, key, val) {
- Object.defineProperty(obj, key, {
- writable: true,
- configurable: true,
- enumerable: false,
- value: val
- });
- };
- /**
- * Returns true if the given string contains only empty brace sets.
- */
- utils.isEmptySets = function (str) {
- return /^(?:\{,\})+$/.test(str);
- };
- /**
- * Returns true if the given string contains only empty brace sets.
- */
- utils.isQuotedString = function (str) {
- var open = str.charAt(0);
- if (open === '\'' || open === '"' || open === '`') {
- return str.slice(-1) === open;
- }
- return false;
- };
- /**
- * Create the key to use for memoization. The unique key is generated
- * by iterating over the options and concatenating key-value pairs
- * to the pattern string.
- */
- utils.createKey = function (pattern, options) {
- var id = pattern;
- if (typeof options === 'undefined') {
- return id;
- }
- var keys = Object.keys(options);
- for (var i = 0; i < keys.length; i++) {
- var key = keys[i];
- id += ';' + key + '=' + String(options[key]);
- }
- return id;
- };
- /**
- * Normalize options
- */
- utils.createOptions = function (options) {
- var opts = utils.extend.apply(null, arguments);
- if (typeof opts.expand === 'boolean') {
- opts.optimize = !opts.expand;
- }
- if (typeof opts.optimize === 'boolean') {
- opts.expand = !opts.optimize;
- }
- if (opts.optimize === true) {
- opts.makeRe = true;
- }
- return opts;
- };
- /**
- * Join patterns in `a` to patterns in `b`
- */
- utils.join = function (a, b, options) {
- options = options || {};
- a = utils.arrayify(a);
- b = utils.arrayify(b);
- if (!a.length) return b;
- if (!b.length) return a;
- var len = a.length;
- var idx = -1;
- var arr = [];
- while (++idx < len) {
- var val = a[idx];
- if (Array.isArray(val)) {
- for (var i = 0; i < val.length; i++) {
- val[i] = utils.join(val[i], b, options);
- }
- arr.push(val);
- continue;
- }
- for (var j = 0; j < b.length; j++) {
- var bval = b[j];
- if (Array.isArray(bval)) {
- arr.push(utils.join(val, bval, options));
- } else {
- arr.push(val + bval);
- }
- }
- }
- return arr;
- };
- /**
- * Split the given string on `,` if not escaped.
- */
- utils.split = function (str, options) {
- var opts = utils.extend({
- sep: ','
- }, options);
- if (typeof opts.keepQuotes !== 'boolean') {
- opts.keepQuotes = true;
- }
- if (opts.unescape === false) {
- opts.keepEscaping = true;
- }
- return splitString(str, opts, utils.escapeBrackets(opts));
- };
- /**
- * Expand ranges or sets in the given `pattern`.
- *
- * @param {String} `str`
- * @param {Object} `options`
- * @return {Object}
- */
- utils.expand = function (str, options) {
- var opts = utils.extend({
- rangeLimit: 10000
- }, options);
- var segs = utils.split(str, opts);
- var tok = {
- segs: segs
- };
- if (utils.isQuotedString(str)) {
- return tok;
- }
- if (opts.rangeLimit === true) {
- opts.rangeLimit = 10000;
- }
- if (segs.length > 1) {
- if (opts.optimize === false) {
- tok.val = segs[0];
- return tok;
- }
- tok.segs = utils.stringifyArray(tok.segs);
- } else if (segs.length === 1) {
- var arr = str.split('..');
- if (arr.length === 1) {
- tok.val = tok.segs[tok.segs.length - 1] || tok.val || str;
- tok.segs = [];
- return tok;
- }
- if (arr.length === 2 && arr[0] === arr[1]) {
- tok.escaped = true;
- tok.val = arr[0];
- tok.segs = [];
- return tok;
- }
- if (arr.length > 1) {
- if (opts.optimize !== false) {
- opts.optimize = true;
- delete opts.expand;
- }
- if (opts.optimize !== true) {
- var min = Math.min(arr[0], arr[1]);
- var max = Math.max(arr[0], arr[1]);
- var step = arr[2] || 1;
- if (opts.rangeLimit !== false && (max - min) / step >= opts.rangeLimit) {
- throw new RangeError('expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.');
- }
- }
- arr.push(opts);
- tok.segs = utils.fillRange.apply(null, arr);
- if (!tok.segs.length) {
- tok.escaped = true;
- tok.val = str;
- return tok;
- }
- if (opts.optimize === true) {
- tok.segs = utils.stringifyArray(tok.segs);
- }
- if (tok.segs === '') {
- tok.val = str;
- } else {
- tok.val = tok.segs[0];
- }
- return tok;
- }
- } else {
- tok.val = str;
- }
- return tok;
- };
- /**
- * Ensure commas inside brackets and parens are not split.
- * @param {Object} `tok` Token from the `split-string` module
- * @return {undefined}
- */
- utils.escapeBrackets = function (options) {
- return function (tok) {
- if (tok.escaped && tok.val === 'b') {
- tok.val = '\\b';
- return;
- }
- if (tok.val !== '(' && tok.val !== '[') return;
- var opts = utils.extend({}, options);
- var brackets = [];
- var parens = [];
- var stack = [];
- var val = tok.val;
- var str = tok.str;
- var i = tok.idx - 1;
- while (++i < str.length) {
- var ch = str[i];
- if (ch === '\\') {
- val += (opts.keepEscaping === false ? '' : ch) + str[++i];
- continue;
- }
- if (ch === '(') {
- parens.push(ch);
- stack.push(ch);
- }
- if (ch === '[') {
- brackets.push(ch);
- stack.push(ch);
- }
- if (ch === ')') {
- parens.pop();
- stack.pop();
- if (!stack.length) {
- val += ch;
- break;
- }
- }
- if (ch === ']') {
- brackets.pop();
- stack.pop();
- if (!stack.length) {
- val += ch;
- break;
- }
- }
- val += ch;
- }
- tok.split = false;
- tok.val = val.slice(1);
- tok.idx = i;
- };
- };
- /**
- * Returns true if the given string looks like a regex quantifier
- * @return {Boolean}
- */
- utils.isQuantifier = function (str) {
- return /^(?:[0-9]?,[0-9]|[0-9],)$/.test(str);
- };
- /**
- * Cast `val` to an array.
- * @param {*} `val`
- */
- utils.stringifyArray = function (arr) {
- return [utils.arrayify(arr).join('|')];
- };
- /**
- * Cast `val` to an array.
- * @param {*} `val`
- */
- utils.arrayify = function (arr) {
- if (typeof arr === 'undefined') {
- return [];
- }
- if (typeof arr === 'string') {
- return [arr];
- }
- return arr;
- };
- /**
- * Returns true if the given `str` is a non-empty string
- * @return {Boolean}
- */
- utils.isString = function (str) {
- return str != null && typeof str === 'string';
- };
- /**
- * Get the last element from `array`
- * @param {Array} `array`
- * @return {*}
- */
- utils.last = function (arr, n) {
- return arr[arr.length - (n || 1)];
- };
- utils.escapeRegex = function (str) {
- return str.replace(/\\?([!^*?()[\]{}+?/])/g, '\\$1');
- };
- /***/ }),
- /***/ "./node_modules/cache-base/index.js":
- /*!******************************************!*\
- !*** ./node_modules/cache-base/index.js ***!
- \******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var isObject = __webpack_require__(/*! isobject */ "./node_modules/isobject/index.js");
- var Emitter = __webpack_require__(/*! component-emitter */ "./node_modules/cache-base/node_modules/component-emitter/index.js");
- var visit = __webpack_require__(/*! collection-visit */ "./node_modules/collection-visit/index.js");
- var toPath = __webpack_require__(/*! to-object-path */ "./node_modules/to-object-path/index.js");
- var union = __webpack_require__(/*! union-value */ "./node_modules/union-value/index.js");
- var del = __webpack_require__(/*! unset-value */ "./node_modules/unset-value/index.js");
- var get = __webpack_require__(/*! get-value */ "./node_modules/get-value/index.js");
- var has = __webpack_require__(/*! has-value */ "./node_modules/has-value/index.js");
- var set = __webpack_require__(/*! set-value */ "./node_modules/set-value/index.js");
- /**
- * Create a `Cache` constructor that when instantiated will
- * store values on the given `prop`.
- *
- * ```js
- * var Cache = require('cache-base').namespace('data');
- * var cache = new Cache();
- *
- * cache.set('foo', 'bar');
- * //=> {data: {foo: 'bar'}}
- * ```
- * @param {String} `prop` The property name to use for storing values.
- * @return {Function} Returns a custom `Cache` constructor
- * @api public
- */
- function namespace(prop) {
- /**
- * Create a new `Cache`. Internally the `Cache` constructor is created using
- * the `namespace` function, with `cache` defined as the storage object.
- *
- * ```js
- * var app = new Cache();
- * ```
- * @param {Object} `cache` Optionally pass an object to initialize with.
- * @constructor
- * @api public
- */
- function Cache(cache) {
- if (prop) {
- this[prop] = {};
- }
- if (cache) {
- this.set(cache);
- }
- }
- /**
- * Inherit Emitter
- */
- Emitter(Cache.prototype);
- /**
- * Assign `value` to `key`. Also emits `set` with
- * the key and value.
- *
- * ```js
- * app.on('set', function(key, val) {
- * // do something when `set` is emitted
- * });
- *
- * app.set(key, value);
- *
- * // also takes an object or array
- * app.set({name: 'Halle'});
- * app.set([{foo: 'bar'}, {baz: 'quux'}]);
- * console.log(app);
- * //=> {name: 'Halle', foo: 'bar', baz: 'quux'}
- * ```
- *
- * @name .set
- * @emits `set` with `key` and `value` as arguments.
- * @param {String} `key`
- * @param {any} `value`
- * @return {Object} Returns the instance for chaining.
- * @api public
- */
- Cache.prototype.set = function (key, val) {
- if (Array.isArray(key) && arguments.length === 2) {
- key = toPath(key);
- }
- if (isObject(key) || Array.isArray(key)) {
- this.visit('set', key);
- } else {
- set(prop ? this[prop] : this, key, val);
- this.emit('set', key, val);
- }
- return this;
- };
- /**
- * Union `array` to `key`. Also emits `set` with
- * the key and value.
- *
- * ```js
- * app.union('a.b', ['foo']);
- * app.union('a.b', ['bar']);
- * console.log(app.get('a'));
- * //=> {b: ['foo', 'bar']}
- * ```
- * @name .union
- * @param {String} `key`
- * @param {any} `value`
- * @return {Object} Returns the instance for chaining.
- * @api public
- */
- Cache.prototype.union = function (key, val) {
- if (Array.isArray(key) && arguments.length === 2) {
- key = toPath(key);
- }
- var ctx = prop ? this[prop] : this;
- union(ctx, key, arrayify(val));
- this.emit('union', val);
- return this;
- };
- /**
- * Return the value of `key`. Dot notation may be used
- * to get [nested property values][get-value].
- *
- * ```js
- * app.set('a.b.c', 'd');
- * app.get('a.b');
- * //=> {c: 'd'}
- *
- * app.get(['a', 'b']);
- * //=> {c: 'd'}
- * ```
- *
- * @name .get
- * @emits `get` with `key` and `value` as arguments.
- * @param {String} `key` The name of the property to get. Dot-notation may be used.
- * @return {any} Returns the value of `key`
- * @api public
- */
- Cache.prototype.get = function (key) {
- key = toPath(arguments);
- var ctx = prop ? this[prop] : this;
- var val = get(ctx, key);
- this.emit('get', key, val);
- return val;
- };
- /**
- * Return true if app has a stored value for `key`,
- * false only if value is `undefined`.
- *
- * ```js
- * app.set('foo', 'bar');
- * app.has('foo');
- * //=> true
- * ```
- *
- * @name .has
- * @emits `has` with `key` and true or false as arguments.
- * @param {String} `key`
- * @return {Boolean}
- * @api public
- */
- Cache.prototype.has = function (key) {
- key = toPath(arguments);
- var ctx = prop ? this[prop] : this;
- var val = get(ctx, key);
- var has = typeof val !== 'undefined';
- this.emit('has', key, has);
- return has;
- };
- /**
- * Delete one or more properties from the instance.
- *
- * ```js
- * app.del(); // delete all
- * // or
- * app.del('foo');
- * // or
- * app.del(['foo', 'bar']);
- * ```
- * @name .del
- * @emits `del` with the `key` as the only argument.
- * @param {String|Array} `key` Property name or array of property names.
- * @return {Object} Returns the instance for chaining.
- * @api public
- */
- Cache.prototype.del = function (key) {
- if (Array.isArray(key)) {
- this.visit('del', key);
- } else {
- del(prop ? this[prop] : this, key);
- this.emit('del', key);
- }
- return this;
- };
- /**
- * Reset the entire cache to an empty object.
- *
- * ```js
- * app.clear();
- * ```
- * @api public
- */
- Cache.prototype.clear = function () {
- if (prop) {
- this[prop] = {};
- }
- };
- /**
- * Visit `method` over the properties in the given object, or map
- * visit over the object-elements in an array.
- *
- * @name .visit
- * @param {String} `method` The name of the `base` method to call.
- * @param {Object|Array} `val` The object or array to iterate over.
- * @return {Object} Returns the instance for chaining.
- * @api public
- */
- Cache.prototype.visit = function (method, val) {
- visit(this, method, val);
- return this;
- };
- return Cache;
- }
- /**
- * Cast val to an array
- */
- function arrayify(val) {
- return val ? Array.isArray(val) ? val : [val] : [];
- }
- /**
- * Expose `Cache`
- */
- module.exports = namespace();
- /**
- * Expose `Cache.namespace`
- */
- module.exports.namespace = namespace;
- /***/ }),
- /***/ "./node_modules/cache-base/node_modules/component-emitter/index.js":
- /*!*************************************************************************!*\
- !*** ./node_modules/cache-base/node_modules/component-emitter/index.js ***!
- \*************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /**
- * Expose `Emitter`.
- */
- if (true) {
- module.exports = Emitter;
- }
- /**
- * Initialize a new `Emitter`.
- *
- * @api public
- */
- function Emitter(obj) {
- if (obj) return mixin(obj);
- }
- ;
- /**
- * Mixin the emitter properties.
- *
- * @param {Object} obj
- * @return {Object}
- * @api private
- */
- function mixin(obj) {
- for (var key in Emitter.prototype) {
- obj[key] = Emitter.prototype[key];
- }
- return obj;
- }
- /**
- * Listen on the given `event` with `fn`.
- *
- * @param {String} event
- * @param {Function} fn
- * @return {Emitter}
- * @api public
- */
- Emitter.prototype.on = Emitter.prototype.addEventListener = function (event, fn) {
- this._callbacks = this._callbacks || {};
- (this._callbacks['$' + event] = this._callbacks['$' + event] || []).push(fn);
- return this;
- };
- /**
- * Adds an `event` listener that will be invoked a single
- * time then automatically removed.
- *
- * @param {String} event
- * @param {Function} fn
- * @return {Emitter}
- * @api public
- */
- Emitter.prototype.once = function (event, fn) {
- function on() {
- this.off(event, on);
- fn.apply(this, arguments);
- }
- on.fn = fn;
- this.on(event, on);
- return this;
- };
- /**
- * Remove the given callback for `event` or all
- * registered callbacks.
- *
- * @param {String} event
- * @param {Function} fn
- * @return {Emitter}
- * @api public
- */
- Emitter.prototype.off = Emitter.prototype.removeListener = Emitter.prototype.removeAllListeners = Emitter.prototype.removeEventListener = function (event, fn) {
- this._callbacks = this._callbacks || {}; // all
- if (0 == arguments.length) {
- this._callbacks = {};
- return this;
- } // specific event
- var callbacks = this._callbacks['$' + event];
- if (!callbacks) return this; // remove all handlers
- if (1 == arguments.length) {
- delete this._callbacks['$' + event];
- return this;
- } // remove specific handler
- var cb;
- for (var i = 0; i < callbacks.length; i++) {
- cb = callbacks[i];
- if (cb === fn || cb.fn === fn) {
- callbacks.splice(i, 1);
- break;
- }
- } // Remove event specific arrays for event types that no
- // one is subscribed for to avoid memory leak.
- if (callbacks.length === 0) {
- delete this._callbacks['$' + event];
- }
- return this;
- };
- /**
- * Emit `event` with the given args.
- *
- * @param {String} event
- * @param {Mixed} ...
- * @return {Emitter}
- */
- Emitter.prototype.emit = function (event) {
- this._callbacks = this._callbacks || {};
- var args = new Array(arguments.length - 1),
- callbacks = this._callbacks['$' + event];
- for (var i = 1; i < arguments.length; i++) {
- args[i - 1] = arguments[i];
- }
- if (callbacks) {
- callbacks = callbacks.slice(0);
- for (var i = 0, len = callbacks.length; i < len; ++i) {
- callbacks[i].apply(this, args);
- }
- }
- return this;
- };
- /**
- * Return array of callbacks for `event`.
- *
- * @param {String} event
- * @return {Array}
- * @api public
- */
- Emitter.prototype.listeners = function (event) {
- this._callbacks = this._callbacks || {};
- return this._callbacks['$' + event] || [];
- };
- /**
- * Check if this emitter has `event` handlers.
- *
- * @param {String} event
- * @return {Boolean}
- * @api public
- */
- Emitter.prototype.hasListeners = function (event) {
- return !!this.listeners(event).length;
- };
- /***/ }),
- /***/ "./node_modules/class-utils/index.js":
- /*!*******************************************!*\
- !*** ./node_modules/class-utils/index.js ***!
- \*******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var util = __webpack_require__(/*! util */ "./node_modules/util/util.js");
- var union = __webpack_require__(/*! arr-union */ "./node_modules/arr-union/index.js");
- var define = __webpack_require__(/*! define-property */ "./node_modules/define-property/index.js");
- var staticExtend = __webpack_require__(/*! static-extend */ "./node_modules/static-extend/index.js");
- var isObj = __webpack_require__(/*! isobject */ "./node_modules/isobject/index.js");
- /**
- * Expose class utils
- */
- var cu = module.exports;
- /**
- * Expose class utils: `cu`
- */
- cu.isObject = function isObject(val) {
- return isObj(val) || typeof val === 'function';
- };
- /**
- * Returns true if an array has any of the given elements, or an
- * object has any of the give keys.
- *
- * ```js
- * cu.has(['a', 'b', 'c'], 'c');
- * //=> true
- *
- * cu.has(['a', 'b', 'c'], ['c', 'z']);
- * //=> true
- *
- * cu.has({a: 'b', c: 'd'}, ['c', 'z']);
- * //=> true
- * ```
- * @param {Object} `obj`
- * @param {String|Array} `val`
- * @return {Boolean}
- * @api public
- */
- cu.has = function has(obj, val) {
- val = cu.arrayify(val);
- var len = val.length;
- if (cu.isObject(obj)) {
- for (var key in obj) {
- if (val.indexOf(key) > -1) {
- return true;
- }
- }
- var keys = cu.nativeKeys(obj);
- return cu.has(keys, val);
- }
- if (Array.isArray(obj)) {
- var arr = obj;
- while (len--) {
- if (arr.indexOf(val[len]) > -1) {
- return true;
- }
- }
- return false;
- }
- throw new TypeError('expected an array or object.');
- };
- /**
- * Returns true if an array or object has all of the given values.
- *
- * ```js
- * cu.hasAll(['a', 'b', 'c'], 'c');
- * //=> true
- *
- * cu.hasAll(['a', 'b', 'c'], ['c', 'z']);
- * //=> false
- *
- * cu.hasAll({a: 'b', c: 'd'}, ['c', 'z']);
- * //=> false
- * ```
- * @param {Object|Array} `val`
- * @param {String|Array} `values`
- * @return {Boolean}
- * @api public
- */
- cu.hasAll = function hasAll(val, values) {
- values = cu.arrayify(values);
- var len = values.length;
- while (len--) {
- if (!cu.has(val, values[len])) {
- return false;
- }
- }
- return true;
- };
- /**
- * Cast the given value to an array.
- *
- * ```js
- * cu.arrayify('foo');
- * //=> ['foo']
- *
- * cu.arrayify(['foo']);
- * //=> ['foo']
- * ```
- *
- * @param {String|Array} `val`
- * @return {Array}
- * @api public
- */
- cu.arrayify = function arrayify(val) {
- return val ? Array.isArray(val) ? val : [val] : [];
- };
- /**
- * Noop
- */
- cu.noop = function noop() {
- return;
- };
- /**
- * Returns the first argument passed to the function.
- */
- cu.identity = function identity(val) {
- return val;
- };
- /**
- * Returns true if a value has a `contructor`
- *
- * ```js
- * cu.hasConstructor({});
- * //=> true
- *
- * cu.hasConstructor(Object.create(null));
- * //=> false
- * ```
- * @param {Object} `value`
- * @return {Boolean}
- * @api public
- */
- cu.hasConstructor = function hasConstructor(val) {
- return cu.isObject(val) && typeof val.constructor !== 'undefined';
- };
- /**
- * Get the native `ownPropertyNames` from the constructor of the
- * given `object`. An empty array is returned if the object does
- * not have a constructor.
- *
- * ```js
- * cu.nativeKeys({a: 'b', b: 'c', c: 'd'})
- * //=> ['a', 'b', 'c']
- *
- * cu.nativeKeys(function(){})
- * //=> ['length', 'caller']
- * ```
- *
- * @param {Object} `obj` Object that has a `constructor`.
- * @return {Array} Array of keys.
- * @api public
- */
- cu.nativeKeys = function nativeKeys(val) {
- if (!cu.hasConstructor(val)) return [];
- var keys = Object.getOwnPropertyNames(val);
- if ('caller' in val) keys.push('caller');
- return keys;
- };
- /**
- * Returns property descriptor `key` if it's an "own" property
- * of the given object.
- *
- * ```js
- * function App() {}
- * Object.defineProperty(App.prototype, 'count', {
- * get: function() {
- * return Object.keys(this).length;
- * }
- * });
- * cu.getDescriptor(App.prototype, 'count');
- * // returns:
- * // {
- * // get: [Function],
- * // set: undefined,
- * // enumerable: false,
- * // configurable: false
- * // }
- * ```
- *
- * @param {Object} `obj`
- * @param {String} `key`
- * @return {Object} Returns descriptor `key`
- * @api public
- */
- cu.getDescriptor = function getDescriptor(obj, key) {
- if (!cu.isObject(obj)) {
- throw new TypeError('expected an object.');
- }
- if (typeof key !== 'string') {
- throw new TypeError('expected key to be a string.');
- }
- return Object.getOwnPropertyDescriptor(obj, key);
- };
- /**
- * Copy a descriptor from one object to another.
- *
- * ```js
- * function App() {}
- * Object.defineProperty(App.prototype, 'count', {
- * get: function() {
- * return Object.keys(this).length;
- * }
- * });
- * var obj = {};
- * cu.copyDescriptor(obj, App.prototype, 'count');
- * ```
- * @param {Object} `receiver`
- * @param {Object} `provider`
- * @param {String} `name`
- * @return {Object}
- * @api public
- */
- cu.copyDescriptor = function copyDescriptor(receiver, provider, name) {
- if (!cu.isObject(receiver)) {
- throw new TypeError('expected receiving object to be an object.');
- }
- if (!cu.isObject(provider)) {
- throw new TypeError('expected providing object to be an object.');
- }
- if (typeof name !== 'string') {
- throw new TypeError('expected name to be a string.');
- }
- var val = cu.getDescriptor(provider, name);
- if (val) Object.defineProperty(receiver, name, val);
- };
- /**
- * Copy static properties, prototype properties, and descriptors
- * from one object to another.
- *
- * @param {Object} `receiver`
- * @param {Object} `provider`
- * @param {String|Array} `omit` One or more properties to omit
- * @return {Object}
- * @api public
- */
- cu.copy = function copy(receiver, provider, omit) {
- if (!cu.isObject(receiver)) {
- throw new TypeError('expected receiving object to be an object.');
- }
- if (!cu.isObject(provider)) {
- throw new TypeError('expected providing object to be an object.');
- }
- var props = Object.getOwnPropertyNames(provider);
- var keys = Object.keys(provider);
- var len = props.length,
- key;
- omit = cu.arrayify(omit);
- while (len--) {
- key = props[len];
- if (cu.has(keys, key)) {
- define(receiver, key, provider[key]);
- } else if (!(key in receiver) && !cu.has(omit, key)) {
- cu.copyDescriptor(receiver, provider, key);
- }
- }
- };
- /**
- * Inherit the static properties, prototype properties, and descriptors
- * from of an object.
- *
- * @param {Object} `receiver`
- * @param {Object} `provider`
- * @param {String|Array} `omit` One or more properties to omit
- * @return {Object}
- * @api public
- */
- cu.inherit = function inherit(receiver, provider, omit) {
- if (!cu.isObject(receiver)) {
- throw new TypeError('expected receiving object to be an object.');
- }
- if (!cu.isObject(provider)) {
- throw new TypeError('expected providing object to be an object.');
- }
- var keys = [];
- for (var key in provider) {
- keys.push(key);
- receiver[key] = provider[key];
- }
- keys = keys.concat(cu.arrayify(omit));
- var a = provider.prototype || provider;
- var b = receiver.prototype || receiver;
- cu.copy(b, a, keys);
- };
- /**
- * Returns a function for extending the static properties,
- * prototype properties, and descriptors from the `Parent`
- * constructor onto `Child` constructors.
- *
- * ```js
- * var extend = cu.extend(Parent);
- * Parent.extend(Child);
- *
- * // optional methods
- * Parent.extend(Child, {
- * foo: function() {},
- * bar: function() {}
- * });
- * ```
- * @param {Function} `Parent` Parent ctor
- * @param {Function} `extend` Optional extend function to handle custom extensions. Useful when updating methods that require a specific prototype.
- * @param {Function} `Child` Child ctor
- * @param {Object} `proto` Optionally pass additional prototype properties to inherit.
- * @return {Object}
- * @api public
- */
- cu.extend = function () {
- // keep it lazy, instead of assigning to `cu.extend`
- return staticExtend.apply(null, arguments);
- };
- /**
- * Bubble up events emitted from static methods on the Parent ctor.
- *
- * @param {Object} `Parent`
- * @param {Array} `events` Event names to bubble up
- * @api public
- */
- cu.bubble = function (Parent, events) {
- events = events || [];
- Parent.bubble = function (Child, arr) {
- if (Array.isArray(arr)) {
- events = union([], events, arr);
- }
- var len = events.length;
- var idx = -1;
- while (++idx < len) {
- var name = events[idx];
- Parent.on(name, Child.emit.bind(Child, name));
- }
- cu.bubble(Child, events);
- };
- };
- /***/ }),
- /***/ "./node_modules/collection-visit/index.js":
- /*!************************************************!*\
- !*** ./node_modules/collection-visit/index.js ***!
- \************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * collection-visit <https://github.com/jonschlinkert/collection-visit>
- *
- * Copyright (c) 2015, 2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- var visit = __webpack_require__(/*! object-visit */ "./node_modules/object-visit/index.js");
- var mapVisit = __webpack_require__(/*! map-visit */ "./node_modules/map-visit/index.js");
- module.exports = function (collection, method, val) {
- var result;
- if (typeof val === 'string' && method in collection) {
- var args = [].slice.call(arguments, 2);
- result = collection[method].apply(collection, args);
- } else if (Array.isArray(val)) {
- result = mapVisit.apply(null, arguments);
- } else {
- result = visit.apply(null, arguments);
- }
- if (typeof result !== 'undefined') {
- return result;
- }
- return collection;
- };
- /***/ }),
- /***/ "./node_modules/color-convert/conversions.js":
- /*!***************************************************!*\
- !*** ./node_modules/color-convert/conversions.js ***!
- \***************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* MIT license */
- var cssKeywords = __webpack_require__(/*! color-name */ "./node_modules/color-name/index.js"); // NOTE: conversions should only return primitive values (i.e. arrays, or
- // values that give correct `typeof` results).
- // do not use box values types (i.e. Number(), String(), etc.)
- var reverseKeywords = {};
- for (var key in cssKeywords) {
- if (cssKeywords.hasOwnProperty(key)) {
- reverseKeywords[cssKeywords[key]] = key;
- }
- }
- var convert = module.exports = {
- 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']
- }
- }; // hide .channels and .labels properties
- for (var model in convert) {
- if (convert.hasOwnProperty(model)) {
- if (!('channels' in convert[model])) {
- throw new Error('missing channels property: ' + model);
- }
- if (!('labels' in convert[model])) {
- throw new Error('missing channel labels property: ' + model);
- }
- if (convert[model].labels.length !== convert[model].channels) {
- throw new Error('channel and label counts mismatch: ' + model);
- }
- var channels = convert[model].channels;
- var labels = convert[model].labels;
- delete convert[model].channels;
- delete convert[model].labels;
- Object.defineProperty(convert[model], 'channels', {
- value: channels
- });
- Object.defineProperty(convert[model], 'labels', {
- value: labels
- });
- }
- }
- convert.rgb.hsl = function (rgb) {
- var r = rgb[0] / 255;
- var g = rgb[1] / 255;
- var b = rgb[2] / 255;
- var min = Math.min(r, g, b);
- var max = Math.max(r, g, b);
- var delta = max - min;
- var h;
- var s;
- var l;
- 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;
- }
- 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.rgb.hsv = function (rgb) {
- var rdif;
- var gdif;
- var bdif;
- var h;
- var s;
- var r = rgb[0] / 255;
- var g = rgb[1] / 255;
- var b = rgb[2] / 255;
- var v = Math.max(r, g, b);
- var diff = v - Math.min(r, g, b);
- var diffc = function diffc(c) {
- return (v - c) / 6 / diff + 1 / 2;
- };
- if (diff === 0) {
- h = 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.rgb.hwb = function (rgb) {
- var r = rgb[0];
- var g = rgb[1];
- var b = rgb[2];
- var h = convert.rgb.hsl(rgb)[0];
- var 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.rgb.cmyk = function (rgb) {
- var r = rgb[0] / 255;
- var g = rgb[1] / 255;
- var b = rgb[2] / 255;
- var c;
- var m;
- var y;
- var k;
- k = Math.min(1 - r, 1 - g, 1 - b);
- c = (1 - r - k) / (1 - k) || 0;
- m = (1 - g - k) / (1 - k) || 0;
- y = (1 - b - k) / (1 - k) || 0;
- return [c * 100, m * 100, y * 100, k * 100];
- };
- /**
- * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
- * */
- function comparativeDistance(x, y) {
- return Math.pow(x[0] - y[0], 2) + Math.pow(x[1] - y[1], 2) + Math.pow(x[2] - y[2], 2);
- }
- convert.rgb.keyword = function (rgb) {
- var reversed = reverseKeywords[rgb];
- if (reversed) {
- return reversed;
- }
- var currentClosestDistance = Infinity;
- var currentClosestKeyword;
- for (var keyword in cssKeywords) {
- if (cssKeywords.hasOwnProperty(keyword)) {
- var value = cssKeywords[keyword]; // Compute comparative distance
- var distance = comparativeDistance(rgb, value); // Check if its less, if so set as closest
- if (distance < currentClosestDistance) {
- currentClosestDistance = distance;
- currentClosestKeyword = keyword;
- }
- }
- }
- return currentClosestKeyword;
- };
- convert.keyword.rgb = function (keyword) {
- return cssKeywords[keyword];
- };
- convert.rgb.xyz = function (rgb) {
- var r = rgb[0] / 255;
- var g = rgb[1] / 255;
- var b = rgb[2] / 255; // assume sRGB
- r = r > 0.04045 ? Math.pow((r + 0.055) / 1.055, 2.4) : r / 12.92;
- g = g > 0.04045 ? Math.pow((g + 0.055) / 1.055, 2.4) : g / 12.92;
- b = b > 0.04045 ? Math.pow((b + 0.055) / 1.055, 2.4) : b / 12.92;
- var x = r * 0.4124 + g * 0.3576 + b * 0.1805;
- var y = r * 0.2126 + g * 0.7152 + b * 0.0722;
- var z = r * 0.0193 + g * 0.1192 + b * 0.9505;
- return [x * 100, y * 100, z * 100];
- };
- convert.rgb.lab = function (rgb) {
- var xyz = convert.rgb.xyz(rgb);
- var x = xyz[0];
- var y = xyz[1];
- var z = xyz[2];
- var l;
- var a;
- var b;
- x /= 95.047;
- y /= 100;
- z /= 108.883;
- x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
- y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
- z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
- l = 116 * y - 16;
- a = 500 * (x - y);
- b = 200 * (y - z);
- return [l, a, b];
- };
- convert.hsl.rgb = function (hsl) {
- var h = hsl[0] / 360;
- var s = hsl[1] / 100;
- var l = hsl[2] / 100;
- var t1;
- var t2;
- var t3;
- var rgb;
- var 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;
- }
- t1 = 2 * l - t2;
- rgb = [0, 0, 0];
- for (var 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.hsl.hsv = function (hsl) {
- var h = hsl[0];
- var s = hsl[1] / 100;
- var l = hsl[2] / 100;
- var smin = s;
- var lmin = Math.max(l, 0.01);
- var sv;
- var v;
- l *= 2;
- s *= l <= 1 ? l : 2 - l;
- smin *= lmin <= 1 ? lmin : 2 - lmin;
- v = (l + s) / 2;
- sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
- return [h, sv * 100, v * 100];
- };
- convert.hsv.rgb = function (hsv) {
- var h = hsv[0] / 60;
- var s = hsv[1] / 100;
- var v = hsv[2] / 100;
- var hi = Math.floor(h) % 6;
- var f = h - Math.floor(h);
- var p = 255 * v * (1 - s);
- var q = 255 * v * (1 - s * f);
- var 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.hsv.hsl = function (hsv) {
- var h = hsv[0];
- var s = hsv[1] / 100;
- var v = hsv[2] / 100;
- var vmin = Math.max(v, 0.01);
- var lmin;
- var sl;
- var l;
- l = (2 - s) * v;
- lmin = (2 - s) * vmin;
- sl = s * vmin;
- sl /= lmin <= 1 ? lmin : 2 - lmin;
- sl = sl || 0;
- l /= 2;
- return [h, sl * 100, l * 100];
- }; // http://dev.w3.org/csswg/css-color/#hwb-to-rgb
- convert.hwb.rgb = function (hwb) {
- var h = hwb[0] / 360;
- var wh = hwb[1] / 100;
- var bl = hwb[2] / 100;
- var ratio = wh + bl;
- var i;
- var v;
- var f;
- var n; // wh + bl cant be > 1
- if (ratio > 1) {
- wh /= ratio;
- bl /= ratio;
- }
- i = Math.floor(6 * h);
- v = 1 - bl;
- f = 6 * h - i;
- if ((i & 0x01) !== 0) {
- f = 1 - f;
- }
- n = wh + f * (v - wh); // linear interpolation
- var r;
- var g;
- var 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.cmyk.rgb = function (cmyk) {
- var c = cmyk[0] / 100;
- var m = cmyk[1] / 100;
- var y = cmyk[2] / 100;
- var k = cmyk[3] / 100;
- var r;
- var g;
- var b;
- r = 1 - Math.min(1, c * (1 - k) + k);
- g = 1 - Math.min(1, m * (1 - k) + k);
- b = 1 - Math.min(1, y * (1 - k) + k);
- return [r * 255, g * 255, b * 255];
- };
- convert.xyz.rgb = function (xyz) {
- var x = xyz[0] / 100;
- var y = xyz[1] / 100;
- var z = xyz[2] / 100;
- var r;
- var g;
- var 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; // assume sRGB
- r = r > 0.0031308 ? 1.055 * Math.pow(r, 1.0 / 2.4) - 0.055 : r * 12.92;
- g = g > 0.0031308 ? 1.055 * Math.pow(g, 1.0 / 2.4) - 0.055 : g * 12.92;
- b = b > 0.0031308 ? 1.055 * Math.pow(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.xyz.lab = function (xyz) {
- var x = xyz[0];
- var y = xyz[1];
- var z = xyz[2];
- var l;
- var a;
- var b;
- x /= 95.047;
- y /= 100;
- z /= 108.883;
- x = x > 0.008856 ? Math.pow(x, 1 / 3) : 7.787 * x + 16 / 116;
- y = y > 0.008856 ? Math.pow(y, 1 / 3) : 7.787 * y + 16 / 116;
- z = z > 0.008856 ? Math.pow(z, 1 / 3) : 7.787 * z + 16 / 116;
- l = 116 * y - 16;
- a = 500 * (x - y);
- b = 200 * (y - z);
- return [l, a, b];
- };
- convert.lab.xyz = function (lab) {
- var l = lab[0];
- var a = lab[1];
- var b = lab[2];
- var x;
- var y;
- var z;
- y = (l + 16) / 116;
- x = a / 500 + y;
- z = y - b / 200;
- var y2 = Math.pow(y, 3);
- var x2 = Math.pow(x, 3);
- var z2 = Math.pow(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.lab.lch = function (lab) {
- var l = lab[0];
- var a = lab[1];
- var b = lab[2];
- var hr;
- var h;
- var c;
- hr = Math.atan2(b, a);
- h = hr * 360 / 2 / Math.PI;
- if (h < 0) {
- h += 360;
- }
- c = Math.sqrt(a * a + b * b);
- return [l, c, h];
- };
- convert.lch.lab = function (lch) {
- var l = lch[0];
- var c = lch[1];
- var h = lch[2];
- var a;
- var b;
- var hr;
- hr = h / 360 * 2 * Math.PI;
- a = c * Math.cos(hr);
- b = c * Math.sin(hr);
- return [l, a, b];
- };
- convert.rgb.ansi16 = function (args) {
- var r = args[0];
- var g = args[1];
- var b = args[2];
- var value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization
- value = Math.round(value / 50);
- if (value === 0) {
- return 30;
- }
- var ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
- if (value === 2) {
- ansi += 60;
- }
- return ansi;
- };
- convert.hsv.ansi16 = function (args) {
- // optimization here; we already know the value and don't need to get
- // it converted for us.
- return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
- };
- convert.rgb.ansi256 = function (args) {
- var r = args[0];
- var g = args[1];
- var b = args[2]; // we use the extended greyscale palette here, with the exception of
- // black and white. normal palette only has 4 greyscale shades.
- if (r === g && g === b) {
- if (r < 8) {
- return 16;
- }
- if (r > 248) {
- return 231;
- }
- return Math.round((r - 8) / 247 * 24) + 232;
- }
- var ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
- return ansi;
- };
- convert.ansi16.rgb = function (args) {
- var color = args % 10; // handle greyscale
- if (color === 0 || color === 7) {
- if (args > 50) {
- color += 3.5;
- }
- color = color / 10.5 * 255;
- return [color, color, color];
- }
- var mult = (~~(args > 50) + 1) * 0.5;
- var r = (color & 1) * mult * 255;
- var g = (color >> 1 & 1) * mult * 255;
- var b = (color >> 2 & 1) * mult * 255;
- return [r, g, b];
- };
- convert.ansi256.rgb = function (args) {
- // handle greyscale
- if (args >= 232) {
- var c = (args - 232) * 10 + 8;
- return [c, c, c];
- }
- args -= 16;
- var rem;
- var r = Math.floor(args / 36) / 5 * 255;
- var g = Math.floor((rem = args % 36) / 6) / 5 * 255;
- var b = rem % 6 / 5 * 255;
- return [r, g, b];
- };
- convert.rgb.hex = function (args) {
- var integer = ((Math.round(args[0]) & 0xFF) << 16) + ((Math.round(args[1]) & 0xFF) << 8) + (Math.round(args[2]) & 0xFF);
- var string = integer.toString(16).toUpperCase();
- return '000000'.substring(string.length) + string;
- };
- convert.hex.rgb = function (args) {
- var match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
- if (!match) {
- return [0, 0, 0];
- }
- var colorString = match[0];
- if (match[0].length === 3) {
- colorString = colorString.split('').map(function (char) {
- return char + char;
- }).join('');
- }
- var integer = parseInt(colorString, 16);
- var r = integer >> 16 & 0xFF;
- var g = integer >> 8 & 0xFF;
- var b = integer & 0xFF;
- return [r, g, b];
- };
- convert.rgb.hcg = function (rgb) {
- var r = rgb[0] / 255;
- var g = rgb[1] / 255;
- var b = rgb[2] / 255;
- var max = Math.max(Math.max(r, g), b);
- var min = Math.min(Math.min(r, g), b);
- var chroma = max - min;
- var grayscale;
- var 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 + 4;
- }
- hue /= 6;
- hue %= 1;
- return [hue * 360, chroma * 100, grayscale * 100];
- };
- convert.hsl.hcg = function (hsl) {
- var s = hsl[1] / 100;
- var l = hsl[2] / 100;
- var c = 1;
- var f = 0;
- if (l < 0.5) {
- c = 2.0 * s * l;
- } else {
- c = 2.0 * s * (1.0 - l);
- }
- if (c < 1.0) {
- f = (l - 0.5 * c) / (1.0 - c);
- }
- return [hsl[0], c * 100, f * 100];
- };
- convert.hsv.hcg = function (hsv) {
- var s = hsv[1] / 100;
- var v = hsv[2] / 100;
- var c = s * v;
- var f = 0;
- if (c < 1.0) {
- f = (v - c) / (1 - c);
- }
- return [hsv[0], c * 100, f * 100];
- };
- convert.hcg.rgb = function (hcg) {
- var h = hcg[0] / 360;
- var c = hcg[1] / 100;
- var g = hcg[2] / 100;
- if (c === 0.0) {
- return [g * 255, g * 255, g * 255];
- }
- var pure = [0, 0, 0];
- var hi = h % 1 * 6;
- var v = hi % 1;
- var w = 1 - v;
- var 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.hcg.hsv = function (hcg) {
- var c = hcg[1] / 100;
- var g = hcg[2] / 100;
- var v = c + g * (1.0 - c);
- var f = 0;
- if (v > 0.0) {
- f = c / v;
- }
- return [hcg[0], f * 100, v * 100];
- };
- convert.hcg.hsl = function (hcg) {
- var c = hcg[1] / 100;
- var g = hcg[2] / 100;
- var l = g * (1.0 - c) + 0.5 * c;
- var 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.hcg.hwb = function (hcg) {
- var c = hcg[1] / 100;
- var g = hcg[2] / 100;
- var v = c + g * (1.0 - c);
- return [hcg[0], (v - c) * 100, (1 - v) * 100];
- };
- convert.hwb.hcg = function (hwb) {
- var w = hwb[1] / 100;
- var b = hwb[2] / 100;
- var v = 1 - b;
- var c = v - w;
- var g = 0;
- if (c < 1) {
- g = (v - c) / (1 - c);
- }
- return [hwb[0], c * 100, g * 100];
- };
- convert.apple.rgb = function (apple) {
- return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
- };
- convert.rgb.apple = function (rgb) {
- return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
- };
- convert.gray.rgb = function (args) {
- return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
- };
- convert.gray.hsl = convert.gray.hsv = function (args) {
- return [0, 0, args[0]];
- };
- convert.gray.hwb = function (gray) {
- return [0, 100, gray[0]];
- };
- convert.gray.cmyk = function (gray) {
- return [0, 0, 0, gray[0]];
- };
- convert.gray.lab = function (gray) {
- return [gray[0], 0, 0];
- };
- convert.gray.hex = function (gray) {
- var val = Math.round(gray[0] / 100 * 255) & 0xFF;
- var integer = (val << 16) + (val << 8) + val;
- var string = integer.toString(16).toUpperCase();
- return '000000'.substring(string.length) + string;
- };
- convert.rgb.gray = function (rgb) {
- var val = (rgb[0] + rgb[1] + rgb[2]) / 3;
- return [val / 255 * 100];
- };
- /***/ }),
- /***/ "./node_modules/color-convert/index.js":
- /*!*********************************************!*\
- !*** ./node_modules/color-convert/index.js ***!
- \*********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- var conversions = __webpack_require__(/*! ./conversions */ "./node_modules/color-convert/conversions.js");
- var route = __webpack_require__(/*! ./route */ "./node_modules/color-convert/route.js");
- var convert = {};
- var models = Object.keys(conversions);
- function wrapRaw(fn) {
- var wrappedFn = function wrappedFn(args) {
- if (args === undefined || args === null) {
- return args;
- }
- if (arguments.length > 1) {
- args = Array.prototype.slice.call(arguments);
- }
- return fn(args);
- }; // preserve .conversion property if there is one
- if ('conversion' in fn) {
- wrappedFn.conversion = fn.conversion;
- }
- return wrappedFn;
- }
- function wrapRounded(fn) {
- var wrappedFn = function wrappedFn(args) {
- if (args === undefined || args === null) {
- return args;
- }
- if (arguments.length > 1) {
- args = Array.prototype.slice.call(arguments);
- }
- var result = fn(args); // we're assuming the result is an array here.
- // see notice in conversions.js; don't use box types
- // in conversion functions.
- if (_typeof(result) === 'object') {
- for (var len = result.length, i = 0; i < len; i++) {
- result[i] = Math.round(result[i]);
- }
- }
- return result;
- }; // preserve .conversion property if there is one
- if ('conversion' in fn) {
- wrappedFn.conversion = fn.conversion;
- }
- return wrappedFn;
- }
- models.forEach(function (fromModel) {
- convert[fromModel] = {};
- Object.defineProperty(convert[fromModel], 'channels', {
- value: conversions[fromModel].channels
- });
- Object.defineProperty(convert[fromModel], 'labels', {
- value: conversions[fromModel].labels
- });
- var routes = route(fromModel);
- var routeModels = Object.keys(routes);
- routeModels.forEach(function (toModel) {
- var fn = routes[toModel];
- convert[fromModel][toModel] = wrapRounded(fn);
- convert[fromModel][toModel].raw = wrapRaw(fn);
- });
- });
- module.exports = convert;
- /***/ }),
- /***/ "./node_modules/color-convert/route.js":
- /*!*********************************************!*\
- !*** ./node_modules/color-convert/route.js ***!
- \*********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var conversions = __webpack_require__(/*! ./conversions */ "./node_modules/color-convert/conversions.js");
- /*
- this function routes a model to all other models.
- all functions that are routed have a property `.conversion` attached
- to the returned synthetic function. This property is an array
- of strings, each with the steps in between the 'from' and 'to'
- color models (inclusive).
- conversions that are not possible simply are not included.
- */
- function buildGraph() {
- var graph = {}; // https://jsperf.com/object-keys-vs-for-in-with-closure/3
- var models = Object.keys(conversions);
- for (var len = models.length, i = 0; i < len; i++) {
- graph[models[i]] = {
- // http://jsperf.com/1-vs-infinity
- // micro-opt, but this is simple.
- distance: -1,
- parent: null
- };
- }
- return graph;
- } // https://en.wikipedia.org/wiki/Breadth-first_search
- function deriveBFS(fromModel) {
- var graph = buildGraph();
- var queue = [fromModel]; // unshift -> queue -> pop
- graph[fromModel].distance = 0;
- while (queue.length) {
- var current = queue.pop();
- var adjacents = Object.keys(conversions[current]);
- for (var len = adjacents.length, i = 0; i < len; i++) {
- var adjacent = adjacents[i];
- var 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) {
- var path = [graph[toModel].parent, toModel];
- var fn = conversions[graph[toModel].parent][toModel];
- var 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;
- }
- module.exports = function (fromModel) {
- var graph = deriveBFS(fromModel);
- var conversion = {};
- var models = Object.keys(graph);
- for (var len = models.length, i = 0; i < len; i++) {
- var toModel = models[i];
- var node = graph[toModel];
- if (node.parent === null) {
- // no possible conversion, or this node is the source model.
- continue;
- }
- conversion[toModel] = wrapConversion(toModel, graph);
- }
- return conversion;
- };
- /***/ }),
- /***/ "./node_modules/color-name/index.js":
- /*!******************************************!*\
- !*** ./node_modules/color-name/index.js ***!
- \******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- module.exports = {
- "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]
- };
- /***/ }),
- /***/ "./node_modules/copy-descriptor/index.js":
- /*!***********************************************!*\
- !*** ./node_modules/copy-descriptor/index.js ***!
- \***********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * copy-descriptor <https://github.com/jonschlinkert/copy-descriptor>
- *
- * Copyright (c) 2015, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- /**
- * Copy a descriptor from one object to another.
- *
- * ```js
- * function App() {
- * this.cache = {};
- * }
- * App.prototype.set = function(key, val) {
- * this.cache[key] = val;
- * return this;
- * };
- * Object.defineProperty(App.prototype, 'count', {
- * get: function() {
- * return Object.keys(this.cache).length;
- * }
- * });
- *
- * copy(App.prototype, 'count', 'len');
- *
- * // create an instance
- * var app = new App();
- *
- * app.set('a', true);
- * app.set('b', true);
- * app.set('c', true);
- *
- * console.log(app.count);
- * //=> 3
- * console.log(app.len);
- * //=> 3
- * ```
- * @name copy
- * @param {Object} `receiver` The target object
- * @param {Object} `provider` The provider object
- * @param {String} `from` The key to copy on provider.
- * @param {String} `to` Optionally specify a new key name to use.
- * @return {Object}
- * @api public
- */
- module.exports = function copyDescriptor(receiver, provider, from, to) {
- if (!isObject(provider) && typeof provider !== 'function') {
- to = from;
- from = provider;
- provider = receiver;
- }
- if (!isObject(receiver) && typeof receiver !== 'function') {
- throw new TypeError('expected the first argument to be an object');
- }
- if (!isObject(provider) && typeof provider !== 'function') {
- throw new TypeError('expected provider to be an object');
- }
- if (typeof to !== 'string') {
- to = from;
- }
- if (typeof from !== 'string') {
- throw new TypeError('expected key to be a string');
- }
- if (!(from in provider)) {
- throw new Error('property "' + from + '" does not exist');
- }
- var val = Object.getOwnPropertyDescriptor(provider, from);
- if (val) Object.defineProperty(receiver, to, val);
- };
- function isObject(val) {
- return {}.toString.call(val) === '[object Object]';
- }
- /***/ }),
- /***/ "./node_modules/define-property/index.js":
- /*!***********************************************!*\
- !*** ./node_modules/define-property/index.js ***!
- \***********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * define-property <https://github.com/jonschlinkert/define-property>
- *
- * Copyright (c) 2015, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- var isDescriptor = __webpack_require__(/*! is-descriptor */ "./node_modules/define-property/node_modules/is-descriptor/index.js");
- module.exports = function defineProperty(obj, prop, val) {
- if (_typeof(obj) !== 'object' && typeof obj !== 'function') {
- throw new TypeError('expected an object or function.');
- }
- if (typeof prop !== 'string') {
- throw new TypeError('expected `prop` to be a string.');
- }
- if (isDescriptor(val) && ('set' in val || 'get' in val)) {
- return Object.defineProperty(obj, prop, val);
- }
- return Object.defineProperty(obj, prop, {
- configurable: true,
- enumerable: false,
- writable: true,
- value: val
- });
- };
- /***/ }),
- /***/ "./node_modules/define-property/node_modules/is-accessor-descriptor/index.js":
- /*!***********************************************************************************!*\
- !*** ./node_modules/define-property/node_modules/is-accessor-descriptor/index.js ***!
- \***********************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * is-accessor-descriptor <https://github.com/jonschlinkert/is-accessor-descriptor>
- *
- * Copyright (c) 2015, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- var typeOf = __webpack_require__(/*! kind-of */ "./node_modules/define-property/node_modules/is-accessor-descriptor/node_modules/kind-of/index.js"); // accessor descriptor properties
- var accessor = {
- get: 'function',
- set: 'function',
- configurable: 'boolean',
- enumerable: 'boolean'
- };
- function isAccessorDescriptor(obj, prop) {
- if (typeof prop === 'string') {
- var val = Object.getOwnPropertyDescriptor(obj, prop);
- return typeof val !== 'undefined';
- }
- if (typeOf(obj) !== 'object') {
- return false;
- }
- if (has(obj, 'value') || has(obj, 'writable')) {
- return false;
- }
- if (!has(obj, 'get') || typeof obj.get !== 'function') {
- return false;
- } // tldr: it's valid to have "set" be undefined
- // "set" might be undefined if `Object.getOwnPropertyDescriptor`
- // was used to get the value, and only `get` was defined by the user
- if (has(obj, 'set') && typeof obj[key] !== 'function' && typeof obj[key] !== 'undefined') {
- return false;
- }
- for (var key in obj) {
- if (!accessor.hasOwnProperty(key)) {
- continue;
- }
- if (typeOf(obj[key]) === accessor[key]) {
- continue;
- }
- if (typeof obj[key] !== 'undefined') {
- return false;
- }
- }
- return true;
- }
- function has(obj, key) {
- return {}.hasOwnProperty.call(obj, key);
- }
- /**
- * Expose `isAccessorDescriptor`
- */
- module.exports = isAccessorDescriptor;
- /***/ }),
- /***/ "./node_modules/define-property/node_modules/is-accessor-descriptor/node_modules/kind-of/index.js":
- /*!********************************************************************************************************!*\
- !*** ./node_modules/define-property/node_modules/is-accessor-descriptor/node_modules/kind-of/index.js ***!
- \********************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var isBuffer = __webpack_require__(/*! is-buffer */ "./node_modules/is-buffer/index.js");
- var toString = Object.prototype.toString;
- /**
- * Get the native `typeof` a value.
- *
- * @param {*} `val`
- * @return {*} Native javascript type
- */
- module.exports = function kindOf(val) {
- // primitivies
- if (typeof val === 'undefined') {
- return 'undefined';
- }
- if (val === null) {
- return 'null';
- }
- if (val === true || val === false || val instanceof Boolean) {
- return 'boolean';
- }
- if (typeof val === 'string' || val instanceof String) {
- return 'string';
- }
- if (typeof val === 'number' || val instanceof Number) {
- return 'number';
- } // functions
- if (typeof val === 'function' || val instanceof Function) {
- return 'function';
- } // array
- if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) {
- return 'array';
- } // check for instances of RegExp and Date before calling `toString`
- if (val instanceof RegExp) {
- return 'regexp';
- }
- if (val instanceof Date) {
- return 'date';
- } // other objects
- var type = toString.call(val);
- if (type === '[object RegExp]') {
- return 'regexp';
- }
- if (type === '[object Date]') {
- return 'date';
- }
- if (type === '[object Arguments]') {
- return 'arguments';
- }
- if (type === '[object Error]') {
- return 'error';
- } // buffer
- if (isBuffer(val)) {
- return 'buffer';
- } // es6: Map, WeakMap, Set, WeakSet
- if (type === '[object Set]') {
- return 'set';
- }
- if (type === '[object WeakSet]') {
- return 'weakset';
- }
- if (type === '[object Map]') {
- return 'map';
- }
- if (type === '[object WeakMap]') {
- return 'weakmap';
- }
- if (type === '[object Symbol]') {
- return 'symbol';
- } // typed arrays
- if (type === '[object Int8Array]') {
- return 'int8array';
- }
- if (type === '[object Uint8Array]') {
- return 'uint8array';
- }
- if (type === '[object Uint8ClampedArray]') {
- return 'uint8clampedarray';
- }
- if (type === '[object Int16Array]') {
- return 'int16array';
- }
- if (type === '[object Uint16Array]') {
- return 'uint16array';
- }
- if (type === '[object Int32Array]') {
- return 'int32array';
- }
- if (type === '[object Uint32Array]') {
- return 'uint32array';
- }
- if (type === '[object Float32Array]') {
- return 'float32array';
- }
- if (type === '[object Float64Array]') {
- return 'float64array';
- } // must be a plain object
- return 'object';
- };
- /***/ }),
- /***/ "./node_modules/define-property/node_modules/is-data-descriptor/index.js":
- /*!*******************************************************************************!*\
- !*** ./node_modules/define-property/node_modules/is-data-descriptor/index.js ***!
- \*******************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * is-data-descriptor <https://github.com/jonschlinkert/is-data-descriptor>
- *
- * Copyright (c) 2015, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- var typeOf = __webpack_require__(/*! kind-of */ "./node_modules/define-property/node_modules/is-data-descriptor/node_modules/kind-of/index.js"); // data descriptor properties
- var data = {
- configurable: 'boolean',
- enumerable: 'boolean',
- writable: 'boolean'
- };
- function isDataDescriptor(obj, prop) {
- if (typeOf(obj) !== 'object') {
- return false;
- }
- if (typeof prop === 'string') {
- var val = Object.getOwnPropertyDescriptor(obj, prop);
- return typeof val !== 'undefined';
- }
- if (!('value' in obj) && !('writable' in obj)) {
- return false;
- }
- for (var key in obj) {
- if (key === 'value') continue;
- if (!data.hasOwnProperty(key)) {
- continue;
- }
- if (typeOf(obj[key]) === data[key]) {
- continue;
- }
- if (typeof obj[key] !== 'undefined') {
- return false;
- }
- }
- return true;
- }
- /**
- * Expose `isDataDescriptor`
- */
- module.exports = isDataDescriptor;
- /***/ }),
- /***/ "./node_modules/define-property/node_modules/is-data-descriptor/node_modules/kind-of/index.js":
- /*!****************************************************************************************************!*\
- !*** ./node_modules/define-property/node_modules/is-data-descriptor/node_modules/kind-of/index.js ***!
- \****************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var isBuffer = __webpack_require__(/*! is-buffer */ "./node_modules/is-buffer/index.js");
- var toString = Object.prototype.toString;
- /**
- * Get the native `typeof` a value.
- *
- * @param {*} `val`
- * @return {*} Native javascript type
- */
- module.exports = function kindOf(val) {
- // primitivies
- if (typeof val === 'undefined') {
- return 'undefined';
- }
- if (val === null) {
- return 'null';
- }
- if (val === true || val === false || val instanceof Boolean) {
- return 'boolean';
- }
- if (typeof val === 'string' || val instanceof String) {
- return 'string';
- }
- if (typeof val === 'number' || val instanceof Number) {
- return 'number';
- } // functions
- if (typeof val === 'function' || val instanceof Function) {
- return 'function';
- } // array
- if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) {
- return 'array';
- } // check for instances of RegExp and Date before calling `toString`
- if (val instanceof RegExp) {
- return 'regexp';
- }
- if (val instanceof Date) {
- return 'date';
- } // other objects
- var type = toString.call(val);
- if (type === '[object RegExp]') {
- return 'regexp';
- }
- if (type === '[object Date]') {
- return 'date';
- }
- if (type === '[object Arguments]') {
- return 'arguments';
- }
- if (type === '[object Error]') {
- return 'error';
- } // buffer
- if (isBuffer(val)) {
- return 'buffer';
- } // es6: Map, WeakMap, Set, WeakSet
- if (type === '[object Set]') {
- return 'set';
- }
- if (type === '[object WeakSet]') {
- return 'weakset';
- }
- if (type === '[object Map]') {
- return 'map';
- }
- if (type === '[object WeakMap]') {
- return 'weakmap';
- }
- if (type === '[object Symbol]') {
- return 'symbol';
- } // typed arrays
- if (type === '[object Int8Array]') {
- return 'int8array';
- }
- if (type === '[object Uint8Array]') {
- return 'uint8array';
- }
- if (type === '[object Uint8ClampedArray]') {
- return 'uint8clampedarray';
- }
- if (type === '[object Int16Array]') {
- return 'int16array';
- }
- if (type === '[object Uint16Array]') {
- return 'uint16array';
- }
- if (type === '[object Int32Array]') {
- return 'int32array';
- }
- if (type === '[object Uint32Array]') {
- return 'uint32array';
- }
- if (type === '[object Float32Array]') {
- return 'float32array';
- }
- if (type === '[object Float64Array]') {
- return 'float64array';
- } // must be a plain object
- return 'object';
- };
- /***/ }),
- /***/ "./node_modules/define-property/node_modules/is-descriptor/index.js":
- /*!**************************************************************************!*\
- !*** ./node_modules/define-property/node_modules/is-descriptor/index.js ***!
- \**************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * is-descriptor <https://github.com/jonschlinkert/is-descriptor>
- *
- * Copyright (c) 2015-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- var typeOf = __webpack_require__(/*! kind-of */ "./node_modules/define-property/node_modules/kind-of/index.js");
- var isAccessor = __webpack_require__(/*! is-accessor-descriptor */ "./node_modules/define-property/node_modules/is-accessor-descriptor/index.js");
- var isData = __webpack_require__(/*! is-data-descriptor */ "./node_modules/define-property/node_modules/is-data-descriptor/index.js");
- module.exports = function isDescriptor(obj, key) {
- if (typeOf(obj) !== 'object') {
- return false;
- }
- if ('get' in obj) {
- return isAccessor(obj, key);
- }
- return isData(obj, key);
- };
- /***/ }),
- /***/ "./node_modules/define-property/node_modules/kind-of/index.js":
- /*!********************************************************************!*\
- !*** ./node_modules/define-property/node_modules/kind-of/index.js ***!
- \********************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- var toString = Object.prototype.toString;
- /**
- * Get the native `typeof` a value.
- *
- * @param {*} `val`
- * @return {*} Native javascript type
- */
- module.exports = function kindOf(val) {
- var type = _typeof(val); // primitivies
- if (type === 'undefined') {
- return 'undefined';
- }
- if (val === null) {
- return 'null';
- }
- if (val === true || val === false || val instanceof Boolean) {
- return 'boolean';
- }
- if (type === 'string' || val instanceof String) {
- return 'string';
- }
- if (type === 'number' || val instanceof Number) {
- return 'number';
- } // functions
- if (type === 'function' || val instanceof Function) {
- if (typeof val.constructor.name !== 'undefined' && val.constructor.name.slice(0, 9) === 'Generator') {
- return 'generatorfunction';
- }
- return 'function';
- } // array
- if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) {
- return 'array';
- } // check for instances of RegExp and Date before calling `toString`
- if (val instanceof RegExp) {
- return 'regexp';
- }
- if (val instanceof Date) {
- return 'date';
- } // other objects
- type = toString.call(val);
- if (type === '[object RegExp]') {
- return 'regexp';
- }
- if (type === '[object Date]') {
- return 'date';
- }
- if (type === '[object Arguments]') {
- return 'arguments';
- }
- if (type === '[object Error]') {
- return 'error';
- }
- if (type === '[object Promise]') {
- return 'promise';
- } // buffer
- if (isBuffer(val)) {
- return 'buffer';
- } // es6: Map, WeakMap, Set, WeakSet
- if (type === '[object Set]') {
- return 'set';
- }
- if (type === '[object WeakSet]') {
- return 'weakset';
- }
- if (type === '[object Map]') {
- return 'map';
- }
- if (type === '[object WeakMap]') {
- return 'weakmap';
- }
- if (type === '[object Symbol]') {
- return 'symbol';
- }
- if (type === '[object Map Iterator]') {
- return 'mapiterator';
- }
- if (type === '[object Set Iterator]') {
- return 'setiterator';
- }
- if (type === '[object String Iterator]') {
- return 'stringiterator';
- }
- if (type === '[object Array Iterator]') {
- return 'arrayiterator';
- } // typed arrays
- if (type === '[object Int8Array]') {
- return 'int8array';
- }
- if (type === '[object Uint8Array]') {
- return 'uint8array';
- }
- if (type === '[object Uint8ClampedArray]') {
- return 'uint8clampedarray';
- }
- if (type === '[object Int16Array]') {
- return 'int16array';
- }
- if (type === '[object Uint16Array]') {
- return 'uint16array';
- }
- if (type === '[object Int32Array]') {
- return 'int32array';
- }
- if (type === '[object Uint32Array]') {
- return 'uint32array';
- }
- if (type === '[object Float32Array]') {
- return 'float32array';
- }
- if (type === '[object Float64Array]') {
- return 'float64array';
- } // must be a plain object
- return 'object';
- };
- /**
- * If you need to support Safari 5-7 (8-10 yr-old browser),
- * take a look at https://github.com/feross/is-buffer
- */
- function isBuffer(val) {
- return val.constructor && typeof val.constructor.isBuffer === 'function' && val.constructor.isBuffer(val);
- }
- /***/ }),
- /***/ "./node_modules/esutils/lib/ast.js":
- /*!*****************************************!*\
- !*** ./node_modules/esutils/lib/ast.js ***!
- \*****************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*
- Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- (function () {
- 'use strict';
- function isExpression(node) {
- if (node == null) {
- return false;
- }
- switch (node.type) {
- case 'ArrayExpression':
- case 'AssignmentExpression':
- case 'BinaryExpression':
- case 'CallExpression':
- case 'ConditionalExpression':
- case 'FunctionExpression':
- case 'Identifier':
- case 'Literal':
- case 'LogicalExpression':
- case 'MemberExpression':
- case 'NewExpression':
- case 'ObjectExpression':
- case 'SequenceExpression':
- case 'ThisExpression':
- case 'UnaryExpression':
- case 'UpdateExpression':
- return true;
- }
- return false;
- }
- function isIterationStatement(node) {
- if (node == null) {
- return false;
- }
- switch (node.type) {
- case 'DoWhileStatement':
- case 'ForInStatement':
- case 'ForStatement':
- case 'WhileStatement':
- return true;
- }
- return false;
- }
- function isStatement(node) {
- if (node == null) {
- return false;
- }
- switch (node.type) {
- case 'BlockStatement':
- case 'BreakStatement':
- case 'ContinueStatement':
- case 'DebuggerStatement':
- case 'DoWhileStatement':
- case 'EmptyStatement':
- case 'ExpressionStatement':
- case 'ForInStatement':
- case 'ForStatement':
- case 'IfStatement':
- case 'LabeledStatement':
- case 'ReturnStatement':
- case 'SwitchStatement':
- case 'ThrowStatement':
- case 'TryStatement':
- case 'VariableDeclaration':
- case 'WhileStatement':
- case 'WithStatement':
- return true;
- }
- return false;
- }
- function isSourceElement(node) {
- return isStatement(node) || node != null && node.type === 'FunctionDeclaration';
- }
- function trailingStatement(node) {
- switch (node.type) {
- case 'IfStatement':
- if (node.alternate != null) {
- return node.alternate;
- }
- return node.consequent;
- case 'LabeledStatement':
- case 'ForStatement':
- case 'ForInStatement':
- case 'WhileStatement':
- case 'WithStatement':
- return node.body;
- }
- return null;
- }
- function isProblematicIfStatement(node) {
- var current;
- if (node.type !== 'IfStatement') {
- return false;
- }
- if (node.alternate == null) {
- return false;
- }
- current = node.consequent;
- do {
- if (current.type === 'IfStatement') {
- if (current.alternate == null) {
- return true;
- }
- }
- current = trailingStatement(current);
- } while (current);
- return false;
- }
- module.exports = {
- isExpression: isExpression,
- isStatement: isStatement,
- isIterationStatement: isIterationStatement,
- isSourceElement: isSourceElement,
- isProblematicIfStatement: isProblematicIfStatement,
- trailingStatement: trailingStatement
- };
- })();
- /* vim: set sw=4 ts=4 et tw=80 : */
- /***/ }),
- /***/ "./node_modules/esutils/lib/code.js":
- /*!******************************************!*\
- !*** ./node_modules/esutils/lib/code.js ***!
- \******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*
- Copyright (C) 2013-2014 Yusuke Suzuki <utatane.tea@gmail.com>
- Copyright (C) 2014 Ivan Nikulin <ifaaan@gmail.com>
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- (function () {
- 'use strict';
- var ES6Regex, ES5Regex, NON_ASCII_WHITESPACES, IDENTIFIER_START, IDENTIFIER_PART, ch; // See `tools/generate-identifier-regex.js`.
- ES5Regex = {
- // ECMAScript 5.1/Unicode v7.0.0 NonAsciiIdentifierStart:
- NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,
- // ECMAScript 5.1/Unicode v7.0.0 NonAsciiIdentifierPart:
- NonAsciiIdentifierPart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/
- };
- ES6Regex = {
- // ECMAScript 6/Unicode v7.0.0 NonAsciiIdentifierStart:
- NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDE00-\uDE11\uDE13-\uDE2B\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDE00-\uDE2F\uDE44\uDE80-\uDEAA]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|\uD809[\uDC00-\uDC6E]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]/,
- // ECMAScript 6/Unicode v7.0.0 NonAsciiIdentifierPart:
- NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDD0-\uDDDA\uDE00-\uDE11\uDE13-\uDE37\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF01-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|\uD809[\uDC00-\uDC6E]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/
- };
- function isDecimalDigit(ch) {
- return 0x30 <= ch && ch <= 0x39; // 0..9
- }
- function isHexDigit(ch) {
- return 0x30 <= ch && ch <= 0x39 || // 0..9
- 0x61 <= ch && ch <= 0x66 || // a..f
- 0x41 <= ch && ch <= 0x46; // A..F
- }
- function isOctalDigit(ch) {
- return ch >= 0x30 && ch <= 0x37; // 0..7
- } // 7.2 White Space
- NON_ASCII_WHITESPACES = [0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF];
- function isWhiteSpace(ch) {
- return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 || ch >= 0x1680 && NON_ASCII_WHITESPACES.indexOf(ch) >= 0;
- } // 7.3 Line Terminators
- function isLineTerminator(ch) {
- return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029;
- } // 7.6 Identifier Names and Identifiers
- function fromCodePoint(cp) {
- if (cp <= 0xFFFF) {
- return String.fromCharCode(cp);
- }
- var cu1 = String.fromCharCode(Math.floor((cp - 0x10000) / 0x400) + 0xD800);
- var cu2 = String.fromCharCode((cp - 0x10000) % 0x400 + 0xDC00);
- return cu1 + cu2;
- }
- IDENTIFIER_START = new Array(0x80);
- for (ch = 0; ch < 0x80; ++ch) {
- IDENTIFIER_START[ch] = ch >= 0x61 && ch <= 0x7A || // a..z
- ch >= 0x41 && ch <= 0x5A || // A..Z
- ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore)
- }
- IDENTIFIER_PART = new Array(0x80);
- for (ch = 0; ch < 0x80; ++ch) {
- IDENTIFIER_PART[ch] = ch >= 0x61 && ch <= 0x7A || // a..z
- ch >= 0x41 && ch <= 0x5A || // A..Z
- ch >= 0x30 && ch <= 0x39 || // 0..9
- ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore)
- }
- function isIdentifierStartES5(ch) {
- return ch < 0x80 ? IDENTIFIER_START[ch] : ES5Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch));
- }
- function isIdentifierPartES5(ch) {
- return ch < 0x80 ? IDENTIFIER_PART[ch] : ES5Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch));
- }
- function isIdentifierStartES6(ch) {
- return ch < 0x80 ? IDENTIFIER_START[ch] : ES6Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch));
- }
- function isIdentifierPartES6(ch) {
- return ch < 0x80 ? IDENTIFIER_PART[ch] : ES6Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch));
- }
- module.exports = {
- isDecimalDigit: isDecimalDigit,
- isHexDigit: isHexDigit,
- isOctalDigit: isOctalDigit,
- isWhiteSpace: isWhiteSpace,
- isLineTerminator: isLineTerminator,
- isIdentifierStartES5: isIdentifierStartES5,
- isIdentifierPartES5: isIdentifierPartES5,
- isIdentifierStartES6: isIdentifierStartES6,
- isIdentifierPartES6: isIdentifierPartES6
- };
- })();
- /* vim: set sw=4 ts=4 et tw=80 : */
- /***/ }),
- /***/ "./node_modules/esutils/lib/keyword.js":
- /*!*********************************************!*\
- !*** ./node_modules/esutils/lib/keyword.js ***!
- \*********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*
- Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- (function () {
- 'use strict';
- var code = __webpack_require__(/*! ./code */ "./node_modules/esutils/lib/code.js");
- function isStrictModeReservedWordES6(id) {
- switch (id) {
- case 'implements':
- case 'interface':
- case 'package':
- case 'private':
- case 'protected':
- case 'public':
- case 'static':
- case 'let':
- return true;
- default:
- return false;
- }
- }
- function isKeywordES5(id, strict) {
- // yield should not be treated as keyword under non-strict mode.
- if (!strict && id === 'yield') {
- return false;
- }
- return isKeywordES6(id, strict);
- }
- function isKeywordES6(id, strict) {
- if (strict && isStrictModeReservedWordES6(id)) {
- return true;
- }
- switch (id.length) {
- case 2:
- return id === 'if' || id === 'in' || id === 'do';
- case 3:
- return id === 'var' || id === 'for' || id === 'new' || id === 'try';
- case 4:
- return id === 'this' || id === 'else' || id === 'case' || id === 'void' || id === 'with' || id === 'enum';
- case 5:
- return id === 'while' || id === 'break' || id === 'catch' || id === 'throw' || id === 'const' || id === 'yield' || id === 'class' || id === 'super';
- case 6:
- return id === 'return' || id === 'typeof' || id === 'delete' || id === 'switch' || id === 'export' || id === 'import';
- case 7:
- return id === 'default' || id === 'finally' || id === 'extends';
- case 8:
- return id === 'function' || id === 'continue' || id === 'debugger';
- case 10:
- return id === 'instanceof';
- default:
- return false;
- }
- }
- function isReservedWordES5(id, strict) {
- return id === 'null' || id === 'true' || id === 'false' || isKeywordES5(id, strict);
- }
- function isReservedWordES6(id, strict) {
- return id === 'null' || id === 'true' || id === 'false' || isKeywordES6(id, strict);
- }
- function isRestrictedWord(id) {
- return id === 'eval' || id === 'arguments';
- }
- function isIdentifierNameES5(id) {
- var i, iz, ch;
- if (id.length === 0) {
- return false;
- }
- ch = id.charCodeAt(0);
- if (!code.isIdentifierStartES5(ch)) {
- return false;
- }
- for (i = 1, iz = id.length; i < iz; ++i) {
- ch = id.charCodeAt(i);
- if (!code.isIdentifierPartES5(ch)) {
- return false;
- }
- }
- return true;
- }
- function decodeUtf16(lead, trail) {
- return (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;
- }
- function isIdentifierNameES6(id) {
- var i, iz, ch, lowCh, check;
- if (id.length === 0) {
- return false;
- }
- check = code.isIdentifierStartES6;
- for (i = 0, iz = id.length; i < iz; ++i) {
- ch = id.charCodeAt(i);
- if (0xD800 <= ch && ch <= 0xDBFF) {
- ++i;
- if (i >= iz) {
- return false;
- }
- lowCh = id.charCodeAt(i);
- if (!(0xDC00 <= lowCh && lowCh <= 0xDFFF)) {
- return false;
- }
- ch = decodeUtf16(ch, lowCh);
- }
- if (!check(ch)) {
- return false;
- }
- check = code.isIdentifierPartES6;
- }
- return true;
- }
- function isIdentifierES5(id, strict) {
- return isIdentifierNameES5(id) && !isReservedWordES5(id, strict);
- }
- function isIdentifierES6(id, strict) {
- return isIdentifierNameES6(id) && !isReservedWordES6(id, strict);
- }
- module.exports = {
- isKeywordES5: isKeywordES5,
- isKeywordES6: isKeywordES6,
- isReservedWordES5: isReservedWordES5,
- isReservedWordES6: isReservedWordES6,
- isRestrictedWord: isRestrictedWord,
- isIdentifierNameES5: isIdentifierNameES5,
- isIdentifierNameES6: isIdentifierNameES6,
- isIdentifierES5: isIdentifierES5,
- isIdentifierES6: isIdentifierES6
- };
- })();
- /* vim: set sw=4 ts=4 et tw=80 : */
- /***/ }),
- /***/ "./node_modules/esutils/lib/utils.js":
- /*!*******************************************!*\
- !*** ./node_modules/esutils/lib/utils.js ***!
- \*******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*
- Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- (function () {
- 'use strict';
- exports.ast = __webpack_require__(/*! ./ast */ "./node_modules/esutils/lib/ast.js");
- exports.code = __webpack_require__(/*! ./code */ "./node_modules/esutils/lib/code.js");
- exports.keyword = __webpack_require__(/*! ./keyword */ "./node_modules/esutils/lib/keyword.js");
- })();
- /* vim: set sw=4 ts=4 et tw=80 : */
- /***/ }),
- /***/ "./node_modules/expand-brackets/index.js":
- /*!***********************************************!*\
- !*** ./node_modules/expand-brackets/index.js ***!
- \***********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(__filename) {
- /**
- * Local dependencies
- */
- var compilers = __webpack_require__(/*! ./lib/compilers */ "./node_modules/expand-brackets/lib/compilers.js");
- var parsers = __webpack_require__(/*! ./lib/parsers */ "./node_modules/expand-brackets/lib/parsers.js");
- /**
- * Module dependencies
- */
- var debug = __webpack_require__(/*! debug */ "./node_modules/expand-brackets/node_modules/debug/src/browser.js")('expand-brackets');
- var extend = __webpack_require__(/*! extend-shallow */ "./node_modules/extend-shallow/index.js");
- var Snapdragon = __webpack_require__(/*! snapdragon */ "./node_modules/snapdragon/index.js");
- var toRegex = __webpack_require__(/*! to-regex */ "./node_modules/to-regex/index.js");
- /**
- * Parses the given POSIX character class `pattern` and returns a
- * string that can be used for creating regular expressions for matching.
- *
- * @param {String} `pattern`
- * @param {Object} `options`
- * @return {Object}
- * @api public
- */
- function brackets(pattern, options) {
- debug('initializing from <%s>', __filename);
- var res = brackets.create(pattern, options);
- return res.output;
- }
- /**
- * Takes an array of strings and a POSIX character class pattern, and returns a new
- * array with only the strings that matched the pattern.
- *
- * ```js
- * var brackets = require('expand-brackets');
- * console.log(brackets.match(['1', 'a', 'ab'], '[[:alpha:]]'));
- * //=> ['a']
- *
- * console.log(brackets.match(['1', 'a', 'ab'], '[[:alpha:]]+'));
- * //=> ['a', 'ab']
- * ```
- * @param {Array} `arr` Array of strings to match
- * @param {String} `pattern` POSIX character class pattern(s)
- * @param {Object} `options`
- * @return {Array}
- * @api public
- */
- brackets.match = function (arr, pattern, options) {
- arr = [].concat(arr);
- var opts = extend({}, options);
- var isMatch = brackets.matcher(pattern, opts);
- var len = arr.length;
- var idx = -1;
- var res = [];
- while (++idx < len) {
- var ele = arr[idx];
- if (isMatch(ele)) {
- res.push(ele);
- }
- }
- if (res.length === 0) {
- if (opts.failglob === true) {
- throw new Error('no matches found for "' + pattern + '"');
- }
- if (opts.nonull === true || opts.nullglob === true) {
- return [pattern.split('\\').join('')];
- }
- }
- return res;
- };
- /**
- * Returns true if the specified `string` matches the given
- * brackets `pattern`.
- *
- * ```js
- * var brackets = require('expand-brackets');
- *
- * console.log(brackets.isMatch('a.a', '[[:alpha:]].[[:alpha:]]'));
- * //=> true
- * console.log(brackets.isMatch('1.2', '[[:alpha:]].[[:alpha:]]'));
- * //=> false
- * ```
- * @param {String} `string` String to match
- * @param {String} `pattern` Poxis pattern
- * @param {String} `options`
- * @return {Boolean}
- * @api public
- */
- brackets.isMatch = function (str, pattern, options) {
- return brackets.matcher(pattern, options)(str);
- };
- /**
- * Takes a POSIX character class pattern and returns a matcher function. The returned
- * function takes the string to match as its only argument.
- *
- * ```js
- * var brackets = require('expand-brackets');
- * var isMatch = brackets.matcher('[[:lower:]].[[:upper:]]');
- *
- * console.log(isMatch('a.a'));
- * //=> false
- * console.log(isMatch('a.A'));
- * //=> true
- * ```
- * @param {String} `pattern` Poxis pattern
- * @param {String} `options`
- * @return {Boolean}
- * @api public
- */
- brackets.matcher = function (pattern, options) {
- var re = brackets.makeRe(pattern, options);
- return function (str) {
- return re.test(str);
- };
- };
- /**
- * Create a regular expression from the given `pattern`.
- *
- * ```js
- * var brackets = require('expand-brackets');
- * var re = brackets.makeRe('[[:alpha:]]');
- * console.log(re);
- * //=> /^(?:[a-zA-Z])$/
- * ```
- * @param {String} `pattern` The pattern to convert to regex.
- * @param {Object} `options`
- * @return {RegExp}
- * @api public
- */
- brackets.makeRe = function (pattern, options) {
- var res = brackets.create(pattern, options);
- var opts = extend({
- strictErrors: false
- }, options);
- return toRegex(res.output, opts);
- };
- /**
- * Parses the given POSIX character class `pattern` and returns an object
- * with the compiled `output` and optional source `map`.
- *
- * ```js
- * var brackets = require('expand-brackets');
- * console.log(brackets('[[:alpha:]]'));
- * // { options: { source: 'string' },
- * // input: '[[:alpha:]]',
- * // state: {},
- * // compilers:
- * // { eos: [Function],
- * // noop: [Function],
- * // bos: [Function],
- * // not: [Function],
- * // escape: [Function],
- * // text: [Function],
- * // posix: [Function],
- * // bracket: [Function],
- * // 'bracket.open': [Function],
- * // 'bracket.inner': [Function],
- * // 'bracket.literal': [Function],
- * // 'bracket.close': [Function] },
- * // output: '[a-zA-Z]',
- * // ast:
- * // { type: 'root',
- * // errors: [],
- * // nodes: [ [Object], [Object], [Object] ] },
- * // parsingErrors: [] }
- * ```
- * @param {String} `pattern`
- * @param {Object} `options`
- * @return {Object}
- * @api public
- */
- brackets.create = function (pattern, options) {
- var snapdragon = options && options.snapdragon || new Snapdragon(options);
- compilers(snapdragon);
- parsers(snapdragon);
- var ast = snapdragon.parse(pattern, options);
- ast.input = pattern;
- var res = snapdragon.compile(ast, options);
- res.input = pattern;
- return res;
- };
- /**
- * Expose `brackets` constructor, parsers and compilers
- */
- brackets.compilers = compilers;
- brackets.parsers = parsers;
- /**
- * Expose `brackets`
- * @type {Function}
- */
- module.exports = brackets;
- /* WEBPACK VAR INJECTION */}.call(this, "/index.js"))
- /***/ }),
- /***/ "./node_modules/expand-brackets/lib/compilers.js":
- /*!*******************************************************!*\
- !*** ./node_modules/expand-brackets/lib/compilers.js ***!
- \*******************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var posix = __webpack_require__(/*! posix-character-classes */ "./node_modules/posix-character-classes/index.js");
- module.exports = function (brackets) {
- brackets.compiler
- /**
- * Escaped characters
- */
- .set('escape', function (node) {
- return this.emit('\\' + node.val.replace(/^\\/, ''), node);
- })
- /**
- * Text
- */
- .set('text', function (node) {
- return this.emit(node.val.replace(/([{}])/g, '\\$1'), node);
- })
- /**
- * POSIX character classes
- */
- .set('posix', function (node) {
- if (node.val === '[::]') {
- return this.emit('\\[::\\]', node);
- }
- var val = posix[node.inner];
- if (typeof val === 'undefined') {
- val = '[' + node.inner + ']';
- }
- return this.emit(val, node);
- })
- /**
- * Non-posix brackets
- */
- .set('bracket', function (node) {
- return this.mapVisit(node.nodes);
- }).set('bracket.open', function (node) {
- return this.emit(node.val, node);
- }).set('bracket.inner', function (node) {
- var inner = node.val;
- if (inner === '[' || inner === ']') {
- return this.emit('\\' + node.val, node);
- }
- if (inner === '^]') {
- return this.emit('^\\]', node);
- }
- if (inner === '^') {
- return this.emit('^', node);
- }
- if (/-/.test(inner) && !/(\d-\d|\w-\w)/.test(inner)) {
- inner = inner.split('-').join('\\-');
- }
- var isNegated = inner.charAt(0) === '^'; // add slashes to negated brackets, per spec
- if (isNegated && inner.indexOf('/') === -1) {
- inner += '/';
- }
- if (isNegated && inner.indexOf('.') === -1) {
- inner += '.';
- } // don't unescape `0` (octal literal)
- inner = inner.replace(/\\([1-9])/g, '$1');
- return this.emit(inner, node);
- }).set('bracket.close', function (node) {
- var val = node.val.replace(/^\\/, '');
- if (node.parent.escaped === true) {
- return this.emit('\\' + val, node);
- }
- return this.emit(val, node);
- });
- };
- /***/ }),
- /***/ "./node_modules/expand-brackets/lib/parsers.js":
- /*!*****************************************************!*\
- !*** ./node_modules/expand-brackets/lib/parsers.js ***!
- \*****************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var utils = __webpack_require__(/*! ./utils */ "./node_modules/expand-brackets/lib/utils.js");
- var define = __webpack_require__(/*! define-property */ "./node_modules/define-property/index.js");
- /**
- * Text regex
- */
- var TEXT_REGEX = '(\\[(?=.*\\])|\\])+';
- var not = utils.createRegex(TEXT_REGEX);
- /**
- * Brackets parsers
- */
- function parsers(brackets) {
- brackets.state = brackets.state || {};
- brackets.parser.sets.bracket = brackets.parser.sets.bracket || [];
- brackets.parser.capture('escape', function () {
- if (this.isInside('bracket')) return;
- var pos = this.position();
- var m = this.match(/^\\(.)/);
- if (!m) return;
- return pos({
- type: 'escape',
- val: m[0]
- });
- })
- /**
- * Text parser
- */
- .capture('text', function () {
- if (this.isInside('bracket')) return;
- var pos = this.position();
- var m = this.match(not);
- if (!m || !m[0]) return;
- return pos({
- type: 'text',
- val: m[0]
- });
- })
- /**
- * POSIX character classes: "[[:alpha:][:digits:]]"
- */
- .capture('posix', function () {
- var pos = this.position();
- var m = this.match(/^\[:(.*?):\](?=.*\])/);
- if (!m) return;
- var inside = this.isInside('bracket');
- if (inside) {
- brackets.posix++;
- }
- return pos({
- type: 'posix',
- insideBracket: inside,
- inner: m[1],
- val: m[0]
- });
- })
- /**
- * Bracket (noop)
- */
- .capture('bracket', function () {})
- /**
- * Open: '['
- */
- .capture('bracket.open', function () {
- var parsed = this.parsed;
- var pos = this.position();
- var m = this.match(/^\[(?=.*\])/);
- if (!m) return;
- var prev = this.prev();
- var last = utils.last(prev.nodes);
- if (parsed.slice(-1) === '\\' && !this.isInside('bracket')) {
- last.val = last.val.slice(0, last.val.length - 1);
- return pos({
- type: 'escape',
- val: m[0]
- });
- }
- var open = pos({
- type: 'bracket.open',
- val: m[0]
- });
- if (last.type === 'bracket.open' || this.isInside('bracket')) {
- open.val = '\\' + open.val;
- open.type = 'bracket.inner';
- open.escaped = true;
- return open;
- }
- var node = pos({
- type: 'bracket',
- nodes: [open]
- });
- define(node, 'parent', prev);
- define(open, 'parent', node);
- this.push('bracket', node);
- prev.nodes.push(node);
- })
- /**
- * Bracket text
- */
- .capture('bracket.inner', function () {
- if (!this.isInside('bracket')) return;
- var pos = this.position();
- var m = this.match(not);
- if (!m || !m[0]) return;
- var next = this.input.charAt(0);
- var val = m[0];
- var node = pos({
- type: 'bracket.inner',
- val: val
- });
- if (val === '\\\\') {
- return node;
- }
- var first = val.charAt(0);
- var last = val.slice(-1);
- if (first === '!') {
- val = '^' + val.slice(1);
- }
- if (last === '\\' || val === '^' && next === ']') {
- val += this.input[0];
- this.consume(1);
- }
- node.val = val;
- return node;
- })
- /**
- * Close: ']'
- */
- .capture('bracket.close', function () {
- var parsed = this.parsed;
- var pos = this.position();
- var m = this.match(/^\]/);
- if (!m) return;
- var prev = this.prev();
- var last = utils.last(prev.nodes);
- if (parsed.slice(-1) === '\\' && !this.isInside('bracket')) {
- last.val = last.val.slice(0, last.val.length - 1);
- return pos({
- type: 'escape',
- val: m[0]
- });
- }
- var node = pos({
- type: 'bracket.close',
- rest: this.input,
- val: m[0]
- });
- if (last.type === 'bracket.open') {
- node.type = 'bracket.inner';
- node.escaped = true;
- return node;
- }
- var bracket = this.pop('bracket');
- if (!this.isType(bracket, 'bracket')) {
- if (this.options.strict) {
- throw new Error('missing opening "["');
- }
- node.type = 'bracket.inner';
- node.escaped = true;
- return node;
- }
- bracket.nodes.push(node);
- define(node, 'parent', bracket);
- });
- }
- /**
- * Brackets parsers
- */
- module.exports = parsers;
- /**
- * Expose text regex
- */
- module.exports.TEXT_REGEX = TEXT_REGEX;
- /***/ }),
- /***/ "./node_modules/expand-brackets/lib/utils.js":
- /*!***************************************************!*\
- !*** ./node_modules/expand-brackets/lib/utils.js ***!
- \***************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var toRegex = __webpack_require__(/*! to-regex */ "./node_modules/to-regex/index.js");
- var regexNot = __webpack_require__(/*! regex-not */ "./node_modules/regex-not/index.js");
- var cached;
- /**
- * Get the last element from `array`
- * @param {Array} `array`
- * @return {*}
- */
- exports.last = function (arr) {
- return arr[arr.length - 1];
- };
- /**
- * Create and cache regex to use for text nodes
- */
- exports.createRegex = function (pattern, include) {
- if (cached) return cached;
- var opts = {
- contains: true,
- strictClose: false
- };
- var not = regexNot.create(pattern, opts);
- var re;
- if (typeof include === 'string') {
- re = toRegex('^(?:' + include + '|' + not + ')', opts);
- } else {
- re = toRegex(not, opts);
- }
- return cached = re;
- };
- /***/ }),
- /***/ "./node_modules/expand-brackets/node_modules/debug/src/browser.js":
- /*!************************************************************************!*\
- !*** ./node_modules/expand-brackets/node_modules/debug/src/browser.js ***!
- \************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(process) {
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- /**
- * This is the web browser implementation of `debug()`.
- *
- * Expose `debug()` as the module.
- */
- exports = module.exports = __webpack_require__(/*! ./debug */ "./node_modules/expand-brackets/node_modules/debug/src/debug.js");
- exports.log = log;
- exports.formatArgs = formatArgs;
- exports.save = save;
- exports.load = load;
- exports.useColors = useColors;
- exports.storage = 'undefined' != typeof chrome && 'undefined' != typeof chrome.storage ? chrome.storage.local : localstorage();
- /**
- * Colors.
- */
- exports.colors = ['lightseagreen', 'forestgreen', 'goldenrod', 'dodgerblue', 'darkorchid', 'crimson'];
- /**
- * Currently only WebKit-based Web Inspectors, Firefox >= v31,
- * and the Firebug extension (any Firefox version) are known
- * to support "%c" CSS customizations.
- *
- * TODO: add a `localStorage` variable to explicitly enable/disable colors
- */
- function useColors() {
- // NB: In an Electron preload script, document will be defined but not fully
- // initialized. Since we know we're in Chrome, we'll just detect this case
- // explicitly
- if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {
- return true;
- } // is webkit? http://stackoverflow.com/a/16459606/376773
- // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
- return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // is firebug? http://stackoverflow.com/a/398120/376773
- typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // is firefox >= v31?
- // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
- typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // double check webkit in userAgent just in case we are in a worker
- typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
- }
- /**
- * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
- */
- exports.formatters.j = function (v) {
- try {
- return JSON.stringify(v);
- } catch (err) {
- return '[UnexpectedJSONParseError]: ' + err.message;
- }
- };
- /**
- * Colorize log arguments if enabled.
- *
- * @api public
- */
- function formatArgs(args) {
- var useColors = this.useColors;
- args[0] = (useColors ? '%c' : '') + this.namespace + (useColors ? ' %c' : ' ') + args[0] + (useColors ? '%c ' : ' ') + '+' + exports.humanize(this.diff);
- if (!useColors) return;
- var c = 'color: ' + this.color;
- args.splice(1, 0, c, 'color: inherit'); // the final "%c" is somewhat tricky, because there could be other
- // arguments passed either before or after the %c, so we need to
- // figure out the correct index to insert the CSS into
- var index = 0;
- var lastC = 0;
- args[0].replace(/%[a-zA-Z%]/g, function (match) {
- if ('%%' === match) return;
- index++;
- if ('%c' === match) {
- // we only are interested in the *last* %c
- // (the user may have provided their own)
- lastC = index;
- }
- });
- args.splice(lastC, 0, c);
- }
- /**
- * Invokes `console.log()` when available.
- * No-op when `console.log` is not a "function".
- *
- * @api public
- */
- function log() {
- // this hackery is required for IE8/9, where
- // the `console.log` function doesn't have 'apply'
- return 'object' === (typeof console === "undefined" ? "undefined" : _typeof(console)) && console.log && Function.prototype.apply.call(console.log, console, arguments);
- }
- /**
- * Save `namespaces`.
- *
- * @param {String} namespaces
- * @api private
- */
- function save(namespaces) {
- try {
- if (null == namespaces) {
- exports.storage.removeItem('debug');
- } else {
- exports.storage.debug = namespaces;
- }
- } catch (e) {}
- }
- /**
- * Load `namespaces`.
- *
- * @return {String} returns the previously persisted debug modes
- * @api private
- */
- function load() {
- var r;
- try {
- r = exports.storage.debug;
- } catch (e) {} // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
- if (!r && typeof process !== 'undefined' && 'env' in process) {
- r = process.env.DEBUG;
- }
- return r;
- }
- /**
- * Enable namespaces listed in `localStorage.debug` initially.
- */
- exports.enable(load());
- /**
- * Localstorage attempts to return the localstorage.
- *
- * This is necessary because safari throws
- * when a user disables cookies/localstorage
- * and you attempt to access it.
- *
- * @return {LocalStorage}
- * @api private
- */
- function localstorage() {
- try {
- return window.localStorage;
- } catch (e) {}
- }
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../process/browser.js */ "./node_modules/process/browser.js")))
- /***/ }),
- /***/ "./node_modules/expand-brackets/node_modules/debug/src/debug.js":
- /*!**********************************************************************!*\
- !*** ./node_modules/expand-brackets/node_modules/debug/src/debug.js ***!
- \**********************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /**
- * This is the common logic for both the Node.js and web browser
- * implementations of `debug()`.
- *
- * Expose `debug()` as the module.
- */
- exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
- exports.coerce = coerce;
- exports.disable = disable;
- exports.enable = enable;
- exports.enabled = enabled;
- exports.humanize = __webpack_require__(/*! ms */ "./node_modules/expand-brackets/node_modules/ms/index.js");
- /**
- * The currently active debug mode names, and names to skip.
- */
- exports.names = [];
- exports.skips = [];
- /**
- * Map of special "%n" handling functions, for the debug "format" argument.
- *
- * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
- */
- exports.formatters = {};
- /**
- * Previous log timestamp.
- */
- var prevTime;
- /**
- * Select a color.
- * @param {String} namespace
- * @return {Number}
- * @api private
- */
- function selectColor(namespace) {
- var hash = 0,
- i;
- for (i in namespace) {
- hash = (hash << 5) - hash + namespace.charCodeAt(i);
- hash |= 0; // Convert to 32bit integer
- }
- return exports.colors[Math.abs(hash) % exports.colors.length];
- }
- /**
- * Create a debugger with the given `namespace`.
- *
- * @param {String} namespace
- * @return {Function}
- * @api public
- */
- function createDebug(namespace) {
- function debug() {
- // disabled?
- if (!debug.enabled) return;
- var self = debug; // set `diff` timestamp
- var curr = +new Date();
- var ms = curr - (prevTime || curr);
- self.diff = ms;
- self.prev = prevTime;
- self.curr = curr;
- prevTime = curr; // turn the `arguments` into a proper Array
- var args = new Array(arguments.length);
- for (var i = 0; i < args.length; i++) {
- args[i] = arguments[i];
- }
- args[0] = exports.coerce(args[0]);
- if ('string' !== typeof args[0]) {
- // anything else let's inspect with %O
- args.unshift('%O');
- } // apply any `formatters` transformations
- var index = 0;
- args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
- // if we encounter an escaped % then don't increase the array index
- if (match === '%%') return match;
- index++;
- var formatter = exports.formatters[format];
- if ('function' === typeof formatter) {
- var val = args[index];
- match = formatter.call(self, val); // now we need to remove `args[index]` since it's inlined in the `format`
- args.splice(index, 1);
- index--;
- }
- return match;
- }); // apply env-specific formatting (colors, etc.)
- exports.formatArgs.call(self, args);
- var logFn = debug.log || exports.log || console.log.bind(console);
- logFn.apply(self, args);
- }
- debug.namespace = namespace;
- debug.enabled = exports.enabled(namespace);
- debug.useColors = exports.useColors();
- debug.color = selectColor(namespace); // env-specific initialization logic for debug instances
- if ('function' === typeof exports.init) {
- exports.init(debug);
- }
- return debug;
- }
- /**
- * Enables a debug mode by namespaces. This can include modes
- * separated by a colon and wildcards.
- *
- * @param {String} namespaces
- * @api public
- */
- function enable(namespaces) {
- exports.save(namespaces);
- exports.names = [];
- exports.skips = [];
- var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
- var len = split.length;
- for (var i = 0; i < len; i++) {
- if (!split[i]) continue; // ignore empty strings
- namespaces = split[i].replace(/\*/g, '.*?');
- if (namespaces[0] === '-') {
- exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
- } else {
- exports.names.push(new RegExp('^' + namespaces + '$'));
- }
- }
- }
- /**
- * Disable debug output.
- *
- * @api public
- */
- function disable() {
- exports.enable('');
- }
- /**
- * Returns true if the given mode name is enabled, false otherwise.
- *
- * @param {String} name
- * @return {Boolean}
- * @api public
- */
- function enabled(name) {
- var i, len;
- for (i = 0, len = exports.skips.length; i < len; i++) {
- if (exports.skips[i].test(name)) {
- return false;
- }
- }
- for (i = 0, len = exports.names.length; i < len; i++) {
- if (exports.names[i].test(name)) {
- return true;
- }
- }
- return false;
- }
- /**
- * Coerce `val`.
- *
- * @param {Mixed} val
- * @return {Mixed}
- * @api private
- */
- function coerce(val) {
- if (val instanceof Error) return val.stack || val.message;
- return val;
- }
- /***/ }),
- /***/ "./node_modules/expand-brackets/node_modules/ms/index.js":
- /*!***************************************************************!*\
- !*** ./node_modules/expand-brackets/node_modules/ms/index.js ***!
- \***************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- /**
- * Helpers.
- */
- var s = 1000;
- var m = s * 60;
- var h = m * 60;
- var d = h * 24;
- var y = d * 365.25;
- /**
- * Parse or format the given `val`.
- *
- * Options:
- *
- * - `long` verbose formatting [false]
- *
- * @param {String|Number} val
- * @param {Object} [options]
- * @throws {Error} throw an error if val is not a non-empty string or a number
- * @return {String|Number}
- * @api public
- */
- module.exports = function (val, options) {
- options = options || {};
- var type = _typeof(val);
- if (type === 'string' && val.length > 0) {
- return parse(val);
- } else if (type === 'number' && isNaN(val) === false) {
- return options.long ? fmtLong(val) : fmtShort(val);
- }
- throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val));
- };
- /**
- * Parse the given `str` and return milliseconds.
- *
- * @param {String} str
- * @return {Number}
- * @api private
- */
- function parse(str) {
- str = String(str);
- if (str.length > 100) {
- return;
- }
- var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str);
- if (!match) {
- return;
- }
- var n = parseFloat(match[1]);
- var type = (match[2] || 'ms').toLowerCase();
- switch (type) {
- case 'years':
- case 'year':
- case 'yrs':
- case 'yr':
- case 'y':
- return n * y;
- case 'days':
- case 'day':
- case 'd':
- return n * d;
- case 'hours':
- case 'hour':
- case 'hrs':
- case 'hr':
- case 'h':
- return n * h;
- case 'minutes':
- case 'minute':
- case 'mins':
- case 'min':
- case 'm':
- return n * m;
- case 'seconds':
- case 'second':
- case 'secs':
- case 'sec':
- case 's':
- return n * s;
- case 'milliseconds':
- case 'millisecond':
- case 'msecs':
- case 'msec':
- case 'ms':
- return n;
- default:
- return undefined;
- }
- }
- /**
- * Short format for `ms`.
- *
- * @param {Number} ms
- * @return {String}
- * @api private
- */
- function fmtShort(ms) {
- if (ms >= d) {
- return Math.round(ms / d) + 'd';
- }
- if (ms >= h) {
- return Math.round(ms / h) + 'h';
- }
- if (ms >= m) {
- return Math.round(ms / m) + 'm';
- }
- if (ms >= s) {
- return Math.round(ms / s) + 's';
- }
- return ms + 'ms';
- }
- /**
- * Long format for `ms`.
- *
- * @param {Number} ms
- * @return {String}
- * @api private
- */
- function fmtLong(ms) {
- return plural(ms, d, 'day') || plural(ms, h, 'hour') || plural(ms, m, 'minute') || plural(ms, s, 'second') || ms + ' ms';
- }
- /**
- * Pluralization helper.
- */
- function plural(ms, n, name) {
- if (ms < n) {
- return;
- }
- if (ms < n * 1.5) {
- return Math.floor(ms / n) + ' ' + name;
- }
- return Math.ceil(ms / n) + ' ' + name + 's';
- }
- /***/ }),
- /***/ "./node_modules/extend-shallow/index.js":
- /*!**********************************************!*\
- !*** ./node_modules/extend-shallow/index.js ***!
- \**********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var isObject = __webpack_require__(/*! is-extendable */ "./node_modules/is-extendable/index.js");
- module.exports = function extend(o
- /*, objects*/
- ) {
- if (!isObject(o)) {
- o = {};
- }
- var len = arguments.length;
- for (var i = 1; i < len; i++) {
- var obj = arguments[i];
- if (isObject(obj)) {
- assign(o, obj);
- }
- }
- return o;
- };
- function assign(a, b) {
- for (var key in b) {
- if (hasOwn(b, key)) {
- a[key] = b[key];
- }
- }
- }
- /**
- * Returns true if the given `key` is an own property of `obj`.
- */
- function hasOwn(obj, key) {
- return Object.prototype.hasOwnProperty.call(obj, key);
- }
- /***/ }),
- /***/ "./node_modules/extglob/index.js":
- /*!***************************************!*\
- !*** ./node_modules/extglob/index.js ***!
- \***************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /**
- * Module dependencies
- */
- var extend = __webpack_require__(/*! extend-shallow */ "./node_modules/extend-shallow/index.js");
- var unique = __webpack_require__(/*! array-unique */ "./node_modules/array-unique/index.js");
- var toRegex = __webpack_require__(/*! to-regex */ "./node_modules/to-regex/index.js");
- /**
- * Local dependencies
- */
- var compilers = __webpack_require__(/*! ./lib/compilers */ "./node_modules/extglob/lib/compilers.js");
- var parsers = __webpack_require__(/*! ./lib/parsers */ "./node_modules/extglob/lib/parsers.js");
- var Extglob = __webpack_require__(/*! ./lib/extglob */ "./node_modules/extglob/lib/extglob.js");
- var utils = __webpack_require__(/*! ./lib/utils */ "./node_modules/extglob/lib/utils.js");
- var MAX_LENGTH = 1024 * 64;
- /**
- * Convert the given `extglob` pattern into a regex-compatible string. Returns
- * an object with the compiled result and the parsed AST.
- *
- * ```js
- * var extglob = require('extglob');
- * console.log(extglob('*.!(*a)'));
- * //=> '(?!\\.)[^/]*?\\.(?!(?!\\.)[^/]*?a\\b).*?'
- * ```
- * @param {String} `pattern`
- * @param {Object} `options`
- * @return {String}
- * @api public
- */
- function extglob(pattern, options) {
- return extglob.create(pattern, options).output;
- }
- /**
- * Takes an array of strings and an extglob pattern and returns a new
- * array that contains only the strings that match the pattern.
- *
- * ```js
- * var extglob = require('extglob');
- * console.log(extglob.match(['a.a', 'a.b', 'a.c'], '*.!(*a)'));
- * //=> ['a.b', 'a.c']
- * ```
- * @param {Array} `list` Array of strings to match
- * @param {String} `pattern` Extglob pattern
- * @param {Object} `options`
- * @return {Array} Returns an array of matches
- * @api public
- */
- extglob.match = function (list, pattern, options) {
- if (typeof pattern !== 'string') {
- throw new TypeError('expected pattern to be a string');
- }
- list = utils.arrayify(list);
- var isMatch = extglob.matcher(pattern, options);
- var len = list.length;
- var idx = -1;
- var matches = [];
- while (++idx < len) {
- var ele = list[idx];
- if (isMatch(ele)) {
- matches.push(ele);
- }
- } // if no options were passed, uniquify results and return
- if (typeof options === 'undefined') {
- return unique(matches);
- }
- if (matches.length === 0) {
- if (options.failglob === true) {
- throw new Error('no matches found for "' + pattern + '"');
- }
- if (options.nonull === true || options.nullglob === true) {
- return [pattern.split('\\').join('')];
- }
- }
- return options.nodupes !== false ? unique(matches) : matches;
- };
- /**
- * Returns true if the specified `string` matches the given
- * extglob `pattern`.
- *
- * ```js
- * var extglob = require('extglob');
- *
- * console.log(extglob.isMatch('a.a', '*.!(*a)'));
- * //=> false
- * console.log(extglob.isMatch('a.b', '*.!(*a)'));
- * //=> true
- * ```
- * @param {String} `string` String to match
- * @param {String} `pattern` Extglob pattern
- * @param {String} `options`
- * @return {Boolean}
- * @api public
- */
- extglob.isMatch = function (str, pattern, options) {
- if (typeof pattern !== 'string') {
- throw new TypeError('expected pattern to be a string');
- }
- if (typeof str !== 'string') {
- throw new TypeError('expected a string');
- }
- if (pattern === str) {
- return true;
- }
- if (pattern === '' || pattern === ' ' || pattern === '.') {
- return pattern === str;
- }
- var isMatch = utils.memoize('isMatch', pattern, options, extglob.matcher);
- return isMatch(str);
- };
- /**
- * Returns true if the given `string` contains the given pattern. Similar to `.isMatch` but
- * the pattern can match any part of the string.
- *
- * ```js
- * var extglob = require('extglob');
- * console.log(extglob.contains('aa/bb/cc', '*b'));
- * //=> true
- * console.log(extglob.contains('aa/bb/cc', '*d'));
- * //=> false
- * ```
- * @param {String} `str` The string to match.
- * @param {String} `pattern` Glob pattern to use for matching.
- * @param {Object} `options`
- * @return {Boolean} Returns true if the patter matches any part of `str`.
- * @api public
- */
- extglob.contains = function (str, pattern, options) {
- if (typeof str !== 'string') {
- throw new TypeError('expected a string');
- }
- if (pattern === '' || pattern === ' ' || pattern === '.') {
- return pattern === str;
- }
- var opts = extend({}, options, {
- contains: true
- });
- opts.strictClose = false;
- opts.strictOpen = false;
- return extglob.isMatch(str, pattern, opts);
- };
- /**
- * Takes an extglob pattern and returns a matcher function. The returned
- * function takes the string to match as its only argument.
- *
- * ```js
- * var extglob = require('extglob');
- * var isMatch = extglob.matcher('*.!(*a)');
- *
- * console.log(isMatch('a.a'));
- * //=> false
- * console.log(isMatch('a.b'));
- * //=> true
- * ```
- * @param {String} `pattern` Extglob pattern
- * @param {String} `options`
- * @return {Boolean}
- * @api public
- */
- extglob.matcher = function (pattern, options) {
- if (typeof pattern !== 'string') {
- throw new TypeError('expected pattern to be a string');
- }
- function matcher() {
- var re = extglob.makeRe(pattern, options);
- return function (str) {
- return re.test(str);
- };
- }
- return utils.memoize('matcher', pattern, options, matcher);
- };
- /**
- * Convert the given `extglob` pattern into a regex-compatible string. Returns
- * an object with the compiled result and the parsed AST.
- *
- * ```js
- * var extglob = require('extglob');
- * console.log(extglob.create('*.!(*a)').output);
- * //=> '(?!\\.)[^/]*?\\.(?!(?!\\.)[^/]*?a\\b).*?'
- * ```
- * @param {String} `str`
- * @param {Object} `options`
- * @return {String}
- * @api public
- */
- extglob.create = function (pattern, options) {
- if (typeof pattern !== 'string') {
- throw new TypeError('expected pattern to be a string');
- }
- function create() {
- var ext = new Extglob(options);
- var ast = ext.parse(pattern, options);
- return ext.compile(ast, options);
- }
- return utils.memoize('create', pattern, options, create);
- };
- /**
- * Returns an array of matches captured by `pattern` in `string`, or `null`
- * if the pattern did not match.
- *
- * ```js
- * var extglob = require('extglob');
- * extglob.capture(pattern, string[, options]);
- *
- * console.log(extglob.capture('test/*.js', 'test/foo.js'));
- * //=> ['foo']
- * console.log(extglob.capture('test/*.js', 'foo/bar.css'));
- * //=> null
- * ```
- * @param {String} `pattern` Glob pattern to use for matching.
- * @param {String} `string` String to match
- * @param {Object} `options` See available [options](#options) for changing how matches are performed
- * @return {Boolean} Returns an array of captures if the string matches the glob pattern, otherwise `null`.
- * @api public
- */
- extglob.capture = function (pattern, str, options) {
- var re = extglob.makeRe(pattern, extend({
- capture: true
- }, options));
- function match() {
- return function (string) {
- var match = re.exec(string);
- if (!match) {
- return null;
- }
- return match.slice(1);
- };
- }
- var capture = utils.memoize('capture', pattern, options, match);
- return capture(str);
- };
- /**
- * Create a regular expression from the given `pattern` and `options`.
- *
- * ```js
- * var extglob = require('extglob');
- * var re = extglob.makeRe('*.!(*a)');
- * console.log(re);
- * //=> /^[^\/]*?\.(?![^\/]*?a)[^\/]*?$/
- * ```
- * @param {String} `pattern` The pattern to convert to regex.
- * @param {Object} `options`
- * @return {RegExp}
- * @api public
- */
- extglob.makeRe = function (pattern, options) {
- if (pattern instanceof RegExp) {
- return pattern;
- }
- if (typeof pattern !== 'string') {
- throw new TypeError('expected pattern to be a string');
- }
- if (pattern.length > MAX_LENGTH) {
- throw new Error('expected pattern to be less than ' + MAX_LENGTH + ' characters');
- }
- function makeRe() {
- var opts = extend({
- strictErrors: false
- }, options);
- if (opts.strictErrors === true) opts.strict = true;
- var res = extglob.create(pattern, opts);
- return toRegex(res.output, opts);
- }
- var regex = utils.memoize('makeRe', pattern, options, makeRe);
- if (regex.source.length > MAX_LENGTH) {
- throw new SyntaxError('potentially malicious regex detected');
- }
- return regex;
- };
- /**
- * Cache
- */
- extglob.cache = utils.cache;
- extglob.clearCache = function () {
- extglob.cache.__data__ = {};
- };
- /**
- * Expose `Extglob` constructor, parsers and compilers
- */
- extglob.Extglob = Extglob;
- extglob.compilers = compilers;
- extglob.parsers = parsers;
- /**
- * Expose `extglob`
- * @type {Function}
- */
- module.exports = extglob;
- /***/ }),
- /***/ "./node_modules/extglob/lib/compilers.js":
- /*!***********************************************!*\
- !*** ./node_modules/extglob/lib/compilers.js ***!
- \***********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var brackets = __webpack_require__(/*! expand-brackets */ "./node_modules/expand-brackets/index.js");
- /**
- * Extglob compilers
- */
- module.exports = function (extglob) {
- function star() {
- if (typeof extglob.options.star === 'function') {
- return extglob.options.star.apply(this, arguments);
- }
- if (typeof extglob.options.star === 'string') {
- return extglob.options.star;
- }
- return '.*?';
- }
- /**
- * Use `expand-brackets` compilers
- */
- extglob.use(brackets.compilers);
- extglob.compiler
- /**
- * Escaped: "\\*"
- */
- .set('escape', function (node) {
- return this.emit(node.val, node);
- })
- /**
- * Dot: "."
- */
- .set('dot', function (node) {
- return this.emit('\\' + node.val, node);
- })
- /**
- * Question mark: "?"
- */
- .set('qmark', function (node) {
- var val = '[^\\\\/.]';
- var prev = this.prev();
- if (node.parsed.slice(-1) === '(') {
- var ch = node.rest.charAt(0);
- if (ch !== '!' && ch !== '=' && ch !== ':') {
- return this.emit(val, node);
- }
- return this.emit(node.val, node);
- }
- if (prev.type === 'text' && prev.val) {
- return this.emit(val, node);
- }
- if (node.val.length > 1) {
- val += '{' + node.val.length + '}';
- }
- return this.emit(val, node);
- })
- /**
- * Plus: "+"
- */
- .set('plus', function (node) {
- var prev = node.parsed.slice(-1);
- if (prev === ']' || prev === ')') {
- return this.emit(node.val, node);
- }
- var ch = this.output.slice(-1);
- if (!this.output || /[?*+]/.test(ch) && node.parent.type !== 'bracket') {
- return this.emit('\\+', node);
- }
- if (/\w/.test(ch) && !node.inside) {
- return this.emit('+\\+?', node);
- }
- return this.emit('+', node);
- })
- /**
- * Star: "*"
- */
- .set('star', function (node) {
- var prev = this.prev();
- var prefix = prev.type !== 'text' && prev.type !== 'escape' ? '(?!\\.)' : '';
- return this.emit(prefix + star.call(this, node), node);
- })
- /**
- * Parens
- */
- .set('paren', function (node) {
- return this.mapVisit(node.nodes);
- }).set('paren.open', function (node) {
- var capture = this.options.capture ? '(' : '';
- switch (node.parent.prefix) {
- case '!':
- case '^':
- return this.emit(capture + '(?:(?!(?:', node);
- case '*':
- case '+':
- case '?':
- case '@':
- return this.emit(capture + '(?:', node);
- default:
- {
- var val = node.val;
- if (this.options.bash === true) {
- val = '\\' + val;
- } else if (!this.options.capture && val === '(' && node.parent.rest[0] !== '?') {
- val += '?:';
- }
- return this.emit(val, node);
- }
- }
- }).set('paren.close', function (node) {
- var capture = this.options.capture ? ')' : '';
- switch (node.prefix) {
- case '!':
- case '^':
- var prefix = /^(\)|$)/.test(node.rest) ? '$' : '';
- var str = star.call(this, node); // if the extglob has a slash explicitly defined, we know the user wants
- // to match slashes, so we need to ensure the "star" regex allows for it
- if (node.parent.hasSlash && !this.options.star && this.options.slash !== false) {
- str = '.*?';
- }
- return this.emit(prefix + ('))' + str + ')') + capture, node);
- case '*':
- case '+':
- case '?':
- return this.emit(')' + node.prefix + capture, node);
- case '@':
- return this.emit(')' + capture, node);
- default:
- {
- var val = (this.options.bash === true ? '\\' : '') + ')';
- return this.emit(val, node);
- }
- }
- })
- /**
- * Text
- */
- .set('text', function (node) {
- var val = node.val.replace(/[\[\]]/g, '\\$&');
- return this.emit(val, node);
- });
- };
- /***/ }),
- /***/ "./node_modules/extglob/lib/extglob.js":
- /*!*********************************************!*\
- !*** ./node_modules/extglob/lib/extglob.js ***!
- \*********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /**
- * Module dependencies
- */
- var Snapdragon = __webpack_require__(/*! snapdragon */ "./node_modules/snapdragon/index.js");
- var define = __webpack_require__(/*! define-property */ "./node_modules/extglob/node_modules/define-property/index.js");
- var extend = __webpack_require__(/*! extend-shallow */ "./node_modules/extend-shallow/index.js");
- /**
- * Local dependencies
- */
- var compilers = __webpack_require__(/*! ./compilers */ "./node_modules/extglob/lib/compilers.js");
- var parsers = __webpack_require__(/*! ./parsers */ "./node_modules/extglob/lib/parsers.js");
- /**
- * Customize Snapdragon parser and renderer
- */
- function Extglob(options) {
- this.options = extend({
- source: 'extglob'
- }, options);
- this.snapdragon = this.options.snapdragon || new Snapdragon(this.options);
- this.snapdragon.patterns = this.snapdragon.patterns || {};
- this.compiler = this.snapdragon.compiler;
- this.parser = this.snapdragon.parser;
- compilers(this.snapdragon);
- parsers(this.snapdragon);
- /**
- * Override Snapdragon `.parse` method
- */
- define(this.snapdragon, 'parse', function (str, options) {
- var parsed = Snapdragon.prototype.parse.apply(this, arguments);
- parsed.input = str; // escape unmatched brace/bracket/parens
- var last = this.parser.stack.pop();
- if (last && this.options.strict !== true) {
- var node = last.nodes[0];
- node.val = '\\' + node.val;
- var sibling = node.parent.nodes[1];
- if (sibling.type === 'star') {
- sibling.loose = true;
- }
- } // add non-enumerable parser reference
- define(parsed, 'parser', this.parser);
- return parsed;
- });
- /**
- * Decorate `.parse` method
- */
- define(this, 'parse', function (ast, options) {
- return this.snapdragon.parse.apply(this.snapdragon, arguments);
- });
- /**
- * Decorate `.compile` method
- */
- define(this, 'compile', function (ast, options) {
- return this.snapdragon.compile.apply(this.snapdragon, arguments);
- });
- }
- /**
- * Expose `Extglob`
- */
- module.exports = Extglob;
- /***/ }),
- /***/ "./node_modules/extglob/lib/parsers.js":
- /*!*********************************************!*\
- !*** ./node_modules/extglob/lib/parsers.js ***!
- \*********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var brackets = __webpack_require__(/*! expand-brackets */ "./node_modules/expand-brackets/index.js");
- var define = __webpack_require__(/*! define-property */ "./node_modules/extglob/node_modules/define-property/index.js");
- var utils = __webpack_require__(/*! ./utils */ "./node_modules/extglob/lib/utils.js");
- /**
- * Characters to use in text regex (we want to "not" match
- * characters that are matched by other parsers)
- */
- var TEXT_REGEX = '([!@*?+]?\\(|\\)|[*?.+\\\\]|\\[:?(?=.*\\])|:?\\])+';
- var not = utils.createRegex(TEXT_REGEX);
- /**
- * Extglob parsers
- */
- function parsers(extglob) {
- extglob.state = extglob.state || {};
- /**
- * Use `expand-brackets` parsers
- */
- extglob.use(brackets.parsers);
- extglob.parser.sets.paren = extglob.parser.sets.paren || [];
- extglob.parser
- /**
- * Extglob open: "*("
- */
- .capture('paren.open', function () {
- var parsed = this.parsed;
- var pos = this.position();
- var m = this.match(/^([!@*?+])?\(/);
- if (!m) return;
- var prev = this.prev();
- var prefix = m[1];
- var val = m[0];
- var open = pos({
- type: 'paren.open',
- parsed: parsed,
- val: val
- });
- var node = pos({
- type: 'paren',
- prefix: prefix,
- nodes: [open]
- }); // if nested negation extglobs, just cancel them out to simplify
- if (prefix === '!' && prev.type === 'paren' && prev.prefix === '!') {
- prev.prefix = '@';
- node.prefix = '@';
- }
- define(node, 'rest', this.input);
- define(node, 'parsed', parsed);
- define(node, 'parent', prev);
- define(open, 'parent', node);
- this.push('paren', node);
- prev.nodes.push(node);
- })
- /**
- * Extglob close: ")"
- */
- .capture('paren.close', function () {
- var parsed = this.parsed;
- var pos = this.position();
- var m = this.match(/^\)/);
- if (!m) return;
- var parent = this.pop('paren');
- var node = pos({
- type: 'paren.close',
- rest: this.input,
- parsed: parsed,
- val: m[0]
- });
- if (!this.isType(parent, 'paren')) {
- if (this.options.strict) {
- throw new Error('missing opening paren: "("');
- }
- node.escaped = true;
- return node;
- }
- node.prefix = parent.prefix;
- parent.nodes.push(node);
- define(node, 'parent', parent);
- })
- /**
- * Escape: "\\."
- */
- .capture('escape', function () {
- var pos = this.position();
- var m = this.match(/^\\(.)/);
- if (!m) return;
- return pos({
- type: 'escape',
- val: m[0],
- ch: m[1]
- });
- })
- /**
- * Question marks: "?"
- */
- .capture('qmark', function () {
- var parsed = this.parsed;
- var pos = this.position();
- var m = this.match(/^\?+(?!\()/);
- if (!m) return;
- extglob.state.metachar = true;
- return pos({
- type: 'qmark',
- rest: this.input,
- parsed: parsed,
- val: m[0]
- });
- })
- /**
- * Character parsers
- */
- .capture('star', /^\*(?!\()/).capture('plus', /^\+(?!\()/).capture('dot', /^\./).capture('text', not);
- }
- ;
- /**
- * Expose text regex string
- */
- module.exports.TEXT_REGEX = TEXT_REGEX;
- /**
- * Extglob parsers
- */
- module.exports = parsers;
- /***/ }),
- /***/ "./node_modules/extglob/lib/utils.js":
- /*!*******************************************!*\
- !*** ./node_modules/extglob/lib/utils.js ***!
- \*******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var regex = __webpack_require__(/*! regex-not */ "./node_modules/regex-not/index.js");
- var Cache = __webpack_require__(/*! fragment-cache */ "./node_modules/fragment-cache/index.js");
- /**
- * Utils
- */
- var utils = module.exports;
- var cache = utils.cache = new Cache();
- /**
- * Cast `val` to an array
- * @return {Array}
- */
- utils.arrayify = function (val) {
- if (!Array.isArray(val)) {
- return [val];
- }
- return val;
- };
- /**
- * Memoize a generated regex or function
- */
- utils.memoize = function (type, pattern, options, fn) {
- var key = utils.createKey(type + pattern, options);
- if (cache.has(type, key)) {
- return cache.get(type, key);
- }
- var val = fn(pattern, options);
- if (options && options.cache === false) {
- return val;
- }
- cache.set(type, key, val);
- return val;
- };
- /**
- * Create the key to use for memoization. The key is generated
- * by iterating over the options and concatenating key-value pairs
- * to the pattern string.
- */
- utils.createKey = function (pattern, options) {
- var key = pattern;
- if (typeof options === 'undefined') {
- return key;
- }
- for (var prop in options) {
- key += ';' + prop + '=' + String(options[prop]);
- }
- return key;
- };
- /**
- * Create the regex to use for matching text
- */
- utils.createRegex = function (str) {
- var opts = {
- contains: true,
- strictClose: false
- };
- return regex(str, opts);
- };
- /***/ }),
- /***/ "./node_modules/extglob/node_modules/define-property/index.js":
- /*!********************************************************************!*\
- !*** ./node_modules/extglob/node_modules/define-property/index.js ***!
- \********************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * define-property <https://github.com/jonschlinkert/define-property>
- *
- * Copyright (c) 2015, 2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- var isDescriptor = __webpack_require__(/*! is-descriptor */ "./node_modules/is-descriptor/index.js");
- module.exports = function defineProperty(obj, prop, val) {
- if (_typeof(obj) !== 'object' && typeof obj !== 'function') {
- throw new TypeError('expected an object or function.');
- }
- if (typeof prop !== 'string') {
- throw new TypeError('expected `prop` to be a string.');
- }
- if (isDescriptor(val) && ('set' in val || 'get' in val)) {
- return Object.defineProperty(obj, prop, val);
- }
- return Object.defineProperty(obj, prop, {
- configurable: true,
- enumerable: false,
- writable: true,
- value: val
- });
- };
- /***/ }),
- /***/ "./node_modules/fill-range/index.js":
- /*!******************************************!*\
- !*** ./node_modules/fill-range/index.js ***!
- \******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * fill-range <https://github.com/jonschlinkert/fill-range>
- *
- * Copyright (c) 2014-2015, 2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- var util = __webpack_require__(/*! util */ "./node_modules/util/util.js");
- var isNumber = __webpack_require__(/*! is-number */ "./node_modules/is-number/index.js");
- var extend = __webpack_require__(/*! extend-shallow */ "./node_modules/extend-shallow/index.js");
- var repeat = __webpack_require__(/*! repeat-string */ "./node_modules/repeat-string/index.js");
- var toRegex = __webpack_require__(/*! to-regex-range */ "./node_modules/to-regex-range/index.js");
- /**
- * Return a range of numbers or letters.
- *
- * @param {String} `start` Start of the range
- * @param {String} `stop` End of the range
- * @param {String} `step` Increment or decrement to use.
- * @param {Function} `fn` Custom function to modify each element in the range.
- * @return {Array}
- */
- function fillRange(start, stop, step, options) {
- if (typeof start === 'undefined') {
- return [];
- }
- if (typeof stop === 'undefined' || start === stop) {
- // special case, for handling negative zero
- var isString = typeof start === 'string';
- if (isNumber(start) && !toNumber(start)) {
- return [isString ? '0' : 0];
- }
- return [start];
- }
- if (typeof step !== 'number' && typeof step !== 'string') {
- options = step;
- step = undefined;
- }
- if (typeof options === 'function') {
- options = {
- transform: options
- };
- }
- var opts = extend({
- step: step
- }, options);
- if (opts.step && !isValidNumber(opts.step)) {
- if (opts.strictRanges === true) {
- throw new TypeError('expected options.step to be a number');
- }
- return [];
- }
- opts.isNumber = isValidNumber(start) && isValidNumber(stop);
- if (!opts.isNumber && !isValid(start, stop)) {
- if (opts.strictRanges === true) {
- throw new RangeError('invalid range arguments: ' + util.inspect([start, stop]));
- }
- return [];
- }
- opts.isPadded = isPadded(start) || isPadded(stop);
- opts.toString = opts.stringify || typeof opts.step === 'string' || typeof start === 'string' || typeof stop === 'string' || !opts.isNumber;
- if (opts.isPadded) {
- opts.maxLength = Math.max(String(start).length, String(stop).length);
- } // support legacy minimatch/fill-range options
- if (typeof opts.optimize === 'boolean') opts.toRegex = opts.optimize;
- if (typeof opts.makeRe === 'boolean') opts.toRegex = opts.makeRe;
- return expand(start, stop, opts);
- }
- function expand(start, stop, options) {
- var a = options.isNumber ? toNumber(start) : start.charCodeAt(0);
- var b = options.isNumber ? toNumber(stop) : stop.charCodeAt(0);
- var step = Math.abs(toNumber(options.step)) || 1;
- if (options.toRegex && step === 1) {
- return toRange(a, b, start, stop, options);
- }
- var zero = {
- greater: [],
- lesser: []
- };
- var asc = a < b;
- var arr = new Array(Math.round((asc ? b - a : a - b) / step));
- var idx = 0;
- while (asc ? a <= b : a >= b) {
- var val = options.isNumber ? a : String.fromCharCode(a);
- if (options.toRegex && (val >= 0 || !options.isNumber)) {
- zero.greater.push(val);
- } else {
- zero.lesser.push(Math.abs(val));
- }
- if (options.isPadded) {
- val = zeros(val, options);
- }
- if (options.toString) {
- val = String(val);
- }
- if (typeof options.transform === 'function') {
- arr[idx++] = options.transform(val, a, b, step, idx, arr, options);
- } else {
- arr[idx++] = val;
- }
- if (asc) {
- a += step;
- } else {
- a -= step;
- }
- }
- if (options.toRegex === true) {
- return toSequence(arr, zero, options);
- }
- return arr;
- }
- function toRange(a, b, start, stop, options) {
- if (options.isPadded) {
- return toRegex(start, stop, options);
- }
- if (options.isNumber) {
- return toRegex(Math.min(a, b), Math.max(a, b), options);
- }
- var start = String.fromCharCode(Math.min(a, b));
- var stop = String.fromCharCode(Math.max(a, b));
- return '[' + start + '-' + stop + ']';
- }
- function toSequence(arr, zeros, options) {
- var greater = '',
- lesser = '';
- if (zeros.greater.length) {
- greater = zeros.greater.join('|');
- }
- if (zeros.lesser.length) {
- lesser = '-(' + zeros.lesser.join('|') + ')';
- }
- var res = greater && lesser ? greater + '|' + lesser : greater || lesser;
- if (options.capture) {
- return '(' + res + ')';
- }
- return res;
- }
- function zeros(val, options) {
- if (options.isPadded) {
- var str = String(val);
- var len = str.length;
- var dash = '';
- if (str.charAt(0) === '-') {
- dash = '-';
- str = str.slice(1);
- }
- var diff = options.maxLength - len;
- var pad = repeat('0', diff);
- val = dash + pad + str;
- }
- if (options.stringify) {
- return String(val);
- }
- return val;
- }
- function toNumber(val) {
- return Number(val) || 0;
- }
- function isPadded(str) {
- return /^-?0\d/.test(str);
- }
- function isValid(min, max) {
- return (isValidNumber(min) || isValidLetter(min)) && (isValidNumber(max) || isValidLetter(max));
- }
- function isValidLetter(ch) {
- return typeof ch === 'string' && ch.length === 1 && /^\w+$/.test(ch);
- }
- function isValidNumber(n) {
- return isNumber(n) && !/\./.test(n);
- }
- /**
- * Expose `fillRange`
- * @type {Function}
- */
- module.exports = fillRange;
- /***/ }),
- /***/ "./node_modules/for-in/index.js":
- /*!**************************************!*\
- !*** ./node_modules/for-in/index.js ***!
- \**************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * for-in <https://github.com/jonschlinkert/for-in>
- *
- * Copyright (c) 2014-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- module.exports = function forIn(obj, fn, thisArg) {
- for (var key in obj) {
- if (fn.call(thisArg, obj[key], key, obj) === false) {
- break;
- }
- }
- };
- /***/ }),
- /***/ "./node_modules/fragment-cache/index.js":
- /*!**********************************************!*\
- !*** ./node_modules/fragment-cache/index.js ***!
- \**********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * fragment-cache <https://github.com/jonschlinkert/fragment-cache>
- *
- * Copyright (c) 2016-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- var MapCache = __webpack_require__(/*! map-cache */ "./node_modules/map-cache/index.js");
- /**
- * Create a new `FragmentCache` with an optional object to use for `caches`.
- *
- * ```js
- * var fragment = new FragmentCache();
- * ```
- * @name FragmentCache
- * @param {String} `cacheName`
- * @return {Object} Returns the [map-cache][] instance.
- * @api public
- */
- function FragmentCache(caches) {
- this.caches = caches || {};
- }
- /**
- * Prototype
- */
- FragmentCache.prototype = {
- /**
- * Get cache `name` from the `fragment.caches` object. Creates a new
- * `MapCache` if it doesn't already exist.
- *
- * ```js
- * var cache = fragment.cache('files');
- * console.log(fragment.caches.hasOwnProperty('files'));
- * //=> true
- * ```
- * @name .cache
- * @param {String} `cacheName`
- * @return {Object} Returns the [map-cache][] instance.
- * @api public
- */
- cache: function cache(cacheName) {
- return this.caches[cacheName] || (this.caches[cacheName] = new MapCache());
- },
- /**
- * Set a value for property `key` on cache `name`
- *
- * ```js
- * fragment.set('files', 'somefile.js', new File({path: 'somefile.js'}));
- * ```
- * @name .set
- * @param {String} `name`
- * @param {String} `key` Property name to set
- * @param {any} `val` The value of `key`
- * @return {Object} The cache instance for chaining
- * @api public
- */
- set: function set(cacheName, key, val) {
- var cache = this.cache(cacheName);
- cache.set(key, val);
- return cache;
- },
- /**
- * Returns true if a non-undefined value is set for `key` on fragment cache `name`.
- *
- * ```js
- * var cache = fragment.cache('files');
- * cache.set('somefile.js');
- *
- * console.log(cache.has('somefile.js'));
- * //=> true
- *
- * console.log(cache.has('some-other-file.js'));
- * //=> false
- * ```
- * @name .has
- * @param {String} `name` Cache name
- * @param {String} `key` Optionally specify a property to check for on cache `name`
- * @return {Boolean}
- * @api public
- */
- has: function has(cacheName, key) {
- return typeof this.get(cacheName, key) !== 'undefined';
- },
- /**
- * Get `name`, or if specified, the value of `key`. Invokes the [cache]() method,
- * so that cache `name` will be created it doesn't already exist. If `key` is not passed,
- * the entire cache (`name`) is returned.
- *
- * ```js
- * var Vinyl = require('vinyl');
- * var cache = fragment.cache('files');
- * cache.set('somefile.js', new Vinyl({path: 'somefile.js'}));
- * console.log(cache.get('somefile.js'));
- * //=> <File "somefile.js">
- * ```
- * @name .get
- * @param {String} `name`
- * @return {Object} Returns cache `name`, or the value of `key` if specified
- * @api public
- */
- get: function get(name, key) {
- var cache = this.cache(name);
- if (typeof key === 'string') {
- return cache.get(key);
- }
- return cache;
- }
- };
- /**
- * Expose `FragmentCache`
- */
- exports = module.exports = FragmentCache;
- /***/ }),
- /***/ "./node_modules/get-value/index.js":
- /*!*****************************************!*\
- !*** ./node_modules/get-value/index.js ***!
- \*****************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- /*!
- * get-value <https://github.com/jonschlinkert/get-value>
- *
- * Copyright (c) 2014-2015, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- module.exports = function (obj, prop, a, b, c) {
- if (!isObject(obj) || !prop) {
- return obj;
- }
- prop = toString(prop); // allowing for multiple properties to be passed as
- // a string or array, but much faster (3-4x) than doing
- // `[].slice.call(arguments)`
- if (a) prop += '.' + toString(a);
- if (b) prop += '.' + toString(b);
- if (c) prop += '.' + toString(c);
- if (prop in obj) {
- return obj[prop];
- }
- var segs = prop.split('.');
- var len = segs.length;
- var i = -1;
- while (obj && ++i < len) {
- var key = segs[i];
- while (key[key.length - 1] === '\\') {
- key = key.slice(0, -1) + '.' + segs[++i];
- }
- obj = obj[key];
- }
- return obj;
- };
- function isObject(val) {
- return val !== null && (_typeof(val) === 'object' || typeof val === 'function');
- }
- function toString(val) {
- if (!val) return '';
- if (Array.isArray(val)) {
- return val.join('.');
- }
- return val;
- }
- /***/ }),
- /***/ "./node_modules/has-value/index.js":
- /*!*****************************************!*\
- !*** ./node_modules/has-value/index.js ***!
- \*****************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * has-value <https://github.com/jonschlinkert/has-value>
- *
- * Copyright (c) 2014-2017, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- var isObject = __webpack_require__(/*! isobject */ "./node_modules/isobject/index.js");
- var hasValues = __webpack_require__(/*! has-values */ "./node_modules/has-values/index.js");
- var get = __webpack_require__(/*! get-value */ "./node_modules/get-value/index.js");
- module.exports = function (val, prop) {
- return hasValues(isObject(val) && prop ? get(val, prop) : val);
- };
- /***/ }),
- /***/ "./node_modules/has-values/index.js":
- /*!******************************************!*\
- !*** ./node_modules/has-values/index.js ***!
- \******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * has-values <https://github.com/jonschlinkert/has-values>
- *
- * Copyright (c) 2014-2015, 2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- var typeOf = __webpack_require__(/*! kind-of */ "./node_modules/has-values/node_modules/kind-of/index.js");
- var isNumber = __webpack_require__(/*! is-number */ "./node_modules/is-number/index.js");
- module.exports = function hasValue(val) {
- // is-number checks for NaN and other edge cases
- if (isNumber(val)) {
- return true;
- }
- switch (typeOf(val)) {
- case 'null':
- case 'boolean':
- case 'function':
- return true;
- case 'string':
- case 'arguments':
- return val.length !== 0;
- case 'error':
- return val.message !== '';
- case 'array':
- var len = val.length;
- if (len === 0) {
- return false;
- }
- for (var i = 0; i < len; i++) {
- if (hasValue(val[i])) {
- return true;
- }
- }
- return false;
- case 'file':
- case 'map':
- case 'set':
- return val.size !== 0;
- case 'object':
- var keys = Object.keys(val);
- if (keys.length === 0) {
- return false;
- }
- for (var i = 0; i < keys.length; i++) {
- var key = keys[i];
- if (hasValue(val[key])) {
- return true;
- }
- }
- return false;
- default:
- {
- return false;
- }
- }
- };
- /***/ }),
- /***/ "./node_modules/has-values/node_modules/kind-of/index.js":
- /*!***************************************************************!*\
- !*** ./node_modules/has-values/node_modules/kind-of/index.js ***!
- \***************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var isBuffer = __webpack_require__(/*! is-buffer */ "./node_modules/is-buffer/index.js");
- var toString = Object.prototype.toString;
- /**
- * Get the native `typeof` a value.
- *
- * @param {*} `val`
- * @return {*} Native javascript type
- */
- module.exports = function kindOf(val) {
- // primitivies
- if (typeof val === 'undefined') {
- return 'undefined';
- }
- if (val === null) {
- return 'null';
- }
- if (val === true || val === false || val instanceof Boolean) {
- return 'boolean';
- }
- if (typeof val === 'string' || val instanceof String) {
- return 'string';
- }
- if (typeof val === 'number' || val instanceof Number) {
- return 'number';
- } // functions
- if (typeof val === 'function' || val instanceof Function) {
- return 'function';
- } // array
- if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) {
- return 'array';
- } // check for instances of RegExp and Date before calling `toString`
- if (val instanceof RegExp) {
- return 'regexp';
- }
- if (val instanceof Date) {
- return 'date';
- } // other objects
- var type = toString.call(val);
- if (type === '[object RegExp]') {
- return 'regexp';
- }
- if (type === '[object Date]') {
- return 'date';
- }
- if (type === '[object Arguments]') {
- return 'arguments';
- }
- if (type === '[object Error]') {
- return 'error';
- }
- if (type === '[object Promise]') {
- return 'promise';
- } // buffer
- if (isBuffer(val)) {
- return 'buffer';
- } // es6: Map, WeakMap, Set, WeakSet
- if (type === '[object Set]') {
- return 'set';
- }
- if (type === '[object WeakSet]') {
- return 'weakset';
- }
- if (type === '[object Map]') {
- return 'map';
- }
- if (type === '[object WeakMap]') {
- return 'weakmap';
- }
- if (type === '[object Symbol]') {
- return 'symbol';
- } // typed arrays
- if (type === '[object Int8Array]') {
- return 'int8array';
- }
- if (type === '[object Uint8Array]') {
- return 'uint8array';
- }
- if (type === '[object Uint8ClampedArray]') {
- return 'uint8clampedarray';
- }
- if (type === '[object Int16Array]') {
- return 'int16array';
- }
- if (type === '[object Uint16Array]') {
- return 'uint16array';
- }
- if (type === '[object Int32Array]') {
- return 'int32array';
- }
- if (type === '[object Uint32Array]') {
- return 'uint32array';
- }
- if (type === '[object Float32Array]') {
- return 'float32array';
- }
- if (type === '[object Float64Array]') {
- return 'float64array';
- } // must be a plain object
- return 'object';
- };
- /***/ }),
- /***/ "./node_modules/is-accessor-descriptor/index.js":
- /*!******************************************************!*\
- !*** ./node_modules/is-accessor-descriptor/index.js ***!
- \******************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * is-accessor-descriptor <https://github.com/jonschlinkert/is-accessor-descriptor>
- *
- * Copyright (c) 2015-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- var typeOf = __webpack_require__(/*! kind-of */ "./node_modules/is-accessor-descriptor/node_modules/kind-of/index.js"); // accessor descriptor properties
- var accessor = {
- get: 'function',
- set: 'function',
- configurable: 'boolean',
- enumerable: 'boolean'
- };
- function isAccessorDescriptor(obj, prop) {
- if (typeof prop === 'string') {
- var val = Object.getOwnPropertyDescriptor(obj, prop);
- return typeof val !== 'undefined';
- }
- if (typeOf(obj) !== 'object') {
- return false;
- }
- if (has(obj, 'value') || has(obj, 'writable')) {
- return false;
- }
- if (!has(obj, 'get') || typeof obj.get !== 'function') {
- return false;
- } // tldr: it's valid to have "set" be undefined
- // "set" might be undefined if `Object.getOwnPropertyDescriptor`
- // was used to get the value, and only `get` was defined by the user
- if (has(obj, 'set') && typeof obj[key] !== 'function' && typeof obj[key] !== 'undefined') {
- return false;
- }
- for (var key in obj) {
- if (!accessor.hasOwnProperty(key)) {
- continue;
- }
- if (typeOf(obj[key]) === accessor[key]) {
- continue;
- }
- if (typeof obj[key] !== 'undefined') {
- return false;
- }
- }
- return true;
- }
- function has(obj, key) {
- return {}.hasOwnProperty.call(obj, key);
- }
- /**
- * Expose `isAccessorDescriptor`
- */
- module.exports = isAccessorDescriptor;
- /***/ }),
- /***/ "./node_modules/is-accessor-descriptor/node_modules/kind-of/index.js":
- /*!***************************************************************************!*\
- !*** ./node_modules/is-accessor-descriptor/node_modules/kind-of/index.js ***!
- \***************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- var toString = Object.prototype.toString;
- module.exports = function kindOf(val) {
- if (val === void 0) return 'undefined';
- if (val === null) return 'null';
- var type = _typeof(val);
- if (type === 'boolean') return 'boolean';
- if (type === 'string') return 'string';
- if (type === 'number') return 'number';
- if (type === 'symbol') return 'symbol';
- if (type === 'function') {
- return isGeneratorFn(val) ? 'generatorfunction' : 'function';
- }
- if (isArray(val)) return 'array';
- if (isBuffer(val)) return 'buffer';
- if (isArguments(val)) return 'arguments';
- if (isDate(val)) return 'date';
- if (isError(val)) return 'error';
- if (isRegexp(val)) return 'regexp';
- switch (ctorName(val)) {
- case 'Symbol':
- return 'symbol';
- case 'Promise':
- return 'promise';
- // Set, Map, WeakSet, WeakMap
- case 'WeakMap':
- return 'weakmap';
- case 'WeakSet':
- return 'weakset';
- case 'Map':
- return 'map';
- case 'Set':
- return 'set';
- // 8-bit typed arrays
- case 'Int8Array':
- return 'int8array';
- case 'Uint8Array':
- return 'uint8array';
- case 'Uint8ClampedArray':
- return 'uint8clampedarray';
- // 16-bit typed arrays
- case 'Int16Array':
- return 'int16array';
- case 'Uint16Array':
- return 'uint16array';
- // 32-bit typed arrays
- case 'Int32Array':
- return 'int32array';
- case 'Uint32Array':
- return 'uint32array';
- case 'Float32Array':
- return 'float32array';
- case 'Float64Array':
- return 'float64array';
- }
- if (isGeneratorObj(val)) {
- return 'generator';
- } // Non-plain objects
- type = toString.call(val);
- switch (type) {
- case '[object Object]':
- return 'object';
- // iterators
- case '[object Map Iterator]':
- return 'mapiterator';
- case '[object Set Iterator]':
- return 'setiterator';
- case '[object String Iterator]':
- return 'stringiterator';
- case '[object Array Iterator]':
- return 'arrayiterator';
- } // other
- return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
- };
- function ctorName(val) {
- return val.constructor ? val.constructor.name : null;
- }
- function isArray(val) {
- if (Array.isArray) return Array.isArray(val);
- return val instanceof Array;
- }
- function isError(val) {
- return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number';
- }
- function isDate(val) {
- if (val instanceof Date) return true;
- return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function';
- }
- function isRegexp(val) {
- if (val instanceof RegExp) return true;
- return typeof val.flags === 'string' && typeof val.ignoreCase === 'boolean' && typeof val.multiline === 'boolean' && typeof val.global === 'boolean';
- }
- function isGeneratorFn(name, val) {
- return ctorName(name) === 'GeneratorFunction';
- }
- function isGeneratorObj(val) {
- return typeof val.throw === 'function' && typeof val.return === 'function' && typeof val.next === 'function';
- }
- function isArguments(val) {
- try {
- if (typeof val.length === 'number' && typeof val.callee === 'function') {
- return true;
- }
- } catch (err) {
- if (err.message.indexOf('callee') !== -1) {
- return true;
- }
- }
- return false;
- }
- /**
- * If you need to support Safari 5-7 (8-10 yr-old browser),
- * take a look at https://github.com/feross/is-buffer
- */
- function isBuffer(val) {
- if (val.constructor && typeof val.constructor.isBuffer === 'function') {
- return val.constructor.isBuffer(val);
- }
- return false;
- }
- /***/ }),
- /***/ "./node_modules/is-buffer/index.js":
- /*!*****************************************!*\
- !*** ./node_modules/is-buffer/index.js ***!
- \*****************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * Determine if an object is a Buffer
- *
- * @author Feross Aboukhadijeh <https://feross.org>
- * @license MIT
- */
- // The _isBuffer check is for Safari 5-7 support, because it's missing
- // Object.prototype.constructor. Remove this eventually
- module.exports = function (obj) {
- return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer);
- };
- function isBuffer(obj) {
- return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj);
- } // For Node v0.10 support. Remove this eventually.
- function isSlowBuffer(obj) {
- return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0));
- }
- /***/ }),
- /***/ "./node_modules/is-data-descriptor/index.js":
- /*!**************************************************!*\
- !*** ./node_modules/is-data-descriptor/index.js ***!
- \**************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * is-data-descriptor <https://github.com/jonschlinkert/is-data-descriptor>
- *
- * Copyright (c) 2015-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- var typeOf = __webpack_require__(/*! kind-of */ "./node_modules/is-data-descriptor/node_modules/kind-of/index.js");
- module.exports = function isDataDescriptor(obj, prop) {
- // data descriptor properties
- var data = {
- configurable: 'boolean',
- enumerable: 'boolean',
- writable: 'boolean'
- };
- if (typeOf(obj) !== 'object') {
- return false;
- }
- if (typeof prop === 'string') {
- var val = Object.getOwnPropertyDescriptor(obj, prop);
- return typeof val !== 'undefined';
- }
- if (!('value' in obj) && !('writable' in obj)) {
- return false;
- }
- for (var key in obj) {
- if (key === 'value') continue;
- if (!data.hasOwnProperty(key)) {
- continue;
- }
- if (typeOf(obj[key]) === data[key]) {
- continue;
- }
- if (typeof obj[key] !== 'undefined') {
- return false;
- }
- }
- return true;
- };
- /***/ }),
- /***/ "./node_modules/is-data-descriptor/node_modules/kind-of/index.js":
- /*!***********************************************************************!*\
- !*** ./node_modules/is-data-descriptor/node_modules/kind-of/index.js ***!
- \***********************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- var toString = Object.prototype.toString;
- module.exports = function kindOf(val) {
- if (val === void 0) return 'undefined';
- if (val === null) return 'null';
- var type = _typeof(val);
- if (type === 'boolean') return 'boolean';
- if (type === 'string') return 'string';
- if (type === 'number') return 'number';
- if (type === 'symbol') return 'symbol';
- if (type === 'function') {
- return isGeneratorFn(val) ? 'generatorfunction' : 'function';
- }
- if (isArray(val)) return 'array';
- if (isBuffer(val)) return 'buffer';
- if (isArguments(val)) return 'arguments';
- if (isDate(val)) return 'date';
- if (isError(val)) return 'error';
- if (isRegexp(val)) return 'regexp';
- switch (ctorName(val)) {
- case 'Symbol':
- return 'symbol';
- case 'Promise':
- return 'promise';
- // Set, Map, WeakSet, WeakMap
- case 'WeakMap':
- return 'weakmap';
- case 'WeakSet':
- return 'weakset';
- case 'Map':
- return 'map';
- case 'Set':
- return 'set';
- // 8-bit typed arrays
- case 'Int8Array':
- return 'int8array';
- case 'Uint8Array':
- return 'uint8array';
- case 'Uint8ClampedArray':
- return 'uint8clampedarray';
- // 16-bit typed arrays
- case 'Int16Array':
- return 'int16array';
- case 'Uint16Array':
- return 'uint16array';
- // 32-bit typed arrays
- case 'Int32Array':
- return 'int32array';
- case 'Uint32Array':
- return 'uint32array';
- case 'Float32Array':
- return 'float32array';
- case 'Float64Array':
- return 'float64array';
- }
- if (isGeneratorObj(val)) {
- return 'generator';
- } // Non-plain objects
- type = toString.call(val);
- switch (type) {
- case '[object Object]':
- return 'object';
- // iterators
- case '[object Map Iterator]':
- return 'mapiterator';
- case '[object Set Iterator]':
- return 'setiterator';
- case '[object String Iterator]':
- return 'stringiterator';
- case '[object Array Iterator]':
- return 'arrayiterator';
- } // other
- return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
- };
- function ctorName(val) {
- return val.constructor ? val.constructor.name : null;
- }
- function isArray(val) {
- if (Array.isArray) return Array.isArray(val);
- return val instanceof Array;
- }
- function isError(val) {
- return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number';
- }
- function isDate(val) {
- if (val instanceof Date) return true;
- return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function';
- }
- function isRegexp(val) {
- if (val instanceof RegExp) return true;
- return typeof val.flags === 'string' && typeof val.ignoreCase === 'boolean' && typeof val.multiline === 'boolean' && typeof val.global === 'boolean';
- }
- function isGeneratorFn(name, val) {
- return ctorName(name) === 'GeneratorFunction';
- }
- function isGeneratorObj(val) {
- return typeof val.throw === 'function' && typeof val.return === 'function' && typeof val.next === 'function';
- }
- function isArguments(val) {
- try {
- if (typeof val.length === 'number' && typeof val.callee === 'function') {
- return true;
- }
- } catch (err) {
- if (err.message.indexOf('callee') !== -1) {
- return true;
- }
- }
- return false;
- }
- /**
- * If you need to support Safari 5-7 (8-10 yr-old browser),
- * take a look at https://github.com/feross/is-buffer
- */
- function isBuffer(val) {
- if (val.constructor && typeof val.constructor.isBuffer === 'function') {
- return val.constructor.isBuffer(val);
- }
- return false;
- }
- /***/ }),
- /***/ "./node_modules/is-descriptor/index.js":
- /*!*********************************************!*\
- !*** ./node_modules/is-descriptor/index.js ***!
- \*********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * is-descriptor <https://github.com/jonschlinkert/is-descriptor>
- *
- * Copyright (c) 2015-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- var typeOf = __webpack_require__(/*! kind-of */ "./node_modules/is-descriptor/node_modules/kind-of/index.js");
- var isAccessor = __webpack_require__(/*! is-accessor-descriptor */ "./node_modules/is-accessor-descriptor/index.js");
- var isData = __webpack_require__(/*! is-data-descriptor */ "./node_modules/is-data-descriptor/index.js");
- module.exports = function isDescriptor(obj, key) {
- if (typeOf(obj) !== 'object') {
- return false;
- }
- if ('get' in obj) {
- return isAccessor(obj, key);
- }
- return isData(obj, key);
- };
- /***/ }),
- /***/ "./node_modules/is-descriptor/node_modules/kind-of/index.js":
- /*!******************************************************************!*\
- !*** ./node_modules/is-descriptor/node_modules/kind-of/index.js ***!
- \******************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- var toString = Object.prototype.toString;
- module.exports = function kindOf(val) {
- if (val === void 0) return 'undefined';
- if (val === null) return 'null';
- var type = _typeof(val);
- if (type === 'boolean') return 'boolean';
- if (type === 'string') return 'string';
- if (type === 'number') return 'number';
- if (type === 'symbol') return 'symbol';
- if (type === 'function') {
- return isGeneratorFn(val) ? 'generatorfunction' : 'function';
- }
- if (isArray(val)) return 'array';
- if (isBuffer(val)) return 'buffer';
- if (isArguments(val)) return 'arguments';
- if (isDate(val)) return 'date';
- if (isError(val)) return 'error';
- if (isRegexp(val)) return 'regexp';
- switch (ctorName(val)) {
- case 'Symbol':
- return 'symbol';
- case 'Promise':
- return 'promise';
- // Set, Map, WeakSet, WeakMap
- case 'WeakMap':
- return 'weakmap';
- case 'WeakSet':
- return 'weakset';
- case 'Map':
- return 'map';
- case 'Set':
- return 'set';
- // 8-bit typed arrays
- case 'Int8Array':
- return 'int8array';
- case 'Uint8Array':
- return 'uint8array';
- case 'Uint8ClampedArray':
- return 'uint8clampedarray';
- // 16-bit typed arrays
- case 'Int16Array':
- return 'int16array';
- case 'Uint16Array':
- return 'uint16array';
- // 32-bit typed arrays
- case 'Int32Array':
- return 'int32array';
- case 'Uint32Array':
- return 'uint32array';
- case 'Float32Array':
- return 'float32array';
- case 'Float64Array':
- return 'float64array';
- }
- if (isGeneratorObj(val)) {
- return 'generator';
- } // Non-plain objects
- type = toString.call(val);
- switch (type) {
- case '[object Object]':
- return 'object';
- // iterators
- case '[object Map Iterator]':
- return 'mapiterator';
- case '[object Set Iterator]':
- return 'setiterator';
- case '[object String Iterator]':
- return 'stringiterator';
- case '[object Array Iterator]':
- return 'arrayiterator';
- } // other
- return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
- };
- function ctorName(val) {
- return val.constructor ? val.constructor.name : null;
- }
- function isArray(val) {
- if (Array.isArray) return Array.isArray(val);
- return val instanceof Array;
- }
- function isError(val) {
- return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number';
- }
- function isDate(val) {
- if (val instanceof Date) return true;
- return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function';
- }
- function isRegexp(val) {
- if (val instanceof RegExp) return true;
- return typeof val.flags === 'string' && typeof val.ignoreCase === 'boolean' && typeof val.multiline === 'boolean' && typeof val.global === 'boolean';
- }
- function isGeneratorFn(name, val) {
- return ctorName(name) === 'GeneratorFunction';
- }
- function isGeneratorObj(val) {
- return typeof val.throw === 'function' && typeof val.return === 'function' && typeof val.next === 'function';
- }
- function isArguments(val) {
- try {
- if (typeof val.length === 'number' && typeof val.callee === 'function') {
- return true;
- }
- } catch (err) {
- if (err.message.indexOf('callee') !== -1) {
- return true;
- }
- }
- return false;
- }
- /**
- * If you need to support Safari 5-7 (8-10 yr-old browser),
- * take a look at https://github.com/feross/is-buffer
- */
- function isBuffer(val) {
- if (val.constructor && typeof val.constructor.isBuffer === 'function') {
- return val.constructor.isBuffer(val);
- }
- return false;
- }
- /***/ }),
- /***/ "./node_modules/is-extendable/index.js":
- /*!*********************************************!*\
- !*** ./node_modules/is-extendable/index.js ***!
- \*********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * is-extendable <https://github.com/jonschlinkert/is-extendable>
- *
- * Copyright (c) 2015, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- module.exports = function isExtendable(val) {
- return typeof val !== 'undefined' && val !== null && (_typeof(val) === 'object' || typeof val === 'function');
- };
- /***/ }),
- /***/ "./node_modules/is-number/index.js":
- /*!*****************************************!*\
- !*** ./node_modules/is-number/index.js ***!
- \*****************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * is-number <https://github.com/jonschlinkert/is-number>
- *
- * Copyright (c) 2014-2015, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- var typeOf = __webpack_require__(/*! kind-of */ "./node_modules/kind-of/index.js");
- module.exports = function isNumber(num) {
- var type = typeOf(num);
- if (type === 'string') {
- if (!num.trim()) return false;
- } else if (type !== 'number') {
- return false;
- }
- return num - num + 1 >= 0;
- };
- /***/ }),
- /***/ "./node_modules/is-plain-object/index.js":
- /*!***********************************************!*\
- !*** ./node_modules/is-plain-object/index.js ***!
- \***********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
- *
- * Copyright (c) 2014-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- var isObject = __webpack_require__(/*! isobject */ "./node_modules/isobject/index.js");
- function isObjectObject(o) {
- return isObject(o) === true && Object.prototype.toString.call(o) === '[object Object]';
- }
- module.exports = function isPlainObject(o) {
- var ctor, prot;
- if (isObjectObject(o) === false) return false; // If has modified constructor
- ctor = o.constructor;
- if (typeof ctor !== 'function') return false; // If has modified prototype
- prot = ctor.prototype;
- if (isObjectObject(prot) === false) return false; // If constructor does not have an Object-specific method
- if (prot.hasOwnProperty('isPrototypeOf') === false) {
- return false;
- } // Most likely a plain Object
- return true;
- };
- /***/ }),
- /***/ "./node_modules/is-windows/index.js":
- /*!******************************************!*\
- !*** ./node_modules/is-windows/index.js ***!
- \******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(process) {var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- /*!
- * is-windows <https://github.com/jonschlinkert/is-windows>
- *
- * Copyright © 2015-2018, Jon Schlinkert.
- * Released under the MIT License.
- */
- (function (factory) {
- if (exports && ( false ? undefined : _typeof(exports)) === 'object' && typeof module !== 'undefined') {
- module.exports = factory();
- } else if (true) {
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
- __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
- (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- } else {}
- })(function () {
- 'use strict';
- return function isWindows() {
- return process && (process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE));
- };
- });
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../process/browser.js */ "./node_modules/process/browser.js")))
- /***/ }),
- /***/ "./node_modules/isarray/index.js":
- /*!***************************************!*\
- !*** ./node_modules/isarray/index.js ***!
- \***************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var toString = {}.toString;
- module.exports = Array.isArray || function (arr) {
- return toString.call(arr) == '[object Array]';
- };
- /***/ }),
- /***/ "./node_modules/isobject/index.js":
- /*!****************************************!*\
- !*** ./node_modules/isobject/index.js ***!
- \****************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * isobject <https://github.com/jonschlinkert/isobject>
- *
- * Copyright (c) 2014-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- module.exports = function isObject(val) {
- return val != null && _typeof(val) === 'object' && Array.isArray(val) === false;
- };
- /***/ }),
- /***/ "./node_modules/js-tokens/index.js":
- /*!*****************************************!*\
- !*** ./node_modules/js-tokens/index.js ***!
- \*****************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- // Copyright 2014, 2015, 2016, 2017, 2018 Simon Lydell
- // License: MIT. (See LICENSE.)
- Object.defineProperty(exports, "__esModule", {
- value: true
- }); // This regex comes from regex.coffee, and is inserted here by generate-index.js
- // (run `npm run build`).
- exports.default = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyus]{1,6}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g;
- exports.matchToToken = function (match) {
- var token = {
- type: "invalid",
- value: match[0],
- closed: undefined
- };
- if (match[1]) token.type = "string", token.closed = !!(match[3] || match[4]);else if (match[5]) token.type = "comment";else if (match[6]) token.type = "comment", token.closed = !!match[7];else if (match[8]) token.type = "regex";else if (match[9]) token.type = "number";else if (match[10]) token.type = "name";else if (match[11]) token.type = "punctuator";else if (match[12]) token.type = "whitespace";
- return token;
- };
- /***/ }),
- /***/ "./node_modules/kind-of/index.js":
- /*!***************************************!*\
- !*** ./node_modules/kind-of/index.js ***!
- \***************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var isBuffer = __webpack_require__(/*! is-buffer */ "./node_modules/is-buffer/index.js");
- var toString = Object.prototype.toString;
- /**
- * Get the native `typeof` a value.
- *
- * @param {*} `val`
- * @return {*} Native javascript type
- */
- module.exports = function kindOf(val) {
- // primitivies
- if (typeof val === 'undefined') {
- return 'undefined';
- }
- if (val === null) {
- return 'null';
- }
- if (val === true || val === false || val instanceof Boolean) {
- return 'boolean';
- }
- if (typeof val === 'string' || val instanceof String) {
- return 'string';
- }
- if (typeof val === 'number' || val instanceof Number) {
- return 'number';
- } // functions
- if (typeof val === 'function' || val instanceof Function) {
- return 'function';
- } // array
- if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) {
- return 'array';
- } // check for instances of RegExp and Date before calling `toString`
- if (val instanceof RegExp) {
- return 'regexp';
- }
- if (val instanceof Date) {
- return 'date';
- } // other objects
- var type = toString.call(val);
- if (type === '[object RegExp]') {
- return 'regexp';
- }
- if (type === '[object Date]') {
- return 'date';
- }
- if (type === '[object Arguments]') {
- return 'arguments';
- }
- if (type === '[object Error]') {
- return 'error';
- } // buffer
- if (isBuffer(val)) {
- return 'buffer';
- } // es6: Map, WeakMap, Set, WeakSet
- if (type === '[object Set]') {
- return 'set';
- }
- if (type === '[object WeakSet]') {
- return 'weakset';
- }
- if (type === '[object Map]') {
- return 'map';
- }
- if (type === '[object WeakMap]') {
- return 'weakmap';
- }
- if (type === '[object Symbol]') {
- return 'symbol';
- } // typed arrays
- if (type === '[object Int8Array]') {
- return 'int8array';
- }
- if (type === '[object Uint8Array]') {
- return 'uint8array';
- }
- if (type === '[object Uint8ClampedArray]') {
- return 'uint8clampedarray';
- }
- if (type === '[object Int16Array]') {
- return 'int16array';
- }
- if (type === '[object Uint16Array]') {
- return 'uint16array';
- }
- if (type === '[object Int32Array]') {
- return 'int32array';
- }
- if (type === '[object Uint32Array]') {
- return 'uint32array';
- }
- if (type === '[object Float32Array]') {
- return 'float32array';
- }
- if (type === '[object Float64Array]') {
- return 'float64array';
- } // must be a plain object
- return 'object';
- };
- /***/ }),
- /***/ "./node_modules/map-cache/index.js":
- /*!*****************************************!*\
- !*** ./node_modules/map-cache/index.js ***!
- \*****************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * map-cache <https://github.com/jonschlinkert/map-cache>
- *
- * Copyright (c) 2015, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- var hasOwn = Object.prototype.hasOwnProperty;
- /**
- * Expose `MapCache`
- */
- module.exports = MapCache;
- /**
- * Creates a cache object to store key/value pairs.
- *
- * ```js
- * var cache = new MapCache();
- * ```
- *
- * @api public
- */
- function MapCache(data) {
- this.__data__ = data || {};
- }
- /**
- * Adds `value` to `key` on the cache.
- *
- * ```js
- * cache.set('foo', 'bar');
- * ```
- *
- * @param {String} `key` The key of the value to cache.
- * @param {*} `value` The value to cache.
- * @returns {Object} Returns the `Cache` object for chaining.
- * @api public
- */
- MapCache.prototype.set = function mapSet(key, value) {
- if (key !== '__proto__') {
- this.__data__[key] = value;
- }
- return this;
- };
- /**
- * Gets the cached value for `key`.
- *
- * ```js
- * cache.get('foo');
- * //=> 'bar'
- * ```
- *
- * @param {String} `key` The key of the value to get.
- * @returns {*} Returns the cached value.
- * @api public
- */
- MapCache.prototype.get = function mapGet(key) {
- return key === '__proto__' ? undefined : this.__data__[key];
- };
- /**
- * Checks if a cached value for `key` exists.
- *
- * ```js
- * cache.has('foo');
- * //=> true
- * ```
- *
- * @param {String} `key` The key of the entry to check.
- * @returns {Boolean} Returns `true` if an entry for `key` exists, else `false`.
- * @api public
- */
- MapCache.prototype.has = function mapHas(key) {
- return key !== '__proto__' && hasOwn.call(this.__data__, key);
- };
- /**
- * Removes `key` and its value from the cache.
- *
- * ```js
- * cache.del('foo');
- * ```
- * @title .del
- * @param {String} `key` The key of the value to remove.
- * @returns {Boolean} Returns `true` if the entry was removed successfully, else `false`.
- * @api public
- */
- MapCache.prototype.del = function mapDelete(key) {
- return this.has(key) && delete this.__data__[key];
- };
- /***/ }),
- /***/ "./node_modules/map-visit/index.js":
- /*!*****************************************!*\
- !*** ./node_modules/map-visit/index.js ***!
- \*****************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- var util = __webpack_require__(/*! util */ "./node_modules/util/util.js");
- var visit = __webpack_require__(/*! object-visit */ "./node_modules/object-visit/index.js");
- /**
- * Map `visit` over an array of objects.
- *
- * @param {Object} `collection` The context in which to invoke `method`
- * @param {String} `method` Name of the method to call on `collection`
- * @param {Object} `arr` Array of objects.
- */
- module.exports = function mapVisit(collection, method, val) {
- if (isObject(val)) {
- return visit.apply(null, arguments);
- }
- if (!Array.isArray(val)) {
- throw new TypeError('expected an array: ' + util.inspect(val));
- }
- var args = [].slice.call(arguments, 3);
- for (var i = 0; i < val.length; i++) {
- var ele = val[i];
- if (isObject(ele)) {
- visit.apply(null, [collection, method, ele].concat(args));
- } else {
- collection[method].apply(collection, [ele].concat(args));
- }
- }
- };
- function isObject(val) {
- return val && (typeof val === 'function' || !Array.isArray(val) && _typeof(val) === 'object');
- }
- /***/ }),
- /***/ "./node_modules/micromatch/index.js":
- /*!******************************************!*\
- !*** ./node_modules/micromatch/index.js ***!
- \******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /**
- * Module dependencies
- */
- var util = __webpack_require__(/*! util */ "./node_modules/util/util.js");
- var braces = __webpack_require__(/*! braces */ "./node_modules/braces/index.js");
- var toRegex = __webpack_require__(/*! to-regex */ "./node_modules/to-regex/index.js");
- var extend = __webpack_require__(/*! extend-shallow */ "./node_modules/micromatch/node_modules/extend-shallow/index.js");
- /**
- * Local dependencies
- */
- var compilers = __webpack_require__(/*! ./lib/compilers */ "./node_modules/micromatch/lib/compilers.js");
- var parsers = __webpack_require__(/*! ./lib/parsers */ "./node_modules/micromatch/lib/parsers.js");
- var cache = __webpack_require__(/*! ./lib/cache */ "./node_modules/micromatch/lib/cache.js");
- var utils = __webpack_require__(/*! ./lib/utils */ "./node_modules/micromatch/lib/utils.js");
- var MAX_LENGTH = 1024 * 64;
- /**
- * The main function takes a list of strings and one or more
- * glob patterns to use for matching.
- *
- * ```js
- * var mm = require('micromatch');
- * mm(list, patterns[, options]);
- *
- * console.log(mm(['a.js', 'a.txt'], ['*.js']));
- * //=> [ 'a.js' ]
- * ```
- * @param {Array} `list` A list of strings to match
- * @param {String|Array} `patterns` One or more glob patterns to use for matching.
- * @param {Object} `options` See available [options](#options) for changing how matches are performed
- * @return {Array} Returns an array of matches
- * @summary false
- * @api public
- */
- function micromatch(list, patterns, options) {
- patterns = utils.arrayify(patterns);
- list = utils.arrayify(list);
- var len = patterns.length;
- if (list.length === 0 || len === 0) {
- return [];
- }
- if (len === 1) {
- return micromatch.match(list, patterns[0], options);
- }
- var omit = [];
- var keep = [];
- var idx = -1;
- while (++idx < len) {
- var pattern = patterns[idx];
- if (typeof pattern === 'string' && pattern.charCodeAt(0) === 33
- /* ! */
- ) {
- omit.push.apply(omit, micromatch.match(list, pattern.slice(1), options));
- } else {
- keep.push.apply(keep, micromatch.match(list, pattern, options));
- }
- }
- var matches = utils.diff(keep, omit);
- if (!options || options.nodupes !== false) {
- return utils.unique(matches);
- }
- return matches;
- }
- /**
- * Similar to the main function, but `pattern` must be a string.
- *
- * ```js
- * var mm = require('micromatch');
- * mm.match(list, pattern[, options]);
- *
- * console.log(mm.match(['a.a', 'a.aa', 'a.b', 'a.c'], '*.a'));
- * //=> ['a.a', 'a.aa']
- * ```
- * @param {Array} `list` Array of strings to match
- * @param {String} `pattern` Glob pattern to use for matching.
- * @param {Object} `options` See available [options](#options) for changing how matches are performed
- * @return {Array} Returns an array of matches
- * @api public
- */
- micromatch.match = function (list, pattern, options) {
- if (Array.isArray(pattern)) {
- throw new TypeError('expected pattern to be a string');
- }
- var unixify = utils.unixify(options);
- var isMatch = memoize('match', pattern, options, micromatch.matcher);
- var matches = [];
- list = utils.arrayify(list);
- var len = list.length;
- var idx = -1;
- while (++idx < len) {
- var ele = list[idx];
- if (ele === pattern || isMatch(ele)) {
- matches.push(utils.value(ele, unixify, options));
- }
- } // if no options were passed, uniquify results and return
- if (typeof options === 'undefined') {
- return utils.unique(matches);
- }
- if (matches.length === 0) {
- if (options.failglob === true) {
- throw new Error('no matches found for "' + pattern + '"');
- }
- if (options.nonull === true || options.nullglob === true) {
- return [options.unescape ? utils.unescape(pattern) : pattern];
- }
- } // if `opts.ignore` was defined, diff ignored list
- if (options.ignore) {
- matches = micromatch.not(matches, options.ignore, options);
- }
- return options.nodupes !== false ? utils.unique(matches) : matches;
- };
- /**
- * Returns true if the specified `string` matches the given glob `pattern`.
- *
- * ```js
- * var mm = require('micromatch');
- * mm.isMatch(string, pattern[, options]);
- *
- * console.log(mm.isMatch('a.a', '*.a'));
- * //=> true
- * console.log(mm.isMatch('a.b', '*.a'));
- * //=> false
- * ```
- * @param {String} `string` String to match
- * @param {String} `pattern` Glob pattern to use for matching.
- * @param {Object} `options` See available [options](#options) for changing how matches are performed
- * @return {Boolean} Returns true if the string matches the glob pattern.
- * @api public
- */
- micromatch.isMatch = function (str, pattern, options) {
- if (typeof str !== 'string') {
- throw new TypeError('expected a string: "' + util.inspect(str) + '"');
- }
- if (isEmptyString(str) || isEmptyString(pattern)) {
- return false;
- }
- var equals = utils.equalsPattern(options);
- if (equals(str)) {
- return true;
- }
- var isMatch = memoize('isMatch', pattern, options, micromatch.matcher);
- return isMatch(str);
- };
- /**
- * Returns true if some of the strings in the given `list` match any of the
- * given glob `patterns`.
- *
- * ```js
- * var mm = require('micromatch');
- * mm.some(list, patterns[, options]);
- *
- * console.log(mm.some(['foo.js', 'bar.js'], ['*.js', '!foo.js']));
- * // true
- * console.log(mm.some(['foo.js'], ['*.js', '!foo.js']));
- * // false
- * ```
- * @param {String|Array} `list` The string or array of strings to test. Returns as soon as the first match is found.
- * @param {String|Array} `patterns` One or more glob patterns to use for matching.
- * @param {Object} `options` See available [options](#options) for changing how matches are performed
- * @return {Boolean} Returns true if any patterns match `str`
- * @api public
- */
- micromatch.some = function (list, patterns, options) {
- if (typeof list === 'string') {
- list = [list];
- }
- for (var i = 0; i < list.length; i++) {
- if (micromatch(list[i], patterns, options).length === 1) {
- return true;
- }
- }
- return false;
- };
- /**
- * Returns true if every string in the given `list` matches
- * any of the given glob `patterns`.
- *
- * ```js
- * var mm = require('micromatch');
- * mm.every(list, patterns[, options]);
- *
- * console.log(mm.every('foo.js', ['foo.js']));
- * // true
- * console.log(mm.every(['foo.js', 'bar.js'], ['*.js']));
- * // true
- * console.log(mm.every(['foo.js', 'bar.js'], ['*.js', '!foo.js']));
- * // false
- * console.log(mm.every(['foo.js'], ['*.js', '!foo.js']));
- * // false
- * ```
- * @param {String|Array} `list` The string or array of strings to test.
- * @param {String|Array} `patterns` One or more glob patterns to use for matching.
- * @param {Object} `options` See available [options](#options) for changing how matches are performed
- * @return {Boolean} Returns true if any patterns match `str`
- * @api public
- */
- micromatch.every = function (list, patterns, options) {
- if (typeof list === 'string') {
- list = [list];
- }
- for (var i = 0; i < list.length; i++) {
- if (micromatch(list[i], patterns, options).length !== 1) {
- return false;
- }
- }
- return true;
- };
- /**
- * Returns true if **any** of the given glob `patterns`
- * match the specified `string`.
- *
- * ```js
- * var mm = require('micromatch');
- * mm.any(string, patterns[, options]);
- *
- * console.log(mm.any('a.a', ['b.*', '*.a']));
- * //=> true
- * console.log(mm.any('a.a', 'b.*'));
- * //=> false
- * ```
- * @param {String|Array} `str` The string to test.
- * @param {String|Array} `patterns` One or more glob patterns to use for matching.
- * @param {Object} `options` See available [options](#options) for changing how matches are performed
- * @return {Boolean} Returns true if any patterns match `str`
- * @api public
- */
- micromatch.any = function (str, patterns, options) {
- if (typeof str !== 'string') {
- throw new TypeError('expected a string: "' + util.inspect(str) + '"');
- }
- if (isEmptyString(str) || isEmptyString(patterns)) {
- return false;
- }
- if (typeof patterns === 'string') {
- patterns = [patterns];
- }
- for (var i = 0; i < patterns.length; i++) {
- if (micromatch.isMatch(str, patterns[i], options)) {
- return true;
- }
- }
- return false;
- };
- /**
- * Returns true if **all** of the given `patterns` match
- * the specified string.
- *
- * ```js
- * var mm = require('micromatch');
- * mm.all(string, patterns[, options]);
- *
- * console.log(mm.all('foo.js', ['foo.js']));
- * // true
- *
- * console.log(mm.all('foo.js', ['*.js', '!foo.js']));
- * // false
- *
- * console.log(mm.all('foo.js', ['*.js', 'foo.js']));
- * // true
- *
- * console.log(mm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js']));
- * // true
- * ```
- * @param {String|Array} `str` The string to test.
- * @param {String|Array} `patterns` One or more glob patterns to use for matching.
- * @param {Object} `options` See available [options](#options) for changing how matches are performed
- * @return {Boolean} Returns true if any patterns match `str`
- * @api public
- */
- micromatch.all = function (str, patterns, options) {
- if (typeof str !== 'string') {
- throw new TypeError('expected a string: "' + util.inspect(str) + '"');
- }
- if (typeof patterns === 'string') {
- patterns = [patterns];
- }
- for (var i = 0; i < patterns.length; i++) {
- if (!micromatch.isMatch(str, patterns[i], options)) {
- return false;
- }
- }
- return true;
- };
- /**
- * Returns a list of strings that _**do not match any**_ of the given `patterns`.
- *
- * ```js
- * var mm = require('micromatch');
- * mm.not(list, patterns[, options]);
- *
- * console.log(mm.not(['a.a', 'b.b', 'c.c'], '*.a'));
- * //=> ['b.b', 'c.c']
- * ```
- * @param {Array} `list` Array of strings to match.
- * @param {String|Array} `patterns` One or more glob pattern to use for matching.
- * @param {Object} `options` See available [options](#options) for changing how matches are performed
- * @return {Array} Returns an array of strings that **do not match** the given patterns.
- * @api public
- */
- micromatch.not = function (list, patterns, options) {
- var opts = extend({}, options);
- var ignore = opts.ignore;
- delete opts.ignore;
- var unixify = utils.unixify(opts);
- list = utils.arrayify(list).map(unixify);
- var matches = utils.diff(list, micromatch(list, patterns, opts));
- if (ignore) {
- matches = utils.diff(matches, micromatch(list, ignore));
- }
- return opts.nodupes !== false ? utils.unique(matches) : matches;
- };
- /**
- * Returns true if the given `string` contains the given pattern. Similar
- * to [.isMatch](#isMatch) but the pattern can match any part of the string.
- *
- * ```js
- * var mm = require('micromatch');
- * mm.contains(string, pattern[, options]);
- *
- * console.log(mm.contains('aa/bb/cc', '*b'));
- * //=> true
- * console.log(mm.contains('aa/bb/cc', '*d'));
- * //=> false
- * ```
- * @param {String} `str` The string to match.
- * @param {String|Array} `patterns` Glob pattern to use for matching.
- * @param {Object} `options` See available [options](#options) for changing how matches are performed
- * @return {Boolean} Returns true if the patter matches any part of `str`.
- * @api public
- */
- micromatch.contains = function (str, patterns, options) {
- if (typeof str !== 'string') {
- throw new TypeError('expected a string: "' + util.inspect(str) + '"');
- }
- if (typeof patterns === 'string') {
- if (isEmptyString(str) || isEmptyString(patterns)) {
- return false;
- }
- var equals = utils.equalsPattern(patterns, options);
- if (equals(str)) {
- return true;
- }
- var contains = utils.containsPattern(patterns, options);
- if (contains(str)) {
- return true;
- }
- }
- var opts = extend({}, options, {
- contains: true
- });
- return micromatch.any(str, patterns, opts);
- };
- /**
- * Returns true if the given pattern and options should enable
- * the `matchBase` option.
- * @return {Boolean}
- * @api private
- */
- micromatch.matchBase = function (pattern, options) {
- if (pattern && pattern.indexOf('/') !== -1 || !options) return false;
- return options.basename === true || options.matchBase === true;
- };
- /**
- * Filter the keys of the given object with the given `glob` pattern
- * and `options`. Does not attempt to match nested keys. If you need this feature,
- * use [glob-object][] instead.
- *
- * ```js
- * var mm = require('micromatch');
- * mm.matchKeys(object, patterns[, options]);
- *
- * var obj = { aa: 'a', ab: 'b', ac: 'c' };
- * console.log(mm.matchKeys(obj, '*b'));
- * //=> { ab: 'b' }
- * ```
- * @param {Object} `object` The object with keys to filter.
- * @param {String|Array} `patterns` One or more glob patterns to use for matching.
- * @param {Object} `options` See available [options](#options) for changing how matches are performed
- * @return {Object} Returns an object with only keys that match the given patterns.
- * @api public
- */
- micromatch.matchKeys = function (obj, patterns, options) {
- if (!utils.isObject(obj)) {
- throw new TypeError('expected the first argument to be an object');
- }
- var keys = micromatch(Object.keys(obj), patterns, options);
- return utils.pick(obj, keys);
- };
- /**
- * Returns a memoized matcher function from the given glob `pattern` and `options`.
- * The returned function takes a string to match as its only argument and returns
- * true if the string is a match.
- *
- * ```js
- * var mm = require('micromatch');
- * mm.matcher(pattern[, options]);
- *
- * var isMatch = mm.matcher('*.!(*a)');
- * console.log(isMatch('a.a'));
- * //=> false
- * console.log(isMatch('a.b'));
- * //=> true
- * ```
- * @param {String} `pattern` Glob pattern
- * @param {Object} `options` See available [options](#options) for changing how matches are performed.
- * @return {Function} Returns a matcher function.
- * @api public
- */
- micromatch.matcher = function matcher(pattern, options) {
- if (Array.isArray(pattern)) {
- return compose(pattern, options, matcher);
- } // if pattern is a regex
- if (pattern instanceof RegExp) {
- return test(pattern);
- } // if pattern is invalid
- if (!utils.isString(pattern)) {
- throw new TypeError('expected pattern to be an array, string or regex');
- } // if pattern is a non-glob string
- if (!utils.hasSpecialChars(pattern)) {
- if (options && options.nocase === true) {
- pattern = pattern.toLowerCase();
- }
- return utils.matchPath(pattern, options);
- } // if pattern is a glob string
- var re = micromatch.makeRe(pattern, options); // if `options.matchBase` or `options.basename` is defined
- if (micromatch.matchBase(pattern, options)) {
- return utils.matchBasename(re, options);
- }
- function test(regex) {
- var equals = utils.equalsPattern(options);
- var unixify = utils.unixify(options);
- return function (str) {
- if (equals(str)) {
- return true;
- }
- if (regex.test(unixify(str))) {
- return true;
- }
- return false;
- };
- }
- var fn = test(re);
- Object.defineProperty(fn, 'result', {
- configurable: true,
- enumerable: false,
- value: re.result
- });
- return fn;
- };
- /**
- * Returns an array of matches captured by `pattern` in `string, or `null` if the pattern did not match.
- *
- * ```js
- * var mm = require('micromatch');
- * mm.capture(pattern, string[, options]);
- *
- * console.log(mm.capture('test/*.js', 'test/foo.js'));
- * //=> ['foo']
- * console.log(mm.capture('test/*.js', 'foo/bar.css'));
- * //=> null
- * ```
- * @param {String} `pattern` Glob pattern to use for matching.
- * @param {String} `string` String to match
- * @param {Object} `options` See available [options](#options) for changing how matches are performed
- * @return {Boolean} Returns an array of captures if the string matches the glob pattern, otherwise `null`.
- * @api public
- */
- micromatch.capture = function (pattern, str, options) {
- var re = micromatch.makeRe(pattern, extend({
- capture: true
- }, options));
- var unixify = utils.unixify(options);
- function match() {
- return function (string) {
- var match = re.exec(unixify(string));
- if (!match) {
- return null;
- }
- return match.slice(1);
- };
- }
- var capture = memoize('capture', pattern, options, match);
- return capture(str);
- };
- /**
- * Create a regular expression from the given glob `pattern`.
- *
- * ```js
- * var mm = require('micromatch');
- * mm.makeRe(pattern[, options]);
- *
- * console.log(mm.makeRe('*.js'));
- * //=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/
- * ```
- * @param {String} `pattern` A glob pattern to convert to regex.
- * @param {Object} `options` See available [options](#options) for changing how matches are performed.
- * @return {RegExp} Returns a regex created from the given pattern.
- * @api public
- */
- micromatch.makeRe = function (pattern, options) {
- if (typeof pattern !== 'string') {
- throw new TypeError('expected pattern to be a string');
- }
- if (pattern.length > MAX_LENGTH) {
- throw new Error('expected pattern to be less than ' + MAX_LENGTH + ' characters');
- }
- function makeRe() {
- var result = micromatch.create(pattern, options);
- var ast_array = [];
- var output = result.map(function (obj) {
- obj.ast.state = obj.state;
- ast_array.push(obj.ast);
- return obj.output;
- });
- var regex = toRegex(output.join('|'), options);
- Object.defineProperty(regex, 'result', {
- configurable: true,
- enumerable: false,
- value: ast_array
- });
- return regex;
- }
- return memoize('makeRe', pattern, options, makeRe);
- };
- /**
- * Expand the given brace `pattern`.
- *
- * ```js
- * var mm = require('micromatch');
- * console.log(mm.braces('foo/{a,b}/bar'));
- * //=> ['foo/(a|b)/bar']
- *
- * console.log(mm.braces('foo/{a,b}/bar', {expand: true}));
- * //=> ['foo/(a|b)/bar']
- * ```
- * @param {String} `pattern` String with brace pattern to expand.
- * @param {Object} `options` Any [options](#options) to change how expansion is performed. See the [braces][] library for all available options.
- * @return {Array}
- * @api public
- */
- micromatch.braces = function (pattern, options) {
- if (typeof pattern !== 'string' && !Array.isArray(pattern)) {
- throw new TypeError('expected pattern to be an array or string');
- }
- function expand() {
- if (options && options.nobrace === true || !/\{.*\}/.test(pattern)) {
- return utils.arrayify(pattern);
- }
- return braces(pattern, options);
- }
- return memoize('braces', pattern, options, expand);
- };
- /**
- * Proxy to the [micromatch.braces](#method), for parity with
- * minimatch.
- */
- micromatch.braceExpand = function (pattern, options) {
- var opts = extend({}, options, {
- expand: true
- });
- return micromatch.braces(pattern, opts);
- };
- /**
- * Parses the given glob `pattern` and returns an array of abstract syntax
- * trees (ASTs), with the compiled `output` and optional source `map` on
- * each AST.
- *
- * ```js
- * var mm = require('micromatch');
- * mm.create(pattern[, options]);
- *
- * console.log(mm.create('abc/*.js'));
- * // [{ options: { source: 'string', sourcemap: true },
- * // state: {},
- * // compilers:
- * // { ... },
- * // output: '(\\.[\\\\\\/])?abc\\/(?!\\.)(?=.)[^\\/]*?\\.js',
- * // ast:
- * // { type: 'root',
- * // errors: [],
- * // nodes:
- * // [ ... ],
- * // dot: false,
- * // input: 'abc/*.js' },
- * // parsingErrors: [],
- * // map:
- * // { version: 3,
- * // sources: [ 'string' ],
- * // names: [],
- * // mappings: 'AAAA,GAAG,EAAC,kBAAC,EAAC,EAAE',
- * // sourcesContent: [ 'abc/*.js' ] },
- * // position: { line: 1, column: 28 },
- * // content: {},
- * // files: {},
- * // idx: 6 }]
- * ```
- * @param {String} `pattern` Glob pattern to parse and compile.
- * @param {Object} `options` Any [options](#options) to change how parsing and compiling is performed.
- * @return {Object} Returns an object with the parsed AST, compiled string and optional source map.
- * @api public
- */
- micromatch.create = function (pattern, options) {
- return memoize('create', pattern, options, function () {
- function create(str, opts) {
- return micromatch.compile(micromatch.parse(str, opts), opts);
- }
- pattern = micromatch.braces(pattern, options);
- var len = pattern.length;
- var idx = -1;
- var res = [];
- while (++idx < len) {
- res.push(create(pattern[idx], options));
- }
- return res;
- });
- };
- /**
- * Parse the given `str` with the given `options`.
- *
- * ```js
- * var mm = require('micromatch');
- * mm.parse(pattern[, options]);
- *
- * var ast = mm.parse('a/{b,c}/d');
- * console.log(ast);
- * // { type: 'root',
- * // errors: [],
- * // input: 'a/{b,c}/d',
- * // nodes:
- * // [ { type: 'bos', val: '' },
- * // { type: 'text', val: 'a/' },
- * // { type: 'brace',
- * // nodes:
- * // [ { type: 'brace.open', val: '{' },
- * // { type: 'text', val: 'b,c' },
- * // { type: 'brace.close', val: '}' } ] },
- * // { type: 'text', val: '/d' },
- * // { type: 'eos', val: '' } ] }
- * ```
- * @param {String} `str`
- * @param {Object} `options`
- * @return {Object} Returns an AST
- * @api public
- */
- micromatch.parse = function (pattern, options) {
- if (typeof pattern !== 'string') {
- throw new TypeError('expected a string');
- }
- function parse() {
- var snapdragon = utils.instantiate(null, options);
- parsers(snapdragon, options);
- var ast = snapdragon.parse(pattern, options);
- utils.define(ast, 'snapdragon', snapdragon);
- ast.input = pattern;
- return ast;
- }
- return memoize('parse', pattern, options, parse);
- };
- /**
- * Compile the given `ast` or string with the given `options`.
- *
- * ```js
- * var mm = require('micromatch');
- * mm.compile(ast[, options]);
- *
- * var ast = mm.parse('a/{b,c}/d');
- * console.log(mm.compile(ast));
- * // { options: { source: 'string' },
- * // state: {},
- * // compilers:
- * // { eos: [Function],
- * // noop: [Function],
- * // bos: [Function],
- * // brace: [Function],
- * // 'brace.open': [Function],
- * // text: [Function],
- * // 'brace.close': [Function] },
- * // output: [ 'a/(b|c)/d' ],
- * // ast:
- * // { ... },
- * // parsingErrors: [] }
- * ```
- * @param {Object|String} `ast`
- * @param {Object} `options`
- * @return {Object} Returns an object that has an `output` property with the compiled string.
- * @api public
- */
- micromatch.compile = function (ast, options) {
- if (typeof ast === 'string') {
- ast = micromatch.parse(ast, options);
- }
- return memoize('compile', ast.input, options, function () {
- var snapdragon = utils.instantiate(ast, options);
- compilers(snapdragon, options);
- return snapdragon.compile(ast, options);
- });
- };
- /**
- * Clear the regex cache.
- *
- * ```js
- * mm.clearCache();
- * ```
- * @api public
- */
- micromatch.clearCache = function () {
- micromatch.cache.caches = {};
- };
- /**
- * Returns true if the given value is effectively an empty string
- */
- function isEmptyString(val) {
- return String(val) === '' || String(val) === './';
- }
- /**
- * Compose a matcher function with the given patterns.
- * This allows matcher functions to be compiled once and
- * called multiple times.
- */
- function compose(patterns, options, matcher) {
- var matchers;
- return memoize('compose', String(patterns), options, function () {
- return function (file) {
- // delay composition until it's invoked the first time,
- // after that it won't be called again
- if (!matchers) {
- matchers = [];
- for (var i = 0; i < patterns.length; i++) {
- matchers.push(matcher(patterns[i], options));
- }
- }
- var len = matchers.length;
- while (len--) {
- if (matchers[len](file) === true) {
- return true;
- }
- }
- return false;
- };
- });
- }
- /**
- * Memoize a generated regex or function. A unique key is generated
- * from the `type` (usually method name), the `pattern`, and
- * user-defined options.
- */
- function memoize(type, pattern, options, fn) {
- var key = utils.createKey(type + '=' + pattern, options);
- if (options && options.cache === false) {
- return fn(pattern, options);
- }
- if (cache.has(type, key)) {
- return cache.get(type, key);
- }
- var val = fn(pattern, options);
- cache.set(type, key, val);
- return val;
- }
- /**
- * Expose compiler, parser and cache on `micromatch`
- */
- micromatch.compilers = compilers;
- micromatch.parsers = parsers;
- micromatch.caches = cache.caches;
- /**
- * Expose `micromatch`
- * @type {Function}
- */
- module.exports = micromatch;
- /***/ }),
- /***/ "./node_modules/micromatch/lib/cache.js":
- /*!**********************************************!*\
- !*** ./node_modules/micromatch/lib/cache.js ***!
- \**********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- module.exports = new (__webpack_require__(/*! fragment-cache */ "./node_modules/fragment-cache/index.js"))();
- /***/ }),
- /***/ "./node_modules/micromatch/lib/compilers.js":
- /*!**************************************************!*\
- !*** ./node_modules/micromatch/lib/compilers.js ***!
- \**************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var nanomatch = __webpack_require__(/*! nanomatch */ "./node_modules/nanomatch/index.js");
- var extglob = __webpack_require__(/*! extglob */ "./node_modules/extglob/index.js");
- module.exports = function (snapdragon) {
- var compilers = snapdragon.compiler.compilers;
- var opts = snapdragon.options; // register nanomatch compilers
- snapdragon.use(nanomatch.compilers); // get references to some specific nanomatch compilers before they
- // are overridden by the extglob and/or custom compilers
- var escape = compilers.escape;
- var qmark = compilers.qmark;
- var slash = compilers.slash;
- var star = compilers.star;
- var text = compilers.text;
- var plus = compilers.plus;
- var dot = compilers.dot; // register extglob compilers or escape exglobs if disabled
- if (opts.extglob === false || opts.noext === true) {
- snapdragon.compiler.use(escapeExtglobs);
- } else {
- snapdragon.use(extglob.compilers);
- }
- snapdragon.use(function () {
- this.options.star = this.options.star || function ()
- /*node*/
- {
- return '[^\\\\/]*?';
- };
- }); // custom micromatch compilers
- snapdragon.compiler // reset referenced compiler
- .set('dot', dot).set('escape', escape).set('plus', plus).set('slash', slash).set('qmark', qmark).set('star', star).set('text', text);
- };
- function escapeExtglobs(compiler) {
- compiler.set('paren', function (node) {
- var val = '';
- visit(node, function (tok) {
- if (tok.val) val += (/^\W/.test(tok.val) ? '\\' : '') + tok.val;
- });
- return this.emit(val, node);
- });
- /**
- * Visit `node` with the given `fn`
- */
- function visit(node, fn) {
- return node.nodes ? mapVisit(node.nodes, fn) : fn(node);
- }
- /**
- * Map visit over array of `nodes`.
- */
- function mapVisit(nodes, fn) {
- var len = nodes.length;
- var idx = -1;
- while (++idx < len) {
- visit(nodes[idx], fn);
- }
- }
- }
- /***/ }),
- /***/ "./node_modules/micromatch/lib/parsers.js":
- /*!************************************************!*\
- !*** ./node_modules/micromatch/lib/parsers.js ***!
- \************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var extglob = __webpack_require__(/*! extglob */ "./node_modules/extglob/index.js");
- var nanomatch = __webpack_require__(/*! nanomatch */ "./node_modules/nanomatch/index.js");
- var regexNot = __webpack_require__(/*! regex-not */ "./node_modules/regex-not/index.js");
- var toRegex = __webpack_require__(/*! to-regex */ "./node_modules/to-regex/index.js");
- var not;
- /**
- * Characters to use in negation regex (we want to "not" match
- * characters that are matched by other parsers)
- */
- var TEXT = '([!@*?+]?\\(|\\)|\\[:?(?=.*?:?\\])|:?\\]|[*+?!^$.\\\\/])+';
- var createNotRegex = function createNotRegex(opts) {
- return not || (not = textRegex(TEXT));
- };
- /**
- * Parsers
- */
- module.exports = function (snapdragon) {
- var parsers = snapdragon.parser.parsers; // register nanomatch parsers
- snapdragon.use(nanomatch.parsers); // get references to some specific nanomatch parsers before they
- // are overridden by the extglob and/or parsers
- var escape = parsers.escape;
- var slash = parsers.slash;
- var qmark = parsers.qmark;
- var plus = parsers.plus;
- var star = parsers.star;
- var dot = parsers.dot; // register extglob parsers
- snapdragon.use(extglob.parsers); // custom micromatch parsers
- snapdragon.parser.use(function () {
- // override "notRegex" created in nanomatch parser
- this.notRegex = /^\!+(?!\()/;
- }) // reset the referenced parsers
- .capture('escape', escape).capture('slash', slash).capture('qmark', qmark).capture('star', star).capture('plus', plus).capture('dot', dot)
- /**
- * Override `text` parser
- */
- .capture('text', function () {
- if (this.isInside('bracket')) return;
- var pos = this.position();
- var m = this.match(createNotRegex(this.options));
- if (!m || !m[0]) return; // escape regex boundary characters and simple brackets
- var val = m[0].replace(/([[\]^$])/g, '\\$1');
- return pos({
- type: 'text',
- val: val
- });
- });
- };
- /**
- * Create text regex
- */
- function textRegex(pattern) {
- var notStr = regexNot.create(pattern, {
- contains: true,
- strictClose: false
- });
- var prefix = '(?:[\\^]|\\\\|';
- return toRegex(prefix + notStr + ')', {
- strictClose: false
- });
- }
- /***/ }),
- /***/ "./node_modules/micromatch/lib/utils.js":
- /*!**********************************************!*\
- !*** ./node_modules/micromatch/lib/utils.js ***!
- \**********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(process) {
- var utils = module.exports;
- var path = __webpack_require__(/*! path */ "./node_modules/path-browserify/index.js");
- /**
- * Module dependencies
- */
- var Snapdragon = __webpack_require__(/*! snapdragon */ "./node_modules/snapdragon/index.js");
- utils.define = __webpack_require__(/*! define-property */ "./node_modules/micromatch/node_modules/define-property/index.js");
- utils.diff = __webpack_require__(/*! arr-diff */ "./node_modules/arr-diff/index.js");
- utils.extend = __webpack_require__(/*! extend-shallow */ "./node_modules/micromatch/node_modules/extend-shallow/index.js");
- utils.pick = __webpack_require__(/*! object.pick */ "./node_modules/object.pick/index.js");
- utils.typeOf = __webpack_require__(/*! kind-of */ "./node_modules/micromatch/node_modules/kind-of/index.js");
- utils.unique = __webpack_require__(/*! array-unique */ "./node_modules/array-unique/index.js");
- /**
- * Returns true if the platform is windows, or `path.sep` is `\\`.
- * This is defined as a function to allow `path.sep` to be set in unit tests,
- * or by the user, if there is a reason to do so.
- * @return {Boolean}
- */
- utils.isWindows = function () {
- return path.sep === '\\' || process.platform === 'win32';
- };
- /**
- * Get the `Snapdragon` instance to use
- */
- utils.instantiate = function (ast, options) {
- var snapdragon; // if an instance was created by `.parse`, use that instance
- if (utils.typeOf(ast) === 'object' && ast.snapdragon) {
- snapdragon = ast.snapdragon; // if the user supplies an instance on options, use that instance
- } else if (utils.typeOf(options) === 'object' && options.snapdragon) {
- snapdragon = options.snapdragon; // create a new instance
- } else {
- snapdragon = new Snapdragon(options);
- }
- utils.define(snapdragon, 'parse', function (str, options) {
- var parsed = Snapdragon.prototype.parse.apply(this, arguments);
- parsed.input = str; // escape unmatched brace/bracket/parens
- var last = this.parser.stack.pop();
- if (last && this.options.strictErrors !== true) {
- var open = last.nodes[0];
- var inner = last.nodes[1];
- if (last.type === 'bracket') {
- if (inner.val.charAt(0) === '[') {
- inner.val = '\\' + inner.val;
- }
- } else {
- open.val = '\\' + open.val;
- var sibling = open.parent.nodes[1];
- if (sibling.type === 'star') {
- sibling.loose = true;
- }
- }
- } // add non-enumerable parser reference
- utils.define(parsed, 'parser', this.parser);
- return parsed;
- });
- return snapdragon;
- };
- /**
- * Create the key to use for memoization. The key is generated
- * by iterating over the options and concatenating key-value pairs
- * to the pattern string.
- */
- utils.createKey = function (pattern, options) {
- if (utils.typeOf(options) !== 'object') {
- return pattern;
- }
- var val = pattern;
- var keys = Object.keys(options);
- for (var i = 0; i < keys.length; i++) {
- var key = keys[i];
- val += ';' + key + '=' + String(options[key]);
- }
- return val;
- };
- /**
- * Cast `val` to an array
- * @return {Array}
- */
- utils.arrayify = function (val) {
- if (typeof val === 'string') return [val];
- return val ? Array.isArray(val) ? val : [val] : [];
- };
- /**
- * Return true if `val` is a non-empty string
- */
- utils.isString = function (val) {
- return typeof val === 'string';
- };
- /**
- * Return true if `val` is a non-empty string
- */
- utils.isObject = function (val) {
- return utils.typeOf(val) === 'object';
- };
- /**
- * Returns true if the given `str` has special characters
- */
- utils.hasSpecialChars = function (str) {
- return /(?:(?:(^|\/)[!.])|[*?+()|\[\]{}]|[+@]\()/.test(str);
- };
- /**
- * Escape regex characters in the given string
- */
- utils.escapeRegex = function (str) {
- return str.replace(/[-[\]{}()^$|*+?.\\\/\s]/g, '\\$&');
- };
- /**
- * Normalize slashes in the given filepath.
- *
- * @param {String} `filepath`
- * @return {String}
- */
- utils.toPosixPath = function (str) {
- return str.replace(/\\+/g, '/');
- };
- /**
- * Strip backslashes before special characters in a string.
- *
- * @param {String} `str`
- * @return {String}
- */
- utils.unescape = function (str) {
- return utils.toPosixPath(str.replace(/\\(?=[*+?!.])/g, ''));
- };
- /**
- * Strip the prefix from a filepath
- * @param {String} `fp`
- * @return {String}
- */
- utils.stripPrefix = function (str) {
- if (str.charAt(0) !== '.') {
- return str;
- }
- var ch = str.charAt(1);
- if (utils.isSlash(ch)) {
- return str.slice(2);
- }
- return str;
- };
- /**
- * Returns true if the given str is an escaped or
- * unescaped path character
- */
- utils.isSlash = function (str) {
- return str === '/' || str === '\\/' || str === '\\' || str === '\\\\';
- };
- /**
- * Returns a function that returns true if the given
- * pattern matches or contains a `filepath`
- *
- * @param {String} `pattern`
- * @return {Function}
- */
- utils.matchPath = function (pattern, options) {
- return options && options.contains ? utils.containsPattern(pattern, options) : utils.equalsPattern(pattern, options);
- };
- /**
- * Returns true if the given (original) filepath or unixified path are equal
- * to the given pattern.
- */
- utils._equals = function (filepath, unixPath, pattern) {
- return pattern === filepath || pattern === unixPath;
- };
- /**
- * Returns true if the given (original) filepath or unixified path contain
- * the given pattern.
- */
- utils._contains = function (filepath, unixPath, pattern) {
- return filepath.indexOf(pattern) !== -1 || unixPath.indexOf(pattern) !== -1;
- };
- /**
- * Returns a function that returns true if the given
- * pattern is the same as a given `filepath`
- *
- * @param {String} `pattern`
- * @return {Function}
- */
- utils.equalsPattern = function (pattern, options) {
- var unixify = utils.unixify(options);
- options = options || {};
- return function fn(filepath) {
- var equal = utils._equals(filepath, unixify(filepath), pattern);
- if (equal === true || options.nocase !== true) {
- return equal;
- }
- var lower = filepath.toLowerCase();
- return utils._equals(lower, unixify(lower), pattern);
- };
- };
- /**
- * Returns a function that returns true if the given
- * pattern contains a `filepath`
- *
- * @param {String} `pattern`
- * @return {Function}
- */
- utils.containsPattern = function (pattern, options) {
- var unixify = utils.unixify(options);
- options = options || {};
- return function (filepath) {
- var contains = utils._contains(filepath, unixify(filepath), pattern);
- if (contains === true || options.nocase !== true) {
- return contains;
- }
- var lower = filepath.toLowerCase();
- return utils._contains(lower, unixify(lower), pattern);
- };
- };
- /**
- * Returns a function that returns true if the given
- * regex matches the `filename` of a file path.
- *
- * @param {RegExp} `re` Matching regex
- * @return {Function}
- */
- utils.matchBasename = function (re) {
- return function (filepath) {
- return re.test(path.basename(filepath));
- };
- };
- /**
- * Determines the filepath to return based on the provided options.
- * @return {any}
- */
- utils.value = function (str, unixify, options) {
- if (options && options.unixify === false) {
- return str;
- }
- return unixify(str);
- };
- /**
- * Returns a function that normalizes slashes in a string to forward
- * slashes, strips `./` from beginning of paths, and optionally unescapes
- * special characters.
- * @return {Function}
- */
- utils.unixify = function (options) {
- options = options || {};
- return function (filepath) {
- if (utils.isWindows() || options.unixify === true) {
- filepath = utils.toPosixPath(filepath);
- }
- if (options.stripPrefix !== false) {
- filepath = utils.stripPrefix(filepath);
- }
- if (options.unescape === true) {
- filepath = utils.unescape(filepath);
- }
- return filepath;
- };
- };
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../process/browser.js */ "./node_modules/process/browser.js")))
- /***/ }),
- /***/ "./node_modules/micromatch/node_modules/define-property/index.js":
- /*!***********************************************************************!*\
- !*** ./node_modules/micromatch/node_modules/define-property/index.js ***!
- \***********************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * define-property <https://github.com/jonschlinkert/define-property>
- *
- * Copyright (c) 2015-2018, Jon Schlinkert.
- * Released under the MIT License.
- */
- var isobject = __webpack_require__(/*! isobject */ "./node_modules/isobject/index.js");
- var isDescriptor = __webpack_require__(/*! is-descriptor */ "./node_modules/is-descriptor/index.js");
- var define = typeof Reflect !== 'undefined' && Reflect.defineProperty ? Reflect.defineProperty : Object.defineProperty;
- module.exports = function defineProperty(obj, key, val) {
- if (!isobject(obj) && typeof obj !== 'function' && !Array.isArray(obj)) {
- throw new TypeError('expected an object, function, or array');
- }
- if (typeof key !== 'string') {
- throw new TypeError('expected "key" to be a string');
- }
- if (isDescriptor(val)) {
- define(obj, key, val);
- return obj;
- }
- define(obj, key, {
- configurable: true,
- enumerable: false,
- writable: true,
- value: val
- });
- return obj;
- };
- /***/ }),
- /***/ "./node_modules/micromatch/node_modules/extend-shallow/index.js":
- /*!**********************************************************************!*\
- !*** ./node_modules/micromatch/node_modules/extend-shallow/index.js ***!
- \**********************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- var isExtendable = __webpack_require__(/*! is-extendable */ "./node_modules/micromatch/node_modules/is-extendable/index.js");
- var assignSymbols = __webpack_require__(/*! assign-symbols */ "./node_modules/assign-symbols/index.js");
- module.exports = Object.assign || function (obj
- /*, objects*/
- ) {
- if (obj === null || typeof obj === 'undefined') {
- throw new TypeError('Cannot convert undefined or null to object');
- }
- if (!isObject(obj)) {
- obj = {};
- }
- for (var i = 1; i < arguments.length; i++) {
- var val = arguments[i];
- if (isString(val)) {
- val = toObject(val);
- }
- if (isObject(val)) {
- assign(obj, val);
- assignSymbols(obj, val);
- }
- }
- return obj;
- };
- function assign(a, b) {
- for (var key in b) {
- if (hasOwn(b, key)) {
- a[key] = b[key];
- }
- }
- }
- function isString(val) {
- return val && typeof val === 'string';
- }
- function toObject(str) {
- var obj = {};
- for (var i in str) {
- obj[i] = str[i];
- }
- return obj;
- }
- function isObject(val) {
- return val && _typeof(val) === 'object' || isExtendable(val);
- }
- /**
- * Returns true if the given `key` is an own property of `obj`.
- */
- function hasOwn(obj, key) {
- return Object.prototype.hasOwnProperty.call(obj, key);
- }
- function isEnum(obj, key) {
- return Object.prototype.propertyIsEnumerable.call(obj, key);
- }
- /***/ }),
- /***/ "./node_modules/micromatch/node_modules/is-extendable/index.js":
- /*!*********************************************************************!*\
- !*** ./node_modules/micromatch/node_modules/is-extendable/index.js ***!
- \*********************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * is-extendable <https://github.com/jonschlinkert/is-extendable>
- *
- * Copyright (c) 2015-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- var isPlainObject = __webpack_require__(/*! is-plain-object */ "./node_modules/is-plain-object/index.js");
- module.exports = function isExtendable(val) {
- return isPlainObject(val) || typeof val === 'function' || Array.isArray(val);
- };
- /***/ }),
- /***/ "./node_modules/micromatch/node_modules/kind-of/index.js":
- /*!***************************************************************!*\
- !*** ./node_modules/micromatch/node_modules/kind-of/index.js ***!
- \***************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- var toString = Object.prototype.toString;
- module.exports = function kindOf(val) {
- if (val === void 0) return 'undefined';
- if (val === null) return 'null';
- var type = _typeof(val);
- if (type === 'boolean') return 'boolean';
- if (type === 'string') return 'string';
- if (type === 'number') return 'number';
- if (type === 'symbol') return 'symbol';
- if (type === 'function') {
- return isGeneratorFn(val) ? 'generatorfunction' : 'function';
- }
- if (isArray(val)) return 'array';
- if (isBuffer(val)) return 'buffer';
- if (isArguments(val)) return 'arguments';
- if (isDate(val)) return 'date';
- if (isError(val)) return 'error';
- if (isRegexp(val)) return 'regexp';
- switch (ctorName(val)) {
- case 'Symbol':
- return 'symbol';
- case 'Promise':
- return 'promise';
- // Set, Map, WeakSet, WeakMap
- case 'WeakMap':
- return 'weakmap';
- case 'WeakSet':
- return 'weakset';
- case 'Map':
- return 'map';
- case 'Set':
- return 'set';
- // 8-bit typed arrays
- case 'Int8Array':
- return 'int8array';
- case 'Uint8Array':
- return 'uint8array';
- case 'Uint8ClampedArray':
- return 'uint8clampedarray';
- // 16-bit typed arrays
- case 'Int16Array':
- return 'int16array';
- case 'Uint16Array':
- return 'uint16array';
- // 32-bit typed arrays
- case 'Int32Array':
- return 'int32array';
- case 'Uint32Array':
- return 'uint32array';
- case 'Float32Array':
- return 'float32array';
- case 'Float64Array':
- return 'float64array';
- }
- if (isGeneratorObj(val)) {
- return 'generator';
- } // Non-plain objects
- type = toString.call(val);
- switch (type) {
- case '[object Object]':
- return 'object';
- // iterators
- case '[object Map Iterator]':
- return 'mapiterator';
- case '[object Set Iterator]':
- return 'setiterator';
- case '[object String Iterator]':
- return 'stringiterator';
- case '[object Array Iterator]':
- return 'arrayiterator';
- } // other
- return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
- };
- function ctorName(val) {
- return val.constructor ? val.constructor.name : null;
- }
- function isArray(val) {
- if (Array.isArray) return Array.isArray(val);
- return val instanceof Array;
- }
- function isError(val) {
- return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number';
- }
- function isDate(val) {
- if (val instanceof Date) return true;
- return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function';
- }
- function isRegexp(val) {
- if (val instanceof RegExp) return true;
- return typeof val.flags === 'string' && typeof val.ignoreCase === 'boolean' && typeof val.multiline === 'boolean' && typeof val.global === 'boolean';
- }
- function isGeneratorFn(name, val) {
- return ctorName(name) === 'GeneratorFunction';
- }
- function isGeneratorObj(val) {
- return typeof val.throw === 'function' && typeof val.return === 'function' && typeof val.next === 'function';
- }
- function isArguments(val) {
- try {
- if (typeof val.length === 'number' && typeof val.callee === 'function') {
- return true;
- }
- } catch (err) {
- if (err.message.indexOf('callee') !== -1) {
- return true;
- }
- }
- return false;
- }
- /**
- * If you need to support Safari 5-7 (8-10 yr-old browser),
- * take a look at https://github.com/feross/is-buffer
- */
- function isBuffer(val) {
- if (val.constructor && typeof val.constructor.isBuffer === 'function') {
- return val.constructor.isBuffer(val);
- }
- return false;
- }
- /***/ }),
- /***/ "./node_modules/mixin-deep/index.js":
- /*!******************************************!*\
- !*** ./node_modules/mixin-deep/index.js ***!
- \******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var isExtendable = __webpack_require__(/*! is-extendable */ "./node_modules/mixin-deep/node_modules/is-extendable/index.js");
- var forIn = __webpack_require__(/*! for-in */ "./node_modules/for-in/index.js");
- function mixinDeep(target, objects) {
- var len = arguments.length,
- i = 0;
- while (++i < len) {
- var obj = arguments[i];
- if (isObject(obj)) {
- forIn(obj, copy, target);
- }
- }
- return target;
- }
- /**
- * Copy properties from the source object to the
- * target object.
- *
- * @param {*} `val`
- * @param {String} `key`
- */
- function copy(val, key) {
- if (!isValidKey(key)) {
- return;
- }
- var obj = this[key];
- if (isObject(val) && isObject(obj)) {
- mixinDeep(obj, val);
- } else {
- this[key] = val;
- }
- }
- /**
- * Returns true if `val` is an object or function.
- *
- * @param {any} val
- * @return {Boolean}
- */
- function isObject(val) {
- return isExtendable(val) && !Array.isArray(val);
- }
- /**
- * Returns true if `key` is a valid key to use when extending objects.
- *
- * @param {String} `key`
- * @return {Boolean}
- */
- function isValidKey(key) {
- return key !== '__proto__' && key !== 'constructor' && key !== 'prototype';
- }
- ;
- /**
- * Expose `mixinDeep`
- */
- module.exports = mixinDeep;
- /***/ }),
- /***/ "./node_modules/mixin-deep/node_modules/is-extendable/index.js":
- /*!*********************************************************************!*\
- !*** ./node_modules/mixin-deep/node_modules/is-extendable/index.js ***!
- \*********************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * is-extendable <https://github.com/jonschlinkert/is-extendable>
- *
- * Copyright (c) 2015-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- var isPlainObject = __webpack_require__(/*! is-plain-object */ "./node_modules/is-plain-object/index.js");
- module.exports = function isExtendable(val) {
- return isPlainObject(val) || typeof val === 'function' || Array.isArray(val);
- };
- /***/ }),
- /***/ "./node_modules/nanomatch/index.js":
- /*!*****************************************!*\
- !*** ./node_modules/nanomatch/index.js ***!
- \*****************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /**
- * Module dependencies
- */
- var util = __webpack_require__(/*! util */ "./node_modules/util/util.js");
- var toRegex = __webpack_require__(/*! to-regex */ "./node_modules/to-regex/index.js");
- var extend = __webpack_require__(/*! extend-shallow */ "./node_modules/nanomatch/node_modules/extend-shallow/index.js");
- /**
- * Local dependencies
- */
- var compilers = __webpack_require__(/*! ./lib/compilers */ "./node_modules/nanomatch/lib/compilers.js");
- var parsers = __webpack_require__(/*! ./lib/parsers */ "./node_modules/nanomatch/lib/parsers.js");
- var cache = __webpack_require__(/*! ./lib/cache */ "./node_modules/nanomatch/lib/cache.js");
- var utils = __webpack_require__(/*! ./lib/utils */ "./node_modules/nanomatch/lib/utils.js");
- var MAX_LENGTH = 1024 * 64;
- /**
- * The main function takes a list of strings and one or more
- * glob patterns to use for matching.
- *
- * ```js
- * var nm = require('nanomatch');
- * nm(list, patterns[, options]);
- *
- * console.log(nm(['a.js', 'a.txt'], ['*.js']));
- * //=> [ 'a.js' ]
- * ```
- * @param {Array} `list` A list of strings to match
- * @param {String|Array} `patterns` One or more glob patterns to use for matching.
- * @param {Object} `options` See available [options](#options) for changing how matches are performed
- * @return {Array} Returns an array of matches
- * @summary false
- * @api public
- */
- function nanomatch(list, patterns, options) {
- patterns = utils.arrayify(patterns);
- list = utils.arrayify(list);
- var len = patterns.length;
- if (list.length === 0 || len === 0) {
- return [];
- }
- if (len === 1) {
- return nanomatch.match(list, patterns[0], options);
- }
- var negated = false;
- var omit = [];
- var keep = [];
- var idx = -1;
- while (++idx < len) {
- var pattern = patterns[idx];
- if (typeof pattern === 'string' && pattern.charCodeAt(0) === 33
- /* ! */
- ) {
- omit.push.apply(omit, nanomatch.match(list, pattern.slice(1), options));
- negated = true;
- } else {
- keep.push.apply(keep, nanomatch.match(list, pattern, options));
- }
- } // minimatch.match parity
- if (negated && keep.length === 0) {
- if (options && options.unixify === false) {
- keep = list.slice();
- } else {
- var unixify = utils.unixify(options);
- for (var i = 0; i < list.length; i++) {
- keep.push(unixify(list[i]));
- }
- }
- }
- var matches = utils.diff(keep, omit);
- if (!options || options.nodupes !== false) {
- return utils.unique(matches);
- }
- return matches;
- }
- /**
- * Similar to the main function, but `pattern` must be a string.
- *
- * ```js
- * var nm = require('nanomatch');
- * nm.match(list, pattern[, options]);
- *
- * console.log(nm.match(['a.a', 'a.aa', 'a.b', 'a.c'], '*.a'));
- * //=> ['a.a', 'a.aa']
- * ```
- * @param {Array} `list` Array of strings to match
- * @param {String} `pattern` Glob pattern to use for matching.
- * @param {Object} `options` See available [options](#options) for changing how matches are performed
- * @return {Array} Returns an array of matches
- * @api public
- */
- nanomatch.match = function (list, pattern, options) {
- if (Array.isArray(pattern)) {
- throw new TypeError('expected pattern to be a string');
- }
- var unixify = utils.unixify(options);
- var isMatch = memoize('match', pattern, options, nanomatch.matcher);
- var matches = [];
- list = utils.arrayify(list);
- var len = list.length;
- var idx = -1;
- while (++idx < len) {
- var ele = list[idx];
- if (ele === pattern || isMatch(ele)) {
- matches.push(utils.value(ele, unixify, options));
- }
- } // if no options were passed, uniquify results and return
- if (typeof options === 'undefined') {
- return utils.unique(matches);
- }
- if (matches.length === 0) {
- if (options.failglob === true) {
- throw new Error('no matches found for "' + pattern + '"');
- }
- if (options.nonull === true || options.nullglob === true) {
- return [options.unescape ? utils.unescape(pattern) : pattern];
- }
- } // if `opts.ignore` was defined, diff ignored list
- if (options.ignore) {
- matches = nanomatch.not(matches, options.ignore, options);
- }
- return options.nodupes !== false ? utils.unique(matches) : matches;
- };
- /**
- * Returns true if the specified `string` matches the given glob `pattern`.
- *
- * ```js
- * var nm = require('nanomatch');
- * nm.isMatch(string, pattern[, options]);
- *
- * console.log(nm.isMatch('a.a', '*.a'));
- * //=> true
- * console.log(nm.isMatch('a.b', '*.a'));
- * //=> false
- * ```
- * @param {String} `string` String to match
- * @param {String} `pattern` Glob pattern to use for matching.
- * @param {Object} `options` See available [options](#options) for changing how matches are performed
- * @return {Boolean} Returns true if the string matches the glob pattern.
- * @api public
- */
- nanomatch.isMatch = function (str, pattern, options) {
- if (typeof str !== 'string') {
- throw new TypeError('expected a string: "' + util.inspect(str) + '"');
- }
- if (utils.isEmptyString(str) || utils.isEmptyString(pattern)) {
- return false;
- }
- var equals = utils.equalsPattern(options);
- if (equals(str)) {
- return true;
- }
- var isMatch = memoize('isMatch', pattern, options, nanomatch.matcher);
- return isMatch(str);
- };
- /**
- * Returns true if some of the elements in the given `list` match any of the
- * given glob `patterns`.
- *
- * ```js
- * var nm = require('nanomatch');
- * nm.some(list, patterns[, options]);
- *
- * console.log(nm.some(['foo.js', 'bar.js'], ['*.js', '!foo.js']));
- * // true
- * console.log(nm.some(['foo.js'], ['*.js', '!foo.js']));
- * // false
- * ```
- * @param {String|Array} `list` The string or array of strings to test. Returns as soon as the first match is found.
- * @param {String|Array} `patterns` One or more glob patterns to use for matching.
- * @param {Object} `options` See available [options](#options) for changing how matches are performed
- * @return {Boolean} Returns true if any patterns match `str`
- * @api public
- */
- nanomatch.some = function (list, patterns, options) {
- if (typeof list === 'string') {
- list = [list];
- }
- for (var i = 0; i < list.length; i++) {
- if (nanomatch(list[i], patterns, options).length === 1) {
- return true;
- }
- }
- return false;
- };
- /**
- * Returns true if every element in the given `list` matches
- * at least one of the given glob `patterns`.
- *
- * ```js
- * var nm = require('nanomatch');
- * nm.every(list, patterns[, options]);
- *
- * console.log(nm.every('foo.js', ['foo.js']));
- * // true
- * console.log(nm.every(['foo.js', 'bar.js'], ['*.js']));
- * // true
- * console.log(nm.every(['foo.js', 'bar.js'], ['*.js', '!foo.js']));
- * // false
- * console.log(nm.every(['foo.js'], ['*.js', '!foo.js']));
- * // false
- * ```
- * @param {String|Array} `list` The string or array of strings to test.
- * @param {String|Array} `patterns` One or more glob patterns to use for matching.
- * @param {Object} `options` See available [options](#options) for changing how matches are performed
- * @return {Boolean} Returns true if any patterns match `str`
- * @api public
- */
- nanomatch.every = function (list, patterns, options) {
- if (typeof list === 'string') {
- list = [list];
- }
- for (var i = 0; i < list.length; i++) {
- if (nanomatch(list[i], patterns, options).length !== 1) {
- return false;
- }
- }
- return true;
- };
- /**
- * Returns true if **any** of the given glob `patterns`
- * match the specified `string`.
- *
- * ```js
- * var nm = require('nanomatch');
- * nm.any(string, patterns[, options]);
- *
- * console.log(nm.any('a.a', ['b.*', '*.a']));
- * //=> true
- * console.log(nm.any('a.a', 'b.*'));
- * //=> false
- * ```
- * @param {String|Array} `str` The string to test.
- * @param {String|Array} `patterns` One or more glob patterns to use for matching.
- * @param {Object} `options` See available [options](#options) for changing how matches are performed
- * @return {Boolean} Returns true if any patterns match `str`
- * @api public
- */
- nanomatch.any = function (str, patterns, options) {
- if (typeof str !== 'string') {
- throw new TypeError('expected a string: "' + util.inspect(str) + '"');
- }
- if (utils.isEmptyString(str) || utils.isEmptyString(patterns)) {
- return false;
- }
- if (typeof patterns === 'string') {
- patterns = [patterns];
- }
- for (var i = 0; i < patterns.length; i++) {
- if (nanomatch.isMatch(str, patterns[i], options)) {
- return true;
- }
- }
- return false;
- };
- /**
- * Returns true if **all** of the given `patterns`
- * match the specified string.
- *
- * ```js
- * var nm = require('nanomatch');
- * nm.all(string, patterns[, options]);
- *
- * console.log(nm.all('foo.js', ['foo.js']));
- * // true
- *
- * console.log(nm.all('foo.js', ['*.js', '!foo.js']));
- * // false
- *
- * console.log(nm.all('foo.js', ['*.js', 'foo.js']));
- * // true
- *
- * console.log(nm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js']));
- * // true
- * ```
- * @param {String|Array} `str` The string to test.
- * @param {String|Array} `patterns` One or more glob patterns to use for matching.
- * @param {Object} `options` See available [options](#options) for changing how matches are performed
- * @return {Boolean} Returns true if any patterns match `str`
- * @api public
- */
- nanomatch.all = function (str, patterns, options) {
- if (typeof str !== 'string') {
- throw new TypeError('expected a string: "' + util.inspect(str) + '"');
- }
- if (typeof patterns === 'string') {
- patterns = [patterns];
- }
- for (var i = 0; i < patterns.length; i++) {
- if (!nanomatch.isMatch(str, patterns[i], options)) {
- return false;
- }
- }
- return true;
- };
- /**
- * Returns a list of strings that _**do not match any**_ of the given `patterns`.
- *
- * ```js
- * var nm = require('nanomatch');
- * nm.not(list, patterns[, options]);
- *
- * console.log(nm.not(['a.a', 'b.b', 'c.c'], '*.a'));
- * //=> ['b.b', 'c.c']
- * ```
- * @param {Array} `list` Array of strings to match.
- * @param {String|Array} `patterns` One or more glob pattern to use for matching.
- * @param {Object} `options` See available [options](#options) for changing how matches are performed
- * @return {Array} Returns an array of strings that **do not match** the given patterns.
- * @api public
- */
- nanomatch.not = function (list, patterns, options) {
- var opts = extend({}, options);
- var ignore = opts.ignore;
- delete opts.ignore;
- list = utils.arrayify(list);
- var matches = utils.diff(list, nanomatch(list, patterns, opts));
- if (ignore) {
- matches = utils.diff(matches, nanomatch(list, ignore));
- }
- return opts.nodupes !== false ? utils.unique(matches) : matches;
- };
- /**
- * Returns true if the given `string` contains the given pattern. Similar
- * to [.isMatch](#isMatch) but the pattern can match any part of the string.
- *
- * ```js
- * var nm = require('nanomatch');
- * nm.contains(string, pattern[, options]);
- *
- * console.log(nm.contains('aa/bb/cc', '*b'));
- * //=> true
- * console.log(nm.contains('aa/bb/cc', '*d'));
- * //=> false
- * ```
- * @param {String} `str` The string to match.
- * @param {String|Array} `patterns` Glob pattern to use for matching.
- * @param {Object} `options` See available [options](#options) for changing how matches are performed
- * @return {Boolean} Returns true if the patter matches any part of `str`.
- * @api public
- */
- nanomatch.contains = function (str, patterns, options) {
- if (typeof str !== 'string') {
- throw new TypeError('expected a string: "' + util.inspect(str) + '"');
- }
- if (typeof patterns === 'string') {
- if (utils.isEmptyString(str) || utils.isEmptyString(patterns)) {
- return false;
- }
- var equals = utils.equalsPattern(patterns, options);
- if (equals(str)) {
- return true;
- }
- var contains = utils.containsPattern(patterns, options);
- if (contains(str)) {
- return true;
- }
- }
- var opts = extend({}, options, {
- contains: true
- });
- return nanomatch.any(str, patterns, opts);
- };
- /**
- * Returns true if the given pattern and options should enable
- * the `matchBase` option.
- * @return {Boolean}
- * @api private
- */
- nanomatch.matchBase = function (pattern, options) {
- if (pattern && pattern.indexOf('/') !== -1 || !options) return false;
- return options.basename === true || options.matchBase === true;
- };
- /**
- * Filter the keys of the given object with the given `glob` pattern
- * and `options`. Does not attempt to match nested keys. If you need this feature,
- * use [glob-object][] instead.
- *
- * ```js
- * var nm = require('nanomatch');
- * nm.matchKeys(object, patterns[, options]);
- *
- * var obj = { aa: 'a', ab: 'b', ac: 'c' };
- * console.log(nm.matchKeys(obj, '*b'));
- * //=> { ab: 'b' }
- * ```
- * @param {Object} `object` The object with keys to filter.
- * @param {String|Array} `patterns` One or more glob patterns to use for matching.
- * @param {Object} `options` See available [options](#options) for changing how matches are performed
- * @return {Object} Returns an object with only keys that match the given patterns.
- * @api public
- */
- nanomatch.matchKeys = function (obj, patterns, options) {
- if (!utils.isObject(obj)) {
- throw new TypeError('expected the first argument to be an object');
- }
- var keys = nanomatch(Object.keys(obj), patterns, options);
- return utils.pick(obj, keys);
- };
- /**
- * Returns a memoized matcher function from the given glob `pattern` and `options`.
- * The returned function takes a string to match as its only argument and returns
- * true if the string is a match.
- *
- * ```js
- * var nm = require('nanomatch');
- * nm.matcher(pattern[, options]);
- *
- * var isMatch = nm.matcher('*.!(*a)');
- * console.log(isMatch('a.a'));
- * //=> false
- * console.log(isMatch('a.b'));
- * //=> true
- * ```
- * @param {String} `pattern` Glob pattern
- * @param {Object} `options` See available [options](#options) for changing how matches are performed.
- * @return {Function} Returns a matcher function.
- * @api public
- */
- nanomatch.matcher = function matcher(pattern, options) {
- if (utils.isEmptyString(pattern)) {
- return function () {
- return false;
- };
- }
- if (Array.isArray(pattern)) {
- return compose(pattern, options, matcher);
- } // if pattern is a regex
- if (pattern instanceof RegExp) {
- return test(pattern);
- } // if pattern is invalid
- if (!utils.isString(pattern)) {
- throw new TypeError('expected pattern to be an array, string or regex');
- } // if pattern is a non-glob string
- if (!utils.hasSpecialChars(pattern)) {
- if (options && options.nocase === true) {
- pattern = pattern.toLowerCase();
- }
- return utils.matchPath(pattern, options);
- } // if pattern is a glob string
- var re = nanomatch.makeRe(pattern, options); // if `options.matchBase` or `options.basename` is defined
- if (nanomatch.matchBase(pattern, options)) {
- return utils.matchBasename(re, options);
- }
- function test(regex) {
- var equals = utils.equalsPattern(options);
- var unixify = utils.unixify(options);
- return function (str) {
- if (equals(str)) {
- return true;
- }
- if (regex.test(unixify(str))) {
- return true;
- }
- return false;
- };
- } // create matcher function
- var matcherFn = test(re); // set result object from compiler on matcher function,
- // as a non-enumerable property. useful for debugging
- utils.define(matcherFn, 'result', re.result);
- return matcherFn;
- };
- /**
- * Returns an array of matches captured by `pattern` in `string, or
- * `null` if the pattern did not match.
- *
- * ```js
- * var nm = require('nanomatch');
- * nm.capture(pattern, string[, options]);
- *
- * console.log(nm.capture('test/*.js', 'test/foo.js'));
- * //=> ['foo']
- * console.log(nm.capture('test/*.js', 'foo/bar.css'));
- * //=> null
- * ```
- * @param {String} `pattern` Glob pattern to use for matching.
- * @param {String} `string` String to match
- * @param {Object} `options` See available [options](#options) for changing how matches are performed
- * @return {Boolean} Returns an array of captures if the string matches the glob pattern, otherwise `null`.
- * @api public
- */
- nanomatch.capture = function (pattern, str, options) {
- var re = nanomatch.makeRe(pattern, extend({
- capture: true
- }, options));
- var unixify = utils.unixify(options);
- function match() {
- return function (string) {
- var match = re.exec(unixify(string));
- if (!match) {
- return null;
- }
- return match.slice(1);
- };
- }
- var capture = memoize('capture', pattern, options, match);
- return capture(str);
- };
- /**
- * Create a regular expression from the given glob `pattern`.
- *
- * ```js
- * var nm = require('nanomatch');
- * nm.makeRe(pattern[, options]);
- *
- * console.log(nm.makeRe('*.js'));
- * //=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/
- * ```
- * @param {String} `pattern` A glob pattern to convert to regex.
- * @param {Object} `options` See available [options](#options) for changing how matches are performed.
- * @return {RegExp} Returns a regex created from the given pattern.
- * @api public
- */
- nanomatch.makeRe = function (pattern, options) {
- if (pattern instanceof RegExp) {
- return pattern;
- }
- if (typeof pattern !== 'string') {
- throw new TypeError('expected pattern to be a string');
- }
- if (pattern.length > MAX_LENGTH) {
- throw new Error('expected pattern to be less than ' + MAX_LENGTH + ' characters');
- }
- function makeRe() {
- var opts = utils.extend({
- wrap: false
- }, options);
- var result = nanomatch.create(pattern, opts);
- var regex = toRegex(result.output, opts);
- utils.define(regex, 'result', result);
- return regex;
- }
- return memoize('makeRe', pattern, options, makeRe);
- };
- /**
- * Parses the given glob `pattern` and returns an object with the compiled `output`
- * and optional source `map`.
- *
- * ```js
- * var nm = require('nanomatch');
- * nm.create(pattern[, options]);
- *
- * console.log(nm.create('abc/*.js'));
- * // { options: { source: 'string', sourcemap: true },
- * // state: {},
- * // compilers:
- * // { ... },
- * // output: '(\\.[\\\\\\/])?abc\\/(?!\\.)(?=.)[^\\/]*?\\.js',
- * // ast:
- * // { type: 'root',
- * // errors: [],
- * // nodes:
- * // [ ... ],
- * // dot: false,
- * // input: 'abc/*.js' },
- * // parsingErrors: [],
- * // map:
- * // { version: 3,
- * // sources: [ 'string' ],
- * // names: [],
- * // mappings: 'AAAA,GAAG,EAAC,kBAAC,EAAC,EAAE',
- * // sourcesContent: [ 'abc/*.js' ] },
- * // position: { line: 1, column: 28 },
- * // content: {},
- * // files: {},
- * // idx: 6 }
- * ```
- * @param {String} `pattern` Glob pattern to parse and compile.
- * @param {Object} `options` Any [options](#options) to change how parsing and compiling is performed.
- * @return {Object} Returns an object with the parsed AST, compiled string and optional source map.
- * @api public
- */
- nanomatch.create = function (pattern, options) {
- if (typeof pattern !== 'string') {
- throw new TypeError('expected a string');
- }
- function create() {
- return nanomatch.compile(nanomatch.parse(pattern, options), options);
- }
- return memoize('create', pattern, options, create);
- };
- /**
- * Parse the given `str` with the given `options`.
- *
- * ```js
- * var nm = require('nanomatch');
- * nm.parse(pattern[, options]);
- *
- * var ast = nm.parse('a/{b,c}/d');
- * console.log(ast);
- * // { type: 'root',
- * // errors: [],
- * // input: 'a/{b,c}/d',
- * // nodes:
- * // [ { type: 'bos', val: '' },
- * // { type: 'text', val: 'a/' },
- * // { type: 'brace',
- * // nodes:
- * // [ { type: 'brace.open', val: '{' },
- * // { type: 'text', val: 'b,c' },
- * // { type: 'brace.close', val: '}' } ] },
- * // { type: 'text', val: '/d' },
- * // { type: 'eos', val: '' } ] }
- * ```
- * @param {String} `str`
- * @param {Object} `options`
- * @return {Object} Returns an AST
- * @api public
- */
- nanomatch.parse = function (pattern, options) {
- if (typeof pattern !== 'string') {
- throw new TypeError('expected a string');
- }
- function parse() {
- var snapdragon = utils.instantiate(null, options);
- parsers(snapdragon, options);
- var ast = snapdragon.parse(pattern, options);
- utils.define(ast, 'snapdragon', snapdragon);
- ast.input = pattern;
- return ast;
- }
- return memoize('parse', pattern, options, parse);
- };
- /**
- * Compile the given `ast` or string with the given `options`.
- *
- * ```js
- * var nm = require('nanomatch');
- * nm.compile(ast[, options]);
- *
- * var ast = nm.parse('a/{b,c}/d');
- * console.log(nm.compile(ast));
- * // { options: { source: 'string' },
- * // state: {},
- * // compilers:
- * // { eos: [Function],
- * // noop: [Function],
- * // bos: [Function],
- * // brace: [Function],
- * // 'brace.open': [Function],
- * // text: [Function],
- * // 'brace.close': [Function] },
- * // output: [ 'a/(b|c)/d' ],
- * // ast:
- * // { ... },
- * // parsingErrors: [] }
- * ```
- * @param {Object|String} `ast`
- * @param {Object} `options`
- * @return {Object} Returns an object that has an `output` property with the compiled string.
- * @api public
- */
- nanomatch.compile = function (ast, options) {
- if (typeof ast === 'string') {
- ast = nanomatch.parse(ast, options);
- }
- function compile() {
- var snapdragon = utils.instantiate(ast, options);
- compilers(snapdragon, options);
- return snapdragon.compile(ast, options);
- }
- return memoize('compile', ast.input, options, compile);
- };
- /**
- * Clear the regex cache.
- *
- * ```js
- * nm.clearCache();
- * ```
- * @api public
- */
- nanomatch.clearCache = function () {
- nanomatch.cache.__data__ = {};
- };
- /**
- * Compose a matcher function with the given patterns.
- * This allows matcher functions to be compiled once and
- * called multiple times.
- */
- function compose(patterns, options, matcher) {
- var matchers;
- return memoize('compose', String(patterns), options, function () {
- return function (file) {
- // delay composition until it's invoked the first time,
- // after that it won't be called again
- if (!matchers) {
- matchers = [];
- for (var i = 0; i < patterns.length; i++) {
- matchers.push(matcher(patterns[i], options));
- }
- }
- var len = matchers.length;
- while (len--) {
- if (matchers[len](file) === true) {
- return true;
- }
- }
- return false;
- };
- });
- }
- /**
- * Memoize a generated regex or function. A unique key is generated
- * from the `type` (usually method name), the `pattern`, and
- * user-defined options.
- */
- function memoize(type, pattern, options, fn) {
- var key = utils.createKey(type + '=' + pattern, options);
- if (options && options.cache === false) {
- return fn(pattern, options);
- }
- if (cache.has(type, key)) {
- return cache.get(type, key);
- }
- var val = fn(pattern, options);
- cache.set(type, key, val);
- return val;
- }
- /**
- * Expose compiler, parser and cache on `nanomatch`
- */
- nanomatch.compilers = compilers;
- nanomatch.parsers = parsers;
- nanomatch.cache = cache;
- /**
- * Expose `nanomatch`
- * @type {Function}
- */
- module.exports = nanomatch;
- /***/ }),
- /***/ "./node_modules/nanomatch/lib/cache.js":
- /*!*********************************************!*\
- !*** ./node_modules/nanomatch/lib/cache.js ***!
- \*********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- module.exports = new (__webpack_require__(/*! fragment-cache */ "./node_modules/fragment-cache/index.js"))();
- /***/ }),
- /***/ "./node_modules/nanomatch/lib/compilers.js":
- /*!*************************************************!*\
- !*** ./node_modules/nanomatch/lib/compilers.js ***!
- \*************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /**
- * Nanomatch compilers
- */
- module.exports = function (nanomatch, options) {
- function slash() {
- if (options && typeof options.slash === 'string') {
- return options.slash;
- }
- if (options && typeof options.slash === 'function') {
- return options.slash.call(nanomatch);
- }
- return '\\\\/';
- }
- function star() {
- if (options && typeof options.star === 'string') {
- return options.star;
- }
- if (options && typeof options.star === 'function') {
- return options.star.call(nanomatch);
- }
- return '[^' + slash() + ']*?';
- }
- var ast = nanomatch.ast = nanomatch.parser.ast;
- ast.state = nanomatch.parser.state;
- nanomatch.compiler.state = ast.state;
- nanomatch.compiler
- /**
- * Negation / escaping
- */
- .set('not', function (node) {
- var prev = this.prev();
- if (this.options.nonegate === true || prev.type !== 'bos') {
- return this.emit('\\' + node.val, node);
- }
- return this.emit(node.val, node);
- }).set('escape', function (node) {
- if (this.options.unescape && /^[-\w_.]/.test(node.val)) {
- return this.emit(node.val, node);
- }
- return this.emit('\\' + node.val, node);
- }).set('quoted', function (node) {
- return this.emit(node.val, node);
- })
- /**
- * Regex
- */
- .set('dollar', function (node) {
- if (node.parent.type === 'bracket') {
- return this.emit(node.val, node);
- }
- return this.emit('\\' + node.val, node);
- })
- /**
- * Dot: "."
- */
- .set('dot', function (node) {
- if (node.dotfiles === true) this.dotfiles = true;
- return this.emit('\\' + node.val, node);
- })
- /**
- * Slashes: "/" and "\"
- */
- .set('backslash', function (node) {
- return this.emit(node.val, node);
- }).set('slash', function (node, nodes, i) {
- var val = '[' + slash() + ']';
- var parent = node.parent;
- var prev = this.prev(); // set "node.hasSlash" to true on all ancestor parens nodes
- while (parent.type === 'paren' && !parent.hasSlash) {
- parent.hasSlash = true;
- parent = parent.parent;
- }
- if (prev.addQmark) {
- val += '?';
- } // word boundary
- if (node.rest.slice(0, 2) === '\\b') {
- return this.emit(val, node);
- } // globstars
- if (node.parsed === '**' || node.parsed === './**') {
- this.output = '(?:' + this.output;
- return this.emit(val + ')?', node);
- } // negation
- if (node.parsed === '!**' && this.options.nonegate !== true) {
- return this.emit(val + '?\\b', node);
- }
- return this.emit(val, node);
- })
- /**
- * Square brackets
- */
- .set('bracket', function (node) {
- var close = node.close;
- var open = !node.escaped ? '[' : '\\[';
- var negated = node.negated;
- var inner = node.inner;
- var val = node.val;
- if (node.escaped === true) {
- inner = inner.replace(/\\?(\W)/g, '\\$1');
- negated = '';
- }
- if (inner === ']-') {
- inner = '\\]\\-';
- }
- if (negated && inner.indexOf('.') === -1) {
- inner += '.';
- }
- if (negated && inner.indexOf('/') === -1) {
- inner += '/';
- }
- val = open + negated + inner + close;
- return this.emit(val, node);
- })
- /**
- * Square: "[.]" (only matches a single character in brackets)
- */
- .set('square', function (node) {
- var val = (/^\W/.test(node.val) ? '\\' : '') + node.val;
- return this.emit(val, node);
- })
- /**
- * Question mark: "?"
- */
- .set('qmark', function (node) {
- var prev = this.prev(); // don't use "slash" variable so that we always avoid
- // matching backslashes and slashes with a qmark
- var val = '[^.\\\\/]';
- if (this.options.dot || prev.type !== 'bos' && prev.type !== 'slash') {
- val = '[^\\\\/]';
- }
- if (node.parsed.slice(-1) === '(') {
- var ch = node.rest.charAt(0);
- if (ch === '!' || ch === '=' || ch === ':') {
- return this.emit(node.val, node);
- }
- }
- if (node.val.length > 1) {
- val += '{' + node.val.length + '}';
- }
- return this.emit(val, node);
- })
- /**
- * Plus
- */
- .set('plus', function (node) {
- var prev = node.parsed.slice(-1);
- if (prev === ']' || prev === ')') {
- return this.emit(node.val, node);
- }
- if (!this.output || /[?*+]/.test(ch) && node.parent.type !== 'bracket') {
- return this.emit('\\+', node);
- }
- var ch = this.output.slice(-1);
- if (/\w/.test(ch) && !node.inside) {
- return this.emit('+\\+?', node);
- }
- return this.emit('+', node);
- })
- /**
- * globstar: '**'
- */
- .set('globstar', function (node, nodes, i) {
- if (!this.output) {
- this.state.leadingGlobstar = true;
- }
- var prev = this.prev();
- var before = this.prev(2);
- var next = this.next();
- var after = this.next(2);
- var type = prev.type;
- var val = node.val;
- if (prev.type === 'slash' && next.type === 'slash') {
- if (before.type === 'text') {
- this.output += '?';
- if (after.type !== 'text') {
- this.output += '\\b';
- }
- }
- }
- var parsed = node.parsed;
- if (parsed.charAt(0) === '!') {
- parsed = parsed.slice(1);
- }
- var isInside = node.isInside.paren || node.isInside.brace;
- if (parsed && type !== 'slash' && type !== 'bos' && !isInside) {
- val = star();
- } else {
- val = this.options.dot !== true ? '(?:(?!(?:[' + slash() + ']|^)\\.).)*?' : '(?:(?!(?:[' + slash() + ']|^)(?:\\.{1,2})($|[' + slash() + ']))(?!\\.{2}).)*?';
- }
- if ((type === 'slash' || type === 'bos') && this.options.dot !== true) {
- val = '(?!\\.)' + val;
- }
- if (prev.type === 'slash' && next.type === 'slash' && before.type !== 'text') {
- if (after.type === 'text' || after.type === 'star') {
- node.addQmark = true;
- }
- }
- if (this.options.capture) {
- val = '(' + val + ')';
- }
- return this.emit(val, node);
- })
- /**
- * Star: "*"
- */
- .set('star', function (node, nodes, i) {
- var prior = nodes[i - 2] || {};
- var prev = this.prev();
- var next = this.next();
- var type = prev.type;
- function isStart(n) {
- return n.type === 'bos' || n.type === 'slash';
- }
- if (this.output === '' && this.options.contains !== true) {
- this.output = '(?![' + slash() + '])';
- }
- if (type === 'bracket' && this.options.bash === false) {
- var str = next && next.type === 'bracket' ? star() : '*?';
- if (!prev.nodes || prev.nodes[1].type !== 'posix') {
- return this.emit(str, node);
- }
- }
- var prefix = !this.dotfiles && type !== 'text' && type !== 'escape' ? this.options.dot ? '(?!(?:^|[' + slash() + '])\\.{1,2}(?:$|[' + slash() + ']))' : '(?!\\.)' : '';
- if (isStart(prev) || isStart(prior) && type === 'not') {
- if (prefix !== '(?!\\.)') {
- prefix += '(?!(\\.{2}|\\.[' + slash() + ']))(?=.)';
- } else {
- prefix += '(?=.)';
- }
- } else if (prefix === '(?!\\.)') {
- prefix = '';
- }
- if (prev.type === 'not' && prior.type === 'bos' && this.options.dot === true) {
- this.output = '(?!\\.)' + this.output;
- }
- var output = prefix + star();
- if (this.options.capture) {
- output = '(' + output + ')';
- }
- return this.emit(output, node);
- })
- /**
- * Text
- */
- .set('text', function (node) {
- return this.emit(node.val, node);
- })
- /**
- * End-of-string
- */
- .set('eos', function (node) {
- var prev = this.prev();
- var val = node.val;
- this.output = '(?:\\.[' + slash() + '](?=.))?' + this.output;
- if (this.state.metachar && prev.type !== 'qmark' && prev.type !== 'slash') {
- val += this.options.contains ? '[' + slash() + ']?' : '(?:[' + slash() + ']|$)';
- }
- return this.emit(val, node);
- });
- /**
- * Allow custom compilers to be passed on options
- */
- if (options && typeof options.compilers === 'function') {
- options.compilers(nanomatch.compiler);
- }
- };
- /***/ }),
- /***/ "./node_modules/nanomatch/lib/parsers.js":
- /*!***********************************************!*\
- !*** ./node_modules/nanomatch/lib/parsers.js ***!
- \***********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var regexNot = __webpack_require__(/*! regex-not */ "./node_modules/regex-not/index.js");
- var toRegex = __webpack_require__(/*! to-regex */ "./node_modules/to-regex/index.js");
- /**
- * Characters to use in negation regex (we want to "not" match
- * characters that are matched by other parsers)
- */
- var cached;
- var NOT_REGEX = '[\\[!*+?$^"\'.\\\\/]+';
- var not = createTextRegex(NOT_REGEX);
- /**
- * Nanomatch parsers
- */
- module.exports = function (nanomatch, options) {
- var parser = nanomatch.parser;
- var opts = parser.options;
- parser.state = {
- slashes: 0,
- paths: []
- };
- parser.ast.state = parser.state;
- parser
- /**
- * Beginning-of-string
- */
- .capture('prefix', function () {
- if (this.parsed) return;
- var m = this.match(/^\.[\\/]/);
- if (!m) return;
- this.state.strictOpen = !!this.options.strictOpen;
- this.state.addPrefix = true;
- })
- /**
- * Escape: "\\."
- */
- .capture('escape', function () {
- if (this.isInside('bracket')) return;
- var pos = this.position();
- var m = this.match(/^(?:\\(.)|([$^]))/);
- if (!m) return;
- return pos({
- type: 'escape',
- val: m[2] || m[1]
- });
- })
- /**
- * Quoted strings
- */
- .capture('quoted', function () {
- var pos = this.position();
- var m = this.match(/^["']/);
- if (!m) return;
- var quote = m[0];
- if (this.input.indexOf(quote) === -1) {
- return pos({
- type: 'escape',
- val: quote
- });
- }
- var tok = advanceTo(this.input, quote);
- this.consume(tok.len);
- return pos({
- type: 'quoted',
- val: tok.esc
- });
- })
- /**
- * Negations: "!"
- */
- .capture('not', function () {
- var parsed = this.parsed;
- var pos = this.position();
- var m = this.match(this.notRegex || /^!+/);
- if (!m) return;
- var val = m[0];
- var isNegated = val.length % 2 === 1;
- if (parsed === '' && !isNegated) {
- val = '';
- } // if nothing has been parsed, we know `!` is at the start,
- // so we need to wrap the result in a negation regex
- if (parsed === '' && isNegated && this.options.nonegate !== true) {
- this.bos.val = '(?!^(?:';
- this.append = ')$).*';
- val = '';
- }
- return pos({
- type: 'not',
- val: val
- });
- })
- /**
- * Dot: "."
- */
- .capture('dot', function () {
- var parsed = this.parsed;
- var pos = this.position();
- var m = this.match(/^\.+/);
- if (!m) return;
- var val = m[0];
- this.state.dot = val === '.' && (parsed === '' || parsed.slice(-1) === '/');
- return pos({
- type: 'dot',
- dotfiles: this.state.dot,
- val: val
- });
- })
- /**
- * Plus: "+"
- */
- .capture('plus', /^\+(?!\()/)
- /**
- * Question mark: "?"
- */
- .capture('qmark', function () {
- var parsed = this.parsed;
- var pos = this.position();
- var m = this.match(/^\?+(?!\()/);
- if (!m) return;
- this.state.metachar = true;
- this.state.qmark = true;
- return pos({
- type: 'qmark',
- parsed: parsed,
- val: m[0]
- });
- })
- /**
- * Globstar: "**"
- */
- .capture('globstar', function () {
- var parsed = this.parsed;
- var pos = this.position();
- var m = this.match(/^\*{2}(?![*(])(?=[,)/]|$)/);
- if (!m) return;
- var type = opts.noglobstar !== true ? 'globstar' : 'star';
- var node = pos({
- type: type,
- parsed: parsed
- });
- this.state.metachar = true;
- while (this.input.slice(0, 4) === '/**/') {
- this.input = this.input.slice(3);
- }
- node.isInside = {
- brace: this.isInside('brace'),
- paren: this.isInside('paren')
- };
- if (type === 'globstar') {
- this.state.globstar = true;
- node.val = '**';
- } else {
- this.state.star = true;
- node.val = '*';
- }
- return node;
- })
- /**
- * Star: "*"
- */
- .capture('star', function () {
- var pos = this.position();
- var starRe = /^(?:\*(?![*(])|[*]{3,}(?!\()|[*]{2}(?![(/]|$)|\*(?=\*\())/;
- var m = this.match(starRe);
- if (!m) return;
- this.state.metachar = true;
- this.state.star = true;
- return pos({
- type: 'star',
- val: m[0]
- });
- })
- /**
- * Slash: "/"
- */
- .capture('slash', function () {
- var pos = this.position();
- var m = this.match(/^\//);
- if (!m) return;
- this.state.slashes++;
- return pos({
- type: 'slash',
- val: m[0]
- });
- })
- /**
- * Backslash: "\\"
- */
- .capture('backslash', function () {
- var pos = this.position();
- var m = this.match(/^\\(?![*+?(){}[\]'"])/);
- if (!m) return;
- var val = m[0];
- if (this.isInside('bracket')) {
- val = '\\';
- } else if (val.length > 1) {
- val = '\\\\';
- }
- return pos({
- type: 'backslash',
- val: val
- });
- })
- /**
- * Square: "[.]"
- */
- .capture('square', function () {
- if (this.isInside('bracket')) return;
- var pos = this.position();
- var m = this.match(/^\[([^!^\\])\]/);
- if (!m) return;
- return pos({
- type: 'square',
- val: m[1]
- });
- })
- /**
- * Brackets: "[...]" (basic, this can be overridden by other parsers)
- */
- .capture('bracket', function () {
- var pos = this.position();
- var m = this.match(/^(?:\[([!^]?)([^\]]+|\]-)(\]|[^*+?]+)|\[)/);
- if (!m) return;
- var val = m[0];
- var negated = m[1] ? '^' : '';
- var inner = (m[2] || '').replace(/\\\\+/, '\\\\');
- var close = m[3] || '';
- if (m[2] && inner.length < m[2].length) {
- val = val.replace(/\\\\+/, '\\\\');
- }
- var esc = this.input.slice(0, 2);
- if (inner === '' && esc === '\\]') {
- inner += esc;
- this.consume(2);
- var str = this.input;
- var idx = -1;
- var ch;
- while (ch = str[++idx]) {
- this.consume(1);
- if (ch === ']') {
- close = ch;
- break;
- }
- inner += ch;
- }
- }
- return pos({
- type: 'bracket',
- val: val,
- escaped: close !== ']',
- negated: negated,
- inner: inner,
- close: close
- });
- })
- /**
- * Text
- */
- .capture('text', function () {
- if (this.isInside('bracket')) return;
- var pos = this.position();
- var m = this.match(not);
- if (!m || !m[0]) return;
- return pos({
- type: 'text',
- val: m[0]
- });
- });
- /**
- * Allow custom parsers to be passed on options
- */
- if (options && typeof options.parsers === 'function') {
- options.parsers(nanomatch.parser);
- }
- };
- /**
- * Advance to the next non-escaped character
- */
- function advanceTo(input, endChar) {
- var ch = input.charAt(0);
- var tok = {
- len: 1,
- val: '',
- esc: ''
- };
- var idx = 0;
- function advance() {
- if (ch !== '\\') {
- tok.esc += '\\' + ch;
- tok.val += ch;
- }
- ch = input.charAt(++idx);
- tok.len++;
- if (ch === '\\') {
- advance();
- advance();
- }
- }
- while (ch && ch !== endChar) {
- advance();
- }
- return tok;
- }
- /**
- * Create text regex
- */
- function createTextRegex(pattern) {
- if (cached) return cached;
- var opts = {
- contains: true,
- strictClose: false
- };
- var not = regexNot.create(pattern, opts);
- var re = toRegex('^(?:[*]\\((?=.)|' + not + ')', opts);
- return cached = re;
- }
- /**
- * Expose negation string
- */
- module.exports.not = NOT_REGEX;
- /***/ }),
- /***/ "./node_modules/nanomatch/lib/utils.js":
- /*!*********************************************!*\
- !*** ./node_modules/nanomatch/lib/utils.js ***!
- \*********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var utils = module.exports;
- var path = __webpack_require__(/*! path */ "./node_modules/path-browserify/index.js");
- /**
- * Module dependencies
- */
- var isWindows = __webpack_require__(/*! is-windows */ "./node_modules/is-windows/index.js")();
- var Snapdragon = __webpack_require__(/*! snapdragon */ "./node_modules/snapdragon/index.js");
- utils.define = __webpack_require__(/*! define-property */ "./node_modules/nanomatch/node_modules/define-property/index.js");
- utils.diff = __webpack_require__(/*! arr-diff */ "./node_modules/arr-diff/index.js");
- utils.extend = __webpack_require__(/*! extend-shallow */ "./node_modules/nanomatch/node_modules/extend-shallow/index.js");
- utils.pick = __webpack_require__(/*! object.pick */ "./node_modules/object.pick/index.js");
- utils.typeOf = __webpack_require__(/*! kind-of */ "./node_modules/nanomatch/node_modules/kind-of/index.js");
- utils.unique = __webpack_require__(/*! array-unique */ "./node_modules/array-unique/index.js");
- /**
- * Returns true if the given value is effectively an empty string
- */
- utils.isEmptyString = function (val) {
- return String(val) === '' || String(val) === './';
- };
- /**
- * Returns true if the platform is windows, or `path.sep` is `\\`.
- * This is defined as a function to allow `path.sep` to be set in unit tests,
- * or by the user, if there is a reason to do so.
- * @return {Boolean}
- */
- utils.isWindows = function () {
- return path.sep === '\\' || isWindows === true;
- };
- /**
- * Return the last element from an array
- */
- utils.last = function (arr, n) {
- return arr[arr.length - (n || 1)];
- };
- /**
- * Get the `Snapdragon` instance to use
- */
- utils.instantiate = function (ast, options) {
- var snapdragon; // if an instance was created by `.parse`, use that instance
- if (utils.typeOf(ast) === 'object' && ast.snapdragon) {
- snapdragon = ast.snapdragon; // if the user supplies an instance on options, use that instance
- } else if (utils.typeOf(options) === 'object' && options.snapdragon) {
- snapdragon = options.snapdragon; // create a new instance
- } else {
- snapdragon = new Snapdragon(options);
- }
- utils.define(snapdragon, 'parse', function (str, options) {
- var parsed = Snapdragon.prototype.parse.call(this, str, options);
- parsed.input = str; // escape unmatched brace/bracket/parens
- var last = this.parser.stack.pop();
- if (last && this.options.strictErrors !== true) {
- var open = last.nodes[0];
- var inner = last.nodes[1];
- if (last.type === 'bracket') {
- if (inner.val.charAt(0) === '[') {
- inner.val = '\\' + inner.val;
- }
- } else {
- open.val = '\\' + open.val;
- var sibling = open.parent.nodes[1];
- if (sibling.type === 'star') {
- sibling.loose = true;
- }
- }
- } // add non-enumerable parser reference
- utils.define(parsed, 'parser', this.parser);
- return parsed;
- });
- return snapdragon;
- };
- /**
- * Create the key to use for memoization. The key is generated
- * by iterating over the options and concatenating key-value pairs
- * to the pattern string.
- */
- utils.createKey = function (pattern, options) {
- if (typeof options === 'undefined') {
- return pattern;
- }
- var key = pattern;
- for (var prop in options) {
- if (options.hasOwnProperty(prop)) {
- key += ';' + prop + '=' + String(options[prop]);
- }
- }
- return key;
- };
- /**
- * Cast `val` to an array
- * @return {Array}
- */
- utils.arrayify = function (val) {
- if (typeof val === 'string') return [val];
- return val ? Array.isArray(val) ? val : [val] : [];
- };
- /**
- * Return true if `val` is a non-empty string
- */
- utils.isString = function (val) {
- return typeof val === 'string';
- };
- /**
- * Return true if `val` is a non-empty string
- */
- utils.isRegex = function (val) {
- return utils.typeOf(val) === 'regexp';
- };
- /**
- * Return true if `val` is a non-empty string
- */
- utils.isObject = function (val) {
- return utils.typeOf(val) === 'object';
- };
- /**
- * Escape regex characters in the given string
- */
- utils.escapeRegex = function (str) {
- return str.replace(/[-[\]{}()^$|*+?.\\/\s]/g, '\\$&');
- };
- /**
- * Combines duplicate characters in the provided `input` string.
- * @param {String} `input`
- * @returns {String}
- */
- utils.combineDupes = function (input, patterns) {
- patterns = utils.arrayify(patterns).join('|').split('|');
- patterns = patterns.map(function (s) {
- return s.replace(/\\?([+*\\/])/g, '\\$1');
- });
- var substr = patterns.join('|');
- var regex = new RegExp('(' + substr + ')(?=\\1)', 'g');
- return input.replace(regex, '');
- };
- /**
- * Returns true if the given `str` has special characters
- */
- utils.hasSpecialChars = function (str) {
- return /(?:(?:(^|\/)[!.])|[*?+()|[\]{}]|[+@]\()/.test(str);
- };
- /**
- * Normalize slashes in the given filepath.
- *
- * @param {String} `filepath`
- * @return {String}
- */
- utils.toPosixPath = function (str) {
- return str.replace(/\\+/g, '/');
- };
- /**
- * Strip backslashes before special characters in a string.
- *
- * @param {String} `str`
- * @return {String}
- */
- utils.unescape = function (str) {
- return utils.toPosixPath(str.replace(/\\(?=[*+?!.])/g, ''));
- };
- /**
- * Strip the drive letter from a windows filepath
- * @param {String} `fp`
- * @return {String}
- */
- utils.stripDrive = function (fp) {
- return utils.isWindows() ? fp.replace(/^[a-z]:[\\/]+?/i, '/') : fp;
- };
- /**
- * Strip the prefix from a filepath
- * @param {String} `fp`
- * @return {String}
- */
- utils.stripPrefix = function (str) {
- if (str.charAt(0) === '.' && (str.charAt(1) === '/' || str.charAt(1) === '\\')) {
- return str.slice(2);
- }
- return str;
- };
- /**
- * Returns true if `str` is a common character that doesn't need
- * to be processed to be used for matching.
- * @param {String} `str`
- * @return {Boolean}
- */
- utils.isSimpleChar = function (str) {
- return str.trim() === '' || str === '.';
- };
- /**
- * Returns true if the given str is an escaped or
- * unescaped path character
- */
- utils.isSlash = function (str) {
- return str === '/' || str === '\\/' || str === '\\' || str === '\\\\';
- };
- /**
- * Returns a function that returns true if the given
- * pattern matches or contains a `filepath`
- *
- * @param {String} `pattern`
- * @return {Function}
- */
- utils.matchPath = function (pattern, options) {
- return options && options.contains ? utils.containsPattern(pattern, options) : utils.equalsPattern(pattern, options);
- };
- /**
- * Returns true if the given (original) filepath or unixified path are equal
- * to the given pattern.
- */
- utils._equals = function (filepath, unixPath, pattern) {
- return pattern === filepath || pattern === unixPath;
- };
- /**
- * Returns true if the given (original) filepath or unixified path contain
- * the given pattern.
- */
- utils._contains = function (filepath, unixPath, pattern) {
- return filepath.indexOf(pattern) !== -1 || unixPath.indexOf(pattern) !== -1;
- };
- /**
- * Returns a function that returns true if the given
- * pattern is the same as a given `filepath`
- *
- * @param {String} `pattern`
- * @return {Function}
- */
- utils.equalsPattern = function (pattern, options) {
- var unixify = utils.unixify(options);
- options = options || {};
- return function fn(filepath) {
- var equal = utils._equals(filepath, unixify(filepath), pattern);
- if (equal === true || options.nocase !== true) {
- return equal;
- }
- var lower = filepath.toLowerCase();
- return utils._equals(lower, unixify(lower), pattern);
- };
- };
- /**
- * Returns a function that returns true if the given
- * pattern contains a `filepath`
- *
- * @param {String} `pattern`
- * @return {Function}
- */
- utils.containsPattern = function (pattern, options) {
- var unixify = utils.unixify(options);
- options = options || {};
- return function (filepath) {
- var contains = utils._contains(filepath, unixify(filepath), pattern);
- if (contains === true || options.nocase !== true) {
- return contains;
- }
- var lower = filepath.toLowerCase();
- return utils._contains(lower, unixify(lower), pattern);
- };
- };
- /**
- * Returns a function that returns true if the given
- * regex matches the `filename` of a file path.
- *
- * @param {RegExp} `re` Matching regex
- * @return {Function}
- */
- utils.matchBasename = function (re) {
- return function (filepath) {
- return re.test(filepath) || re.test(path.basename(filepath));
- };
- };
- /**
- * Returns the given value unchanced.
- * @return {any}
- */
- utils.identity = function (val) {
- return val;
- };
- /**
- * Determines the filepath to return based on the provided options.
- * @return {any}
- */
- utils.value = function (str, unixify, options) {
- if (options && options.unixify === false) {
- return str;
- }
- if (options && typeof options.unixify === 'function') {
- return options.unixify(str);
- }
- return unixify(str);
- };
- /**
- * Returns a function that normalizes slashes in a string to forward
- * slashes, strips `./` from beginning of paths, and optionally unescapes
- * special characters.
- * @return {Function}
- */
- utils.unixify = function (options) {
- var opts = options || {};
- return function (filepath) {
- if (opts.stripPrefix !== false) {
- filepath = utils.stripPrefix(filepath);
- }
- if (opts.unescape === true) {
- filepath = utils.unescape(filepath);
- }
- if (opts.unixify === true || utils.isWindows()) {
- filepath = utils.toPosixPath(filepath);
- }
- return filepath;
- };
- };
- /***/ }),
- /***/ "./node_modules/nanomatch/node_modules/define-property/index.js":
- /*!**********************************************************************!*\
- !*** ./node_modules/nanomatch/node_modules/define-property/index.js ***!
- \**********************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * define-property <https://github.com/jonschlinkert/define-property>
- *
- * Copyright (c) 2015-2018, Jon Schlinkert.
- * Released under the MIT License.
- */
- var isobject = __webpack_require__(/*! isobject */ "./node_modules/isobject/index.js");
- var isDescriptor = __webpack_require__(/*! is-descriptor */ "./node_modules/is-descriptor/index.js");
- var define = typeof Reflect !== 'undefined' && Reflect.defineProperty ? Reflect.defineProperty : Object.defineProperty;
- module.exports = function defineProperty(obj, key, val) {
- if (!isobject(obj) && typeof obj !== 'function' && !Array.isArray(obj)) {
- throw new TypeError('expected an object, function, or array');
- }
- if (typeof key !== 'string') {
- throw new TypeError('expected "key" to be a string');
- }
- if (isDescriptor(val)) {
- define(obj, key, val);
- return obj;
- }
- define(obj, key, {
- configurable: true,
- enumerable: false,
- writable: true,
- value: val
- });
- return obj;
- };
- /***/ }),
- /***/ "./node_modules/nanomatch/node_modules/extend-shallow/index.js":
- /*!*********************************************************************!*\
- !*** ./node_modules/nanomatch/node_modules/extend-shallow/index.js ***!
- \*********************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- var isExtendable = __webpack_require__(/*! is-extendable */ "./node_modules/nanomatch/node_modules/is-extendable/index.js");
- var assignSymbols = __webpack_require__(/*! assign-symbols */ "./node_modules/assign-symbols/index.js");
- module.exports = Object.assign || function (obj
- /*, objects*/
- ) {
- if (obj === null || typeof obj === 'undefined') {
- throw new TypeError('Cannot convert undefined or null to object');
- }
- if (!isObject(obj)) {
- obj = {};
- }
- for (var i = 1; i < arguments.length; i++) {
- var val = arguments[i];
- if (isString(val)) {
- val = toObject(val);
- }
- if (isObject(val)) {
- assign(obj, val);
- assignSymbols(obj, val);
- }
- }
- return obj;
- };
- function assign(a, b) {
- for (var key in b) {
- if (hasOwn(b, key)) {
- a[key] = b[key];
- }
- }
- }
- function isString(val) {
- return val && typeof val === 'string';
- }
- function toObject(str) {
- var obj = {};
- for (var i in str) {
- obj[i] = str[i];
- }
- return obj;
- }
- function isObject(val) {
- return val && _typeof(val) === 'object' || isExtendable(val);
- }
- /**
- * Returns true if the given `key` is an own property of `obj`.
- */
- function hasOwn(obj, key) {
- return Object.prototype.hasOwnProperty.call(obj, key);
- }
- function isEnum(obj, key) {
- return Object.prototype.propertyIsEnumerable.call(obj, key);
- }
- /***/ }),
- /***/ "./node_modules/nanomatch/node_modules/is-extendable/index.js":
- /*!********************************************************************!*\
- !*** ./node_modules/nanomatch/node_modules/is-extendable/index.js ***!
- \********************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * is-extendable <https://github.com/jonschlinkert/is-extendable>
- *
- * Copyright (c) 2015-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- var isPlainObject = __webpack_require__(/*! is-plain-object */ "./node_modules/is-plain-object/index.js");
- module.exports = function isExtendable(val) {
- return isPlainObject(val) || typeof val === 'function' || Array.isArray(val);
- };
- /***/ }),
- /***/ "./node_modules/nanomatch/node_modules/kind-of/index.js":
- /*!**************************************************************!*\
- !*** ./node_modules/nanomatch/node_modules/kind-of/index.js ***!
- \**************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- var toString = Object.prototype.toString;
- module.exports = function kindOf(val) {
- if (val === void 0) return 'undefined';
- if (val === null) return 'null';
- var type = _typeof(val);
- if (type === 'boolean') return 'boolean';
- if (type === 'string') return 'string';
- if (type === 'number') return 'number';
- if (type === 'symbol') return 'symbol';
- if (type === 'function') {
- return isGeneratorFn(val) ? 'generatorfunction' : 'function';
- }
- if (isArray(val)) return 'array';
- if (isBuffer(val)) return 'buffer';
- if (isArguments(val)) return 'arguments';
- if (isDate(val)) return 'date';
- if (isError(val)) return 'error';
- if (isRegexp(val)) return 'regexp';
- switch (ctorName(val)) {
- case 'Symbol':
- return 'symbol';
- case 'Promise':
- return 'promise';
- // Set, Map, WeakSet, WeakMap
- case 'WeakMap':
- return 'weakmap';
- case 'WeakSet':
- return 'weakset';
- case 'Map':
- return 'map';
- case 'Set':
- return 'set';
- // 8-bit typed arrays
- case 'Int8Array':
- return 'int8array';
- case 'Uint8Array':
- return 'uint8array';
- case 'Uint8ClampedArray':
- return 'uint8clampedarray';
- // 16-bit typed arrays
- case 'Int16Array':
- return 'int16array';
- case 'Uint16Array':
- return 'uint16array';
- // 32-bit typed arrays
- case 'Int32Array':
- return 'int32array';
- case 'Uint32Array':
- return 'uint32array';
- case 'Float32Array':
- return 'float32array';
- case 'Float64Array':
- return 'float64array';
- }
- if (isGeneratorObj(val)) {
- return 'generator';
- } // Non-plain objects
- type = toString.call(val);
- switch (type) {
- case '[object Object]':
- return 'object';
- // iterators
- case '[object Map Iterator]':
- return 'mapiterator';
- case '[object Set Iterator]':
- return 'setiterator';
- case '[object String Iterator]':
- return 'stringiterator';
- case '[object Array Iterator]':
- return 'arrayiterator';
- } // other
- return type.slice(8, -1).toLowerCase().replace(/\s/g, '');
- };
- function ctorName(val) {
- return val.constructor ? val.constructor.name : null;
- }
- function isArray(val) {
- if (Array.isArray) return Array.isArray(val);
- return val instanceof Array;
- }
- function isError(val) {
- return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number';
- }
- function isDate(val) {
- if (val instanceof Date) return true;
- return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function';
- }
- function isRegexp(val) {
- if (val instanceof RegExp) return true;
- return typeof val.flags === 'string' && typeof val.ignoreCase === 'boolean' && typeof val.multiline === 'boolean' && typeof val.global === 'boolean';
- }
- function isGeneratorFn(name, val) {
- return ctorName(name) === 'GeneratorFunction';
- }
- function isGeneratorObj(val) {
- return typeof val.throw === 'function' && typeof val.return === 'function' && typeof val.next === 'function';
- }
- function isArguments(val) {
- try {
- if (typeof val.length === 'number' && typeof val.callee === 'function') {
- return true;
- }
- } catch (err) {
- if (err.message.indexOf('callee') !== -1) {
- return true;
- }
- }
- return false;
- }
- /**
- * If you need to support Safari 5-7 (8-10 yr-old browser),
- * take a look at https://github.com/feross/is-buffer
- */
- function isBuffer(val) {
- if (val.constructor && typeof val.constructor.isBuffer === 'function') {
- return val.constructor.isBuffer(val);
- }
- return false;
- }
- /***/ }),
- /***/ "./node_modules/node-libs-browser/mock/empty.js":
- /*!******************************************************!*\
- !*** ./node_modules/node-libs-browser/mock/empty.js ***!
- \******************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /***/ }),
- /***/ "./node_modules/object-copy/index.js":
- /*!*******************************************!*\
- !*** ./node_modules/object-copy/index.js ***!
- \*******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var typeOf = __webpack_require__(/*! kind-of */ "./node_modules/kind-of/index.js");
- var copyDescriptor = __webpack_require__(/*! copy-descriptor */ "./node_modules/copy-descriptor/index.js");
- var define = __webpack_require__(/*! define-property */ "./node_modules/define-property/index.js");
- /**
- * Copy static properties, prototype properties, and descriptors from one object to another.
- *
- * ```js
- * function App() {}
- * var proto = App.prototype;
- * App.prototype.set = function() {};
- * App.prototype.get = function() {};
- *
- * var obj = {};
- * copy(obj, proto);
- * ```
- * @param {Object} `receiver`
- * @param {Object} `provider`
- * @param {String|Array} `omit` One or more properties to omit
- * @return {Object}
- * @api public
- */
- function copy(receiver, provider, omit) {
- if (!isObject(receiver)) {
- throw new TypeError('expected receiving object to be an object.');
- }
- if (!isObject(provider)) {
- throw new TypeError('expected providing object to be an object.');
- }
- var props = nativeKeys(provider);
- var keys = Object.keys(provider);
- var len = props.length;
- omit = arrayify(omit);
- while (len--) {
- var key = props[len];
- if (has(keys, key)) {
- define(receiver, key, provider[key]);
- } else if (!(key in receiver) && !has(omit, key)) {
- copyDescriptor(receiver, provider, key);
- }
- }
- }
- ;
- /**
- * Return true if the given value is an object or function
- */
- function isObject(val) {
- return typeOf(val) === 'object' || typeof val === 'function';
- }
- /**
- * Returns true if an array has any of the given elements, or an
- * object has any of the give keys.
- *
- * ```js
- * has(['a', 'b', 'c'], 'c');
- * //=> true
- *
- * has(['a', 'b', 'c'], ['c', 'z']);
- * //=> true
- *
- * has({a: 'b', c: 'd'}, ['c', 'z']);
- * //=> true
- * ```
- * @param {Object} `obj`
- * @param {String|Array} `val`
- * @return {Boolean}
- */
- function has(obj, val) {
- val = arrayify(val);
- var len = val.length;
- if (isObject(obj)) {
- for (var key in obj) {
- if (val.indexOf(key) > -1) {
- return true;
- }
- }
- var keys = nativeKeys(obj);
- return has(keys, val);
- }
- if (Array.isArray(obj)) {
- var arr = obj;
- while (len--) {
- if (arr.indexOf(val[len]) > -1) {
- return true;
- }
- }
- return false;
- }
- throw new TypeError('expected an array or object.');
- }
- /**
- * Cast the given value to an array.
- *
- * ```js
- * arrayify('foo');
- * //=> ['foo']
- *
- * arrayify(['foo']);
- * //=> ['foo']
- * ```
- *
- * @param {String|Array} `val`
- * @return {Array}
- */
- function arrayify(val) {
- return val ? Array.isArray(val) ? val : [val] : [];
- }
- /**
- * Returns true if a value has a `contructor`
- *
- * ```js
- * hasConstructor({});
- * //=> true
- *
- * hasConstructor(Object.create(null));
- * //=> false
- * ```
- * @param {Object} `value`
- * @return {Boolean}
- */
- function hasConstructor(val) {
- return isObject(val) && typeof val.constructor !== 'undefined';
- }
- /**
- * Get the native `ownPropertyNames` from the constructor of the
- * given `object`. An empty array is returned if the object does
- * not have a constructor.
- *
- * ```js
- * nativeKeys({a: 'b', b: 'c', c: 'd'})
- * //=> ['a', 'b', 'c']
- *
- * nativeKeys(function(){})
- * //=> ['length', 'caller']
- * ```
- *
- * @param {Object} `obj` Object that has a `constructor`.
- * @return {Array} Array of keys.
- */
- function nativeKeys(val) {
- if (!hasConstructor(val)) return [];
- return Object.getOwnPropertyNames(val);
- }
- /**
- * Expose `copy`
- */
- module.exports = copy;
- /**
- * Expose `copy.has` for tests
- */
- module.exports.has = has;
- /***/ }),
- /***/ "./node_modules/object-visit/index.js":
- /*!********************************************!*\
- !*** ./node_modules/object-visit/index.js ***!
- \********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * object-visit <https://github.com/jonschlinkert/object-visit>
- *
- * Copyright (c) 2015, 2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- var isObject = __webpack_require__(/*! isobject */ "./node_modules/isobject/index.js");
- module.exports = function visit(thisArg, method, target, val) {
- if (!isObject(thisArg) && typeof thisArg !== 'function') {
- throw new Error('object-visit expects `thisArg` to be an object.');
- }
- if (typeof method !== 'string') {
- throw new Error('object-visit expects `method` name to be a string');
- }
- if (typeof thisArg[method] !== 'function') {
- return thisArg;
- }
- var args = [].slice.call(arguments, 3);
- target = target || {};
- for (var key in target) {
- var arr = [key, target[key]].concat(args);
- thisArg[method].apply(thisArg, arr);
- }
- return thisArg;
- };
- /***/ }),
- /***/ "./node_modules/object.pick/index.js":
- /*!*******************************************!*\
- !*** ./node_modules/object.pick/index.js ***!
- \*******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * object.pick <https://github.com/jonschlinkert/object.pick>
- *
- * Copyright (c) 2014-2015 Jon Schlinkert, contributors.
- * Licensed under the MIT License
- */
- var isObject = __webpack_require__(/*! isobject */ "./node_modules/isobject/index.js");
- module.exports = function pick(obj, keys) {
- if (!isObject(obj) && typeof obj !== 'function') {
- return {};
- }
- var res = {};
- if (typeof keys === 'string') {
- if (keys in obj) {
- res[keys] = obj[keys];
- }
- return res;
- }
- var len = keys.length;
- var idx = -1;
- while (++idx < len) {
- var key = keys[idx];
- if (key in obj) {
- res[key] = obj[key];
- }
- }
- return res;
- };
- /***/ }),
- /***/ "./node_modules/pascalcase/index.js":
- /*!******************************************!*\
- !*** ./node_modules/pascalcase/index.js ***!
- \******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * pascalcase <https://github.com/jonschlinkert/pascalcase>
- *
- * Copyright (c) 2015, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- function pascalcase(str) {
- if (typeof str !== 'string') {
- throw new TypeError('expected a string.');
- }
- str = str.replace(/([A-Z])/g, ' $1');
- if (str.length === 1) {
- return str.toUpperCase();
- }
- str = str.replace(/^[\W_]+|[\W_]+$/g, '').toLowerCase();
- str = str.charAt(0).toUpperCase() + str.slice(1);
- return str.replace(/[\W_]+(\w|$)/g, function (_, ch) {
- return ch.toUpperCase();
- });
- }
- module.exports = pascalcase;
- /***/ }),
- /***/ "./node_modules/path-browserify/index.js":
- /*!***********************************************!*\
- !*** ./node_modules/path-browserify/index.js ***!
- \***********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(process) {
- // .dirname, .basename, and .extname methods are extracted from Node.js v8.11.1,
- // backported and transplited with Babel, with backwards-compat fixes
- // Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
- // resolves . and .. elements in a path array with directory names there
- // must be no slashes, empty elements, or device names (c:\) in the array
- // (so also no leading and trailing slashes - it does not distinguish
- // relative and absolute paths)
- function normalizeArray(parts, allowAboveRoot) {
- // if the path tries to go above the root, `up` ends up > 0
- var up = 0;
- for (var i = parts.length - 1; i >= 0; i--) {
- var last = parts[i];
- if (last === '.') {
- parts.splice(i, 1);
- } else if (last === '..') {
- parts.splice(i, 1);
- up++;
- } else if (up) {
- parts.splice(i, 1);
- up--;
- }
- } // if the path is allowed to go above the root, restore leading ..s
- if (allowAboveRoot) {
- for (; up--; up) {
- parts.unshift('..');
- }
- }
- return parts;
- } // path.resolve([from ...], to)
- // posix version
- exports.resolve = function () {
- var resolvedPath = '',
- resolvedAbsolute = false;
- for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
- var path = i >= 0 ? arguments[i] : process.cwd(); // Skip empty and invalid entries
- if (typeof path !== 'string') {
- throw new TypeError('Arguments to path.resolve must be strings');
- } else if (!path) {
- continue;
- }
- resolvedPath = path + '/' + resolvedPath;
- resolvedAbsolute = path.charAt(0) === '/';
- } // At this point the path should be resolved to a full absolute path, but
- // handle relative paths to be safe (might happen when process.cwd() fails)
- // Normalize the path
- resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function (p) {
- return !!p;
- }), !resolvedAbsolute).join('/');
- return (resolvedAbsolute ? '/' : '') + resolvedPath || '.';
- }; // path.normalize(path)
- // posix version
- exports.normalize = function (path) {
- var isAbsolute = exports.isAbsolute(path),
- trailingSlash = substr(path, -1) === '/'; // Normalize the path
- path = normalizeArray(filter(path.split('/'), function (p) {
- return !!p;
- }), !isAbsolute).join('/');
- if (!path && !isAbsolute) {
- path = '.';
- }
- if (path && trailingSlash) {
- path += '/';
- }
- return (isAbsolute ? '/' : '') + path;
- }; // posix version
- exports.isAbsolute = function (path) {
- return path.charAt(0) === '/';
- }; // posix version
- exports.join = function () {
- var paths = Array.prototype.slice.call(arguments, 0);
- return exports.normalize(filter(paths, function (p, index) {
- if (typeof p !== 'string') {
- throw new TypeError('Arguments to path.join must be strings');
- }
- return p;
- }).join('/'));
- }; // path.relative(from, to)
- // posix version
- exports.relative = function (from, to) {
- from = exports.resolve(from).substr(1);
- to = exports.resolve(to).substr(1);
- function trim(arr) {
- var start = 0;
- for (; start < arr.length; start++) {
- if (arr[start] !== '') break;
- }
- var end = arr.length - 1;
- for (; end >= 0; end--) {
- if (arr[end] !== '') break;
- }
- if (start > end) return [];
- return arr.slice(start, end - start + 1);
- }
- var fromParts = trim(from.split('/'));
- var toParts = trim(to.split('/'));
- var length = Math.min(fromParts.length, toParts.length);
- var samePartsLength = length;
- for (var i = 0; i < length; i++) {
- if (fromParts[i] !== toParts[i]) {
- samePartsLength = i;
- break;
- }
- }
- var outputParts = [];
- for (var i = samePartsLength; i < fromParts.length; i++) {
- outputParts.push('..');
- }
- outputParts = outputParts.concat(toParts.slice(samePartsLength));
- return outputParts.join('/');
- };
- exports.sep = '/';
- exports.delimiter = ':';
- exports.dirname = function (path) {
- if (typeof path !== 'string') path = path + '';
- if (path.length === 0) return '.';
- var code = path.charCodeAt(0);
- var hasRoot = code === 47
- /*/*/
- ;
- var end = -1;
- var matchedSlash = true;
- for (var i = path.length - 1; i >= 1; --i) {
- code = path.charCodeAt(i);
- if (code === 47
- /*/*/
- ) {
- if (!matchedSlash) {
- end = i;
- break;
- }
- } else {
- // We saw the first non-path separator
- matchedSlash = false;
- }
- }
- if (end === -1) return hasRoot ? '/' : '.';
- if (hasRoot && end === 1) {
- // return '//';
- // Backwards-compat fix:
- return '/';
- }
- return path.slice(0, end);
- };
- function basename(path) {
- if (typeof path !== 'string') path = path + '';
- var start = 0;
- var end = -1;
- var matchedSlash = true;
- var i;
- for (i = path.length - 1; i >= 0; --i) {
- if (path.charCodeAt(i) === 47
- /*/*/
- ) {
- // If we reached a path separator that was not part of a set of path
- // separators at the end of the string, stop now
- if (!matchedSlash) {
- start = i + 1;
- break;
- }
- } else if (end === -1) {
- // We saw the first non-path separator, mark this as the end of our
- // path component
- matchedSlash = false;
- end = i + 1;
- }
- }
- if (end === -1) return '';
- return path.slice(start, end);
- } // Uses a mixed approach for backwards-compatibility, as ext behavior changed
- // in new Node.js versions, so only basename() above is backported here
- exports.basename = function (path, ext) {
- var f = basename(path);
- if (ext && f.substr(-1 * ext.length) === ext) {
- f = f.substr(0, f.length - ext.length);
- }
- return f;
- };
- exports.extname = function (path) {
- if (typeof path !== 'string') path = path + '';
- var startDot = -1;
- var startPart = 0;
- var end = -1;
- var matchedSlash = true; // Track the state of characters (if any) we see before our first dot and
- // after any path separator we find
- var preDotState = 0;
- for (var i = path.length - 1; i >= 0; --i) {
- var code = path.charCodeAt(i);
- if (code === 47
- /*/*/
- ) {
- // If we reached a path separator that was not part of a set of path
- // separators at the end of the string, stop now
- if (!matchedSlash) {
- startPart = i + 1;
- break;
- }
- continue;
- }
- if (end === -1) {
- // We saw the first non-path separator, mark this as the end of our
- // extension
- matchedSlash = false;
- end = i + 1;
- }
- if (code === 46
- /*.*/
- ) {
- // If this is our first dot, mark it as the start of our extension
- if (startDot === -1) startDot = i;else if (preDotState !== 1) preDotState = 1;
- } else if (startDot !== -1) {
- // We saw a non-dot and non-path separator before our dot, so we should
- // have a good chance at having a non-empty extension
- preDotState = -1;
- }
- }
- if (startDot === -1 || end === -1 || // We saw a non-dot character immediately before the dot
- preDotState === 0 || // The (right-most) trimmed path component is exactly '..'
- preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
- return '';
- }
- return path.slice(startDot, end);
- };
- function filter(xs, f) {
- if (xs.filter) return xs.filter(f);
- var res = [];
- for (var i = 0; i < xs.length; i++) {
- if (f(xs[i], i, xs)) res.push(xs[i]);
- }
- return res;
- } // String.prototype.substr - negative index don't work in IE8
- var substr = 'ab'.substr(-1) === 'b' ? function (str, start, len) {
- return str.substr(start, len);
- } : function (str, start, len) {
- if (start < 0) start = str.length + start;
- return str.substr(start, len);
- };
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../process/browser.js */ "./node_modules/process/browser.js")))
- /***/ }),
- /***/ "./node_modules/posix-character-classes/index.js":
- /*!*******************************************************!*\
- !*** ./node_modules/posix-character-classes/index.js ***!
- \*******************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /**
- * POSIX character classes
- */
- module.exports = {
- alnum: 'a-zA-Z0-9',
- alpha: 'a-zA-Z',
- ascii: '\\x00-\\x7F',
- blank: ' \\t',
- cntrl: '\\x00-\\x1F\\x7F',
- digit: '0-9',
- graph: '\\x21-\\x7E',
- lower: 'a-z',
- print: '\\x20-\\x7E ',
- punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
- space: ' \\t\\r\\n\\v\\f',
- upper: 'A-Z',
- word: 'A-Za-z0-9_',
- xdigit: 'A-Fa-f0-9'
- };
- /***/ }),
- /***/ "./node_modules/process/browser.js":
- /*!*****************************************!*\
- !*** ./node_modules/process/browser.js ***!
- \*****************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- // shim for using process in browser
- var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it
- // don't break things. But we need to wrap it in a try catch in case it is
- // wrapped in strict mode code which doesn't define any globals. It's inside a
- // function because try/catches deoptimize in certain engines.
- var cachedSetTimeout;
- var cachedClearTimeout;
- function defaultSetTimout() {
- throw new Error('setTimeout has not been defined');
- }
- function defaultClearTimeout() {
- throw new Error('clearTimeout has not been defined');
- }
- (function () {
- try {
- if (typeof setTimeout === 'function') {
- cachedSetTimeout = setTimeout;
- } else {
- cachedSetTimeout = defaultSetTimout;
- }
- } catch (e) {
- cachedSetTimeout = defaultSetTimout;
- }
- try {
- if (typeof clearTimeout === 'function') {
- cachedClearTimeout = clearTimeout;
- } else {
- cachedClearTimeout = defaultClearTimeout;
- }
- } catch (e) {
- cachedClearTimeout = defaultClearTimeout;
- }
- })();
- function runTimeout(fun) {
- if (cachedSetTimeout === setTimeout) {
- //normal enviroments in sane situations
- return setTimeout(fun, 0);
- } // if setTimeout wasn't available but was latter defined
- if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
- cachedSetTimeout = setTimeout;
- return setTimeout(fun, 0);
- }
- try {
- // when when somebody has screwed with setTimeout but no I.E. maddness
- return cachedSetTimeout(fun, 0);
- } catch (e) {
- try {
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
- return cachedSetTimeout.call(null, fun, 0);
- } catch (e) {
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
- return cachedSetTimeout.call(this, fun, 0);
- }
- }
- }
- function runClearTimeout(marker) {
- if (cachedClearTimeout === clearTimeout) {
- //normal enviroments in sane situations
- return clearTimeout(marker);
- } // if clearTimeout wasn't available but was latter defined
- if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
- cachedClearTimeout = clearTimeout;
- return clearTimeout(marker);
- }
- try {
- // when when somebody has screwed with setTimeout but no I.E. maddness
- return cachedClearTimeout(marker);
- } catch (e) {
- try {
- // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
- return cachedClearTimeout.call(null, marker);
- } catch (e) {
- // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
- // Some versions of I.E. have different rules for clearTimeout vs setTimeout
- return cachedClearTimeout.call(this, marker);
- }
- }
- }
- var queue = [];
- var draining = false;
- var currentQueue;
- var queueIndex = -1;
- function cleanUpNextTick() {
- if (!draining || !currentQueue) {
- return;
- }
- draining = false;
- if (currentQueue.length) {
- queue = currentQueue.concat(queue);
- } else {
- queueIndex = -1;
- }
- if (queue.length) {
- drainQueue();
- }
- }
- function drainQueue() {
- if (draining) {
- return;
- }
- var timeout = runTimeout(cleanUpNextTick);
- draining = true;
- var len = queue.length;
- while (len) {
- currentQueue = queue;
- queue = [];
- while (++queueIndex < len) {
- if (currentQueue) {
- currentQueue[queueIndex].run();
- }
- }
- queueIndex = -1;
- len = queue.length;
- }
- currentQueue = null;
- draining = false;
- runClearTimeout(timeout);
- }
- process.nextTick = function (fun) {
- var args = new Array(arguments.length - 1);
- if (arguments.length > 1) {
- for (var i = 1; i < arguments.length; i++) {
- args[i - 1] = arguments[i];
- }
- }
- queue.push(new Item(fun, args));
- if (queue.length === 1 && !draining) {
- runTimeout(drainQueue);
- }
- }; // v8 likes predictible objects
- function Item(fun, array) {
- this.fun = fun;
- this.array = array;
- }
- Item.prototype.run = function () {
- this.fun.apply(null, this.array);
- };
- process.title = 'browser';
- process.browser = true;
- process.env = {};
- process.argv = [];
- process.version = ''; // empty string to avoid regexp issues
- process.versions = {};
- function noop() {}
- process.on = noop;
- process.addListener = noop;
- process.once = noop;
- process.off = noop;
- process.removeListener = noop;
- process.removeAllListeners = noop;
- process.emit = noop;
- process.prependListener = noop;
- process.prependOnceListener = noop;
- process.listeners = function (name) {
- return [];
- };
- process.binding = function (name) {
- throw new Error('process.binding is not supported');
- };
- process.cwd = function () {
- return '/';
- };
- process.chdir = function (dir) {
- throw new Error('process.chdir is not supported');
- };
- process.umask = function () {
- return 0;
- };
- /***/ }),
- /***/ "./node_modules/react-is/cjs/react-is.development.js":
- /*!***********************************************************!*\
- !*** ./node_modules/react-is/cjs/react-is.development.js ***!
- \***********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /** @license React v16.8.6
- * react-is.development.js
- *
- * Copyright (c) Facebook, Inc. and its affiliates.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- if (true) {
- (function () {
- 'use strict';
- Object.defineProperty(exports, '__esModule', {
- value: true
- }); // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
- // nor polyfill, then a plain number is used for performance.
- var hasSymbol = typeof Symbol === 'function' && Symbol.for;
- var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
- var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
- var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
- var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
- var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
- var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
- var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
- var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
- var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
- var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
- var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
- var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
- var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
- function isValidElementType(type) {
- return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
- type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || _typeof(type) === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE);
- }
- /**
- * Forked from fbjs/warning:
- * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
- *
- * Only change is we use console.warn instead of console.error,
- * and do nothing when 'console' is not supported.
- * This really simplifies the code.
- * ---
- * Similar to invariant but only logs a warning if the condition is not met.
- * This can be used to log issues in development environments in critical
- * paths. Removing the logging code for production environments will keep the
- * same logic and follow the same code paths.
- */
- var lowPriorityWarning = function lowPriorityWarning() {};
- {
- var printWarning = function printWarning(format) {
- for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- args[_key - 1] = arguments[_key];
- }
- var argIndex = 0;
- var message = 'Warning: ' + format.replace(/%s/g, function () {
- return args[argIndex++];
- });
- if (typeof console !== 'undefined') {
- console.warn(message);
- }
- try {
- // --- Welcome to debugging React ---
- // This error was thrown as a convenience so that you can use this stack
- // to find the callsite that caused this warning to fire.
- throw new Error(message);
- } catch (x) {}
- };
- lowPriorityWarning = function lowPriorityWarning(condition, format) {
- if (format === undefined) {
- throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
- }
- if (!condition) {
- for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
- args[_key2 - 2] = arguments[_key2];
- }
- printWarning.apply(undefined, [format].concat(args));
- }
- };
- }
- var lowPriorityWarning$1 = lowPriorityWarning;
- function typeOf(object) {
- if (_typeof(object) === 'object' && object !== null) {
- var $$typeof = object.$$typeof;
- switch ($$typeof) {
- case REACT_ELEMENT_TYPE:
- var type = object.type;
- switch (type) {
- case REACT_ASYNC_MODE_TYPE:
- case REACT_CONCURRENT_MODE_TYPE:
- case REACT_FRAGMENT_TYPE:
- case REACT_PROFILER_TYPE:
- case REACT_STRICT_MODE_TYPE:
- case REACT_SUSPENSE_TYPE:
- return type;
- default:
- var $$typeofType = type && type.$$typeof;
- switch ($$typeofType) {
- case REACT_CONTEXT_TYPE:
- case REACT_FORWARD_REF_TYPE:
- case REACT_PROVIDER_TYPE:
- return $$typeofType;
- default:
- return $$typeof;
- }
- }
- case REACT_LAZY_TYPE:
- case REACT_MEMO_TYPE:
- case REACT_PORTAL_TYPE:
- return $$typeof;
- }
- }
- return undefined;
- } // AsyncMode is deprecated along with isAsyncMode
- var AsyncMode = REACT_ASYNC_MODE_TYPE;
- var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
- var ContextConsumer = REACT_CONTEXT_TYPE;
- var ContextProvider = REACT_PROVIDER_TYPE;
- var Element = REACT_ELEMENT_TYPE;
- var ForwardRef = REACT_FORWARD_REF_TYPE;
- var Fragment = REACT_FRAGMENT_TYPE;
- var Lazy = REACT_LAZY_TYPE;
- var Memo = REACT_MEMO_TYPE;
- var Portal = REACT_PORTAL_TYPE;
- var Profiler = REACT_PROFILER_TYPE;
- var StrictMode = REACT_STRICT_MODE_TYPE;
- var Suspense = REACT_SUSPENSE_TYPE;
- var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated
- function isAsyncMode(object) {
- {
- if (!hasWarnedAboutDeprecatedIsAsyncMode) {
- hasWarnedAboutDeprecatedIsAsyncMode = true;
- lowPriorityWarning$1(false, 'The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
- }
- }
- return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
- }
- function isConcurrentMode(object) {
- return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
- }
- function isContextConsumer(object) {
- return typeOf(object) === REACT_CONTEXT_TYPE;
- }
- function isContextProvider(object) {
- return typeOf(object) === REACT_PROVIDER_TYPE;
- }
- function isElement(object) {
- return _typeof(object) === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
- }
- function isForwardRef(object) {
- return typeOf(object) === REACT_FORWARD_REF_TYPE;
- }
- function isFragment(object) {
- return typeOf(object) === REACT_FRAGMENT_TYPE;
- }
- function isLazy(object) {
- return typeOf(object) === REACT_LAZY_TYPE;
- }
- function isMemo(object) {
- return typeOf(object) === REACT_MEMO_TYPE;
- }
- function isPortal(object) {
- return typeOf(object) === REACT_PORTAL_TYPE;
- }
- function isProfiler(object) {
- return typeOf(object) === REACT_PROFILER_TYPE;
- }
- function isStrictMode(object) {
- return typeOf(object) === REACT_STRICT_MODE_TYPE;
- }
- function isSuspense(object) {
- return typeOf(object) === REACT_SUSPENSE_TYPE;
- }
- exports.typeOf = typeOf;
- exports.AsyncMode = AsyncMode;
- exports.ConcurrentMode = ConcurrentMode;
- exports.ContextConsumer = ContextConsumer;
- exports.ContextProvider = ContextProvider;
- exports.Element = Element;
- exports.ForwardRef = ForwardRef;
- exports.Fragment = Fragment;
- exports.Lazy = Lazy;
- exports.Memo = Memo;
- exports.Portal = Portal;
- exports.Profiler = Profiler;
- exports.StrictMode = StrictMode;
- exports.Suspense = Suspense;
- exports.isValidElementType = isValidElementType;
- exports.isAsyncMode = isAsyncMode;
- exports.isConcurrentMode = isConcurrentMode;
- exports.isContextConsumer = isContextConsumer;
- exports.isContextProvider = isContextProvider;
- exports.isElement = isElement;
- exports.isForwardRef = isForwardRef;
- exports.isFragment = isFragment;
- exports.isLazy = isLazy;
- exports.isMemo = isMemo;
- exports.isPortal = isPortal;
- exports.isProfiler = isProfiler;
- exports.isStrictMode = isStrictMode;
- exports.isSuspense = isSuspense;
- })();
- }
- /***/ }),
- /***/ "./node_modules/react-is/index.js":
- /*!****************************************!*\
- !*** ./node_modules/react-is/index.js ***!
- \****************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- if (false) {} else {
- module.exports = __webpack_require__(/*! ./cjs/react-is.development.js */ "./node_modules/react-is/cjs/react-is.development.js");
- }
- /***/ }),
- /***/ "./node_modules/regex-not/index.js":
- /*!*****************************************!*\
- !*** ./node_modules/regex-not/index.js ***!
- \*****************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var extend = __webpack_require__(/*! extend-shallow */ "./node_modules/regex-not/node_modules/extend-shallow/index.js");
- var safe = __webpack_require__(/*! safe-regex */ "./node_modules/safe-regex/index.js");
- /**
- * The main export is a function that takes a `pattern` string and an `options` object.
- *
- * ```js
- & var not = require('regex-not');
- & console.log(not('foo'));
- & //=> /^(?:(?!^(?:foo)$).)*$/
- * ```
- *
- * @param {String} `pattern`
- * @param {Object} `options`
- * @return {RegExp} Converts the given `pattern` to a regex using the specified `options`.
- * @api public
- */
- function toRegex(pattern, options) {
- return new RegExp(toRegex.create(pattern, options));
- }
- /**
- * Create a regex-compatible string from the given `pattern` and `options`.
- *
- * ```js
- & var not = require('regex-not');
- & console.log(not.create('foo'));
- & //=> '^(?:(?!^(?:foo)$).)*$'
- * ```
- * @param {String} `pattern`
- * @param {Object} `options`
- * @return {String}
- * @api public
- */
- toRegex.create = function (pattern, options) {
- if (typeof pattern !== 'string') {
- throw new TypeError('expected a string');
- }
- var opts = extend({}, options);
- if (opts.contains === true) {
- opts.strictNegate = false;
- }
- var open = opts.strictOpen !== false ? '^' : '';
- var close = opts.strictClose !== false ? '$' : '';
- var endChar = opts.endChar ? opts.endChar : '+';
- var str = pattern;
- if (opts.strictNegate === false) {
- str = '(?:(?!(?:' + pattern + ')).)' + endChar;
- } else {
- str = '(?:(?!^(?:' + pattern + ')$).)' + endChar;
- }
- var res = open + str + close;
- if (opts.safe === true && safe(res) === false) {
- throw new Error('potentially unsafe regular expression: ' + res);
- }
- return res;
- };
- /**
- * Expose `toRegex`
- */
- module.exports = toRegex;
- /***/ }),
- /***/ "./node_modules/regex-not/node_modules/extend-shallow/index.js":
- /*!*********************************************************************!*\
- !*** ./node_modules/regex-not/node_modules/extend-shallow/index.js ***!
- \*********************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- var isExtendable = __webpack_require__(/*! is-extendable */ "./node_modules/regex-not/node_modules/is-extendable/index.js");
- var assignSymbols = __webpack_require__(/*! assign-symbols */ "./node_modules/assign-symbols/index.js");
- module.exports = Object.assign || function (obj
- /*, objects*/
- ) {
- if (obj === null || typeof obj === 'undefined') {
- throw new TypeError('Cannot convert undefined or null to object');
- }
- if (!isObject(obj)) {
- obj = {};
- }
- for (var i = 1; i < arguments.length; i++) {
- var val = arguments[i];
- if (isString(val)) {
- val = toObject(val);
- }
- if (isObject(val)) {
- assign(obj, val);
- assignSymbols(obj, val);
- }
- }
- return obj;
- };
- function assign(a, b) {
- for (var key in b) {
- if (hasOwn(b, key)) {
- a[key] = b[key];
- }
- }
- }
- function isString(val) {
- return val && typeof val === 'string';
- }
- function toObject(str) {
- var obj = {};
- for (var i in str) {
- obj[i] = str[i];
- }
- return obj;
- }
- function isObject(val) {
- return val && _typeof(val) === 'object' || isExtendable(val);
- }
- /**
- * Returns true if the given `key` is an own property of `obj`.
- */
- function hasOwn(obj, key) {
- return Object.prototype.hasOwnProperty.call(obj, key);
- }
- function isEnum(obj, key) {
- return Object.prototype.propertyIsEnumerable.call(obj, key);
- }
- /***/ }),
- /***/ "./node_modules/regex-not/node_modules/is-extendable/index.js":
- /*!********************************************************************!*\
- !*** ./node_modules/regex-not/node_modules/is-extendable/index.js ***!
- \********************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * is-extendable <https://github.com/jonschlinkert/is-extendable>
- *
- * Copyright (c) 2015-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- var isPlainObject = __webpack_require__(/*! is-plain-object */ "./node_modules/is-plain-object/index.js");
- module.exports = function isExtendable(val) {
- return isPlainObject(val) || typeof val === 'function' || Array.isArray(val);
- };
- /***/ }),
- /***/ "./node_modules/repeat-element/index.js":
- /*!**********************************************!*\
- !*** ./node_modules/repeat-element/index.js ***!
- \**********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * repeat-element <https://github.com/jonschlinkert/repeat-element>
- *
- * Copyright (c) 2015-present, Jon Schlinkert.
- * Licensed under the MIT license.
- */
- module.exports = function repeat(ele, num) {
- var arr = new Array(num);
- for (var i = 0; i < num; i++) {
- arr[i] = ele;
- }
- return arr;
- };
- /***/ }),
- /***/ "./node_modules/repeat-string/index.js":
- /*!*********************************************!*\
- !*** ./node_modules/repeat-string/index.js ***!
- \*********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * repeat-string <https://github.com/jonschlinkert/repeat-string>
- *
- * Copyright (c) 2014-2015, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- /**
- * Results cache
- */
- var res = '';
- var cache;
- /**
- * Expose `repeat`
- */
- module.exports = repeat;
- /**
- * Repeat the given `string` the specified `number`
- * of times.
- *
- * **Example:**
- *
- * ```js
- * var repeat = require('repeat-string');
- * repeat('A', 5);
- * //=> AAAAA
- * ```
- *
- * @param {String} `string` The string to repeat
- * @param {Number} `number` The number of times to repeat the string
- * @return {String} Repeated string
- * @api public
- */
- function repeat(str, num) {
- if (typeof str !== 'string') {
- throw new TypeError('expected a string');
- } // cover common, quick use cases
- if (num === 1) return str;
- if (num === 2) return str + str;
- var max = str.length * num;
- if (cache !== str || typeof cache === 'undefined') {
- cache = str;
- res = '';
- } else if (res.length >= max) {
- return res.substr(0, max);
- }
- while (max > res.length && num > 1) {
- if (num & 1) {
- res += str;
- }
- num >>= 1;
- str += str;
- }
- res += str;
- res = res.substr(0, max);
- return res;
- }
- /***/ }),
- /***/ "./node_modules/resolve-url/resolve-url.js":
- /*!*************************************************!*\
- !*** ./node_modules/resolve-url/resolve-url.js ***!
- \*************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- // Copyright 2014 Simon Lydell
- // X11 (“MIT”) Licensed. (See LICENSE.)
- void function (root, factory) {
- if (true) {
- !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
- __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
- (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
- __WEBPACK_AMD_DEFINE_FACTORY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- } else {}
- }(void 0, function () {
- function resolveUrl()
- /* ...urls */
- {
- var numUrls = arguments.length;
- if (numUrls === 0) {
- throw new Error("resolveUrl requires at least one argument; got none.");
- }
- var base = document.createElement("base");
- base.href = arguments[0];
- if (numUrls === 1) {
- return base.href;
- }
- var head = document.getElementsByTagName("head")[0];
- head.insertBefore(base, head.firstChild);
- var a = document.createElement("a");
- var resolved;
- for (var index = 1; index < numUrls; index++) {
- a.href = arguments[index];
- resolved = a.href;
- base.href = resolved;
- }
- head.removeChild(base);
- return resolved;
- }
- return resolveUrl;
- });
- /***/ }),
- /***/ "./node_modules/ret/lib/index.js":
- /*!***************************************!*\
- !*** ./node_modules/ret/lib/index.js ***!
- \***************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var util = __webpack_require__(/*! ./util */ "./node_modules/ret/lib/util.js");
- var types = __webpack_require__(/*! ./types */ "./node_modules/ret/lib/types.js");
- var sets = __webpack_require__(/*! ./sets */ "./node_modules/ret/lib/sets.js");
- var positions = __webpack_require__(/*! ./positions */ "./node_modules/ret/lib/positions.js");
- module.exports = function (regexpStr) {
- var i = 0,
- l,
- c,
- start = {
- type: types.ROOT,
- stack: []
- },
- // Keep track of last clause/group and stack.
- lastGroup = start,
- last = start.stack,
- groupStack = [];
- var repeatErr = function repeatErr(i) {
- util.error(regexpStr, 'Nothing to repeat at column ' + (i - 1));
- }; // Decode a few escaped characters.
- var str = util.strToChars(regexpStr);
- l = str.length; // Iterate through each character in string.
- while (i < l) {
- c = str[i++];
- switch (c) {
- // Handle escaped characters, inclues a few sets.
- case '\\':
- c = str[i++];
- switch (c) {
- case 'b':
- last.push(positions.wordBoundary());
- break;
- case 'B':
- last.push(positions.nonWordBoundary());
- break;
- case 'w':
- last.push(sets.words());
- break;
- case 'W':
- last.push(sets.notWords());
- break;
- case 'd':
- last.push(sets.ints());
- break;
- case 'D':
- last.push(sets.notInts());
- break;
- case 's':
- last.push(sets.whitespace());
- break;
- case 'S':
- last.push(sets.notWhitespace());
- break;
- default:
- // Check if c is integer.
- // In which case it's a reference.
- if (/\d/.test(c)) {
- last.push({
- type: types.REFERENCE,
- value: parseInt(c, 10)
- }); // Escaped character.
- } else {
- last.push({
- type: types.CHAR,
- value: c.charCodeAt(0)
- });
- }
- }
- break;
- // Positionals.
- case '^':
- last.push(positions.begin());
- break;
- case '$':
- last.push(positions.end());
- break;
- // Handle custom sets.
- case '[':
- // Check if this class is 'anti' i.e. [^abc].
- var not;
- if (str[i] === '^') {
- not = true;
- i++;
- } else {
- not = false;
- } // Get all the characters in class.
- var classTokens = util.tokenizeClass(str.slice(i), regexpStr); // Increase index by length of class.
- i += classTokens[1];
- last.push({
- type: types.SET,
- set: classTokens[0],
- not: not
- });
- break;
- // Class of any character except \n.
- case '.':
- last.push(sets.anyChar());
- break;
- // Push group onto stack.
- case '(':
- // Create group.
- var group = {
- type: types.GROUP,
- stack: [],
- remember: true
- };
- c = str[i]; // If if this is a special kind of group.
- if (c === '?') {
- c = str[i + 1];
- i += 2; // Match if followed by.
- if (c === '=') {
- group.followedBy = true; // Match if not followed by.
- } else if (c === '!') {
- group.notFollowedBy = true;
- } else if (c !== ':') {
- util.error(regexpStr, 'Invalid group, character \'' + c + '\' after \'?\' at column ' + (i - 1));
- }
- group.remember = false;
- } // Insert subgroup into current group stack.
- last.push(group); // Remember the current group for when the group closes.
- groupStack.push(lastGroup); // Make this new group the current group.
- lastGroup = group;
- last = group.stack;
- break;
- // Pop group out of stack.
- case ')':
- if (groupStack.length === 0) {
- util.error(regexpStr, 'Unmatched ) at column ' + (i - 1));
- }
- lastGroup = groupStack.pop(); // Check if this group has a PIPE.
- // To get back the correct last stack.
- last = lastGroup.options ? lastGroup.options[lastGroup.options.length - 1] : lastGroup.stack;
- break;
- // Use pipe character to give more choices.
- case '|':
- // Create array where options are if this is the first PIPE
- // in this clause.
- if (!lastGroup.options) {
- lastGroup.options = [lastGroup.stack];
- delete lastGroup.stack;
- } // Create a new stack and add to options for rest of clause.
- var stack = [];
- lastGroup.options.push(stack);
- last = stack;
- break;
- // Repetition.
- // For every repetition, remove last element from last stack
- // then insert back a RANGE object.
- // This design is chosen because there could be more than
- // one repetition symbols in a regex i.e. `a?+{2,3}`.
- case '{':
- var rs = /^(\d+)(,(\d+)?)?\}/.exec(str.slice(i)),
- min,
- max;
- if (rs !== null) {
- if (last.length === 0) {
- repeatErr(i);
- }
- min = parseInt(rs[1], 10);
- max = rs[2] ? rs[3] ? parseInt(rs[3], 10) : Infinity : min;
- i += rs[0].length;
- last.push({
- type: types.REPETITION,
- min: min,
- max: max,
- value: last.pop()
- });
- } else {
- last.push({
- type: types.CHAR,
- value: 123
- });
- }
- break;
- case '?':
- if (last.length === 0) {
- repeatErr(i);
- }
- last.push({
- type: types.REPETITION,
- min: 0,
- max: 1,
- value: last.pop()
- });
- break;
- case '+':
- if (last.length === 0) {
- repeatErr(i);
- }
- last.push({
- type: types.REPETITION,
- min: 1,
- max: Infinity,
- value: last.pop()
- });
- break;
- case '*':
- if (last.length === 0) {
- repeatErr(i);
- }
- last.push({
- type: types.REPETITION,
- min: 0,
- max: Infinity,
- value: last.pop()
- });
- break;
- // Default is a character that is not `\[](){}?+*^$`.
- default:
- last.push({
- type: types.CHAR,
- value: c.charCodeAt(0)
- });
- }
- } // Check if any groups have not been closed.
- if (groupStack.length !== 0) {
- util.error(regexpStr, 'Unterminated group');
- }
- return start;
- };
- module.exports.types = types;
- /***/ }),
- /***/ "./node_modules/ret/lib/positions.js":
- /*!*******************************************!*\
- !*** ./node_modules/ret/lib/positions.js ***!
- \*******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var types = __webpack_require__(/*! ./types */ "./node_modules/ret/lib/types.js");
- exports.wordBoundary = function () {
- return {
- type: types.POSITION,
- value: 'b'
- };
- };
- exports.nonWordBoundary = function () {
- return {
- type: types.POSITION,
- value: 'B'
- };
- };
- exports.begin = function () {
- return {
- type: types.POSITION,
- value: '^'
- };
- };
- exports.end = function () {
- return {
- type: types.POSITION,
- value: '$'
- };
- };
- /***/ }),
- /***/ "./node_modules/ret/lib/sets.js":
- /*!**************************************!*\
- !*** ./node_modules/ret/lib/sets.js ***!
- \**************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var types = __webpack_require__(/*! ./types */ "./node_modules/ret/lib/types.js");
- var INTS = function INTS() {
- return [{
- type: types.RANGE,
- from: 48,
- to: 57
- }];
- };
- var WORDS = function WORDS() {
- return [{
- type: types.CHAR,
- value: 95
- }, {
- type: types.RANGE,
- from: 97,
- to: 122
- }, {
- type: types.RANGE,
- from: 65,
- to: 90
- }].concat(INTS());
- };
- var WHITESPACE = function WHITESPACE() {
- return [{
- type: types.CHAR,
- value: 9
- }, {
- type: types.CHAR,
- value: 10
- }, {
- type: types.CHAR,
- value: 11
- }, {
- type: types.CHAR,
- value: 12
- }, {
- type: types.CHAR,
- value: 13
- }, {
- type: types.CHAR,
- value: 32
- }, {
- type: types.CHAR,
- value: 160
- }, {
- type: types.CHAR,
- value: 5760
- }, {
- type: types.CHAR,
- value: 6158
- }, {
- type: types.CHAR,
- value: 8192
- }, {
- type: types.CHAR,
- value: 8193
- }, {
- type: types.CHAR,
- value: 8194
- }, {
- type: types.CHAR,
- value: 8195
- }, {
- type: types.CHAR,
- value: 8196
- }, {
- type: types.CHAR,
- value: 8197
- }, {
- type: types.CHAR,
- value: 8198
- }, {
- type: types.CHAR,
- value: 8199
- }, {
- type: types.CHAR,
- value: 8200
- }, {
- type: types.CHAR,
- value: 8201
- }, {
- type: types.CHAR,
- value: 8202
- }, {
- type: types.CHAR,
- value: 8232
- }, {
- type: types.CHAR,
- value: 8233
- }, {
- type: types.CHAR,
- value: 8239
- }, {
- type: types.CHAR,
- value: 8287
- }, {
- type: types.CHAR,
- value: 12288
- }, {
- type: types.CHAR,
- value: 65279
- }];
- };
- var NOTANYCHAR = function NOTANYCHAR() {
- return [{
- type: types.CHAR,
- value: 10
- }, {
- type: types.CHAR,
- value: 13
- }, {
- type: types.CHAR,
- value: 8232
- }, {
- type: types.CHAR,
- value: 8233
- }];
- }; // Predefined class objects.
- exports.words = function () {
- return {
- type: types.SET,
- set: WORDS(),
- not: false
- };
- };
- exports.notWords = function () {
- return {
- type: types.SET,
- set: WORDS(),
- not: true
- };
- };
- exports.ints = function () {
- return {
- type: types.SET,
- set: INTS(),
- not: false
- };
- };
- exports.notInts = function () {
- return {
- type: types.SET,
- set: INTS(),
- not: true
- };
- };
- exports.whitespace = function () {
- return {
- type: types.SET,
- set: WHITESPACE(),
- not: false
- };
- };
- exports.notWhitespace = function () {
- return {
- type: types.SET,
- set: WHITESPACE(),
- not: true
- };
- };
- exports.anyChar = function () {
- return {
- type: types.SET,
- set: NOTANYCHAR(),
- not: true
- };
- };
- /***/ }),
- /***/ "./node_modules/ret/lib/types.js":
- /*!***************************************!*\
- !*** ./node_modules/ret/lib/types.js ***!
- \***************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- module.exports = {
- ROOT: 0,
- GROUP: 1,
- POSITION: 2,
- SET: 3,
- RANGE: 4,
- REPETITION: 5,
- REFERENCE: 6,
- CHAR: 7
- };
- /***/ }),
- /***/ "./node_modules/ret/lib/util.js":
- /*!**************************************!*\
- !*** ./node_modules/ret/lib/util.js ***!
- \**************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var types = __webpack_require__(/*! ./types */ "./node_modules/ret/lib/types.js");
- var sets = __webpack_require__(/*! ./sets */ "./node_modules/ret/lib/sets.js"); // All of these are private and only used by randexp.
- // It's assumed that they will always be called with the correct input.
- var CTRL = '@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?';
- var SLSH = {
- '0': 0,
- 't': 9,
- 'n': 10,
- 'v': 11,
- 'f': 12,
- 'r': 13
- };
- /**
- * Finds character representations in str and convert all to
- * their respective characters
- *
- * @param {String} str
- * @return {String}
- */
- exports.strToChars = function (str) {
- /* jshint maxlen: false */
- var chars_regex = /(\[\\b\])|(\\)?\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|(0?[0-7]{2})|c([@A-Z\[\\\]\^?])|([0tnvfr]))/g;
- str = str.replace(chars_regex, function (s, b, lbs, a16, b16, c8, dctrl, eslsh) {
- if (lbs) {
- return s;
- }
- var code = b ? 8 : a16 ? parseInt(a16, 16) : b16 ? parseInt(b16, 16) : c8 ? parseInt(c8, 8) : dctrl ? CTRL.indexOf(dctrl) : SLSH[eslsh];
- var c = String.fromCharCode(code); // Escape special regex characters.
- if (/[\[\]{}\^$.|?*+()]/.test(c)) {
- c = '\\' + c;
- }
- return c;
- });
- return str;
- };
- /**
- * turns class into tokens
- * reads str until it encounters a ] not preceeded by a \
- *
- * @param {String} str
- * @param {String} regexpStr
- * @return {Array.<Array.<Object>, Number>}
- */
- exports.tokenizeClass = function (str, regexpStr) {
- /* jshint maxlen: false */
- var tokens = [];
- var regexp = /\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(?:\\)?([^\]]))|(\])|(?:\\)?(.)/g;
- var rs, c;
- while ((rs = regexp.exec(str)) != null) {
- if (rs[1]) {
- tokens.push(sets.words());
- } else if (rs[2]) {
- tokens.push(sets.ints());
- } else if (rs[3]) {
- tokens.push(sets.whitespace());
- } else if (rs[4]) {
- tokens.push(sets.notWords());
- } else if (rs[5]) {
- tokens.push(sets.notInts());
- } else if (rs[6]) {
- tokens.push(sets.notWhitespace());
- } else if (rs[7]) {
- tokens.push({
- type: types.RANGE,
- from: (rs[8] || rs[9]).charCodeAt(0),
- to: rs[10].charCodeAt(0)
- });
- } else if (c = rs[12]) {
- tokens.push({
- type: types.CHAR,
- value: c.charCodeAt(0)
- });
- } else {
- return [tokens, regexp.lastIndex];
- }
- }
- exports.error(regexpStr, 'Unterminated character class');
- };
- /**
- * Shortcut to throw errors.
- *
- * @param {String} regexp
- * @param {String} msg
- */
- exports.error = function (regexp, msg) {
- throw new SyntaxError('Invalid regular expression: /' + regexp + '/: ' + msg);
- };
- /***/ }),
- /***/ "./node_modules/safe-regex/index.js":
- /*!******************************************!*\
- !*** ./node_modules/safe-regex/index.js ***!
- \******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var parse = __webpack_require__(/*! ret */ "./node_modules/ret/lib/index.js");
- var types = parse.types;
- module.exports = function (re, opts) {
- if (!opts) opts = {};
- var replimit = opts.limit === undefined ? 25 : opts.limit;
- if (isRegExp(re)) re = re.source;else if (typeof re !== 'string') re = String(re);
- try {
- re = parse(re);
- } catch (err) {
- return false;
- }
- var reps = 0;
- return function walk(node, starHeight) {
- if (node.type === types.REPETITION) {
- starHeight++;
- reps++;
- if (starHeight > 1) return false;
- if (reps > replimit) return false;
- }
- if (node.options) {
- for (var i = 0, len = node.options.length; i < len; i++) {
- var ok = walk({
- stack: node.options[i]
- }, starHeight);
- if (!ok) return false;
- }
- }
- var stack = node.stack || node.value && node.value.stack;
- if (!stack) return true;
- for (var i = 0; i < stack.length; i++) {
- var ok = walk(stack[i], starHeight);
- if (!ok) return false;
- }
- return true;
- }(re, 0);
- };
- function isRegExp(x) {
- return {}.toString.call(x) === '[object RegExp]';
- }
- /***/ }),
- /***/ "./node_modules/set-value/index.js":
- /*!*****************************************!*\
- !*** ./node_modules/set-value/index.js ***!
- \*****************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * set-value <https://github.com/jonschlinkert/set-value>
- *
- * Copyright (c) 2014-2015, 2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- var split = __webpack_require__(/*! split-string */ "./node_modules/split-string/index.js");
- var extend = __webpack_require__(/*! extend-shallow */ "./node_modules/extend-shallow/index.js");
- var isPlainObject = __webpack_require__(/*! is-plain-object */ "./node_modules/is-plain-object/index.js");
- var isObject = __webpack_require__(/*! is-extendable */ "./node_modules/is-extendable/index.js");
- module.exports = function (obj, prop, val) {
- if (!isObject(obj)) {
- return obj;
- }
- if (Array.isArray(prop)) {
- prop = [].concat.apply([], prop).join('.');
- }
- if (typeof prop !== 'string') {
- return obj;
- }
- var keys = split(prop, {
- sep: '.',
- brackets: true
- }).filter(isValidKey);
- var len = keys.length;
- var idx = -1;
- var current = obj;
- while (++idx < len) {
- var key = keys[idx];
- if (idx !== len - 1) {
- if (!isObject(current[key])) {
- current[key] = {};
- }
- current = current[key];
- continue;
- }
- if (isPlainObject(current[key]) && isPlainObject(val)) {
- current[key] = extend({}, current[key], val);
- } else {
- current[key] = val;
- }
- }
- return obj;
- };
- function isValidKey(key) {
- return key !== '__proto__' && key !== 'constructor' && key !== 'prototype';
- }
- /***/ }),
- /***/ "./node_modules/setimmediate/setImmediate.js":
- /*!***************************************************!*\
- !*** ./node_modules/setimmediate/setImmediate.js ***!
- \***************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(global, process) {
- (function (global, undefined) {
- "use strict";
- if (global.setImmediate) {
- return;
- }
- var nextHandle = 1; // Spec says greater than zero
- var tasksByHandle = {};
- var currentlyRunningATask = false;
- var doc = global.document;
- var registerImmediate;
- function setImmediate(callback) {
- // Callback can either be a function or a string
- if (typeof callback !== "function") {
- callback = new Function("" + callback);
- } // Copy function arguments
- var args = new Array(arguments.length - 1);
- for (var i = 0; i < args.length; i++) {
- args[i] = arguments[i + 1];
- } // Store and register the task
- var task = {
- callback: callback,
- args: args
- };
- tasksByHandle[nextHandle] = task;
- registerImmediate(nextHandle);
- return nextHandle++;
- }
- function clearImmediate(handle) {
- delete tasksByHandle[handle];
- }
- function run(task) {
- var callback = task.callback;
- var args = task.args;
- switch (args.length) {
- case 0:
- callback();
- break;
- case 1:
- callback(args[0]);
- break;
- case 2:
- callback(args[0], args[1]);
- break;
- case 3:
- callback(args[0], args[1], args[2]);
- break;
- default:
- callback.apply(undefined, args);
- break;
- }
- }
- function runIfPresent(handle) {
- // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
- // So if we're currently running a task, we'll need to delay this invocation.
- if (currentlyRunningATask) {
- // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
- // "too much recursion" error.
- setTimeout(runIfPresent, 0, handle);
- } else {
- var task = tasksByHandle[handle];
- if (task) {
- currentlyRunningATask = true;
- try {
- run(task);
- } finally {
- clearImmediate(handle);
- currentlyRunningATask = false;
- }
- }
- }
- }
- function installNextTickImplementation() {
- registerImmediate = function registerImmediate(handle) {
- process.nextTick(function () {
- runIfPresent(handle);
- });
- };
- }
- function canUsePostMessage() {
- // The test against `importScripts` prevents this implementation from being installed inside a web worker,
- // where `global.postMessage` means something completely different and can't be used for this purpose.
- if (global.postMessage && !global.importScripts) {
- var postMessageIsAsynchronous = true;
- var oldOnMessage = global.onmessage;
- global.onmessage = function () {
- postMessageIsAsynchronous = false;
- };
- global.postMessage("", "*");
- global.onmessage = oldOnMessage;
- return postMessageIsAsynchronous;
- }
- }
- function installPostMessageImplementation() {
- // Installs an event handler on `global` for the `message` event: see
- // * https://developer.mozilla.org/en/DOM/window.postMessage
- // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
- var messagePrefix = "setImmediate$" + Math.random() + "$";
- var onGlobalMessage = function onGlobalMessage(event) {
- if (event.source === global && typeof event.data === "string" && event.data.indexOf(messagePrefix) === 0) {
- runIfPresent(+event.data.slice(messagePrefix.length));
- }
- };
- if (global.addEventListener) {
- global.addEventListener("message", onGlobalMessage, false);
- } else {
- global.attachEvent("onmessage", onGlobalMessage);
- }
- registerImmediate = function registerImmediate(handle) {
- global.postMessage(messagePrefix + handle, "*");
- };
- }
- function installMessageChannelImplementation() {
- var channel = new MessageChannel();
- channel.port1.onmessage = function (event) {
- var handle = event.data;
- runIfPresent(handle);
- };
- registerImmediate = function registerImmediate(handle) {
- channel.port2.postMessage(handle);
- };
- }
- function installReadyStateChangeImplementation() {
- var html = doc.documentElement;
- registerImmediate = function registerImmediate(handle) {
- // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
- // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
- var script = doc.createElement("script");
- script.onreadystatechange = function () {
- runIfPresent(handle);
- script.onreadystatechange = null;
- html.removeChild(script);
- script = null;
- };
- html.appendChild(script);
- };
- }
- function installSetTimeoutImplementation() {
- registerImmediate = function registerImmediate(handle) {
- setTimeout(runIfPresent, 0, handle);
- };
- } // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
- var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
- attachTo = attachTo && attachTo.setTimeout ? attachTo : global; // Don't get fooled by e.g. browserify environments.
- if ({}.toString.call(global.process) === "[object process]") {
- // For Node.js before 0.9
- installNextTickImplementation();
- } else if (canUsePostMessage()) {
- // For non-IE10 modern browsers
- installPostMessageImplementation();
- } else if (global.MessageChannel) {
- // For web workers, where supported
- installMessageChannelImplementation();
- } else if (doc && "onreadystatechange" in doc.createElement("script")) {
- // For IE 6–8
- installReadyStateChangeImplementation();
- } else {
- // For older browsers
- installSetTimeoutImplementation();
- }
- attachTo.setImmediate = setImmediate;
- attachTo.clearImmediate = clearImmediate;
- })(typeof self === "undefined" ? typeof global === "undefined" ? void 0 : global : self);
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"), __webpack_require__(/*! ./../process/browser.js */ "./node_modules/process/browser.js")))
- /***/ }),
- /***/ "./node_modules/slash/index.js":
- /*!*************************************!*\
- !*** ./node_modules/slash/index.js ***!
- \*************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- module.exports = function (input) {
- var isExtendedLengthPath = /^\\\\\?\\/.test(input);
- var hasNonAscii = /[^\u0000-\u0080]+/.test(input); // eslint-disable-line no-control-regex
- if (isExtendedLengthPath || hasNonAscii) {
- return input;
- }
- return input.replace(/\\/g, '/');
- };
- /***/ }),
- /***/ "./node_modules/snapdragon-node/index.js":
- /*!***********************************************!*\
- !*** ./node_modules/snapdragon-node/index.js ***!
- \***********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var isObject = __webpack_require__(/*! isobject */ "./node_modules/isobject/index.js");
- var define = __webpack_require__(/*! define-property */ "./node_modules/snapdragon-node/node_modules/define-property/index.js");
- var utils = __webpack_require__(/*! snapdragon-util */ "./node_modules/snapdragon-util/index.js");
- var ownNames;
- /**
- * Create a new AST `Node` with the given `val` and `type`.
- *
- * ```js
- * var node = new Node('*', 'Star');
- * var node = new Node({type: 'star', val: '*'});
- * ```
- * @name Node
- * @param {String|Object} `val` Pass a matched substring, or an object to merge onto the node.
- * @param {String} `type` The node type to use when `val` is a string.
- * @return {Object} node instance
- * @api public
- */
- function Node(val, type, parent) {
- if (typeof type !== 'string') {
- parent = type;
- type = null;
- }
- define(this, 'parent', parent);
- define(this, 'isNode', true);
- define(this, 'expect', null);
- if (typeof type !== 'string' && isObject(val)) {
- lazyKeys();
- var keys = Object.keys(val);
- for (var i = 0; i < keys.length; i++) {
- var key = keys[i];
- if (ownNames.indexOf(key) === -1) {
- this[key] = val[key];
- }
- }
- } else {
- this.type = type;
- this.val = val;
- }
- }
- /**
- * Returns true if the given value is a node.
- *
- * ```js
- * var Node = require('snapdragon-node');
- * var node = new Node({type: 'foo'});
- * console.log(Node.isNode(node)); //=> true
- * console.log(Node.isNode({})); //=> false
- * ```
- * @param {Object} `node`
- * @returns {Boolean}
- * @api public
- */
- Node.isNode = function (node) {
- return utils.isNode(node);
- };
- /**
- * Define a non-enumberable property on the node instance.
- * Useful for adding properties that shouldn't be extended
- * or visible during debugging.
- *
- * ```js
- * var node = new Node();
- * node.define('foo', 'something non-enumerable');
- * ```
- * @param {String} `name`
- * @param {any} `val`
- * @return {Object} returns the node instance
- * @api public
- */
- Node.prototype.define = function (name, val) {
- define(this, name, val);
- return this;
- };
- /**
- * Returns true if `node.val` is an empty string, or `node.nodes` does
- * not contain any non-empty text nodes.
- *
- * ```js
- * var node = new Node({type: 'text'});
- * node.isEmpty(); //=> true
- * node.val = 'foo';
- * node.isEmpty(); //=> false
- * ```
- * @param {Function} `fn` (optional) Filter function that is called on `node` and/or child nodes. `isEmpty` will return false immediately when the filter function returns false on any nodes.
- * @return {Boolean}
- * @api public
- */
- Node.prototype.isEmpty = function (fn) {
- return utils.isEmpty(this, fn);
- };
- /**
- * Given node `foo` and node `bar`, push node `bar` onto `foo.nodes`, and
- * set `foo` as `bar.parent`.
- *
- * ```js
- * var foo = new Node({type: 'foo'});
- * var bar = new Node({type: 'bar'});
- * foo.push(bar);
- * ```
- * @param {Object} `node`
- * @return {Number} Returns the length of `node.nodes`
- * @api public
- */
- Node.prototype.push = function (node) {
- assert(Node.isNode(node), 'expected node to be an instance of Node');
- define(node, 'parent', this);
- this.nodes = this.nodes || [];
- return this.nodes.push(node);
- };
- /**
- * Given node `foo` and node `bar`, unshift node `bar` onto `foo.nodes`, and
- * set `foo` as `bar.parent`.
- *
- * ```js
- * var foo = new Node({type: 'foo'});
- * var bar = new Node({type: 'bar'});
- * foo.unshift(bar);
- * ```
- * @param {Object} `node`
- * @return {Number} Returns the length of `node.nodes`
- * @api public
- */
- Node.prototype.unshift = function (node) {
- assert(Node.isNode(node), 'expected node to be an instance of Node');
- define(node, 'parent', this);
- this.nodes = this.nodes || [];
- return this.nodes.unshift(node);
- };
- /**
- * Pop a node from `node.nodes`.
- *
- * ```js
- * var node = new Node({type: 'foo'});
- * node.push(new Node({type: 'a'}));
- * node.push(new Node({type: 'b'}));
- * node.push(new Node({type: 'c'}));
- * node.push(new Node({type: 'd'}));
- * console.log(node.nodes.length);
- * //=> 4
- * node.pop();
- * console.log(node.nodes.length);
- * //=> 3
- * ```
- * @return {Number} Returns the popped `node`
- * @api public
- */
- Node.prototype.pop = function () {
- return this.nodes && this.nodes.pop();
- };
- /**
- * Shift a node from `node.nodes`.
- *
- * ```js
- * var node = new Node({type: 'foo'});
- * node.push(new Node({type: 'a'}));
- * node.push(new Node({type: 'b'}));
- * node.push(new Node({type: 'c'}));
- * node.push(new Node({type: 'd'}));
- * console.log(node.nodes.length);
- * //=> 4
- * node.shift();
- * console.log(node.nodes.length);
- * //=> 3
- * ```
- * @return {Object} Returns the shifted `node`
- * @api public
- */
- Node.prototype.shift = function () {
- return this.nodes && this.nodes.shift();
- };
- /**
- * Remove `node` from `node.nodes`.
- *
- * ```js
- * node.remove(childNode);
- * ```
- * @param {Object} `node`
- * @return {Object} Returns the removed node.
- * @api public
- */
- Node.prototype.remove = function (node) {
- assert(Node.isNode(node), 'expected node to be an instance of Node');
- this.nodes = this.nodes || [];
- var idx = node.index;
- if (idx !== -1) {
- node.index = -1;
- return this.nodes.splice(idx, 1);
- }
- return null;
- };
- /**
- * Get the first child node from `node.nodes` that matches the given `type`.
- * If `type` is a number, the child node at that index is returned.
- *
- * ```js
- * var child = node.find(1); //<= index of the node to get
- * var child = node.find('foo'); //<= node.type of a child node
- * var child = node.find(/^(foo|bar)$/); //<= regex to match node.type
- * var child = node.find(['foo', 'bar']); //<= array of node.type(s)
- * ```
- * @param {String} `type`
- * @return {Object} Returns a child node or undefined.
- * @api public
- */
- Node.prototype.find = function (type) {
- return utils.findNode(this.nodes, type);
- };
- /**
- * Return true if the node is the given `type`.
- *
- * ```js
- * var node = new Node({type: 'bar'});
- * cosole.log(node.isType('foo')); // false
- * cosole.log(node.isType(/^(foo|bar)$/)); // true
- * cosole.log(node.isType(['foo', 'bar'])); // true
- * ```
- * @param {String} `type`
- * @return {Boolean}
- * @api public
- */
- Node.prototype.isType = function (type) {
- return utils.isType(this, type);
- };
- /**
- * Return true if the `node.nodes` has the given `type`.
- *
- * ```js
- * var foo = new Node({type: 'foo'});
- * var bar = new Node({type: 'bar'});
- * foo.push(bar);
- *
- * cosole.log(foo.hasType('qux')); // false
- * cosole.log(foo.hasType(/^(qux|bar)$/)); // true
- * cosole.log(foo.hasType(['qux', 'bar'])); // true
- * ```
- * @param {String} `type`
- * @return {Boolean}
- * @api public
- */
- Node.prototype.hasType = function (type) {
- return utils.hasType(this, type);
- };
- /**
- * Get the siblings array, or `null` if it doesn't exist.
- *
- * ```js
- * var foo = new Node({type: 'foo'});
- * var bar = new Node({type: 'bar'});
- * var baz = new Node({type: 'baz'});
- * foo.push(bar);
- * foo.push(baz);
- *
- * console.log(bar.siblings.length) // 2
- * console.log(baz.siblings.length) // 2
- * ```
- * @return {Array}
- * @api public
- */
- Object.defineProperty(Node.prototype, 'siblings', {
- set: function set() {
- throw new Error('node.siblings is a getter and cannot be defined');
- },
- get: function get() {
- return this.parent ? this.parent.nodes : null;
- }
- });
- /**
- * Get the node's current index from `node.parent.nodes`.
- * This should always be correct, even when the parent adds nodes.
- *
- * ```js
- * var foo = new Node({type: 'foo'});
- * var bar = new Node({type: 'bar'});
- * var baz = new Node({type: 'baz'});
- * var qux = new Node({type: 'qux'});
- * foo.push(bar);
- * foo.push(baz);
- * foo.unshift(qux);
- *
- * console.log(bar.index) // 1
- * console.log(baz.index) // 2
- * console.log(qux.index) // 0
- * ```
- * @return {Number}
- * @api public
- */
- Object.defineProperty(Node.prototype, 'index', {
- set: function set(index) {
- define(this, 'idx', index);
- },
- get: function get() {
- if (!Array.isArray(this.siblings)) {
- return -1;
- }
- var tok = this.idx !== -1 ? this.siblings[this.idx] : null;
- if (tok !== this) {
- this.idx = this.siblings.indexOf(this);
- }
- return this.idx;
- }
- });
- /**
- * Get the previous node from the siblings array or `null`.
- *
- * ```js
- * var foo = new Node({type: 'foo'});
- * var bar = new Node({type: 'bar'});
- * var baz = new Node({type: 'baz'});
- * foo.push(bar);
- * foo.push(baz);
- *
- * console.log(baz.prev.type) // 'bar'
- * ```
- * @return {Object}
- * @api public
- */
- Object.defineProperty(Node.prototype, 'prev', {
- set: function set() {
- throw new Error('node.prev is a getter and cannot be defined');
- },
- get: function get() {
- if (Array.isArray(this.siblings)) {
- return this.siblings[this.index - 1] || this.parent.prev;
- }
- return null;
- }
- });
- /**
- * Get the siblings array, or `null` if it doesn't exist.
- *
- * ```js
- * var foo = new Node({type: 'foo'});
- * var bar = new Node({type: 'bar'});
- * var baz = new Node({type: 'baz'});
- * foo.push(bar);
- * foo.push(baz);
- *
- * console.log(bar.siblings.length) // 2
- * console.log(baz.siblings.length) // 2
- * ```
- * @return {Object}
- * @api public
- */
- Object.defineProperty(Node.prototype, 'next', {
- set: function set() {
- throw new Error('node.next is a getter and cannot be defined');
- },
- get: function get() {
- if (Array.isArray(this.siblings)) {
- return this.siblings[this.index + 1] || this.parent.next;
- }
- return null;
- }
- });
- /**
- * Get the first node from `node.nodes`.
- *
- * ```js
- * var foo = new Node({type: 'foo'});
- * var bar = new Node({type: 'bar'});
- * var baz = new Node({type: 'baz'});
- * var qux = new Node({type: 'qux'});
- * foo.push(bar);
- * foo.push(baz);
- * foo.push(qux);
- *
- * console.log(foo.first.type) // 'bar'
- * ```
- * @return {Object} The first node, or undefiend
- * @api public
- */
- Object.defineProperty(Node.prototype, 'first', {
- get: function get() {
- return this.nodes ? this.nodes[0] : null;
- }
- });
- /**
- * Get the last node from `node.nodes`.
- *
- * ```js
- * var foo = new Node({type: 'foo'});
- * var bar = new Node({type: 'bar'});
- * var baz = new Node({type: 'baz'});
- * var qux = new Node({type: 'qux'});
- * foo.push(bar);
- * foo.push(baz);
- * foo.push(qux);
- *
- * console.log(foo.last.type) // 'qux'
- * ```
- * @return {Object} The last node, or undefiend
- * @api public
- */
- Object.defineProperty(Node.prototype, 'last', {
- get: function get() {
- return this.nodes ? utils.last(this.nodes) : null;
- }
- });
- /**
- * Get the last node from `node.nodes`.
- *
- * ```js
- * var foo = new Node({type: 'foo'});
- * var bar = new Node({type: 'bar'});
- * var baz = new Node({type: 'baz'});
- * var qux = new Node({type: 'qux'});
- * foo.push(bar);
- * foo.push(baz);
- * foo.push(qux);
- *
- * console.log(foo.last.type) // 'qux'
- * ```
- * @return {Object} The last node, or undefiend
- * @api public
- */
- Object.defineProperty(Node.prototype, 'scope', {
- get: function get() {
- if (this.isScope !== true) {
- return this.parent ? this.parent.scope : this;
- }
- return this;
- }
- });
- /**
- * Get own property names from Node prototype, but only the
- * first time `Node` is instantiated
- */
- function lazyKeys() {
- if (!ownNames) {
- ownNames = Object.getOwnPropertyNames(Node.prototype);
- }
- }
- /**
- * Simplified assertion. Throws an error is `val` is falsey.
- */
- function assert(val, message) {
- if (!val) throw new Error(message);
- }
- /**
- * Expose `Node`
- */
- exports = module.exports = Node;
- /***/ }),
- /***/ "./node_modules/snapdragon-node/node_modules/define-property/index.js":
- /*!****************************************************************************!*\
- !*** ./node_modules/snapdragon-node/node_modules/define-property/index.js ***!
- \****************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * define-property <https://github.com/jonschlinkert/define-property>
- *
- * Copyright (c) 2015, 2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- var isDescriptor = __webpack_require__(/*! is-descriptor */ "./node_modules/is-descriptor/index.js");
- module.exports = function defineProperty(obj, prop, val) {
- if (_typeof(obj) !== 'object' && typeof obj !== 'function') {
- throw new TypeError('expected an object or function.');
- }
- if (typeof prop !== 'string') {
- throw new TypeError('expected `prop` to be a string.');
- }
- if (isDescriptor(val) && ('set' in val || 'get' in val)) {
- return Object.defineProperty(obj, prop, val);
- }
- return Object.defineProperty(obj, prop, {
- configurable: true,
- enumerable: false,
- writable: true,
- value: val
- });
- };
- /***/ }),
- /***/ "./node_modules/snapdragon-util/index.js":
- /*!***********************************************!*\
- !*** ./node_modules/snapdragon-util/index.js ***!
- \***********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var typeOf = __webpack_require__(/*! kind-of */ "./node_modules/kind-of/index.js");
- var utils = module.exports;
- /**
- * Returns true if the given value is a node.
- *
- * ```js
- * var Node = require('snapdragon-node');
- * var node = new Node({type: 'foo'});
- * console.log(utils.isNode(node)); //=> true
- * console.log(utils.isNode({})); //=> false
- * ```
- * @param {Object} `node` Instance of [snapdragon-node][]
- * @returns {Boolean}
- * @api public
- */
- utils.isNode = function (node) {
- return typeOf(node) === 'object' && node.isNode === true;
- };
- /**
- * Emit an empty string for the given `node`.
- *
- * ```js
- * // do nothing for beginning-of-string
- * snapdragon.compiler.set('bos', utils.noop);
- * ```
- * @param {Object} `node` Instance of [snapdragon-node][]
- * @returns {undefined}
- * @api public
- */
- utils.noop = function (node) {
- append(this, '', node);
- };
- /**
- * Appdend `node.val` to `compiler.output`, exactly as it was created
- * by the parser.
- *
- * ```js
- * snapdragon.compiler.set('text', utils.identity);
- * ```
- * @param {Object} `node` Instance of [snapdragon-node][]
- * @returns {undefined}
- * @api public
- */
- utils.identity = function (node) {
- append(this, node.val, node);
- };
- /**
- * Previously named `.emit`, this method appends the given `val`
- * to `compiler.output` for the given node. Useful when you know
- * what value should be appended advance, regardless of the actual
- * value of `node.val`.
- *
- * ```js
- * snapdragon.compiler
- * .set('i', function(node) {
- * this.mapVisit(node);
- * })
- * .set('i.open', utils.append('<i>'))
- * .set('i.close', utils.append('</i>'))
- * ```
- * @param {Object} `node` Instance of [snapdragon-node][]
- * @returns {Function} Returns a compiler middleware function.
- * @api public
- */
- utils.append = function (val) {
- return function (node) {
- append(this, val, node);
- };
- };
- /**
- * Used in compiler middleware, this onverts an AST node into
- * an empty `text` node and deletes `node.nodes` if it exists.
- * The advantage of this method is that, as opposed to completely
- * removing the node, indices will not need to be re-calculated
- * in sibling nodes, and nothing is appended to the output.
- *
- * ```js
- * utils.toNoop(node);
- * // convert `node.nodes` to the given value instead of deleting it
- * utils.toNoop(node, []);
- * ```
- * @param {Object} `node` Instance of [snapdragon-node][]
- * @param {Array} `nodes` Optionally pass a new `nodes` value, to replace the existing `node.nodes` array.
- * @api public
- */
- utils.toNoop = function (node, nodes) {
- if (nodes) {
- node.nodes = nodes;
- } else {
- delete node.nodes;
- node.type = 'text';
- node.val = '';
- }
- };
- /**
- * Visit `node` with the given `fn`. The built-in `.visit` method in snapdragon
- * automatically calls registered compilers, this allows you to pass a visitor
- * function.
- *
- * ```js
- * snapdragon.compiler.set('i', function(node) {
- * utils.visit(node, function(childNode) {
- * // do stuff with "childNode"
- * return childNode;
- * });
- * });
- * ```
- * @param {Object} `node` Instance of [snapdragon-node][]
- * @param {Function} `fn`
- * @return {Object} returns the node after recursively visiting all child nodes.
- * @api public
- */
- utils.visit = function (node, fn) {
- assert(utils.isNode(node), 'expected node to be an instance of Node');
- assert(isFunction(fn), 'expected a visitor function');
- fn(node);
- return node.nodes ? utils.mapVisit(node, fn) : node;
- };
- /**
- * Map [visit](#visit) the given `fn` over `node.nodes`. This is called by
- * [visit](#visit), use this method if you do not want `fn` to be called on
- * the first node.
- *
- * ```js
- * snapdragon.compiler.set('i', function(node) {
- * utils.mapVisit(node, function(childNode) {
- * // do stuff with "childNode"
- * return childNode;
- * });
- * });
- * ```
- * @param {Object} `node` Instance of [snapdragon-node][]
- * @param {Object} `options`
- * @param {Function} `fn`
- * @return {Object} returns the node
- * @api public
- */
- utils.mapVisit = function (node, fn) {
- assert(utils.isNode(node), 'expected node to be an instance of Node');
- assert(isArray(node.nodes), 'expected node.nodes to be an array');
- assert(isFunction(fn), 'expected a visitor function');
- for (var i = 0; i < node.nodes.length; i++) {
- utils.visit(node.nodes[i], fn);
- }
- return node;
- };
- /**
- * Unshift an `*.open` node onto `node.nodes`.
- *
- * ```js
- * var Node = require('snapdragon-node');
- * snapdragon.parser.set('brace', function(node) {
- * var match = this.match(/^{/);
- * if (match) {
- * var parent = new Node({type: 'brace'});
- * utils.addOpen(parent, Node);
- * console.log(parent.nodes[0]):
- * // { type: 'brace.open', val: '' };
- *
- * // push the parent "brace" node onto the stack
- * this.push(parent);
- *
- * // return the parent node, so it's also added to the AST
- * return brace;
- * }
- * });
- * ```
- * @param {Object} `node` Instance of [snapdragon-node][]
- * @param {Function} `Node` (required) Node constructor function from [snapdragon-node][].
- * @param {Function} `filter` Optionaly specify a filter function to exclude the node.
- * @return {Object} Returns the created opening node.
- * @api public
- */
- utils.addOpen = function (node, Node, val, filter) {
- assert(utils.isNode(node), 'expected node to be an instance of Node');
- assert(isFunction(Node), 'expected Node to be a constructor function');
- if (typeof val === 'function') {
- filter = val;
- val = '';
- }
- if (typeof filter === 'function' && !filter(node)) return;
- var open = new Node({
- type: node.type + '.open',
- val: val
- });
- var unshift = node.unshift || node.unshiftNode;
- if (typeof unshift === 'function') {
- unshift.call(node, open);
- } else {
- utils.unshiftNode(node, open);
- }
- return open;
- };
- /**
- * Push a `*.close` node onto `node.nodes`.
- *
- * ```js
- * var Node = require('snapdragon-node');
- * snapdragon.parser.set('brace', function(node) {
- * var match = this.match(/^}/);
- * if (match) {
- * var parent = this.parent();
- * if (parent.type !== 'brace') {
- * throw new Error('missing opening: ' + '}');
- * }
- *
- * utils.addClose(parent, Node);
- * console.log(parent.nodes[parent.nodes.length - 1]):
- * // { type: 'brace.close', val: '' };
- *
- * // no need to return a node, since the parent
- * // was already added to the AST
- * return;
- * }
- * });
- * ```
- * @param {Object} `node` Instance of [snapdragon-node][]
- * @param {Function} `Node` (required) Node constructor function from [snapdragon-node][].
- * @param {Function} `filter` Optionaly specify a filter function to exclude the node.
- * @return {Object} Returns the created closing node.
- * @api public
- */
- utils.addClose = function (node, Node, val, filter) {
- assert(utils.isNode(node), 'expected node to be an instance of Node');
- assert(isFunction(Node), 'expected Node to be a constructor function');
- if (typeof val === 'function') {
- filter = val;
- val = '';
- }
- if (typeof filter === 'function' && !filter(node)) return;
- var close = new Node({
- type: node.type + '.close',
- val: val
- });
- var push = node.push || node.pushNode;
- if (typeof push === 'function') {
- push.call(node, close);
- } else {
- utils.pushNode(node, close);
- }
- return close;
- };
- /**
- * Wraps the given `node` with `*.open` and `*.close` nodes.
- *
- * @param {Object} `node` Instance of [snapdragon-node][]
- * @param {Function} `Node` (required) Node constructor function from [snapdragon-node][].
- * @param {Function} `filter` Optionaly specify a filter function to exclude the node.
- * @return {Object} Returns the node
- * @api public
- */
- utils.wrapNodes = function (node, Node, filter) {
- assert(utils.isNode(node), 'expected node to be an instance of Node');
- assert(isFunction(Node), 'expected Node to be a constructor function');
- utils.addOpen(node, Node, filter);
- utils.addClose(node, Node, filter);
- return node;
- };
- /**
- * Push the given `node` onto `parent.nodes`, and set `parent` as `node.parent.
- *
- * ```js
- * var parent = new Node({type: 'foo'});
- * var node = new Node({type: 'bar'});
- * utils.pushNode(parent, node);
- * console.log(parent.nodes[0].type) // 'bar'
- * console.log(node.parent.type) // 'foo'
- * ```
- * @param {Object} `parent`
- * @param {Object} `node` Instance of [snapdragon-node][]
- * @return {Object} Returns the child node
- * @api public
- */
- utils.pushNode = function (parent, node) {
- assert(utils.isNode(parent), 'expected parent node to be an instance of Node');
- assert(utils.isNode(node), 'expected node to be an instance of Node');
- node.define('parent', parent);
- parent.nodes = parent.nodes || [];
- parent.nodes.push(node);
- return node;
- };
- /**
- * Unshift `node` onto `parent.nodes`, and set `parent` as `node.parent.
- *
- * ```js
- * var parent = new Node({type: 'foo'});
- * var node = new Node({type: 'bar'});
- * utils.unshiftNode(parent, node);
- * console.log(parent.nodes[0].type) // 'bar'
- * console.log(node.parent.type) // 'foo'
- * ```
- * @param {Object} `parent`
- * @param {Object} `node` Instance of [snapdragon-node][]
- * @return {undefined}
- * @api public
- */
- utils.unshiftNode = function (parent, node) {
- assert(utils.isNode(parent), 'expected parent node to be an instance of Node');
- assert(utils.isNode(node), 'expected node to be an instance of Node');
- node.define('parent', parent);
- parent.nodes = parent.nodes || [];
- parent.nodes.unshift(node);
- };
- /**
- * Pop the last `node` off of `parent.nodes`. The advantage of
- * using this method is that it checks for `node.nodes` and works
- * with any version of `snapdragon-node`.
- *
- * ```js
- * var parent = new Node({type: 'foo'});
- * utils.pushNode(parent, new Node({type: 'foo'}));
- * utils.pushNode(parent, new Node({type: 'bar'}));
- * utils.pushNode(parent, new Node({type: 'baz'}));
- * console.log(parent.nodes.length); //=> 3
- * utils.popNode(parent);
- * console.log(parent.nodes.length); //=> 2
- * ```
- * @param {Object} `parent`
- * @param {Object} `node` Instance of [snapdragon-node][]
- * @return {Number|Undefined} Returns the length of `node.nodes` or undefined.
- * @api public
- */
- utils.popNode = function (node) {
- assert(utils.isNode(node), 'expected node to be an instance of Node');
- if (typeof node.pop === 'function') {
- return node.pop();
- }
- return node.nodes && node.nodes.pop();
- };
- /**
- * Shift the first `node` off of `parent.nodes`. The advantage of
- * using this method is that it checks for `node.nodes` and works
- * with any version of `snapdragon-node`.
- *
- * ```js
- * var parent = new Node({type: 'foo'});
- * utils.pushNode(parent, new Node({type: 'foo'}));
- * utils.pushNode(parent, new Node({type: 'bar'}));
- * utils.pushNode(parent, new Node({type: 'baz'}));
- * console.log(parent.nodes.length); //=> 3
- * utils.shiftNode(parent);
- * console.log(parent.nodes.length); //=> 2
- * ```
- * @param {Object} `parent`
- * @param {Object} `node` Instance of [snapdragon-node][]
- * @return {Number|Undefined} Returns the length of `node.nodes` or undefined.
- * @api public
- */
- utils.shiftNode = function (node) {
- assert(utils.isNode(node), 'expected node to be an instance of Node');
- if (typeof node.shift === 'function') {
- return node.shift();
- }
- return node.nodes && node.nodes.shift();
- };
- /**
- * Remove the specified `node` from `parent.nodes`.
- *
- * ```js
- * var parent = new Node({type: 'abc'});
- * var foo = new Node({type: 'foo'});
- * utils.pushNode(parent, foo);
- * utils.pushNode(parent, new Node({type: 'bar'}));
- * utils.pushNode(parent, new Node({type: 'baz'}));
- * console.log(parent.nodes.length); //=> 3
- * utils.removeNode(parent, foo);
- * console.log(parent.nodes.length); //=> 2
- * ```
- * @param {Object} `parent`
- * @param {Object} `node` Instance of [snapdragon-node][]
- * @return {Object|undefined} Returns the removed node, if successful, or undefined if it does not exist on `parent.nodes`.
- * @api public
- */
- utils.removeNode = function (parent, node) {
- assert(utils.isNode(parent), 'expected parent.node to be an instance of Node');
- assert(utils.isNode(node), 'expected node to be an instance of Node');
- if (!parent.nodes) {
- return null;
- }
- if (typeof parent.remove === 'function') {
- return parent.remove(node);
- }
- var idx = parent.nodes.indexOf(node);
- if (idx !== -1) {
- return parent.nodes.splice(idx, 1);
- }
- };
- /**
- * Returns true if `node.type` matches the given `type`. Throws a
- * `TypeError` if `node` is not an instance of `Node`.
- *
- * ```js
- * var Node = require('snapdragon-node');
- * var node = new Node({type: 'foo'});
- * console.log(utils.isType(node, 'foo')); // false
- * console.log(utils.isType(node, 'bar')); // true
- * ```
- * @param {Object} `node` Instance of [snapdragon-node][]
- * @param {String} `type`
- * @return {Boolean}
- * @api public
- */
- utils.isType = function (node, type) {
- assert(utils.isNode(node), 'expected node to be an instance of Node');
- switch (typeOf(type)) {
- case 'array':
- var types = type.slice();
- for (var i = 0; i < types.length; i++) {
- if (utils.isType(node, types[i])) {
- return true;
- }
- }
- return false;
- case 'string':
- return node.type === type;
- case 'regexp':
- return type.test(node.type);
- default:
- {
- throw new TypeError('expected "type" to be an array, string or regexp');
- }
- }
- };
- /**
- * Returns true if the given `node` has the given `type` in `node.nodes`.
- * Throws a `TypeError` if `node` is not an instance of `Node`.
- *
- * ```js
- * var Node = require('snapdragon-node');
- * var node = new Node({
- * type: 'foo',
- * nodes: [
- * new Node({type: 'bar'}),
- * new Node({type: 'baz'})
- * ]
- * });
- * console.log(utils.hasType(node, 'xyz')); // false
- * console.log(utils.hasType(node, 'baz')); // true
- * ```
- * @param {Object} `node` Instance of [snapdragon-node][]
- * @param {String} `type`
- * @return {Boolean}
- * @api public
- */
- utils.hasType = function (node, type) {
- assert(utils.isNode(node), 'expected node to be an instance of Node');
- if (!Array.isArray(node.nodes)) return false;
- for (var i = 0; i < node.nodes.length; i++) {
- if (utils.isType(node.nodes[i], type)) {
- return true;
- }
- }
- return false;
- };
- /**
- * Returns the first node from `node.nodes` of the given `type`
- *
- * ```js
- * var node = new Node({
- * type: 'foo',
- * nodes: [
- * new Node({type: 'text', val: 'abc'}),
- * new Node({type: 'text', val: 'xyz'})
- * ]
- * });
- *
- * var textNode = utils.firstOfType(node.nodes, 'text');
- * console.log(textNode.val);
- * //=> 'abc'
- * ```
- * @param {Array} `nodes`
- * @param {String} `type`
- * @return {Object|undefined} Returns the first matching node or undefined.
- * @api public
- */
- utils.firstOfType = function (nodes, type) {
- for (var i = 0; i < nodes.length; i++) {
- var node = nodes[i];
- if (utils.isType(node, type)) {
- return node;
- }
- }
- };
- /**
- * Returns the node at the specified index, or the first node of the
- * given `type` from `node.nodes`.
- *
- * ```js
- * var node = new Node({
- * type: 'foo',
- * nodes: [
- * new Node({type: 'text', val: 'abc'}),
- * new Node({type: 'text', val: 'xyz'})
- * ]
- * });
- *
- * var nodeOne = utils.findNode(node.nodes, 'text');
- * console.log(nodeOne.val);
- * //=> 'abc'
- *
- * var nodeTwo = utils.findNode(node.nodes, 1);
- * console.log(nodeTwo.val);
- * //=> 'xyz'
- * ```
- *
- * @param {Array} `nodes`
- * @param {String|Number} `type` Node type or index.
- * @return {Object} Returns a node or undefined.
- * @api public
- */
- utils.findNode = function (nodes, type) {
- if (!Array.isArray(nodes)) {
- return null;
- }
- if (typeof type === 'number') {
- return nodes[type];
- }
- return utils.firstOfType(nodes, type);
- };
- /**
- * Returns true if the given node is an "*.open" node.
- *
- * ```js
- * var Node = require('snapdragon-node');
- * var brace = new Node({type: 'brace'});
- * var open = new Node({type: 'brace.open'});
- * var close = new Node({type: 'brace.close'});
- *
- * console.log(utils.isOpen(brace)); // false
- * console.log(utils.isOpen(open)); // true
- * console.log(utils.isOpen(close)); // false
- * ```
- * @param {Object} `node` Instance of [snapdragon-node][]
- * @return {Boolean}
- * @api public
- */
- utils.isOpen = function (node) {
- assert(utils.isNode(node), 'expected node to be an instance of Node');
- return node.type.slice(-5) === '.open';
- };
- /**
- * Returns true if the given node is a "*.close" node.
- *
- * ```js
- * var Node = require('snapdragon-node');
- * var brace = new Node({type: 'brace'});
- * var open = new Node({type: 'brace.open'});
- * var close = new Node({type: 'brace.close'});
- *
- * console.log(utils.isClose(brace)); // false
- * console.log(utils.isClose(open)); // false
- * console.log(utils.isClose(close)); // true
- * ```
- * @param {Object} `node` Instance of [snapdragon-node][]
- * @return {Boolean}
- * @api public
- */
- utils.isClose = function (node) {
- assert(utils.isNode(node), 'expected node to be an instance of Node');
- return node.type.slice(-6) === '.close';
- };
- /**
- * Returns true if `node.nodes` **has** an `.open` node
- *
- * ```js
- * var Node = require('snapdragon-node');
- * var brace = new Node({
- * type: 'brace',
- * nodes: []
- * });
- *
- * var open = new Node({type: 'brace.open'});
- * console.log(utils.hasOpen(brace)); // false
- *
- * brace.pushNode(open);
- * console.log(utils.hasOpen(brace)); // true
- * ```
- * @param {Object} `node` Instance of [snapdragon-node][]
- * @return {Boolean}
- * @api public
- */
- utils.hasOpen = function (node) {
- assert(utils.isNode(node), 'expected node to be an instance of Node');
- var first = node.first || node.nodes ? node.nodes[0] : null;
- if (utils.isNode(first)) {
- return first.type === node.type + '.open';
- }
- return false;
- };
- /**
- * Returns true if `node.nodes` **has** a `.close` node
- *
- * ```js
- * var Node = require('snapdragon-node');
- * var brace = new Node({
- * type: 'brace',
- * nodes: []
- * });
- *
- * var close = new Node({type: 'brace.close'});
- * console.log(utils.hasClose(brace)); // false
- *
- * brace.pushNode(close);
- * console.log(utils.hasClose(brace)); // true
- * ```
- * @param {Object} `node` Instance of [snapdragon-node][]
- * @return {Boolean}
- * @api public
- */
- utils.hasClose = function (node) {
- assert(utils.isNode(node), 'expected node to be an instance of Node');
- var last = node.last || node.nodes ? node.nodes[node.nodes.length - 1] : null;
- if (utils.isNode(last)) {
- return last.type === node.type + '.close';
- }
- return false;
- };
- /**
- * Returns true if `node.nodes` has both `.open` and `.close` nodes
- *
- * ```js
- * var Node = require('snapdragon-node');
- * var brace = new Node({
- * type: 'brace',
- * nodes: []
- * });
- *
- * var open = new Node({type: 'brace.open'});
- * var close = new Node({type: 'brace.close'});
- * console.log(utils.hasOpen(brace)); // false
- * console.log(utils.hasClose(brace)); // false
- *
- * brace.pushNode(open);
- * brace.pushNode(close);
- * console.log(utils.hasOpen(brace)); // true
- * console.log(utils.hasClose(brace)); // true
- * ```
- * @param {Object} `node` Instance of [snapdragon-node][]
- * @return {Boolean}
- * @api public
- */
- utils.hasOpenAndClose = function (node) {
- return utils.hasOpen(node) && utils.hasClose(node);
- };
- /**
- * Push the given `node` onto the `state.inside` array for the
- * given type. This array is used as a specialized "stack" for
- * only the given `node.type`.
- *
- * ```js
- * var state = { inside: {}};
- * var node = new Node({type: 'brace'});
- * utils.addType(state, node);
- * console.log(state.inside);
- * //=> { brace: [{type: 'brace'}] }
- * ```
- * @param {Object} `state` The `compiler.state` object or custom state object.
- * @param {Object} `node` Instance of [snapdragon-node][]
- * @return {Array} Returns the `state.inside` stack for the given type.
- * @api public
- */
- utils.addType = function (state, node) {
- assert(utils.isNode(node), 'expected node to be an instance of Node');
- assert(isObject(state), 'expected state to be an object');
- var type = node.parent ? node.parent.type : node.type.replace(/\.open$/, '');
- if (!state.hasOwnProperty('inside')) {
- state.inside = {};
- }
- if (!state.inside.hasOwnProperty(type)) {
- state.inside[type] = [];
- }
- var arr = state.inside[type];
- arr.push(node);
- return arr;
- };
- /**
- * Remove the given `node` from the `state.inside` array for the
- * given type. This array is used as a specialized "stack" for
- * only the given `node.type`.
- *
- * ```js
- * var state = { inside: {}};
- * var node = new Node({type: 'brace'});
- * utils.addType(state, node);
- * console.log(state.inside);
- * //=> { brace: [{type: 'brace'}] }
- * utils.removeType(state, node);
- * //=> { brace: [] }
- * ```
- * @param {Object} `state` The `compiler.state` object or custom state object.
- * @param {Object} `node` Instance of [snapdragon-node][]
- * @return {Array} Returns the `state.inside` stack for the given type.
- * @api public
- */
- utils.removeType = function (state, node) {
- assert(utils.isNode(node), 'expected node to be an instance of Node');
- assert(isObject(state), 'expected state to be an object');
- var type = node.parent ? node.parent.type : node.type.replace(/\.close$/, '');
- if (state.inside.hasOwnProperty(type)) {
- return state.inside[type].pop();
- }
- };
- /**
- * Returns true if `node.val` is an empty string, or `node.nodes` does
- * not contain any non-empty text nodes.
- *
- * ```js
- * var node = new Node({type: 'text'});
- * utils.isEmpty(node); //=> true
- * node.val = 'foo';
- * utils.isEmpty(node); //=> false
- * ```
- * @param {Object} `node` Instance of [snapdragon-node][]
- * @param {Function} `fn`
- * @return {Boolean}
- * @api public
- */
- utils.isEmpty = function (node, fn) {
- assert(utils.isNode(node), 'expected node to be an instance of Node');
- if (!Array.isArray(node.nodes)) {
- if (node.type !== 'text') {
- return true;
- }
- if (typeof fn === 'function') {
- return fn(node, node.parent);
- }
- return !utils.trim(node.val);
- }
- for (var i = 0; i < node.nodes.length; i++) {
- var child = node.nodes[i];
- if (utils.isOpen(child) || utils.isClose(child)) {
- continue;
- }
- if (!utils.isEmpty(child, fn)) {
- return false;
- }
- }
- return true;
- };
- /**
- * Returns true if the `state.inside` stack for the given type exists
- * and has one or more nodes on it.
- *
- * ```js
- * var state = { inside: {}};
- * var node = new Node({type: 'brace'});
- * console.log(utils.isInsideType(state, 'brace')); //=> false
- * utils.addType(state, node);
- * console.log(utils.isInsideType(state, 'brace')); //=> true
- * utils.removeType(state, node);
- * console.log(utils.isInsideType(state, 'brace')); //=> false
- * ```
- * @param {Object} `state`
- * @param {String} `type`
- * @return {Boolean}
- * @api public
- */
- utils.isInsideType = function (state, type) {
- assert(isObject(state), 'expected state to be an object');
- assert(isString(type), 'expected type to be a string');
- if (!state.hasOwnProperty('inside')) {
- return false;
- }
- if (!state.inside.hasOwnProperty(type)) {
- return false;
- }
- return state.inside[type].length > 0;
- };
- /**
- * Returns true if `node` is either a child or grand-child of the given `type`,
- * or `state.inside[type]` is a non-empty array.
- *
- * ```js
- * var state = { inside: {}};
- * var node = new Node({type: 'brace'});
- * var open = new Node({type: 'brace.open'});
- * console.log(utils.isInside(state, open, 'brace')); //=> false
- * utils.pushNode(node, open);
- * console.log(utils.isInside(state, open, 'brace')); //=> true
- * ```
- * @param {Object} `state` Either the `compiler.state` object, if it exists, or a user-supplied state object.
- * @param {Object} `node` Instance of [snapdragon-node][]
- * @param {String} `type` The `node.type` to check for.
- * @return {Boolean}
- * @api public
- */
- utils.isInside = function (state, node, type) {
- assert(utils.isNode(node), 'expected node to be an instance of Node');
- assert(isObject(state), 'expected state to be an object');
- if (Array.isArray(type)) {
- for (var i = 0; i < type.length; i++) {
- if (utils.isInside(state, node, type[i])) {
- return true;
- }
- }
- return false;
- }
- var parent = node.parent;
- if (typeof type === 'string') {
- return parent && parent.type === type || utils.isInsideType(state, type);
- }
- if (typeOf(type) === 'regexp') {
- if (parent && parent.type && type.test(parent.type)) {
- return true;
- }
- var keys = Object.keys(state.inside);
- var len = keys.length;
- var idx = -1;
- while (++idx < len) {
- var key = keys[idx];
- var val = state.inside[key];
- if (Array.isArray(val) && val.length !== 0 && type.test(key)) {
- return true;
- }
- }
- }
- return false;
- };
- /**
- * Get the last `n` element from the given `array`. Used for getting
- * a node from `node.nodes.`
- *
- * @param {Array} `array`
- * @param {Number} `n`
- * @return {undefined}
- * @api public
- */
- utils.last = function (arr, n) {
- return arr[arr.length - (n || 1)];
- };
- /**
- * Cast the given `val` to an array.
- *
- * ```js
- * console.log(utils.arrayify(''));
- * //=> []
- * console.log(utils.arrayify('foo'));
- * //=> ['foo']
- * console.log(utils.arrayify(['foo']));
- * //=> ['foo']
- * ```
- * @param {any} `val`
- * @return {Array}
- * @api public
- */
- utils.arrayify = function (val) {
- if (typeof val === 'string' && val !== '') {
- return [val];
- }
- if (!Array.isArray(val)) {
- return [];
- }
- return val;
- };
- /**
- * Convert the given `val` to a string by joining with `,`. Useful
- * for creating a cheerio/CSS/DOM-style selector from a list of strings.
- *
- * @param {any} `val`
- * @return {Array}
- * @api public
- */
- utils.stringify = function (val) {
- return utils.arrayify(val).join(',');
- };
- /**
- * Ensure that the given value is a string and call `.trim()` on it,
- * or return an empty string.
- *
- * @param {String} `str`
- * @return {String}
- * @api public
- */
- utils.trim = function (str) {
- return typeof str === 'string' ? str.trim() : '';
- };
- /**
- * Return true if val is an object
- */
- function isObject(val) {
- return typeOf(val) === 'object';
- }
- /**
- * Return true if val is a string
- */
- function isString(val) {
- return typeof val === 'string';
- }
- /**
- * Return true if val is a function
- */
- function isFunction(val) {
- return typeof val === 'function';
- }
- /**
- * Return true if val is an array
- */
- function isArray(val) {
- return Array.isArray(val);
- }
- /**
- * Shim to ensure the `.append` methods work with any version of snapdragon
- */
- function append(compiler, val, node) {
- if (typeof compiler.append !== 'function') {
- return compiler.emit(val, node);
- }
- return compiler.append(val, node);
- }
- /**
- * Simplified assertion. Throws an error is `val` is falsey.
- */
- function assert(val, message) {
- if (!val) throw new Error(message);
- }
- /***/ }),
- /***/ "./node_modules/snapdragon/index.js":
- /*!******************************************!*\
- !*** ./node_modules/snapdragon/index.js ***!
- \******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var Base = __webpack_require__(/*! base */ "./node_modules/base/index.js");
- var define = __webpack_require__(/*! define-property */ "./node_modules/define-property/index.js");
- var Compiler = __webpack_require__(/*! ./lib/compiler */ "./node_modules/snapdragon/lib/compiler.js");
- var Parser = __webpack_require__(/*! ./lib/parser */ "./node_modules/snapdragon/lib/parser.js");
- var utils = __webpack_require__(/*! ./lib/utils */ "./node_modules/snapdragon/lib/utils.js");
- var regexCache = {};
- var cache = {};
- /**
- * Create a new instance of `Snapdragon` with the given `options`.
- *
- * ```js
- * var snapdragon = new Snapdragon();
- * ```
- *
- * @param {Object} `options`
- * @api public
- */
- function Snapdragon(options) {
- Base.call(this, null, options);
- this.options = utils.extend({
- source: 'string'
- }, this.options);
- this.compiler = new Compiler(this.options);
- this.parser = new Parser(this.options);
- Object.defineProperty(this, 'compilers', {
- get: function get() {
- return this.compiler.compilers;
- }
- });
- Object.defineProperty(this, 'parsers', {
- get: function get() {
- return this.parser.parsers;
- }
- });
- Object.defineProperty(this, 'regex', {
- get: function get() {
- return this.parser.regex;
- }
- });
- }
- /**
- * Inherit Base
- */
- Base.extend(Snapdragon);
- /**
- * Add a parser to `snapdragon.parsers` for capturing the given `type` using
- * the specified regex or parser function. A function is useful if you need
- * to customize how the token is created and/or have access to the parser
- * instance to check options, etc.
- *
- * ```js
- * snapdragon
- * .capture('slash', /^\//)
- * .capture('dot', function() {
- * var pos = this.position();
- * var m = this.match(/^\./);
- * if (!m) return;
- * return pos({
- * type: 'dot',
- * val: m[0]
- * });
- * });
- * ```
- * @param {String} `type`
- * @param {RegExp|Function} `regex`
- * @return {Object} Returns the parser instance for chaining
- * @api public
- */
- Snapdragon.prototype.capture = function () {
- return this.parser.capture.apply(this.parser, arguments);
- };
- /**
- * Register a plugin `fn`.
- *
- * ```js
- * var snapdragon = new Snapdgragon([options]);
- * snapdragon.use(function() {
- * console.log(this); //<= snapdragon instance
- * console.log(this.parser); //<= parser instance
- * console.log(this.compiler); //<= compiler instance
- * });
- * ```
- * @param {Object} `fn`
- * @api public
- */
- Snapdragon.prototype.use = function (fn) {
- fn.call(this, this);
- return this;
- };
- /**
- * Parse the given `str`.
- *
- * ```js
- * var snapdragon = new Snapdgragon([options]);
- * // register parsers
- * snapdragon.parser.use(function() {});
- *
- * // parse
- * var ast = snapdragon.parse('foo/bar');
- * console.log(ast);
- * ```
- * @param {String} `str`
- * @param {Object} `options` Set `options.sourcemap` to true to enable source maps.
- * @return {Object} Returns an AST.
- * @api public
- */
- Snapdragon.prototype.parse = function (str, options) {
- this.options = utils.extend({}, this.options, options);
- var parsed = this.parser.parse(str, this.options); // add non-enumerable parser reference
- define(parsed, 'parser', this.parser);
- return parsed;
- };
- /**
- * Compile the given `AST`.
- *
- * ```js
- * var snapdragon = new Snapdgragon([options]);
- * // register plugins
- * snapdragon.use(function() {});
- * // register parser plugins
- * snapdragon.parser.use(function() {});
- * // register compiler plugins
- * snapdragon.compiler.use(function() {});
- *
- * // parse
- * var ast = snapdragon.parse('foo/bar');
- *
- * // compile
- * var res = snapdragon.compile(ast);
- * console.log(res.output);
- * ```
- * @param {Object} `ast`
- * @param {Object} `options`
- * @return {Object} Returns an object with an `output` property with the rendered string.
- * @api public
- */
- Snapdragon.prototype.compile = function (ast, options) {
- this.options = utils.extend({}, this.options, options);
- var compiled = this.compiler.compile(ast, this.options); // add non-enumerable compiler reference
- define(compiled, 'compiler', this.compiler);
- return compiled;
- };
- /**
- * Expose `Snapdragon`
- */
- module.exports = Snapdragon;
- /**
- * Expose `Parser` and `Compiler`
- */
- module.exports.Compiler = Compiler;
- module.exports.Parser = Parser;
- /***/ }),
- /***/ "./node_modules/snapdragon/lib/compiler.js":
- /*!*************************************************!*\
- !*** ./node_modules/snapdragon/lib/compiler.js ***!
- \*************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(__filename) {
- var use = __webpack_require__(/*! use */ "./node_modules/use/index.js");
- var _define = __webpack_require__(/*! define-property */ "./node_modules/define-property/index.js");
- var debug = __webpack_require__(/*! debug */ "./node_modules/snapdragon/node_modules/debug/src/browser.js")('snapdragon:compiler');
- var utils = __webpack_require__(/*! ./utils */ "./node_modules/snapdragon/lib/utils.js");
- /**
- * Create a new `Compiler` with the given `options`.
- * @param {Object} `options`
- */
- function Compiler(options, state) {
- debug('initializing', __filename);
- this.options = utils.extend({
- source: 'string'
- }, options);
- this.state = state || {};
- this.compilers = {};
- this.output = '';
- this.set('eos', function (node) {
- return this.emit(node.val, node);
- });
- this.set('noop', function (node) {
- return this.emit(node.val, node);
- });
- this.set('bos', function (node) {
- return this.emit(node.val, node);
- });
- use(this);
- }
- /**
- * Prototype methods
- */
- Compiler.prototype = {
- /**
- * Throw an error message with details including the cursor position.
- * @param {String} `msg` Message to use in the Error.
- */
- error: function error(msg, node) {
- var pos = node.position || {
- start: {
- column: 0
- }
- };
- var message = this.options.source + ' column:' + pos.start.column + ': ' + msg;
- var err = new Error(message);
- err.reason = msg;
- err.column = pos.start.column;
- err.source = this.pattern;
- if (this.options.silent) {
- this.errors.push(err);
- } else {
- throw err;
- }
- },
- /**
- * Define a non-enumberable property on the `Compiler` instance.
- *
- * ```js
- * compiler.define('foo', 'bar');
- * ```
- * @name .define
- * @param {String} `key` propery name
- * @param {any} `val` property value
- * @return {Object} Returns the Compiler instance for chaining.
- * @api public
- */
- define: function define(key, val) {
- _define(this, key, val);
- return this;
- },
- /**
- * Emit `node.val`
- */
- emit: function emit(str, node) {
- this.output += str;
- return str;
- },
- /**
- * Add a compiler `fn` with the given `name`
- */
- set: function set(name, fn) {
- this.compilers[name] = fn;
- return this;
- },
- /**
- * Get compiler `name`.
- */
- get: function get(name) {
- return this.compilers[name];
- },
- /**
- * Get the previous AST node.
- */
- prev: function prev(n) {
- return this.ast.nodes[this.idx - (n || 1)] || {
- type: 'bos',
- val: ''
- };
- },
- /**
- * Get the next AST node.
- */
- next: function next(n) {
- return this.ast.nodes[this.idx + (n || 1)] || {
- type: 'eos',
- val: ''
- };
- },
- /**
- * Visit `node`.
- */
- visit: function visit(node, nodes, i) {
- var fn = this.compilers[node.type];
- this.idx = i;
- if (typeof fn !== 'function') {
- throw this.error('compiler "' + node.type + '" is not registered', node);
- }
- return fn.call(this, node, nodes, i);
- },
- /**
- * Map visit over array of `nodes`.
- */
- mapVisit: function mapVisit(nodes) {
- if (!Array.isArray(nodes)) {
- throw new TypeError('expected an array');
- }
- var len = nodes.length;
- var idx = -1;
- while (++idx < len) {
- this.visit(nodes[idx], nodes, idx);
- }
- return this;
- },
- /**
- * Compile `ast`.
- */
- compile: function compile(ast, options) {
- var opts = utils.extend({}, this.options, options);
- this.ast = ast;
- this.parsingErrors = this.ast.errors;
- this.output = ''; // source map support
- if (opts.sourcemap) {
- var sourcemaps = __webpack_require__(/*! ./source-maps */ "./node_modules/snapdragon/lib/source-maps.js");
- sourcemaps(this);
- this.mapVisit(this.ast.nodes);
- this.applySourceMaps();
- this.map = opts.sourcemap === 'generator' ? this.map : this.map.toJSON();
- return this;
- }
- this.mapVisit(this.ast.nodes);
- return this;
- }
- };
- /**
- * Expose `Compiler`
- */
- module.exports = Compiler;
- /* WEBPACK VAR INJECTION */}.call(this, "/index.js"))
- /***/ }),
- /***/ "./node_modules/snapdragon/lib/parser.js":
- /*!***********************************************!*\
- !*** ./node_modules/snapdragon/lib/parser.js ***!
- \***********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(__filename) {
- var use = __webpack_require__(/*! use */ "./node_modules/use/index.js");
- var util = __webpack_require__(/*! util */ "./node_modules/util/util.js");
- var Cache = __webpack_require__(/*! map-cache */ "./node_modules/map-cache/index.js");
- var _define = __webpack_require__(/*! define-property */ "./node_modules/define-property/index.js");
- var debug = __webpack_require__(/*! debug */ "./node_modules/snapdragon/node_modules/debug/src/browser.js")('snapdragon:parser');
- var Position = __webpack_require__(/*! ./position */ "./node_modules/snapdragon/lib/position.js");
- var utils = __webpack_require__(/*! ./utils */ "./node_modules/snapdragon/lib/utils.js");
- /**
- * Create a new `Parser` with the given `input` and `options`.
- * @param {String} `input`
- * @param {Object} `options`
- * @api public
- */
- function Parser(options) {
- debug('initializing', __filename);
- this.options = utils.extend({
- source: 'string'
- }, options);
- this.init(this.options);
- use(this);
- }
- /**
- * Prototype methods
- */
- Parser.prototype = {
- constructor: Parser,
- init: function init(options) {
- this.orig = '';
- this.input = '';
- this.parsed = '';
- this.column = 1;
- this.line = 1;
- this.regex = new Cache();
- this.errors = this.errors || [];
- this.parsers = this.parsers || {};
- this.types = this.types || [];
- this.sets = this.sets || {};
- this.fns = this.fns || [];
- this.currentType = 'root';
- var pos = this.position();
- this.bos = pos({
- type: 'bos',
- val: ''
- });
- this.ast = {
- type: 'root',
- errors: this.errors,
- nodes: [this.bos]
- };
- _define(this.bos, 'parent', this.ast);
- this.nodes = [this.ast];
- this.count = 0;
- this.setCount = 0;
- this.stack = [];
- },
- /**
- * Throw a formatted error with the cursor column and `msg`.
- * @param {String} `msg` Message to use in the Error.
- */
- error: function error(msg, node) {
- var pos = node.position || {
- start: {
- column: 0,
- line: 0
- }
- };
- var line = pos.start.line;
- var column = pos.start.column;
- var source = this.options.source;
- var message = source + ' <line:' + line + ' column:' + column + '>: ' + msg;
- var err = new Error(message);
- err.source = source;
- err.reason = msg;
- err.pos = pos;
- if (this.options.silent) {
- this.errors.push(err);
- } else {
- throw err;
- }
- },
- /**
- * Define a non-enumberable property on the `Parser` instance.
- *
- * ```js
- * parser.define('foo', 'bar');
- * ```
- * @name .define
- * @param {String} `key` propery name
- * @param {any} `val` property value
- * @return {Object} Returns the Parser instance for chaining.
- * @api public
- */
- define: function define(key, val) {
- _define(this, key, val);
- return this;
- },
- /**
- * Mark position and patch `node.position`.
- */
- position: function position() {
- var start = {
- line: this.line,
- column: this.column
- };
- var self = this;
- return function (node) {
- _define(node, 'position', new Position(start, self));
- return node;
- };
- },
- /**
- * Set parser `name` with the given `fn`
- * @param {String} `name`
- * @param {Function} `fn`
- * @api public
- */
- set: function set(type, fn) {
- if (this.types.indexOf(type) === -1) {
- this.types.push(type);
- }
- this.parsers[type] = fn.bind(this);
- return this;
- },
- /**
- * Get parser `name`
- * @param {String} `name`
- * @api public
- */
- get: function get(name) {
- return this.parsers[name];
- },
- /**
- * Push a `token` onto the `type` stack.
- *
- * @param {String} `type`
- * @return {Object} `token`
- * @api public
- */
- push: function push(type, token) {
- this.sets[type] = this.sets[type] || [];
- this.count++;
- this.stack.push(token);
- return this.sets[type].push(token);
- },
- /**
- * Pop a token off of the `type` stack
- * @param {String} `type`
- * @returns {Object} Returns a token
- * @api public
- */
- pop: function pop(type) {
- this.sets[type] = this.sets[type] || [];
- this.count--;
- this.stack.pop();
- return this.sets[type].pop();
- },
- /**
- * Return true if inside a `stack` node. Types are `braces`, `parens` or `brackets`.
- *
- * @param {String} `type`
- * @return {Boolean}
- * @api public
- */
- isInside: function isInside(type) {
- this.sets[type] = this.sets[type] || [];
- return this.sets[type].length > 0;
- },
- /**
- * Return true if `node` is the given `type`.
- *
- * ```js
- * parser.isType(node, 'brace');
- * ```
- * @param {Object} `node`
- * @param {String} `type`
- * @return {Boolean}
- * @api public
- */
- isType: function isType(node, type) {
- return node && node.type === type;
- },
- /**
- * Get the previous AST node
- * @return {Object}
- */
- prev: function prev(n) {
- return this.stack.length > 0 ? utils.last(this.stack, n) : utils.last(this.nodes, n);
- },
- /**
- * Update line and column based on `str`.
- */
- consume: function consume(len) {
- this.input = this.input.substr(len);
- },
- /**
- * Update column based on `str`.
- */
- updatePosition: function updatePosition(str, len) {
- var lines = str.match(/\n/g);
- if (lines) this.line += lines.length;
- var i = str.lastIndexOf('\n');
- this.column = ~i ? len - i : this.column + len;
- this.parsed += str;
- this.consume(len);
- },
- /**
- * Match `regex`, return captures, and update the cursor position by `match[0]` length.
- * @param {RegExp} `regex`
- * @return {Object}
- */
- match: function match(regex) {
- var m = regex.exec(this.input);
- if (m) {
- this.updatePosition(m[0], m[0].length);
- return m;
- }
- },
- /**
- * Capture `type` with the given regex.
- * @param {String} `type`
- * @param {RegExp} `regex`
- * @return {Function}
- */
- capture: function capture(type, regex) {
- if (typeof regex === 'function') {
- return this.set.apply(this, arguments);
- }
- this.regex.set(type, regex);
- this.set(type, function () {
- var parsed = this.parsed;
- var pos = this.position();
- var m = this.match(regex);
- if (!m || !m[0]) return;
- var prev = this.prev();
- var node = pos({
- type: type,
- val: m[0],
- parsed: parsed,
- rest: this.input
- });
- if (m[1]) {
- node.inner = m[1];
- }
- _define(node, 'inside', this.stack.length > 0);
- _define(node, 'parent', prev);
- prev.nodes.push(node);
- }.bind(this));
- return this;
- },
- /**
- * Create a parser with open and close for parens,
- * brackets or braces
- */
- capturePair: function capturePair(type, openRegex, closeRegex, fn) {
- this.sets[type] = this.sets[type] || [];
- /**
- * Open
- */
- this.set(type + '.open', function () {
- var parsed = this.parsed;
- var pos = this.position();
- var m = this.match(openRegex);
- if (!m || !m[0]) return;
- var val = m[0];
- this.setCount++;
- this.specialChars = true;
- var open = pos({
- type: type + '.open',
- val: val,
- rest: this.input
- });
- if (typeof m[1] !== 'undefined') {
- open.inner = m[1];
- }
- var prev = this.prev();
- var node = pos({
- type: type,
- nodes: [open]
- });
- _define(node, 'rest', this.input);
- _define(node, 'parsed', parsed);
- _define(node, 'prefix', m[1]);
- _define(node, 'parent', prev);
- _define(open, 'parent', node);
- if (typeof fn === 'function') {
- fn.call(this, open, node);
- }
- this.push(type, node);
- prev.nodes.push(node);
- });
- /**
- * Close
- */
- this.set(type + '.close', function () {
- var pos = this.position();
- var m = this.match(closeRegex);
- if (!m || !m[0]) return;
- var parent = this.pop(type);
- var node = pos({
- type: type + '.close',
- rest: this.input,
- suffix: m[1],
- val: m[0]
- });
- if (!this.isType(parent, type)) {
- if (this.options.strict) {
- throw new Error('missing opening "' + type + '"');
- }
- this.setCount--;
- node.escaped = true;
- return node;
- }
- if (node.suffix === '\\') {
- parent.escaped = true;
- node.escaped = true;
- }
- parent.nodes.push(node);
- _define(node, 'parent', parent);
- });
- return this;
- },
- /**
- * Capture end-of-string
- */
- eos: function eos() {
- var pos = this.position();
- if (this.input) return;
- var prev = this.prev();
- while (prev.type !== 'root' && !prev.visited) {
- if (this.options.strict === true) {
- throw new SyntaxError('invalid syntax:' + util.inspect(prev, null, 2));
- }
- if (!hasDelims(prev)) {
- prev.parent.escaped = true;
- prev.escaped = true;
- }
- visit(prev, function (node) {
- if (!hasDelims(node.parent)) {
- node.parent.escaped = true;
- node.escaped = true;
- }
- });
- prev = prev.parent;
- }
- var tok = pos({
- type: 'eos',
- val: this.append || ''
- });
- _define(tok, 'parent', this.ast);
- return tok;
- },
- /**
- * Run parsers to advance the cursor position
- */
- next: function next() {
- var parsed = this.parsed;
- var len = this.types.length;
- var idx = -1;
- var tok;
- while (++idx < len) {
- if (tok = this.parsers[this.types[idx]].call(this)) {
- _define(tok, 'rest', this.input);
- _define(tok, 'parsed', parsed);
- this.last = tok;
- return tok;
- }
- }
- },
- /**
- * Parse the given string.
- * @return {Array}
- */
- parse: function parse(input) {
- if (typeof input !== 'string') {
- throw new TypeError('expected a string');
- }
- this.init(this.options);
- this.orig = input;
- this.input = input;
- var self = this;
- function parse() {
- // check input before calling `.next()`
- input = self.input; // get the next AST ndoe
- var node = self.next();
- if (node) {
- var prev = self.prev();
- if (prev) {
- _define(node, 'parent', prev);
- if (prev.nodes) {
- prev.nodes.push(node);
- }
- }
- if (self.sets.hasOwnProperty(prev.type)) {
- self.currentType = prev.type;
- }
- } // if we got here but input is not changed, throw an error
- if (self.input && input === self.input) {
- throw new Error('no parsers registered for: "' + self.input.slice(0, 5) + '"');
- }
- }
- while (this.input) {
- parse();
- }
- if (this.stack.length && this.options.strict) {
- var node = this.stack.pop();
- throw this.error('missing opening ' + node.type + ': "' + this.orig + '"');
- }
- var eos = this.eos();
- var tok = this.prev();
- if (tok.type !== 'eos') {
- this.ast.nodes.push(eos);
- }
- return this.ast;
- }
- };
- /**
- * Visit `node` with the given `fn`
- */
- function visit(node, fn) {
- if (!node.visited) {
- _define(node, 'visited', true);
- return node.nodes ? mapVisit(node.nodes, fn) : fn(node);
- }
- return node;
- }
- /**
- * Map visit over array of `nodes`.
- */
- function mapVisit(nodes, fn) {
- var len = nodes.length;
- var idx = -1;
- while (++idx < len) {
- visit(nodes[idx], fn);
- }
- }
- function hasOpen(node) {
- return node.nodes && node.nodes[0].type === node.type + '.open';
- }
- function hasClose(node) {
- return node.nodes && utils.last(node.nodes).type === node.type + '.close';
- }
- function hasDelims(node) {
- return hasOpen(node) && hasClose(node);
- }
- /**
- * Expose `Parser`
- */
- module.exports = Parser;
- /* WEBPACK VAR INJECTION */}.call(this, "/index.js"))
- /***/ }),
- /***/ "./node_modules/snapdragon/lib/position.js":
- /*!*************************************************!*\
- !*** ./node_modules/snapdragon/lib/position.js ***!
- \*************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var define = __webpack_require__(/*! define-property */ "./node_modules/define-property/index.js");
- /**
- * Store position for a node
- */
- module.exports = function Position(start, parser) {
- this.start = start;
- this.end = {
- line: parser.line,
- column: parser.column
- };
- define(this, 'content', parser.orig);
- define(this, 'source', parser.options.source);
- };
- /***/ }),
- /***/ "./node_modules/snapdragon/lib/source-maps.js":
- /*!****************************************************!*\
- !*** ./node_modules/snapdragon/lib/source-maps.js ***!
- \****************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var fs = __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js");
- var path = __webpack_require__(/*! path */ "./node_modules/path-browserify/index.js");
- var define = __webpack_require__(/*! define-property */ "./node_modules/define-property/index.js");
- var utils = __webpack_require__(/*! ./utils */ "./node_modules/snapdragon/lib/utils.js");
- /**
- * Expose `mixin()`.
- * This code is based on `source-maps-support.js` in reworkcss/css
- * https://github.com/reworkcss/css/blob/master/lib/stringify/source-map-support.js
- * Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>
- */
- module.exports = mixin;
- /**
- * Mixin source map support into `compiler`.
- *
- * @param {Object} `compiler`
- * @api public
- */
- function mixin(compiler) {
- define(compiler, '_comment', compiler.comment);
- compiler.map = new utils.SourceMap.SourceMapGenerator();
- compiler.position = {
- line: 1,
- column: 1
- };
- compiler.content = {};
- compiler.files = {};
- for (var key in exports) {
- define(compiler, key, exports[key]);
- }
- }
- /**
- * Update position.
- *
- * @param {String} str
- */
- exports.updatePosition = function (str) {
- var lines = str.match(/\n/g);
- if (lines) this.position.line += lines.length;
- var i = str.lastIndexOf('\n');
- this.position.column = ~i ? str.length - i : this.position.column + str.length;
- };
- /**
- * Emit `str` with `position`.
- *
- * @param {String} str
- * @param {Object} [pos]
- * @return {String}
- */
- exports.emit = function (str, node) {
- var position = node.position || {};
- var source = position.source;
- if (source) {
- if (position.filepath) {
- source = utils.unixify(position.filepath);
- }
- this.map.addMapping({
- source: source,
- generated: {
- line: this.position.line,
- column: Math.max(this.position.column - 1, 0)
- },
- original: {
- line: position.start.line,
- column: position.start.column - 1
- }
- });
- if (position.content) {
- this.addContent(source, position);
- }
- if (position.filepath) {
- this.addFile(source, position);
- }
- this.updatePosition(str);
- this.output += str;
- }
- return str;
- };
- /**
- * Adds a file to the source map output if it has not already been added
- * @param {String} `file`
- * @param {Object} `pos`
- */
- exports.addFile = function (file, position) {
- if (typeof position.content !== 'string') return;
- if (Object.prototype.hasOwnProperty.call(this.files, file)) return;
- this.files[file] = position.content;
- };
- /**
- * Adds a content source to the source map output if it has not already been added
- * @param {String} `source`
- * @param {Object} `position`
- */
- exports.addContent = function (source, position) {
- if (typeof position.content !== 'string') return;
- if (Object.prototype.hasOwnProperty.call(this.content, source)) return;
- this.map.setSourceContent(source, position.content);
- };
- /**
- * Applies any original source maps to the output and embeds the source file
- * contents in the source map.
- */
- exports.applySourceMaps = function () {
- Object.keys(this.files).forEach(function (file) {
- var content = this.files[file];
- this.map.setSourceContent(file, content);
- if (this.options.inputSourcemaps === true) {
- var originalMap = utils.sourceMapResolve.resolveSync(content, file, fs.readFileSync);
- if (originalMap) {
- var map = new utils.SourceMap.SourceMapConsumer(originalMap.map);
- var relativeTo = originalMap.sourcesRelativeTo;
- this.map.applySourceMap(map, file, utils.unixify(path.dirname(relativeTo)));
- }
- }
- }, this);
- };
- /**
- * Process comments, drops sourceMap comments.
- * @param {Object} node
- */
- exports.comment = function (node) {
- if (/^# sourceMappingURL=/.test(node.comment)) {
- return this.emit('', node.position);
- }
- return this._comment(node);
- };
- /***/ }),
- /***/ "./node_modules/snapdragon/lib/utils.js":
- /*!**********************************************!*\
- !*** ./node_modules/snapdragon/lib/utils.js ***!
- \**********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /**
- * Module dependencies
- */
- exports.extend = __webpack_require__(/*! extend-shallow */ "./node_modules/extend-shallow/index.js");
- exports.SourceMap = __webpack_require__(/*! source-map */ "./node_modules/snapdragon/node_modules/source-map/source-map.js");
- exports.sourceMapResolve = __webpack_require__(/*! source-map-resolve */ "./node_modules/source-map-resolve/source-map-resolve.js");
- /**
- * Convert backslash in the given string to forward slashes
- */
- exports.unixify = function (fp) {
- return fp.split(/\\+/).join('/');
- };
- /**
- * Return true if `val` is a non-empty string
- *
- * @param {String} `str`
- * @return {Boolean}
- */
- exports.isString = function (str) {
- return str && typeof str === 'string';
- };
- /**
- * Cast `val` to an array
- * @return {Array}
- */
- exports.arrayify = function (val) {
- if (typeof val === 'string') return [val];
- return val ? Array.isArray(val) ? val : [val] : [];
- };
- /**
- * Get the last `n` element from the given `array`
- * @param {Array} `array`
- * @return {*}
- */
- exports.last = function (arr, n) {
- return arr[arr.length - (n || 1)];
- };
- /***/ }),
- /***/ "./node_modules/snapdragon/node_modules/debug/src/browser.js":
- /*!*******************************************************************!*\
- !*** ./node_modules/snapdragon/node_modules/debug/src/browser.js ***!
- \*******************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(process) {
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- /**
- * This is the web browser implementation of `debug()`.
- *
- * Expose `debug()` as the module.
- */
- exports = module.exports = __webpack_require__(/*! ./debug */ "./node_modules/snapdragon/node_modules/debug/src/debug.js");
- exports.log = log;
- exports.formatArgs = formatArgs;
- exports.save = save;
- exports.load = load;
- exports.useColors = useColors;
- exports.storage = 'undefined' != typeof chrome && 'undefined' != typeof chrome.storage ? chrome.storage.local : localstorage();
- /**
- * Colors.
- */
- exports.colors = ['lightseagreen', 'forestgreen', 'goldenrod', 'dodgerblue', 'darkorchid', 'crimson'];
- /**
- * Currently only WebKit-based Web Inspectors, Firefox >= v31,
- * and the Firebug extension (any Firefox version) are known
- * to support "%c" CSS customizations.
- *
- * TODO: add a `localStorage` variable to explicitly enable/disable colors
- */
- function useColors() {
- // NB: In an Electron preload script, document will be defined but not fully
- // initialized. Since we know we're in Chrome, we'll just detect this case
- // explicitly
- if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {
- return true;
- } // is webkit? http://stackoverflow.com/a/16459606/376773
- // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
- return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // is firebug? http://stackoverflow.com/a/398120/376773
- typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // is firefox >= v31?
- // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
- typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // double check webkit in userAgent just in case we are in a worker
- typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
- }
- /**
- * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
- */
- exports.formatters.j = function (v) {
- try {
- return JSON.stringify(v);
- } catch (err) {
- return '[UnexpectedJSONParseError]: ' + err.message;
- }
- };
- /**
- * Colorize log arguments if enabled.
- *
- * @api public
- */
- function formatArgs(args) {
- var useColors = this.useColors;
- args[0] = (useColors ? '%c' : '') + this.namespace + (useColors ? ' %c' : ' ') + args[0] + (useColors ? '%c ' : ' ') + '+' + exports.humanize(this.diff);
- if (!useColors) return;
- var c = 'color: ' + this.color;
- args.splice(1, 0, c, 'color: inherit'); // the final "%c" is somewhat tricky, because there could be other
- // arguments passed either before or after the %c, so we need to
- // figure out the correct index to insert the CSS into
- var index = 0;
- var lastC = 0;
- args[0].replace(/%[a-zA-Z%]/g, function (match) {
- if ('%%' === match) return;
- index++;
- if ('%c' === match) {
- // we only are interested in the *last* %c
- // (the user may have provided their own)
- lastC = index;
- }
- });
- args.splice(lastC, 0, c);
- }
- /**
- * Invokes `console.log()` when available.
- * No-op when `console.log` is not a "function".
- *
- * @api public
- */
- function log() {
- // this hackery is required for IE8/9, where
- // the `console.log` function doesn't have 'apply'
- return 'object' === (typeof console === "undefined" ? "undefined" : _typeof(console)) && console.log && Function.prototype.apply.call(console.log, console, arguments);
- }
- /**
- * Save `namespaces`.
- *
- * @param {String} namespaces
- * @api private
- */
- function save(namespaces) {
- try {
- if (null == namespaces) {
- exports.storage.removeItem('debug');
- } else {
- exports.storage.debug = namespaces;
- }
- } catch (e) {}
- }
- /**
- * Load `namespaces`.
- *
- * @return {String} returns the previously persisted debug modes
- * @api private
- */
- function load() {
- var r;
- try {
- r = exports.storage.debug;
- } catch (e) {} // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
- if (!r && typeof process !== 'undefined' && 'env' in process) {
- r = process.env.DEBUG;
- }
- return r;
- }
- /**
- * Enable namespaces listed in `localStorage.debug` initially.
- */
- exports.enable(load());
- /**
- * Localstorage attempts to return the localstorage.
- *
- * This is necessary because safari throws
- * when a user disables cookies/localstorage
- * and you attempt to access it.
- *
- * @return {LocalStorage}
- * @api private
- */
- function localstorage() {
- try {
- return window.localStorage;
- } catch (e) {}
- }
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../process/browser.js */ "./node_modules/process/browser.js")))
- /***/ }),
- /***/ "./node_modules/snapdragon/node_modules/debug/src/debug.js":
- /*!*****************************************************************!*\
- !*** ./node_modules/snapdragon/node_modules/debug/src/debug.js ***!
- \*****************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /**
- * This is the common logic for both the Node.js and web browser
- * implementations of `debug()`.
- *
- * Expose `debug()` as the module.
- */
- exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
- exports.coerce = coerce;
- exports.disable = disable;
- exports.enable = enable;
- exports.enabled = enabled;
- exports.humanize = __webpack_require__(/*! ms */ "./node_modules/snapdragon/node_modules/ms/index.js");
- /**
- * The currently active debug mode names, and names to skip.
- */
- exports.names = [];
- exports.skips = [];
- /**
- * Map of special "%n" handling functions, for the debug "format" argument.
- *
- * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
- */
- exports.formatters = {};
- /**
- * Previous log timestamp.
- */
- var prevTime;
- /**
- * Select a color.
- * @param {String} namespace
- * @return {Number}
- * @api private
- */
- function selectColor(namespace) {
- var hash = 0,
- i;
- for (i in namespace) {
- hash = (hash << 5) - hash + namespace.charCodeAt(i);
- hash |= 0; // Convert to 32bit integer
- }
- return exports.colors[Math.abs(hash) % exports.colors.length];
- }
- /**
- * Create a debugger with the given `namespace`.
- *
- * @param {String} namespace
- * @return {Function}
- * @api public
- */
- function createDebug(namespace) {
- function debug() {
- // disabled?
- if (!debug.enabled) return;
- var self = debug; // set `diff` timestamp
- var curr = +new Date();
- var ms = curr - (prevTime || curr);
- self.diff = ms;
- self.prev = prevTime;
- self.curr = curr;
- prevTime = curr; // turn the `arguments` into a proper Array
- var args = new Array(arguments.length);
- for (var i = 0; i < args.length; i++) {
- args[i] = arguments[i];
- }
- args[0] = exports.coerce(args[0]);
- if ('string' !== typeof args[0]) {
- // anything else let's inspect with %O
- args.unshift('%O');
- } // apply any `formatters` transformations
- var index = 0;
- args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
- // if we encounter an escaped % then don't increase the array index
- if (match === '%%') return match;
- index++;
- var formatter = exports.formatters[format];
- if ('function' === typeof formatter) {
- var val = args[index];
- match = formatter.call(self, val); // now we need to remove `args[index]` since it's inlined in the `format`
- args.splice(index, 1);
- index--;
- }
- return match;
- }); // apply env-specific formatting (colors, etc.)
- exports.formatArgs.call(self, args);
- var logFn = debug.log || exports.log || console.log.bind(console);
- logFn.apply(self, args);
- }
- debug.namespace = namespace;
- debug.enabled = exports.enabled(namespace);
- debug.useColors = exports.useColors();
- debug.color = selectColor(namespace); // env-specific initialization logic for debug instances
- if ('function' === typeof exports.init) {
- exports.init(debug);
- }
- return debug;
- }
- /**
- * Enables a debug mode by namespaces. This can include modes
- * separated by a colon and wildcards.
- *
- * @param {String} namespaces
- * @api public
- */
- function enable(namespaces) {
- exports.save(namespaces);
- exports.names = [];
- exports.skips = [];
- var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
- var len = split.length;
- for (var i = 0; i < len; i++) {
- if (!split[i]) continue; // ignore empty strings
- namespaces = split[i].replace(/\*/g, '.*?');
- if (namespaces[0] === '-') {
- exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
- } else {
- exports.names.push(new RegExp('^' + namespaces + '$'));
- }
- }
- }
- /**
- * Disable debug output.
- *
- * @api public
- */
- function disable() {
- exports.enable('');
- }
- /**
- * Returns true if the given mode name is enabled, false otherwise.
- *
- * @param {String} name
- * @return {Boolean}
- * @api public
- */
- function enabled(name) {
- var i, len;
- for (i = 0, len = exports.skips.length; i < len; i++) {
- if (exports.skips[i].test(name)) {
- return false;
- }
- }
- for (i = 0, len = exports.names.length; i < len; i++) {
- if (exports.names[i].test(name)) {
- return true;
- }
- }
- return false;
- }
- /**
- * Coerce `val`.
- *
- * @param {Mixed} val
- * @return {Mixed}
- * @api private
- */
- function coerce(val) {
- if (val instanceof Error) return val.stack || val.message;
- return val;
- }
- /***/ }),
- /***/ "./node_modules/snapdragon/node_modules/ms/index.js":
- /*!**********************************************************!*\
- !*** ./node_modules/snapdragon/node_modules/ms/index.js ***!
- \**********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- /**
- * Helpers.
- */
- var s = 1000;
- var m = s * 60;
- var h = m * 60;
- var d = h * 24;
- var y = d * 365.25;
- /**
- * Parse or format the given `val`.
- *
- * Options:
- *
- * - `long` verbose formatting [false]
- *
- * @param {String|Number} val
- * @param {Object} [options]
- * @throws {Error} throw an error if val is not a non-empty string or a number
- * @return {String|Number}
- * @api public
- */
- module.exports = function (val, options) {
- options = options || {};
- var type = _typeof(val);
- if (type === 'string' && val.length > 0) {
- return parse(val);
- } else if (type === 'number' && isNaN(val) === false) {
- return options.long ? fmtLong(val) : fmtShort(val);
- }
- throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val));
- };
- /**
- * Parse the given `str` and return milliseconds.
- *
- * @param {String} str
- * @return {Number}
- * @api private
- */
- function parse(str) {
- str = String(str);
- if (str.length > 100) {
- return;
- }
- var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str);
- if (!match) {
- return;
- }
- var n = parseFloat(match[1]);
- var type = (match[2] || 'ms').toLowerCase();
- switch (type) {
- case 'years':
- case 'year':
- case 'yrs':
- case 'yr':
- case 'y':
- return n * y;
- case 'days':
- case 'day':
- case 'd':
- return n * d;
- case 'hours':
- case 'hour':
- case 'hrs':
- case 'hr':
- case 'h':
- return n * h;
- case 'minutes':
- case 'minute':
- case 'mins':
- case 'min':
- case 'm':
- return n * m;
- case 'seconds':
- case 'second':
- case 'secs':
- case 'sec':
- case 's':
- return n * s;
- case 'milliseconds':
- case 'millisecond':
- case 'msecs':
- case 'msec':
- case 'ms':
- return n;
- default:
- return undefined;
- }
- }
- /**
- * Short format for `ms`.
- *
- * @param {Number} ms
- * @return {String}
- * @api private
- */
- function fmtShort(ms) {
- if (ms >= d) {
- return Math.round(ms / d) + 'd';
- }
- if (ms >= h) {
- return Math.round(ms / h) + 'h';
- }
- if (ms >= m) {
- return Math.round(ms / m) + 'm';
- }
- if (ms >= s) {
- return Math.round(ms / s) + 's';
- }
- return ms + 'ms';
- }
- /**
- * Long format for `ms`.
- *
- * @param {Number} ms
- * @return {String}
- * @api private
- */
- function fmtLong(ms) {
- return plural(ms, d, 'day') || plural(ms, h, 'hour') || plural(ms, m, 'minute') || plural(ms, s, 'second') || ms + ' ms';
- }
- /**
- * Pluralization helper.
- */
- function plural(ms, n, name) {
- if (ms < n) {
- return;
- }
- if (ms < n * 1.5) {
- return Math.floor(ms / n) + ' ' + name;
- }
- return Math.ceil(ms / n) + ' ' + name + 's';
- }
- /***/ }),
- /***/ "./node_modules/snapdragon/node_modules/source-map/lib/array-set.js":
- /*!**************************************************************************!*\
- !*** ./node_modules/snapdragon/node_modules/source-map/lib/array-set.js ***!
- \**************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* -*- Mode: js; js-indent-level: 2; -*- */
- /*
- * Copyright 2011 Mozilla Foundation and contributors
- * Licensed under the New BSD license. See LICENSE or:
- * http://opensource.org/licenses/BSD-3-Clause
- */
- var util = __webpack_require__(/*! ./util */ "./node_modules/snapdragon/node_modules/source-map/lib/util.js");
- var has = Object.prototype.hasOwnProperty;
- var hasNativeMap = typeof Map !== "undefined";
- /**
- * A data structure which is a combination of an array and a set. Adding a new
- * member is O(1), testing for membership is O(1), and finding the index of an
- * element is O(1). Removing elements from the set is not supported. Only
- * strings are supported for membership.
- */
- function ArraySet() {
- this._array = [];
- this._set = hasNativeMap ? new Map() : Object.create(null);
- }
- /**
- * Static method for creating ArraySet instances from an existing array.
- */
- ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
- var set = new ArraySet();
- for (var i = 0, len = aArray.length; i < len; i++) {
- set.add(aArray[i], aAllowDuplicates);
- }
- return set;
- };
- /**
- * Return how many unique items are in this ArraySet. If duplicates have been
- * added, than those do not count towards the size.
- *
- * @returns Number
- */
- ArraySet.prototype.size = function ArraySet_size() {
- return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
- };
- /**
- * Add the given string to this set.
- *
- * @param String aStr
- */
- ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
- var sStr = hasNativeMap ? aStr : util.toSetString(aStr);
- var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);
- var idx = this._array.length;
- if (!isDuplicate || aAllowDuplicates) {
- this._array.push(aStr);
- }
- if (!isDuplicate) {
- if (hasNativeMap) {
- this._set.set(aStr, idx);
- } else {
- this._set[sStr] = idx;
- }
- }
- };
- /**
- * Is the given string a member of this set?
- *
- * @param String aStr
- */
- ArraySet.prototype.has = function ArraySet_has(aStr) {
- if (hasNativeMap) {
- return this._set.has(aStr);
- } else {
- var sStr = util.toSetString(aStr);
- return has.call(this._set, sStr);
- }
- };
- /**
- * What is the index of the given string in the array?
- *
- * @param String aStr
- */
- ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {
- if (hasNativeMap) {
- var idx = this._set.get(aStr);
- if (idx >= 0) {
- return idx;
- }
- } else {
- var sStr = util.toSetString(aStr);
- if (has.call(this._set, sStr)) {
- return this._set[sStr];
- }
- }
- throw new Error('"' + aStr + '" is not in the set.');
- };
- /**
- * What is the element at the given index?
- *
- * @param Number aIdx
- */
- ArraySet.prototype.at = function ArraySet_at(aIdx) {
- if (aIdx >= 0 && aIdx < this._array.length) {
- return this._array[aIdx];
- }
- throw new Error('No element indexed by ' + aIdx);
- };
- /**
- * Returns the array representation of this set (which has the proper indices
- * indicated by indexOf). Note that this is a copy of the internal array used
- * for storing the members so that no one can mess with internal state.
- */
- ArraySet.prototype.toArray = function ArraySet_toArray() {
- return this._array.slice();
- };
- exports.ArraySet = ArraySet;
- /***/ }),
- /***/ "./node_modules/snapdragon/node_modules/source-map/lib/base64-vlq.js":
- /*!***************************************************************************!*\
- !*** ./node_modules/snapdragon/node_modules/source-map/lib/base64-vlq.js ***!
- \***************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* -*- Mode: js; js-indent-level: 2; -*- */
- /*
- * Copyright 2011 Mozilla Foundation and contributors
- * Licensed under the New BSD license. See LICENSE or:
- * http://opensource.org/licenses/BSD-3-Clause
- *
- * Based on the Base 64 VLQ implementation in Closure Compiler:
- * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
- *
- * Copyright 2011 The Closure Compiler Authors. All rights reserved.
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- var base64 = __webpack_require__(/*! ./base64 */ "./node_modules/snapdragon/node_modules/source-map/lib/base64.js"); // A single base 64 digit can contain 6 bits of data. For the base 64 variable
- // length quantities we use in the source map spec, the first bit is the sign,
- // the next four bits are the actual value, and the 6th bit is the
- // continuation bit. The continuation bit tells us whether there are more
- // digits in this value following this digit.
- //
- // Continuation
- // | Sign
- // | |
- // V V
- // 101011
- var VLQ_BASE_SHIFT = 5; // binary: 100000
- var VLQ_BASE = 1 << VLQ_BASE_SHIFT; // binary: 011111
- var VLQ_BASE_MASK = VLQ_BASE - 1; // binary: 100000
- var VLQ_CONTINUATION_BIT = VLQ_BASE;
- /**
- * Converts from a two-complement value to a value where the sign bit is
- * placed in the least significant bit. For example, as decimals:
- * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
- * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
- */
- function toVLQSigned(aValue) {
- return aValue < 0 ? (-aValue << 1) + 1 : (aValue << 1) + 0;
- }
- /**
- * Converts to a two-complement value from a value where the sign bit is
- * placed in the least significant bit. For example, as decimals:
- * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
- * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
- */
- function fromVLQSigned(aValue) {
- var isNegative = (aValue & 1) === 1;
- var shifted = aValue >> 1;
- return isNegative ? -shifted : shifted;
- }
- /**
- * Returns the base 64 VLQ encoded value.
- */
- exports.encode = function base64VLQ_encode(aValue) {
- var encoded = "";
- var digit;
- var vlq = toVLQSigned(aValue);
- do {
- digit = vlq & VLQ_BASE_MASK;
- vlq >>>= VLQ_BASE_SHIFT;
- if (vlq > 0) {
- // There are still more digits in this value, so we must make sure the
- // continuation bit is marked.
- digit |= VLQ_CONTINUATION_BIT;
- }
- encoded += base64.encode(digit);
- } while (vlq > 0);
- return encoded;
- };
- /**
- * Decodes the next base 64 VLQ value from the given string and returns the
- * value and the rest of the string via the out parameter.
- */
- exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
- var strLen = aStr.length;
- var result = 0;
- var shift = 0;
- var continuation, digit;
- do {
- if (aIndex >= strLen) {
- throw new Error("Expected more digits in base 64 VLQ value.");
- }
- digit = base64.decode(aStr.charCodeAt(aIndex++));
- if (digit === -1) {
- throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
- }
- continuation = !!(digit & VLQ_CONTINUATION_BIT);
- digit &= VLQ_BASE_MASK;
- result = result + (digit << shift);
- shift += VLQ_BASE_SHIFT;
- } while (continuation);
- aOutParam.value = fromVLQSigned(result);
- aOutParam.rest = aIndex;
- };
- /***/ }),
- /***/ "./node_modules/snapdragon/node_modules/source-map/lib/base64.js":
- /*!***********************************************************************!*\
- !*** ./node_modules/snapdragon/node_modules/source-map/lib/base64.js ***!
- \***********************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* -*- Mode: js; js-indent-level: 2; -*- */
- /*
- * Copyright 2011 Mozilla Foundation and contributors
- * Licensed under the New BSD license. See LICENSE or:
- * http://opensource.org/licenses/BSD-3-Clause
- */
- var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
- /**
- * Encode an integer in the range of 0 to 63 to a single base 64 digit.
- */
- exports.encode = function (number) {
- if (0 <= number && number < intToCharMap.length) {
- return intToCharMap[number];
- }
- throw new TypeError("Must be between 0 and 63: " + number);
- };
- /**
- * Decode a single base 64 character code digit to an integer. Returns -1 on
- * failure.
- */
- exports.decode = function (charCode) {
- var bigA = 65; // 'A'
- var bigZ = 90; // 'Z'
- var littleA = 97; // 'a'
- var littleZ = 122; // 'z'
- var zero = 48; // '0'
- var nine = 57; // '9'
- var plus = 43; // '+'
- var slash = 47; // '/'
- var littleOffset = 26;
- var numberOffset = 52; // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
- if (bigA <= charCode && charCode <= bigZ) {
- return charCode - bigA;
- } // 26 - 51: abcdefghijklmnopqrstuvwxyz
- if (littleA <= charCode && charCode <= littleZ) {
- return charCode - littleA + littleOffset;
- } // 52 - 61: 0123456789
- if (zero <= charCode && charCode <= nine) {
- return charCode - zero + numberOffset;
- } // 62: +
- if (charCode == plus) {
- return 62;
- } // 63: /
- if (charCode == slash) {
- return 63;
- } // Invalid base64 digit.
- return -1;
- };
- /***/ }),
- /***/ "./node_modules/snapdragon/node_modules/source-map/lib/binary-search.js":
- /*!******************************************************************************!*\
- !*** ./node_modules/snapdragon/node_modules/source-map/lib/binary-search.js ***!
- \******************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* -*- Mode: js; js-indent-level: 2; -*- */
- /*
- * Copyright 2011 Mozilla Foundation and contributors
- * Licensed under the New BSD license. See LICENSE or:
- * http://opensource.org/licenses/BSD-3-Clause
- */
- exports.GREATEST_LOWER_BOUND = 1;
- exports.LEAST_UPPER_BOUND = 2;
- /**
- * Recursive implementation of binary search.
- *
- * @param aLow Indices here and lower do not contain the needle.
- * @param aHigh Indices here and higher do not contain the needle.
- * @param aNeedle The element being searched for.
- * @param aHaystack The non-empty array being searched.
- * @param aCompare Function which takes two elements and returns -1, 0, or 1.
- * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
- * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
- * closest element that is smaller than or greater than the one we are
- * searching for, respectively, if the exact element cannot be found.
- */
- function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
- // This function terminates when one of the following is true:
- //
- // 1. We find the exact element we are looking for.
- //
- // 2. We did not find the exact element, but we can return the index of
- // the next-closest element.
- //
- // 3. We did not find the exact element, and there is no next-closest
- // element than the one we are searching for, so we return -1.
- var mid = Math.floor((aHigh - aLow) / 2) + aLow;
- var cmp = aCompare(aNeedle, aHaystack[mid], true);
- if (cmp === 0) {
- // Found the element we are looking for.
- return mid;
- } else if (cmp > 0) {
- // Our needle is greater than aHaystack[mid].
- if (aHigh - mid > 1) {
- // The element is in the upper half.
- return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
- } // The exact needle element was not found in this haystack. Determine if
- // we are in termination case (3) or (2) and return the appropriate thing.
- if (aBias == exports.LEAST_UPPER_BOUND) {
- return aHigh < aHaystack.length ? aHigh : -1;
- } else {
- return mid;
- }
- } else {
- // Our needle is less than aHaystack[mid].
- if (mid - aLow > 1) {
- // The element is in the lower half.
- return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
- } // we are in termination case (3) or (2) and return the appropriate thing.
- if (aBias == exports.LEAST_UPPER_BOUND) {
- return mid;
- } else {
- return aLow < 0 ? -1 : aLow;
- }
- }
- }
- /**
- * This is an implementation of binary search which will always try and return
- * the index of the closest element if there is no exact hit. This is because
- * mappings between original and generated line/col pairs are single points,
- * and there is an implicit region between each of them, so a miss just means
- * that you aren't on the very start of a region.
- *
- * @param aNeedle The element you are looking for.
- * @param aHaystack The array that is being searched.
- * @param aCompare A function which takes the needle and an element in the
- * array and returns -1, 0, or 1 depending on whether the needle is less
- * than, equal to, or greater than the element, respectively.
- * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
- * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
- * closest element that is smaller than or greater than the one we are
- * searching for, respectively, if the exact element cannot be found.
- * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.
- */
- exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {
- if (aHaystack.length === 0) {
- return -1;
- }
- var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, aCompare, aBias || exports.GREATEST_LOWER_BOUND);
- if (index < 0) {
- return -1;
- } // We have found either the exact element, or the next-closest element than
- // the one we are searching for. However, there may be more than one such
- // element. Make sure we always return the smallest of these.
- while (index - 1 >= 0) {
- if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
- break;
- }
- --index;
- }
- return index;
- };
- /***/ }),
- /***/ "./node_modules/snapdragon/node_modules/source-map/lib/mapping-list.js":
- /*!*****************************************************************************!*\
- !*** ./node_modules/snapdragon/node_modules/source-map/lib/mapping-list.js ***!
- \*****************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* -*- Mode: js; js-indent-level: 2; -*- */
- /*
- * Copyright 2014 Mozilla Foundation and contributors
- * Licensed under the New BSD license. See LICENSE or:
- * http://opensource.org/licenses/BSD-3-Clause
- */
- var util = __webpack_require__(/*! ./util */ "./node_modules/snapdragon/node_modules/source-map/lib/util.js");
- /**
- * Determine whether mappingB is after mappingA with respect to generated
- * position.
- */
- function generatedPositionAfter(mappingA, mappingB) {
- // Optimized for most common case
- var lineA = mappingA.generatedLine;
- var lineB = mappingB.generatedLine;
- var columnA = mappingA.generatedColumn;
- var columnB = mappingB.generatedColumn;
- return lineB > lineA || lineB == lineA && columnB >= columnA || util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
- }
- /**
- * A data structure to provide a sorted view of accumulated mappings in a
- * performance conscious manner. It trades a neglibable overhead in general
- * case for a large speedup in case of mappings being added in order.
- */
- function MappingList() {
- this._array = [];
- this._sorted = true; // Serves as infimum
- this._last = {
- generatedLine: -1,
- generatedColumn: 0
- };
- }
- /**
- * Iterate through internal items. This method takes the same arguments that
- * `Array.prototype.forEach` takes.
- *
- * NOTE: The order of the mappings is NOT guaranteed.
- */
- MappingList.prototype.unsortedForEach = function MappingList_forEach(aCallback, aThisArg) {
- this._array.forEach(aCallback, aThisArg);
- };
- /**
- * Add the given source mapping.
- *
- * @param Object aMapping
- */
- MappingList.prototype.add = function MappingList_add(aMapping) {
- if (generatedPositionAfter(this._last, aMapping)) {
- this._last = aMapping;
- this._array.push(aMapping);
- } else {
- this._sorted = false;
- this._array.push(aMapping);
- }
- };
- /**
- * Returns the flat, sorted array of mappings. The mappings are sorted by
- * generated position.
- *
- * WARNING: This method returns internal data without copying, for
- * performance. The return value must NOT be mutated, and should be treated as
- * an immutable borrow. If you want to take ownership, you must make your own
- * copy.
- */
- MappingList.prototype.toArray = function MappingList_toArray() {
- if (!this._sorted) {
- this._array.sort(util.compareByGeneratedPositionsInflated);
- this._sorted = true;
- }
- return this._array;
- };
- exports.MappingList = MappingList;
- /***/ }),
- /***/ "./node_modules/snapdragon/node_modules/source-map/lib/quick-sort.js":
- /*!***************************************************************************!*\
- !*** ./node_modules/snapdragon/node_modules/source-map/lib/quick-sort.js ***!
- \***************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* -*- Mode: js; js-indent-level: 2; -*- */
- /*
- * Copyright 2011 Mozilla Foundation and contributors
- * Licensed under the New BSD license. See LICENSE or:
- * http://opensource.org/licenses/BSD-3-Clause
- */
- // It turns out that some (most?) JavaScript engines don't self-host
- // `Array.prototype.sort`. This makes sense because C++ will likely remain
- // faster than JS when doing raw CPU-intensive sorting. However, when using a
- // custom comparator function, calling back and forth between the VM's C++ and
- // JIT'd JS is rather slow *and* loses JIT type information, resulting in
- // worse generated code for the comparator function than would be optimal. In
- // fact, when sorting with a comparator, these costs outweigh the benefits of
- // sorting in C++. By using our own JS-implemented Quick Sort (below), we get
- // a ~3500ms mean speed-up in `bench/bench.html`.
- /**
- * Swap the elements indexed by `x` and `y` in the array `ary`.
- *
- * @param {Array} ary
- * The array.
- * @param {Number} x
- * The index of the first item.
- * @param {Number} y
- * The index of the second item.
- */
- function swap(ary, x, y) {
- var temp = ary[x];
- ary[x] = ary[y];
- ary[y] = temp;
- }
- /**
- * Returns a random integer within the range `low .. high` inclusive.
- *
- * @param {Number} low
- * The lower bound on the range.
- * @param {Number} high
- * The upper bound on the range.
- */
- function randomIntInRange(low, high) {
- return Math.round(low + Math.random() * (high - low));
- }
- /**
- * The Quick Sort algorithm.
- *
- * @param {Array} ary
- * An array to sort.
- * @param {function} comparator
- * Function to use to compare two items.
- * @param {Number} p
- * Start index of the array
- * @param {Number} r
- * End index of the array
- */
- function doQuickSort(ary, comparator, p, r) {
- // If our lower bound is less than our upper bound, we (1) partition the
- // array into two pieces and (2) recurse on each half. If it is not, this is
- // the empty array and our base case.
- if (p < r) {
- // (1) Partitioning.
- //
- // The partitioning chooses a pivot between `p` and `r` and moves all
- // elements that are less than or equal to the pivot to the before it, and
- // all the elements that are greater than it after it. The effect is that
- // once partition is done, the pivot is in the exact place it will be when
- // the array is put in sorted order, and it will not need to be moved
- // again. This runs in O(n) time.
- // Always choose a random pivot so that an input array which is reverse
- // sorted does not cause O(n^2) running time.
- var pivotIndex = randomIntInRange(p, r);
- var i = p - 1;
- swap(ary, pivotIndex, r);
- var pivot = ary[r]; // Immediately after `j` is incremented in this loop, the following hold
- // true:
- //
- // * Every element in `ary[p .. i]` is less than or equal to the pivot.
- //
- // * Every element in `ary[i+1 .. j-1]` is greater than the pivot.
- for (var j = p; j < r; j++) {
- if (comparator(ary[j], pivot) <= 0) {
- i += 1;
- swap(ary, i, j);
- }
- }
- swap(ary, i + 1, j);
- var q = i + 1; // (2) Recurse on each half.
- doQuickSort(ary, comparator, p, q - 1);
- doQuickSort(ary, comparator, q + 1, r);
- }
- }
- /**
- * Sort the given array in-place with the given comparator function.
- *
- * @param {Array} ary
- * An array to sort.
- * @param {function} comparator
- * Function to use to compare two items.
- */
- exports.quickSort = function (ary, comparator) {
- doQuickSort(ary, comparator, 0, ary.length - 1);
- };
- /***/ }),
- /***/ "./node_modules/snapdragon/node_modules/source-map/lib/source-map-consumer.js":
- /*!************************************************************************************!*\
- !*** ./node_modules/snapdragon/node_modules/source-map/lib/source-map-consumer.js ***!
- \************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* -*- Mode: js; js-indent-level: 2; -*- */
- /*
- * Copyright 2011 Mozilla Foundation and contributors
- * Licensed under the New BSD license. See LICENSE or:
- * http://opensource.org/licenses/BSD-3-Clause
- */
- var util = __webpack_require__(/*! ./util */ "./node_modules/snapdragon/node_modules/source-map/lib/util.js");
- var binarySearch = __webpack_require__(/*! ./binary-search */ "./node_modules/snapdragon/node_modules/source-map/lib/binary-search.js");
- var ArraySet = __webpack_require__(/*! ./array-set */ "./node_modules/snapdragon/node_modules/source-map/lib/array-set.js").ArraySet;
- var base64VLQ = __webpack_require__(/*! ./base64-vlq */ "./node_modules/snapdragon/node_modules/source-map/lib/base64-vlq.js");
- var quickSort = __webpack_require__(/*! ./quick-sort */ "./node_modules/snapdragon/node_modules/source-map/lib/quick-sort.js").quickSort;
- function SourceMapConsumer(aSourceMap) {
- var sourceMap = aSourceMap;
- if (typeof aSourceMap === 'string') {
- sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, ''));
- }
- return sourceMap.sections != null ? new IndexedSourceMapConsumer(sourceMap) : new BasicSourceMapConsumer(sourceMap);
- }
- SourceMapConsumer.fromSourceMap = function (aSourceMap) {
- return BasicSourceMapConsumer.fromSourceMap(aSourceMap);
- };
- /**
- * The version of the source mapping spec that we are consuming.
- */
- SourceMapConsumer.prototype._version = 3; // `__generatedMappings` and `__originalMappings` are arrays that hold the
- // parsed mapping coordinates from the source map's "mappings" attribute. They
- // are lazily instantiated, accessed via the `_generatedMappings` and
- // `_originalMappings` getters respectively, and we only parse the mappings
- // and create these arrays once queried for a source location. We jump through
- // these hoops because there can be many thousands of mappings, and parsing
- // them is expensive, so we only want to do it if we must.
- //
- // Each object in the arrays is of the form:
- //
- // {
- // generatedLine: The line number in the generated code,
- // generatedColumn: The column number in the generated code,
- // source: The path to the original source file that generated this
- // chunk of code,
- // originalLine: The line number in the original source that
- // corresponds to this chunk of generated code,
- // originalColumn: The column number in the original source that
- // corresponds to this chunk of generated code,
- // name: The name of the original symbol which generated this chunk of
- // code.
- // }
- //
- // All properties except for `generatedLine` and `generatedColumn` can be
- // `null`.
- //
- // `_generatedMappings` is ordered by the generated positions.
- //
- // `_originalMappings` is ordered by the original positions.
- SourceMapConsumer.prototype.__generatedMappings = null;
- Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {
- get: function get() {
- if (!this.__generatedMappings) {
- this._parseMappings(this._mappings, this.sourceRoot);
- }
- return this.__generatedMappings;
- }
- });
- SourceMapConsumer.prototype.__originalMappings = null;
- Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {
- get: function get() {
- if (!this.__originalMappings) {
- this._parseMappings(this._mappings, this.sourceRoot);
- }
- return this.__originalMappings;
- }
- });
- SourceMapConsumer.prototype._charIsMappingSeparator = function SourceMapConsumer_charIsMappingSeparator(aStr, index) {
- var c = aStr.charAt(index);
- return c === ";" || c === ",";
- };
- /**
- * Parse the mappings in a string in to a data structure which we can easily
- * query (the ordered arrays in the `this.__generatedMappings` and
- * `this.__originalMappings` properties).
- */
- SourceMapConsumer.prototype._parseMappings = function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
- throw new Error("Subclasses must implement _parseMappings");
- };
- SourceMapConsumer.GENERATED_ORDER = 1;
- SourceMapConsumer.ORIGINAL_ORDER = 2;
- SourceMapConsumer.GREATEST_LOWER_BOUND = 1;
- SourceMapConsumer.LEAST_UPPER_BOUND = 2;
- /**
- * Iterate over each mapping between an original source/line/column and a
- * generated line/column in this source map.
- *
- * @param Function aCallback
- * The function that is called with each mapping.
- * @param Object aContext
- * Optional. If specified, this object will be the value of `this` every
- * time that `aCallback` is called.
- * @param aOrder
- * Either `SourceMapConsumer.GENERATED_ORDER` or
- * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to
- * iterate over the mappings sorted by the generated file's line/column
- * order or the original's source/line/column order, respectively. Defaults to
- * `SourceMapConsumer.GENERATED_ORDER`.
- */
- SourceMapConsumer.prototype.eachMapping = function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
- var context = aContext || null;
- var order = aOrder || SourceMapConsumer.GENERATED_ORDER;
- var mappings;
- switch (order) {
- case SourceMapConsumer.GENERATED_ORDER:
- mappings = this._generatedMappings;
- break;
- case SourceMapConsumer.ORIGINAL_ORDER:
- mappings = this._originalMappings;
- break;
- default:
- throw new Error("Unknown order of iteration.");
- }
- var sourceRoot = this.sourceRoot;
- mappings.map(function (mapping) {
- var source = mapping.source === null ? null : this._sources.at(mapping.source);
- if (source != null && sourceRoot != null) {
- source = util.join(sourceRoot, source);
- }
- return {
- source: source,
- generatedLine: mapping.generatedLine,
- generatedColumn: mapping.generatedColumn,
- originalLine: mapping.originalLine,
- originalColumn: mapping.originalColumn,
- name: mapping.name === null ? null : this._names.at(mapping.name)
- };
- }, this).forEach(aCallback, context);
- };
- /**
- * Returns all generated line and column information for the original source,
- * line, and column provided. If no column is provided, returns all mappings
- * corresponding to a either the line we are searching for or the next
- * closest line that has any mappings. Otherwise, returns all mappings
- * corresponding to the given line and either the column we are searching for
- * or the next closest column that has any offsets.
- *
- * The only argument is an object with the following properties:
- *
- * - source: The filename of the original source.
- * - line: The line number in the original source.
- * - column: Optional. the column number in the original source.
- *
- * and an array of objects is returned, each with the following properties:
- *
- * - line: The line number in the generated source, or null.
- * - column: The column number in the generated source, or null.
- */
- SourceMapConsumer.prototype.allGeneratedPositionsFor = function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {
- var line = util.getArg(aArgs, 'line'); // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping
- // returns the index of the closest mapping less than the needle. By
- // setting needle.originalColumn to 0, we thus find the last mapping for
- // the given line, provided such a mapping exists.
- var needle = {
- source: util.getArg(aArgs, 'source'),
- originalLine: line,
- originalColumn: util.getArg(aArgs, 'column', 0)
- };
- if (this.sourceRoot != null) {
- needle.source = util.relative(this.sourceRoot, needle.source);
- }
- if (!this._sources.has(needle.source)) {
- return [];
- }
- needle.source = this._sources.indexOf(needle.source);
- var mappings = [];
- var index = this._findMapping(needle, this._originalMappings, "originalLine", "originalColumn", util.compareByOriginalPositions, binarySearch.LEAST_UPPER_BOUND);
- if (index >= 0) {
- var mapping = this._originalMappings[index];
- if (aArgs.column === undefined) {
- var originalLine = mapping.originalLine; // Iterate until either we run out of mappings, or we run into
- // a mapping for a different line than the one we found. Since
- // mappings are sorted, this is guaranteed to find all mappings for
- // the line we found.
- while (mapping && mapping.originalLine === originalLine) {
- mappings.push({
- line: util.getArg(mapping, 'generatedLine', null),
- column: util.getArg(mapping, 'generatedColumn', null),
- lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
- });
- mapping = this._originalMappings[++index];
- }
- } else {
- var originalColumn = mapping.originalColumn; // Iterate until either we run out of mappings, or we run into
- // a mapping for a different line than the one we were searching for.
- // Since mappings are sorted, this is guaranteed to find all mappings for
- // the line we are searching for.
- while (mapping && mapping.originalLine === line && mapping.originalColumn == originalColumn) {
- mappings.push({
- line: util.getArg(mapping, 'generatedLine', null),
- column: util.getArg(mapping, 'generatedColumn', null),
- lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
- });
- mapping = this._originalMappings[++index];
- }
- }
- }
- return mappings;
- };
- exports.SourceMapConsumer = SourceMapConsumer;
- /**
- * A BasicSourceMapConsumer instance represents a parsed source map which we can
- * query for information about the original file positions by giving it a file
- * position in the generated source.
- *
- * The only parameter is the raw source map (either as a JSON string, or
- * already parsed to an object). According to the spec, source maps have the
- * following attributes:
- *
- * - version: Which version of the source map spec this map is following.
- * - sources: An array of URLs to the original source files.
- * - names: An array of identifiers which can be referrenced by individual mappings.
- * - sourceRoot: Optional. The URL root from which all sources are relative.
- * - sourcesContent: Optional. An array of contents of the original source files.
- * - mappings: A string of base64 VLQs which contain the actual mappings.
- * - file: Optional. The generated file this source map is associated with.
- *
- * Here is an example source map, taken from the source map spec[0]:
- *
- * {
- * version : 3,
- * file: "out.js",
- * sourceRoot : "",
- * sources: ["foo.js", "bar.js"],
- * names: ["src", "maps", "are", "fun"],
- * mappings: "AA,AB;;ABCDE;"
- * }
- *
- * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#
- */
- function BasicSourceMapConsumer(aSourceMap) {
- var sourceMap = aSourceMap;
- if (typeof aSourceMap === 'string') {
- sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, ''));
- }
- var version = util.getArg(sourceMap, 'version');
- var sources = util.getArg(sourceMap, 'sources'); // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which
- // requires the array) to play nice here.
- var names = util.getArg(sourceMap, 'names', []);
- var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);
- var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);
- var mappings = util.getArg(sourceMap, 'mappings');
- var file = util.getArg(sourceMap, 'file', null); // Once again, Sass deviates from the spec and supplies the version as a
- // string rather than a number, so we use loose equality checking here.
- if (version != this._version) {
- throw new Error('Unsupported version: ' + version);
- }
- sources = sources.map(String) // Some source maps produce relative source paths like "./foo.js" instead of
- // "foo.js". Normalize these first so that future comparisons will succeed.
- // See bugzil.la/1090768.
- .map(util.normalize) // Always ensure that absolute sources are internally stored relative to
- // the source root, if the source root is absolute. Not doing this would
- // be particularly problematic when the source root is a prefix of the
- // source (valid, but why??). See github issue #199 and bugzil.la/1188982.
- .map(function (source) {
- return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) ? util.relative(sourceRoot, source) : source;
- }); // Pass `true` below to allow duplicate names and sources. While source maps
- // are intended to be compressed and deduplicated, the TypeScript compiler
- // sometimes generates source maps with duplicates in them. See Github issue
- // #72 and bugzil.la/889492.
- this._names = ArraySet.fromArray(names.map(String), true);
- this._sources = ArraySet.fromArray(sources, true);
- this.sourceRoot = sourceRoot;
- this.sourcesContent = sourcesContent;
- this._mappings = mappings;
- this.file = file;
- }
- BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
- BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;
- /**
- * Create a BasicSourceMapConsumer from a SourceMapGenerator.
- *
- * @param SourceMapGenerator aSourceMap
- * The source map that will be consumed.
- * @returns BasicSourceMapConsumer
- */
- BasicSourceMapConsumer.fromSourceMap = function SourceMapConsumer_fromSourceMap(aSourceMap) {
- var smc = Object.create(BasicSourceMapConsumer.prototype);
- var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);
- var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);
- smc.sourceRoot = aSourceMap._sourceRoot;
- smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), smc.sourceRoot);
- smc.file = aSourceMap._file; // Because we are modifying the entries (by converting string sources and
- // names to indices into the sources and names ArraySets), we have to make
- // a copy of the entry or else bad things happen. Shared mutable state
- // strikes again! See github issue #191.
- var generatedMappings = aSourceMap._mappings.toArray().slice();
- var destGeneratedMappings = smc.__generatedMappings = [];
- var destOriginalMappings = smc.__originalMappings = [];
- for (var i = 0, length = generatedMappings.length; i < length; i++) {
- var srcMapping = generatedMappings[i];
- var destMapping = new Mapping();
- destMapping.generatedLine = srcMapping.generatedLine;
- destMapping.generatedColumn = srcMapping.generatedColumn;
- if (srcMapping.source) {
- destMapping.source = sources.indexOf(srcMapping.source);
- destMapping.originalLine = srcMapping.originalLine;
- destMapping.originalColumn = srcMapping.originalColumn;
- if (srcMapping.name) {
- destMapping.name = names.indexOf(srcMapping.name);
- }
- destOriginalMappings.push(destMapping);
- }
- destGeneratedMappings.push(destMapping);
- }
- quickSort(smc.__originalMappings, util.compareByOriginalPositions);
- return smc;
- };
- /**
- * The version of the source mapping spec that we are consuming.
- */
- BasicSourceMapConsumer.prototype._version = 3;
- /**
- * The list of original sources.
- */
- Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {
- get: function get() {
- return this._sources.toArray().map(function (s) {
- return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s;
- }, this);
- }
- });
- /**
- * Provide the JIT with a nice shape / hidden class.
- */
- function Mapping() {
- this.generatedLine = 0;
- this.generatedColumn = 0;
- this.source = null;
- this.originalLine = null;
- this.originalColumn = null;
- this.name = null;
- }
- /**
- * Parse the mappings in a string in to a data structure which we can easily
- * query (the ordered arrays in the `this.__generatedMappings` and
- * `this.__originalMappings` properties).
- */
- BasicSourceMapConsumer.prototype._parseMappings = function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
- var generatedLine = 1;
- var previousGeneratedColumn = 0;
- var previousOriginalLine = 0;
- var previousOriginalColumn = 0;
- var previousSource = 0;
- var previousName = 0;
- var length = aStr.length;
- var index = 0;
- var cachedSegments = {};
- var temp = {};
- var originalMappings = [];
- var generatedMappings = [];
- var mapping, str, segment, end, value;
- while (index < length) {
- if (aStr.charAt(index) === ';') {
- generatedLine++;
- index++;
- previousGeneratedColumn = 0;
- } else if (aStr.charAt(index) === ',') {
- index++;
- } else {
- mapping = new Mapping();
- mapping.generatedLine = generatedLine; // Because each offset is encoded relative to the previous one,
- // many segments often have the same encoding. We can exploit this
- // fact by caching the parsed variable length fields of each segment,
- // allowing us to avoid a second parse if we encounter the same
- // segment again.
- for (end = index; end < length; end++) {
- if (this._charIsMappingSeparator(aStr, end)) {
- break;
- }
- }
- str = aStr.slice(index, end);
- segment = cachedSegments[str];
- if (segment) {
- index += str.length;
- } else {
- segment = [];
- while (index < end) {
- base64VLQ.decode(aStr, index, temp);
- value = temp.value;
- index = temp.rest;
- segment.push(value);
- }
- if (segment.length === 2) {
- throw new Error('Found a source, but no line and column');
- }
- if (segment.length === 3) {
- throw new Error('Found a source and line, but no column');
- }
- cachedSegments[str] = segment;
- } // Generated column.
- mapping.generatedColumn = previousGeneratedColumn + segment[0];
- previousGeneratedColumn = mapping.generatedColumn;
- if (segment.length > 1) {
- // Original source.
- mapping.source = previousSource + segment[1];
- previousSource += segment[1]; // Original line.
- mapping.originalLine = previousOriginalLine + segment[2];
- previousOriginalLine = mapping.originalLine; // Lines are stored 0-based
- mapping.originalLine += 1; // Original column.
- mapping.originalColumn = previousOriginalColumn + segment[3];
- previousOriginalColumn = mapping.originalColumn;
- if (segment.length > 4) {
- // Original name.
- mapping.name = previousName + segment[4];
- previousName += segment[4];
- }
- }
- generatedMappings.push(mapping);
- if (typeof mapping.originalLine === 'number') {
- originalMappings.push(mapping);
- }
- }
- }
- quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated);
- this.__generatedMappings = generatedMappings;
- quickSort(originalMappings, util.compareByOriginalPositions);
- this.__originalMappings = originalMappings;
- };
- /**
- * Find the mapping that best matches the hypothetical "needle" mapping that
- * we are searching for in the given "haystack" of mappings.
- */
- BasicSourceMapConsumer.prototype._findMapping = function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, aColumnName, aComparator, aBias) {
- // To return the position we are searching for, we must first find the
- // mapping for the given position and then return the opposite position it
- // points to. Because the mappings are sorted, we can use binary search to
- // find the best mapping.
- if (aNeedle[aLineName] <= 0) {
- throw new TypeError('Line must be greater than or equal to 1, got ' + aNeedle[aLineName]);
- }
- if (aNeedle[aColumnName] < 0) {
- throw new TypeError('Column must be greater than or equal to 0, got ' + aNeedle[aColumnName]);
- }
- return binarySearch.search(aNeedle, aMappings, aComparator, aBias);
- };
- /**
- * Compute the last column for each generated mapping. The last column is
- * inclusive.
- */
- BasicSourceMapConsumer.prototype.computeColumnSpans = function SourceMapConsumer_computeColumnSpans() {
- for (var index = 0; index < this._generatedMappings.length; ++index) {
- var mapping = this._generatedMappings[index]; // Mappings do not contain a field for the last generated columnt. We
- // can come up with an optimistic estimate, however, by assuming that
- // mappings are contiguous (i.e. given two consecutive mappings, the
- // first mapping ends where the second one starts).
- if (index + 1 < this._generatedMappings.length) {
- var nextMapping = this._generatedMappings[index + 1];
- if (mapping.generatedLine === nextMapping.generatedLine) {
- mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;
- continue;
- }
- } // The last mapping for each line spans the entire line.
- mapping.lastGeneratedColumn = Infinity;
- }
- };
- /**
- * Returns the original source, line, and column information for the generated
- * source's line and column positions provided. The only argument is an object
- * with the following properties:
- *
- * - line: The line number in the generated source.
- * - column: The column number in the generated source.
- * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
- * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
- * closest element that is smaller than or greater than the one we are
- * searching for, respectively, if the exact element cannot be found.
- * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
- *
- * and an object is returned with the following properties:
- *
- * - source: The original source file, or null.
- * - line: The line number in the original source, or null.
- * - column: The column number in the original source, or null.
- * - name: The original identifier, or null.
- */
- BasicSourceMapConsumer.prototype.originalPositionFor = function SourceMapConsumer_originalPositionFor(aArgs) {
- var needle = {
- generatedLine: util.getArg(aArgs, 'line'),
- generatedColumn: util.getArg(aArgs, 'column')
- };
- var index = this._findMapping(needle, this._generatedMappings, "generatedLine", "generatedColumn", util.compareByGeneratedPositionsDeflated, util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND));
- if (index >= 0) {
- var mapping = this._generatedMappings[index];
- if (mapping.generatedLine === needle.generatedLine) {
- var source = util.getArg(mapping, 'source', null);
- if (source !== null) {
- source = this._sources.at(source);
- if (this.sourceRoot != null) {
- source = util.join(this.sourceRoot, source);
- }
- }
- var name = util.getArg(mapping, 'name', null);
- if (name !== null) {
- name = this._names.at(name);
- }
- return {
- source: source,
- line: util.getArg(mapping, 'originalLine', null),
- column: util.getArg(mapping, 'originalColumn', null),
- name: name
- };
- }
- }
- return {
- source: null,
- line: null,
- column: null,
- name: null
- };
- };
- /**
- * Return true if we have the source content for every source in the source
- * map, false otherwise.
- */
- BasicSourceMapConsumer.prototype.hasContentsOfAllSources = function BasicSourceMapConsumer_hasContentsOfAllSources() {
- if (!this.sourcesContent) {
- return false;
- }
- return this.sourcesContent.length >= this._sources.size() && !this.sourcesContent.some(function (sc) {
- return sc == null;
- });
- };
- /**
- * Returns the original source content. The only argument is the url of the
- * original source file. Returns null if no original source content is
- * available.
- */
- BasicSourceMapConsumer.prototype.sourceContentFor = function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
- if (!this.sourcesContent) {
- return null;
- }
- if (this.sourceRoot != null) {
- aSource = util.relative(this.sourceRoot, aSource);
- }
- if (this._sources.has(aSource)) {
- return this.sourcesContent[this._sources.indexOf(aSource)];
- }
- var url;
- if (this.sourceRoot != null && (url = util.urlParse(this.sourceRoot))) {
- // XXX: file:// URIs and absolute paths lead to unexpected behavior for
- // many users. We can help them out when they expect file:// URIs to
- // behave like it would if they were running a local HTTP server. See
- // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.
- var fileUriAbsPath = aSource.replace(/^file:\/\//, "");
- if (url.scheme == "file" && this._sources.has(fileUriAbsPath)) {
- return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)];
- }
- if ((!url.path || url.path == "/") && this._sources.has("/" + aSource)) {
- return this.sourcesContent[this._sources.indexOf("/" + aSource)];
- }
- } // This function is used recursively from
- // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we
- // don't want to throw if we can't find the source - we just want to
- // return null, so we provide a flag to exit gracefully.
- if (nullOnMissing) {
- return null;
- } else {
- throw new Error('"' + aSource + '" is not in the SourceMap.');
- }
- };
- /**
- * Returns the generated line and column information for the original source,
- * line, and column positions provided. The only argument is an object with
- * the following properties:
- *
- * - source: The filename of the original source.
- * - line: The line number in the original source.
- * - column: The column number in the original source.
- * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
- * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
- * closest element that is smaller than or greater than the one we are
- * searching for, respectively, if the exact element cannot be found.
- * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
- *
- * and an object is returned with the following properties:
- *
- * - line: The line number in the generated source, or null.
- * - column: The column number in the generated source, or null.
- */
- BasicSourceMapConsumer.prototype.generatedPositionFor = function SourceMapConsumer_generatedPositionFor(aArgs) {
- var source = util.getArg(aArgs, 'source');
- if (this.sourceRoot != null) {
- source = util.relative(this.sourceRoot, source);
- }
- if (!this._sources.has(source)) {
- return {
- line: null,
- column: null,
- lastColumn: null
- };
- }
- source = this._sources.indexOf(source);
- var needle = {
- source: source,
- originalLine: util.getArg(aArgs, 'line'),
- originalColumn: util.getArg(aArgs, 'column')
- };
- var index = this._findMapping(needle, this._originalMappings, "originalLine", "originalColumn", util.compareByOriginalPositions, util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND));
- if (index >= 0) {
- var mapping = this._originalMappings[index];
- if (mapping.source === needle.source) {
- return {
- line: util.getArg(mapping, 'generatedLine', null),
- column: util.getArg(mapping, 'generatedColumn', null),
- lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
- };
- }
- }
- return {
- line: null,
- column: null,
- lastColumn: null
- };
- };
- exports.BasicSourceMapConsumer = BasicSourceMapConsumer;
- /**
- * An IndexedSourceMapConsumer instance represents a parsed source map which
- * we can query for information. It differs from BasicSourceMapConsumer in
- * that it takes "indexed" source maps (i.e. ones with a "sections" field) as
- * input.
- *
- * The only parameter is a raw source map (either as a JSON string, or already
- * parsed to an object). According to the spec for indexed source maps, they
- * have the following attributes:
- *
- * - version: Which version of the source map spec this map is following.
- * - file: Optional. The generated file this source map is associated with.
- * - sections: A list of section definitions.
- *
- * Each value under the "sections" field has two fields:
- * - offset: The offset into the original specified at which this section
- * begins to apply, defined as an object with a "line" and "column"
- * field.
- * - map: A source map definition. This source map could also be indexed,
- * but doesn't have to be.
- *
- * Instead of the "map" field, it's also possible to have a "url" field
- * specifying a URL to retrieve a source map from, but that's currently
- * unsupported.
- *
- * Here's an example source map, taken from the source map spec[0], but
- * modified to omit a section which uses the "url" field.
- *
- * {
- * version : 3,
- * file: "app.js",
- * sections: [{
- * offset: {line:100, column:10},
- * map: {
- * version : 3,
- * file: "section.js",
- * sources: ["foo.js", "bar.js"],
- * names: ["src", "maps", "are", "fun"],
- * mappings: "AAAA,E;;ABCDE;"
- * }
- * }],
- * }
- *
- * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt
- */
- function IndexedSourceMapConsumer(aSourceMap) {
- var sourceMap = aSourceMap;
- if (typeof aSourceMap === 'string') {
- sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, ''));
- }
- var version = util.getArg(sourceMap, 'version');
- var sections = util.getArg(sourceMap, 'sections');
- if (version != this._version) {
- throw new Error('Unsupported version: ' + version);
- }
- this._sources = new ArraySet();
- this._names = new ArraySet();
- var lastOffset = {
- line: -1,
- column: 0
- };
- this._sections = sections.map(function (s) {
- if (s.url) {
- // The url field will require support for asynchronicity.
- // See https://github.com/mozilla/source-map/issues/16
- throw new Error('Support for url field in sections not implemented.');
- }
- var offset = util.getArg(s, 'offset');
- var offsetLine = util.getArg(offset, 'line');
- var offsetColumn = util.getArg(offset, 'column');
- if (offsetLine < lastOffset.line || offsetLine === lastOffset.line && offsetColumn < lastOffset.column) {
- throw new Error('Section offsets must be ordered and non-overlapping.');
- }
- lastOffset = offset;
- return {
- generatedOffset: {
- // The offset fields are 0-based, but we use 1-based indices when
- // encoding/decoding from VLQ.
- generatedLine: offsetLine + 1,
- generatedColumn: offsetColumn + 1
- },
- consumer: new SourceMapConsumer(util.getArg(s, 'map'))
- };
- });
- }
- IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
- IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;
- /**
- * The version of the source mapping spec that we are consuming.
- */
- IndexedSourceMapConsumer.prototype._version = 3;
- /**
- * The list of original sources.
- */
- Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {
- get: function get() {
- var sources = [];
- for (var i = 0; i < this._sections.length; i++) {
- for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {
- sources.push(this._sections[i].consumer.sources[j]);
- }
- }
- return sources;
- }
- });
- /**
- * Returns the original source, line, and column information for the generated
- * source's line and column positions provided. The only argument is an object
- * with the following properties:
- *
- * - line: The line number in the generated source.
- * - column: The column number in the generated source.
- *
- * and an object is returned with the following properties:
- *
- * - source: The original source file, or null.
- * - line: The line number in the original source, or null.
- * - column: The column number in the original source, or null.
- * - name: The original identifier, or null.
- */
- IndexedSourceMapConsumer.prototype.originalPositionFor = function IndexedSourceMapConsumer_originalPositionFor(aArgs) {
- var needle = {
- generatedLine: util.getArg(aArgs, 'line'),
- generatedColumn: util.getArg(aArgs, 'column')
- }; // Find the section containing the generated position we're trying to map
- // to an original position.
- var sectionIndex = binarySearch.search(needle, this._sections, function (needle, section) {
- var cmp = needle.generatedLine - section.generatedOffset.generatedLine;
- if (cmp) {
- return cmp;
- }
- return needle.generatedColumn - section.generatedOffset.generatedColumn;
- });
- var section = this._sections[sectionIndex];
- if (!section) {
- return {
- source: null,
- line: null,
- column: null,
- name: null
- };
- }
- return section.consumer.originalPositionFor({
- line: needle.generatedLine - (section.generatedOffset.generatedLine - 1),
- column: needle.generatedColumn - (section.generatedOffset.generatedLine === needle.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0),
- bias: aArgs.bias
- });
- };
- /**
- * Return true if we have the source content for every source in the source
- * map, false otherwise.
- */
- IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = function IndexedSourceMapConsumer_hasContentsOfAllSources() {
- return this._sections.every(function (s) {
- return s.consumer.hasContentsOfAllSources();
- });
- };
- /**
- * Returns the original source content. The only argument is the url of the
- * original source file. Returns null if no original source content is
- * available.
- */
- IndexedSourceMapConsumer.prototype.sourceContentFor = function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
- for (var i = 0; i < this._sections.length; i++) {
- var section = this._sections[i];
- var content = section.consumer.sourceContentFor(aSource, true);
- if (content) {
- return content;
- }
- }
- if (nullOnMissing) {
- return null;
- } else {
- throw new Error('"' + aSource + '" is not in the SourceMap.');
- }
- };
- /**
- * Returns the generated line and column information for the original source,
- * line, and column positions provided. The only argument is an object with
- * the following properties:
- *
- * - source: The filename of the original source.
- * - line: The line number in the original source.
- * - column: The column number in the original source.
- *
- * and an object is returned with the following properties:
- *
- * - line: The line number in the generated source, or null.
- * - column: The column number in the generated source, or null.
- */
- IndexedSourceMapConsumer.prototype.generatedPositionFor = function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {
- for (var i = 0; i < this._sections.length; i++) {
- var section = this._sections[i]; // Only consider this section if the requested source is in the list of
- // sources of the consumer.
- if (section.consumer.sources.indexOf(util.getArg(aArgs, 'source')) === -1) {
- continue;
- }
- var generatedPosition = section.consumer.generatedPositionFor(aArgs);
- if (generatedPosition) {
- var ret = {
- line: generatedPosition.line + (section.generatedOffset.generatedLine - 1),
- column: generatedPosition.column + (section.generatedOffset.generatedLine === generatedPosition.line ? section.generatedOffset.generatedColumn - 1 : 0)
- };
- return ret;
- }
- }
- return {
- line: null,
- column: null
- };
- };
- /**
- * Parse the mappings in a string in to a data structure which we can easily
- * query (the ordered arrays in the `this.__generatedMappings` and
- * `this.__originalMappings` properties).
- */
- IndexedSourceMapConsumer.prototype._parseMappings = function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {
- this.__generatedMappings = [];
- this.__originalMappings = [];
- for (var i = 0; i < this._sections.length; i++) {
- var section = this._sections[i];
- var sectionMappings = section.consumer._generatedMappings;
- for (var j = 0; j < sectionMappings.length; j++) {
- var mapping = sectionMappings[j];
- var source = section.consumer._sources.at(mapping.source);
- if (section.consumer.sourceRoot !== null) {
- source = util.join(section.consumer.sourceRoot, source);
- }
- this._sources.add(source);
- source = this._sources.indexOf(source);
- var name = section.consumer._names.at(mapping.name);
- this._names.add(name);
- name = this._names.indexOf(name); // The mappings coming from the consumer for the section have
- // generated positions relative to the start of the section, so we
- // need to offset them to be relative to the start of the concatenated
- // generated file.
- var adjustedMapping = {
- source: source,
- generatedLine: mapping.generatedLine + (section.generatedOffset.generatedLine - 1),
- generatedColumn: mapping.generatedColumn + (section.generatedOffset.generatedLine === mapping.generatedLine ? section.generatedOffset.generatedColumn - 1 : 0),
- originalLine: mapping.originalLine,
- originalColumn: mapping.originalColumn,
- name: name
- };
- this.__generatedMappings.push(adjustedMapping);
- if (typeof adjustedMapping.originalLine === 'number') {
- this.__originalMappings.push(adjustedMapping);
- }
- }
- }
- quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);
- quickSort(this.__originalMappings, util.compareByOriginalPositions);
- };
- exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;
- /***/ }),
- /***/ "./node_modules/snapdragon/node_modules/source-map/lib/source-map-generator.js":
- /*!*************************************************************************************!*\
- !*** ./node_modules/snapdragon/node_modules/source-map/lib/source-map-generator.js ***!
- \*************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* -*- Mode: js; js-indent-level: 2; -*- */
- /*
- * Copyright 2011 Mozilla Foundation and contributors
- * Licensed under the New BSD license. See LICENSE or:
- * http://opensource.org/licenses/BSD-3-Clause
- */
- var base64VLQ = __webpack_require__(/*! ./base64-vlq */ "./node_modules/snapdragon/node_modules/source-map/lib/base64-vlq.js");
- var util = __webpack_require__(/*! ./util */ "./node_modules/snapdragon/node_modules/source-map/lib/util.js");
- var ArraySet = __webpack_require__(/*! ./array-set */ "./node_modules/snapdragon/node_modules/source-map/lib/array-set.js").ArraySet;
- var MappingList = __webpack_require__(/*! ./mapping-list */ "./node_modules/snapdragon/node_modules/source-map/lib/mapping-list.js").MappingList;
- /**
- * An instance of the SourceMapGenerator represents a source map which is
- * being built incrementally. You may pass an object with the following
- * properties:
- *
- * - file: The filename of the generated source.
- * - sourceRoot: A root for all relative URLs in this source map.
- */
- function SourceMapGenerator(aArgs) {
- if (!aArgs) {
- aArgs = {};
- }
- this._file = util.getArg(aArgs, 'file', null);
- this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);
- this._skipValidation = util.getArg(aArgs, 'skipValidation', false);
- this._sources = new ArraySet();
- this._names = new ArraySet();
- this._mappings = new MappingList();
- this._sourcesContents = null;
- }
- SourceMapGenerator.prototype._version = 3;
- /**
- * Creates a new SourceMapGenerator based on a SourceMapConsumer
- *
- * @param aSourceMapConsumer The SourceMap.
- */
- SourceMapGenerator.fromSourceMap = function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
- var sourceRoot = aSourceMapConsumer.sourceRoot;
- var generator = new SourceMapGenerator({
- file: aSourceMapConsumer.file,
- sourceRoot: sourceRoot
- });
- aSourceMapConsumer.eachMapping(function (mapping) {
- var newMapping = {
- generated: {
- line: mapping.generatedLine,
- column: mapping.generatedColumn
- }
- };
- if (mapping.source != null) {
- newMapping.source = mapping.source;
- if (sourceRoot != null) {
- newMapping.source = util.relative(sourceRoot, newMapping.source);
- }
- newMapping.original = {
- line: mapping.originalLine,
- column: mapping.originalColumn
- };
- if (mapping.name != null) {
- newMapping.name = mapping.name;
- }
- }
- generator.addMapping(newMapping);
- });
- aSourceMapConsumer.sources.forEach(function (sourceFile) {
- var content = aSourceMapConsumer.sourceContentFor(sourceFile);
- if (content != null) {
- generator.setSourceContent(sourceFile, content);
- }
- });
- return generator;
- };
- /**
- * Add a single mapping from original source line and column to the generated
- * source's line and column for this source map being created. The mapping
- * object should have the following properties:
- *
- * - generated: An object with the generated line and column positions.
- * - original: An object with the original line and column positions.
- * - source: The original source file (relative to the sourceRoot).
- * - name: An optional original token name for this mapping.
- */
- SourceMapGenerator.prototype.addMapping = function SourceMapGenerator_addMapping(aArgs) {
- var generated = util.getArg(aArgs, 'generated');
- var original = util.getArg(aArgs, 'original', null);
- var source = util.getArg(aArgs, 'source', null);
- var name = util.getArg(aArgs, 'name', null);
- if (!this._skipValidation) {
- this._validateMapping(generated, original, source, name);
- }
- if (source != null) {
- source = String(source);
- if (!this._sources.has(source)) {
- this._sources.add(source);
- }
- }
- if (name != null) {
- name = String(name);
- if (!this._names.has(name)) {
- this._names.add(name);
- }
- }
- this._mappings.add({
- generatedLine: generated.line,
- generatedColumn: generated.column,
- originalLine: original != null && original.line,
- originalColumn: original != null && original.column,
- source: source,
- name: name
- });
- };
- /**
- * Set the source content for a source file.
- */
- SourceMapGenerator.prototype.setSourceContent = function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
- var source = aSourceFile;
- if (this._sourceRoot != null) {
- source = util.relative(this._sourceRoot, source);
- }
- if (aSourceContent != null) {
- // Add the source content to the _sourcesContents map.
- // Create a new _sourcesContents map if the property is null.
- if (!this._sourcesContents) {
- this._sourcesContents = Object.create(null);
- }
- this._sourcesContents[util.toSetString(source)] = aSourceContent;
- } else if (this._sourcesContents) {
- // Remove the source file from the _sourcesContents map.
- // If the _sourcesContents map is empty, set the property to null.
- delete this._sourcesContents[util.toSetString(source)];
- if (Object.keys(this._sourcesContents).length === 0) {
- this._sourcesContents = null;
- }
- }
- };
- /**
- * Applies the mappings of a sub-source-map for a specific source file to the
- * source map being generated. Each mapping to the supplied source file is
- * rewritten using the supplied source map. Note: The resolution for the
- * resulting mappings is the minimium of this map and the supplied map.
- *
- * @param aSourceMapConsumer The source map to be applied.
- * @param aSourceFile Optional. The filename of the source file.
- * If omitted, SourceMapConsumer's file property will be used.
- * @param aSourceMapPath Optional. The dirname of the path to the source map
- * to be applied. If relative, it is relative to the SourceMapConsumer.
- * This parameter is needed when the two source maps aren't in the same
- * directory, and the source map to be applied contains relative source
- * paths. If so, those relative source paths need to be rewritten
- * relative to the SourceMapGenerator.
- */
- SourceMapGenerator.prototype.applySourceMap = function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
- var sourceFile = aSourceFile; // If aSourceFile is omitted, we will use the file property of the SourceMap
- if (aSourceFile == null) {
- if (aSourceMapConsumer.file == null) {
- throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + 'or the source map\'s "file" property. Both were omitted.');
- }
- sourceFile = aSourceMapConsumer.file;
- }
- var sourceRoot = this._sourceRoot; // Make "sourceFile" relative if an absolute Url is passed.
- if (sourceRoot != null) {
- sourceFile = util.relative(sourceRoot, sourceFile);
- } // Applying the SourceMap can add and remove items from the sources and
- // the names array.
- var newSources = new ArraySet();
- var newNames = new ArraySet(); // Find mappings for the "sourceFile"
- this._mappings.unsortedForEach(function (mapping) {
- if (mapping.source === sourceFile && mapping.originalLine != null) {
- // Check if it can be mapped by the source map, then update the mapping.
- var original = aSourceMapConsumer.originalPositionFor({
- line: mapping.originalLine,
- column: mapping.originalColumn
- });
- if (original.source != null) {
- // Copy mapping
- mapping.source = original.source;
- if (aSourceMapPath != null) {
- mapping.source = util.join(aSourceMapPath, mapping.source);
- }
- if (sourceRoot != null) {
- mapping.source = util.relative(sourceRoot, mapping.source);
- }
- mapping.originalLine = original.line;
- mapping.originalColumn = original.column;
- if (original.name != null) {
- mapping.name = original.name;
- }
- }
- }
- var source = mapping.source;
- if (source != null && !newSources.has(source)) {
- newSources.add(source);
- }
- var name = mapping.name;
- if (name != null && !newNames.has(name)) {
- newNames.add(name);
- }
- }, this);
- this._sources = newSources;
- this._names = newNames; // Copy sourcesContents of applied map.
- aSourceMapConsumer.sources.forEach(function (sourceFile) {
- var content = aSourceMapConsumer.sourceContentFor(sourceFile);
- if (content != null) {
- if (aSourceMapPath != null) {
- sourceFile = util.join(aSourceMapPath, sourceFile);
- }
- if (sourceRoot != null) {
- sourceFile = util.relative(sourceRoot, sourceFile);
- }
- this.setSourceContent(sourceFile, content);
- }
- }, this);
- };
- /**
- * A mapping can have one of the three levels of data:
- *
- * 1. Just the generated position.
- * 2. The Generated position, original position, and original source.
- * 3. Generated and original position, original source, as well as a name
- * token.
- *
- * To maintain consistency, we validate that any new mapping being added falls
- * in to one of these categories.
- */
- SourceMapGenerator.prototype._validateMapping = function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, aName) {
- // When aOriginal is truthy but has empty values for .line and .column,
- // it is most likely a programmer error. In this case we throw a very
- // specific error message to try to guide them the right way.
- // For example: https://github.com/Polymer/polymer-bundler/pull/519
- if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {
- throw new Error('original.line and original.column are not numbers -- you probably meant to omit ' + 'the original mapping entirely and only map the generated position. If so, pass ' + 'null for the original mapping instead of an object with empty or null values.');
- }
- if (aGenerated && 'line' in aGenerated && 'column' in aGenerated && aGenerated.line > 0 && aGenerated.column >= 0 && !aOriginal && !aSource && !aName) {
- // Case 1.
- return;
- } else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated && aOriginal && 'line' in aOriginal && 'column' in aOriginal && aGenerated.line > 0 && aGenerated.column >= 0 && aOriginal.line > 0 && aOriginal.column >= 0 && aSource) {
- // Cases 2 and 3.
- return;
- } else {
- throw new Error('Invalid mapping: ' + JSON.stringify({
- generated: aGenerated,
- source: aSource,
- original: aOriginal,
- name: aName
- }));
- }
- };
- /**
- * Serialize the accumulated mappings in to the stream of base 64 VLQs
- * specified by the source map format.
- */
- SourceMapGenerator.prototype._serializeMappings = function SourceMapGenerator_serializeMappings() {
- var previousGeneratedColumn = 0;
- var previousGeneratedLine = 1;
- var previousOriginalColumn = 0;
- var previousOriginalLine = 0;
- var previousName = 0;
- var previousSource = 0;
- var result = '';
- var next;
- var mapping;
- var nameIdx;
- var sourceIdx;
- var mappings = this._mappings.toArray();
- for (var i = 0, len = mappings.length; i < len; i++) {
- mapping = mappings[i];
- next = '';
- if (mapping.generatedLine !== previousGeneratedLine) {
- previousGeneratedColumn = 0;
- while (mapping.generatedLine !== previousGeneratedLine) {
- next += ';';
- previousGeneratedLine++;
- }
- } else {
- if (i > 0) {
- if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
- continue;
- }
- next += ',';
- }
- }
- next += base64VLQ.encode(mapping.generatedColumn - previousGeneratedColumn);
- previousGeneratedColumn = mapping.generatedColumn;
- if (mapping.source != null) {
- sourceIdx = this._sources.indexOf(mapping.source);
- next += base64VLQ.encode(sourceIdx - previousSource);
- previousSource = sourceIdx; // lines are stored 0-based in SourceMap spec version 3
- next += base64VLQ.encode(mapping.originalLine - 1 - previousOriginalLine);
- previousOriginalLine = mapping.originalLine - 1;
- next += base64VLQ.encode(mapping.originalColumn - previousOriginalColumn);
- previousOriginalColumn = mapping.originalColumn;
- if (mapping.name != null) {
- nameIdx = this._names.indexOf(mapping.name);
- next += base64VLQ.encode(nameIdx - previousName);
- previousName = nameIdx;
- }
- }
- result += next;
- }
- return result;
- };
- SourceMapGenerator.prototype._generateSourcesContent = function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
- return aSources.map(function (source) {
- if (!this._sourcesContents) {
- return null;
- }
- if (aSourceRoot != null) {
- source = util.relative(aSourceRoot, source);
- }
- var key = util.toSetString(source);
- return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) ? this._sourcesContents[key] : null;
- }, this);
- };
- /**
- * Externalize the source map.
- */
- SourceMapGenerator.prototype.toJSON = function SourceMapGenerator_toJSON() {
- var map = {
- version: this._version,
- sources: this._sources.toArray(),
- names: this._names.toArray(),
- mappings: this._serializeMappings()
- };
- if (this._file != null) {
- map.file = this._file;
- }
- if (this._sourceRoot != null) {
- map.sourceRoot = this._sourceRoot;
- }
- if (this._sourcesContents) {
- map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
- }
- return map;
- };
- /**
- * Render the source map being generated to a string.
- */
- SourceMapGenerator.prototype.toString = function SourceMapGenerator_toString() {
- return JSON.stringify(this.toJSON());
- };
- exports.SourceMapGenerator = SourceMapGenerator;
- /***/ }),
- /***/ "./node_modules/snapdragon/node_modules/source-map/lib/source-node.js":
- /*!****************************************************************************!*\
- !*** ./node_modules/snapdragon/node_modules/source-map/lib/source-node.js ***!
- \****************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* -*- Mode: js; js-indent-level: 2; -*- */
- /*
- * Copyright 2011 Mozilla Foundation and contributors
- * Licensed under the New BSD license. See LICENSE or:
- * http://opensource.org/licenses/BSD-3-Clause
- */
- var SourceMapGenerator = __webpack_require__(/*! ./source-map-generator */ "./node_modules/snapdragon/node_modules/source-map/lib/source-map-generator.js").SourceMapGenerator;
- var util = __webpack_require__(/*! ./util */ "./node_modules/snapdragon/node_modules/source-map/lib/util.js"); // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other
- // operating systems these days (capturing the result).
- var REGEX_NEWLINE = /(\r?\n)/; // Newline character code for charCodeAt() comparisons
- var NEWLINE_CODE = 10; // Private symbol for identifying `SourceNode`s when multiple versions of
- // the source-map library are loaded. This MUST NOT CHANGE across
- // versions!
- var isSourceNode = "$$$isSourceNode$$$";
- /**
- * SourceNodes provide a way to abstract over interpolating/concatenating
- * snippets of generated JavaScript source code while maintaining the line and
- * column information associated with the original source code.
- *
- * @param aLine The original line number.
- * @param aColumn The original column number.
- * @param aSource The original source's filename.
- * @param aChunks Optional. An array of strings which are snippets of
- * generated JS, or other SourceNodes.
- * @param aName The original identifier.
- */
- function SourceNode(aLine, aColumn, aSource, aChunks, aName) {
- this.children = [];
- this.sourceContents = {};
- this.line = aLine == null ? null : aLine;
- this.column = aColumn == null ? null : aColumn;
- this.source = aSource == null ? null : aSource;
- this.name = aName == null ? null : aName;
- this[isSourceNode] = true;
- if (aChunks != null) this.add(aChunks);
- }
- /**
- * Creates a SourceNode from generated code and a SourceMapConsumer.
- *
- * @param aGeneratedCode The generated code
- * @param aSourceMapConsumer The SourceMap for the generated code
- * @param aRelativePath Optional. The path that relative sources in the
- * SourceMapConsumer should be relative to.
- */
- SourceNode.fromStringWithSourceMap = function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {
- // The SourceNode we want to fill with the generated code
- // and the SourceMap
- var node = new SourceNode(); // All even indices of this array are one line of the generated code,
- // while all odd indices are the newlines between two adjacent lines
- // (since `REGEX_NEWLINE` captures its match).
- // Processed fragments are accessed by calling `shiftNextLine`.
- var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
- var remainingLinesIndex = 0;
- var shiftNextLine = function shiftNextLine() {
- var lineContents = getNextLine(); // The last line of a file might not have a newline.
- var newLine = getNextLine() || "";
- return lineContents + newLine;
- function getNextLine() {
- return remainingLinesIndex < remainingLines.length ? remainingLines[remainingLinesIndex++] : undefined;
- }
- }; // We need to remember the position of "remainingLines"
- var lastGeneratedLine = 1,
- lastGeneratedColumn = 0; // The generate SourceNodes we need a code range.
- // To extract it current and last mapping is used.
- // Here we store the last mapping.
- var lastMapping = null;
- aSourceMapConsumer.eachMapping(function (mapping) {
- if (lastMapping !== null) {
- // We add the code from "lastMapping" to "mapping":
- // First check if there is a new line in between.
- if (lastGeneratedLine < mapping.generatedLine) {
- // Associate first line with "lastMapping"
- addMappingWithCode(lastMapping, shiftNextLine());
- lastGeneratedLine++;
- lastGeneratedColumn = 0; // The remaining code is added without mapping
- } else {
- // There is no new line in between.
- // Associate the code between "lastGeneratedColumn" and
- // "mapping.generatedColumn" with "lastMapping"
- var nextLine = remainingLines[remainingLinesIndex];
- var code = nextLine.substr(0, mapping.generatedColumn - lastGeneratedColumn);
- remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - lastGeneratedColumn);
- lastGeneratedColumn = mapping.generatedColumn;
- addMappingWithCode(lastMapping, code); // No more remaining code, continue
- lastMapping = mapping;
- return;
- }
- } // We add the generated code until the first mapping
- // to the SourceNode without any mapping.
- // Each line is added as separate string.
- while (lastGeneratedLine < mapping.generatedLine) {
- node.add(shiftNextLine());
- lastGeneratedLine++;
- }
- if (lastGeneratedColumn < mapping.generatedColumn) {
- var nextLine = remainingLines[remainingLinesIndex];
- node.add(nextLine.substr(0, mapping.generatedColumn));
- remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);
- lastGeneratedColumn = mapping.generatedColumn;
- }
- lastMapping = mapping;
- }, this); // We have processed all mappings.
- if (remainingLinesIndex < remainingLines.length) {
- if (lastMapping) {
- // Associate the remaining code in the current line with "lastMapping"
- addMappingWithCode(lastMapping, shiftNextLine());
- } // and add the remaining lines without any mapping
- node.add(remainingLines.splice(remainingLinesIndex).join(""));
- } // Copy sourcesContent into SourceNode
- aSourceMapConsumer.sources.forEach(function (sourceFile) {
- var content = aSourceMapConsumer.sourceContentFor(sourceFile);
- if (content != null) {
- if (aRelativePath != null) {
- sourceFile = util.join(aRelativePath, sourceFile);
- }
- node.setSourceContent(sourceFile, content);
- }
- });
- return node;
- function addMappingWithCode(mapping, code) {
- if (mapping === null || mapping.source === undefined) {
- node.add(code);
- } else {
- var source = aRelativePath ? util.join(aRelativePath, mapping.source) : mapping.source;
- node.add(new SourceNode(mapping.originalLine, mapping.originalColumn, source, code, mapping.name));
- }
- }
- };
- /**
- * Add a chunk of generated JS to this source node.
- *
- * @param aChunk A string snippet of generated JS code, another instance of
- * SourceNode, or an array where each member is one of those things.
- */
- SourceNode.prototype.add = function SourceNode_add(aChunk) {
- if (Array.isArray(aChunk)) {
- aChunk.forEach(function (chunk) {
- this.add(chunk);
- }, this);
- } else if (aChunk[isSourceNode] || typeof aChunk === "string") {
- if (aChunk) {
- this.children.push(aChunk);
- }
- } else {
- throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk);
- }
- return this;
- };
- /**
- * Add a chunk of generated JS to the beginning of this source node.
- *
- * @param aChunk A string snippet of generated JS code, another instance of
- * SourceNode, or an array where each member is one of those things.
- */
- SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {
- if (Array.isArray(aChunk)) {
- for (var i = aChunk.length - 1; i >= 0; i--) {
- this.prepend(aChunk[i]);
- }
- } else if (aChunk[isSourceNode] || typeof aChunk === "string") {
- this.children.unshift(aChunk);
- } else {
- throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk);
- }
- return this;
- };
- /**
- * Walk over the tree of JS snippets in this node and its children. The
- * walking function is called once for each snippet of JS and is passed that
- * snippet and the its original associated source's line/column location.
- *
- * @param aFn The traversal function.
- */
- SourceNode.prototype.walk = function SourceNode_walk(aFn) {
- var chunk;
- for (var i = 0, len = this.children.length; i < len; i++) {
- chunk = this.children[i];
- if (chunk[isSourceNode]) {
- chunk.walk(aFn);
- } else {
- if (chunk !== '') {
- aFn(chunk, {
- source: this.source,
- line: this.line,
- column: this.column,
- name: this.name
- });
- }
- }
- }
- };
- /**
- * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between
- * each of `this.children`.
- *
- * @param aSep The separator.
- */
- SourceNode.prototype.join = function SourceNode_join(aSep) {
- var newChildren;
- var i;
- var len = this.children.length;
- if (len > 0) {
- newChildren = [];
- for (i = 0; i < len - 1; i++) {
- newChildren.push(this.children[i]);
- newChildren.push(aSep);
- }
- newChildren.push(this.children[i]);
- this.children = newChildren;
- }
- return this;
- };
- /**
- * Call String.prototype.replace on the very right-most source snippet. Useful
- * for trimming whitespace from the end of a source node, etc.
- *
- * @param aPattern The pattern to replace.
- * @param aReplacement The thing to replace the pattern with.
- */
- SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {
- var lastChild = this.children[this.children.length - 1];
- if (lastChild[isSourceNode]) {
- lastChild.replaceRight(aPattern, aReplacement);
- } else if (typeof lastChild === 'string') {
- this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
- } else {
- this.children.push(''.replace(aPattern, aReplacement));
- }
- return this;
- };
- /**
- * Set the source content for a source file. This will be added to the SourceMapGenerator
- * in the sourcesContent field.
- *
- * @param aSourceFile The filename of the source file
- * @param aSourceContent The content of the source file
- */
- SourceNode.prototype.setSourceContent = function SourceNode_setSourceContent(aSourceFile, aSourceContent) {
- this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
- };
- /**
- * Walk over the tree of SourceNodes. The walking function is called for each
- * source file content and is passed the filename and source content.
- *
- * @param aFn The traversal function.
- */
- SourceNode.prototype.walkSourceContents = function SourceNode_walkSourceContents(aFn) {
- for (var i = 0, len = this.children.length; i < len; i++) {
- if (this.children[i][isSourceNode]) {
- this.children[i].walkSourceContents(aFn);
- }
- }
- var sources = Object.keys(this.sourceContents);
- for (var i = 0, len = sources.length; i < len; i++) {
- aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
- }
- };
- /**
- * Return the string representation of this source node. Walks over the tree
- * and concatenates all the various snippets together to one string.
- */
- SourceNode.prototype.toString = function SourceNode_toString() {
- var str = "";
- this.walk(function (chunk) {
- str += chunk;
- });
- return str;
- };
- /**
- * Returns the string representation of this source node along with a source
- * map.
- */
- SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
- var generated = {
- code: "",
- line: 1,
- column: 0
- };
- var map = new SourceMapGenerator(aArgs);
- var sourceMappingActive = false;
- var lastOriginalSource = null;
- var lastOriginalLine = null;
- var lastOriginalColumn = null;
- var lastOriginalName = null;
- this.walk(function (chunk, original) {
- generated.code += chunk;
- if (original.source !== null && original.line !== null && original.column !== null) {
- if (lastOriginalSource !== original.source || lastOriginalLine !== original.line || lastOriginalColumn !== original.column || lastOriginalName !== original.name) {
- map.addMapping({
- source: original.source,
- original: {
- line: original.line,
- column: original.column
- },
- generated: {
- line: generated.line,
- column: generated.column
- },
- name: original.name
- });
- }
- lastOriginalSource = original.source;
- lastOriginalLine = original.line;
- lastOriginalColumn = original.column;
- lastOriginalName = original.name;
- sourceMappingActive = true;
- } else if (sourceMappingActive) {
- map.addMapping({
- generated: {
- line: generated.line,
- column: generated.column
- }
- });
- lastOriginalSource = null;
- sourceMappingActive = false;
- }
- for (var idx = 0, length = chunk.length; idx < length; idx++) {
- if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
- generated.line++;
- generated.column = 0; // Mappings end at eol
- if (idx + 1 === length) {
- lastOriginalSource = null;
- sourceMappingActive = false;
- } else if (sourceMappingActive) {
- map.addMapping({
- source: original.source,
- original: {
- line: original.line,
- column: original.column
- },
- generated: {
- line: generated.line,
- column: generated.column
- },
- name: original.name
- });
- }
- } else {
- generated.column++;
- }
- }
- });
- this.walkSourceContents(function (sourceFile, sourceContent) {
- map.setSourceContent(sourceFile, sourceContent);
- });
- return {
- code: generated.code,
- map: map
- };
- };
- exports.SourceNode = SourceNode;
- /***/ }),
- /***/ "./node_modules/snapdragon/node_modules/source-map/lib/util.js":
- /*!*********************************************************************!*\
- !*** ./node_modules/snapdragon/node_modules/source-map/lib/util.js ***!
- \*********************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* -*- Mode: js; js-indent-level: 2; -*- */
- /*
- * Copyright 2011 Mozilla Foundation and contributors
- * Licensed under the New BSD license. See LICENSE or:
- * http://opensource.org/licenses/BSD-3-Clause
- */
- /**
- * This is a helper function for getting values from parameter/options
- * objects.
- *
- * @param args The object we are extracting values from
- * @param name The name of the property we are getting.
- * @param defaultValue An optional value to return if the property is missing
- * from the object. If this is not specified and the property is missing, an
- * error will be thrown.
- */
- function getArg(aArgs, aName, aDefaultValue) {
- if (aName in aArgs) {
- return aArgs[aName];
- } else if (arguments.length === 3) {
- return aDefaultValue;
- } else {
- throw new Error('"' + aName + '" is a required argument.');
- }
- }
- exports.getArg = getArg;
- var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/;
- var dataUrlRegexp = /^data:.+\,.+$/;
- function urlParse(aUrl) {
- var match = aUrl.match(urlRegexp);
- if (!match) {
- return null;
- }
- return {
- scheme: match[1],
- auth: match[2],
- host: match[3],
- port: match[4],
- path: match[5]
- };
- }
- exports.urlParse = urlParse;
- function urlGenerate(aParsedUrl) {
- var url = '';
- if (aParsedUrl.scheme) {
- url += aParsedUrl.scheme + ':';
- }
- url += '//';
- if (aParsedUrl.auth) {
- url += aParsedUrl.auth + '@';
- }
- if (aParsedUrl.host) {
- url += aParsedUrl.host;
- }
- if (aParsedUrl.port) {
- url += ":" + aParsedUrl.port;
- }
- if (aParsedUrl.path) {
- url += aParsedUrl.path;
- }
- return url;
- }
- exports.urlGenerate = urlGenerate;
- /**
- * Normalizes a path, or the path portion of a URL:
- *
- * - Replaces consecutive slashes with one slash.
- * - Removes unnecessary '.' parts.
- * - Removes unnecessary '<dir>/..' parts.
- *
- * Based on code in the Node.js 'path' core module.
- *
- * @param aPath The path or url to normalize.
- */
- function normalize(aPath) {
- var path = aPath;
- var url = urlParse(aPath);
- if (url) {
- if (!url.path) {
- return aPath;
- }
- path = url.path;
- }
- var isAbsolute = exports.isAbsolute(path);
- var parts = path.split(/\/+/);
- for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
- part = parts[i];
- if (part === '.') {
- parts.splice(i, 1);
- } else if (part === '..') {
- up++;
- } else if (up > 0) {
- if (part === '') {
- // The first part is blank if the path is absolute. Trying to go
- // above the root is a no-op. Therefore we can remove all '..' parts
- // directly after the root.
- parts.splice(i + 1, up);
- up = 0;
- } else {
- parts.splice(i, 2);
- up--;
- }
- }
- }
- path = parts.join('/');
- if (path === '') {
- path = isAbsolute ? '/' : '.';
- }
- if (url) {
- url.path = path;
- return urlGenerate(url);
- }
- return path;
- }
- exports.normalize = normalize;
- /**
- * Joins two paths/URLs.
- *
- * @param aRoot The root path or URL.
- * @param aPath The path or URL to be joined with the root.
- *
- * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
- * scheme-relative URL: Then the scheme of aRoot, if any, is prepended
- * first.
- * - Otherwise aPath is a path. If aRoot is a URL, then its path portion
- * is updated with the result and aRoot is returned. Otherwise the result
- * is returned.
- * - If aPath is absolute, the result is aPath.
- * - Otherwise the two paths are joined with a slash.
- * - Joining for example 'http://' and 'www.example.com' is also supported.
- */
- function join(aRoot, aPath) {
- if (aRoot === "") {
- aRoot = ".";
- }
- if (aPath === "") {
- aPath = ".";
- }
- var aPathUrl = urlParse(aPath);
- var aRootUrl = urlParse(aRoot);
- if (aRootUrl) {
- aRoot = aRootUrl.path || '/';
- } // `join(foo, '//www.example.org')`
- if (aPathUrl && !aPathUrl.scheme) {
- if (aRootUrl) {
- aPathUrl.scheme = aRootUrl.scheme;
- }
- return urlGenerate(aPathUrl);
- }
- if (aPathUrl || aPath.match(dataUrlRegexp)) {
- return aPath;
- } // `join('http://', 'www.example.com')`
- if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
- aRootUrl.host = aPath;
- return urlGenerate(aRootUrl);
- }
- var joined = aPath.charAt(0) === '/' ? aPath : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
- if (aRootUrl) {
- aRootUrl.path = joined;
- return urlGenerate(aRootUrl);
- }
- return joined;
- }
- exports.join = join;
- exports.isAbsolute = function (aPath) {
- return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp);
- };
- /**
- * Make a path relative to a URL or another path.
- *
- * @param aRoot The root path or URL.
- * @param aPath The path or URL to be made relative to aRoot.
- */
- function relative(aRoot, aPath) {
- if (aRoot === "") {
- aRoot = ".";
- }
- aRoot = aRoot.replace(/\/$/, ''); // It is possible for the path to be above the root. In this case, simply
- // checking whether the root is a prefix of the path won't work. Instead, we
- // need to remove components from the root one by one, until either we find
- // a prefix that fits, or we run out of components to remove.
- var level = 0;
- while (aPath.indexOf(aRoot + '/') !== 0) {
- var index = aRoot.lastIndexOf("/");
- if (index < 0) {
- return aPath;
- } // If the only part of the root that is left is the scheme (i.e. http://,
- // file:///, etc.), one or more slashes (/), or simply nothing at all, we
- // have exhausted all components, so the path is not relative to the root.
- aRoot = aRoot.slice(0, index);
- if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
- return aPath;
- }
- ++level;
- } // Make sure we add a "../" for each component we removed from the root.
- return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
- }
- exports.relative = relative;
- var supportsNullProto = function () {
- var obj = Object.create(null);
- return !('__proto__' in obj);
- }();
- function identity(s) {
- return s;
- }
- /**
- * Because behavior goes wacky when you set `__proto__` on objects, we
- * have to prefix all the strings in our set with an arbitrary character.
- *
- * See https://github.com/mozilla/source-map/pull/31 and
- * https://github.com/mozilla/source-map/issues/30
- *
- * @param String aStr
- */
- function toSetString(aStr) {
- if (isProtoString(aStr)) {
- return '$' + aStr;
- }
- return aStr;
- }
- exports.toSetString = supportsNullProto ? identity : toSetString;
- function fromSetString(aStr) {
- if (isProtoString(aStr)) {
- return aStr.slice(1);
- }
- return aStr;
- }
- exports.fromSetString = supportsNullProto ? identity : fromSetString;
- function isProtoString(s) {
- if (!s) {
- return false;
- }
- var length = s.length;
- if (length < 9
- /* "__proto__".length */
- ) {
- return false;
- }
- if (s.charCodeAt(length - 1) !== 95
- /* '_' */
- || s.charCodeAt(length - 2) !== 95
- /* '_' */
- || s.charCodeAt(length - 3) !== 111
- /* 'o' */
- || s.charCodeAt(length - 4) !== 116
- /* 't' */
- || s.charCodeAt(length - 5) !== 111
- /* 'o' */
- || s.charCodeAt(length - 6) !== 114
- /* 'r' */
- || s.charCodeAt(length - 7) !== 112
- /* 'p' */
- || s.charCodeAt(length - 8) !== 95
- /* '_' */
- || s.charCodeAt(length - 9) !== 95
- /* '_' */
- ) {
- return false;
- }
- for (var i = length - 10; i >= 0; i--) {
- if (s.charCodeAt(i) !== 36
- /* '$' */
- ) {
- return false;
- }
- }
- return true;
- }
- /**
- * Comparator between two mappings where the original positions are compared.
- *
- * Optionally pass in `true` as `onlyCompareGenerated` to consider two
- * mappings with the same original source/line/column, but different generated
- * line and column the same. Useful when searching for a mapping with a
- * stubbed out mapping.
- */
- function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
- var cmp = mappingA.source - mappingB.source;
- if (cmp !== 0) {
- return cmp;
- }
- cmp = mappingA.originalLine - mappingB.originalLine;
- if (cmp !== 0) {
- return cmp;
- }
- cmp = mappingA.originalColumn - mappingB.originalColumn;
- if (cmp !== 0 || onlyCompareOriginal) {
- return cmp;
- }
- cmp = mappingA.generatedColumn - mappingB.generatedColumn;
- if (cmp !== 0) {
- return cmp;
- }
- cmp = mappingA.generatedLine - mappingB.generatedLine;
- if (cmp !== 0) {
- return cmp;
- }
- return mappingA.name - mappingB.name;
- }
- exports.compareByOriginalPositions = compareByOriginalPositions;
- /**
- * Comparator between two mappings with deflated source and name indices where
- * the generated positions are compared.
- *
- * Optionally pass in `true` as `onlyCompareGenerated` to consider two
- * mappings with the same generated line and column, but different
- * source/name/original line and column the same. Useful when searching for a
- * mapping with a stubbed out mapping.
- */
- function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
- var cmp = mappingA.generatedLine - mappingB.generatedLine;
- if (cmp !== 0) {
- return cmp;
- }
- cmp = mappingA.generatedColumn - mappingB.generatedColumn;
- if (cmp !== 0 || onlyCompareGenerated) {
- return cmp;
- }
- cmp = mappingA.source - mappingB.source;
- if (cmp !== 0) {
- return cmp;
- }
- cmp = mappingA.originalLine - mappingB.originalLine;
- if (cmp !== 0) {
- return cmp;
- }
- cmp = mappingA.originalColumn - mappingB.originalColumn;
- if (cmp !== 0) {
- return cmp;
- }
- return mappingA.name - mappingB.name;
- }
- exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
- function strcmp(aStr1, aStr2) {
- if (aStr1 === aStr2) {
- return 0;
- }
- if (aStr1 > aStr2) {
- return 1;
- }
- return -1;
- }
- /**
- * Comparator between two mappings with inflated source and name strings where
- * the generated positions are compared.
- */
- function compareByGeneratedPositionsInflated(mappingA, mappingB) {
- var cmp = mappingA.generatedLine - mappingB.generatedLine;
- if (cmp !== 0) {
- return cmp;
- }
- cmp = mappingA.generatedColumn - mappingB.generatedColumn;
- if (cmp !== 0) {
- return cmp;
- }
- cmp = strcmp(mappingA.source, mappingB.source);
- if (cmp !== 0) {
- return cmp;
- }
- cmp = mappingA.originalLine - mappingB.originalLine;
- if (cmp !== 0) {
- return cmp;
- }
- cmp = mappingA.originalColumn - mappingB.originalColumn;
- if (cmp !== 0) {
- return cmp;
- }
- return strcmp(mappingA.name, mappingB.name);
- }
- exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
- /***/ }),
- /***/ "./node_modules/snapdragon/node_modules/source-map/source-map.js":
- /*!***********************************************************************!*\
- !*** ./node_modules/snapdragon/node_modules/source-map/source-map.js ***!
- \***********************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*
- * Copyright 2009-2011 Mozilla Foundation and contributors
- * Licensed under the New BSD license. See LICENSE.txt or:
- * http://opensource.org/licenses/BSD-3-Clause
- */
- exports.SourceMapGenerator = __webpack_require__(/*! ./lib/source-map-generator */ "./node_modules/snapdragon/node_modules/source-map/lib/source-map-generator.js").SourceMapGenerator;
- exports.SourceMapConsumer = __webpack_require__(/*! ./lib/source-map-consumer */ "./node_modules/snapdragon/node_modules/source-map/lib/source-map-consumer.js").SourceMapConsumer;
- exports.SourceNode = __webpack_require__(/*! ./lib/source-node */ "./node_modules/snapdragon/node_modules/source-map/lib/source-node.js").SourceNode;
- /***/ }),
- /***/ "./node_modules/source-map-resolve/source-map-resolve.js":
- /*!***************************************************************!*\
- !*** ./node_modules/source-map-resolve/source-map-resolve.js ***!
- \***************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(setImmediate) {var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- // Copyright 2014, 2015, 2016, 2017 Simon Lydell
- // X11 (“MIT”) Licensed. (See LICENSE.)
- // Note: source-map-resolve.js is generated from source-map-resolve-node.js and
- // source-map-resolve-template.js. Only edit the two latter files, _not_
- // source-map-resolve.js!
- void function (root, factory) {
- if (true) {
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(/*! source-map-url */ "./node_modules/source-map-url/source-map-url.js"), __webpack_require__(/*! resolve-url */ "./node_modules/resolve-url/resolve-url.js")], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
- __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
- (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- } else { var resolveUrl, sourceMappingURL; }
- }(void 0, function (sourceMappingURL, resolveUrl) {
- function callbackAsync(callback, error, result) {
- setImmediate(function () {
- callback(error, result);
- });
- }
- function parseMapToJSON(string, data) {
- try {
- return JSON.parse(string.replace(/^\)\]\}'/, ""));
- } catch (error) {
- error.sourceMapData = data;
- throw error;
- }
- }
- function readSync(read, url, data) {
- var readUrl = url;
- try {
- return String(read(readUrl));
- } catch (error) {
- error.sourceMapData = data;
- throw error;
- }
- }
- function resolveSourceMap(code, codeUrl, read, callback) {
- var mapData;
- try {
- mapData = resolveSourceMapHelper(code, codeUrl);
- } catch (error) {
- return callbackAsync(callback, error);
- }
- if (!mapData || mapData.map) {
- return callbackAsync(callback, null, mapData);
- }
- var readUrl = mapData.url;
- read(readUrl, function (error, result) {
- if (error) {
- error.sourceMapData = mapData;
- return callback(error);
- }
- mapData.map = String(result);
- try {
- mapData.map = parseMapToJSON(mapData.map, mapData);
- } catch (error) {
- return callback(error);
- }
- callback(null, mapData);
- });
- }
- function resolveSourceMapSync(code, codeUrl, read) {
- var mapData = resolveSourceMapHelper(code, codeUrl);
- if (!mapData || mapData.map) {
- return mapData;
- }
- mapData.map = readSync(read, mapData.url, mapData);
- mapData.map = parseMapToJSON(mapData.map, mapData);
- return mapData;
- }
- var dataUriRegex = /^data:([^,;]*)(;[^,;]*)*(?:,(.*))?$/;
- var jsonMimeTypeRegex = /^(?:application|text)\/json$/;
- function resolveSourceMapHelper(code, codeUrl) {
- var url = sourceMappingURL.getFrom(code);
- if (!url) {
- return null;
- }
- var dataUri = url.match(dataUriRegex);
- if (dataUri) {
- var mimeType = dataUri[1];
- var lastParameter = dataUri[2] || "";
- var encoded = dataUri[3] || "";
- var data = {
- sourceMappingURL: url,
- url: null,
- sourcesRelativeTo: codeUrl,
- map: encoded
- };
- if (!jsonMimeTypeRegex.test(mimeType)) {
- var error = new Error("Unuseful data uri mime type: " + (mimeType || "text/plain"));
- error.sourceMapData = data;
- throw error;
- }
- data.map = parseMapToJSON(lastParameter === ";base64" ? atob(encoded) : decodeURIComponent(encoded), data);
- return data;
- }
- var mapUrl = resolveUrl(codeUrl, url);
- return {
- sourceMappingURL: url,
- url: mapUrl,
- sourcesRelativeTo: mapUrl,
- map: null
- };
- }
- function resolveSources(map, mapUrl, read, options, callback) {
- if (typeof options === "function") {
- callback = options;
- options = {};
- }
- var pending = map.sources ? map.sources.length : 0;
- var result = {
- sourcesResolved: [],
- sourcesContent: []
- };
- if (pending === 0) {
- callbackAsync(callback, null, result);
- return;
- }
- var done = function done() {
- pending--;
- if (pending === 0) {
- callback(null, result);
- }
- };
- resolveSourcesHelper(map, mapUrl, options, function (fullUrl, sourceContent, index) {
- result.sourcesResolved[index] = fullUrl;
- if (typeof sourceContent === "string") {
- result.sourcesContent[index] = sourceContent;
- callbackAsync(done, null);
- } else {
- var readUrl = fullUrl;
- read(readUrl, function (error, source) {
- result.sourcesContent[index] = error ? error : String(source);
- done();
- });
- }
- });
- }
- function resolveSourcesSync(map, mapUrl, read, options) {
- var result = {
- sourcesResolved: [],
- sourcesContent: []
- };
- if (!map.sources || map.sources.length === 0) {
- return result;
- }
- resolveSourcesHelper(map, mapUrl, options, function (fullUrl, sourceContent, index) {
- result.sourcesResolved[index] = fullUrl;
- if (read !== null) {
- if (typeof sourceContent === "string") {
- result.sourcesContent[index] = sourceContent;
- } else {
- var readUrl = fullUrl;
- try {
- result.sourcesContent[index] = String(read(readUrl));
- } catch (error) {
- result.sourcesContent[index] = error;
- }
- }
- }
- });
- return result;
- }
- var endingSlash = /\/?$/;
- function resolveSourcesHelper(map, mapUrl, options, fn) {
- options = options || {};
- var fullUrl;
- var sourceContent;
- var sourceRoot;
- for (var index = 0, len = map.sources.length; index < len; index++) {
- sourceRoot = null;
- if (typeof options.sourceRoot === "string") {
- sourceRoot = options.sourceRoot;
- } else if (typeof map.sourceRoot === "string" && options.sourceRoot !== false) {
- sourceRoot = map.sourceRoot;
- } // If the sourceRoot is the empty string, it is equivalent to not setting
- // the property at all.
- if (sourceRoot === null || sourceRoot === '') {
- fullUrl = resolveUrl(mapUrl, map.sources[index]);
- } else {
- // Make sure that the sourceRoot ends with a slash, so that `/scripts/subdir` becomes
- // `/scripts/subdir/<source>`, not `/scripts/<source>`. Pointing to a file as source root
- // does not make sense.
- fullUrl = resolveUrl(mapUrl, sourceRoot.replace(endingSlash, "/"), map.sources[index]);
- }
- sourceContent = (map.sourcesContent || [])[index];
- fn(fullUrl, sourceContent, index);
- }
- }
- function resolve(code, codeUrl, read, options, callback) {
- if (typeof options === "function") {
- callback = options;
- options = {};
- }
- if (code === null) {
- var mapUrl = codeUrl;
- var data = {
- sourceMappingURL: null,
- url: mapUrl,
- sourcesRelativeTo: mapUrl,
- map: null
- };
- var readUrl = mapUrl;
- read(readUrl, function (error, result) {
- if (error) {
- error.sourceMapData = data;
- return callback(error);
- }
- data.map = String(result);
- try {
- data.map = parseMapToJSON(data.map, data);
- } catch (error) {
- return callback(error);
- }
- _resolveSources(data);
- });
- } else {
- resolveSourceMap(code, codeUrl, read, function (error, mapData) {
- if (error) {
- return callback(error);
- }
- if (!mapData) {
- return callback(null, null);
- }
- _resolveSources(mapData);
- });
- }
- function _resolveSources(mapData) {
- resolveSources(mapData.map, mapData.sourcesRelativeTo, read, options, function (error, result) {
- if (error) {
- return callback(error);
- }
- mapData.sourcesResolved = result.sourcesResolved;
- mapData.sourcesContent = result.sourcesContent;
- callback(null, mapData);
- });
- }
- }
- function resolveSync(code, codeUrl, read, options) {
- var mapData;
- if (code === null) {
- var mapUrl = codeUrl;
- mapData = {
- sourceMappingURL: null,
- url: mapUrl,
- sourcesRelativeTo: mapUrl,
- map: null
- };
- mapData.map = readSync(read, mapUrl, mapData);
- mapData.map = parseMapToJSON(mapData.map, mapData);
- } else {
- mapData = resolveSourceMapSync(code, codeUrl, read);
- if (!mapData) {
- return null;
- }
- }
- var result = resolveSourcesSync(mapData.map, mapData.sourcesRelativeTo, read, options);
- mapData.sourcesResolved = result.sourcesResolved;
- mapData.sourcesContent = result.sourcesContent;
- return mapData;
- }
- return {
- resolveSourceMap: resolveSourceMap,
- resolveSourceMapSync: resolveSourceMapSync,
- resolveSources: resolveSources,
- resolveSourcesSync: resolveSourcesSync,
- resolve: resolve,
- resolveSync: resolveSync,
- parseMapToJSON: parseMapToJSON
- };
- });
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../timers-browserify/main.js */ "./node_modules/timers-browserify/main.js").setImmediate))
- /***/ }),
- /***/ "./node_modules/source-map-url/source-map-url.js":
- /*!*******************************************************!*\
- !*** ./node_modules/source-map-url/source-map-url.js ***!
- \*******************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- // Copyright 2014 Simon Lydell
- // X11 (“MIT”) Licensed. (See LICENSE.)
- void function (root, factory) {
- if (true) {
- !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
- __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
- (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
- __WEBPACK_AMD_DEFINE_FACTORY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- } else {}
- }(void 0, function () {
- var innerRegex = /[#@] sourceMappingURL=([^\s'"]*)/;
- var regex = RegExp("(?:" + "/\\*" + "(?:\\s*\r?\n(?://)?)?" + "(?:" + innerRegex.source + ")" + "\\s*" + "\\*/" + "|" + "//(?:" + innerRegex.source + ")" + ")" + "\\s*");
- return {
- regex: regex,
- _innerRegex: innerRegex,
- getFrom: function getFrom(code) {
- var match = code.match(regex);
- return match ? match[1] || match[2] || "" : null;
- },
- existsIn: function existsIn(code) {
- return regex.test(code);
- },
- removeFrom: function removeFrom(code) {
- return code.replace(regex, "");
- },
- insertBefore: function insertBefore(code, string) {
- var match = code.match(regex);
- if (match) {
- return code.slice(0, match.index) + string + code.slice(match.index);
- } else {
- return code + string;
- }
- }
- };
- });
- /***/ }),
- /***/ "./node_modules/split-string/index.js":
- /*!********************************************!*\
- !*** ./node_modules/split-string/index.js ***!
- \********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * split-string <https://github.com/jonschlinkert/split-string>
- *
- * Copyright (c) 2015-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- var extend = __webpack_require__(/*! extend-shallow */ "./node_modules/split-string/node_modules/extend-shallow/index.js");
- module.exports = function (str, options, fn) {
- if (typeof str !== 'string') {
- throw new TypeError('expected a string');
- }
- if (typeof options === 'function') {
- fn = options;
- options = null;
- } // allow separator to be defined as a string
- if (typeof options === 'string') {
- options = {
- sep: options
- };
- }
- var opts = extend({
- sep: '.'
- }, options);
- var quotes = opts.quotes || ['"', "'", '`'];
- var brackets;
- if (opts.brackets === true) {
- brackets = {
- '<': '>',
- '(': ')',
- '[': ']',
- '{': '}'
- };
- } else if (opts.brackets) {
- brackets = opts.brackets;
- }
- var tokens = [];
- var stack = [];
- var arr = [''];
- var sep = opts.sep;
- var len = str.length;
- var idx = -1;
- var closeIdx;
- function expected() {
- if (brackets && stack.length) {
- return brackets[stack[stack.length - 1]];
- }
- }
- while (++idx < len) {
- var ch = str[idx];
- var next = str[idx + 1];
- var tok = {
- val: ch,
- idx: idx,
- arr: arr,
- str: str
- };
- tokens.push(tok);
- if (ch === '\\') {
- tok.val = keepEscaping(opts, str, idx) === true ? ch + next : next;
- tok.escaped = true;
- if (typeof fn === 'function') {
- fn(tok);
- }
- arr[arr.length - 1] += tok.val;
- idx++;
- continue;
- }
- if (brackets && brackets[ch]) {
- stack.push(ch);
- var e = expected();
- var i = idx + 1;
- if (str.indexOf(e, i + 1) !== -1) {
- while (stack.length && i < len) {
- var s = str[++i];
- if (s === '\\') {
- s++;
- continue;
- }
- if (quotes.indexOf(s) !== -1) {
- i = getClosingQuote(str, s, i + 1);
- continue;
- }
- e = expected();
- if (stack.length && str.indexOf(e, i + 1) === -1) {
- break;
- }
- if (brackets[s]) {
- stack.push(s);
- continue;
- }
- if (e === s) {
- stack.pop();
- }
- }
- }
- closeIdx = i;
- if (closeIdx === -1) {
- arr[arr.length - 1] += ch;
- continue;
- }
- ch = str.slice(idx, closeIdx + 1);
- tok.val = ch;
- tok.idx = idx = closeIdx;
- }
- if (quotes.indexOf(ch) !== -1) {
- closeIdx = getClosingQuote(str, ch, idx + 1);
- if (closeIdx === -1) {
- arr[arr.length - 1] += ch;
- continue;
- }
- if (keepQuotes(ch, opts) === true) {
- ch = str.slice(idx, closeIdx + 1);
- } else {
- ch = str.slice(idx + 1, closeIdx);
- }
- tok.val = ch;
- tok.idx = idx = closeIdx;
- }
- if (typeof fn === 'function') {
- fn(tok, tokens);
- ch = tok.val;
- idx = tok.idx;
- }
- if (tok.val === sep && tok.split !== false) {
- arr.push('');
- continue;
- }
- arr[arr.length - 1] += tok.val;
- }
- return arr;
- };
- function getClosingQuote(str, ch, i, brackets) {
- var idx = str.indexOf(ch, i);
- if (str.charAt(idx - 1) === '\\') {
- return getClosingQuote(str, ch, idx + 1);
- }
- return idx;
- }
- function keepQuotes(ch, opts) {
- if (opts.keepDoubleQuotes === true && ch === '"') return true;
- if (opts.keepSingleQuotes === true && ch === "'") return true;
- return opts.keepQuotes;
- }
- function keepEscaping(opts, str, idx) {
- if (typeof opts.keepEscaping === 'function') {
- return opts.keepEscaping(str, idx);
- }
- return opts.keepEscaping === true || str[idx + 1] === '\\';
- }
- /***/ }),
- /***/ "./node_modules/split-string/node_modules/extend-shallow/index.js":
- /*!************************************************************************!*\
- !*** ./node_modules/split-string/node_modules/extend-shallow/index.js ***!
- \************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- var isExtendable = __webpack_require__(/*! is-extendable */ "./node_modules/split-string/node_modules/is-extendable/index.js");
- var assignSymbols = __webpack_require__(/*! assign-symbols */ "./node_modules/assign-symbols/index.js");
- module.exports = Object.assign || function (obj
- /*, objects*/
- ) {
- if (obj === null || typeof obj === 'undefined') {
- throw new TypeError('Cannot convert undefined or null to object');
- }
- if (!isObject(obj)) {
- obj = {};
- }
- for (var i = 1; i < arguments.length; i++) {
- var val = arguments[i];
- if (isString(val)) {
- val = toObject(val);
- }
- if (isObject(val)) {
- assign(obj, val);
- assignSymbols(obj, val);
- }
- }
- return obj;
- };
- function assign(a, b) {
- for (var key in b) {
- if (hasOwn(b, key)) {
- a[key] = b[key];
- }
- }
- }
- function isString(val) {
- return val && typeof val === 'string';
- }
- function toObject(str) {
- var obj = {};
- for (var i in str) {
- obj[i] = str[i];
- }
- return obj;
- }
- function isObject(val) {
- return val && _typeof(val) === 'object' || isExtendable(val);
- }
- /**
- * Returns true if the given `key` is an own property of `obj`.
- */
- function hasOwn(obj, key) {
- return Object.prototype.hasOwnProperty.call(obj, key);
- }
- function isEnum(obj, key) {
- return Object.prototype.propertyIsEnumerable.call(obj, key);
- }
- /***/ }),
- /***/ "./node_modules/split-string/node_modules/is-extendable/index.js":
- /*!***********************************************************************!*\
- !*** ./node_modules/split-string/node_modules/is-extendable/index.js ***!
- \***********************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * is-extendable <https://github.com/jonschlinkert/is-extendable>
- *
- * Copyright (c) 2015-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- var isPlainObject = __webpack_require__(/*! is-plain-object */ "./node_modules/is-plain-object/index.js");
- module.exports = function isExtendable(val) {
- return isPlainObject(val) || typeof val === 'function' || Array.isArray(val);
- };
- /***/ }),
- /***/ "./node_modules/stack-utils/index.js":
- /*!*******************************************!*\
- !*** ./node_modules/stack-utils/index.js ***!
- \*******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(process) {
- module.exports = StackUtils;
- function StackUtils(opts) {
- if (!(this instanceof StackUtils)) {
- throw new Error('StackUtils constructor must be called with new');
- }
- opts = opts || {};
- this._cwd = (opts.cwd || process.cwd()).replace(/\\/g, '/');
- this._internals = opts.internals || [];
- this._wrapCallSite = opts.wrapCallSite || false;
- }
- module.exports.nodeInternals = nodeInternals;
- function nodeInternals() {
- if (!module.exports.natives) {
- module.exports.natives = Object.keys(process.binding('natives'));
- module.exports.natives.push('bootstrap_node', 'node', 'internal/bootstrap/node');
- }
- return module.exports.natives.map(function (n) {
- return new RegExp('\\(' + n + '\\.js:\\d+:\\d+\\)$');
- }).concat([/\s*at (bootstrap_)?node\.js:\d+:\d+?$/, /\(internal\/[^:]+:\d+:\d+\)$/, /\/\.node-spawn-wrap-\w+-\w+\/node:\d+:\d+\)?$/]);
- }
- StackUtils.prototype.clean = function (stack) {
- if (!Array.isArray(stack)) {
- stack = stack.split('\n');
- }
- if (!/^\s*at /.test(stack[0]) && /^\s*at /.test(stack[1])) {
- stack = stack.slice(1);
- }
- var outdent = false;
- var lastNonAtLine = null;
- var result = [];
- stack.forEach(function (st) {
- st = st.replace(/\\/g, '/');
- var isInternal = this._internals.some(function (internal) {
- return internal.test(st);
- });
- if (isInternal) {
- return null;
- }
- var isAtLine = /^\s*at /.test(st);
- if (outdent) {
- st = st.replace(/\s+$/, '').replace(/^(\s+)at /, '$1');
- } else {
- st = st.trim();
- if (isAtLine) {
- st = st.substring(3);
- }
- }
- st = st.replace(this._cwd + '/', '');
- if (st) {
- if (isAtLine) {
- if (lastNonAtLine) {
- result.push(lastNonAtLine);
- lastNonAtLine = null;
- }
- result.push(st);
- } else {
- outdent = true;
- lastNonAtLine = st;
- }
- }
- }, this);
- stack = result.join('\n').trim();
- if (stack) {
- return stack + '\n';
- }
- return '';
- };
- StackUtils.prototype.captureString = function (limit, fn) {
- if (typeof limit === 'function') {
- fn = limit;
- limit = Infinity;
- }
- if (!fn) {
- fn = this.captureString;
- }
- var limitBefore = Error.stackTraceLimit;
- if (limit) {
- Error.stackTraceLimit = limit;
- }
- var obj = {};
- Error.captureStackTrace(obj, fn);
- var stack = obj.stack;
- Error.stackTraceLimit = limitBefore;
- return this.clean(stack);
- };
- StackUtils.prototype.capture = function (limit, fn) {
- if (typeof limit === 'function') {
- fn = limit;
- limit = Infinity;
- }
- if (!fn) {
- fn = this.capture;
- }
- var prepBefore = Error.prepareStackTrace;
- var limitBefore = Error.stackTraceLimit;
- var wrapCallSite = this._wrapCallSite;
- Error.prepareStackTrace = function (obj, site) {
- if (wrapCallSite) {
- return site.map(wrapCallSite);
- }
- return site;
- };
- if (limit) {
- Error.stackTraceLimit = limit;
- }
- var obj = {};
- Error.captureStackTrace(obj, fn);
- var stack = obj.stack;
- Error.prepareStackTrace = prepBefore;
- Error.stackTraceLimit = limitBefore;
- return stack;
- };
- StackUtils.prototype.at = function at(fn) {
- if (!fn) {
- fn = at;
- }
- var site = this.capture(1, fn)[0];
- if (!site) {
- return {};
- }
- var res = {
- line: site.getLineNumber(),
- column: site.getColumnNumber()
- };
- this._setFile(res, site.getFileName());
- if (site.isConstructor()) {
- res.constructor = true;
- }
- if (site.isEval()) {
- res.evalOrigin = site.getEvalOrigin();
- } // Node v10 stopped with the isNative() on callsites, apparently
- /* istanbul ignore next */
- if (site.isNative()) {
- res.native = true;
- }
- var typename = null;
- try {
- typename = site.getTypeName();
- } catch (er) {}
- if (typename && typename !== 'Object' && typename !== '[object Object]') {
- res.type = typename;
- }
- var fname = site.getFunctionName();
- if (fname) {
- res.function = fname;
- }
- var meth = site.getMethodName();
- if (meth && fname !== meth) {
- res.method = meth;
- }
- return res;
- };
- StackUtils.prototype._setFile = function (result, filename) {
- if (filename) {
- filename = filename.replace(/\\/g, '/');
- if (filename.indexOf(this._cwd + '/') === 0) {
- filename = filename.substr(this._cwd.length + 1);
- }
- result.file = filename;
- }
- };
- var re = new RegExp('^' + // Sometimes we strip out the ' at' because it's noisy
- '(?:\\s*at )?' + // $1 = ctor if 'new'
- '(?:(new) )?' + // $2 = function name (can be literally anything)
- // May contain method at the end as [as xyz]
- '(?:(.*?) \\()?' + // (eval at <anonymous> (file.js:1:1),
- // $3 = eval origin
- // $4:$5:$6 are eval file/line/col, but not normally reported
- '(?:eval at ([^ ]+) \\((.+?):(\\d+):(\\d+)\\), )?' + // file:line:col
- // $7:$8:$9
- // $10 = 'native' if native
- '(?:(.+?):(\\d+):(\\d+)|(native))' + // maybe close the paren, then end
- // if $11 is ), then we only allow balanced parens in the filename
- // any imbalance is placed on the fname. This is a heuristic, and
- // bound to be incorrect in some edge cases. The bet is that
- // having weird characters in method names is more common than
- // having weird characters in filenames, which seems reasonable.
- '(\\)?)$');
- var methodRe = /^(.*?) \[as (.*?)\]$/;
- StackUtils.prototype.parseLine = function parseLine(line) {
- var match = line && line.match(re);
- if (!match) {
- return null;
- }
- var ctor = match[1] === 'new';
- var fname = match[2];
- var evalOrigin = match[3];
- var evalFile = match[4];
- var evalLine = Number(match[5]);
- var evalCol = Number(match[6]);
- var file = match[7];
- var lnum = match[8];
- var col = match[9];
- var native = match[10] === 'native';
- var closeParen = match[11] === ')';
- var res = {};
- if (lnum) {
- res.line = Number(lnum);
- }
- if (col) {
- res.column = Number(col);
- }
- if (closeParen && file) {
- // make sure parens are balanced
- // if we have a file like "asdf) [as foo] (xyz.js", then odds are
- // that the fname should be += " (asdf) [as foo]" and the file
- // should be just "xyz.js"
- // walk backwards from the end to find the last unbalanced (
- var closes = 0;
- for (var i = file.length - 1; i > 0; i--) {
- if (file.charAt(i) === ')') {
- closes++;
- } else if (file.charAt(i) === '(' && file.charAt(i - 1) === ' ') {
- closes--;
- if (closes === -1 && file.charAt(i - 1) === ' ') {
- var before = file.substr(0, i - 1);
- var after = file.substr(i + 1);
- file = after;
- fname += ' (' + before;
- break;
- }
- }
- }
- }
- if (fname) {
- var methodMatch = fname.match(methodRe);
- if (methodMatch) {
- fname = methodMatch[1];
- var meth = methodMatch[2];
- }
- }
- this._setFile(res, file);
- if (ctor) {
- res.constructor = true;
- }
- if (evalOrigin) {
- res.evalOrigin = evalOrigin;
- res.evalLine = evalLine;
- res.evalColumn = evalCol;
- res.evalFile = evalFile && evalFile.replace(/\\/g, '/');
- }
- if (native) {
- res.native = true;
- }
- if (fname) {
- res.function = fname;
- }
- if (meth && fname !== meth) {
- res.method = meth;
- }
- return res;
- };
- var bound = new StackUtils();
- Object.keys(StackUtils.prototype).forEach(function (key) {
- StackUtils[key] = bound[key].bind(bound);
- });
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../process/browser.js */ "./node_modules/process/browser.js")))
- /***/ }),
- /***/ "./node_modules/static-extend/index.js":
- /*!*********************************************!*\
- !*** ./node_modules/static-extend/index.js ***!
- \*********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * static-extend <https://github.com/jonschlinkert/static-extend>
- *
- * Copyright (c) 2016, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- var copy = __webpack_require__(/*! object-copy */ "./node_modules/object-copy/index.js");
- var define = __webpack_require__(/*! define-property */ "./node_modules/define-property/index.js");
- var util = __webpack_require__(/*! util */ "./node_modules/util/util.js");
- /**
- * Returns a function for extending the static properties,
- * prototype properties, and descriptors from the `Parent`
- * constructor onto `Child` constructors.
- *
- * ```js
- * var extend = require('static-extend');
- * Parent.extend = extend(Parent);
- *
- * // optionally pass a custom merge function as the second arg
- * Parent.extend = extend(Parent, function(Child) {
- * Child.prototype.mixin = function(key, val) {
- * Child.prototype[key] = val;
- * };
- * });
- *
- * // extend "child" constructors
- * Parent.extend(Child);
- *
- * // optionally define prototype methods as the second arg
- * Parent.extend(Child, {
- * foo: function() {},
- * bar: function() {}
- * });
- * ```
- * @param {Function} `Parent` Parent ctor
- * @param {Function} `extendFn` Optional extend function for handling any necessary custom merging. Useful when updating methods that require a specific prototype.
- * @param {Function} `Child` Child ctor
- * @param {Object} `proto` Optionally pass additional prototype properties to inherit.
- * @return {Object}
- * @api public
- */
- function extend(Parent, extendFn) {
- if (typeof Parent !== 'function') {
- throw new TypeError('expected Parent to be a function.');
- }
- return function (Ctor, proto) {
- if (typeof Ctor !== 'function') {
- throw new TypeError('expected Ctor to be a function.');
- }
- util.inherits(Ctor, Parent);
- copy(Ctor, Parent); // proto can be null or a plain object
- if (_typeof(proto) === 'object') {
- var obj = Object.create(proto);
- for (var k in obj) {
- Ctor.prototype[k] = obj[k];
- }
- } // keep a reference to the parent prototype
- define(Ctor.prototype, '_parent_', {
- configurable: true,
- set: function set() {},
- get: function get() {
- return Parent.prototype;
- }
- });
- if (typeof extendFn === 'function') {
- extendFn(Ctor, Parent);
- }
- Ctor.extend = extend(Ctor, extendFn);
- };
- }
- ;
- /**
- * Expose `extend`
- */
- module.exports = extend;
- /***/ }),
- /***/ "./node_modules/timers-browserify/main.js":
- /*!************************************************!*\
- !*** ./node_modules/timers-browserify/main.js ***!
- \************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(global) {
- var scope = typeof global !== "undefined" && global || typeof self !== "undefined" && self || window;
- var apply = Function.prototype.apply; // DOM APIs, for completeness
- exports.setTimeout = function () {
- return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
- };
- exports.setInterval = function () {
- return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
- };
- exports.clearTimeout = exports.clearInterval = function (timeout) {
- if (timeout) {
- timeout.close();
- }
- };
- function Timeout(id, clearFn) {
- this._id = id;
- this._clearFn = clearFn;
- }
- Timeout.prototype.unref = Timeout.prototype.ref = function () {};
- Timeout.prototype.close = function () {
- this._clearFn.call(scope, this._id);
- }; // Does not start the time, just sets up the members needed.
- exports.enroll = function (item, msecs) {
- clearTimeout(item._idleTimeoutId);
- item._idleTimeout = msecs;
- };
- exports.unenroll = function (item) {
- clearTimeout(item._idleTimeoutId);
- item._idleTimeout = -1;
- };
- exports._unrefActive = exports.active = function (item) {
- clearTimeout(item._idleTimeoutId);
- var msecs = item._idleTimeout;
- if (msecs >= 0) {
- item._idleTimeoutId = setTimeout(function onTimeout() {
- if (item._onTimeout) item._onTimeout();
- }, msecs);
- }
- }; // setimmediate attaches itself to the global object
- __webpack_require__(/*! setimmediate */ "./node_modules/setimmediate/setImmediate.js"); // On some exotic environments, it's not clear which object `setimmediate` was
- // able to install onto. Search each possibility in the same order as the
- // `setimmediate` library.
- exports.setImmediate = typeof self !== "undefined" && self.setImmediate || typeof global !== "undefined" && global.setImmediate || void 0 && (void 0).setImmediate;
- exports.clearImmediate = typeof self !== "undefined" && self.clearImmediate || typeof global !== "undefined" && global.clearImmediate || void 0 && (void 0).clearImmediate;
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
- /***/ }),
- /***/ "./node_modules/to-object-path/index.js":
- /*!**********************************************!*\
- !*** ./node_modules/to-object-path/index.js ***!
- \**********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * to-object-path <https://github.com/jonschlinkert/to-object-path>
- *
- * Copyright (c) 2015, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- var typeOf = __webpack_require__(/*! kind-of */ "./node_modules/kind-of/index.js");
- module.exports = function toPath(args) {
- if (typeOf(args) !== 'arguments') {
- args = arguments;
- }
- return filter(args).join('.');
- };
- function filter(arr) {
- var len = arr.length;
- var idx = -1;
- var res = [];
- while (++idx < len) {
- var ele = arr[idx];
- if (typeOf(ele) === 'arguments' || Array.isArray(ele)) {
- res.push.apply(res, filter(ele));
- } else if (typeof ele === 'string') {
- res.push(ele);
- }
- }
- return res;
- }
- /***/ }),
- /***/ "./node_modules/to-regex-range/index.js":
- /*!**********************************************!*\
- !*** ./node_modules/to-regex-range/index.js ***!
- \**********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * to-regex-range <https://github.com/jonschlinkert/to-regex-range>
- *
- * Copyright (c) 2015, 2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- var repeat = __webpack_require__(/*! repeat-string */ "./node_modules/repeat-string/index.js");
- var isNumber = __webpack_require__(/*! is-number */ "./node_modules/is-number/index.js");
- var cache = {};
- function toRegexRange(min, max, options) {
- if (isNumber(min) === false) {
- throw new RangeError('toRegexRange: first argument is invalid.');
- }
- if (typeof max === 'undefined' || min === max) {
- return String(min);
- }
- if (isNumber(max) === false) {
- throw new RangeError('toRegexRange: second argument is invalid.');
- }
- options = options || {};
- var relax = String(options.relaxZeros);
- var shorthand = String(options.shorthand);
- var capture = String(options.capture);
- var key = min + ':' + max + '=' + relax + shorthand + capture;
- if (cache.hasOwnProperty(key)) {
- return cache[key].result;
- }
- var a = Math.min(min, max);
- var b = Math.max(min, max);
- if (Math.abs(a - b) === 1) {
- var result = min + '|' + max;
- if (options.capture) {
- return '(' + result + ')';
- }
- return result;
- }
- var isPadded = padding(min) || padding(max);
- var positives = [];
- var negatives = [];
- var tok = {
- min: min,
- max: max,
- a: a,
- b: b
- };
- if (isPadded) {
- tok.isPadded = isPadded;
- tok.maxLen = String(tok.max).length;
- }
- if (a < 0) {
- var newMin = b < 0 ? Math.abs(b) : 1;
- var newMax = Math.abs(a);
- negatives = splitToPatterns(newMin, newMax, tok, options);
- a = tok.a = 0;
- }
- if (b >= 0) {
- positives = splitToPatterns(a, b, tok, options);
- }
- tok.negatives = negatives;
- tok.positives = positives;
- tok.result = siftPatterns(negatives, positives, options);
- if (options.capture && positives.length + negatives.length > 1) {
- tok.result = '(' + tok.result + ')';
- }
- cache[key] = tok;
- return tok.result;
- }
- function siftPatterns(neg, pos, options) {
- var onlyNegative = filterPatterns(neg, pos, '-', false, options) || [];
- var onlyPositive = filterPatterns(pos, neg, '', false, options) || [];
- var intersected = filterPatterns(neg, pos, '-?', true, options) || [];
- var subpatterns = onlyNegative.concat(intersected).concat(onlyPositive);
- return subpatterns.join('|');
- }
- function splitToRanges(min, max) {
- min = Number(min);
- max = Number(max);
- var nines = 1;
- var stops = [max];
- var stop = +countNines(min, nines);
- while (min <= stop && stop <= max) {
- stops = push(stops, stop);
- nines += 1;
- stop = +countNines(min, nines);
- }
- var zeros = 1;
- stop = countZeros(max + 1, zeros) - 1;
- while (min < stop && stop <= max) {
- stops = push(stops, stop);
- zeros += 1;
- stop = countZeros(max + 1, zeros) - 1;
- }
- stops.sort(compare);
- return stops;
- }
- /**
- * Convert a range to a regex pattern
- * @param {Number} `start`
- * @param {Number} `stop`
- * @return {String}
- */
- function rangeToPattern(start, stop, options) {
- if (start === stop) {
- return {
- pattern: String(start),
- digits: []
- };
- }
- var zipped = zip(String(start), String(stop));
- var len = zipped.length,
- i = -1;
- var pattern = '';
- var digits = 0;
- while (++i < len) {
- var numbers = zipped[i];
- var startDigit = numbers[0];
- var stopDigit = numbers[1];
- if (startDigit === stopDigit) {
- pattern += startDigit;
- } else if (startDigit !== '0' || stopDigit !== '9') {
- pattern += toCharacterClass(startDigit, stopDigit);
- } else {
- digits += 1;
- }
- }
- if (digits) {
- pattern += options.shorthand ? '\\d' : '[0-9]';
- }
- return {
- pattern: pattern,
- digits: [digits]
- };
- }
- function splitToPatterns(min, max, tok, options) {
- var ranges = splitToRanges(min, max);
- var len = ranges.length;
- var idx = -1;
- var tokens = [];
- var start = min;
- var prev;
- while (++idx < len) {
- var range = ranges[idx];
- var obj = rangeToPattern(start, range, options);
- var zeros = '';
- if (!tok.isPadded && prev && prev.pattern === obj.pattern) {
- if (prev.digits.length > 1) {
- prev.digits.pop();
- }
- prev.digits.push(obj.digits[0]);
- prev.string = prev.pattern + toQuantifier(prev.digits);
- start = range + 1;
- continue;
- }
- if (tok.isPadded) {
- zeros = padZeros(range, tok);
- }
- obj.string = zeros + obj.pattern + toQuantifier(obj.digits);
- tokens.push(obj);
- start = range + 1;
- prev = obj;
- }
- return tokens;
- }
- function filterPatterns(arr, comparison, prefix, intersection, options) {
- var res = [];
- for (var i = 0; i < arr.length; i++) {
- var tok = arr[i];
- var ele = tok.string;
- if (options.relaxZeros !== false) {
- if (prefix === '-' && ele.charAt(0) === '0') {
- if (ele.charAt(1) === '{') {
- ele = '0*' + ele.replace(/^0\{\d+\}/, '');
- } else {
- ele = '0*' + ele.slice(1);
- }
- }
- }
- if (!intersection && !contains(comparison, 'string', ele)) {
- res.push(prefix + ele);
- }
- if (intersection && contains(comparison, 'string', ele)) {
- res.push(prefix + ele);
- }
- }
- return res;
- }
- /**
- * Zip strings (`for in` can be used on string characters)
- */
- function zip(a, b) {
- var arr = [];
- for (var ch in a) {
- arr.push([a[ch], b[ch]]);
- }
- return arr;
- }
- function compare(a, b) {
- return a > b ? 1 : b > a ? -1 : 0;
- }
- function push(arr, ele) {
- if (arr.indexOf(ele) === -1) arr.push(ele);
- return arr;
- }
- function contains(arr, key, val) {
- for (var i = 0; i < arr.length; i++) {
- if (arr[i][key] === val) {
- return true;
- }
- }
- return false;
- }
- function countNines(min, len) {
- return String(min).slice(0, -len) + repeat('9', len);
- }
- function countZeros(integer, zeros) {
- return integer - integer % Math.pow(10, zeros);
- }
- function toQuantifier(digits) {
- var start = digits[0];
- var stop = digits[1] ? ',' + digits[1] : '';
- if (!stop && (!start || start === 1)) {
- return '';
- }
- return '{' + start + stop + '}';
- }
- function toCharacterClass(a, b) {
- return '[' + a + (b - a === 1 ? '' : '-') + b + ']';
- }
- function padding(str) {
- return /^-?(0+)\d/.exec(str);
- }
- function padZeros(val, tok) {
- if (tok.isPadded) {
- var diff = Math.abs(tok.maxLen - String(val).length);
- switch (diff) {
- case 0:
- return '';
- case 1:
- return '0';
- default:
- {
- return '0{' + diff + '}';
- }
- }
- }
- return val;
- }
- /**
- * Expose `toRegexRange`
- */
- module.exports = toRegexRange;
- /***/ }),
- /***/ "./node_modules/to-regex/index.js":
- /*!****************************************!*\
- !*** ./node_modules/to-regex/index.js ***!
- \****************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var safe = __webpack_require__(/*! safe-regex */ "./node_modules/safe-regex/index.js");
- var define = __webpack_require__(/*! define-property */ "./node_modules/to-regex/node_modules/define-property/index.js");
- var extend = __webpack_require__(/*! extend-shallow */ "./node_modules/to-regex/node_modules/extend-shallow/index.js");
- var not = __webpack_require__(/*! regex-not */ "./node_modules/regex-not/index.js");
- var MAX_LENGTH = 1024 * 64;
- /**
- * Session cache
- */
- var cache = {};
- /**
- * Create a regular expression from the given `pattern` string.
- *
- * @param {String|RegExp} `pattern` Pattern can be a string or regular expression.
- * @param {Object} `options`
- * @return {RegExp}
- * @api public
- */
- module.exports = function (patterns, options) {
- if (!Array.isArray(patterns)) {
- return makeRe(patterns, options);
- }
- return makeRe(patterns.join('|'), options);
- };
- /**
- * Create a regular expression from the given `pattern` string.
- *
- * @param {String|RegExp} `pattern` Pattern can be a string or regular expression.
- * @param {Object} `options`
- * @return {RegExp}
- * @api public
- */
- function makeRe(pattern, options) {
- if (pattern instanceof RegExp) {
- return pattern;
- }
- if (typeof pattern !== 'string') {
- throw new TypeError('expected a string');
- }
- if (pattern.length > MAX_LENGTH) {
- throw new Error('expected pattern to be less than ' + MAX_LENGTH + ' characters');
- }
- var key = pattern; // do this before shallow cloning options, it's a lot faster
- if (!options || options && options.cache !== false) {
- key = createKey(pattern, options);
- if (cache.hasOwnProperty(key)) {
- return cache[key];
- }
- }
- var opts = extend({}, options);
- if (opts.contains === true) {
- if (opts.negate === true) {
- opts.strictNegate = false;
- } else {
- opts.strict = false;
- }
- }
- if (opts.strict === false) {
- opts.strictOpen = false;
- opts.strictClose = false;
- }
- var open = opts.strictOpen !== false ? '^' : '';
- var close = opts.strictClose !== false ? '$' : '';
- var flags = opts.flags || '';
- var regex;
- if (opts.nocase === true && !/i/.test(flags)) {
- flags += 'i';
- }
- try {
- if (opts.negate || typeof opts.strictNegate === 'boolean') {
- pattern = not.create(pattern, opts);
- }
- var str = open + '(?:' + pattern + ')' + close;
- regex = new RegExp(str, flags);
- if (opts.safe === true && safe(regex) === false) {
- throw new Error('potentially unsafe regular expression: ' + regex.source);
- }
- } catch (err) {
- if (opts.strictErrors === true || opts.safe === true) {
- err.key = key;
- err.pattern = pattern;
- err.originalOptions = options;
- err.createdOptions = opts;
- throw err;
- }
- try {
- regex = new RegExp('^' + pattern.replace(/(\W)/g, '\\$1') + '$');
- } catch (err) {
- regex = /.^/; //<= match nothing
- }
- }
- if (opts.cache !== false) {
- memoize(regex, key, pattern, opts);
- }
- return regex;
- }
- /**
- * Memoize generated regex. This can result in dramatic speed improvements
- * and simplify debugging by adding options and pattern to the regex. It can be
- * disabled by passing setting `options.cache` to false.
- */
- function memoize(regex, key, pattern, options) {
- define(regex, 'cached', true);
- define(regex, 'pattern', pattern);
- define(regex, 'options', options);
- define(regex, 'key', key);
- cache[key] = regex;
- }
- /**
- * Create the key to use for memoization. The key is generated
- * by iterating over the options and concatenating key-value pairs
- * to the pattern string.
- */
- function createKey(pattern, options) {
- if (!options) return pattern;
- var key = pattern;
- for (var prop in options) {
- if (options.hasOwnProperty(prop)) {
- key += ';' + prop + '=' + String(options[prop]);
- }
- }
- return key;
- }
- /**
- * Expose `makeRe`
- */
- module.exports.makeRe = makeRe;
- /***/ }),
- /***/ "./node_modules/to-regex/node_modules/define-property/index.js":
- /*!*********************************************************************!*\
- !*** ./node_modules/to-regex/node_modules/define-property/index.js ***!
- \*********************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * define-property <https://github.com/jonschlinkert/define-property>
- *
- * Copyright (c) 2015-2018, Jon Schlinkert.
- * Released under the MIT License.
- */
- var isobject = __webpack_require__(/*! isobject */ "./node_modules/isobject/index.js");
- var isDescriptor = __webpack_require__(/*! is-descriptor */ "./node_modules/is-descriptor/index.js");
- var define = typeof Reflect !== 'undefined' && Reflect.defineProperty ? Reflect.defineProperty : Object.defineProperty;
- module.exports = function defineProperty(obj, key, val) {
- if (!isobject(obj) && typeof obj !== 'function' && !Array.isArray(obj)) {
- throw new TypeError('expected an object, function, or array');
- }
- if (typeof key !== 'string') {
- throw new TypeError('expected "key" to be a string');
- }
- if (isDescriptor(val)) {
- define(obj, key, val);
- return obj;
- }
- define(obj, key, {
- configurable: true,
- enumerable: false,
- writable: true,
- value: val
- });
- return obj;
- };
- /***/ }),
- /***/ "./node_modules/to-regex/node_modules/extend-shallow/index.js":
- /*!********************************************************************!*\
- !*** ./node_modules/to-regex/node_modules/extend-shallow/index.js ***!
- \********************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- var isExtendable = __webpack_require__(/*! is-extendable */ "./node_modules/to-regex/node_modules/is-extendable/index.js");
- var assignSymbols = __webpack_require__(/*! assign-symbols */ "./node_modules/assign-symbols/index.js");
- module.exports = Object.assign || function (obj
- /*, objects*/
- ) {
- if (obj === null || typeof obj === 'undefined') {
- throw new TypeError('Cannot convert undefined or null to object');
- }
- if (!isObject(obj)) {
- obj = {};
- }
- for (var i = 1; i < arguments.length; i++) {
- var val = arguments[i];
- if (isString(val)) {
- val = toObject(val);
- }
- if (isObject(val)) {
- assign(obj, val);
- assignSymbols(obj, val);
- }
- }
- return obj;
- };
- function assign(a, b) {
- for (var key in b) {
- if (hasOwn(b, key)) {
- a[key] = b[key];
- }
- }
- }
- function isString(val) {
- return val && typeof val === 'string';
- }
- function toObject(str) {
- var obj = {};
- for (var i in str) {
- obj[i] = str[i];
- }
- return obj;
- }
- function isObject(val) {
- return val && _typeof(val) === 'object' || isExtendable(val);
- }
- /**
- * Returns true if the given `key` is an own property of `obj`.
- */
- function hasOwn(obj, key) {
- return Object.prototype.hasOwnProperty.call(obj, key);
- }
- function isEnum(obj, key) {
- return Object.prototype.propertyIsEnumerable.call(obj, key);
- }
- /***/ }),
- /***/ "./node_modules/to-regex/node_modules/is-extendable/index.js":
- /*!*******************************************************************!*\
- !*** ./node_modules/to-regex/node_modules/is-extendable/index.js ***!
- \*******************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * is-extendable <https://github.com/jonschlinkert/is-extendable>
- *
- * Copyright (c) 2015-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- var isPlainObject = __webpack_require__(/*! is-plain-object */ "./node_modules/is-plain-object/index.js");
- module.exports = function isExtendable(val) {
- return isPlainObject(val) || typeof val === 'function' || Array.isArray(val);
- };
- /***/ }),
- /***/ "./node_modules/union-value/index.js":
- /*!*******************************************!*\
- !*** ./node_modules/union-value/index.js ***!
- \*******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var isObject = __webpack_require__(/*! is-extendable */ "./node_modules/is-extendable/index.js");
- var union = __webpack_require__(/*! arr-union */ "./node_modules/arr-union/index.js");
- var get = __webpack_require__(/*! get-value */ "./node_modules/get-value/index.js");
- var set = __webpack_require__(/*! set-value */ "./node_modules/set-value/index.js");
- module.exports = function unionValue(obj, prop, value) {
- if (!isObject(obj)) {
- throw new TypeError('union-value expects the first argument to be an object.');
- }
- if (typeof prop !== 'string') {
- throw new TypeError('union-value expects `prop` to be a string.');
- }
- var arr = arrayify(get(obj, prop));
- set(obj, prop, union(arr, arrayify(value)));
- return obj;
- };
- function arrayify(val) {
- if (val === null || typeof val === 'undefined') {
- return [];
- }
- if (Array.isArray(val)) {
- return val;
- }
- return [val];
- }
- /***/ }),
- /***/ "./node_modules/unset-value/index.js":
- /*!*******************************************!*\
- !*** ./node_modules/unset-value/index.js ***!
- \*******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * unset-value <https://github.com/jonschlinkert/unset-value>
- *
- * Copyright (c) 2015, 2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- var isObject = __webpack_require__(/*! isobject */ "./node_modules/isobject/index.js");
- var has = __webpack_require__(/*! has-value */ "./node_modules/unset-value/node_modules/has-value/index.js");
- module.exports = function unset(obj, prop) {
- if (!isObject(obj)) {
- throw new TypeError('expected an object.');
- }
- if (obj.hasOwnProperty(prop)) {
- delete obj[prop];
- return true;
- }
- if (has(obj, prop)) {
- var segs = prop.split('.');
- var last = segs.pop();
- while (segs.length && segs[segs.length - 1].slice(-1) === '\\') {
- last = segs.pop().slice(0, -1) + '.' + last;
- }
- while (segs.length) {
- obj = obj[prop = segs.shift()];
- }
- return delete obj[last];
- }
- return true;
- };
- /***/ }),
- /***/ "./node_modules/unset-value/node_modules/has-value/index.js":
- /*!******************************************************************!*\
- !*** ./node_modules/unset-value/node_modules/has-value/index.js ***!
- \******************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * has-value <https://github.com/jonschlinkert/has-value>
- *
- * Copyright (c) 2014-2016, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- var isObject = __webpack_require__(/*! isobject */ "./node_modules/unset-value/node_modules/has-value/node_modules/isobject/index.js");
- var hasValues = __webpack_require__(/*! has-values */ "./node_modules/unset-value/node_modules/has-values/index.js");
- var get = __webpack_require__(/*! get-value */ "./node_modules/get-value/index.js");
- module.exports = function (obj, prop, noZero) {
- if (isObject(obj)) {
- return hasValues(get(obj, prop), noZero);
- }
- return hasValues(obj, prop);
- };
- /***/ }),
- /***/ "./node_modules/unset-value/node_modules/has-value/node_modules/isobject/index.js":
- /*!****************************************************************************************!*\
- !*** ./node_modules/unset-value/node_modules/has-value/node_modules/isobject/index.js ***!
- \****************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * isobject <https://github.com/jonschlinkert/isobject>
- *
- * Copyright (c) 2014-2015, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js");
- module.exports = function isObject(val) {
- return val != null && _typeof(val) === 'object' && isArray(val) === false;
- };
- /***/ }),
- /***/ "./node_modules/unset-value/node_modules/has-values/index.js":
- /*!*******************************************************************!*\
- !*** ./node_modules/unset-value/node_modules/has-values/index.js ***!
- \*******************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * has-values <https://github.com/jonschlinkert/has-values>
- *
- * Copyright (c) 2014-2015, Jon Schlinkert.
- * Licensed under the MIT License.
- */
- module.exports = function hasValue(o, noZero) {
- if (o === null || o === undefined) {
- return false;
- }
- if (typeof o === 'boolean') {
- return true;
- }
- if (typeof o === 'number') {
- if (o === 0 && noZero === true) {
- return false;
- }
- return true;
- }
- if (o.length !== undefined) {
- return o.length !== 0;
- }
- for (var key in o) {
- if (o.hasOwnProperty(key)) {
- return true;
- }
- }
- return false;
- };
- /***/ }),
- /***/ "./node_modules/use/index.js":
- /*!***********************************!*\
- !*** ./node_modules/use/index.js ***!
- \***********************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /*!
- * use <https://github.com/jonschlinkert/use>
- *
- * Copyright (c) 2015-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- module.exports = function base(app, options) {
- if (!isObject(app) && typeof app !== 'function') {
- throw new TypeError('expected an object or function');
- }
- var opts = isObject(options) ? options : {};
- var prop = typeof opts.prop === 'string' ? opts.prop : 'fns';
- if (!Array.isArray(app[prop])) {
- define(app, prop, []);
- }
- /**
- * Define a plugin function to be passed to use. The only
- * parameter exposed to the plugin is `app`, the object or function.
- * passed to `use(app)`. `app` is also exposed as `this` in plugins.
- *
- * Additionally, **if a plugin returns a function, the function will
- * be pushed onto the `fns` array**, allowing the plugin to be
- * called at a later point by the `run` method.
- *
- * ```js
- * var use = require('use');
- *
- * // define a plugin
- * function foo(app) {
- * // do stuff
- * }
- *
- * var app = function(){};
- * use(app);
- *
- * // register plugins
- * app.use(foo);
- * app.use(bar);
- * app.use(baz);
- * ```
- * @name .use
- * @param {Function} `fn` plugin function to call
- * @api public
- */
- define(app, 'use', use);
- /**
- * Run all plugins on `fns`. Any plugin that returns a function
- * when called by `use` is pushed onto the `fns` array.
- *
- * ```js
- * var config = {};
- * app.run(config);
- * ```
- * @name .run
- * @param {Object} `value` Object to be modified by plugins.
- * @return {Object} Returns the object passed to `run`
- * @api public
- */
- define(app, 'run', function (val) {
- if (!isObject(val)) return;
- if (!val.use || !val.run) {
- define(val, prop, val[prop] || []);
- define(val, 'use', use);
- }
- if (!val[prop] || val[prop].indexOf(base) === -1) {
- val.use(base);
- }
- var self = this || app;
- var fns = self[prop];
- var len = fns.length;
- var idx = -1;
- while (++idx < len) {
- val.use(fns[idx]);
- }
- return val;
- });
- /**
- * Call plugin `fn`. If a function is returned push it into the
- * `fns` array to be called by the `run` method.
- */
- function use(type, fn, options) {
- var offset = 1;
- if (typeof type === 'string' || Array.isArray(type)) {
- fn = wrap(type, fn);
- offset++;
- } else {
- options = fn;
- fn = type;
- }
- if (typeof fn !== 'function') {
- throw new TypeError('expected a function');
- }
- var self = this || app;
- var fns = self[prop];
- var args = [].slice.call(arguments, offset);
- args.unshift(self);
- if (typeof opts.hook === 'function') {
- opts.hook.apply(self, args);
- }
- var val = fn.apply(self, args);
- if (typeof val === 'function' && fns.indexOf(val) === -1) {
- fns.push(val);
- }
- return self;
- }
- /**
- * Wrap a named plugin function so that it's only called on objects of the
- * given `type`
- *
- * @param {String} `type`
- * @param {Function} `fn` Plugin function
- * @return {Function}
- */
- function wrap(type, fn) {
- return function plugin() {
- return this.type === type ? fn.apply(this, arguments) : plugin;
- };
- }
- return app;
- };
- function isObject(val) {
- return val && _typeof(val) === 'object' && !Array.isArray(val);
- }
- function define(obj, key, val) {
- Object.defineProperty(obj, key, {
- configurable: true,
- writable: true,
- value: val
- });
- }
- /***/ }),
- /***/ "./node_modules/util/node_modules/inherits/inherits_browser.js":
- /*!*********************************************************************!*\
- !*** ./node_modules/util/node_modules/inherits/inherits_browser.js ***!
- \*********************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- if (typeof Object.create === 'function') {
- // implementation from standard node.js 'util' module
- module.exports = function inherits(ctor, superCtor) {
- ctor.super_ = superCtor;
- ctor.prototype = Object.create(superCtor.prototype, {
- constructor: {
- value: ctor,
- enumerable: false,
- writable: true,
- configurable: true
- }
- });
- };
- } else {
- // old school shim for old browsers
- module.exports = function inherits(ctor, superCtor) {
- ctor.super_ = superCtor;
- var TempCtor = function TempCtor() {};
- TempCtor.prototype = superCtor.prototype;
- ctor.prototype = new TempCtor();
- ctor.prototype.constructor = ctor;
- };
- }
- /***/ }),
- /***/ "./node_modules/util/support/isBufferBrowser.js":
- /*!******************************************************!*\
- !*** ./node_modules/util/support/isBufferBrowser.js ***!
- \******************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- module.exports = function isBuffer(arg) {
- return arg && _typeof(arg) === 'object' && typeof arg.copy === 'function' && typeof arg.fill === 'function' && typeof arg.readUInt8 === 'function';
- };
- /***/ }),
- /***/ "./node_modules/util/util.js":
- /*!***********************************!*\
- !*** ./node_modules/util/util.js ***!
- \***********************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(process) {
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- // Copyright Joyent, Inc. and other Node contributors.
- //
- // Permission is hereby granted, free of charge, to any person obtaining a
- // copy of this software and associated documentation files (the
- // "Software"), to deal in the Software without restriction, including
- // without limitation the rights to use, copy, modify, merge, publish,
- // distribute, sublicense, and/or sell copies of the Software, and to permit
- // persons to whom the Software is furnished to do so, subject to the
- // following conditions:
- //
- // The above copyright notice and this permission notice shall be included
- // in all copies or substantial portions of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
- var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors(obj) {
- var keys = Object.keys(obj);
- var descriptors = {};
- for (var i = 0; i < keys.length; i++) {
- descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);
- }
- return descriptors;
- };
- var formatRegExp = /%[sdj%]/g;
- exports.format = function (f) {
- if (!isString(f)) {
- var objects = [];
- for (var i = 0; i < arguments.length; i++) {
- objects.push(inspect(arguments[i]));
- }
- return objects.join(' ');
- }
- var i = 1;
- var args = arguments;
- var len = args.length;
- var str = String(f).replace(formatRegExp, function (x) {
- if (x === '%%') return '%';
- if (i >= len) return x;
- switch (x) {
- case '%s':
- return String(args[i++]);
- case '%d':
- return Number(args[i++]);
- case '%j':
- try {
- return JSON.stringify(args[i++]);
- } catch (_) {
- return '[Circular]';
- }
- default:
- return x;
- }
- });
- for (var x = args[i]; i < len; x = args[++i]) {
- if (isNull(x) || !isObject(x)) {
- str += ' ' + x;
- } else {
- str += ' ' + inspect(x);
- }
- }
- return str;
- }; // Mark that a method should not be used.
- // Returns a modified function which warns once by default.
- // If --no-deprecation is set, then it is a no-op.
- exports.deprecate = function (fn, msg) {
- if (typeof process !== 'undefined' && process.noDeprecation === true) {
- return fn;
- } // Allow for deprecating things in the process of starting up.
- if (typeof process === 'undefined') {
- return function () {
- return exports.deprecate(fn, msg).apply(this, arguments);
- };
- }
- var warned = false;
- function deprecated() {
- if (!warned) {
- if (process.throwDeprecation) {
- throw new Error(msg);
- } else if (process.traceDeprecation) {
- console.trace(msg);
- } else {
- console.error(msg);
- }
- warned = true;
- }
- return fn.apply(this, arguments);
- }
- return deprecated;
- };
- var debugs = {};
- var debugEnviron;
- exports.debuglog = function (set) {
- if (isUndefined(debugEnviron)) debugEnviron = process.env.NODE_DEBUG || '';
- set = set.toUpperCase();
- if (!debugs[set]) {
- if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
- var pid = process.pid;
- debugs[set] = function () {
- var msg = exports.format.apply(exports, arguments);
- console.error('%s %d: %s', set, pid, msg);
- };
- } else {
- debugs[set] = function () {};
- }
- }
- return debugs[set];
- };
- /**
- * Echos the value of a value. Trys to print the value out
- * in the best way possible given the different types.
- *
- * @param {Object} obj The object to print out.
- * @param {Object} opts Optional options object that alters the output.
- */
- /* legacy: obj, showHidden, depth, colors*/
- function inspect(obj, opts) {
- // default options
- var ctx = {
- seen: [],
- stylize: stylizeNoColor
- }; // legacy...
- if (arguments.length >= 3) ctx.depth = arguments[2];
- if (arguments.length >= 4) ctx.colors = arguments[3];
- if (isBoolean(opts)) {
- // legacy...
- ctx.showHidden = opts;
- } else if (opts) {
- // got an "options" object
- exports._extend(ctx, opts);
- } // set default options
- if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
- if (isUndefined(ctx.depth)) ctx.depth = 2;
- if (isUndefined(ctx.colors)) ctx.colors = false;
- if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
- if (ctx.colors) ctx.stylize = stylizeWithColor;
- return formatValue(ctx, obj, ctx.depth);
- }
- exports.inspect = inspect; // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
- inspect.colors = {
- 'bold': [1, 22],
- 'italic': [3, 23],
- 'underline': [4, 24],
- 'inverse': [7, 27],
- 'white': [37, 39],
- 'grey': [90, 39],
- 'black': [30, 39],
- 'blue': [34, 39],
- 'cyan': [36, 39],
- 'green': [32, 39],
- 'magenta': [35, 39],
- 'red': [31, 39],
- 'yellow': [33, 39]
- }; // Don't use 'blue' not visible on cmd.exe
- inspect.styles = {
- 'special': 'cyan',
- 'number': 'yellow',
- 'boolean': 'yellow',
- 'undefined': 'grey',
- 'null': 'bold',
- 'string': 'green',
- 'date': 'magenta',
- // "name": intentionally not styling
- 'regexp': 'red'
- };
- function stylizeWithColor(str, styleType) {
- var style = inspect.styles[styleType];
- if (style) {
- return "\x1B[" + inspect.colors[style][0] + 'm' + str + "\x1B[" + inspect.colors[style][1] + 'm';
- } else {
- return str;
- }
- }
- function stylizeNoColor(str, styleType) {
- return str;
- }
- function arrayToHash(array) {
- var hash = {};
- array.forEach(function (val, idx) {
- hash[val] = true;
- });
- return hash;
- }
- function formatValue(ctx, value, recurseTimes) {
- // Provide a hook for user-specified inspect functions.
- // Check that value is an object with an inspect function on it
- if (ctx.customInspect && value && isFunction(value.inspect) && // Filter out the util module, it's inspect function is special
- value.inspect !== exports.inspect && // Also filter out any prototype objects using the circular check.
- !(value.constructor && value.constructor.prototype === value)) {
- var ret = value.inspect(recurseTimes, ctx);
- if (!isString(ret)) {
- ret = formatValue(ctx, ret, recurseTimes);
- }
- return ret;
- } // Primitive types cannot have properties
- var primitive = formatPrimitive(ctx, value);
- if (primitive) {
- return primitive;
- } // Look up the keys of the object.
- var keys = Object.keys(value);
- var visibleKeys = arrayToHash(keys);
- if (ctx.showHidden) {
- keys = Object.getOwnPropertyNames(value);
- } // IE doesn't make error fields non-enumerable
- // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
- if (isError(value) && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
- return formatError(value);
- } // Some type of object without properties can be shortcutted.
- if (keys.length === 0) {
- if (isFunction(value)) {
- var name = value.name ? ': ' + value.name : '';
- return ctx.stylize('[Function' + name + ']', 'special');
- }
- if (isRegExp(value)) {
- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
- }
- if (isDate(value)) {
- return ctx.stylize(Date.prototype.toString.call(value), 'date');
- }
- if (isError(value)) {
- return formatError(value);
- }
- }
- var base = '',
- array = false,
- braces = ['{', '}']; // Make Array say that they are Array
- if (isArray(value)) {
- array = true;
- braces = ['[', ']'];
- } // Make functions say that they are functions
- if (isFunction(value)) {
- var n = value.name ? ': ' + value.name : '';
- base = ' [Function' + n + ']';
- } // Make RegExps say that they are RegExps
- if (isRegExp(value)) {
- base = ' ' + RegExp.prototype.toString.call(value);
- } // Make dates with properties first say the date
- if (isDate(value)) {
- base = ' ' + Date.prototype.toUTCString.call(value);
- } // Make error with message first say the error
- if (isError(value)) {
- base = ' ' + formatError(value);
- }
- if (keys.length === 0 && (!array || value.length == 0)) {
- return braces[0] + base + braces[1];
- }
- if (recurseTimes < 0) {
- if (isRegExp(value)) {
- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
- } else {
- return ctx.stylize('[Object]', 'special');
- }
- }
- ctx.seen.push(value);
- var output;
- if (array) {
- output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
- } else {
- output = keys.map(function (key) {
- return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
- });
- }
- ctx.seen.pop();
- return reduceToSingleString(output, base, braces);
- }
- function formatPrimitive(ctx, value) {
- if (isUndefined(value)) return ctx.stylize('undefined', 'undefined');
- if (isString(value)) {
- var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '').replace(/'/g, "\\'").replace(/\\"/g, '"') + '\'';
- return ctx.stylize(simple, 'string');
- }
- if (isNumber(value)) return ctx.stylize('' + value, 'number');
- if (isBoolean(value)) return ctx.stylize('' + value, 'boolean'); // For some reason typeof null is "object", so special case here.
- if (isNull(value)) return ctx.stylize('null', 'null');
- }
- function formatError(value) {
- return '[' + Error.prototype.toString.call(value) + ']';
- }
- function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
- var output = [];
- for (var i = 0, l = value.length; i < l; ++i) {
- if (hasOwnProperty(value, String(i))) {
- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true));
- } else {
- output.push('');
- }
- }
- keys.forEach(function (key) {
- if (!key.match(/^\d+$/)) {
- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key, true));
- }
- });
- return output;
- }
- function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
- var name, str, desc;
- desc = Object.getOwnPropertyDescriptor(value, key) || {
- value: value[key]
- };
- if (desc.get) {
- if (desc.set) {
- str = ctx.stylize('[Getter/Setter]', 'special');
- } else {
- str = ctx.stylize('[Getter]', 'special');
- }
- } else {
- if (desc.set) {
- str = ctx.stylize('[Setter]', 'special');
- }
- }
- if (!hasOwnProperty(visibleKeys, key)) {
- name = '[' + key + ']';
- }
- if (!str) {
- if (ctx.seen.indexOf(desc.value) < 0) {
- if (isNull(recurseTimes)) {
- str = formatValue(ctx, desc.value, null);
- } else {
- str = formatValue(ctx, desc.value, recurseTimes - 1);
- }
- if (str.indexOf('\n') > -1) {
- if (array) {
- str = str.split('\n').map(function (line) {
- return ' ' + line;
- }).join('\n').substr(2);
- } else {
- str = '\n' + str.split('\n').map(function (line) {
- return ' ' + line;
- }).join('\n');
- }
- }
- } else {
- str = ctx.stylize('[Circular]', 'special');
- }
- }
- if (isUndefined(name)) {
- if (array && key.match(/^\d+$/)) {
- return str;
- }
- name = JSON.stringify('' + key);
- if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
- name = name.substr(1, name.length - 2);
- name = ctx.stylize(name, 'name');
- } else {
- name = name.replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'");
- name = ctx.stylize(name, 'string');
- }
- }
- return name + ': ' + str;
- }
- function reduceToSingleString(output, base, braces) {
- var numLinesEst = 0;
- var length = output.reduce(function (prev, cur) {
- numLinesEst++;
- if (cur.indexOf('\n') >= 0) numLinesEst++;
- return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
- }, 0);
- if (length > 60) {
- return braces[0] + (base === '' ? '' : base + '\n ') + ' ' + output.join(',\n ') + ' ' + braces[1];
- }
- return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
- } // NOTE: These type checking functions intentionally don't use `instanceof`
- // because it is fragile and can be easily faked with `Object.create()`.
- function isArray(ar) {
- return Array.isArray(ar);
- }
- exports.isArray = isArray;
- function isBoolean(arg) {
- return typeof arg === 'boolean';
- }
- exports.isBoolean = isBoolean;
- function isNull(arg) {
- return arg === null;
- }
- exports.isNull = isNull;
- function isNullOrUndefined(arg) {
- return arg == null;
- }
- exports.isNullOrUndefined = isNullOrUndefined;
- function isNumber(arg) {
- return typeof arg === 'number';
- }
- exports.isNumber = isNumber;
- function isString(arg) {
- return typeof arg === 'string';
- }
- exports.isString = isString;
- function isSymbol(arg) {
- return _typeof(arg) === 'symbol';
- }
- exports.isSymbol = isSymbol;
- function isUndefined(arg) {
- return arg === void 0;
- }
- exports.isUndefined = isUndefined;
- function isRegExp(re) {
- return isObject(re) && objectToString(re) === '[object RegExp]';
- }
- exports.isRegExp = isRegExp;
- function isObject(arg) {
- return _typeof(arg) === 'object' && arg !== null;
- }
- exports.isObject = isObject;
- function isDate(d) {
- return isObject(d) && objectToString(d) === '[object Date]';
- }
- exports.isDate = isDate;
- function isError(e) {
- return isObject(e) && (objectToString(e) === '[object Error]' || e instanceof Error);
- }
- exports.isError = isError;
- function isFunction(arg) {
- return typeof arg === 'function';
- }
- exports.isFunction = isFunction;
- function isPrimitive(arg) {
- return arg === null || typeof arg === 'boolean' || typeof arg === 'number' || typeof arg === 'string' || _typeof(arg) === 'symbol' || // ES6 symbol
- typeof arg === 'undefined';
- }
- exports.isPrimitive = isPrimitive;
- exports.isBuffer = __webpack_require__(/*! ./support/isBuffer */ "./node_modules/util/support/isBufferBrowser.js");
- function objectToString(o) {
- return Object.prototype.toString.call(o);
- }
- function pad(n) {
- return n < 10 ? '0' + n.toString(10) : n.toString(10);
- }
- var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; // 26 Feb 16:19:34
- function timestamp() {
- var d = new Date();
- var time = [pad(d.getHours()), pad(d.getMinutes()), pad(d.getSeconds())].join(':');
- return [d.getDate(), months[d.getMonth()], time].join(' ');
- } // log is just a thin wrapper to console.log that prepends a timestamp
- exports.log = function () {
- console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
- };
- /**
- * Inherit the prototype methods from one constructor into another.
- *
- * The Function.prototype.inherits from lang.js rewritten as a standalone
- * function (not on Function.prototype). NOTE: If this file is to be loaded
- * during bootstrapping this function needs to be rewritten using some native
- * functions as prototype setup using normal JavaScript does not work as
- * expected during bootstrapping (see mirror.js in r114903).
- *
- * @param {function} ctor Constructor function which needs to inherit the
- * prototype.
- * @param {function} superCtor Constructor function to inherit prototype from.
- */
- exports.inherits = __webpack_require__(/*! inherits */ "./node_modules/util/node_modules/inherits/inherits_browser.js");
- exports._extend = function (origin, add) {
- // Don't do anything if add isn't an object
- if (!add || !isObject(add)) return origin;
- var keys = Object.keys(add);
- var i = keys.length;
- while (i--) {
- origin[keys[i]] = add[keys[i]];
- }
- return origin;
- };
- function hasOwnProperty(obj, prop) {
- return Object.prototype.hasOwnProperty.call(obj, prop);
- }
- var kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined;
- exports.promisify = function promisify(original) {
- if (typeof original !== 'function') throw new TypeError('The "original" argument must be of type Function');
- if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {
- var fn = original[kCustomPromisifiedSymbol];
- if (typeof fn !== 'function') {
- throw new TypeError('The "util.promisify.custom" argument must be of type Function');
- }
- Object.defineProperty(fn, kCustomPromisifiedSymbol, {
- value: fn,
- enumerable: false,
- writable: false,
- configurable: true
- });
- return fn;
- }
- function fn() {
- var promiseResolve, promiseReject;
- var promise = new Promise(function (resolve, reject) {
- promiseResolve = resolve;
- promiseReject = reject;
- });
- var args = [];
- for (var i = 0; i < arguments.length; i++) {
- args.push(arguments[i]);
- }
- args.push(function (err, value) {
- if (err) {
- promiseReject(err);
- } else {
- promiseResolve(value);
- }
- });
- try {
- original.apply(this, args);
- } catch (err) {
- promiseReject(err);
- }
- return promise;
- }
- Object.setPrototypeOf(fn, Object.getPrototypeOf(original));
- if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {
- value: fn,
- enumerable: false,
- writable: false,
- configurable: true
- });
- return Object.defineProperties(fn, getOwnPropertyDescriptors(original));
- };
- exports.promisify.custom = kCustomPromisifiedSymbol;
- function callbackifyOnRejected(reason, cb) {
- // `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).
- // Because `null` is a special error value in callbacks which means "no error
- // occurred", we error-wrap so the callback consumer can distinguish between
- // "the promise rejected with null" or "the promise fulfilled with undefined".
- if (!reason) {
- var newReason = new Error('Promise was rejected with a falsy value');
- newReason.reason = reason;
- reason = newReason;
- }
- return cb(reason);
- }
- function callbackify(original) {
- if (typeof original !== 'function') {
- throw new TypeError('The "original" argument must be of type Function');
- } // We DO NOT return the promise as it gives the user a false sense that
- // the promise is actually somehow related to the callback's execution
- // and that the callback throwing will reject the promise.
- function callbackified() {
- var args = [];
- for (var i = 0; i < arguments.length; i++) {
- args.push(arguments[i]);
- }
- var maybeCb = args.pop();
- if (typeof maybeCb !== 'function') {
- throw new TypeError('The last argument must be of type Function');
- }
- var self = this;
- var cb = function cb() {
- return maybeCb.apply(self, arguments);
- }; // In true node style we process the callback on `nextTick` with all the
- // implications (stack, `uncaughtException`, `async_hooks`)
- original.apply(this, args).then(function (ret) {
- process.nextTick(cb, null, ret);
- }, function (rej) {
- process.nextTick(callbackifyOnRejected, rej, cb);
- });
- }
- Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));
- Object.defineProperties(callbackified, getOwnPropertyDescriptors(original));
- return callbackified;
- }
- exports.callbackify = callbackify;
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../process/browser.js */ "./node_modules/process/browser.js")))
- /***/ }),
- /***/ "./node_modules/webpack/buildin/global.js":
- /*!***********************************!*\
- !*** (webpack)/buildin/global.js ***!
- \***********************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- var g; // This works in non-strict mode
- g = function () {
- return this;
- }();
- try {
- // This works if eval is allowed (see CSP)
- g = g || new Function("return this")();
- } catch (e) {
- // This works if the window reference is available
- if ((typeof window === "undefined" ? "undefined" : _typeof(window)) === "object") g = window;
- } // g can still be undefined, but nothing to do about it...
- // We return undefined, instead of nothing here, so it's
- // easier to handle this case. if(!global) { ...}
- module.exports = g;
- /***/ }),
- /***/ "./node_modules/webpack/buildin/module.js":
- /*!***********************************!*\
- !*** (webpack)/buildin/module.js ***!
- \***********************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- module.exports = function (module) {
- if (!module.webpackPolyfill) {
- module.deprecate = function () {};
- module.paths = []; // module.parent = undefined by default
- if (!module.children) module.children = [];
- Object.defineProperty(module, "loaded", {
- enumerable: true,
- get: function get() {
- return module.l;
- }
- });
- Object.defineProperty(module, "id", {
- enumerable: true,
- get: function get() {
- return module.i;
- }
- });
- module.webpackPolyfill = 1;
- }
- return module;
- };
- /***/ }),
- /***/ "./packages/diff-sequences/build/index.js":
- /*!************************************************!*\
- !*** ./packages/diff-sequences/build/index.js ***!
- \************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.default = void 0;
- /**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
- // This diff-sequences package implements the linear space variation in
- // An O(ND) Difference Algorithm and Its Variations by Eugene W. Myers
- // Relationship in notation between Myers paper and this package:
- // A is a
- // N is aLength, aEnd - aStart, and so on
- // x is aIndex, aFirst, aLast, and so on
- // B is b
- // M is bLength, bEnd - bStart, and so on
- // y is bIndex, bFirst, bLast, and so on
- // Δ = N - M is negative of baDeltaLength = bLength - aLength
- // D is d
- // k is kF
- // k + Δ is kF = kR - baDeltaLength
- // V is aIndexesF or aIndexesR (see comment below about Indexes type)
- // index intervals [1, N] and [1, M] are [0, aLength) and [0, bLength)
- // starting point in forward direction (0, 0) is (-1, -1)
- // starting point in reverse direction (N + 1, M + 1) is (aLength, bLength)
- // The “edit graph” for sequences a and b corresponds to items:
- // in a on the horizontal axis
- // in b on the vertical axis
- //
- // Given a-coordinate of a point in a diagonal, you can compute b-coordinate.
- //
- // Forward diagonals kF:
- // zero diagonal intersects top left corner
- // positive diagonals intersect top edge
- // negative diagonals insersect left edge
- //
- // Reverse diagonals kR:
- // zero diagonal intersects bottom right corner
- // positive diagonals intersect right edge
- // negative diagonals intersect bottom edge
- // The graph contains a directed acyclic graph of edges:
- // horizontal: delete an item from a
- // vertical: insert an item from b
- // diagonal: common item in a and b
- //
- // The algorithm solves dual problems in the graph analogy:
- // Find longest common subsequence: path with maximum number of diagonal edges
- // Find shortest edit script: path with minimum number of non-diagonal edges
- // Input callback function compares items at indexes in the sequences.
- // Output callback function receives the number of adjacent items
- // and starting indexes of each common subsequence.
- // Either original functions or wrapped to swap indexes if graph is transposed.
- // Indexes in sequence a of last point of forward or reverse paths in graph.
- // Myers algorithm indexes by diagonal k which for negative is bad deopt in V8.
- // This package indexes by iF and iR which are greater than or equal to zero.
- // and also updates the index arrays in place to cut memory in half.
- // kF = 2 * iF - d
- // kR = d - 2 * iR
- // Division of index intervals in sequences a and b at the middle change.
- // Invariant: intervals do not have common items at the start or end.
- var pkg = 'diff-sequences'; // for error messages
- var NOT_YET_SET = 0; // small int instead of undefined to avoid deopt in V8
- // Return the number of common items that follow in forward direction.
- // The length of what Myers paper calls a “snake” in a forward path.
- var countCommonItemsF = function countCommonItemsF(aIndex, aEnd, bIndex, bEnd, isCommon) {
- var nCommon = 0;
- while (aIndex < aEnd && bIndex < bEnd && isCommon(aIndex, bIndex)) {
- aIndex += 1;
- bIndex += 1;
- nCommon += 1;
- }
- return nCommon;
- }; // Return the number of common items that precede in reverse direction.
- // The length of what Myers paper calls a “snake” in a reverse path.
- var countCommonItemsR = function countCommonItemsR(aStart, aIndex, bStart, bIndex, isCommon) {
- var nCommon = 0;
- while (aStart <= aIndex && bStart <= bIndex && isCommon(aIndex, bIndex)) {
- aIndex -= 1;
- bIndex -= 1;
- nCommon += 1;
- }
- return nCommon;
- }; // A simple function to extend forward paths from (d - 1) to d changes
- // when forward and reverse paths cannot yet overlap.
- var extendPathsF = function extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF) {
- // Unroll the first iteration.
- var iF = 0;
- var kF = -d; // kF = 2 * iF - d
- var aFirst = aIndexesF[iF]; // in first iteration always insert
- var aIndexPrev1 = aFirst; // prev value of [iF - 1] in next iteration
- aIndexesF[iF] += countCommonItemsF(aFirst + 1, aEnd, bF + aFirst - kF + 1, bEnd, isCommon); // Optimization: skip diagonals in which paths cannot ever overlap.
- var nF = d < iMaxF ? d : iMaxF; // The diagonals kF are odd when d is odd and even when d is even.
- for (iF += 1, kF += 2; iF <= nF; iF += 1, kF += 2) {
- // To get first point of path segment, move one change in forward direction
- // from last point of previous path segment in an adjacent diagonal.
- // In last possible iteration when iF === d and kF === d always delete.
- if (iF !== d && aIndexPrev1 < aIndexesF[iF]) {
- aFirst = aIndexesF[iF]; // vertical to insert from b
- } else {
- aFirst = aIndexPrev1 + 1; // horizontal to delete from a
- if (aEnd <= aFirst) {
- // Optimization: delete moved past right of graph.
- return iF - 1;
- }
- } // To get last point of path segment, move along diagonal of common items.
- aIndexPrev1 = aIndexesF[iF];
- aIndexesF[iF] = aFirst + countCommonItemsF(aFirst + 1, aEnd, bF + aFirst - kF + 1, bEnd, isCommon);
- }
- return iMaxF;
- }; // A simple function to extend reverse paths from (d - 1) to d changes
- // when reverse and forward paths cannot yet overlap.
- var extendPathsR = function extendPathsR(d, aStart, bStart, bR, isCommon, aIndexesR, iMaxR) {
- // Unroll the first iteration.
- var iR = 0;
- var kR = d; // kR = d - 2 * iR
- var aFirst = aIndexesR[iR]; // in first iteration always insert
- var aIndexPrev1 = aFirst; // prev value of [iR - 1] in next iteration
- aIndexesR[iR] -= countCommonItemsR(aStart, aFirst - 1, bStart, bR + aFirst - kR - 1, isCommon); // Optimization: skip diagonals in which paths cannot ever overlap.
- var nR = d < iMaxR ? d : iMaxR; // The diagonals kR are odd when d is odd and even when d is even.
- for (iR += 1, kR -= 2; iR <= nR; iR += 1, kR -= 2) {
- // To get first point of path segment, move one change in reverse direction
- // from last point of previous path segment in an adjacent diagonal.
- // In last possible iteration when iR === d and kR === -d always delete.
- if (iR !== d && aIndexesR[iR] < aIndexPrev1) {
- aFirst = aIndexesR[iR]; // vertical to insert from b
- } else {
- aFirst = aIndexPrev1 - 1; // horizontal to delete from a
- if (aFirst < aStart) {
- // Optimization: delete moved past left of graph.
- return iR - 1;
- }
- } // To get last point of path segment, move along diagonal of common items.
- aIndexPrev1 = aIndexesR[iR];
- aIndexesR[iR] = aFirst - countCommonItemsR(aStart, aFirst - 1, bStart, bR + aFirst - kR - 1, isCommon);
- }
- return iMaxR;
- }; // A complete function to extend forward paths from (d - 1) to d changes.
- // Return true if a path overlaps reverse path of (d - 1) changes in its diagonal.
- var extendOverlappablePathsF = function extendOverlappablePathsF(d, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, iMaxF, aIndexesR, iMaxR, division) {
- var bF = bStart - aStart; // bIndex = bF + aIndex - kF
- var aLength = aEnd - aStart;
- var bLength = bEnd - bStart;
- var baDeltaLength = bLength - aLength; // kF = kR - baDeltaLength
- // Range of diagonals in which forward and reverse paths might overlap.
- var kMinOverlapF = -baDeltaLength - (d - 1); // -(d - 1) <= kR
- var kMaxOverlapF = -baDeltaLength + (d - 1); // kR <= (d - 1)
- var aIndexPrev1 = NOT_YET_SET; // prev value of [iF - 1] in next iteration
- // Optimization: skip diagonals in which paths cannot ever overlap.
- var nF = d < iMaxF ? d : iMaxF; // The diagonals kF = 2 * iF - d are odd when d is odd and even when d is even.
- for (var iF = 0, kF = -d; iF <= nF; iF += 1, kF += 2) {
- // To get first point of path segment, move one change in forward direction
- // from last point of previous path segment in an adjacent diagonal.
- // In first iteration when iF === 0 and kF === -d always insert.
- // In last possible iteration when iF === d and kF === d always delete.
- var insert = iF === 0 || iF !== d && aIndexPrev1 < aIndexesF[iF];
- var aLastPrev = insert ? aIndexesF[iF] : aIndexPrev1;
- var aFirst = insert ? aLastPrev // vertical to insert from b
- : aLastPrev + 1; // horizontal to delete from a
- // To get last point of path segment, move along diagonal of common items.
- var bFirst = bF + aFirst - kF;
- var nCommonF = countCommonItemsF(aFirst + 1, aEnd, bFirst + 1, bEnd, isCommon);
- var aLast = aFirst + nCommonF;
- aIndexPrev1 = aIndexesF[iF];
- aIndexesF[iF] = aLast;
- if (kMinOverlapF <= kF && kF <= kMaxOverlapF) {
- // Solve for iR of reverse path with (d - 1) changes in diagonal kF:
- // kR = kF + baDeltaLength
- // kR = (d - 1) - 2 * iR
- var iR = (d - 1 - (kF + baDeltaLength)) / 2; // If this forward path overlaps the reverse path in this diagonal,
- // then this is the middle change of the index intervals.
- if (iR <= iMaxR && aIndexesR[iR] - 1 <= aLast) {
- // Unlike the Myers algorithm which finds only the middle “snake”
- // this package can find two common subsequences per division.
- // Last point of previous path segment is on an adjacent diagonal.
- var bLastPrev = bF + aLastPrev - (insert ? kF + 1 : kF - 1); // Because of invariant that intervals preceding the middle change
- // cannot have common items at the end,
- // move in reverse direction along a diagonal of common items.
- var nCommonR = countCommonItemsR(aStart, aLastPrev, bStart, bLastPrev, isCommon);
- var aIndexPrevFirst = aLastPrev - nCommonR;
- var bIndexPrevFirst = bLastPrev - nCommonR;
- var aEndPreceding = aIndexPrevFirst + 1;
- var bEndPreceding = bIndexPrevFirst + 1;
- division.nChangePreceding = d - 1;
- if (d - 1 === aEndPreceding + bEndPreceding - aStart - bStart) {
- // Optimization: number of preceding changes in forward direction
- // is equal to number of items in preceding interval,
- // therefore it cannot contain any common items.
- division.aEndPreceding = aStart;
- division.bEndPreceding = bStart;
- } else {
- division.aEndPreceding = aEndPreceding;
- division.bEndPreceding = bEndPreceding;
- }
- division.nCommonPreceding = nCommonR;
- if (nCommonR !== 0) {
- division.aCommonPreceding = aEndPreceding;
- division.bCommonPreceding = bEndPreceding;
- }
- division.nCommonFollowing = nCommonF;
- if (nCommonF !== 0) {
- division.aCommonFollowing = aFirst + 1;
- division.bCommonFollowing = bFirst + 1;
- }
- var aStartFollowing = aLast + 1;
- var bStartFollowing = bFirst + nCommonF + 1;
- division.nChangeFollowing = d - 1;
- if (d - 1 === aEnd + bEnd - aStartFollowing - bStartFollowing) {
- // Optimization: number of changes in reverse direction
- // is equal to number of items in following interval,
- // therefore it cannot contain any common items.
- division.aStartFollowing = aEnd;
- division.bStartFollowing = bEnd;
- } else {
- division.aStartFollowing = aStartFollowing;
- division.bStartFollowing = bStartFollowing;
- }
- return true;
- }
- }
- }
- return false;
- }; // A complete function to extend reverse paths from (d - 1) to d changes.
- // Return true if a path overlaps forward path of d changes in its diagonal.
- var extendOverlappablePathsR = function extendOverlappablePathsR(d, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, iMaxF, aIndexesR, iMaxR, division) {
- var bR = bEnd - aEnd; // bIndex = bR + aIndex - kR
- var aLength = aEnd - aStart;
- var bLength = bEnd - bStart;
- var baDeltaLength = bLength - aLength; // kR = kF + baDeltaLength
- // Range of diagonals in which forward and reverse paths might overlap.
- var kMinOverlapR = baDeltaLength - d; // -d <= kF
- var kMaxOverlapR = baDeltaLength + d; // kF <= d
- var aIndexPrev1 = NOT_YET_SET; // prev value of [iR - 1] in next iteration
- // Optimization: skip diagonals in which paths cannot ever overlap.
- var nR = d < iMaxR ? d : iMaxR; // The diagonals kR = d - 2 * iR are odd when d is odd and even when d is even.
- for (var iR = 0, kR = d; iR <= nR; iR += 1, kR -= 2) {
- // To get first point of path segment, move one change in reverse direction
- // from last point of previous path segment in an adjacent diagonal.
- // In first iteration when iR === 0 and kR === d always insert.
- // In last possible iteration when iR === d and kR === -d always delete.
- var insert = iR === 0 || iR !== d && aIndexesR[iR] < aIndexPrev1;
- var aLastPrev = insert ? aIndexesR[iR] : aIndexPrev1;
- var aFirst = insert ? aLastPrev // vertical to insert from b
- : aLastPrev - 1; // horizontal to delete from a
- // To get last point of path segment, move along diagonal of common items.
- var bFirst = bR + aFirst - kR;
- var nCommonR = countCommonItemsR(aStart, aFirst - 1, bStart, bFirst - 1, isCommon);
- var aLast = aFirst - nCommonR;
- aIndexPrev1 = aIndexesR[iR];
- aIndexesR[iR] = aLast;
- if (kMinOverlapR <= kR && kR <= kMaxOverlapR) {
- // Solve for iF of forward path with d changes in diagonal kR:
- // kF = kR - baDeltaLength
- // kF = 2 * iF - d
- var iF = (d + (kR - baDeltaLength)) / 2; // If this reverse path overlaps the forward path in this diagonal,
- // then this is a middle change of the index intervals.
- if (iF <= iMaxF && aLast - 1 <= aIndexesF[iF]) {
- var bLast = bFirst - nCommonR;
- division.nChangePreceding = d;
- if (d === aLast + bLast - aStart - bStart) {
- // Optimization: number of changes in reverse direction
- // is equal to number of items in preceding interval,
- // therefore it cannot contain any common items.
- division.aEndPreceding = aStart;
- division.bEndPreceding = bStart;
- } else {
- division.aEndPreceding = aLast;
- division.bEndPreceding = bLast;
- }
- division.nCommonPreceding = nCommonR;
- if (nCommonR !== 0) {
- // The last point of reverse path segment is start of common subsequence.
- division.aCommonPreceding = aLast;
- division.bCommonPreceding = bLast;
- }
- division.nChangeFollowing = d - 1;
- if (d === 1) {
- // There is no previous path segment.
- division.nCommonFollowing = 0;
- division.aStartFollowing = aEnd;
- division.bStartFollowing = bEnd;
- } else {
- // Unlike the Myers algorithm which finds only the middle “snake”
- // this package can find two common subsequences per division.
- // Last point of previous path segment is on an adjacent diagonal.
- var bLastPrev = bR + aLastPrev - (insert ? kR - 1 : kR + 1); // Because of invariant that intervals following the middle change
- // cannot have common items at the start,
- // move in forward direction along a diagonal of common items.
- var nCommonF = countCommonItemsF(aLastPrev, aEnd, bLastPrev, bEnd, isCommon);
- division.nCommonFollowing = nCommonF;
- if (nCommonF !== 0) {
- // The last point of reverse path segment is start of common subsequence.
- division.aCommonFollowing = aLastPrev;
- division.bCommonFollowing = bLastPrev;
- }
- var aStartFollowing = aLastPrev + nCommonF; // aFirstPrev
- var bStartFollowing = bLastPrev + nCommonF; // bFirstPrev
- if (d - 1 === aEnd + bEnd - aStartFollowing - bStartFollowing) {
- // Optimization: number of changes in forward direction
- // is equal to number of items in following interval,
- // therefore it cannot contain any common items.
- division.aStartFollowing = aEnd;
- division.bStartFollowing = bEnd;
- } else {
- division.aStartFollowing = aStartFollowing;
- division.bStartFollowing = bStartFollowing;
- }
- }
- return true;
- }
- }
- }
- return false;
- }; // Given index intervals and input function to compare items at indexes,
- // divide at the middle change.
- //
- // DO NOT CALL if start === end, because interval cannot contain common items
- // and because this function will throw the “no overlap” error.
- var divide = function divide(nChange, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, aIndexesR, division // output
- ) {
- var bF = bStart - aStart; // bIndex = bF + aIndex - kF
- var bR = bEnd - aEnd; // bIndex = bR + aIndex - kR
- var aLength = aEnd - aStart;
- var bLength = bEnd - bStart; // Because graph has square or portrait orientation,
- // length difference is minimum number of items to insert from b.
- // Corresponding forward and reverse diagonals in graph
- // depend on length difference of the sequences:
- // kF = kR - baDeltaLength
- // kR = kF + baDeltaLength
- var baDeltaLength = bLength - aLength; // Optimization: max diagonal in graph intersects corner of shorter side.
- var iMaxF = aLength;
- var iMaxR = aLength; // Initialize no changes yet in forward or reverse direction:
- aIndexesF[0] = aStart - 1; // at open start of interval, outside closed start
- aIndexesR[0] = aEnd; // at open end of interval
- if (baDeltaLength % 2 === 0) {
- // The number of changes in paths is 2 * d if length difference is even.
- var dMin = (nChange || baDeltaLength) / 2;
- var dMax = (aLength + bLength) / 2;
- for (var d = 1; d <= dMax; d += 1) {
- iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
- if (d < dMin) {
- iMaxR = extendPathsR(d, aStart, bStart, bR, isCommon, aIndexesR, iMaxR);
- } else if ( // If a reverse path overlaps a forward path in the same diagonal,
- // return a division of the index intervals at the middle change.
- extendOverlappablePathsR(d, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, iMaxF, aIndexesR, iMaxR, division)) {
- return;
- }
- }
- } else {
- // The number of changes in paths is 2 * d - 1 if length difference is odd.
- var _dMin = ((nChange || baDeltaLength) + 1) / 2;
- var _dMax = (aLength + bLength + 1) / 2; // Unroll first half iteration so loop extends the relevant pairs of paths.
- // Because of invariant that intervals have no common items at start or end,
- // and limitation not to call divide with empty intervals,
- // therefore it cannot be called if a forward path with one change
- // would overlap a reverse path with no changes, even if dMin === 1.
- var _d = 1;
- iMaxF = extendPathsF(_d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
- for (_d += 1; _d <= _dMax; _d += 1) {
- iMaxR = extendPathsR(_d - 1, aStart, bStart, bR, isCommon, aIndexesR, iMaxR);
- if (_d < _dMin) {
- iMaxF = extendPathsF(_d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
- } else if ( // If a forward path overlaps a reverse path in the same diagonal,
- // return a division of the index intervals at the middle change.
- extendOverlappablePathsF(_d, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, iMaxF, aIndexesR, iMaxR, division)) {
- return;
- }
- }
- }
- /* istanbul ignore next */
- throw new Error("".concat(pkg, ": no overlap aStart=").concat(aStart, " aEnd=").concat(aEnd, " bStart=").concat(bStart, " bEnd=").concat(bEnd));
- }; // Given index intervals and input function to compare items at indexes,
- // return by output function the number of adjacent items and starting indexes
- // of each common subsequence. Divide and conquer with only linear space.
- //
- // The index intervals are half open [start, end) like array slice method.
- // DO NOT CALL if start === end, because interval cannot contain common items
- // and because divide function will throw the “no overlap” error.
- var findSubsequences = function findSubsequences(nChange, aStart, aEnd, bStart, bEnd, transposed, callbacks, aIndexesF, aIndexesR, division // temporary memory, not input nor output
- ) {
- if (bEnd - bStart < aEnd - aStart) {
- // Transpose graph so it has portrait instead of landscape orientation.
- // Always compare shorter to longer sequence for consistency and optimization.
- transposed = !transposed;
- if (transposed && callbacks.length === 1) {
- // Lazily wrap callback functions to swap args if graph is transposed.
- var _callbacks$ = callbacks[0],
- _foundSubsequence2 = _callbacks$.foundSubsequence,
- _isCommon2 = _callbacks$.isCommon;
- callbacks[1] = {
- foundSubsequence: function (_foundSubsequence) {
- function foundSubsequence(_x, _x2, _x3) {
- return _foundSubsequence.apply(this, arguments);
- }
- foundSubsequence.toString = function () {
- return _foundSubsequence.toString();
- };
- return foundSubsequence;
- }(function (nCommon, bCommon, aCommon) {
- _foundSubsequence2(nCommon, aCommon, bCommon);
- }),
- isCommon: function (_isCommon) {
- function isCommon(_x4, _x5) {
- return _isCommon.apply(this, arguments);
- }
- isCommon.toString = function () {
- return _isCommon.toString();
- };
- return isCommon;
- }(function (bIndex, aIndex) {
- return _isCommon2(aIndex, bIndex);
- })
- };
- }
- var tStart = aStart;
- var tEnd = aEnd;
- aStart = bStart;
- aEnd = bEnd;
- bStart = tStart;
- bEnd = tEnd;
- }
- var _callbacks = callbacks[transposed ? 1 : 0],
- foundSubsequence = _callbacks.foundSubsequence,
- isCommon = _callbacks.isCommon; // Divide the index intervals at the middle change.
- divide(nChange, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, aIndexesR, division);
- var nChangePreceding = division.nChangePreceding,
- aEndPreceding = division.aEndPreceding,
- bEndPreceding = division.bEndPreceding,
- nCommonPreceding = division.nCommonPreceding,
- aCommonPreceding = division.aCommonPreceding,
- bCommonPreceding = division.bCommonPreceding,
- nCommonFollowing = division.nCommonFollowing,
- aCommonFollowing = division.aCommonFollowing,
- bCommonFollowing = division.bCommonFollowing,
- nChangeFollowing = division.nChangeFollowing,
- aStartFollowing = division.aStartFollowing,
- bStartFollowing = division.bStartFollowing; // Unless either index interval is empty, they might contain common items.
- if (aStart < aEndPreceding && bStart < bEndPreceding) {
- // Recursely find and return common subsequences preceding the division.
- findSubsequences(nChangePreceding, aStart, aEndPreceding, bStart, bEndPreceding, transposed, callbacks, aIndexesF, aIndexesR, division);
- } // Return common subsequences that are adjacent to the middle change.
- if (nCommonPreceding !== 0) {
- foundSubsequence(nCommonPreceding, aCommonPreceding, bCommonPreceding);
- }
- if (nCommonFollowing !== 0) {
- foundSubsequence(nCommonFollowing, aCommonFollowing, bCommonFollowing);
- } // Unless either index interval is empty, they might contain common items.
- if (aStartFollowing < aEnd && bStartFollowing < bEnd) {
- // Recursely find and return common subsequences following the division.
- findSubsequences(nChangeFollowing, aStartFollowing, aEnd, bStartFollowing, bEnd, transposed, callbacks, aIndexesF, aIndexesR, division);
- }
- };
- var validateLength = function validateLength(name, arg) {
- var type = _typeof(arg);
- if (type !== 'number') {
- throw new TypeError("".concat(pkg, ": ").concat(name, " typeof ").concat(type, " is not a number"));
- }
- if (!Number.isSafeInteger(arg)) {
- throw new RangeError("".concat(pkg, ": ").concat(name, " value ").concat(arg, " is not a safe integer"));
- }
- if (arg < 0) {
- throw new RangeError("".concat(pkg, ": ").concat(name, " value ").concat(arg, " is a negative integer"));
- }
- };
- var validateCallback = function validateCallback(name, arg) {
- var type = _typeof(arg);
- if (type !== 'function') {
- throw new TypeError("".concat(pkg, ": ").concat(name, " typeof ").concat(type, " is not a function"));
- }
- }; // Compare items in two sequences to find a longest common subsequence.
- // Given lengths of sequences and input function to compare items at indexes,
- // return by output function the number of adjacent items and starting indexes
- // of each common subsequence.
- var _default = function _default(aLength, bLength, isCommon, foundSubsequence) {
- validateLength('aLength', aLength);
- validateLength('bLength', bLength);
- validateCallback('isCommon', isCommon);
- validateCallback('foundSubsequence', foundSubsequence); // Count common items from the start in the forward direction.
- var nCommonF = countCommonItemsF(0, aLength, 0, bLength, isCommon);
- if (nCommonF !== 0) {
- foundSubsequence(nCommonF, 0, 0);
- } // Unless both sequences consist of common items only,
- // find common items in the half-trimmed index intervals.
- if (aLength !== nCommonF || bLength !== nCommonF) {
- // Invariant: intervals do not have common items at the start.
- // The start of an index interval is closed like array slice method.
- var aStart = nCommonF;
- var bStart = nCommonF; // Count common items from the end in the reverse direction.
- var nCommonR = countCommonItemsR(aStart, aLength - 1, bStart, bLength - 1, isCommon); // Invariant: intervals do not have common items at the end.
- // The end of an index interval is open like array slice method.
- var aEnd = aLength - nCommonR;
- var bEnd = bLength - nCommonR; // Unless one sequence consists of common items only,
- // therefore the other trimmed index interval consists of changes only,
- // find common items in the trimmed index intervals.
- var nCommonFR = nCommonF + nCommonR;
- if (aLength !== nCommonFR && bLength !== nCommonFR) {
- var nChange = 0; // number of change items is not yet known
- var transposed = false; // call the original unwrapped functions
- var callbacks = [{
- foundSubsequence: foundSubsequence,
- isCommon: isCommon
- }]; // Indexes in sequence a of last points in furthest reaching paths
- // from outside the start at top left in the forward direction:
- var aIndexesF = [NOT_YET_SET]; // from the end at bottom right in the reverse direction:
- var aIndexesR = [NOT_YET_SET]; // Initialize one object as output of all calls to divide function.
- var division = {
- aCommonFollowing: NOT_YET_SET,
- aCommonPreceding: NOT_YET_SET,
- aEndPreceding: NOT_YET_SET,
- aStartFollowing: NOT_YET_SET,
- bCommonFollowing: NOT_YET_SET,
- bCommonPreceding: NOT_YET_SET,
- bEndPreceding: NOT_YET_SET,
- bStartFollowing: NOT_YET_SET,
- nChangeFollowing: NOT_YET_SET,
- nChangePreceding: NOT_YET_SET,
- nCommonFollowing: NOT_YET_SET,
- nCommonPreceding: NOT_YET_SET
- }; // Find and return common subsequences in the trimmed index intervals.
- findSubsequences(nChange, aStart, aEnd, bStart, bEnd, transposed, callbacks, aIndexesF, aIndexesR, division);
- }
- if (nCommonR !== 0) {
- foundSubsequence(nCommonR, aEnd, bEnd);
- }
- }
- };
- exports.default = _default;
- /***/ }),
- /***/ "./packages/expect/build/fakeChalk.js":
- /*!********************************************!*\
- !*** ./packages/expect/build/fakeChalk.js ***!
- \********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
- var _ansiStyles = _interopRequireDefault(__webpack_require__(/*! ansi-styles */ "./node_modules/ansi-styles/index.js"));
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
- }
- /**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
- var returnInput = function returnInput(str) {
- return str;
- };
- var allColorsAsFunc = Object.keys(_ansiStyles.default).map(function (style) {
- return _defineProperty({}, style, returnInput);
- }).reduce(function (acc, cur) {
- return Object.assign(acc, cur);
- });
- Object.keys(allColorsAsFunc).map(function (color) {
- return allColorsAsFunc[color];
- }).forEach(function (style) {
- Object.assign(style, allColorsAsFunc);
- Object.assign(returnInput, style);
- });
- module.exports = allColorsAsFunc;
- /***/ }),
- /***/ "./packages/expect/src/asymmetricMatchers.ts":
- /*!***************************************************!*\
- !*** ./packages/expect/src/asymmetricMatchers.ts ***!
- \***************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.stringNotMatching = exports.stringMatching = exports.stringNotContaining = exports.stringContaining = exports.objectNotContaining = exports.objectContaining = exports.arrayNotContaining = exports.arrayContaining = exports.anything = exports.any = exports.AsymmetricMatcher = void 0;
- var _jasmineUtils = __webpack_require__(/*! ./jasmineUtils */ "./packages/expect/src/jasmineUtils.ts");
- var _utils = __webpack_require__(/*! ./utils */ "./packages/expect/src/utils.ts");
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- var AsymmetricMatcher = function AsymmetricMatcher(sample) {
- _classCallCheck(this, AsymmetricMatcher);
- this.$$typeof = Symbol.for('jest.asymmetricMatcher');
- this.sample = sample;
- };
- exports.AsymmetricMatcher = AsymmetricMatcher;
- var Any =
- /*#__PURE__*/
- function (_AsymmetricMatcher) {
- _inherits(Any, _AsymmetricMatcher);
- function Any(sample) {
- _classCallCheck(this, Any);
- if (typeof sample === 'undefined') {
- throw new TypeError('any() expects to be passed a constructor function. ' + 'Please pass one or use anything() to match any object.');
- }
- return _possibleConstructorReturn(this, _getPrototypeOf(Any).call(this, sample));
- }
- _createClass(Any, [{
- key: "asymmetricMatch",
- value: function asymmetricMatch(other) {
- if (this.sample == String) {
- return typeof other == 'string' || other instanceof String;
- }
- if (this.sample == Number) {
- return typeof other == 'number' || other instanceof Number;
- }
- if (this.sample == Function) {
- return typeof other == 'function' || other instanceof Function;
- }
- if (this.sample == Object) {
- return _typeof(other) == 'object';
- }
- if (this.sample == Boolean) {
- return typeof other == 'boolean';
- }
- return other instanceof this.sample;
- }
- }, {
- key: "toString",
- value: function toString() {
- return 'Any';
- }
- }, {
- key: "getExpectedType",
- value: function getExpectedType() {
- if (this.sample == String) {
- return 'string';
- }
- if (this.sample == Number) {
- return 'number';
- }
- if (this.sample == Function) {
- return 'function';
- }
- if (this.sample == Object) {
- return 'object';
- }
- if (this.sample == Boolean) {
- return 'boolean';
- }
- return (0, _jasmineUtils.fnNameFor)(this.sample);
- }
- }, {
- key: "toAsymmetricMatcher",
- value: function toAsymmetricMatcher() {
- return 'Any<' + (0, _jasmineUtils.fnNameFor)(this.sample) + '>';
- }
- }]);
- return Any;
- }(AsymmetricMatcher);
- var Anything =
- /*#__PURE__*/
- function (_AsymmetricMatcher2) {
- _inherits(Anything, _AsymmetricMatcher2);
- function Anything() {
- _classCallCheck(this, Anything);
- return _possibleConstructorReturn(this, _getPrototypeOf(Anything).apply(this, arguments));
- }
- _createClass(Anything, [{
- key: "asymmetricMatch",
- value: function asymmetricMatch(other) {
- return !(0, _jasmineUtils.isUndefined)(other) && other !== null;
- }
- }, {
- key: "toString",
- value: function toString() {
- return 'Anything';
- } // No getExpectedType method, because it matches either null or undefined.
- }, {
- key: "toAsymmetricMatcher",
- value: function toAsymmetricMatcher() {
- return 'Anything';
- }
- }]);
- return Anything;
- }(AsymmetricMatcher);
- var ArrayContaining =
- /*#__PURE__*/
- function (_AsymmetricMatcher3) {
- _inherits(ArrayContaining, _AsymmetricMatcher3);
- function ArrayContaining(sample) {
- var _this;
- var inverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- _classCallCheck(this, ArrayContaining);
- _this = _possibleConstructorReturn(this, _getPrototypeOf(ArrayContaining).call(this, sample));
- _this.inverse = inverse;
- return _this;
- }
- _createClass(ArrayContaining, [{
- key: "asymmetricMatch",
- value: function asymmetricMatch(other) {
- if (!Array.isArray(this.sample)) {
- throw new Error("You must provide an array to ".concat(this.toString(), ", not '") + _typeof(this.sample) + "'.");
- }
- var result = this.sample.length === 0 || Array.isArray(other) && this.sample.every(function (item) {
- return other.some(function (another) {
- return (0, _jasmineUtils.equals)(item, another);
- });
- });
- return this.inverse ? !result : result;
- }
- }, {
- key: "toString",
- value: function toString() {
- return "Array".concat(this.inverse ? 'Not' : '', "Containing");
- }
- }, {
- key: "getExpectedType",
- value: function getExpectedType() {
- return 'array';
- }
- }]);
- return ArrayContaining;
- }(AsymmetricMatcher);
- var ObjectContaining =
- /*#__PURE__*/
- function (_AsymmetricMatcher4) {
- _inherits(ObjectContaining, _AsymmetricMatcher4);
- function ObjectContaining(sample) {
- var _this2;
- var inverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- _classCallCheck(this, ObjectContaining);
- _this2 = _possibleConstructorReturn(this, _getPrototypeOf(ObjectContaining).call(this, sample));
- _this2.inverse = inverse;
- return _this2;
- }
- _createClass(ObjectContaining, [{
- key: "asymmetricMatch",
- value: function asymmetricMatch(other) {
- if (_typeof(this.sample) !== 'object') {
- throw new Error("You must provide an object to ".concat(this.toString(), ", not '") + _typeof(this.sample) + "'.");
- }
- if (this.inverse) {
- for (var property in this.sample) {
- if ((0, _jasmineUtils.hasProperty)(other, property) && (0, _jasmineUtils.equals)(this.sample[property], other[property]) && !(0, _utils.emptyObject)(this.sample[property]) && !(0, _utils.emptyObject)(other[property])) {
- return false;
- }
- }
- return true;
- } else {
- for (var _property in this.sample) {
- if (!(0, _jasmineUtils.hasProperty)(other, _property) || !(0, _jasmineUtils.equals)(this.sample[_property], other[_property])) {
- return false;
- }
- }
- return true;
- }
- }
- }, {
- key: "toString",
- value: function toString() {
- return "Object".concat(this.inverse ? 'Not' : '', "Containing");
- }
- }, {
- key: "getExpectedType",
- value: function getExpectedType() {
- return 'object';
- }
- }]);
- return ObjectContaining;
- }(AsymmetricMatcher);
- var StringContaining =
- /*#__PURE__*/
- function (_AsymmetricMatcher5) {
- _inherits(StringContaining, _AsymmetricMatcher5);
- function StringContaining(sample) {
- var _this3;
- var inverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- _classCallCheck(this, StringContaining);
- if (!(0, _jasmineUtils.isA)('String', sample)) {
- throw new Error('Expected is not a string');
- }
- _this3 = _possibleConstructorReturn(this, _getPrototypeOf(StringContaining).call(this, sample));
- _this3.inverse = inverse;
- return _this3;
- }
- _createClass(StringContaining, [{
- key: "asymmetricMatch",
- value: function asymmetricMatch(other) {
- var result = (0, _jasmineUtils.isA)('String', other) && other.includes(this.sample);
- return this.inverse ? !result : result;
- }
- }, {
- key: "toString",
- value: function toString() {
- return "String".concat(this.inverse ? 'Not' : '', "Containing");
- }
- }, {
- key: "getExpectedType",
- value: function getExpectedType() {
- return 'string';
- }
- }]);
- return StringContaining;
- }(AsymmetricMatcher);
- var StringMatching =
- /*#__PURE__*/
- function (_AsymmetricMatcher6) {
- _inherits(StringMatching, _AsymmetricMatcher6);
- function StringMatching(sample) {
- var _this4;
- var inverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- _classCallCheck(this, StringMatching);
- if (!(0, _jasmineUtils.isA)('String', sample) && !(0, _jasmineUtils.isA)('RegExp', sample)) {
- throw new Error('Expected is not a String or a RegExp');
- }
- _this4 = _possibleConstructorReturn(this, _getPrototypeOf(StringMatching).call(this, new RegExp(sample)));
- _this4.inverse = inverse;
- return _this4;
- }
- _createClass(StringMatching, [{
- key: "asymmetricMatch",
- value: function asymmetricMatch(other) {
- var result = (0, _jasmineUtils.isA)('String', other) && this.sample.test(other);
- return this.inverse ? !result : result;
- }
- }, {
- key: "toString",
- value: function toString() {
- return "String".concat(this.inverse ? 'Not' : '', "Matching");
- }
- }, {
- key: "getExpectedType",
- value: function getExpectedType() {
- return 'string';
- }
- }]);
- return StringMatching;
- }(AsymmetricMatcher);
- var any = function any(expectedObject) {
- return new Any(expectedObject);
- };
- exports.any = any;
- var anything = function anything() {
- return new Anything();
- };
- exports.anything = anything;
- var arrayContaining = function arrayContaining(sample) {
- return new ArrayContaining(sample);
- };
- exports.arrayContaining = arrayContaining;
- var arrayNotContaining = function arrayNotContaining(sample) {
- return new ArrayContaining(sample, true);
- };
- exports.arrayNotContaining = arrayNotContaining;
- var objectContaining = function objectContaining(sample) {
- return new ObjectContaining(sample);
- };
- exports.objectContaining = objectContaining;
- var objectNotContaining = function objectNotContaining(sample) {
- return new ObjectContaining(sample, true);
- };
- exports.objectNotContaining = objectNotContaining;
- var stringContaining = function stringContaining(expected) {
- return new StringContaining(expected);
- };
- exports.stringContaining = stringContaining;
- var stringNotContaining = function stringNotContaining(expected) {
- return new StringContaining(expected, true);
- };
- exports.stringNotContaining = stringNotContaining;
- var stringMatching = function stringMatching(expected) {
- return new StringMatching(expected);
- };
- exports.stringMatching = stringMatching;
- var stringNotMatching = function stringNotMatching(expected) {
- return new StringMatching(expected, true);
- };
- exports.stringNotMatching = stringNotMatching;
- /***/ }),
- /***/ "./packages/expect/src/extractExpectedAssertionsErrors.ts":
- /*!****************************************************************!*\
- !*** ./packages/expect/src/extractExpectedAssertionsErrors.ts ***!
- \****************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _jestMatcherUtils = __webpack_require__(/*! jest-matcher-utils */ "./packages/jest-matcher-utils/build/index.js");
- var _jestMatchersObject = __webpack_require__(/*! ./jestMatchersObject */ "./packages/expect/src/jestMatchersObject.ts");
- /**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
- var resetAssertionsLocalState = function resetAssertionsLocalState() {
- (0, _jestMatchersObject.setState)({
- assertionCalls: 0,
- expectedAssertionsNumber: null,
- isExpectingAssertions: false
- });
- }; // Create and format all errors related to the mismatched number of `expect`
- // calls and reset the matcher's state.
- var extractExpectedAssertionsErrors = function extractExpectedAssertionsErrors() {
- var result = [];
- var _getState = (0, _jestMatchersObject.getState)(),
- assertionCalls = _getState.assertionCalls,
- expectedAssertionsNumber = _getState.expectedAssertionsNumber,
- expectedAssertionsNumberError = _getState.expectedAssertionsNumberError,
- isExpectingAssertions = _getState.isExpectingAssertions,
- isExpectingAssertionsError = _getState.isExpectingAssertionsError;
- resetAssertionsLocalState();
- if (typeof expectedAssertionsNumber === 'number' && assertionCalls !== expectedAssertionsNumber) {
- var numOfAssertionsExpected = (0, _jestMatcherUtils.EXPECTED_COLOR)((0, _jestMatcherUtils.pluralize)('assertion', expectedAssertionsNumber));
- expectedAssertionsNumberError.message = (0, _jestMatcherUtils.matcherHint)('.assertions', '', String(expectedAssertionsNumber), {
- isDirectExpectCall: true
- }) + '\n\n' + "Expected ".concat(numOfAssertionsExpected, " to be called but received ") + (0, _jestMatcherUtils.RECEIVED_COLOR)((0, _jestMatcherUtils.pluralize)('assertion call', assertionCalls || 0)) + '.';
- result.push({
- actual: assertionCalls,
- error: expectedAssertionsNumberError,
- expected: expectedAssertionsNumber
- });
- }
- if (isExpectingAssertions && assertionCalls === 0) {
- var expected = (0, _jestMatcherUtils.EXPECTED_COLOR)('at least one assertion');
- var received = (0, _jestMatcherUtils.RECEIVED_COLOR)('received none');
- isExpectingAssertionsError.message = (0, _jestMatcherUtils.matcherHint)('.hasAssertions', '', '', {
- isDirectExpectCall: true
- }) + '\n\n' + "Expected ".concat(expected, " to be called but ").concat(received, ".");
- result.push({
- actual: 'none',
- error: isExpectingAssertionsError,
- expected: 'at least one'
- });
- }
- return result;
- };
- var _default = extractExpectedAssertionsErrors;
- exports.default = _default;
- /***/ }),
- /***/ "./packages/expect/src/index.ts":
- /*!**************************************!*\
- !*** ./packages/expect/src/index.ts ***!
- \**************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var matcherUtils = _interopRequireWildcard(__webpack_require__(/*! jest-matcher-utils */ "./packages/jest-matcher-utils/build/index.js"));
- var _utils = __webpack_require__(/*! ./utils */ "./packages/expect/src/utils.ts");
- var _matchers = _interopRequireDefault(__webpack_require__(/*! ./matchers */ "./packages/expect/src/matchers.ts"));
- var _spyMatchers = _interopRequireDefault(__webpack_require__(/*! ./spyMatchers */ "./packages/expect/src/spyMatchers.ts"));
- var _toThrowMatchers = _interopRequireWildcard(__webpack_require__(/*! ./toThrowMatchers */ "./packages/expect/src/toThrowMatchers.ts"));
- var _jasmineUtils = __webpack_require__(/*! ./jasmineUtils */ "./packages/expect/src/jasmineUtils.ts");
- var _asymmetricMatchers = __webpack_require__(/*! ./asymmetricMatchers */ "./packages/expect/src/asymmetricMatchers.ts");
- var _jestMatchersObject = __webpack_require__(/*! ./jestMatchersObject */ "./packages/expect/src/jestMatchersObject.ts");
- var _extractExpectedAssertionsErrors = _interopRequireDefault(__webpack_require__(/*! ./extractExpectedAssertionsErrors */ "./packages/expect/src/extractExpectedAssertionsErrors.ts"));
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
- function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
- function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
- function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
- function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
- var JestAssertionError =
- /*#__PURE__*/
- function (_Error) {
- _inherits(JestAssertionError, _Error);
- function JestAssertionError() {
- _classCallCheck(this, JestAssertionError);
- return _possibleConstructorReturn(this, _getPrototypeOf(JestAssertionError).apply(this, arguments));
- }
- return JestAssertionError;
- }(_wrapNativeSuper(Error));
- var isPromise = function isPromise(obj) {
- return !!obj && (_typeof(obj) === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
- };
- var createToThrowErrorMatchingSnapshotMatcher = function createToThrowErrorMatchingSnapshotMatcher(matcher) {
- return function (received, testNameOrInlineSnapshot) {
- return matcher.apply(this, [received, testNameOrInlineSnapshot, true]);
- };
- };
- var getPromiseMatcher = function getPromiseMatcher(name, matcher) {
- if (name === 'toThrow' || name === 'toThrowError') {
- return (0, _toThrowMatchers.createMatcher)(name, true);
- } else if (name === 'toThrowErrorMatchingSnapshot' || name === 'toThrowErrorMatchingInlineSnapshot') {
- return createToThrowErrorMatchingSnapshotMatcher(matcher);
- }
- return null;
- };
- var expect = function expect(actual) {
- if ((arguments.length <= 1 ? 0 : arguments.length - 1) !== 0) {
- throw new Error('Expect takes at most one argument.');
- }
- var allMatchers = (0, _jestMatchersObject.getMatchers)();
- var expectation = {
- not: {},
- rejects: {
- not: {}
- },
- resolves: {
- not: {}
- }
- };
- var err = new JestAssertionError();
- Object.keys(allMatchers).forEach(function (name) {
- var matcher = allMatchers[name];
- var promiseMatcher = getPromiseMatcher(name, matcher) || matcher;
- expectation[name] = makeThrowingMatcher(matcher, false, '', actual);
- expectation.not[name] = makeThrowingMatcher(matcher, true, '', actual);
- expectation.resolves[name] = makeResolveMatcher(name, promiseMatcher, false, actual, err);
- expectation.resolves.not[name] = makeResolveMatcher(name, promiseMatcher, true, actual, err);
- expectation.rejects[name] = makeRejectMatcher(name, promiseMatcher, false, actual, err);
- expectation.rejects.not[name] = makeRejectMatcher(name, promiseMatcher, true, actual, err);
- });
- return expectation;
- };
- var getMessage = function getMessage(message) {
- return message && message() || matcherUtils.RECEIVED_COLOR('No message was specified for this matcher.');
- };
- var makeResolveMatcher = function makeResolveMatcher(matcherName, matcher, isNot, actual, outerErr) {
- return function () {
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- var options = {
- isNot: isNot,
- promise: 'resolves'
- };
- if (!isPromise(actual)) {
- throw new JestAssertionError(matcherUtils.matcherErrorMessage(matcherUtils.matcherHint(matcherName, undefined, '', options), "".concat(matcherUtils.RECEIVED_COLOR('received'), " value must be a promise"), matcherUtils.printWithType('Received', actual, matcherUtils.printReceived)));
- }
- var innerErr = new JestAssertionError();
- return actual.then(function (result) {
- return makeThrowingMatcher(matcher, isNot, 'resolves', result, innerErr).apply(null, args);
- }, function (reason) {
- outerErr.message = matcherUtils.matcherHint(matcherName, undefined, '', options) + '\n\n' + "Received promise rejected instead of resolved\n" + "Rejected to value: ".concat(matcherUtils.printReceived(reason));
- return Promise.reject(outerErr);
- });
- };
- };
- var makeRejectMatcher = function makeRejectMatcher(matcherName, matcher, isNot, actual, outerErr) {
- return function () {
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
- args[_key2] = arguments[_key2];
- }
- var options = {
- isNot: isNot,
- promise: 'rejects'
- };
- if (!isPromise(actual)) {
- throw new JestAssertionError(matcherUtils.matcherErrorMessage(matcherUtils.matcherHint(matcherName, undefined, '', options), "".concat(matcherUtils.RECEIVED_COLOR('received'), " value must be a promise"), matcherUtils.printWithType('Received', actual, matcherUtils.printReceived)));
- }
- var innerErr = new JestAssertionError();
- return actual.then(function (result) {
- outerErr.message = matcherUtils.matcherHint(matcherName, undefined, '', options) + '\n\n' + "Received promise resolved instead of rejected\n" + "Resolved to value: ".concat(matcherUtils.printReceived(result));
- return Promise.reject(outerErr);
- }, function (reason) {
- return makeThrowingMatcher(matcher, isNot, 'rejects', reason, innerErr).apply(null, args);
- });
- };
- };
- var makeThrowingMatcher = function makeThrowingMatcher(matcher, isNot, promise, actual, err) {
- return function throwingMatcher() {
- var throws = true;
- var utils = _objectSpread({}, matcherUtils, {
- iterableEquality: _utils.iterableEquality,
- subsetEquality: _utils.subsetEquality
- });
- var matcherContext = _objectSpread({
- // When throws is disabled, the matcher will not throw errors during test
- // execution but instead add them to the global matcher state. If a
- // matcher throws, test execution is normally stopped immediately. The
- // snapshot matcher uses it because we want to log all snapshot
- // failures in a test.
- dontThrow: function dontThrow() {
- return throws = false;
- }
- }, (0, _jestMatchersObject.getState)(), {
- equals: _jasmineUtils.equals,
- error: err,
- isNot: isNot,
- promise: promise,
- utils: utils
- });
- var processResult = function processResult(result, asyncError) {
- _validateResult(result);
- (0, _jestMatchersObject.getState)().assertionCalls++;
- if (result.pass && isNot || !result.pass && !isNot) {
- // XOR
- var message = getMessage(result.message);
- var error;
- if (err) {
- error = err;
- error.message = message;
- } else if (asyncError) {
- error = asyncError;
- error.message = message;
- } else {
- error = new JestAssertionError(message); // Try to remove this function from the stack trace frame.
- // Guard for some environments (browsers) that do not support this feature.
- if (Error.captureStackTrace) {
- Error.captureStackTrace(error, throwingMatcher);
- }
- } // Passing the result of the matcher with the error so that a custom
- // reporter could access the actual and expected objects of the result
- // for example in order to display a custom visual diff
- error.matcherResult = result;
- if (throws) {
- throw error;
- } else {
- (0, _jestMatchersObject.getState)().suppressedErrors.push(error);
- }
- }
- };
- var handlError = function handlError(error) {
- if (matcher[_jestMatchersObject.INTERNAL_MATCHER_FLAG] === true && !(error instanceof JestAssertionError) && error.name !== 'PrettyFormatPluginError' && // Guard for some environments (browsers) that do not support this feature.
- Error.captureStackTrace) {
- // Try to remove this and deeper functions from the stack trace frame.
- Error.captureStackTrace(error, throwingMatcher);
- }
- throw error;
- };
- var potentialResult;
- try {
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
- args[_key3] = arguments[_key3];
- }
- potentialResult = matcher.call.apply(matcher, [matcherContext, actual].concat(args));
- if (isPromise(potentialResult)) {
- var asyncResult = potentialResult;
- var asyncError = new JestAssertionError();
- if (Error.captureStackTrace) {
- Error.captureStackTrace(asyncError, throwingMatcher);
- }
- return asyncResult.then(function (aResult) {
- return processResult(aResult, asyncError);
- }).catch(function (error) {
- return handlError(error);
- });
- } else {
- var syncResult = potentialResult;
- return processResult(syncResult);
- }
- } catch (error) {
- return handlError(error);
- }
- };
- };
- expect.extend = function (matchers) {
- return (0, _jestMatchersObject.setMatchers)(matchers, false, expect);
- };
- expect.anything = _asymmetricMatchers.anything;
- expect.any = _asymmetricMatchers.any;
- expect.not = {
- arrayContaining: _asymmetricMatchers.arrayNotContaining,
- objectContaining: _asymmetricMatchers.objectNotContaining,
- stringContaining: _asymmetricMatchers.stringNotContaining,
- stringMatching: _asymmetricMatchers.stringNotMatching
- };
- expect.objectContaining = _asymmetricMatchers.objectContaining;
- expect.arrayContaining = _asymmetricMatchers.arrayContaining;
- expect.stringContaining = _asymmetricMatchers.stringContaining;
- expect.stringMatching = _asymmetricMatchers.stringMatching;
- var _validateResult = function _validateResult(result) {
- if (_typeof(result) !== 'object' || typeof result.pass !== 'boolean' || result.message && typeof result.message !== 'string' && typeof result.message !== 'function') {
- throw new Error('Unexpected return from a matcher function.\n' + 'Matcher functions should ' + 'return an object in the following format:\n' + ' {message?: string | function, pass: boolean}\n' + "'".concat(matcherUtils.stringify(result), "' was returned"));
- }
- };
- function assertions(expected) {
- var error = new Error();
- if (Error.captureStackTrace) {
- Error.captureStackTrace(error, assertions);
- }
- (0, _jestMatchersObject.getState)().expectedAssertionsNumber = expected;
- (0, _jestMatchersObject.getState)().expectedAssertionsNumberError = error;
- }
- function hasAssertions() {
- var error = new Error();
- if (Error.captureStackTrace) {
- Error.captureStackTrace(error, hasAssertions);
- }
- matcherUtils.ensureNoExpected(arguments.length <= 0 ? undefined : arguments[0], '.hasAssertions');
- (0, _jestMatchersObject.getState)().isExpectingAssertions = true;
- (0, _jestMatchersObject.getState)().isExpectingAssertionsError = error;
- } // add default jest matchers
- (0, _jestMatchersObject.setMatchers)(_matchers.default, true, expect);
- (0, _jestMatchersObject.setMatchers)(_spyMatchers.default, true, expect);
- (0, _jestMatchersObject.setMatchers)(_toThrowMatchers.default, true, expect);
- expect.addSnapshotSerializer = function () {
- return void 0;
- };
- expect.assertions = assertions;
- expect.hasAssertions = hasAssertions;
- expect.getState = _jestMatchersObject.getState;
- expect.setState = _jestMatchersObject.setState;
- expect.extractExpectedAssertionsErrors = _extractExpectedAssertionsErrors.default;
- var expectExport = expect; // eslint-disable-next-line no-redeclare
- module.exports = expectExport;
- /***/ }),
- /***/ "./packages/expect/src/jasmineUtils.ts":
- /*!*********************************************!*\
- !*** ./packages/expect/src/jasmineUtils.ts ***!
- \*********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.equals = equals;
- exports.isA = isA;
- exports.fnNameFor = fnNameFor;
- exports.isUndefined = isUndefined;
- exports.hasProperty = hasProperty;
- exports.isImmutableUnorderedKeyed = isImmutableUnorderedKeyed;
- exports.isImmutableUnorderedSet = isImmutableUnorderedSet;
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- /*
- Copyright (c) 2008-2016 Pivotal Labs
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
- /* eslint-disable */
- // Extracted out of jasmine 2.5.2
- function equals(a, b, customTesters, strictCheck) {
- customTesters = customTesters || [];
- return eq(a, b, [], [], customTesters, strictCheck ? hasKey : hasDefinedKey);
- }
- var functionToString = Function.prototype.toString;
- function isAsymmetric(obj) {
- return !!obj && isA('Function', obj.asymmetricMatch);
- }
- function asymmetricMatch(a, b) {
- var asymmetricA = isAsymmetric(a),
- asymmetricB = isAsymmetric(b);
- if (asymmetricA && asymmetricB) {
- return undefined;
- }
- if (asymmetricA) {
- return a.asymmetricMatch(b);
- }
- if (asymmetricB) {
- return b.asymmetricMatch(a);
- }
- } // Equality function lovingly adapted from isEqual in
- // [Underscore](http://underscorejs.org)
- function eq(a, b, aStack, bStack, customTesters, hasKey) {
- var result = true;
- var asymmetricResult = asymmetricMatch(a, b);
- if (asymmetricResult !== undefined) {
- return asymmetricResult;
- }
- for (var i = 0; i < customTesters.length; i++) {
- var customTesterResult = customTesters[i](a, b);
- if (customTesterResult !== undefined) {
- return customTesterResult;
- }
- }
- if (a instanceof Error && b instanceof Error) {
- return a.message == b.message;
- }
- if (Object.is(a, b)) {
- return true;
- } // A strict comparison is necessary because `null == undefined`.
- if (a === null || b === null) {
- return a === b;
- }
- var className = Object.prototype.toString.call(a);
- if (className != Object.prototype.toString.call(b)) {
- return false;
- }
- switch (className) {
- // Strings, numbers, dates, and booleans are compared by value.
- case '[object String]':
- // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
- // equivalent to `new String("5")`.
- return a == String(b);
- case '[object Number]':
- return Object.is(Number(a), Number(b));
- case '[object Date]':
- case '[object Boolean]':
- // Coerce dates and booleans to numeric primitive values. Dates are compared by their
- // millisecond representations. Note that invalid dates with millisecond representations
- // of `NaN` are not equivalent.
- return +a == +b;
- // RegExps are compared by their source patterns and flags.
- case '[object RegExp]':
- return a.source == b.source && a.global == b.global && a.multiline == b.multiline && a.ignoreCase == b.ignoreCase;
- }
- if (_typeof(a) != 'object' || _typeof(b) != 'object') {
- return false;
- } // Use DOM3 method isEqualNode (IE>=9)
- if (isDomNode(a) && isDomNode(b)) {
- return a.isEqualNode(b);
- } // Used to detect circular references.
- var length = aStack.length;
- while (length--) {
- // Linear search. Performance is inversely proportional to the number of
- // unique nested structures.
- // circular references at same depth are equal
- // circular reference is not equal to non-circular one
- if (aStack[length] === a) {
- return bStack[length] === b;
- } else if (bStack[length] === b) {
- return false;
- }
- } // Add the first object to the stack of traversed objects.
- aStack.push(a);
- bStack.push(b);
- var size = 0; // Recursively compare objects and arrays.
- // Compare array lengths to determine if a deep comparison is necessary.
- if (className == '[object Array]') {
- size = a.length;
- if (size !== b.length) {
- return false;
- }
- while (size--) {
- result = eq(a[size], b[size], aStack, bStack, customTesters, hasKey);
- if (!result) {
- return false;
- }
- }
- } // Deep compare objects.
- var aKeys = keys(a, className == '[object Array]', hasKey),
- key;
- size = aKeys.length; // Ensure that both objects contain the same number of properties before comparing deep equality.
- if (keys(b, className == '[object Array]', hasKey).length !== size) {
- return false;
- }
- while (size--) {
- key = aKeys[size]; // Deep compare each member
- result = hasKey(b, key) && eq(a[key], b[key], aStack, bStack, customTesters, hasKey);
- if (!result) {
- return false;
- }
- } // Remove the first object from the stack of traversed objects.
- aStack.pop();
- bStack.pop();
- return result;
- }
- function keys(obj, isArray, hasKey) {
- var allKeys = function (o) {
- var keys = [];
- for (var key in o) {
- if (hasKey(o, key)) {
- keys.push(key);
- }
- }
- return keys.concat(Object.getOwnPropertySymbols(o).filter(function (symbol) {
- return Object.getOwnPropertyDescriptor(o, symbol).enumerable;
- }));
- }(obj);
- if (!isArray) {
- return allKeys;
- }
- var extraKeys = [];
- if (allKeys.length === 0) {
- return allKeys;
- }
- for (var x = 0; x < allKeys.length; x++) {
- if (_typeof(allKeys[x]) === 'symbol' || !allKeys[x].match(/^[0-9]+$/)) {
- extraKeys.push(allKeys[x]);
- }
- }
- return extraKeys;
- }
- function hasDefinedKey(obj, key) {
- return hasKey(obj, key) && obj[key] !== undefined;
- }
- function hasKey(obj, key) {
- return Object.prototype.hasOwnProperty.call(obj, key);
- }
- function isA(typeName, value) {
- return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
- }
- function isDomNode(obj) {
- return obj !== null && _typeof(obj) === 'object' && typeof obj.nodeType === 'number' && typeof obj.nodeName === 'string' && typeof obj.isEqualNode === 'function';
- }
- function fnNameFor(func) {
- if (func.name) {
- return func.name;
- }
- var matches = functionToString.call(func).match(/^(?:async)?\s*function\s*\*?\s*([\w$]+)\s*\(/);
- return matches ? matches[1] : '<anonymous>';
- }
- function isUndefined(obj) {
- return obj === void 0;
- }
- function getPrototype(obj) {
- if (Object.getPrototypeOf) {
- return Object.getPrototypeOf(obj);
- }
- if (obj.constructor.prototype == obj) {
- return null;
- }
- return obj.constructor.prototype;
- }
- function hasProperty(obj, property) {
- if (!obj) {
- return false;
- }
- if (Object.prototype.hasOwnProperty.call(obj, property)) {
- return true;
- }
- return hasProperty(getPrototype(obj), property);
- } // SENTINEL constants are from https://github.com/facebook/immutable-js
- var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';
- var IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';
- var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';
- function isImmutableUnorderedKeyed(maybeKeyed) {
- return !!(maybeKeyed && maybeKeyed[IS_KEYED_SENTINEL] && !maybeKeyed[IS_ORDERED_SENTINEL]);
- }
- function isImmutableUnorderedSet(maybeSet) {
- return !!(maybeSet && maybeSet[IS_SET_SENTINEL] && !maybeSet[IS_ORDERED_SENTINEL]);
- }
- /***/ }),
- /***/ "./packages/expect/src/jestMatchersObject.ts":
- /*!***************************************************!*\
- !*** ./packages/expect/src/jestMatchersObject.ts ***!
- \***************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(global) {
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.setMatchers = exports.getMatchers = exports.setState = exports.getState = exports.INTERNAL_MATCHER_FLAG = void 0;
- var _asymmetricMatchers = __webpack_require__(/*! ./asymmetricMatchers */ "./packages/expect/src/asymmetricMatchers.ts");
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
- function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
- function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- // Global matchers object holds the list of available matchers and
- // the state, that can hold matcher specific values that change over time.
- var JEST_MATCHERS_OBJECT = Symbol.for('$$jest-matchers-object'); // Notes a built-in/internal Jest matcher.
- // Jest may override the stack trace of Errors thrown by internal matchers.
- var INTERNAL_MATCHER_FLAG = Symbol.for('$$jest-internal-matcher');
- exports.INTERNAL_MATCHER_FLAG = INTERNAL_MATCHER_FLAG;
- if (!global.hasOwnProperty(JEST_MATCHERS_OBJECT)) {
- Object.defineProperty(global, JEST_MATCHERS_OBJECT, {
- value: {
- matchers: Object.create(null),
- state: {
- assertionCalls: 0,
- expectedAssertionsNumber: null,
- isExpectingAssertions: false,
- suppressedErrors: [] // errors that are not thrown immediately.
- }
- }
- });
- }
- var getState = function getState() {
- return global[JEST_MATCHERS_OBJECT].state;
- };
- exports.getState = getState;
- var setState = function setState(state) {
- Object.assign(global[JEST_MATCHERS_OBJECT].state, state);
- };
- exports.setState = setState;
- var getMatchers = function getMatchers() {
- return global[JEST_MATCHERS_OBJECT].matchers;
- };
- exports.getMatchers = getMatchers;
- var setMatchers = function setMatchers(matchers, isInternal, expect) {
- Object.keys(matchers).forEach(function (key) {
- var matcher = matchers[key];
- Object.defineProperty(matcher, INTERNAL_MATCHER_FLAG, {
- value: isInternal
- });
- if (!isInternal) {
- // expect is defined
- var CustomMatcher =
- /*#__PURE__*/
- function (_AsymmetricMatcher) {
- _inherits(CustomMatcher, _AsymmetricMatcher);
- function CustomMatcher() {
- var _this;
- var inverse = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
- _classCallCheck(this, CustomMatcher);
- for (var _len = arguments.length, sample = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- sample[_key - 1] = arguments[_key];
- }
- _this = _possibleConstructorReturn(this, _getPrototypeOf(CustomMatcher).call(this, sample));
- _this.inverse = inverse;
- return _this;
- }
- _createClass(CustomMatcher, [{
- key: "asymmetricMatch",
- value: function asymmetricMatch(other) {
- var _ref = matcher.apply(void 0, [other].concat(_toConsumableArray(this.sample))),
- pass = _ref.pass;
- return this.inverse ? !pass : pass;
- }
- }, {
- key: "toString",
- value: function toString() {
- return "".concat(this.inverse ? 'not.' : '').concat(key);
- }
- }, {
- key: "getExpectedType",
- value: function getExpectedType() {
- return 'any';
- }
- }, {
- key: "toAsymmetricMatcher",
- value: function toAsymmetricMatcher() {
- return "".concat(this.toString(), "<").concat(this.sample.join(', '), ">");
- }
- }]);
- return CustomMatcher;
- }(_asymmetricMatchers.AsymmetricMatcher);
- expect[key] = function () {
- for (var _len2 = arguments.length, sample = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
- sample[_key2] = arguments[_key2];
- }
- return _construct(CustomMatcher, [false].concat(sample));
- };
- if (!expect.not) {
- expect.not = {};
- }
- expect.not[key] = function () {
- for (var _len3 = arguments.length, sample = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
- sample[_key3] = arguments[_key3];
- }
- return _construct(CustomMatcher, [true].concat(sample));
- };
- }
- });
- Object.assign(global[JEST_MATCHERS_OBJECT].matchers, matchers);
- };
- exports.setMatchers = setMatchers;
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
- /***/ }),
- /***/ "./packages/expect/src/matchers.ts":
- /*!*****************************************!*\
- !*** ./packages/expect/src/matchers.ts ***!
- \*****************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _jestGetType = _interopRequireWildcard(__webpack_require__(/*! jest-get-type */ "./packages/jest-get-type/build/index.js"));
- var _jestMatcherUtils = __webpack_require__(/*! jest-matcher-utils */ "./packages/jest-matcher-utils/build/index.js");
- var _print = __webpack_require__(/*! ./print */ "./packages/expect/src/print.ts");
- var _utils = __webpack_require__(/*! ./utils */ "./packages/expect/src/utils.ts");
- var _jasmineUtils = __webpack_require__(/*! ./jasmineUtils */ "./packages/expect/src/jasmineUtils.ts");
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- // Omit colon and one or more spaces, so can call getLabelPrinter.
- var EXPECTED_LABEL = 'Expected';
- var RECEIVED_LABEL = 'Received';
- var EXPECTED_VALUE_LABEL = 'Expected value';
- var RECEIVED_VALUE_LABEL = 'Received value'; // The optional property of matcher context is true if undefined.
- var isExpand = function isExpand(expand) {
- return expand !== false;
- };
- var toStrictEqualTesters = [_utils.iterableEquality, _utils.typeEquality, _utils.sparseArrayEquality];
- var matchers = {
- toBe: function toBe(received, expected) {
- var _this = this;
- var matcherName = 'toBe';
- var options = {
- comment: 'Object.is equality',
- isNot: this.isNot,
- promise: this.promise
- };
- var pass = Object.is(received, expected);
- var message = pass ? function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "Expected: not ".concat((0, _jestMatcherUtils.printExpected)(expected));
- } : function () {
- var expectedType = (0, _jestGetType.default)(expected);
- var deepEqualityName = null;
- if (expectedType !== 'map' && expectedType !== 'set') {
- // If deep equality passes when referential identity fails,
- // but exclude map and set until review of their equality logic.
- if ((0, _jasmineUtils.equals)(received, expected, toStrictEqualTesters, true)) {
- deepEqualityName = 'toStrictEqual';
- } else if ((0, _jasmineUtils.equals)(received, expected, [_utils.iterableEquality])) {
- deepEqualityName = 'toEqual';
- }
- }
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + (deepEqualityName !== null ? (0, _jestMatcherUtils.DIM_COLOR)("If it should pass with deep equality, replace \"".concat(matcherName, "\" with \"").concat(deepEqualityName, "\"")) + '\n\n' : '') + (0, _jestMatcherUtils.printDiffOrStringify)(expected, received, EXPECTED_LABEL, RECEIVED_LABEL, isExpand(_this.expand));
- }; // Passing the actual and expected objects so that a custom reporter
- // could access them, for example in order to display a custom visual diff,
- // or create a different error message
- return {
- actual: received,
- expected: expected,
- message: message,
- name: matcherName,
- pass: pass
- };
- },
- toBeCloseTo: function toBeCloseTo(received, expected) {
- var precision = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2;
- var matcherName = 'toBeCloseTo';
- var secondArgument = arguments.length === 3 ? 'precision' : undefined;
- var options = {
- isNot: this.isNot,
- promise: this.promise,
- secondArgument: secondArgument,
- secondArgumentColor: function secondArgumentColor(arg) {
- return arg;
- }
- };
- (0, _jestMatcherUtils.ensureNumbers)(received, expected, matcherName, options);
- var pass = false;
- var expectedDiff = 0;
- var receivedDiff = 0;
- if (received === Infinity && expected === Infinity) {
- pass = true; // Infinity - Infinity is NaN
- } else if (received === -Infinity && expected === -Infinity) {
- pass = true; // -Infinity - -Infinity is NaN
- } else {
- expectedDiff = Math.pow(10, -precision) / 2;
- receivedDiff = Math.abs(expected - received);
- pass = receivedDiff < expectedDiff;
- }
- var message = pass ? function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "Expected: not ".concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + (receivedDiff === 0 ? '' : "Received: ".concat((0, _jestMatcherUtils.printReceived)(received), "\n") + '\n' + "Expected precision: ".concat((0, _jestMatcherUtils.stringify)(precision), "\n") + "Expected difference: not < ".concat((0, _jestMatcherUtils.printExpected)(expectedDiff), "\n") + "Received difference: ".concat((0, _jestMatcherUtils.printReceived)(receivedDiff)));
- } : function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "Expected: ".concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + "Received: ".concat((0, _jestMatcherUtils.printReceived)(received), "\n") + '\n' + "Expected precision: ".concat((0, _jestMatcherUtils.stringify)(precision), "\n") + "Expected difference: < ".concat((0, _jestMatcherUtils.printExpected)(expectedDiff), "\n") + "Received difference: ".concat((0, _jestMatcherUtils.printReceived)(receivedDiff));
- };
- return {
- message: message,
- pass: pass
- };
- },
- toBeDefined: function toBeDefined(received, expected) {
- var matcherName = 'toBeDefined';
- var options = {
- isNot: this.isNot,
- promise: this.promise
- };
- (0, _jestMatcherUtils.ensureNoExpected)(expected, matcherName, options);
- var pass = received !== void 0;
- var message = function message() {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, '', options) + '\n\n' + "Received: ".concat((0, _jestMatcherUtils.printReceived)(received));
- };
- return {
- message: message,
- pass: pass
- };
- },
- toBeFalsy: function toBeFalsy(received, expected) {
- var matcherName = 'toBeFalsy';
- var options = {
- isNot: this.isNot,
- promise: this.promise
- };
- (0, _jestMatcherUtils.ensureNoExpected)(expected, matcherName, options);
- var pass = !received;
- var message = function message() {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, '', options) + '\n\n' + "Received: ".concat((0, _jestMatcherUtils.printReceived)(received));
- };
- return {
- message: message,
- pass: pass
- };
- },
- toBeGreaterThan: function toBeGreaterThan(received, expected) {
- var matcherName = 'toBeGreaterThan';
- var isNot = this.isNot;
- var options = {
- isNot: isNot,
- promise: this.promise
- };
- (0, _jestMatcherUtils.ensureNumbers)(received, expected, matcherName, options);
- var pass = received > expected;
- var message = function message() {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "Expected:".concat(isNot ? ' not' : '', " > ").concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + "Received:".concat(isNot ? ' ' : '', " ").concat((0, _jestMatcherUtils.printReceived)(received));
- };
- return {
- message: message,
- pass: pass
- };
- },
- toBeGreaterThanOrEqual: function toBeGreaterThanOrEqual(received, expected) {
- var matcherName = 'toBeGreaterThanOrEqual';
- var isNot = this.isNot;
- var options = {
- isNot: isNot,
- promise: this.promise
- };
- (0, _jestMatcherUtils.ensureNumbers)(received, expected, matcherName, options);
- var pass = received >= expected;
- var message = function message() {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "Expected:".concat(isNot ? ' not' : '', " >= ").concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + "Received:".concat(isNot ? ' ' : '', " ").concat((0, _jestMatcherUtils.printReceived)(received));
- };
- return {
- message: message,
- pass: pass
- };
- },
- toBeInstanceOf: function toBeInstanceOf(received, expected) {
- var matcherName = 'toBeInstanceOf';
- var options = {
- isNot: this.isNot,
- promise: this.promise
- };
- if (typeof expected !== 'function') {
- throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options), "".concat((0, _jestMatcherUtils.EXPECTED_COLOR)('expected'), " value must be a function"), (0, _jestMatcherUtils.printWithType)('Expected', expected, _jestMatcherUtils.printExpected)));
- }
- var pass = received instanceof expected;
- var message = pass ? function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + (0, _print.printExpectedConstructorNameNot)('Expected constructor', expected) + (typeof received.constructor === 'function' && received.constructor !== expected ? (0, _print.printReceivedConstructorNameNot)('Received constructor', received.constructor, expected) : '');
- } : function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + (0, _print.printExpectedConstructorName)('Expected constructor', expected) + ((0, _jestGetType.isPrimitive)(received) || Object.getPrototypeOf(received) === null ? "\nReceived value has no prototype\nReceived value: ".concat((0, _jestMatcherUtils.printReceived)(received)) : typeof received.constructor !== 'function' ? "\nReceived value: ".concat((0, _jestMatcherUtils.printReceived)(received)) : (0, _print.printReceivedConstructorName)('Received constructor', received.constructor));
- };
- return {
- message: message,
- pass: pass
- };
- },
- toBeLessThan: function toBeLessThan(received, expected) {
- var matcherName = 'toBeLessThan';
- var isNot = this.isNot;
- var options = {
- isNot: isNot,
- promise: this.promise
- };
- (0, _jestMatcherUtils.ensureNumbers)(received, expected, matcherName, options);
- var pass = received < expected;
- var message = function message() {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "Expected:".concat(isNot ? ' not' : '', " < ").concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + "Received:".concat(isNot ? ' ' : '', " ").concat((0, _jestMatcherUtils.printReceived)(received));
- };
- return {
- message: message,
- pass: pass
- };
- },
- toBeLessThanOrEqual: function toBeLessThanOrEqual(received, expected) {
- var matcherName = 'toBeLessThanOrEqual';
- var isNot = this.isNot;
- var options = {
- isNot: isNot,
- promise: this.promise
- };
- (0, _jestMatcherUtils.ensureNumbers)(received, expected, matcherName, options);
- var pass = received <= expected;
- var message = function message() {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "Expected:".concat(isNot ? ' not' : '', " <= ").concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + "Received:".concat(isNot ? ' ' : '', " ").concat((0, _jestMatcherUtils.printReceived)(received));
- };
- return {
- message: message,
- pass: pass
- };
- },
- toBeNaN: function toBeNaN(received, expected) {
- var matcherName = 'toBeNaN';
- var options = {
- isNot: this.isNot,
- promise: this.promise
- };
- (0, _jestMatcherUtils.ensureNoExpected)(expected, matcherName, options);
- var pass = Number.isNaN(received);
- var message = function message() {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, '', options) + '\n\n' + "Received: ".concat((0, _jestMatcherUtils.printReceived)(received));
- };
- return {
- message: message,
- pass: pass
- };
- },
- toBeNull: function toBeNull(received, expected) {
- var matcherName = 'toBeNull';
- var options = {
- isNot: this.isNot,
- promise: this.promise
- };
- (0, _jestMatcherUtils.ensureNoExpected)(expected, matcherName, options);
- var pass = received === null;
- var message = function message() {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, '', options) + '\n\n' + "Received: ".concat((0, _jestMatcherUtils.printReceived)(received));
- };
- return {
- message: message,
- pass: pass
- };
- },
- toBeTruthy: function toBeTruthy(received, expected) {
- var matcherName = 'toBeTruthy';
- var options = {
- isNot: this.isNot,
- promise: this.promise
- };
- (0, _jestMatcherUtils.ensureNoExpected)(expected, matcherName, options);
- var pass = !!received;
- var message = function message() {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, '', options) + '\n\n' + "Received: ".concat((0, _jestMatcherUtils.printReceived)(received));
- };
- return {
- message: message,
- pass: pass
- };
- },
- toBeUndefined: function toBeUndefined(received, expected) {
- var matcherName = 'toBeUndefined';
- var options = {
- isNot: this.isNot,
- promise: this.promise
- };
- (0, _jestMatcherUtils.ensureNoExpected)(expected, matcherName, options);
- var pass = received === void 0;
- var message = function message() {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, '', options) + '\n\n' + "Received: ".concat((0, _jestMatcherUtils.printReceived)(received));
- };
- return {
- message: message,
- pass: pass
- };
- },
- toContain: function toContain(received, expected) {
- var matcherName = 'toContain';
- var isNot = this.isNot;
- var options = {
- comment: 'indexOf',
- isNot: isNot,
- promise: this.promise
- };
- if (received == null) {
- throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options), "".concat((0, _jestMatcherUtils.RECEIVED_COLOR)('received'), " value must not be null nor undefined"), (0, _jestMatcherUtils.printWithType)('Received', received, _jestMatcherUtils.printReceived)));
- }
- if (typeof received === 'string') {
- var _index = received.indexOf(String(expected));
- var _pass = _index !== -1;
- var _message = function _message() {
- var labelExpected = "Expected ".concat(typeof expected === 'string' ? 'substring' : 'value');
- var labelReceived = 'Received string';
- var printLabel = (0, _jestMatcherUtils.getLabelPrinter)(labelExpected, labelReceived);
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "".concat(printLabel(labelExpected)).concat(isNot ? 'not ' : '').concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + "".concat(printLabel(labelReceived)).concat(isNot ? ' ' : '').concat(isNot ? (0, _print.printReceivedStringContainExpectedSubstring)(received, _index, String(expected).length) : (0, _jestMatcherUtils.printReceived)(received));
- };
- return {
- message: _message,
- pass: _pass
- };
- }
- var indexable = Array.from(received);
- var index = indexable.indexOf(expected);
- var pass = index !== -1;
- var message = function message() {
- var labelExpected = 'Expected value';
- var labelReceived = "Received ".concat((0, _jestGetType.default)(received));
- var printLabel = (0, _jestMatcherUtils.getLabelPrinter)(labelExpected, labelReceived);
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "".concat(printLabel(labelExpected)).concat(isNot ? 'not ' : '').concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + "".concat(printLabel(labelReceived)).concat(isNot ? ' ' : '').concat(isNot && Array.isArray(received) ? (0, _print.printReceivedArrayContainExpectedItem)(received, index) : (0, _jestMatcherUtils.printReceived)(received)) + (!isNot && indexable.findIndex(function (item) {
- return (0, _jasmineUtils.equals)(item, expected, [_utils.iterableEquality]);
- }) !== -1 ? "\n\n".concat(_jestMatcherUtils.SUGGEST_TO_CONTAIN_EQUAL) : '');
- };
- return {
- message: message,
- pass: pass
- };
- },
- toContainEqual: function toContainEqual(received, expected) {
- var matcherName = 'toContainEqual';
- var isNot = this.isNot;
- var options = {
- comment: 'deep equality',
- isNot: isNot,
- promise: this.promise
- };
- if (received == null) {
- throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options), "".concat((0, _jestMatcherUtils.RECEIVED_COLOR)('received'), " value must not be null nor undefined"), (0, _jestMatcherUtils.printWithType)('Received', received, _jestMatcherUtils.printReceived)));
- }
- var index = Array.from(received).findIndex(function (item) {
- return (0, _jasmineUtils.equals)(item, expected, [_utils.iterableEquality]);
- });
- var pass = index !== -1;
- var message = function message() {
- var labelExpected = 'Expected value';
- var labelReceived = "Received ".concat((0, _jestGetType.default)(received));
- var printLabel = (0, _jestMatcherUtils.getLabelPrinter)(labelExpected, labelReceived);
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "".concat(printLabel(labelExpected)).concat(isNot ? 'not ' : '').concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + "".concat(printLabel(labelReceived)).concat(isNot ? ' ' : '').concat(isNot && Array.isArray(received) ? (0, _print.printReceivedArrayContainExpectedItem)(received, index) : (0, _jestMatcherUtils.printReceived)(received));
- };
- return {
- message: message,
- pass: pass
- };
- },
- toEqual: function toEqual(received, expected) {
- var _this2 = this;
- var matcherName = 'toEqual';
- var options = {
- comment: 'deep equality',
- isNot: this.isNot,
- promise: this.promise
- };
- var pass = (0, _jasmineUtils.equals)(received, expected, [_utils.iterableEquality]);
- var message = pass ? function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "Expected: not ".concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + ((0, _jestMatcherUtils.stringify)(expected) !== (0, _jestMatcherUtils.stringify)(received) ? "Received: ".concat((0, _jestMatcherUtils.printReceived)(received)) : '');
- } : function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + (0, _jestMatcherUtils.printDiffOrStringify)(expected, received, EXPECTED_LABEL, RECEIVED_LABEL, isExpand(_this2.expand));
- }; // Passing the actual and expected objects so that a custom reporter
- // could access them, for example in order to display a custom visual diff,
- // or create a different error message
- return {
- actual: received,
- expected: expected,
- message: message,
- name: matcherName,
- pass: pass
- };
- },
- toHaveLength: function toHaveLength(received, expected) {
- var matcherName = 'toHaveLength';
- var isNot = this.isNot;
- var options = {
- isNot: isNot,
- promise: this.promise
- };
- if (typeof received !== 'string' && (!received || typeof received.length !== 'number')) {
- throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options), "".concat((0, _jestMatcherUtils.RECEIVED_COLOR)('received'), " value must have a length property whose value must be a number"), (0, _jestMatcherUtils.printWithType)('Received', received, _jestMatcherUtils.printReceived)));
- }
- (0, _jestMatcherUtils.ensureExpectedIsNonNegativeInteger)(expected, matcherName, options);
- var pass = received.length === expected;
- var message = function message() {
- var labelExpected = 'Expected length';
- var labelReceivedLength = 'Received length';
- var labelReceivedValue = "Received ".concat((0, _jestGetType.default)(received));
- var printLabel = (0, _jestMatcherUtils.getLabelPrinter)(labelExpected, labelReceivedLength, labelReceivedValue);
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "".concat(printLabel(labelExpected)).concat(isNot ? 'not ' : '').concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + (isNot ? '' : "".concat(printLabel(labelReceivedLength)).concat((0, _jestMatcherUtils.printReceived)(received.length), "\n")) + "".concat(printLabel(labelReceivedValue)).concat(isNot ? ' ' : '').concat((0, _jestMatcherUtils.printReceived)(received));
- };
- return {
- message: message,
- pass: pass
- };
- },
- toHaveProperty: function toHaveProperty(received, expectedPath, expectedValue) {
- var _this3 = this;
- var matcherName = 'toHaveProperty';
- var expectedArgument = 'path';
- var hasValue = arguments.length === 3;
- var options = {
- isNot: this.isNot,
- promise: this.promise,
- secondArgument: hasValue ? 'value' : ''
- };
- if (received === null || received === undefined) {
- throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, expectedArgument, options), "".concat((0, _jestMatcherUtils.RECEIVED_COLOR)('received'), " value must not be null nor undefined"), (0, _jestMatcherUtils.printWithType)('Received', received, _jestMatcherUtils.printReceived)));
- }
- var expectedPathType = (0, _jestGetType.default)(expectedPath);
- if (expectedPathType !== 'string' && expectedPathType !== 'array') {
- throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, expectedArgument, options), "".concat((0, _jestMatcherUtils.EXPECTED_COLOR)('expected'), " path must be a string or array"), (0, _jestMatcherUtils.printWithType)('Expected', expectedPath, _jestMatcherUtils.printExpected)));
- }
- var expectedPathLength = typeof expectedPath === 'string' ? expectedPath.split('.').length : expectedPath.length;
- if (expectedPathType === 'array' && expectedPathLength === 0) {
- throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, expectedArgument, options), "".concat((0, _jestMatcherUtils.EXPECTED_COLOR)('expected'), " path must not be an empty array"), (0, _jestMatcherUtils.printWithType)('Expected', expectedPath, _jestMatcherUtils.printExpected)));
- }
- var result = (0, _utils.getPath)(received, expectedPath);
- var lastTraversedObject = result.lastTraversedObject,
- hasEndProp = result.hasEndProp;
- var receivedPath = result.traversedPath;
- var hasCompletePath = receivedPath.length === expectedPathLength;
- var receivedValue = hasCompletePath ? result.value : lastTraversedObject;
- var pass = hasValue ? (0, _jasmineUtils.equals)(result.value, expectedValue, [_utils.iterableEquality]) : Boolean(hasEndProp); // theoretically undefined if empty path
- // Remove type cast if we rewrite getPath as iterative algorithm.
- // Delete this unique report if future breaking change
- // removes the edge case that expected value undefined
- // also matches absence of a property with the key path.
- if (pass && !hasCompletePath) {
- var _message2 = function _message2() {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, expectedArgument, options) + '\n\n' + "Expected path: ".concat((0, _jestMatcherUtils.printExpected)(expectedPath), "\n") + "Received path: ".concat((0, _jestMatcherUtils.printReceived)(expectedPathType === 'array' || receivedPath.length === 0 ? receivedPath : receivedPath.join('.')), "\n\n") + "Expected value: not ".concat((0, _jestMatcherUtils.printExpected)(expectedValue), "\n") + "Received value: ".concat((0, _jestMatcherUtils.printReceived)(receivedValue), "\n\n") + (0, _jestMatcherUtils.DIM_COLOR)('Because a positive assertion passes for expected value undefined if the property does not exist, this negative assertion fails unless the property does exist and has a defined value');
- };
- return {
- message: _message2,
- pass: pass
- };
- }
- var message = pass ? function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, expectedArgument, options) + '\n\n' + (hasValue ? "Expected path: ".concat((0, _jestMatcherUtils.printExpected)(expectedPath), "\n\n") + "Expected value: not ".concat((0, _jestMatcherUtils.printExpected)(expectedValue)) + ((0, _jestMatcherUtils.stringify)(expectedValue) !== (0, _jestMatcherUtils.stringify)(receivedValue) ? "\nReceived value: ".concat((0, _jestMatcherUtils.printReceived)(receivedValue)) : '') : "Expected path: not ".concat((0, _jestMatcherUtils.printExpected)(expectedPath), "\n\n") + "Received value: ".concat((0, _jestMatcherUtils.printReceived)(receivedValue)));
- } : function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, expectedArgument, options) + '\n\n' + "Expected path: ".concat((0, _jestMatcherUtils.printExpected)(expectedPath), "\n") + (hasCompletePath ? '\n' + (0, _jestMatcherUtils.printDiffOrStringify)(expectedValue, receivedValue, EXPECTED_VALUE_LABEL, RECEIVED_VALUE_LABEL, isExpand(_this3.expand)) : "Received path: ".concat((0, _jestMatcherUtils.printReceived)(expectedPathType === 'array' || receivedPath.length === 0 ? receivedPath : receivedPath.join('.')), "\n\n") + (hasValue ? "Expected value: ".concat((0, _jestMatcherUtils.printExpected)(expectedValue), "\n") : '') + "Received value: ".concat((0, _jestMatcherUtils.printReceived)(receivedValue)));
- };
- return {
- message: message,
- pass: pass
- };
- },
- toMatch: function toMatch(received, expected) {
- var matcherName = 'toMatch';
- var options = {
- isNot: this.isNot,
- promise: this.promise
- };
- if (typeof received !== 'string') {
- throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options), "".concat((0, _jestMatcherUtils.RECEIVED_COLOR)('received'), " value must be a string"), (0, _jestMatcherUtils.printWithType)('Received', received, _jestMatcherUtils.printReceived)));
- }
- if (!(typeof expected === 'string') && !(expected && typeof expected.test === 'function')) {
- throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options), "".concat((0, _jestMatcherUtils.EXPECTED_COLOR)('expected'), " value must be a string or regular expression"), (0, _jestMatcherUtils.printWithType)('Expected', expected, _jestMatcherUtils.printExpected)));
- }
- var pass = typeof expected === 'string' ? received.includes(expected) : expected.test(received);
- var message = pass ? function () {
- return typeof expected === 'string' ? (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "Expected substring: not ".concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + "Received string: ".concat((0, _print.printReceivedStringContainExpectedSubstring)(received, received.indexOf(expected), expected.length)) : (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "Expected pattern: not ".concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + "Received string: ".concat((0, _print.printReceivedStringContainExpectedResult)(received, typeof expected.exec === 'function' ? expected.exec(received) : null));
- } : function () {
- var labelExpected = "Expected ".concat(typeof expected === 'string' ? 'substring' : 'pattern');
- var labelReceived = 'Received string';
- var printLabel = (0, _jestMatcherUtils.getLabelPrinter)(labelExpected, labelReceived);
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "".concat(printLabel(labelExpected)).concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + "".concat(printLabel(labelReceived)).concat((0, _jestMatcherUtils.printReceived)(received));
- };
- return {
- message: message,
- pass: pass
- };
- },
- toMatchObject: function toMatchObject(received, expected) {
- var _this4 = this;
- var matcherName = 'toMatchObject';
- var options = {
- isNot: this.isNot,
- promise: this.promise
- };
- if (_typeof(received) !== 'object' || received === null) {
- throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options), "".concat((0, _jestMatcherUtils.RECEIVED_COLOR)('received'), " value must be a non-null object"), (0, _jestMatcherUtils.printWithType)('Received', received, _jestMatcherUtils.printReceived)));
- }
- if (_typeof(expected) !== 'object' || expected === null) {
- throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options), "".concat((0, _jestMatcherUtils.EXPECTED_COLOR)('expected'), " value must be a non-null object"), (0, _jestMatcherUtils.printWithType)('Expected', expected, _jestMatcherUtils.printExpected)));
- }
- var pass = (0, _jasmineUtils.equals)(received, expected, [_utils.iterableEquality, _utils.subsetEquality]);
- var message = pass ? function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "Expected: not ".concat((0, _jestMatcherUtils.printExpected)(expected)) + ((0, _jestMatcherUtils.stringify)(expected) !== (0, _jestMatcherUtils.stringify)(received) ? "\nReceived: ".concat((0, _jestMatcherUtils.printReceived)(received)) : '');
- } : function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + (0, _jestMatcherUtils.printDiffOrStringify)(expected, (0, _utils.getObjectSubset)(received, expected), EXPECTED_LABEL, RECEIVED_LABEL, isExpand(_this4.expand));
- };
- return {
- message: message,
- pass: pass
- };
- },
- toStrictEqual: function toStrictEqual(received, expected) {
- var _this5 = this;
- var matcherName = 'toStrictEqual';
- var options = {
- comment: 'deep equality',
- isNot: this.isNot,
- promise: this.promise
- };
- var pass = (0, _jasmineUtils.equals)(received, expected, toStrictEqualTesters, true);
- var message = pass ? function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + "Expected: not ".concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + ((0, _jestMatcherUtils.stringify)(expected) !== (0, _jestMatcherUtils.stringify)(received) ? "Received: ".concat((0, _jestMatcherUtils.printReceived)(received)) : '');
- } : function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + (0, _jestMatcherUtils.printDiffOrStringify)(expected, received, EXPECTED_LABEL, RECEIVED_LABEL, isExpand(_this5.expand));
- }; // Passing the actual and expected objects so that a custom reporter
- // could access them, for example in order to display a custom visual diff,
- // or create a different error message
- return {
- actual: received,
- expected: expected,
- message: message,
- name: matcherName,
- pass: pass
- };
- }
- };
- var _default = matchers;
- exports.default = _default;
- /***/ }),
- /***/ "./packages/expect/src/print.ts":
- /*!**************************************!*\
- !*** ./packages/expect/src/print.ts ***!
- \**************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.printReceivedConstructorNameNot = exports.printReceivedConstructorName = exports.printExpectedConstructorNameNot = exports.printExpectedConstructorName = exports.printReceivedArrayContainExpectedItem = exports.printReceivedStringContainExpectedResult = exports.printReceivedStringContainExpectedSubstring = void 0;
- var _jestMatcherUtils = __webpack_require__(/*! jest-matcher-utils */ "./packages/jest-matcher-utils/build/index.js");
- /**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
- // Format substring but do not enclose in double quote marks.
- // The replacement is compatible with pretty-format package.
- var printSubstring = function printSubstring(val) {
- return val.replace(/"|\\/g, '\\$&');
- };
- var printReceivedStringContainExpectedSubstring = function printReceivedStringContainExpectedSubstring(received, start, length) {
- return (0, _jestMatcherUtils.RECEIVED_COLOR)('"' + printSubstring(received.slice(0, start)) + (0, _jestMatcherUtils.INVERTED_COLOR)(printSubstring(received.slice(start, start + length))) + printSubstring(received.slice(start + length)) + '"');
- };
- exports.printReceivedStringContainExpectedSubstring = printReceivedStringContainExpectedSubstring;
- var printReceivedStringContainExpectedResult = function printReceivedStringContainExpectedResult(received, result) {
- return result === null ? (0, _jestMatcherUtils.printReceived)(received) : printReceivedStringContainExpectedSubstring(received, result.index, result[0].length);
- }; // The serialized array is compatible with pretty-format package min option.
- // However, items have default stringify depth (instead of depth - 1)
- // so expected item looks consistent by itself and enclosed in the array.
- exports.printReceivedStringContainExpectedResult = printReceivedStringContainExpectedResult;
- var printReceivedArrayContainExpectedItem = function printReceivedArrayContainExpectedItem(received, index) {
- return (0, _jestMatcherUtils.RECEIVED_COLOR)('[' + received.map(function (item, i) {
- var stringified = (0, _jestMatcherUtils.stringify)(item);
- return i === index ? (0, _jestMatcherUtils.INVERTED_COLOR)(stringified) : stringified;
- }).join(', ') + ']');
- };
- exports.printReceivedArrayContainExpectedItem = printReceivedArrayContainExpectedItem;
- var printExpectedConstructorName = function printExpectedConstructorName(label, expected) {
- return printConstructorName(label, expected, false, true) + '\n';
- };
- exports.printExpectedConstructorName = printExpectedConstructorName;
- var printExpectedConstructorNameNot = function printExpectedConstructorNameNot(label, expected) {
- return printConstructorName(label, expected, true, true) + '\n';
- };
- exports.printExpectedConstructorNameNot = printExpectedConstructorNameNot;
- var printReceivedConstructorName = function printReceivedConstructorName(label, received) {
- return printConstructorName(label, received, false, false) + '\n';
- }; // Do not call function if received is equal to expected.
- exports.printReceivedConstructorName = printReceivedConstructorName;
- var printReceivedConstructorNameNot = function printReceivedConstructorNameNot(label, received, expected) {
- return typeof expected.name === 'string' && expected.name.length !== 0 && typeof received.name === 'string' && received.name.length !== 0 ? printConstructorName(label, received, true, false) + " ".concat(Object.getPrototypeOf(received) === expected ? 'extends' : 'extends … extends', " ").concat((0, _jestMatcherUtils.EXPECTED_COLOR)(expected.name)) + '\n' : printConstructorName(label, received, false, false) + '\n';
- };
- exports.printReceivedConstructorNameNot = printReceivedConstructorNameNot;
- var printConstructorName = function printConstructorName(label, constructor, isNot, isExpected) {
- return typeof constructor.name !== 'string' ? "".concat(label, " name is not a string") : constructor.name.length === 0 ? "".concat(label, " name is an empty string") : "".concat(label, ": ").concat(!isNot ? '' : isExpected ? 'not ' : ' ').concat(isExpected ? (0, _jestMatcherUtils.EXPECTED_COLOR)(constructor.name) : (0, _jestMatcherUtils.RECEIVED_COLOR)(constructor.name));
- };
- /***/ }),
- /***/ "./packages/expect/src/spyMatchers.ts":
- /*!********************************************!*\
- !*** ./packages/expect/src/spyMatchers.ts ***!
- \********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = void 0;
- var _jestGetType = _interopRequireWildcard(__webpack_require__(/*! jest-get-type */ "./packages/jest-get-type/build/index.js"));
- var _jestMatcherUtils = __webpack_require__(/*! jest-matcher-utils */ "./packages/jest-matcher-utils/build/index.js");
- var _jasmineUtils = __webpack_require__(/*! ./jasmineUtils */ "./packages/expect/src/jasmineUtils.ts");
- var _utils = __webpack_require__(/*! ./utils */ "./packages/expect/src/utils.ts");
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
- function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
- // The optional property of matcher context is true if undefined.
- var isExpand = function isExpand(expand) {
- return expand !== false;
- };
- var PRINT_LIMIT = 3;
- var NO_ARGUMENTS = 'called with 0 arguments';
- var printExpectedArgs = function printExpectedArgs(expected) {
- return expected.length === 0 ? NO_ARGUMENTS : expected.map(function (arg) {
- return (0, _jestMatcherUtils.printExpected)(arg);
- }).join(', ');
- };
- var printReceivedArgs = function printReceivedArgs(received, expected) {
- return received.length === 0 ? NO_ARGUMENTS : received.map(function (arg, i) {
- return Array.isArray(expected) && i < expected.length && isEqualValue(expected[i], arg) ? printCommon(arg) : (0, _jestMatcherUtils.printReceived)(arg);
- }).join(', ');
- };
- var printCommon = function printCommon(val) {
- return (0, _jestMatcherUtils.DIM_COLOR)((0, _jestMatcherUtils.stringify)(val));
- };
- var isEqualValue = function isEqualValue(expected, received) {
- return (0, _jasmineUtils.equals)(expected, received, [_utils.iterableEquality]);
- };
- var isEqualCall = function isEqualCall(expected, received) {
- return isEqualValue(expected, received);
- };
- var isEqualReturn = function isEqualReturn(expected, result) {
- return result.type === 'return' && isEqualValue(expected, result.value);
- };
- var countReturns = function countReturns(results) {
- return results.reduce(function (n, result) {
- return result.type === 'return' ? n + 1 : n;
- }, 0);
- };
- var printNumberOfReturns = function printNumberOfReturns(countReturns, countCalls) {
- return "\nNumber of returns: ".concat((0, _jestMatcherUtils.printReceived)(countReturns)) + (countCalls !== countReturns ? "\nNumber of calls: ".concat((0, _jestMatcherUtils.printReceived)(countCalls)) : '');
- };
- // Given a label, return a function which given a string,
- // right-aligns it preceding the colon in the label.
- var getRightAlignedPrinter = function getRightAlignedPrinter(label) {
- // Assume that the label contains a colon.
- var index = label.indexOf(':');
- var suffix = label.slice(index);
- return function (string, isExpectedCall) {
- return (isExpectedCall ? '->' + ' '.repeat(Math.max(0, index - 2 - string.length)) : ' '.repeat(Math.max(index - string.length))) + string + suffix;
- };
- };
- var printReceivedCallsNegative = function printReceivedCallsNegative(expected, indexedCalls, isOnlyCall, iExpectedCall) {
- if (indexedCalls.length === 0) {
- return '';
- }
- var label = 'Received: ';
- if (isOnlyCall) {
- return label + printReceivedArgs(indexedCalls[0], expected) + '\n';
- }
- var printAligned = getRightAlignedPrinter(label);
- return 'Received\n' + indexedCalls.reduce(function (printed, _ref) {
- var _ref2 = _slicedToArray(_ref, 2),
- i = _ref2[0],
- args = _ref2[1];
- return printed + printAligned(String(i + 1), i === iExpectedCall) + printReceivedArgs(args, expected) + '\n';
- }, '');
- };
- var printExpectedReceivedCallsPositive = function printExpectedReceivedCallsPositive(expected, indexedCalls, expand, isOnlyCall, iExpectedCall) {
- var expectedLine = "Expected: ".concat(printExpectedArgs(expected), "\n");
- if (indexedCalls.length === 0) {
- return expectedLine;
- }
- var label = 'Received: ';
- if (isOnlyCall && (iExpectedCall === 0 || iExpectedCall === undefined)) {
- var received = indexedCalls[0][1];
- if (isLineDiffableCall(expected, received)) {
- // Display diff without indentation.
- var lines = [(0, _jestMatcherUtils.EXPECTED_COLOR)('- Expected'), (0, _jestMatcherUtils.RECEIVED_COLOR)('+ Received'), ''];
- var length = Math.max(expected.length, received.length);
- for (var i = 0; i < length; i += 1) {
- if (i < expected.length && i < received.length) {
- if (isEqualValue(expected[i], received[i])) {
- lines.push(" ".concat(printCommon(received[i]), ","));
- continue;
- }
- if (isLineDiffableArg(expected[i], received[i])) {
- var difference = (0, _jestMatcherUtils.diff)(expected[i], received[i], {
- expand: expand
- });
- if (typeof difference === 'string' && difference.includes('- Expected') && difference.includes('+ Received')) {
- // Omit annotation in case multiple args have diff.
- lines.push(difference.split('\n').slice(3).join('\n') + ',');
- continue;
- }
- }
- }
- if (i < expected.length) {
- lines.push((0, _jestMatcherUtils.EXPECTED_COLOR)('- ' + (0, _jestMatcherUtils.stringify)(expected[i])) + ',');
- }
- if (i < received.length) {
- lines.push((0, _jestMatcherUtils.RECEIVED_COLOR)('+ ' + (0, _jestMatcherUtils.stringify)(received[i])) + ',');
- }
- }
- return lines.join('\n') + '\n';
- }
- return expectedLine + label + printReceivedArgs(received, expected) + '\n';
- }
- var printAligned = getRightAlignedPrinter(label);
- return expectedLine + 'Received\n' + indexedCalls.reduce(function (printed, _ref3) {
- var _ref4 = _slicedToArray(_ref3, 2),
- i = _ref4[0],
- received = _ref4[1];
- var aligned = printAligned(String(i + 1), i === iExpectedCall);
- return printed + ((i === iExpectedCall || iExpectedCall === undefined) && isLineDiffableCall(expected, received) ? aligned.replace(': ', '\n') + printDiffCall(expected, received, expand) : aligned + printReceivedArgs(received, expected)) + '\n';
- }, '');
- };
- var indentation = 'Received'.replace(/\w/g, ' ');
- var printDiffCall = function printDiffCall(expected, received, expand) {
- return received.map(function (arg, i) {
- if (i < expected.length) {
- if (isEqualValue(expected[i], arg)) {
- return indentation + ' ' + printCommon(arg) + ',';
- }
- if (isLineDiffableArg(expected[i], arg)) {
- var difference = (0, _jestMatcherUtils.diff)(expected[i], arg, {
- expand: expand
- });
- if (typeof difference === 'string' && difference.includes('- Expected') && difference.includes('+ Received')) {
- // Display diff with indentation.
- return difference.split('\n').slice(3).map(function (line) {
- return indentation + line;
- }).join('\n') + ',';
- }
- }
- } // Display + only if received arg has no corresponding expected arg.
- return indentation + (i < expected.length ? ' ' + (0, _jestMatcherUtils.printReceived)(arg) : (0, _jestMatcherUtils.RECEIVED_COLOR)('+ ' + (0, _jestMatcherUtils.stringify)(arg))) + ',';
- }).join('\n');
- };
- var isLineDiffableCall = function isLineDiffableCall(expected, received) {
- return expected.some(function (arg, i) {
- return i < received.length && isLineDiffableArg(arg, received[i]);
- });
- }; // Almost redundant with function in jest-matcher-utils,
- // except no line diff for any strings.
- var isLineDiffableArg = function isLineDiffableArg(expected, received) {
- var expectedType = (0, _jestGetType.default)(expected);
- var receivedType = (0, _jestGetType.default)(received);
- if (expectedType !== receivedType) {
- return false;
- }
- if ((0, _jestGetType.isPrimitive)(expected)) {
- return false;
- }
- if (expectedType === 'date' || expectedType === 'function' || expectedType === 'regexp') {
- return false;
- }
- if (expected instanceof Error && received instanceof Error) {
- return false;
- }
- if (expectedType === 'object' && typeof expected.asymmetricMatch === 'function') {
- return false;
- }
- if (receivedType === 'object' && typeof received.asymmetricMatch === 'function') {
- return false;
- }
- return true;
- };
- var printResult = function printResult(result, expected) {
- return result.type === 'throw' ? 'function call threw an error' : result.type === 'incomplete' ? 'function call has not returned yet' : isEqualValue(expected, result.value) ? printCommon(result.value) : (0, _jestMatcherUtils.printReceived)(result.value);
- };
- // Return either empty string or one line per indexed result,
- // so additional empty line can separate from `Number of returns` which follows.
- var printReceivedResults = function printReceivedResults(label, expected, indexedResults, isOnlyCall, iExpectedCall) {
- if (indexedResults.length === 0) {
- return '';
- }
- if (isOnlyCall && (iExpectedCall === 0 || iExpectedCall === undefined)) {
- return label + printResult(indexedResults[0][1], expected) + '\n';
- }
- var printAligned = getRightAlignedPrinter(label);
- return label.replace(':', '').trim() + '\n' + indexedResults.reduce(function (printed, _ref5) {
- var _ref6 = _slicedToArray(_ref5, 2),
- i = _ref6[0],
- result = _ref6[1];
- return printed + printAligned(String(i + 1), i === iExpectedCall) + printResult(result, expected) + '\n';
- }, '');
- };
- var createToBeCalledMatcher = function createToBeCalledMatcher(matcherName) {
- return function (received, expected) {
- var expectedArgument = '';
- var options = {
- isNot: this.isNot,
- promise: this.promise
- };
- (0, _jestMatcherUtils.ensureNoExpected)(expected, matcherName, options);
- ensureMockOrSpy(received, matcherName, expectedArgument, options);
- var receivedIsSpy = isSpy(received);
- var receivedName = receivedIsSpy ? 'spy' : received.getMockName();
- var count = receivedIsSpy ? received.calls.count() : received.mock.calls.length;
- var calls = receivedIsSpy ? received.calls.all().map(function (x) {
- return x.args;
- }) : received.mock.calls;
- var pass = count > 0;
- var message = pass ? function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "Expected number of calls: ".concat((0, _jestMatcherUtils.printExpected)(0), "\n") + "Received number of calls: ".concat((0, _jestMatcherUtils.printReceived)(count), "\n\n") + calls.reduce(function (lines, args, i) {
- if (lines.length < PRINT_LIMIT) {
- lines.push("".concat(i + 1, ": ").concat(printReceivedArgs(args)));
- }
- return lines;
- }, []).join('\n');
- } : function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "Expected number of calls: >= ".concat((0, _jestMatcherUtils.printExpected)(1), "\n") + "Received number of calls: ".concat((0, _jestMatcherUtils.printReceived)(count));
- };
- return {
- message: message,
- pass: pass
- };
- };
- };
- var createToReturnMatcher = function createToReturnMatcher(matcherName) {
- return function (received, expected) {
- var expectedArgument = '';
- var options = {
- isNot: this.isNot,
- promise: this.promise
- };
- (0, _jestMatcherUtils.ensureNoExpected)(expected, matcherName, options);
- ensureMock(received, matcherName, expectedArgument, options);
- var receivedName = received.getMockName(); // Count return values that correspond only to calls that returned
- var count = received.mock.results.reduce(function (n, result) {
- return result.type === 'return' ? n + 1 : n;
- }, 0);
- var pass = count > 0;
- var message = pass ? function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "Expected number of returns: ".concat((0, _jestMatcherUtils.printExpected)(0), "\n") + "Received number of returns: ".concat((0, _jestMatcherUtils.printReceived)(count), "\n\n") + received.mock.results.reduce(function (lines, result, i) {
- if (result.type === 'return' && lines.length < PRINT_LIMIT) {
- lines.push("".concat(i + 1, ": ").concat((0, _jestMatcherUtils.printReceived)(result.value)));
- }
- return lines;
- }, []).join('\n') + (received.mock.calls.length !== count ? "\n\nReceived number of calls: ".concat((0, _jestMatcherUtils.printReceived)(received.mock.calls.length)) : '');
- } : function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "Expected number of returns: >= ".concat((0, _jestMatcherUtils.printExpected)(1), "\n") + "Received number of returns: ".concat((0, _jestMatcherUtils.printReceived)(count)) + (received.mock.calls.length !== count ? "\nReceived number of calls: ".concat((0, _jestMatcherUtils.printReceived)(received.mock.calls.length)) : '');
- };
- return {
- message: message,
- pass: pass
- };
- };
- };
- var createToBeCalledTimesMatcher = function createToBeCalledTimesMatcher(matcherName) {
- return function (received, expected) {
- var expectedArgument = 'expected';
- var options = {
- isNot: this.isNot,
- promise: this.promise
- };
- (0, _jestMatcherUtils.ensureExpectedIsNumber)(expected, matcherName, options);
- ensureMockOrSpy(received, matcherName, expectedArgument, options);
- var receivedIsSpy = isSpy(received);
- var receivedName = receivedIsSpy ? 'spy' : received.getMockName();
- var count = receivedIsSpy ? received.calls.count() : received.mock.calls.length;
- var pass = count === expected;
- var message = pass ? function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + "\n\n" + "Expected number of calls: not ".concat((0, _jestMatcherUtils.printExpected)(expected));
- } : function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "Expected number of calls: ".concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + "Received number of calls: ".concat((0, _jestMatcherUtils.printReceived)(count));
- };
- return {
- message: message,
- pass: pass
- };
- };
- };
- var createToReturnTimesMatcher = function createToReturnTimesMatcher(matcherName) {
- return function (received, expected) {
- var expectedArgument = 'expected';
- var options = {
- isNot: this.isNot,
- promise: this.promise
- };
- (0, _jestMatcherUtils.ensureExpectedIsNumber)(expected, matcherName, options);
- ensureMock(received, matcherName, expectedArgument, options);
- var receivedName = received.getMockName(); // Count return values that correspond only to calls that returned
- var count = received.mock.results.reduce(function (n, result) {
- return result.type === 'return' ? n + 1 : n;
- }, 0);
- var pass = count === expected;
- var message = pass ? function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + "\n\n" + "Expected number of returns: not ".concat((0, _jestMatcherUtils.printExpected)(expected)) + (received.mock.calls.length !== count ? "\n\nReceived number of calls: ".concat((0, _jestMatcherUtils.printReceived)(received.mock.calls.length)) : '');
- } : function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "Expected number of returns: ".concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + "Received number of returns: ".concat((0, _jestMatcherUtils.printReceived)(count)) + (received.mock.calls.length !== count ? "\nReceived number of calls: ".concat((0, _jestMatcherUtils.printReceived)(received.mock.calls.length)) : '');
- };
- return {
- message: message,
- pass: pass
- };
- };
- };
- var createToBeCalledWithMatcher = function createToBeCalledWithMatcher(matcherName) {
- return function (received) {
- var _this = this;
- for (var _len = arguments.length, expected = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
- expected[_key - 1] = arguments[_key];
- }
- var expectedArgument = '...expected';
- var options = {
- isNot: this.isNot,
- promise: this.promise
- };
- ensureMockOrSpy(received, matcherName, expectedArgument, options);
- var receivedIsSpy = isSpy(received);
- var receivedName = receivedIsSpy ? 'spy' : received.getMockName();
- var calls = receivedIsSpy ? received.calls.all().map(function (x) {
- return x.args;
- }) : received.mock.calls;
- var pass = calls.some(function (call) {
- return isEqualCall(expected, call);
- });
- var message = pass ? function () {
- // Some examples of calls that are equal to expected value.
- var indexedCalls = [];
- var i = 0;
- while (i < calls.length && indexedCalls.length < PRINT_LIMIT) {
- if (isEqualCall(expected, calls[i])) {
- indexedCalls.push([i, calls[i]]);
- }
- i += 1;
- }
- return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "Expected: not ".concat(printExpectedArgs(expected), "\n") + (calls.length === 1 && (0, _jestMatcherUtils.stringify)(calls[0]) === (0, _jestMatcherUtils.stringify)(expected) ? '' : printReceivedCallsNegative(expected, indexedCalls, calls.length === 1)) + "\nNumber of calls: ".concat((0, _jestMatcherUtils.printReceived)(calls.length));
- } : function () {
- // Some examples of calls that are not equal to expected value.
- var indexedCalls = [];
- var i = 0;
- while (i < calls.length && indexedCalls.length < PRINT_LIMIT) {
- indexedCalls.push([i, calls[i]]);
- i += 1;
- }
- return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + printExpectedReceivedCallsPositive(expected, indexedCalls, isExpand(_this.expand), calls.length === 1) + "\nNumber of calls: ".concat((0, _jestMatcherUtils.printReceived)(calls.length));
- };
- return {
- message: message,
- pass: pass
- };
- };
- };
- var createToReturnWithMatcher = function createToReturnWithMatcher(matcherName) {
- return function (received, expected) {
- var expectedArgument = 'expected';
- var options = {
- isNot: this.isNot,
- promise: this.promise
- };
- ensureMock(received, matcherName, expectedArgument, options);
- var receivedName = received.getMockName();
- var _received$mock = received.mock,
- calls = _received$mock.calls,
- results = _received$mock.results;
- var pass = results.some(function (result) {
- return isEqualReturn(expected, result);
- });
- var message = pass ? function () {
- // Some examples of results that are equal to expected value.
- var indexedResults = [];
- var i = 0;
- while (i < results.length && indexedResults.length < PRINT_LIMIT) {
- if (isEqualReturn(expected, results[i])) {
- indexedResults.push([i, results[i]]);
- }
- i += 1;
- }
- return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "Expected: not ".concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + (results.length === 1 && results[0].type === 'return' && (0, _jestMatcherUtils.stringify)(results[0].value) === (0, _jestMatcherUtils.stringify)(expected) ? '' : printReceivedResults('Received: ', expected, indexedResults, results.length === 1)) + printNumberOfReturns(countReturns(results), calls.length);
- } : function () {
- // Some examples of results that are not equal to expected value.
- var indexedResults = [];
- var i = 0;
- while (i < results.length && indexedResults.length < PRINT_LIMIT) {
- indexedResults.push([i, results[i]]);
- i += 1;
- }
- return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "Expected: ".concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + printReceivedResults('Received: ', expected, indexedResults, results.length === 1) + printNumberOfReturns(countReturns(results), calls.length);
- };
- return {
- message: message,
- pass: pass
- };
- };
- };
- var createLastCalledWithMatcher = function createLastCalledWithMatcher(matcherName) {
- return function (received) {
- var _this2 = this;
- for (var _len2 = arguments.length, expected = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
- expected[_key2 - 1] = arguments[_key2];
- }
- var expectedArgument = '...expected';
- var options = {
- isNot: this.isNot,
- promise: this.promise
- };
- ensureMockOrSpy(received, matcherName, expectedArgument, options);
- var receivedIsSpy = isSpy(received);
- var receivedName = receivedIsSpy ? 'spy' : received.getMockName();
- var calls = receivedIsSpy ? received.calls.all().map(function (x) {
- return x.args;
- }) : received.mock.calls;
- var iLast = calls.length - 1;
- var pass = iLast >= 0 && isEqualCall(expected, calls[iLast]);
- var message = pass ? function () {
- var indexedCalls = [];
- if (iLast > 0) {
- // Display preceding call as context.
- indexedCalls.push([iLast - 1, calls[iLast - 1]]);
- }
- indexedCalls.push([iLast, calls[iLast]]);
- return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "Expected: not ".concat(printExpectedArgs(expected), "\n") + (calls.length === 1 && (0, _jestMatcherUtils.stringify)(calls[0]) === (0, _jestMatcherUtils.stringify)(expected) ? '' : printReceivedCallsNegative(expected, indexedCalls, calls.length === 1, iLast)) + "\nNumber of calls: ".concat((0, _jestMatcherUtils.printReceived)(calls.length));
- } : function () {
- var indexedCalls = [];
- if (iLast >= 0) {
- if (iLast > 0) {
- var i = iLast - 1; // Is there a preceding call that is equal to expected args?
- while (i >= 0 && !isEqualCall(expected, calls[i])) {
- i -= 1;
- }
- if (i < 0) {
- i = iLast - 1; // otherwise, preceding call
- }
- indexedCalls.push([i, calls[i]]);
- }
- indexedCalls.push([iLast, calls[iLast]]);
- }
- return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + printExpectedReceivedCallsPositive(expected, indexedCalls, isExpand(_this2.expand), calls.length === 1, iLast) + "\nNumber of calls: ".concat((0, _jestMatcherUtils.printReceived)(calls.length));
- };
- return {
- message: message,
- pass: pass
- };
- };
- };
- var createLastReturnedMatcher = function createLastReturnedMatcher(matcherName) {
- return function (received, expected) {
- var expectedArgument = 'expected';
- var options = {
- isNot: this.isNot,
- promise: this.promise
- };
- ensureMock(received, matcherName, expectedArgument, options);
- var receivedName = received.getMockName();
- var _received$mock2 = received.mock,
- calls = _received$mock2.calls,
- results = _received$mock2.results;
- var iLast = results.length - 1;
- var pass = iLast >= 0 && isEqualReturn(expected, results[iLast]);
- var message = pass ? function () {
- var indexedResults = [];
- if (iLast > 0) {
- // Display preceding result as context.
- indexedResults.push([iLast - 1, results[iLast - 1]]);
- }
- indexedResults.push([iLast, results[iLast]]);
- return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "Expected: not ".concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + (results.length === 1 && results[0].type === 'return' && (0, _jestMatcherUtils.stringify)(results[0].value) === (0, _jestMatcherUtils.stringify)(expected) ? '' : printReceivedResults('Received: ', expected, indexedResults, results.length === 1, iLast)) + printNumberOfReturns(countReturns(results), calls.length);
- } : function () {
- var indexedResults = [];
- if (iLast >= 0) {
- if (iLast > 0) {
- var i = iLast - 1; // Is there a preceding result that is equal to expected value?
- while (i >= 0 && !isEqualReturn(expected, results[i])) {
- i -= 1;
- }
- if (i < 0) {
- i = iLast - 1; // otherwise, preceding result
- }
- indexedResults.push([i, results[i]]);
- }
- indexedResults.push([iLast, results[iLast]]);
- }
- return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "Expected: ".concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + printReceivedResults('Received: ', expected, indexedResults, results.length === 1, iLast) + printNumberOfReturns(countReturns(results), calls.length);
- };
- return {
- message: message,
- pass: pass
- };
- };
- };
- var createNthCalledWithMatcher = function createNthCalledWithMatcher(matcherName) {
- return function (received, nth) {
- var _this3 = this;
- for (var _len3 = arguments.length, expected = new Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) {
- expected[_key3 - 2] = arguments[_key3];
- }
- var expectedArgument = 'n';
- var options = {
- expectedColor: function expectedColor(arg) {
- return arg;
- },
- isNot: this.isNot,
- promise: this.promise,
- secondArgument: '...expected'
- };
- ensureMockOrSpy(received, matcherName, expectedArgument, options);
- if (!Number.isSafeInteger(nth) || nth < 1) {
- throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, expectedArgument, options), "".concat(expectedArgument, " must be a positive integer"), (0, _jestMatcherUtils.printWithType)(expectedArgument, nth, _jestMatcherUtils.stringify)));
- }
- var receivedIsSpy = isSpy(received);
- var receivedName = receivedIsSpy ? 'spy' : received.getMockName();
- var calls = receivedIsSpy ? received.calls.all().map(function (x) {
- return x.args;
- }) : received.mock.calls;
- var length = calls.length;
- var iNth = nth - 1;
- var pass = iNth < length && isEqualCall(expected, calls[iNth]);
- var message = pass ? function () {
- // Display preceding and following calls,
- var indexedCalls = [];
- if (iNth - 1 >= 0) {
- indexedCalls.push([iNth - 1, calls[iNth - 1]]);
- }
- indexedCalls.push([iNth, calls[iNth]]);
- if (iNth + 1 < length) {
- indexedCalls.push([iNth + 1, calls[iNth + 1]]);
- }
- return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "n: ".concat(nth, "\n") + "Expected: not ".concat(printExpectedArgs(expected), "\n") + (calls.length === 1 && (0, _jestMatcherUtils.stringify)(calls[0]) === (0, _jestMatcherUtils.stringify)(expected) ? '' : printReceivedCallsNegative(expected, indexedCalls, calls.length === 1, iNth)) + "\nNumber of calls: ".concat((0, _jestMatcherUtils.printReceived)(calls.length));
- } : function () {
- // Display preceding and following calls:
- // * nearest call that is equal to expected args
- // * otherwise, adjacent call
- var indexedCalls = [];
- if (iNth < length) {
- if (iNth - 1 >= 0) {
- var i = iNth - 1; // Is there a preceding call that is equal to expected args?
- while (i >= 0 && !isEqualCall(expected, calls[i])) {
- i -= 1;
- }
- if (i < 0) {
- i = iNth - 1; // otherwise, adjacent call
- }
- indexedCalls.push([i, calls[i]]);
- }
- indexedCalls.push([iNth, calls[iNth]]);
- if (iNth + 1 < length) {
- var _i2 = iNth + 1; // Is there a following call that is equal to expected args?
- while (_i2 < length && !isEqualCall(expected, calls[_i2])) {
- _i2 += 1;
- }
- if (_i2 >= length) {
- _i2 = iNth + 1; // otherwise, adjacent call
- }
- indexedCalls.push([_i2, calls[_i2]]);
- }
- } else if (length > 0) {
- // The number of received calls is fewer than the expected number.
- var _i3 = length - 1; // Is there a call that is equal to expected args?
- while (_i3 >= 0 && !isEqualCall(expected, calls[_i3])) {
- _i3 -= 1;
- }
- if (_i3 < 0) {
- _i3 = length - 1; // otherwise, last call
- }
- indexedCalls.push([_i3, calls[_i3]]);
- }
- return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "n: ".concat(nth, "\n") + printExpectedReceivedCallsPositive(expected, indexedCalls, isExpand(_this3.expand), calls.length === 1, iNth) + "\nNumber of calls: ".concat((0, _jestMatcherUtils.printReceived)(calls.length));
- };
- return {
- message: message,
- pass: pass
- };
- };
- };
- var createNthReturnedWithMatcher = function createNthReturnedWithMatcher(matcherName) {
- return function (received, nth, expected) {
- var expectedArgument = 'n';
- var options = {
- expectedColor: function expectedColor(arg) {
- return arg;
- },
- isNot: this.isNot,
- promise: this.promise,
- secondArgument: 'expected'
- };
- ensureMock(received, matcherName, expectedArgument, options);
- if (!Number.isSafeInteger(nth) || nth < 1) {
- throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, expectedArgument, options), "".concat(expectedArgument, " must be a positive integer"), (0, _jestMatcherUtils.printWithType)(expectedArgument, nth, _jestMatcherUtils.stringify)));
- }
- var receivedName = received.getMockName();
- var _received$mock3 = received.mock,
- calls = _received$mock3.calls,
- results = _received$mock3.results;
- var length = results.length;
- var iNth = nth - 1;
- var pass = iNth < length && isEqualReturn(expected, results[iNth]);
- var message = pass ? function () {
- // Display preceding and following results,
- var indexedResults = [];
- if (iNth - 1 >= 0) {
- indexedResults.push([iNth - 1, results[iNth - 1]]);
- }
- indexedResults.push([iNth, results[iNth]]);
- if (iNth + 1 < length) {
- indexedResults.push([iNth + 1, results[iNth + 1]]);
- }
- return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "n: ".concat(nth, "\n") + "Expected: not ".concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + (results.length === 1 && results[0].type === 'return' && (0, _jestMatcherUtils.stringify)(results[0].value) === (0, _jestMatcherUtils.stringify)(expected) ? '' : printReceivedResults('Received: ', expected, indexedResults, results.length === 1, iNth)) + printNumberOfReturns(countReturns(results), calls.length);
- } : function () {
- // Display preceding and following results:
- // * nearest result that is equal to expected value
- // * otherwise, adjacent result
- var indexedResults = [];
- if (iNth < length) {
- if (iNth - 1 >= 0) {
- var i = iNth - 1; // Is there a preceding result that is equal to expected value?
- while (i >= 0 && !isEqualReturn(expected, results[i])) {
- i -= 1;
- }
- if (i < 0) {
- i = iNth - 1; // otherwise, adjacent result
- }
- indexedResults.push([i, results[i]]);
- }
- indexedResults.push([iNth, results[iNth]]);
- if (iNth + 1 < length) {
- var _i4 = iNth + 1; // Is there a following result that is equal to expected value?
- while (_i4 < length && !isEqualReturn(expected, results[_i4])) {
- _i4 += 1;
- }
- if (_i4 >= length) {
- _i4 = iNth + 1; // otherwise, adjacent result
- }
- indexedResults.push([_i4, results[_i4]]);
- }
- } else if (length > 0) {
- // The number of received calls is fewer than the expected number.
- var _i5 = length - 1; // Is there a result that is equal to expected value?
- while (_i5 >= 0 && !isEqualReturn(expected, results[_i5])) {
- _i5 -= 1;
- }
- if (_i5 < 0) {
- _i5 = length - 1; // otherwise, last result
- }
- indexedResults.push([_i5, results[_i5]]);
- }
- return (0, _jestMatcherUtils.matcherHint)(matcherName, receivedName, expectedArgument, options) + '\n\n' + "n: ".concat(nth, "\n") + "Expected: ".concat((0, _jestMatcherUtils.printExpected)(expected), "\n") + printReceivedResults('Received: ', expected, indexedResults, results.length === 1, iNth) + printNumberOfReturns(countReturns(results), calls.length);
- };
- return {
- message: message,
- pass: pass
- };
- };
- };
- var spyMatchers = {
- lastCalledWith: createLastCalledWithMatcher('lastCalledWith'),
- lastReturnedWith: createLastReturnedMatcher('lastReturnedWith'),
- nthCalledWith: createNthCalledWithMatcher('nthCalledWith'),
- nthReturnedWith: createNthReturnedWithMatcher('nthReturnedWith'),
- toBeCalled: createToBeCalledMatcher('toBeCalled'),
- toBeCalledTimes: createToBeCalledTimesMatcher('toBeCalledTimes'),
- toBeCalledWith: createToBeCalledWithMatcher('toBeCalledWith'),
- toHaveBeenCalled: createToBeCalledMatcher('toHaveBeenCalled'),
- toHaveBeenCalledTimes: createToBeCalledTimesMatcher('toHaveBeenCalledTimes'),
- toHaveBeenCalledWith: createToBeCalledWithMatcher('toHaveBeenCalledWith'),
- toHaveBeenLastCalledWith: createLastCalledWithMatcher('toHaveBeenLastCalledWith'),
- toHaveBeenNthCalledWith: createNthCalledWithMatcher('toHaveBeenNthCalledWith'),
- toHaveLastReturnedWith: createLastReturnedMatcher('toHaveLastReturnedWith'),
- toHaveNthReturnedWith: createNthReturnedWithMatcher('toHaveNthReturnedWith'),
- toHaveReturned: createToReturnMatcher('toHaveReturned'),
- toHaveReturnedTimes: createToReturnTimesMatcher('toHaveReturnedTimes'),
- toHaveReturnedWith: createToReturnWithMatcher('toHaveReturnedWith'),
- toReturn: createToReturnMatcher('toReturn'),
- toReturnTimes: createToReturnTimesMatcher('toReturnTimes'),
- toReturnWith: createToReturnWithMatcher('toReturnWith')
- };
- var isMock = function isMock(received) {
- return received != null && received._isMockFunction === true;
- };
- var isSpy = function isSpy(received) {
- return received != null && received.calls != null && typeof received.calls.all === 'function' && typeof received.calls.count === 'function';
- };
- var ensureMockOrSpy = function ensureMockOrSpy(received, matcherName, expectedArgument, options) {
- if (!isMock(received) && !isSpy(received)) {
- throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, expectedArgument, options), "".concat((0, _jestMatcherUtils.RECEIVED_COLOR)('received'), " value must be a mock or spy function"), (0, _jestMatcherUtils.printWithType)('Received', received, _jestMatcherUtils.printReceived)));
- }
- };
- var ensureMock = function ensureMock(received, matcherName, expectedArgument, options) {
- if (!isMock(received)) {
- throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, expectedArgument, options), "".concat((0, _jestMatcherUtils.RECEIVED_COLOR)('received'), " value must be a mock function"), (0, _jestMatcherUtils.printWithType)('Received', received, _jestMatcherUtils.printReceived)));
- }
- };
- var _default = spyMatchers;
- exports.default = _default;
- /***/ }),
- /***/ "./packages/expect/src/toThrowMatchers.ts":
- /*!************************************************!*\
- !*** ./packages/expect/src/toThrowMatchers.ts ***!
- \************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(process) {
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = exports.createMatcher = void 0;
- var _jestMessageUtil = __webpack_require__(/*! jest-message-util */ "./packages/jest-message-util/build/index.js");
- var _jestMatcherUtils = __webpack_require__(/*! jest-matcher-utils */ "./packages/jest-matcher-utils/build/index.js");
- var _print = __webpack_require__(/*! ./print */ "./packages/expect/src/print.ts");
- var _utils = __webpack_require__(/*! ./utils */ "./packages/expect/src/utils.ts");
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- var DID_NOT_THROW = 'Received function did not throw';
- var getThrown = function getThrown(e) {
- var hasMessage = e !== null && e !== undefined && typeof e.message === 'string';
- if (hasMessage && typeof e.name === 'string' && typeof e.stack === 'string') {
- return {
- hasMessage: hasMessage,
- isError: true,
- message: e.message,
- value: e
- };
- }
- return {
- hasMessage: hasMessage,
- isError: false,
- message: hasMessage ? e.message : String(e),
- value: e
- };
- };
- var createMatcher = function createMatcher(matcherName, fromPromise) {
- return function (received, expected) {
- var options = {
- isNot: this.isNot,
- promise: this.promise
- };
- var thrown = null;
- if (fromPromise && (0, _utils.isError)(received)) {
- thrown = getThrown(received);
- } else {
- if (typeof received !== 'function') {
- if (!fromPromise) {
- var placeholder = expected === undefined ? '' : 'expected';
- throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, placeholder, options), "".concat((0, _jestMatcherUtils.RECEIVED_COLOR)('received'), " value must be a function"), (0, _jestMatcherUtils.printWithType)('Received', received, _jestMatcherUtils.printReceived)));
- }
- } else {
- try {
- received();
- } catch (e) {
- thrown = getThrown(e);
- }
- }
- }
- if (expected === undefined) {
- return toThrow(matcherName, options, thrown);
- } else if (typeof expected === 'function') {
- return toThrowExpectedClass(matcherName, options, thrown, expected);
- } else if (typeof expected === 'string') {
- return toThrowExpectedString(matcherName, options, thrown, expected);
- } else if (expected !== null && typeof expected.test === 'function') {
- return toThrowExpectedRegExp(matcherName, options, thrown, expected);
- } else if (expected !== null && typeof expected.asymmetricMatch === 'function') {
- return toThrowExpectedAsymmetric(matcherName, options, thrown, expected);
- } else if (expected !== null && _typeof(expected) === 'object') {
- return toThrowExpectedObject(matcherName, options, thrown, expected);
- } else {
- throw new Error((0, _jestMatcherUtils.matcherErrorMessage)((0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options), "".concat((0, _jestMatcherUtils.EXPECTED_COLOR)('expected'), " value must be a string or regular expression or class or error"), (0, _jestMatcherUtils.printWithType)('Expected', expected, _jestMatcherUtils.printExpected)));
- }
- };
- };
- exports.createMatcher = createMatcher;
- var matchers = {
- toThrow: createMatcher('toThrow'),
- toThrowError: createMatcher('toThrowError')
- };
- var toThrowExpectedRegExp = function toThrowExpectedRegExp(matcherName, options, thrown, expected) {
- var pass = thrown !== null && expected.test(thrown.message);
- var message = pass ? function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + formatExpected('Expected pattern: not ', expected) + (thrown !== null && thrown.hasMessage ? formatReceived('Received message: ', thrown, 'message', expected) + formatStack(thrown) : formatReceived('Received value: ', thrown, 'value'));
- } : function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + formatExpected('Expected pattern: ', expected) + (thrown === null ? '\n' + DID_NOT_THROW : thrown.hasMessage ? formatReceived('Received message: ', thrown, 'message') + formatStack(thrown) : formatReceived('Received value: ', thrown, 'value'));
- };
- return {
- message: message,
- pass: pass
- };
- };
- var toThrowExpectedAsymmetric = function toThrowExpectedAsymmetric(matcherName, options, thrown, expected) {
- var pass = thrown !== null && expected.asymmetricMatch(thrown.value);
- var message = pass ? function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + formatExpected('Expected asymmetric matcher: not ', expected) + '\n' + (thrown !== null && thrown.hasMessage ? formatReceived('Received name: ', thrown, 'name') + formatReceived('Received message: ', thrown, 'message') + formatStack(thrown) : formatReceived('Thrown value: ', thrown, 'value'));
- } : function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + formatExpected('Expected asymmetric matcher: ', expected) + '\n' + (thrown === null ? DID_NOT_THROW : thrown.hasMessage ? formatReceived('Received name: ', thrown, 'name') + formatReceived('Received message: ', thrown, 'message') + formatStack(thrown) : formatReceived('Thrown value: ', thrown, 'value'));
- };
- return {
- message: message,
- pass: pass
- };
- };
- var toThrowExpectedObject = function toThrowExpectedObject(matcherName, options, thrown, expected) {
- var pass = thrown !== null && thrown.message === expected.message;
- var message = pass ? function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + formatExpected('Expected message: not ', expected.message) + (thrown !== null && thrown.hasMessage ? formatStack(thrown) : formatReceived('Received value: ', thrown, 'value'));
- } : function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + (thrown === null ? formatExpected('Expected message: ', expected.message) + '\n' + DID_NOT_THROW : thrown.hasMessage ? (0, _jestMatcherUtils.printDiffOrStringify)(expected.message, thrown.message, 'Expected message', 'Received message', true) + '\n' + formatStack(thrown) : formatExpected('Expected message: ', expected.message) + formatReceived('Received value: ', thrown, 'value'));
- };
- return {
- message: message,
- pass: pass
- };
- };
- var toThrowExpectedClass = function toThrowExpectedClass(matcherName, options, thrown, expected) {
- var pass = thrown !== null && thrown.value instanceof expected;
- var message = pass ? function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + (0, _print.printExpectedConstructorNameNot)('Expected constructor', expected) + (thrown !== null && thrown.value != null && typeof thrown.value.constructor === 'function' && thrown.value.constructor !== expected ? (0, _print.printReceivedConstructorNameNot)('Received constructor', thrown.value.constructor, expected) : '') + '\n' + (thrown !== null && thrown.hasMessage ? formatReceived('Received message: ', thrown, 'message') + formatStack(thrown) : formatReceived('Received value: ', thrown, 'value'));
- } : function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + (0, _print.printExpectedConstructorName)('Expected constructor', expected) + (thrown === null ? '\n' + DID_NOT_THROW : (thrown.value != null && typeof thrown.value.constructor === 'function' ? (0, _print.printReceivedConstructorName)('Received constructor', thrown.value.constructor) : '') + '\n' + (thrown.hasMessage ? formatReceived('Received message: ', thrown, 'message') + formatStack(thrown) : formatReceived('Received value: ', thrown, 'value')));
- };
- return {
- message: message,
- pass: pass
- };
- };
- var toThrowExpectedString = function toThrowExpectedString(matcherName, options, thrown, expected) {
- var pass = thrown !== null && thrown.message.includes(expected);
- var message = pass ? function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + formatExpected('Expected substring: not ', expected) + (thrown !== null && thrown.hasMessage ? formatReceived('Received message: ', thrown, 'message', expected) + formatStack(thrown) : formatReceived('Received value: ', thrown, 'value'));
- } : function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, undefined, options) + '\n\n' + formatExpected('Expected substring: ', expected) + (thrown === null ? '\n' + DID_NOT_THROW : thrown.hasMessage ? formatReceived('Received message: ', thrown, 'message') + formatStack(thrown) : formatReceived('Received value: ', thrown, 'value'));
- };
- return {
- message: message,
- pass: pass
- };
- };
- var toThrow = function toThrow(matcherName, options, thrown) {
- var pass = thrown !== null;
- var message = pass ? function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, '', options) + '\n\n' + (thrown !== null && thrown.hasMessage ? formatReceived('Error name: ', thrown, 'name') + formatReceived('Error message: ', thrown, 'message') + formatStack(thrown) : formatReceived('Thrown value: ', thrown, 'value'));
- } : function () {
- return (0, _jestMatcherUtils.matcherHint)(matcherName, undefined, '', options) + '\n\n' + DID_NOT_THROW;
- };
- return {
- message: message,
- pass: pass
- };
- };
- var formatExpected = function formatExpected(label, expected) {
- return label + (0, _jestMatcherUtils.printExpected)(expected) + '\n';
- };
- var formatReceived = function formatReceived(label, thrown, key, expected) {
- if (thrown === null) {
- return '';
- }
- if (key === 'message') {
- var _message = thrown.message;
- if (typeof expected === 'string') {
- var index = _message.indexOf(expected);
- if (index !== -1) {
- return label + (0, _print.printReceivedStringContainExpectedSubstring)(_message, index, expected.length) + '\n';
- }
- } else if (expected instanceof RegExp) {
- return label + (0, _print.printReceivedStringContainExpectedResult)(_message, typeof expected.exec === 'function' ? expected.exec(_message) : null) + '\n';
- }
- return label + (0, _jestMatcherUtils.printReceived)(_message) + '\n';
- }
- if (key === 'name') {
- return thrown.isError ? label + (0, _jestMatcherUtils.printReceived)(thrown.value.name) + '\n' : '';
- }
- if (key === 'value') {
- return thrown.isError ? '' : label + (0, _jestMatcherUtils.printReceived)(thrown.value) + '\n';
- }
- return '';
- };
- var formatStack = function formatStack(thrown) {
- return thrown === null || !thrown.isError ? '' : (0, _jestMessageUtil.formatStackTrace)((0, _jestMessageUtil.separateMessageFromStack)(thrown.value.stack).stack, {
- rootDir: process.cwd(),
- testMatch: []
- }, {
- noStackTrace: false
- });
- };
- var _default = matchers;
- exports.default = _default;
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/process/browser.js */ "./node_modules/process/browser.js")))
- /***/ }),
- /***/ "./packages/expect/src/utils.ts":
- /*!**************************************!*\
- !*** ./packages/expect/src/utils.ts ***!
- \**************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.emptyObject = emptyObject;
- exports.isOneline = exports.isError = exports.partition = exports.sparseArrayEquality = exports.typeEquality = exports.subsetEquality = exports.iterableEquality = exports.getObjectSubset = exports.getPath = exports.hasOwnProperty = void 0;
- var _jestGetType = __webpack_require__(/*! jest-get-type */ "./packages/jest-get-type/build/index.js");
- var _jasmineUtils = __webpack_require__(/*! ./jasmineUtils */ "./packages/expect/src/jasmineUtils.ts");
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
- function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- // Return whether object instance inherits getter from its class.
- var hasGetterFromConstructor = function hasGetterFromConstructor(object, key) {
- var constructor = object.constructor;
- if (constructor === Object) {
- // A literal object has Object as constructor.
- // Therefore, it cannot inherit application-specific getters.
- // Furthermore, Object has __proto__ getter which is not relevant.
- // Array, Boolean, Number, String constructors don’t have any getters.
- return false;
- }
- if (typeof constructor !== 'function') {
- // Object.create(null) constructs object with no constructor nor prototype.
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create#Custom_and_Null_objects
- return false;
- }
- var descriptor = Object.getOwnPropertyDescriptor(constructor.prototype, key);
- return descriptor !== undefined && typeof descriptor.get === 'function';
- };
- var hasOwnProperty = function hasOwnProperty(object, key) {
- return Object.prototype.hasOwnProperty.call(object, key) || hasGetterFromConstructor(object, key);
- };
- exports.hasOwnProperty = hasOwnProperty;
- var getPath = function getPath(object, propertyPath) {
- if (!Array.isArray(propertyPath)) {
- propertyPath = propertyPath.split('.');
- }
- if (propertyPath.length) {
- var lastProp = propertyPath.length === 1;
- var prop = propertyPath[0];
- var newObject = object[prop];
- if (!lastProp && (newObject === null || newObject === undefined)) {
- // This is not the last prop in the chain. If we keep recursing it will
- // hit a `can't access property X of undefined | null`. At this point we
- // know that the chain has broken and we can return right away.
- return {
- hasEndProp: false,
- lastTraversedObject: object,
- traversedPath: []
- };
- }
- var result = getPath(newObject, propertyPath.slice(1));
- if (result.lastTraversedObject === null) {
- result.lastTraversedObject = object;
- }
- result.traversedPath.unshift(prop);
- if (lastProp) {
- // Does object have the property with an undefined value?
- // Although primitive values support bracket notation (above)
- // they would throw TypeError for in operator (below).
- result.hasEndProp = newObject !== undefined || !(0, _jestGetType.isPrimitive)(object) && prop in object;
- if (!result.hasEndProp) {
- result.traversedPath.shift();
- }
- }
- return result;
- }
- return {
- lastTraversedObject: null,
- traversedPath: [],
- value: object
- };
- }; // Strip properties from object that are not present in the subset. Useful for
- // printing the diff for toMatchObject() without adding unrelated noise.
- exports.getPath = getPath;
- var getObjectSubset = function getObjectSubset(object, subset) {
- var seenReferences = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new WeakMap();
- if (Array.isArray(object)) {
- if (Array.isArray(subset) && subset.length === object.length) {
- return subset.map(function (sub, i) {
- return getObjectSubset(object[i], sub);
- });
- }
- } else if (object instanceof Date) {
- return object;
- } else if (isObject(object) && isObject(subset)) {
- var trimmed = {};
- seenReferences.set(object, trimmed);
- Object.keys(object).filter(function (key) {
- return hasOwnProperty(subset, key);
- }).forEach(function (key) {
- trimmed[key] = seenReferences.has(object[key]) ? seenReferences.get(object[key]) : getObjectSubset(object[key], subset[key], seenReferences);
- });
- if (Object.keys(trimmed).length > 0) {
- return trimmed;
- }
- }
- return object;
- };
- exports.getObjectSubset = getObjectSubset;
- var IteratorSymbol = Symbol.iterator;
- var hasIterator = function hasIterator(object) {
- return !!(object != null && object[IteratorSymbol]);
- };
- var iterableEquality = function iterableEquality(a, b) {
- var aStack = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
- var bStack = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
- if (_typeof(a) !== 'object' || _typeof(b) !== 'object' || Array.isArray(a) || Array.isArray(b) || !hasIterator(a) || !hasIterator(b)) {
- return undefined;
- }
- if (a.constructor !== b.constructor) {
- return false;
- }
- var length = aStack.length;
- while (length--) {
- // Linear search. Performance is inversely proportional to the number of
- // unique nested structures.
- // circular references at same depth are equal
- // circular reference is not equal to non-circular one
- if (aStack[length] === a) {
- return bStack[length] === b;
- }
- }
- aStack.push(a);
- bStack.push(b);
- var iterableEqualityWithStack = function iterableEqualityWithStack(a, b) {
- return iterableEquality(a, b, _toConsumableArray(aStack), _toConsumableArray(bStack));
- };
- if (a.size !== undefined) {
- if (a.size !== b.size) {
- return false;
- } else if ((0, _jasmineUtils.isA)('Set', a) || (0, _jasmineUtils.isImmutableUnorderedSet)(a)) {
- var allFound = true;
- var _iteratorNormalCompletion = true;
- var _didIteratorError = false;
- var _iteratorError = undefined;
- try {
- for (var _iterator = a[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
- var aValue = _step.value;
- if (!b.has(aValue)) {
- var has = false;
- var _iteratorNormalCompletion2 = true;
- var _didIteratorError2 = false;
- var _iteratorError2 = undefined;
- try {
- for (var _iterator2 = b[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
- var bValue = _step2.value;
- var isEqual = (0, _jasmineUtils.equals)(aValue, bValue, [iterableEqualityWithStack]);
- if (isEqual === true) {
- has = true;
- }
- }
- } catch (err) {
- _didIteratorError2 = true;
- _iteratorError2 = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
- _iterator2.return();
- }
- } finally {
- if (_didIteratorError2) {
- throw _iteratorError2;
- }
- }
- }
- if (has === false) {
- allFound = false;
- break;
- }
- }
- } // Remove the first value from the stack of traversed values.
- } catch (err) {
- _didIteratorError = true;
- _iteratorError = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion && _iterator.return != null) {
- _iterator.return();
- }
- } finally {
- if (_didIteratorError) {
- throw _iteratorError;
- }
- }
- }
- aStack.pop();
- bStack.pop();
- return allFound;
- } else if ((0, _jasmineUtils.isA)('Map', a) || (0, _jasmineUtils.isImmutableUnorderedKeyed)(a)) {
- var _allFound = true;
- var _iteratorNormalCompletion3 = true;
- var _didIteratorError3 = false;
- var _iteratorError3 = undefined;
- try {
- for (var _iterator3 = a[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
- var aEntry = _step3.value;
- if (!b.has(aEntry[0]) || !(0, _jasmineUtils.equals)(aEntry[1], b.get(aEntry[0]), [iterableEqualityWithStack])) {
- var _has = false;
- var _iteratorNormalCompletion4 = true;
- var _didIteratorError4 = false;
- var _iteratorError4 = undefined;
- try {
- for (var _iterator4 = b[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
- var bEntry = _step4.value;
- var matchedKey = (0, _jasmineUtils.equals)(aEntry[0], bEntry[0], [iterableEqualityWithStack]);
- var matchedValue = false;
- if (matchedKey === true) {
- matchedValue = (0, _jasmineUtils.equals)(aEntry[1], bEntry[1], [iterableEqualityWithStack]);
- }
- if (matchedValue === true) {
- _has = true;
- }
- }
- } catch (err) {
- _didIteratorError4 = true;
- _iteratorError4 = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
- _iterator4.return();
- }
- } finally {
- if (_didIteratorError4) {
- throw _iteratorError4;
- }
- }
- }
- if (_has === false) {
- _allFound = false;
- break;
- }
- }
- } // Remove the first value from the stack of traversed values.
- } catch (err) {
- _didIteratorError3 = true;
- _iteratorError3 = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
- _iterator3.return();
- }
- } finally {
- if (_didIteratorError3) {
- throw _iteratorError3;
- }
- }
- }
- aStack.pop();
- bStack.pop();
- return _allFound;
- }
- }
- var bIterator = b[IteratorSymbol]();
- var _iteratorNormalCompletion5 = true;
- var _didIteratorError5 = false;
- var _iteratorError5 = undefined;
- try {
- for (var _iterator5 = a[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
- var _aValue = _step5.value;
- var nextB = bIterator.next();
- if (nextB.done || !(0, _jasmineUtils.equals)(_aValue, nextB.value, [iterableEqualityWithStack])) {
- return false;
- }
- }
- } catch (err) {
- _didIteratorError5 = true;
- _iteratorError5 = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
- _iterator5.return();
- }
- } finally {
- if (_didIteratorError5) {
- throw _iteratorError5;
- }
- }
- }
- if (!bIterator.next().done) {
- return false;
- } // Remove the first value from the stack of traversed values.
- aStack.pop();
- bStack.pop();
- return true;
- };
- exports.iterableEquality = iterableEquality;
- var isObject = function isObject(a) {
- return a !== null && _typeof(a) === 'object';
- };
- var isObjectWithKeys = function isObjectWithKeys(a) {
- return isObject(a) && !(a instanceof Error) && !(a instanceof Array) && !(a instanceof Date);
- };
- var subsetEquality = function subsetEquality(object, subset) {
- // subsetEquality needs to keep track of the references
- // it has already visited to avoid infinite loops in case
- // there are circular references in the subset passed to it.
- var subsetEqualityWithContext = function subsetEqualityWithContext() {
- var seenReferences = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new WeakMap();
- return function (object, subset) {
- if (!isObjectWithKeys(subset)) {
- return undefined;
- }
- return Object.keys(subset).every(function (key) {
- if (isObjectWithKeys(subset[key])) {
- if (seenReferences.get(subset[key])) {
- return (0, _jasmineUtils.equals)(object[key], subset[key], [iterableEquality]);
- }
- seenReferences.set(subset[key], true);
- }
- return object != null && hasOwnProperty(object, key) && (0, _jasmineUtils.equals)(object[key], subset[key], [iterableEquality, subsetEqualityWithContext(seenReferences)]);
- });
- };
- };
- return subsetEqualityWithContext()(object, subset);
- };
- exports.subsetEquality = subsetEquality;
- var typeEquality = function typeEquality(a, b) {
- if (a == null || b == null || a.constructor === b.constructor) {
- return undefined;
- }
- return false;
- };
- exports.typeEquality = typeEquality;
- var sparseArrayEquality = function sparseArrayEquality(a, b) {
- if (!Array.isArray(a) || !Array.isArray(b)) {
- return undefined;
- } // A sparse array [, , 1] will have keys ["2"] whereas [undefined, undefined, 1] will have keys ["0", "1", "2"]
- var aKeys = Object.keys(a);
- var bKeys = Object.keys(b);
- return (0, _jasmineUtils.equals)(a, b, [iterableEquality, typeEquality], true) && (0, _jasmineUtils.equals)(aKeys, bKeys);
- };
- exports.sparseArrayEquality = sparseArrayEquality;
- var partition = function partition(items, predicate) {
- var result = [[], []];
- items.forEach(function (item) {
- return result[predicate(item) ? 0 : 1].push(item);
- });
- return result;
- }; // Copied from https://github.com/graingert/angular.js/blob/a43574052e9775cbc1d7dd8a086752c979b0f020/src/Angular.js#L685-L693
- exports.partition = partition;
- var isError = function isError(value) {
- switch (Object.prototype.toString.call(value)) {
- case '[object Error]':
- return true;
- case '[object Exception]':
- return true;
- case '[object DOMException]':
- return true;
- default:
- return value instanceof Error;
- }
- };
- exports.isError = isError;
- function emptyObject(obj) {
- return obj && _typeof(obj) === 'object' ? !Object.keys(obj).length : false;
- }
- var MULTILINE_REGEXP = /[\r\n]/;
- var isOneline = function isOneline(expected, received) {
- return typeof expected === 'string' && typeof received === 'string' && (!MULTILINE_REGEXP.test(expected) || !MULTILINE_REGEXP.test(received));
- };
- exports.isOneline = isOneline;
- /***/ }),
- /***/ "./packages/jest-diff/build/cleanupSemantic.js":
- /*!*****************************************************!*\
- !*** ./packages/jest-diff/build/cleanupSemantic.js ***!
- \*****************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.cleanupSemantic = exports.DIFF_INSERT = exports.DIFF_DELETE = exports.DIFF_EQUAL = exports.Diff = void 0;
- function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- /**
- * Diff Match and Patch
- * Copyright 2018 The diff-match-patch Authors.
- * https://github.com/google/diff-match-patch
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- /**
- * @fileoverview Computes the difference between two texts to create a patch.
- * Applies the patch onto another text, allowing for errors.
- * @author fraser@google.com (Neil Fraser)
- */
- /**
- * CHANGES by pedrottimark to diff_match_patch_uncompressed.ts file:
- *
- * 1. Delete anything not needed to use diff_cleanupSemantic method
- * 2. Convert from prototype properties to var declarations
- * 3. Convert Diff to class from constructor and prototype
- * 4. Add type annotations for arguments and return values
- * 5. Add exports
- */
- /**
- * The data structure representing a diff is an array of tuples:
- * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]
- * which means: delete 'Hello', add 'Goodbye' and keep ' world.'
- */
- var DIFF_DELETE = -1;
- exports.DIFF_DELETE = DIFF_DELETE;
- var DIFF_INSERT = 1;
- exports.DIFF_INSERT = DIFF_INSERT;
- var DIFF_EQUAL = 0;
- /**
- * Class representing one diff tuple.
- * Attempts to look like a two-element array (which is what this used to be).
- * @param {number} op Operation, one of: DIFF_DELETE, DIFF_INSERT, DIFF_EQUAL.
- * @param {string} text Text to be deleted, inserted, or retained.
- * @constructor
- */
- exports.DIFF_EQUAL = DIFF_EQUAL;
- var Diff = function Diff(op, text) {
- _classCallCheck(this, Diff);
- _defineProperty(this, 0, void 0);
- _defineProperty(this, 1, void 0);
- this[0] = op;
- this[1] = text;
- };
- /**
- * Determine the common prefix of two strings.
- * @param {string} text1 First string.
- * @param {string} text2 Second string.
- * @return {number} The number of characters common to the start of each
- * string.
- */
- exports.Diff = Diff;
- var diff_commonPrefix = function diff_commonPrefix(text1, text2) {
- // Quick check for common null cases.
- if (!text1 || !text2 || text1.charAt(0) != text2.charAt(0)) {
- return 0;
- } // Binary search.
- // Performance analysis: https://neil.fraser.name/news/2007/10/09/
- var pointermin = 0;
- var pointermax = Math.min(text1.length, text2.length);
- var pointermid = pointermax;
- var pointerstart = 0;
- while (pointermin < pointermid) {
- if (text1.substring(pointerstart, pointermid) == text2.substring(pointerstart, pointermid)) {
- pointermin = pointermid;
- pointerstart = pointermin;
- } else {
- pointermax = pointermid;
- }
- pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
- }
- return pointermid;
- };
- /**
- * Determine the common suffix of two strings.
- * @param {string} text1 First string.
- * @param {string} text2 Second string.
- * @return {number} The number of characters common to the end of each string.
- */
- var diff_commonSuffix = function diff_commonSuffix(text1, text2) {
- // Quick check for common null cases.
- if (!text1 || !text2 || text1.charAt(text1.length - 1) != text2.charAt(text2.length - 1)) {
- return 0;
- } // Binary search.
- // Performance analysis: https://neil.fraser.name/news/2007/10/09/
- var pointermin = 0;
- var pointermax = Math.min(text1.length, text2.length);
- var pointermid = pointermax;
- var pointerend = 0;
- while (pointermin < pointermid) {
- if (text1.substring(text1.length - pointermid, text1.length - pointerend) == text2.substring(text2.length - pointermid, text2.length - pointerend)) {
- pointermin = pointermid;
- pointerend = pointermin;
- } else {
- pointermax = pointermid;
- }
- pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
- }
- return pointermid;
- };
- /**
- * Determine if the suffix of one string is the prefix of another.
- * @param {string} text1 First string.
- * @param {string} text2 Second string.
- * @return {number} The number of characters common to the end of the first
- * string and the start of the second string.
- * @private
- */
- var diff_commonOverlap_ = function diff_commonOverlap_(text1, text2) {
- // Cache the text lengths to prevent multiple calls.
- var text1_length = text1.length;
- var text2_length = text2.length; // Eliminate the null case.
- if (text1_length == 0 || text2_length == 0) {
- return 0;
- } // Truncate the longer string.
- if (text1_length > text2_length) {
- text1 = text1.substring(text1_length - text2_length);
- } else if (text1_length < text2_length) {
- text2 = text2.substring(0, text1_length);
- }
- var text_length = Math.min(text1_length, text2_length); // Quick check for the worst case.
- if (text1 == text2) {
- return text_length;
- } // Start by looking for a single character match
- // and increase length until no match is found.
- // Performance analysis: https://neil.fraser.name/news/2010/11/04/
- var best = 0;
- var length = 1;
- while (true) {
- var pattern = text1.substring(text_length - length);
- var found = text2.indexOf(pattern);
- if (found == -1) {
- return best;
- }
- length += found;
- if (found == 0 || text1.substring(text_length - length) == text2.substring(0, length)) {
- best = length;
- length++;
- }
- }
- };
- /**
- * Reduce the number of edits by eliminating semantically trivial equalities.
- * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
- */
- var diff_cleanupSemantic = function diff_cleanupSemantic(diffs) {
- var changes = false;
- var equalities = []; // Stack of indices where equalities are found.
- var equalitiesLength = 0; // Keeping our own length var is faster in JS.
- /** @type {?string} */
- var lastEquality = null; // Always equal to diffs[equalities[equalitiesLength - 1]][1]
- var pointer = 0; // Index of current position.
- // Number of characters that changed prior to the equality.
- var length_insertions1 = 0;
- var length_deletions1 = 0; // Number of characters that changed after the equality.
- var length_insertions2 = 0;
- var length_deletions2 = 0;
- while (pointer < diffs.length) {
- if (diffs[pointer][0] == DIFF_EQUAL) {
- // Equality found.
- equalities[equalitiesLength++] = pointer;
- length_insertions1 = length_insertions2;
- length_deletions1 = length_deletions2;
- length_insertions2 = 0;
- length_deletions2 = 0;
- lastEquality = diffs[pointer][1];
- } else {
- // An insertion or deletion.
- if (diffs[pointer][0] == DIFF_INSERT) {
- length_insertions2 += diffs[pointer][1].length;
- } else {
- length_deletions2 += diffs[pointer][1].length;
- } // Eliminate an equality that is smaller or equal to the edits on both
- // sides of it.
- if (lastEquality && lastEquality.length <= Math.max(length_insertions1, length_deletions1) && lastEquality.length <= Math.max(length_insertions2, length_deletions2)) {
- // Duplicate record.
- diffs.splice(equalities[equalitiesLength - 1], 0, new Diff(DIFF_DELETE, lastEquality)); // Change second copy to insert.
- diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT; // Throw away the equality we just deleted.
- equalitiesLength--; // Throw away the previous equality (it needs to be reevaluated).
- equalitiesLength--;
- pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1;
- length_insertions1 = 0; // Reset the counters.
- length_deletions1 = 0;
- length_insertions2 = 0;
- length_deletions2 = 0;
- lastEquality = null;
- changes = true;
- }
- }
- pointer++;
- } // Normalize the diff.
- if (changes) {
- diff_cleanupMerge(diffs);
- }
- diff_cleanupSemanticLossless(diffs); // Find any overlaps between deletions and insertions.
- // e.g: <del>abcxxx</del><ins>xxxdef</ins>
- // -> <del>abc</del>xxx<ins>def</ins>
- // e.g: <del>xxxabc</del><ins>defxxx</ins>
- // -> <ins>def</ins>xxx<del>abc</del>
- // Only extract an overlap if it is as big as the edit ahead or behind it.
- pointer = 1;
- while (pointer < diffs.length) {
- if (diffs[pointer - 1][0] == DIFF_DELETE && diffs[pointer][0] == DIFF_INSERT) {
- var deletion = diffs[pointer - 1][1];
- var insertion = diffs[pointer][1];
- var overlap_length1 = diff_commonOverlap_(deletion, insertion);
- var overlap_length2 = diff_commonOverlap_(insertion, deletion);
- if (overlap_length1 >= overlap_length2) {
- if (overlap_length1 >= deletion.length / 2 || overlap_length1 >= insertion.length / 2) {
- // Overlap found. Insert an equality and trim the surrounding edits.
- diffs.splice(pointer, 0, new Diff(DIFF_EQUAL, insertion.substring(0, overlap_length1)));
- diffs[pointer - 1][1] = deletion.substring(0, deletion.length - overlap_length1);
- diffs[pointer + 1][1] = insertion.substring(overlap_length1);
- pointer++;
- }
- } else {
- if (overlap_length2 >= deletion.length / 2 || overlap_length2 >= insertion.length / 2) {
- // Reverse overlap found.
- // Insert an equality and swap and trim the surrounding edits.
- diffs.splice(pointer, 0, new Diff(DIFF_EQUAL, deletion.substring(0, overlap_length2)));
- diffs[pointer - 1][0] = DIFF_INSERT;
- diffs[pointer - 1][1] = insertion.substring(0, insertion.length - overlap_length2);
- diffs[pointer + 1][0] = DIFF_DELETE;
- diffs[pointer + 1][1] = deletion.substring(overlap_length2);
- pointer++;
- }
- }
- pointer++;
- }
- pointer++;
- }
- };
- /**
- * Look for single edits surrounded on both sides by equalities
- * which can be shifted sideways to align the edit to a word boundary.
- * e.g: The c<ins>at c</ins>ame. -> The <ins>cat </ins>came.
- * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
- */
- exports.cleanupSemantic = diff_cleanupSemantic;
- var diff_cleanupSemanticLossless = function diff_cleanupSemanticLossless(diffs) {
- /**
- * Given two strings, compute a score representing whether the internal
- * boundary falls on logical boundaries.
- * Scores range from 6 (best) to 0 (worst).
- * Closure, but does not reference any external variables.
- * @param {string} one First string.
- * @param {string} two Second string.
- * @return {number} The score.
- * @private
- */
- function diff_cleanupSemanticScore_(one, two) {
- if (!one || !two) {
- // Edges are the best.
- return 6;
- } // Each port of this function behaves slightly differently due to
- // subtle differences in each language's definition of things like
- // 'whitespace'. Since this function's purpose is largely cosmetic,
- // the choice has been made to use each language's native features
- // rather than force total conformity.
- var char1 = one.charAt(one.length - 1);
- var char2 = two.charAt(0);
- var nonAlphaNumeric1 = char1.match(nonAlphaNumericRegex_);
- var nonAlphaNumeric2 = char2.match(nonAlphaNumericRegex_);
- var whitespace1 = nonAlphaNumeric1 && char1.match(whitespaceRegex_);
- var whitespace2 = nonAlphaNumeric2 && char2.match(whitespaceRegex_);
- var lineBreak1 = whitespace1 && char1.match(linebreakRegex_);
- var lineBreak2 = whitespace2 && char2.match(linebreakRegex_);
- var blankLine1 = lineBreak1 && one.match(blanklineEndRegex_);
- var blankLine2 = lineBreak2 && two.match(blanklineStartRegex_);
- if (blankLine1 || blankLine2) {
- // Five points for blank lines.
- return 5;
- } else if (lineBreak1 || lineBreak2) {
- // Four points for line breaks.
- return 4;
- } else if (nonAlphaNumeric1 && !whitespace1 && whitespace2) {
- // Three points for end of sentences.
- return 3;
- } else if (whitespace1 || whitespace2) {
- // Two points for whitespace.
- return 2;
- } else if (nonAlphaNumeric1 || nonAlphaNumeric2) {
- // One point for non-alphanumeric.
- return 1;
- }
- return 0;
- }
- var pointer = 1; // Intentionally ignore the first and last element (don't need checking).
- while (pointer < diffs.length - 1) {
- if (diffs[pointer - 1][0] == DIFF_EQUAL && diffs[pointer + 1][0] == DIFF_EQUAL) {
- // This is a single edit surrounded by equalities.
- var equality1 = diffs[pointer - 1][1];
- var edit = diffs[pointer][1];
- var equality2 = diffs[pointer + 1][1]; // First, shift the edit as far left as possible.
- var commonOffset = diff_commonSuffix(equality1, edit);
- if (commonOffset) {
- var commonString = edit.substring(edit.length - commonOffset);
- equality1 = equality1.substring(0, equality1.length - commonOffset);
- edit = commonString + edit.substring(0, edit.length - commonOffset);
- equality2 = commonString + equality2;
- } // Second, step character by character right, looking for the best fit.
- var bestEquality1 = equality1;
- var bestEdit = edit;
- var bestEquality2 = equality2;
- var bestScore = diff_cleanupSemanticScore_(equality1, edit) + diff_cleanupSemanticScore_(edit, equality2);
- while (edit.charAt(0) === equality2.charAt(0)) {
- equality1 += edit.charAt(0);
- edit = edit.substring(1) + equality2.charAt(0);
- equality2 = equality2.substring(1);
- var score = diff_cleanupSemanticScore_(equality1, edit) + diff_cleanupSemanticScore_(edit, equality2); // The >= encourages trailing rather than leading whitespace on edits.
- if (score >= bestScore) {
- bestScore = score;
- bestEquality1 = equality1;
- bestEdit = edit;
- bestEquality2 = equality2;
- }
- }
- if (diffs[pointer - 1][1] != bestEquality1) {
- // We have an improvement, save it back to the diff.
- if (bestEquality1) {
- diffs[pointer - 1][1] = bestEquality1;
- } else {
- diffs.splice(pointer - 1, 1);
- pointer--;
- }
- diffs[pointer][1] = bestEdit;
- if (bestEquality2) {
- diffs[pointer + 1][1] = bestEquality2;
- } else {
- diffs.splice(pointer + 1, 1);
- pointer--;
- }
- }
- }
- pointer++;
- }
- }; // Define some regex patterns for matching boundaries.
- var nonAlphaNumericRegex_ = /[^a-zA-Z0-9]/;
- var whitespaceRegex_ = /\s/;
- var linebreakRegex_ = /[\r\n]/;
- var blanklineEndRegex_ = /\n\r?\n$/;
- var blanklineStartRegex_ = /^\r?\n\r?\n/;
- /**
- * Reorder and merge like edit sections. Merge equalities.
- * Any edit section can move as long as it doesn't cross an equality.
- * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.
- */
- var diff_cleanupMerge = function diff_cleanupMerge(diffs) {
- // Add a dummy entry at the end.
- diffs.push(new Diff(DIFF_EQUAL, ''));
- var pointer = 0;
- var count_delete = 0;
- var count_insert = 0;
- var text_delete = '';
- var text_insert = '';
- var commonlength;
- while (pointer < diffs.length) {
- switch (diffs[pointer][0]) {
- case DIFF_INSERT:
- count_insert++;
- text_insert += diffs[pointer][1];
- pointer++;
- break;
- case DIFF_DELETE:
- count_delete++;
- text_delete += diffs[pointer][1];
- pointer++;
- break;
- case DIFF_EQUAL:
- // Upon reaching an equality, check for prior redundancies.
- if (count_delete + count_insert > 1) {
- if (count_delete !== 0 && count_insert !== 0) {
- // Factor out any common prefixies.
- commonlength = diff_commonPrefix(text_insert, text_delete);
- if (commonlength !== 0) {
- if (pointer - count_delete - count_insert > 0 && diffs[pointer - count_delete - count_insert - 1][0] == DIFF_EQUAL) {
- diffs[pointer - count_delete - count_insert - 1][1] += text_insert.substring(0, commonlength);
- } else {
- diffs.splice(0, 0, new Diff(DIFF_EQUAL, text_insert.substring(0, commonlength)));
- pointer++;
- }
- text_insert = text_insert.substring(commonlength);
- text_delete = text_delete.substring(commonlength);
- } // Factor out any common suffixies.
- commonlength = diff_commonSuffix(text_insert, text_delete);
- if (commonlength !== 0) {
- diffs[pointer][1] = text_insert.substring(text_insert.length - commonlength) + diffs[pointer][1];
- text_insert = text_insert.substring(0, text_insert.length - commonlength);
- text_delete = text_delete.substring(0, text_delete.length - commonlength);
- }
- } // Delete the offending records and add the merged ones.
- pointer -= count_delete + count_insert;
- diffs.splice(pointer, count_delete + count_insert);
- if (text_delete.length) {
- diffs.splice(pointer, 0, new Diff(DIFF_DELETE, text_delete));
- pointer++;
- }
- if (text_insert.length) {
- diffs.splice(pointer, 0, new Diff(DIFF_INSERT, text_insert));
- pointer++;
- }
- pointer++;
- } else if (pointer !== 0 && diffs[pointer - 1][0] == DIFF_EQUAL) {
- // Merge this equality with the previous one.
- diffs[pointer - 1][1] += diffs[pointer][1];
- diffs.splice(pointer, 1);
- } else {
- pointer++;
- }
- count_insert = 0;
- count_delete = 0;
- text_delete = '';
- text_insert = '';
- break;
- }
- }
- if (diffs[diffs.length - 1][1] === '') {
- diffs.pop(); // Remove the dummy entry at the end.
- } // Second pass: look for single edits surrounded on both sides by equalities
- // which can be shifted sideways to eliminate an equality.
- // e.g: A<ins>BA</ins>C -> <ins>AB</ins>AC
- var changes = false;
- pointer = 1; // Intentionally ignore the first and last element (don't need checking).
- while (pointer < diffs.length - 1) {
- if (diffs[pointer - 1][0] == DIFF_EQUAL && diffs[pointer + 1][0] == DIFF_EQUAL) {
- // This is a single edit surrounded by equalities.
- if (diffs[pointer][1].substring(diffs[pointer][1].length - diffs[pointer - 1][1].length) == diffs[pointer - 1][1]) {
- // Shift the edit over the previous equality.
- diffs[pointer][1] = diffs[pointer - 1][1] + diffs[pointer][1].substring(0, diffs[pointer][1].length - diffs[pointer - 1][1].length);
- diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];
- diffs.splice(pointer - 1, 1);
- changes = true;
- } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) == diffs[pointer + 1][1]) {
- // Shift the edit over the next equality.
- diffs[pointer - 1][1] += diffs[pointer + 1][1];
- diffs[pointer][1] = diffs[pointer][1].substring(diffs[pointer + 1][1].length) + diffs[pointer + 1][1];
- diffs.splice(pointer + 1, 1);
- changes = true;
- }
- }
- pointer++;
- } // If shifts were made, the diff needs reordering and another shift sweep.
- if (changes) {
- diff_cleanupMerge(diffs);
- }
- };
- /***/ }),
- /***/ "./packages/jest-diff/build/constants.js":
- /*!***********************************************!*\
- !*** ./packages/jest-diff/build/constants.js ***!
- \***********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.SIMILAR_MESSAGE = exports.NO_DIFF_MESSAGE = void 0;
- var _chalk = _interopRequireDefault(__webpack_require__(/*! chalk */ "./packages/expect/build/fakeChalk.js"));
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
- }
- /**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
- var NO_DIFF_MESSAGE = _chalk.default.dim('Compared values have no visual difference.');
- exports.NO_DIFF_MESSAGE = NO_DIFF_MESSAGE;
- var SIMILAR_MESSAGE = _chalk.default.dim('Compared values serialize to the same structure.\n' + 'Printing internal object structure without calling `toJSON` instead.');
- exports.SIMILAR_MESSAGE = SIMILAR_MESSAGE;
- /***/ }),
- /***/ "./packages/jest-diff/build/diffLines.js":
- /*!***********************************************!*\
- !*** ./packages/jest-diff/build/diffLines.js ***!
- \***********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.default = void 0;
- var _chalk = _interopRequireDefault(__webpack_require__(/*! chalk */ "./packages/expect/build/fakeChalk.js"));
- var _diffSequences = _interopRequireDefault(__webpack_require__(/*! diff-sequences */ "./packages/diff-sequences/build/index.js"));
- var _constants = __webpack_require__(/*! ./constants */ "./packages/jest-diff/build/constants.js");
- var _printDiffs = __webpack_require__(/*! ./printDiffs */ "./packages/jest-diff/build/printDiffs.js");
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
- }
- /**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
- var DIFF_CONTEXT_DEFAULT = 5;
- var fgDelete = _chalk.default.green;
- var fgInsert = _chalk.default.red;
- var fgCommon = _chalk.default.dim; // common lines (even indentation same)
- var fgIndent = _chalk.default.cyan; // common lines (only indentation different)
- var bgCommon = _chalk.default.bgYellow; // edge spaces in common line (even indentation same)
- var bgInverse = _chalk.default.inverse; // edge spaces in any other lines
- // ONLY trailing if expected value is snapshot or multiline string.
- var highlightTrailingSpaces = function highlightTrailingSpaces(line, bgColor) {
- return line.replace(/\s+$/, bgColor('$&'));
- }; // BOTH leading AND trailing if expected value is data structure.
- var highlightLeadingTrailingSpaces = function highlightLeadingTrailingSpaces(line, bgColor // If line consists of ALL spaces: highlight all of them.
- ) {
- return highlightTrailingSpaces(line, bgColor).replace( // If line has an ODD length of leading spaces: highlight only the LAST.
- /^(\s\s)*(\s)(?=[^\s])/, '$1' + bgColor('$2'));
- };
- var getHighlightSpaces = function getHighlightSpaces(bothEdges) {
- return bothEdges ? highlightLeadingTrailingSpaces : highlightTrailingSpaces;
- }; // Given index interval in expected lines, put formatted delete lines.
- var formatDelete = function formatDelete(aStart, aEnd, aLinesUn, aLinesIn, put) {
- var highlightSpaces = getHighlightSpaces(aLinesUn !== aLinesIn);
- for (var aIndex = aStart; aIndex !== aEnd; aIndex += 1) {
- var aLineUn = aLinesUn[aIndex];
- var aLineIn = aLinesIn[aIndex];
- var indentation = aLineIn.slice(0, aLineIn.length - aLineUn.length);
- put(fgDelete('- ' + indentation + highlightSpaces(aLineUn, bgInverse)));
- }
- }; // Given index interval in received lines, put formatted insert lines.
- var formatInsert = function formatInsert(bStart, bEnd, bLinesUn, bLinesIn, put) {
- var highlightSpaces = getHighlightSpaces(bLinesUn !== bLinesIn);
- for (var bIndex = bStart; bIndex !== bEnd; bIndex += 1) {
- var bLineUn = bLinesUn[bIndex];
- var bLineIn = bLinesIn[bIndex];
- var indentation = bLineIn.slice(0, bLineIn.length - bLineUn.length);
- put(fgInsert('+ ' + indentation + highlightSpaces(bLineUn, bgInverse)));
- }
- }; // Given the number of items and starting indexes of a common subsequence,
- // put formatted common lines.
- var formatCommon = function formatCommon(nCommon, aCommon, bCommon, aLinesIn, bLinesUn, bLinesIn, put) {
- var highlightSpaces = getHighlightSpaces(bLinesUn !== bLinesIn);
- for (; nCommon !== 0; nCommon -= 1, aCommon += 1, bCommon += 1) {
- var bLineUn = bLinesUn[bCommon];
- var bLineIn = bLinesIn[bCommon];
- var bLineInLength = bLineIn.length; // For common lines, received indentation seems more intuitive.
- var indentation = bLineIn.slice(0, bLineInLength - bLineUn.length); // Color shows whether expected and received line has same indentation.
- var hasSameIndentation = aLinesIn[aCommon].length === bLineInLength;
- var fg = hasSameIndentation ? fgCommon : fgIndent;
- var bg = hasSameIndentation ? bgCommon : bgInverse;
- put(fg(' ' + indentation + highlightSpaces(bLineUn, bg)));
- }
- }; // jest --expand
- // Return formatted diff as joined string of all lines.
- var diffExpand = function diffExpand(aLinesUn, bLinesUn, aLinesIn, bLinesIn) {
- var isCommon = function isCommon(aIndex, bIndex) {
- return aLinesUn[aIndex] === bLinesUn[bIndex];
- };
- var array = [];
- var put = function put(line) {
- array.push(line);
- };
- var aStart = 0;
- var bStart = 0;
- var foundSubsequence = function foundSubsequence(nCommon, aCommon, bCommon) {
- formatDelete(aStart, aCommon, aLinesUn, aLinesIn, put);
- formatInsert(bStart, bCommon, bLinesUn, bLinesIn, put);
- formatCommon(nCommon, aCommon, bCommon, aLinesIn, bLinesUn, bLinesIn, put);
- aStart = aCommon + nCommon;
- bStart = bCommon + nCommon;
- };
- var aLength = aLinesUn.length;
- var bLength = bLinesUn.length;
- (0, _diffSequences.default)(aLength, bLength, isCommon, foundSubsequence); // After the last common subsequence, format remaining change lines.
- formatDelete(aStart, aLength, aLinesUn, aLinesIn, put);
- formatInsert(bStart, bLength, bLinesUn, bLinesIn, put);
- return array.join('\n');
- };
- var getContextLines = function getContextLines(options) {
- return options && typeof options.contextLines === 'number' && options.contextLines >= 0 ? options.contextLines : DIFF_CONTEXT_DEFAULT;
- }; // jest --no-expand
- // Return joined string of formatted diff for all change lines,
- // but if some common lines are omitted because there are more than the context,
- // then a “patch mark” precedes each set of adjacent changed and common lines.
- var diffNoExpand = function diffNoExpand(aLinesUn, bLinesUn, aLinesIn, bLinesIn, nContextLines) {
- var isCommon = function isCommon(aIndex, bIndex) {
- return aLinesUn[aIndex] === bLinesUn[bIndex];
- };
- var iPatchMark = 0; // index of placeholder line for patch mark
- var array = [''];
- var put = function put(line) {
- array.push(line);
- };
- var isAtEnd = false;
- var aLength = aLinesUn.length;
- var bLength = bLinesUn.length;
- var nContextLines2 = nContextLines + nContextLines; // Initialize the first patch for changes at the start,
- // especially for edge case in which there is no common subsequence.
- var aStart = 0;
- var aEnd = 0;
- var bStart = 0;
- var bEnd = 0; // Given the number of items and starting indexes of each common subsequence,
- // format any preceding change lines, and then common context lines.
- var foundSubsequence = function foundSubsequence(nCommon, aStartCommon, bStartCommon) {
- var aEndCommon = aStartCommon + nCommon;
- var bEndCommon = bStartCommon + nCommon;
- isAtEnd = aEndCommon === aLength && bEndCommon === bLength; // If common subsequence is at start, re-initialize the first patch.
- if (aStartCommon === 0 && bStartCommon === 0) {
- var nLines = nContextLines < nCommon ? nContextLines : nCommon;
- aStart = aEndCommon - nLines;
- bStart = bEndCommon - nLines;
- formatCommon(nLines, aStart, bStart, aLinesIn, bLinesUn, bLinesIn, put);
- aEnd = aEndCommon;
- bEnd = bEndCommon;
- return;
- } // Format preceding change lines.
- formatDelete(aEnd, aStartCommon, aLinesUn, aLinesIn, put);
- formatInsert(bEnd, bStartCommon, bLinesUn, bLinesIn, put);
- aEnd = aStartCommon;
- bEnd = bStartCommon; // If common subsequence is at end, then context follows preceding changes;
- // else context follows preceding changes AND precedes following changes.
- var maxContextLines = isAtEnd ? nContextLines : nContextLines2;
- if (nCommon <= maxContextLines) {
- // The patch includes all lines in the common subsequence.
- formatCommon(nCommon, aEnd, bEnd, aLinesIn, bLinesUn, bLinesIn, put);
- aEnd += nCommon;
- bEnd += nCommon;
- return;
- } // The patch ends because context is less than number of common lines.
- formatCommon(nContextLines, aEnd, bEnd, aLinesIn, bLinesUn, bLinesIn, put);
- aEnd += nContextLines;
- bEnd += nContextLines;
- array[iPatchMark] = (0, _printDiffs.createPatchMark)(aStart, aEnd, bStart, bEnd); // If common subsequence is not at end, another patch follows it.
- if (!isAtEnd) {
- iPatchMark = array.length; // index of placeholder line
- array[iPatchMark] = '';
- var _nLines = nContextLines < nCommon ? nContextLines : nCommon;
- aStart = aEndCommon - _nLines;
- bStart = bEndCommon - _nLines;
- formatCommon(_nLines, aStart, bStart, aLinesIn, bLinesUn, bLinesIn, put);
- aEnd = aEndCommon;
- bEnd = bEndCommon;
- }
- };
- (0, _diffSequences.default)(aLength, bLength, isCommon, foundSubsequence); // If no common subsequence or last was not at end, format remaining change lines.
- if (!isAtEnd) {
- formatDelete(aEnd, aLength, aLinesUn, aLinesIn, put);
- formatInsert(bEnd, bLength, bLinesUn, bLinesIn, put);
- aEnd = aLength;
- bEnd = bLength;
- }
- if (aStart === 0 && aEnd === aLength && bStart === 0 && bEnd === bLength) {
- array.splice(0, 1); // delete placeholder line for patch mark
- } else {
- array[iPatchMark] = (0, _printDiffs.createPatchMark)(aStart, aEnd, bStart, bEnd);
- }
- return array.join('\n');
- };
- var _default = function _default(a, b, options, original) {
- if (a === b) {
- return _constants.NO_DIFF_MESSAGE;
- }
- var aLinesUn = a.split('\n');
- var bLinesUn = b.split('\n'); // Indentation is unknown if expected value is snapshot or multiline string.
- var aLinesIn = aLinesUn;
- var bLinesIn = bLinesUn;
- if (original) {
- // Indentation is known if expected value is data structure:
- // Compare lines without indentation and format lines with indentation.
- aLinesIn = original.a.split('\n');
- bLinesIn = original.b.split('\n');
- if (aLinesUn.length !== aLinesIn.length || bLinesUn.length !== bLinesIn.length) {
- // Fall back if unindented and indented lines are inconsistent.
- aLinesUn = aLinesIn;
- bLinesUn = bLinesIn;
- }
- }
- return (0, _printDiffs.printAnnotation)(options) + (options && options.expand === false ? diffNoExpand(aLinesUn, bLinesUn, aLinesIn, bLinesIn, getContextLines(options)) : diffExpand(aLinesUn, bLinesUn, aLinesIn, bLinesIn));
- };
- exports.default = _default;
- /***/ }),
- /***/ "./packages/jest-diff/build/diffStrings.js":
- /*!*************************************************!*\
- !*** ./packages/jest-diff/build/diffStrings.js ***!
- \*************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.default = void 0;
- var _diffSequences = _interopRequireDefault(__webpack_require__(/*! diff-sequences */ "./packages/diff-sequences/build/index.js"));
- var _cleanupSemantic = __webpack_require__(/*! ./cleanupSemantic */ "./packages/jest-diff/build/cleanupSemantic.js");
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
- }
- /**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
- var diffStrings = function diffStrings(a, b) {
- var isCommon = function isCommon(aIndex, bIndex) {
- return a[aIndex] === b[bIndex];
- };
- var aIndex = 0;
- var bIndex = 0;
- var diffs = [];
- var foundSubsequence = function foundSubsequence(nCommon, aCommon, bCommon) {
- if (aIndex !== aCommon) {
- diffs.push(new _cleanupSemantic.Diff(_cleanupSemantic.DIFF_DELETE, a.slice(aIndex, aCommon)));
- }
- if (bIndex !== bCommon) {
- diffs.push(new _cleanupSemantic.Diff(_cleanupSemantic.DIFF_INSERT, b.slice(bIndex, bCommon)));
- }
- aIndex = aCommon + nCommon; // number of characters compared in a
- bIndex = bCommon + nCommon; // number of characters compared in b
- diffs.push(new _cleanupSemantic.Diff(_cleanupSemantic.DIFF_EQUAL, b.slice(bCommon, bIndex)));
- };
- (0, _diffSequences.default)(a.length, b.length, isCommon, foundSubsequence); // After the last common subsequence, push remaining change items.
- if (aIndex !== a.length) {
- diffs.push(new _cleanupSemantic.Diff(_cleanupSemantic.DIFF_DELETE, a.slice(aIndex)));
- }
- if (bIndex !== b.length) {
- diffs.push(new _cleanupSemantic.Diff(_cleanupSemantic.DIFF_INSERT, b.slice(bIndex)));
- }
- return diffs;
- };
- var _default = diffStrings;
- exports.default = _default;
- /***/ }),
- /***/ "./packages/jest-diff/build/getAlignedDiffs.js":
- /*!*****************************************************!*\
- !*** ./packages/jest-diff/build/getAlignedDiffs.js ***!
- \*****************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
- function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.default = void 0;
- var _cleanupSemantic = __webpack_require__(/*! ./cleanupSemantic */ "./packages/jest-diff/build/cleanupSemantic.js");
- var _printDiffs = __webpack_require__(/*! ./printDiffs */ "./packages/jest-diff/build/printDiffs.js");
- function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
- } // Encapsulate change lines until either a common newline or the end.
- var ChangeBuffer =
- /*#__PURE__*/
- function () {
- // incomplete line
- // complete lines
- function ChangeBuffer(op) {
- _classCallCheck(this, ChangeBuffer);
- _defineProperty(this, 'op', void 0);
- _defineProperty(this, 'line', void 0);
- _defineProperty(this, 'lines', void 0);
- this.op = op;
- this.line = [];
- this.lines = [];
- }
- _createClass(ChangeBuffer, [{
- key: "pushSubstring",
- value: function pushSubstring(substring) {
- this.pushDiff(new _cleanupSemantic.Diff(this.op, substring));
- }
- }, {
- key: "pushLine",
- value: function pushLine() {
- // Assume call only if line has at least one diff,
- // therefore an empty line must have a diff which has an empty string.
- this.lines.push(new _cleanupSemantic.Diff(this.op, (0, _printDiffs.getHighlightedString)(this.op, this.line)));
- this.line.length = 0;
- }
- }, {
- key: "isLineEmpty",
- value: function isLineEmpty() {
- return this.line.length === 0;
- } // Minor input to buffer.
- }, {
- key: "pushDiff",
- value: function pushDiff(diff) {
- this.line.push(diff);
- } // Main input to buffer.
- }, {
- key: "align",
- value: function align(diff) {
- var _this = this;
- var string = diff[1];
- if (_printDiffs.MULTILINE_REGEXP.test(string)) {
- var substrings = string.split('\n');
- var iLast = substrings.length - 1;
- substrings.forEach(function (substring, i) {
- if (i < iLast) {
- // The first substring completes the current change line.
- // A middle substring is a change line.
- _this.pushSubstring(substring);
- _this.pushLine();
- } else if (substring.length !== 0) {
- // The last substring starts a change line, if it is not empty.
- // Important: This non-empty condition also automatically omits
- // the newline appended to the end of expected and received strings.
- _this.pushSubstring(substring);
- }
- });
- } else {
- // Append non-multiline string to current change line.
- this.pushDiff(diff);
- }
- } // Output from buffer.
- }, {
- key: "moveLinesTo",
- value: function moveLinesTo(lines) {
- if (!this.isLineEmpty()) {
- this.pushLine();
- }
- lines.push.apply(lines, _toConsumableArray(this.lines));
- this.lines.length = 0;
- }
- }]);
- return ChangeBuffer;
- }(); // Encapsulate common and change lines.
- var CommonBuffer =
- /*#__PURE__*/
- function () {
- function CommonBuffer(deleteBuffer, insertBuffer) {
- _classCallCheck(this, CommonBuffer);
- _defineProperty(this, 'deleteBuffer', void 0);
- _defineProperty(this, 'insertBuffer', void 0);
- _defineProperty(this, 'lines', void 0);
- this.deleteBuffer = deleteBuffer;
- this.insertBuffer = insertBuffer;
- this.lines = [];
- }
- _createClass(CommonBuffer, [{
- key: "pushDiffCommonLine",
- value: function pushDiffCommonLine(diff) {
- this.lines.push(diff);
- }
- }, {
- key: "pushDiffChangeLines",
- value: function pushDiffChangeLines(diff) {
- var isDiffEmpty = diff[1].length === 0; // An empty diff string is redundant, unless a change line is empty.
- if (!isDiffEmpty || this.deleteBuffer.isLineEmpty()) {
- this.deleteBuffer.pushDiff(diff);
- }
- if (!isDiffEmpty || this.insertBuffer.isLineEmpty()) {
- this.insertBuffer.pushDiff(diff);
- }
- }
- }, {
- key: "flushChangeLines",
- value: function flushChangeLines() {
- this.deleteBuffer.moveLinesTo(this.lines);
- this.insertBuffer.moveLinesTo(this.lines);
- } // Input to buffer.
- }, {
- key: "align",
- value: function align(diff) {
- var _this2 = this;
- var op = diff[0];
- var string = diff[1];
- if (_printDiffs.MULTILINE_REGEXP.test(string)) {
- var substrings = string.split('\n');
- var iLast = substrings.length - 1;
- substrings.forEach(function (substring, i) {
- if (i === 0) {
- var subdiff = new _cleanupSemantic.Diff(op, substring);
- if (_this2.deleteBuffer.isLineEmpty() && _this2.insertBuffer.isLineEmpty()) {
- // If both current change lines are empty,
- // then the first substring is a common line.
- _this2.flushChangeLines();
- _this2.pushDiffCommonLine(subdiff);
- } else {
- // If either current change line is non-empty,
- // then the first substring completes the change lines.
- _this2.pushDiffChangeLines(subdiff);
- _this2.flushChangeLines();
- }
- } else if (i < iLast) {
- // A middle substring is a common line.
- _this2.pushDiffCommonLine(new _cleanupSemantic.Diff(op, substring));
- } else if (substring.length !== 0) {
- // The last substring starts a change line, if it is not empty.
- // Important: This non-empty condition also automatically omits
- // the newline appended to the end of expected and received strings.
- _this2.pushDiffChangeLines(new _cleanupSemantic.Diff(op, substring));
- }
- });
- } else {
- // Append non-multiline string to current change lines.
- // Important: It cannot be at the end following empty change lines,
- // because newline appended to the end of expected and received strings.
- this.pushDiffChangeLines(diff);
- }
- } // Output from buffer.
- }, {
- key: "getLines",
- value: function getLines() {
- this.flushChangeLines();
- return this.lines;
- }
- }]);
- return CommonBuffer;
- }(); // Given diffs from expected and received strings,
- // return new array of diffs split or joined into lines.
- //
- // To correctly align a change line at the end, the algorithm:
- // * assumes that a newline was appended to the strings
- // * omits the last newline from the output array
- //
- // Assume the function is not called:
- // * if either expected or received is empty string
- // * if neither expected nor received is multiline string
- var getAlignedDiffs = function getAlignedDiffs(diffs) {
- var deleteBuffer = new ChangeBuffer(_cleanupSemantic.DIFF_DELETE);
- var insertBuffer = new ChangeBuffer(_cleanupSemantic.DIFF_INSERT);
- var commonBuffer = new CommonBuffer(deleteBuffer, insertBuffer);
- diffs.forEach(function (diff) {
- switch (diff[0]) {
- case _cleanupSemantic.DIFF_DELETE:
- deleteBuffer.align(diff);
- break;
- case _cleanupSemantic.DIFF_INSERT:
- insertBuffer.align(diff);
- break;
- default:
- commonBuffer.align(diff);
- }
- });
- return commonBuffer.getLines();
- };
- var _default = getAlignedDiffs;
- exports.default = _default;
- /***/ }),
- /***/ "./packages/jest-diff/build/index.js":
- /*!*******************************************!*\
- !*** ./packages/jest-diff/build/index.js ***!
- \*******************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(global) {
- var _prettyFormat = _interopRequireDefault(__webpack_require__(/*! pretty-format */ "./packages/pretty-format/build/index.js"));
- var _chalk = _interopRequireDefault(__webpack_require__(/*! chalk */ "./packages/expect/build/fakeChalk.js"));
- var _jestGetType = _interopRequireDefault(__webpack_require__(/*! jest-get-type */ "./packages/jest-get-type/build/index.js"));
- var _diffLines = _interopRequireDefault(__webpack_require__(/*! ./diffLines */ "./packages/jest-diff/build/diffLines.js"));
- var _printDiffs = __webpack_require__(/*! ./printDiffs */ "./packages/jest-diff/build/printDiffs.js");
- var _constants = __webpack_require__(/*! ./constants */ "./packages/jest-diff/build/constants.js");
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
- }
- var _Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
- function _objectSpread(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i] != null ? arguments[i] : {};
- var ownKeys = Object.keys(source);
- if (typeof Object.getOwnPropertySymbols === 'function') {
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
- }));
- }
- ownKeys.forEach(function (key) {
- _defineProperty(target, key, source[key]);
- });
- }
- return target;
- }
- function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- var _prettyFormat$plugins = _prettyFormat.default.plugins,
- AsymmetricMatcher = _prettyFormat$plugins.AsymmetricMatcher,
- DOMCollection = _prettyFormat$plugins.DOMCollection,
- DOMElement = _prettyFormat$plugins.DOMElement,
- Immutable = _prettyFormat$plugins.Immutable,
- ReactElement = _prettyFormat$plugins.ReactElement,
- ReactTestComponent = _prettyFormat$plugins.ReactTestComponent;
- var PLUGINS = [ReactTestComponent, ReactElement, DOMElement, DOMCollection, Immutable, AsymmetricMatcher];
- var FORMAT_OPTIONS = {
- plugins: PLUGINS
- };
- var FORMAT_OPTIONS_0 = _objectSpread({}, FORMAT_OPTIONS, {
- indent: 0
- });
- var FALLBACK_FORMAT_OPTIONS = {
- callToJSON: false,
- maxDepth: 10,
- plugins: PLUGINS
- };
- var FALLBACK_FORMAT_OPTIONS_0 = _objectSpread({}, FALLBACK_FORMAT_OPTIONS, {
- indent: 0
- }); // Generate a string that will highlight the difference between two values
- // with green and red. (similar to how github does code diffing)
- function diff(a, b, options) {
- if (Object.is(a, b)) {
- return _constants.NO_DIFF_MESSAGE;
- }
- var aType = (0, _jestGetType.default)(a);
- var expectedType = aType;
- var omitDifference = false;
- if (aType === 'object' && typeof a.asymmetricMatch === 'function') {
- if (a.$$typeof !== _Symbol.for('jest.asymmetricMatcher')) {
- // Do not know expected type of user-defined asymmetric matcher.
- return null;
- }
- if (typeof a.getExpectedType !== 'function') {
- // For example, expect.anything() matches either null or undefined
- return null;
- }
- expectedType = a.getExpectedType(); // Primitive types boolean and number omit difference below.
- // For example, omit difference for expect.stringMatching(regexp)
- omitDifference = expectedType === 'string';
- }
- if (expectedType !== (0, _jestGetType.default)(b)) {
- return ' Comparing two different types of values.' + " Expected ".concat(_chalk.default.green(expectedType), " but ") + "received ".concat(_chalk.default.red((0, _jestGetType.default)(b)), ".");
- }
- if (omitDifference) {
- return null;
- }
- switch (aType) {
- case 'string':
- return (0, _diffLines.default)(a, b, options);
- case 'boolean':
- case 'number':
- return comparePrimitive(a, b, options);
- case 'map':
- return compareObjects(sortMap(a), sortMap(b), options);
- case 'set':
- return compareObjects(sortSet(a), sortSet(b), options);
- default:
- return compareObjects(a, b, options);
- }
- }
- function comparePrimitive(a, b, options) {
- return (0, _diffLines.default)((0, _prettyFormat.default)(a, FORMAT_OPTIONS), (0, _prettyFormat.default)(b, FORMAT_OPTIONS), options);
- }
- function sortMap(map) {
- return new Map(Array.from(map.entries()).sort());
- }
- function sortSet(set) {
- return new Set(Array.from(set.values()).sort());
- }
- function compareObjects(a, b, options) {
- var diffMessage;
- var hasThrown = false;
- try {
- diffMessage = (0, _diffLines.default)((0, _prettyFormat.default)(a, FORMAT_OPTIONS_0), (0, _prettyFormat.default)(b, FORMAT_OPTIONS_0), options, {
- a: (0, _prettyFormat.default)(a, FORMAT_OPTIONS),
- b: (0, _prettyFormat.default)(b, FORMAT_OPTIONS)
- });
- } catch (e) {
- hasThrown = true;
- } // If the comparison yields no results, compare again but this time
- // without calling `toJSON`. It's also possible that toJSON might throw.
- if (!diffMessage || diffMessage === _constants.NO_DIFF_MESSAGE) {
- diffMessage = (0, _diffLines.default)((0, _prettyFormat.default)(a, FALLBACK_FORMAT_OPTIONS_0), (0, _prettyFormat.default)(b, FALLBACK_FORMAT_OPTIONS_0), options, {
- a: (0, _prettyFormat.default)(a, FALLBACK_FORMAT_OPTIONS),
- b: (0, _prettyFormat.default)(b, FALLBACK_FORMAT_OPTIONS)
- });
- if (diffMessage !== _constants.NO_DIFF_MESSAGE && !hasThrown) {
- diffMessage = _constants.SIMILAR_MESSAGE + '\n\n' + diffMessage;
- }
- }
- return diffMessage;
- } // eslint-disable-next-line no-redeclare
- diff.getStringDiff = _printDiffs.getStringDiff;
- module.exports = diff;
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
- /***/ }),
- /***/ "./packages/jest-diff/build/joinAlignedDiffs.js":
- /*!******************************************************!*\
- !*** ./packages/jest-diff/build/joinAlignedDiffs.js ***!
- \******************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.joinAlignedDiffsExpand = exports.joinAlignedDiffsNoExpand = void 0;
- var _cleanupSemantic = __webpack_require__(/*! ./cleanupSemantic */ "./packages/jest-diff/build/cleanupSemantic.js");
- var _printDiffs = __webpack_require__(/*! ./printDiffs */ "./packages/jest-diff/build/printDiffs.js");
- /**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
- var DIFF_CONTEXT_DEFAULT = 5; // same as diffLines
- // jest --no-expand
- //
- // Given array of aligned strings with inverse highlight formatting,
- // return joined lines with diff formatting (and patch marks, if needed).
- var joinAlignedDiffsNoExpand = function joinAlignedDiffsNoExpand(diffs) {
- var nContextLines = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DIFF_CONTEXT_DEFAULT;
- var iLength = diffs.length;
- var nContextLines2 = nContextLines + nContextLines; // First pass: count output lines and see if it has patches.
- var jLength = iLength;
- var hasExcessAtStartOrEnd = false;
- var nExcessesBetweenChanges = 0;
- var i = 0;
- while (i !== iLength) {
- var iStart = i;
- while (i !== iLength && diffs[i][0] === _cleanupSemantic.DIFF_EQUAL) {
- i += 1;
- }
- if (iStart !== i) {
- if (iStart === 0) {
- // at start
- if (i > nContextLines) {
- jLength -= i - nContextLines; // subtract excess common lines
- hasExcessAtStartOrEnd = true;
- }
- } else if (i === iLength) {
- // at end
- var n = i - iStart;
- if (n > nContextLines) {
- jLength -= n - nContextLines; // subtract excess common lines
- hasExcessAtStartOrEnd = true;
- }
- } else {
- // between changes
- var _n = i - iStart;
- if (_n > nContextLines2) {
- jLength -= _n - nContextLines2; // subtract excess common lines
- nExcessesBetweenChanges += 1;
- }
- }
- }
- while (i !== iLength && diffs[i][0] !== _cleanupSemantic.DIFF_EQUAL) {
- i += 1;
- }
- }
- var hasPatch = nExcessesBetweenChanges !== 0 || hasExcessAtStartOrEnd;
- if (nExcessesBetweenChanges !== 0) {
- jLength += nExcessesBetweenChanges + 1; // add patch lines
- } else if (hasExcessAtStartOrEnd) {
- jLength += 1; // add patch line
- }
- var jLast = jLength - 1;
- var lines = [];
- var jPatchMark = 0; // index of placeholder line for current patch mark
- if (hasPatch) {
- lines.push(''); // placeholder line for first patch mark
- } // Indexes of expected or received lines in current patch:
- var aStart = 0;
- var bStart = 0;
- var aEnd = 0;
- var bEnd = 0;
- var pushCommonLine = function pushCommonLine(line) {
- var j = lines.length;
- lines.push((0, _printDiffs.printCommonLine)(line, j === 0 || j === jLast));
- aEnd += 1;
- bEnd += 1;
- };
- var pushDeleteLine = function pushDeleteLine(line) {
- lines.push((0, _printDiffs.printDeleteLine)(line));
- aEnd += 1;
- };
- var pushInsertLine = function pushInsertLine(line) {
- lines.push((0, _printDiffs.printInsertLine)(line));
- bEnd += 1;
- }; // Second pass: push lines with diff formatting (and patch marks, if needed).
- i = 0;
- while (i !== iLength) {
- var _iStart = i;
- while (i !== iLength && diffs[i][0] === _cleanupSemantic.DIFF_EQUAL) {
- i += 1;
- }
- if (_iStart !== i) {
- if (_iStart === 0) {
- // at beginning
- if (i > nContextLines) {
- _iStart = i - nContextLines;
- aStart = _iStart;
- bStart = _iStart;
- aEnd = aStart;
- bEnd = bStart;
- }
- for (var iCommon = _iStart; iCommon !== i; iCommon += 1) {
- pushCommonLine(diffs[iCommon][1]);
- }
- } else if (i === iLength) {
- // at end
- var iEnd = i - _iStart > nContextLines ? _iStart + nContextLines : i;
- for (var _iCommon = _iStart; _iCommon !== iEnd; _iCommon += 1) {
- pushCommonLine(diffs[_iCommon][1]);
- }
- } else {
- // between changes
- var nCommon = i - _iStart;
- if (nCommon > nContextLines2) {
- var _iEnd = _iStart + nContextLines;
- for (var _iCommon2 = _iStart; _iCommon2 !== _iEnd; _iCommon2 += 1) {
- pushCommonLine(diffs[_iCommon2][1]);
- }
- lines[jPatchMark] = (0, _printDiffs.createPatchMark)(aStart, aEnd, bStart, bEnd);
- jPatchMark = lines.length;
- lines.push(''); // placeholder line for next patch mark
- var nOmit = nCommon - nContextLines2;
- aStart = aEnd + nOmit;
- bStart = bEnd + nOmit;
- aEnd = aStart;
- bEnd = bStart;
- for (var _iCommon3 = i - nContextLines; _iCommon3 !== i; _iCommon3 += 1) {
- pushCommonLine(diffs[_iCommon3][1]);
- }
- } else {
- for (var _iCommon4 = _iStart; _iCommon4 !== i; _iCommon4 += 1) {
- pushCommonLine(diffs[_iCommon4][1]);
- }
- }
- }
- }
- while (i !== iLength && diffs[i][0] === _cleanupSemantic.DIFF_DELETE) {
- pushDeleteLine(diffs[i][1]);
- i += 1;
- }
- while (i !== iLength && diffs[i][0] === _cleanupSemantic.DIFF_INSERT) {
- pushInsertLine(diffs[i][1]);
- i += 1;
- }
- }
- if (hasPatch) {
- lines[jPatchMark] = (0, _printDiffs.createPatchMark)(aStart, aEnd, bStart, bEnd);
- }
- return lines.join('\n');
- }; // jest --expand
- //
- // Given array of aligned strings with inverse highlight formatting,
- // return joined lines with diff formatting.
- exports.joinAlignedDiffsNoExpand = joinAlignedDiffsNoExpand;
- var joinAlignedDiffsExpand = function joinAlignedDiffsExpand(diffs) {
- return diffs.map(function (diff, i, diffs) {
- var line = diff[1];
- switch (diff[0]) {
- case _cleanupSemantic.DIFF_DELETE:
- return (0, _printDiffs.printDeleteLine)(line);
- case _cleanupSemantic.DIFF_INSERT:
- return (0, _printDiffs.printInsertLine)(line);
- default:
- return (0, _printDiffs.printCommonLine)(line, i === 0 || i === diffs.length - 1);
- }
- }).join('\n');
- };
- exports.joinAlignedDiffsExpand = joinAlignedDiffsExpand;
- /***/ }),
- /***/ "./packages/jest-diff/build/printDiffs.js":
- /*!************************************************!*\
- !*** ./packages/jest-diff/build/printDiffs.js ***!
- \************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.getStringDiff = exports.printMultilineStringDiffs = exports.createPatchMark = exports.printAnnotation = exports.hasCommonDiff = exports.computeStringDiffs = exports.printCommonLine = exports.printInsertLine = exports.printDeleteLine = exports.MULTILINE_REGEXP = exports.getReceivedString = exports.getExpectedString = exports.getHighlightedString = exports.RECEIVED_COLOR = exports.INVERTED_COLOR = exports.EXPECTED_COLOR = exports.DIM_COLOR = void 0;
- var _chalk = _interopRequireDefault(__webpack_require__(/*! chalk */ "./packages/expect/build/fakeChalk.js"));
- var _cleanupSemantic = __webpack_require__(/*! ./cleanupSemantic */ "./packages/jest-diff/build/cleanupSemantic.js");
- var _diffStrings = _interopRequireDefault(__webpack_require__(/*! ./diffStrings */ "./packages/jest-diff/build/diffStrings.js"));
- var _getAlignedDiffs = _interopRequireDefault(__webpack_require__(/*! ./getAlignedDiffs */ "./packages/jest-diff/build/getAlignedDiffs.js"));
- var _joinAlignedDiffs = __webpack_require__(/*! ./joinAlignedDiffs */ "./packages/jest-diff/build/joinAlignedDiffs.js");
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
- }
- /**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
- var DIM_COLOR = _chalk.default.dim;
- exports.DIM_COLOR = DIM_COLOR;
- var EXPECTED_COLOR = _chalk.default.green;
- exports.EXPECTED_COLOR = EXPECTED_COLOR;
- var INVERTED_COLOR = _chalk.default.inverse;
- exports.INVERTED_COLOR = INVERTED_COLOR;
- var RECEIVED_COLOR = _chalk.default.red;
- exports.RECEIVED_COLOR = RECEIVED_COLOR;
- var PATCH_COLOR = _chalk.default.yellow; // Given change op and array of diffs, return concatenated string:
- // * include common strings
- // * include change strings which have argument op (inverse highlight)
- // * exclude change strings which have opposite op
- var getHighlightedString = function getHighlightedString(op, diffs) {
- return diffs.reduce(function (reduced, diff) {
- return reduced + (diff[0] === _cleanupSemantic.DIFF_EQUAL ? diff[1] : diff[0] === op ? INVERTED_COLOR(diff[1]) : '');
- }, '');
- };
- exports.getHighlightedString = getHighlightedString;
- var getExpectedString = function getExpectedString(diffs) {
- return getHighlightedString(_cleanupSemantic.DIFF_DELETE, diffs);
- };
- exports.getExpectedString = getExpectedString;
- var getReceivedString = function getReceivedString(diffs) {
- return getHighlightedString(_cleanupSemantic.DIFF_INSERT, diffs);
- };
- exports.getReceivedString = getReceivedString;
- var MULTILINE_REGEXP = /\n/;
- exports.MULTILINE_REGEXP = MULTILINE_REGEXP;
- var NEWLINE_SYMBOL = "\u21B5"; // downwards arrow with corner leftwards
- var SPACE_SYMBOL = "\xB7"; // middle dot
- // Instead of inverse highlight which now implies a change,
- // replace common spaces with middle dot at the end of the line.
- var replaceSpacesAtEnd = function replaceSpacesAtEnd(line) {
- return line.replace(/\s+$/, function (spaces) {
- return SPACE_SYMBOL.repeat(spaces.length);
- });
- };
- var printDeleteLine = function printDeleteLine(line) {
- return EXPECTED_COLOR(line.length !== 0 ? '- ' + replaceSpacesAtEnd(line) : '-');
- };
- exports.printDeleteLine = printDeleteLine;
- var printInsertLine = function printInsertLine(line) {
- return RECEIVED_COLOR(line.length !== 0 ? '+ ' + replaceSpacesAtEnd(line) : '+');
- }; // Prevent visually ambiguous empty line as the first or the last.
- exports.printInsertLine = printInsertLine;
- var printCommonLine = function printCommonLine(line) {
- var isFirstOrLast = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
- return line.length !== 0 ? DIM_COLOR(' ' + replaceSpacesAtEnd(line)) : isFirstOrLast ? DIM_COLOR(' ' + NEWLINE_SYMBOL) : '';
- };
- exports.printCommonLine = printCommonLine;
- var computeStringDiffs = function computeStringDiffs(expected, received) {
- var isMultiline = MULTILINE_REGEXP.test(expected) || MULTILINE_REGEXP.test(received); // getAlignedDiffs assumes that a newline was appended to the strings.
- if (isMultiline) {
- expected += '\n';
- received += '\n';
- }
- var diffs = (0, _diffStrings.default)(expected, received);
- (0, _cleanupSemantic.cleanupSemantic)(diffs); // impure function
- return {
- diffs: diffs,
- isMultiline: isMultiline
- };
- };
- exports.computeStringDiffs = computeStringDiffs;
- var hasCommonDiff = function hasCommonDiff(diffs, isMultiline) {
- if (isMultiline) {
- // Important: Ignore common newline that was appended to multiline strings!
- var iLast = diffs.length - 1;
- return diffs.some(function (diff, i) {
- return diff[0] === _cleanupSemantic.DIFF_EQUAL && (i !== iLast || diff[1] !== '\n');
- });
- }
- return diffs.some(function (diff) {
- return diff[0] === _cleanupSemantic.DIFF_EQUAL;
- });
- };
- exports.hasCommonDiff = hasCommonDiff;
- var printAnnotation = function printAnnotation(options) {
- return EXPECTED_COLOR('- ' + (options && options.aAnnotation || 'Expected')) + '\n' + RECEIVED_COLOR('+ ' + (options && options.bAnnotation || 'Received')) + '\n\n';
- }; // In GNU diff format, indexes are one-based instead of zero-based.
- exports.printAnnotation = printAnnotation;
- var createPatchMark = function createPatchMark(aStart, aEnd, bStart, bEnd) {
- return PATCH_COLOR("@@ -".concat(aStart + 1, ",").concat(aEnd - aStart, " +").concat(bStart + 1, ",").concat(bEnd - bStart, " @@"));
- }; // Return formatted diff lines without labels.
- exports.createPatchMark = createPatchMark;
- var printMultilineStringDiffs = function printMultilineStringDiffs(diffs, expand) {
- var lines = (0, _getAlignedDiffs.default)(diffs);
- return expand ? (0, _joinAlignedDiffs.joinAlignedDiffsExpand)(lines) : (0, _joinAlignedDiffs.joinAlignedDiffsNoExpand)(lines);
- };
- exports.printMultilineStringDiffs = printMultilineStringDiffs;
- var MAX_DIFF_STRING_LENGTH = 20000; // Print specific substring diff for strings only:
- // * if strings are not equal
- // * if neither string is empty
- // * if neither string is too long
- // * if there is a common string after semantic cleanup
- var getStringDiff = function getStringDiff(expected, received, options) {
- if (expected === received || expected.length === 0 || received.length === 0 || expected.length > MAX_DIFF_STRING_LENGTH || received.length > MAX_DIFF_STRING_LENGTH) {
- return null;
- }
- var _computeStringDiffs = computeStringDiffs(expected, received),
- diffs = _computeStringDiffs.diffs,
- isMultiline = _computeStringDiffs.isMultiline;
- if (!hasCommonDiff(diffs, isMultiline)) {
- return null;
- }
- return isMultiline ? {
- annotatedDiff: printAnnotation(options) + printMultilineStringDiffs(diffs, options === undefined || options.expand !== false),
- isMultiline: isMultiline
- } : {
- a: getExpectedString(diffs),
- b: getReceivedString(diffs),
- isMultiline: isMultiline
- };
- };
- exports.getStringDiff = getStringDiff;
- /***/ }),
- /***/ "./packages/jest-get-type/build/index.js":
- /*!***********************************************!*\
- !*** ./packages/jest-get-type/build/index.js ***!
- \***********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
- // get the type of a value with handling the edge cases like `typeof []`
- // and `typeof null`
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- function getType(value) {
- if (value === undefined) {
- return 'undefined';
- } else if (value === null) {
- return 'null';
- } else if (Array.isArray(value)) {
- return 'array';
- } else if (typeof value === 'boolean') {
- return 'boolean';
- } else if (typeof value === 'function') {
- return 'function';
- } else if (typeof value === 'number') {
- return 'number';
- } else if (typeof value === 'string') {
- return 'string';
- } else if (_typeof(value) === 'object') {
- if (value != null) {
- if (value.constructor === RegExp) {
- return 'regexp';
- } else if (value.constructor === Map) {
- return 'map';
- } else if (value.constructor === Set) {
- return 'set';
- } else if (value.constructor === Date) {
- return 'date';
- }
- }
- return 'object';
- } else if (_typeof(value) === 'symbol') {
- return 'symbol';
- }
- throw new Error("value of unknown type: ".concat(value));
- }
- getType.isPrimitive = function (value) {
- return Object(value) !== value;
- };
- module.exports = getType;
- /***/ }),
- /***/ "./packages/jest-matcher-utils/build/index.js":
- /*!****************************************************!*\
- !*** ./packages/jest-matcher-utils/build/index.js ***!
- \****************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- Object.defineProperty(exports, 'DiffOptions', {
- enumerable: true,
- get: function get() {
- return _jestDiff.DiffOptions;
- }
- });
- exports.matcherHint = exports.matcherErrorMessage = exports.getLabelPrinter = exports.pluralize = exports.diff = exports.printDiffOrStringify = exports.ensureExpectedIsNonNegativeInteger = exports.ensureNumbers = exports.ensureExpectedIsNumber = exports.ensureActualIsNumber = exports.ensureNoExpected = exports.printWithType = exports.printExpected = exports.printReceived = exports.highlightTrailingWhitespace = exports.stringify = exports.SUGGEST_TO_CONTAIN_EQUAL = exports.DIM_COLOR = exports.BOLD_WEIGHT = exports.INVERTED_COLOR = exports.RECEIVED_COLOR = exports.EXPECTED_COLOR = void 0;
- var _chalk = _interopRequireDefault(__webpack_require__(/*! chalk */ "./packages/expect/build/fakeChalk.js"));
- var _jestDiff = _interopRequireWildcard(__webpack_require__(/*! jest-diff */ "./packages/jest-diff/build/index.js"));
- var _jestGetType = _interopRequireWildcard(__webpack_require__(/*! jest-get-type */ "./packages/jest-get-type/build/index.js"));
- var _prettyFormat = _interopRequireDefault(__webpack_require__(/*! pretty-format */ "./packages/pretty-format/build/index.js"));
- function _interopRequireWildcard(obj) {
- if (obj && obj.__esModule) {
- return obj;
- } else {
- var newObj = {};
- if (obj != null) {
- for (var key in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
- if (desc.get || desc.set) {
- Object.defineProperty(newObj, key, desc);
- } else {
- newObj[key] = obj[key];
- }
- }
- }
- }
- newObj.default = obj;
- return newObj;
- }
- }
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
- }
- /**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
- var _prettyFormat$plugins = _prettyFormat.default.plugins,
- AsymmetricMatcher = _prettyFormat$plugins.AsymmetricMatcher,
- DOMCollection = _prettyFormat$plugins.DOMCollection,
- DOMElement = _prettyFormat$plugins.DOMElement,
- Immutable = _prettyFormat$plugins.Immutable,
- ReactElement = _prettyFormat$plugins.ReactElement,
- ReactTestComponent = _prettyFormat$plugins.ReactTestComponent;
- var PLUGINS = [ReactTestComponent, ReactElement, DOMElement, DOMCollection, Immutable, AsymmetricMatcher];
- var EXPECTED_COLOR = _chalk.default.green;
- exports.EXPECTED_COLOR = EXPECTED_COLOR;
- var RECEIVED_COLOR = _chalk.default.red;
- exports.RECEIVED_COLOR = RECEIVED_COLOR;
- var INVERTED_COLOR = _chalk.default.inverse;
- exports.INVERTED_COLOR = INVERTED_COLOR;
- var BOLD_WEIGHT = _chalk.default.bold;
- exports.BOLD_WEIGHT = BOLD_WEIGHT;
- var DIM_COLOR = _chalk.default.dim;
- exports.DIM_COLOR = DIM_COLOR;
- var MULTILINE_REGEXP = /\n/;
- var SPACE_SYMBOL = "\xB7"; // middle dot
- var NUMBERS = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen'];
- var SUGGEST_TO_CONTAIN_EQUAL = _chalk.default.dim('Looks like you wanted to test for object/array equality with the stricter `toContain` matcher. You probably need to use `toContainEqual` instead.');
- exports.SUGGEST_TO_CONTAIN_EQUAL = SUGGEST_TO_CONTAIN_EQUAL;
- var stringify = function stringify(object) {
- var maxDepth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
- var MAX_LENGTH = 10000;
- var result;
- try {
- result = (0, _prettyFormat.default)(object, {
- maxDepth: maxDepth,
- min: true,
- plugins: PLUGINS
- });
- } catch (e) {
- result = (0, _prettyFormat.default)(object, {
- callToJSON: false,
- maxDepth: maxDepth,
- min: true,
- plugins: PLUGINS
- });
- }
- return result.length >= MAX_LENGTH && maxDepth > 1 ? stringify(object, Math.floor(maxDepth / 2)) : result;
- };
- exports.stringify = stringify;
- var highlightTrailingWhitespace = function highlightTrailingWhitespace(text) {
- return text.replace(/\s+$/gm, _chalk.default.inverse('$&'));
- }; // Instead of inverse highlight which now implies a change,
- // replace common spaces with middle dot at the end of any line.
- exports.highlightTrailingWhitespace = highlightTrailingWhitespace;
- var replaceTrailingSpaces = function replaceTrailingSpaces(text) {
- return text.replace(/\s+$/gm, function (spaces) {
- return SPACE_SYMBOL.repeat(spaces.length);
- });
- };
- var printReceived = function printReceived(object) {
- return RECEIVED_COLOR(replaceTrailingSpaces(stringify(object)));
- };
- exports.printReceived = printReceived;
- var printExpected = function printExpected(value) {
- return EXPECTED_COLOR(replaceTrailingSpaces(stringify(value)));
- };
- exports.printExpected = printExpected;
- var printWithType = function printWithType(name, value, print // printExpected or printReceived
- ) {
- var type = (0, _jestGetType.default)(value);
- var hasType = type !== 'null' && type !== 'undefined' ? "".concat(name, " has type: ").concat(type, "\n") : '';
- var hasValue = "".concat(name, " has value: ").concat(print(value));
- return hasType + hasValue;
- };
- exports.printWithType = printWithType;
- var ensureNoExpected = function ensureNoExpected(expected, matcherName, options) {
- if (typeof expected !== 'undefined') {
- // Prepend maybe not only for backward compatibility.
- var matcherString = (options ? '' : '[.not]') + matcherName;
- throw new Error(matcherErrorMessage(matcherHint(matcherString, undefined, '', options), // Because expected is omitted in hint above,
- 'this matcher must not have an expected argument', printWithType('Expected', expected, printExpected)));
- }
- };
- exports.ensureNoExpected = ensureNoExpected;
- var ensureActualIsNumber = function ensureActualIsNumber(actual, matcherName, options) {
- if (typeof actual !== 'number') {
- // Prepend maybe not only for backward compatibility.
- var matcherString = (options ? '' : '[.not]') + matcherName;
- throw new Error(matcherErrorMessage(matcherHint(matcherString, undefined, undefined, options), "".concat(RECEIVED_COLOR('received'), " value must be a number"), printWithType('Received', actual, printReceived)));
- }
- };
- exports.ensureActualIsNumber = ensureActualIsNumber;
- var ensureExpectedIsNumber = function ensureExpectedIsNumber(expected, matcherName, options) {
- if (typeof expected !== 'number') {
- // Prepend maybe not only for backward compatibility.
- var matcherString = (options ? '' : '[.not]') + matcherName;
- throw new Error(matcherErrorMessage(matcherHint(matcherString, undefined, undefined, options), "".concat(EXPECTED_COLOR('expected'), " value must be a number"), printWithType('Expected', expected, printExpected)));
- }
- };
- exports.ensureExpectedIsNumber = ensureExpectedIsNumber;
- var ensureNumbers = function ensureNumbers(actual, expected, matcherName, options) {
- ensureActualIsNumber(actual, matcherName, options);
- ensureExpectedIsNumber(expected, matcherName, options);
- };
- exports.ensureNumbers = ensureNumbers;
- var ensureExpectedIsNonNegativeInteger = function ensureExpectedIsNonNegativeInteger(expected, matcherName, options) {
- if (typeof expected !== 'number' || !Number.isSafeInteger(expected) || expected < 0) {
- // Prepend maybe not only for backward compatibility.
- var matcherString = (options ? '' : '[.not]') + matcherName;
- throw new Error(matcherErrorMessage(matcherHint(matcherString, undefined, undefined, options), "".concat(EXPECTED_COLOR('expected'), " value must be a non-negative integer"), printWithType('Expected', expected, printExpected)));
- }
- };
- exports.ensureExpectedIsNonNegativeInteger = ensureExpectedIsNonNegativeInteger;
- var isLineDiffable = function isLineDiffable(expected, received) {
- var expectedType = (0, _jestGetType.default)(expected);
- var receivedType = (0, _jestGetType.default)(received);
- if (expectedType !== receivedType) {
- return false;
- }
- if ((0, _jestGetType.isPrimitive)(expected)) {
- // Print generic line diff for strings only:
- // * if neither string is empty
- return typeof expected === 'string' && typeof received === 'string' && expected.length !== 0 && received.length !== 0 && (MULTILINE_REGEXP.test(expected) || MULTILINE_REGEXP.test(received));
- }
- if (expectedType === 'date' || expectedType === 'function' || expectedType === 'regexp') {
- return false;
- }
- if (expected instanceof Error && received instanceof Error) {
- return false;
- }
- if (expectedType === 'object' && typeof expected.asymmetricMatch === 'function') {
- return false;
- }
- if (receivedType === 'object' && typeof received.asymmetricMatch === 'function') {
- return false;
- }
- return true;
- };
- var printDiffOrStringify = function printDiffOrStringify(expected, received, expectedLabel, receivedLabel, expand) {
- if (typeof expected === 'string' && typeof received === 'string') {
- var result = (0, _jestDiff.getStringDiff)(expected, received, {
- aAnnotation: expectedLabel,
- bAnnotation: receivedLabel,
- expand: expand
- });
- if (result !== null) {
- if (result.isMultiline) {
- return result.annotatedDiff;
- }
- var _printLabel = getLabelPrinter(expectedLabel, receivedLabel);
- var _expectedLine = _printLabel(expectedLabel) + printExpected(result.a);
- var _receivedLine = _printLabel(receivedLabel) + printReceived(result.b);
- return _expectedLine + '\n' + _receivedLine;
- }
- }
- if (isLineDiffable(expected, received)) {
- var difference = (0, _jestDiff.default)(expected, received, {
- aAnnotation: expectedLabel,
- bAnnotation: receivedLabel,
- expand: expand
- });
- if (typeof difference === 'string' && difference.includes('- ' + expectedLabel) && difference.includes('+ ' + receivedLabel)) {
- return difference;
- }
- }
- var printLabel = getLabelPrinter(expectedLabel, receivedLabel);
- var expectedLine = printLabel(expectedLabel) + printExpected(expected);
- var receivedLine = printLabel(receivedLabel) + (stringify(expected) === stringify(received) ? 'serializes to the same string' : printReceived(received));
- return expectedLine + '\n' + receivedLine;
- }; // Sometimes, e.g. when comparing two numbers, the output from jest-diff
- // does not contain more information than the `Expected:` / `Received:` already gives.
- // In those cases, we do not print a diff to make the output shorter and not redundant.
- exports.printDiffOrStringify = printDiffOrStringify;
- var shouldPrintDiff = function shouldPrintDiff(actual, expected) {
- if (typeof actual === 'number' && typeof expected === 'number') {
- return false;
- }
- if (typeof actual === 'boolean' && typeof expected === 'boolean') {
- return false;
- }
- return true;
- };
- var diff = function diff(a, b, options) {
- return shouldPrintDiff(a, b) ? (0, _jestDiff.default)(a, b, options) : null;
- };
- exports.diff = diff;
- var pluralize = function pluralize(word, count) {
- return (NUMBERS[count] || count) + ' ' + word + (count === 1 ? '' : 's');
- }; // To display lines of labeled values as two columns with monospace alignment:
- // given the strings which will describe the values,
- // return function which given each string, returns the label:
- // string, colon, space, and enough padding spaces to align the value.
- exports.pluralize = pluralize;
- var getLabelPrinter = function getLabelPrinter() {
- for (var _len = arguments.length, strings = new Array(_len), _key = 0; _key < _len; _key++) {
- strings[_key] = arguments[_key];
- }
- var maxLength = strings.reduce(function (max, string) {
- return string.length > max ? string.length : max;
- }, 0);
- return function (string) {
- return "".concat(string, ": ").concat(' '.repeat(maxLength - string.length));
- };
- };
- exports.getLabelPrinter = getLabelPrinter;
- var matcherErrorMessage = function matcherErrorMessage(hint, generic, specific // incorrect value returned from call to printWithType
- ) {
- return "".concat(hint, "\n\n").concat(_chalk.default.bold('Matcher error'), ": ").concat(generic, "\n\n").concat(specific);
- }; // Display assertion for the report when a test fails.
- // New format: rejects/resolves, not, and matcher name have black color
- // Old format: matcher name has dim color
- exports.matcherErrorMessage = matcherErrorMessage;
- var matcherHint = function matcherHint(matcherName) {
- var received = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'received';
- var expected = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'expected';
- var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
- var _options$comment = options.comment,
- comment = _options$comment === void 0 ? '' : _options$comment,
- _options$expectedColo = options.expectedColor,
- expectedColor = _options$expectedColo === void 0 ? EXPECTED_COLOR : _options$expectedColo,
- _options$isDirectExpe = options.isDirectExpectCall,
- isDirectExpectCall = _options$isDirectExpe === void 0 ? false : _options$isDirectExpe,
- _options$isNot = options.isNot,
- isNot = _options$isNot === void 0 ? false : _options$isNot,
- _options$promise = options.promise,
- promise = _options$promise === void 0 ? '' : _options$promise,
- _options$receivedColo = options.receivedColor,
- receivedColor = _options$receivedColo === void 0 ? RECEIVED_COLOR : _options$receivedColo,
- _options$secondArgume = options.secondArgument,
- secondArgument = _options$secondArgume === void 0 ? '' : _options$secondArgume,
- _options$secondArgume2 = options.secondArgumentColor,
- secondArgumentColor = _options$secondArgume2 === void 0 ? EXPECTED_COLOR : _options$secondArgume2;
- var hint = '';
- var dimString = 'expect'; // concatenate adjacent dim substrings
- if (!isDirectExpectCall && received !== '') {
- hint += DIM_COLOR(dimString + '(') + receivedColor(received);
- dimString = ')';
- }
- if (promise !== '') {
- hint += DIM_COLOR(dimString + '.') + promise;
- dimString = '';
- }
- if (isNot) {
- hint += DIM_COLOR(dimString + '.') + 'not';
- dimString = '';
- }
- if (matcherName.includes('.')) {
- // Old format: for backward compatibility,
- // especially without promise or isNot options
- dimString += matcherName;
- } else {
- // New format: omit period from matcherName arg
- hint += DIM_COLOR(dimString + '.') + matcherName;
- dimString = '';
- }
- if (expected === '') {
- dimString += '()';
- } else {
- hint += DIM_COLOR(dimString + '(') + expectedColor(expected);
- if (secondArgument) {
- hint += DIM_COLOR(', ') + secondArgumentColor(secondArgument);
- }
- dimString = ')';
- }
- if (comment !== '') {
- dimString += ' // ' + comment;
- }
- if (dimString !== '') {
- hint += DIM_COLOR(dimString);
- }
- return hint;
- };
- exports.matcherHint = matcherHint;
- /***/ }),
- /***/ "./packages/jest-message-util/build/index.js":
- /*!***************************************************!*\
- !*** ./packages/jest-message-util/build/index.js ***!
- \***************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(global) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- Object.defineProperty(exports, 'Frame', {
- enumerable: true,
- get: function get() {
- return _types.Frame;
- }
- });
- exports.separateMessageFromStack = exports.formatResultsErrors = exports.formatStackTrace = exports.getTopFrame = exports.getStackTraceLines = exports.formatExecError = void 0;
- var _fs = _interopRequireDefault(__webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js"));
- var _path = _interopRequireDefault(__webpack_require__(/*! path */ "./node_modules/path-browserify/index.js"));
- var _chalk = _interopRequireDefault(__webpack_require__(/*! chalk */ "./packages/expect/build/fakeChalk.js"));
- var _micromatch = _interopRequireDefault(__webpack_require__(/*! micromatch */ "./node_modules/micromatch/index.js"));
- var _slash = _interopRequireDefault(__webpack_require__(/*! slash */ "./node_modules/slash/index.js"));
- var _codeFrame = __webpack_require__(/*! @babel/code-frame */ "./node_modules/@babel/code-frame/lib/index.js");
- var _stackUtils = _interopRequireDefault(__webpack_require__(/*! stack-utils */ "./node_modules/stack-utils/index.js"));
- var _types = __webpack_require__(/*! ./types */ "./packages/jest-message-util/build/types.js");
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
- }
- var _Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
- var jestReadFile = global[_Symbol.for('jest-native-read-file')] || _fs.default.readFileSync;
- var _Symbol = global['jest-symbol-do-not-touch'] || global.Symbol; // stack utils tries to create pretty stack by making paths relative.
- var stackUtils = new _stackUtils.default({
- cwd: 'something which does not exist'
- });
- var nodeInternals = [];
- try {
- nodeInternals = _stackUtils.default.nodeInternals();
- } catch (e) {// `StackUtils.nodeInternals()` fails in browsers. We don't need to remove
- // node internals in the browser though, so no issue.
- }
- var PATH_NODE_MODULES = "".concat(_path.default.sep, "node_modules").concat(_path.default.sep);
- var PATH_JEST_PACKAGES = "".concat(_path.default.sep, "jest").concat(_path.default.sep, "packages").concat(_path.default.sep); // filter for noisy stack trace lines
- var JASMINE_IGNORE = /^\s+at(?:(?:.jasmine\-)|\s+jasmine\.buildExpectationResult)/;
- var JEST_INTERNALS_IGNORE = /^\s+at.*?jest(-.*?)?(\/|\\)(build|node_modules|packages)(\/|\\)/;
- var ANONYMOUS_FN_IGNORE = /^\s+at <anonymous>.*$/;
- var ANONYMOUS_PROMISE_IGNORE = /^\s+at (new )?Promise \(<anonymous>\).*$/;
- var ANONYMOUS_GENERATOR_IGNORE = /^\s+at Generator.next \(<anonymous>\).*$/;
- var NATIVE_NEXT_IGNORE = /^\s+at next \(native\).*$/;
- var TITLE_INDENT = ' ';
- var MESSAGE_INDENT = ' ';
- var STACK_INDENT = ' ';
- var ANCESTRY_SEPARATOR = " \u203A ";
- var TITLE_BULLET = _chalk.default.bold("\u25CF ");
- var STACK_TRACE_COLOR = _chalk.default.dim;
- var STACK_PATH_REGEXP = /\s*at.*\(?(\:\d*\:\d*|native)\)?/;
- var EXEC_ERROR_MESSAGE = 'Test suite failed to run';
- var NOT_EMPTY_LINE_REGEXP = /^(?!$)/gm;
- var indentAllLines = function indentAllLines(lines, indent) {
- return lines.replace(NOT_EMPTY_LINE_REGEXP, indent);
- };
- var trim = function trim(string) {
- return (string || '').trim();
- }; // Some errors contain not only line numbers in stack traces
- // e.g. SyntaxErrors can contain snippets of code, and we don't
- // want to trim those, because they may have pointers to the column/character
- // which will get misaligned.
- var trimPaths = function trimPaths(string) {
- return string.match(STACK_PATH_REGEXP) ? trim(string) : string;
- };
- var getRenderedCallsite = function getRenderedCallsite(fileContent, line, column) {
- var renderedCallsite = (0, _codeFrame.codeFrameColumns)(fileContent, {
- start: {
- column: column,
- line: line
- }
- }, {
- highlightCode: true
- });
- renderedCallsite = indentAllLines(renderedCallsite, MESSAGE_INDENT);
- renderedCallsite = "\n".concat(renderedCallsite, "\n");
- return renderedCallsite;
- };
- var blankStringRegexp = /^\s*$/; // ExecError is an error thrown outside of the test suite (not inside an `it` or
- // `before/after each` hooks). If it's thrown, none of the tests in the file
- // are executed.
- var formatExecError = function formatExecError(error, config, options, testPath, reuseMessage) {
- if (!error || typeof error === 'number') {
- error = new Error("Expected an Error, but \"".concat(String(error), "\" was thrown"));
- error.stack = '';
- }
- var message, stack;
- if (typeof error === 'string' || !error) {
- error || (error = 'EMPTY ERROR');
- message = '';
- stack = error;
- } else {
- message = error.message;
- stack = error.stack;
- }
- var separated = separateMessageFromStack(stack || '');
- stack = separated.stack;
- if (separated.message.includes(trim(message))) {
- // Often stack trace already contains the duplicate of the message
- message = separated.message;
- }
- message = indentAllLines(message, MESSAGE_INDENT);
- stack = stack && !options.noStackTrace ? '\n' + formatStackTrace(stack, config, options, testPath) : '';
- if (blankStringRegexp.test(message) && blankStringRegexp.test(stack)) {
- // this can happen if an empty object is thrown.
- message = MESSAGE_INDENT + 'Error: No message was provided';
- }
- var messageToUse;
- if (reuseMessage) {
- messageToUse = " ".concat(message.trim());
- } else {
- messageToUse = "".concat(EXEC_ERROR_MESSAGE, "\n\n").concat(message);
- }
- return TITLE_INDENT + TITLE_BULLET + messageToUse + stack + '\n';
- };
- exports.formatExecError = formatExecError;
- var removeInternalStackEntries = function removeInternalStackEntries(lines, options) {
- var pathCounter = 0;
- return lines.filter(function (line) {
- if (ANONYMOUS_FN_IGNORE.test(line)) {
- return false;
- }
- if (ANONYMOUS_PROMISE_IGNORE.test(line)) {
- return false;
- }
- if (ANONYMOUS_GENERATOR_IGNORE.test(line)) {
- return false;
- }
- if (NATIVE_NEXT_IGNORE.test(line)) {
- return false;
- }
- if (nodeInternals.some(function (internal) {
- return internal.test(line);
- })) {
- return false;
- }
- if (!STACK_PATH_REGEXP.test(line)) {
- return true;
- }
- if (JASMINE_IGNORE.test(line)) {
- return false;
- }
- if (++pathCounter === 1) {
- return true; // always keep the first line even if it's from Jest
- }
- if (options.noStackTrace) {
- return false;
- }
- if (JEST_INTERNALS_IGNORE.test(line)) {
- return false;
- }
- return true;
- });
- };
- var formatPaths = function formatPaths(config, relativeTestPath, line) {
- // Extract the file path from the trace line.
- var match = line.match(/(^\s*at .*?\(?)([^()]+)(:[0-9]+:[0-9]+\)?.*$)/);
- if (!match) {
- return line;
- }
- var filePath = (0, _slash.default)(_path.default.relative(config.rootDir, match[2])); // highlight paths from the current test file
- if (config.testMatch && config.testMatch.length && _micromatch.default.some(filePath, config.testMatch) || filePath === relativeTestPath) {
- filePath = _chalk.default.reset.cyan(filePath);
- }
- return STACK_TRACE_COLOR(match[1]) + filePath + STACK_TRACE_COLOR(match[3]);
- };
- var getStackTraceLines = function getStackTraceLines(stack) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
- noStackTrace: false
- };
- return removeInternalStackEntries(stack.split(/\n/), options);
- };
- exports.getStackTraceLines = getStackTraceLines;
- var getTopFrame = function getTopFrame(lines) {
- var _iteratorNormalCompletion = true;
- var _didIteratorError = false;
- var _iteratorError = undefined;
- try {
- for (var _iterator = lines[_Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
- var line = _step.value;
- if (line.includes(PATH_NODE_MODULES) || line.includes(PATH_JEST_PACKAGES)) {
- continue;
- }
- var parsedFrame = stackUtils.parseLine(line.trim());
- if (parsedFrame && parsedFrame.file) {
- return parsedFrame;
- }
- }
- } catch (err) {
- _didIteratorError = true;
- _iteratorError = err;
- } finally {
- try {
- if (!_iteratorNormalCompletion && _iterator.return != null) {
- _iterator.return();
- }
- } finally {
- if (_didIteratorError) {
- throw _iteratorError;
- }
- }
- }
- return null;
- };
- exports.getTopFrame = getTopFrame;
- var formatStackTrace = function formatStackTrace(stack, config, options, testPath) {
- var lines = getStackTraceLines(stack, options);
- var topFrame = getTopFrame(lines);
- var renderedCallsite = '';
- var relativeTestPath = testPath ? (0, _slash.default)(_path.default.relative(config.rootDir, testPath)) : null;
- if (topFrame) {
- var column = topFrame.column,
- filename = topFrame.file,
- line = topFrame.line;
- if (line && filename && _path.default.isAbsolute(filename)) {
- var fileContent;
- try {
- // TODO: check & read HasteFS instead of reading the filesystem:
- // see: https://github.com/facebook/jest/pull/5405#discussion_r164281696
- fileContent = jestReadFile(filename, 'utf8');
- renderedCallsite = getRenderedCallsite(fileContent, line, column);
- } catch (e) {// the file does not exist or is inaccessible, we ignore
- }
- }
- }
- var stacktrace = lines.filter(Boolean).map(function (line) {
- return STACK_INDENT + formatPaths(config, relativeTestPath, trimPaths(line));
- }).join('\n');
- return "".concat(renderedCallsite, "\n").concat(stacktrace);
- };
- exports.formatStackTrace = formatStackTrace;
- var formatResultsErrors = function formatResultsErrors(testResults, config, options, testPath) {
- var failedResults = testResults.reduce(function (errors, result) {
- result.failureMessages.forEach(function (content) {
- return errors.push({
- content: content,
- result: result
- });
- });
- return errors;
- }, []);
- if (!failedResults.length) {
- return null;
- }
- return failedResults.map(function (_ref) {
- var result = _ref.result,
- content = _ref.content;
- var _separateMessageFromS = separateMessageFromStack(content),
- message = _separateMessageFromS.message,
- stack = _separateMessageFromS.stack;
- stack = options.noStackTrace ? '' : STACK_TRACE_COLOR(formatStackTrace(stack, config, options, testPath)) + '\n';
- message = indentAllLines(message, MESSAGE_INDENT);
- var title = _chalk.default.bold.red(TITLE_INDENT + TITLE_BULLET + result.ancestorTitles.join(ANCESTRY_SEPARATOR) + (result.ancestorTitles.length ? ANCESTRY_SEPARATOR : '') + result.title) + '\n';
- return title + '\n' + message + '\n' + stack;
- }).join('\n');
- };
- exports.formatResultsErrors = formatResultsErrors;
- var errorRegexp = /^Error:?\s*$/;
- var removeBlankErrorLine = function removeBlankErrorLine(str) {
- return str.split('\n') // Lines saying just `Error:` are useless
- .filter(function (line) {
- return !errorRegexp.test(line);
- }).join('\n').trimRight();
- }; // jasmine and worker farm sometimes don't give us access to the actual
- // Error object, so we have to regexp out the message from the stack string
- // to format it.
- var separateMessageFromStack = function separateMessageFromStack(content) {
- if (!content) {
- return {
- message: '',
- stack: ''
- };
- } // All lines up to what looks like a stack -- or if nothing looks like a stack
- // (maybe it's a code frame instead), just the first non-empty line.
- // If the error is a plain "Error:" instead of a SyntaxError or TypeError we
- // remove the prefix from the message because it is generally not useful.
- var messageMatch = content.match(/^(?:Error: )?([\s\S]*?(?=\n\s*at\s.*:\d*:\d*)|\s*.*)([\s\S]*)$/);
- if (!messageMatch) {
- // For typescript
- throw new Error('If you hit this error, the regex above is buggy.');
- }
- var message = removeBlankErrorLine(messageMatch[1]);
- var stack = removeBlankErrorLine(messageMatch[2]);
- return {
- message: message,
- stack: stack
- };
- };
- exports.separateMessageFromStack = separateMessageFromStack;
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
- /***/ }),
- /***/ "./packages/jest-message-util/build/types.js":
- /*!***************************************************!*\
- !*** ./packages/jest-message-util/build/types.js ***!
- \***************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /***/ }),
- /***/ "./packages/pretty-format/build/collections.js":
- /*!*****************************************************!*\
- !*** ./packages/pretty-format/build/collections.js ***!
- \*****************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.printIteratorEntries = printIteratorEntries;
- exports.printIteratorValues = printIteratorValues;
- exports.printListItems = printListItems;
- exports.printObjectProperties = printObjectProperties;
- /**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- *
- */
- var getKeysOfEnumerableProperties = function getKeysOfEnumerableProperties(object) {
- var keys = Object.keys(object).sort();
- if (Object.getOwnPropertySymbols) {
- Object.getOwnPropertySymbols(object).forEach(function (symbol) {
- if (Object.getOwnPropertyDescriptor(object, symbol).enumerable) {
- keys.push(symbol);
- }
- });
- }
- return keys;
- };
- /**
- * Return entries (for example, of a map)
- * with spacing, indentation, and comma
- * without surrounding punctuation (for example, braces)
- */
- function printIteratorEntries( // Flow 0.51.0: property `@@iterator` of $Iterator not found in Object
- // To allow simplistic getRecordIterator in immutable.js
- iterator, config, indentation, depth, refs, printer) {
- var separator = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : ': ';
- var result = '';
- var current = iterator.next();
- if (!current.done) {
- result += config.spacingOuter;
- var indentationNext = indentation + config.indent;
- while (!current.done) {
- var name = printer(current.value[0], config, indentationNext, depth, refs);
- var value = printer(current.value[1], config, indentationNext, depth, refs);
- result += indentationNext + name + separator + value;
- current = iterator.next();
- if (!current.done) {
- result += ',' + config.spacingInner;
- } else if (!config.min) {
- result += ',';
- }
- }
- result += config.spacingOuter + indentation;
- }
- return result;
- }
- /**
- * Return values (for example, of a set)
- * with spacing, indentation, and comma
- * without surrounding punctuation (braces or brackets)
- */
- function printIteratorValues(iterator, config, indentation, depth, refs, printer) {
- var result = '';
- var current = iterator.next();
- if (!current.done) {
- result += config.spacingOuter;
- var indentationNext = indentation + config.indent;
- while (!current.done) {
- result += indentationNext + printer(current.value, config, indentationNext, depth, refs);
- current = iterator.next();
- if (!current.done) {
- result += ',' + config.spacingInner;
- } else if (!config.min) {
- result += ',';
- }
- }
- result += config.spacingOuter + indentation;
- }
- return result;
- }
- /**
- * Return items (for example, of an array)
- * with spacing, indentation, and comma
- * without surrounding punctuation (for example, brackets)
- **/
- function printListItems(list, config, indentation, depth, refs, printer) {
- var result = '';
- if (list.length) {
- result += config.spacingOuter;
- var indentationNext = indentation + config.indent;
- for (var i = 0; i < list.length; i++) {
- result += indentationNext + printer(list[i], config, indentationNext, depth, refs);
- if (i < list.length - 1) {
- result += ',' + config.spacingInner;
- } else if (!config.min) {
- result += ',';
- }
- }
- result += config.spacingOuter + indentation;
- }
- return result;
- }
- /**
- * Return properties of an object
- * with spacing, indentation, and comma
- * without surrounding punctuation (for example, braces)
- */
- function printObjectProperties(val, config, indentation, depth, refs, printer) {
- var result = '';
- var keys = getKeysOfEnumerableProperties(val);
- if (keys.length) {
- result += config.spacingOuter;
- var indentationNext = indentation + config.indent;
- for (var i = 0; i < keys.length; i++) {
- var key = keys[i];
- var name = printer(key, config, indentationNext, depth, refs);
- var value = printer(val[key], config, indentationNext, depth, refs);
- result += indentationNext + name + ': ' + value;
- if (i < keys.length - 1) {
- result += ',' + config.spacingInner;
- } else if (!config.min) {
- result += ',';
- }
- }
- result += config.spacingOuter + indentation;
- }
- return result;
- }
- /***/ }),
- /***/ "./packages/pretty-format/build/index.js":
- /*!***********************************************!*\
- !*** ./packages/pretty-format/build/index.js ***!
- \***********************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(global) {
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
- function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
- function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
- function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
- function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
- var _ansiStyles = _interopRequireDefault(__webpack_require__(/*! ansi-styles */ "./node_modules/ansi-styles/index.js"));
- var _collections = __webpack_require__(/*! ./collections */ "./packages/pretty-format/build/collections.js");
- var _AsymmetricMatcher = _interopRequireDefault(__webpack_require__(/*! ./plugins/AsymmetricMatcher */ "./packages/pretty-format/build/plugins/AsymmetricMatcher.js"));
- var _ConvertAnsi = _interopRequireDefault(__webpack_require__(/*! ./plugins/ConvertAnsi */ "./packages/pretty-format/build/plugins/ConvertAnsi.js"));
- var _DOMCollection = _interopRequireDefault(__webpack_require__(/*! ./plugins/DOMCollection */ "./packages/pretty-format/build/plugins/DOMCollection.js"));
- var _DOMElement = _interopRequireDefault(__webpack_require__(/*! ./plugins/DOMElement */ "./packages/pretty-format/build/plugins/DOMElement.js"));
- var _Immutable = _interopRequireDefault(__webpack_require__(/*! ./plugins/Immutable */ "./packages/pretty-format/build/plugins/Immutable.js"));
- var _ReactElement = _interopRequireDefault(__webpack_require__(/*! ./plugins/ReactElement */ "./packages/pretty-format/build/plugins/ReactElement.js"));
- var _ReactTestComponent = _interopRequireDefault(__webpack_require__(/*! ./plugins/ReactTestComponent */ "./packages/pretty-format/build/plugins/ReactTestComponent.js"));
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
- }
- var _Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
- var toString = Object.prototype.toString;
- var toISOString = Date.prototype.toISOString;
- var errorToString = Error.prototype.toString;
- var regExpToString = RegExp.prototype.toString;
- var symbolToString = _Symbol.prototype.toString;
- /**
- * Explicitly comparing typeof constructor to function avoids undefined as name
- * when mock identity-obj-proxy returns the key as the value for any key.
- */
- var getConstructorName = function getConstructorName(val) {
- return typeof val.constructor === 'function' && val.constructor.name || 'Object';
- };
- /* global window */
- /** Is val is equal to global window object? Works even if it does not exist :) */
- var isWindow = function isWindow(val) {
- return typeof window !== 'undefined' && val === window;
- };
- var SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
- var NEWLINE_REGEXP = /\n/gi;
- var PrettyFormatPluginError =
- /*#__PURE__*/
- function (_Error) {
- _inherits(PrettyFormatPluginError, _Error);
- function PrettyFormatPluginError(message, stack) {
- var _this;
- _classCallCheck(this, PrettyFormatPluginError);
- _this = _possibleConstructorReturn(this, _getPrototypeOf(PrettyFormatPluginError).call(this, message));
- _this.stack = stack;
- _this.name = _this.constructor.name;
- return _this;
- }
- return PrettyFormatPluginError;
- }(_wrapNativeSuper(Error));
- function isToStringedArrayType(toStringed) {
- return toStringed === '[object Array]' || toStringed === '[object ArrayBuffer]' || toStringed === '[object DataView]' || toStringed === '[object Float32Array]' || toStringed === '[object Float64Array]' || toStringed === '[object Int8Array]' || toStringed === '[object Int16Array]' || toStringed === '[object Int32Array]' || toStringed === '[object Uint8Array]' || toStringed === '[object Uint8ClampedArray]' || toStringed === '[object Uint16Array]' || toStringed === '[object Uint32Array]';
- }
- function printNumber(val) {
- return Object.is(val, -0) ? '-0' : String(val);
- }
- function printBigInt(val) {
- return String("".concat(val, "n"));
- }
- function printFunction(val, printFunctionName) {
- if (!printFunctionName) {
- return '[Function]';
- }
- return '[Function ' + (val.name || 'anonymous') + ']';
- }
- function printSymbol(val) {
- return symbolToString.call(val).replace(SYMBOL_REGEXP, 'Symbol($1)');
- }
- function printError(val) {
- return '[' + errorToString.call(val) + ']';
- }
- /**
- * The first port of call for printing an object, handles most of the
- * data-types in JS.
- */
- function printBasicValue(val, printFunctionName, escapeRegex, escapeString) {
- if (val === true || val === false) {
- return '' + val;
- }
- if (val === undefined) {
- return 'undefined';
- }
- if (val === null) {
- return 'null';
- }
- var typeOf = _typeof(val);
- if (typeOf === 'number') {
- return printNumber(val);
- }
- if (typeOf === 'bigint') {
- return printBigInt(val);
- }
- if (typeOf === 'string') {
- if (escapeString) {
- return '"' + val.replace(/"|\\/g, '\\$&') + '"';
- }
- return '"' + val + '"';
- }
- if (typeOf === 'function') {
- return printFunction(val, printFunctionName);
- }
- if (typeOf === 'symbol') {
- return printSymbol(val);
- }
- var toStringed = toString.call(val);
- if (toStringed === '[object WeakMap]') {
- return 'WeakMap {}';
- }
- if (toStringed === '[object WeakSet]') {
- return 'WeakSet {}';
- }
- if (toStringed === '[object Function]' || toStringed === '[object GeneratorFunction]') {
- return printFunction(val, printFunctionName);
- }
- if (toStringed === '[object Symbol]') {
- return printSymbol(val);
- }
- if (toStringed === '[object Date]') {
- return isNaN(+val) ? 'Date { NaN }' : toISOString.call(val);
- }
- if (toStringed === '[object Error]') {
- return printError(val);
- }
- if (toStringed === '[object RegExp]') {
- if (escapeRegex) {
- // https://github.com/benjamingr/RegExp.escape/blob/master/polyfill.js
- return regExpToString.call(val).replace(/[\\^$*+?.()|[\]{}]/g, '\\$&');
- }
- return regExpToString.call(val);
- }
- if (val instanceof Error) {
- return printError(val);
- }
- return null;
- }
- /**
- * Handles more complex objects ( such as objects with circular references.
- * maps and sets etc )
- */
- function printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON) {
- if (refs.indexOf(val) !== -1) {
- return '[Circular]';
- }
- refs = refs.slice();
- refs.push(val);
- var hitMaxDepth = ++depth > config.maxDepth;
- var min = config.min;
- if (config.callToJSON && !hitMaxDepth && val.toJSON && typeof val.toJSON === 'function' && !hasCalledToJSON) {
- return printer(val.toJSON(), config, indentation, depth, refs, true);
- }
- var toStringed = toString.call(val);
- if (toStringed === '[object Arguments]') {
- return hitMaxDepth ? '[Arguments]' : (min ? '' : 'Arguments ') + '[' + (0, _collections.printListItems)(val, config, indentation, depth, refs, printer) + ']';
- }
- if (isToStringedArrayType(toStringed)) {
- return hitMaxDepth ? '[' + val.constructor.name + ']' : (min ? '' : val.constructor.name + ' ') + '[' + (0, _collections.printListItems)(val, config, indentation, depth, refs, printer) + ']';
- }
- if (toStringed === '[object Map]') {
- return hitMaxDepth ? '[Map]' : 'Map {' + (0, _collections.printIteratorEntries)(val.entries(), config, indentation, depth, refs, printer, ' => ') + '}';
- }
- if (toStringed === '[object Set]') {
- return hitMaxDepth ? '[Set]' : 'Set {' + (0, _collections.printIteratorValues)(val.values(), config, indentation, depth, refs, printer) + '}';
- } // Avoid failure to serialize global window object in jsdom test environment.
- // For example, not even relevant if window is prop of React element.
- return hitMaxDepth || isWindow(val) ? '[' + getConstructorName(val) + ']' : (min ? '' : getConstructorName(val) + ' ') + '{' + (0, _collections.printObjectProperties)(val, config, indentation, depth, refs, printer) + '}';
- }
- function isNewPlugin(plugin) {
- return plugin.serialize != null;
- }
- function printPlugin(plugin, val, config, indentation, depth, refs) {
- var printed;
- try {
- printed = isNewPlugin(plugin) ? plugin.serialize(val, config, indentation, depth, refs, printer) : plugin.print(val, function (valChild) {
- return printer(valChild, config, indentation, depth, refs);
- }, function (str) {
- var indentationNext = indentation + config.indent;
- return indentationNext + str.replace(NEWLINE_REGEXP, '\n' + indentationNext);
- }, {
- edgeSpacing: config.spacingOuter,
- min: config.min,
- spacing: config.spacingInner
- }, config.colors);
- } catch (error) {
- throw new PrettyFormatPluginError(error.message, error.stack);
- }
- if (typeof printed !== 'string') {
- throw new Error("pretty-format: Plugin must return type \"string\" but instead returned \"".concat(_typeof(printed), "\"."));
- }
- return printed;
- }
- function findPlugin(plugins, val) {
- for (var p = 0; p < plugins.length; p++) {
- try {
- if (plugins[p].test(val)) {
- return plugins[p];
- }
- } catch (error) {
- throw new PrettyFormatPluginError(error.message, error.stack);
- }
- }
- return null;
- }
- function printer(val, config, indentation, depth, refs, hasCalledToJSON) {
- var plugin = findPlugin(config.plugins, val);
- if (plugin !== null) {
- return printPlugin(plugin, val, config, indentation, depth, refs);
- }
- var basicResult = printBasicValue(val, config.printFunctionName, config.escapeRegex, config.escapeString);
- if (basicResult !== null) {
- return basicResult;
- }
- return printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON);
- }
- var DEFAULT_THEME = {
- comment: 'gray',
- content: 'reset',
- prop: 'yellow',
- tag: 'cyan',
- value: 'green'
- };
- var DEFAULT_THEME_KEYS = Object.keys(DEFAULT_THEME);
- var DEFAULT_OPTIONS = {
- callToJSON: true,
- escapeRegex: false,
- escapeString: true,
- highlight: false,
- indent: 2,
- maxDepth: Infinity,
- min: false,
- plugins: [],
- printFunctionName: true,
- theme: DEFAULT_THEME
- };
- function validateOptions(options) {
- Object.keys(options).forEach(function (key) {
- if (!DEFAULT_OPTIONS.hasOwnProperty(key)) {
- throw new Error("pretty-format: Unknown option \"".concat(key, "\"."));
- }
- });
- if (options.min && options.indent !== undefined && options.indent !== 0) {
- throw new Error('pretty-format: Options "min" and "indent" cannot be used together.');
- }
- if (options.theme !== undefined) {
- if (options.theme === null) {
- throw new Error("pretty-format: Option \"theme\" must not be null.");
- }
- if (_typeof(options.theme) !== 'object') {
- throw new Error("pretty-format: Option \"theme\" must be of type \"object\" but instead received \"".concat(_typeof(options.theme), "\"."));
- }
- }
- }
- var getColorsHighlight = function getColorsHighlight(options) {
- return DEFAULT_THEME_KEYS.reduce(function (colors, key) {
- var value = options.theme && options.theme[key] !== undefined ? options.theme[key] : DEFAULT_THEME[key];
- var color = value && _ansiStyles.default[value];
- if (color && typeof color.close === 'string' && typeof color.open === 'string') {
- colors[key] = color;
- } else {
- throw new Error("pretty-format: Option \"theme\" has a key \"".concat(key, "\" whose value \"").concat(value, "\" is undefined in ansi-styles."));
- }
- return colors;
- }, Object.create(null));
- };
- var getColorsEmpty = function getColorsEmpty() {
- return DEFAULT_THEME_KEYS.reduce(function (colors, key) {
- colors[key] = {
- close: '',
- open: ''
- };
- return colors;
- }, Object.create(null));
- };
- var getPrintFunctionName = function getPrintFunctionName(options) {
- return options && options.printFunctionName !== undefined ? options.printFunctionName : DEFAULT_OPTIONS.printFunctionName;
- };
- var getEscapeRegex = function getEscapeRegex(options) {
- return options && options.escapeRegex !== undefined ? options.escapeRegex : DEFAULT_OPTIONS.escapeRegex;
- };
- var getEscapeString = function getEscapeString(options) {
- return options && options.escapeString !== undefined ? options.escapeString : DEFAULT_OPTIONS.escapeString;
- };
- var getConfig = function getConfig(options) {
- return {
- callToJSON: options && options.callToJSON !== undefined ? options.callToJSON : DEFAULT_OPTIONS.callToJSON,
- colors: options && options.highlight ? getColorsHighlight(options) : getColorsEmpty(),
- escapeRegex: getEscapeRegex(options),
- escapeString: getEscapeString(options),
- indent: options && options.min ? '' : createIndent(options && options.indent !== undefined ? options.indent : DEFAULT_OPTIONS.indent),
- maxDepth: options && options.maxDepth !== undefined ? options.maxDepth : DEFAULT_OPTIONS.maxDepth,
- min: options && options.min !== undefined ? options.min : DEFAULT_OPTIONS.min,
- plugins: options && options.plugins !== undefined ? options.plugins : DEFAULT_OPTIONS.plugins,
- printFunctionName: getPrintFunctionName(options),
- spacingInner: options && options.min ? ' ' : '\n',
- spacingOuter: options && options.min ? '' : '\n'
- };
- };
- function createIndent(indent) {
- return new Array(indent + 1).join(' ');
- }
- /**
- * Returns a presentation string of your `val` object
- * @param val any potential JavaScript object
- * @param options Custom settings
- */
- function prettyFormat(val, options) {
- if (options) {
- validateOptions(options);
- if (options.plugins) {
- var plugin = findPlugin(options.plugins, val);
- if (plugin !== null) {
- return printPlugin(plugin, val, getConfig(options), '', 0, []);
- }
- }
- }
- var basicResult = printBasicValue(val, getPrintFunctionName(options), getEscapeRegex(options), getEscapeString(options));
- if (basicResult !== null) {
- return basicResult;
- }
- return printComplexValue(val, getConfig(options), '', 0, []);
- }
- prettyFormat.plugins = {
- AsymmetricMatcher: _AsymmetricMatcher.default,
- ConvertAnsi: _ConvertAnsi.default,
- DOMCollection: _DOMCollection.default,
- DOMElement: _DOMElement.default,
- Immutable: _Immutable.default,
- ReactElement: _ReactElement.default,
- ReactTestComponent: _ReactTestComponent.default
- };
- /* eslint-disable-next-line no-redeclare */
- module.exports = prettyFormat;
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
- /***/ }),
- /***/ "./packages/pretty-format/build/plugins/AsymmetricMatcher.js":
- /*!*******************************************************************!*\
- !*** ./packages/pretty-format/build/plugins/AsymmetricMatcher.js ***!
- \*******************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(global) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.default = exports.test = exports.serialize = void 0;
- var _collections = __webpack_require__(/*! ../collections */ "./packages/pretty-format/build/collections.js");
- var _Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
- var asymmetricMatcher = _Symbol.for('jest.asymmetricMatcher');
- var SPACE = ' ';
- var serialize = function serialize(val, config, indentation, depth, refs, printer) {
- var stringedValue = val.toString();
- if (stringedValue === 'ArrayContaining' || stringedValue === 'ArrayNotContaining') {
- if (++depth > config.maxDepth) {
- return '[' + stringedValue + ']';
- }
- return stringedValue + SPACE + '[' + (0, _collections.printListItems)(val.sample, config, indentation, depth, refs, printer) + ']';
- }
- if (stringedValue === 'ObjectContaining' || stringedValue === 'ObjectNotContaining') {
- if (++depth > config.maxDepth) {
- return '[' + stringedValue + ']';
- }
- return stringedValue + SPACE + '{' + (0, _collections.printObjectProperties)(val.sample, config, indentation, depth, refs, printer) + '}';
- }
- if (stringedValue === 'StringMatching' || stringedValue === 'StringNotMatching') {
- return stringedValue + SPACE + printer(val.sample, config, indentation, depth, refs);
- }
- if (stringedValue === 'StringContaining' || stringedValue === 'StringNotContaining') {
- return stringedValue + SPACE + printer(val.sample, config, indentation, depth, refs);
- }
- return val.toAsymmetricMatcher();
- };
- exports.serialize = serialize;
- var test = function test(val) {
- return val && val.$$typeof === asymmetricMatcher;
- };
- exports.test = test;
- var plugin = {
- serialize: serialize,
- test: test
- };
- var _default = plugin;
- exports.default = _default;
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
- /***/ }),
- /***/ "./packages/pretty-format/build/plugins/ConvertAnsi.js":
- /*!*************************************************************!*\
- !*** ./packages/pretty-format/build/plugins/ConvertAnsi.js ***!
- \*************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.default = exports.serialize = exports.test = void 0;
- var _ansiRegex = _interopRequireDefault(__webpack_require__(/*! ansi-regex */ "./node_modules/ansi-regex/index.js"));
- var _ansiStyles = _interopRequireDefault(__webpack_require__(/*! ansi-styles */ "./node_modules/ansi-styles/index.js"));
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
- }
- /**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
- var toHumanReadableAnsi = function toHumanReadableAnsi(text) {
- return text.replace((0, _ansiRegex.default)(), function (match) {
- switch (match) {
- case _ansiStyles.default.red.close:
- case _ansiStyles.default.green.close:
- case _ansiStyles.default.cyan.close:
- case _ansiStyles.default.gray.close:
- case _ansiStyles.default.white.close:
- case _ansiStyles.default.yellow.close:
- case _ansiStyles.default.bgRed.close:
- case _ansiStyles.default.bgGreen.close:
- case _ansiStyles.default.bgYellow.close:
- case _ansiStyles.default.inverse.close:
- case _ansiStyles.default.dim.close:
- case _ansiStyles.default.bold.close:
- case _ansiStyles.default.reset.open:
- case _ansiStyles.default.reset.close:
- return '</>';
- case _ansiStyles.default.red.open:
- return '<red>';
- case _ansiStyles.default.green.open:
- return '<green>';
- case _ansiStyles.default.cyan.open:
- return '<cyan>';
- case _ansiStyles.default.gray.open:
- return '<gray>';
- case _ansiStyles.default.white.open:
- return '<white>';
- case _ansiStyles.default.yellow.open:
- return '<yellow>';
- case _ansiStyles.default.bgRed.open:
- return '<bgRed>';
- case _ansiStyles.default.bgGreen.open:
- return '<bgGreen>';
- case _ansiStyles.default.bgYellow.open:
- return '<bgYellow>';
- case _ansiStyles.default.inverse.open:
- return '<inverse>';
- case _ansiStyles.default.dim.open:
- return '<dim>';
- case _ansiStyles.default.bold.open:
- return '<bold>';
- default:
- return '';
- }
- });
- };
- var test = function test(val) {
- return typeof val === 'string' && !!val.match((0, _ansiRegex.default)());
- };
- exports.test = test;
- var serialize = function serialize(val, config, indentation, depth, refs, printer) {
- return printer(toHumanReadableAnsi(val), config, indentation, depth, refs);
- };
- exports.serialize = serialize;
- var plugin = {
- serialize: serialize,
- test: test
- };
- var _default = plugin;
- exports.default = _default;
- /***/ }),
- /***/ "./packages/pretty-format/build/plugins/DOMCollection.js":
- /*!***************************************************************!*\
- !*** ./packages/pretty-format/build/plugins/DOMCollection.js ***!
- \***************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.default = exports.serialize = exports.test = void 0;
- var _collections = __webpack_require__(/*! ../collections */ "./packages/pretty-format/build/collections.js");
- function _objectSpread(target) {
- for (var i = 1; i < arguments.length; i++) {
- var source = arguments[i] != null ? arguments[i] : {};
- var ownKeys = Object.keys(source);
- if (typeof Object.getOwnPropertySymbols === 'function') {
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
- }));
- }
- ownKeys.forEach(function (key) {
- _defineProperty(target, key, source[key]);
- });
- }
- return target;
- }
- function _defineProperty(obj, key, value) {
- if (key in obj) {
- Object.defineProperty(obj, key, {
- value: value,
- enumerable: true,
- configurable: true,
- writable: true
- });
- } else {
- obj[key] = value;
- }
- return obj;
- }
- var SPACE = ' ';
- var OBJECT_NAMES = ['DOMStringMap', 'NamedNodeMap'];
- var ARRAY_REGEXP = /^(HTML\w*Collection|NodeList)$/;
- var testName = function testName(name) {
- return OBJECT_NAMES.indexOf(name) !== -1 || ARRAY_REGEXP.test(name);
- };
- var test = function test(val) {
- return val && val.constructor && val.constructor.name && testName(val.constructor.name);
- }; // Convert array of attribute objects to props object.
- exports.test = test;
- var propsReducer = function propsReducer(props, attribute) {
- props[attribute.name] = attribute.value;
- return props;
- };
- var serialize = function serialize(collection, config, indentation, depth, refs, printer) {
- var name = collection.constructor.name;
- if (++depth > config.maxDepth) {
- return '[' + name + ']';
- }
- return (config.min ? '' : name + SPACE) + (OBJECT_NAMES.indexOf(name) !== -1 ? '{' + (0, _collections.printObjectProperties)(name === 'NamedNodeMap' ? Array.prototype.reduce.call(collection, propsReducer, {}) : _objectSpread({}, collection), config, indentation, depth, refs, printer) + '}' : '[' + (0, _collections.printListItems)(Array.from(collection), config, indentation, depth, refs, printer) + ']');
- };
- exports.serialize = serialize;
- var plugin = {
- serialize: serialize,
- test: test
- };
- var _default = plugin;
- exports.default = _default;
- /***/ }),
- /***/ "./packages/pretty-format/build/plugins/DOMElement.js":
- /*!************************************************************!*\
- !*** ./packages/pretty-format/build/plugins/DOMElement.js ***!
- \************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.default = exports.serialize = exports.test = void 0;
- var _markup = __webpack_require__(/*! ./lib/markup */ "./packages/pretty-format/build/plugins/lib/markup.js");
- /**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
- var ELEMENT_NODE = 1;
- var TEXT_NODE = 3;
- var COMMENT_NODE = 8;
- var FRAGMENT_NODE = 11;
- var ELEMENT_REGEXP = /^((HTML|SVG)\w*)?Element$/;
- var testNode = function testNode(nodeType, name) {
- return nodeType === ELEMENT_NODE && ELEMENT_REGEXP.test(name) || nodeType === TEXT_NODE && name === 'Text' || nodeType === COMMENT_NODE && name === 'Comment' || nodeType === FRAGMENT_NODE && name === 'DocumentFragment';
- };
- var test = function test(val) {
- return val && val.constructor && val.constructor.name && testNode(val.nodeType, val.constructor.name);
- };
- exports.test = test;
- function nodeIsText(node) {
- return node.nodeType === TEXT_NODE;
- }
- function nodeIsComment(node) {
- return node.nodeType === COMMENT_NODE;
- }
- function nodeIsFragment(node) {
- return node.nodeType === FRAGMENT_NODE;
- }
- var serialize = function serialize(node, config, indentation, depth, refs, printer) {
- if (nodeIsText(node)) {
- return (0, _markup.printText)(node.data, config);
- }
- if (nodeIsComment(node)) {
- return (0, _markup.printComment)(node.data, config);
- }
- var type = nodeIsFragment(node) ? "DocumentFragment" : node.tagName.toLowerCase();
- if (++depth > config.maxDepth) {
- return (0, _markup.printElementAsLeaf)(type, config);
- }
- return (0, _markup.printElement)(type, (0, _markup.printProps)(nodeIsFragment(node) ? [] : Array.from(node.attributes).map(function (attr) {
- return attr.name;
- }).sort(), nodeIsFragment(node) ? [] : Array.from(node.attributes).reduce(function (props, attribute) {
- props[attribute.name] = attribute.value;
- return props;
- }, {}), config, indentation + config.indent, depth, refs, printer), (0, _markup.printChildren)(Array.prototype.slice.call(node.childNodes || node.children), config, indentation + config.indent, depth, refs, printer), config, indentation);
- };
- exports.serialize = serialize;
- var plugin = {
- serialize: serialize,
- test: test
- };
- var _default = plugin;
- exports.default = _default;
- /***/ }),
- /***/ "./packages/pretty-format/build/plugins/Immutable.js":
- /*!***********************************************************!*\
- !*** ./packages/pretty-format/build/plugins/Immutable.js ***!
- \***********************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.default = exports.test = exports.serialize = void 0;
- var _collections = __webpack_require__(/*! ../collections */ "./packages/pretty-format/build/collections.js");
- /**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
- // SENTINEL constants are from https://github.com/facebook/immutable-js
- var IS_ITERABLE_SENTINEL = '@@__IMMUTABLE_ITERABLE__@@';
- var IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';
- var IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';
- var IS_MAP_SENTINEL = '@@__IMMUTABLE_MAP__@@';
- var IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';
- var IS_RECORD_SENTINEL = '@@__IMMUTABLE_RECORD__@@'; // immutable v4
- var IS_SEQ_SENTINEL = '@@__IMMUTABLE_SEQ__@@';
- var IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';
- var IS_STACK_SENTINEL = '@@__IMMUTABLE_STACK__@@';
- var getImmutableName = function getImmutableName(name) {
- return 'Immutable.' + name;
- };
- var printAsLeaf = function printAsLeaf(name) {
- return '[' + name + ']';
- };
- var SPACE = ' ';
- var LAZY = '…'; // Seq is lazy if it calls a method like filter
- var printImmutableEntries = function printImmutableEntries(val, config, indentation, depth, refs, printer, type) {
- return ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : getImmutableName(type) + SPACE + '{' + (0, _collections.printIteratorEntries)(val.entries(), config, indentation, depth, refs, printer) + '}';
- }; // Record has an entries method because it is a collection in immutable v3.
- // Return an iterator for Immutable Record from version v3 or v4.
- var getRecordEntries = function getRecordEntries(val) {
- var i = 0;
- return {
- next: function next() {
- if (i < val._keys.length) {
- var key = val._keys[i++];
- return {
- done: false,
- value: [key, val.get(key)]
- };
- }
- return {
- done: true
- };
- }
- };
- };
- var printImmutableRecord = function printImmutableRecord(val, config, indentation, depth, refs, printer) {
- // _name property is defined only for an Immutable Record instance
- // which was constructed with a second optional descriptive name arg
- var name = getImmutableName(val._name || 'Record');
- return ++depth > config.maxDepth ? printAsLeaf(name) : name + SPACE + '{' + (0, _collections.printIteratorEntries)(getRecordEntries(val), config, indentation, depth, refs, printer) + '}';
- };
- var printImmutableSeq = function printImmutableSeq(val, config, indentation, depth, refs, printer) {
- var name = getImmutableName('Seq');
- if (++depth > config.maxDepth) {
- return printAsLeaf(name);
- }
- if (val[IS_KEYED_SENTINEL]) {
- return name + SPACE + '{' + ( // from Immutable collection of entries or from ECMAScript object
- val._iter || val._object ? (0, _collections.printIteratorEntries)(val.entries(), config, indentation, depth, refs, printer) : LAZY) + '}';
- }
- return name + SPACE + '[' + (val._iter || // from Immutable collection of values
- val._array || // from ECMAScript array
- val._collection || // from ECMAScript collection in immutable v4
- val._iterable // from ECMAScript collection in immutable v3
- ? (0, _collections.printIteratorValues)(val.values(), config, indentation, depth, refs, printer) : LAZY) + ']';
- };
- var printImmutableValues = function printImmutableValues(val, config, indentation, depth, refs, printer, type) {
- return ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : getImmutableName(type) + SPACE + '[' + (0, _collections.printIteratorValues)(val.values(), config, indentation, depth, refs, printer) + ']';
- };
- var serialize = function serialize(val, config, indentation, depth, refs, printer) {
- if (val[IS_MAP_SENTINEL]) {
- return printImmutableEntries(val, config, indentation, depth, refs, printer, val[IS_ORDERED_SENTINEL] ? 'OrderedMap' : 'Map');
- }
- if (val[IS_LIST_SENTINEL]) {
- return printImmutableValues(val, config, indentation, depth, refs, printer, 'List');
- }
- if (val[IS_SET_SENTINEL]) {
- return printImmutableValues(val, config, indentation, depth, refs, printer, val[IS_ORDERED_SENTINEL] ? 'OrderedSet' : 'Set');
- }
- if (val[IS_STACK_SENTINEL]) {
- return printImmutableValues(val, config, indentation, depth, refs, printer, 'Stack');
- }
- if (val[IS_SEQ_SENTINEL]) {
- return printImmutableSeq(val, config, indentation, depth, refs, printer);
- } // For compatibility with immutable v3 and v4, let record be the default.
- return printImmutableRecord(val, config, indentation, depth, refs, printer);
- }; // Explicitly comparing sentinel properties to true avoids false positive
- // when mock identity-obj-proxy returns the key as the value for any key.
- exports.serialize = serialize;
- var test = function test(val) {
- return val && (val[IS_ITERABLE_SENTINEL] === true || val[IS_RECORD_SENTINEL] === true);
- };
- exports.test = test;
- var plugin = {
- serialize: serialize,
- test: test
- };
- var _default = plugin;
- exports.default = _default;
- /***/ }),
- /***/ "./packages/pretty-format/build/plugins/ReactElement.js":
- /*!**************************************************************!*\
- !*** ./packages/pretty-format/build/plugins/ReactElement.js ***!
- \**************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.default = exports.test = exports.serialize = void 0;
- var ReactIs = _interopRequireWildcard(__webpack_require__(/*! react-is */ "./node_modules/react-is/index.js"));
- var _markup = __webpack_require__(/*! ./lib/markup */ "./packages/pretty-format/build/plugins/lib/markup.js");
- function _interopRequireWildcard(obj) {
- if (obj && obj.__esModule) {
- return obj;
- } else {
- var newObj = {};
- if (obj != null) {
- for (var key in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
- var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
- if (desc.get || desc.set) {
- Object.defineProperty(newObj, key, desc);
- } else {
- newObj[key] = obj[key];
- }
- }
- }
- }
- newObj.default = obj;
- return newObj;
- }
- }
- /**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
- // Given element.props.children, or subtree during recursive traversal,
- // return flattened array of children.
- var getChildren = function getChildren(arg) {
- var children = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
- if (Array.isArray(arg)) {
- arg.forEach(function (item) {
- getChildren(item, children);
- });
- } else if (arg != null && arg !== false) {
- children.push(arg);
- }
- return children;
- };
- var getType = function getType(element) {
- var type = element.type;
- if (typeof type === 'string') {
- return type;
- }
- if (typeof type === 'function') {
- return type.displayName || type.name || 'Unknown';
- }
- if (ReactIs.isFragment(element)) {
- return 'React.Fragment';
- }
- if (ReactIs.isSuspense(element)) {
- return 'React.Suspense';
- }
- if (_typeof(type) === 'object' && type !== null) {
- if (ReactIs.isContextProvider(element)) {
- return 'Context.Provider';
- }
- if (ReactIs.isContextConsumer(element)) {
- return 'Context.Consumer';
- }
- if (ReactIs.isForwardRef(element)) {
- var functionName = type.render.displayName || type.render.name || '';
- return functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef';
- }
- if (ReactIs.isMemo(type)) {
- var _functionName = type.displayName || type.type.displayName || type.type.name || '';
- return _functionName !== '' ? 'Memo(' + _functionName + ')' : 'Memo';
- }
- }
- return 'UNDEFINED';
- };
- var getPropKeys = function getPropKeys(element) {
- var props = element.props;
- return Object.keys(props).filter(function (key) {
- return key !== 'children' && props[key] !== undefined;
- }).sort();
- };
- var serialize = function serialize(element, config, indentation, depth, refs, printer) {
- return ++depth > config.maxDepth ? (0, _markup.printElementAsLeaf)(getType(element), config) : (0, _markup.printElement)(getType(element), (0, _markup.printProps)(getPropKeys(element), element.props, config, indentation + config.indent, depth, refs, printer), (0, _markup.printChildren)(getChildren(element.props.children), config, indentation + config.indent, depth, refs, printer), config, indentation);
- };
- exports.serialize = serialize;
- var test = function test(val) {
- return val && ReactIs.isElement(val);
- };
- exports.test = test;
- var plugin = {
- serialize: serialize,
- test: test
- };
- var _default = plugin;
- exports.default = _default;
- /***/ }),
- /***/ "./packages/pretty-format/build/plugins/ReactTestComponent.js":
- /*!********************************************************************!*\
- !*** ./packages/pretty-format/build/plugins/ReactTestComponent.js ***!
- \********************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- /* WEBPACK VAR INJECTION */(function(global) {
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.default = exports.test = exports.serialize = void 0;
- var _markup = __webpack_require__(/*! ./lib/markup */ "./packages/pretty-format/build/plugins/lib/markup.js");
- var _Symbol = global['jest-symbol-do-not-touch'] || global.Symbol;
- var testSymbol = _Symbol.for('react.test.json');
- var getPropKeys = function getPropKeys(object) {
- var props = object.props;
- return props ? Object.keys(props).filter(function (key) {
- return props[key] !== undefined;
- }).sort() : [];
- };
- var serialize = function serialize(object, config, indentation, depth, refs, printer) {
- return ++depth > config.maxDepth ? (0, _markup.printElementAsLeaf)(object.type, config) : (0, _markup.printElement)(object.type, object.props ? (0, _markup.printProps)(getPropKeys(object), object.props, config, indentation + config.indent, depth, refs, printer) : '', object.children ? (0, _markup.printChildren)(object.children, config, indentation + config.indent, depth, refs, printer) : '', config, indentation);
- };
- exports.serialize = serialize;
- var test = function test(val) {
- return val && val.$$typeof === testSymbol;
- };
- exports.test = test;
- var plugin = {
- serialize: serialize,
- test: test
- };
- var _default = plugin;
- exports.default = _default;
- /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
- /***/ }),
- /***/ "./packages/pretty-format/build/plugins/lib/escapeHTML.js":
- /*!****************************************************************!*\
- !*** ./packages/pretty-format/build/plugins/lib/escapeHTML.js ***!
- \****************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.default = escapeHTML;
- /**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
- function escapeHTML(str) {
- return str.replace(/</g, '<').replace(/>/g, '>');
- }
- /***/ }),
- /***/ "./packages/pretty-format/build/plugins/lib/markup.js":
- /*!************************************************************!*\
- !*** ./packages/pretty-format/build/plugins/lib/markup.js ***!
- \************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- Object.defineProperty(exports, '__esModule', {
- value: true
- });
- exports.printElementAsLeaf = exports.printElement = exports.printComment = exports.printText = exports.printChildren = exports.printProps = void 0;
- var _escapeHTML = _interopRequireDefault(__webpack_require__(/*! ./escapeHTML */ "./packages/pretty-format/build/plugins/lib/escapeHTML.js"));
- function _interopRequireDefault(obj) {
- return obj && obj.__esModule ? obj : {
- default: obj
- };
- }
- /**
- * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE file in the root directory of this source tree.
- */
- // Return empty string if keys is empty.
- var printProps = function printProps(keys, props, config, indentation, depth, refs, printer) {
- var indentationNext = indentation + config.indent;
- var colors = config.colors;
- return keys.map(function (key) {
- var value = props[key];
- var printed = printer(value, config, indentationNext, depth, refs);
- if (typeof value !== 'string') {
- if (printed.indexOf('\n') !== -1) {
- printed = config.spacingOuter + indentationNext + printed + config.spacingOuter + indentation;
- }
- printed = '{' + printed + '}';
- }
- return config.spacingInner + indentation + colors.prop.open + key + colors.prop.close + '=' + colors.value.open + printed + colors.value.close;
- }).join('');
- }; // Return empty string if children is empty.
- exports.printProps = printProps;
- var printChildren = function printChildren(children, config, indentation, depth, refs, printer) {
- return children.map(function (child) {
- return config.spacingOuter + indentation + (typeof child === 'string' ? printText(child, config) : printer(child, config, indentation, depth, refs));
- }).join('');
- };
- exports.printChildren = printChildren;
- var printText = function printText(text, config) {
- var contentColor = config.colors.content;
- return contentColor.open + (0, _escapeHTML.default)(text) + contentColor.close;
- };
- exports.printText = printText;
- var printComment = function printComment(comment, config) {
- var commentColor = config.colors.comment;
- return commentColor.open + '<!--' + (0, _escapeHTML.default)(comment) + '-->' + commentColor.close;
- }; // Separate the functions to format props, children, and element,
- // so a plugin could override a particular function, if needed.
- // Too bad, so sad: the traditional (but unnecessary) space
- // in a self-closing tagColor requires a second test of printedProps.
- exports.printComment = printComment;
- var printElement = function printElement(type, printedProps, printedChildren, config, indentation) {
- var tagColor = config.colors.tag;
- return tagColor.open + '<' + type + (printedProps && tagColor.close + printedProps + config.spacingOuter + indentation + tagColor.open) + (printedChildren ? '>' + tagColor.close + printedChildren + config.spacingOuter + indentation + tagColor.open + '</' + type : (printedProps && !config.min ? '' : ' ') + '/') + '>' + tagColor.close;
- };
- exports.printElement = printElement;
- var printElementAsLeaf = function printElementAsLeaf(type, config) {
- var tagColor = config.colors.tag;
- return tagColor.open + '<' + type + tagColor.close + ' …' + tagColor.open + ' />' + tagColor.close;
- };
- exports.printElementAsLeaf = printElementAsLeaf;
- /***/ })
- /******/ });
- });
- //# sourceMappingURL=index.js.map
|