535.index.js 556 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854
  1. exports.id = 535;
  2. exports.ids = [535];
  3. exports.modules = {
  4. /***/ 60350:
  5. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  6. const {isString, getType, isPlainObject, isArrayOf, map} = __webpack_require__(74094)
  7. const isArray = Array.isArray
  8. const filter = name => !(/.+(Sync|Stream|Promise)$/.test(name))
  9. /**
  10. * Promisify Node.js callback-style function
  11. *
  12. * @param {function} target – a callback-style function
  13. * @param {any} [ctx = null]
  14. *
  15. * @return {function} - promised function
  16. *
  17. * @example
  18. *
  19. * import fs from "fs"
  20. *
  21. * const readFile = promisify(fs.readFile)
  22. *
  23. * const onFulfilled = content => console.log(String(content))
  24. *
  25. * const onRejected = err => console.error(err)
  26. *
  27. * readFile(__filename).then(onFulfilled, onRejected)
  28. */
  29. function promisify(target, ctx = null) {
  30. if (typeof target !== "function") {
  31. throw TypeError(
  32. `Expected target function. Received ${getType(target)}`
  33. )
  34. }
  35. return function(...args) {
  36. ctx || (ctx = this)
  37. return new Promise((resolve, reject) => {
  38. const fulfill = (err, res) => err ? reject(err) : resolve(res)
  39. target.call(ctx, ...args, fulfill)
  40. })
  41. }
  42. }
  43. /**
  44. * Promisify all given methods
  45. *
  46. * @param {object} targets - object with the pairs of name => target
  47. * @param {any} [ctx = null]
  48. *
  49. * @return {object}
  50. */
  51. function all(targets, ctx) {
  52. if (!isPlainObject(targets)) {
  53. throw new TypeError(
  54. `Expected a plain object as targets. Received ${getType(targets)}`
  55. )
  56. }
  57. return map(targets, (fn, name) => filter(name) ? promisify(fn, ctx) : fn)
  58. }
  59. /**
  60. * @param {object} targets
  61. * @param {string[]} list
  62. * @param {any} [ctx = null]
  63. *
  64. * @return {object}
  65. */
  66. function some(targets, list, ctx) {
  67. if (!isPlainObject(targets)) {
  68. throw new TypeError(
  69. `Expected a plain object as targets. Received ${getType(targets)}`
  70. )
  71. }
  72. if (!isArray(list)) {
  73. throw new TypeError(`Expected list as an array. Received ${getType(list)}`)
  74. }
  75. if (!isArrayOf(list, isString)) {
  76. throw new TypeError("Each element in the list should be a string.")
  77. }
  78. return map(
  79. targets, (fn, name) => (
  80. filter(name) && list.includes(name) ? promisify(fn, ctx) : fn
  81. )
  82. )
  83. }
  84. /**
  85. * @param {object} targets
  86. * @param {string[]} list
  87. * @param {any} [ctx = null]
  88. *
  89. * @return {object}
  90. */
  91. function except(targets, list, ctx) {
  92. if (!isPlainObject(targets)) {
  93. throw new TypeError(
  94. `Expected a plain object as targets. Received ${getType(targets)}`
  95. )
  96. }
  97. if (!isArray(list)) {
  98. throw new TypeError(`Expected list as an array. Received ${getType(list)}`)
  99. }
  100. if (!isArrayOf(list, isString)) {
  101. throw new TypeError("Each element in the list should be a string.")
  102. }
  103. return map(
  104. targets, (fn, name) => (
  105. filter(name) && !(list.includes(name)) ? promisify(fn, ctx) : fn
  106. )
  107. )
  108. }
  109. module.exports = promisify
  110. module.exports.default = promisify
  111. module.exports.all = all
  112. module.exports.some = some
  113. module.exports.except = except
  114. /***/ }),
  115. /***/ 74094:
  116. /***/ ((module) => {
  117. const keys = Object.keys
  118. const toString = val => Object.prototype.toString.call(val)
  119. const getType = val => toString(val).slice(8, -1).toLowerCase()
  120. const isString = val => typeof val === "string" || getType(val) === "string"
  121. // Based ob lodash/isPlainObject
  122. function isPlainObject(val) {
  123. if (getType(val) !== "object") {
  124. return false
  125. }
  126. const pp = Object.getPrototypeOf(val)
  127. if (pp === null || pp === void 0) {
  128. return true
  129. }
  130. const Ctor = pp.constructor && pp.constructor.toString()
  131. return Ctor === Object.toString()
  132. }
  133. function isArrayOf(arr, predicate, ctx = null) {
  134. for (const [key, val] of arr.entries()) {
  135. if (predicate.call(ctx, val, key, arr) === false) {
  136. return false
  137. }
  138. }
  139. return true
  140. }
  141. function map(obj, fn) {
  142. const res = {}
  143. for (const key of keys(obj)) {
  144. const val = obj[key]
  145. res[key] = fn(val, key, obj)
  146. }
  147. return res
  148. }
  149. module.exports = {isArrayOf, getType, isString, isPlainObject, map}
  150. /***/ }),
  151. /***/ 83999:
  152. /***/ ((__unused_webpack_module, exports) => {
  153. "use strict";
  154. var tester = /^[-!#$%&'*+\/0-9=?A-Z^_a-z{|}~](\.?[-!#$%&'*+\/0-9=?A-Z^_a-z`{|}~])*@[a-zA-Z0-9](-*\.?[a-zA-Z0-9])*\.[a-zA-Z](-?[a-zA-Z0-9])+$/;
  155. // Thanks to:
  156. // http://fightingforalostcause.net/misc/2006/compare-email-regex.php
  157. // http://thedailywtf.com/Articles/Validating_Email_Addresses.aspx
  158. // http://stackoverflow.com/questions/201323/what-is-the-best-regular-expression-for-validating-email-addresses/201378#201378
  159. exports.validate = function(email)
  160. {
  161. if (!email)
  162. return false;
  163. if(email.length>254)
  164. return false;
  165. var valid = tester.test(email);
  166. if(!valid)
  167. return false;
  168. // Further checking of some things regex can't handle
  169. var parts = email.split("@");
  170. if(parts[0].length>64)
  171. return false;
  172. var domainParts = parts[1].split(".");
  173. if(domainParts.some(function(part) { return part.length>63; }))
  174. return false;
  175. return true;
  176. }
  177. /***/ }),
  178. /***/ 31072:
  179. /***/ (function(module) {
  180. (function webpackUniversalModuleDefinition(root, factory) {
  181. /* istanbul ignore next */
  182. if(true)
  183. module.exports = factory();
  184. else {}
  185. })(this, function() {
  186. return /******/ (function(modules) { // webpackBootstrap
  187. /******/ // The module cache
  188. /******/ var installedModules = {};
  189. /******/ // The require function
  190. /******/ function __nested_webpack_require_583__(moduleId) {
  191. /******/ // Check if module is in cache
  192. /* istanbul ignore if */
  193. /******/ if(installedModules[moduleId])
  194. /******/ return installedModules[moduleId].exports;
  195. /******/ // Create a new module (and put it into the cache)
  196. /******/ var module = installedModules[moduleId] = {
  197. /******/ exports: {},
  198. /******/ id: moduleId,
  199. /******/ loaded: false
  200. /******/ };
  201. /******/ // Execute the module function
  202. /******/ modules[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_583__);
  203. /******/ // Flag the module as loaded
  204. /******/ module.loaded = true;
  205. /******/ // Return the exports of the module
  206. /******/ return module.exports;
  207. /******/ }
  208. /******/ // expose the modules object (__webpack_modules__)
  209. /******/ __nested_webpack_require_583__.m = modules;
  210. /******/ // expose the module cache
  211. /******/ __nested_webpack_require_583__.c = installedModules;
  212. /******/ // __webpack_public_path__
  213. /******/ __nested_webpack_require_583__.p = "";
  214. /******/ // Load entry module and return exports
  215. /******/ return __nested_webpack_require_583__(0);
  216. /******/ })
  217. /************************************************************************/
  218. /******/ ([
  219. /* 0 */
  220. /***/ function(module, exports, __nested_webpack_require_1808__) {
  221. "use strict";
  222. /*
  223. Copyright JS Foundation and other contributors, https://js.foundation/
  224. Redistribution and use in source and binary forms, with or without
  225. modification, are permitted provided that the following conditions are met:
  226. * Redistributions of source code must retain the above copyright
  227. notice, this list of conditions and the following disclaimer.
  228. * Redistributions in binary form must reproduce the above copyright
  229. notice, this list of conditions and the following disclaimer in the
  230. documentation and/or other materials provided with the distribution.
  231. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  232. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  233. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  234. ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  235. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  236. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  237. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  238. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  239. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  240. THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  241. */
  242. Object.defineProperty(exports, "__esModule", { value: true });
  243. var comment_handler_1 = __nested_webpack_require_1808__(1);
  244. var jsx_parser_1 = __nested_webpack_require_1808__(3);
  245. var parser_1 = __nested_webpack_require_1808__(8);
  246. var tokenizer_1 = __nested_webpack_require_1808__(15);
  247. function parse(code, options, delegate) {
  248. var commentHandler = null;
  249. var proxyDelegate = function (node, metadata) {
  250. if (delegate) {
  251. delegate(node, metadata);
  252. }
  253. if (commentHandler) {
  254. commentHandler.visit(node, metadata);
  255. }
  256. };
  257. var parserDelegate = (typeof delegate === 'function') ? proxyDelegate : null;
  258. var collectComment = false;
  259. if (options) {
  260. collectComment = (typeof options.comment === 'boolean' && options.comment);
  261. var attachComment = (typeof options.attachComment === 'boolean' && options.attachComment);
  262. if (collectComment || attachComment) {
  263. commentHandler = new comment_handler_1.CommentHandler();
  264. commentHandler.attach = attachComment;
  265. options.comment = true;
  266. parserDelegate = proxyDelegate;
  267. }
  268. }
  269. var isModule = false;
  270. if (options && typeof options.sourceType === 'string') {
  271. isModule = (options.sourceType === 'module');
  272. }
  273. var parser;
  274. if (options && typeof options.jsx === 'boolean' && options.jsx) {
  275. parser = new jsx_parser_1.JSXParser(code, options, parserDelegate);
  276. }
  277. else {
  278. parser = new parser_1.Parser(code, options, parserDelegate);
  279. }
  280. var program = isModule ? parser.parseModule() : parser.parseScript();
  281. var ast = program;
  282. if (collectComment && commentHandler) {
  283. ast.comments = commentHandler.comments;
  284. }
  285. if (parser.config.tokens) {
  286. ast.tokens = parser.tokens;
  287. }
  288. if (parser.config.tolerant) {
  289. ast.errors = parser.errorHandler.errors;
  290. }
  291. return ast;
  292. }
  293. exports.parse = parse;
  294. function parseModule(code, options, delegate) {
  295. var parsingOptions = options || {};
  296. parsingOptions.sourceType = 'module';
  297. return parse(code, parsingOptions, delegate);
  298. }
  299. exports.parseModule = parseModule;
  300. function parseScript(code, options, delegate) {
  301. var parsingOptions = options || {};
  302. parsingOptions.sourceType = 'script';
  303. return parse(code, parsingOptions, delegate);
  304. }
  305. exports.parseScript = parseScript;
  306. function tokenize(code, options, delegate) {
  307. var tokenizer = new tokenizer_1.Tokenizer(code, options);
  308. var tokens;
  309. tokens = [];
  310. try {
  311. while (true) {
  312. var token = tokenizer.getNextToken();
  313. if (!token) {
  314. break;
  315. }
  316. if (delegate) {
  317. token = delegate(token);
  318. }
  319. tokens.push(token);
  320. }
  321. }
  322. catch (e) {
  323. tokenizer.errorHandler.tolerate(e);
  324. }
  325. if (tokenizer.errorHandler.tolerant) {
  326. tokens.errors = tokenizer.errors();
  327. }
  328. return tokens;
  329. }
  330. exports.tokenize = tokenize;
  331. var syntax_1 = __nested_webpack_require_1808__(2);
  332. exports.Syntax = syntax_1.Syntax;
  333. // Sync with *.json manifests.
  334. exports.version = '4.0.1';
  335. /***/ },
  336. /* 1 */
  337. /***/ function(module, exports, __nested_webpack_require_6456__) {
  338. "use strict";
  339. Object.defineProperty(exports, "__esModule", { value: true });
  340. var syntax_1 = __nested_webpack_require_6456__(2);
  341. var CommentHandler = (function () {
  342. function CommentHandler() {
  343. this.attach = false;
  344. this.comments = [];
  345. this.stack = [];
  346. this.leading = [];
  347. this.trailing = [];
  348. }
  349. CommentHandler.prototype.insertInnerComments = function (node, metadata) {
  350. // innnerComments for properties empty block
  351. // `function a() {/** comments **\/}`
  352. if (node.type === syntax_1.Syntax.BlockStatement && node.body.length === 0) {
  353. var innerComments = [];
  354. for (var i = this.leading.length - 1; i >= 0; --i) {
  355. var entry = this.leading[i];
  356. if (metadata.end.offset >= entry.start) {
  357. innerComments.unshift(entry.comment);
  358. this.leading.splice(i, 1);
  359. this.trailing.splice(i, 1);
  360. }
  361. }
  362. if (innerComments.length) {
  363. node.innerComments = innerComments;
  364. }
  365. }
  366. };
  367. CommentHandler.prototype.findTrailingComments = function (metadata) {
  368. var trailingComments = [];
  369. if (this.trailing.length > 0) {
  370. for (var i = this.trailing.length - 1; i >= 0; --i) {
  371. var entry_1 = this.trailing[i];
  372. if (entry_1.start >= metadata.end.offset) {
  373. trailingComments.unshift(entry_1.comment);
  374. }
  375. }
  376. this.trailing.length = 0;
  377. return trailingComments;
  378. }
  379. var entry = this.stack[this.stack.length - 1];
  380. if (entry && entry.node.trailingComments) {
  381. var firstComment = entry.node.trailingComments[0];
  382. if (firstComment && firstComment.range[0] >= metadata.end.offset) {
  383. trailingComments = entry.node.trailingComments;
  384. delete entry.node.trailingComments;
  385. }
  386. }
  387. return trailingComments;
  388. };
  389. CommentHandler.prototype.findLeadingComments = function (metadata) {
  390. var leadingComments = [];
  391. var target;
  392. while (this.stack.length > 0) {
  393. var entry = this.stack[this.stack.length - 1];
  394. if (entry && entry.start >= metadata.start.offset) {
  395. target = entry.node;
  396. this.stack.pop();
  397. }
  398. else {
  399. break;
  400. }
  401. }
  402. if (target) {
  403. var count = target.leadingComments ? target.leadingComments.length : 0;
  404. for (var i = count - 1; i >= 0; --i) {
  405. var comment = target.leadingComments[i];
  406. if (comment.range[1] <= metadata.start.offset) {
  407. leadingComments.unshift(comment);
  408. target.leadingComments.splice(i, 1);
  409. }
  410. }
  411. if (target.leadingComments && target.leadingComments.length === 0) {
  412. delete target.leadingComments;
  413. }
  414. return leadingComments;
  415. }
  416. for (var i = this.leading.length - 1; i >= 0; --i) {
  417. var entry = this.leading[i];
  418. if (entry.start <= metadata.start.offset) {
  419. leadingComments.unshift(entry.comment);
  420. this.leading.splice(i, 1);
  421. }
  422. }
  423. return leadingComments;
  424. };
  425. CommentHandler.prototype.visitNode = function (node, metadata) {
  426. if (node.type === syntax_1.Syntax.Program && node.body.length > 0) {
  427. return;
  428. }
  429. this.insertInnerComments(node, metadata);
  430. var trailingComments = this.findTrailingComments(metadata);
  431. var leadingComments = this.findLeadingComments(metadata);
  432. if (leadingComments.length > 0) {
  433. node.leadingComments = leadingComments;
  434. }
  435. if (trailingComments.length > 0) {
  436. node.trailingComments = trailingComments;
  437. }
  438. this.stack.push({
  439. node: node,
  440. start: metadata.start.offset
  441. });
  442. };
  443. CommentHandler.prototype.visitComment = function (node, metadata) {
  444. var type = (node.type[0] === 'L') ? 'Line' : 'Block';
  445. var comment = {
  446. type: type,
  447. value: node.value
  448. };
  449. if (node.range) {
  450. comment.range = node.range;
  451. }
  452. if (node.loc) {
  453. comment.loc = node.loc;
  454. }
  455. this.comments.push(comment);
  456. if (this.attach) {
  457. var entry = {
  458. comment: {
  459. type: type,
  460. value: node.value,
  461. range: [metadata.start.offset, metadata.end.offset]
  462. },
  463. start: metadata.start.offset
  464. };
  465. if (node.loc) {
  466. entry.comment.loc = node.loc;
  467. }
  468. node.type = type;
  469. this.leading.push(entry);
  470. this.trailing.push(entry);
  471. }
  472. };
  473. CommentHandler.prototype.visit = function (node, metadata) {
  474. if (node.type === 'LineComment') {
  475. this.visitComment(node, metadata);
  476. }
  477. else if (node.type === 'BlockComment') {
  478. this.visitComment(node, metadata);
  479. }
  480. else if (this.attach) {
  481. this.visitNode(node, metadata);
  482. }
  483. };
  484. return CommentHandler;
  485. }());
  486. exports.CommentHandler = CommentHandler;
  487. /***/ },
  488. /* 2 */
  489. /***/ function(module, exports) {
  490. "use strict";
  491. Object.defineProperty(exports, "__esModule", { value: true });
  492. exports.Syntax = {
  493. AssignmentExpression: 'AssignmentExpression',
  494. AssignmentPattern: 'AssignmentPattern',
  495. ArrayExpression: 'ArrayExpression',
  496. ArrayPattern: 'ArrayPattern',
  497. ArrowFunctionExpression: 'ArrowFunctionExpression',
  498. AwaitExpression: 'AwaitExpression',
  499. BlockStatement: 'BlockStatement',
  500. BinaryExpression: 'BinaryExpression',
  501. BreakStatement: 'BreakStatement',
  502. CallExpression: 'CallExpression',
  503. CatchClause: 'CatchClause',
  504. ClassBody: 'ClassBody',
  505. ClassDeclaration: 'ClassDeclaration',
  506. ClassExpression: 'ClassExpression',
  507. ConditionalExpression: 'ConditionalExpression',
  508. ContinueStatement: 'ContinueStatement',
  509. DoWhileStatement: 'DoWhileStatement',
  510. DebuggerStatement: 'DebuggerStatement',
  511. EmptyStatement: 'EmptyStatement',
  512. ExportAllDeclaration: 'ExportAllDeclaration',
  513. ExportDefaultDeclaration: 'ExportDefaultDeclaration',
  514. ExportNamedDeclaration: 'ExportNamedDeclaration',
  515. ExportSpecifier: 'ExportSpecifier',
  516. ExpressionStatement: 'ExpressionStatement',
  517. ForStatement: 'ForStatement',
  518. ForOfStatement: 'ForOfStatement',
  519. ForInStatement: 'ForInStatement',
  520. FunctionDeclaration: 'FunctionDeclaration',
  521. FunctionExpression: 'FunctionExpression',
  522. Identifier: 'Identifier',
  523. IfStatement: 'IfStatement',
  524. ImportDeclaration: 'ImportDeclaration',
  525. ImportDefaultSpecifier: 'ImportDefaultSpecifier',
  526. ImportNamespaceSpecifier: 'ImportNamespaceSpecifier',
  527. ImportSpecifier: 'ImportSpecifier',
  528. Literal: 'Literal',
  529. LabeledStatement: 'LabeledStatement',
  530. LogicalExpression: 'LogicalExpression',
  531. MemberExpression: 'MemberExpression',
  532. MetaProperty: 'MetaProperty',
  533. MethodDefinition: 'MethodDefinition',
  534. NewExpression: 'NewExpression',
  535. ObjectExpression: 'ObjectExpression',
  536. ObjectPattern: 'ObjectPattern',
  537. Program: 'Program',
  538. Property: 'Property',
  539. RestElement: 'RestElement',
  540. ReturnStatement: 'ReturnStatement',
  541. SequenceExpression: 'SequenceExpression',
  542. SpreadElement: 'SpreadElement',
  543. Super: 'Super',
  544. SwitchCase: 'SwitchCase',
  545. SwitchStatement: 'SwitchStatement',
  546. TaggedTemplateExpression: 'TaggedTemplateExpression',
  547. TemplateElement: 'TemplateElement',
  548. TemplateLiteral: 'TemplateLiteral',
  549. ThisExpression: 'ThisExpression',
  550. ThrowStatement: 'ThrowStatement',
  551. TryStatement: 'TryStatement',
  552. UnaryExpression: 'UnaryExpression',
  553. UpdateExpression: 'UpdateExpression',
  554. VariableDeclaration: 'VariableDeclaration',
  555. VariableDeclarator: 'VariableDeclarator',
  556. WhileStatement: 'WhileStatement',
  557. WithStatement: 'WithStatement',
  558. YieldExpression: 'YieldExpression'
  559. };
  560. /***/ },
  561. /* 3 */
  562. /***/ function(module, exports, __nested_webpack_require_15019__) {
  563. "use strict";
  564. /* istanbul ignore next */
  565. var __extends = (this && this.__extends) || (function () {
  566. var extendStatics = Object.setPrototypeOf ||
  567. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  568. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  569. return function (d, b) {
  570. extendStatics(d, b);
  571. function __() { this.constructor = d; }
  572. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  573. };
  574. })();
  575. Object.defineProperty(exports, "__esModule", { value: true });
  576. var character_1 = __nested_webpack_require_15019__(4);
  577. var JSXNode = __nested_webpack_require_15019__(5);
  578. var jsx_syntax_1 = __nested_webpack_require_15019__(6);
  579. var Node = __nested_webpack_require_15019__(7);
  580. var parser_1 = __nested_webpack_require_15019__(8);
  581. var token_1 = __nested_webpack_require_15019__(13);
  582. var xhtml_entities_1 = __nested_webpack_require_15019__(14);
  583. token_1.TokenName[100 /* Identifier */] = 'JSXIdentifier';
  584. token_1.TokenName[101 /* Text */] = 'JSXText';
  585. // Fully qualified element name, e.g. <svg:path> returns "svg:path"
  586. function getQualifiedElementName(elementName) {
  587. var qualifiedName;
  588. switch (elementName.type) {
  589. case jsx_syntax_1.JSXSyntax.JSXIdentifier:
  590. var id = elementName;
  591. qualifiedName = id.name;
  592. break;
  593. case jsx_syntax_1.JSXSyntax.JSXNamespacedName:
  594. var ns = elementName;
  595. qualifiedName = getQualifiedElementName(ns.namespace) + ':' +
  596. getQualifiedElementName(ns.name);
  597. break;
  598. case jsx_syntax_1.JSXSyntax.JSXMemberExpression:
  599. var expr = elementName;
  600. qualifiedName = getQualifiedElementName(expr.object) + '.' +
  601. getQualifiedElementName(expr.property);
  602. break;
  603. /* istanbul ignore next */
  604. default:
  605. break;
  606. }
  607. return qualifiedName;
  608. }
  609. var JSXParser = (function (_super) {
  610. __extends(JSXParser, _super);
  611. function JSXParser(code, options, delegate) {
  612. return _super.call(this, code, options, delegate) || this;
  613. }
  614. JSXParser.prototype.parsePrimaryExpression = function () {
  615. return this.match('<') ? this.parseJSXRoot() : _super.prototype.parsePrimaryExpression.call(this);
  616. };
  617. JSXParser.prototype.startJSX = function () {
  618. // Unwind the scanner before the lookahead token.
  619. this.scanner.index = this.startMarker.index;
  620. this.scanner.lineNumber = this.startMarker.line;
  621. this.scanner.lineStart = this.startMarker.index - this.startMarker.column;
  622. };
  623. JSXParser.prototype.finishJSX = function () {
  624. // Prime the next lookahead.
  625. this.nextToken();
  626. };
  627. JSXParser.prototype.reenterJSX = function () {
  628. this.startJSX();
  629. this.expectJSX('}');
  630. // Pop the closing '}' added from the lookahead.
  631. if (this.config.tokens) {
  632. this.tokens.pop();
  633. }
  634. };
  635. JSXParser.prototype.createJSXNode = function () {
  636. this.collectComments();
  637. return {
  638. index: this.scanner.index,
  639. line: this.scanner.lineNumber,
  640. column: this.scanner.index - this.scanner.lineStart
  641. };
  642. };
  643. JSXParser.prototype.createJSXChildNode = function () {
  644. return {
  645. index: this.scanner.index,
  646. line: this.scanner.lineNumber,
  647. column: this.scanner.index - this.scanner.lineStart
  648. };
  649. };
  650. JSXParser.prototype.scanXHTMLEntity = function (quote) {
  651. var result = '&';
  652. var valid = true;
  653. var terminated = false;
  654. var numeric = false;
  655. var hex = false;
  656. while (!this.scanner.eof() && valid && !terminated) {
  657. var ch = this.scanner.source[this.scanner.index];
  658. if (ch === quote) {
  659. break;
  660. }
  661. terminated = (ch === ';');
  662. result += ch;
  663. ++this.scanner.index;
  664. if (!terminated) {
  665. switch (result.length) {
  666. case 2:
  667. // e.g. '&#123;'
  668. numeric = (ch === '#');
  669. break;
  670. case 3:
  671. if (numeric) {
  672. // e.g. '&#x41;'
  673. hex = (ch === 'x');
  674. valid = hex || character_1.Character.isDecimalDigit(ch.charCodeAt(0));
  675. numeric = numeric && !hex;
  676. }
  677. break;
  678. default:
  679. valid = valid && !(numeric && !character_1.Character.isDecimalDigit(ch.charCodeAt(0)));
  680. valid = valid && !(hex && !character_1.Character.isHexDigit(ch.charCodeAt(0)));
  681. break;
  682. }
  683. }
  684. }
  685. if (valid && terminated && result.length > 2) {
  686. // e.g. '&#x41;' becomes just '#x41'
  687. var str = result.substr(1, result.length - 2);
  688. if (numeric && str.length > 1) {
  689. result = String.fromCharCode(parseInt(str.substr(1), 10));
  690. }
  691. else if (hex && str.length > 2) {
  692. result = String.fromCharCode(parseInt('0' + str.substr(1), 16));
  693. }
  694. else if (!numeric && !hex && xhtml_entities_1.XHTMLEntities[str]) {
  695. result = xhtml_entities_1.XHTMLEntities[str];
  696. }
  697. }
  698. return result;
  699. };
  700. // Scan the next JSX token. This replaces Scanner#lex when in JSX mode.
  701. JSXParser.prototype.lexJSX = function () {
  702. var cp = this.scanner.source.charCodeAt(this.scanner.index);
  703. // < > / : = { }
  704. if (cp === 60 || cp === 62 || cp === 47 || cp === 58 || cp === 61 || cp === 123 || cp === 125) {
  705. var value = this.scanner.source[this.scanner.index++];
  706. return {
  707. type: 7 /* Punctuator */,
  708. value: value,
  709. lineNumber: this.scanner.lineNumber,
  710. lineStart: this.scanner.lineStart,
  711. start: this.scanner.index - 1,
  712. end: this.scanner.index
  713. };
  714. }
  715. // " '
  716. if (cp === 34 || cp === 39) {
  717. var start = this.scanner.index;
  718. var quote = this.scanner.source[this.scanner.index++];
  719. var str = '';
  720. while (!this.scanner.eof()) {
  721. var ch = this.scanner.source[this.scanner.index++];
  722. if (ch === quote) {
  723. break;
  724. }
  725. else if (ch === '&') {
  726. str += this.scanXHTMLEntity(quote);
  727. }
  728. else {
  729. str += ch;
  730. }
  731. }
  732. return {
  733. type: 8 /* StringLiteral */,
  734. value: str,
  735. lineNumber: this.scanner.lineNumber,
  736. lineStart: this.scanner.lineStart,
  737. start: start,
  738. end: this.scanner.index
  739. };
  740. }
  741. // ... or .
  742. if (cp === 46) {
  743. var n1 = this.scanner.source.charCodeAt(this.scanner.index + 1);
  744. var n2 = this.scanner.source.charCodeAt(this.scanner.index + 2);
  745. var value = (n1 === 46 && n2 === 46) ? '...' : '.';
  746. var start = this.scanner.index;
  747. this.scanner.index += value.length;
  748. return {
  749. type: 7 /* Punctuator */,
  750. value: value,
  751. lineNumber: this.scanner.lineNumber,
  752. lineStart: this.scanner.lineStart,
  753. start: start,
  754. end: this.scanner.index
  755. };
  756. }
  757. // `
  758. if (cp === 96) {
  759. // Only placeholder, since it will be rescanned as a real assignment expression.
  760. return {
  761. type: 10 /* Template */,
  762. value: '',
  763. lineNumber: this.scanner.lineNumber,
  764. lineStart: this.scanner.lineStart,
  765. start: this.scanner.index,
  766. end: this.scanner.index
  767. };
  768. }
  769. // Identifer can not contain backslash (char code 92).
  770. if (character_1.Character.isIdentifierStart(cp) && (cp !== 92)) {
  771. var start = this.scanner.index;
  772. ++this.scanner.index;
  773. while (!this.scanner.eof()) {
  774. var ch = this.scanner.source.charCodeAt(this.scanner.index);
  775. if (character_1.Character.isIdentifierPart(ch) && (ch !== 92)) {
  776. ++this.scanner.index;
  777. }
  778. else if (ch === 45) {
  779. // Hyphen (char code 45) can be part of an identifier.
  780. ++this.scanner.index;
  781. }
  782. else {
  783. break;
  784. }
  785. }
  786. var id = this.scanner.source.slice(start, this.scanner.index);
  787. return {
  788. type: 100 /* Identifier */,
  789. value: id,
  790. lineNumber: this.scanner.lineNumber,
  791. lineStart: this.scanner.lineStart,
  792. start: start,
  793. end: this.scanner.index
  794. };
  795. }
  796. return this.scanner.lex();
  797. };
  798. JSXParser.prototype.nextJSXToken = function () {
  799. this.collectComments();
  800. this.startMarker.index = this.scanner.index;
  801. this.startMarker.line = this.scanner.lineNumber;
  802. this.startMarker.column = this.scanner.index - this.scanner.lineStart;
  803. var token = this.lexJSX();
  804. this.lastMarker.index = this.scanner.index;
  805. this.lastMarker.line = this.scanner.lineNumber;
  806. this.lastMarker.column = this.scanner.index - this.scanner.lineStart;
  807. if (this.config.tokens) {
  808. this.tokens.push(this.convertToken(token));
  809. }
  810. return token;
  811. };
  812. JSXParser.prototype.nextJSXText = function () {
  813. this.startMarker.index = this.scanner.index;
  814. this.startMarker.line = this.scanner.lineNumber;
  815. this.startMarker.column = this.scanner.index - this.scanner.lineStart;
  816. var start = this.scanner.index;
  817. var text = '';
  818. while (!this.scanner.eof()) {
  819. var ch = this.scanner.source[this.scanner.index];
  820. if (ch === '{' || ch === '<') {
  821. break;
  822. }
  823. ++this.scanner.index;
  824. text += ch;
  825. if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
  826. ++this.scanner.lineNumber;
  827. if (ch === '\r' && this.scanner.source[this.scanner.index] === '\n') {
  828. ++this.scanner.index;
  829. }
  830. this.scanner.lineStart = this.scanner.index;
  831. }
  832. }
  833. this.lastMarker.index = this.scanner.index;
  834. this.lastMarker.line = this.scanner.lineNumber;
  835. this.lastMarker.column = this.scanner.index - this.scanner.lineStart;
  836. var token = {
  837. type: 101 /* Text */,
  838. value: text,
  839. lineNumber: this.scanner.lineNumber,
  840. lineStart: this.scanner.lineStart,
  841. start: start,
  842. end: this.scanner.index
  843. };
  844. if ((text.length > 0) && this.config.tokens) {
  845. this.tokens.push(this.convertToken(token));
  846. }
  847. return token;
  848. };
  849. JSXParser.prototype.peekJSXToken = function () {
  850. var state = this.scanner.saveState();
  851. this.scanner.scanComments();
  852. var next = this.lexJSX();
  853. this.scanner.restoreState(state);
  854. return next;
  855. };
  856. // Expect the next JSX token to match the specified punctuator.
  857. // If not, an exception will be thrown.
  858. JSXParser.prototype.expectJSX = function (value) {
  859. var token = this.nextJSXToken();
  860. if (token.type !== 7 /* Punctuator */ || token.value !== value) {
  861. this.throwUnexpectedToken(token);
  862. }
  863. };
  864. // Return true if the next JSX token matches the specified punctuator.
  865. JSXParser.prototype.matchJSX = function (value) {
  866. var next = this.peekJSXToken();
  867. return next.type === 7 /* Punctuator */ && next.value === value;
  868. };
  869. JSXParser.prototype.parseJSXIdentifier = function () {
  870. var node = this.createJSXNode();
  871. var token = this.nextJSXToken();
  872. if (token.type !== 100 /* Identifier */) {
  873. this.throwUnexpectedToken(token);
  874. }
  875. return this.finalize(node, new JSXNode.JSXIdentifier(token.value));
  876. };
  877. JSXParser.prototype.parseJSXElementName = function () {
  878. var node = this.createJSXNode();
  879. var elementName = this.parseJSXIdentifier();
  880. if (this.matchJSX(':')) {
  881. var namespace = elementName;
  882. this.expectJSX(':');
  883. var name_1 = this.parseJSXIdentifier();
  884. elementName = this.finalize(node, new JSXNode.JSXNamespacedName(namespace, name_1));
  885. }
  886. else if (this.matchJSX('.')) {
  887. while (this.matchJSX('.')) {
  888. var object = elementName;
  889. this.expectJSX('.');
  890. var property = this.parseJSXIdentifier();
  891. elementName = this.finalize(node, new JSXNode.JSXMemberExpression(object, property));
  892. }
  893. }
  894. return elementName;
  895. };
  896. JSXParser.prototype.parseJSXAttributeName = function () {
  897. var node = this.createJSXNode();
  898. var attributeName;
  899. var identifier = this.parseJSXIdentifier();
  900. if (this.matchJSX(':')) {
  901. var namespace = identifier;
  902. this.expectJSX(':');
  903. var name_2 = this.parseJSXIdentifier();
  904. attributeName = this.finalize(node, new JSXNode.JSXNamespacedName(namespace, name_2));
  905. }
  906. else {
  907. attributeName = identifier;
  908. }
  909. return attributeName;
  910. };
  911. JSXParser.prototype.parseJSXStringLiteralAttribute = function () {
  912. var node = this.createJSXNode();
  913. var token = this.nextJSXToken();
  914. if (token.type !== 8 /* StringLiteral */) {
  915. this.throwUnexpectedToken(token);
  916. }
  917. var raw = this.getTokenRaw(token);
  918. return this.finalize(node, new Node.Literal(token.value, raw));
  919. };
  920. JSXParser.prototype.parseJSXExpressionAttribute = function () {
  921. var node = this.createJSXNode();
  922. this.expectJSX('{');
  923. this.finishJSX();
  924. if (this.match('}')) {
  925. this.tolerateError('JSX attributes must only be assigned a non-empty expression');
  926. }
  927. var expression = this.parseAssignmentExpression();
  928. this.reenterJSX();
  929. return this.finalize(node, new JSXNode.JSXExpressionContainer(expression));
  930. };
  931. JSXParser.prototype.parseJSXAttributeValue = function () {
  932. return this.matchJSX('{') ? this.parseJSXExpressionAttribute() :
  933. this.matchJSX('<') ? this.parseJSXElement() : this.parseJSXStringLiteralAttribute();
  934. };
  935. JSXParser.prototype.parseJSXNameValueAttribute = function () {
  936. var node = this.createJSXNode();
  937. var name = this.parseJSXAttributeName();
  938. var value = null;
  939. if (this.matchJSX('=')) {
  940. this.expectJSX('=');
  941. value = this.parseJSXAttributeValue();
  942. }
  943. return this.finalize(node, new JSXNode.JSXAttribute(name, value));
  944. };
  945. JSXParser.prototype.parseJSXSpreadAttribute = function () {
  946. var node = this.createJSXNode();
  947. this.expectJSX('{');
  948. this.expectJSX('...');
  949. this.finishJSX();
  950. var argument = this.parseAssignmentExpression();
  951. this.reenterJSX();
  952. return this.finalize(node, new JSXNode.JSXSpreadAttribute(argument));
  953. };
  954. JSXParser.prototype.parseJSXAttributes = function () {
  955. var attributes = [];
  956. while (!this.matchJSX('/') && !this.matchJSX('>')) {
  957. var attribute = this.matchJSX('{') ? this.parseJSXSpreadAttribute() :
  958. this.parseJSXNameValueAttribute();
  959. attributes.push(attribute);
  960. }
  961. return attributes;
  962. };
  963. JSXParser.prototype.parseJSXOpeningElement = function () {
  964. var node = this.createJSXNode();
  965. this.expectJSX('<');
  966. var name = this.parseJSXElementName();
  967. var attributes = this.parseJSXAttributes();
  968. var selfClosing = this.matchJSX('/');
  969. if (selfClosing) {
  970. this.expectJSX('/');
  971. }
  972. this.expectJSX('>');
  973. return this.finalize(node, new JSXNode.JSXOpeningElement(name, selfClosing, attributes));
  974. };
  975. JSXParser.prototype.parseJSXBoundaryElement = function () {
  976. var node = this.createJSXNode();
  977. this.expectJSX('<');
  978. if (this.matchJSX('/')) {
  979. this.expectJSX('/');
  980. var name_3 = this.parseJSXElementName();
  981. this.expectJSX('>');
  982. return this.finalize(node, new JSXNode.JSXClosingElement(name_3));
  983. }
  984. var name = this.parseJSXElementName();
  985. var attributes = this.parseJSXAttributes();
  986. var selfClosing = this.matchJSX('/');
  987. if (selfClosing) {
  988. this.expectJSX('/');
  989. }
  990. this.expectJSX('>');
  991. return this.finalize(node, new JSXNode.JSXOpeningElement(name, selfClosing, attributes));
  992. };
  993. JSXParser.prototype.parseJSXEmptyExpression = function () {
  994. var node = this.createJSXChildNode();
  995. this.collectComments();
  996. this.lastMarker.index = this.scanner.index;
  997. this.lastMarker.line = this.scanner.lineNumber;
  998. this.lastMarker.column = this.scanner.index - this.scanner.lineStart;
  999. return this.finalize(node, new JSXNode.JSXEmptyExpression());
  1000. };
  1001. JSXParser.prototype.parseJSXExpressionContainer = function () {
  1002. var node = this.createJSXNode();
  1003. this.expectJSX('{');
  1004. var expression;
  1005. if (this.matchJSX('}')) {
  1006. expression = this.parseJSXEmptyExpression();
  1007. this.expectJSX('}');
  1008. }
  1009. else {
  1010. this.finishJSX();
  1011. expression = this.parseAssignmentExpression();
  1012. this.reenterJSX();
  1013. }
  1014. return this.finalize(node, new JSXNode.JSXExpressionContainer(expression));
  1015. };
  1016. JSXParser.prototype.parseJSXChildren = function () {
  1017. var children = [];
  1018. while (!this.scanner.eof()) {
  1019. var node = this.createJSXChildNode();
  1020. var token = this.nextJSXText();
  1021. if (token.start < token.end) {
  1022. var raw = this.getTokenRaw(token);
  1023. var child = this.finalize(node, new JSXNode.JSXText(token.value, raw));
  1024. children.push(child);
  1025. }
  1026. if (this.scanner.source[this.scanner.index] === '{') {
  1027. var container = this.parseJSXExpressionContainer();
  1028. children.push(container);
  1029. }
  1030. else {
  1031. break;
  1032. }
  1033. }
  1034. return children;
  1035. };
  1036. JSXParser.prototype.parseComplexJSXElement = function (el) {
  1037. var stack = [];
  1038. while (!this.scanner.eof()) {
  1039. el.children = el.children.concat(this.parseJSXChildren());
  1040. var node = this.createJSXChildNode();
  1041. var element = this.parseJSXBoundaryElement();
  1042. if (element.type === jsx_syntax_1.JSXSyntax.JSXOpeningElement) {
  1043. var opening = element;
  1044. if (opening.selfClosing) {
  1045. var child = this.finalize(node, new JSXNode.JSXElement(opening, [], null));
  1046. el.children.push(child);
  1047. }
  1048. else {
  1049. stack.push(el);
  1050. el = { node: node, opening: opening, closing: null, children: [] };
  1051. }
  1052. }
  1053. if (element.type === jsx_syntax_1.JSXSyntax.JSXClosingElement) {
  1054. el.closing = element;
  1055. var open_1 = getQualifiedElementName(el.opening.name);
  1056. var close_1 = getQualifiedElementName(el.closing.name);
  1057. if (open_1 !== close_1) {
  1058. this.tolerateError('Expected corresponding JSX closing tag for %0', open_1);
  1059. }
  1060. if (stack.length > 0) {
  1061. var child = this.finalize(el.node, new JSXNode.JSXElement(el.opening, el.children, el.closing));
  1062. el = stack[stack.length - 1];
  1063. el.children.push(child);
  1064. stack.pop();
  1065. }
  1066. else {
  1067. break;
  1068. }
  1069. }
  1070. }
  1071. return el;
  1072. };
  1073. JSXParser.prototype.parseJSXElement = function () {
  1074. var node = this.createJSXNode();
  1075. var opening = this.parseJSXOpeningElement();
  1076. var children = [];
  1077. var closing = null;
  1078. if (!opening.selfClosing) {
  1079. var el = this.parseComplexJSXElement({ node: node, opening: opening, closing: closing, children: children });
  1080. children = el.children;
  1081. closing = el.closing;
  1082. }
  1083. return this.finalize(node, new JSXNode.JSXElement(opening, children, closing));
  1084. };
  1085. JSXParser.prototype.parseJSXRoot = function () {
  1086. // Pop the opening '<' added from the lookahead.
  1087. if (this.config.tokens) {
  1088. this.tokens.pop();
  1089. }
  1090. this.startJSX();
  1091. var element = this.parseJSXElement();
  1092. this.finishJSX();
  1093. return element;
  1094. };
  1095. JSXParser.prototype.isStartOfExpression = function () {
  1096. return _super.prototype.isStartOfExpression.call(this) || this.match('<');
  1097. };
  1098. return JSXParser;
  1099. }(parser_1.Parser));
  1100. exports.JSXParser = JSXParser;
  1101. /***/ },
  1102. /* 4 */
  1103. /***/ function(module, exports) {
  1104. "use strict";
  1105. Object.defineProperty(exports, "__esModule", { value: true });
  1106. // See also tools/generate-unicode-regex.js.
  1107. var Regex = {
  1108. // Unicode v8.0.0 NonAsciiIdentifierStart:
  1109. 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-\u08B4\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\u0AF9\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-\u0C5A\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\u0D5F-\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-\u13F5\u13F8-\u13FD\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\u19B0-\u19C9\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-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\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-\uAB65\uAB70-\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\uDCE0-\uDCF2\uDCF4\uDCF5\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\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\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\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,
  1110. // Unicode v8.0.0 NonAsciiIdentifierPart:
  1111. 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-\u08B4\u08E3-\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\u0AF9\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-\u0C5A\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\u0D5F-\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-\u13F5\u13F8-\u13FD\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-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\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-\uAB65\uAB70-\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-\uFE2F\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\uDCE0-\uDCF2\uDCF4\uDCF5\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\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\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]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\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\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/
  1112. };
  1113. exports.Character = {
  1114. /* tslint:disable:no-bitwise */
  1115. fromCodePoint: function (cp) {
  1116. return (cp < 0x10000) ? String.fromCharCode(cp) :
  1117. String.fromCharCode(0xD800 + ((cp - 0x10000) >> 10)) +
  1118. String.fromCharCode(0xDC00 + ((cp - 0x10000) & 1023));
  1119. },
  1120. // https://tc39.github.io/ecma262/#sec-white-space
  1121. isWhiteSpace: function (cp) {
  1122. return (cp === 0x20) || (cp === 0x09) || (cp === 0x0B) || (cp === 0x0C) || (cp === 0xA0) ||
  1123. (cp >= 0x1680 && [0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(cp) >= 0);
  1124. },
  1125. // https://tc39.github.io/ecma262/#sec-line-terminators
  1126. isLineTerminator: function (cp) {
  1127. return (cp === 0x0A) || (cp === 0x0D) || (cp === 0x2028) || (cp === 0x2029);
  1128. },
  1129. // https://tc39.github.io/ecma262/#sec-names-and-keywords
  1130. isIdentifierStart: function (cp) {
  1131. return (cp === 0x24) || (cp === 0x5F) ||
  1132. (cp >= 0x41 && cp <= 0x5A) ||
  1133. (cp >= 0x61 && cp <= 0x7A) ||
  1134. (cp === 0x5C) ||
  1135. ((cp >= 0x80) && Regex.NonAsciiIdentifierStart.test(exports.Character.fromCodePoint(cp)));
  1136. },
  1137. isIdentifierPart: function (cp) {
  1138. return (cp === 0x24) || (cp === 0x5F) ||
  1139. (cp >= 0x41 && cp <= 0x5A) ||
  1140. (cp >= 0x61 && cp <= 0x7A) ||
  1141. (cp >= 0x30 && cp <= 0x39) ||
  1142. (cp === 0x5C) ||
  1143. ((cp >= 0x80) && Regex.NonAsciiIdentifierPart.test(exports.Character.fromCodePoint(cp)));
  1144. },
  1145. // https://tc39.github.io/ecma262/#sec-literals-numeric-literals
  1146. isDecimalDigit: function (cp) {
  1147. return (cp >= 0x30 && cp <= 0x39); // 0..9
  1148. },
  1149. isHexDigit: function (cp) {
  1150. return (cp >= 0x30 && cp <= 0x39) ||
  1151. (cp >= 0x41 && cp <= 0x46) ||
  1152. (cp >= 0x61 && cp <= 0x66); // a..f
  1153. },
  1154. isOctalDigit: function (cp) {
  1155. return (cp >= 0x30 && cp <= 0x37); // 0..7
  1156. }
  1157. };
  1158. /***/ },
  1159. /* 5 */
  1160. /***/ function(module, exports, __nested_webpack_require_54354__) {
  1161. "use strict";
  1162. Object.defineProperty(exports, "__esModule", { value: true });
  1163. var jsx_syntax_1 = __nested_webpack_require_54354__(6);
  1164. /* tslint:disable:max-classes-per-file */
  1165. var JSXClosingElement = (function () {
  1166. function JSXClosingElement(name) {
  1167. this.type = jsx_syntax_1.JSXSyntax.JSXClosingElement;
  1168. this.name = name;
  1169. }
  1170. return JSXClosingElement;
  1171. }());
  1172. exports.JSXClosingElement = JSXClosingElement;
  1173. var JSXElement = (function () {
  1174. function JSXElement(openingElement, children, closingElement) {
  1175. this.type = jsx_syntax_1.JSXSyntax.JSXElement;
  1176. this.openingElement = openingElement;
  1177. this.children = children;
  1178. this.closingElement = closingElement;
  1179. }
  1180. return JSXElement;
  1181. }());
  1182. exports.JSXElement = JSXElement;
  1183. var JSXEmptyExpression = (function () {
  1184. function JSXEmptyExpression() {
  1185. this.type = jsx_syntax_1.JSXSyntax.JSXEmptyExpression;
  1186. }
  1187. return JSXEmptyExpression;
  1188. }());
  1189. exports.JSXEmptyExpression = JSXEmptyExpression;
  1190. var JSXExpressionContainer = (function () {
  1191. function JSXExpressionContainer(expression) {
  1192. this.type = jsx_syntax_1.JSXSyntax.JSXExpressionContainer;
  1193. this.expression = expression;
  1194. }
  1195. return JSXExpressionContainer;
  1196. }());
  1197. exports.JSXExpressionContainer = JSXExpressionContainer;
  1198. var JSXIdentifier = (function () {
  1199. function JSXIdentifier(name) {
  1200. this.type = jsx_syntax_1.JSXSyntax.JSXIdentifier;
  1201. this.name = name;
  1202. }
  1203. return JSXIdentifier;
  1204. }());
  1205. exports.JSXIdentifier = JSXIdentifier;
  1206. var JSXMemberExpression = (function () {
  1207. function JSXMemberExpression(object, property) {
  1208. this.type = jsx_syntax_1.JSXSyntax.JSXMemberExpression;
  1209. this.object = object;
  1210. this.property = property;
  1211. }
  1212. return JSXMemberExpression;
  1213. }());
  1214. exports.JSXMemberExpression = JSXMemberExpression;
  1215. var JSXAttribute = (function () {
  1216. function JSXAttribute(name, value) {
  1217. this.type = jsx_syntax_1.JSXSyntax.JSXAttribute;
  1218. this.name = name;
  1219. this.value = value;
  1220. }
  1221. return JSXAttribute;
  1222. }());
  1223. exports.JSXAttribute = JSXAttribute;
  1224. var JSXNamespacedName = (function () {
  1225. function JSXNamespacedName(namespace, name) {
  1226. this.type = jsx_syntax_1.JSXSyntax.JSXNamespacedName;
  1227. this.namespace = namespace;
  1228. this.name = name;
  1229. }
  1230. return JSXNamespacedName;
  1231. }());
  1232. exports.JSXNamespacedName = JSXNamespacedName;
  1233. var JSXOpeningElement = (function () {
  1234. function JSXOpeningElement(name, selfClosing, attributes) {
  1235. this.type = jsx_syntax_1.JSXSyntax.JSXOpeningElement;
  1236. this.name = name;
  1237. this.selfClosing = selfClosing;
  1238. this.attributes = attributes;
  1239. }
  1240. return JSXOpeningElement;
  1241. }());
  1242. exports.JSXOpeningElement = JSXOpeningElement;
  1243. var JSXSpreadAttribute = (function () {
  1244. function JSXSpreadAttribute(argument) {
  1245. this.type = jsx_syntax_1.JSXSyntax.JSXSpreadAttribute;
  1246. this.argument = argument;
  1247. }
  1248. return JSXSpreadAttribute;
  1249. }());
  1250. exports.JSXSpreadAttribute = JSXSpreadAttribute;
  1251. var JSXText = (function () {
  1252. function JSXText(value, raw) {
  1253. this.type = jsx_syntax_1.JSXSyntax.JSXText;
  1254. this.value = value;
  1255. this.raw = raw;
  1256. }
  1257. return JSXText;
  1258. }());
  1259. exports.JSXText = JSXText;
  1260. /***/ },
  1261. /* 6 */
  1262. /***/ function(module, exports) {
  1263. "use strict";
  1264. Object.defineProperty(exports, "__esModule", { value: true });
  1265. exports.JSXSyntax = {
  1266. JSXAttribute: 'JSXAttribute',
  1267. JSXClosingElement: 'JSXClosingElement',
  1268. JSXElement: 'JSXElement',
  1269. JSXEmptyExpression: 'JSXEmptyExpression',
  1270. JSXExpressionContainer: 'JSXExpressionContainer',
  1271. JSXIdentifier: 'JSXIdentifier',
  1272. JSXMemberExpression: 'JSXMemberExpression',
  1273. JSXNamespacedName: 'JSXNamespacedName',
  1274. JSXOpeningElement: 'JSXOpeningElement',
  1275. JSXSpreadAttribute: 'JSXSpreadAttribute',
  1276. JSXText: 'JSXText'
  1277. };
  1278. /***/ },
  1279. /* 7 */
  1280. /***/ function(module, exports, __nested_webpack_require_58416__) {
  1281. "use strict";
  1282. Object.defineProperty(exports, "__esModule", { value: true });
  1283. var syntax_1 = __nested_webpack_require_58416__(2);
  1284. /* tslint:disable:max-classes-per-file */
  1285. var ArrayExpression = (function () {
  1286. function ArrayExpression(elements) {
  1287. this.type = syntax_1.Syntax.ArrayExpression;
  1288. this.elements = elements;
  1289. }
  1290. return ArrayExpression;
  1291. }());
  1292. exports.ArrayExpression = ArrayExpression;
  1293. var ArrayPattern = (function () {
  1294. function ArrayPattern(elements) {
  1295. this.type = syntax_1.Syntax.ArrayPattern;
  1296. this.elements = elements;
  1297. }
  1298. return ArrayPattern;
  1299. }());
  1300. exports.ArrayPattern = ArrayPattern;
  1301. var ArrowFunctionExpression = (function () {
  1302. function ArrowFunctionExpression(params, body, expression) {
  1303. this.type = syntax_1.Syntax.ArrowFunctionExpression;
  1304. this.id = null;
  1305. this.params = params;
  1306. this.body = body;
  1307. this.generator = false;
  1308. this.expression = expression;
  1309. this.async = false;
  1310. }
  1311. return ArrowFunctionExpression;
  1312. }());
  1313. exports.ArrowFunctionExpression = ArrowFunctionExpression;
  1314. var AssignmentExpression = (function () {
  1315. function AssignmentExpression(operator, left, right) {
  1316. this.type = syntax_1.Syntax.AssignmentExpression;
  1317. this.operator = operator;
  1318. this.left = left;
  1319. this.right = right;
  1320. }
  1321. return AssignmentExpression;
  1322. }());
  1323. exports.AssignmentExpression = AssignmentExpression;
  1324. var AssignmentPattern = (function () {
  1325. function AssignmentPattern(left, right) {
  1326. this.type = syntax_1.Syntax.AssignmentPattern;
  1327. this.left = left;
  1328. this.right = right;
  1329. }
  1330. return AssignmentPattern;
  1331. }());
  1332. exports.AssignmentPattern = AssignmentPattern;
  1333. var AsyncArrowFunctionExpression = (function () {
  1334. function AsyncArrowFunctionExpression(params, body, expression) {
  1335. this.type = syntax_1.Syntax.ArrowFunctionExpression;
  1336. this.id = null;
  1337. this.params = params;
  1338. this.body = body;
  1339. this.generator = false;
  1340. this.expression = expression;
  1341. this.async = true;
  1342. }
  1343. return AsyncArrowFunctionExpression;
  1344. }());
  1345. exports.AsyncArrowFunctionExpression = AsyncArrowFunctionExpression;
  1346. var AsyncFunctionDeclaration = (function () {
  1347. function AsyncFunctionDeclaration(id, params, body) {
  1348. this.type = syntax_1.Syntax.FunctionDeclaration;
  1349. this.id = id;
  1350. this.params = params;
  1351. this.body = body;
  1352. this.generator = false;
  1353. this.expression = false;
  1354. this.async = true;
  1355. }
  1356. return AsyncFunctionDeclaration;
  1357. }());
  1358. exports.AsyncFunctionDeclaration = AsyncFunctionDeclaration;
  1359. var AsyncFunctionExpression = (function () {
  1360. function AsyncFunctionExpression(id, params, body) {
  1361. this.type = syntax_1.Syntax.FunctionExpression;
  1362. this.id = id;
  1363. this.params = params;
  1364. this.body = body;
  1365. this.generator = false;
  1366. this.expression = false;
  1367. this.async = true;
  1368. }
  1369. return AsyncFunctionExpression;
  1370. }());
  1371. exports.AsyncFunctionExpression = AsyncFunctionExpression;
  1372. var AwaitExpression = (function () {
  1373. function AwaitExpression(argument) {
  1374. this.type = syntax_1.Syntax.AwaitExpression;
  1375. this.argument = argument;
  1376. }
  1377. return AwaitExpression;
  1378. }());
  1379. exports.AwaitExpression = AwaitExpression;
  1380. var BinaryExpression = (function () {
  1381. function BinaryExpression(operator, left, right) {
  1382. var logical = (operator === '||' || operator === '&&');
  1383. this.type = logical ? syntax_1.Syntax.LogicalExpression : syntax_1.Syntax.BinaryExpression;
  1384. this.operator = operator;
  1385. this.left = left;
  1386. this.right = right;
  1387. }
  1388. return BinaryExpression;
  1389. }());
  1390. exports.BinaryExpression = BinaryExpression;
  1391. var BlockStatement = (function () {
  1392. function BlockStatement(body) {
  1393. this.type = syntax_1.Syntax.BlockStatement;
  1394. this.body = body;
  1395. }
  1396. return BlockStatement;
  1397. }());
  1398. exports.BlockStatement = BlockStatement;
  1399. var BreakStatement = (function () {
  1400. function BreakStatement(label) {
  1401. this.type = syntax_1.Syntax.BreakStatement;
  1402. this.label = label;
  1403. }
  1404. return BreakStatement;
  1405. }());
  1406. exports.BreakStatement = BreakStatement;
  1407. var CallExpression = (function () {
  1408. function CallExpression(callee, args) {
  1409. this.type = syntax_1.Syntax.CallExpression;
  1410. this.callee = callee;
  1411. this.arguments = args;
  1412. }
  1413. return CallExpression;
  1414. }());
  1415. exports.CallExpression = CallExpression;
  1416. var CatchClause = (function () {
  1417. function CatchClause(param, body) {
  1418. this.type = syntax_1.Syntax.CatchClause;
  1419. this.param = param;
  1420. this.body = body;
  1421. }
  1422. return CatchClause;
  1423. }());
  1424. exports.CatchClause = CatchClause;
  1425. var ClassBody = (function () {
  1426. function ClassBody(body) {
  1427. this.type = syntax_1.Syntax.ClassBody;
  1428. this.body = body;
  1429. }
  1430. return ClassBody;
  1431. }());
  1432. exports.ClassBody = ClassBody;
  1433. var ClassDeclaration = (function () {
  1434. function ClassDeclaration(id, superClass, body) {
  1435. this.type = syntax_1.Syntax.ClassDeclaration;
  1436. this.id = id;
  1437. this.superClass = superClass;
  1438. this.body = body;
  1439. }
  1440. return ClassDeclaration;
  1441. }());
  1442. exports.ClassDeclaration = ClassDeclaration;
  1443. var ClassExpression = (function () {
  1444. function ClassExpression(id, superClass, body) {
  1445. this.type = syntax_1.Syntax.ClassExpression;
  1446. this.id = id;
  1447. this.superClass = superClass;
  1448. this.body = body;
  1449. }
  1450. return ClassExpression;
  1451. }());
  1452. exports.ClassExpression = ClassExpression;
  1453. var ComputedMemberExpression = (function () {
  1454. function ComputedMemberExpression(object, property) {
  1455. this.type = syntax_1.Syntax.MemberExpression;
  1456. this.computed = true;
  1457. this.object = object;
  1458. this.property = property;
  1459. }
  1460. return ComputedMemberExpression;
  1461. }());
  1462. exports.ComputedMemberExpression = ComputedMemberExpression;
  1463. var ConditionalExpression = (function () {
  1464. function ConditionalExpression(test, consequent, alternate) {
  1465. this.type = syntax_1.Syntax.ConditionalExpression;
  1466. this.test = test;
  1467. this.consequent = consequent;
  1468. this.alternate = alternate;
  1469. }
  1470. return ConditionalExpression;
  1471. }());
  1472. exports.ConditionalExpression = ConditionalExpression;
  1473. var ContinueStatement = (function () {
  1474. function ContinueStatement(label) {
  1475. this.type = syntax_1.Syntax.ContinueStatement;
  1476. this.label = label;
  1477. }
  1478. return ContinueStatement;
  1479. }());
  1480. exports.ContinueStatement = ContinueStatement;
  1481. var DebuggerStatement = (function () {
  1482. function DebuggerStatement() {
  1483. this.type = syntax_1.Syntax.DebuggerStatement;
  1484. }
  1485. return DebuggerStatement;
  1486. }());
  1487. exports.DebuggerStatement = DebuggerStatement;
  1488. var Directive = (function () {
  1489. function Directive(expression, directive) {
  1490. this.type = syntax_1.Syntax.ExpressionStatement;
  1491. this.expression = expression;
  1492. this.directive = directive;
  1493. }
  1494. return Directive;
  1495. }());
  1496. exports.Directive = Directive;
  1497. var DoWhileStatement = (function () {
  1498. function DoWhileStatement(body, test) {
  1499. this.type = syntax_1.Syntax.DoWhileStatement;
  1500. this.body = body;
  1501. this.test = test;
  1502. }
  1503. return DoWhileStatement;
  1504. }());
  1505. exports.DoWhileStatement = DoWhileStatement;
  1506. var EmptyStatement = (function () {
  1507. function EmptyStatement() {
  1508. this.type = syntax_1.Syntax.EmptyStatement;
  1509. }
  1510. return EmptyStatement;
  1511. }());
  1512. exports.EmptyStatement = EmptyStatement;
  1513. var ExportAllDeclaration = (function () {
  1514. function ExportAllDeclaration(source) {
  1515. this.type = syntax_1.Syntax.ExportAllDeclaration;
  1516. this.source = source;
  1517. }
  1518. return ExportAllDeclaration;
  1519. }());
  1520. exports.ExportAllDeclaration = ExportAllDeclaration;
  1521. var ExportDefaultDeclaration = (function () {
  1522. function ExportDefaultDeclaration(declaration) {
  1523. this.type = syntax_1.Syntax.ExportDefaultDeclaration;
  1524. this.declaration = declaration;
  1525. }
  1526. return ExportDefaultDeclaration;
  1527. }());
  1528. exports.ExportDefaultDeclaration = ExportDefaultDeclaration;
  1529. var ExportNamedDeclaration = (function () {
  1530. function ExportNamedDeclaration(declaration, specifiers, source) {
  1531. this.type = syntax_1.Syntax.ExportNamedDeclaration;
  1532. this.declaration = declaration;
  1533. this.specifiers = specifiers;
  1534. this.source = source;
  1535. }
  1536. return ExportNamedDeclaration;
  1537. }());
  1538. exports.ExportNamedDeclaration = ExportNamedDeclaration;
  1539. var ExportSpecifier = (function () {
  1540. function ExportSpecifier(local, exported) {
  1541. this.type = syntax_1.Syntax.ExportSpecifier;
  1542. this.exported = exported;
  1543. this.local = local;
  1544. }
  1545. return ExportSpecifier;
  1546. }());
  1547. exports.ExportSpecifier = ExportSpecifier;
  1548. var ExpressionStatement = (function () {
  1549. function ExpressionStatement(expression) {
  1550. this.type = syntax_1.Syntax.ExpressionStatement;
  1551. this.expression = expression;
  1552. }
  1553. return ExpressionStatement;
  1554. }());
  1555. exports.ExpressionStatement = ExpressionStatement;
  1556. var ForInStatement = (function () {
  1557. function ForInStatement(left, right, body) {
  1558. this.type = syntax_1.Syntax.ForInStatement;
  1559. this.left = left;
  1560. this.right = right;
  1561. this.body = body;
  1562. this.each = false;
  1563. }
  1564. return ForInStatement;
  1565. }());
  1566. exports.ForInStatement = ForInStatement;
  1567. var ForOfStatement = (function () {
  1568. function ForOfStatement(left, right, body) {
  1569. this.type = syntax_1.Syntax.ForOfStatement;
  1570. this.left = left;
  1571. this.right = right;
  1572. this.body = body;
  1573. }
  1574. return ForOfStatement;
  1575. }());
  1576. exports.ForOfStatement = ForOfStatement;
  1577. var ForStatement = (function () {
  1578. function ForStatement(init, test, update, body) {
  1579. this.type = syntax_1.Syntax.ForStatement;
  1580. this.init = init;
  1581. this.test = test;
  1582. this.update = update;
  1583. this.body = body;
  1584. }
  1585. return ForStatement;
  1586. }());
  1587. exports.ForStatement = ForStatement;
  1588. var FunctionDeclaration = (function () {
  1589. function FunctionDeclaration(id, params, body, generator) {
  1590. this.type = syntax_1.Syntax.FunctionDeclaration;
  1591. this.id = id;
  1592. this.params = params;
  1593. this.body = body;
  1594. this.generator = generator;
  1595. this.expression = false;
  1596. this.async = false;
  1597. }
  1598. return FunctionDeclaration;
  1599. }());
  1600. exports.FunctionDeclaration = FunctionDeclaration;
  1601. var FunctionExpression = (function () {
  1602. function FunctionExpression(id, params, body, generator) {
  1603. this.type = syntax_1.Syntax.FunctionExpression;
  1604. this.id = id;
  1605. this.params = params;
  1606. this.body = body;
  1607. this.generator = generator;
  1608. this.expression = false;
  1609. this.async = false;
  1610. }
  1611. return FunctionExpression;
  1612. }());
  1613. exports.FunctionExpression = FunctionExpression;
  1614. var Identifier = (function () {
  1615. function Identifier(name) {
  1616. this.type = syntax_1.Syntax.Identifier;
  1617. this.name = name;
  1618. }
  1619. return Identifier;
  1620. }());
  1621. exports.Identifier = Identifier;
  1622. var IfStatement = (function () {
  1623. function IfStatement(test, consequent, alternate) {
  1624. this.type = syntax_1.Syntax.IfStatement;
  1625. this.test = test;
  1626. this.consequent = consequent;
  1627. this.alternate = alternate;
  1628. }
  1629. return IfStatement;
  1630. }());
  1631. exports.IfStatement = IfStatement;
  1632. var ImportDeclaration = (function () {
  1633. function ImportDeclaration(specifiers, source) {
  1634. this.type = syntax_1.Syntax.ImportDeclaration;
  1635. this.specifiers = specifiers;
  1636. this.source = source;
  1637. }
  1638. return ImportDeclaration;
  1639. }());
  1640. exports.ImportDeclaration = ImportDeclaration;
  1641. var ImportDefaultSpecifier = (function () {
  1642. function ImportDefaultSpecifier(local) {
  1643. this.type = syntax_1.Syntax.ImportDefaultSpecifier;
  1644. this.local = local;
  1645. }
  1646. return ImportDefaultSpecifier;
  1647. }());
  1648. exports.ImportDefaultSpecifier = ImportDefaultSpecifier;
  1649. var ImportNamespaceSpecifier = (function () {
  1650. function ImportNamespaceSpecifier(local) {
  1651. this.type = syntax_1.Syntax.ImportNamespaceSpecifier;
  1652. this.local = local;
  1653. }
  1654. return ImportNamespaceSpecifier;
  1655. }());
  1656. exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier;
  1657. var ImportSpecifier = (function () {
  1658. function ImportSpecifier(local, imported) {
  1659. this.type = syntax_1.Syntax.ImportSpecifier;
  1660. this.local = local;
  1661. this.imported = imported;
  1662. }
  1663. return ImportSpecifier;
  1664. }());
  1665. exports.ImportSpecifier = ImportSpecifier;
  1666. var LabeledStatement = (function () {
  1667. function LabeledStatement(label, body) {
  1668. this.type = syntax_1.Syntax.LabeledStatement;
  1669. this.label = label;
  1670. this.body = body;
  1671. }
  1672. return LabeledStatement;
  1673. }());
  1674. exports.LabeledStatement = LabeledStatement;
  1675. var Literal = (function () {
  1676. function Literal(value, raw) {
  1677. this.type = syntax_1.Syntax.Literal;
  1678. this.value = value;
  1679. this.raw = raw;
  1680. }
  1681. return Literal;
  1682. }());
  1683. exports.Literal = Literal;
  1684. var MetaProperty = (function () {
  1685. function MetaProperty(meta, property) {
  1686. this.type = syntax_1.Syntax.MetaProperty;
  1687. this.meta = meta;
  1688. this.property = property;
  1689. }
  1690. return MetaProperty;
  1691. }());
  1692. exports.MetaProperty = MetaProperty;
  1693. var MethodDefinition = (function () {
  1694. function MethodDefinition(key, computed, value, kind, isStatic) {
  1695. this.type = syntax_1.Syntax.MethodDefinition;
  1696. this.key = key;
  1697. this.computed = computed;
  1698. this.value = value;
  1699. this.kind = kind;
  1700. this.static = isStatic;
  1701. }
  1702. return MethodDefinition;
  1703. }());
  1704. exports.MethodDefinition = MethodDefinition;
  1705. var Module = (function () {
  1706. function Module(body) {
  1707. this.type = syntax_1.Syntax.Program;
  1708. this.body = body;
  1709. this.sourceType = 'module';
  1710. }
  1711. return Module;
  1712. }());
  1713. exports.Module = Module;
  1714. var NewExpression = (function () {
  1715. function NewExpression(callee, args) {
  1716. this.type = syntax_1.Syntax.NewExpression;
  1717. this.callee = callee;
  1718. this.arguments = args;
  1719. }
  1720. return NewExpression;
  1721. }());
  1722. exports.NewExpression = NewExpression;
  1723. var ObjectExpression = (function () {
  1724. function ObjectExpression(properties) {
  1725. this.type = syntax_1.Syntax.ObjectExpression;
  1726. this.properties = properties;
  1727. }
  1728. return ObjectExpression;
  1729. }());
  1730. exports.ObjectExpression = ObjectExpression;
  1731. var ObjectPattern = (function () {
  1732. function ObjectPattern(properties) {
  1733. this.type = syntax_1.Syntax.ObjectPattern;
  1734. this.properties = properties;
  1735. }
  1736. return ObjectPattern;
  1737. }());
  1738. exports.ObjectPattern = ObjectPattern;
  1739. var Property = (function () {
  1740. function Property(kind, key, computed, value, method, shorthand) {
  1741. this.type = syntax_1.Syntax.Property;
  1742. this.key = key;
  1743. this.computed = computed;
  1744. this.value = value;
  1745. this.kind = kind;
  1746. this.method = method;
  1747. this.shorthand = shorthand;
  1748. }
  1749. return Property;
  1750. }());
  1751. exports.Property = Property;
  1752. var RegexLiteral = (function () {
  1753. function RegexLiteral(value, raw, pattern, flags) {
  1754. this.type = syntax_1.Syntax.Literal;
  1755. this.value = value;
  1756. this.raw = raw;
  1757. this.regex = { pattern: pattern, flags: flags };
  1758. }
  1759. return RegexLiteral;
  1760. }());
  1761. exports.RegexLiteral = RegexLiteral;
  1762. var RestElement = (function () {
  1763. function RestElement(argument) {
  1764. this.type = syntax_1.Syntax.RestElement;
  1765. this.argument = argument;
  1766. }
  1767. return RestElement;
  1768. }());
  1769. exports.RestElement = RestElement;
  1770. var ReturnStatement = (function () {
  1771. function ReturnStatement(argument) {
  1772. this.type = syntax_1.Syntax.ReturnStatement;
  1773. this.argument = argument;
  1774. }
  1775. return ReturnStatement;
  1776. }());
  1777. exports.ReturnStatement = ReturnStatement;
  1778. var Script = (function () {
  1779. function Script(body) {
  1780. this.type = syntax_1.Syntax.Program;
  1781. this.body = body;
  1782. this.sourceType = 'script';
  1783. }
  1784. return Script;
  1785. }());
  1786. exports.Script = Script;
  1787. var SequenceExpression = (function () {
  1788. function SequenceExpression(expressions) {
  1789. this.type = syntax_1.Syntax.SequenceExpression;
  1790. this.expressions = expressions;
  1791. }
  1792. return SequenceExpression;
  1793. }());
  1794. exports.SequenceExpression = SequenceExpression;
  1795. var SpreadElement = (function () {
  1796. function SpreadElement(argument) {
  1797. this.type = syntax_1.Syntax.SpreadElement;
  1798. this.argument = argument;
  1799. }
  1800. return SpreadElement;
  1801. }());
  1802. exports.SpreadElement = SpreadElement;
  1803. var StaticMemberExpression = (function () {
  1804. function StaticMemberExpression(object, property) {
  1805. this.type = syntax_1.Syntax.MemberExpression;
  1806. this.computed = false;
  1807. this.object = object;
  1808. this.property = property;
  1809. }
  1810. return StaticMemberExpression;
  1811. }());
  1812. exports.StaticMemberExpression = StaticMemberExpression;
  1813. var Super = (function () {
  1814. function Super() {
  1815. this.type = syntax_1.Syntax.Super;
  1816. }
  1817. return Super;
  1818. }());
  1819. exports.Super = Super;
  1820. var SwitchCase = (function () {
  1821. function SwitchCase(test, consequent) {
  1822. this.type = syntax_1.Syntax.SwitchCase;
  1823. this.test = test;
  1824. this.consequent = consequent;
  1825. }
  1826. return SwitchCase;
  1827. }());
  1828. exports.SwitchCase = SwitchCase;
  1829. var SwitchStatement = (function () {
  1830. function SwitchStatement(discriminant, cases) {
  1831. this.type = syntax_1.Syntax.SwitchStatement;
  1832. this.discriminant = discriminant;
  1833. this.cases = cases;
  1834. }
  1835. return SwitchStatement;
  1836. }());
  1837. exports.SwitchStatement = SwitchStatement;
  1838. var TaggedTemplateExpression = (function () {
  1839. function TaggedTemplateExpression(tag, quasi) {
  1840. this.type = syntax_1.Syntax.TaggedTemplateExpression;
  1841. this.tag = tag;
  1842. this.quasi = quasi;
  1843. }
  1844. return TaggedTemplateExpression;
  1845. }());
  1846. exports.TaggedTemplateExpression = TaggedTemplateExpression;
  1847. var TemplateElement = (function () {
  1848. function TemplateElement(value, tail) {
  1849. this.type = syntax_1.Syntax.TemplateElement;
  1850. this.value = value;
  1851. this.tail = tail;
  1852. }
  1853. return TemplateElement;
  1854. }());
  1855. exports.TemplateElement = TemplateElement;
  1856. var TemplateLiteral = (function () {
  1857. function TemplateLiteral(quasis, expressions) {
  1858. this.type = syntax_1.Syntax.TemplateLiteral;
  1859. this.quasis = quasis;
  1860. this.expressions = expressions;
  1861. }
  1862. return TemplateLiteral;
  1863. }());
  1864. exports.TemplateLiteral = TemplateLiteral;
  1865. var ThisExpression = (function () {
  1866. function ThisExpression() {
  1867. this.type = syntax_1.Syntax.ThisExpression;
  1868. }
  1869. return ThisExpression;
  1870. }());
  1871. exports.ThisExpression = ThisExpression;
  1872. var ThrowStatement = (function () {
  1873. function ThrowStatement(argument) {
  1874. this.type = syntax_1.Syntax.ThrowStatement;
  1875. this.argument = argument;
  1876. }
  1877. return ThrowStatement;
  1878. }());
  1879. exports.ThrowStatement = ThrowStatement;
  1880. var TryStatement = (function () {
  1881. function TryStatement(block, handler, finalizer) {
  1882. this.type = syntax_1.Syntax.TryStatement;
  1883. this.block = block;
  1884. this.handler = handler;
  1885. this.finalizer = finalizer;
  1886. }
  1887. return TryStatement;
  1888. }());
  1889. exports.TryStatement = TryStatement;
  1890. var UnaryExpression = (function () {
  1891. function UnaryExpression(operator, argument) {
  1892. this.type = syntax_1.Syntax.UnaryExpression;
  1893. this.operator = operator;
  1894. this.argument = argument;
  1895. this.prefix = true;
  1896. }
  1897. return UnaryExpression;
  1898. }());
  1899. exports.UnaryExpression = UnaryExpression;
  1900. var UpdateExpression = (function () {
  1901. function UpdateExpression(operator, argument, prefix) {
  1902. this.type = syntax_1.Syntax.UpdateExpression;
  1903. this.operator = operator;
  1904. this.argument = argument;
  1905. this.prefix = prefix;
  1906. }
  1907. return UpdateExpression;
  1908. }());
  1909. exports.UpdateExpression = UpdateExpression;
  1910. var VariableDeclaration = (function () {
  1911. function VariableDeclaration(declarations, kind) {
  1912. this.type = syntax_1.Syntax.VariableDeclaration;
  1913. this.declarations = declarations;
  1914. this.kind = kind;
  1915. }
  1916. return VariableDeclaration;
  1917. }());
  1918. exports.VariableDeclaration = VariableDeclaration;
  1919. var VariableDeclarator = (function () {
  1920. function VariableDeclarator(id, init) {
  1921. this.type = syntax_1.Syntax.VariableDeclarator;
  1922. this.id = id;
  1923. this.init = init;
  1924. }
  1925. return VariableDeclarator;
  1926. }());
  1927. exports.VariableDeclarator = VariableDeclarator;
  1928. var WhileStatement = (function () {
  1929. function WhileStatement(test, body) {
  1930. this.type = syntax_1.Syntax.WhileStatement;
  1931. this.test = test;
  1932. this.body = body;
  1933. }
  1934. return WhileStatement;
  1935. }());
  1936. exports.WhileStatement = WhileStatement;
  1937. var WithStatement = (function () {
  1938. function WithStatement(object, body) {
  1939. this.type = syntax_1.Syntax.WithStatement;
  1940. this.object = object;
  1941. this.body = body;
  1942. }
  1943. return WithStatement;
  1944. }());
  1945. exports.WithStatement = WithStatement;
  1946. var YieldExpression = (function () {
  1947. function YieldExpression(argument, delegate) {
  1948. this.type = syntax_1.Syntax.YieldExpression;
  1949. this.argument = argument;
  1950. this.delegate = delegate;
  1951. }
  1952. return YieldExpression;
  1953. }());
  1954. exports.YieldExpression = YieldExpression;
  1955. /***/ },
  1956. /* 8 */
  1957. /***/ function(module, exports, __nested_webpack_require_80491__) {
  1958. "use strict";
  1959. Object.defineProperty(exports, "__esModule", { value: true });
  1960. var assert_1 = __nested_webpack_require_80491__(9);
  1961. var error_handler_1 = __nested_webpack_require_80491__(10);
  1962. var messages_1 = __nested_webpack_require_80491__(11);
  1963. var Node = __nested_webpack_require_80491__(7);
  1964. var scanner_1 = __nested_webpack_require_80491__(12);
  1965. var syntax_1 = __nested_webpack_require_80491__(2);
  1966. var token_1 = __nested_webpack_require_80491__(13);
  1967. var ArrowParameterPlaceHolder = 'ArrowParameterPlaceHolder';
  1968. var Parser = (function () {
  1969. function Parser(code, options, delegate) {
  1970. if (options === void 0) { options = {}; }
  1971. this.config = {
  1972. range: (typeof options.range === 'boolean') && options.range,
  1973. loc: (typeof options.loc === 'boolean') && options.loc,
  1974. source: null,
  1975. tokens: (typeof options.tokens === 'boolean') && options.tokens,
  1976. comment: (typeof options.comment === 'boolean') && options.comment,
  1977. tolerant: (typeof options.tolerant === 'boolean') && options.tolerant
  1978. };
  1979. if (this.config.loc && options.source && options.source !== null) {
  1980. this.config.source = String(options.source);
  1981. }
  1982. this.delegate = delegate;
  1983. this.errorHandler = new error_handler_1.ErrorHandler();
  1984. this.errorHandler.tolerant = this.config.tolerant;
  1985. this.scanner = new scanner_1.Scanner(code, this.errorHandler);
  1986. this.scanner.trackComment = this.config.comment;
  1987. this.operatorPrecedence = {
  1988. ')': 0,
  1989. ';': 0,
  1990. ',': 0,
  1991. '=': 0,
  1992. ']': 0,
  1993. '||': 1,
  1994. '&&': 2,
  1995. '|': 3,
  1996. '^': 4,
  1997. '&': 5,
  1998. '==': 6,
  1999. '!=': 6,
  2000. '===': 6,
  2001. '!==': 6,
  2002. '<': 7,
  2003. '>': 7,
  2004. '<=': 7,
  2005. '>=': 7,
  2006. '<<': 8,
  2007. '>>': 8,
  2008. '>>>': 8,
  2009. '+': 9,
  2010. '-': 9,
  2011. '*': 11,
  2012. '/': 11,
  2013. '%': 11
  2014. };
  2015. this.lookahead = {
  2016. type: 2 /* EOF */,
  2017. value: '',
  2018. lineNumber: this.scanner.lineNumber,
  2019. lineStart: 0,
  2020. start: 0,
  2021. end: 0
  2022. };
  2023. this.hasLineTerminator = false;
  2024. this.context = {
  2025. isModule: false,
  2026. await: false,
  2027. allowIn: true,
  2028. allowStrictDirective: true,
  2029. allowYield: true,
  2030. firstCoverInitializedNameError: null,
  2031. isAssignmentTarget: false,
  2032. isBindingElement: false,
  2033. inFunctionBody: false,
  2034. inIteration: false,
  2035. inSwitch: false,
  2036. labelSet: {},
  2037. strict: false
  2038. };
  2039. this.tokens = [];
  2040. this.startMarker = {
  2041. index: 0,
  2042. line: this.scanner.lineNumber,
  2043. column: 0
  2044. };
  2045. this.lastMarker = {
  2046. index: 0,
  2047. line: this.scanner.lineNumber,
  2048. column: 0
  2049. };
  2050. this.nextToken();
  2051. this.lastMarker = {
  2052. index: this.scanner.index,
  2053. line: this.scanner.lineNumber,
  2054. column: this.scanner.index - this.scanner.lineStart
  2055. };
  2056. }
  2057. Parser.prototype.throwError = function (messageFormat) {
  2058. var values = [];
  2059. for (var _i = 1; _i < arguments.length; _i++) {
  2060. values[_i - 1] = arguments[_i];
  2061. }
  2062. var args = Array.prototype.slice.call(arguments, 1);
  2063. var msg = messageFormat.replace(/%(\d)/g, function (whole, idx) {
  2064. assert_1.assert(idx < args.length, 'Message reference must be in range');
  2065. return args[idx];
  2066. });
  2067. var index = this.lastMarker.index;
  2068. var line = this.lastMarker.line;
  2069. var column = this.lastMarker.column + 1;
  2070. throw this.errorHandler.createError(index, line, column, msg);
  2071. };
  2072. Parser.prototype.tolerateError = function (messageFormat) {
  2073. var values = [];
  2074. for (var _i = 1; _i < arguments.length; _i++) {
  2075. values[_i - 1] = arguments[_i];
  2076. }
  2077. var args = Array.prototype.slice.call(arguments, 1);
  2078. var msg = messageFormat.replace(/%(\d)/g, function (whole, idx) {
  2079. assert_1.assert(idx < args.length, 'Message reference must be in range');
  2080. return args[idx];
  2081. });
  2082. var index = this.lastMarker.index;
  2083. var line = this.scanner.lineNumber;
  2084. var column = this.lastMarker.column + 1;
  2085. this.errorHandler.tolerateError(index, line, column, msg);
  2086. };
  2087. // Throw an exception because of the token.
  2088. Parser.prototype.unexpectedTokenError = function (token, message) {
  2089. var msg = message || messages_1.Messages.UnexpectedToken;
  2090. var value;
  2091. if (token) {
  2092. if (!message) {
  2093. msg = (token.type === 2 /* EOF */) ? messages_1.Messages.UnexpectedEOS :
  2094. (token.type === 3 /* Identifier */) ? messages_1.Messages.UnexpectedIdentifier :
  2095. (token.type === 6 /* NumericLiteral */) ? messages_1.Messages.UnexpectedNumber :
  2096. (token.type === 8 /* StringLiteral */) ? messages_1.Messages.UnexpectedString :
  2097. (token.type === 10 /* Template */) ? messages_1.Messages.UnexpectedTemplate :
  2098. messages_1.Messages.UnexpectedToken;
  2099. if (token.type === 4 /* Keyword */) {
  2100. if (this.scanner.isFutureReservedWord(token.value)) {
  2101. msg = messages_1.Messages.UnexpectedReserved;
  2102. }
  2103. else if (this.context.strict && this.scanner.isStrictModeReservedWord(token.value)) {
  2104. msg = messages_1.Messages.StrictReservedWord;
  2105. }
  2106. }
  2107. }
  2108. value = token.value;
  2109. }
  2110. else {
  2111. value = 'ILLEGAL';
  2112. }
  2113. msg = msg.replace('%0', value);
  2114. if (token && typeof token.lineNumber === 'number') {
  2115. var index = token.start;
  2116. var line = token.lineNumber;
  2117. var lastMarkerLineStart = this.lastMarker.index - this.lastMarker.column;
  2118. var column = token.start - lastMarkerLineStart + 1;
  2119. return this.errorHandler.createError(index, line, column, msg);
  2120. }
  2121. else {
  2122. var index = this.lastMarker.index;
  2123. var line = this.lastMarker.line;
  2124. var column = this.lastMarker.column + 1;
  2125. return this.errorHandler.createError(index, line, column, msg);
  2126. }
  2127. };
  2128. Parser.prototype.throwUnexpectedToken = function (token, message) {
  2129. throw this.unexpectedTokenError(token, message);
  2130. };
  2131. Parser.prototype.tolerateUnexpectedToken = function (token, message) {
  2132. this.errorHandler.tolerate(this.unexpectedTokenError(token, message));
  2133. };
  2134. Parser.prototype.collectComments = function () {
  2135. if (!this.config.comment) {
  2136. this.scanner.scanComments();
  2137. }
  2138. else {
  2139. var comments = this.scanner.scanComments();
  2140. if (comments.length > 0 && this.delegate) {
  2141. for (var i = 0; i < comments.length; ++i) {
  2142. var e = comments[i];
  2143. var node = void 0;
  2144. node = {
  2145. type: e.multiLine ? 'BlockComment' : 'LineComment',
  2146. value: this.scanner.source.slice(e.slice[0], e.slice[1])
  2147. };
  2148. if (this.config.range) {
  2149. node.range = e.range;
  2150. }
  2151. if (this.config.loc) {
  2152. node.loc = e.loc;
  2153. }
  2154. var metadata = {
  2155. start: {
  2156. line: e.loc.start.line,
  2157. column: e.loc.start.column,
  2158. offset: e.range[0]
  2159. },
  2160. end: {
  2161. line: e.loc.end.line,
  2162. column: e.loc.end.column,
  2163. offset: e.range[1]
  2164. }
  2165. };
  2166. this.delegate(node, metadata);
  2167. }
  2168. }
  2169. }
  2170. };
  2171. // From internal representation to an external structure
  2172. Parser.prototype.getTokenRaw = function (token) {
  2173. return this.scanner.source.slice(token.start, token.end);
  2174. };
  2175. Parser.prototype.convertToken = function (token) {
  2176. var t = {
  2177. type: token_1.TokenName[token.type],
  2178. value: this.getTokenRaw(token)
  2179. };
  2180. if (this.config.range) {
  2181. t.range = [token.start, token.end];
  2182. }
  2183. if (this.config.loc) {
  2184. t.loc = {
  2185. start: {
  2186. line: this.startMarker.line,
  2187. column: this.startMarker.column
  2188. },
  2189. end: {
  2190. line: this.scanner.lineNumber,
  2191. column: this.scanner.index - this.scanner.lineStart
  2192. }
  2193. };
  2194. }
  2195. if (token.type === 9 /* RegularExpression */) {
  2196. var pattern = token.pattern;
  2197. var flags = token.flags;
  2198. t.regex = { pattern: pattern, flags: flags };
  2199. }
  2200. return t;
  2201. };
  2202. Parser.prototype.nextToken = function () {
  2203. var token = this.lookahead;
  2204. this.lastMarker.index = this.scanner.index;
  2205. this.lastMarker.line = this.scanner.lineNumber;
  2206. this.lastMarker.column = this.scanner.index - this.scanner.lineStart;
  2207. this.collectComments();
  2208. if (this.scanner.index !== this.startMarker.index) {
  2209. this.startMarker.index = this.scanner.index;
  2210. this.startMarker.line = this.scanner.lineNumber;
  2211. this.startMarker.column = this.scanner.index - this.scanner.lineStart;
  2212. }
  2213. var next = this.scanner.lex();
  2214. this.hasLineTerminator = (token.lineNumber !== next.lineNumber);
  2215. if (next && this.context.strict && next.type === 3 /* Identifier */) {
  2216. if (this.scanner.isStrictModeReservedWord(next.value)) {
  2217. next.type = 4 /* Keyword */;
  2218. }
  2219. }
  2220. this.lookahead = next;
  2221. if (this.config.tokens && next.type !== 2 /* EOF */) {
  2222. this.tokens.push(this.convertToken(next));
  2223. }
  2224. return token;
  2225. };
  2226. Parser.prototype.nextRegexToken = function () {
  2227. this.collectComments();
  2228. var token = this.scanner.scanRegExp();
  2229. if (this.config.tokens) {
  2230. // Pop the previous token, '/' or '/='
  2231. // This is added from the lookahead token.
  2232. this.tokens.pop();
  2233. this.tokens.push(this.convertToken(token));
  2234. }
  2235. // Prime the next lookahead.
  2236. this.lookahead = token;
  2237. this.nextToken();
  2238. return token;
  2239. };
  2240. Parser.prototype.createNode = function () {
  2241. return {
  2242. index: this.startMarker.index,
  2243. line: this.startMarker.line,
  2244. column: this.startMarker.column
  2245. };
  2246. };
  2247. Parser.prototype.startNode = function (token, lastLineStart) {
  2248. if (lastLineStart === void 0) { lastLineStart = 0; }
  2249. var column = token.start - token.lineStart;
  2250. var line = token.lineNumber;
  2251. if (column < 0) {
  2252. column += lastLineStart;
  2253. line--;
  2254. }
  2255. return {
  2256. index: token.start,
  2257. line: line,
  2258. column: column
  2259. };
  2260. };
  2261. Parser.prototype.finalize = function (marker, node) {
  2262. if (this.config.range) {
  2263. node.range = [marker.index, this.lastMarker.index];
  2264. }
  2265. if (this.config.loc) {
  2266. node.loc = {
  2267. start: {
  2268. line: marker.line,
  2269. column: marker.column,
  2270. },
  2271. end: {
  2272. line: this.lastMarker.line,
  2273. column: this.lastMarker.column
  2274. }
  2275. };
  2276. if (this.config.source) {
  2277. node.loc.source = this.config.source;
  2278. }
  2279. }
  2280. if (this.delegate) {
  2281. var metadata = {
  2282. start: {
  2283. line: marker.line,
  2284. column: marker.column,
  2285. offset: marker.index
  2286. },
  2287. end: {
  2288. line: this.lastMarker.line,
  2289. column: this.lastMarker.column,
  2290. offset: this.lastMarker.index
  2291. }
  2292. };
  2293. this.delegate(node, metadata);
  2294. }
  2295. return node;
  2296. };
  2297. // Expect the next token to match the specified punctuator.
  2298. // If not, an exception will be thrown.
  2299. Parser.prototype.expect = function (value) {
  2300. var token = this.nextToken();
  2301. if (token.type !== 7 /* Punctuator */ || token.value !== value) {
  2302. this.throwUnexpectedToken(token);
  2303. }
  2304. };
  2305. // Quietly expect a comma when in tolerant mode, otherwise delegates to expect().
  2306. Parser.prototype.expectCommaSeparator = function () {
  2307. if (this.config.tolerant) {
  2308. var token = this.lookahead;
  2309. if (token.type === 7 /* Punctuator */ && token.value === ',') {
  2310. this.nextToken();
  2311. }
  2312. else if (token.type === 7 /* Punctuator */ && token.value === ';') {
  2313. this.nextToken();
  2314. this.tolerateUnexpectedToken(token);
  2315. }
  2316. else {
  2317. this.tolerateUnexpectedToken(token, messages_1.Messages.UnexpectedToken);
  2318. }
  2319. }
  2320. else {
  2321. this.expect(',');
  2322. }
  2323. };
  2324. // Expect the next token to match the specified keyword.
  2325. // If not, an exception will be thrown.
  2326. Parser.prototype.expectKeyword = function (keyword) {
  2327. var token = this.nextToken();
  2328. if (token.type !== 4 /* Keyword */ || token.value !== keyword) {
  2329. this.throwUnexpectedToken(token);
  2330. }
  2331. };
  2332. // Return true if the next token matches the specified punctuator.
  2333. Parser.prototype.match = function (value) {
  2334. return this.lookahead.type === 7 /* Punctuator */ && this.lookahead.value === value;
  2335. };
  2336. // Return true if the next token matches the specified keyword
  2337. Parser.prototype.matchKeyword = function (keyword) {
  2338. return this.lookahead.type === 4 /* Keyword */ && this.lookahead.value === keyword;
  2339. };
  2340. // Return true if the next token matches the specified contextual keyword
  2341. // (where an identifier is sometimes a keyword depending on the context)
  2342. Parser.prototype.matchContextualKeyword = function (keyword) {
  2343. return this.lookahead.type === 3 /* Identifier */ && this.lookahead.value === keyword;
  2344. };
  2345. // Return true if the next token is an assignment operator
  2346. Parser.prototype.matchAssign = function () {
  2347. if (this.lookahead.type !== 7 /* Punctuator */) {
  2348. return false;
  2349. }
  2350. var op = this.lookahead.value;
  2351. return op === '=' ||
  2352. op === '*=' ||
  2353. op === '**=' ||
  2354. op === '/=' ||
  2355. op === '%=' ||
  2356. op === '+=' ||
  2357. op === '-=' ||
  2358. op === '<<=' ||
  2359. op === '>>=' ||
  2360. op === '>>>=' ||
  2361. op === '&=' ||
  2362. op === '^=' ||
  2363. op === '|=';
  2364. };
  2365. // Cover grammar support.
  2366. //
  2367. // When an assignment expression position starts with an left parenthesis, the determination of the type
  2368. // of the syntax is to be deferred arbitrarily long until the end of the parentheses pair (plus a lookahead)
  2369. // or the first comma. This situation also defers the determination of all the expressions nested in the pair.
  2370. //
  2371. // There are three productions that can be parsed in a parentheses pair that needs to be determined
  2372. // after the outermost pair is closed. They are:
  2373. //
  2374. // 1. AssignmentExpression
  2375. // 2. BindingElements
  2376. // 3. AssignmentTargets
  2377. //
  2378. // In order to avoid exponential backtracking, we use two flags to denote if the production can be
  2379. // binding element or assignment target.
  2380. //
  2381. // The three productions have the relationship:
  2382. //
  2383. // BindingElements ⊆ AssignmentTargets ⊆ AssignmentExpression
  2384. //
  2385. // with a single exception that CoverInitializedName when used directly in an Expression, generates
  2386. // an early error. Therefore, we need the third state, firstCoverInitializedNameError, to track the
  2387. // first usage of CoverInitializedName and report it when we reached the end of the parentheses pair.
  2388. //
  2389. // isolateCoverGrammar function runs the given parser function with a new cover grammar context, and it does not
  2390. // effect the current flags. This means the production the parser parses is only used as an expression. Therefore
  2391. // the CoverInitializedName check is conducted.
  2392. //
  2393. // inheritCoverGrammar function runs the given parse function with a new cover grammar context, and it propagates
  2394. // the flags outside of the parser. This means the production the parser parses is used as a part of a potential
  2395. // pattern. The CoverInitializedName check is deferred.
  2396. Parser.prototype.isolateCoverGrammar = function (parseFunction) {
  2397. var previousIsBindingElement = this.context.isBindingElement;
  2398. var previousIsAssignmentTarget = this.context.isAssignmentTarget;
  2399. var previousFirstCoverInitializedNameError = this.context.firstCoverInitializedNameError;
  2400. this.context.isBindingElement = true;
  2401. this.context.isAssignmentTarget = true;
  2402. this.context.firstCoverInitializedNameError = null;
  2403. var result = parseFunction.call(this);
  2404. if (this.context.firstCoverInitializedNameError !== null) {
  2405. this.throwUnexpectedToken(this.context.firstCoverInitializedNameError);
  2406. }
  2407. this.context.isBindingElement = previousIsBindingElement;
  2408. this.context.isAssignmentTarget = previousIsAssignmentTarget;
  2409. this.context.firstCoverInitializedNameError = previousFirstCoverInitializedNameError;
  2410. return result;
  2411. };
  2412. Parser.prototype.inheritCoverGrammar = function (parseFunction) {
  2413. var previousIsBindingElement = this.context.isBindingElement;
  2414. var previousIsAssignmentTarget = this.context.isAssignmentTarget;
  2415. var previousFirstCoverInitializedNameError = this.context.firstCoverInitializedNameError;
  2416. this.context.isBindingElement = true;
  2417. this.context.isAssignmentTarget = true;
  2418. this.context.firstCoverInitializedNameError = null;
  2419. var result = parseFunction.call(this);
  2420. this.context.isBindingElement = this.context.isBindingElement && previousIsBindingElement;
  2421. this.context.isAssignmentTarget = this.context.isAssignmentTarget && previousIsAssignmentTarget;
  2422. this.context.firstCoverInitializedNameError = previousFirstCoverInitializedNameError || this.context.firstCoverInitializedNameError;
  2423. return result;
  2424. };
  2425. Parser.prototype.consumeSemicolon = function () {
  2426. if (this.match(';')) {
  2427. this.nextToken();
  2428. }
  2429. else if (!this.hasLineTerminator) {
  2430. if (this.lookahead.type !== 2 /* EOF */ && !this.match('}')) {
  2431. this.throwUnexpectedToken(this.lookahead);
  2432. }
  2433. this.lastMarker.index = this.startMarker.index;
  2434. this.lastMarker.line = this.startMarker.line;
  2435. this.lastMarker.column = this.startMarker.column;
  2436. }
  2437. };
  2438. // https://tc39.github.io/ecma262/#sec-primary-expression
  2439. Parser.prototype.parsePrimaryExpression = function () {
  2440. var node = this.createNode();
  2441. var expr;
  2442. var token, raw;
  2443. switch (this.lookahead.type) {
  2444. case 3 /* Identifier */:
  2445. if ((this.context.isModule || this.context.await) && this.lookahead.value === 'await') {
  2446. this.tolerateUnexpectedToken(this.lookahead);
  2447. }
  2448. expr = this.matchAsyncFunction() ? this.parseFunctionExpression() : this.finalize(node, new Node.Identifier(this.nextToken().value));
  2449. break;
  2450. case 6 /* NumericLiteral */:
  2451. case 8 /* StringLiteral */:
  2452. if (this.context.strict && this.lookahead.octal) {
  2453. this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.StrictOctalLiteral);
  2454. }
  2455. this.context.isAssignmentTarget = false;
  2456. this.context.isBindingElement = false;
  2457. token = this.nextToken();
  2458. raw = this.getTokenRaw(token);
  2459. expr = this.finalize(node, new Node.Literal(token.value, raw));
  2460. break;
  2461. case 1 /* BooleanLiteral */:
  2462. this.context.isAssignmentTarget = false;
  2463. this.context.isBindingElement = false;
  2464. token = this.nextToken();
  2465. raw = this.getTokenRaw(token);
  2466. expr = this.finalize(node, new Node.Literal(token.value === 'true', raw));
  2467. break;
  2468. case 5 /* NullLiteral */:
  2469. this.context.isAssignmentTarget = false;
  2470. this.context.isBindingElement = false;
  2471. token = this.nextToken();
  2472. raw = this.getTokenRaw(token);
  2473. expr = this.finalize(node, new Node.Literal(null, raw));
  2474. break;
  2475. case 10 /* Template */:
  2476. expr = this.parseTemplateLiteral();
  2477. break;
  2478. case 7 /* Punctuator */:
  2479. switch (this.lookahead.value) {
  2480. case '(':
  2481. this.context.isBindingElement = false;
  2482. expr = this.inheritCoverGrammar(this.parseGroupExpression);
  2483. break;
  2484. case '[':
  2485. expr = this.inheritCoverGrammar(this.parseArrayInitializer);
  2486. break;
  2487. case '{':
  2488. expr = this.inheritCoverGrammar(this.parseObjectInitializer);
  2489. break;
  2490. case '/':
  2491. case '/=':
  2492. this.context.isAssignmentTarget = false;
  2493. this.context.isBindingElement = false;
  2494. this.scanner.index = this.startMarker.index;
  2495. token = this.nextRegexToken();
  2496. raw = this.getTokenRaw(token);
  2497. expr = this.finalize(node, new Node.RegexLiteral(token.regex, raw, token.pattern, token.flags));
  2498. break;
  2499. default:
  2500. expr = this.throwUnexpectedToken(this.nextToken());
  2501. }
  2502. break;
  2503. case 4 /* Keyword */:
  2504. if (!this.context.strict && this.context.allowYield && this.matchKeyword('yield')) {
  2505. expr = this.parseIdentifierName();
  2506. }
  2507. else if (!this.context.strict && this.matchKeyword('let')) {
  2508. expr = this.finalize(node, new Node.Identifier(this.nextToken().value));
  2509. }
  2510. else {
  2511. this.context.isAssignmentTarget = false;
  2512. this.context.isBindingElement = false;
  2513. if (this.matchKeyword('function')) {
  2514. expr = this.parseFunctionExpression();
  2515. }
  2516. else if (this.matchKeyword('this')) {
  2517. this.nextToken();
  2518. expr = this.finalize(node, new Node.ThisExpression());
  2519. }
  2520. else if (this.matchKeyword('class')) {
  2521. expr = this.parseClassExpression();
  2522. }
  2523. else {
  2524. expr = this.throwUnexpectedToken(this.nextToken());
  2525. }
  2526. }
  2527. break;
  2528. default:
  2529. expr = this.throwUnexpectedToken(this.nextToken());
  2530. }
  2531. return expr;
  2532. };
  2533. // https://tc39.github.io/ecma262/#sec-array-initializer
  2534. Parser.prototype.parseSpreadElement = function () {
  2535. var node = this.createNode();
  2536. this.expect('...');
  2537. var arg = this.inheritCoverGrammar(this.parseAssignmentExpression);
  2538. return this.finalize(node, new Node.SpreadElement(arg));
  2539. };
  2540. Parser.prototype.parseArrayInitializer = function () {
  2541. var node = this.createNode();
  2542. var elements = [];
  2543. this.expect('[');
  2544. while (!this.match(']')) {
  2545. if (this.match(',')) {
  2546. this.nextToken();
  2547. elements.push(null);
  2548. }
  2549. else if (this.match('...')) {
  2550. var element = this.parseSpreadElement();
  2551. if (!this.match(']')) {
  2552. this.context.isAssignmentTarget = false;
  2553. this.context.isBindingElement = false;
  2554. this.expect(',');
  2555. }
  2556. elements.push(element);
  2557. }
  2558. else {
  2559. elements.push(this.inheritCoverGrammar(this.parseAssignmentExpression));
  2560. if (!this.match(']')) {
  2561. this.expect(',');
  2562. }
  2563. }
  2564. }
  2565. this.expect(']');
  2566. return this.finalize(node, new Node.ArrayExpression(elements));
  2567. };
  2568. // https://tc39.github.io/ecma262/#sec-object-initializer
  2569. Parser.prototype.parsePropertyMethod = function (params) {
  2570. this.context.isAssignmentTarget = false;
  2571. this.context.isBindingElement = false;
  2572. var previousStrict = this.context.strict;
  2573. var previousAllowStrictDirective = this.context.allowStrictDirective;
  2574. this.context.allowStrictDirective = params.simple;
  2575. var body = this.isolateCoverGrammar(this.parseFunctionSourceElements);
  2576. if (this.context.strict && params.firstRestricted) {
  2577. this.tolerateUnexpectedToken(params.firstRestricted, params.message);
  2578. }
  2579. if (this.context.strict && params.stricted) {
  2580. this.tolerateUnexpectedToken(params.stricted, params.message);
  2581. }
  2582. this.context.strict = previousStrict;
  2583. this.context.allowStrictDirective = previousAllowStrictDirective;
  2584. return body;
  2585. };
  2586. Parser.prototype.parsePropertyMethodFunction = function () {
  2587. var isGenerator = false;
  2588. var node = this.createNode();
  2589. var previousAllowYield = this.context.allowYield;
  2590. this.context.allowYield = true;
  2591. var params = this.parseFormalParameters();
  2592. var method = this.parsePropertyMethod(params);
  2593. this.context.allowYield = previousAllowYield;
  2594. return this.finalize(node, new Node.FunctionExpression(null, params.params, method, isGenerator));
  2595. };
  2596. Parser.prototype.parsePropertyMethodAsyncFunction = function () {
  2597. var node = this.createNode();
  2598. var previousAllowYield = this.context.allowYield;
  2599. var previousAwait = this.context.await;
  2600. this.context.allowYield = false;
  2601. this.context.await = true;
  2602. var params = this.parseFormalParameters();
  2603. var method = this.parsePropertyMethod(params);
  2604. this.context.allowYield = previousAllowYield;
  2605. this.context.await = previousAwait;
  2606. return this.finalize(node, new Node.AsyncFunctionExpression(null, params.params, method));
  2607. };
  2608. Parser.prototype.parseObjectPropertyKey = function () {
  2609. var node = this.createNode();
  2610. var token = this.nextToken();
  2611. var key;
  2612. switch (token.type) {
  2613. case 8 /* StringLiteral */:
  2614. case 6 /* NumericLiteral */:
  2615. if (this.context.strict && token.octal) {
  2616. this.tolerateUnexpectedToken(token, messages_1.Messages.StrictOctalLiteral);
  2617. }
  2618. var raw = this.getTokenRaw(token);
  2619. key = this.finalize(node, new Node.Literal(token.value, raw));
  2620. break;
  2621. case 3 /* Identifier */:
  2622. case 1 /* BooleanLiteral */:
  2623. case 5 /* NullLiteral */:
  2624. case 4 /* Keyword */:
  2625. key = this.finalize(node, new Node.Identifier(token.value));
  2626. break;
  2627. case 7 /* Punctuator */:
  2628. if (token.value === '[') {
  2629. key = this.isolateCoverGrammar(this.parseAssignmentExpression);
  2630. this.expect(']');
  2631. }
  2632. else {
  2633. key = this.throwUnexpectedToken(token);
  2634. }
  2635. break;
  2636. default:
  2637. key = this.throwUnexpectedToken(token);
  2638. }
  2639. return key;
  2640. };
  2641. Parser.prototype.isPropertyKey = function (key, value) {
  2642. return (key.type === syntax_1.Syntax.Identifier && key.name === value) ||
  2643. (key.type === syntax_1.Syntax.Literal && key.value === value);
  2644. };
  2645. Parser.prototype.parseObjectProperty = function (hasProto) {
  2646. var node = this.createNode();
  2647. var token = this.lookahead;
  2648. var kind;
  2649. var key = null;
  2650. var value = null;
  2651. var computed = false;
  2652. var method = false;
  2653. var shorthand = false;
  2654. var isAsync = false;
  2655. if (token.type === 3 /* Identifier */) {
  2656. var id = token.value;
  2657. this.nextToken();
  2658. computed = this.match('[');
  2659. isAsync = !this.hasLineTerminator && (id === 'async') &&
  2660. !this.match(':') && !this.match('(') && !this.match('*') && !this.match(',');
  2661. key = isAsync ? this.parseObjectPropertyKey() : this.finalize(node, new Node.Identifier(id));
  2662. }
  2663. else if (this.match('*')) {
  2664. this.nextToken();
  2665. }
  2666. else {
  2667. computed = this.match('[');
  2668. key = this.parseObjectPropertyKey();
  2669. }
  2670. var lookaheadPropertyKey = this.qualifiedPropertyName(this.lookahead);
  2671. if (token.type === 3 /* Identifier */ && !isAsync && token.value === 'get' && lookaheadPropertyKey) {
  2672. kind = 'get';
  2673. computed = this.match('[');
  2674. key = this.parseObjectPropertyKey();
  2675. this.context.allowYield = false;
  2676. value = this.parseGetterMethod();
  2677. }
  2678. else if (token.type === 3 /* Identifier */ && !isAsync && token.value === 'set' && lookaheadPropertyKey) {
  2679. kind = 'set';
  2680. computed = this.match('[');
  2681. key = this.parseObjectPropertyKey();
  2682. value = this.parseSetterMethod();
  2683. }
  2684. else if (token.type === 7 /* Punctuator */ && token.value === '*' && lookaheadPropertyKey) {
  2685. kind = 'init';
  2686. computed = this.match('[');
  2687. key = this.parseObjectPropertyKey();
  2688. value = this.parseGeneratorMethod();
  2689. method = true;
  2690. }
  2691. else {
  2692. if (!key) {
  2693. this.throwUnexpectedToken(this.lookahead);
  2694. }
  2695. kind = 'init';
  2696. if (this.match(':') && !isAsync) {
  2697. if (!computed && this.isPropertyKey(key, '__proto__')) {
  2698. if (hasProto.value) {
  2699. this.tolerateError(messages_1.Messages.DuplicateProtoProperty);
  2700. }
  2701. hasProto.value = true;
  2702. }
  2703. this.nextToken();
  2704. value = this.inheritCoverGrammar(this.parseAssignmentExpression);
  2705. }
  2706. else if (this.match('(')) {
  2707. value = isAsync ? this.parsePropertyMethodAsyncFunction() : this.parsePropertyMethodFunction();
  2708. method = true;
  2709. }
  2710. else if (token.type === 3 /* Identifier */) {
  2711. var id = this.finalize(node, new Node.Identifier(token.value));
  2712. if (this.match('=')) {
  2713. this.context.firstCoverInitializedNameError = this.lookahead;
  2714. this.nextToken();
  2715. shorthand = true;
  2716. var init = this.isolateCoverGrammar(this.parseAssignmentExpression);
  2717. value = this.finalize(node, new Node.AssignmentPattern(id, init));
  2718. }
  2719. else {
  2720. shorthand = true;
  2721. value = id;
  2722. }
  2723. }
  2724. else {
  2725. this.throwUnexpectedToken(this.nextToken());
  2726. }
  2727. }
  2728. return this.finalize(node, new Node.Property(kind, key, computed, value, method, shorthand));
  2729. };
  2730. Parser.prototype.parseObjectInitializer = function () {
  2731. var node = this.createNode();
  2732. this.expect('{');
  2733. var properties = [];
  2734. var hasProto = { value: false };
  2735. while (!this.match('}')) {
  2736. properties.push(this.parseObjectProperty(hasProto));
  2737. if (!this.match('}')) {
  2738. this.expectCommaSeparator();
  2739. }
  2740. }
  2741. this.expect('}');
  2742. return this.finalize(node, new Node.ObjectExpression(properties));
  2743. };
  2744. // https://tc39.github.io/ecma262/#sec-template-literals
  2745. Parser.prototype.parseTemplateHead = function () {
  2746. assert_1.assert(this.lookahead.head, 'Template literal must start with a template head');
  2747. var node = this.createNode();
  2748. var token = this.nextToken();
  2749. var raw = token.value;
  2750. var cooked = token.cooked;
  2751. return this.finalize(node, new Node.TemplateElement({ raw: raw, cooked: cooked }, token.tail));
  2752. };
  2753. Parser.prototype.parseTemplateElement = function () {
  2754. if (this.lookahead.type !== 10 /* Template */) {
  2755. this.throwUnexpectedToken();
  2756. }
  2757. var node = this.createNode();
  2758. var token = this.nextToken();
  2759. var raw = token.value;
  2760. var cooked = token.cooked;
  2761. return this.finalize(node, new Node.TemplateElement({ raw: raw, cooked: cooked }, token.tail));
  2762. };
  2763. Parser.prototype.parseTemplateLiteral = function () {
  2764. var node = this.createNode();
  2765. var expressions = [];
  2766. var quasis = [];
  2767. var quasi = this.parseTemplateHead();
  2768. quasis.push(quasi);
  2769. while (!quasi.tail) {
  2770. expressions.push(this.parseExpression());
  2771. quasi = this.parseTemplateElement();
  2772. quasis.push(quasi);
  2773. }
  2774. return this.finalize(node, new Node.TemplateLiteral(quasis, expressions));
  2775. };
  2776. // https://tc39.github.io/ecma262/#sec-grouping-operator
  2777. Parser.prototype.reinterpretExpressionAsPattern = function (expr) {
  2778. switch (expr.type) {
  2779. case syntax_1.Syntax.Identifier:
  2780. case syntax_1.Syntax.MemberExpression:
  2781. case syntax_1.Syntax.RestElement:
  2782. case syntax_1.Syntax.AssignmentPattern:
  2783. break;
  2784. case syntax_1.Syntax.SpreadElement:
  2785. expr.type = syntax_1.Syntax.RestElement;
  2786. this.reinterpretExpressionAsPattern(expr.argument);
  2787. break;
  2788. case syntax_1.Syntax.ArrayExpression:
  2789. expr.type = syntax_1.Syntax.ArrayPattern;
  2790. for (var i = 0; i < expr.elements.length; i++) {
  2791. if (expr.elements[i] !== null) {
  2792. this.reinterpretExpressionAsPattern(expr.elements[i]);
  2793. }
  2794. }
  2795. break;
  2796. case syntax_1.Syntax.ObjectExpression:
  2797. expr.type = syntax_1.Syntax.ObjectPattern;
  2798. for (var i = 0; i < expr.properties.length; i++) {
  2799. this.reinterpretExpressionAsPattern(expr.properties[i].value);
  2800. }
  2801. break;
  2802. case syntax_1.Syntax.AssignmentExpression:
  2803. expr.type = syntax_1.Syntax.AssignmentPattern;
  2804. delete expr.operator;
  2805. this.reinterpretExpressionAsPattern(expr.left);
  2806. break;
  2807. default:
  2808. // Allow other node type for tolerant parsing.
  2809. break;
  2810. }
  2811. };
  2812. Parser.prototype.parseGroupExpression = function () {
  2813. var expr;
  2814. this.expect('(');
  2815. if (this.match(')')) {
  2816. this.nextToken();
  2817. if (!this.match('=>')) {
  2818. this.expect('=>');
  2819. }
  2820. expr = {
  2821. type: ArrowParameterPlaceHolder,
  2822. params: [],
  2823. async: false
  2824. };
  2825. }
  2826. else {
  2827. var startToken = this.lookahead;
  2828. var params = [];
  2829. if (this.match('...')) {
  2830. expr = this.parseRestElement(params);
  2831. this.expect(')');
  2832. if (!this.match('=>')) {
  2833. this.expect('=>');
  2834. }
  2835. expr = {
  2836. type: ArrowParameterPlaceHolder,
  2837. params: [expr],
  2838. async: false
  2839. };
  2840. }
  2841. else {
  2842. var arrow = false;
  2843. this.context.isBindingElement = true;
  2844. expr = this.inheritCoverGrammar(this.parseAssignmentExpression);
  2845. if (this.match(',')) {
  2846. var expressions = [];
  2847. this.context.isAssignmentTarget = false;
  2848. expressions.push(expr);
  2849. while (this.lookahead.type !== 2 /* EOF */) {
  2850. if (!this.match(',')) {
  2851. break;
  2852. }
  2853. this.nextToken();
  2854. if (this.match(')')) {
  2855. this.nextToken();
  2856. for (var i = 0; i < expressions.length; i++) {
  2857. this.reinterpretExpressionAsPattern(expressions[i]);
  2858. }
  2859. arrow = true;
  2860. expr = {
  2861. type: ArrowParameterPlaceHolder,
  2862. params: expressions,
  2863. async: false
  2864. };
  2865. }
  2866. else if (this.match('...')) {
  2867. if (!this.context.isBindingElement) {
  2868. this.throwUnexpectedToken(this.lookahead);
  2869. }
  2870. expressions.push(this.parseRestElement(params));
  2871. this.expect(')');
  2872. if (!this.match('=>')) {
  2873. this.expect('=>');
  2874. }
  2875. this.context.isBindingElement = false;
  2876. for (var i = 0; i < expressions.length; i++) {
  2877. this.reinterpretExpressionAsPattern(expressions[i]);
  2878. }
  2879. arrow = true;
  2880. expr = {
  2881. type: ArrowParameterPlaceHolder,
  2882. params: expressions,
  2883. async: false
  2884. };
  2885. }
  2886. else {
  2887. expressions.push(this.inheritCoverGrammar(this.parseAssignmentExpression));
  2888. }
  2889. if (arrow) {
  2890. break;
  2891. }
  2892. }
  2893. if (!arrow) {
  2894. expr = this.finalize(this.startNode(startToken), new Node.SequenceExpression(expressions));
  2895. }
  2896. }
  2897. if (!arrow) {
  2898. this.expect(')');
  2899. if (this.match('=>')) {
  2900. if (expr.type === syntax_1.Syntax.Identifier && expr.name === 'yield') {
  2901. arrow = true;
  2902. expr = {
  2903. type: ArrowParameterPlaceHolder,
  2904. params: [expr],
  2905. async: false
  2906. };
  2907. }
  2908. if (!arrow) {
  2909. if (!this.context.isBindingElement) {
  2910. this.throwUnexpectedToken(this.lookahead);
  2911. }
  2912. if (expr.type === syntax_1.Syntax.SequenceExpression) {
  2913. for (var i = 0; i < expr.expressions.length; i++) {
  2914. this.reinterpretExpressionAsPattern(expr.expressions[i]);
  2915. }
  2916. }
  2917. else {
  2918. this.reinterpretExpressionAsPattern(expr);
  2919. }
  2920. var parameters = (expr.type === syntax_1.Syntax.SequenceExpression ? expr.expressions : [expr]);
  2921. expr = {
  2922. type: ArrowParameterPlaceHolder,
  2923. params: parameters,
  2924. async: false
  2925. };
  2926. }
  2927. }
  2928. this.context.isBindingElement = false;
  2929. }
  2930. }
  2931. }
  2932. return expr;
  2933. };
  2934. // https://tc39.github.io/ecma262/#sec-left-hand-side-expressions
  2935. Parser.prototype.parseArguments = function () {
  2936. this.expect('(');
  2937. var args = [];
  2938. if (!this.match(')')) {
  2939. while (true) {
  2940. var expr = this.match('...') ? this.parseSpreadElement() :
  2941. this.isolateCoverGrammar(this.parseAssignmentExpression);
  2942. args.push(expr);
  2943. if (this.match(')')) {
  2944. break;
  2945. }
  2946. this.expectCommaSeparator();
  2947. if (this.match(')')) {
  2948. break;
  2949. }
  2950. }
  2951. }
  2952. this.expect(')');
  2953. return args;
  2954. };
  2955. Parser.prototype.isIdentifierName = function (token) {
  2956. return token.type === 3 /* Identifier */ ||
  2957. token.type === 4 /* Keyword */ ||
  2958. token.type === 1 /* BooleanLiteral */ ||
  2959. token.type === 5 /* NullLiteral */;
  2960. };
  2961. Parser.prototype.parseIdentifierName = function () {
  2962. var node = this.createNode();
  2963. var token = this.nextToken();
  2964. if (!this.isIdentifierName(token)) {
  2965. this.throwUnexpectedToken(token);
  2966. }
  2967. return this.finalize(node, new Node.Identifier(token.value));
  2968. };
  2969. Parser.prototype.parseNewExpression = function () {
  2970. var node = this.createNode();
  2971. var id = this.parseIdentifierName();
  2972. assert_1.assert(id.name === 'new', 'New expression must start with `new`');
  2973. var expr;
  2974. if (this.match('.')) {
  2975. this.nextToken();
  2976. if (this.lookahead.type === 3 /* Identifier */ && this.context.inFunctionBody && this.lookahead.value === 'target') {
  2977. var property = this.parseIdentifierName();
  2978. expr = new Node.MetaProperty(id, property);
  2979. }
  2980. else {
  2981. this.throwUnexpectedToken(this.lookahead);
  2982. }
  2983. }
  2984. else {
  2985. var callee = this.isolateCoverGrammar(this.parseLeftHandSideExpression);
  2986. var args = this.match('(') ? this.parseArguments() : [];
  2987. expr = new Node.NewExpression(callee, args);
  2988. this.context.isAssignmentTarget = false;
  2989. this.context.isBindingElement = false;
  2990. }
  2991. return this.finalize(node, expr);
  2992. };
  2993. Parser.prototype.parseAsyncArgument = function () {
  2994. var arg = this.parseAssignmentExpression();
  2995. this.context.firstCoverInitializedNameError = null;
  2996. return arg;
  2997. };
  2998. Parser.prototype.parseAsyncArguments = function () {
  2999. this.expect('(');
  3000. var args = [];
  3001. if (!this.match(')')) {
  3002. while (true) {
  3003. var expr = this.match('...') ? this.parseSpreadElement() :
  3004. this.isolateCoverGrammar(this.parseAsyncArgument);
  3005. args.push(expr);
  3006. if (this.match(')')) {
  3007. break;
  3008. }
  3009. this.expectCommaSeparator();
  3010. if (this.match(')')) {
  3011. break;
  3012. }
  3013. }
  3014. }
  3015. this.expect(')');
  3016. return args;
  3017. };
  3018. Parser.prototype.parseLeftHandSideExpressionAllowCall = function () {
  3019. var startToken = this.lookahead;
  3020. var maybeAsync = this.matchContextualKeyword('async');
  3021. var previousAllowIn = this.context.allowIn;
  3022. this.context.allowIn = true;
  3023. var expr;
  3024. if (this.matchKeyword('super') && this.context.inFunctionBody) {
  3025. expr = this.createNode();
  3026. this.nextToken();
  3027. expr = this.finalize(expr, new Node.Super());
  3028. if (!this.match('(') && !this.match('.') && !this.match('[')) {
  3029. this.throwUnexpectedToken(this.lookahead);
  3030. }
  3031. }
  3032. else {
  3033. expr = this.inheritCoverGrammar(this.matchKeyword('new') ? this.parseNewExpression : this.parsePrimaryExpression);
  3034. }
  3035. while (true) {
  3036. if (this.match('.')) {
  3037. this.context.isBindingElement = false;
  3038. this.context.isAssignmentTarget = true;
  3039. this.expect('.');
  3040. var property = this.parseIdentifierName();
  3041. expr = this.finalize(this.startNode(startToken), new Node.StaticMemberExpression(expr, property));
  3042. }
  3043. else if (this.match('(')) {
  3044. var asyncArrow = maybeAsync && (startToken.lineNumber === this.lookahead.lineNumber);
  3045. this.context.isBindingElement = false;
  3046. this.context.isAssignmentTarget = false;
  3047. var args = asyncArrow ? this.parseAsyncArguments() : this.parseArguments();
  3048. expr = this.finalize(this.startNode(startToken), new Node.CallExpression(expr, args));
  3049. if (asyncArrow && this.match('=>')) {
  3050. for (var i = 0; i < args.length; ++i) {
  3051. this.reinterpretExpressionAsPattern(args[i]);
  3052. }
  3053. expr = {
  3054. type: ArrowParameterPlaceHolder,
  3055. params: args,
  3056. async: true
  3057. };
  3058. }
  3059. }
  3060. else if (this.match('[')) {
  3061. this.context.isBindingElement = false;
  3062. this.context.isAssignmentTarget = true;
  3063. this.expect('[');
  3064. var property = this.isolateCoverGrammar(this.parseExpression);
  3065. this.expect(']');
  3066. expr = this.finalize(this.startNode(startToken), new Node.ComputedMemberExpression(expr, property));
  3067. }
  3068. else if (this.lookahead.type === 10 /* Template */ && this.lookahead.head) {
  3069. var quasi = this.parseTemplateLiteral();
  3070. expr = this.finalize(this.startNode(startToken), new Node.TaggedTemplateExpression(expr, quasi));
  3071. }
  3072. else {
  3073. break;
  3074. }
  3075. }
  3076. this.context.allowIn = previousAllowIn;
  3077. return expr;
  3078. };
  3079. Parser.prototype.parseSuper = function () {
  3080. var node = this.createNode();
  3081. this.expectKeyword('super');
  3082. if (!this.match('[') && !this.match('.')) {
  3083. this.throwUnexpectedToken(this.lookahead);
  3084. }
  3085. return this.finalize(node, new Node.Super());
  3086. };
  3087. Parser.prototype.parseLeftHandSideExpression = function () {
  3088. assert_1.assert(this.context.allowIn, 'callee of new expression always allow in keyword.');
  3089. var node = this.startNode(this.lookahead);
  3090. var expr = (this.matchKeyword('super') && this.context.inFunctionBody) ? this.parseSuper() :
  3091. this.inheritCoverGrammar(this.matchKeyword('new') ? this.parseNewExpression : this.parsePrimaryExpression);
  3092. while (true) {
  3093. if (this.match('[')) {
  3094. this.context.isBindingElement = false;
  3095. this.context.isAssignmentTarget = true;
  3096. this.expect('[');
  3097. var property = this.isolateCoverGrammar(this.parseExpression);
  3098. this.expect(']');
  3099. expr = this.finalize(node, new Node.ComputedMemberExpression(expr, property));
  3100. }
  3101. else if (this.match('.')) {
  3102. this.context.isBindingElement = false;
  3103. this.context.isAssignmentTarget = true;
  3104. this.expect('.');
  3105. var property = this.parseIdentifierName();
  3106. expr = this.finalize(node, new Node.StaticMemberExpression(expr, property));
  3107. }
  3108. else if (this.lookahead.type === 10 /* Template */ && this.lookahead.head) {
  3109. var quasi = this.parseTemplateLiteral();
  3110. expr = this.finalize(node, new Node.TaggedTemplateExpression(expr, quasi));
  3111. }
  3112. else {
  3113. break;
  3114. }
  3115. }
  3116. return expr;
  3117. };
  3118. // https://tc39.github.io/ecma262/#sec-update-expressions
  3119. Parser.prototype.parseUpdateExpression = function () {
  3120. var expr;
  3121. var startToken = this.lookahead;
  3122. if (this.match('++') || this.match('--')) {
  3123. var node = this.startNode(startToken);
  3124. var token = this.nextToken();
  3125. expr = this.inheritCoverGrammar(this.parseUnaryExpression);
  3126. if (this.context.strict && expr.type === syntax_1.Syntax.Identifier && this.scanner.isRestrictedWord(expr.name)) {
  3127. this.tolerateError(messages_1.Messages.StrictLHSPrefix);
  3128. }
  3129. if (!this.context.isAssignmentTarget) {
  3130. this.tolerateError(messages_1.Messages.InvalidLHSInAssignment);
  3131. }
  3132. var prefix = true;
  3133. expr = this.finalize(node, new Node.UpdateExpression(token.value, expr, prefix));
  3134. this.context.isAssignmentTarget = false;
  3135. this.context.isBindingElement = false;
  3136. }
  3137. else {
  3138. expr = this.inheritCoverGrammar(this.parseLeftHandSideExpressionAllowCall);
  3139. if (!this.hasLineTerminator && this.lookahead.type === 7 /* Punctuator */) {
  3140. if (this.match('++') || this.match('--')) {
  3141. if (this.context.strict && expr.type === syntax_1.Syntax.Identifier && this.scanner.isRestrictedWord(expr.name)) {
  3142. this.tolerateError(messages_1.Messages.StrictLHSPostfix);
  3143. }
  3144. if (!this.context.isAssignmentTarget) {
  3145. this.tolerateError(messages_1.Messages.InvalidLHSInAssignment);
  3146. }
  3147. this.context.isAssignmentTarget = false;
  3148. this.context.isBindingElement = false;
  3149. var operator = this.nextToken().value;
  3150. var prefix = false;
  3151. expr = this.finalize(this.startNode(startToken), new Node.UpdateExpression(operator, expr, prefix));
  3152. }
  3153. }
  3154. }
  3155. return expr;
  3156. };
  3157. // https://tc39.github.io/ecma262/#sec-unary-operators
  3158. Parser.prototype.parseAwaitExpression = function () {
  3159. var node = this.createNode();
  3160. this.nextToken();
  3161. var argument = this.parseUnaryExpression();
  3162. return this.finalize(node, new Node.AwaitExpression(argument));
  3163. };
  3164. Parser.prototype.parseUnaryExpression = function () {
  3165. var expr;
  3166. if (this.match('+') || this.match('-') || this.match('~') || this.match('!') ||
  3167. this.matchKeyword('delete') || this.matchKeyword('void') || this.matchKeyword('typeof')) {
  3168. var node = this.startNode(this.lookahead);
  3169. var token = this.nextToken();
  3170. expr = this.inheritCoverGrammar(this.parseUnaryExpression);
  3171. expr = this.finalize(node, new Node.UnaryExpression(token.value, expr));
  3172. if (this.context.strict && expr.operator === 'delete' && expr.argument.type === syntax_1.Syntax.Identifier) {
  3173. this.tolerateError(messages_1.Messages.StrictDelete);
  3174. }
  3175. this.context.isAssignmentTarget = false;
  3176. this.context.isBindingElement = false;
  3177. }
  3178. else if (this.context.await && this.matchContextualKeyword('await')) {
  3179. expr = this.parseAwaitExpression();
  3180. }
  3181. else {
  3182. expr = this.parseUpdateExpression();
  3183. }
  3184. return expr;
  3185. };
  3186. Parser.prototype.parseExponentiationExpression = function () {
  3187. var startToken = this.lookahead;
  3188. var expr = this.inheritCoverGrammar(this.parseUnaryExpression);
  3189. if (expr.type !== syntax_1.Syntax.UnaryExpression && this.match('**')) {
  3190. this.nextToken();
  3191. this.context.isAssignmentTarget = false;
  3192. this.context.isBindingElement = false;
  3193. var left = expr;
  3194. var right = this.isolateCoverGrammar(this.parseExponentiationExpression);
  3195. expr = this.finalize(this.startNode(startToken), new Node.BinaryExpression('**', left, right));
  3196. }
  3197. return expr;
  3198. };
  3199. // https://tc39.github.io/ecma262/#sec-exp-operator
  3200. // https://tc39.github.io/ecma262/#sec-multiplicative-operators
  3201. // https://tc39.github.io/ecma262/#sec-additive-operators
  3202. // https://tc39.github.io/ecma262/#sec-bitwise-shift-operators
  3203. // https://tc39.github.io/ecma262/#sec-relational-operators
  3204. // https://tc39.github.io/ecma262/#sec-equality-operators
  3205. // https://tc39.github.io/ecma262/#sec-binary-bitwise-operators
  3206. // https://tc39.github.io/ecma262/#sec-binary-logical-operators
  3207. Parser.prototype.binaryPrecedence = function (token) {
  3208. var op = token.value;
  3209. var precedence;
  3210. if (token.type === 7 /* Punctuator */) {
  3211. precedence = this.operatorPrecedence[op] || 0;
  3212. }
  3213. else if (token.type === 4 /* Keyword */) {
  3214. precedence = (op === 'instanceof' || (this.context.allowIn && op === 'in')) ? 7 : 0;
  3215. }
  3216. else {
  3217. precedence = 0;
  3218. }
  3219. return precedence;
  3220. };
  3221. Parser.prototype.parseBinaryExpression = function () {
  3222. var startToken = this.lookahead;
  3223. var expr = this.inheritCoverGrammar(this.parseExponentiationExpression);
  3224. var token = this.lookahead;
  3225. var prec = this.binaryPrecedence(token);
  3226. if (prec > 0) {
  3227. this.nextToken();
  3228. this.context.isAssignmentTarget = false;
  3229. this.context.isBindingElement = false;
  3230. var markers = [startToken, this.lookahead];
  3231. var left = expr;
  3232. var right = this.isolateCoverGrammar(this.parseExponentiationExpression);
  3233. var stack = [left, token.value, right];
  3234. var precedences = [prec];
  3235. while (true) {
  3236. prec = this.binaryPrecedence(this.lookahead);
  3237. if (prec <= 0) {
  3238. break;
  3239. }
  3240. // Reduce: make a binary expression from the three topmost entries.
  3241. while ((stack.length > 2) && (prec <= precedences[precedences.length - 1])) {
  3242. right = stack.pop();
  3243. var operator = stack.pop();
  3244. precedences.pop();
  3245. left = stack.pop();
  3246. markers.pop();
  3247. var node = this.startNode(markers[markers.length - 1]);
  3248. stack.push(this.finalize(node, new Node.BinaryExpression(operator, left, right)));
  3249. }
  3250. // Shift.
  3251. stack.push(this.nextToken().value);
  3252. precedences.push(prec);
  3253. markers.push(this.lookahead);
  3254. stack.push(this.isolateCoverGrammar(this.parseExponentiationExpression));
  3255. }
  3256. // Final reduce to clean-up the stack.
  3257. var i = stack.length - 1;
  3258. expr = stack[i];
  3259. var lastMarker = markers.pop();
  3260. while (i > 1) {
  3261. var marker = markers.pop();
  3262. var lastLineStart = lastMarker && lastMarker.lineStart;
  3263. var node = this.startNode(marker, lastLineStart);
  3264. var operator = stack[i - 1];
  3265. expr = this.finalize(node, new Node.BinaryExpression(operator, stack[i - 2], expr));
  3266. i -= 2;
  3267. lastMarker = marker;
  3268. }
  3269. }
  3270. return expr;
  3271. };
  3272. // https://tc39.github.io/ecma262/#sec-conditional-operator
  3273. Parser.prototype.parseConditionalExpression = function () {
  3274. var startToken = this.lookahead;
  3275. var expr = this.inheritCoverGrammar(this.parseBinaryExpression);
  3276. if (this.match('?')) {
  3277. this.nextToken();
  3278. var previousAllowIn = this.context.allowIn;
  3279. this.context.allowIn = true;
  3280. var consequent = this.isolateCoverGrammar(this.parseAssignmentExpression);
  3281. this.context.allowIn = previousAllowIn;
  3282. this.expect(':');
  3283. var alternate = this.isolateCoverGrammar(this.parseAssignmentExpression);
  3284. expr = this.finalize(this.startNode(startToken), new Node.ConditionalExpression(expr, consequent, alternate));
  3285. this.context.isAssignmentTarget = false;
  3286. this.context.isBindingElement = false;
  3287. }
  3288. return expr;
  3289. };
  3290. // https://tc39.github.io/ecma262/#sec-assignment-operators
  3291. Parser.prototype.checkPatternParam = function (options, param) {
  3292. switch (param.type) {
  3293. case syntax_1.Syntax.Identifier:
  3294. this.validateParam(options, param, param.name);
  3295. break;
  3296. case syntax_1.Syntax.RestElement:
  3297. this.checkPatternParam(options, param.argument);
  3298. break;
  3299. case syntax_1.Syntax.AssignmentPattern:
  3300. this.checkPatternParam(options, param.left);
  3301. break;
  3302. case syntax_1.Syntax.ArrayPattern:
  3303. for (var i = 0; i < param.elements.length; i++) {
  3304. if (param.elements[i] !== null) {
  3305. this.checkPatternParam(options, param.elements[i]);
  3306. }
  3307. }
  3308. break;
  3309. case syntax_1.Syntax.ObjectPattern:
  3310. for (var i = 0; i < param.properties.length; i++) {
  3311. this.checkPatternParam(options, param.properties[i].value);
  3312. }
  3313. break;
  3314. default:
  3315. break;
  3316. }
  3317. options.simple = options.simple && (param instanceof Node.Identifier);
  3318. };
  3319. Parser.prototype.reinterpretAsCoverFormalsList = function (expr) {
  3320. var params = [expr];
  3321. var options;
  3322. var asyncArrow = false;
  3323. switch (expr.type) {
  3324. case syntax_1.Syntax.Identifier:
  3325. break;
  3326. case ArrowParameterPlaceHolder:
  3327. params = expr.params;
  3328. asyncArrow = expr.async;
  3329. break;
  3330. default:
  3331. return null;
  3332. }
  3333. options = {
  3334. simple: true,
  3335. paramSet: {}
  3336. };
  3337. for (var i = 0; i < params.length; ++i) {
  3338. var param = params[i];
  3339. if (param.type === syntax_1.Syntax.AssignmentPattern) {
  3340. if (param.right.type === syntax_1.Syntax.YieldExpression) {
  3341. if (param.right.argument) {
  3342. this.throwUnexpectedToken(this.lookahead);
  3343. }
  3344. param.right.type = syntax_1.Syntax.Identifier;
  3345. param.right.name = 'yield';
  3346. delete param.right.argument;
  3347. delete param.right.delegate;
  3348. }
  3349. }
  3350. else if (asyncArrow && param.type === syntax_1.Syntax.Identifier && param.name === 'await') {
  3351. this.throwUnexpectedToken(this.lookahead);
  3352. }
  3353. this.checkPatternParam(options, param);
  3354. params[i] = param;
  3355. }
  3356. if (this.context.strict || !this.context.allowYield) {
  3357. for (var i = 0; i < params.length; ++i) {
  3358. var param = params[i];
  3359. if (param.type === syntax_1.Syntax.YieldExpression) {
  3360. this.throwUnexpectedToken(this.lookahead);
  3361. }
  3362. }
  3363. }
  3364. if (options.message === messages_1.Messages.StrictParamDupe) {
  3365. var token = this.context.strict ? options.stricted : options.firstRestricted;
  3366. this.throwUnexpectedToken(token, options.message);
  3367. }
  3368. return {
  3369. simple: options.simple,
  3370. params: params,
  3371. stricted: options.stricted,
  3372. firstRestricted: options.firstRestricted,
  3373. message: options.message
  3374. };
  3375. };
  3376. Parser.prototype.parseAssignmentExpression = function () {
  3377. var expr;
  3378. if (!this.context.allowYield && this.matchKeyword('yield')) {
  3379. expr = this.parseYieldExpression();
  3380. }
  3381. else {
  3382. var startToken = this.lookahead;
  3383. var token = startToken;
  3384. expr = this.parseConditionalExpression();
  3385. if (token.type === 3 /* Identifier */ && (token.lineNumber === this.lookahead.lineNumber) && token.value === 'async') {
  3386. if (this.lookahead.type === 3 /* Identifier */ || this.matchKeyword('yield')) {
  3387. var arg = this.parsePrimaryExpression();
  3388. this.reinterpretExpressionAsPattern(arg);
  3389. expr = {
  3390. type: ArrowParameterPlaceHolder,
  3391. params: [arg],
  3392. async: true
  3393. };
  3394. }
  3395. }
  3396. if (expr.type === ArrowParameterPlaceHolder || this.match('=>')) {
  3397. // https://tc39.github.io/ecma262/#sec-arrow-function-definitions
  3398. this.context.isAssignmentTarget = false;
  3399. this.context.isBindingElement = false;
  3400. var isAsync = expr.async;
  3401. var list = this.reinterpretAsCoverFormalsList(expr);
  3402. if (list) {
  3403. if (this.hasLineTerminator) {
  3404. this.tolerateUnexpectedToken(this.lookahead);
  3405. }
  3406. this.context.firstCoverInitializedNameError = null;
  3407. var previousStrict = this.context.strict;
  3408. var previousAllowStrictDirective = this.context.allowStrictDirective;
  3409. this.context.allowStrictDirective = list.simple;
  3410. var previousAllowYield = this.context.allowYield;
  3411. var previousAwait = this.context.await;
  3412. this.context.allowYield = true;
  3413. this.context.await = isAsync;
  3414. var node = this.startNode(startToken);
  3415. this.expect('=>');
  3416. var body = void 0;
  3417. if (this.match('{')) {
  3418. var previousAllowIn = this.context.allowIn;
  3419. this.context.allowIn = true;
  3420. body = this.parseFunctionSourceElements();
  3421. this.context.allowIn = previousAllowIn;
  3422. }
  3423. else {
  3424. body = this.isolateCoverGrammar(this.parseAssignmentExpression);
  3425. }
  3426. var expression = body.type !== syntax_1.Syntax.BlockStatement;
  3427. if (this.context.strict && list.firstRestricted) {
  3428. this.throwUnexpectedToken(list.firstRestricted, list.message);
  3429. }
  3430. if (this.context.strict && list.stricted) {
  3431. this.tolerateUnexpectedToken(list.stricted, list.message);
  3432. }
  3433. expr = isAsync ? this.finalize(node, new Node.AsyncArrowFunctionExpression(list.params, body, expression)) :
  3434. this.finalize(node, new Node.ArrowFunctionExpression(list.params, body, expression));
  3435. this.context.strict = previousStrict;
  3436. this.context.allowStrictDirective = previousAllowStrictDirective;
  3437. this.context.allowYield = previousAllowYield;
  3438. this.context.await = previousAwait;
  3439. }
  3440. }
  3441. else {
  3442. if (this.matchAssign()) {
  3443. if (!this.context.isAssignmentTarget) {
  3444. this.tolerateError(messages_1.Messages.InvalidLHSInAssignment);
  3445. }
  3446. if (this.context.strict && expr.type === syntax_1.Syntax.Identifier) {
  3447. var id = expr;
  3448. if (this.scanner.isRestrictedWord(id.name)) {
  3449. this.tolerateUnexpectedToken(token, messages_1.Messages.StrictLHSAssignment);
  3450. }
  3451. if (this.scanner.isStrictModeReservedWord(id.name)) {
  3452. this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord);
  3453. }
  3454. }
  3455. if (!this.match('=')) {
  3456. this.context.isAssignmentTarget = false;
  3457. this.context.isBindingElement = false;
  3458. }
  3459. else {
  3460. this.reinterpretExpressionAsPattern(expr);
  3461. }
  3462. token = this.nextToken();
  3463. var operator = token.value;
  3464. var right = this.isolateCoverGrammar(this.parseAssignmentExpression);
  3465. expr = this.finalize(this.startNode(startToken), new Node.AssignmentExpression(operator, expr, right));
  3466. this.context.firstCoverInitializedNameError = null;
  3467. }
  3468. }
  3469. }
  3470. return expr;
  3471. };
  3472. // https://tc39.github.io/ecma262/#sec-comma-operator
  3473. Parser.prototype.parseExpression = function () {
  3474. var startToken = this.lookahead;
  3475. var expr = this.isolateCoverGrammar(this.parseAssignmentExpression);
  3476. if (this.match(',')) {
  3477. var expressions = [];
  3478. expressions.push(expr);
  3479. while (this.lookahead.type !== 2 /* EOF */) {
  3480. if (!this.match(',')) {
  3481. break;
  3482. }
  3483. this.nextToken();
  3484. expressions.push(this.isolateCoverGrammar(this.parseAssignmentExpression));
  3485. }
  3486. expr = this.finalize(this.startNode(startToken), new Node.SequenceExpression(expressions));
  3487. }
  3488. return expr;
  3489. };
  3490. // https://tc39.github.io/ecma262/#sec-block
  3491. Parser.prototype.parseStatementListItem = function () {
  3492. var statement;
  3493. this.context.isAssignmentTarget = true;
  3494. this.context.isBindingElement = true;
  3495. if (this.lookahead.type === 4 /* Keyword */) {
  3496. switch (this.lookahead.value) {
  3497. case 'export':
  3498. if (!this.context.isModule) {
  3499. this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.IllegalExportDeclaration);
  3500. }
  3501. statement = this.parseExportDeclaration();
  3502. break;
  3503. case 'import':
  3504. if (!this.context.isModule) {
  3505. this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.IllegalImportDeclaration);
  3506. }
  3507. statement = this.parseImportDeclaration();
  3508. break;
  3509. case 'const':
  3510. statement = this.parseLexicalDeclaration({ inFor: false });
  3511. break;
  3512. case 'function':
  3513. statement = this.parseFunctionDeclaration();
  3514. break;
  3515. case 'class':
  3516. statement = this.parseClassDeclaration();
  3517. break;
  3518. case 'let':
  3519. statement = this.isLexicalDeclaration() ? this.parseLexicalDeclaration({ inFor: false }) : this.parseStatement();
  3520. break;
  3521. default:
  3522. statement = this.parseStatement();
  3523. break;
  3524. }
  3525. }
  3526. else {
  3527. statement = this.parseStatement();
  3528. }
  3529. return statement;
  3530. };
  3531. Parser.prototype.parseBlock = function () {
  3532. var node = this.createNode();
  3533. this.expect('{');
  3534. var block = [];
  3535. while (true) {
  3536. if (this.match('}')) {
  3537. break;
  3538. }
  3539. block.push(this.parseStatementListItem());
  3540. }
  3541. this.expect('}');
  3542. return this.finalize(node, new Node.BlockStatement(block));
  3543. };
  3544. // https://tc39.github.io/ecma262/#sec-let-and-const-declarations
  3545. Parser.prototype.parseLexicalBinding = function (kind, options) {
  3546. var node = this.createNode();
  3547. var params = [];
  3548. var id = this.parsePattern(params, kind);
  3549. if (this.context.strict && id.type === syntax_1.Syntax.Identifier) {
  3550. if (this.scanner.isRestrictedWord(id.name)) {
  3551. this.tolerateError(messages_1.Messages.StrictVarName);
  3552. }
  3553. }
  3554. var init = null;
  3555. if (kind === 'const') {
  3556. if (!this.matchKeyword('in') && !this.matchContextualKeyword('of')) {
  3557. if (this.match('=')) {
  3558. this.nextToken();
  3559. init = this.isolateCoverGrammar(this.parseAssignmentExpression);
  3560. }
  3561. else {
  3562. this.throwError(messages_1.Messages.DeclarationMissingInitializer, 'const');
  3563. }
  3564. }
  3565. }
  3566. else if ((!options.inFor && id.type !== syntax_1.Syntax.Identifier) || this.match('=')) {
  3567. this.expect('=');
  3568. init = this.isolateCoverGrammar(this.parseAssignmentExpression);
  3569. }
  3570. return this.finalize(node, new Node.VariableDeclarator(id, init));
  3571. };
  3572. Parser.prototype.parseBindingList = function (kind, options) {
  3573. var list = [this.parseLexicalBinding(kind, options)];
  3574. while (this.match(',')) {
  3575. this.nextToken();
  3576. list.push(this.parseLexicalBinding(kind, options));
  3577. }
  3578. return list;
  3579. };
  3580. Parser.prototype.isLexicalDeclaration = function () {
  3581. var state = this.scanner.saveState();
  3582. this.scanner.scanComments();
  3583. var next = this.scanner.lex();
  3584. this.scanner.restoreState(state);
  3585. return (next.type === 3 /* Identifier */) ||
  3586. (next.type === 7 /* Punctuator */ && next.value === '[') ||
  3587. (next.type === 7 /* Punctuator */ && next.value === '{') ||
  3588. (next.type === 4 /* Keyword */ && next.value === 'let') ||
  3589. (next.type === 4 /* Keyword */ && next.value === 'yield');
  3590. };
  3591. Parser.prototype.parseLexicalDeclaration = function (options) {
  3592. var node = this.createNode();
  3593. var kind = this.nextToken().value;
  3594. assert_1.assert(kind === 'let' || kind === 'const', 'Lexical declaration must be either let or const');
  3595. var declarations = this.parseBindingList(kind, options);
  3596. this.consumeSemicolon();
  3597. return this.finalize(node, new Node.VariableDeclaration(declarations, kind));
  3598. };
  3599. // https://tc39.github.io/ecma262/#sec-destructuring-binding-patterns
  3600. Parser.prototype.parseBindingRestElement = function (params, kind) {
  3601. var node = this.createNode();
  3602. this.expect('...');
  3603. var arg = this.parsePattern(params, kind);
  3604. return this.finalize(node, new Node.RestElement(arg));
  3605. };
  3606. Parser.prototype.parseArrayPattern = function (params, kind) {
  3607. var node = this.createNode();
  3608. this.expect('[');
  3609. var elements = [];
  3610. while (!this.match(']')) {
  3611. if (this.match(',')) {
  3612. this.nextToken();
  3613. elements.push(null);
  3614. }
  3615. else {
  3616. if (this.match('...')) {
  3617. elements.push(this.parseBindingRestElement(params, kind));
  3618. break;
  3619. }
  3620. else {
  3621. elements.push(this.parsePatternWithDefault(params, kind));
  3622. }
  3623. if (!this.match(']')) {
  3624. this.expect(',');
  3625. }
  3626. }
  3627. }
  3628. this.expect(']');
  3629. return this.finalize(node, new Node.ArrayPattern(elements));
  3630. };
  3631. Parser.prototype.parsePropertyPattern = function (params, kind) {
  3632. var node = this.createNode();
  3633. var computed = false;
  3634. var shorthand = false;
  3635. var method = false;
  3636. var key;
  3637. var value;
  3638. if (this.lookahead.type === 3 /* Identifier */) {
  3639. var keyToken = this.lookahead;
  3640. key = this.parseVariableIdentifier();
  3641. var init = this.finalize(node, new Node.Identifier(keyToken.value));
  3642. if (this.match('=')) {
  3643. params.push(keyToken);
  3644. shorthand = true;
  3645. this.nextToken();
  3646. var expr = this.parseAssignmentExpression();
  3647. value = this.finalize(this.startNode(keyToken), new Node.AssignmentPattern(init, expr));
  3648. }
  3649. else if (!this.match(':')) {
  3650. params.push(keyToken);
  3651. shorthand = true;
  3652. value = init;
  3653. }
  3654. else {
  3655. this.expect(':');
  3656. value = this.parsePatternWithDefault(params, kind);
  3657. }
  3658. }
  3659. else {
  3660. computed = this.match('[');
  3661. key = this.parseObjectPropertyKey();
  3662. this.expect(':');
  3663. value = this.parsePatternWithDefault(params, kind);
  3664. }
  3665. return this.finalize(node, new Node.Property('init', key, computed, value, method, shorthand));
  3666. };
  3667. Parser.prototype.parseObjectPattern = function (params, kind) {
  3668. var node = this.createNode();
  3669. var properties = [];
  3670. this.expect('{');
  3671. while (!this.match('}')) {
  3672. properties.push(this.parsePropertyPattern(params, kind));
  3673. if (!this.match('}')) {
  3674. this.expect(',');
  3675. }
  3676. }
  3677. this.expect('}');
  3678. return this.finalize(node, new Node.ObjectPattern(properties));
  3679. };
  3680. Parser.prototype.parsePattern = function (params, kind) {
  3681. var pattern;
  3682. if (this.match('[')) {
  3683. pattern = this.parseArrayPattern(params, kind);
  3684. }
  3685. else if (this.match('{')) {
  3686. pattern = this.parseObjectPattern(params, kind);
  3687. }
  3688. else {
  3689. if (this.matchKeyword('let') && (kind === 'const' || kind === 'let')) {
  3690. this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.LetInLexicalBinding);
  3691. }
  3692. params.push(this.lookahead);
  3693. pattern = this.parseVariableIdentifier(kind);
  3694. }
  3695. return pattern;
  3696. };
  3697. Parser.prototype.parsePatternWithDefault = function (params, kind) {
  3698. var startToken = this.lookahead;
  3699. var pattern = this.parsePattern(params, kind);
  3700. if (this.match('=')) {
  3701. this.nextToken();
  3702. var previousAllowYield = this.context.allowYield;
  3703. this.context.allowYield = true;
  3704. var right = this.isolateCoverGrammar(this.parseAssignmentExpression);
  3705. this.context.allowYield = previousAllowYield;
  3706. pattern = this.finalize(this.startNode(startToken), new Node.AssignmentPattern(pattern, right));
  3707. }
  3708. return pattern;
  3709. };
  3710. // https://tc39.github.io/ecma262/#sec-variable-statement
  3711. Parser.prototype.parseVariableIdentifier = function (kind) {
  3712. var node = this.createNode();
  3713. var token = this.nextToken();
  3714. if (token.type === 4 /* Keyword */ && token.value === 'yield') {
  3715. if (this.context.strict) {
  3716. this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord);
  3717. }
  3718. else if (!this.context.allowYield) {
  3719. this.throwUnexpectedToken(token);
  3720. }
  3721. }
  3722. else if (token.type !== 3 /* Identifier */) {
  3723. if (this.context.strict && token.type === 4 /* Keyword */ && this.scanner.isStrictModeReservedWord(token.value)) {
  3724. this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord);
  3725. }
  3726. else {
  3727. if (this.context.strict || token.value !== 'let' || kind !== 'var') {
  3728. this.throwUnexpectedToken(token);
  3729. }
  3730. }
  3731. }
  3732. else if ((this.context.isModule || this.context.await) && token.type === 3 /* Identifier */ && token.value === 'await') {
  3733. this.tolerateUnexpectedToken(token);
  3734. }
  3735. return this.finalize(node, new Node.Identifier(token.value));
  3736. };
  3737. Parser.prototype.parseVariableDeclaration = function (options) {
  3738. var node = this.createNode();
  3739. var params = [];
  3740. var id = this.parsePattern(params, 'var');
  3741. if (this.context.strict && id.type === syntax_1.Syntax.Identifier) {
  3742. if (this.scanner.isRestrictedWord(id.name)) {
  3743. this.tolerateError(messages_1.Messages.StrictVarName);
  3744. }
  3745. }
  3746. var init = null;
  3747. if (this.match('=')) {
  3748. this.nextToken();
  3749. init = this.isolateCoverGrammar(this.parseAssignmentExpression);
  3750. }
  3751. else if (id.type !== syntax_1.Syntax.Identifier && !options.inFor) {
  3752. this.expect('=');
  3753. }
  3754. return this.finalize(node, new Node.VariableDeclarator(id, init));
  3755. };
  3756. Parser.prototype.parseVariableDeclarationList = function (options) {
  3757. var opt = { inFor: options.inFor };
  3758. var list = [];
  3759. list.push(this.parseVariableDeclaration(opt));
  3760. while (this.match(',')) {
  3761. this.nextToken();
  3762. list.push(this.parseVariableDeclaration(opt));
  3763. }
  3764. return list;
  3765. };
  3766. Parser.prototype.parseVariableStatement = function () {
  3767. var node = this.createNode();
  3768. this.expectKeyword('var');
  3769. var declarations = this.parseVariableDeclarationList({ inFor: false });
  3770. this.consumeSemicolon();
  3771. return this.finalize(node, new Node.VariableDeclaration(declarations, 'var'));
  3772. };
  3773. // https://tc39.github.io/ecma262/#sec-empty-statement
  3774. Parser.prototype.parseEmptyStatement = function () {
  3775. var node = this.createNode();
  3776. this.expect(';');
  3777. return this.finalize(node, new Node.EmptyStatement());
  3778. };
  3779. // https://tc39.github.io/ecma262/#sec-expression-statement
  3780. Parser.prototype.parseExpressionStatement = function () {
  3781. var node = this.createNode();
  3782. var expr = this.parseExpression();
  3783. this.consumeSemicolon();
  3784. return this.finalize(node, new Node.ExpressionStatement(expr));
  3785. };
  3786. // https://tc39.github.io/ecma262/#sec-if-statement
  3787. Parser.prototype.parseIfClause = function () {
  3788. if (this.context.strict && this.matchKeyword('function')) {
  3789. this.tolerateError(messages_1.Messages.StrictFunction);
  3790. }
  3791. return this.parseStatement();
  3792. };
  3793. Parser.prototype.parseIfStatement = function () {
  3794. var node = this.createNode();
  3795. var consequent;
  3796. var alternate = null;
  3797. this.expectKeyword('if');
  3798. this.expect('(');
  3799. var test = this.parseExpression();
  3800. if (!this.match(')') && this.config.tolerant) {
  3801. this.tolerateUnexpectedToken(this.nextToken());
  3802. consequent = this.finalize(this.createNode(), new Node.EmptyStatement());
  3803. }
  3804. else {
  3805. this.expect(')');
  3806. consequent = this.parseIfClause();
  3807. if (this.matchKeyword('else')) {
  3808. this.nextToken();
  3809. alternate = this.parseIfClause();
  3810. }
  3811. }
  3812. return this.finalize(node, new Node.IfStatement(test, consequent, alternate));
  3813. };
  3814. // https://tc39.github.io/ecma262/#sec-do-while-statement
  3815. Parser.prototype.parseDoWhileStatement = function () {
  3816. var node = this.createNode();
  3817. this.expectKeyword('do');
  3818. var previousInIteration = this.context.inIteration;
  3819. this.context.inIteration = true;
  3820. var body = this.parseStatement();
  3821. this.context.inIteration = previousInIteration;
  3822. this.expectKeyword('while');
  3823. this.expect('(');
  3824. var test = this.parseExpression();
  3825. if (!this.match(')') && this.config.tolerant) {
  3826. this.tolerateUnexpectedToken(this.nextToken());
  3827. }
  3828. else {
  3829. this.expect(')');
  3830. if (this.match(';')) {
  3831. this.nextToken();
  3832. }
  3833. }
  3834. return this.finalize(node, new Node.DoWhileStatement(body, test));
  3835. };
  3836. // https://tc39.github.io/ecma262/#sec-while-statement
  3837. Parser.prototype.parseWhileStatement = function () {
  3838. var node = this.createNode();
  3839. var body;
  3840. this.expectKeyword('while');
  3841. this.expect('(');
  3842. var test = this.parseExpression();
  3843. if (!this.match(')') && this.config.tolerant) {
  3844. this.tolerateUnexpectedToken(this.nextToken());
  3845. body = this.finalize(this.createNode(), new Node.EmptyStatement());
  3846. }
  3847. else {
  3848. this.expect(')');
  3849. var previousInIteration = this.context.inIteration;
  3850. this.context.inIteration = true;
  3851. body = this.parseStatement();
  3852. this.context.inIteration = previousInIteration;
  3853. }
  3854. return this.finalize(node, new Node.WhileStatement(test, body));
  3855. };
  3856. // https://tc39.github.io/ecma262/#sec-for-statement
  3857. // https://tc39.github.io/ecma262/#sec-for-in-and-for-of-statements
  3858. Parser.prototype.parseForStatement = function () {
  3859. var init = null;
  3860. var test = null;
  3861. var update = null;
  3862. var forIn = true;
  3863. var left, right;
  3864. var node = this.createNode();
  3865. this.expectKeyword('for');
  3866. this.expect('(');
  3867. if (this.match(';')) {
  3868. this.nextToken();
  3869. }
  3870. else {
  3871. if (this.matchKeyword('var')) {
  3872. init = this.createNode();
  3873. this.nextToken();
  3874. var previousAllowIn = this.context.allowIn;
  3875. this.context.allowIn = false;
  3876. var declarations = this.parseVariableDeclarationList({ inFor: true });
  3877. this.context.allowIn = previousAllowIn;
  3878. if (declarations.length === 1 && this.matchKeyword('in')) {
  3879. var decl = declarations[0];
  3880. if (decl.init && (decl.id.type === syntax_1.Syntax.ArrayPattern || decl.id.type === syntax_1.Syntax.ObjectPattern || this.context.strict)) {
  3881. this.tolerateError(messages_1.Messages.ForInOfLoopInitializer, 'for-in');
  3882. }
  3883. init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var'));
  3884. this.nextToken();
  3885. left = init;
  3886. right = this.parseExpression();
  3887. init = null;
  3888. }
  3889. else if (declarations.length === 1 && declarations[0].init === null && this.matchContextualKeyword('of')) {
  3890. init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var'));
  3891. this.nextToken();
  3892. left = init;
  3893. right = this.parseAssignmentExpression();
  3894. init = null;
  3895. forIn = false;
  3896. }
  3897. else {
  3898. init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var'));
  3899. this.expect(';');
  3900. }
  3901. }
  3902. else if (this.matchKeyword('const') || this.matchKeyword('let')) {
  3903. init = this.createNode();
  3904. var kind = this.nextToken().value;
  3905. if (!this.context.strict && this.lookahead.value === 'in') {
  3906. init = this.finalize(init, new Node.Identifier(kind));
  3907. this.nextToken();
  3908. left = init;
  3909. right = this.parseExpression();
  3910. init = null;
  3911. }
  3912. else {
  3913. var previousAllowIn = this.context.allowIn;
  3914. this.context.allowIn = false;
  3915. var declarations = this.parseBindingList(kind, { inFor: true });
  3916. this.context.allowIn = previousAllowIn;
  3917. if (declarations.length === 1 && declarations[0].init === null && this.matchKeyword('in')) {
  3918. init = this.finalize(init, new Node.VariableDeclaration(declarations, kind));
  3919. this.nextToken();
  3920. left = init;
  3921. right = this.parseExpression();
  3922. init = null;
  3923. }
  3924. else if (declarations.length === 1 && declarations[0].init === null && this.matchContextualKeyword('of')) {
  3925. init = this.finalize(init, new Node.VariableDeclaration(declarations, kind));
  3926. this.nextToken();
  3927. left = init;
  3928. right = this.parseAssignmentExpression();
  3929. init = null;
  3930. forIn = false;
  3931. }
  3932. else {
  3933. this.consumeSemicolon();
  3934. init = this.finalize(init, new Node.VariableDeclaration(declarations, kind));
  3935. }
  3936. }
  3937. }
  3938. else {
  3939. var initStartToken = this.lookahead;
  3940. var previousAllowIn = this.context.allowIn;
  3941. this.context.allowIn = false;
  3942. init = this.inheritCoverGrammar(this.parseAssignmentExpression);
  3943. this.context.allowIn = previousAllowIn;
  3944. if (this.matchKeyword('in')) {
  3945. if (!this.context.isAssignmentTarget || init.type === syntax_1.Syntax.AssignmentExpression) {
  3946. this.tolerateError(messages_1.Messages.InvalidLHSInForIn);
  3947. }
  3948. this.nextToken();
  3949. this.reinterpretExpressionAsPattern(init);
  3950. left = init;
  3951. right = this.parseExpression();
  3952. init = null;
  3953. }
  3954. else if (this.matchContextualKeyword('of')) {
  3955. if (!this.context.isAssignmentTarget || init.type === syntax_1.Syntax.AssignmentExpression) {
  3956. this.tolerateError(messages_1.Messages.InvalidLHSInForLoop);
  3957. }
  3958. this.nextToken();
  3959. this.reinterpretExpressionAsPattern(init);
  3960. left = init;
  3961. right = this.parseAssignmentExpression();
  3962. init = null;
  3963. forIn = false;
  3964. }
  3965. else {
  3966. if (this.match(',')) {
  3967. var initSeq = [init];
  3968. while (this.match(',')) {
  3969. this.nextToken();
  3970. initSeq.push(this.isolateCoverGrammar(this.parseAssignmentExpression));
  3971. }
  3972. init = this.finalize(this.startNode(initStartToken), new Node.SequenceExpression(initSeq));
  3973. }
  3974. this.expect(';');
  3975. }
  3976. }
  3977. }
  3978. if (typeof left === 'undefined') {
  3979. if (!this.match(';')) {
  3980. test = this.parseExpression();
  3981. }
  3982. this.expect(';');
  3983. if (!this.match(')')) {
  3984. update = this.parseExpression();
  3985. }
  3986. }
  3987. var body;
  3988. if (!this.match(')') && this.config.tolerant) {
  3989. this.tolerateUnexpectedToken(this.nextToken());
  3990. body = this.finalize(this.createNode(), new Node.EmptyStatement());
  3991. }
  3992. else {
  3993. this.expect(')');
  3994. var previousInIteration = this.context.inIteration;
  3995. this.context.inIteration = true;
  3996. body = this.isolateCoverGrammar(this.parseStatement);
  3997. this.context.inIteration = previousInIteration;
  3998. }
  3999. return (typeof left === 'undefined') ?
  4000. this.finalize(node, new Node.ForStatement(init, test, update, body)) :
  4001. forIn ? this.finalize(node, new Node.ForInStatement(left, right, body)) :
  4002. this.finalize(node, new Node.ForOfStatement(left, right, body));
  4003. };
  4004. // https://tc39.github.io/ecma262/#sec-continue-statement
  4005. Parser.prototype.parseContinueStatement = function () {
  4006. var node = this.createNode();
  4007. this.expectKeyword('continue');
  4008. var label = null;
  4009. if (this.lookahead.type === 3 /* Identifier */ && !this.hasLineTerminator) {
  4010. var id = this.parseVariableIdentifier();
  4011. label = id;
  4012. var key = '$' + id.name;
  4013. if (!Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) {
  4014. this.throwError(messages_1.Messages.UnknownLabel, id.name);
  4015. }
  4016. }
  4017. this.consumeSemicolon();
  4018. if (label === null && !this.context.inIteration) {
  4019. this.throwError(messages_1.Messages.IllegalContinue);
  4020. }
  4021. return this.finalize(node, new Node.ContinueStatement(label));
  4022. };
  4023. // https://tc39.github.io/ecma262/#sec-break-statement
  4024. Parser.prototype.parseBreakStatement = function () {
  4025. var node = this.createNode();
  4026. this.expectKeyword('break');
  4027. var label = null;
  4028. if (this.lookahead.type === 3 /* Identifier */ && !this.hasLineTerminator) {
  4029. var id = this.parseVariableIdentifier();
  4030. var key = '$' + id.name;
  4031. if (!Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) {
  4032. this.throwError(messages_1.Messages.UnknownLabel, id.name);
  4033. }
  4034. label = id;
  4035. }
  4036. this.consumeSemicolon();
  4037. if (label === null && !this.context.inIteration && !this.context.inSwitch) {
  4038. this.throwError(messages_1.Messages.IllegalBreak);
  4039. }
  4040. return this.finalize(node, new Node.BreakStatement(label));
  4041. };
  4042. // https://tc39.github.io/ecma262/#sec-return-statement
  4043. Parser.prototype.parseReturnStatement = function () {
  4044. if (!this.context.inFunctionBody) {
  4045. this.tolerateError(messages_1.Messages.IllegalReturn);
  4046. }
  4047. var node = this.createNode();
  4048. this.expectKeyword('return');
  4049. var hasArgument = (!this.match(';') && !this.match('}') &&
  4050. !this.hasLineTerminator && this.lookahead.type !== 2 /* EOF */) ||
  4051. this.lookahead.type === 8 /* StringLiteral */ ||
  4052. this.lookahead.type === 10 /* Template */;
  4053. var argument = hasArgument ? this.parseExpression() : null;
  4054. this.consumeSemicolon();
  4055. return this.finalize(node, new Node.ReturnStatement(argument));
  4056. };
  4057. // https://tc39.github.io/ecma262/#sec-with-statement
  4058. Parser.prototype.parseWithStatement = function () {
  4059. if (this.context.strict) {
  4060. this.tolerateError(messages_1.Messages.StrictModeWith);
  4061. }
  4062. var node = this.createNode();
  4063. var body;
  4064. this.expectKeyword('with');
  4065. this.expect('(');
  4066. var object = this.parseExpression();
  4067. if (!this.match(')') && this.config.tolerant) {
  4068. this.tolerateUnexpectedToken(this.nextToken());
  4069. body = this.finalize(this.createNode(), new Node.EmptyStatement());
  4070. }
  4071. else {
  4072. this.expect(')');
  4073. body = this.parseStatement();
  4074. }
  4075. return this.finalize(node, new Node.WithStatement(object, body));
  4076. };
  4077. // https://tc39.github.io/ecma262/#sec-switch-statement
  4078. Parser.prototype.parseSwitchCase = function () {
  4079. var node = this.createNode();
  4080. var test;
  4081. if (this.matchKeyword('default')) {
  4082. this.nextToken();
  4083. test = null;
  4084. }
  4085. else {
  4086. this.expectKeyword('case');
  4087. test = this.parseExpression();
  4088. }
  4089. this.expect(':');
  4090. var consequent = [];
  4091. while (true) {
  4092. if (this.match('}') || this.matchKeyword('default') || this.matchKeyword('case')) {
  4093. break;
  4094. }
  4095. consequent.push(this.parseStatementListItem());
  4096. }
  4097. return this.finalize(node, new Node.SwitchCase(test, consequent));
  4098. };
  4099. Parser.prototype.parseSwitchStatement = function () {
  4100. var node = this.createNode();
  4101. this.expectKeyword('switch');
  4102. this.expect('(');
  4103. var discriminant = this.parseExpression();
  4104. this.expect(')');
  4105. var previousInSwitch = this.context.inSwitch;
  4106. this.context.inSwitch = true;
  4107. var cases = [];
  4108. var defaultFound = false;
  4109. this.expect('{');
  4110. while (true) {
  4111. if (this.match('}')) {
  4112. break;
  4113. }
  4114. var clause = this.parseSwitchCase();
  4115. if (clause.test === null) {
  4116. if (defaultFound) {
  4117. this.throwError(messages_1.Messages.MultipleDefaultsInSwitch);
  4118. }
  4119. defaultFound = true;
  4120. }
  4121. cases.push(clause);
  4122. }
  4123. this.expect('}');
  4124. this.context.inSwitch = previousInSwitch;
  4125. return this.finalize(node, new Node.SwitchStatement(discriminant, cases));
  4126. };
  4127. // https://tc39.github.io/ecma262/#sec-labelled-statements
  4128. Parser.prototype.parseLabelledStatement = function () {
  4129. var node = this.createNode();
  4130. var expr = this.parseExpression();
  4131. var statement;
  4132. if ((expr.type === syntax_1.Syntax.Identifier) && this.match(':')) {
  4133. this.nextToken();
  4134. var id = expr;
  4135. var key = '$' + id.name;
  4136. if (Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) {
  4137. this.throwError(messages_1.Messages.Redeclaration, 'Label', id.name);
  4138. }
  4139. this.context.labelSet[key] = true;
  4140. var body = void 0;
  4141. if (this.matchKeyword('class')) {
  4142. this.tolerateUnexpectedToken(this.lookahead);
  4143. body = this.parseClassDeclaration();
  4144. }
  4145. else if (this.matchKeyword('function')) {
  4146. var token = this.lookahead;
  4147. var declaration = this.parseFunctionDeclaration();
  4148. if (this.context.strict) {
  4149. this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunction);
  4150. }
  4151. else if (declaration.generator) {
  4152. this.tolerateUnexpectedToken(token, messages_1.Messages.GeneratorInLegacyContext);
  4153. }
  4154. body = declaration;
  4155. }
  4156. else {
  4157. body = this.parseStatement();
  4158. }
  4159. delete this.context.labelSet[key];
  4160. statement = new Node.LabeledStatement(id, body);
  4161. }
  4162. else {
  4163. this.consumeSemicolon();
  4164. statement = new Node.ExpressionStatement(expr);
  4165. }
  4166. return this.finalize(node, statement);
  4167. };
  4168. // https://tc39.github.io/ecma262/#sec-throw-statement
  4169. Parser.prototype.parseThrowStatement = function () {
  4170. var node = this.createNode();
  4171. this.expectKeyword('throw');
  4172. if (this.hasLineTerminator) {
  4173. this.throwError(messages_1.Messages.NewlineAfterThrow);
  4174. }
  4175. var argument = this.parseExpression();
  4176. this.consumeSemicolon();
  4177. return this.finalize(node, new Node.ThrowStatement(argument));
  4178. };
  4179. // https://tc39.github.io/ecma262/#sec-try-statement
  4180. Parser.prototype.parseCatchClause = function () {
  4181. var node = this.createNode();
  4182. this.expectKeyword('catch');
  4183. this.expect('(');
  4184. if (this.match(')')) {
  4185. this.throwUnexpectedToken(this.lookahead);
  4186. }
  4187. var params = [];
  4188. var param = this.parsePattern(params);
  4189. var paramMap = {};
  4190. for (var i = 0; i < params.length; i++) {
  4191. var key = '$' + params[i].value;
  4192. if (Object.prototype.hasOwnProperty.call(paramMap, key)) {
  4193. this.tolerateError(messages_1.Messages.DuplicateBinding, params[i].value);
  4194. }
  4195. paramMap[key] = true;
  4196. }
  4197. if (this.context.strict && param.type === syntax_1.Syntax.Identifier) {
  4198. if (this.scanner.isRestrictedWord(param.name)) {
  4199. this.tolerateError(messages_1.Messages.StrictCatchVariable);
  4200. }
  4201. }
  4202. this.expect(')');
  4203. var body = this.parseBlock();
  4204. return this.finalize(node, new Node.CatchClause(param, body));
  4205. };
  4206. Parser.prototype.parseFinallyClause = function () {
  4207. this.expectKeyword('finally');
  4208. return this.parseBlock();
  4209. };
  4210. Parser.prototype.parseTryStatement = function () {
  4211. var node = this.createNode();
  4212. this.expectKeyword('try');
  4213. var block = this.parseBlock();
  4214. var handler = this.matchKeyword('catch') ? this.parseCatchClause() : null;
  4215. var finalizer = this.matchKeyword('finally') ? this.parseFinallyClause() : null;
  4216. if (!handler && !finalizer) {
  4217. this.throwError(messages_1.Messages.NoCatchOrFinally);
  4218. }
  4219. return this.finalize(node, new Node.TryStatement(block, handler, finalizer));
  4220. };
  4221. // https://tc39.github.io/ecma262/#sec-debugger-statement
  4222. Parser.prototype.parseDebuggerStatement = function () {
  4223. var node = this.createNode();
  4224. this.expectKeyword('debugger');
  4225. this.consumeSemicolon();
  4226. return this.finalize(node, new Node.DebuggerStatement());
  4227. };
  4228. // https://tc39.github.io/ecma262/#sec-ecmascript-language-statements-and-declarations
  4229. Parser.prototype.parseStatement = function () {
  4230. var statement;
  4231. switch (this.lookahead.type) {
  4232. case 1 /* BooleanLiteral */:
  4233. case 5 /* NullLiteral */:
  4234. case 6 /* NumericLiteral */:
  4235. case 8 /* StringLiteral */:
  4236. case 10 /* Template */:
  4237. case 9 /* RegularExpression */:
  4238. statement = this.parseExpressionStatement();
  4239. break;
  4240. case 7 /* Punctuator */:
  4241. var value = this.lookahead.value;
  4242. if (value === '{') {
  4243. statement = this.parseBlock();
  4244. }
  4245. else if (value === '(') {
  4246. statement = this.parseExpressionStatement();
  4247. }
  4248. else if (value === ';') {
  4249. statement = this.parseEmptyStatement();
  4250. }
  4251. else {
  4252. statement = this.parseExpressionStatement();
  4253. }
  4254. break;
  4255. case 3 /* Identifier */:
  4256. statement = this.matchAsyncFunction() ? this.parseFunctionDeclaration() : this.parseLabelledStatement();
  4257. break;
  4258. case 4 /* Keyword */:
  4259. switch (this.lookahead.value) {
  4260. case 'break':
  4261. statement = this.parseBreakStatement();
  4262. break;
  4263. case 'continue':
  4264. statement = this.parseContinueStatement();
  4265. break;
  4266. case 'debugger':
  4267. statement = this.parseDebuggerStatement();
  4268. break;
  4269. case 'do':
  4270. statement = this.parseDoWhileStatement();
  4271. break;
  4272. case 'for':
  4273. statement = this.parseForStatement();
  4274. break;
  4275. case 'function':
  4276. statement = this.parseFunctionDeclaration();
  4277. break;
  4278. case 'if':
  4279. statement = this.parseIfStatement();
  4280. break;
  4281. case 'return':
  4282. statement = this.parseReturnStatement();
  4283. break;
  4284. case 'switch':
  4285. statement = this.parseSwitchStatement();
  4286. break;
  4287. case 'throw':
  4288. statement = this.parseThrowStatement();
  4289. break;
  4290. case 'try':
  4291. statement = this.parseTryStatement();
  4292. break;
  4293. case 'var':
  4294. statement = this.parseVariableStatement();
  4295. break;
  4296. case 'while':
  4297. statement = this.parseWhileStatement();
  4298. break;
  4299. case 'with':
  4300. statement = this.parseWithStatement();
  4301. break;
  4302. default:
  4303. statement = this.parseExpressionStatement();
  4304. break;
  4305. }
  4306. break;
  4307. default:
  4308. statement = this.throwUnexpectedToken(this.lookahead);
  4309. }
  4310. return statement;
  4311. };
  4312. // https://tc39.github.io/ecma262/#sec-function-definitions
  4313. Parser.prototype.parseFunctionSourceElements = function () {
  4314. var node = this.createNode();
  4315. this.expect('{');
  4316. var body = this.parseDirectivePrologues();
  4317. var previousLabelSet = this.context.labelSet;
  4318. var previousInIteration = this.context.inIteration;
  4319. var previousInSwitch = this.context.inSwitch;
  4320. var previousInFunctionBody = this.context.inFunctionBody;
  4321. this.context.labelSet = {};
  4322. this.context.inIteration = false;
  4323. this.context.inSwitch = false;
  4324. this.context.inFunctionBody = true;
  4325. while (this.lookahead.type !== 2 /* EOF */) {
  4326. if (this.match('}')) {
  4327. break;
  4328. }
  4329. body.push(this.parseStatementListItem());
  4330. }
  4331. this.expect('}');
  4332. this.context.labelSet = previousLabelSet;
  4333. this.context.inIteration = previousInIteration;
  4334. this.context.inSwitch = previousInSwitch;
  4335. this.context.inFunctionBody = previousInFunctionBody;
  4336. return this.finalize(node, new Node.BlockStatement(body));
  4337. };
  4338. Parser.prototype.validateParam = function (options, param, name) {
  4339. var key = '$' + name;
  4340. if (this.context.strict) {
  4341. if (this.scanner.isRestrictedWord(name)) {
  4342. options.stricted = param;
  4343. options.message = messages_1.Messages.StrictParamName;
  4344. }
  4345. if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) {
  4346. options.stricted = param;
  4347. options.message = messages_1.Messages.StrictParamDupe;
  4348. }
  4349. }
  4350. else if (!options.firstRestricted) {
  4351. if (this.scanner.isRestrictedWord(name)) {
  4352. options.firstRestricted = param;
  4353. options.message = messages_1.Messages.StrictParamName;
  4354. }
  4355. else if (this.scanner.isStrictModeReservedWord(name)) {
  4356. options.firstRestricted = param;
  4357. options.message = messages_1.Messages.StrictReservedWord;
  4358. }
  4359. else if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) {
  4360. options.stricted = param;
  4361. options.message = messages_1.Messages.StrictParamDupe;
  4362. }
  4363. }
  4364. /* istanbul ignore next */
  4365. if (typeof Object.defineProperty === 'function') {
  4366. Object.defineProperty(options.paramSet, key, { value: true, enumerable: true, writable: true, configurable: true });
  4367. }
  4368. else {
  4369. options.paramSet[key] = true;
  4370. }
  4371. };
  4372. Parser.prototype.parseRestElement = function (params) {
  4373. var node = this.createNode();
  4374. this.expect('...');
  4375. var arg = this.parsePattern(params);
  4376. if (this.match('=')) {
  4377. this.throwError(messages_1.Messages.DefaultRestParameter);
  4378. }
  4379. if (!this.match(')')) {
  4380. this.throwError(messages_1.Messages.ParameterAfterRestParameter);
  4381. }
  4382. return this.finalize(node, new Node.RestElement(arg));
  4383. };
  4384. Parser.prototype.parseFormalParameter = function (options) {
  4385. var params = [];
  4386. var param = this.match('...') ? this.parseRestElement(params) : this.parsePatternWithDefault(params);
  4387. for (var i = 0; i < params.length; i++) {
  4388. this.validateParam(options, params[i], params[i].value);
  4389. }
  4390. options.simple = options.simple && (param instanceof Node.Identifier);
  4391. options.params.push(param);
  4392. };
  4393. Parser.prototype.parseFormalParameters = function (firstRestricted) {
  4394. var options;
  4395. options = {
  4396. simple: true,
  4397. params: [],
  4398. firstRestricted: firstRestricted
  4399. };
  4400. this.expect('(');
  4401. if (!this.match(')')) {
  4402. options.paramSet = {};
  4403. while (this.lookahead.type !== 2 /* EOF */) {
  4404. this.parseFormalParameter(options);
  4405. if (this.match(')')) {
  4406. break;
  4407. }
  4408. this.expect(',');
  4409. if (this.match(')')) {
  4410. break;
  4411. }
  4412. }
  4413. }
  4414. this.expect(')');
  4415. return {
  4416. simple: options.simple,
  4417. params: options.params,
  4418. stricted: options.stricted,
  4419. firstRestricted: options.firstRestricted,
  4420. message: options.message
  4421. };
  4422. };
  4423. Parser.prototype.matchAsyncFunction = function () {
  4424. var match = this.matchContextualKeyword('async');
  4425. if (match) {
  4426. var state = this.scanner.saveState();
  4427. this.scanner.scanComments();
  4428. var next = this.scanner.lex();
  4429. this.scanner.restoreState(state);
  4430. match = (state.lineNumber === next.lineNumber) && (next.type === 4 /* Keyword */) && (next.value === 'function');
  4431. }
  4432. return match;
  4433. };
  4434. Parser.prototype.parseFunctionDeclaration = function (identifierIsOptional) {
  4435. var node = this.createNode();
  4436. var isAsync = this.matchContextualKeyword('async');
  4437. if (isAsync) {
  4438. this.nextToken();
  4439. }
  4440. this.expectKeyword('function');
  4441. var isGenerator = isAsync ? false : this.match('*');
  4442. if (isGenerator) {
  4443. this.nextToken();
  4444. }
  4445. var message;
  4446. var id = null;
  4447. var firstRestricted = null;
  4448. if (!identifierIsOptional || !this.match('(')) {
  4449. var token = this.lookahead;
  4450. id = this.parseVariableIdentifier();
  4451. if (this.context.strict) {
  4452. if (this.scanner.isRestrictedWord(token.value)) {
  4453. this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunctionName);
  4454. }
  4455. }
  4456. else {
  4457. if (this.scanner.isRestrictedWord(token.value)) {
  4458. firstRestricted = token;
  4459. message = messages_1.Messages.StrictFunctionName;
  4460. }
  4461. else if (this.scanner.isStrictModeReservedWord(token.value)) {
  4462. firstRestricted = token;
  4463. message = messages_1.Messages.StrictReservedWord;
  4464. }
  4465. }
  4466. }
  4467. var previousAllowAwait = this.context.await;
  4468. var previousAllowYield = this.context.allowYield;
  4469. this.context.await = isAsync;
  4470. this.context.allowYield = !isGenerator;
  4471. var formalParameters = this.parseFormalParameters(firstRestricted);
  4472. var params = formalParameters.params;
  4473. var stricted = formalParameters.stricted;
  4474. firstRestricted = formalParameters.firstRestricted;
  4475. if (formalParameters.message) {
  4476. message = formalParameters.message;
  4477. }
  4478. var previousStrict = this.context.strict;
  4479. var previousAllowStrictDirective = this.context.allowStrictDirective;
  4480. this.context.allowStrictDirective = formalParameters.simple;
  4481. var body = this.parseFunctionSourceElements();
  4482. if (this.context.strict && firstRestricted) {
  4483. this.throwUnexpectedToken(firstRestricted, message);
  4484. }
  4485. if (this.context.strict && stricted) {
  4486. this.tolerateUnexpectedToken(stricted, message);
  4487. }
  4488. this.context.strict = previousStrict;
  4489. this.context.allowStrictDirective = previousAllowStrictDirective;
  4490. this.context.await = previousAllowAwait;
  4491. this.context.allowYield = previousAllowYield;
  4492. return isAsync ? this.finalize(node, new Node.AsyncFunctionDeclaration(id, params, body)) :
  4493. this.finalize(node, new Node.FunctionDeclaration(id, params, body, isGenerator));
  4494. };
  4495. Parser.prototype.parseFunctionExpression = function () {
  4496. var node = this.createNode();
  4497. var isAsync = this.matchContextualKeyword('async');
  4498. if (isAsync) {
  4499. this.nextToken();
  4500. }
  4501. this.expectKeyword('function');
  4502. var isGenerator = isAsync ? false : this.match('*');
  4503. if (isGenerator) {
  4504. this.nextToken();
  4505. }
  4506. var message;
  4507. var id = null;
  4508. var firstRestricted;
  4509. var previousAllowAwait = this.context.await;
  4510. var previousAllowYield = this.context.allowYield;
  4511. this.context.await = isAsync;
  4512. this.context.allowYield = !isGenerator;
  4513. if (!this.match('(')) {
  4514. var token = this.lookahead;
  4515. id = (!this.context.strict && !isGenerator && this.matchKeyword('yield')) ? this.parseIdentifierName() : this.parseVariableIdentifier();
  4516. if (this.context.strict) {
  4517. if (this.scanner.isRestrictedWord(token.value)) {
  4518. this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunctionName);
  4519. }
  4520. }
  4521. else {
  4522. if (this.scanner.isRestrictedWord(token.value)) {
  4523. firstRestricted = token;
  4524. message = messages_1.Messages.StrictFunctionName;
  4525. }
  4526. else if (this.scanner.isStrictModeReservedWord(token.value)) {
  4527. firstRestricted = token;
  4528. message = messages_1.Messages.StrictReservedWord;
  4529. }
  4530. }
  4531. }
  4532. var formalParameters = this.parseFormalParameters(firstRestricted);
  4533. var params = formalParameters.params;
  4534. var stricted = formalParameters.stricted;
  4535. firstRestricted = formalParameters.firstRestricted;
  4536. if (formalParameters.message) {
  4537. message = formalParameters.message;
  4538. }
  4539. var previousStrict = this.context.strict;
  4540. var previousAllowStrictDirective = this.context.allowStrictDirective;
  4541. this.context.allowStrictDirective = formalParameters.simple;
  4542. var body = this.parseFunctionSourceElements();
  4543. if (this.context.strict && firstRestricted) {
  4544. this.throwUnexpectedToken(firstRestricted, message);
  4545. }
  4546. if (this.context.strict && stricted) {
  4547. this.tolerateUnexpectedToken(stricted, message);
  4548. }
  4549. this.context.strict = previousStrict;
  4550. this.context.allowStrictDirective = previousAllowStrictDirective;
  4551. this.context.await = previousAllowAwait;
  4552. this.context.allowYield = previousAllowYield;
  4553. return isAsync ? this.finalize(node, new Node.AsyncFunctionExpression(id, params, body)) :
  4554. this.finalize(node, new Node.FunctionExpression(id, params, body, isGenerator));
  4555. };
  4556. // https://tc39.github.io/ecma262/#sec-directive-prologues-and-the-use-strict-directive
  4557. Parser.prototype.parseDirective = function () {
  4558. var token = this.lookahead;
  4559. var node = this.createNode();
  4560. var expr = this.parseExpression();
  4561. var directive = (expr.type === syntax_1.Syntax.Literal) ? this.getTokenRaw(token).slice(1, -1) : null;
  4562. this.consumeSemicolon();
  4563. return this.finalize(node, directive ? new Node.Directive(expr, directive) : new Node.ExpressionStatement(expr));
  4564. };
  4565. Parser.prototype.parseDirectivePrologues = function () {
  4566. var firstRestricted = null;
  4567. var body = [];
  4568. while (true) {
  4569. var token = this.lookahead;
  4570. if (token.type !== 8 /* StringLiteral */) {
  4571. break;
  4572. }
  4573. var statement = this.parseDirective();
  4574. body.push(statement);
  4575. var directive = statement.directive;
  4576. if (typeof directive !== 'string') {
  4577. break;
  4578. }
  4579. if (directive === 'use strict') {
  4580. this.context.strict = true;
  4581. if (firstRestricted) {
  4582. this.tolerateUnexpectedToken(firstRestricted, messages_1.Messages.StrictOctalLiteral);
  4583. }
  4584. if (!this.context.allowStrictDirective) {
  4585. this.tolerateUnexpectedToken(token, messages_1.Messages.IllegalLanguageModeDirective);
  4586. }
  4587. }
  4588. else {
  4589. if (!firstRestricted && token.octal) {
  4590. firstRestricted = token;
  4591. }
  4592. }
  4593. }
  4594. return body;
  4595. };
  4596. // https://tc39.github.io/ecma262/#sec-method-definitions
  4597. Parser.prototype.qualifiedPropertyName = function (token) {
  4598. switch (token.type) {
  4599. case 3 /* Identifier */:
  4600. case 8 /* StringLiteral */:
  4601. case 1 /* BooleanLiteral */:
  4602. case 5 /* NullLiteral */:
  4603. case 6 /* NumericLiteral */:
  4604. case 4 /* Keyword */:
  4605. return true;
  4606. case 7 /* Punctuator */:
  4607. return token.value === '[';
  4608. default:
  4609. break;
  4610. }
  4611. return false;
  4612. };
  4613. Parser.prototype.parseGetterMethod = function () {
  4614. var node = this.createNode();
  4615. var isGenerator = false;
  4616. var previousAllowYield = this.context.allowYield;
  4617. this.context.allowYield = !isGenerator;
  4618. var formalParameters = this.parseFormalParameters();
  4619. if (formalParameters.params.length > 0) {
  4620. this.tolerateError(messages_1.Messages.BadGetterArity);
  4621. }
  4622. var method = this.parsePropertyMethod(formalParameters);
  4623. this.context.allowYield = previousAllowYield;
  4624. return this.finalize(node, new Node.FunctionExpression(null, formalParameters.params, method, isGenerator));
  4625. };
  4626. Parser.prototype.parseSetterMethod = function () {
  4627. var node = this.createNode();
  4628. var isGenerator = false;
  4629. var previousAllowYield = this.context.allowYield;
  4630. this.context.allowYield = !isGenerator;
  4631. var formalParameters = this.parseFormalParameters();
  4632. if (formalParameters.params.length !== 1) {
  4633. this.tolerateError(messages_1.Messages.BadSetterArity);
  4634. }
  4635. else if (formalParameters.params[0] instanceof Node.RestElement) {
  4636. this.tolerateError(messages_1.Messages.BadSetterRestParameter);
  4637. }
  4638. var method = this.parsePropertyMethod(formalParameters);
  4639. this.context.allowYield = previousAllowYield;
  4640. return this.finalize(node, new Node.FunctionExpression(null, formalParameters.params, method, isGenerator));
  4641. };
  4642. Parser.prototype.parseGeneratorMethod = function () {
  4643. var node = this.createNode();
  4644. var isGenerator = true;
  4645. var previousAllowYield = this.context.allowYield;
  4646. this.context.allowYield = true;
  4647. var params = this.parseFormalParameters();
  4648. this.context.allowYield = false;
  4649. var method = this.parsePropertyMethod(params);
  4650. this.context.allowYield = previousAllowYield;
  4651. return this.finalize(node, new Node.FunctionExpression(null, params.params, method, isGenerator));
  4652. };
  4653. // https://tc39.github.io/ecma262/#sec-generator-function-definitions
  4654. Parser.prototype.isStartOfExpression = function () {
  4655. var start = true;
  4656. var value = this.lookahead.value;
  4657. switch (this.lookahead.type) {
  4658. case 7 /* Punctuator */:
  4659. start = (value === '[') || (value === '(') || (value === '{') ||
  4660. (value === '+') || (value === '-') ||
  4661. (value === '!') || (value === '~') ||
  4662. (value === '++') || (value === '--') ||
  4663. (value === '/') || (value === '/='); // regular expression literal
  4664. break;
  4665. case 4 /* Keyword */:
  4666. start = (value === 'class') || (value === 'delete') ||
  4667. (value === 'function') || (value === 'let') || (value === 'new') ||
  4668. (value === 'super') || (value === 'this') || (value === 'typeof') ||
  4669. (value === 'void') || (value === 'yield');
  4670. break;
  4671. default:
  4672. break;
  4673. }
  4674. return start;
  4675. };
  4676. Parser.prototype.parseYieldExpression = function () {
  4677. var node = this.createNode();
  4678. this.expectKeyword('yield');
  4679. var argument = null;
  4680. var delegate = false;
  4681. if (!this.hasLineTerminator) {
  4682. var previousAllowYield = this.context.allowYield;
  4683. this.context.allowYield = false;
  4684. delegate = this.match('*');
  4685. if (delegate) {
  4686. this.nextToken();
  4687. argument = this.parseAssignmentExpression();
  4688. }
  4689. else if (this.isStartOfExpression()) {
  4690. argument = this.parseAssignmentExpression();
  4691. }
  4692. this.context.allowYield = previousAllowYield;
  4693. }
  4694. return this.finalize(node, new Node.YieldExpression(argument, delegate));
  4695. };
  4696. // https://tc39.github.io/ecma262/#sec-class-definitions
  4697. Parser.prototype.parseClassElement = function (hasConstructor) {
  4698. var token = this.lookahead;
  4699. var node = this.createNode();
  4700. var kind = '';
  4701. var key = null;
  4702. var value = null;
  4703. var computed = false;
  4704. var method = false;
  4705. var isStatic = false;
  4706. var isAsync = false;
  4707. if (this.match('*')) {
  4708. this.nextToken();
  4709. }
  4710. else {
  4711. computed = this.match('[');
  4712. key = this.parseObjectPropertyKey();
  4713. var id = key;
  4714. if (id.name === 'static' && (this.qualifiedPropertyName(this.lookahead) || this.match('*'))) {
  4715. token = this.lookahead;
  4716. isStatic = true;
  4717. computed = this.match('[');
  4718. if (this.match('*')) {
  4719. this.nextToken();
  4720. }
  4721. else {
  4722. key = this.parseObjectPropertyKey();
  4723. }
  4724. }
  4725. if ((token.type === 3 /* Identifier */) && !this.hasLineTerminator && (token.value === 'async')) {
  4726. var punctuator = this.lookahead.value;
  4727. if (punctuator !== ':' && punctuator !== '(' && punctuator !== '*') {
  4728. isAsync = true;
  4729. token = this.lookahead;
  4730. key = this.parseObjectPropertyKey();
  4731. if (token.type === 3 /* Identifier */ && token.value === 'constructor') {
  4732. this.tolerateUnexpectedToken(token, messages_1.Messages.ConstructorIsAsync);
  4733. }
  4734. }
  4735. }
  4736. }
  4737. var lookaheadPropertyKey = this.qualifiedPropertyName(this.lookahead);
  4738. if (token.type === 3 /* Identifier */) {
  4739. if (token.value === 'get' && lookaheadPropertyKey) {
  4740. kind = 'get';
  4741. computed = this.match('[');
  4742. key = this.parseObjectPropertyKey();
  4743. this.context.allowYield = false;
  4744. value = this.parseGetterMethod();
  4745. }
  4746. else if (token.value === 'set' && lookaheadPropertyKey) {
  4747. kind = 'set';
  4748. computed = this.match('[');
  4749. key = this.parseObjectPropertyKey();
  4750. value = this.parseSetterMethod();
  4751. }
  4752. }
  4753. else if (token.type === 7 /* Punctuator */ && token.value === '*' && lookaheadPropertyKey) {
  4754. kind = 'init';
  4755. computed = this.match('[');
  4756. key = this.parseObjectPropertyKey();
  4757. value = this.parseGeneratorMethod();
  4758. method = true;
  4759. }
  4760. if (!kind && key && this.match('(')) {
  4761. kind = 'init';
  4762. value = isAsync ? this.parsePropertyMethodAsyncFunction() : this.parsePropertyMethodFunction();
  4763. method = true;
  4764. }
  4765. if (!kind) {
  4766. this.throwUnexpectedToken(this.lookahead);
  4767. }
  4768. if (kind === 'init') {
  4769. kind = 'method';
  4770. }
  4771. if (!computed) {
  4772. if (isStatic && this.isPropertyKey(key, 'prototype')) {
  4773. this.throwUnexpectedToken(token, messages_1.Messages.StaticPrototype);
  4774. }
  4775. if (!isStatic && this.isPropertyKey(key, 'constructor')) {
  4776. if (kind !== 'method' || !method || (value && value.generator)) {
  4777. this.throwUnexpectedToken(token, messages_1.Messages.ConstructorSpecialMethod);
  4778. }
  4779. if (hasConstructor.value) {
  4780. this.throwUnexpectedToken(token, messages_1.Messages.DuplicateConstructor);
  4781. }
  4782. else {
  4783. hasConstructor.value = true;
  4784. }
  4785. kind = 'constructor';
  4786. }
  4787. }
  4788. return this.finalize(node, new Node.MethodDefinition(key, computed, value, kind, isStatic));
  4789. };
  4790. Parser.prototype.parseClassElementList = function () {
  4791. var body = [];
  4792. var hasConstructor = { value: false };
  4793. this.expect('{');
  4794. while (!this.match('}')) {
  4795. if (this.match(';')) {
  4796. this.nextToken();
  4797. }
  4798. else {
  4799. body.push(this.parseClassElement(hasConstructor));
  4800. }
  4801. }
  4802. this.expect('}');
  4803. return body;
  4804. };
  4805. Parser.prototype.parseClassBody = function () {
  4806. var node = this.createNode();
  4807. var elementList = this.parseClassElementList();
  4808. return this.finalize(node, new Node.ClassBody(elementList));
  4809. };
  4810. Parser.prototype.parseClassDeclaration = function (identifierIsOptional) {
  4811. var node = this.createNode();
  4812. var previousStrict = this.context.strict;
  4813. this.context.strict = true;
  4814. this.expectKeyword('class');
  4815. var id = (identifierIsOptional && (this.lookahead.type !== 3 /* Identifier */)) ? null : this.parseVariableIdentifier();
  4816. var superClass = null;
  4817. if (this.matchKeyword('extends')) {
  4818. this.nextToken();
  4819. superClass = this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall);
  4820. }
  4821. var classBody = this.parseClassBody();
  4822. this.context.strict = previousStrict;
  4823. return this.finalize(node, new Node.ClassDeclaration(id, superClass, classBody));
  4824. };
  4825. Parser.prototype.parseClassExpression = function () {
  4826. var node = this.createNode();
  4827. var previousStrict = this.context.strict;
  4828. this.context.strict = true;
  4829. this.expectKeyword('class');
  4830. var id = (this.lookahead.type === 3 /* Identifier */) ? this.parseVariableIdentifier() : null;
  4831. var superClass = null;
  4832. if (this.matchKeyword('extends')) {
  4833. this.nextToken();
  4834. superClass = this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall);
  4835. }
  4836. var classBody = this.parseClassBody();
  4837. this.context.strict = previousStrict;
  4838. return this.finalize(node, new Node.ClassExpression(id, superClass, classBody));
  4839. };
  4840. // https://tc39.github.io/ecma262/#sec-scripts
  4841. // https://tc39.github.io/ecma262/#sec-modules
  4842. Parser.prototype.parseModule = function () {
  4843. this.context.strict = true;
  4844. this.context.isModule = true;
  4845. this.scanner.isModule = true;
  4846. var node = this.createNode();
  4847. var body = this.parseDirectivePrologues();
  4848. while (this.lookahead.type !== 2 /* EOF */) {
  4849. body.push(this.parseStatementListItem());
  4850. }
  4851. return this.finalize(node, new Node.Module(body));
  4852. };
  4853. Parser.prototype.parseScript = function () {
  4854. var node = this.createNode();
  4855. var body = this.parseDirectivePrologues();
  4856. while (this.lookahead.type !== 2 /* EOF */) {
  4857. body.push(this.parseStatementListItem());
  4858. }
  4859. return this.finalize(node, new Node.Script(body));
  4860. };
  4861. // https://tc39.github.io/ecma262/#sec-imports
  4862. Parser.prototype.parseModuleSpecifier = function () {
  4863. var node = this.createNode();
  4864. if (this.lookahead.type !== 8 /* StringLiteral */) {
  4865. this.throwError(messages_1.Messages.InvalidModuleSpecifier);
  4866. }
  4867. var token = this.nextToken();
  4868. var raw = this.getTokenRaw(token);
  4869. return this.finalize(node, new Node.Literal(token.value, raw));
  4870. };
  4871. // import {<foo as bar>} ...;
  4872. Parser.prototype.parseImportSpecifier = function () {
  4873. var node = this.createNode();
  4874. var imported;
  4875. var local;
  4876. if (this.lookahead.type === 3 /* Identifier */) {
  4877. imported = this.parseVariableIdentifier();
  4878. local = imported;
  4879. if (this.matchContextualKeyword('as')) {
  4880. this.nextToken();
  4881. local = this.parseVariableIdentifier();
  4882. }
  4883. }
  4884. else {
  4885. imported = this.parseIdentifierName();
  4886. local = imported;
  4887. if (this.matchContextualKeyword('as')) {
  4888. this.nextToken();
  4889. local = this.parseVariableIdentifier();
  4890. }
  4891. else {
  4892. this.throwUnexpectedToken(this.nextToken());
  4893. }
  4894. }
  4895. return this.finalize(node, new Node.ImportSpecifier(local, imported));
  4896. };
  4897. // {foo, bar as bas}
  4898. Parser.prototype.parseNamedImports = function () {
  4899. this.expect('{');
  4900. var specifiers = [];
  4901. while (!this.match('}')) {
  4902. specifiers.push(this.parseImportSpecifier());
  4903. if (!this.match('}')) {
  4904. this.expect(',');
  4905. }
  4906. }
  4907. this.expect('}');
  4908. return specifiers;
  4909. };
  4910. // import <foo> ...;
  4911. Parser.prototype.parseImportDefaultSpecifier = function () {
  4912. var node = this.createNode();
  4913. var local = this.parseIdentifierName();
  4914. return this.finalize(node, new Node.ImportDefaultSpecifier(local));
  4915. };
  4916. // import <* as foo> ...;
  4917. Parser.prototype.parseImportNamespaceSpecifier = function () {
  4918. var node = this.createNode();
  4919. this.expect('*');
  4920. if (!this.matchContextualKeyword('as')) {
  4921. this.throwError(messages_1.Messages.NoAsAfterImportNamespace);
  4922. }
  4923. this.nextToken();
  4924. var local = this.parseIdentifierName();
  4925. return this.finalize(node, new Node.ImportNamespaceSpecifier(local));
  4926. };
  4927. Parser.prototype.parseImportDeclaration = function () {
  4928. if (this.context.inFunctionBody) {
  4929. this.throwError(messages_1.Messages.IllegalImportDeclaration);
  4930. }
  4931. var node = this.createNode();
  4932. this.expectKeyword('import');
  4933. var src;
  4934. var specifiers = [];
  4935. if (this.lookahead.type === 8 /* StringLiteral */) {
  4936. // import 'foo';
  4937. src = this.parseModuleSpecifier();
  4938. }
  4939. else {
  4940. if (this.match('{')) {
  4941. // import {bar}
  4942. specifiers = specifiers.concat(this.parseNamedImports());
  4943. }
  4944. else if (this.match('*')) {
  4945. // import * as foo
  4946. specifiers.push(this.parseImportNamespaceSpecifier());
  4947. }
  4948. else if (this.isIdentifierName(this.lookahead) && !this.matchKeyword('default')) {
  4949. // import foo
  4950. specifiers.push(this.parseImportDefaultSpecifier());
  4951. if (this.match(',')) {
  4952. this.nextToken();
  4953. if (this.match('*')) {
  4954. // import foo, * as foo
  4955. specifiers.push(this.parseImportNamespaceSpecifier());
  4956. }
  4957. else if (this.match('{')) {
  4958. // import foo, {bar}
  4959. specifiers = specifiers.concat(this.parseNamedImports());
  4960. }
  4961. else {
  4962. this.throwUnexpectedToken(this.lookahead);
  4963. }
  4964. }
  4965. }
  4966. else {
  4967. this.throwUnexpectedToken(this.nextToken());
  4968. }
  4969. if (!this.matchContextualKeyword('from')) {
  4970. var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause;
  4971. this.throwError(message, this.lookahead.value);
  4972. }
  4973. this.nextToken();
  4974. src = this.parseModuleSpecifier();
  4975. }
  4976. this.consumeSemicolon();
  4977. return this.finalize(node, new Node.ImportDeclaration(specifiers, src));
  4978. };
  4979. // https://tc39.github.io/ecma262/#sec-exports
  4980. Parser.prototype.parseExportSpecifier = function () {
  4981. var node = this.createNode();
  4982. var local = this.parseIdentifierName();
  4983. var exported = local;
  4984. if (this.matchContextualKeyword('as')) {
  4985. this.nextToken();
  4986. exported = this.parseIdentifierName();
  4987. }
  4988. return this.finalize(node, new Node.ExportSpecifier(local, exported));
  4989. };
  4990. Parser.prototype.parseExportDeclaration = function () {
  4991. if (this.context.inFunctionBody) {
  4992. this.throwError(messages_1.Messages.IllegalExportDeclaration);
  4993. }
  4994. var node = this.createNode();
  4995. this.expectKeyword('export');
  4996. var exportDeclaration;
  4997. if (this.matchKeyword('default')) {
  4998. // export default ...
  4999. this.nextToken();
  5000. if (this.matchKeyword('function')) {
  5001. // export default function foo () {}
  5002. // export default function () {}
  5003. var declaration = this.parseFunctionDeclaration(true);
  5004. exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration));
  5005. }
  5006. else if (this.matchKeyword('class')) {
  5007. // export default class foo {}
  5008. var declaration = this.parseClassDeclaration(true);
  5009. exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration));
  5010. }
  5011. else if (this.matchContextualKeyword('async')) {
  5012. // export default async function f () {}
  5013. // export default async function () {}
  5014. // export default async x => x
  5015. var declaration = this.matchAsyncFunction() ? this.parseFunctionDeclaration(true) : this.parseAssignmentExpression();
  5016. exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration));
  5017. }
  5018. else {
  5019. if (this.matchContextualKeyword('from')) {
  5020. this.throwError(messages_1.Messages.UnexpectedToken, this.lookahead.value);
  5021. }
  5022. // export default {};
  5023. // export default [];
  5024. // export default (1 + 2);
  5025. var declaration = this.match('{') ? this.parseObjectInitializer() :
  5026. this.match('[') ? this.parseArrayInitializer() : this.parseAssignmentExpression();
  5027. this.consumeSemicolon();
  5028. exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration));
  5029. }
  5030. }
  5031. else if (this.match('*')) {
  5032. // export * from 'foo';
  5033. this.nextToken();
  5034. if (!this.matchContextualKeyword('from')) {
  5035. var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause;
  5036. this.throwError(message, this.lookahead.value);
  5037. }
  5038. this.nextToken();
  5039. var src = this.parseModuleSpecifier();
  5040. this.consumeSemicolon();
  5041. exportDeclaration = this.finalize(node, new Node.ExportAllDeclaration(src));
  5042. }
  5043. else if (this.lookahead.type === 4 /* Keyword */) {
  5044. // export var f = 1;
  5045. var declaration = void 0;
  5046. switch (this.lookahead.value) {
  5047. case 'let':
  5048. case 'const':
  5049. declaration = this.parseLexicalDeclaration({ inFor: false });
  5050. break;
  5051. case 'var':
  5052. case 'class':
  5053. case 'function':
  5054. declaration = this.parseStatementListItem();
  5055. break;
  5056. default:
  5057. this.throwUnexpectedToken(this.lookahead);
  5058. }
  5059. exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(declaration, [], null));
  5060. }
  5061. else if (this.matchAsyncFunction()) {
  5062. var declaration = this.parseFunctionDeclaration();
  5063. exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(declaration, [], null));
  5064. }
  5065. else {
  5066. var specifiers = [];
  5067. var source = null;
  5068. var isExportFromIdentifier = false;
  5069. this.expect('{');
  5070. while (!this.match('}')) {
  5071. isExportFromIdentifier = isExportFromIdentifier || this.matchKeyword('default');
  5072. specifiers.push(this.parseExportSpecifier());
  5073. if (!this.match('}')) {
  5074. this.expect(',');
  5075. }
  5076. }
  5077. this.expect('}');
  5078. if (this.matchContextualKeyword('from')) {
  5079. // export {default} from 'foo';
  5080. // export {foo} from 'foo';
  5081. this.nextToken();
  5082. source = this.parseModuleSpecifier();
  5083. this.consumeSemicolon();
  5084. }
  5085. else if (isExportFromIdentifier) {
  5086. // export {default}; // missing fromClause
  5087. var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause;
  5088. this.throwError(message, this.lookahead.value);
  5089. }
  5090. else {
  5091. // export {foo};
  5092. this.consumeSemicolon();
  5093. }
  5094. exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(null, specifiers, source));
  5095. }
  5096. return exportDeclaration;
  5097. };
  5098. return Parser;
  5099. }());
  5100. exports.Parser = Parser;
  5101. /***/ },
  5102. /* 9 */
  5103. /***/ function(module, exports) {
  5104. "use strict";
  5105. // Ensure the condition is true, otherwise throw an error.
  5106. // This is only to have a better contract semantic, i.e. another safety net
  5107. // to catch a logic error. The condition shall be fulfilled in normal case.
  5108. // Do NOT use this to enforce a certain condition on any user input.
  5109. Object.defineProperty(exports, "__esModule", { value: true });
  5110. function assert(condition, message) {
  5111. /* istanbul ignore if */
  5112. if (!condition) {
  5113. throw new Error('ASSERT: ' + message);
  5114. }
  5115. }
  5116. exports.assert = assert;
  5117. /***/ },
  5118. /* 10 */
  5119. /***/ function(module, exports) {
  5120. "use strict";
  5121. /* tslint:disable:max-classes-per-file */
  5122. Object.defineProperty(exports, "__esModule", { value: true });
  5123. var ErrorHandler = (function () {
  5124. function ErrorHandler() {
  5125. this.errors = [];
  5126. this.tolerant = false;
  5127. }
  5128. ErrorHandler.prototype.recordError = function (error) {
  5129. this.errors.push(error);
  5130. };
  5131. ErrorHandler.prototype.tolerate = function (error) {
  5132. if (this.tolerant) {
  5133. this.recordError(error);
  5134. }
  5135. else {
  5136. throw error;
  5137. }
  5138. };
  5139. ErrorHandler.prototype.constructError = function (msg, column) {
  5140. var error = new Error(msg);
  5141. try {
  5142. throw error;
  5143. }
  5144. catch (base) {
  5145. /* istanbul ignore else */
  5146. if (Object.create && Object.defineProperty) {
  5147. error = Object.create(base);
  5148. Object.defineProperty(error, 'column', { value: column });
  5149. }
  5150. }
  5151. /* istanbul ignore next */
  5152. return error;
  5153. };
  5154. ErrorHandler.prototype.createError = function (index, line, col, description) {
  5155. var msg = 'Line ' + line + ': ' + description;
  5156. var error = this.constructError(msg, col);
  5157. error.index = index;
  5158. error.lineNumber = line;
  5159. error.description = description;
  5160. return error;
  5161. };
  5162. ErrorHandler.prototype.throwError = function (index, line, col, description) {
  5163. throw this.createError(index, line, col, description);
  5164. };
  5165. ErrorHandler.prototype.tolerateError = function (index, line, col, description) {
  5166. var error = this.createError(index, line, col, description);
  5167. if (this.tolerant) {
  5168. this.recordError(error);
  5169. }
  5170. else {
  5171. throw error;
  5172. }
  5173. };
  5174. return ErrorHandler;
  5175. }());
  5176. exports.ErrorHandler = ErrorHandler;
  5177. /***/ },
  5178. /* 11 */
  5179. /***/ function(module, exports) {
  5180. "use strict";
  5181. Object.defineProperty(exports, "__esModule", { value: true });
  5182. // Error messages should be identical to V8.
  5183. exports.Messages = {
  5184. BadGetterArity: 'Getter must not have any formal parameters',
  5185. BadSetterArity: 'Setter must have exactly one formal parameter',
  5186. BadSetterRestParameter: 'Setter function argument must not be a rest parameter',
  5187. ConstructorIsAsync: 'Class constructor may not be an async method',
  5188. ConstructorSpecialMethod: 'Class constructor may not be an accessor',
  5189. DeclarationMissingInitializer: 'Missing initializer in %0 declaration',
  5190. DefaultRestParameter: 'Unexpected token =',
  5191. DuplicateBinding: 'Duplicate binding %0',
  5192. DuplicateConstructor: 'A class may only have one constructor',
  5193. DuplicateProtoProperty: 'Duplicate __proto__ fields are not allowed in object literals',
  5194. ForInOfLoopInitializer: '%0 loop variable declaration may not have an initializer',
  5195. GeneratorInLegacyContext: 'Generator declarations are not allowed in legacy contexts',
  5196. IllegalBreak: 'Illegal break statement',
  5197. IllegalContinue: 'Illegal continue statement',
  5198. IllegalExportDeclaration: 'Unexpected token',
  5199. IllegalImportDeclaration: 'Unexpected token',
  5200. IllegalLanguageModeDirective: 'Illegal \'use strict\' directive in function with non-simple parameter list',
  5201. IllegalReturn: 'Illegal return statement',
  5202. InvalidEscapedReservedWord: 'Keyword must not contain escaped characters',
  5203. InvalidHexEscapeSequence: 'Invalid hexadecimal escape sequence',
  5204. InvalidLHSInAssignment: 'Invalid left-hand side in assignment',
  5205. InvalidLHSInForIn: 'Invalid left-hand side in for-in',
  5206. InvalidLHSInForLoop: 'Invalid left-hand side in for-loop',
  5207. InvalidModuleSpecifier: 'Unexpected token',
  5208. InvalidRegExp: 'Invalid regular expression',
  5209. LetInLexicalBinding: 'let is disallowed as a lexically bound name',
  5210. MissingFromClause: 'Unexpected token',
  5211. MultipleDefaultsInSwitch: 'More than one default clause in switch statement',
  5212. NewlineAfterThrow: 'Illegal newline after throw',
  5213. NoAsAfterImportNamespace: 'Unexpected token',
  5214. NoCatchOrFinally: 'Missing catch or finally after try',
  5215. ParameterAfterRestParameter: 'Rest parameter must be last formal parameter',
  5216. Redeclaration: '%0 \'%1\' has already been declared',
  5217. StaticPrototype: 'Classes may not have static property named prototype',
  5218. StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode',
  5219. StrictDelete: 'Delete of an unqualified identifier in strict mode.',
  5220. StrictFunction: 'In strict mode code, functions can only be declared at top level or inside a block',
  5221. StrictFunctionName: 'Function name may not be eval or arguments in strict mode',
  5222. StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode',
  5223. StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode',
  5224. StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode',
  5225. StrictModeWith: 'Strict mode code may not include a with statement',
  5226. StrictOctalLiteral: 'Octal literals are not allowed in strict mode.',
  5227. StrictParamDupe: 'Strict mode function may not have duplicate parameter names',
  5228. StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode',
  5229. StrictReservedWord: 'Use of future reserved word in strict mode',
  5230. StrictVarName: 'Variable name may not be eval or arguments in strict mode',
  5231. TemplateOctalLiteral: 'Octal literals are not allowed in template strings.',
  5232. UnexpectedEOS: 'Unexpected end of input',
  5233. UnexpectedIdentifier: 'Unexpected identifier',
  5234. UnexpectedNumber: 'Unexpected number',
  5235. UnexpectedReserved: 'Unexpected reserved word',
  5236. UnexpectedString: 'Unexpected string',
  5237. UnexpectedTemplate: 'Unexpected quasi %0',
  5238. UnexpectedToken: 'Unexpected token %0',
  5239. UnexpectedTokenIllegal: 'Unexpected token ILLEGAL',
  5240. UnknownLabel: 'Undefined label \'%0\'',
  5241. UnterminatedRegExp: 'Invalid regular expression: missing /'
  5242. };
  5243. /***/ },
  5244. /* 12 */
  5245. /***/ function(module, exports, __nested_webpack_require_226595__) {
  5246. "use strict";
  5247. Object.defineProperty(exports, "__esModule", { value: true });
  5248. var assert_1 = __nested_webpack_require_226595__(9);
  5249. var character_1 = __nested_webpack_require_226595__(4);
  5250. var messages_1 = __nested_webpack_require_226595__(11);
  5251. function hexValue(ch) {
  5252. return '0123456789abcdef'.indexOf(ch.toLowerCase());
  5253. }
  5254. function octalValue(ch) {
  5255. return '01234567'.indexOf(ch);
  5256. }
  5257. var Scanner = (function () {
  5258. function Scanner(code, handler) {
  5259. this.source = code;
  5260. this.errorHandler = handler;
  5261. this.trackComment = false;
  5262. this.isModule = false;
  5263. this.length = code.length;
  5264. this.index = 0;
  5265. this.lineNumber = (code.length > 0) ? 1 : 0;
  5266. this.lineStart = 0;
  5267. this.curlyStack = [];
  5268. }
  5269. Scanner.prototype.saveState = function () {
  5270. return {
  5271. index: this.index,
  5272. lineNumber: this.lineNumber,
  5273. lineStart: this.lineStart
  5274. };
  5275. };
  5276. Scanner.prototype.restoreState = function (state) {
  5277. this.index = state.index;
  5278. this.lineNumber = state.lineNumber;
  5279. this.lineStart = state.lineStart;
  5280. };
  5281. Scanner.prototype.eof = function () {
  5282. return this.index >= this.length;
  5283. };
  5284. Scanner.prototype.throwUnexpectedToken = function (message) {
  5285. if (message === void 0) { message = messages_1.Messages.UnexpectedTokenIllegal; }
  5286. return this.errorHandler.throwError(this.index, this.lineNumber, this.index - this.lineStart + 1, message);
  5287. };
  5288. Scanner.prototype.tolerateUnexpectedToken = function (message) {
  5289. if (message === void 0) { message = messages_1.Messages.UnexpectedTokenIllegal; }
  5290. this.errorHandler.tolerateError(this.index, this.lineNumber, this.index - this.lineStart + 1, message);
  5291. };
  5292. // https://tc39.github.io/ecma262/#sec-comments
  5293. Scanner.prototype.skipSingleLineComment = function (offset) {
  5294. var comments = [];
  5295. var start, loc;
  5296. if (this.trackComment) {
  5297. comments = [];
  5298. start = this.index - offset;
  5299. loc = {
  5300. start: {
  5301. line: this.lineNumber,
  5302. column: this.index - this.lineStart - offset
  5303. },
  5304. end: {}
  5305. };
  5306. }
  5307. while (!this.eof()) {
  5308. var ch = this.source.charCodeAt(this.index);
  5309. ++this.index;
  5310. if (character_1.Character.isLineTerminator(ch)) {
  5311. if (this.trackComment) {
  5312. loc.end = {
  5313. line: this.lineNumber,
  5314. column: this.index - this.lineStart - 1
  5315. };
  5316. var entry = {
  5317. multiLine: false,
  5318. slice: [start + offset, this.index - 1],
  5319. range: [start, this.index - 1],
  5320. loc: loc
  5321. };
  5322. comments.push(entry);
  5323. }
  5324. if (ch === 13 && this.source.charCodeAt(this.index) === 10) {
  5325. ++this.index;
  5326. }
  5327. ++this.lineNumber;
  5328. this.lineStart = this.index;
  5329. return comments;
  5330. }
  5331. }
  5332. if (this.trackComment) {
  5333. loc.end = {
  5334. line: this.lineNumber,
  5335. column: this.index - this.lineStart
  5336. };
  5337. var entry = {
  5338. multiLine: false,
  5339. slice: [start + offset, this.index],
  5340. range: [start, this.index],
  5341. loc: loc
  5342. };
  5343. comments.push(entry);
  5344. }
  5345. return comments;
  5346. };
  5347. Scanner.prototype.skipMultiLineComment = function () {
  5348. var comments = [];
  5349. var start, loc;
  5350. if (this.trackComment) {
  5351. comments = [];
  5352. start = this.index - 2;
  5353. loc = {
  5354. start: {
  5355. line: this.lineNumber,
  5356. column: this.index - this.lineStart - 2
  5357. },
  5358. end: {}
  5359. };
  5360. }
  5361. while (!this.eof()) {
  5362. var ch = this.source.charCodeAt(this.index);
  5363. if (character_1.Character.isLineTerminator(ch)) {
  5364. if (ch === 0x0D && this.source.charCodeAt(this.index + 1) === 0x0A) {
  5365. ++this.index;
  5366. }
  5367. ++this.lineNumber;
  5368. ++this.index;
  5369. this.lineStart = this.index;
  5370. }
  5371. else if (ch === 0x2A) {
  5372. // Block comment ends with '*/'.
  5373. if (this.source.charCodeAt(this.index + 1) === 0x2F) {
  5374. this.index += 2;
  5375. if (this.trackComment) {
  5376. loc.end = {
  5377. line: this.lineNumber,
  5378. column: this.index - this.lineStart
  5379. };
  5380. var entry = {
  5381. multiLine: true,
  5382. slice: [start + 2, this.index - 2],
  5383. range: [start, this.index],
  5384. loc: loc
  5385. };
  5386. comments.push(entry);
  5387. }
  5388. return comments;
  5389. }
  5390. ++this.index;
  5391. }
  5392. else {
  5393. ++this.index;
  5394. }
  5395. }
  5396. // Ran off the end of the file - the whole thing is a comment
  5397. if (this.trackComment) {
  5398. loc.end = {
  5399. line: this.lineNumber,
  5400. column: this.index - this.lineStart
  5401. };
  5402. var entry = {
  5403. multiLine: true,
  5404. slice: [start + 2, this.index],
  5405. range: [start, this.index],
  5406. loc: loc
  5407. };
  5408. comments.push(entry);
  5409. }
  5410. this.tolerateUnexpectedToken();
  5411. return comments;
  5412. };
  5413. Scanner.prototype.scanComments = function () {
  5414. var comments;
  5415. if (this.trackComment) {
  5416. comments = [];
  5417. }
  5418. var start = (this.index === 0);
  5419. while (!this.eof()) {
  5420. var ch = this.source.charCodeAt(this.index);
  5421. if (character_1.Character.isWhiteSpace(ch)) {
  5422. ++this.index;
  5423. }
  5424. else if (character_1.Character.isLineTerminator(ch)) {
  5425. ++this.index;
  5426. if (ch === 0x0D && this.source.charCodeAt(this.index) === 0x0A) {
  5427. ++this.index;
  5428. }
  5429. ++this.lineNumber;
  5430. this.lineStart = this.index;
  5431. start = true;
  5432. }
  5433. else if (ch === 0x2F) {
  5434. ch = this.source.charCodeAt(this.index + 1);
  5435. if (ch === 0x2F) {
  5436. this.index += 2;
  5437. var comment = this.skipSingleLineComment(2);
  5438. if (this.trackComment) {
  5439. comments = comments.concat(comment);
  5440. }
  5441. start = true;
  5442. }
  5443. else if (ch === 0x2A) {
  5444. this.index += 2;
  5445. var comment = this.skipMultiLineComment();
  5446. if (this.trackComment) {
  5447. comments = comments.concat(comment);
  5448. }
  5449. }
  5450. else {
  5451. break;
  5452. }
  5453. }
  5454. else if (start && ch === 0x2D) {
  5455. // U+003E is '>'
  5456. if ((this.source.charCodeAt(this.index + 1) === 0x2D) && (this.source.charCodeAt(this.index + 2) === 0x3E)) {
  5457. // '-->' is a single-line comment
  5458. this.index += 3;
  5459. var comment = this.skipSingleLineComment(3);
  5460. if (this.trackComment) {
  5461. comments = comments.concat(comment);
  5462. }
  5463. }
  5464. else {
  5465. break;
  5466. }
  5467. }
  5468. else if (ch === 0x3C && !this.isModule) {
  5469. if (this.source.slice(this.index + 1, this.index + 4) === '!--') {
  5470. this.index += 4; // `<!--`
  5471. var comment = this.skipSingleLineComment(4);
  5472. if (this.trackComment) {
  5473. comments = comments.concat(comment);
  5474. }
  5475. }
  5476. else {
  5477. break;
  5478. }
  5479. }
  5480. else {
  5481. break;
  5482. }
  5483. }
  5484. return comments;
  5485. };
  5486. // https://tc39.github.io/ecma262/#sec-future-reserved-words
  5487. Scanner.prototype.isFutureReservedWord = function (id) {
  5488. switch (id) {
  5489. case 'enum':
  5490. case 'export':
  5491. case 'import':
  5492. case 'super':
  5493. return true;
  5494. default:
  5495. return false;
  5496. }
  5497. };
  5498. Scanner.prototype.isStrictModeReservedWord = function (id) {
  5499. switch (id) {
  5500. case 'implements':
  5501. case 'interface':
  5502. case 'package':
  5503. case 'private':
  5504. case 'protected':
  5505. case 'public':
  5506. case 'static':
  5507. case 'yield':
  5508. case 'let':
  5509. return true;
  5510. default:
  5511. return false;
  5512. }
  5513. };
  5514. Scanner.prototype.isRestrictedWord = function (id) {
  5515. return id === 'eval' || id === 'arguments';
  5516. };
  5517. // https://tc39.github.io/ecma262/#sec-keywords
  5518. Scanner.prototype.isKeyword = function (id) {
  5519. switch (id.length) {
  5520. case 2:
  5521. return (id === 'if') || (id === 'in') || (id === 'do');
  5522. case 3:
  5523. return (id === 'var') || (id === 'for') || (id === 'new') ||
  5524. (id === 'try') || (id === 'let');
  5525. case 4:
  5526. return (id === 'this') || (id === 'else') || (id === 'case') ||
  5527. (id === 'void') || (id === 'with') || (id === 'enum');
  5528. case 5:
  5529. return (id === 'while') || (id === 'break') || (id === 'catch') ||
  5530. (id === 'throw') || (id === 'const') || (id === 'yield') ||
  5531. (id === 'class') || (id === 'super');
  5532. case 6:
  5533. return (id === 'return') || (id === 'typeof') || (id === 'delete') ||
  5534. (id === 'switch') || (id === 'export') || (id === 'import');
  5535. case 7:
  5536. return (id === 'default') || (id === 'finally') || (id === 'extends');
  5537. case 8:
  5538. return (id === 'function') || (id === 'continue') || (id === 'debugger');
  5539. case 10:
  5540. return (id === 'instanceof');
  5541. default:
  5542. return false;
  5543. }
  5544. };
  5545. Scanner.prototype.codePointAt = function (i) {
  5546. var cp = this.source.charCodeAt(i);
  5547. if (cp >= 0xD800 && cp <= 0xDBFF) {
  5548. var second = this.source.charCodeAt(i + 1);
  5549. if (second >= 0xDC00 && second <= 0xDFFF) {
  5550. var first = cp;
  5551. cp = (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
  5552. }
  5553. }
  5554. return cp;
  5555. };
  5556. Scanner.prototype.scanHexEscape = function (prefix) {
  5557. var len = (prefix === 'u') ? 4 : 2;
  5558. var code = 0;
  5559. for (var i = 0; i < len; ++i) {
  5560. if (!this.eof() && character_1.Character.isHexDigit(this.source.charCodeAt(this.index))) {
  5561. code = code * 16 + hexValue(this.source[this.index++]);
  5562. }
  5563. else {
  5564. return null;
  5565. }
  5566. }
  5567. return String.fromCharCode(code);
  5568. };
  5569. Scanner.prototype.scanUnicodeCodePointEscape = function () {
  5570. var ch = this.source[this.index];
  5571. var code = 0;
  5572. // At least, one hex digit is required.
  5573. if (ch === '}') {
  5574. this.throwUnexpectedToken();
  5575. }
  5576. while (!this.eof()) {
  5577. ch = this.source[this.index++];
  5578. if (!character_1.Character.isHexDigit(ch.charCodeAt(0))) {
  5579. break;
  5580. }
  5581. code = code * 16 + hexValue(ch);
  5582. }
  5583. if (code > 0x10FFFF || ch !== '}') {
  5584. this.throwUnexpectedToken();
  5585. }
  5586. return character_1.Character.fromCodePoint(code);
  5587. };
  5588. Scanner.prototype.getIdentifier = function () {
  5589. var start = this.index++;
  5590. while (!this.eof()) {
  5591. var ch = this.source.charCodeAt(this.index);
  5592. if (ch === 0x5C) {
  5593. // Blackslash (U+005C) marks Unicode escape sequence.
  5594. this.index = start;
  5595. return this.getComplexIdentifier();
  5596. }
  5597. else if (ch >= 0xD800 && ch < 0xDFFF) {
  5598. // Need to handle surrogate pairs.
  5599. this.index = start;
  5600. return this.getComplexIdentifier();
  5601. }
  5602. if (character_1.Character.isIdentifierPart(ch)) {
  5603. ++this.index;
  5604. }
  5605. else {
  5606. break;
  5607. }
  5608. }
  5609. return this.source.slice(start, this.index);
  5610. };
  5611. Scanner.prototype.getComplexIdentifier = function () {
  5612. var cp = this.codePointAt(this.index);
  5613. var id = character_1.Character.fromCodePoint(cp);
  5614. this.index += id.length;
  5615. // '\u' (U+005C, U+0075) denotes an escaped character.
  5616. var ch;
  5617. if (cp === 0x5C) {
  5618. if (this.source.charCodeAt(this.index) !== 0x75) {
  5619. this.throwUnexpectedToken();
  5620. }
  5621. ++this.index;
  5622. if (this.source[this.index] === '{') {
  5623. ++this.index;
  5624. ch = this.scanUnicodeCodePointEscape();
  5625. }
  5626. else {
  5627. ch = this.scanHexEscape('u');
  5628. if (ch === null || ch === '\\' || !character_1.Character.isIdentifierStart(ch.charCodeAt(0))) {
  5629. this.throwUnexpectedToken();
  5630. }
  5631. }
  5632. id = ch;
  5633. }
  5634. while (!this.eof()) {
  5635. cp = this.codePointAt(this.index);
  5636. if (!character_1.Character.isIdentifierPart(cp)) {
  5637. break;
  5638. }
  5639. ch = character_1.Character.fromCodePoint(cp);
  5640. id += ch;
  5641. this.index += ch.length;
  5642. // '\u' (U+005C, U+0075) denotes an escaped character.
  5643. if (cp === 0x5C) {
  5644. id = id.substr(0, id.length - 1);
  5645. if (this.source.charCodeAt(this.index) !== 0x75) {
  5646. this.throwUnexpectedToken();
  5647. }
  5648. ++this.index;
  5649. if (this.source[this.index] === '{') {
  5650. ++this.index;
  5651. ch = this.scanUnicodeCodePointEscape();
  5652. }
  5653. else {
  5654. ch = this.scanHexEscape('u');
  5655. if (ch === null || ch === '\\' || !character_1.Character.isIdentifierPart(ch.charCodeAt(0))) {
  5656. this.throwUnexpectedToken();
  5657. }
  5658. }
  5659. id += ch;
  5660. }
  5661. }
  5662. return id;
  5663. };
  5664. Scanner.prototype.octalToDecimal = function (ch) {
  5665. // \0 is not octal escape sequence
  5666. var octal = (ch !== '0');
  5667. var code = octalValue(ch);
  5668. if (!this.eof() && character_1.Character.isOctalDigit(this.source.charCodeAt(this.index))) {
  5669. octal = true;
  5670. code = code * 8 + octalValue(this.source[this.index++]);
  5671. // 3 digits are only allowed when string starts
  5672. // with 0, 1, 2, 3
  5673. if ('0123'.indexOf(ch) >= 0 && !this.eof() && character_1.Character.isOctalDigit(this.source.charCodeAt(this.index))) {
  5674. code = code * 8 + octalValue(this.source[this.index++]);
  5675. }
  5676. }
  5677. return {
  5678. code: code,
  5679. octal: octal
  5680. };
  5681. };
  5682. // https://tc39.github.io/ecma262/#sec-names-and-keywords
  5683. Scanner.prototype.scanIdentifier = function () {
  5684. var type;
  5685. var start = this.index;
  5686. // Backslash (U+005C) starts an escaped character.
  5687. var id = (this.source.charCodeAt(start) === 0x5C) ? this.getComplexIdentifier() : this.getIdentifier();
  5688. // There is no keyword or literal with only one character.
  5689. // Thus, it must be an identifier.
  5690. if (id.length === 1) {
  5691. type = 3 /* Identifier */;
  5692. }
  5693. else if (this.isKeyword(id)) {
  5694. type = 4 /* Keyword */;
  5695. }
  5696. else if (id === 'null') {
  5697. type = 5 /* NullLiteral */;
  5698. }
  5699. else if (id === 'true' || id === 'false') {
  5700. type = 1 /* BooleanLiteral */;
  5701. }
  5702. else {
  5703. type = 3 /* Identifier */;
  5704. }
  5705. if (type !== 3 /* Identifier */ && (start + id.length !== this.index)) {
  5706. var restore = this.index;
  5707. this.index = start;
  5708. this.tolerateUnexpectedToken(messages_1.Messages.InvalidEscapedReservedWord);
  5709. this.index = restore;
  5710. }
  5711. return {
  5712. type: type,
  5713. value: id,
  5714. lineNumber: this.lineNumber,
  5715. lineStart: this.lineStart,
  5716. start: start,
  5717. end: this.index
  5718. };
  5719. };
  5720. // https://tc39.github.io/ecma262/#sec-punctuators
  5721. Scanner.prototype.scanPunctuator = function () {
  5722. var start = this.index;
  5723. // Check for most common single-character punctuators.
  5724. var str = this.source[this.index];
  5725. switch (str) {
  5726. case '(':
  5727. case '{':
  5728. if (str === '{') {
  5729. this.curlyStack.push('{');
  5730. }
  5731. ++this.index;
  5732. break;
  5733. case '.':
  5734. ++this.index;
  5735. if (this.source[this.index] === '.' && this.source[this.index + 1] === '.') {
  5736. // Spread operator: ...
  5737. this.index += 2;
  5738. str = '...';
  5739. }
  5740. break;
  5741. case '}':
  5742. ++this.index;
  5743. this.curlyStack.pop();
  5744. break;
  5745. case ')':
  5746. case ';':
  5747. case ',':
  5748. case '[':
  5749. case ']':
  5750. case ':':
  5751. case '?':
  5752. case '~':
  5753. ++this.index;
  5754. break;
  5755. default:
  5756. // 4-character punctuator.
  5757. str = this.source.substr(this.index, 4);
  5758. if (str === '>>>=') {
  5759. this.index += 4;
  5760. }
  5761. else {
  5762. // 3-character punctuators.
  5763. str = str.substr(0, 3);
  5764. if (str === '===' || str === '!==' || str === '>>>' ||
  5765. str === '<<=' || str === '>>=' || str === '**=') {
  5766. this.index += 3;
  5767. }
  5768. else {
  5769. // 2-character punctuators.
  5770. str = str.substr(0, 2);
  5771. if (str === '&&' || str === '||' || str === '==' || str === '!=' ||
  5772. str === '+=' || str === '-=' || str === '*=' || str === '/=' ||
  5773. str === '++' || str === '--' || str === '<<' || str === '>>' ||
  5774. str === '&=' || str === '|=' || str === '^=' || str === '%=' ||
  5775. str === '<=' || str === '>=' || str === '=>' || str === '**') {
  5776. this.index += 2;
  5777. }
  5778. else {
  5779. // 1-character punctuators.
  5780. str = this.source[this.index];
  5781. if ('<>=!+-*%&|^/'.indexOf(str) >= 0) {
  5782. ++this.index;
  5783. }
  5784. }
  5785. }
  5786. }
  5787. }
  5788. if (this.index === start) {
  5789. this.throwUnexpectedToken();
  5790. }
  5791. return {
  5792. type: 7 /* Punctuator */,
  5793. value: str,
  5794. lineNumber: this.lineNumber,
  5795. lineStart: this.lineStart,
  5796. start: start,
  5797. end: this.index
  5798. };
  5799. };
  5800. // https://tc39.github.io/ecma262/#sec-literals-numeric-literals
  5801. Scanner.prototype.scanHexLiteral = function (start) {
  5802. var num = '';
  5803. while (!this.eof()) {
  5804. if (!character_1.Character.isHexDigit(this.source.charCodeAt(this.index))) {
  5805. break;
  5806. }
  5807. num += this.source[this.index++];
  5808. }
  5809. if (num.length === 0) {
  5810. this.throwUnexpectedToken();
  5811. }
  5812. if (character_1.Character.isIdentifierStart(this.source.charCodeAt(this.index))) {
  5813. this.throwUnexpectedToken();
  5814. }
  5815. return {
  5816. type: 6 /* NumericLiteral */,
  5817. value: parseInt('0x' + num, 16),
  5818. lineNumber: this.lineNumber,
  5819. lineStart: this.lineStart,
  5820. start: start,
  5821. end: this.index
  5822. };
  5823. };
  5824. Scanner.prototype.scanBinaryLiteral = function (start) {
  5825. var num = '';
  5826. var ch;
  5827. while (!this.eof()) {
  5828. ch = this.source[this.index];
  5829. if (ch !== '0' && ch !== '1') {
  5830. break;
  5831. }
  5832. num += this.source[this.index++];
  5833. }
  5834. if (num.length === 0) {
  5835. // only 0b or 0B
  5836. this.throwUnexpectedToken();
  5837. }
  5838. if (!this.eof()) {
  5839. ch = this.source.charCodeAt(this.index);
  5840. /* istanbul ignore else */
  5841. if (character_1.Character.isIdentifierStart(ch) || character_1.Character.isDecimalDigit(ch)) {
  5842. this.throwUnexpectedToken();
  5843. }
  5844. }
  5845. return {
  5846. type: 6 /* NumericLiteral */,
  5847. value: parseInt(num, 2),
  5848. lineNumber: this.lineNumber,
  5849. lineStart: this.lineStart,
  5850. start: start,
  5851. end: this.index
  5852. };
  5853. };
  5854. Scanner.prototype.scanOctalLiteral = function (prefix, start) {
  5855. var num = '';
  5856. var octal = false;
  5857. if (character_1.Character.isOctalDigit(prefix.charCodeAt(0))) {
  5858. octal = true;
  5859. num = '0' + this.source[this.index++];
  5860. }
  5861. else {
  5862. ++this.index;
  5863. }
  5864. while (!this.eof()) {
  5865. if (!character_1.Character.isOctalDigit(this.source.charCodeAt(this.index))) {
  5866. break;
  5867. }
  5868. num += this.source[this.index++];
  5869. }
  5870. if (!octal && num.length === 0) {
  5871. // only 0o or 0O
  5872. this.throwUnexpectedToken();
  5873. }
  5874. if (character_1.Character.isIdentifierStart(this.source.charCodeAt(this.index)) || character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
  5875. this.throwUnexpectedToken();
  5876. }
  5877. return {
  5878. type: 6 /* NumericLiteral */,
  5879. value: parseInt(num, 8),
  5880. octal: octal,
  5881. lineNumber: this.lineNumber,
  5882. lineStart: this.lineStart,
  5883. start: start,
  5884. end: this.index
  5885. };
  5886. };
  5887. Scanner.prototype.isImplicitOctalLiteral = function () {
  5888. // Implicit octal, unless there is a non-octal digit.
  5889. // (Annex B.1.1 on Numeric Literals)
  5890. for (var i = this.index + 1; i < this.length; ++i) {
  5891. var ch = this.source[i];
  5892. if (ch === '8' || ch === '9') {
  5893. return false;
  5894. }
  5895. if (!character_1.Character.isOctalDigit(ch.charCodeAt(0))) {
  5896. return true;
  5897. }
  5898. }
  5899. return true;
  5900. };
  5901. Scanner.prototype.scanNumericLiteral = function () {
  5902. var start = this.index;
  5903. var ch = this.source[start];
  5904. assert_1.assert(character_1.Character.isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'), 'Numeric literal must start with a decimal digit or a decimal point');
  5905. var num = '';
  5906. if (ch !== '.') {
  5907. num = this.source[this.index++];
  5908. ch = this.source[this.index];
  5909. // Hex number starts with '0x'.
  5910. // Octal number starts with '0'.
  5911. // Octal number in ES6 starts with '0o'.
  5912. // Binary number in ES6 starts with '0b'.
  5913. if (num === '0') {
  5914. if (ch === 'x' || ch === 'X') {
  5915. ++this.index;
  5916. return this.scanHexLiteral(start);
  5917. }
  5918. if (ch === 'b' || ch === 'B') {
  5919. ++this.index;
  5920. return this.scanBinaryLiteral(start);
  5921. }
  5922. if (ch === 'o' || ch === 'O') {
  5923. return this.scanOctalLiteral(ch, start);
  5924. }
  5925. if (ch && character_1.Character.isOctalDigit(ch.charCodeAt(0))) {
  5926. if (this.isImplicitOctalLiteral()) {
  5927. return this.scanOctalLiteral(ch, start);
  5928. }
  5929. }
  5930. }
  5931. while (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
  5932. num += this.source[this.index++];
  5933. }
  5934. ch = this.source[this.index];
  5935. }
  5936. if (ch === '.') {
  5937. num += this.source[this.index++];
  5938. while (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
  5939. num += this.source[this.index++];
  5940. }
  5941. ch = this.source[this.index];
  5942. }
  5943. if (ch === 'e' || ch === 'E') {
  5944. num += this.source[this.index++];
  5945. ch = this.source[this.index];
  5946. if (ch === '+' || ch === '-') {
  5947. num += this.source[this.index++];
  5948. }
  5949. if (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
  5950. while (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
  5951. num += this.source[this.index++];
  5952. }
  5953. }
  5954. else {
  5955. this.throwUnexpectedToken();
  5956. }
  5957. }
  5958. if (character_1.Character.isIdentifierStart(this.source.charCodeAt(this.index))) {
  5959. this.throwUnexpectedToken();
  5960. }
  5961. return {
  5962. type: 6 /* NumericLiteral */,
  5963. value: parseFloat(num),
  5964. lineNumber: this.lineNumber,
  5965. lineStart: this.lineStart,
  5966. start: start,
  5967. end: this.index
  5968. };
  5969. };
  5970. // https://tc39.github.io/ecma262/#sec-literals-string-literals
  5971. Scanner.prototype.scanStringLiteral = function () {
  5972. var start = this.index;
  5973. var quote = this.source[start];
  5974. assert_1.assert((quote === '\'' || quote === '"'), 'String literal must starts with a quote');
  5975. ++this.index;
  5976. var octal = false;
  5977. var str = '';
  5978. while (!this.eof()) {
  5979. var ch = this.source[this.index++];
  5980. if (ch === quote) {
  5981. quote = '';
  5982. break;
  5983. }
  5984. else if (ch === '\\') {
  5985. ch = this.source[this.index++];
  5986. if (!ch || !character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
  5987. switch (ch) {
  5988. case 'u':
  5989. if (this.source[this.index] === '{') {
  5990. ++this.index;
  5991. str += this.scanUnicodeCodePointEscape();
  5992. }
  5993. else {
  5994. var unescaped_1 = this.scanHexEscape(ch);
  5995. if (unescaped_1 === null) {
  5996. this.throwUnexpectedToken();
  5997. }
  5998. str += unescaped_1;
  5999. }
  6000. break;
  6001. case 'x':
  6002. var unescaped = this.scanHexEscape(ch);
  6003. if (unescaped === null) {
  6004. this.throwUnexpectedToken(messages_1.Messages.InvalidHexEscapeSequence);
  6005. }
  6006. str += unescaped;
  6007. break;
  6008. case 'n':
  6009. str += '\n';
  6010. break;
  6011. case 'r':
  6012. str += '\r';
  6013. break;
  6014. case 't':
  6015. str += '\t';
  6016. break;
  6017. case 'b':
  6018. str += '\b';
  6019. break;
  6020. case 'f':
  6021. str += '\f';
  6022. break;
  6023. case 'v':
  6024. str += '\x0B';
  6025. break;
  6026. case '8':
  6027. case '9':
  6028. str += ch;
  6029. this.tolerateUnexpectedToken();
  6030. break;
  6031. default:
  6032. if (ch && character_1.Character.isOctalDigit(ch.charCodeAt(0))) {
  6033. var octToDec = this.octalToDecimal(ch);
  6034. octal = octToDec.octal || octal;
  6035. str += String.fromCharCode(octToDec.code);
  6036. }
  6037. else {
  6038. str += ch;
  6039. }
  6040. break;
  6041. }
  6042. }
  6043. else {
  6044. ++this.lineNumber;
  6045. if (ch === '\r' && this.source[this.index] === '\n') {
  6046. ++this.index;
  6047. }
  6048. this.lineStart = this.index;
  6049. }
  6050. }
  6051. else if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
  6052. break;
  6053. }
  6054. else {
  6055. str += ch;
  6056. }
  6057. }
  6058. if (quote !== '') {
  6059. this.index = start;
  6060. this.throwUnexpectedToken();
  6061. }
  6062. return {
  6063. type: 8 /* StringLiteral */,
  6064. value: str,
  6065. octal: octal,
  6066. lineNumber: this.lineNumber,
  6067. lineStart: this.lineStart,
  6068. start: start,
  6069. end: this.index
  6070. };
  6071. };
  6072. // https://tc39.github.io/ecma262/#sec-template-literal-lexical-components
  6073. Scanner.prototype.scanTemplate = function () {
  6074. var cooked = '';
  6075. var terminated = false;
  6076. var start = this.index;
  6077. var head = (this.source[start] === '`');
  6078. var tail = false;
  6079. var rawOffset = 2;
  6080. ++this.index;
  6081. while (!this.eof()) {
  6082. var ch = this.source[this.index++];
  6083. if (ch === '`') {
  6084. rawOffset = 1;
  6085. tail = true;
  6086. terminated = true;
  6087. break;
  6088. }
  6089. else if (ch === '$') {
  6090. if (this.source[this.index] === '{') {
  6091. this.curlyStack.push('${');
  6092. ++this.index;
  6093. terminated = true;
  6094. break;
  6095. }
  6096. cooked += ch;
  6097. }
  6098. else if (ch === '\\') {
  6099. ch = this.source[this.index++];
  6100. if (!character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
  6101. switch (ch) {
  6102. case 'n':
  6103. cooked += '\n';
  6104. break;
  6105. case 'r':
  6106. cooked += '\r';
  6107. break;
  6108. case 't':
  6109. cooked += '\t';
  6110. break;
  6111. case 'u':
  6112. if (this.source[this.index] === '{') {
  6113. ++this.index;
  6114. cooked += this.scanUnicodeCodePointEscape();
  6115. }
  6116. else {
  6117. var restore = this.index;
  6118. var unescaped_2 = this.scanHexEscape(ch);
  6119. if (unescaped_2 !== null) {
  6120. cooked += unescaped_2;
  6121. }
  6122. else {
  6123. this.index = restore;
  6124. cooked += ch;
  6125. }
  6126. }
  6127. break;
  6128. case 'x':
  6129. var unescaped = this.scanHexEscape(ch);
  6130. if (unescaped === null) {
  6131. this.throwUnexpectedToken(messages_1.Messages.InvalidHexEscapeSequence);
  6132. }
  6133. cooked += unescaped;
  6134. break;
  6135. case 'b':
  6136. cooked += '\b';
  6137. break;
  6138. case 'f':
  6139. cooked += '\f';
  6140. break;
  6141. case 'v':
  6142. cooked += '\v';
  6143. break;
  6144. default:
  6145. if (ch === '0') {
  6146. if (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
  6147. // Illegal: \01 \02 and so on
  6148. this.throwUnexpectedToken(messages_1.Messages.TemplateOctalLiteral);
  6149. }
  6150. cooked += '\0';
  6151. }
  6152. else if (character_1.Character.isOctalDigit(ch.charCodeAt(0))) {
  6153. // Illegal: \1 \2
  6154. this.throwUnexpectedToken(messages_1.Messages.TemplateOctalLiteral);
  6155. }
  6156. else {
  6157. cooked += ch;
  6158. }
  6159. break;
  6160. }
  6161. }
  6162. else {
  6163. ++this.lineNumber;
  6164. if (ch === '\r' && this.source[this.index] === '\n') {
  6165. ++this.index;
  6166. }
  6167. this.lineStart = this.index;
  6168. }
  6169. }
  6170. else if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
  6171. ++this.lineNumber;
  6172. if (ch === '\r' && this.source[this.index] === '\n') {
  6173. ++this.index;
  6174. }
  6175. this.lineStart = this.index;
  6176. cooked += '\n';
  6177. }
  6178. else {
  6179. cooked += ch;
  6180. }
  6181. }
  6182. if (!terminated) {
  6183. this.throwUnexpectedToken();
  6184. }
  6185. if (!head) {
  6186. this.curlyStack.pop();
  6187. }
  6188. return {
  6189. type: 10 /* Template */,
  6190. value: this.source.slice(start + 1, this.index - rawOffset),
  6191. cooked: cooked,
  6192. head: head,
  6193. tail: tail,
  6194. lineNumber: this.lineNumber,
  6195. lineStart: this.lineStart,
  6196. start: start,
  6197. end: this.index
  6198. };
  6199. };
  6200. // https://tc39.github.io/ecma262/#sec-literals-regular-expression-literals
  6201. Scanner.prototype.testRegExp = function (pattern, flags) {
  6202. // The BMP character to use as a replacement for astral symbols when
  6203. // translating an ES6 "u"-flagged pattern to an ES5-compatible
  6204. // approximation.
  6205. // Note: replacing with '\uFFFF' enables false positives in unlikely
  6206. // scenarios. For example, `[\u{1044f}-\u{10440}]` is an invalid
  6207. // pattern that would not be detected by this substitution.
  6208. var astralSubstitute = '\uFFFF';
  6209. var tmp = pattern;
  6210. var self = this;
  6211. if (flags.indexOf('u') >= 0) {
  6212. tmp = tmp
  6213. .replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g, function ($0, $1, $2) {
  6214. var codePoint = parseInt($1 || $2, 16);
  6215. if (codePoint > 0x10FFFF) {
  6216. self.throwUnexpectedToken(messages_1.Messages.InvalidRegExp);
  6217. }
  6218. if (codePoint <= 0xFFFF) {
  6219. return String.fromCharCode(codePoint);
  6220. }
  6221. return astralSubstitute;
  6222. })
  6223. .replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, astralSubstitute);
  6224. }
  6225. // First, detect invalid regular expressions.
  6226. try {
  6227. RegExp(tmp);
  6228. }
  6229. catch (e) {
  6230. this.throwUnexpectedToken(messages_1.Messages.InvalidRegExp);
  6231. }
  6232. // Return a regular expression object for this pattern-flag pair, or
  6233. // `null` in case the current environment doesn't support the flags it
  6234. // uses.
  6235. try {
  6236. return new RegExp(pattern, flags);
  6237. }
  6238. catch (exception) {
  6239. /* istanbul ignore next */
  6240. return null;
  6241. }
  6242. };
  6243. Scanner.prototype.scanRegExpBody = function () {
  6244. var ch = this.source[this.index];
  6245. assert_1.assert(ch === '/', 'Regular expression literal must start with a slash');
  6246. var str = this.source[this.index++];
  6247. var classMarker = false;
  6248. var terminated = false;
  6249. while (!this.eof()) {
  6250. ch = this.source[this.index++];
  6251. str += ch;
  6252. if (ch === '\\') {
  6253. ch = this.source[this.index++];
  6254. // https://tc39.github.io/ecma262/#sec-literals-regular-expression-literals
  6255. if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
  6256. this.throwUnexpectedToken(messages_1.Messages.UnterminatedRegExp);
  6257. }
  6258. str += ch;
  6259. }
  6260. else if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
  6261. this.throwUnexpectedToken(messages_1.Messages.UnterminatedRegExp);
  6262. }
  6263. else if (classMarker) {
  6264. if (ch === ']') {
  6265. classMarker = false;
  6266. }
  6267. }
  6268. else {
  6269. if (ch === '/') {
  6270. terminated = true;
  6271. break;
  6272. }
  6273. else if (ch === '[') {
  6274. classMarker = true;
  6275. }
  6276. }
  6277. }
  6278. if (!terminated) {
  6279. this.throwUnexpectedToken(messages_1.Messages.UnterminatedRegExp);
  6280. }
  6281. // Exclude leading and trailing slash.
  6282. return str.substr(1, str.length - 2);
  6283. };
  6284. Scanner.prototype.scanRegExpFlags = function () {
  6285. var str = '';
  6286. var flags = '';
  6287. while (!this.eof()) {
  6288. var ch = this.source[this.index];
  6289. if (!character_1.Character.isIdentifierPart(ch.charCodeAt(0))) {
  6290. break;
  6291. }
  6292. ++this.index;
  6293. if (ch === '\\' && !this.eof()) {
  6294. ch = this.source[this.index];
  6295. if (ch === 'u') {
  6296. ++this.index;
  6297. var restore = this.index;
  6298. var char = this.scanHexEscape('u');
  6299. if (char !== null) {
  6300. flags += char;
  6301. for (str += '\\u'; restore < this.index; ++restore) {
  6302. str += this.source[restore];
  6303. }
  6304. }
  6305. else {
  6306. this.index = restore;
  6307. flags += 'u';
  6308. str += '\\u';
  6309. }
  6310. this.tolerateUnexpectedToken();
  6311. }
  6312. else {
  6313. str += '\\';
  6314. this.tolerateUnexpectedToken();
  6315. }
  6316. }
  6317. else {
  6318. flags += ch;
  6319. str += ch;
  6320. }
  6321. }
  6322. return flags;
  6323. };
  6324. Scanner.prototype.scanRegExp = function () {
  6325. var start = this.index;
  6326. var pattern = this.scanRegExpBody();
  6327. var flags = this.scanRegExpFlags();
  6328. var value = this.testRegExp(pattern, flags);
  6329. return {
  6330. type: 9 /* RegularExpression */,
  6331. value: '',
  6332. pattern: pattern,
  6333. flags: flags,
  6334. regex: value,
  6335. lineNumber: this.lineNumber,
  6336. lineStart: this.lineStart,
  6337. start: start,
  6338. end: this.index
  6339. };
  6340. };
  6341. Scanner.prototype.lex = function () {
  6342. if (this.eof()) {
  6343. return {
  6344. type: 2 /* EOF */,
  6345. value: '',
  6346. lineNumber: this.lineNumber,
  6347. lineStart: this.lineStart,
  6348. start: this.index,
  6349. end: this.index
  6350. };
  6351. }
  6352. var cp = this.source.charCodeAt(this.index);
  6353. if (character_1.Character.isIdentifierStart(cp)) {
  6354. return this.scanIdentifier();
  6355. }
  6356. // Very common: ( and ) and ;
  6357. if (cp === 0x28 || cp === 0x29 || cp === 0x3B) {
  6358. return this.scanPunctuator();
  6359. }
  6360. // String literal starts with single quote (U+0027) or double quote (U+0022).
  6361. if (cp === 0x27 || cp === 0x22) {
  6362. return this.scanStringLiteral();
  6363. }
  6364. // Dot (.) U+002E can also start a floating-point number, hence the need
  6365. // to check the next character.
  6366. if (cp === 0x2E) {
  6367. if (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index + 1))) {
  6368. return this.scanNumericLiteral();
  6369. }
  6370. return this.scanPunctuator();
  6371. }
  6372. if (character_1.Character.isDecimalDigit(cp)) {
  6373. return this.scanNumericLiteral();
  6374. }
  6375. // Template literals start with ` (U+0060) for template head
  6376. // or } (U+007D) for template middle or template tail.
  6377. if (cp === 0x60 || (cp === 0x7D && this.curlyStack[this.curlyStack.length - 1] === '${')) {
  6378. return this.scanTemplate();
  6379. }
  6380. // Possible identifier start in a surrogate pair.
  6381. if (cp >= 0xD800 && cp < 0xDFFF) {
  6382. if (character_1.Character.isIdentifierStart(this.codePointAt(this.index))) {
  6383. return this.scanIdentifier();
  6384. }
  6385. }
  6386. return this.scanPunctuator();
  6387. };
  6388. return Scanner;
  6389. }());
  6390. exports.Scanner = Scanner;
  6391. /***/ },
  6392. /* 13 */
  6393. /***/ function(module, exports) {
  6394. "use strict";
  6395. Object.defineProperty(exports, "__esModule", { value: true });
  6396. exports.TokenName = {};
  6397. exports.TokenName[1 /* BooleanLiteral */] = 'Boolean';
  6398. exports.TokenName[2 /* EOF */] = '<end>';
  6399. exports.TokenName[3 /* Identifier */] = 'Identifier';
  6400. exports.TokenName[4 /* Keyword */] = 'Keyword';
  6401. exports.TokenName[5 /* NullLiteral */] = 'Null';
  6402. exports.TokenName[6 /* NumericLiteral */] = 'Numeric';
  6403. exports.TokenName[7 /* Punctuator */] = 'Punctuator';
  6404. exports.TokenName[8 /* StringLiteral */] = 'String';
  6405. exports.TokenName[9 /* RegularExpression */] = 'RegularExpression';
  6406. exports.TokenName[10 /* Template */] = 'Template';
  6407. /***/ },
  6408. /* 14 */
  6409. /***/ function(module, exports) {
  6410. "use strict";
  6411. // Generated by generate-xhtml-entities.js. DO NOT MODIFY!
  6412. Object.defineProperty(exports, "__esModule", { value: true });
  6413. exports.XHTMLEntities = {
  6414. quot: '\u0022',
  6415. amp: '\u0026',
  6416. apos: '\u0027',
  6417. gt: '\u003E',
  6418. nbsp: '\u00A0',
  6419. iexcl: '\u00A1',
  6420. cent: '\u00A2',
  6421. pound: '\u00A3',
  6422. curren: '\u00A4',
  6423. yen: '\u00A5',
  6424. brvbar: '\u00A6',
  6425. sect: '\u00A7',
  6426. uml: '\u00A8',
  6427. copy: '\u00A9',
  6428. ordf: '\u00AA',
  6429. laquo: '\u00AB',
  6430. not: '\u00AC',
  6431. shy: '\u00AD',
  6432. reg: '\u00AE',
  6433. macr: '\u00AF',
  6434. deg: '\u00B0',
  6435. plusmn: '\u00B1',
  6436. sup2: '\u00B2',
  6437. sup3: '\u00B3',
  6438. acute: '\u00B4',
  6439. micro: '\u00B5',
  6440. para: '\u00B6',
  6441. middot: '\u00B7',
  6442. cedil: '\u00B8',
  6443. sup1: '\u00B9',
  6444. ordm: '\u00BA',
  6445. raquo: '\u00BB',
  6446. frac14: '\u00BC',
  6447. frac12: '\u00BD',
  6448. frac34: '\u00BE',
  6449. iquest: '\u00BF',
  6450. Agrave: '\u00C0',
  6451. Aacute: '\u00C1',
  6452. Acirc: '\u00C2',
  6453. Atilde: '\u00C3',
  6454. Auml: '\u00C4',
  6455. Aring: '\u00C5',
  6456. AElig: '\u00C6',
  6457. Ccedil: '\u00C7',
  6458. Egrave: '\u00C8',
  6459. Eacute: '\u00C9',
  6460. Ecirc: '\u00CA',
  6461. Euml: '\u00CB',
  6462. Igrave: '\u00CC',
  6463. Iacute: '\u00CD',
  6464. Icirc: '\u00CE',
  6465. Iuml: '\u00CF',
  6466. ETH: '\u00D0',
  6467. Ntilde: '\u00D1',
  6468. Ograve: '\u00D2',
  6469. Oacute: '\u00D3',
  6470. Ocirc: '\u00D4',
  6471. Otilde: '\u00D5',
  6472. Ouml: '\u00D6',
  6473. times: '\u00D7',
  6474. Oslash: '\u00D8',
  6475. Ugrave: '\u00D9',
  6476. Uacute: '\u00DA',
  6477. Ucirc: '\u00DB',
  6478. Uuml: '\u00DC',
  6479. Yacute: '\u00DD',
  6480. THORN: '\u00DE',
  6481. szlig: '\u00DF',
  6482. agrave: '\u00E0',
  6483. aacute: '\u00E1',
  6484. acirc: '\u00E2',
  6485. atilde: '\u00E3',
  6486. auml: '\u00E4',
  6487. aring: '\u00E5',
  6488. aelig: '\u00E6',
  6489. ccedil: '\u00E7',
  6490. egrave: '\u00E8',
  6491. eacute: '\u00E9',
  6492. ecirc: '\u00EA',
  6493. euml: '\u00EB',
  6494. igrave: '\u00EC',
  6495. iacute: '\u00ED',
  6496. icirc: '\u00EE',
  6497. iuml: '\u00EF',
  6498. eth: '\u00F0',
  6499. ntilde: '\u00F1',
  6500. ograve: '\u00F2',
  6501. oacute: '\u00F3',
  6502. ocirc: '\u00F4',
  6503. otilde: '\u00F5',
  6504. ouml: '\u00F6',
  6505. divide: '\u00F7',
  6506. oslash: '\u00F8',
  6507. ugrave: '\u00F9',
  6508. uacute: '\u00FA',
  6509. ucirc: '\u00FB',
  6510. uuml: '\u00FC',
  6511. yacute: '\u00FD',
  6512. thorn: '\u00FE',
  6513. yuml: '\u00FF',
  6514. OElig: '\u0152',
  6515. oelig: '\u0153',
  6516. Scaron: '\u0160',
  6517. scaron: '\u0161',
  6518. Yuml: '\u0178',
  6519. fnof: '\u0192',
  6520. circ: '\u02C6',
  6521. tilde: '\u02DC',
  6522. Alpha: '\u0391',
  6523. Beta: '\u0392',
  6524. Gamma: '\u0393',
  6525. Delta: '\u0394',
  6526. Epsilon: '\u0395',
  6527. Zeta: '\u0396',
  6528. Eta: '\u0397',
  6529. Theta: '\u0398',
  6530. Iota: '\u0399',
  6531. Kappa: '\u039A',
  6532. Lambda: '\u039B',
  6533. Mu: '\u039C',
  6534. Nu: '\u039D',
  6535. Xi: '\u039E',
  6536. Omicron: '\u039F',
  6537. Pi: '\u03A0',
  6538. Rho: '\u03A1',
  6539. Sigma: '\u03A3',
  6540. Tau: '\u03A4',
  6541. Upsilon: '\u03A5',
  6542. Phi: '\u03A6',
  6543. Chi: '\u03A7',
  6544. Psi: '\u03A8',
  6545. Omega: '\u03A9',
  6546. alpha: '\u03B1',
  6547. beta: '\u03B2',
  6548. gamma: '\u03B3',
  6549. delta: '\u03B4',
  6550. epsilon: '\u03B5',
  6551. zeta: '\u03B6',
  6552. eta: '\u03B7',
  6553. theta: '\u03B8',
  6554. iota: '\u03B9',
  6555. kappa: '\u03BA',
  6556. lambda: '\u03BB',
  6557. mu: '\u03BC',
  6558. nu: '\u03BD',
  6559. xi: '\u03BE',
  6560. omicron: '\u03BF',
  6561. pi: '\u03C0',
  6562. rho: '\u03C1',
  6563. sigmaf: '\u03C2',
  6564. sigma: '\u03C3',
  6565. tau: '\u03C4',
  6566. upsilon: '\u03C5',
  6567. phi: '\u03C6',
  6568. chi: '\u03C7',
  6569. psi: '\u03C8',
  6570. omega: '\u03C9',
  6571. thetasym: '\u03D1',
  6572. upsih: '\u03D2',
  6573. piv: '\u03D6',
  6574. ensp: '\u2002',
  6575. emsp: '\u2003',
  6576. thinsp: '\u2009',
  6577. zwnj: '\u200C',
  6578. zwj: '\u200D',
  6579. lrm: '\u200E',
  6580. rlm: '\u200F',
  6581. ndash: '\u2013',
  6582. mdash: '\u2014',
  6583. lsquo: '\u2018',
  6584. rsquo: '\u2019',
  6585. sbquo: '\u201A',
  6586. ldquo: '\u201C',
  6587. rdquo: '\u201D',
  6588. bdquo: '\u201E',
  6589. dagger: '\u2020',
  6590. Dagger: '\u2021',
  6591. bull: '\u2022',
  6592. hellip: '\u2026',
  6593. permil: '\u2030',
  6594. prime: '\u2032',
  6595. Prime: '\u2033',
  6596. lsaquo: '\u2039',
  6597. rsaquo: '\u203A',
  6598. oline: '\u203E',
  6599. frasl: '\u2044',
  6600. euro: '\u20AC',
  6601. image: '\u2111',
  6602. weierp: '\u2118',
  6603. real: '\u211C',
  6604. trade: '\u2122',
  6605. alefsym: '\u2135',
  6606. larr: '\u2190',
  6607. uarr: '\u2191',
  6608. rarr: '\u2192',
  6609. darr: '\u2193',
  6610. harr: '\u2194',
  6611. crarr: '\u21B5',
  6612. lArr: '\u21D0',
  6613. uArr: '\u21D1',
  6614. rArr: '\u21D2',
  6615. dArr: '\u21D3',
  6616. hArr: '\u21D4',
  6617. forall: '\u2200',
  6618. part: '\u2202',
  6619. exist: '\u2203',
  6620. empty: '\u2205',
  6621. nabla: '\u2207',
  6622. isin: '\u2208',
  6623. notin: '\u2209',
  6624. ni: '\u220B',
  6625. prod: '\u220F',
  6626. sum: '\u2211',
  6627. minus: '\u2212',
  6628. lowast: '\u2217',
  6629. radic: '\u221A',
  6630. prop: '\u221D',
  6631. infin: '\u221E',
  6632. ang: '\u2220',
  6633. and: '\u2227',
  6634. or: '\u2228',
  6635. cap: '\u2229',
  6636. cup: '\u222A',
  6637. int: '\u222B',
  6638. there4: '\u2234',
  6639. sim: '\u223C',
  6640. cong: '\u2245',
  6641. asymp: '\u2248',
  6642. ne: '\u2260',
  6643. equiv: '\u2261',
  6644. le: '\u2264',
  6645. ge: '\u2265',
  6646. sub: '\u2282',
  6647. sup: '\u2283',
  6648. nsub: '\u2284',
  6649. sube: '\u2286',
  6650. supe: '\u2287',
  6651. oplus: '\u2295',
  6652. otimes: '\u2297',
  6653. perp: '\u22A5',
  6654. sdot: '\u22C5',
  6655. lceil: '\u2308',
  6656. rceil: '\u2309',
  6657. lfloor: '\u230A',
  6658. rfloor: '\u230B',
  6659. loz: '\u25CA',
  6660. spades: '\u2660',
  6661. clubs: '\u2663',
  6662. hearts: '\u2665',
  6663. diams: '\u2666',
  6664. lang: '\u27E8',
  6665. rang: '\u27E9'
  6666. };
  6667. /***/ },
  6668. /* 15 */
  6669. /***/ function(module, exports, __nested_webpack_require_277122__) {
  6670. "use strict";
  6671. Object.defineProperty(exports, "__esModule", { value: true });
  6672. var error_handler_1 = __nested_webpack_require_277122__(10);
  6673. var scanner_1 = __nested_webpack_require_277122__(12);
  6674. var token_1 = __nested_webpack_require_277122__(13);
  6675. var Reader = (function () {
  6676. function Reader() {
  6677. this.values = [];
  6678. this.curly = this.paren = -1;
  6679. }
  6680. // A function following one of those tokens is an expression.
  6681. Reader.prototype.beforeFunctionExpression = function (t) {
  6682. return ['(', '{', '[', 'in', 'typeof', 'instanceof', 'new',
  6683. 'return', 'case', 'delete', 'throw', 'void',
  6684. // assignment operators
  6685. '=', '+=', '-=', '*=', '**=', '/=', '%=', '<<=', '>>=', '>>>=',
  6686. '&=', '|=', '^=', ',',
  6687. // binary/unary operators
  6688. '+', '-', '*', '**', '/', '%', '++', '--', '<<', '>>', '>>>', '&',
  6689. '|', '^', '!', '~', '&&', '||', '?', ':', '===', '==', '>=',
  6690. '<=', '<', '>', '!=', '!=='].indexOf(t) >= 0;
  6691. };
  6692. // Determine if forward slash (/) is an operator or part of a regular expression
  6693. // https://github.com/mozilla/sweet.js/wiki/design
  6694. Reader.prototype.isRegexStart = function () {
  6695. var previous = this.values[this.values.length - 1];
  6696. var regex = (previous !== null);
  6697. switch (previous) {
  6698. case 'this':
  6699. case ']':
  6700. regex = false;
  6701. break;
  6702. case ')':
  6703. var keyword = this.values[this.paren - 1];
  6704. regex = (keyword === 'if' || keyword === 'while' || keyword === 'for' || keyword === 'with');
  6705. break;
  6706. case '}':
  6707. // Dividing a function by anything makes little sense,
  6708. // but we have to check for that.
  6709. regex = false;
  6710. if (this.values[this.curly - 3] === 'function') {
  6711. // Anonymous function, e.g. function(){} /42
  6712. var check = this.values[this.curly - 4];
  6713. regex = check ? !this.beforeFunctionExpression(check) : false;
  6714. }
  6715. else if (this.values[this.curly - 4] === 'function') {
  6716. // Named function, e.g. function f(){} /42/
  6717. var check = this.values[this.curly - 5];
  6718. regex = check ? !this.beforeFunctionExpression(check) : true;
  6719. }
  6720. break;
  6721. default:
  6722. break;
  6723. }
  6724. return regex;
  6725. };
  6726. Reader.prototype.push = function (token) {
  6727. if (token.type === 7 /* Punctuator */ || token.type === 4 /* Keyword */) {
  6728. if (token.value === '{') {
  6729. this.curly = this.values.length;
  6730. }
  6731. else if (token.value === '(') {
  6732. this.paren = this.values.length;
  6733. }
  6734. this.values.push(token.value);
  6735. }
  6736. else {
  6737. this.values.push(null);
  6738. }
  6739. };
  6740. return Reader;
  6741. }());
  6742. var Tokenizer = (function () {
  6743. function Tokenizer(code, config) {
  6744. this.errorHandler = new error_handler_1.ErrorHandler();
  6745. this.errorHandler.tolerant = config ? (typeof config.tolerant === 'boolean' && config.tolerant) : false;
  6746. this.scanner = new scanner_1.Scanner(code, this.errorHandler);
  6747. this.scanner.trackComment = config ? (typeof config.comment === 'boolean' && config.comment) : false;
  6748. this.trackRange = config ? (typeof config.range === 'boolean' && config.range) : false;
  6749. this.trackLoc = config ? (typeof config.loc === 'boolean' && config.loc) : false;
  6750. this.buffer = [];
  6751. this.reader = new Reader();
  6752. }
  6753. Tokenizer.prototype.errors = function () {
  6754. return this.errorHandler.errors;
  6755. };
  6756. Tokenizer.prototype.getNextToken = function () {
  6757. if (this.buffer.length === 0) {
  6758. var comments = this.scanner.scanComments();
  6759. if (this.scanner.trackComment) {
  6760. for (var i = 0; i < comments.length; ++i) {
  6761. var e = comments[i];
  6762. var value = this.scanner.source.slice(e.slice[0], e.slice[1]);
  6763. var comment = {
  6764. type: e.multiLine ? 'BlockComment' : 'LineComment',
  6765. value: value
  6766. };
  6767. if (this.trackRange) {
  6768. comment.range = e.range;
  6769. }
  6770. if (this.trackLoc) {
  6771. comment.loc = e.loc;
  6772. }
  6773. this.buffer.push(comment);
  6774. }
  6775. }
  6776. if (!this.scanner.eof()) {
  6777. var loc = void 0;
  6778. if (this.trackLoc) {
  6779. loc = {
  6780. start: {
  6781. line: this.scanner.lineNumber,
  6782. column: this.scanner.index - this.scanner.lineStart
  6783. },
  6784. end: {}
  6785. };
  6786. }
  6787. var startRegex = (this.scanner.source[this.scanner.index] === '/') && this.reader.isRegexStart();
  6788. var token = startRegex ? this.scanner.scanRegExp() : this.scanner.lex();
  6789. this.reader.push(token);
  6790. var entry = {
  6791. type: token_1.TokenName[token.type],
  6792. value: this.scanner.source.slice(token.start, token.end)
  6793. };
  6794. if (this.trackRange) {
  6795. entry.range = [token.start, token.end];
  6796. }
  6797. if (this.trackLoc) {
  6798. loc.end = {
  6799. line: this.scanner.lineNumber,
  6800. column: this.scanner.index - this.scanner.lineStart
  6801. };
  6802. entry.loc = loc;
  6803. }
  6804. if (token.type === 9 /* RegularExpression */) {
  6805. var pattern = token.pattern;
  6806. var flags = token.flags;
  6807. entry.regex = { pattern: pattern, flags: flags };
  6808. }
  6809. this.buffer.push(entry);
  6810. }
  6811. }
  6812. return this.buffer.shift();
  6813. };
  6814. return Tokenizer;
  6815. }());
  6816. exports.Tokenizer = Tokenizer;
  6817. /***/ }
  6818. /******/ ])
  6819. });
  6820. ;
  6821. /***/ }),
  6822. /***/ 93320:
  6823. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  6824. "use strict";
  6825. var yaml = __webpack_require__(51294);
  6826. module.exports = yaml;
  6827. /***/ }),
  6828. /***/ 51294:
  6829. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  6830. "use strict";
  6831. var loader = __webpack_require__(40028);
  6832. var dumper = __webpack_require__(96157);
  6833. function deprecated(name) {
  6834. return function () {
  6835. throw new Error('Function ' + name + ' is deprecated and cannot be used.');
  6836. };
  6837. }
  6838. module.exports.Type = __webpack_require__(53899);
  6839. module.exports.Schema = __webpack_require__(82409);
  6840. module.exports.FAILSAFE_SCHEMA = __webpack_require__(75322);
  6841. module.exports.JSON_SCHEMA = __webpack_require__(65796);
  6842. module.exports.CORE_SCHEMA = __webpack_require__(17318);
  6843. module.exports.DEFAULT_SAFE_SCHEMA = __webpack_require__(5972);
  6844. module.exports.DEFAULT_FULL_SCHEMA = __webpack_require__(19321);
  6845. module.exports.load = loader.load;
  6846. module.exports.loadAll = loader.loadAll;
  6847. module.exports.safeLoad = loader.safeLoad;
  6848. module.exports.safeLoadAll = loader.safeLoadAll;
  6849. module.exports.dump = dumper.dump;
  6850. module.exports.safeDump = dumper.safeDump;
  6851. module.exports.YAMLException = __webpack_require__(14884);
  6852. // Deprecated schema names from JS-YAML 2.0.x
  6853. module.exports.MINIMAL_SCHEMA = __webpack_require__(75322);
  6854. module.exports.SAFE_SCHEMA = __webpack_require__(5972);
  6855. module.exports.DEFAULT_SCHEMA = __webpack_require__(19321);
  6856. // Deprecated functions from JS-YAML 1.x.x
  6857. module.exports.scan = deprecated('scan');
  6858. module.exports.parse = deprecated('parse');
  6859. module.exports.compose = deprecated('compose');
  6860. module.exports.addConstructor = deprecated('addConstructor');
  6861. /***/ }),
  6862. /***/ 25596:
  6863. /***/ ((module) => {
  6864. "use strict";
  6865. function isNothing(subject) {
  6866. return (typeof subject === 'undefined') || (subject === null);
  6867. }
  6868. function isObject(subject) {
  6869. return (typeof subject === 'object') && (subject !== null);
  6870. }
  6871. function toArray(sequence) {
  6872. if (Array.isArray(sequence)) return sequence;
  6873. else if (isNothing(sequence)) return [];
  6874. return [ sequence ];
  6875. }
  6876. function extend(target, source) {
  6877. var index, length, key, sourceKeys;
  6878. if (source) {
  6879. sourceKeys = Object.keys(source);
  6880. for (index = 0, length = sourceKeys.length; index < length; index += 1) {
  6881. key = sourceKeys[index];
  6882. target[key] = source[key];
  6883. }
  6884. }
  6885. return target;
  6886. }
  6887. function repeat(string, count) {
  6888. var result = '', cycle;
  6889. for (cycle = 0; cycle < count; cycle += 1) {
  6890. result += string;
  6891. }
  6892. return result;
  6893. }
  6894. function isNegativeZero(number) {
  6895. return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number);
  6896. }
  6897. module.exports.isNothing = isNothing;
  6898. module.exports.isObject = isObject;
  6899. module.exports.toArray = toArray;
  6900. module.exports.repeat = repeat;
  6901. module.exports.isNegativeZero = isNegativeZero;
  6902. module.exports.extend = extend;
  6903. /***/ }),
  6904. /***/ 96157:
  6905. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  6906. "use strict";
  6907. /*eslint-disable no-use-before-define*/
  6908. var common = __webpack_require__(25596);
  6909. var YAMLException = __webpack_require__(14884);
  6910. var DEFAULT_FULL_SCHEMA = __webpack_require__(19321);
  6911. var DEFAULT_SAFE_SCHEMA = __webpack_require__(5972);
  6912. var _toString = Object.prototype.toString;
  6913. var _hasOwnProperty = Object.prototype.hasOwnProperty;
  6914. var CHAR_TAB = 0x09; /* Tab */
  6915. var CHAR_LINE_FEED = 0x0A; /* LF */
  6916. var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */
  6917. var CHAR_SPACE = 0x20; /* Space */
  6918. var CHAR_EXCLAMATION = 0x21; /* ! */
  6919. var CHAR_DOUBLE_QUOTE = 0x22; /* " */
  6920. var CHAR_SHARP = 0x23; /* # */
  6921. var CHAR_PERCENT = 0x25; /* % */
  6922. var CHAR_AMPERSAND = 0x26; /* & */
  6923. var CHAR_SINGLE_QUOTE = 0x27; /* ' */
  6924. var CHAR_ASTERISK = 0x2A; /* * */
  6925. var CHAR_COMMA = 0x2C; /* , */
  6926. var CHAR_MINUS = 0x2D; /* - */
  6927. var CHAR_COLON = 0x3A; /* : */
  6928. var CHAR_EQUALS = 0x3D; /* = */
  6929. var CHAR_GREATER_THAN = 0x3E; /* > */
  6930. var CHAR_QUESTION = 0x3F; /* ? */
  6931. var CHAR_COMMERCIAL_AT = 0x40; /* @ */
  6932. var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */
  6933. var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */
  6934. var CHAR_GRAVE_ACCENT = 0x60; /* ` */
  6935. var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */
  6936. var CHAR_VERTICAL_LINE = 0x7C; /* | */
  6937. var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */
  6938. var ESCAPE_SEQUENCES = {};
  6939. ESCAPE_SEQUENCES[0x00] = '\\0';
  6940. ESCAPE_SEQUENCES[0x07] = '\\a';
  6941. ESCAPE_SEQUENCES[0x08] = '\\b';
  6942. ESCAPE_SEQUENCES[0x09] = '\\t';
  6943. ESCAPE_SEQUENCES[0x0A] = '\\n';
  6944. ESCAPE_SEQUENCES[0x0B] = '\\v';
  6945. ESCAPE_SEQUENCES[0x0C] = '\\f';
  6946. ESCAPE_SEQUENCES[0x0D] = '\\r';
  6947. ESCAPE_SEQUENCES[0x1B] = '\\e';
  6948. ESCAPE_SEQUENCES[0x22] = '\\"';
  6949. ESCAPE_SEQUENCES[0x5C] = '\\\\';
  6950. ESCAPE_SEQUENCES[0x85] = '\\N';
  6951. ESCAPE_SEQUENCES[0xA0] = '\\_';
  6952. ESCAPE_SEQUENCES[0x2028] = '\\L';
  6953. ESCAPE_SEQUENCES[0x2029] = '\\P';
  6954. var DEPRECATED_BOOLEANS_SYNTAX = [
  6955. 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON',
  6956. 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'
  6957. ];
  6958. function compileStyleMap(schema, map) {
  6959. var result, keys, index, length, tag, style, type;
  6960. if (map === null) return {};
  6961. result = {};
  6962. keys = Object.keys(map);
  6963. for (index = 0, length = keys.length; index < length; index += 1) {
  6964. tag = keys[index];
  6965. style = String(map[tag]);
  6966. if (tag.slice(0, 2) === '!!') {
  6967. tag = 'tag:yaml.org,2002:' + tag.slice(2);
  6968. }
  6969. type = schema.compiledTypeMap['fallback'][tag];
  6970. if (type && _hasOwnProperty.call(type.styleAliases, style)) {
  6971. style = type.styleAliases[style];
  6972. }
  6973. result[tag] = style;
  6974. }
  6975. return result;
  6976. }
  6977. function encodeHex(character) {
  6978. var string, handle, length;
  6979. string = character.toString(16).toUpperCase();
  6980. if (character <= 0xFF) {
  6981. handle = 'x';
  6982. length = 2;
  6983. } else if (character <= 0xFFFF) {
  6984. handle = 'u';
  6985. length = 4;
  6986. } else if (character <= 0xFFFFFFFF) {
  6987. handle = 'U';
  6988. length = 8;
  6989. } else {
  6990. throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF');
  6991. }
  6992. return '\\' + handle + common.repeat('0', length - string.length) + string;
  6993. }
  6994. function State(options) {
  6995. this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;
  6996. this.indent = Math.max(1, (options['indent'] || 2));
  6997. this.noArrayIndent = options['noArrayIndent'] || false;
  6998. this.skipInvalid = options['skipInvalid'] || false;
  6999. this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']);
  7000. this.styleMap = compileStyleMap(this.schema, options['styles'] || null);
  7001. this.sortKeys = options['sortKeys'] || false;
  7002. this.lineWidth = options['lineWidth'] || 80;
  7003. this.noRefs = options['noRefs'] || false;
  7004. this.noCompatMode = options['noCompatMode'] || false;
  7005. this.condenseFlow = options['condenseFlow'] || false;
  7006. this.implicitTypes = this.schema.compiledImplicit;
  7007. this.explicitTypes = this.schema.compiledExplicit;
  7008. this.tag = null;
  7009. this.result = '';
  7010. this.duplicates = [];
  7011. this.usedDuplicates = null;
  7012. }
  7013. // Indents every line in a string. Empty lines (\n only) are not indented.
  7014. function indentString(string, spaces) {
  7015. var ind = common.repeat(' ', spaces),
  7016. position = 0,
  7017. next = -1,
  7018. result = '',
  7019. line,
  7020. length = string.length;
  7021. while (position < length) {
  7022. next = string.indexOf('\n', position);
  7023. if (next === -1) {
  7024. line = string.slice(position);
  7025. position = length;
  7026. } else {
  7027. line = string.slice(position, next + 1);
  7028. position = next + 1;
  7029. }
  7030. if (line.length && line !== '\n') result += ind;
  7031. result += line;
  7032. }
  7033. return result;
  7034. }
  7035. function generateNextLine(state, level) {
  7036. return '\n' + common.repeat(' ', state.indent * level);
  7037. }
  7038. function testImplicitResolving(state, str) {
  7039. var index, length, type;
  7040. for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
  7041. type = state.implicitTypes[index];
  7042. if (type.resolve(str)) {
  7043. return true;
  7044. }
  7045. }
  7046. return false;
  7047. }
  7048. // [33] s-white ::= s-space | s-tab
  7049. function isWhitespace(c) {
  7050. return c === CHAR_SPACE || c === CHAR_TAB;
  7051. }
  7052. // Returns true if the character can be printed without escaping.
  7053. // From YAML 1.2: "any allowed characters known to be non-printable
  7054. // should also be escaped. [However,] This isn’t mandatory"
  7055. // Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029.
  7056. function isPrintable(c) {
  7057. return (0x00020 <= c && c <= 0x00007E)
  7058. || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029)
  7059. || ((0x0E000 <= c && c <= 0x00FFFD) && c !== 0xFEFF /* BOM */)
  7060. || (0x10000 <= c && c <= 0x10FFFF);
  7061. }
  7062. // [34] ns-char ::= nb-char - s-white
  7063. // [27] nb-char ::= c-printable - b-char - c-byte-order-mark
  7064. // [26] b-char ::= b-line-feed | b-carriage-return
  7065. // [24] b-line-feed ::= #xA /* LF */
  7066. // [25] b-carriage-return ::= #xD /* CR */
  7067. // [3] c-byte-order-mark ::= #xFEFF
  7068. function isNsChar(c) {
  7069. return isPrintable(c) && !isWhitespace(c)
  7070. // byte-order-mark
  7071. && c !== 0xFEFF
  7072. // b-char
  7073. && c !== CHAR_CARRIAGE_RETURN
  7074. && c !== CHAR_LINE_FEED;
  7075. }
  7076. // Simplified test for values allowed after the first character in plain style.
  7077. function isPlainSafe(c, prev) {
  7078. // Uses a subset of nb-char - c-flow-indicator - ":" - "#"
  7079. // where nb-char ::= c-printable - b-char - c-byte-order-mark.
  7080. return isPrintable(c) && c !== 0xFEFF
  7081. // - c-flow-indicator
  7082. && c !== CHAR_COMMA
  7083. && c !== CHAR_LEFT_SQUARE_BRACKET
  7084. && c !== CHAR_RIGHT_SQUARE_BRACKET
  7085. && c !== CHAR_LEFT_CURLY_BRACKET
  7086. && c !== CHAR_RIGHT_CURLY_BRACKET
  7087. // - ":" - "#"
  7088. // /* An ns-char preceding */ "#"
  7089. && c !== CHAR_COLON
  7090. && ((c !== CHAR_SHARP) || (prev && isNsChar(prev)));
  7091. }
  7092. // Simplified test for values allowed as the first character in plain style.
  7093. function isPlainSafeFirst(c) {
  7094. // Uses a subset of ns-char - c-indicator
  7095. // where ns-char = nb-char - s-white.
  7096. return isPrintable(c) && c !== 0xFEFF
  7097. && !isWhitespace(c) // - s-white
  7098. // - (c-indicator ::=
  7099. // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}”
  7100. && c !== CHAR_MINUS
  7101. && c !== CHAR_QUESTION
  7102. && c !== CHAR_COLON
  7103. && c !== CHAR_COMMA
  7104. && c !== CHAR_LEFT_SQUARE_BRACKET
  7105. && c !== CHAR_RIGHT_SQUARE_BRACKET
  7106. && c !== CHAR_LEFT_CURLY_BRACKET
  7107. && c !== CHAR_RIGHT_CURLY_BRACKET
  7108. // | “#” | “&” | “*” | “!” | “|” | “=” | “>” | “'” | “"”
  7109. && c !== CHAR_SHARP
  7110. && c !== CHAR_AMPERSAND
  7111. && c !== CHAR_ASTERISK
  7112. && c !== CHAR_EXCLAMATION
  7113. && c !== CHAR_VERTICAL_LINE
  7114. && c !== CHAR_EQUALS
  7115. && c !== CHAR_GREATER_THAN
  7116. && c !== CHAR_SINGLE_QUOTE
  7117. && c !== CHAR_DOUBLE_QUOTE
  7118. // | “%” | “@” | “`”)
  7119. && c !== CHAR_PERCENT
  7120. && c !== CHAR_COMMERCIAL_AT
  7121. && c !== CHAR_GRAVE_ACCENT;
  7122. }
  7123. // Determines whether block indentation indicator is required.
  7124. function needIndentIndicator(string) {
  7125. var leadingSpaceRe = /^\n* /;
  7126. return leadingSpaceRe.test(string);
  7127. }
  7128. var STYLE_PLAIN = 1,
  7129. STYLE_SINGLE = 2,
  7130. STYLE_LITERAL = 3,
  7131. STYLE_FOLDED = 4,
  7132. STYLE_DOUBLE = 5;
  7133. // Determines which scalar styles are possible and returns the preferred style.
  7134. // lineWidth = -1 => no limit.
  7135. // Pre-conditions: str.length > 0.
  7136. // Post-conditions:
  7137. // STYLE_PLAIN or STYLE_SINGLE => no \n are in the string.
  7138. // STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1).
  7139. // STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1).
  7140. function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) {
  7141. var i;
  7142. var char, prev_char;
  7143. var hasLineBreak = false;
  7144. var hasFoldableLine = false; // only checked if shouldTrackWidth
  7145. var shouldTrackWidth = lineWidth !== -1;
  7146. var previousLineBreak = -1; // count the first line correctly
  7147. var plain = isPlainSafeFirst(string.charCodeAt(0))
  7148. && !isWhitespace(string.charCodeAt(string.length - 1));
  7149. if (singleLineOnly) {
  7150. // Case: no block styles.
  7151. // Check for disallowed characters to rule out plain and single.
  7152. for (i = 0; i < string.length; i++) {
  7153. char = string.charCodeAt(i);
  7154. if (!isPrintable(char)) {
  7155. return STYLE_DOUBLE;
  7156. }
  7157. prev_char = i > 0 ? string.charCodeAt(i - 1) : null;
  7158. plain = plain && isPlainSafe(char, prev_char);
  7159. }
  7160. } else {
  7161. // Case: block styles permitted.
  7162. for (i = 0; i < string.length; i++) {
  7163. char = string.charCodeAt(i);
  7164. if (char === CHAR_LINE_FEED) {
  7165. hasLineBreak = true;
  7166. // Check if any line can be folded.
  7167. if (shouldTrackWidth) {
  7168. hasFoldableLine = hasFoldableLine ||
  7169. // Foldable line = too long, and not more-indented.
  7170. (i - previousLineBreak - 1 > lineWidth &&
  7171. string[previousLineBreak + 1] !== ' ');
  7172. previousLineBreak = i;
  7173. }
  7174. } else if (!isPrintable(char)) {
  7175. return STYLE_DOUBLE;
  7176. }
  7177. prev_char = i > 0 ? string.charCodeAt(i - 1) : null;
  7178. plain = plain && isPlainSafe(char, prev_char);
  7179. }
  7180. // in case the end is missing a \n
  7181. hasFoldableLine = hasFoldableLine || (shouldTrackWidth &&
  7182. (i - previousLineBreak - 1 > lineWidth &&
  7183. string[previousLineBreak + 1] !== ' '));
  7184. }
  7185. // Although every style can represent \n without escaping, prefer block styles
  7186. // for multiline, since they're more readable and they don't add empty lines.
  7187. // Also prefer folding a super-long line.
  7188. if (!hasLineBreak && !hasFoldableLine) {
  7189. // Strings interpretable as another type have to be quoted;
  7190. // e.g. the string 'true' vs. the boolean true.
  7191. return plain && !testAmbiguousType(string)
  7192. ? STYLE_PLAIN : STYLE_SINGLE;
  7193. }
  7194. // Edge case: block indentation indicator can only have one digit.
  7195. if (indentPerLevel > 9 && needIndentIndicator(string)) {
  7196. return STYLE_DOUBLE;
  7197. }
  7198. // At this point we know block styles are valid.
  7199. // Prefer literal style unless we want to fold.
  7200. return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
  7201. }
  7202. // Note: line breaking/folding is implemented for only the folded style.
  7203. // NB. We drop the last trailing newline (if any) of a returned block scalar
  7204. // since the dumper adds its own newline. This always works:
  7205. // • No ending newline => unaffected; already using strip "-" chomping.
  7206. // • Ending newline => removed then restored.
  7207. // Importantly, this keeps the "+" chomp indicator from gaining an extra line.
  7208. function writeScalar(state, string, level, iskey) {
  7209. state.dump = (function () {
  7210. if (string.length === 0) {
  7211. return "''";
  7212. }
  7213. if (!state.noCompatMode &&
  7214. DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) {
  7215. return "'" + string + "'";
  7216. }
  7217. var indent = state.indent * Math.max(1, level); // no 0-indent scalars
  7218. // As indentation gets deeper, let the width decrease monotonically
  7219. // to the lower bound min(state.lineWidth, 40).
  7220. // Note that this implies
  7221. // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound.
  7222. // state.lineWidth > 40 + state.indent: width decreases until the lower bound.
  7223. // This behaves better than a constant minimum width which disallows narrower options,
  7224. // or an indent threshold which causes the width to suddenly increase.
  7225. var lineWidth = state.lineWidth === -1
  7226. ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
  7227. // Without knowing if keys are implicit/explicit, assume implicit for safety.
  7228. var singleLineOnly = iskey
  7229. // No block styles in flow mode.
  7230. || (state.flowLevel > -1 && level >= state.flowLevel);
  7231. function testAmbiguity(string) {
  7232. return testImplicitResolving(state, string);
  7233. }
  7234. switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) {
  7235. case STYLE_PLAIN:
  7236. return string;
  7237. case STYLE_SINGLE:
  7238. return "'" + string.replace(/'/g, "''") + "'";
  7239. case STYLE_LITERAL:
  7240. return '|' + blockHeader(string, state.indent)
  7241. + dropEndingNewline(indentString(string, indent));
  7242. case STYLE_FOLDED:
  7243. return '>' + blockHeader(string, state.indent)
  7244. + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
  7245. case STYLE_DOUBLE:
  7246. return '"' + escapeString(string, lineWidth) + '"';
  7247. default:
  7248. throw new YAMLException('impossible error: invalid scalar style');
  7249. }
  7250. }());
  7251. }
  7252. // Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9.
  7253. function blockHeader(string, indentPerLevel) {
  7254. var indentIndicator = needIndentIndicator(string) ? String(indentPerLevel) : '';
  7255. // note the special case: the string '\n' counts as a "trailing" empty line.
  7256. var clip = string[string.length - 1] === '\n';
  7257. var keep = clip && (string[string.length - 2] === '\n' || string === '\n');
  7258. var chomp = keep ? '+' : (clip ? '' : '-');
  7259. return indentIndicator + chomp + '\n';
  7260. }
  7261. // (See the note for writeScalar.)
  7262. function dropEndingNewline(string) {
  7263. return string[string.length - 1] === '\n' ? string.slice(0, -1) : string;
  7264. }
  7265. // Note: a long line without a suitable break point will exceed the width limit.
  7266. // Pre-conditions: every char in str isPrintable, str.length > 0, width > 0.
  7267. function foldString(string, width) {
  7268. // In folded style, $k$ consecutive newlines output as $k+1$ newlines—
  7269. // unless they're before or after a more-indented line, or at the very
  7270. // beginning or end, in which case $k$ maps to $k$.
  7271. // Therefore, parse each chunk as newline(s) followed by a content line.
  7272. var lineRe = /(\n+)([^\n]*)/g;
  7273. // first line (possibly an empty line)
  7274. var result = (function () {
  7275. var nextLF = string.indexOf('\n');
  7276. nextLF = nextLF !== -1 ? nextLF : string.length;
  7277. lineRe.lastIndex = nextLF;
  7278. return foldLine(string.slice(0, nextLF), width);
  7279. }());
  7280. // If we haven't reached the first content line yet, don't add an extra \n.
  7281. var prevMoreIndented = string[0] === '\n' || string[0] === ' ';
  7282. var moreIndented;
  7283. // rest of the lines
  7284. var match;
  7285. while ((match = lineRe.exec(string))) {
  7286. var prefix = match[1], line = match[2];
  7287. moreIndented = (line[0] === ' ');
  7288. result += prefix
  7289. + (!prevMoreIndented && !moreIndented && line !== ''
  7290. ? '\n' : '')
  7291. + foldLine(line, width);
  7292. prevMoreIndented = moreIndented;
  7293. }
  7294. return result;
  7295. }
  7296. // Greedy line breaking.
  7297. // Picks the longest line under the limit each time,
  7298. // otherwise settles for the shortest line over the limit.
  7299. // NB. More-indented lines *cannot* be folded, as that would add an extra \n.
  7300. function foldLine(line, width) {
  7301. if (line === '' || line[0] === ' ') return line;
  7302. // Since a more-indented line adds a \n, breaks can't be followed by a space.
  7303. var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.
  7304. var match;
  7305. // start is an inclusive index. end, curr, and next are exclusive.
  7306. var start = 0, end, curr = 0, next = 0;
  7307. var result = '';
  7308. // Invariants: 0 <= start <= length-1.
  7309. // 0 <= curr <= next <= max(0, length-2). curr - start <= width.
  7310. // Inside the loop:
  7311. // A match implies length >= 2, so curr and next are <= length-2.
  7312. while ((match = breakRe.exec(line))) {
  7313. next = match.index;
  7314. // maintain invariant: curr - start <= width
  7315. if (next - start > width) {
  7316. end = (curr > start) ? curr : next; // derive end <= length-2
  7317. result += '\n' + line.slice(start, end);
  7318. // skip the space that was output as \n
  7319. start = end + 1; // derive start <= length-1
  7320. }
  7321. curr = next;
  7322. }
  7323. // By the invariants, start <= length-1, so there is something left over.
  7324. // It is either the whole string or a part starting from non-whitespace.
  7325. result += '\n';
  7326. // Insert a break if the remainder is too long and there is a break available.
  7327. if (line.length - start > width && curr > start) {
  7328. result += line.slice(start, curr) + '\n' + line.slice(curr + 1);
  7329. } else {
  7330. result += line.slice(start);
  7331. }
  7332. return result.slice(1); // drop extra \n joiner
  7333. }
  7334. // Escapes a double-quoted string.
  7335. function escapeString(string) {
  7336. var result = '';
  7337. var char, nextChar;
  7338. var escapeSeq;
  7339. for (var i = 0; i < string.length; i++) {
  7340. char = string.charCodeAt(i);
  7341. // Check for surrogate pairs (reference Unicode 3.0 section "3.7 Surrogates").
  7342. if (char >= 0xD800 && char <= 0xDBFF/* high surrogate */) {
  7343. nextChar = string.charCodeAt(i + 1);
  7344. if (nextChar >= 0xDC00 && nextChar <= 0xDFFF/* low surrogate */) {
  7345. // Combine the surrogate pair and store it escaped.
  7346. result += encodeHex((char - 0xD800) * 0x400 + nextChar - 0xDC00 + 0x10000);
  7347. // Advance index one extra since we already used that char here.
  7348. i++; continue;
  7349. }
  7350. }
  7351. escapeSeq = ESCAPE_SEQUENCES[char];
  7352. result += !escapeSeq && isPrintable(char)
  7353. ? string[i]
  7354. : escapeSeq || encodeHex(char);
  7355. }
  7356. return result;
  7357. }
  7358. function writeFlowSequence(state, level, object) {
  7359. var _result = '',
  7360. _tag = state.tag,
  7361. index,
  7362. length;
  7363. for (index = 0, length = object.length; index < length; index += 1) {
  7364. // Write only valid elements.
  7365. if (writeNode(state, level, object[index], false, false)) {
  7366. if (index !== 0) _result += ',' + (!state.condenseFlow ? ' ' : '');
  7367. _result += state.dump;
  7368. }
  7369. }
  7370. state.tag = _tag;
  7371. state.dump = '[' + _result + ']';
  7372. }
  7373. function writeBlockSequence(state, level, object, compact) {
  7374. var _result = '',
  7375. _tag = state.tag,
  7376. index,
  7377. length;
  7378. for (index = 0, length = object.length; index < length; index += 1) {
  7379. // Write only valid elements.
  7380. if (writeNode(state, level + 1, object[index], true, true)) {
  7381. if (!compact || index !== 0) {
  7382. _result += generateNextLine(state, level);
  7383. }
  7384. if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
  7385. _result += '-';
  7386. } else {
  7387. _result += '- ';
  7388. }
  7389. _result += state.dump;
  7390. }
  7391. }
  7392. state.tag = _tag;
  7393. state.dump = _result || '[]'; // Empty sequence if no valid values.
  7394. }
  7395. function writeFlowMapping(state, level, object) {
  7396. var _result = '',
  7397. _tag = state.tag,
  7398. objectKeyList = Object.keys(object),
  7399. index,
  7400. length,
  7401. objectKey,
  7402. objectValue,
  7403. pairBuffer;
  7404. for (index = 0, length = objectKeyList.length; index < length; index += 1) {
  7405. pairBuffer = '';
  7406. if (index !== 0) pairBuffer += ', ';
  7407. if (state.condenseFlow) pairBuffer += '"';
  7408. objectKey = objectKeyList[index];
  7409. objectValue = object[objectKey];
  7410. if (!writeNode(state, level, objectKey, false, false)) {
  7411. continue; // Skip this pair because of invalid key;
  7412. }
  7413. if (state.dump.length > 1024) pairBuffer += '? ';
  7414. pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' ');
  7415. if (!writeNode(state, level, objectValue, false, false)) {
  7416. continue; // Skip this pair because of invalid value.
  7417. }
  7418. pairBuffer += state.dump;
  7419. // Both key and value are valid.
  7420. _result += pairBuffer;
  7421. }
  7422. state.tag = _tag;
  7423. state.dump = '{' + _result + '}';
  7424. }
  7425. function writeBlockMapping(state, level, object, compact) {
  7426. var _result = '',
  7427. _tag = state.tag,
  7428. objectKeyList = Object.keys(object),
  7429. index,
  7430. length,
  7431. objectKey,
  7432. objectValue,
  7433. explicitPair,
  7434. pairBuffer;
  7435. // Allow sorting keys so that the output file is deterministic
  7436. if (state.sortKeys === true) {
  7437. // Default sorting
  7438. objectKeyList.sort();
  7439. } else if (typeof state.sortKeys === 'function') {
  7440. // Custom sort function
  7441. objectKeyList.sort(state.sortKeys);
  7442. } else if (state.sortKeys) {
  7443. // Something is wrong
  7444. throw new YAMLException('sortKeys must be a boolean or a function');
  7445. }
  7446. for (index = 0, length = objectKeyList.length; index < length; index += 1) {
  7447. pairBuffer = '';
  7448. if (!compact || index !== 0) {
  7449. pairBuffer += generateNextLine(state, level);
  7450. }
  7451. objectKey = objectKeyList[index];
  7452. objectValue = object[objectKey];
  7453. if (!writeNode(state, level + 1, objectKey, true, true, true)) {
  7454. continue; // Skip this pair because of invalid key.
  7455. }
  7456. explicitPair = (state.tag !== null && state.tag !== '?') ||
  7457. (state.dump && state.dump.length > 1024);
  7458. if (explicitPair) {
  7459. if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
  7460. pairBuffer += '?';
  7461. } else {
  7462. pairBuffer += '? ';
  7463. }
  7464. }
  7465. pairBuffer += state.dump;
  7466. if (explicitPair) {
  7467. pairBuffer += generateNextLine(state, level);
  7468. }
  7469. if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
  7470. continue; // Skip this pair because of invalid value.
  7471. }
  7472. if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
  7473. pairBuffer += ':';
  7474. } else {
  7475. pairBuffer += ': ';
  7476. }
  7477. pairBuffer += state.dump;
  7478. // Both key and value are valid.
  7479. _result += pairBuffer;
  7480. }
  7481. state.tag = _tag;
  7482. state.dump = _result || '{}'; // Empty mapping if no valid pairs.
  7483. }
  7484. function detectType(state, object, explicit) {
  7485. var _result, typeList, index, length, type, style;
  7486. typeList = explicit ? state.explicitTypes : state.implicitTypes;
  7487. for (index = 0, length = typeList.length; index < length; index += 1) {
  7488. type = typeList[index];
  7489. if ((type.instanceOf || type.predicate) &&
  7490. (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) &&
  7491. (!type.predicate || type.predicate(object))) {
  7492. state.tag = explicit ? type.tag : '?';
  7493. if (type.represent) {
  7494. style = state.styleMap[type.tag] || type.defaultStyle;
  7495. if (_toString.call(type.represent) === '[object Function]') {
  7496. _result = type.represent(object, style);
  7497. } else if (_hasOwnProperty.call(type.represent, style)) {
  7498. _result = type.represent[style](object, style);
  7499. } else {
  7500. throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style');
  7501. }
  7502. state.dump = _result;
  7503. }
  7504. return true;
  7505. }
  7506. }
  7507. return false;
  7508. }
  7509. // Serializes `object` and writes it to global `result`.
  7510. // Returns true on success, or false on invalid object.
  7511. //
  7512. function writeNode(state, level, object, block, compact, iskey) {
  7513. state.tag = null;
  7514. state.dump = object;
  7515. if (!detectType(state, object, false)) {
  7516. detectType(state, object, true);
  7517. }
  7518. var type = _toString.call(state.dump);
  7519. if (block) {
  7520. block = (state.flowLevel < 0 || state.flowLevel > level);
  7521. }
  7522. var objectOrArray = type === '[object Object]' || type === '[object Array]',
  7523. duplicateIndex,
  7524. duplicate;
  7525. if (objectOrArray) {
  7526. duplicateIndex = state.duplicates.indexOf(object);
  7527. duplicate = duplicateIndex !== -1;
  7528. }
  7529. if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) {
  7530. compact = false;
  7531. }
  7532. if (duplicate && state.usedDuplicates[duplicateIndex]) {
  7533. state.dump = '*ref_' + duplicateIndex;
  7534. } else {
  7535. if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
  7536. state.usedDuplicates[duplicateIndex] = true;
  7537. }
  7538. if (type === '[object Object]') {
  7539. if (block && (Object.keys(state.dump).length !== 0)) {
  7540. writeBlockMapping(state, level, state.dump, compact);
  7541. if (duplicate) {
  7542. state.dump = '&ref_' + duplicateIndex + state.dump;
  7543. }
  7544. } else {
  7545. writeFlowMapping(state, level, state.dump);
  7546. if (duplicate) {
  7547. state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
  7548. }
  7549. }
  7550. } else if (type === '[object Array]') {
  7551. var arrayLevel = (state.noArrayIndent && (level > 0)) ? level - 1 : level;
  7552. if (block && (state.dump.length !== 0)) {
  7553. writeBlockSequence(state, arrayLevel, state.dump, compact);
  7554. if (duplicate) {
  7555. state.dump = '&ref_' + duplicateIndex + state.dump;
  7556. }
  7557. } else {
  7558. writeFlowSequence(state, arrayLevel, state.dump);
  7559. if (duplicate) {
  7560. state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
  7561. }
  7562. }
  7563. } else if (type === '[object String]') {
  7564. if (state.tag !== '?') {
  7565. writeScalar(state, state.dump, level, iskey);
  7566. }
  7567. } else {
  7568. if (state.skipInvalid) return false;
  7569. throw new YAMLException('unacceptable kind of an object to dump ' + type);
  7570. }
  7571. if (state.tag !== null && state.tag !== '?') {
  7572. state.dump = '!<' + state.tag + '> ' + state.dump;
  7573. }
  7574. }
  7575. return true;
  7576. }
  7577. function getDuplicateReferences(object, state) {
  7578. var objects = [],
  7579. duplicatesIndexes = [],
  7580. index,
  7581. length;
  7582. inspectNode(object, objects, duplicatesIndexes);
  7583. for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
  7584. state.duplicates.push(objects[duplicatesIndexes[index]]);
  7585. }
  7586. state.usedDuplicates = new Array(length);
  7587. }
  7588. function inspectNode(object, objects, duplicatesIndexes) {
  7589. var objectKeyList,
  7590. index,
  7591. length;
  7592. if (object !== null && typeof object === 'object') {
  7593. index = objects.indexOf(object);
  7594. if (index !== -1) {
  7595. if (duplicatesIndexes.indexOf(index) === -1) {
  7596. duplicatesIndexes.push(index);
  7597. }
  7598. } else {
  7599. objects.push(object);
  7600. if (Array.isArray(object)) {
  7601. for (index = 0, length = object.length; index < length; index += 1) {
  7602. inspectNode(object[index], objects, duplicatesIndexes);
  7603. }
  7604. } else {
  7605. objectKeyList = Object.keys(object);
  7606. for (index = 0, length = objectKeyList.length; index < length; index += 1) {
  7607. inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
  7608. }
  7609. }
  7610. }
  7611. }
  7612. }
  7613. function dump(input, options) {
  7614. options = options || {};
  7615. var state = new State(options);
  7616. if (!state.noRefs) getDuplicateReferences(input, state);
  7617. if (writeNode(state, 0, input, true, true)) return state.dump + '\n';
  7618. return '';
  7619. }
  7620. function safeDump(input, options) {
  7621. return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
  7622. }
  7623. module.exports.dump = dump;
  7624. module.exports.safeDump = safeDump;
  7625. /***/ }),
  7626. /***/ 14884:
  7627. /***/ ((module) => {
  7628. "use strict";
  7629. // YAML error class. http://stackoverflow.com/questions/8458984
  7630. //
  7631. function YAMLException(reason, mark) {
  7632. // Super constructor
  7633. Error.call(this);
  7634. this.name = 'YAMLException';
  7635. this.reason = reason;
  7636. this.mark = mark;
  7637. this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : '');
  7638. // Include stack trace in error object
  7639. if (Error.captureStackTrace) {
  7640. // Chrome and NodeJS
  7641. Error.captureStackTrace(this, this.constructor);
  7642. } else {
  7643. // FF, IE 10+ and Safari 6+. Fallback for others
  7644. this.stack = (new Error()).stack || '';
  7645. }
  7646. }
  7647. // Inherit from Error
  7648. YAMLException.prototype = Object.create(Error.prototype);
  7649. YAMLException.prototype.constructor = YAMLException;
  7650. YAMLException.prototype.toString = function toString(compact) {
  7651. var result = this.name + ': ';
  7652. result += this.reason || '(unknown reason)';
  7653. if (!compact && this.mark) {
  7654. result += ' ' + this.mark.toString();
  7655. }
  7656. return result;
  7657. };
  7658. module.exports = YAMLException;
  7659. /***/ }),
  7660. /***/ 40028:
  7661. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  7662. "use strict";
  7663. /*eslint-disable max-len,no-use-before-define*/
  7664. var common = __webpack_require__(25596);
  7665. var YAMLException = __webpack_require__(14884);
  7666. var Mark = __webpack_require__(77334);
  7667. var DEFAULT_SAFE_SCHEMA = __webpack_require__(5972);
  7668. var DEFAULT_FULL_SCHEMA = __webpack_require__(19321);
  7669. var _hasOwnProperty = Object.prototype.hasOwnProperty;
  7670. var CONTEXT_FLOW_IN = 1;
  7671. var CONTEXT_FLOW_OUT = 2;
  7672. var CONTEXT_BLOCK_IN = 3;
  7673. var CONTEXT_BLOCK_OUT = 4;
  7674. var CHOMPING_CLIP = 1;
  7675. var CHOMPING_STRIP = 2;
  7676. var CHOMPING_KEEP = 3;
  7677. var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
  7678. var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
  7679. var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
  7680. var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
  7681. var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
  7682. function _class(obj) { return Object.prototype.toString.call(obj); }
  7683. function is_EOL(c) {
  7684. return (c === 0x0A/* LF */) || (c === 0x0D/* CR */);
  7685. }
  7686. function is_WHITE_SPACE(c) {
  7687. return (c === 0x09/* Tab */) || (c === 0x20/* Space */);
  7688. }
  7689. function is_WS_OR_EOL(c) {
  7690. return (c === 0x09/* Tab */) ||
  7691. (c === 0x20/* Space */) ||
  7692. (c === 0x0A/* LF */) ||
  7693. (c === 0x0D/* CR */);
  7694. }
  7695. function is_FLOW_INDICATOR(c) {
  7696. return c === 0x2C/* , */ ||
  7697. c === 0x5B/* [ */ ||
  7698. c === 0x5D/* ] */ ||
  7699. c === 0x7B/* { */ ||
  7700. c === 0x7D/* } */;
  7701. }
  7702. function fromHexCode(c) {
  7703. var lc;
  7704. if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
  7705. return c - 0x30;
  7706. }
  7707. /*eslint-disable no-bitwise*/
  7708. lc = c | 0x20;
  7709. if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) {
  7710. return lc - 0x61 + 10;
  7711. }
  7712. return -1;
  7713. }
  7714. function escapedHexLen(c) {
  7715. if (c === 0x78/* x */) { return 2; }
  7716. if (c === 0x75/* u */) { return 4; }
  7717. if (c === 0x55/* U */) { return 8; }
  7718. return 0;
  7719. }
  7720. function fromDecimalCode(c) {
  7721. if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
  7722. return c - 0x30;
  7723. }
  7724. return -1;
  7725. }
  7726. function simpleEscapeSequence(c) {
  7727. /* eslint-disable indent */
  7728. return (c === 0x30/* 0 */) ? '\x00' :
  7729. (c === 0x61/* a */) ? '\x07' :
  7730. (c === 0x62/* b */) ? '\x08' :
  7731. (c === 0x74/* t */) ? '\x09' :
  7732. (c === 0x09/* Tab */) ? '\x09' :
  7733. (c === 0x6E/* n */) ? '\x0A' :
  7734. (c === 0x76/* v */) ? '\x0B' :
  7735. (c === 0x66/* f */) ? '\x0C' :
  7736. (c === 0x72/* r */) ? '\x0D' :
  7737. (c === 0x65/* e */) ? '\x1B' :
  7738. (c === 0x20/* Space */) ? ' ' :
  7739. (c === 0x22/* " */) ? '\x22' :
  7740. (c === 0x2F/* / */) ? '/' :
  7741. (c === 0x5C/* \ */) ? '\x5C' :
  7742. (c === 0x4E/* N */) ? '\x85' :
  7743. (c === 0x5F/* _ */) ? '\xA0' :
  7744. (c === 0x4C/* L */) ? '\u2028' :
  7745. (c === 0x50/* P */) ? '\u2029' : '';
  7746. }
  7747. function charFromCodepoint(c) {
  7748. if (c <= 0xFFFF) {
  7749. return String.fromCharCode(c);
  7750. }
  7751. // Encode UTF-16 surrogate pair
  7752. // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF
  7753. return String.fromCharCode(
  7754. ((c - 0x010000) >> 10) + 0xD800,
  7755. ((c - 0x010000) & 0x03FF) + 0xDC00
  7756. );
  7757. }
  7758. var simpleEscapeCheck = new Array(256); // integer, for fast access
  7759. var simpleEscapeMap = new Array(256);
  7760. for (var i = 0; i < 256; i++) {
  7761. simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
  7762. simpleEscapeMap[i] = simpleEscapeSequence(i);
  7763. }
  7764. function State(input, options) {
  7765. this.input = input;
  7766. this.filename = options['filename'] || null;
  7767. this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;
  7768. this.onWarning = options['onWarning'] || null;
  7769. this.legacy = options['legacy'] || false;
  7770. this.json = options['json'] || false;
  7771. this.listener = options['listener'] || null;
  7772. this.implicitTypes = this.schema.compiledImplicit;
  7773. this.typeMap = this.schema.compiledTypeMap;
  7774. this.length = input.length;
  7775. this.position = 0;
  7776. this.line = 0;
  7777. this.lineStart = 0;
  7778. this.lineIndent = 0;
  7779. this.documents = [];
  7780. /*
  7781. this.version;
  7782. this.checkLineBreaks;
  7783. this.tagMap;
  7784. this.anchorMap;
  7785. this.tag;
  7786. this.anchor;
  7787. this.kind;
  7788. this.result;*/
  7789. }
  7790. function generateError(state, message) {
  7791. return new YAMLException(
  7792. message,
  7793. new Mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart)));
  7794. }
  7795. function throwError(state, message) {
  7796. throw generateError(state, message);
  7797. }
  7798. function throwWarning(state, message) {
  7799. if (state.onWarning) {
  7800. state.onWarning.call(null, generateError(state, message));
  7801. }
  7802. }
  7803. var directiveHandlers = {
  7804. YAML: function handleYamlDirective(state, name, args) {
  7805. var match, major, minor;
  7806. if (state.version !== null) {
  7807. throwError(state, 'duplication of %YAML directive');
  7808. }
  7809. if (args.length !== 1) {
  7810. throwError(state, 'YAML directive accepts exactly one argument');
  7811. }
  7812. match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
  7813. if (match === null) {
  7814. throwError(state, 'ill-formed argument of the YAML directive');
  7815. }
  7816. major = parseInt(match[1], 10);
  7817. minor = parseInt(match[2], 10);
  7818. if (major !== 1) {
  7819. throwError(state, 'unacceptable YAML version of the document');
  7820. }
  7821. state.version = args[0];
  7822. state.checkLineBreaks = (minor < 2);
  7823. if (minor !== 1 && minor !== 2) {
  7824. throwWarning(state, 'unsupported YAML version of the document');
  7825. }
  7826. },
  7827. TAG: function handleTagDirective(state, name, args) {
  7828. var handle, prefix;
  7829. if (args.length !== 2) {
  7830. throwError(state, 'TAG directive accepts exactly two arguments');
  7831. }
  7832. handle = args[0];
  7833. prefix = args[1];
  7834. if (!PATTERN_TAG_HANDLE.test(handle)) {
  7835. throwError(state, 'ill-formed tag handle (first argument) of the TAG directive');
  7836. }
  7837. if (_hasOwnProperty.call(state.tagMap, handle)) {
  7838. throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
  7839. }
  7840. if (!PATTERN_TAG_URI.test(prefix)) {
  7841. throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive');
  7842. }
  7843. state.tagMap[handle] = prefix;
  7844. }
  7845. };
  7846. function captureSegment(state, start, end, checkJson) {
  7847. var _position, _length, _character, _result;
  7848. if (start < end) {
  7849. _result = state.input.slice(start, end);
  7850. if (checkJson) {
  7851. for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
  7852. _character = _result.charCodeAt(_position);
  7853. if (!(_character === 0x09 ||
  7854. (0x20 <= _character && _character <= 0x10FFFF))) {
  7855. throwError(state, 'expected valid JSON character');
  7856. }
  7857. }
  7858. } else if (PATTERN_NON_PRINTABLE.test(_result)) {
  7859. throwError(state, 'the stream contains non-printable characters');
  7860. }
  7861. state.result += _result;
  7862. }
  7863. }
  7864. function mergeMappings(state, destination, source, overridableKeys) {
  7865. var sourceKeys, key, index, quantity;
  7866. if (!common.isObject(source)) {
  7867. throwError(state, 'cannot merge mappings; the provided source object is unacceptable');
  7868. }
  7869. sourceKeys = Object.keys(source);
  7870. for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
  7871. key = sourceKeys[index];
  7872. if (!_hasOwnProperty.call(destination, key)) {
  7873. destination[key] = source[key];
  7874. overridableKeys[key] = true;
  7875. }
  7876. }
  7877. }
  7878. function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) {
  7879. var index, quantity;
  7880. // The output is a plain object here, so keys can only be strings.
  7881. // We need to convert keyNode to a string, but doing so can hang the process
  7882. // (deeply nested arrays that explode exponentially using aliases).
  7883. if (Array.isArray(keyNode)) {
  7884. keyNode = Array.prototype.slice.call(keyNode);
  7885. for (index = 0, quantity = keyNode.length; index < quantity; index += 1) {
  7886. if (Array.isArray(keyNode[index])) {
  7887. throwError(state, 'nested arrays are not supported inside keys');
  7888. }
  7889. if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') {
  7890. keyNode[index] = '[object Object]';
  7891. }
  7892. }
  7893. }
  7894. // Avoid code execution in load() via toString property
  7895. // (still use its own toString for arrays, timestamps,
  7896. // and whatever user schema extensions happen to have @@toStringTag)
  7897. if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') {
  7898. keyNode = '[object Object]';
  7899. }
  7900. keyNode = String(keyNode);
  7901. if (_result === null) {
  7902. _result = {};
  7903. }
  7904. if (keyTag === 'tag:yaml.org,2002:merge') {
  7905. if (Array.isArray(valueNode)) {
  7906. for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
  7907. mergeMappings(state, _result, valueNode[index], overridableKeys);
  7908. }
  7909. } else {
  7910. mergeMappings(state, _result, valueNode, overridableKeys);
  7911. }
  7912. } else {
  7913. if (!state.json &&
  7914. !_hasOwnProperty.call(overridableKeys, keyNode) &&
  7915. _hasOwnProperty.call(_result, keyNode)) {
  7916. state.line = startLine || state.line;
  7917. state.position = startPos || state.position;
  7918. throwError(state, 'duplicated mapping key');
  7919. }
  7920. _result[keyNode] = valueNode;
  7921. delete overridableKeys[keyNode];
  7922. }
  7923. return _result;
  7924. }
  7925. function readLineBreak(state) {
  7926. var ch;
  7927. ch = state.input.charCodeAt(state.position);
  7928. if (ch === 0x0A/* LF */) {
  7929. state.position++;
  7930. } else if (ch === 0x0D/* CR */) {
  7931. state.position++;
  7932. if (state.input.charCodeAt(state.position) === 0x0A/* LF */) {
  7933. state.position++;
  7934. }
  7935. } else {
  7936. throwError(state, 'a line break is expected');
  7937. }
  7938. state.line += 1;
  7939. state.lineStart = state.position;
  7940. }
  7941. function skipSeparationSpace(state, allowComments, checkIndent) {
  7942. var lineBreaks = 0,
  7943. ch = state.input.charCodeAt(state.position);
  7944. while (ch !== 0) {
  7945. while (is_WHITE_SPACE(ch)) {
  7946. ch = state.input.charCodeAt(++state.position);
  7947. }
  7948. if (allowComments && ch === 0x23/* # */) {
  7949. do {
  7950. ch = state.input.charCodeAt(++state.position);
  7951. } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0);
  7952. }
  7953. if (is_EOL(ch)) {
  7954. readLineBreak(state);
  7955. ch = state.input.charCodeAt(state.position);
  7956. lineBreaks++;
  7957. state.lineIndent = 0;
  7958. while (ch === 0x20/* Space */) {
  7959. state.lineIndent++;
  7960. ch = state.input.charCodeAt(++state.position);
  7961. }
  7962. } else {
  7963. break;
  7964. }
  7965. }
  7966. if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
  7967. throwWarning(state, 'deficient indentation');
  7968. }
  7969. return lineBreaks;
  7970. }
  7971. function testDocumentSeparator(state) {
  7972. var _position = state.position,
  7973. ch;
  7974. ch = state.input.charCodeAt(_position);
  7975. // Condition state.position === state.lineStart is tested
  7976. // in parent on each call, for efficiency. No needs to test here again.
  7977. if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) &&
  7978. ch === state.input.charCodeAt(_position + 1) &&
  7979. ch === state.input.charCodeAt(_position + 2)) {
  7980. _position += 3;
  7981. ch = state.input.charCodeAt(_position);
  7982. if (ch === 0 || is_WS_OR_EOL(ch)) {
  7983. return true;
  7984. }
  7985. }
  7986. return false;
  7987. }
  7988. function writeFoldedLines(state, count) {
  7989. if (count === 1) {
  7990. state.result += ' ';
  7991. } else if (count > 1) {
  7992. state.result += common.repeat('\n', count - 1);
  7993. }
  7994. }
  7995. function readPlainScalar(state, nodeIndent, withinFlowCollection) {
  7996. var preceding,
  7997. following,
  7998. captureStart,
  7999. captureEnd,
  8000. hasPendingContent,
  8001. _line,
  8002. _lineStart,
  8003. _lineIndent,
  8004. _kind = state.kind,
  8005. _result = state.result,
  8006. ch;
  8007. ch = state.input.charCodeAt(state.position);
  8008. if (is_WS_OR_EOL(ch) ||
  8009. is_FLOW_INDICATOR(ch) ||
  8010. ch === 0x23/* # */ ||
  8011. ch === 0x26/* & */ ||
  8012. ch === 0x2A/* * */ ||
  8013. ch === 0x21/* ! */ ||
  8014. ch === 0x7C/* | */ ||
  8015. ch === 0x3E/* > */ ||
  8016. ch === 0x27/* ' */ ||
  8017. ch === 0x22/* " */ ||
  8018. ch === 0x25/* % */ ||
  8019. ch === 0x40/* @ */ ||
  8020. ch === 0x60/* ` */) {
  8021. return false;
  8022. }
  8023. if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) {
  8024. following = state.input.charCodeAt(state.position + 1);
  8025. if (is_WS_OR_EOL(following) ||
  8026. withinFlowCollection && is_FLOW_INDICATOR(following)) {
  8027. return false;
  8028. }
  8029. }
  8030. state.kind = 'scalar';
  8031. state.result = '';
  8032. captureStart = captureEnd = state.position;
  8033. hasPendingContent = false;
  8034. while (ch !== 0) {
  8035. if (ch === 0x3A/* : */) {
  8036. following = state.input.charCodeAt(state.position + 1);
  8037. if (is_WS_OR_EOL(following) ||
  8038. withinFlowCollection && is_FLOW_INDICATOR(following)) {
  8039. break;
  8040. }
  8041. } else if (ch === 0x23/* # */) {
  8042. preceding = state.input.charCodeAt(state.position - 1);
  8043. if (is_WS_OR_EOL(preceding)) {
  8044. break;
  8045. }
  8046. } else if ((state.position === state.lineStart && testDocumentSeparator(state)) ||
  8047. withinFlowCollection && is_FLOW_INDICATOR(ch)) {
  8048. break;
  8049. } else if (is_EOL(ch)) {
  8050. _line = state.line;
  8051. _lineStart = state.lineStart;
  8052. _lineIndent = state.lineIndent;
  8053. skipSeparationSpace(state, false, -1);
  8054. if (state.lineIndent >= nodeIndent) {
  8055. hasPendingContent = true;
  8056. ch = state.input.charCodeAt(state.position);
  8057. continue;
  8058. } else {
  8059. state.position = captureEnd;
  8060. state.line = _line;
  8061. state.lineStart = _lineStart;
  8062. state.lineIndent = _lineIndent;
  8063. break;
  8064. }
  8065. }
  8066. if (hasPendingContent) {
  8067. captureSegment(state, captureStart, captureEnd, false);
  8068. writeFoldedLines(state, state.line - _line);
  8069. captureStart = captureEnd = state.position;
  8070. hasPendingContent = false;
  8071. }
  8072. if (!is_WHITE_SPACE(ch)) {
  8073. captureEnd = state.position + 1;
  8074. }
  8075. ch = state.input.charCodeAt(++state.position);
  8076. }
  8077. captureSegment(state, captureStart, captureEnd, false);
  8078. if (state.result) {
  8079. return true;
  8080. }
  8081. state.kind = _kind;
  8082. state.result = _result;
  8083. return false;
  8084. }
  8085. function readSingleQuotedScalar(state, nodeIndent) {
  8086. var ch,
  8087. captureStart, captureEnd;
  8088. ch = state.input.charCodeAt(state.position);
  8089. if (ch !== 0x27/* ' */) {
  8090. return false;
  8091. }
  8092. state.kind = 'scalar';
  8093. state.result = '';
  8094. state.position++;
  8095. captureStart = captureEnd = state.position;
  8096. while ((ch = state.input.charCodeAt(state.position)) !== 0) {
  8097. if (ch === 0x27/* ' */) {
  8098. captureSegment(state, captureStart, state.position, true);
  8099. ch = state.input.charCodeAt(++state.position);
  8100. if (ch === 0x27/* ' */) {
  8101. captureStart = state.position;
  8102. state.position++;
  8103. captureEnd = state.position;
  8104. } else {
  8105. return true;
  8106. }
  8107. } else if (is_EOL(ch)) {
  8108. captureSegment(state, captureStart, captureEnd, true);
  8109. writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
  8110. captureStart = captureEnd = state.position;
  8111. } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
  8112. throwError(state, 'unexpected end of the document within a single quoted scalar');
  8113. } else {
  8114. state.position++;
  8115. captureEnd = state.position;
  8116. }
  8117. }
  8118. throwError(state, 'unexpected end of the stream within a single quoted scalar');
  8119. }
  8120. function readDoubleQuotedScalar(state, nodeIndent) {
  8121. var captureStart,
  8122. captureEnd,
  8123. hexLength,
  8124. hexResult,
  8125. tmp,
  8126. ch;
  8127. ch = state.input.charCodeAt(state.position);
  8128. if (ch !== 0x22/* " */) {
  8129. return false;
  8130. }
  8131. state.kind = 'scalar';
  8132. state.result = '';
  8133. state.position++;
  8134. captureStart = captureEnd = state.position;
  8135. while ((ch = state.input.charCodeAt(state.position)) !== 0) {
  8136. if (ch === 0x22/* " */) {
  8137. captureSegment(state, captureStart, state.position, true);
  8138. state.position++;
  8139. return true;
  8140. } else if (ch === 0x5C/* \ */) {
  8141. captureSegment(state, captureStart, state.position, true);
  8142. ch = state.input.charCodeAt(++state.position);
  8143. if (is_EOL(ch)) {
  8144. skipSeparationSpace(state, false, nodeIndent);
  8145. // TODO: rework to inline fn with no type cast?
  8146. } else if (ch < 256 && simpleEscapeCheck[ch]) {
  8147. state.result += simpleEscapeMap[ch];
  8148. state.position++;
  8149. } else if ((tmp = escapedHexLen(ch)) > 0) {
  8150. hexLength = tmp;
  8151. hexResult = 0;
  8152. for (; hexLength > 0; hexLength--) {
  8153. ch = state.input.charCodeAt(++state.position);
  8154. if ((tmp = fromHexCode(ch)) >= 0) {
  8155. hexResult = (hexResult << 4) + tmp;
  8156. } else {
  8157. throwError(state, 'expected hexadecimal character');
  8158. }
  8159. }
  8160. state.result += charFromCodepoint(hexResult);
  8161. state.position++;
  8162. } else {
  8163. throwError(state, 'unknown escape sequence');
  8164. }
  8165. captureStart = captureEnd = state.position;
  8166. } else if (is_EOL(ch)) {
  8167. captureSegment(state, captureStart, captureEnd, true);
  8168. writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
  8169. captureStart = captureEnd = state.position;
  8170. } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
  8171. throwError(state, 'unexpected end of the document within a double quoted scalar');
  8172. } else {
  8173. state.position++;
  8174. captureEnd = state.position;
  8175. }
  8176. }
  8177. throwError(state, 'unexpected end of the stream within a double quoted scalar');
  8178. }
  8179. function readFlowCollection(state, nodeIndent) {
  8180. var readNext = true,
  8181. _line,
  8182. _tag = state.tag,
  8183. _result,
  8184. _anchor = state.anchor,
  8185. following,
  8186. terminator,
  8187. isPair,
  8188. isExplicitPair,
  8189. isMapping,
  8190. overridableKeys = {},
  8191. keyNode,
  8192. keyTag,
  8193. valueNode,
  8194. ch;
  8195. ch = state.input.charCodeAt(state.position);
  8196. if (ch === 0x5B/* [ */) {
  8197. terminator = 0x5D;/* ] */
  8198. isMapping = false;
  8199. _result = [];
  8200. } else if (ch === 0x7B/* { */) {
  8201. terminator = 0x7D;/* } */
  8202. isMapping = true;
  8203. _result = {};
  8204. } else {
  8205. return false;
  8206. }
  8207. if (state.anchor !== null) {
  8208. state.anchorMap[state.anchor] = _result;
  8209. }
  8210. ch = state.input.charCodeAt(++state.position);
  8211. while (ch !== 0) {
  8212. skipSeparationSpace(state, true, nodeIndent);
  8213. ch = state.input.charCodeAt(state.position);
  8214. if (ch === terminator) {
  8215. state.position++;
  8216. state.tag = _tag;
  8217. state.anchor = _anchor;
  8218. state.kind = isMapping ? 'mapping' : 'sequence';
  8219. state.result = _result;
  8220. return true;
  8221. } else if (!readNext) {
  8222. throwError(state, 'missed comma between flow collection entries');
  8223. }
  8224. keyTag = keyNode = valueNode = null;
  8225. isPair = isExplicitPair = false;
  8226. if (ch === 0x3F/* ? */) {
  8227. following = state.input.charCodeAt(state.position + 1);
  8228. if (is_WS_OR_EOL(following)) {
  8229. isPair = isExplicitPair = true;
  8230. state.position++;
  8231. skipSeparationSpace(state, true, nodeIndent);
  8232. }
  8233. }
  8234. _line = state.line;
  8235. composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
  8236. keyTag = state.tag;
  8237. keyNode = state.result;
  8238. skipSeparationSpace(state, true, nodeIndent);
  8239. ch = state.input.charCodeAt(state.position);
  8240. if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) {
  8241. isPair = true;
  8242. ch = state.input.charCodeAt(++state.position);
  8243. skipSeparationSpace(state, true, nodeIndent);
  8244. composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
  8245. valueNode = state.result;
  8246. }
  8247. if (isMapping) {
  8248. storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode);
  8249. } else if (isPair) {
  8250. _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode));
  8251. } else {
  8252. _result.push(keyNode);
  8253. }
  8254. skipSeparationSpace(state, true, nodeIndent);
  8255. ch = state.input.charCodeAt(state.position);
  8256. if (ch === 0x2C/* , */) {
  8257. readNext = true;
  8258. ch = state.input.charCodeAt(++state.position);
  8259. } else {
  8260. readNext = false;
  8261. }
  8262. }
  8263. throwError(state, 'unexpected end of the stream within a flow collection');
  8264. }
  8265. function readBlockScalar(state, nodeIndent) {
  8266. var captureStart,
  8267. folding,
  8268. chomping = CHOMPING_CLIP,
  8269. didReadContent = false,
  8270. detectedIndent = false,
  8271. textIndent = nodeIndent,
  8272. emptyLines = 0,
  8273. atMoreIndented = false,
  8274. tmp,
  8275. ch;
  8276. ch = state.input.charCodeAt(state.position);
  8277. if (ch === 0x7C/* | */) {
  8278. folding = false;
  8279. } else if (ch === 0x3E/* > */) {
  8280. folding = true;
  8281. } else {
  8282. return false;
  8283. }
  8284. state.kind = 'scalar';
  8285. state.result = '';
  8286. while (ch !== 0) {
  8287. ch = state.input.charCodeAt(++state.position);
  8288. if (ch === 0x2B/* + */ || ch === 0x2D/* - */) {
  8289. if (CHOMPING_CLIP === chomping) {
  8290. chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP;
  8291. } else {
  8292. throwError(state, 'repeat of a chomping mode identifier');
  8293. }
  8294. } else if ((tmp = fromDecimalCode(ch)) >= 0) {
  8295. if (tmp === 0) {
  8296. throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one');
  8297. } else if (!detectedIndent) {
  8298. textIndent = nodeIndent + tmp - 1;
  8299. detectedIndent = true;
  8300. } else {
  8301. throwError(state, 'repeat of an indentation width identifier');
  8302. }
  8303. } else {
  8304. break;
  8305. }
  8306. }
  8307. if (is_WHITE_SPACE(ch)) {
  8308. do { ch = state.input.charCodeAt(++state.position); }
  8309. while (is_WHITE_SPACE(ch));
  8310. if (ch === 0x23/* # */) {
  8311. do { ch = state.input.charCodeAt(++state.position); }
  8312. while (!is_EOL(ch) && (ch !== 0));
  8313. }
  8314. }
  8315. while (ch !== 0) {
  8316. readLineBreak(state);
  8317. state.lineIndent = 0;
  8318. ch = state.input.charCodeAt(state.position);
  8319. while ((!detectedIndent || state.lineIndent < textIndent) &&
  8320. (ch === 0x20/* Space */)) {
  8321. state.lineIndent++;
  8322. ch = state.input.charCodeAt(++state.position);
  8323. }
  8324. if (!detectedIndent && state.lineIndent > textIndent) {
  8325. textIndent = state.lineIndent;
  8326. }
  8327. if (is_EOL(ch)) {
  8328. emptyLines++;
  8329. continue;
  8330. }
  8331. // End of the scalar.
  8332. if (state.lineIndent < textIndent) {
  8333. // Perform the chomping.
  8334. if (chomping === CHOMPING_KEEP) {
  8335. state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
  8336. } else if (chomping === CHOMPING_CLIP) {
  8337. if (didReadContent) { // i.e. only if the scalar is not empty.
  8338. state.result += '\n';
  8339. }
  8340. }
  8341. // Break this `while` cycle and go to the funciton's epilogue.
  8342. break;
  8343. }
  8344. // Folded style: use fancy rules to handle line breaks.
  8345. if (folding) {
  8346. // Lines starting with white space characters (more-indented lines) are not folded.
  8347. if (is_WHITE_SPACE(ch)) {
  8348. atMoreIndented = true;
  8349. // except for the first content line (cf. Example 8.1)
  8350. state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
  8351. // End of more-indented block.
  8352. } else if (atMoreIndented) {
  8353. atMoreIndented = false;
  8354. state.result += common.repeat('\n', emptyLines + 1);
  8355. // Just one line break - perceive as the same line.
  8356. } else if (emptyLines === 0) {
  8357. if (didReadContent) { // i.e. only if we have already read some scalar content.
  8358. state.result += ' ';
  8359. }
  8360. // Several line breaks - perceive as different lines.
  8361. } else {
  8362. state.result += common.repeat('\n', emptyLines);
  8363. }
  8364. // Literal style: just add exact number of line breaks between content lines.
  8365. } else {
  8366. // Keep all line breaks except the header line break.
  8367. state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
  8368. }
  8369. didReadContent = true;
  8370. detectedIndent = true;
  8371. emptyLines = 0;
  8372. captureStart = state.position;
  8373. while (!is_EOL(ch) && (ch !== 0)) {
  8374. ch = state.input.charCodeAt(++state.position);
  8375. }
  8376. captureSegment(state, captureStart, state.position, false);
  8377. }
  8378. return true;
  8379. }
  8380. function readBlockSequence(state, nodeIndent) {
  8381. var _line,
  8382. _tag = state.tag,
  8383. _anchor = state.anchor,
  8384. _result = [],
  8385. following,
  8386. detected = false,
  8387. ch;
  8388. if (state.anchor !== null) {
  8389. state.anchorMap[state.anchor] = _result;
  8390. }
  8391. ch = state.input.charCodeAt(state.position);
  8392. while (ch !== 0) {
  8393. if (ch !== 0x2D/* - */) {
  8394. break;
  8395. }
  8396. following = state.input.charCodeAt(state.position + 1);
  8397. if (!is_WS_OR_EOL(following)) {
  8398. break;
  8399. }
  8400. detected = true;
  8401. state.position++;
  8402. if (skipSeparationSpace(state, true, -1)) {
  8403. if (state.lineIndent <= nodeIndent) {
  8404. _result.push(null);
  8405. ch = state.input.charCodeAt(state.position);
  8406. continue;
  8407. }
  8408. }
  8409. _line = state.line;
  8410. composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
  8411. _result.push(state.result);
  8412. skipSeparationSpace(state, true, -1);
  8413. ch = state.input.charCodeAt(state.position);
  8414. if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {
  8415. throwError(state, 'bad indentation of a sequence entry');
  8416. } else if (state.lineIndent < nodeIndent) {
  8417. break;
  8418. }
  8419. }
  8420. if (detected) {
  8421. state.tag = _tag;
  8422. state.anchor = _anchor;
  8423. state.kind = 'sequence';
  8424. state.result = _result;
  8425. return true;
  8426. }
  8427. return false;
  8428. }
  8429. function readBlockMapping(state, nodeIndent, flowIndent) {
  8430. var following,
  8431. allowCompact,
  8432. _line,
  8433. _pos,
  8434. _tag = state.tag,
  8435. _anchor = state.anchor,
  8436. _result = {},
  8437. overridableKeys = {},
  8438. keyTag = null,
  8439. keyNode = null,
  8440. valueNode = null,
  8441. atExplicitKey = false,
  8442. detected = false,
  8443. ch;
  8444. if (state.anchor !== null) {
  8445. state.anchorMap[state.anchor] = _result;
  8446. }
  8447. ch = state.input.charCodeAt(state.position);
  8448. while (ch !== 0) {
  8449. following = state.input.charCodeAt(state.position + 1);
  8450. _line = state.line; // Save the current line.
  8451. _pos = state.position;
  8452. //
  8453. // Explicit notation case. There are two separate blocks:
  8454. // first for the key (denoted by "?") and second for the value (denoted by ":")
  8455. //
  8456. if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) {
  8457. if (ch === 0x3F/* ? */) {
  8458. if (atExplicitKey) {
  8459. storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
  8460. keyTag = keyNode = valueNode = null;
  8461. }
  8462. detected = true;
  8463. atExplicitKey = true;
  8464. allowCompact = true;
  8465. } else if (atExplicitKey) {
  8466. // i.e. 0x3A/* : */ === character after the explicit key.
  8467. atExplicitKey = false;
  8468. allowCompact = true;
  8469. } else {
  8470. throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line');
  8471. }
  8472. state.position += 1;
  8473. ch = following;
  8474. //
  8475. // Implicit notation case. Flow-style node as the key first, then ":", and the value.
  8476. //
  8477. } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
  8478. if (state.line === _line) {
  8479. ch = state.input.charCodeAt(state.position);
  8480. while (is_WHITE_SPACE(ch)) {
  8481. ch = state.input.charCodeAt(++state.position);
  8482. }
  8483. if (ch === 0x3A/* : */) {
  8484. ch = state.input.charCodeAt(++state.position);
  8485. if (!is_WS_OR_EOL(ch)) {
  8486. throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping');
  8487. }
  8488. if (atExplicitKey) {
  8489. storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
  8490. keyTag = keyNode = valueNode = null;
  8491. }
  8492. detected = true;
  8493. atExplicitKey = false;
  8494. allowCompact = false;
  8495. keyTag = state.tag;
  8496. keyNode = state.result;
  8497. } else if (detected) {
  8498. throwError(state, 'can not read an implicit mapping pair; a colon is missed');
  8499. } else {
  8500. state.tag = _tag;
  8501. state.anchor = _anchor;
  8502. return true; // Keep the result of `composeNode`.
  8503. }
  8504. } else if (detected) {
  8505. throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key');
  8506. } else {
  8507. state.tag = _tag;
  8508. state.anchor = _anchor;
  8509. return true; // Keep the result of `composeNode`.
  8510. }
  8511. } else {
  8512. break; // Reading is done. Go to the epilogue.
  8513. }
  8514. //
  8515. // Common reading code for both explicit and implicit notations.
  8516. //
  8517. if (state.line === _line || state.lineIndent > nodeIndent) {
  8518. if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
  8519. if (atExplicitKey) {
  8520. keyNode = state.result;
  8521. } else {
  8522. valueNode = state.result;
  8523. }
  8524. }
  8525. if (!atExplicitKey) {
  8526. storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos);
  8527. keyTag = keyNode = valueNode = null;
  8528. }
  8529. skipSeparationSpace(state, true, -1);
  8530. ch = state.input.charCodeAt(state.position);
  8531. }
  8532. if (state.lineIndent > nodeIndent && (ch !== 0)) {
  8533. throwError(state, 'bad indentation of a mapping entry');
  8534. } else if (state.lineIndent < nodeIndent) {
  8535. break;
  8536. }
  8537. }
  8538. //
  8539. // Epilogue.
  8540. //
  8541. // Special case: last mapping's node contains only the key in explicit notation.
  8542. if (atExplicitKey) {
  8543. storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
  8544. }
  8545. // Expose the resulting mapping.
  8546. if (detected) {
  8547. state.tag = _tag;
  8548. state.anchor = _anchor;
  8549. state.kind = 'mapping';
  8550. state.result = _result;
  8551. }
  8552. return detected;
  8553. }
  8554. function readTagProperty(state) {
  8555. var _position,
  8556. isVerbatim = false,
  8557. isNamed = false,
  8558. tagHandle,
  8559. tagName,
  8560. ch;
  8561. ch = state.input.charCodeAt(state.position);
  8562. if (ch !== 0x21/* ! */) return false;
  8563. if (state.tag !== null) {
  8564. throwError(state, 'duplication of a tag property');
  8565. }
  8566. ch = state.input.charCodeAt(++state.position);
  8567. if (ch === 0x3C/* < */) {
  8568. isVerbatim = true;
  8569. ch = state.input.charCodeAt(++state.position);
  8570. } else if (ch === 0x21/* ! */) {
  8571. isNamed = true;
  8572. tagHandle = '!!';
  8573. ch = state.input.charCodeAt(++state.position);
  8574. } else {
  8575. tagHandle = '!';
  8576. }
  8577. _position = state.position;
  8578. if (isVerbatim) {
  8579. do { ch = state.input.charCodeAt(++state.position); }
  8580. while (ch !== 0 && ch !== 0x3E/* > */);
  8581. if (state.position < state.length) {
  8582. tagName = state.input.slice(_position, state.position);
  8583. ch = state.input.charCodeAt(++state.position);
  8584. } else {
  8585. throwError(state, 'unexpected end of the stream within a verbatim tag');
  8586. }
  8587. } else {
  8588. while (ch !== 0 && !is_WS_OR_EOL(ch)) {
  8589. if (ch === 0x21/* ! */) {
  8590. if (!isNamed) {
  8591. tagHandle = state.input.slice(_position - 1, state.position + 1);
  8592. if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
  8593. throwError(state, 'named tag handle cannot contain such characters');
  8594. }
  8595. isNamed = true;
  8596. _position = state.position + 1;
  8597. } else {
  8598. throwError(state, 'tag suffix cannot contain exclamation marks');
  8599. }
  8600. }
  8601. ch = state.input.charCodeAt(++state.position);
  8602. }
  8603. tagName = state.input.slice(_position, state.position);
  8604. if (PATTERN_FLOW_INDICATORS.test(tagName)) {
  8605. throwError(state, 'tag suffix cannot contain flow indicator characters');
  8606. }
  8607. }
  8608. if (tagName && !PATTERN_TAG_URI.test(tagName)) {
  8609. throwError(state, 'tag name cannot contain such characters: ' + tagName);
  8610. }
  8611. if (isVerbatim) {
  8612. state.tag = tagName;
  8613. } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {
  8614. state.tag = state.tagMap[tagHandle] + tagName;
  8615. } else if (tagHandle === '!') {
  8616. state.tag = '!' + tagName;
  8617. } else if (tagHandle === '!!') {
  8618. state.tag = 'tag:yaml.org,2002:' + tagName;
  8619. } else {
  8620. throwError(state, 'undeclared tag handle "' + tagHandle + '"');
  8621. }
  8622. return true;
  8623. }
  8624. function readAnchorProperty(state) {
  8625. var _position,
  8626. ch;
  8627. ch = state.input.charCodeAt(state.position);
  8628. if (ch !== 0x26/* & */) return false;
  8629. if (state.anchor !== null) {
  8630. throwError(state, 'duplication of an anchor property');
  8631. }
  8632. ch = state.input.charCodeAt(++state.position);
  8633. _position = state.position;
  8634. while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
  8635. ch = state.input.charCodeAt(++state.position);
  8636. }
  8637. if (state.position === _position) {
  8638. throwError(state, 'name of an anchor node must contain at least one character');
  8639. }
  8640. state.anchor = state.input.slice(_position, state.position);
  8641. return true;
  8642. }
  8643. function readAlias(state) {
  8644. var _position, alias,
  8645. ch;
  8646. ch = state.input.charCodeAt(state.position);
  8647. if (ch !== 0x2A/* * */) return false;
  8648. ch = state.input.charCodeAt(++state.position);
  8649. _position = state.position;
  8650. while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
  8651. ch = state.input.charCodeAt(++state.position);
  8652. }
  8653. if (state.position === _position) {
  8654. throwError(state, 'name of an alias node must contain at least one character');
  8655. }
  8656. alias = state.input.slice(_position, state.position);
  8657. if (!_hasOwnProperty.call(state.anchorMap, alias)) {
  8658. throwError(state, 'unidentified alias "' + alias + '"');
  8659. }
  8660. state.result = state.anchorMap[alias];
  8661. skipSeparationSpace(state, true, -1);
  8662. return true;
  8663. }
  8664. function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
  8665. var allowBlockStyles,
  8666. allowBlockScalars,
  8667. allowBlockCollections,
  8668. indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this<parent
  8669. atNewLine = false,
  8670. hasContent = false,
  8671. typeIndex,
  8672. typeQuantity,
  8673. type,
  8674. flowIndent,
  8675. blockIndent;
  8676. if (state.listener !== null) {
  8677. state.listener('open', state);
  8678. }
  8679. state.tag = null;
  8680. state.anchor = null;
  8681. state.kind = null;
  8682. state.result = null;
  8683. allowBlockStyles = allowBlockScalars = allowBlockCollections =
  8684. CONTEXT_BLOCK_OUT === nodeContext ||
  8685. CONTEXT_BLOCK_IN === nodeContext;
  8686. if (allowToSeek) {
  8687. if (skipSeparationSpace(state, true, -1)) {
  8688. atNewLine = true;
  8689. if (state.lineIndent > parentIndent) {
  8690. indentStatus = 1;
  8691. } else if (state.lineIndent === parentIndent) {
  8692. indentStatus = 0;
  8693. } else if (state.lineIndent < parentIndent) {
  8694. indentStatus = -1;
  8695. }
  8696. }
  8697. }
  8698. if (indentStatus === 1) {
  8699. while (readTagProperty(state) || readAnchorProperty(state)) {
  8700. if (skipSeparationSpace(state, true, -1)) {
  8701. atNewLine = true;
  8702. allowBlockCollections = allowBlockStyles;
  8703. if (state.lineIndent > parentIndent) {
  8704. indentStatus = 1;
  8705. } else if (state.lineIndent === parentIndent) {
  8706. indentStatus = 0;
  8707. } else if (state.lineIndent < parentIndent) {
  8708. indentStatus = -1;
  8709. }
  8710. } else {
  8711. allowBlockCollections = false;
  8712. }
  8713. }
  8714. }
  8715. if (allowBlockCollections) {
  8716. allowBlockCollections = atNewLine || allowCompact;
  8717. }
  8718. if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
  8719. if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
  8720. flowIndent = parentIndent;
  8721. } else {
  8722. flowIndent = parentIndent + 1;
  8723. }
  8724. blockIndent = state.position - state.lineStart;
  8725. if (indentStatus === 1) {
  8726. if (allowBlockCollections &&
  8727. (readBlockSequence(state, blockIndent) ||
  8728. readBlockMapping(state, blockIndent, flowIndent)) ||
  8729. readFlowCollection(state, flowIndent)) {
  8730. hasContent = true;
  8731. } else {
  8732. if ((allowBlockScalars && readBlockScalar(state, flowIndent)) ||
  8733. readSingleQuotedScalar(state, flowIndent) ||
  8734. readDoubleQuotedScalar(state, flowIndent)) {
  8735. hasContent = true;
  8736. } else if (readAlias(state)) {
  8737. hasContent = true;
  8738. if (state.tag !== null || state.anchor !== null) {
  8739. throwError(state, 'alias node should not have any properties');
  8740. }
  8741. } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
  8742. hasContent = true;
  8743. if (state.tag === null) {
  8744. state.tag = '?';
  8745. }
  8746. }
  8747. if (state.anchor !== null) {
  8748. state.anchorMap[state.anchor] = state.result;
  8749. }
  8750. }
  8751. } else if (indentStatus === 0) {
  8752. // Special case: block sequences are allowed to have same indentation level as the parent.
  8753. // http://www.yaml.org/spec/1.2/spec.html#id2799784
  8754. hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
  8755. }
  8756. }
  8757. if (state.tag !== null && state.tag !== '!') {
  8758. if (state.tag === '?') {
  8759. // Implicit resolving is not allowed for non-scalar types, and '?'
  8760. // non-specific tag is only automatically assigned to plain scalars.
  8761. //
  8762. // We only need to check kind conformity in case user explicitly assigns '?'
  8763. // tag, for example like this: "!<?> [0]"
  8764. //
  8765. if (state.result !== null && state.kind !== 'scalar') {
  8766. throwError(state, 'unacceptable node kind for !<?> tag; it should be "scalar", not "' + state.kind + '"');
  8767. }
  8768. for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
  8769. type = state.implicitTypes[typeIndex];
  8770. if (type.resolve(state.result)) { // `state.result` updated in resolver if matched
  8771. state.result = type.construct(state.result);
  8772. state.tag = type.tag;
  8773. if (state.anchor !== null) {
  8774. state.anchorMap[state.anchor] = state.result;
  8775. }
  8776. break;
  8777. }
  8778. }
  8779. } else if (_hasOwnProperty.call(state.typeMap[state.kind || 'fallback'], state.tag)) {
  8780. type = state.typeMap[state.kind || 'fallback'][state.tag];
  8781. if (state.result !== null && type.kind !== state.kind) {
  8782. throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
  8783. }
  8784. if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched
  8785. throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag');
  8786. } else {
  8787. state.result = type.construct(state.result);
  8788. if (state.anchor !== null) {
  8789. state.anchorMap[state.anchor] = state.result;
  8790. }
  8791. }
  8792. } else {
  8793. throwError(state, 'unknown tag !<' + state.tag + '>');
  8794. }
  8795. }
  8796. if (state.listener !== null) {
  8797. state.listener('close', state);
  8798. }
  8799. return state.tag !== null || state.anchor !== null || hasContent;
  8800. }
  8801. function readDocument(state) {
  8802. var documentStart = state.position,
  8803. _position,
  8804. directiveName,
  8805. directiveArgs,
  8806. hasDirectives = false,
  8807. ch;
  8808. state.version = null;
  8809. state.checkLineBreaks = state.legacy;
  8810. state.tagMap = {};
  8811. state.anchorMap = {};
  8812. while ((ch = state.input.charCodeAt(state.position)) !== 0) {
  8813. skipSeparationSpace(state, true, -1);
  8814. ch = state.input.charCodeAt(state.position);
  8815. if (state.lineIndent > 0 || ch !== 0x25/* % */) {
  8816. break;
  8817. }
  8818. hasDirectives = true;
  8819. ch = state.input.charCodeAt(++state.position);
  8820. _position = state.position;
  8821. while (ch !== 0 && !is_WS_OR_EOL(ch)) {
  8822. ch = state.input.charCodeAt(++state.position);
  8823. }
  8824. directiveName = state.input.slice(_position, state.position);
  8825. directiveArgs = [];
  8826. if (directiveName.length < 1) {
  8827. throwError(state, 'directive name must not be less than one character in length');
  8828. }
  8829. while (ch !== 0) {
  8830. while (is_WHITE_SPACE(ch)) {
  8831. ch = state.input.charCodeAt(++state.position);
  8832. }
  8833. if (ch === 0x23/* # */) {
  8834. do { ch = state.input.charCodeAt(++state.position); }
  8835. while (ch !== 0 && !is_EOL(ch));
  8836. break;
  8837. }
  8838. if (is_EOL(ch)) break;
  8839. _position = state.position;
  8840. while (ch !== 0 && !is_WS_OR_EOL(ch)) {
  8841. ch = state.input.charCodeAt(++state.position);
  8842. }
  8843. directiveArgs.push(state.input.slice(_position, state.position));
  8844. }
  8845. if (ch !== 0) readLineBreak(state);
  8846. if (_hasOwnProperty.call(directiveHandlers, directiveName)) {
  8847. directiveHandlers[directiveName](state, directiveName, directiveArgs);
  8848. } else {
  8849. throwWarning(state, 'unknown document directive "' + directiveName + '"');
  8850. }
  8851. }
  8852. skipSeparationSpace(state, true, -1);
  8853. if (state.lineIndent === 0 &&
  8854. state.input.charCodeAt(state.position) === 0x2D/* - */ &&
  8855. state.input.charCodeAt(state.position + 1) === 0x2D/* - */ &&
  8856. state.input.charCodeAt(state.position + 2) === 0x2D/* - */) {
  8857. state.position += 3;
  8858. skipSeparationSpace(state, true, -1);
  8859. } else if (hasDirectives) {
  8860. throwError(state, 'directives end mark is expected');
  8861. }
  8862. composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
  8863. skipSeparationSpace(state, true, -1);
  8864. if (state.checkLineBreaks &&
  8865. PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
  8866. throwWarning(state, 'non-ASCII line breaks are interpreted as content');
  8867. }
  8868. state.documents.push(state.result);
  8869. if (state.position === state.lineStart && testDocumentSeparator(state)) {
  8870. if (state.input.charCodeAt(state.position) === 0x2E/* . */) {
  8871. state.position += 3;
  8872. skipSeparationSpace(state, true, -1);
  8873. }
  8874. return;
  8875. }
  8876. if (state.position < (state.length - 1)) {
  8877. throwError(state, 'end of the stream or a document separator is expected');
  8878. } else {
  8879. return;
  8880. }
  8881. }
  8882. function loadDocuments(input, options) {
  8883. input = String(input);
  8884. options = options || {};
  8885. if (input.length !== 0) {
  8886. // Add tailing `\n` if not exists
  8887. if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ &&
  8888. input.charCodeAt(input.length - 1) !== 0x0D/* CR */) {
  8889. input += '\n';
  8890. }
  8891. // Strip BOM
  8892. if (input.charCodeAt(0) === 0xFEFF) {
  8893. input = input.slice(1);
  8894. }
  8895. }
  8896. var state = new State(input, options);
  8897. var nullpos = input.indexOf('\0');
  8898. if (nullpos !== -1) {
  8899. state.position = nullpos;
  8900. throwError(state, 'null byte is not allowed in input');
  8901. }
  8902. // Use 0 as string terminator. That significantly simplifies bounds check.
  8903. state.input += '\0';
  8904. while (state.input.charCodeAt(state.position) === 0x20/* Space */) {
  8905. state.lineIndent += 1;
  8906. state.position += 1;
  8907. }
  8908. while (state.position < (state.length - 1)) {
  8909. readDocument(state);
  8910. }
  8911. return state.documents;
  8912. }
  8913. function loadAll(input, iterator, options) {
  8914. if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') {
  8915. options = iterator;
  8916. iterator = null;
  8917. }
  8918. var documents = loadDocuments(input, options);
  8919. if (typeof iterator !== 'function') {
  8920. return documents;
  8921. }
  8922. for (var index = 0, length = documents.length; index < length; index += 1) {
  8923. iterator(documents[index]);
  8924. }
  8925. }
  8926. function load(input, options) {
  8927. var documents = loadDocuments(input, options);
  8928. if (documents.length === 0) {
  8929. /*eslint-disable no-undefined*/
  8930. return undefined;
  8931. } else if (documents.length === 1) {
  8932. return documents[0];
  8933. }
  8934. throw new YAMLException('expected a single document in the stream, but found more');
  8935. }
  8936. function safeLoadAll(input, iterator, options) {
  8937. if (typeof iterator === 'object' && iterator !== null && typeof options === 'undefined') {
  8938. options = iterator;
  8939. iterator = null;
  8940. }
  8941. return loadAll(input, iterator, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
  8942. }
  8943. function safeLoad(input, options) {
  8944. return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
  8945. }
  8946. module.exports.loadAll = loadAll;
  8947. module.exports.load = load;
  8948. module.exports.safeLoadAll = safeLoadAll;
  8949. module.exports.safeLoad = safeLoad;
  8950. /***/ }),
  8951. /***/ 77334:
  8952. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  8953. "use strict";
  8954. var common = __webpack_require__(25596);
  8955. function Mark(name, buffer, position, line, column) {
  8956. this.name = name;
  8957. this.buffer = buffer;
  8958. this.position = position;
  8959. this.line = line;
  8960. this.column = column;
  8961. }
  8962. Mark.prototype.getSnippet = function getSnippet(indent, maxLength) {
  8963. var head, start, tail, end, snippet;
  8964. if (!this.buffer) return null;
  8965. indent = indent || 4;
  8966. maxLength = maxLength || 75;
  8967. head = '';
  8968. start = this.position;
  8969. while (start > 0 && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1)) === -1) {
  8970. start -= 1;
  8971. if (this.position - start > (maxLength / 2 - 1)) {
  8972. head = ' ... ';
  8973. start += 5;
  8974. break;
  8975. }
  8976. }
  8977. tail = '';
  8978. end = this.position;
  8979. while (end < this.buffer.length && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end)) === -1) {
  8980. end += 1;
  8981. if (end - this.position > (maxLength / 2 - 1)) {
  8982. tail = ' ... ';
  8983. end -= 5;
  8984. break;
  8985. }
  8986. }
  8987. snippet = this.buffer.slice(start, end);
  8988. return common.repeat(' ', indent) + head + snippet + tail + '\n' +
  8989. common.repeat(' ', indent + this.position - start + head.length) + '^';
  8990. };
  8991. Mark.prototype.toString = function toString(compact) {
  8992. var snippet, where = '';
  8993. if (this.name) {
  8994. where += 'in "' + this.name + '" ';
  8995. }
  8996. where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1);
  8997. if (!compact) {
  8998. snippet = this.getSnippet();
  8999. if (snippet) {
  9000. where += ':\n' + snippet;
  9001. }
  9002. }
  9003. return where;
  9004. };
  9005. module.exports = Mark;
  9006. /***/ }),
  9007. /***/ 82409:
  9008. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  9009. "use strict";
  9010. /*eslint-disable max-len*/
  9011. var common = __webpack_require__(25596);
  9012. var YAMLException = __webpack_require__(14884);
  9013. var Type = __webpack_require__(53899);
  9014. function compileList(schema, name, result) {
  9015. var exclude = [];
  9016. schema.include.forEach(function (includedSchema) {
  9017. result = compileList(includedSchema, name, result);
  9018. });
  9019. schema[name].forEach(function (currentType) {
  9020. result.forEach(function (previousType, previousIndex) {
  9021. if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) {
  9022. exclude.push(previousIndex);
  9023. }
  9024. });
  9025. result.push(currentType);
  9026. });
  9027. return result.filter(function (type, index) {
  9028. return exclude.indexOf(index) === -1;
  9029. });
  9030. }
  9031. function compileMap(/* lists... */) {
  9032. var result = {
  9033. scalar: {},
  9034. sequence: {},
  9035. mapping: {},
  9036. fallback: {}
  9037. }, index, length;
  9038. function collectType(type) {
  9039. result[type.kind][type.tag] = result['fallback'][type.tag] = type;
  9040. }
  9041. for (index = 0, length = arguments.length; index < length; index += 1) {
  9042. arguments[index].forEach(collectType);
  9043. }
  9044. return result;
  9045. }
  9046. function Schema(definition) {
  9047. this.include = definition.include || [];
  9048. this.implicit = definition.implicit || [];
  9049. this.explicit = definition.explicit || [];
  9050. this.implicit.forEach(function (type) {
  9051. if (type.loadKind && type.loadKind !== 'scalar') {
  9052. throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.');
  9053. }
  9054. });
  9055. this.compiledImplicit = compileList(this, 'implicit', []);
  9056. this.compiledExplicit = compileList(this, 'explicit', []);
  9057. this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit);
  9058. }
  9059. Schema.DEFAULT = null;
  9060. Schema.create = function createSchema() {
  9061. var schemas, types;
  9062. switch (arguments.length) {
  9063. case 1:
  9064. schemas = Schema.DEFAULT;
  9065. types = arguments[0];
  9066. break;
  9067. case 2:
  9068. schemas = arguments[0];
  9069. types = arguments[1];
  9070. break;
  9071. default:
  9072. throw new YAMLException('Wrong number of arguments for Schema.create function');
  9073. }
  9074. schemas = common.toArray(schemas);
  9075. types = common.toArray(types);
  9076. if (!schemas.every(function (schema) { return schema instanceof Schema; })) {
  9077. throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.');
  9078. }
  9079. if (!types.every(function (type) { return type instanceof Type; })) {
  9080. throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.');
  9081. }
  9082. return new Schema({
  9083. include: schemas,
  9084. explicit: types
  9085. });
  9086. };
  9087. module.exports = Schema;
  9088. /***/ }),
  9089. /***/ 17318:
  9090. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  9091. "use strict";
  9092. // Standard YAML's Core schema.
  9093. // http://www.yaml.org/spec/1.2/spec.html#id2804923
  9094. //
  9095. // NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
  9096. // So, Core schema has no distinctions from JSON schema is JS-YAML.
  9097. var Schema = __webpack_require__(82409);
  9098. module.exports = new Schema({
  9099. include: [
  9100. __webpack_require__(65796)
  9101. ]
  9102. });
  9103. /***/ }),
  9104. /***/ 19321:
  9105. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  9106. "use strict";
  9107. // JS-YAML's default schema for `load` function.
  9108. // It is not described in the YAML specification.
  9109. //
  9110. // This schema is based on JS-YAML's default safe schema and includes
  9111. // JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function.
  9112. //
  9113. // Also this schema is used as default base schema at `Schema.create` function.
  9114. var Schema = __webpack_require__(82409);
  9115. module.exports = Schema.DEFAULT = new Schema({
  9116. include: [
  9117. __webpack_require__(5972)
  9118. ],
  9119. explicit: [
  9120. __webpack_require__(70575),
  9121. __webpack_require__(97287),
  9122. __webpack_require__(89811)
  9123. ]
  9124. });
  9125. /***/ }),
  9126. /***/ 5972:
  9127. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  9128. "use strict";
  9129. // JS-YAML's default schema for `safeLoad` function.
  9130. // It is not described in the YAML specification.
  9131. //
  9132. // This schema is based on standard YAML's Core schema and includes most of
  9133. // extra types described at YAML tag repository. (http://yaml.org/type/)
  9134. var Schema = __webpack_require__(82409);
  9135. module.exports = new Schema({
  9136. include: [
  9137. __webpack_require__(17318)
  9138. ],
  9139. implicit: [
  9140. __webpack_require__(56145),
  9141. __webpack_require__(243)
  9142. ],
  9143. explicit: [
  9144. __webpack_require__(18964),
  9145. __webpack_require__(3878),
  9146. __webpack_require__(68244),
  9147. __webpack_require__(67300)
  9148. ]
  9149. });
  9150. /***/ }),
  9151. /***/ 75322:
  9152. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  9153. "use strict";
  9154. // Standard YAML's Failsafe schema.
  9155. // http://www.yaml.org/spec/1.2/spec.html#id2802346
  9156. var Schema = __webpack_require__(82409);
  9157. module.exports = new Schema({
  9158. explicit: [
  9159. __webpack_require__(79483),
  9160. __webpack_require__(43745),
  9161. __webpack_require__(86553)
  9162. ]
  9163. });
  9164. /***/ }),
  9165. /***/ 65796:
  9166. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  9167. "use strict";
  9168. // Standard YAML's JSON schema.
  9169. // http://www.yaml.org/spec/1.2/spec.html#id2803231
  9170. //
  9171. // NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
  9172. // So, this schema is not such strict as defined in the YAML specification.
  9173. // It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc.
  9174. var Schema = __webpack_require__(82409);
  9175. module.exports = new Schema({
  9176. include: [
  9177. __webpack_require__(75322)
  9178. ],
  9179. implicit: [
  9180. __webpack_require__(3022),
  9181. __webpack_require__(2648),
  9182. __webpack_require__(95979),
  9183. __webpack_require__(53456)
  9184. ]
  9185. });
  9186. /***/ }),
  9187. /***/ 53899:
  9188. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  9189. "use strict";
  9190. var YAMLException = __webpack_require__(14884);
  9191. var TYPE_CONSTRUCTOR_OPTIONS = [
  9192. 'kind',
  9193. 'resolve',
  9194. 'construct',
  9195. 'instanceOf',
  9196. 'predicate',
  9197. 'represent',
  9198. 'defaultStyle',
  9199. 'styleAliases'
  9200. ];
  9201. var YAML_NODE_KINDS = [
  9202. 'scalar',
  9203. 'sequence',
  9204. 'mapping'
  9205. ];
  9206. function compileStyleAliases(map) {
  9207. var result = {};
  9208. if (map !== null) {
  9209. Object.keys(map).forEach(function (style) {
  9210. map[style].forEach(function (alias) {
  9211. result[String(alias)] = style;
  9212. });
  9213. });
  9214. }
  9215. return result;
  9216. }
  9217. function Type(tag, options) {
  9218. options = options || {};
  9219. Object.keys(options).forEach(function (name) {
  9220. if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
  9221. throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
  9222. }
  9223. });
  9224. // TODO: Add tag format check.
  9225. this.tag = tag;
  9226. this.kind = options['kind'] || null;
  9227. this.resolve = options['resolve'] || function () { return true; };
  9228. this.construct = options['construct'] || function (data) { return data; };
  9229. this.instanceOf = options['instanceOf'] || null;
  9230. this.predicate = options['predicate'] || null;
  9231. this.represent = options['represent'] || null;
  9232. this.defaultStyle = options['defaultStyle'] || null;
  9233. this.styleAliases = compileStyleAliases(options['styleAliases'] || null);
  9234. if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
  9235. throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
  9236. }
  9237. }
  9238. module.exports = Type;
  9239. /***/ }),
  9240. /***/ 18964:
  9241. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  9242. "use strict";
  9243. /*eslint-disable no-bitwise*/
  9244. var NodeBuffer;
  9245. try {
  9246. // A trick for browserified version, to not include `Buffer` shim
  9247. var _require = undefined;
  9248. NodeBuffer = __webpack_require__(64293).Buffer;
  9249. } catch (__) {}
  9250. var Type = __webpack_require__(53899);
  9251. // [ 64, 65, 66 ] -> [ padding, CR, LF ]
  9252. var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r';
  9253. function resolveYamlBinary(data) {
  9254. if (data === null) return false;
  9255. var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;
  9256. // Convert one by one.
  9257. for (idx = 0; idx < max; idx++) {
  9258. code = map.indexOf(data.charAt(idx));
  9259. // Skip CR/LF
  9260. if (code > 64) continue;
  9261. // Fail on illegal characters
  9262. if (code < 0) return false;
  9263. bitlen += 6;
  9264. }
  9265. // If there are any bits left, source was corrupted
  9266. return (bitlen % 8) === 0;
  9267. }
  9268. function constructYamlBinary(data) {
  9269. var idx, tailbits,
  9270. input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan
  9271. max = input.length,
  9272. map = BASE64_MAP,
  9273. bits = 0,
  9274. result = [];
  9275. // Collect by 6*4 bits (3 bytes)
  9276. for (idx = 0; idx < max; idx++) {
  9277. if ((idx % 4 === 0) && idx) {
  9278. result.push((bits >> 16) & 0xFF);
  9279. result.push((bits >> 8) & 0xFF);
  9280. result.push(bits & 0xFF);
  9281. }
  9282. bits = (bits << 6) | map.indexOf(input.charAt(idx));
  9283. }
  9284. // Dump tail
  9285. tailbits = (max % 4) * 6;
  9286. if (tailbits === 0) {
  9287. result.push((bits >> 16) & 0xFF);
  9288. result.push((bits >> 8) & 0xFF);
  9289. result.push(bits & 0xFF);
  9290. } else if (tailbits === 18) {
  9291. result.push((bits >> 10) & 0xFF);
  9292. result.push((bits >> 2) & 0xFF);
  9293. } else if (tailbits === 12) {
  9294. result.push((bits >> 4) & 0xFF);
  9295. }
  9296. // Wrap into Buffer for NodeJS and leave Array for browser
  9297. if (NodeBuffer) {
  9298. // Support node 6.+ Buffer API when available
  9299. return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result);
  9300. }
  9301. return result;
  9302. }
  9303. function representYamlBinary(object /*, style*/) {
  9304. var result = '', bits = 0, idx, tail,
  9305. max = object.length,
  9306. map = BASE64_MAP;
  9307. // Convert every three bytes to 4 ASCII characters.
  9308. for (idx = 0; idx < max; idx++) {
  9309. if ((idx % 3 === 0) && idx) {
  9310. result += map[(bits >> 18) & 0x3F];
  9311. result += map[(bits >> 12) & 0x3F];
  9312. result += map[(bits >> 6) & 0x3F];
  9313. result += map[bits & 0x3F];
  9314. }
  9315. bits = (bits << 8) + object[idx];
  9316. }
  9317. // Dump tail
  9318. tail = max % 3;
  9319. if (tail === 0) {
  9320. result += map[(bits >> 18) & 0x3F];
  9321. result += map[(bits >> 12) & 0x3F];
  9322. result += map[(bits >> 6) & 0x3F];
  9323. result += map[bits & 0x3F];
  9324. } else if (tail === 2) {
  9325. result += map[(bits >> 10) & 0x3F];
  9326. result += map[(bits >> 4) & 0x3F];
  9327. result += map[(bits << 2) & 0x3F];
  9328. result += map[64];
  9329. } else if (tail === 1) {
  9330. result += map[(bits >> 2) & 0x3F];
  9331. result += map[(bits << 4) & 0x3F];
  9332. result += map[64];
  9333. result += map[64];
  9334. }
  9335. return result;
  9336. }
  9337. function isBinary(object) {
  9338. return NodeBuffer && NodeBuffer.isBuffer(object);
  9339. }
  9340. module.exports = new Type('tag:yaml.org,2002:binary', {
  9341. kind: 'scalar',
  9342. resolve: resolveYamlBinary,
  9343. construct: constructYamlBinary,
  9344. predicate: isBinary,
  9345. represent: representYamlBinary
  9346. });
  9347. /***/ }),
  9348. /***/ 2648:
  9349. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  9350. "use strict";
  9351. var Type = __webpack_require__(53899);
  9352. function resolveYamlBoolean(data) {
  9353. if (data === null) return false;
  9354. var max = data.length;
  9355. return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) ||
  9356. (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'));
  9357. }
  9358. function constructYamlBoolean(data) {
  9359. return data === 'true' ||
  9360. data === 'True' ||
  9361. data === 'TRUE';
  9362. }
  9363. function isBoolean(object) {
  9364. return Object.prototype.toString.call(object) === '[object Boolean]';
  9365. }
  9366. module.exports = new Type('tag:yaml.org,2002:bool', {
  9367. kind: 'scalar',
  9368. resolve: resolveYamlBoolean,
  9369. construct: constructYamlBoolean,
  9370. predicate: isBoolean,
  9371. represent: {
  9372. lowercase: function (object) { return object ? 'true' : 'false'; },
  9373. uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; },
  9374. camelcase: function (object) { return object ? 'True' : 'False'; }
  9375. },
  9376. defaultStyle: 'lowercase'
  9377. });
  9378. /***/ }),
  9379. /***/ 53456:
  9380. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  9381. "use strict";
  9382. var common = __webpack_require__(25596);
  9383. var Type = __webpack_require__(53899);
  9384. var YAML_FLOAT_PATTERN = new RegExp(
  9385. // 2.5e4, 2.5 and integers
  9386. '^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' +
  9387. // .2e4, .2
  9388. // special case, seems not from spec
  9389. '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' +
  9390. // 20:59
  9391. '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' +
  9392. // .inf
  9393. '|[-+]?\\.(?:inf|Inf|INF)' +
  9394. // .nan
  9395. '|\\.(?:nan|NaN|NAN))$');
  9396. function resolveYamlFloat(data) {
  9397. if (data === null) return false;
  9398. if (!YAML_FLOAT_PATTERN.test(data) ||
  9399. // Quick hack to not allow integers end with `_`
  9400. // Probably should update regexp & check speed
  9401. data[data.length - 1] === '_') {
  9402. return false;
  9403. }
  9404. return true;
  9405. }
  9406. function constructYamlFloat(data) {
  9407. var value, sign, base, digits;
  9408. value = data.replace(/_/g, '').toLowerCase();
  9409. sign = value[0] === '-' ? -1 : 1;
  9410. digits = [];
  9411. if ('+-'.indexOf(value[0]) >= 0) {
  9412. value = value.slice(1);
  9413. }
  9414. if (value === '.inf') {
  9415. return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
  9416. } else if (value === '.nan') {
  9417. return NaN;
  9418. } else if (value.indexOf(':') >= 0) {
  9419. value.split(':').forEach(function (v) {
  9420. digits.unshift(parseFloat(v, 10));
  9421. });
  9422. value = 0.0;
  9423. base = 1;
  9424. digits.forEach(function (d) {
  9425. value += d * base;
  9426. base *= 60;
  9427. });
  9428. return sign * value;
  9429. }
  9430. return sign * parseFloat(value, 10);
  9431. }
  9432. var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
  9433. function representYamlFloat(object, style) {
  9434. var res;
  9435. if (isNaN(object)) {
  9436. switch (style) {
  9437. case 'lowercase': return '.nan';
  9438. case 'uppercase': return '.NAN';
  9439. case 'camelcase': return '.NaN';
  9440. }
  9441. } else if (Number.POSITIVE_INFINITY === object) {
  9442. switch (style) {
  9443. case 'lowercase': return '.inf';
  9444. case 'uppercase': return '.INF';
  9445. case 'camelcase': return '.Inf';
  9446. }
  9447. } else if (Number.NEGATIVE_INFINITY === object) {
  9448. switch (style) {
  9449. case 'lowercase': return '-.inf';
  9450. case 'uppercase': return '-.INF';
  9451. case 'camelcase': return '-.Inf';
  9452. }
  9453. } else if (common.isNegativeZero(object)) {
  9454. return '-0.0';
  9455. }
  9456. res = object.toString(10);
  9457. // JS stringifier can build scientific format without dots: 5e-100,
  9458. // while YAML requres dot: 5.e-100. Fix it with simple hack
  9459. return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res;
  9460. }
  9461. function isFloat(object) {
  9462. return (Object.prototype.toString.call(object) === '[object Number]') &&
  9463. (object % 1 !== 0 || common.isNegativeZero(object));
  9464. }
  9465. module.exports = new Type('tag:yaml.org,2002:float', {
  9466. kind: 'scalar',
  9467. resolve: resolveYamlFloat,
  9468. construct: constructYamlFloat,
  9469. predicate: isFloat,
  9470. represent: representYamlFloat,
  9471. defaultStyle: 'lowercase'
  9472. });
  9473. /***/ }),
  9474. /***/ 95979:
  9475. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  9476. "use strict";
  9477. var common = __webpack_require__(25596);
  9478. var Type = __webpack_require__(53899);
  9479. function isHexCode(c) {
  9480. return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) ||
  9481. ((0x41/* A */ <= c) && (c <= 0x46/* F */)) ||
  9482. ((0x61/* a */ <= c) && (c <= 0x66/* f */));
  9483. }
  9484. function isOctCode(c) {
  9485. return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */));
  9486. }
  9487. function isDecCode(c) {
  9488. return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */));
  9489. }
  9490. function resolveYamlInteger(data) {
  9491. if (data === null) return false;
  9492. var max = data.length,
  9493. index = 0,
  9494. hasDigits = false,
  9495. ch;
  9496. if (!max) return false;
  9497. ch = data[index];
  9498. // sign
  9499. if (ch === '-' || ch === '+') {
  9500. ch = data[++index];
  9501. }
  9502. if (ch === '0') {
  9503. // 0
  9504. if (index + 1 === max) return true;
  9505. ch = data[++index];
  9506. // base 2, base 8, base 16
  9507. if (ch === 'b') {
  9508. // base 2
  9509. index++;
  9510. for (; index < max; index++) {
  9511. ch = data[index];
  9512. if (ch === '_') continue;
  9513. if (ch !== '0' && ch !== '1') return false;
  9514. hasDigits = true;
  9515. }
  9516. return hasDigits && ch !== '_';
  9517. }
  9518. if (ch === 'x') {
  9519. // base 16
  9520. index++;
  9521. for (; index < max; index++) {
  9522. ch = data[index];
  9523. if (ch === '_') continue;
  9524. if (!isHexCode(data.charCodeAt(index))) return false;
  9525. hasDigits = true;
  9526. }
  9527. return hasDigits && ch !== '_';
  9528. }
  9529. // base 8
  9530. for (; index < max; index++) {
  9531. ch = data[index];
  9532. if (ch === '_') continue;
  9533. if (!isOctCode(data.charCodeAt(index))) return false;
  9534. hasDigits = true;
  9535. }
  9536. return hasDigits && ch !== '_';
  9537. }
  9538. // base 10 (except 0) or base 60
  9539. // value should not start with `_`;
  9540. if (ch === '_') return false;
  9541. for (; index < max; index++) {
  9542. ch = data[index];
  9543. if (ch === '_') continue;
  9544. if (ch === ':') break;
  9545. if (!isDecCode(data.charCodeAt(index))) {
  9546. return false;
  9547. }
  9548. hasDigits = true;
  9549. }
  9550. // Should have digits and should not end with `_`
  9551. if (!hasDigits || ch === '_') return false;
  9552. // if !base60 - done;
  9553. if (ch !== ':') return true;
  9554. // base60 almost not used, no needs to optimize
  9555. return /^(:[0-5]?[0-9])+$/.test(data.slice(index));
  9556. }
  9557. function constructYamlInteger(data) {
  9558. var value = data, sign = 1, ch, base, digits = [];
  9559. if (value.indexOf('_') !== -1) {
  9560. value = value.replace(/_/g, '');
  9561. }
  9562. ch = value[0];
  9563. if (ch === '-' || ch === '+') {
  9564. if (ch === '-') sign = -1;
  9565. value = value.slice(1);
  9566. ch = value[0];
  9567. }
  9568. if (value === '0') return 0;
  9569. if (ch === '0') {
  9570. if (value[1] === 'b') return sign * parseInt(value.slice(2), 2);
  9571. if (value[1] === 'x') return sign * parseInt(value, 16);
  9572. return sign * parseInt(value, 8);
  9573. }
  9574. if (value.indexOf(':') !== -1) {
  9575. value.split(':').forEach(function (v) {
  9576. digits.unshift(parseInt(v, 10));
  9577. });
  9578. value = 0;
  9579. base = 1;
  9580. digits.forEach(function (d) {
  9581. value += (d * base);
  9582. base *= 60;
  9583. });
  9584. return sign * value;
  9585. }
  9586. return sign * parseInt(value, 10);
  9587. }
  9588. function isInteger(object) {
  9589. return (Object.prototype.toString.call(object)) === '[object Number]' &&
  9590. (object % 1 === 0 && !common.isNegativeZero(object));
  9591. }
  9592. module.exports = new Type('tag:yaml.org,2002:int', {
  9593. kind: 'scalar',
  9594. resolve: resolveYamlInteger,
  9595. construct: constructYamlInteger,
  9596. predicate: isInteger,
  9597. represent: {
  9598. binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); },
  9599. octal: function (obj) { return obj >= 0 ? '0' + obj.toString(8) : '-0' + obj.toString(8).slice(1); },
  9600. decimal: function (obj) { return obj.toString(10); },
  9601. /* eslint-disable max-len */
  9602. hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); }
  9603. },
  9604. defaultStyle: 'decimal',
  9605. styleAliases: {
  9606. binary: [ 2, 'bin' ],
  9607. octal: [ 8, 'oct' ],
  9608. decimal: [ 10, 'dec' ],
  9609. hexadecimal: [ 16, 'hex' ]
  9610. }
  9611. });
  9612. /***/ }),
  9613. /***/ 89811:
  9614. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  9615. "use strict";
  9616. var esprima;
  9617. // Browserified version does not have esprima
  9618. //
  9619. // 1. For node.js just require module as deps
  9620. // 2. For browser try to require mudule via external AMD system.
  9621. // If not found - try to fallback to window.esprima. If not
  9622. // found too - then fail to parse.
  9623. //
  9624. try {
  9625. // workaround to exclude package from browserify list.
  9626. var _require = undefined;
  9627. esprima = __webpack_require__(31072);
  9628. } catch (_) {
  9629. /* eslint-disable no-redeclare */
  9630. /* global window */
  9631. if (typeof window !== 'undefined') esprima = window.esprima;
  9632. }
  9633. var Type = __webpack_require__(53899);
  9634. function resolveJavascriptFunction(data) {
  9635. if (data === null) return false;
  9636. try {
  9637. var source = '(' + data + ')',
  9638. ast = esprima.parse(source, { range: true });
  9639. if (ast.type !== 'Program' ||
  9640. ast.body.length !== 1 ||
  9641. ast.body[0].type !== 'ExpressionStatement' ||
  9642. (ast.body[0].expression.type !== 'ArrowFunctionExpression' &&
  9643. ast.body[0].expression.type !== 'FunctionExpression')) {
  9644. return false;
  9645. }
  9646. return true;
  9647. } catch (err) {
  9648. return false;
  9649. }
  9650. }
  9651. function constructJavascriptFunction(data) {
  9652. /*jslint evil:true*/
  9653. var source = '(' + data + ')',
  9654. ast = esprima.parse(source, { range: true }),
  9655. params = [],
  9656. body;
  9657. if (ast.type !== 'Program' ||
  9658. ast.body.length !== 1 ||
  9659. ast.body[0].type !== 'ExpressionStatement' ||
  9660. (ast.body[0].expression.type !== 'ArrowFunctionExpression' &&
  9661. ast.body[0].expression.type !== 'FunctionExpression')) {
  9662. throw new Error('Failed to resolve function');
  9663. }
  9664. ast.body[0].expression.params.forEach(function (param) {
  9665. params.push(param.name);
  9666. });
  9667. body = ast.body[0].expression.body.range;
  9668. // Esprima's ranges include the first '{' and the last '}' characters on
  9669. // function expressions. So cut them out.
  9670. if (ast.body[0].expression.body.type === 'BlockStatement') {
  9671. /*eslint-disable no-new-func*/
  9672. return new Function(params, source.slice(body[0] + 1, body[1] - 1));
  9673. }
  9674. // ES6 arrow functions can omit the BlockStatement. In that case, just return
  9675. // the body.
  9676. /*eslint-disable no-new-func*/
  9677. return new Function(params, 'return ' + source.slice(body[0], body[1]));
  9678. }
  9679. function representJavascriptFunction(object /*, style*/) {
  9680. return object.toString();
  9681. }
  9682. function isFunction(object) {
  9683. return Object.prototype.toString.call(object) === '[object Function]';
  9684. }
  9685. module.exports = new Type('tag:yaml.org,2002:js/function', {
  9686. kind: 'scalar',
  9687. resolve: resolveJavascriptFunction,
  9688. construct: constructJavascriptFunction,
  9689. predicate: isFunction,
  9690. represent: representJavascriptFunction
  9691. });
  9692. /***/ }),
  9693. /***/ 97287:
  9694. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  9695. "use strict";
  9696. var Type = __webpack_require__(53899);
  9697. function resolveJavascriptRegExp(data) {
  9698. if (data === null) return false;
  9699. if (data.length === 0) return false;
  9700. var regexp = data,
  9701. tail = /\/([gim]*)$/.exec(data),
  9702. modifiers = '';
  9703. // if regexp starts with '/' it can have modifiers and must be properly closed
  9704. // `/foo/gim` - modifiers tail can be maximum 3 chars
  9705. if (regexp[0] === '/') {
  9706. if (tail) modifiers = tail[1];
  9707. if (modifiers.length > 3) return false;
  9708. // if expression starts with /, is should be properly terminated
  9709. if (regexp[regexp.length - modifiers.length - 1] !== '/') return false;
  9710. }
  9711. return true;
  9712. }
  9713. function constructJavascriptRegExp(data) {
  9714. var regexp = data,
  9715. tail = /\/([gim]*)$/.exec(data),
  9716. modifiers = '';
  9717. // `/foo/gim` - tail can be maximum 4 chars
  9718. if (regexp[0] === '/') {
  9719. if (tail) modifiers = tail[1];
  9720. regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
  9721. }
  9722. return new RegExp(regexp, modifiers);
  9723. }
  9724. function representJavascriptRegExp(object /*, style*/) {
  9725. var result = '/' + object.source + '/';
  9726. if (object.global) result += 'g';
  9727. if (object.multiline) result += 'm';
  9728. if (object.ignoreCase) result += 'i';
  9729. return result;
  9730. }
  9731. function isRegExp(object) {
  9732. return Object.prototype.toString.call(object) === '[object RegExp]';
  9733. }
  9734. module.exports = new Type('tag:yaml.org,2002:js/regexp', {
  9735. kind: 'scalar',
  9736. resolve: resolveJavascriptRegExp,
  9737. construct: constructJavascriptRegExp,
  9738. predicate: isRegExp,
  9739. represent: representJavascriptRegExp
  9740. });
  9741. /***/ }),
  9742. /***/ 70575:
  9743. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  9744. "use strict";
  9745. var Type = __webpack_require__(53899);
  9746. function resolveJavascriptUndefined() {
  9747. return true;
  9748. }
  9749. function constructJavascriptUndefined() {
  9750. /*eslint-disable no-undefined*/
  9751. return undefined;
  9752. }
  9753. function representJavascriptUndefined() {
  9754. return '';
  9755. }
  9756. function isUndefined(object) {
  9757. return typeof object === 'undefined';
  9758. }
  9759. module.exports = new Type('tag:yaml.org,2002:js/undefined', {
  9760. kind: 'scalar',
  9761. resolve: resolveJavascriptUndefined,
  9762. construct: constructJavascriptUndefined,
  9763. predicate: isUndefined,
  9764. represent: representJavascriptUndefined
  9765. });
  9766. /***/ }),
  9767. /***/ 86553:
  9768. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  9769. "use strict";
  9770. var Type = __webpack_require__(53899);
  9771. module.exports = new Type('tag:yaml.org,2002:map', {
  9772. kind: 'mapping',
  9773. construct: function (data) { return data !== null ? data : {}; }
  9774. });
  9775. /***/ }),
  9776. /***/ 243:
  9777. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  9778. "use strict";
  9779. var Type = __webpack_require__(53899);
  9780. function resolveYamlMerge(data) {
  9781. return data === '<<' || data === null;
  9782. }
  9783. module.exports = new Type('tag:yaml.org,2002:merge', {
  9784. kind: 'scalar',
  9785. resolve: resolveYamlMerge
  9786. });
  9787. /***/ }),
  9788. /***/ 3022:
  9789. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  9790. "use strict";
  9791. var Type = __webpack_require__(53899);
  9792. function resolveYamlNull(data) {
  9793. if (data === null) return true;
  9794. var max = data.length;
  9795. return (max === 1 && data === '~') ||
  9796. (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'));
  9797. }
  9798. function constructYamlNull() {
  9799. return null;
  9800. }
  9801. function isNull(object) {
  9802. return object === null;
  9803. }
  9804. module.exports = new Type('tag:yaml.org,2002:null', {
  9805. kind: 'scalar',
  9806. resolve: resolveYamlNull,
  9807. construct: constructYamlNull,
  9808. predicate: isNull,
  9809. represent: {
  9810. canonical: function () { return '~'; },
  9811. lowercase: function () { return 'null'; },
  9812. uppercase: function () { return 'NULL'; },
  9813. camelcase: function () { return 'Null'; }
  9814. },
  9815. defaultStyle: 'lowercase'
  9816. });
  9817. /***/ }),
  9818. /***/ 3878:
  9819. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  9820. "use strict";
  9821. var Type = __webpack_require__(53899);
  9822. var _hasOwnProperty = Object.prototype.hasOwnProperty;
  9823. var _toString = Object.prototype.toString;
  9824. function resolveYamlOmap(data) {
  9825. if (data === null) return true;
  9826. var objectKeys = [], index, length, pair, pairKey, pairHasKey,
  9827. object = data;
  9828. for (index = 0, length = object.length; index < length; index += 1) {
  9829. pair = object[index];
  9830. pairHasKey = false;
  9831. if (_toString.call(pair) !== '[object Object]') return false;
  9832. for (pairKey in pair) {
  9833. if (_hasOwnProperty.call(pair, pairKey)) {
  9834. if (!pairHasKey) pairHasKey = true;
  9835. else return false;
  9836. }
  9837. }
  9838. if (!pairHasKey) return false;
  9839. if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
  9840. else return false;
  9841. }
  9842. return true;
  9843. }
  9844. function constructYamlOmap(data) {
  9845. return data !== null ? data : [];
  9846. }
  9847. module.exports = new Type('tag:yaml.org,2002:omap', {
  9848. kind: 'sequence',
  9849. resolve: resolveYamlOmap,
  9850. construct: constructYamlOmap
  9851. });
  9852. /***/ }),
  9853. /***/ 68244:
  9854. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  9855. "use strict";
  9856. var Type = __webpack_require__(53899);
  9857. var _toString = Object.prototype.toString;
  9858. function resolveYamlPairs(data) {
  9859. if (data === null) return true;
  9860. var index, length, pair, keys, result,
  9861. object = data;
  9862. result = new Array(object.length);
  9863. for (index = 0, length = object.length; index < length; index += 1) {
  9864. pair = object[index];
  9865. if (_toString.call(pair) !== '[object Object]') return false;
  9866. keys = Object.keys(pair);
  9867. if (keys.length !== 1) return false;
  9868. result[index] = [ keys[0], pair[keys[0]] ];
  9869. }
  9870. return true;
  9871. }
  9872. function constructYamlPairs(data) {
  9873. if (data === null) return [];
  9874. var index, length, pair, keys, result,
  9875. object = data;
  9876. result = new Array(object.length);
  9877. for (index = 0, length = object.length; index < length; index += 1) {
  9878. pair = object[index];
  9879. keys = Object.keys(pair);
  9880. result[index] = [ keys[0], pair[keys[0]] ];
  9881. }
  9882. return result;
  9883. }
  9884. module.exports = new Type('tag:yaml.org,2002:pairs', {
  9885. kind: 'sequence',
  9886. resolve: resolveYamlPairs,
  9887. construct: constructYamlPairs
  9888. });
  9889. /***/ }),
  9890. /***/ 43745:
  9891. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  9892. "use strict";
  9893. var Type = __webpack_require__(53899);
  9894. module.exports = new Type('tag:yaml.org,2002:seq', {
  9895. kind: 'sequence',
  9896. construct: function (data) { return data !== null ? data : []; }
  9897. });
  9898. /***/ }),
  9899. /***/ 67300:
  9900. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  9901. "use strict";
  9902. var Type = __webpack_require__(53899);
  9903. var _hasOwnProperty = Object.prototype.hasOwnProperty;
  9904. function resolveYamlSet(data) {
  9905. if (data === null) return true;
  9906. var key, object = data;
  9907. for (key in object) {
  9908. if (_hasOwnProperty.call(object, key)) {
  9909. if (object[key] !== null) return false;
  9910. }
  9911. }
  9912. return true;
  9913. }
  9914. function constructYamlSet(data) {
  9915. return data !== null ? data : {};
  9916. }
  9917. module.exports = new Type('tag:yaml.org,2002:set', {
  9918. kind: 'mapping',
  9919. resolve: resolveYamlSet,
  9920. construct: constructYamlSet
  9921. });
  9922. /***/ }),
  9923. /***/ 79483:
  9924. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  9925. "use strict";
  9926. var Type = __webpack_require__(53899);
  9927. module.exports = new Type('tag:yaml.org,2002:str', {
  9928. kind: 'scalar',
  9929. construct: function (data) { return data !== null ? data : ''; }
  9930. });
  9931. /***/ }),
  9932. /***/ 56145:
  9933. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  9934. "use strict";
  9935. var Type = __webpack_require__(53899);
  9936. var YAML_DATE_REGEXP = new RegExp(
  9937. '^([0-9][0-9][0-9][0-9])' + // [1] year
  9938. '-([0-9][0-9])' + // [2] month
  9939. '-([0-9][0-9])$'); // [3] day
  9940. var YAML_TIMESTAMP_REGEXP = new RegExp(
  9941. '^([0-9][0-9][0-9][0-9])' + // [1] year
  9942. '-([0-9][0-9]?)' + // [2] month
  9943. '-([0-9][0-9]?)' + // [3] day
  9944. '(?:[Tt]|[ \\t]+)' + // ...
  9945. '([0-9][0-9]?)' + // [4] hour
  9946. ':([0-9][0-9])' + // [5] minute
  9947. ':([0-9][0-9])' + // [6] second
  9948. '(?:\\.([0-9]*))?' + // [7] fraction
  9949. '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour
  9950. '(?::([0-9][0-9]))?))?$'); // [11] tz_minute
  9951. function resolveYamlTimestamp(data) {
  9952. if (data === null) return false;
  9953. if (YAML_DATE_REGEXP.exec(data) !== null) return true;
  9954. if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
  9955. return false;
  9956. }
  9957. function constructYamlTimestamp(data) {
  9958. var match, year, month, day, hour, minute, second, fraction = 0,
  9959. delta = null, tz_hour, tz_minute, date;
  9960. match = YAML_DATE_REGEXP.exec(data);
  9961. if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
  9962. if (match === null) throw new Error('Date resolve error');
  9963. // match: [1] year [2] month [3] day
  9964. year = +(match[1]);
  9965. month = +(match[2]) - 1; // JS month starts with 0
  9966. day = +(match[3]);
  9967. if (!match[4]) { // no hour
  9968. return new Date(Date.UTC(year, month, day));
  9969. }
  9970. // match: [4] hour [5] minute [6] second [7] fraction
  9971. hour = +(match[4]);
  9972. minute = +(match[5]);
  9973. second = +(match[6]);
  9974. if (match[7]) {
  9975. fraction = match[7].slice(0, 3);
  9976. while (fraction.length < 3) { // milli-seconds
  9977. fraction += '0';
  9978. }
  9979. fraction = +fraction;
  9980. }
  9981. // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute
  9982. if (match[9]) {
  9983. tz_hour = +(match[10]);
  9984. tz_minute = +(match[11] || 0);
  9985. delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds
  9986. if (match[9] === '-') delta = -delta;
  9987. }
  9988. date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
  9989. if (delta) date.setTime(date.getTime() - delta);
  9990. return date;
  9991. }
  9992. function representYamlTimestamp(object /*, style*/) {
  9993. return object.toISOString();
  9994. }
  9995. module.exports = new Type('tag:yaml.org,2002:timestamp', {
  9996. kind: 'scalar',
  9997. resolve: resolveYamlTimestamp,
  9998. construct: constructYamlTimestamp,
  9999. instanceOf: Date,
  10000. represent: representYamlTimestamp
  10001. });
  10002. /***/ }),
  10003. /***/ 39593:
  10004. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  10005. "use strict";
  10006. // A linked list to keep track of recently-used-ness
  10007. const Yallist = __webpack_require__(34411)
  10008. const MAX = Symbol('max')
  10009. const LENGTH = Symbol('length')
  10010. const LENGTH_CALCULATOR = Symbol('lengthCalculator')
  10011. const ALLOW_STALE = Symbol('allowStale')
  10012. const MAX_AGE = Symbol('maxAge')
  10013. const DISPOSE = Symbol('dispose')
  10014. const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet')
  10015. const LRU_LIST = Symbol('lruList')
  10016. const CACHE = Symbol('cache')
  10017. const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet')
  10018. const naiveLength = () => 1
  10019. // lruList is a yallist where the head is the youngest
  10020. // item, and the tail is the oldest. the list contains the Hit
  10021. // objects as the entries.
  10022. // Each Hit object has a reference to its Yallist.Node. This
  10023. // never changes.
  10024. //
  10025. // cache is a Map (or PseudoMap) that matches the keys to
  10026. // the Yallist.Node object.
  10027. class LRUCache {
  10028. constructor (options) {
  10029. if (typeof options === 'number')
  10030. options = { max: options }
  10031. if (!options)
  10032. options = {}
  10033. if (options.max && (typeof options.max !== 'number' || options.max < 0))
  10034. throw new TypeError('max must be a non-negative number')
  10035. // Kind of weird to have a default max of Infinity, but oh well.
  10036. const max = this[MAX] = options.max || Infinity
  10037. const lc = options.length || naiveLength
  10038. this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc
  10039. this[ALLOW_STALE] = options.stale || false
  10040. if (options.maxAge && typeof options.maxAge !== 'number')
  10041. throw new TypeError('maxAge must be a number')
  10042. this[MAX_AGE] = options.maxAge || 0
  10043. this[DISPOSE] = options.dispose
  10044. this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false
  10045. this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false
  10046. this.reset()
  10047. }
  10048. // resize the cache when the max changes.
  10049. set max (mL) {
  10050. if (typeof mL !== 'number' || mL < 0)
  10051. throw new TypeError('max must be a non-negative number')
  10052. this[MAX] = mL || Infinity
  10053. trim(this)
  10054. }
  10055. get max () {
  10056. return this[MAX]
  10057. }
  10058. set allowStale (allowStale) {
  10059. this[ALLOW_STALE] = !!allowStale
  10060. }
  10061. get allowStale () {
  10062. return this[ALLOW_STALE]
  10063. }
  10064. set maxAge (mA) {
  10065. if (typeof mA !== 'number')
  10066. throw new TypeError('maxAge must be a non-negative number')
  10067. this[MAX_AGE] = mA
  10068. trim(this)
  10069. }
  10070. get maxAge () {
  10071. return this[MAX_AGE]
  10072. }
  10073. // resize the cache when the lengthCalculator changes.
  10074. set lengthCalculator (lC) {
  10075. if (typeof lC !== 'function')
  10076. lC = naiveLength
  10077. if (lC !== this[LENGTH_CALCULATOR]) {
  10078. this[LENGTH_CALCULATOR] = lC
  10079. this[LENGTH] = 0
  10080. this[LRU_LIST].forEach(hit => {
  10081. hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key)
  10082. this[LENGTH] += hit.length
  10083. })
  10084. }
  10085. trim(this)
  10086. }
  10087. get lengthCalculator () { return this[LENGTH_CALCULATOR] }
  10088. get length () { return this[LENGTH] }
  10089. get itemCount () { return this[LRU_LIST].length }
  10090. rforEach (fn, thisp) {
  10091. thisp = thisp || this
  10092. for (let walker = this[LRU_LIST].tail; walker !== null;) {
  10093. const prev = walker.prev
  10094. forEachStep(this, fn, walker, thisp)
  10095. walker = prev
  10096. }
  10097. }
  10098. forEach (fn, thisp) {
  10099. thisp = thisp || this
  10100. for (let walker = this[LRU_LIST].head; walker !== null;) {
  10101. const next = walker.next
  10102. forEachStep(this, fn, walker, thisp)
  10103. walker = next
  10104. }
  10105. }
  10106. keys () {
  10107. return this[LRU_LIST].toArray().map(k => k.key)
  10108. }
  10109. values () {
  10110. return this[LRU_LIST].toArray().map(k => k.value)
  10111. }
  10112. reset () {
  10113. if (this[DISPOSE] &&
  10114. this[LRU_LIST] &&
  10115. this[LRU_LIST].length) {
  10116. this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value))
  10117. }
  10118. this[CACHE] = new Map() // hash of items by key
  10119. this[LRU_LIST] = new Yallist() // list of items in order of use recency
  10120. this[LENGTH] = 0 // length of items in the list
  10121. }
  10122. dump () {
  10123. return this[LRU_LIST].map(hit =>
  10124. isStale(this, hit) ? false : {
  10125. k: hit.key,
  10126. v: hit.value,
  10127. e: hit.now + (hit.maxAge || 0)
  10128. }).toArray().filter(h => h)
  10129. }
  10130. dumpLru () {
  10131. return this[LRU_LIST]
  10132. }
  10133. set (key, value, maxAge) {
  10134. maxAge = maxAge || this[MAX_AGE]
  10135. if (maxAge && typeof maxAge !== 'number')
  10136. throw new TypeError('maxAge must be a number')
  10137. const now = maxAge ? Date.now() : 0
  10138. const len = this[LENGTH_CALCULATOR](value, key)
  10139. if (this[CACHE].has(key)) {
  10140. if (len > this[MAX]) {
  10141. del(this, this[CACHE].get(key))
  10142. return false
  10143. }
  10144. const node = this[CACHE].get(key)
  10145. const item = node.value
  10146. // dispose of the old one before overwriting
  10147. // split out into 2 ifs for better coverage tracking
  10148. if (this[DISPOSE]) {
  10149. if (!this[NO_DISPOSE_ON_SET])
  10150. this[DISPOSE](key, item.value)
  10151. }
  10152. item.now = now
  10153. item.maxAge = maxAge
  10154. item.value = value
  10155. this[LENGTH] += len - item.length
  10156. item.length = len
  10157. this.get(key)
  10158. trim(this)
  10159. return true
  10160. }
  10161. const hit = new Entry(key, value, len, now, maxAge)
  10162. // oversized objects fall out of cache automatically.
  10163. if (hit.length > this[MAX]) {
  10164. if (this[DISPOSE])
  10165. this[DISPOSE](key, value)
  10166. return false
  10167. }
  10168. this[LENGTH] += hit.length
  10169. this[LRU_LIST].unshift(hit)
  10170. this[CACHE].set(key, this[LRU_LIST].head)
  10171. trim(this)
  10172. return true
  10173. }
  10174. has (key) {
  10175. if (!this[CACHE].has(key)) return false
  10176. const hit = this[CACHE].get(key).value
  10177. return !isStale(this, hit)
  10178. }
  10179. get (key) {
  10180. return get(this, key, true)
  10181. }
  10182. peek (key) {
  10183. return get(this, key, false)
  10184. }
  10185. pop () {
  10186. const node = this[LRU_LIST].tail
  10187. if (!node)
  10188. return null
  10189. del(this, node)
  10190. return node.value
  10191. }
  10192. del (key) {
  10193. del(this, this[CACHE].get(key))
  10194. }
  10195. load (arr) {
  10196. // reset the cache
  10197. this.reset()
  10198. const now = Date.now()
  10199. // A previous serialized cache has the most recent items first
  10200. for (let l = arr.length - 1; l >= 0; l--) {
  10201. const hit = arr[l]
  10202. const expiresAt = hit.e || 0
  10203. if (expiresAt === 0)
  10204. // the item was created without expiration in a non aged cache
  10205. this.set(hit.k, hit.v)
  10206. else {
  10207. const maxAge = expiresAt - now
  10208. // dont add already expired items
  10209. if (maxAge > 0) {
  10210. this.set(hit.k, hit.v, maxAge)
  10211. }
  10212. }
  10213. }
  10214. }
  10215. prune () {
  10216. this[CACHE].forEach((value, key) => get(this, key, false))
  10217. }
  10218. }
  10219. const get = (self, key, doUse) => {
  10220. const node = self[CACHE].get(key)
  10221. if (node) {
  10222. const hit = node.value
  10223. if (isStale(self, hit)) {
  10224. del(self, node)
  10225. if (!self[ALLOW_STALE])
  10226. return undefined
  10227. } else {
  10228. if (doUse) {
  10229. if (self[UPDATE_AGE_ON_GET])
  10230. node.value.now = Date.now()
  10231. self[LRU_LIST].unshiftNode(node)
  10232. }
  10233. }
  10234. return hit.value
  10235. }
  10236. }
  10237. const isStale = (self, hit) => {
  10238. if (!hit || (!hit.maxAge && !self[MAX_AGE]))
  10239. return false
  10240. const diff = Date.now() - hit.now
  10241. return hit.maxAge ? diff > hit.maxAge
  10242. : self[MAX_AGE] && (diff > self[MAX_AGE])
  10243. }
  10244. const trim = self => {
  10245. if (self[LENGTH] > self[MAX]) {
  10246. for (let walker = self[LRU_LIST].tail;
  10247. self[LENGTH] > self[MAX] && walker !== null;) {
  10248. // We know that we're about to delete this one, and also
  10249. // what the next least recently used key will be, so just
  10250. // go ahead and set it now.
  10251. const prev = walker.prev
  10252. del(self, walker)
  10253. walker = prev
  10254. }
  10255. }
  10256. }
  10257. const del = (self, node) => {
  10258. if (node) {
  10259. const hit = node.value
  10260. if (self[DISPOSE])
  10261. self[DISPOSE](hit.key, hit.value)
  10262. self[LENGTH] -= hit.length
  10263. self[CACHE].delete(hit.key)
  10264. self[LRU_LIST].removeNode(node)
  10265. }
  10266. }
  10267. class Entry {
  10268. constructor (key, value, length, now, maxAge) {
  10269. this.key = key
  10270. this.value = value
  10271. this.length = length
  10272. this.now = now
  10273. this.maxAge = maxAge || 0
  10274. }
  10275. }
  10276. const forEachStep = (self, fn, node, thisp) => {
  10277. let hit = node.value
  10278. if (isStale(self, hit)) {
  10279. del(self, node)
  10280. if (!self[ALLOW_STALE])
  10281. hit = undefined
  10282. }
  10283. if (hit)
  10284. fn.call(thisp, hit.value, hit.key, self)
  10285. }
  10286. module.exports = LRUCache
  10287. /***/ }),
  10288. /***/ 91729:
  10289. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  10290. const fs = __webpack_require__(35747)
  10291. const promisify = __webpack_require__(60350)
  10292. const isFunction = value => typeof value === "function"
  10293. const names = [
  10294. "access",
  10295. "readFile",
  10296. "writeFile",
  10297. "copyFile",
  10298. "close",
  10299. "open",
  10300. "read",
  10301. "write",
  10302. "rename",
  10303. "rmdir",
  10304. "mkdir",
  10305. "readdir",
  10306. "stat",
  10307. "lstat",
  10308. "fstat",
  10309. "appendFile",
  10310. "realpath",
  10311. "link",
  10312. "unlink",
  10313. "readlink",
  10314. "chmod",
  10315. "fchmod",
  10316. "chown",
  10317. "fchown",
  10318. "lchown",
  10319. "fsync",
  10320. "utimes",
  10321. "futimes",
  10322. "ftruncate"
  10323. ]
  10324. const pfs = promisify.some(fs, names.filter(name => isFunction(fs[name])))
  10325. module.exports = pfs
  10326. module.exports.default = pfs
  10327. /***/ }),
  10328. /***/ 60390:
  10329. /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
  10330. "use strict";
  10331. Object.defineProperty(exports, "__esModule", ({ value: true }));
  10332. exports.encode = exports.parsePackageString = void 0;
  10333. const debug = __webpack_require__(15158)('snyk:module');
  10334. const gitHost = __webpack_require__(19672);
  10335. exports.default = parsePackageString;
  10336. /**
  10337. * Parses a string package id (name + optional version) to an object.
  10338. *
  10339. * This method used to be named `moduleToObject`.
  10340. */
  10341. function parsePackageString(nameAndMaybeVersion, versionOrOptions, options) {
  10342. if (!nameAndMaybeVersion) {
  10343. throw new Error('requires string to parse into module');
  10344. }
  10345. let version;
  10346. if (versionOrOptions && !options && typeof versionOrOptions === 'object') {
  10347. options = versionOrOptions;
  10348. }
  10349. else {
  10350. version = versionOrOptions;
  10351. }
  10352. let str = nameAndMaybeVersion;
  10353. // first, try the common case; there's no version, and it's a normal package name
  10354. if (!version) {
  10355. // foo, foo-bar, @foo/bar, com.example:test
  10356. // none of these can be URLs, or versions
  10357. const fastPath = /^(?:(?:[a-z-]+)|(?:@[a-z-]+\/[a-z-]+)|(?:[a-z-]+\.[.a-z-]+:[a-z-]+))$/;
  10358. if (fastPath.test(str)) {
  10359. return supported(str, { name: str, version: '*' }, options);
  10360. }
  10361. }
  10362. if (version && str.lastIndexOf('@') < 1) {
  10363. debug('appending version onto string');
  10364. str += '@' + version;
  10365. }
  10366. // first try with regular git urls
  10367. const gitObject = looksLikeUrl(str);
  10368. if (gitObject) {
  10369. // then the string looks like a url, let's try to parse it
  10370. return supported(str, fromGitObject(gitObject), options);
  10371. }
  10372. let parts = str.split('@');
  10373. if (str.indexOf('@') === 0) {
  10374. // put the scoped package name back together
  10375. parts = parts.slice(1);
  10376. parts[0] = '@' + parts[0];
  10377. }
  10378. // then as a backup, try pkg@giturl
  10379. const maybeGitObject = parts[1] && looksLikeUrl(parts[1]);
  10380. if (maybeGitObject) {
  10381. // then the string looks like a url, let's try to parse it
  10382. return supported(str, fromGitObject(maybeGitObject), options);
  10383. }
  10384. if (parts.length === 1) {
  10385. // no version
  10386. parts.push('*');
  10387. }
  10388. const module = {
  10389. name: parts[0],
  10390. version: parts.slice(1).join('@'),
  10391. };
  10392. return supported(str, module, options);
  10393. }
  10394. exports.parsePackageString = parsePackageString;
  10395. // git host from URL
  10396. function looksLikeUrl(str) {
  10397. if (str.slice(-1) === '/') {
  10398. // strip the trailing slash since we can't parse it properly anyway
  10399. str = str.slice(0, -1);
  10400. }
  10401. if (str.toLowerCase().indexOf('://github.com/') !== -1 &&
  10402. str.indexOf('http') === 0) {
  10403. // attempt to get better compat with our parser by stripping the github
  10404. // and url parts
  10405. // examples:
  10406. // - https://github.com/Snyk/snyk/releases/tag/v1.14.2
  10407. // - https://github.com/Snyk/vulndb/tree/snapshots
  10408. // - https://github.com/Snyk/snyk/commit/75477b18
  10409. const parts = str.replace(/https?:\/\/github.com\//, '').split('/');
  10410. str = parts.shift() + '/' + parts.shift();
  10411. if (parts.length) {
  10412. str += '#' + parts.pop();
  10413. }
  10414. }
  10415. const obj = gitHost.fromUrl(str);
  10416. return obj;
  10417. }
  10418. function fromGitObject(obj) {
  10419. // debug('parsed from hosted-git-info');
  10420. /* istanbul ignore if */
  10421. if (!obj.project || !obj.user) {
  10422. // this should never actually occur
  10423. const error = new Error('not supported: failed to fully parse');
  10424. error.code = 501;
  10425. throw error;
  10426. }
  10427. const module = {
  10428. name: obj.project,
  10429. version: obj.user + '/' + obj.project,
  10430. };
  10431. if (obj.committish) {
  10432. module.version += '#' + obj.committish;
  10433. }
  10434. return module;
  10435. }
  10436. function encode(name) {
  10437. return name[0] + encodeURIComponent(name.slice(1));
  10438. }
  10439. exports.encode = encode;
  10440. function supported(str, module, options) {
  10441. if (!options) {
  10442. options = {};
  10443. }
  10444. if (options.packageManager === 'maven') {
  10445. if (str.indexOf(':') === -1) {
  10446. throw new Error('invalid Maven package name: ' + str);
  10447. }
  10448. return module;
  10449. }
  10450. const protocolMatch = module.version.match(/^(https?:)|(git[:+])/i);
  10451. if (protocolMatch || module.name.indexOf('://') !== -1) {
  10452. // we don't support non-npm modules atm
  10453. debug('not supported %s@%s (ext)', module.name, module.version);
  10454. if (options.loose) {
  10455. delete module.version;
  10456. }
  10457. else {
  10458. debug('external module: ' + toString(module));
  10459. }
  10460. }
  10461. if (module.version === 'latest' || !module.version) {
  10462. module.version = '*';
  10463. }
  10464. debug('%s => { name: "%s", version: "%s" }', str, module.name, module.version);
  10465. return module;
  10466. }
  10467. function toString(module) {
  10468. return module.name + '@' + module.version;
  10469. }
  10470. //# sourceMappingURL=index.js.map
  10471. /***/ }),
  10472. /***/ 84479:
  10473. /***/ ((module) => {
  10474. "use strict";
  10475. var gitHosts = module.exports = {
  10476. github: {
  10477. // First two are insecure and generally shouldn't be used any more, but
  10478. // they are still supported.
  10479. 'protocols': [ 'git', 'http', 'git+ssh', 'git+https', 'ssh', 'https' ],
  10480. 'domain': 'github.com',
  10481. 'treepath': 'tree',
  10482. 'filetemplate': 'https://{auth@}raw.githubusercontent.com/{user}/{project}/{committish}/{path}',
  10483. 'bugstemplate': 'https://{domain}/{user}/{project}/issues',
  10484. 'gittemplate': 'git://{auth@}{domain}/{user}/{project}.git{#committish}',
  10485. 'tarballtemplate': 'https://codeload.{domain}/{user}/{project}/tar.gz/{committish}'
  10486. },
  10487. bitbucket: {
  10488. 'protocols': [ 'git+ssh', 'git+https', 'ssh', 'https' ],
  10489. 'domain': 'bitbucket.org',
  10490. 'treepath': 'src',
  10491. 'tarballtemplate': 'https://{domain}/{user}/{project}/get/{committish}.tar.gz'
  10492. },
  10493. gitlab: {
  10494. 'protocols': [ 'git+ssh', 'git+https', 'ssh', 'https' ],
  10495. 'domain': 'gitlab.com',
  10496. 'treepath': 'tree',
  10497. 'bugstemplate': 'https://{domain}/{user}/{project}/issues',
  10498. 'httpstemplate': 'git+https://{auth@}{domain}/{user}/{projectPath}.git{#committish}',
  10499. 'tarballtemplate': 'https://{domain}/{user}/{project}/repository/archive.tar.gz?ref={committish}',
  10500. 'pathmatch': /^\/([^/]+)\/((?!.*(\/-\/|\/repository(\/[^/]+)?\/archive\.tar\.gz)).*?)(?:\.git|\/)?$/
  10501. },
  10502. gist: {
  10503. 'protocols': [ 'git', 'git+ssh', 'git+https', 'ssh', 'https' ],
  10504. 'domain': 'gist.github.com',
  10505. 'pathmatch': /^[/](?:([^/]+)[/])?([a-z0-9]{7,})(?:[.]git)?$/,
  10506. 'filetemplate': 'https://gist.githubusercontent.com/{user}/{project}/raw{/committish}/{path}',
  10507. 'bugstemplate': 'https://{domain}/{project}',
  10508. 'gittemplate': 'git://{domain}/{project}.git{#committish}',
  10509. 'sshtemplate': 'git@{domain}:/{project}.git{#committish}',
  10510. 'sshurltemplate': 'git+ssh://git@{domain}/{project}.git{#committish}',
  10511. 'browsetemplate': 'https://{domain}/{project}{/committish}',
  10512. 'browsefiletemplate': 'https://{domain}/{project}{/committish}{#path}',
  10513. 'docstemplate': 'https://{domain}/{project}{/committish}',
  10514. 'httpstemplate': 'git+https://{domain}/{project}.git{#committish}',
  10515. 'shortcuttemplate': '{type}:{project}{#committish}',
  10516. 'pathtemplate': '{project}{#committish}',
  10517. 'tarballtemplate': 'https://codeload.github.com/gist/{project}/tar.gz/{committish}',
  10518. 'hashformat': function (fragment) {
  10519. return 'file-' + formatHashFragment(fragment)
  10520. }
  10521. }
  10522. }
  10523. var gitHostDefaults = {
  10524. 'sshtemplate': 'git@{domain}:{user}/{project}.git{#committish}',
  10525. 'sshurltemplate': 'git+ssh://git@{domain}/{user}/{project}.git{#committish}',
  10526. 'browsetemplate': 'https://{domain}/{user}/{project}{/tree/committish}',
  10527. 'browsefiletemplate': 'https://{domain}/{user}/{project}/{treepath}/{committish}/{path}{#fragment}',
  10528. 'docstemplate': 'https://{domain}/{user}/{project}{/tree/committish}#readme',
  10529. 'httpstemplate': 'git+https://{auth@}{domain}/{user}/{project}.git{#committish}',
  10530. 'filetemplate': 'https://{domain}/{user}/{project}/raw/{committish}/{path}',
  10531. 'shortcuttemplate': '{type}:{user}/{project}{#committish}',
  10532. 'pathtemplate': '{user}/{project}{#committish}',
  10533. 'pathmatch': /^[/]([^/]+)[/]([^/]+?)(?:[.]git|[/])?$/,
  10534. 'hashformat': formatHashFragment
  10535. }
  10536. Object.keys(gitHosts).forEach(function (name) {
  10537. Object.keys(gitHostDefaults).forEach(function (key) {
  10538. if (gitHosts[name][key]) return
  10539. gitHosts[name][key] = gitHostDefaults[key]
  10540. })
  10541. gitHosts[name].protocols_re = RegExp('^(' +
  10542. gitHosts[name].protocols.map(function (protocol) {
  10543. return protocol.replace(/([\\+*{}()[\]$^|])/g, '\\$1')
  10544. }).join('|') + '):$')
  10545. })
  10546. function formatHashFragment (fragment) {
  10547. return fragment.toLowerCase().replace(/^\W+|\/|\W+$/g, '').replace(/\W+/g, '-')
  10548. }
  10549. /***/ }),
  10550. /***/ 11234:
  10551. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  10552. "use strict";
  10553. var gitHosts = __webpack_require__(84479)
  10554. /* eslint-disable node/no-deprecated-api */
  10555. // copy-pasta util._extend from node's source, to avoid pulling
  10556. // the whole util module into peoples' webpack bundles.
  10557. /* istanbul ignore next */
  10558. var extend = Object.assign || function _extend (target, source) {
  10559. // Don't do anything if source isn't an object
  10560. if (source === null || typeof source !== 'object') return target
  10561. const keys = Object.keys(source)
  10562. let i = keys.length
  10563. while (i--) {
  10564. target[keys[i]] = source[keys[i]]
  10565. }
  10566. return target
  10567. }
  10568. module.exports = GitHost
  10569. function GitHost (type, user, auth, project, committish, defaultRepresentation, opts) {
  10570. var gitHostInfo = this
  10571. gitHostInfo.type = type
  10572. Object.keys(gitHosts[type]).forEach(function (key) {
  10573. gitHostInfo[key] = gitHosts[type][key]
  10574. })
  10575. gitHostInfo.user = user
  10576. gitHostInfo.auth = auth
  10577. gitHostInfo.project = project
  10578. gitHostInfo.committish = committish
  10579. gitHostInfo.default = defaultRepresentation
  10580. gitHostInfo.opts = opts || {}
  10581. }
  10582. GitHost.prototype.hash = function () {
  10583. return this.committish ? '#' + this.committish : ''
  10584. }
  10585. GitHost.prototype._fill = function (template, opts) {
  10586. if (!template) return
  10587. var vars = extend({}, opts)
  10588. vars.path = vars.path ? vars.path.replace(/^[/]+/g, '') : ''
  10589. opts = extend(extend({}, this.opts), opts)
  10590. var self = this
  10591. Object.keys(this).forEach(function (key) {
  10592. if (self[key] != null && vars[key] == null) vars[key] = self[key]
  10593. })
  10594. var rawAuth = vars.auth
  10595. var rawcommittish = vars.committish
  10596. var rawFragment = vars.fragment
  10597. var rawPath = vars.path
  10598. var rawProject = vars.project
  10599. Object.keys(vars).forEach(function (key) {
  10600. var value = vars[key]
  10601. if ((key === 'path' || key === 'project') && typeof value === 'string') {
  10602. vars[key] = value.split('/').map(function (pathComponent) {
  10603. return encodeURIComponent(pathComponent)
  10604. }).join('/')
  10605. } else if (key !== 'domain') {
  10606. vars[key] = encodeURIComponent(value)
  10607. }
  10608. })
  10609. vars['auth@'] = rawAuth ? rawAuth + '@' : ''
  10610. vars['#fragment'] = rawFragment ? '#' + this.hashformat(rawFragment) : ''
  10611. vars.fragment = vars.fragment ? vars.fragment : ''
  10612. vars['#path'] = rawPath ? '#' + this.hashformat(rawPath) : ''
  10613. vars['/path'] = vars.path ? '/' + vars.path : ''
  10614. vars.projectPath = rawProject.split('/').map(encodeURIComponent).join('/')
  10615. if (opts.noCommittish) {
  10616. vars['#committish'] = ''
  10617. vars['/tree/committish'] = ''
  10618. vars['/committish'] = ''
  10619. vars.committish = ''
  10620. } else {
  10621. vars['#committish'] = rawcommittish ? '#' + rawcommittish : ''
  10622. vars['/tree/committish'] = vars.committish
  10623. ? '/' + vars.treepath + '/' + vars.committish
  10624. : ''
  10625. vars['/committish'] = vars.committish ? '/' + vars.committish : ''
  10626. vars.committish = vars.committish || 'master'
  10627. }
  10628. var res = template
  10629. Object.keys(vars).forEach(function (key) {
  10630. res = res.replace(new RegExp('[{]' + key + '[}]', 'g'), vars[key])
  10631. })
  10632. if (opts.noGitPlus) {
  10633. return res.replace(/^git[+]/, '')
  10634. } else {
  10635. return res
  10636. }
  10637. }
  10638. GitHost.prototype.ssh = function (opts) {
  10639. return this._fill(this.sshtemplate, opts)
  10640. }
  10641. GitHost.prototype.sshurl = function (opts) {
  10642. return this._fill(this.sshurltemplate, opts)
  10643. }
  10644. GitHost.prototype.browse = function (P, F, opts) {
  10645. if (typeof P === 'string') {
  10646. if (typeof F !== 'string') {
  10647. opts = F
  10648. F = null
  10649. }
  10650. return this._fill(this.browsefiletemplate, extend({
  10651. fragment: F,
  10652. path: P
  10653. }, opts))
  10654. } else {
  10655. return this._fill(this.browsetemplate, P)
  10656. }
  10657. }
  10658. GitHost.prototype.docs = function (opts) {
  10659. return this._fill(this.docstemplate, opts)
  10660. }
  10661. GitHost.prototype.bugs = function (opts) {
  10662. return this._fill(this.bugstemplate, opts)
  10663. }
  10664. GitHost.prototype.https = function (opts) {
  10665. return this._fill(this.httpstemplate, opts)
  10666. }
  10667. GitHost.prototype.git = function (opts) {
  10668. return this._fill(this.gittemplate, opts)
  10669. }
  10670. GitHost.prototype.shortcut = function (opts) {
  10671. return this._fill(this.shortcuttemplate, opts)
  10672. }
  10673. GitHost.prototype.path = function (opts) {
  10674. return this._fill(this.pathtemplate, opts)
  10675. }
  10676. GitHost.prototype.tarball = function (opts_) {
  10677. var opts = extend({}, opts_, { noCommittish: false })
  10678. return this._fill(this.tarballtemplate, opts)
  10679. }
  10680. GitHost.prototype.file = function (P, opts) {
  10681. return this._fill(this.filetemplate, extend({ path: P }, opts))
  10682. }
  10683. GitHost.prototype.getDefaultRepresentation = function () {
  10684. return this.default
  10685. }
  10686. GitHost.prototype.toString = function (opts) {
  10687. if (this.default && typeof this[this.default] === 'function') return this[this.default](opts)
  10688. return this.sshurl(opts)
  10689. }
  10690. /***/ }),
  10691. /***/ 19672:
  10692. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  10693. "use strict";
  10694. var url = __webpack_require__(78835)
  10695. var gitHosts = __webpack_require__(84479)
  10696. var GitHost = module.exports = __webpack_require__(11234)
  10697. var LRU = __webpack_require__(64422)
  10698. var cache = new LRU({max: 1000})
  10699. var protocolToRepresentationMap = {
  10700. 'git+ssh:': 'sshurl',
  10701. 'git+https:': 'https',
  10702. 'ssh:': 'sshurl',
  10703. 'git:': 'git'
  10704. }
  10705. function protocolToRepresentation (protocol) {
  10706. return protocolToRepresentationMap[protocol] || protocol.slice(0, -1)
  10707. }
  10708. var authProtocols = {
  10709. 'git:': true,
  10710. 'https:': true,
  10711. 'git+https:': true,
  10712. 'http:': true,
  10713. 'git+http:': true
  10714. }
  10715. module.exports.fromUrl = function (giturl, opts) {
  10716. if (typeof giturl !== 'string') return
  10717. var key = giturl + JSON.stringify(opts || {})
  10718. if (!cache.has(key)) {
  10719. cache.set(key, fromUrl(giturl, opts))
  10720. }
  10721. return cache.get(key)
  10722. }
  10723. function fromUrl (giturl, opts) {
  10724. if (giturl == null || giturl === '') return
  10725. var url = fixupUnqualifiedGist(
  10726. isGitHubShorthand(giturl) ? 'github:' + giturl : giturl
  10727. )
  10728. var parsed = parseGitUrl(url)
  10729. var shortcutMatch = url.match(/^([^:]+):(?:[^@]+@)?(?:([^/]*)\/)?([^#]+)/)
  10730. var matches = Object.keys(gitHosts).map(function (gitHostName) {
  10731. try {
  10732. var gitHostInfo = gitHosts[gitHostName]
  10733. var auth = null
  10734. if (parsed.auth && authProtocols[parsed.protocol]) {
  10735. auth = parsed.auth
  10736. }
  10737. var committish = parsed.hash ? decodeURIComponent(parsed.hash.substr(1)) : null
  10738. var user = null
  10739. var project = null
  10740. var defaultRepresentation = null
  10741. if (shortcutMatch && shortcutMatch[1] === gitHostName) {
  10742. user = shortcutMatch[2] && decodeURIComponent(shortcutMatch[2])
  10743. project = decodeURIComponent(shortcutMatch[3].replace(/\.git$/, ''))
  10744. defaultRepresentation = 'shortcut'
  10745. } else {
  10746. if (parsed.host && parsed.host !== gitHostInfo.domain && parsed.host.replace(/^www[.]/, '') !== gitHostInfo.domain) return
  10747. if (!gitHostInfo.protocols_re.test(parsed.protocol)) return
  10748. if (!parsed.path) return
  10749. var pathmatch = gitHostInfo.pathmatch
  10750. var matched = parsed.path.match(pathmatch)
  10751. if (!matched) return
  10752. /* istanbul ignore else */
  10753. if (matched[1] !== null && matched[1] !== undefined) {
  10754. user = decodeURIComponent(matched[1].replace(/^:/, ''))
  10755. }
  10756. project = decodeURIComponent(matched[2])
  10757. defaultRepresentation = protocolToRepresentation(parsed.protocol)
  10758. }
  10759. return new GitHost(gitHostName, user, auth, project, committish, defaultRepresentation, opts)
  10760. } catch (ex) {
  10761. /* istanbul ignore else */
  10762. if (ex instanceof URIError) {
  10763. } else throw ex
  10764. }
  10765. }).filter(function (gitHostInfo) { return gitHostInfo })
  10766. if (matches.length !== 1) return
  10767. return matches[0]
  10768. }
  10769. function isGitHubShorthand (arg) {
  10770. // Note: This does not fully test the git ref format.
  10771. // See https://www.kernel.org/pub/software/scm/git/docs/git-check-ref-format.html
  10772. //
  10773. // The only way to do this properly would be to shell out to
  10774. // git-check-ref-format, and as this is a fast sync function,
  10775. // we don't want to do that. Just let git fail if it turns
  10776. // out that the commit-ish is invalid.
  10777. // GH usernames cannot start with . or -
  10778. return /^[^:@%/\s.-][^:@%/\s]*[/][^:@\s/%]+(?:#.*)?$/.test(arg)
  10779. }
  10780. function fixupUnqualifiedGist (giturl) {
  10781. // necessary for round-tripping gists
  10782. var parsed = url.parse(giturl)
  10783. if (parsed.protocol === 'gist:' && parsed.host && !parsed.path) {
  10784. return parsed.protocol + '/' + parsed.host
  10785. } else {
  10786. return giturl
  10787. }
  10788. }
  10789. function parseGitUrl (giturl) {
  10790. var matched = giturl.match(/^([^@]+)@([^:/]+):[/]?((?:[^/]+[/])?[^/]+?)(?:[.]git)?(#.*)?$/)
  10791. if (!matched) {
  10792. var legacy = url.parse(giturl)
  10793. if (legacy.auth) {
  10794. // git urls can be in the form of scp-style/ssh-connect strings, like
  10795. // git+ssh://user@host.com:some/path, which the legacy url parser
  10796. // supports, but WhatWG url.URL class does not. However, the legacy
  10797. // parser de-urlencodes the username and password, so something like
  10798. // https://user%3An%40me:p%40ss%3Aword@x.com/ becomes
  10799. // https://user:n@me:p@ss:word@x.com/ which is all kinds of wrong.
  10800. // Pull off just the auth and host, so we dont' get the confusing
  10801. // scp-style URL, then pass that to the WhatWG parser to get the
  10802. // auth properly escaped.
  10803. const authmatch = giturl.match(/[^@]+@[^:/]+/)
  10804. /* istanbul ignore else - this should be impossible */
  10805. if (authmatch) {
  10806. var whatwg = new url.URL(authmatch[0])
  10807. legacy.auth = whatwg.username || ''
  10808. if (whatwg.password) legacy.auth += ':' + whatwg.password
  10809. }
  10810. }
  10811. return legacy
  10812. }
  10813. return {
  10814. protocol: 'git+ssh:',
  10815. slashes: true,
  10816. auth: matched[1],
  10817. host: matched[2],
  10818. port: null,
  10819. hostname: matched[2],
  10820. hash: matched[4],
  10821. search: null,
  10822. query: null,
  10823. pathname: '/' + matched[3],
  10824. path: '/' + matched[3],
  10825. href: 'git+ssh://' + matched[1] + '@' + matched[2] +
  10826. '/' + matched[3] + (matched[4] || '')
  10827. }
  10828. }
  10829. /***/ }),
  10830. /***/ 64422:
  10831. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  10832. "use strict";
  10833. // A linked list to keep track of recently-used-ness
  10834. const Yallist = __webpack_require__(20891)
  10835. const MAX = Symbol('max')
  10836. const LENGTH = Symbol('length')
  10837. const LENGTH_CALCULATOR = Symbol('lengthCalculator')
  10838. const ALLOW_STALE = Symbol('allowStale')
  10839. const MAX_AGE = Symbol('maxAge')
  10840. const DISPOSE = Symbol('dispose')
  10841. const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet')
  10842. const LRU_LIST = Symbol('lruList')
  10843. const CACHE = Symbol('cache')
  10844. const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet')
  10845. const naiveLength = () => 1
  10846. // lruList is a yallist where the head is the youngest
  10847. // item, and the tail is the oldest. the list contains the Hit
  10848. // objects as the entries.
  10849. // Each Hit object has a reference to its Yallist.Node. This
  10850. // never changes.
  10851. //
  10852. // cache is a Map (or PseudoMap) that matches the keys to
  10853. // the Yallist.Node object.
  10854. class LRUCache {
  10855. constructor (options) {
  10856. if (typeof options === 'number')
  10857. options = { max: options }
  10858. if (!options)
  10859. options = {}
  10860. if (options.max && (typeof options.max !== 'number' || options.max < 0))
  10861. throw new TypeError('max must be a non-negative number')
  10862. // Kind of weird to have a default max of Infinity, but oh well.
  10863. const max = this[MAX] = options.max || Infinity
  10864. const lc = options.length || naiveLength
  10865. this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc
  10866. this[ALLOW_STALE] = options.stale || false
  10867. if (options.maxAge && typeof options.maxAge !== 'number')
  10868. throw new TypeError('maxAge must be a number')
  10869. this[MAX_AGE] = options.maxAge || 0
  10870. this[DISPOSE] = options.dispose
  10871. this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false
  10872. this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false
  10873. this.reset()
  10874. }
  10875. // resize the cache when the max changes.
  10876. set max (mL) {
  10877. if (typeof mL !== 'number' || mL < 0)
  10878. throw new TypeError('max must be a non-negative number')
  10879. this[MAX] = mL || Infinity
  10880. trim(this)
  10881. }
  10882. get max () {
  10883. return this[MAX]
  10884. }
  10885. set allowStale (allowStale) {
  10886. this[ALLOW_STALE] = !!allowStale
  10887. }
  10888. get allowStale () {
  10889. return this[ALLOW_STALE]
  10890. }
  10891. set maxAge (mA) {
  10892. if (typeof mA !== 'number')
  10893. throw new TypeError('maxAge must be a non-negative number')
  10894. this[MAX_AGE] = mA
  10895. trim(this)
  10896. }
  10897. get maxAge () {
  10898. return this[MAX_AGE]
  10899. }
  10900. // resize the cache when the lengthCalculator changes.
  10901. set lengthCalculator (lC) {
  10902. if (typeof lC !== 'function')
  10903. lC = naiveLength
  10904. if (lC !== this[LENGTH_CALCULATOR]) {
  10905. this[LENGTH_CALCULATOR] = lC
  10906. this[LENGTH] = 0
  10907. this[LRU_LIST].forEach(hit => {
  10908. hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key)
  10909. this[LENGTH] += hit.length
  10910. })
  10911. }
  10912. trim(this)
  10913. }
  10914. get lengthCalculator () { return this[LENGTH_CALCULATOR] }
  10915. get length () { return this[LENGTH] }
  10916. get itemCount () { return this[LRU_LIST].length }
  10917. rforEach (fn, thisp) {
  10918. thisp = thisp || this
  10919. for (let walker = this[LRU_LIST].tail; walker !== null;) {
  10920. const prev = walker.prev
  10921. forEachStep(this, fn, walker, thisp)
  10922. walker = prev
  10923. }
  10924. }
  10925. forEach (fn, thisp) {
  10926. thisp = thisp || this
  10927. for (let walker = this[LRU_LIST].head; walker !== null;) {
  10928. const next = walker.next
  10929. forEachStep(this, fn, walker, thisp)
  10930. walker = next
  10931. }
  10932. }
  10933. keys () {
  10934. return this[LRU_LIST].toArray().map(k => k.key)
  10935. }
  10936. values () {
  10937. return this[LRU_LIST].toArray().map(k => k.value)
  10938. }
  10939. reset () {
  10940. if (this[DISPOSE] &&
  10941. this[LRU_LIST] &&
  10942. this[LRU_LIST].length) {
  10943. this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value))
  10944. }
  10945. this[CACHE] = new Map() // hash of items by key
  10946. this[LRU_LIST] = new Yallist() // list of items in order of use recency
  10947. this[LENGTH] = 0 // length of items in the list
  10948. }
  10949. dump () {
  10950. return this[LRU_LIST].map(hit =>
  10951. isStale(this, hit) ? false : {
  10952. k: hit.key,
  10953. v: hit.value,
  10954. e: hit.now + (hit.maxAge || 0)
  10955. }).toArray().filter(h => h)
  10956. }
  10957. dumpLru () {
  10958. return this[LRU_LIST]
  10959. }
  10960. set (key, value, maxAge) {
  10961. maxAge = maxAge || this[MAX_AGE]
  10962. if (maxAge && typeof maxAge !== 'number')
  10963. throw new TypeError('maxAge must be a number')
  10964. const now = maxAge ? Date.now() : 0
  10965. const len = this[LENGTH_CALCULATOR](value, key)
  10966. if (this[CACHE].has(key)) {
  10967. if (len > this[MAX]) {
  10968. del(this, this[CACHE].get(key))
  10969. return false
  10970. }
  10971. const node = this[CACHE].get(key)
  10972. const item = node.value
  10973. // dispose of the old one before overwriting
  10974. // split out into 2 ifs for better coverage tracking
  10975. if (this[DISPOSE]) {
  10976. if (!this[NO_DISPOSE_ON_SET])
  10977. this[DISPOSE](key, item.value)
  10978. }
  10979. item.now = now
  10980. item.maxAge = maxAge
  10981. item.value = value
  10982. this[LENGTH] += len - item.length
  10983. item.length = len
  10984. this.get(key)
  10985. trim(this)
  10986. return true
  10987. }
  10988. const hit = new Entry(key, value, len, now, maxAge)
  10989. // oversized objects fall out of cache automatically.
  10990. if (hit.length > this[MAX]) {
  10991. if (this[DISPOSE])
  10992. this[DISPOSE](key, value)
  10993. return false
  10994. }
  10995. this[LENGTH] += hit.length
  10996. this[LRU_LIST].unshift(hit)
  10997. this[CACHE].set(key, this[LRU_LIST].head)
  10998. trim(this)
  10999. return true
  11000. }
  11001. has (key) {
  11002. if (!this[CACHE].has(key)) return false
  11003. const hit = this[CACHE].get(key).value
  11004. return !isStale(this, hit)
  11005. }
  11006. get (key) {
  11007. return get(this, key, true)
  11008. }
  11009. peek (key) {
  11010. return get(this, key, false)
  11011. }
  11012. pop () {
  11013. const node = this[LRU_LIST].tail
  11014. if (!node)
  11015. return null
  11016. del(this, node)
  11017. return node.value
  11018. }
  11019. del (key) {
  11020. del(this, this[CACHE].get(key))
  11021. }
  11022. load (arr) {
  11023. // reset the cache
  11024. this.reset()
  11025. const now = Date.now()
  11026. // A previous serialized cache has the most recent items first
  11027. for (let l = arr.length - 1; l >= 0; l--) {
  11028. const hit = arr[l]
  11029. const expiresAt = hit.e || 0
  11030. if (expiresAt === 0)
  11031. // the item was created without expiration in a non aged cache
  11032. this.set(hit.k, hit.v)
  11033. else {
  11034. const maxAge = expiresAt - now
  11035. // dont add already expired items
  11036. if (maxAge > 0) {
  11037. this.set(hit.k, hit.v, maxAge)
  11038. }
  11039. }
  11040. }
  11041. }
  11042. prune () {
  11043. this[CACHE].forEach((value, key) => get(this, key, false))
  11044. }
  11045. }
  11046. const get = (self, key, doUse) => {
  11047. const node = self[CACHE].get(key)
  11048. if (node) {
  11049. const hit = node.value
  11050. if (isStale(self, hit)) {
  11051. del(self, node)
  11052. if (!self[ALLOW_STALE])
  11053. return undefined
  11054. } else {
  11055. if (doUse) {
  11056. if (self[UPDATE_AGE_ON_GET])
  11057. node.value.now = Date.now()
  11058. self[LRU_LIST].unshiftNode(node)
  11059. }
  11060. }
  11061. return hit.value
  11062. }
  11063. }
  11064. const isStale = (self, hit) => {
  11065. if (!hit || (!hit.maxAge && !self[MAX_AGE]))
  11066. return false
  11067. const diff = Date.now() - hit.now
  11068. return hit.maxAge ? diff > hit.maxAge
  11069. : self[MAX_AGE] && (diff > self[MAX_AGE])
  11070. }
  11071. const trim = self => {
  11072. if (self[LENGTH] > self[MAX]) {
  11073. for (let walker = self[LRU_LIST].tail;
  11074. self[LENGTH] > self[MAX] && walker !== null;) {
  11075. // We know that we're about to delete this one, and also
  11076. // what the next least recently used key will be, so just
  11077. // go ahead and set it now.
  11078. const prev = walker.prev
  11079. del(self, walker)
  11080. walker = prev
  11081. }
  11082. }
  11083. }
  11084. const del = (self, node) => {
  11085. if (node) {
  11086. const hit = node.value
  11087. if (self[DISPOSE])
  11088. self[DISPOSE](hit.key, hit.value)
  11089. self[LENGTH] -= hit.length
  11090. self[CACHE].delete(hit.key)
  11091. self[LRU_LIST].removeNode(node)
  11092. }
  11093. }
  11094. class Entry {
  11095. constructor (key, value, length, now, maxAge) {
  11096. this.key = key
  11097. this.value = value
  11098. this.length = length
  11099. this.now = now
  11100. this.maxAge = maxAge || 0
  11101. }
  11102. }
  11103. const forEachStep = (self, fn, node, thisp) => {
  11104. let hit = node.value
  11105. if (isStale(self, hit)) {
  11106. del(self, node)
  11107. if (!self[ALLOW_STALE])
  11108. hit = undefined
  11109. }
  11110. if (hit)
  11111. fn.call(thisp, hit.value, hit.key, self)
  11112. }
  11113. module.exports = LRUCache
  11114. /***/ }),
  11115. /***/ 65693:
  11116. /***/ ((module) => {
  11117. "use strict";
  11118. module.exports = function (Yallist) {
  11119. Yallist.prototype[Symbol.iterator] = function* () {
  11120. for (let walker = this.head; walker; walker = walker.next) {
  11121. yield walker.value
  11122. }
  11123. }
  11124. }
  11125. /***/ }),
  11126. /***/ 20891:
  11127. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  11128. "use strict";
  11129. module.exports = Yallist
  11130. Yallist.Node = Node
  11131. Yallist.create = Yallist
  11132. function Yallist (list) {
  11133. var self = this
  11134. if (!(self instanceof Yallist)) {
  11135. self = new Yallist()
  11136. }
  11137. self.tail = null
  11138. self.head = null
  11139. self.length = 0
  11140. if (list && typeof list.forEach === 'function') {
  11141. list.forEach(function (item) {
  11142. self.push(item)
  11143. })
  11144. } else if (arguments.length > 0) {
  11145. for (var i = 0, l = arguments.length; i < l; i++) {
  11146. self.push(arguments[i])
  11147. }
  11148. }
  11149. return self
  11150. }
  11151. Yallist.prototype.removeNode = function (node) {
  11152. if (node.list !== this) {
  11153. throw new Error('removing node which does not belong to this list')
  11154. }
  11155. var next = node.next
  11156. var prev = node.prev
  11157. if (next) {
  11158. next.prev = prev
  11159. }
  11160. if (prev) {
  11161. prev.next = next
  11162. }
  11163. if (node === this.head) {
  11164. this.head = next
  11165. }
  11166. if (node === this.tail) {
  11167. this.tail = prev
  11168. }
  11169. node.list.length--
  11170. node.next = null
  11171. node.prev = null
  11172. node.list = null
  11173. return next
  11174. }
  11175. Yallist.prototype.unshiftNode = function (node) {
  11176. if (node === this.head) {
  11177. return
  11178. }
  11179. if (node.list) {
  11180. node.list.removeNode(node)
  11181. }
  11182. var head = this.head
  11183. node.list = this
  11184. node.next = head
  11185. if (head) {
  11186. head.prev = node
  11187. }
  11188. this.head = node
  11189. if (!this.tail) {
  11190. this.tail = node
  11191. }
  11192. this.length++
  11193. }
  11194. Yallist.prototype.pushNode = function (node) {
  11195. if (node === this.tail) {
  11196. return
  11197. }
  11198. if (node.list) {
  11199. node.list.removeNode(node)
  11200. }
  11201. var tail = this.tail
  11202. node.list = this
  11203. node.prev = tail
  11204. if (tail) {
  11205. tail.next = node
  11206. }
  11207. this.tail = node
  11208. if (!this.head) {
  11209. this.head = node
  11210. }
  11211. this.length++
  11212. }
  11213. Yallist.prototype.push = function () {
  11214. for (var i = 0, l = arguments.length; i < l; i++) {
  11215. push(this, arguments[i])
  11216. }
  11217. return this.length
  11218. }
  11219. Yallist.prototype.unshift = function () {
  11220. for (var i = 0, l = arguments.length; i < l; i++) {
  11221. unshift(this, arguments[i])
  11222. }
  11223. return this.length
  11224. }
  11225. Yallist.prototype.pop = function () {
  11226. if (!this.tail) {
  11227. return undefined
  11228. }
  11229. var res = this.tail.value
  11230. this.tail = this.tail.prev
  11231. if (this.tail) {
  11232. this.tail.next = null
  11233. } else {
  11234. this.head = null
  11235. }
  11236. this.length--
  11237. return res
  11238. }
  11239. Yallist.prototype.shift = function () {
  11240. if (!this.head) {
  11241. return undefined
  11242. }
  11243. var res = this.head.value
  11244. this.head = this.head.next
  11245. if (this.head) {
  11246. this.head.prev = null
  11247. } else {
  11248. this.tail = null
  11249. }
  11250. this.length--
  11251. return res
  11252. }
  11253. Yallist.prototype.forEach = function (fn, thisp) {
  11254. thisp = thisp || this
  11255. for (var walker = this.head, i = 0; walker !== null; i++) {
  11256. fn.call(thisp, walker.value, i, this)
  11257. walker = walker.next
  11258. }
  11259. }
  11260. Yallist.prototype.forEachReverse = function (fn, thisp) {
  11261. thisp = thisp || this
  11262. for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
  11263. fn.call(thisp, walker.value, i, this)
  11264. walker = walker.prev
  11265. }
  11266. }
  11267. Yallist.prototype.get = function (n) {
  11268. for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
  11269. // abort out of the list early if we hit a cycle
  11270. walker = walker.next
  11271. }
  11272. if (i === n && walker !== null) {
  11273. return walker.value
  11274. }
  11275. }
  11276. Yallist.prototype.getReverse = function (n) {
  11277. for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
  11278. // abort out of the list early if we hit a cycle
  11279. walker = walker.prev
  11280. }
  11281. if (i === n && walker !== null) {
  11282. return walker.value
  11283. }
  11284. }
  11285. Yallist.prototype.map = function (fn, thisp) {
  11286. thisp = thisp || this
  11287. var res = new Yallist()
  11288. for (var walker = this.head; walker !== null;) {
  11289. res.push(fn.call(thisp, walker.value, this))
  11290. walker = walker.next
  11291. }
  11292. return res
  11293. }
  11294. Yallist.prototype.mapReverse = function (fn, thisp) {
  11295. thisp = thisp || this
  11296. var res = new Yallist()
  11297. for (var walker = this.tail; walker !== null;) {
  11298. res.push(fn.call(thisp, walker.value, this))
  11299. walker = walker.prev
  11300. }
  11301. return res
  11302. }
  11303. Yallist.prototype.reduce = function (fn, initial) {
  11304. var acc
  11305. var walker = this.head
  11306. if (arguments.length > 1) {
  11307. acc = initial
  11308. } else if (this.head) {
  11309. walker = this.head.next
  11310. acc = this.head.value
  11311. } else {
  11312. throw new TypeError('Reduce of empty list with no initial value')
  11313. }
  11314. for (var i = 0; walker !== null; i++) {
  11315. acc = fn(acc, walker.value, i)
  11316. walker = walker.next
  11317. }
  11318. return acc
  11319. }
  11320. Yallist.prototype.reduceReverse = function (fn, initial) {
  11321. var acc
  11322. var walker = this.tail
  11323. if (arguments.length > 1) {
  11324. acc = initial
  11325. } else if (this.tail) {
  11326. walker = this.tail.prev
  11327. acc = this.tail.value
  11328. } else {
  11329. throw new TypeError('Reduce of empty list with no initial value')
  11330. }
  11331. for (var i = this.length - 1; walker !== null; i--) {
  11332. acc = fn(acc, walker.value, i)
  11333. walker = walker.prev
  11334. }
  11335. return acc
  11336. }
  11337. Yallist.prototype.toArray = function () {
  11338. var arr = new Array(this.length)
  11339. for (var i = 0, walker = this.head; walker !== null; i++) {
  11340. arr[i] = walker.value
  11341. walker = walker.next
  11342. }
  11343. return arr
  11344. }
  11345. Yallist.prototype.toArrayReverse = function () {
  11346. var arr = new Array(this.length)
  11347. for (var i = 0, walker = this.tail; walker !== null; i++) {
  11348. arr[i] = walker.value
  11349. walker = walker.prev
  11350. }
  11351. return arr
  11352. }
  11353. Yallist.prototype.slice = function (from, to) {
  11354. to = to || this.length
  11355. if (to < 0) {
  11356. to += this.length
  11357. }
  11358. from = from || 0
  11359. if (from < 0) {
  11360. from += this.length
  11361. }
  11362. var ret = new Yallist()
  11363. if (to < from || to < 0) {
  11364. return ret
  11365. }
  11366. if (from < 0) {
  11367. from = 0
  11368. }
  11369. if (to > this.length) {
  11370. to = this.length
  11371. }
  11372. for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
  11373. walker = walker.next
  11374. }
  11375. for (; walker !== null && i < to; i++, walker = walker.next) {
  11376. ret.push(walker.value)
  11377. }
  11378. return ret
  11379. }
  11380. Yallist.prototype.sliceReverse = function (from, to) {
  11381. to = to || this.length
  11382. if (to < 0) {
  11383. to += this.length
  11384. }
  11385. from = from || 0
  11386. if (from < 0) {
  11387. from += this.length
  11388. }
  11389. var ret = new Yallist()
  11390. if (to < from || to < 0) {
  11391. return ret
  11392. }
  11393. if (from < 0) {
  11394. from = 0
  11395. }
  11396. if (to > this.length) {
  11397. to = this.length
  11398. }
  11399. for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
  11400. walker = walker.prev
  11401. }
  11402. for (; walker !== null && i > from; i--, walker = walker.prev) {
  11403. ret.push(walker.value)
  11404. }
  11405. return ret
  11406. }
  11407. Yallist.prototype.splice = function (start, deleteCount, ...nodes) {
  11408. if (start > this.length) {
  11409. start = this.length - 1
  11410. }
  11411. if (start < 0) {
  11412. start = this.length + start;
  11413. }
  11414. for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
  11415. walker = walker.next
  11416. }
  11417. var ret = []
  11418. for (var i = 0; walker && i < deleteCount; i++) {
  11419. ret.push(walker.value)
  11420. walker = this.removeNode(walker)
  11421. }
  11422. if (walker === null) {
  11423. walker = this.tail
  11424. }
  11425. if (walker !== this.head && walker !== this.tail) {
  11426. walker = walker.prev
  11427. }
  11428. for (var i = 0; i < nodes.length; i++) {
  11429. walker = insert(this, walker, nodes[i])
  11430. }
  11431. return ret;
  11432. }
  11433. Yallist.prototype.reverse = function () {
  11434. var head = this.head
  11435. var tail = this.tail
  11436. for (var walker = head; walker !== null; walker = walker.prev) {
  11437. var p = walker.prev
  11438. walker.prev = walker.next
  11439. walker.next = p
  11440. }
  11441. this.head = tail
  11442. this.tail = head
  11443. return this
  11444. }
  11445. function insert (self, node, value) {
  11446. var inserted = node === self.head ?
  11447. new Node(value, null, node, self) :
  11448. new Node(value, node, node.next, self)
  11449. if (inserted.next === null) {
  11450. self.tail = inserted
  11451. }
  11452. if (inserted.prev === null) {
  11453. self.head = inserted
  11454. }
  11455. self.length++
  11456. return inserted
  11457. }
  11458. function push (self, item) {
  11459. self.tail = new Node(item, self.tail, null, self)
  11460. if (!self.head) {
  11461. self.head = self.tail
  11462. }
  11463. self.length++
  11464. }
  11465. function unshift (self, item) {
  11466. self.head = new Node(item, null, self.head, self)
  11467. if (!self.tail) {
  11468. self.tail = self.head
  11469. }
  11470. self.length++
  11471. }
  11472. function Node (value, prev, next, list) {
  11473. if (!(this instanceof Node)) {
  11474. return new Node(value, prev, next, list)
  11475. }
  11476. this.list = list
  11477. this.value = value
  11478. if (prev) {
  11479. prev.next = this
  11480. this.prev = prev
  11481. } else {
  11482. this.prev = null
  11483. }
  11484. if (next) {
  11485. next.prev = this
  11486. this.next = next
  11487. } else {
  11488. this.next = null
  11489. }
  11490. }
  11491. try {
  11492. // add if support for Symbol.iterator is present
  11493. __webpack_require__(65693)(Yallist)
  11494. } catch (er) {}
  11495. /***/ }),
  11496. /***/ 70382:
  11497. /***/ ((module) => {
  11498. module.exports = addExclude;
  11499. function addExclude(policy, pattern, group = 'global', options = {}) {
  11500. if (!isPatternGroupValid(group)) {
  11501. throw new Error('invalid file pattern-group');
  11502. }
  11503. policy.exclude = policy.exclude || {};
  11504. let patterns = policy.exclude[group] || [];
  11505. // Remove duplicates
  11506. patterns = patterns.filter((p) => p !== pattern && !p[pattern]);
  11507. options.created = new Date();
  11508. const entry =
  11509. !options.expires && !options.reason ? pattern : { [pattern]: options };
  11510. policy.exclude[group] = [...patterns, entry];
  11511. }
  11512. function isPatternGroupValid(group) {
  11513. return ['global', 'code', 'iac-drift'].includes(group);
  11514. }
  11515. /***/ }),
  11516. /***/ 24763:
  11517. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  11518. module.exports = add;
  11519. const debug = __webpack_require__(15158)('snyk:policy');
  11520. const emailValidator = __webpack_require__(83999);
  11521. const validReasonTypes = ['not-vulnerable', 'wont-fix', 'temporary-ignore'];
  11522. function add(policy, type, options) {
  11523. if (type !== 'ignore' && type !== 'patch') {
  11524. throw new Error('policy.add: unknown type "' + type + '" to add to');
  11525. }
  11526. if (!options || !options.id || !options.path) {
  11527. throw new Error('policy.add: required option props { id, path }');
  11528. }
  11529. const id = options.id;
  11530. const path = options.path;
  11531. const data = Object.keys(options).reduce(function (acc, curr) {
  11532. if (curr === 'id' || curr === 'path') {
  11533. return acc;
  11534. }
  11535. if (
  11536. curr === 'reasonType' &&
  11537. validReasonTypes.indexOf(options[curr]) === -1
  11538. ) {
  11539. throw new Error('invalid reasonType ' + options[curr]);
  11540. }
  11541. if (curr === 'ignoredBy') {
  11542. if (typeof options[curr] !== 'object') {
  11543. throw new Error('ignoredBy must be an object');
  11544. }
  11545. if (!emailValidator.validate(options[curr].email)) {
  11546. throw new Error('ignoredBy.email must be a valid email address');
  11547. }
  11548. }
  11549. acc[curr] = options[curr];
  11550. return acc;
  11551. }, {});
  11552. if (!policy[type][id]) {
  11553. policy[type][id] = [];
  11554. }
  11555. /* istanbul ignore if */
  11556. if (policy[type][id][path]) {
  11557. debug('policy.add: path already exists', policy[type][id][path]);
  11558. }
  11559. const rule = {};
  11560. rule[path] = data;
  11561. policy[type][id].push(rule);
  11562. return policy;
  11563. }
  11564. /***/ }),
  11565. /***/ 83105:
  11566. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  11567. // FIXME move to ext module
  11568. module.exports = getVulnSource;
  11569. const debug = __webpack_require__(15158)('snyk:policy');
  11570. const resolve = __webpack_require__(7320);
  11571. const path = __webpack_require__(85622);
  11572. const statSync = __webpack_require__(35747).statSync;
  11573. let { parsePackageString: moduleToObject } = __webpack_require__(60390);
  11574. function getVulnSource(vuln, cwd, live) {
  11575. const from = vuln.from.slice(1).map(function (pkg) {
  11576. return moduleToObject(pkg).name;
  11577. });
  11578. const viaPath = path.resolve(
  11579. cwd || process.cwd(),
  11580. 'node_modules',
  11581. from.join('/node_modules/')
  11582. );
  11583. let source = vuln.__filename ? path.dirname(vuln.__filename) : viaPath;
  11584. // try to stat the directory, if it throws, it doesn't exist...
  11585. try {
  11586. statSync(source);
  11587. } catch (e) {
  11588. // ...which means the package is located in a parent path (from an
  11589. // npm dedupe process), so we remove the module name from the path
  11590. // and use the `resolve` package to navigate the node_modules up
  11591. // through parent directories.
  11592. try {
  11593. source = resolve.sync(from.slice(-1).pop(), viaPath);
  11594. } catch (e) {
  11595. if (live) {
  11596. throw e;
  11597. }
  11598. // otherwise this is a dry run so we don't mind that it won't be
  11599. // able to patch - likely a scenario run, so it's fine that the
  11600. // patch target won't be found
  11601. }
  11602. debug('found better source for package: %s', source);
  11603. }
  11604. return source;
  11605. }
  11606. /***/ }),
  11607. /***/ 29695:
  11608. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  11609. module.exports = filterIgnored;
  11610. const cloneDeep = __webpack_require__(83465);
  11611. const debug = __webpack_require__(15158)('snyk:policy');
  11612. const matchToRule = __webpack_require__(39147).matchToRule;
  11613. // given an ignore ruleset (parsed from the .snyk yaml file) and a array of
  11614. // vulnerabilities, return the vulnerabilities that *are not* ignored
  11615. // see http://git.io/vCHmV for example of what ignore structure looks like
  11616. function filterIgnored(
  11617. ignore,
  11618. vuln,
  11619. filtered,
  11620. matchStrategy = 'packageManager'
  11621. ) {
  11622. if (!ignore) {
  11623. return vuln;
  11624. }
  11625. if (!filtered) {
  11626. filtered = [];
  11627. }
  11628. debug('filtering ignored');
  11629. const now = new Date().toJSON();
  11630. return vuln
  11631. .map(function (vuln) {
  11632. const applySecurityPolicyIgnore = vulnHasSecurityPolicyIgnore(vuln);
  11633. if (!ignore[vuln.id] && !applySecurityPolicyIgnore) {
  11634. return vuln;
  11635. }
  11636. debug('%s has rules', vuln.id);
  11637. let appliedRules = [];
  11638. if (applySecurityPolicyIgnore) {
  11639. // logic: if vuln has securityPolicyMetaData.ignore rule, that means it comes
  11640. // after security rule applied with the ignore action, thus we have to apply
  11641. // this ignore and not any others.
  11642. // Security policies ignores we apply to all paths "*" and disregardIfFixable=false
  11643. const rule = vuln.securityPolicyMetaData.ignore;
  11644. const {
  11645. created,
  11646. disregardIfFixable,
  11647. ignoredBy,
  11648. path,
  11649. reason = '',
  11650. reasonType,
  11651. source,
  11652. } = rule;
  11653. appliedRules = [
  11654. {
  11655. [path[0]]: {
  11656. reason,
  11657. reasonType,
  11658. source,
  11659. ignoredBy,
  11660. created,
  11661. disregardIfFixable,
  11662. },
  11663. },
  11664. ];
  11665. } else {
  11666. // logic: loop through all rules (from `ignore[vuln.id]`), and if *any* dep
  11667. // paths match our vuln.from dep chain AND the rule hasn't expired, then the
  11668. // vulnerability is ignored. if none of the rules match, then let we'll
  11669. // keep it.
  11670. // if rules.find, then ignore vuln
  11671. appliedRules = ignore[vuln.id].filter(function (rule) {
  11672. const path = Object.keys(rule)[0]; // this is a string
  11673. let expires = rule[path].expires;
  11674. if (expires && expires.toJSON) {
  11675. expires = expires.toJSON();
  11676. }
  11677. // first check if the path is a match on the rule
  11678. const pathMatch = matchToRule(vuln, rule, matchStrategy);
  11679. if (pathMatch && expires && expires < now) {
  11680. debug('%s vuln rule has expired (%s)', vuln.id, expires);
  11681. return false;
  11682. }
  11683. if (
  11684. pathMatch &&
  11685. rule[path].disregardIfFixable &&
  11686. (vuln.isUpgradable || vuln.isPatchable)
  11687. ) {
  11688. debug(
  11689. '%s vuln is fixable and rule is set to disregard if fixable',
  11690. vuln.id
  11691. );
  11692. return false;
  11693. }
  11694. if (pathMatch) {
  11695. if (debug.enabled) {
  11696. debug(
  11697. 'ignoring based on path match: %s ~= %s',
  11698. path,
  11699. vuln.from.slice(1).join(' > ')
  11700. );
  11701. }
  11702. return true;
  11703. }
  11704. return false;
  11705. });
  11706. }
  11707. if (appliedRules.length) {
  11708. vuln.filtered = {
  11709. ignored: appliedRules.map(function (rule) {
  11710. const path = Object.keys(rule)[0];
  11711. const ruleData = cloneDeep(rule[path]);
  11712. ruleData.path = path.split(' > ');
  11713. return ruleData;
  11714. }),
  11715. };
  11716. filtered.push(vuln);
  11717. }
  11718. return appliedRules.length ? false : vuln;
  11719. })
  11720. .filter(Boolean);
  11721. }
  11722. const vulnHasSecurityPolicyIgnore = (vuln) => {
  11723. return !!(vuln.securityPolicyMetaData && vuln.securityPolicyMetaData.ignore);
  11724. };
  11725. /***/ }),
  11726. /***/ 10877:
  11727. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  11728. module.exports = filter;
  11729. const debug = __webpack_require__(15158)('snyk:policy');
  11730. const ignore = __webpack_require__(29695);
  11731. const patch = __webpack_require__(1735);
  11732. const notes = __webpack_require__(77156);
  11733. // warning: mutates vulns
  11734. function filter(vulns, policy, root, matchStrategy = 'packageManager') {
  11735. if (!root) {
  11736. root = process.cwd();
  11737. }
  11738. if (vulns.ok) {
  11739. return vulns;
  11740. }
  11741. const filtered = {
  11742. ignore: [],
  11743. patch: [],
  11744. };
  11745. // strip the ignored modules from the results
  11746. vulns.vulnerabilities = ignore(
  11747. policy.ignore,
  11748. vulns.vulnerabilities,
  11749. filtered.ignore,
  11750. matchStrategy
  11751. );
  11752. vulns.vulnerabilities = patch(
  11753. policy.patch,
  11754. vulns.vulnerabilities,
  11755. root,
  11756. policy.skipVerifyPatch ? true : false,
  11757. filtered.patch
  11758. );
  11759. if (policy.suggest) {
  11760. vulns.vulnerabilities = notes(policy.suggest, vulns.vulnerabilities, root);
  11761. }
  11762. // if there's no vulns after the ignore process, let's reset the `ok`
  11763. // state and remove the vulns entirely.
  11764. if (vulns.vulnerabilities.length === 0) {
  11765. vulns.ok = true;
  11766. vulns.vulnerabilities = [];
  11767. }
  11768. vulns.filtered = filtered;
  11769. debug('> has threshold? %s', policy.failThreshold);
  11770. if (policy.failThreshold && vulns.ok === false) {
  11771. // check what's left and switch the failure flag if there's anything
  11772. // under our threshold
  11773. const levels = {
  11774. high: 3,
  11775. medium: 2,
  11776. low: 1,
  11777. };
  11778. const level = levels[policy.failThreshold];
  11779. vulns.ok = true;
  11780. vulns.vulnerabilities.some(function (vuln) {
  11781. if (levels[vuln.severity] >= level) {
  11782. vulns.ok = false;
  11783. return true; // breaks
  11784. }
  11785. });
  11786. }
  11787. return vulns;
  11788. }
  11789. /***/ }),
  11790. /***/ 77156:
  11791. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  11792. module.exports = attachNotes;
  11793. const debug = __webpack_require__(15158)('snyk:policy');
  11794. const matchToRule = __webpack_require__(39147).matchToRule;
  11795. function attachNotes(notes, vuln) {
  11796. if (!notes) {
  11797. return vuln;
  11798. }
  11799. debug('attaching notes');
  11800. const now = new Date().toJSON();
  11801. return vuln.map(function (vuln) {
  11802. if (!notes[vuln.id]) {
  11803. return vuln;
  11804. }
  11805. debug('%s has rules', vuln.id);
  11806. // if rules.some, then add note to the vuln
  11807. notes[vuln.id].forEach(function (rule) {
  11808. const path = Object.keys(rule)[0]; // this is a string
  11809. let expires = rule[path].expires;
  11810. // first check if the path is a match on the rule
  11811. const pathMatch = matchToRule(vuln, rule);
  11812. if (expires && expires.toJSON) {
  11813. expires = expires.toJSON();
  11814. }
  11815. if (pathMatch && expires && expires < now) {
  11816. debug('%s vuln rule has expired (%s)', vuln.id, expires);
  11817. return false;
  11818. }
  11819. if (
  11820. pathMatch &&
  11821. rule[path].disregardIfFixable &&
  11822. (vuln.upgradePath.length || vuln.patches.length)
  11823. ) {
  11824. debug(
  11825. '%s vuln is fixable and rule is set to disregard if fixable',
  11826. vuln.id
  11827. );
  11828. return false;
  11829. }
  11830. if (pathMatch) {
  11831. // strip any control characters in the 3rd party reason file
  11832. const reason = rule[path].reason.replace('/[\x00-\x1F\x7F-\x9F]/u', '');
  11833. if (debug.enabled) {
  11834. debug(
  11835. 'adding note based on path match: %s ~= %s',
  11836. path,
  11837. vuln.from.slice(1).join(' > ')
  11838. );
  11839. }
  11840. vuln.note =
  11841. 'Snyk policy in ' +
  11842. rule[path].from +
  11843. ' suggests ignoring this issue, with reason: ' +
  11844. reason;
  11845. }
  11846. return false;
  11847. });
  11848. return vuln;
  11849. });
  11850. }
  11851. /***/ }),
  11852. /***/ 1735:
  11853. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  11854. module.exports = filterPatched;
  11855. const cloneDeep = __webpack_require__(83465);
  11856. const debug = __webpack_require__(15158)('snyk:policy');
  11857. const matchToRule = __webpack_require__(39147).matchToRule;
  11858. const path = __webpack_require__(85622);
  11859. const statSync = __webpack_require__(35747).statSync;
  11860. const getVulnSource = __webpack_require__(83105);
  11861. // cwd is used for testing
  11862. function filterPatched(patched, vulns, cwd, skipVerifyPatch, filteredPatches) {
  11863. if (!patched) {
  11864. return vulns;
  11865. }
  11866. if (!filteredPatches) {
  11867. filteredPatches = [];
  11868. }
  11869. debug('filtering patched');
  11870. return vulns
  11871. .map(function (vuln) {
  11872. if (!patched[vuln.id]) {
  11873. return vuln;
  11874. }
  11875. debug('%s has rules', vuln.id);
  11876. // logic: loop through all rules (from `patched[vuln.id]`), and if *any* dep
  11877. // paths match our vuln.from dep chain AND a flag exists, then the
  11878. // vulnerability is ignored. if none of the rules match, then let we'll
  11879. // keep it.
  11880. // if rules.find, then ignore vuln
  11881. const vulnRules = patched[vuln.id]
  11882. .map(function (rule) {
  11883. // first check if the path is a match on the rule
  11884. const pathMatch = matchToRule(vuln, rule);
  11885. if (pathMatch) {
  11886. const path = Object.keys(rule)[0]; // this is a string
  11887. debug(
  11888. '(patch) ignoring based on path match: %s ~= %s',
  11889. path,
  11890. vuln.from.slice(1).join(' > ')
  11891. );
  11892. return rule;
  11893. }
  11894. return false;
  11895. })
  11896. .filter(Boolean);
  11897. // run through the potential rules to check if there's a patch flag in place
  11898. const appliedRules = vulnRules.filter(function () {
  11899. // the target directory where our module name will live
  11900. if (skipVerifyPatch) {
  11901. return true;
  11902. }
  11903. const source = getVulnSource(vuln, cwd, true);
  11904. const id = vuln.id.replace(/:/g, '-');
  11905. const flag = path.resolve(source, '.snyk-' + id + '.flag');
  11906. const oldFlag = path.resolve(source, '.snyk-' + vuln.id + '.flag');
  11907. let res = false;
  11908. try {
  11909. res = statSync(flag);
  11910. } catch (e) {
  11911. try {
  11912. res = statSync(oldFlag);
  11913. } catch (e) {}
  11914. }
  11915. debug('flag found for %s? %s', vuln.id);
  11916. return !!res;
  11917. });
  11918. if (appliedRules.length) {
  11919. vuln.filtered = {
  11920. patches: appliedRules.map(function (rule) {
  11921. const path = Object.keys(rule)[0];
  11922. const ruleData = cloneDeep(rule[path]) || {};
  11923. ruleData.path = path.split(' > ');
  11924. return ruleData;
  11925. }),
  11926. };
  11927. filteredPatches.push(vuln);
  11928. }
  11929. return appliedRules.length ? false : vuln;
  11930. })
  11931. .filter(Boolean);
  11932. }
  11933. /***/ }),
  11934. /***/ 70535:
  11935. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  11936. const fs = __webpack_require__(91729);
  11937. const path = __webpack_require__(85622);
  11938. const debug = __webpack_require__(15158)('snyk:policy');
  11939. const match = __webpack_require__(39147);
  11940. const parse = __webpack_require__(791);
  11941. const tryRequire = __webpack_require__(14402);
  11942. const filter = __webpack_require__(10877);
  11943. const add = __webpack_require__(24763);
  11944. const addExclude = __webpack_require__(70382);
  11945. module.exports = {
  11946. filter: filter,
  11947. demunge: parse.demunge,
  11948. load: load,
  11949. save: save,
  11950. getByVuln: match.getByVuln,
  11951. matchToRule: match.matchToRule,
  11952. loadFromText: loadFromText,
  11953. add: add,
  11954. addExclude: addExclude,
  11955. create: create,
  11956. };
  11957. function create() {
  11958. return loadFromText('');
  11959. }
  11960. // this is a function to allow our tests and fixtures to change cwd
  11961. function defaultFilename() {
  11962. return path.resolve(process.cwd(), '.snyk');
  11963. }
  11964. function attachMethods(policy) {
  11965. policy.filter = function (vulns, root, matchStrategy = 'packageManager') {
  11966. return filter(
  11967. vulns,
  11968. policy,
  11969. root || path.dirname(policy.__filename),
  11970. matchStrategy
  11971. );
  11972. };
  11973. policy.save = save.bind(null, policy);
  11974. policy.toString = parse.export.bind(null, policy);
  11975. policy.demunge = parse.demunge.bind(null, policy);
  11976. policy.add = add.bind(null, policy);
  11977. policy.addIgnore = add.bind(null, policy, 'ignore');
  11978. policy.addPatch = add.bind(null, policy, 'patch');
  11979. policy.addExclude = addExclude.bind(null, policy);
  11980. return policy;
  11981. }
  11982. function loadFromText(text) {
  11983. return new Promise(function (resolve) {
  11984. const policy = parse.import(text);
  11985. const now = Date.now();
  11986. policy.__filename = '';
  11987. policy.__modified = now;
  11988. policy.__created = now;
  11989. resolve(policy);
  11990. }).then(attachMethods);
  11991. }
  11992. function load(root, options) {
  11993. if (!Array.isArray(root) && typeof root !== 'string') {
  11994. options = root;
  11995. root = null;
  11996. }
  11997. if (!root) {
  11998. root = process.cwd();
  11999. }
  12000. if (!options) {
  12001. options = {};
  12002. }
  12003. const ignorePolicy = !!options['ignore-policy'];
  12004. let filename = '';
  12005. if (Array.isArray(root)) {
  12006. // we do a bit of a dance to get the first item in the array, and
  12007. // use it as our filename
  12008. filename = root[0];
  12009. } else {
  12010. if (root.indexOf('.snyk') === -1) {
  12011. root = path.resolve(root, '.snyk');
  12012. }
  12013. filename = root;
  12014. }
  12015. if (filename.indexOf('.snyk') === -1) {
  12016. filename = path.resolve(filename, '.snyk');
  12017. }
  12018. // Check if filename is directory and resolve to correct file path
  12019. try {
  12020. if (fs.lstatSync(filename).isDirectory()) {
  12021. filename = path.join(filename, '/.snyk');
  12022. }
  12023. } catch (error) {
  12024. if (error.code === 'ENOENT') {
  12025. // Ignore if EOENT
  12026. debug('ENOENT on file, while checking if directory');
  12027. } else {
  12028. throw error;
  12029. }
  12030. }
  12031. const promise = new Promise(function (resolve) {
  12032. if (ignorePolicy) {
  12033. return resolve(parse.import());
  12034. }
  12035. if (!ignorePolicy && Array.isArray(root)) {
  12036. return resolve(
  12037. mergePolicies(root, options).then(function (res) {
  12038. if (debug.enabled) {
  12039. debug('final policy:');
  12040. debug(JSON.stringify(res, '', 2));
  12041. }
  12042. return res;
  12043. })
  12044. );
  12045. }
  12046. resolve(fs.readFile(filename, 'utf8').then(parse.import));
  12047. });
  12048. const promises = [
  12049. promise,
  12050. fs.stat(filename).catch(function () {
  12051. return {};
  12052. }),
  12053. ];
  12054. return Promise.all(promises)
  12055. .catch(function (error) {
  12056. if (options.loose && error.code === 'ENOENT') {
  12057. debug('ENOENT on file, but running loose');
  12058. return [parse.import(), {}];
  12059. }
  12060. throw error;
  12061. })
  12062. .then(function (res) {
  12063. const policy = res[0];
  12064. policy.__modified = res[1].mtime;
  12065. policy.__created = res[1].birthtime || res[1].ctime;
  12066. if (options.loose && !policy.__modified) {
  12067. policy.__filename = null;
  12068. } else {
  12069. policy.__filename = path.relative(process.cwd(), filename);
  12070. }
  12071. return policy;
  12072. })
  12073. .then(attachMethods);
  12074. }
  12075. function mergePolicies(policyDirs, options) {
  12076. const ignoreTarget = options['trust-policies'] ? 'ignore' : 'suggest';
  12077. return Promise.all(
  12078. policyDirs.map(function (dir) {
  12079. return load(dir, options);
  12080. })
  12081. ).then(function (policies) {
  12082. // firstly extend the paths in the ignore and patch
  12083. const rootPolicy = policies[0];
  12084. const others = policies.slice(1);
  12085. return Promise.all(
  12086. others
  12087. .filter(function (policy) {
  12088. return policy.__filename; // filter out non loaded policies
  12089. })
  12090. .map(function (policy) {
  12091. const filename = path.dirname(policy.__filename) + '/package.json';
  12092. return tryRequire(filename).then(function (pkg) {
  12093. const full = pkg.name + '@' + pkg.version;
  12094. mergePath('ignore', ignoreTarget, full, rootPolicy, policy);
  12095. mergePath('patch', 'patch', full, rootPolicy, policy);
  12096. });
  12097. })
  12098. ).then(function () {
  12099. return rootPolicy;
  12100. });
  12101. });
  12102. }
  12103. // note: mutates both objects, be warned!
  12104. function mergePath(type, into, pathRoot, rootPolicy, policy) {
  12105. if (!rootPolicy[into]) {
  12106. rootPolicy[into] = {};
  12107. }
  12108. Object.keys(policy[type]).forEach(function (id) {
  12109. // convert the path from `module@version` to `parent > module@version`
  12110. policy[type][id] = policy[type][id].map(function (path) {
  12111. // this is because our policy file format favours "readable" yaml,
  12112. // instead of easy to use object structures.
  12113. const key = Object.keys(path).pop();
  12114. const newPath = {};
  12115. newPath[pathRoot + ' > ' + key] = path[key];
  12116. path[key] = path[key] || {};
  12117. path[key].from = pathRoot;
  12118. return newPath;
  12119. });
  12120. // add the rule if we don't have it in our policy already
  12121. if (!rootPolicy[into][id]) {
  12122. rootPolicy[into][id] = policy[type][id];
  12123. return;
  12124. }
  12125. // otherwise we need to merge up manually
  12126. rootPolicy[into][id] = rootPolicy[into][id].concat(policy[type][id]);
  12127. });
  12128. }
  12129. function save(object, root, spinner) {
  12130. const filename = root ? path.resolve(root, '.snyk') : defaultFilename();
  12131. const lbl = 'Saving .snyk policy file...';
  12132. if (!spinner) {
  12133. spinner = function (res) {
  12134. return Promise.resolve(res);
  12135. };
  12136. spinner.clear = spinner;
  12137. }
  12138. return spinner(lbl)
  12139. .then(function () {
  12140. return parse.export(object);
  12141. })
  12142. .then(function (yaml) {
  12143. return fs.writeFile(filename, yaml);
  12144. })
  12145. .then(spinner.clear(lbl));
  12146. }
  12147. /***/ }),
  12148. /***/ 39147:
  12149. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  12150. module.exports = {
  12151. matchToRule: matchToRule,
  12152. getByVuln: getByVuln,
  12153. };
  12154. const debug = __webpack_require__(15158)('snyk:policy');
  12155. const debugPolicy = __webpack_require__(15158)('snyk:protect');
  12156. const semver = __webpack_require__(23382);
  12157. let { parsePackageString: moduleToObject } = __webpack_require__(60390);
  12158. // matchPath will take the array of dependencies that a vulnerability came from
  12159. // and try to match it to a string `path`. The path will look like this:
  12160. // express-hbs@0.8.4 > handlebars@3.0.3 > uglify-js@2.3.6
  12161. // note that the root package is never part of the path (i.e. jsbin@3.11.31)
  12162. // the path can also use `*` as a wildcard _and_ use semver:
  12163. // * > uglify-js@2.x
  12164. // The matchPath will break the `path` down into it's component parts, and loop
  12165. // through trying to get a positive match or not. For full examples of options
  12166. // see http://git.io/vCH3N
  12167. function matchPath(from, path) {
  12168. const parts = path.split(' > ');
  12169. debugPolicy('checking path: %s vs. %s', path, from);
  12170. let offset = 0;
  12171. const res = parts.every(function (pkg, i) {
  12172. debugPolicy('for %s...(against %s)', pkg, from[i + offset]);
  12173. let fromPkg = from[i + offset] ? moduleToObject(from[i + offset]) : {};
  12174. if (pkg === '*') {
  12175. debugPolicy('star rule');
  12176. // handle the rule being `*` alone
  12177. if (!parts[i + 1]) {
  12178. return true;
  12179. }
  12180. const next = moduleToObject(parts[i + 1]);
  12181. // assuming we're not at the end of the rule path, then try to find
  12182. // the next matching package in the chain. So `* > semver` matches
  12183. // `foo > bar > semver`
  12184. if (next) {
  12185. debugPolicy('next', next);
  12186. // move forward until we find a matching package
  12187. for (let j = i; i < parts.length; j++) {
  12188. // if we've run out of paths, then we didn't match
  12189. if (!from[i + offset]) {
  12190. return false;
  12191. }
  12192. fromPkg = moduleToObject(from[i + offset]);
  12193. debugPolicy('fromPkg', fromPkg, next);
  12194. if (next.name === fromPkg.name) {
  12195. // adjust for the `i` index incrementing in the next .every call
  12196. offset--;
  12197. debugPolicy('next has a match');
  12198. break;
  12199. }
  12200. debugPolicy('pushing offset');
  12201. offset++;
  12202. }
  12203. }
  12204. return true;
  12205. }
  12206. debugPolicy('next test', pkg, fromPkg);
  12207. if (pkg === from[i + offset]) {
  12208. debugPolicy('exact match');
  12209. return true;
  12210. }
  12211. const target = moduleToObject(pkg);
  12212. let pkgVersion = target.version;
  12213. // the * semver rule won't match pre-releases, which in our case is a
  12214. // problem, so if the version is indeed *, we'll reset it to the exact same
  12215. // version as our target package to allow for a match.
  12216. if (pkgVersion === '*') {
  12217. pkgVersion = fromPkg.version;
  12218. }
  12219. // shortcut version match, if it's exact, then skip the semver check
  12220. if (target.name === fromPkg.name) {
  12221. if (fromPkg.version === pkgVersion) {
  12222. debugPolicy('exact version match');
  12223. return true;
  12224. }
  12225. if (
  12226. semver.valid(fromPkg.version) &&
  12227. semver.satisfies(fromPkg.version, pkgVersion)
  12228. ) {
  12229. debugPolicy('semver match');
  12230. return true;
  12231. }
  12232. }
  12233. debugPolicy('failed match');
  12234. return false;
  12235. });
  12236. debugPolicy('result of path test %s: %s', path, res);
  12237. return res;
  12238. }
  12239. function matchToRule(vuln, rule, matchStrategy = 'packageManager') {
  12240. return Object.keys(rule).some(function (path) {
  12241. return matchToSingleRule(vuln, path, matchStrategy);
  12242. });
  12243. }
  12244. function matchToSingleRule(vuln, path, matchStrategy) {
  12245. if (matchStrategy === 'exact') {
  12246. return matchExactWithStars(vuln, path);
  12247. }
  12248. // check for an exact match
  12249. let pathMatch = false;
  12250. const from = vuln.from.slice(1);
  12251. if (path.indexOf(from.join(' > ')) !== -1) {
  12252. debug('%s exact match from %s', vuln.id, from);
  12253. pathMatch = true;
  12254. } else if (matchPath(from, path)) {
  12255. pathMatch = true;
  12256. }
  12257. return pathMatch;
  12258. }
  12259. function matchExactWithStars(vuln, path) {
  12260. const parts = path.split(' > ');
  12261. if (parts[parts.length - 1] === '*') {
  12262. const paddingLength = vuln.from.length - parts.length;
  12263. for (let i = 0; i < paddingLength; i++) {
  12264. parts.push('*');
  12265. }
  12266. }
  12267. if (parts.length !== vuln.from.length) {
  12268. return false;
  12269. }
  12270. for (let i = 0; i < parts.length; i++) {
  12271. if (parts[i] !== vuln.from[i] && parts[i] !== '*') {
  12272. return false;
  12273. }
  12274. }
  12275. return true;
  12276. }
  12277. function getByVuln(policy, vuln) {
  12278. let found = null;
  12279. if (!policy || !vuln) {
  12280. return found;
  12281. }
  12282. ['ignore', 'patch'].forEach(function (key) {
  12283. Object.keys(policy[key] || []).forEach(function (p) {
  12284. if (p === vuln.id) {
  12285. policy[key][p].forEach(function (rule) {
  12286. if (matchToRule(vuln, rule)) {
  12287. found = {
  12288. type: key,
  12289. id: vuln.id,
  12290. rule: vuln.from,
  12291. };
  12292. const rootRule = Object.keys(rule).pop();
  12293. Object.keys(rule[rootRule]).forEach(function (key) {
  12294. found[key] = rule[rootRule][key];
  12295. });
  12296. }
  12297. });
  12298. }
  12299. });
  12300. });
  12301. return found;
  12302. }
  12303. /***/ }),
  12304. /***/ 56202:
  12305. /***/ ((module) => {
  12306. module.exports = addComments;
  12307. const initialComment =
  12308. '# Snyk (https://snyk.io) policy file, patches or ' +
  12309. 'ignores known vulnerabilities.';
  12310. const inlineComments = {
  12311. ignore:
  12312. '# ignores vulnerabilities until expiry date; change duration by ' +
  12313. 'modifying expiry date',
  12314. patch: '# patches apply the minimum changes required to fix a vulnerability',
  12315. };
  12316. function addComments(policyExport) {
  12317. const lines = policyExport.split('\n');
  12318. lines.unshift(initialComment);
  12319. Object.keys(inlineComments).forEach(function (key) {
  12320. const position = lines.indexOf(key + ':');
  12321. if (position !== -1) {
  12322. lines.splice(position, 0, inlineComments[key]);
  12323. }
  12324. });
  12325. return lines.join('\n');
  12326. }
  12327. /***/ }),
  12328. /***/ 72088:
  12329. /***/ ((module) => {
  12330. module.exports = demunge;
  12331. function demunge(policy, apiRoot) {
  12332. if (!apiRoot) {
  12333. apiRoot = '';
  12334. }
  12335. const res = ['ignore', 'patch', 'exclude'].reduce(function (acc, type) {
  12336. acc[type] = policy[type]
  12337. ? Object.keys(policy[type]).map(function (id) {
  12338. const paths = policy[type][id].map(function (pathObj) {
  12339. if (type === 'exclude' && typeof pathObj === 'string') {
  12340. return {
  12341. path: pathObj,
  12342. };
  12343. }
  12344. const path = Object.keys(pathObj).pop();
  12345. const res = {
  12346. path: path,
  12347. };
  12348. if (type === 'ignore' || type === 'exclude') {
  12349. res.reason = pathObj[path].reason;
  12350. res.expires =
  12351. pathObj[path].expires && new Date(pathObj[path].expires);
  12352. res.disregardIfFixable = pathObj[path].disregardIfFixable;
  12353. }
  12354. return res;
  12355. });
  12356. return {
  12357. id: id,
  12358. url: apiRoot + '/vuln/' + id,
  12359. paths: paths,
  12360. };
  12361. })
  12362. : [];
  12363. return acc;
  12364. }, {});
  12365. res.version = policy.version;
  12366. return res;
  12367. }
  12368. /***/ }),
  12369. /***/ 791:
  12370. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  12371. const cloneDeep = __webpack_require__(83465);
  12372. const semver = __webpack_require__(23382);
  12373. const yaml = __webpack_require__(93320);
  12374. const addComments = __webpack_require__(56202);
  12375. const { version: versionFromPackageJson } = __webpack_require__(4195);
  12376. module.exports = {
  12377. import: imports,
  12378. export: exports,
  12379. demunge: __webpack_require__(72088),
  12380. version: version(),
  12381. };
  12382. const parsers = {
  12383. v1: __webpack_require__(36414),
  12384. };
  12385. function imports(rawYaml) {
  12386. let data = yaml.safeLoad(rawYaml || '');
  12387. if (!data || typeof data !== 'object') {
  12388. data = {};
  12389. }
  12390. if (!data.version) {
  12391. data.version = version();
  12392. }
  12393. if (data.version === 'v1') {
  12394. data.version = 'v1.0.0';
  12395. }
  12396. const parser = parsers['v' + semver.major(data.version.substr(1))];
  12397. if (!parser) {
  12398. throw new Error('unsupported version: ' + data.version);
  12399. }
  12400. return parser(data);
  12401. }
  12402. function exports(policy) {
  12403. const data = cloneDeep(policy);
  12404. // remove any private information on the policy
  12405. Object.keys(data).map(function (key) {
  12406. if (key.indexOf('__') === 0) {
  12407. delete data[key];
  12408. }
  12409. if (data[key] == null) {
  12410. // jshint ignore:line
  12411. delete data[key];
  12412. }
  12413. // strip helper functions
  12414. if (typeof data[key] === 'function') {
  12415. delete data[key];
  12416. }
  12417. });
  12418. // ensure we always update the version of the policy format
  12419. data.version = version();
  12420. // put inline comments into the exported yaml file
  12421. return addComments(yaml.safeDump(data));
  12422. }
  12423. function version() {
  12424. if (versionFromPackageJson && versionFromPackageJson !== '0.0.0') {
  12425. return 'v' + versionFromPackageJson;
  12426. }
  12427. return 'v1.0.0';
  12428. }
  12429. /***/ }),
  12430. /***/ 36414:
  12431. /***/ ((module) => {
  12432. // eventually we'll have v2 which will point to latestParser, and v1 will
  12433. // need to process the old form of data and upgrade it to v2 structure
  12434. module.exports = function imports(policy) {
  12435. if (!policy.ignore) {
  12436. policy.ignore = {};
  12437. }
  12438. if (!policy.patch) {
  12439. policy.patch = {};
  12440. }
  12441. Object.keys(policy.patch).forEach(function (id) {
  12442. if (!Array.isArray(policy.patch[id])) {
  12443. delete policy.patch[id];
  12444. }
  12445. });
  12446. checkForOldFormat(policy.ignore); // this is only an old issue on ignores
  12447. validate(policy.ignore);
  12448. validate(policy.patch);
  12449. policy.failThreshold = getFailThreshold(policy);
  12450. if (!policy.failThreshold) {
  12451. // throw it away if it's not set
  12452. delete policy.failThreshold;
  12453. }
  12454. return policy;
  12455. };
  12456. module.exports.needsFixing = needsFixing;
  12457. function checkForOldFormat(ignore) {
  12458. // this is a cursory test to ensure that we're working with a snyk format
  12459. // that we recognise. if the property is an object, then it's the early
  12460. // alpha format, and we'll throw
  12461. Object.keys(ignore).forEach(function (id) {
  12462. if (!Array.isArray(ignore[id])) {
  12463. const error = new Error('old, unsupported .snyk format detected');
  12464. error.code = 'OLD_DOTFILE_FORMAT';
  12465. throw error;
  12466. }
  12467. });
  12468. }
  12469. function validate(policy) {
  12470. const fix = needsFixing(policy);
  12471. if (fix) {
  12472. fix.forEach(function (item) {
  12473. const o = {};
  12474. o[item.key] = item.rule;
  12475. policy[item.id].push(o);
  12476. });
  12477. }
  12478. }
  12479. function needsFixing(policy) {
  12480. const move = [];
  12481. Object.keys(policy).forEach(function (id) {
  12482. policy[id].forEach(function (rule) {
  12483. const keys = Object.keys(rule);
  12484. keys.shift(); // drop the first
  12485. if (keys === 0) {
  12486. return;
  12487. }
  12488. // this means our policy has become corrupted, and we need to move
  12489. // the additional keys into their own position in the policy
  12490. keys.forEach(function (key) {
  12491. move.push({
  12492. id: id,
  12493. key: key,
  12494. rule: rule[key],
  12495. });
  12496. delete rule[key];
  12497. });
  12498. });
  12499. });
  12500. return move.length ? move : false;
  12501. }
  12502. function getFailThreshold(policy) {
  12503. let threshold = null;
  12504. // pluck the value out, and support all sorts of silly typos
  12505. [
  12506. 'failThreshold',
  12507. 'fail_threshold',
  12508. 'failthreshold',
  12509. 'threshold',
  12510. 'fail_threshhold',
  12511. ].some(function (key) {
  12512. // if we have the value, set it and return it - which will exit loop
  12513. return (threshold = policy[key] || null); // jshint ignore:line
  12514. });
  12515. if (!threshold) {
  12516. return null;
  12517. }
  12518. const valid = ['high', 'medium', 'low'];
  12519. threshold = threshold.toLowerCase().trim();
  12520. if (valid.indexOf(threshold) === -1) {
  12521. const error = new Error('unknown threshold value "' + threshold + '"');
  12522. error.code = 'POLICY_BAD_THRESHOLD';
  12523. throw error;
  12524. }
  12525. return threshold;
  12526. }
  12527. /***/ }),
  12528. /***/ 89006:
  12529. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  12530. "use strict";
  12531. // A linked list to keep track of recently-used-ness
  12532. const Yallist = __webpack_require__(41898)
  12533. const MAX = Symbol('max')
  12534. const LENGTH = Symbol('length')
  12535. const LENGTH_CALCULATOR = Symbol('lengthCalculator')
  12536. const ALLOW_STALE = Symbol('allowStale')
  12537. const MAX_AGE = Symbol('maxAge')
  12538. const DISPOSE = Symbol('dispose')
  12539. const NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet')
  12540. const LRU_LIST = Symbol('lruList')
  12541. const CACHE = Symbol('cache')
  12542. const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet')
  12543. const naiveLength = () => 1
  12544. // lruList is a yallist where the head is the youngest
  12545. // item, and the tail is the oldest. the list contains the Hit
  12546. // objects as the entries.
  12547. // Each Hit object has a reference to its Yallist.Node. This
  12548. // never changes.
  12549. //
  12550. // cache is a Map (or PseudoMap) that matches the keys to
  12551. // the Yallist.Node object.
  12552. class LRUCache {
  12553. constructor (options) {
  12554. if (typeof options === 'number')
  12555. options = { max: options }
  12556. if (!options)
  12557. options = {}
  12558. if (options.max && (typeof options.max !== 'number' || options.max < 0))
  12559. throw new TypeError('max must be a non-negative number')
  12560. // Kind of weird to have a default max of Infinity, but oh well.
  12561. const max = this[MAX] = options.max || Infinity
  12562. const lc = options.length || naiveLength
  12563. this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc
  12564. this[ALLOW_STALE] = options.stale || false
  12565. if (options.maxAge && typeof options.maxAge !== 'number')
  12566. throw new TypeError('maxAge must be a number')
  12567. this[MAX_AGE] = options.maxAge || 0
  12568. this[DISPOSE] = options.dispose
  12569. this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false
  12570. this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false
  12571. this.reset()
  12572. }
  12573. // resize the cache when the max changes.
  12574. set max (mL) {
  12575. if (typeof mL !== 'number' || mL < 0)
  12576. throw new TypeError('max must be a non-negative number')
  12577. this[MAX] = mL || Infinity
  12578. trim(this)
  12579. }
  12580. get max () {
  12581. return this[MAX]
  12582. }
  12583. set allowStale (allowStale) {
  12584. this[ALLOW_STALE] = !!allowStale
  12585. }
  12586. get allowStale () {
  12587. return this[ALLOW_STALE]
  12588. }
  12589. set maxAge (mA) {
  12590. if (typeof mA !== 'number')
  12591. throw new TypeError('maxAge must be a non-negative number')
  12592. this[MAX_AGE] = mA
  12593. trim(this)
  12594. }
  12595. get maxAge () {
  12596. return this[MAX_AGE]
  12597. }
  12598. // resize the cache when the lengthCalculator changes.
  12599. set lengthCalculator (lC) {
  12600. if (typeof lC !== 'function')
  12601. lC = naiveLength
  12602. if (lC !== this[LENGTH_CALCULATOR]) {
  12603. this[LENGTH_CALCULATOR] = lC
  12604. this[LENGTH] = 0
  12605. this[LRU_LIST].forEach(hit => {
  12606. hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key)
  12607. this[LENGTH] += hit.length
  12608. })
  12609. }
  12610. trim(this)
  12611. }
  12612. get lengthCalculator () { return this[LENGTH_CALCULATOR] }
  12613. get length () { return this[LENGTH] }
  12614. get itemCount () { return this[LRU_LIST].length }
  12615. rforEach (fn, thisp) {
  12616. thisp = thisp || this
  12617. for (let walker = this[LRU_LIST].tail; walker !== null;) {
  12618. const prev = walker.prev
  12619. forEachStep(this, fn, walker, thisp)
  12620. walker = prev
  12621. }
  12622. }
  12623. forEach (fn, thisp) {
  12624. thisp = thisp || this
  12625. for (let walker = this[LRU_LIST].head; walker !== null;) {
  12626. const next = walker.next
  12627. forEachStep(this, fn, walker, thisp)
  12628. walker = next
  12629. }
  12630. }
  12631. keys () {
  12632. return this[LRU_LIST].toArray().map(k => k.key)
  12633. }
  12634. values () {
  12635. return this[LRU_LIST].toArray().map(k => k.value)
  12636. }
  12637. reset () {
  12638. if (this[DISPOSE] &&
  12639. this[LRU_LIST] &&
  12640. this[LRU_LIST].length) {
  12641. this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value))
  12642. }
  12643. this[CACHE] = new Map() // hash of items by key
  12644. this[LRU_LIST] = new Yallist() // list of items in order of use recency
  12645. this[LENGTH] = 0 // length of items in the list
  12646. }
  12647. dump () {
  12648. return this[LRU_LIST].map(hit =>
  12649. isStale(this, hit) ? false : {
  12650. k: hit.key,
  12651. v: hit.value,
  12652. e: hit.now + (hit.maxAge || 0)
  12653. }).toArray().filter(h => h)
  12654. }
  12655. dumpLru () {
  12656. return this[LRU_LIST]
  12657. }
  12658. set (key, value, maxAge) {
  12659. maxAge = maxAge || this[MAX_AGE]
  12660. if (maxAge && typeof maxAge !== 'number')
  12661. throw new TypeError('maxAge must be a number')
  12662. const now = maxAge ? Date.now() : 0
  12663. const len = this[LENGTH_CALCULATOR](value, key)
  12664. if (this[CACHE].has(key)) {
  12665. if (len > this[MAX]) {
  12666. del(this, this[CACHE].get(key))
  12667. return false
  12668. }
  12669. const node = this[CACHE].get(key)
  12670. const item = node.value
  12671. // dispose of the old one before overwriting
  12672. // split out into 2 ifs for better coverage tracking
  12673. if (this[DISPOSE]) {
  12674. if (!this[NO_DISPOSE_ON_SET])
  12675. this[DISPOSE](key, item.value)
  12676. }
  12677. item.now = now
  12678. item.maxAge = maxAge
  12679. item.value = value
  12680. this[LENGTH] += len - item.length
  12681. item.length = len
  12682. this.get(key)
  12683. trim(this)
  12684. return true
  12685. }
  12686. const hit = new Entry(key, value, len, now, maxAge)
  12687. // oversized objects fall out of cache automatically.
  12688. if (hit.length > this[MAX]) {
  12689. if (this[DISPOSE])
  12690. this[DISPOSE](key, value)
  12691. return false
  12692. }
  12693. this[LENGTH] += hit.length
  12694. this[LRU_LIST].unshift(hit)
  12695. this[CACHE].set(key, this[LRU_LIST].head)
  12696. trim(this)
  12697. return true
  12698. }
  12699. has (key) {
  12700. if (!this[CACHE].has(key)) return false
  12701. const hit = this[CACHE].get(key).value
  12702. return !isStale(this, hit)
  12703. }
  12704. get (key) {
  12705. return get(this, key, true)
  12706. }
  12707. peek (key) {
  12708. return get(this, key, false)
  12709. }
  12710. pop () {
  12711. const node = this[LRU_LIST].tail
  12712. if (!node)
  12713. return null
  12714. del(this, node)
  12715. return node.value
  12716. }
  12717. del (key) {
  12718. del(this, this[CACHE].get(key))
  12719. }
  12720. load (arr) {
  12721. // reset the cache
  12722. this.reset()
  12723. const now = Date.now()
  12724. // A previous serialized cache has the most recent items first
  12725. for (let l = arr.length - 1; l >= 0; l--) {
  12726. const hit = arr[l]
  12727. const expiresAt = hit.e || 0
  12728. if (expiresAt === 0)
  12729. // the item was created without expiration in a non aged cache
  12730. this.set(hit.k, hit.v)
  12731. else {
  12732. const maxAge = expiresAt - now
  12733. // dont add already expired items
  12734. if (maxAge > 0) {
  12735. this.set(hit.k, hit.v, maxAge)
  12736. }
  12737. }
  12738. }
  12739. }
  12740. prune () {
  12741. this[CACHE].forEach((value, key) => get(this, key, false))
  12742. }
  12743. }
  12744. const get = (self, key, doUse) => {
  12745. const node = self[CACHE].get(key)
  12746. if (node) {
  12747. const hit = node.value
  12748. if (isStale(self, hit)) {
  12749. del(self, node)
  12750. if (!self[ALLOW_STALE])
  12751. return undefined
  12752. } else {
  12753. if (doUse) {
  12754. if (self[UPDATE_AGE_ON_GET])
  12755. node.value.now = Date.now()
  12756. self[LRU_LIST].unshiftNode(node)
  12757. }
  12758. }
  12759. return hit.value
  12760. }
  12761. }
  12762. const isStale = (self, hit) => {
  12763. if (!hit || (!hit.maxAge && !self[MAX_AGE]))
  12764. return false
  12765. const diff = Date.now() - hit.now
  12766. return hit.maxAge ? diff > hit.maxAge
  12767. : self[MAX_AGE] && (diff > self[MAX_AGE])
  12768. }
  12769. const trim = self => {
  12770. if (self[LENGTH] > self[MAX]) {
  12771. for (let walker = self[LRU_LIST].tail;
  12772. self[LENGTH] > self[MAX] && walker !== null;) {
  12773. // We know that we're about to delete this one, and also
  12774. // what the next least recently used key will be, so just
  12775. // go ahead and set it now.
  12776. const prev = walker.prev
  12777. del(self, walker)
  12778. walker = prev
  12779. }
  12780. }
  12781. }
  12782. const del = (self, node) => {
  12783. if (node) {
  12784. const hit = node.value
  12785. if (self[DISPOSE])
  12786. self[DISPOSE](hit.key, hit.value)
  12787. self[LENGTH] -= hit.length
  12788. self[CACHE].delete(hit.key)
  12789. self[LRU_LIST].removeNode(node)
  12790. }
  12791. }
  12792. class Entry {
  12793. constructor (key, value, length, now, maxAge) {
  12794. this.key = key
  12795. this.value = value
  12796. this.length = length
  12797. this.now = now
  12798. this.maxAge = maxAge || 0
  12799. }
  12800. }
  12801. const forEachStep = (self, fn, node, thisp) => {
  12802. let hit = node.value
  12803. if (isStale(self, hit)) {
  12804. del(self, node)
  12805. if (!self[ALLOW_STALE])
  12806. hit = undefined
  12807. }
  12808. if (hit)
  12809. fn.call(thisp, hit.value, hit.key, self)
  12810. }
  12811. module.exports = LRUCache
  12812. /***/ }),
  12813. /***/ 60054:
  12814. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  12815. const ANY = Symbol('SemVer ANY')
  12816. // hoisted class for cyclic dependency
  12817. class Comparator {
  12818. static get ANY () {
  12819. return ANY
  12820. }
  12821. constructor (comp, options) {
  12822. options = parseOptions(options)
  12823. if (comp instanceof Comparator) {
  12824. if (comp.loose === !!options.loose) {
  12825. return comp
  12826. } else {
  12827. comp = comp.value
  12828. }
  12829. }
  12830. debug('comparator', comp, options)
  12831. this.options = options
  12832. this.loose = !!options.loose
  12833. this.parse(comp)
  12834. if (this.semver === ANY) {
  12835. this.value = ''
  12836. } else {
  12837. this.value = this.operator + this.semver.version
  12838. }
  12839. debug('comp', this)
  12840. }
  12841. parse (comp) {
  12842. const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
  12843. const m = comp.match(r)
  12844. if (!m) {
  12845. throw new TypeError(`Invalid comparator: ${comp}`)
  12846. }
  12847. this.operator = m[1] !== undefined ? m[1] : ''
  12848. if (this.operator === '=') {
  12849. this.operator = ''
  12850. }
  12851. // if it literally is just '>' or '' then allow anything.
  12852. if (!m[2]) {
  12853. this.semver = ANY
  12854. } else {
  12855. this.semver = new SemVer(m[2], this.options.loose)
  12856. }
  12857. }
  12858. toString () {
  12859. return this.value
  12860. }
  12861. test (version) {
  12862. debug('Comparator.test', version, this.options.loose)
  12863. if (this.semver === ANY || version === ANY) {
  12864. return true
  12865. }
  12866. if (typeof version === 'string') {
  12867. try {
  12868. version = new SemVer(version, this.options)
  12869. } catch (er) {
  12870. return false
  12871. }
  12872. }
  12873. return cmp(version, this.operator, this.semver, this.options)
  12874. }
  12875. intersects (comp, options) {
  12876. if (!(comp instanceof Comparator)) {
  12877. throw new TypeError('a Comparator is required')
  12878. }
  12879. if (!options || typeof options !== 'object') {
  12880. options = {
  12881. loose: !!options,
  12882. includePrerelease: false
  12883. }
  12884. }
  12885. if (this.operator === '') {
  12886. if (this.value === '') {
  12887. return true
  12888. }
  12889. return new Range(comp.value, options).test(this.value)
  12890. } else if (comp.operator === '') {
  12891. if (comp.value === '') {
  12892. return true
  12893. }
  12894. return new Range(this.value, options).test(comp.semver)
  12895. }
  12896. const sameDirectionIncreasing =
  12897. (this.operator === '>=' || this.operator === '>') &&
  12898. (comp.operator === '>=' || comp.operator === '>')
  12899. const sameDirectionDecreasing =
  12900. (this.operator === '<=' || this.operator === '<') &&
  12901. (comp.operator === '<=' || comp.operator === '<')
  12902. const sameSemVer = this.semver.version === comp.semver.version
  12903. const differentDirectionsInclusive =
  12904. (this.operator === '>=' || this.operator === '<=') &&
  12905. (comp.operator === '>=' || comp.operator === '<=')
  12906. const oppositeDirectionsLessThan =
  12907. cmp(this.semver, '<', comp.semver, options) &&
  12908. (this.operator === '>=' || this.operator === '>') &&
  12909. (comp.operator === '<=' || comp.operator === '<')
  12910. const oppositeDirectionsGreaterThan =
  12911. cmp(this.semver, '>', comp.semver, options) &&
  12912. (this.operator === '<=' || this.operator === '<') &&
  12913. (comp.operator === '>=' || comp.operator === '>')
  12914. return (
  12915. sameDirectionIncreasing ||
  12916. sameDirectionDecreasing ||
  12917. (sameSemVer && differentDirectionsInclusive) ||
  12918. oppositeDirectionsLessThan ||
  12919. oppositeDirectionsGreaterThan
  12920. )
  12921. }
  12922. }
  12923. module.exports = Comparator
  12924. const parseOptions = __webpack_require__(26084)
  12925. const {re, t} = __webpack_require__(50487)
  12926. const cmp = __webpack_require__(16378)
  12927. const debug = __webpack_require__(96738)
  12928. const SemVer = __webpack_require__(39541)
  12929. const Range = __webpack_require__(93031)
  12930. /***/ }),
  12931. /***/ 93031:
  12932. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  12933. // hoisted class for cyclic dependency
  12934. class Range {
  12935. constructor (range, options) {
  12936. options = parseOptions(options)
  12937. if (range instanceof Range) {
  12938. if (
  12939. range.loose === !!options.loose &&
  12940. range.includePrerelease === !!options.includePrerelease
  12941. ) {
  12942. return range
  12943. } else {
  12944. return new Range(range.raw, options)
  12945. }
  12946. }
  12947. if (range instanceof Comparator) {
  12948. // just put it in the set and return
  12949. this.raw = range.value
  12950. this.set = [[range]]
  12951. this.format()
  12952. return this
  12953. }
  12954. this.options = options
  12955. this.loose = !!options.loose
  12956. this.includePrerelease = !!options.includePrerelease
  12957. // First, split based on boolean or ||
  12958. this.raw = range
  12959. this.set = range
  12960. .split(/\s*\|\|\s*/)
  12961. // map the range to a 2d array of comparators
  12962. .map(range => this.parseRange(range.trim()))
  12963. // throw out any comparator lists that are empty
  12964. // this generally means that it was not a valid range, which is allowed
  12965. // in loose mode, but will still throw if the WHOLE range is invalid.
  12966. .filter(c => c.length)
  12967. if (!this.set.length) {
  12968. throw new TypeError(`Invalid SemVer Range: ${range}`)
  12969. }
  12970. // if we have any that are not the null set, throw out null sets.
  12971. if (this.set.length > 1) {
  12972. // keep the first one, in case they're all null sets
  12973. const first = this.set[0]
  12974. this.set = this.set.filter(c => !isNullSet(c[0]))
  12975. if (this.set.length === 0)
  12976. this.set = [first]
  12977. else if (this.set.length > 1) {
  12978. // if we have any that are *, then the range is just *
  12979. for (const c of this.set) {
  12980. if (c.length === 1 && isAny(c[0])) {
  12981. this.set = [c]
  12982. break
  12983. }
  12984. }
  12985. }
  12986. }
  12987. this.format()
  12988. }
  12989. format () {
  12990. this.range = this.set
  12991. .map((comps) => {
  12992. return comps.join(' ').trim()
  12993. })
  12994. .join('||')
  12995. .trim()
  12996. return this.range
  12997. }
  12998. toString () {
  12999. return this.range
  13000. }
  13001. parseRange (range) {
  13002. range = range.trim()
  13003. // memoize range parsing for performance.
  13004. // this is a very hot path, and fully deterministic.
  13005. const memoOpts = Object.keys(this.options).join(',')
  13006. const memoKey = `parseRange:${memoOpts}:${range}`
  13007. const cached = cache.get(memoKey)
  13008. if (cached)
  13009. return cached
  13010. const loose = this.options.loose
  13011. // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
  13012. const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]
  13013. range = range.replace(hr, hyphenReplace(this.options.includePrerelease))
  13014. debug('hyphen replace', range)
  13015. // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
  13016. range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)
  13017. debug('comparator trim', range, re[t.COMPARATORTRIM])
  13018. // `~ 1.2.3` => `~1.2.3`
  13019. range = range.replace(re[t.TILDETRIM], tildeTrimReplace)
  13020. // `^ 1.2.3` => `^1.2.3`
  13021. range = range.replace(re[t.CARETTRIM], caretTrimReplace)
  13022. // normalize spaces
  13023. range = range.split(/\s+/).join(' ')
  13024. // At this point, the range is completely trimmed and
  13025. // ready to be split into comparators.
  13026. const compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
  13027. const rangeList = range
  13028. .split(' ')
  13029. .map(comp => parseComparator(comp, this.options))
  13030. .join(' ')
  13031. .split(/\s+/)
  13032. // >=0.0.0 is equivalent to *
  13033. .map(comp => replaceGTE0(comp, this.options))
  13034. // in loose mode, throw out any that are not valid comparators
  13035. .filter(this.options.loose ? comp => !!comp.match(compRe) : () => true)
  13036. .map(comp => new Comparator(comp, this.options))
  13037. // if any comparators are the null set, then replace with JUST null set
  13038. // if more than one comparator, remove any * comparators
  13039. // also, don't include the same comparator more than once
  13040. const l = rangeList.length
  13041. const rangeMap = new Map()
  13042. for (const comp of rangeList) {
  13043. if (isNullSet(comp))
  13044. return [comp]
  13045. rangeMap.set(comp.value, comp)
  13046. }
  13047. if (rangeMap.size > 1 && rangeMap.has(''))
  13048. rangeMap.delete('')
  13049. const result = [...rangeMap.values()]
  13050. cache.set(memoKey, result)
  13051. return result
  13052. }
  13053. intersects (range, options) {
  13054. if (!(range instanceof Range)) {
  13055. throw new TypeError('a Range is required')
  13056. }
  13057. return this.set.some((thisComparators) => {
  13058. return (
  13059. isSatisfiable(thisComparators, options) &&
  13060. range.set.some((rangeComparators) => {
  13061. return (
  13062. isSatisfiable(rangeComparators, options) &&
  13063. thisComparators.every((thisComparator) => {
  13064. return rangeComparators.every((rangeComparator) => {
  13065. return thisComparator.intersects(rangeComparator, options)
  13066. })
  13067. })
  13068. )
  13069. })
  13070. )
  13071. })
  13072. }
  13073. // if ANY of the sets match ALL of its comparators, then pass
  13074. test (version) {
  13075. if (!version) {
  13076. return false
  13077. }
  13078. if (typeof version === 'string') {
  13079. try {
  13080. version = new SemVer(version, this.options)
  13081. } catch (er) {
  13082. return false
  13083. }
  13084. }
  13085. for (let i = 0; i < this.set.length; i++) {
  13086. if (testSet(this.set[i], version, this.options)) {
  13087. return true
  13088. }
  13089. }
  13090. return false
  13091. }
  13092. }
  13093. module.exports = Range
  13094. const LRU = __webpack_require__(89006)
  13095. const cache = new LRU({ max: 1000 })
  13096. const parseOptions = __webpack_require__(26084)
  13097. const Comparator = __webpack_require__(60054)
  13098. const debug = __webpack_require__(96738)
  13099. const SemVer = __webpack_require__(39541)
  13100. const {
  13101. re,
  13102. t,
  13103. comparatorTrimReplace,
  13104. tildeTrimReplace,
  13105. caretTrimReplace
  13106. } = __webpack_require__(50487)
  13107. const isNullSet = c => c.value === '<0.0.0-0'
  13108. const isAny = c => c.value === ''
  13109. // take a set of comparators and determine whether there
  13110. // exists a version which can satisfy it
  13111. const isSatisfiable = (comparators, options) => {
  13112. let result = true
  13113. const remainingComparators = comparators.slice()
  13114. let testComparator = remainingComparators.pop()
  13115. while (result && remainingComparators.length) {
  13116. result = remainingComparators.every((otherComparator) => {
  13117. return testComparator.intersects(otherComparator, options)
  13118. })
  13119. testComparator = remainingComparators.pop()
  13120. }
  13121. return result
  13122. }
  13123. // comprised of xranges, tildes, stars, and gtlt's at this point.
  13124. // already replaced the hyphen ranges
  13125. // turn into a set of JUST comparators.
  13126. const parseComparator = (comp, options) => {
  13127. debug('comp', comp, options)
  13128. comp = replaceCarets(comp, options)
  13129. debug('caret', comp)
  13130. comp = replaceTildes(comp, options)
  13131. debug('tildes', comp)
  13132. comp = replaceXRanges(comp, options)
  13133. debug('xrange', comp)
  13134. comp = replaceStars(comp, options)
  13135. debug('stars', comp)
  13136. return comp
  13137. }
  13138. const isX = id => !id || id.toLowerCase() === 'x' || id === '*'
  13139. // ~, ~> --> * (any, kinda silly)
  13140. // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
  13141. // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
  13142. // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
  13143. // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
  13144. // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
  13145. const replaceTildes = (comp, options) =>
  13146. comp.trim().split(/\s+/).map((comp) => {
  13147. return replaceTilde(comp, options)
  13148. }).join(' ')
  13149. const replaceTilde = (comp, options) => {
  13150. const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]
  13151. return comp.replace(r, (_, M, m, p, pr) => {
  13152. debug('tilde', comp, _, M, m, p, pr)
  13153. let ret
  13154. if (isX(M)) {
  13155. ret = ''
  13156. } else if (isX(m)) {
  13157. ret = `>=${M}.0.0 <${+M + 1}.0.0-0`
  13158. } else if (isX(p)) {
  13159. // ~1.2 == >=1.2.0 <1.3.0-0
  13160. ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`
  13161. } else if (pr) {
  13162. debug('replaceTilde pr', pr)
  13163. ret = `>=${M}.${m}.${p}-${pr
  13164. } <${M}.${+m + 1}.0-0`
  13165. } else {
  13166. // ~1.2.3 == >=1.2.3 <1.3.0-0
  13167. ret = `>=${M}.${m}.${p
  13168. } <${M}.${+m + 1}.0-0`
  13169. }
  13170. debug('tilde return', ret)
  13171. return ret
  13172. })
  13173. }
  13174. // ^ --> * (any, kinda silly)
  13175. // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
  13176. // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
  13177. // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
  13178. // ^1.2.3 --> >=1.2.3 <2.0.0-0
  13179. // ^1.2.0 --> >=1.2.0 <2.0.0-0
  13180. const replaceCarets = (comp, options) =>
  13181. comp.trim().split(/\s+/).map((comp) => {
  13182. return replaceCaret(comp, options)
  13183. }).join(' ')
  13184. const replaceCaret = (comp, options) => {
  13185. debug('caret', comp, options)
  13186. const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]
  13187. const z = options.includePrerelease ? '-0' : ''
  13188. return comp.replace(r, (_, M, m, p, pr) => {
  13189. debug('caret', comp, _, M, m, p, pr)
  13190. let ret
  13191. if (isX(M)) {
  13192. ret = ''
  13193. } else if (isX(m)) {
  13194. ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`
  13195. } else if (isX(p)) {
  13196. if (M === '0') {
  13197. ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`
  13198. } else {
  13199. ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`
  13200. }
  13201. } else if (pr) {
  13202. debug('replaceCaret pr', pr)
  13203. if (M === '0') {
  13204. if (m === '0') {
  13205. ret = `>=${M}.${m}.${p}-${pr
  13206. } <${M}.${m}.${+p + 1}-0`
  13207. } else {
  13208. ret = `>=${M}.${m}.${p}-${pr
  13209. } <${M}.${+m + 1}.0-0`
  13210. }
  13211. } else {
  13212. ret = `>=${M}.${m}.${p}-${pr
  13213. } <${+M + 1}.0.0-0`
  13214. }
  13215. } else {
  13216. debug('no pr')
  13217. if (M === '0') {
  13218. if (m === '0') {
  13219. ret = `>=${M}.${m}.${p
  13220. }${z} <${M}.${m}.${+p + 1}-0`
  13221. } else {
  13222. ret = `>=${M}.${m}.${p
  13223. }${z} <${M}.${+m + 1}.0-0`
  13224. }
  13225. } else {
  13226. ret = `>=${M}.${m}.${p
  13227. } <${+M + 1}.0.0-0`
  13228. }
  13229. }
  13230. debug('caret return', ret)
  13231. return ret
  13232. })
  13233. }
  13234. const replaceXRanges = (comp, options) => {
  13235. debug('replaceXRanges', comp, options)
  13236. return comp.split(/\s+/).map((comp) => {
  13237. return replaceXRange(comp, options)
  13238. }).join(' ')
  13239. }
  13240. const replaceXRange = (comp, options) => {
  13241. comp = comp.trim()
  13242. const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]
  13243. return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
  13244. debug('xRange', comp, ret, gtlt, M, m, p, pr)
  13245. const xM = isX(M)
  13246. const xm = xM || isX(m)
  13247. const xp = xm || isX(p)
  13248. const anyX = xp
  13249. if (gtlt === '=' && anyX) {
  13250. gtlt = ''
  13251. }
  13252. // if we're including prereleases in the match, then we need
  13253. // to fix this to -0, the lowest possible prerelease value
  13254. pr = options.includePrerelease ? '-0' : ''
  13255. if (xM) {
  13256. if (gtlt === '>' || gtlt === '<') {
  13257. // nothing is allowed
  13258. ret = '<0.0.0-0'
  13259. } else {
  13260. // nothing is forbidden
  13261. ret = '*'
  13262. }
  13263. } else if (gtlt && anyX) {
  13264. // we know patch is an x, because we have any x at all.
  13265. // replace X with 0
  13266. if (xm) {
  13267. m = 0
  13268. }
  13269. p = 0
  13270. if (gtlt === '>') {
  13271. // >1 => >=2.0.0
  13272. // >1.2 => >=1.3.0
  13273. gtlt = '>='
  13274. if (xm) {
  13275. M = +M + 1
  13276. m = 0
  13277. p = 0
  13278. } else {
  13279. m = +m + 1
  13280. p = 0
  13281. }
  13282. } else if (gtlt === '<=') {
  13283. // <=0.7.x is actually <0.8.0, since any 0.7.x should
  13284. // pass. Similarly, <=7.x is actually <8.0.0, etc.
  13285. gtlt = '<'
  13286. if (xm) {
  13287. M = +M + 1
  13288. } else {
  13289. m = +m + 1
  13290. }
  13291. }
  13292. if (gtlt === '<')
  13293. pr = '-0'
  13294. ret = `${gtlt + M}.${m}.${p}${pr}`
  13295. } else if (xm) {
  13296. ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`
  13297. } else if (xp) {
  13298. ret = `>=${M}.${m}.0${pr
  13299. } <${M}.${+m + 1}.0-0`
  13300. }
  13301. debug('xRange return', ret)
  13302. return ret
  13303. })
  13304. }
  13305. // Because * is AND-ed with everything else in the comparator,
  13306. // and '' means "any version", just remove the *s entirely.
  13307. const replaceStars = (comp, options) => {
  13308. debug('replaceStars', comp, options)
  13309. // Looseness is ignored here. star is always as loose as it gets!
  13310. return comp.trim().replace(re[t.STAR], '')
  13311. }
  13312. const replaceGTE0 = (comp, options) => {
  13313. debug('replaceGTE0', comp, options)
  13314. return comp.trim()
  13315. .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')
  13316. }
  13317. // This function is passed to string.replace(re[t.HYPHENRANGE])
  13318. // M, m, patch, prerelease, build
  13319. // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
  13320. // 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
  13321. // 1.2 - 3.4 => >=1.2.0 <3.5.0-0
  13322. const hyphenReplace = incPr => ($0,
  13323. from, fM, fm, fp, fpr, fb,
  13324. to, tM, tm, tp, tpr, tb) => {
  13325. if (isX(fM)) {
  13326. from = ''
  13327. } else if (isX(fm)) {
  13328. from = `>=${fM}.0.0${incPr ? '-0' : ''}`
  13329. } else if (isX(fp)) {
  13330. from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`
  13331. } else if (fpr) {
  13332. from = `>=${from}`
  13333. } else {
  13334. from = `>=${from}${incPr ? '-0' : ''}`
  13335. }
  13336. if (isX(tM)) {
  13337. to = ''
  13338. } else if (isX(tm)) {
  13339. to = `<${+tM + 1}.0.0-0`
  13340. } else if (isX(tp)) {
  13341. to = `<${tM}.${+tm + 1}.0-0`
  13342. } else if (tpr) {
  13343. to = `<=${tM}.${tm}.${tp}-${tpr}`
  13344. } else if (incPr) {
  13345. to = `<${tM}.${tm}.${+tp + 1}-0`
  13346. } else {
  13347. to = `<=${to}`
  13348. }
  13349. return (`${from} ${to}`).trim()
  13350. }
  13351. const testSet = (set, version, options) => {
  13352. for (let i = 0; i < set.length; i++) {
  13353. if (!set[i].test(version)) {
  13354. return false
  13355. }
  13356. }
  13357. if (version.prerelease.length && !options.includePrerelease) {
  13358. // Find the set of versions that are allowed to have prereleases
  13359. // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
  13360. // That should allow `1.2.3-pr.2` to pass.
  13361. // However, `1.2.4-alpha.notready` should NOT be allowed,
  13362. // even though it's within the range set by the comparators.
  13363. for (let i = 0; i < set.length; i++) {
  13364. debug(set[i].semver)
  13365. if (set[i].semver === Comparator.ANY) {
  13366. continue
  13367. }
  13368. if (set[i].semver.prerelease.length > 0) {
  13369. const allowed = set[i].semver
  13370. if (allowed.major === version.major &&
  13371. allowed.minor === version.minor &&
  13372. allowed.patch === version.patch) {
  13373. return true
  13374. }
  13375. }
  13376. }
  13377. // Version has a -pre, but it's not one of the ones we like.
  13378. return false
  13379. }
  13380. return true
  13381. }
  13382. /***/ }),
  13383. /***/ 39541:
  13384. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  13385. const debug = __webpack_require__(96738)
  13386. const { MAX_LENGTH, MAX_SAFE_INTEGER } = __webpack_require__(34504)
  13387. const { re, t } = __webpack_require__(50487)
  13388. const parseOptions = __webpack_require__(26084)
  13389. const { compareIdentifiers } = __webpack_require__(37686)
  13390. class SemVer {
  13391. constructor (version, options) {
  13392. options = parseOptions(options)
  13393. if (version instanceof SemVer) {
  13394. if (version.loose === !!options.loose &&
  13395. version.includePrerelease === !!options.includePrerelease) {
  13396. return version
  13397. } else {
  13398. version = version.version
  13399. }
  13400. } else if (typeof version !== 'string') {
  13401. throw new TypeError(`Invalid Version: ${version}`)
  13402. }
  13403. if (version.length > MAX_LENGTH) {
  13404. throw new TypeError(
  13405. `version is longer than ${MAX_LENGTH} characters`
  13406. )
  13407. }
  13408. debug('SemVer', version, options)
  13409. this.options = options
  13410. this.loose = !!options.loose
  13411. // this isn't actually relevant for versions, but keep it so that we
  13412. // don't run into trouble passing this.options around.
  13413. this.includePrerelease = !!options.includePrerelease
  13414. const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])
  13415. if (!m) {
  13416. throw new TypeError(`Invalid Version: ${version}`)
  13417. }
  13418. this.raw = version
  13419. // these are actually numbers
  13420. this.major = +m[1]
  13421. this.minor = +m[2]
  13422. this.patch = +m[3]
  13423. if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
  13424. throw new TypeError('Invalid major version')
  13425. }
  13426. if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
  13427. throw new TypeError('Invalid minor version')
  13428. }
  13429. if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
  13430. throw new TypeError('Invalid patch version')
  13431. }
  13432. // numberify any prerelease numeric ids
  13433. if (!m[4]) {
  13434. this.prerelease = []
  13435. } else {
  13436. this.prerelease = m[4].split('.').map((id) => {
  13437. if (/^[0-9]+$/.test(id)) {
  13438. const num = +id
  13439. if (num >= 0 && num < MAX_SAFE_INTEGER) {
  13440. return num
  13441. }
  13442. }
  13443. return id
  13444. })
  13445. }
  13446. this.build = m[5] ? m[5].split('.') : []
  13447. this.format()
  13448. }
  13449. format () {
  13450. this.version = `${this.major}.${this.minor}.${this.patch}`
  13451. if (this.prerelease.length) {
  13452. this.version += `-${this.prerelease.join('.')}`
  13453. }
  13454. return this.version
  13455. }
  13456. toString () {
  13457. return this.version
  13458. }
  13459. compare (other) {
  13460. debug('SemVer.compare', this.version, this.options, other)
  13461. if (!(other instanceof SemVer)) {
  13462. if (typeof other === 'string' && other === this.version) {
  13463. return 0
  13464. }
  13465. other = new SemVer(other, this.options)
  13466. }
  13467. if (other.version === this.version) {
  13468. return 0
  13469. }
  13470. return this.compareMain(other) || this.comparePre(other)
  13471. }
  13472. compareMain (other) {
  13473. if (!(other instanceof SemVer)) {
  13474. other = new SemVer(other, this.options)
  13475. }
  13476. return (
  13477. compareIdentifiers(this.major, other.major) ||
  13478. compareIdentifiers(this.minor, other.minor) ||
  13479. compareIdentifiers(this.patch, other.patch)
  13480. )
  13481. }
  13482. comparePre (other) {
  13483. if (!(other instanceof SemVer)) {
  13484. other = new SemVer(other, this.options)
  13485. }
  13486. // NOT having a prerelease is > having one
  13487. if (this.prerelease.length && !other.prerelease.length) {
  13488. return -1
  13489. } else if (!this.prerelease.length && other.prerelease.length) {
  13490. return 1
  13491. } else if (!this.prerelease.length && !other.prerelease.length) {
  13492. return 0
  13493. }
  13494. let i = 0
  13495. do {
  13496. const a = this.prerelease[i]
  13497. const b = other.prerelease[i]
  13498. debug('prerelease compare', i, a, b)
  13499. if (a === undefined && b === undefined) {
  13500. return 0
  13501. } else if (b === undefined) {
  13502. return 1
  13503. } else if (a === undefined) {
  13504. return -1
  13505. } else if (a === b) {
  13506. continue
  13507. } else {
  13508. return compareIdentifiers(a, b)
  13509. }
  13510. } while (++i)
  13511. }
  13512. compareBuild (other) {
  13513. if (!(other instanceof SemVer)) {
  13514. other = new SemVer(other, this.options)
  13515. }
  13516. let i = 0
  13517. do {
  13518. const a = this.build[i]
  13519. const b = other.build[i]
  13520. debug('prerelease compare', i, a, b)
  13521. if (a === undefined && b === undefined) {
  13522. return 0
  13523. } else if (b === undefined) {
  13524. return 1
  13525. } else if (a === undefined) {
  13526. return -1
  13527. } else if (a === b) {
  13528. continue
  13529. } else {
  13530. return compareIdentifiers(a, b)
  13531. }
  13532. } while (++i)
  13533. }
  13534. // preminor will bump the version up to the next minor release, and immediately
  13535. // down to pre-release. premajor and prepatch work the same way.
  13536. inc (release, identifier) {
  13537. switch (release) {
  13538. case 'premajor':
  13539. this.prerelease.length = 0
  13540. this.patch = 0
  13541. this.minor = 0
  13542. this.major++
  13543. this.inc('pre', identifier)
  13544. break
  13545. case 'preminor':
  13546. this.prerelease.length = 0
  13547. this.patch = 0
  13548. this.minor++
  13549. this.inc('pre', identifier)
  13550. break
  13551. case 'prepatch':
  13552. // If this is already a prerelease, it will bump to the next version
  13553. // drop any prereleases that might already exist, since they are not
  13554. // relevant at this point.
  13555. this.prerelease.length = 0
  13556. this.inc('patch', identifier)
  13557. this.inc('pre', identifier)
  13558. break
  13559. // If the input is a non-prerelease version, this acts the same as
  13560. // prepatch.
  13561. case 'prerelease':
  13562. if (this.prerelease.length === 0) {
  13563. this.inc('patch', identifier)
  13564. }
  13565. this.inc('pre', identifier)
  13566. break
  13567. case 'major':
  13568. // If this is a pre-major version, bump up to the same major version.
  13569. // Otherwise increment major.
  13570. // 1.0.0-5 bumps to 1.0.0
  13571. // 1.1.0 bumps to 2.0.0
  13572. if (
  13573. this.minor !== 0 ||
  13574. this.patch !== 0 ||
  13575. this.prerelease.length === 0
  13576. ) {
  13577. this.major++
  13578. }
  13579. this.minor = 0
  13580. this.patch = 0
  13581. this.prerelease = []
  13582. break
  13583. case 'minor':
  13584. // If this is a pre-minor version, bump up to the same minor version.
  13585. // Otherwise increment minor.
  13586. // 1.2.0-5 bumps to 1.2.0
  13587. // 1.2.1 bumps to 1.3.0
  13588. if (this.patch !== 0 || this.prerelease.length === 0) {
  13589. this.minor++
  13590. }
  13591. this.patch = 0
  13592. this.prerelease = []
  13593. break
  13594. case 'patch':
  13595. // If this is not a pre-release version, it will increment the patch.
  13596. // If it is a pre-release it will bump up to the same patch version.
  13597. // 1.2.0-5 patches to 1.2.0
  13598. // 1.2.0 patches to 1.2.1
  13599. if (this.prerelease.length === 0) {
  13600. this.patch++
  13601. }
  13602. this.prerelease = []
  13603. break
  13604. // This probably shouldn't be used publicly.
  13605. // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
  13606. case 'pre':
  13607. if (this.prerelease.length === 0) {
  13608. this.prerelease = [0]
  13609. } else {
  13610. let i = this.prerelease.length
  13611. while (--i >= 0) {
  13612. if (typeof this.prerelease[i] === 'number') {
  13613. this.prerelease[i]++
  13614. i = -2
  13615. }
  13616. }
  13617. if (i === -1) {
  13618. // didn't increment anything
  13619. this.prerelease.push(0)
  13620. }
  13621. }
  13622. if (identifier) {
  13623. // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
  13624. // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
  13625. if (this.prerelease[0] === identifier) {
  13626. if (isNaN(this.prerelease[1])) {
  13627. this.prerelease = [identifier, 0]
  13628. }
  13629. } else {
  13630. this.prerelease = [identifier, 0]
  13631. }
  13632. }
  13633. break
  13634. default:
  13635. throw new Error(`invalid increment argument: ${release}`)
  13636. }
  13637. this.format()
  13638. this.raw = this.version
  13639. return this
  13640. }
  13641. }
  13642. module.exports = SemVer
  13643. /***/ }),
  13644. /***/ 8870:
  13645. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  13646. const parse = __webpack_require__(54847)
  13647. const clean = (version, options) => {
  13648. const s = parse(version.trim().replace(/^[=v]+/, ''), options)
  13649. return s ? s.version : null
  13650. }
  13651. module.exports = clean
  13652. /***/ }),
  13653. /***/ 16378:
  13654. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  13655. const eq = __webpack_require__(95576)
  13656. const neq = __webpack_require__(98836)
  13657. const gt = __webpack_require__(84021)
  13658. const gte = __webpack_require__(39747)
  13659. const lt = __webpack_require__(72680)
  13660. const lte = __webpack_require__(26223)
  13661. const cmp = (a, op, b, loose) => {
  13662. switch (op) {
  13663. case '===':
  13664. if (typeof a === 'object')
  13665. a = a.version
  13666. if (typeof b === 'object')
  13667. b = b.version
  13668. return a === b
  13669. case '!==':
  13670. if (typeof a === 'object')
  13671. a = a.version
  13672. if (typeof b === 'object')
  13673. b = b.version
  13674. return a !== b
  13675. case '':
  13676. case '=':
  13677. case '==':
  13678. return eq(a, b, loose)
  13679. case '!=':
  13680. return neq(a, b, loose)
  13681. case '>':
  13682. return gt(a, b, loose)
  13683. case '>=':
  13684. return gte(a, b, loose)
  13685. case '<':
  13686. return lt(a, b, loose)
  13687. case '<=':
  13688. return lte(a, b, loose)
  13689. default:
  13690. throw new TypeError(`Invalid operator: ${op}`)
  13691. }
  13692. }
  13693. module.exports = cmp
  13694. /***/ }),
  13695. /***/ 35195:
  13696. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  13697. const SemVer = __webpack_require__(39541)
  13698. const parse = __webpack_require__(54847)
  13699. const {re, t} = __webpack_require__(50487)
  13700. const coerce = (version, options) => {
  13701. if (version instanceof SemVer) {
  13702. return version
  13703. }
  13704. if (typeof version === 'number') {
  13705. version = String(version)
  13706. }
  13707. if (typeof version !== 'string') {
  13708. return null
  13709. }
  13710. options = options || {}
  13711. let match = null
  13712. if (!options.rtl) {
  13713. match = version.match(re[t.COERCE])
  13714. } else {
  13715. // Find the right-most coercible string that does not share
  13716. // a terminus with a more left-ward coercible string.
  13717. // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
  13718. //
  13719. // Walk through the string checking with a /g regexp
  13720. // Manually set the index so as to pick up overlapping matches.
  13721. // Stop when we get a match that ends at the string end, since no
  13722. // coercible string can be more right-ward without the same terminus.
  13723. let next
  13724. while ((next = re[t.COERCERTL].exec(version)) &&
  13725. (!match || match.index + match[0].length !== version.length)
  13726. ) {
  13727. if (!match ||
  13728. next.index + next[0].length !== match.index + match[0].length) {
  13729. match = next
  13730. }
  13731. re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length
  13732. }
  13733. // leave it in a clean state
  13734. re[t.COERCERTL].lastIndex = -1
  13735. }
  13736. if (match === null)
  13737. return null
  13738. return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options)
  13739. }
  13740. module.exports = coerce
  13741. /***/ }),
  13742. /***/ 93668:
  13743. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  13744. const SemVer = __webpack_require__(39541)
  13745. const compareBuild = (a, b, loose) => {
  13746. const versionA = new SemVer(a, loose)
  13747. const versionB = new SemVer(b, loose)
  13748. return versionA.compare(versionB) || versionA.compareBuild(versionB)
  13749. }
  13750. module.exports = compareBuild
  13751. /***/ }),
  13752. /***/ 80796:
  13753. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  13754. const compare = __webpack_require__(28929)
  13755. const compareLoose = (a, b) => compare(a, b, true)
  13756. module.exports = compareLoose
  13757. /***/ }),
  13758. /***/ 28929:
  13759. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  13760. const SemVer = __webpack_require__(39541)
  13761. const compare = (a, b, loose) =>
  13762. new SemVer(a, loose).compare(new SemVer(b, loose))
  13763. module.exports = compare
  13764. /***/ }),
  13765. /***/ 36131:
  13766. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  13767. const parse = __webpack_require__(54847)
  13768. const eq = __webpack_require__(95576)
  13769. const diff = (version1, version2) => {
  13770. if (eq(version1, version2)) {
  13771. return null
  13772. } else {
  13773. const v1 = parse(version1)
  13774. const v2 = parse(version2)
  13775. const hasPre = v1.prerelease.length || v2.prerelease.length
  13776. const prefix = hasPre ? 'pre' : ''
  13777. const defaultResult = hasPre ? 'prerelease' : ''
  13778. for (const key in v1) {
  13779. if (key === 'major' || key === 'minor' || key === 'patch') {
  13780. if (v1[key] !== v2[key]) {
  13781. return prefix + key
  13782. }
  13783. }
  13784. }
  13785. return defaultResult // may be undefined
  13786. }
  13787. }
  13788. module.exports = diff
  13789. /***/ }),
  13790. /***/ 95576:
  13791. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  13792. const compare = __webpack_require__(28929)
  13793. const eq = (a, b, loose) => compare(a, b, loose) === 0
  13794. module.exports = eq
  13795. /***/ }),
  13796. /***/ 84021:
  13797. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  13798. const compare = __webpack_require__(28929)
  13799. const gt = (a, b, loose) => compare(a, b, loose) > 0
  13800. module.exports = gt
  13801. /***/ }),
  13802. /***/ 39747:
  13803. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  13804. const compare = __webpack_require__(28929)
  13805. const gte = (a, b, loose) => compare(a, b, loose) >= 0
  13806. module.exports = gte
  13807. /***/ }),
  13808. /***/ 10127:
  13809. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  13810. const SemVer = __webpack_require__(39541)
  13811. const inc = (version, release, options, identifier) => {
  13812. if (typeof (options) === 'string') {
  13813. identifier = options
  13814. options = undefined
  13815. }
  13816. try {
  13817. return new SemVer(version, options).inc(release, identifier).version
  13818. } catch (er) {
  13819. return null
  13820. }
  13821. }
  13822. module.exports = inc
  13823. /***/ }),
  13824. /***/ 72680:
  13825. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  13826. const compare = __webpack_require__(28929)
  13827. const lt = (a, b, loose) => compare(a, b, loose) < 0
  13828. module.exports = lt
  13829. /***/ }),
  13830. /***/ 26223:
  13831. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  13832. const compare = __webpack_require__(28929)
  13833. const lte = (a, b, loose) => compare(a, b, loose) <= 0
  13834. module.exports = lte
  13835. /***/ }),
  13836. /***/ 70957:
  13837. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  13838. const SemVer = __webpack_require__(39541)
  13839. const major = (a, loose) => new SemVer(a, loose).major
  13840. module.exports = major
  13841. /***/ }),
  13842. /***/ 15122:
  13843. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  13844. const SemVer = __webpack_require__(39541)
  13845. const minor = (a, loose) => new SemVer(a, loose).minor
  13846. module.exports = minor
  13847. /***/ }),
  13848. /***/ 98836:
  13849. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  13850. const compare = __webpack_require__(28929)
  13851. const neq = (a, b, loose) => compare(a, b, loose) !== 0
  13852. module.exports = neq
  13853. /***/ }),
  13854. /***/ 54847:
  13855. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  13856. const {MAX_LENGTH} = __webpack_require__(34504)
  13857. const { re, t } = __webpack_require__(50487)
  13858. const SemVer = __webpack_require__(39541)
  13859. const parseOptions = __webpack_require__(26084)
  13860. const parse = (version, options) => {
  13861. options = parseOptions(options)
  13862. if (version instanceof SemVer) {
  13863. return version
  13864. }
  13865. if (typeof version !== 'string') {
  13866. return null
  13867. }
  13868. if (version.length > MAX_LENGTH) {
  13869. return null
  13870. }
  13871. const r = options.loose ? re[t.LOOSE] : re[t.FULL]
  13872. if (!r.test(version)) {
  13873. return null
  13874. }
  13875. try {
  13876. return new SemVer(version, options)
  13877. } catch (er) {
  13878. return null
  13879. }
  13880. }
  13881. module.exports = parse
  13882. /***/ }),
  13883. /***/ 61100:
  13884. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  13885. const SemVer = __webpack_require__(39541)
  13886. const patch = (a, loose) => new SemVer(a, loose).patch
  13887. module.exports = patch
  13888. /***/ }),
  13889. /***/ 68761:
  13890. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  13891. const parse = __webpack_require__(54847)
  13892. const prerelease = (version, options) => {
  13893. const parsed = parse(version, options)
  13894. return (parsed && parsed.prerelease.length) ? parsed.prerelease : null
  13895. }
  13896. module.exports = prerelease
  13897. /***/ }),
  13898. /***/ 15444:
  13899. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  13900. const compare = __webpack_require__(28929)
  13901. const rcompare = (a, b, loose) => compare(b, a, loose)
  13902. module.exports = rcompare
  13903. /***/ }),
  13904. /***/ 58354:
  13905. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  13906. const compareBuild = __webpack_require__(93668)
  13907. const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose))
  13908. module.exports = rsort
  13909. /***/ }),
  13910. /***/ 76973:
  13911. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  13912. const Range = __webpack_require__(93031)
  13913. const satisfies = (version, range, options) => {
  13914. try {
  13915. range = new Range(range, options)
  13916. } catch (er) {
  13917. return false
  13918. }
  13919. return range.test(version)
  13920. }
  13921. module.exports = satisfies
  13922. /***/ }),
  13923. /***/ 84499:
  13924. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  13925. const compareBuild = __webpack_require__(93668)
  13926. const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose))
  13927. module.exports = sort
  13928. /***/ }),
  13929. /***/ 26109:
  13930. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  13931. const parse = __webpack_require__(54847)
  13932. const valid = (version, options) => {
  13933. const v = parse(version, options)
  13934. return v ? v.version : null
  13935. }
  13936. module.exports = valid
  13937. /***/ }),
  13938. /***/ 23382:
  13939. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  13940. // just pre-load all the stuff that index.js lazily exports
  13941. const internalRe = __webpack_require__(50487)
  13942. module.exports = {
  13943. re: internalRe.re,
  13944. src: internalRe.src,
  13945. tokens: internalRe.t,
  13946. SEMVER_SPEC_VERSION: __webpack_require__(34504).SEMVER_SPEC_VERSION,
  13947. SemVer: __webpack_require__(39541),
  13948. compareIdentifiers: __webpack_require__(37686).compareIdentifiers,
  13949. rcompareIdentifiers: __webpack_require__(37686).rcompareIdentifiers,
  13950. parse: __webpack_require__(54847),
  13951. valid: __webpack_require__(26109),
  13952. clean: __webpack_require__(8870),
  13953. inc: __webpack_require__(10127),
  13954. diff: __webpack_require__(36131),
  13955. major: __webpack_require__(70957),
  13956. minor: __webpack_require__(15122),
  13957. patch: __webpack_require__(61100),
  13958. prerelease: __webpack_require__(68761),
  13959. compare: __webpack_require__(28929),
  13960. rcompare: __webpack_require__(15444),
  13961. compareLoose: __webpack_require__(80796),
  13962. compareBuild: __webpack_require__(93668),
  13963. sort: __webpack_require__(84499),
  13964. rsort: __webpack_require__(58354),
  13965. gt: __webpack_require__(84021),
  13966. lt: __webpack_require__(72680),
  13967. eq: __webpack_require__(95576),
  13968. neq: __webpack_require__(98836),
  13969. gte: __webpack_require__(39747),
  13970. lte: __webpack_require__(26223),
  13971. cmp: __webpack_require__(16378),
  13972. coerce: __webpack_require__(35195),
  13973. Comparator: __webpack_require__(60054),
  13974. Range: __webpack_require__(93031),
  13975. satisfies: __webpack_require__(76973),
  13976. toComparators: __webpack_require__(76380),
  13977. maxSatisfying: __webpack_require__(96169),
  13978. minSatisfying: __webpack_require__(98037),
  13979. minVersion: __webpack_require__(66682),
  13980. validRange: __webpack_require__(93372),
  13981. outside: __webpack_require__(30623),
  13982. gtr: __webpack_require__(84575),
  13983. ltr: __webpack_require__(75887),
  13984. intersects: __webpack_require__(97429),
  13985. simplifyRange: __webpack_require__(97286),
  13986. subset: __webpack_require__(6870),
  13987. }
  13988. /***/ }),
  13989. /***/ 34504:
  13990. /***/ ((module) => {
  13991. // Note: this is the semver.org version of the spec that it implements
  13992. // Not necessarily the package version of this code.
  13993. const SEMVER_SPEC_VERSION = '2.0.0'
  13994. const MAX_LENGTH = 256
  13995. const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
  13996. /* istanbul ignore next */ 9007199254740991
  13997. // Max safe segment length for coercion.
  13998. const MAX_SAFE_COMPONENT_LENGTH = 16
  13999. module.exports = {
  14000. SEMVER_SPEC_VERSION,
  14001. MAX_LENGTH,
  14002. MAX_SAFE_INTEGER,
  14003. MAX_SAFE_COMPONENT_LENGTH
  14004. }
  14005. /***/ }),
  14006. /***/ 96738:
  14007. /***/ ((module) => {
  14008. const debug = (
  14009. typeof process === 'object' &&
  14010. process.env &&
  14011. process.env.NODE_DEBUG &&
  14012. /\bsemver\b/i.test(process.env.NODE_DEBUG)
  14013. ) ? (...args) => console.error('SEMVER', ...args)
  14014. : () => {}
  14015. module.exports = debug
  14016. /***/ }),
  14017. /***/ 37686:
  14018. /***/ ((module) => {
  14019. const numeric = /^[0-9]+$/
  14020. const compareIdentifiers = (a, b) => {
  14021. const anum = numeric.test(a)
  14022. const bnum = numeric.test(b)
  14023. if (anum && bnum) {
  14024. a = +a
  14025. b = +b
  14026. }
  14027. return a === b ? 0
  14028. : (anum && !bnum) ? -1
  14029. : (bnum && !anum) ? 1
  14030. : a < b ? -1
  14031. : 1
  14032. }
  14033. const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)
  14034. module.exports = {
  14035. compareIdentifiers,
  14036. rcompareIdentifiers
  14037. }
  14038. /***/ }),
  14039. /***/ 26084:
  14040. /***/ ((module) => {
  14041. // parse out just the options we care about so we always get a consistent
  14042. // obj with keys in a consistent order.
  14043. const opts = ['includePrerelease', 'loose', 'rtl']
  14044. const parseOptions = options =>
  14045. !options ? {}
  14046. : typeof options !== 'object' ? { loose: true }
  14047. : opts.filter(k => options[k]).reduce((options, k) => {
  14048. options[k] = true
  14049. return options
  14050. }, {})
  14051. module.exports = parseOptions
  14052. /***/ }),
  14053. /***/ 50487:
  14054. /***/ ((module, exports, __webpack_require__) => {
  14055. const { MAX_SAFE_COMPONENT_LENGTH } = __webpack_require__(34504)
  14056. const debug = __webpack_require__(96738)
  14057. exports = module.exports = {}
  14058. // The actual regexps go on exports.re
  14059. const re = exports.re = []
  14060. const src = exports.src = []
  14061. const t = exports.t = {}
  14062. let R = 0
  14063. const createToken = (name, value, isGlobal) => {
  14064. const index = R++
  14065. debug(index, value)
  14066. t[name] = index
  14067. src[index] = value
  14068. re[index] = new RegExp(value, isGlobal ? 'g' : undefined)
  14069. }
  14070. // The following Regular Expressions can be used for tokenizing,
  14071. // validating, and parsing SemVer version strings.
  14072. // ## Numeric Identifier
  14073. // A single `0`, or a non-zero digit followed by zero or more digits.
  14074. createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*')
  14075. createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+')
  14076. // ## Non-numeric Identifier
  14077. // Zero or more digits, followed by a letter or hyphen, and then zero or
  14078. // more letters, digits, or hyphens.
  14079. createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*')
  14080. // ## Main Version
  14081. // Three dot-separated numeric identifiers.
  14082. createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` +
  14083. `(${src[t.NUMERICIDENTIFIER]})\\.` +
  14084. `(${src[t.NUMERICIDENTIFIER]})`)
  14085. createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
  14086. `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
  14087. `(${src[t.NUMERICIDENTIFIERLOOSE]})`)
  14088. // ## Pre-release Version Identifier
  14089. // A numeric identifier, or a non-numeric identifier.
  14090. createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]
  14091. }|${src[t.NONNUMERICIDENTIFIER]})`)
  14092. createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]
  14093. }|${src[t.NONNUMERICIDENTIFIER]})`)
  14094. // ## Pre-release Version
  14095. // Hyphen, followed by one or more dot-separated pre-release version
  14096. // identifiers.
  14097. createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]
  14098. }(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`)
  14099. createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
  14100. }(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`)
  14101. // ## Build Metadata Identifier
  14102. // Any combination of digits, letters, or hyphens.
  14103. createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+')
  14104. // ## Build Metadata
  14105. // Plus sign, followed by one or more period-separated build metadata
  14106. // identifiers.
  14107. createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]
  14108. }(?:\\.${src[t.BUILDIDENTIFIER]})*))`)
  14109. // ## Full Version String
  14110. // A main version, followed optionally by a pre-release version and
  14111. // build metadata.
  14112. // Note that the only major, minor, patch, and pre-release sections of
  14113. // the version string are capturing groups. The build metadata is not a
  14114. // capturing group, because it should not ever be used in version
  14115. // comparison.
  14116. createToken('FULLPLAIN', `v?${src[t.MAINVERSION]
  14117. }${src[t.PRERELEASE]}?${
  14118. src[t.BUILD]}?`)
  14119. createToken('FULL', `^${src[t.FULLPLAIN]}$`)
  14120. // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
  14121. // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
  14122. // common in the npm registry.
  14123. createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]
  14124. }${src[t.PRERELEASELOOSE]}?${
  14125. src[t.BUILD]}?`)
  14126. createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`)
  14127. createToken('GTLT', '((?:<|>)?=?)')
  14128. // Something like "2.*" or "1.2.x".
  14129. // Note that "x.x" is a valid xRange identifer, meaning "any version"
  14130. // Only the first item is strictly required.
  14131. createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`)
  14132. createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`)
  14133. createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` +
  14134. `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
  14135. `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
  14136. `(?:${src[t.PRERELEASE]})?${
  14137. src[t.BUILD]}?` +
  14138. `)?)?`)
  14139. createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +
  14140. `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
  14141. `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
  14142. `(?:${src[t.PRERELEASELOOSE]})?${
  14143. src[t.BUILD]}?` +
  14144. `)?)?`)
  14145. createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`)
  14146. createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`)
  14147. // Coercion.
  14148. // Extract anything that could conceivably be a part of a valid semver
  14149. createToken('COERCE', `${'(^|[^\\d])' +
  14150. '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
  14151. `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
  14152. `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
  14153. `(?:$|[^\\d])`)
  14154. createToken('COERCERTL', src[t.COERCE], true)
  14155. // Tilde ranges.
  14156. // Meaning is "reasonably at or greater than"
  14157. createToken('LONETILDE', '(?:~>?)')
  14158. createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true)
  14159. exports.tildeTrimReplace = '$1~'
  14160. createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`)
  14161. createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`)
  14162. // Caret ranges.
  14163. // Meaning is "at least and backwards compatible with"
  14164. createToken('LONECARET', '(?:\\^)')
  14165. createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true)
  14166. exports.caretTrimReplace = '$1^'
  14167. createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`)
  14168. createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`)
  14169. // A simple gt/lt/eq thing, or just "" to indicate "any version"
  14170. createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`)
  14171. createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`)
  14172. // An expression to strip any whitespace between the gtlt and the thing
  14173. // it modifies, so that `> 1.2.3` ==> `>1.2.3`
  14174. createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
  14175. }\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true)
  14176. exports.comparatorTrimReplace = '$1$2$3'
  14177. // Something like `1.2.3 - 1.2.4`
  14178. // Note that these all use the loose form, because they'll be
  14179. // checked against either the strict or loose comparator form
  14180. // later.
  14181. createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` +
  14182. `\\s+-\\s+` +
  14183. `(${src[t.XRANGEPLAIN]})` +
  14184. `\\s*$`)
  14185. createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
  14186. `\\s+-\\s+` +
  14187. `(${src[t.XRANGEPLAINLOOSE]})` +
  14188. `\\s*$`)
  14189. // Star ranges basically just allow anything at all.
  14190. createToken('STAR', '(<|>)?=?\\s*\\*')
  14191. // >=0.0.0 is like a star
  14192. createToken('GTE0', '^\\s*>=\\s*0\.0\.0\\s*$')
  14193. createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$')
  14194. /***/ }),
  14195. /***/ 84575:
  14196. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  14197. // Determine if version is greater than all the versions possible in the range.
  14198. const outside = __webpack_require__(30623)
  14199. const gtr = (version, range, options) => outside(version, range, '>', options)
  14200. module.exports = gtr
  14201. /***/ }),
  14202. /***/ 97429:
  14203. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  14204. const Range = __webpack_require__(93031)
  14205. const intersects = (r1, r2, options) => {
  14206. r1 = new Range(r1, options)
  14207. r2 = new Range(r2, options)
  14208. return r1.intersects(r2)
  14209. }
  14210. module.exports = intersects
  14211. /***/ }),
  14212. /***/ 75887:
  14213. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  14214. const outside = __webpack_require__(30623)
  14215. // Determine if version is less than all the versions possible in the range
  14216. const ltr = (version, range, options) => outside(version, range, '<', options)
  14217. module.exports = ltr
  14218. /***/ }),
  14219. /***/ 96169:
  14220. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  14221. const SemVer = __webpack_require__(39541)
  14222. const Range = __webpack_require__(93031)
  14223. const maxSatisfying = (versions, range, options) => {
  14224. let max = null
  14225. let maxSV = null
  14226. let rangeObj = null
  14227. try {
  14228. rangeObj = new Range(range, options)
  14229. } catch (er) {
  14230. return null
  14231. }
  14232. versions.forEach((v) => {
  14233. if (rangeObj.test(v)) {
  14234. // satisfies(v, range, options)
  14235. if (!max || maxSV.compare(v) === -1) {
  14236. // compare(max, v, true)
  14237. max = v
  14238. maxSV = new SemVer(max, options)
  14239. }
  14240. }
  14241. })
  14242. return max
  14243. }
  14244. module.exports = maxSatisfying
  14245. /***/ }),
  14246. /***/ 98037:
  14247. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  14248. const SemVer = __webpack_require__(39541)
  14249. const Range = __webpack_require__(93031)
  14250. const minSatisfying = (versions, range, options) => {
  14251. let min = null
  14252. let minSV = null
  14253. let rangeObj = null
  14254. try {
  14255. rangeObj = new Range(range, options)
  14256. } catch (er) {
  14257. return null
  14258. }
  14259. versions.forEach((v) => {
  14260. if (rangeObj.test(v)) {
  14261. // satisfies(v, range, options)
  14262. if (!min || minSV.compare(v) === 1) {
  14263. // compare(min, v, true)
  14264. min = v
  14265. minSV = new SemVer(min, options)
  14266. }
  14267. }
  14268. })
  14269. return min
  14270. }
  14271. module.exports = minSatisfying
  14272. /***/ }),
  14273. /***/ 66682:
  14274. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  14275. const SemVer = __webpack_require__(39541)
  14276. const Range = __webpack_require__(93031)
  14277. const gt = __webpack_require__(84021)
  14278. const minVersion = (range, loose) => {
  14279. range = new Range(range, loose)
  14280. let minver = new SemVer('0.0.0')
  14281. if (range.test(minver)) {
  14282. return minver
  14283. }
  14284. minver = new SemVer('0.0.0-0')
  14285. if (range.test(minver)) {
  14286. return minver
  14287. }
  14288. minver = null
  14289. for (let i = 0; i < range.set.length; ++i) {
  14290. const comparators = range.set[i]
  14291. let setMin = null
  14292. comparators.forEach((comparator) => {
  14293. // Clone to avoid manipulating the comparator's semver object.
  14294. const compver = new SemVer(comparator.semver.version)
  14295. switch (comparator.operator) {
  14296. case '>':
  14297. if (compver.prerelease.length === 0) {
  14298. compver.patch++
  14299. } else {
  14300. compver.prerelease.push(0)
  14301. }
  14302. compver.raw = compver.format()
  14303. /* fallthrough */
  14304. case '':
  14305. case '>=':
  14306. if (!setMin || gt(compver, setMin)) {
  14307. setMin = compver
  14308. }
  14309. break
  14310. case '<':
  14311. case '<=':
  14312. /* Ignore maximum versions */
  14313. break
  14314. /* istanbul ignore next */
  14315. default:
  14316. throw new Error(`Unexpected operation: ${comparator.operator}`)
  14317. }
  14318. })
  14319. if (setMin && (!minver || gt(minver, setMin)))
  14320. minver = setMin
  14321. }
  14322. if (minver && range.test(minver)) {
  14323. return minver
  14324. }
  14325. return null
  14326. }
  14327. module.exports = minVersion
  14328. /***/ }),
  14329. /***/ 30623:
  14330. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  14331. const SemVer = __webpack_require__(39541)
  14332. const Comparator = __webpack_require__(60054)
  14333. const {ANY} = Comparator
  14334. const Range = __webpack_require__(93031)
  14335. const satisfies = __webpack_require__(76973)
  14336. const gt = __webpack_require__(84021)
  14337. const lt = __webpack_require__(72680)
  14338. const lte = __webpack_require__(26223)
  14339. const gte = __webpack_require__(39747)
  14340. const outside = (version, range, hilo, options) => {
  14341. version = new SemVer(version, options)
  14342. range = new Range(range, options)
  14343. let gtfn, ltefn, ltfn, comp, ecomp
  14344. switch (hilo) {
  14345. case '>':
  14346. gtfn = gt
  14347. ltefn = lte
  14348. ltfn = lt
  14349. comp = '>'
  14350. ecomp = '>='
  14351. break
  14352. case '<':
  14353. gtfn = lt
  14354. ltefn = gte
  14355. ltfn = gt
  14356. comp = '<'
  14357. ecomp = '<='
  14358. break
  14359. default:
  14360. throw new TypeError('Must provide a hilo val of "<" or ">"')
  14361. }
  14362. // If it satisfies the range it is not outside
  14363. if (satisfies(version, range, options)) {
  14364. return false
  14365. }
  14366. // From now on, variable terms are as if we're in "gtr" mode.
  14367. // but note that everything is flipped for the "ltr" function.
  14368. for (let i = 0; i < range.set.length; ++i) {
  14369. const comparators = range.set[i]
  14370. let high = null
  14371. let low = null
  14372. comparators.forEach((comparator) => {
  14373. if (comparator.semver === ANY) {
  14374. comparator = new Comparator('>=0.0.0')
  14375. }
  14376. high = high || comparator
  14377. low = low || comparator
  14378. if (gtfn(comparator.semver, high.semver, options)) {
  14379. high = comparator
  14380. } else if (ltfn(comparator.semver, low.semver, options)) {
  14381. low = comparator
  14382. }
  14383. })
  14384. // If the edge version comparator has a operator then our version
  14385. // isn't outside it
  14386. if (high.operator === comp || high.operator === ecomp) {
  14387. return false
  14388. }
  14389. // If the lowest version comparator has an operator and our version
  14390. // is less than it then it isn't higher than the range
  14391. if ((!low.operator || low.operator === comp) &&
  14392. ltefn(version, low.semver)) {
  14393. return false
  14394. } else if (low.operator === ecomp && ltfn(version, low.semver)) {
  14395. return false
  14396. }
  14397. }
  14398. return true
  14399. }
  14400. module.exports = outside
  14401. /***/ }),
  14402. /***/ 97286:
  14403. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  14404. // given a set of versions and a range, create a "simplified" range
  14405. // that includes the same versions that the original range does
  14406. // If the original range is shorter than the simplified one, return that.
  14407. const satisfies = __webpack_require__(76973)
  14408. const compare = __webpack_require__(28929)
  14409. module.exports = (versions, range, options) => {
  14410. const set = []
  14411. let min = null
  14412. let prev = null
  14413. const v = versions.sort((a, b) => compare(a, b, options))
  14414. for (const version of v) {
  14415. const included = satisfies(version, range, options)
  14416. if (included) {
  14417. prev = version
  14418. if (!min)
  14419. min = version
  14420. } else {
  14421. if (prev) {
  14422. set.push([min, prev])
  14423. }
  14424. prev = null
  14425. min = null
  14426. }
  14427. }
  14428. if (min)
  14429. set.push([min, null])
  14430. const ranges = []
  14431. for (const [min, max] of set) {
  14432. if (min === max)
  14433. ranges.push(min)
  14434. else if (!max && min === v[0])
  14435. ranges.push('*')
  14436. else if (!max)
  14437. ranges.push(`>=${min}`)
  14438. else if (min === v[0])
  14439. ranges.push(`<=${max}`)
  14440. else
  14441. ranges.push(`${min} - ${max}`)
  14442. }
  14443. const simplified = ranges.join(' || ')
  14444. const original = typeof range.raw === 'string' ? range.raw : String(range)
  14445. return simplified.length < original.length ? simplified : range
  14446. }
  14447. /***/ }),
  14448. /***/ 6870:
  14449. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  14450. const Range = __webpack_require__(93031)
  14451. const Comparator = __webpack_require__(60054)
  14452. const { ANY } = Comparator
  14453. const satisfies = __webpack_require__(76973)
  14454. const compare = __webpack_require__(28929)
  14455. // Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:
  14456. // - Every simple range `r1, r2, ...` is a null set, OR
  14457. // - Every simple range `r1, r2, ...` which is not a null set is a subset of
  14458. // some `R1, R2, ...`
  14459. //
  14460. // Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:
  14461. // - If c is only the ANY comparator
  14462. // - If C is only the ANY comparator, return true
  14463. // - Else if in prerelease mode, return false
  14464. // - else replace c with `[>=0.0.0]`
  14465. // - If C is only the ANY comparator
  14466. // - if in prerelease mode, return true
  14467. // - else replace C with `[>=0.0.0]`
  14468. // - Let EQ be the set of = comparators in c
  14469. // - If EQ is more than one, return true (null set)
  14470. // - Let GT be the highest > or >= comparator in c
  14471. // - Let LT be the lowest < or <= comparator in c
  14472. // - If GT and LT, and GT.semver > LT.semver, return true (null set)
  14473. // - If any C is a = range, and GT or LT are set, return false
  14474. // - If EQ
  14475. // - If GT, and EQ does not satisfy GT, return true (null set)
  14476. // - If LT, and EQ does not satisfy LT, return true (null set)
  14477. // - If EQ satisfies every C, return true
  14478. // - Else return false
  14479. // - If GT
  14480. // - If GT.semver is lower than any > or >= comp in C, return false
  14481. // - If GT is >=, and GT.semver does not satisfy every C, return false
  14482. // - If GT.semver has a prerelease, and not in prerelease mode
  14483. // - If no C has a prerelease and the GT.semver tuple, return false
  14484. // - If LT
  14485. // - If LT.semver is greater than any < or <= comp in C, return false
  14486. // - If LT is <=, and LT.semver does not satisfy every C, return false
  14487. // - If GT.semver has a prerelease, and not in prerelease mode
  14488. // - If no C has a prerelease and the LT.semver tuple, return false
  14489. // - Else return true
  14490. const subset = (sub, dom, options = {}) => {
  14491. if (sub === dom)
  14492. return true
  14493. sub = new Range(sub, options)
  14494. dom = new Range(dom, options)
  14495. let sawNonNull = false
  14496. OUTER: for (const simpleSub of sub.set) {
  14497. for (const simpleDom of dom.set) {
  14498. const isSub = simpleSubset(simpleSub, simpleDom, options)
  14499. sawNonNull = sawNonNull || isSub !== null
  14500. if (isSub)
  14501. continue OUTER
  14502. }
  14503. // the null set is a subset of everything, but null simple ranges in
  14504. // a complex range should be ignored. so if we saw a non-null range,
  14505. // then we know this isn't a subset, but if EVERY simple range was null,
  14506. // then it is a subset.
  14507. if (sawNonNull)
  14508. return false
  14509. }
  14510. return true
  14511. }
  14512. const simpleSubset = (sub, dom, options) => {
  14513. if (sub === dom)
  14514. return true
  14515. if (sub.length === 1 && sub[0].semver === ANY) {
  14516. if (dom.length === 1 && dom[0].semver === ANY)
  14517. return true
  14518. else if (options.includePrerelease)
  14519. sub = [ new Comparator('>=0.0.0-0') ]
  14520. else
  14521. sub = [ new Comparator('>=0.0.0') ]
  14522. }
  14523. if (dom.length === 1 && dom[0].semver === ANY) {
  14524. if (options.includePrerelease)
  14525. return true
  14526. else
  14527. dom = [ new Comparator('>=0.0.0') ]
  14528. }
  14529. const eqSet = new Set()
  14530. let gt, lt
  14531. for (const c of sub) {
  14532. if (c.operator === '>' || c.operator === '>=')
  14533. gt = higherGT(gt, c, options)
  14534. else if (c.operator === '<' || c.operator === '<=')
  14535. lt = lowerLT(lt, c, options)
  14536. else
  14537. eqSet.add(c.semver)
  14538. }
  14539. if (eqSet.size > 1)
  14540. return null
  14541. let gtltComp
  14542. if (gt && lt) {
  14543. gtltComp = compare(gt.semver, lt.semver, options)
  14544. if (gtltComp > 0)
  14545. return null
  14546. else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<='))
  14547. return null
  14548. }
  14549. // will iterate one or zero times
  14550. for (const eq of eqSet) {
  14551. if (gt && !satisfies(eq, String(gt), options))
  14552. return null
  14553. if (lt && !satisfies(eq, String(lt), options))
  14554. return null
  14555. for (const c of dom) {
  14556. if (!satisfies(eq, String(c), options))
  14557. return false
  14558. }
  14559. return true
  14560. }
  14561. let higher, lower
  14562. let hasDomLT, hasDomGT
  14563. // if the subset has a prerelease, we need a comparator in the superset
  14564. // with the same tuple and a prerelease, or it's not a subset
  14565. let needDomLTPre = lt &&
  14566. !options.includePrerelease &&
  14567. lt.semver.prerelease.length ? lt.semver : false
  14568. let needDomGTPre = gt &&
  14569. !options.includePrerelease &&
  14570. gt.semver.prerelease.length ? gt.semver : false
  14571. // exception: <1.2.3-0 is the same as <1.2.3
  14572. if (needDomLTPre && needDomLTPre.prerelease.length === 1 &&
  14573. lt.operator === '<' && needDomLTPre.prerelease[0] === 0) {
  14574. needDomLTPre = false
  14575. }
  14576. for (const c of dom) {
  14577. hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>='
  14578. hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<='
  14579. if (gt) {
  14580. if (needDomGTPre) {
  14581. if (c.semver.prerelease && c.semver.prerelease.length &&
  14582. c.semver.major === needDomGTPre.major &&
  14583. c.semver.minor === needDomGTPre.minor &&
  14584. c.semver.patch === needDomGTPre.patch) {
  14585. needDomGTPre = false
  14586. }
  14587. }
  14588. if (c.operator === '>' || c.operator === '>=') {
  14589. higher = higherGT(gt, c, options)
  14590. if (higher === c && higher !== gt)
  14591. return false
  14592. } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options))
  14593. return false
  14594. }
  14595. if (lt) {
  14596. if (needDomLTPre) {
  14597. if (c.semver.prerelease && c.semver.prerelease.length &&
  14598. c.semver.major === needDomLTPre.major &&
  14599. c.semver.minor === needDomLTPre.minor &&
  14600. c.semver.patch === needDomLTPre.patch) {
  14601. needDomLTPre = false
  14602. }
  14603. }
  14604. if (c.operator === '<' || c.operator === '<=') {
  14605. lower = lowerLT(lt, c, options)
  14606. if (lower === c && lower !== lt)
  14607. return false
  14608. } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options))
  14609. return false
  14610. }
  14611. if (!c.operator && (lt || gt) && gtltComp !== 0)
  14612. return false
  14613. }
  14614. // if there was a < or >, and nothing in the dom, then must be false
  14615. // UNLESS it was limited by another range in the other direction.
  14616. // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0
  14617. if (gt && hasDomLT && !lt && gtltComp !== 0)
  14618. return false
  14619. if (lt && hasDomGT && !gt && gtltComp !== 0)
  14620. return false
  14621. // we needed a prerelease range in a specific tuple, but didn't get one
  14622. // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0,
  14623. // because it includes prereleases in the 1.2.3 tuple
  14624. if (needDomGTPre || needDomLTPre)
  14625. return false
  14626. return true
  14627. }
  14628. // >=1.2.3 is lower than >1.2.3
  14629. const higherGT = (a, b, options) => {
  14630. if (!a)
  14631. return b
  14632. const comp = compare(a.semver, b.semver, options)
  14633. return comp > 0 ? a
  14634. : comp < 0 ? b
  14635. : b.operator === '>' && a.operator === '>=' ? b
  14636. : a
  14637. }
  14638. // <=1.2.3 is higher than <1.2.3
  14639. const lowerLT = (a, b, options) => {
  14640. if (!a)
  14641. return b
  14642. const comp = compare(a.semver, b.semver, options)
  14643. return comp < 0 ? a
  14644. : comp > 0 ? b
  14645. : b.operator === '<' && a.operator === '<=' ? b
  14646. : a
  14647. }
  14648. module.exports = subset
  14649. /***/ }),
  14650. /***/ 76380:
  14651. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  14652. const Range = __webpack_require__(93031)
  14653. // Mostly just for testing and legacy API reasons
  14654. const toComparators = (range, options) =>
  14655. new Range(range, options).set
  14656. .map(comp => comp.map(c => c.value).join(' ').trim().split(' '))
  14657. module.exports = toComparators
  14658. /***/ }),
  14659. /***/ 93372:
  14660. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  14661. const Range = __webpack_require__(93031)
  14662. const validRange = (range, options) => {
  14663. try {
  14664. // Return '*' instead of '' so that truthiness works.
  14665. // This will throw if it's invalid anyway
  14666. return new Range(range, options).range || '*'
  14667. } catch (er) {
  14668. return null
  14669. }
  14670. }
  14671. module.exports = validRange
  14672. /***/ }),
  14673. /***/ 76816:
  14674. /***/ ((module) => {
  14675. "use strict";
  14676. module.exports = function (Yallist) {
  14677. Yallist.prototype[Symbol.iterator] = function* () {
  14678. for (let walker = this.head; walker; walker = walker.next) {
  14679. yield walker.value
  14680. }
  14681. }
  14682. }
  14683. /***/ }),
  14684. /***/ 41898:
  14685. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  14686. "use strict";
  14687. module.exports = Yallist
  14688. Yallist.Node = Node
  14689. Yallist.create = Yallist
  14690. function Yallist (list) {
  14691. var self = this
  14692. if (!(self instanceof Yallist)) {
  14693. self = new Yallist()
  14694. }
  14695. self.tail = null
  14696. self.head = null
  14697. self.length = 0
  14698. if (list && typeof list.forEach === 'function') {
  14699. list.forEach(function (item) {
  14700. self.push(item)
  14701. })
  14702. } else if (arguments.length > 0) {
  14703. for (var i = 0, l = arguments.length; i < l; i++) {
  14704. self.push(arguments[i])
  14705. }
  14706. }
  14707. return self
  14708. }
  14709. Yallist.prototype.removeNode = function (node) {
  14710. if (node.list !== this) {
  14711. throw new Error('removing node which does not belong to this list')
  14712. }
  14713. var next = node.next
  14714. var prev = node.prev
  14715. if (next) {
  14716. next.prev = prev
  14717. }
  14718. if (prev) {
  14719. prev.next = next
  14720. }
  14721. if (node === this.head) {
  14722. this.head = next
  14723. }
  14724. if (node === this.tail) {
  14725. this.tail = prev
  14726. }
  14727. node.list.length--
  14728. node.next = null
  14729. node.prev = null
  14730. node.list = null
  14731. return next
  14732. }
  14733. Yallist.prototype.unshiftNode = function (node) {
  14734. if (node === this.head) {
  14735. return
  14736. }
  14737. if (node.list) {
  14738. node.list.removeNode(node)
  14739. }
  14740. var head = this.head
  14741. node.list = this
  14742. node.next = head
  14743. if (head) {
  14744. head.prev = node
  14745. }
  14746. this.head = node
  14747. if (!this.tail) {
  14748. this.tail = node
  14749. }
  14750. this.length++
  14751. }
  14752. Yallist.prototype.pushNode = function (node) {
  14753. if (node === this.tail) {
  14754. return
  14755. }
  14756. if (node.list) {
  14757. node.list.removeNode(node)
  14758. }
  14759. var tail = this.tail
  14760. node.list = this
  14761. node.prev = tail
  14762. if (tail) {
  14763. tail.next = node
  14764. }
  14765. this.tail = node
  14766. if (!this.head) {
  14767. this.head = node
  14768. }
  14769. this.length++
  14770. }
  14771. Yallist.prototype.push = function () {
  14772. for (var i = 0, l = arguments.length; i < l; i++) {
  14773. push(this, arguments[i])
  14774. }
  14775. return this.length
  14776. }
  14777. Yallist.prototype.unshift = function () {
  14778. for (var i = 0, l = arguments.length; i < l; i++) {
  14779. unshift(this, arguments[i])
  14780. }
  14781. return this.length
  14782. }
  14783. Yallist.prototype.pop = function () {
  14784. if (!this.tail) {
  14785. return undefined
  14786. }
  14787. var res = this.tail.value
  14788. this.tail = this.tail.prev
  14789. if (this.tail) {
  14790. this.tail.next = null
  14791. } else {
  14792. this.head = null
  14793. }
  14794. this.length--
  14795. return res
  14796. }
  14797. Yallist.prototype.shift = function () {
  14798. if (!this.head) {
  14799. return undefined
  14800. }
  14801. var res = this.head.value
  14802. this.head = this.head.next
  14803. if (this.head) {
  14804. this.head.prev = null
  14805. } else {
  14806. this.tail = null
  14807. }
  14808. this.length--
  14809. return res
  14810. }
  14811. Yallist.prototype.forEach = function (fn, thisp) {
  14812. thisp = thisp || this
  14813. for (var walker = this.head, i = 0; walker !== null; i++) {
  14814. fn.call(thisp, walker.value, i, this)
  14815. walker = walker.next
  14816. }
  14817. }
  14818. Yallist.prototype.forEachReverse = function (fn, thisp) {
  14819. thisp = thisp || this
  14820. for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
  14821. fn.call(thisp, walker.value, i, this)
  14822. walker = walker.prev
  14823. }
  14824. }
  14825. Yallist.prototype.get = function (n) {
  14826. for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
  14827. // abort out of the list early if we hit a cycle
  14828. walker = walker.next
  14829. }
  14830. if (i === n && walker !== null) {
  14831. return walker.value
  14832. }
  14833. }
  14834. Yallist.prototype.getReverse = function (n) {
  14835. for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
  14836. // abort out of the list early if we hit a cycle
  14837. walker = walker.prev
  14838. }
  14839. if (i === n && walker !== null) {
  14840. return walker.value
  14841. }
  14842. }
  14843. Yallist.prototype.map = function (fn, thisp) {
  14844. thisp = thisp || this
  14845. var res = new Yallist()
  14846. for (var walker = this.head; walker !== null;) {
  14847. res.push(fn.call(thisp, walker.value, this))
  14848. walker = walker.next
  14849. }
  14850. return res
  14851. }
  14852. Yallist.prototype.mapReverse = function (fn, thisp) {
  14853. thisp = thisp || this
  14854. var res = new Yallist()
  14855. for (var walker = this.tail; walker !== null;) {
  14856. res.push(fn.call(thisp, walker.value, this))
  14857. walker = walker.prev
  14858. }
  14859. return res
  14860. }
  14861. Yallist.prototype.reduce = function (fn, initial) {
  14862. var acc
  14863. var walker = this.head
  14864. if (arguments.length > 1) {
  14865. acc = initial
  14866. } else if (this.head) {
  14867. walker = this.head.next
  14868. acc = this.head.value
  14869. } else {
  14870. throw new TypeError('Reduce of empty list with no initial value')
  14871. }
  14872. for (var i = 0; walker !== null; i++) {
  14873. acc = fn(acc, walker.value, i)
  14874. walker = walker.next
  14875. }
  14876. return acc
  14877. }
  14878. Yallist.prototype.reduceReverse = function (fn, initial) {
  14879. var acc
  14880. var walker = this.tail
  14881. if (arguments.length > 1) {
  14882. acc = initial
  14883. } else if (this.tail) {
  14884. walker = this.tail.prev
  14885. acc = this.tail.value
  14886. } else {
  14887. throw new TypeError('Reduce of empty list with no initial value')
  14888. }
  14889. for (var i = this.length - 1; walker !== null; i--) {
  14890. acc = fn(acc, walker.value, i)
  14891. walker = walker.prev
  14892. }
  14893. return acc
  14894. }
  14895. Yallist.prototype.toArray = function () {
  14896. var arr = new Array(this.length)
  14897. for (var i = 0, walker = this.head; walker !== null; i++) {
  14898. arr[i] = walker.value
  14899. walker = walker.next
  14900. }
  14901. return arr
  14902. }
  14903. Yallist.prototype.toArrayReverse = function () {
  14904. var arr = new Array(this.length)
  14905. for (var i = 0, walker = this.tail; walker !== null; i++) {
  14906. arr[i] = walker.value
  14907. walker = walker.prev
  14908. }
  14909. return arr
  14910. }
  14911. Yallist.prototype.slice = function (from, to) {
  14912. to = to || this.length
  14913. if (to < 0) {
  14914. to += this.length
  14915. }
  14916. from = from || 0
  14917. if (from < 0) {
  14918. from += this.length
  14919. }
  14920. var ret = new Yallist()
  14921. if (to < from || to < 0) {
  14922. return ret
  14923. }
  14924. if (from < 0) {
  14925. from = 0
  14926. }
  14927. if (to > this.length) {
  14928. to = this.length
  14929. }
  14930. for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
  14931. walker = walker.next
  14932. }
  14933. for (; walker !== null && i < to; i++, walker = walker.next) {
  14934. ret.push(walker.value)
  14935. }
  14936. return ret
  14937. }
  14938. Yallist.prototype.sliceReverse = function (from, to) {
  14939. to = to || this.length
  14940. if (to < 0) {
  14941. to += this.length
  14942. }
  14943. from = from || 0
  14944. if (from < 0) {
  14945. from += this.length
  14946. }
  14947. var ret = new Yallist()
  14948. if (to < from || to < 0) {
  14949. return ret
  14950. }
  14951. if (from < 0) {
  14952. from = 0
  14953. }
  14954. if (to > this.length) {
  14955. to = this.length
  14956. }
  14957. for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
  14958. walker = walker.prev
  14959. }
  14960. for (; walker !== null && i > from; i--, walker = walker.prev) {
  14961. ret.push(walker.value)
  14962. }
  14963. return ret
  14964. }
  14965. Yallist.prototype.splice = function (start, deleteCount, ...nodes) {
  14966. if (start > this.length) {
  14967. start = this.length - 1
  14968. }
  14969. if (start < 0) {
  14970. start = this.length + start;
  14971. }
  14972. for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
  14973. walker = walker.next
  14974. }
  14975. var ret = []
  14976. for (var i = 0; walker && i < deleteCount; i++) {
  14977. ret.push(walker.value)
  14978. walker = this.removeNode(walker)
  14979. }
  14980. if (walker === null) {
  14981. walker = this.tail
  14982. }
  14983. if (walker !== this.head && walker !== this.tail) {
  14984. walker = walker.prev
  14985. }
  14986. for (var i = 0; i < nodes.length; i++) {
  14987. walker = insert(this, walker, nodes[i])
  14988. }
  14989. return ret;
  14990. }
  14991. Yallist.prototype.reverse = function () {
  14992. var head = this.head
  14993. var tail = this.tail
  14994. for (var walker = head; walker !== null; walker = walker.prev) {
  14995. var p = walker.prev
  14996. walker.prev = walker.next
  14997. walker.next = p
  14998. }
  14999. this.head = tail
  15000. this.tail = head
  15001. return this
  15002. }
  15003. function insert (self, node, value) {
  15004. var inserted = node === self.head ?
  15005. new Node(value, null, node, self) :
  15006. new Node(value, node, node.next, self)
  15007. if (inserted.next === null) {
  15008. self.tail = inserted
  15009. }
  15010. if (inserted.prev === null) {
  15011. self.head = inserted
  15012. }
  15013. self.length++
  15014. return inserted
  15015. }
  15016. function push (self, item) {
  15017. self.tail = new Node(item, self.tail, null, self)
  15018. if (!self.head) {
  15019. self.head = self.tail
  15020. }
  15021. self.length++
  15022. }
  15023. function unshift (self, item) {
  15024. self.head = new Node(item, null, self.head, self)
  15025. if (!self.tail) {
  15026. self.tail = self.head
  15027. }
  15028. self.length++
  15029. }
  15030. function Node (value, prev, next, list) {
  15031. if (!(this instanceof Node)) {
  15032. return new Node(value, prev, next, list)
  15033. }
  15034. this.list = list
  15035. this.value = value
  15036. if (prev) {
  15037. prev.next = this
  15038. this.prev = prev
  15039. } else {
  15040. this.prev = null
  15041. }
  15042. if (next) {
  15043. next.prev = this
  15044. this.next = next
  15045. } else {
  15046. this.next = null
  15047. }
  15048. }
  15049. try {
  15050. // add if support for Symbol.iterator is present
  15051. __webpack_require__(76816)(Yallist)
  15052. } catch (er) {}
  15053. /***/ }),
  15054. /***/ 7320:
  15055. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  15056. module.exports = resolvePkg;
  15057. module.exports.sync = sync;
  15058. var fs = __webpack_require__(91729);
  15059. var path = __webpack_require__(85622);
  15060. var debug = __webpack_require__(15158)('snyk:resolve');
  15061. function resolvePkg(name, basedir) {
  15062. if (!basedir) {
  15063. basedir = process.cwd();
  15064. }
  15065. var filename = path.resolve(basedir, 'node_modules', name, 'package.json');
  15066. debug('%s: %s', name, filename);
  15067. return fs.stat(filename).then(function (stat) {
  15068. if (stat.isFile()) {
  15069. return path.dirname(filename);
  15070. }
  15071. }).catch(function (error) {
  15072. debug('%s: not found on %s (root? %s)', name, basedir, isRoot(basedir));
  15073. if (isRoot(basedir)) {
  15074. debug('at root');
  15075. error = new Error('package not found ' + name);
  15076. error.code = 'NO_PACKAGE_FOUND';
  15077. throw error;
  15078. }
  15079. }).then(function (dir) {
  15080. if (dir) {
  15081. debug('%s: FOUND AT %s', name, dir);
  15082. return dir;
  15083. }
  15084. debug('%s: cycling down', name);
  15085. return resolvePkg(name, path.resolve(basedir, '..'));
  15086. });
  15087. }
  15088. function sync(name, basedir) {
  15089. if (!basedir) {
  15090. basedir = process.cwd();
  15091. }
  15092. var filename = path.resolve(basedir, 'node_modules', name, 'package.json');
  15093. debug('%s: %s', name, filename);
  15094. var isFile = function (file) {
  15095. var stat;
  15096. try {
  15097. stat = fs.statSync(file);
  15098. } catch (error) {
  15099. if (error && error.code === 'ENOENT') {
  15100. return false;
  15101. }
  15102. }
  15103. return stat.isFile() || stat.isFIFO();
  15104. };
  15105. if (isFile(filename)) {
  15106. debug('%s: FOUND AT %s', name, filename);
  15107. return path.dirname(filename);
  15108. }
  15109. if (isRoot(basedir)) {
  15110. debug('%s: not found on %s (now at root)', name, filename);
  15111. var error = new Error('package not found ' + name);
  15112. error.code = 'NO_PACKAGE_FOUND';
  15113. throw error;
  15114. }
  15115. debug('%s: cycling down', name);
  15116. return sync(name, path.resolve(basedir, '..'));
  15117. }
  15118. function isRoot(dir) {
  15119. var parsed = parse(dir);
  15120. return parsed.root === parsed.dir && !parsed.base;
  15121. }
  15122. // FIXME determine whether this would work properly on windows in 0.10
  15123. function parse(dir) {
  15124. /* istanbul ignore else */
  15125. // jscs:disable requireEarlyReturn
  15126. if (path.parse) {
  15127. return path.parse(dir);
  15128. } else {
  15129. var split = dir.split(path.sep);
  15130. var root = split[0] + path.sep;
  15131. return {
  15132. base: split[1],
  15133. root: root,
  15134. dir: dir,
  15135. };
  15136. }
  15137. // jscs:enable requireEarlyReturn
  15138. }
  15139. /***/ }),
  15140. /***/ 14402:
  15141. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  15142. module.exports = tryRequire;
  15143. const fsModule = __webpack_require__(35747);
  15144. const util = __webpack_require__(31669);
  15145. const path = __webpack_require__(85622);
  15146. const debug = __webpack_require__(15158)('snyk:resolve:try-require');
  15147. const cloneDeep = __webpack_require__(83465);
  15148. const LRU = __webpack_require__(39593);
  15149. const options = { max: 100, maxAge: 1000 * 60 * 60 };
  15150. const cache = new LRU(options);
  15151. const fs = {
  15152. readFile: util.promisify(fsModule.readFile),
  15153. stat: util.promisify(fsModule.stat),
  15154. };
  15155. module.exports.cache = cache; // allows for a reset
  15156. function tryRequire(filename) {
  15157. const cached = cache.get(filename);
  15158. if (cached) {
  15159. const res = cloneDeep(cached);
  15160. /* istanbul ignore else */
  15161. if (process.env.TAP) {
  15162. res.__cached = true;
  15163. }
  15164. return Promise.resolve(res);
  15165. }
  15166. return fs
  15167. .readFile(filename, 'utf8')
  15168. .then(function (pkgStr) {
  15169. let leadingBOM = '';
  15170. if (pkgStr && pkgStr[0] === '\ufeff') {
  15171. // String starts with UTF BOM. Remove it so that JSON.parse doesn't
  15172. // stumble, but remember it for later use.
  15173. pkgStr = pkgStr.slice(1);
  15174. leadingBOM = '\ufeff';
  15175. }
  15176. const pkg = JSON.parse(pkgStr);
  15177. pkg.leading = leadingBOM + pkgStr.match(/^(\s*){/)[1];
  15178. pkg.trailing = pkgStr.match(/}(\s*)$/)[1];
  15179. return pkg;
  15180. })
  15181. .catch(function (e) {
  15182. debug('tryRequire silently failing on %s', e.message);
  15183. return null;
  15184. })
  15185. .then(function (pkg) {
  15186. if (!pkg) {
  15187. return pkg;
  15188. }
  15189. // fixes potential issues later on
  15190. if (!pkg.devDependencies) {
  15191. pkg.devDependencies = {};
  15192. }
  15193. if (!pkg.dependencies) {
  15194. pkg.dependencies = {};
  15195. }
  15196. if (!pkg.name) {
  15197. pkg.name = path.basename(path.dirname(filename));
  15198. }
  15199. pkg.__filename = filename;
  15200. // test for npm-shrinkwrap and find a .snyk policy file whilst we're at it
  15201. const dir = path.dirname(filename);
  15202. const promises = [
  15203. fs.stat(path.resolve(dir, '.snyk')).catch(pass),
  15204. fs.stat(path.resolve(dir, 'npm-shrinkwrap.json')).catch(pass),
  15205. ];
  15206. return Promise.all(promises).then(function (res) {
  15207. if (!pkg.snyk) {
  15208. pkg.snyk = res[0].isFile();
  15209. }
  15210. if (pkg.snyk) {
  15211. pkg.snyk = dir;
  15212. }
  15213. if (res[1].isFile()) {
  15214. pkg.shrinkwrap = true;
  15215. }
  15216. return pkg;
  15217. });
  15218. })
  15219. .then(function (pkg) {
  15220. cache.set(filename, pkg);
  15221. return cloneDeep(pkg);
  15222. });
  15223. }
  15224. const pass = function () {
  15225. return {
  15226. isFile: function () {
  15227. return false;
  15228. },
  15229. };
  15230. };
  15231. /***/ }),
  15232. /***/ 49602:
  15233. /***/ ((module) => {
  15234. "use strict";
  15235. module.exports = function (Yallist) {
  15236. Yallist.prototype[Symbol.iterator] = function* () {
  15237. for (let walker = this.head; walker; walker = walker.next) {
  15238. yield walker.value
  15239. }
  15240. }
  15241. }
  15242. /***/ }),
  15243. /***/ 34411:
  15244. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  15245. "use strict";
  15246. module.exports = Yallist
  15247. Yallist.Node = Node
  15248. Yallist.create = Yallist
  15249. function Yallist (list) {
  15250. var self = this
  15251. if (!(self instanceof Yallist)) {
  15252. self = new Yallist()
  15253. }
  15254. self.tail = null
  15255. self.head = null
  15256. self.length = 0
  15257. if (list && typeof list.forEach === 'function') {
  15258. list.forEach(function (item) {
  15259. self.push(item)
  15260. })
  15261. } else if (arguments.length > 0) {
  15262. for (var i = 0, l = arguments.length; i < l; i++) {
  15263. self.push(arguments[i])
  15264. }
  15265. }
  15266. return self
  15267. }
  15268. Yallist.prototype.removeNode = function (node) {
  15269. if (node.list !== this) {
  15270. throw new Error('removing node which does not belong to this list')
  15271. }
  15272. var next = node.next
  15273. var prev = node.prev
  15274. if (next) {
  15275. next.prev = prev
  15276. }
  15277. if (prev) {
  15278. prev.next = next
  15279. }
  15280. if (node === this.head) {
  15281. this.head = next
  15282. }
  15283. if (node === this.tail) {
  15284. this.tail = prev
  15285. }
  15286. node.list.length--
  15287. node.next = null
  15288. node.prev = null
  15289. node.list = null
  15290. return next
  15291. }
  15292. Yallist.prototype.unshiftNode = function (node) {
  15293. if (node === this.head) {
  15294. return
  15295. }
  15296. if (node.list) {
  15297. node.list.removeNode(node)
  15298. }
  15299. var head = this.head
  15300. node.list = this
  15301. node.next = head
  15302. if (head) {
  15303. head.prev = node
  15304. }
  15305. this.head = node
  15306. if (!this.tail) {
  15307. this.tail = node
  15308. }
  15309. this.length++
  15310. }
  15311. Yallist.prototype.pushNode = function (node) {
  15312. if (node === this.tail) {
  15313. return
  15314. }
  15315. if (node.list) {
  15316. node.list.removeNode(node)
  15317. }
  15318. var tail = this.tail
  15319. node.list = this
  15320. node.prev = tail
  15321. if (tail) {
  15322. tail.next = node
  15323. }
  15324. this.tail = node
  15325. if (!this.head) {
  15326. this.head = node
  15327. }
  15328. this.length++
  15329. }
  15330. Yallist.prototype.push = function () {
  15331. for (var i = 0, l = arguments.length; i < l; i++) {
  15332. push(this, arguments[i])
  15333. }
  15334. return this.length
  15335. }
  15336. Yallist.prototype.unshift = function () {
  15337. for (var i = 0, l = arguments.length; i < l; i++) {
  15338. unshift(this, arguments[i])
  15339. }
  15340. return this.length
  15341. }
  15342. Yallist.prototype.pop = function () {
  15343. if (!this.tail) {
  15344. return undefined
  15345. }
  15346. var res = this.tail.value
  15347. this.tail = this.tail.prev
  15348. if (this.tail) {
  15349. this.tail.next = null
  15350. } else {
  15351. this.head = null
  15352. }
  15353. this.length--
  15354. return res
  15355. }
  15356. Yallist.prototype.shift = function () {
  15357. if (!this.head) {
  15358. return undefined
  15359. }
  15360. var res = this.head.value
  15361. this.head = this.head.next
  15362. if (this.head) {
  15363. this.head.prev = null
  15364. } else {
  15365. this.tail = null
  15366. }
  15367. this.length--
  15368. return res
  15369. }
  15370. Yallist.prototype.forEach = function (fn, thisp) {
  15371. thisp = thisp || this
  15372. for (var walker = this.head, i = 0; walker !== null; i++) {
  15373. fn.call(thisp, walker.value, i, this)
  15374. walker = walker.next
  15375. }
  15376. }
  15377. Yallist.prototype.forEachReverse = function (fn, thisp) {
  15378. thisp = thisp || this
  15379. for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
  15380. fn.call(thisp, walker.value, i, this)
  15381. walker = walker.prev
  15382. }
  15383. }
  15384. Yallist.prototype.get = function (n) {
  15385. for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
  15386. // abort out of the list early if we hit a cycle
  15387. walker = walker.next
  15388. }
  15389. if (i === n && walker !== null) {
  15390. return walker.value
  15391. }
  15392. }
  15393. Yallist.prototype.getReverse = function (n) {
  15394. for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
  15395. // abort out of the list early if we hit a cycle
  15396. walker = walker.prev
  15397. }
  15398. if (i === n && walker !== null) {
  15399. return walker.value
  15400. }
  15401. }
  15402. Yallist.prototype.map = function (fn, thisp) {
  15403. thisp = thisp || this
  15404. var res = new Yallist()
  15405. for (var walker = this.head; walker !== null;) {
  15406. res.push(fn.call(thisp, walker.value, this))
  15407. walker = walker.next
  15408. }
  15409. return res
  15410. }
  15411. Yallist.prototype.mapReverse = function (fn, thisp) {
  15412. thisp = thisp || this
  15413. var res = new Yallist()
  15414. for (var walker = this.tail; walker !== null;) {
  15415. res.push(fn.call(thisp, walker.value, this))
  15416. walker = walker.prev
  15417. }
  15418. return res
  15419. }
  15420. Yallist.prototype.reduce = function (fn, initial) {
  15421. var acc
  15422. var walker = this.head
  15423. if (arguments.length > 1) {
  15424. acc = initial
  15425. } else if (this.head) {
  15426. walker = this.head.next
  15427. acc = this.head.value
  15428. } else {
  15429. throw new TypeError('Reduce of empty list with no initial value')
  15430. }
  15431. for (var i = 0; walker !== null; i++) {
  15432. acc = fn(acc, walker.value, i)
  15433. walker = walker.next
  15434. }
  15435. return acc
  15436. }
  15437. Yallist.prototype.reduceReverse = function (fn, initial) {
  15438. var acc
  15439. var walker = this.tail
  15440. if (arguments.length > 1) {
  15441. acc = initial
  15442. } else if (this.tail) {
  15443. walker = this.tail.prev
  15444. acc = this.tail.value
  15445. } else {
  15446. throw new TypeError('Reduce of empty list with no initial value')
  15447. }
  15448. for (var i = this.length - 1; walker !== null; i--) {
  15449. acc = fn(acc, walker.value, i)
  15450. walker = walker.prev
  15451. }
  15452. return acc
  15453. }
  15454. Yallist.prototype.toArray = function () {
  15455. var arr = new Array(this.length)
  15456. for (var i = 0, walker = this.head; walker !== null; i++) {
  15457. arr[i] = walker.value
  15458. walker = walker.next
  15459. }
  15460. return arr
  15461. }
  15462. Yallist.prototype.toArrayReverse = function () {
  15463. var arr = new Array(this.length)
  15464. for (var i = 0, walker = this.tail; walker !== null; i++) {
  15465. arr[i] = walker.value
  15466. walker = walker.prev
  15467. }
  15468. return arr
  15469. }
  15470. Yallist.prototype.slice = function (from, to) {
  15471. to = to || this.length
  15472. if (to < 0) {
  15473. to += this.length
  15474. }
  15475. from = from || 0
  15476. if (from < 0) {
  15477. from += this.length
  15478. }
  15479. var ret = new Yallist()
  15480. if (to < from || to < 0) {
  15481. return ret
  15482. }
  15483. if (from < 0) {
  15484. from = 0
  15485. }
  15486. if (to > this.length) {
  15487. to = this.length
  15488. }
  15489. for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
  15490. walker = walker.next
  15491. }
  15492. for (; walker !== null && i < to; i++, walker = walker.next) {
  15493. ret.push(walker.value)
  15494. }
  15495. return ret
  15496. }
  15497. Yallist.prototype.sliceReverse = function (from, to) {
  15498. to = to || this.length
  15499. if (to < 0) {
  15500. to += this.length
  15501. }
  15502. from = from || 0
  15503. if (from < 0) {
  15504. from += this.length
  15505. }
  15506. var ret = new Yallist()
  15507. if (to < from || to < 0) {
  15508. return ret
  15509. }
  15510. if (from < 0) {
  15511. from = 0
  15512. }
  15513. if (to > this.length) {
  15514. to = this.length
  15515. }
  15516. for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
  15517. walker = walker.prev
  15518. }
  15519. for (; walker !== null && i > from; i--, walker = walker.prev) {
  15520. ret.push(walker.value)
  15521. }
  15522. return ret
  15523. }
  15524. Yallist.prototype.splice = function (start, deleteCount /*, ...nodes */) {
  15525. if (start > this.length) {
  15526. start = this.length - 1
  15527. }
  15528. if (start < 0) {
  15529. start = this.length + start;
  15530. }
  15531. for (var i = 0, walker = this.head; walker !== null && i < start; i++) {
  15532. walker = walker.next
  15533. }
  15534. var ret = []
  15535. for (var i = 0; walker && i < deleteCount; i++) {
  15536. ret.push(walker.value)
  15537. walker = this.removeNode(walker)
  15538. }
  15539. if (walker === null) {
  15540. walker = this.tail
  15541. }
  15542. if (walker !== this.head && walker !== this.tail) {
  15543. walker = walker.prev
  15544. }
  15545. for (var i = 2; i < arguments.length; i++) {
  15546. walker = insert(this, walker, arguments[i])
  15547. }
  15548. return ret;
  15549. }
  15550. Yallist.prototype.reverse = function () {
  15551. var head = this.head
  15552. var tail = this.tail
  15553. for (var walker = head; walker !== null; walker = walker.prev) {
  15554. var p = walker.prev
  15555. walker.prev = walker.next
  15556. walker.next = p
  15557. }
  15558. this.head = tail
  15559. this.tail = head
  15560. return this
  15561. }
  15562. function insert (self, node, value) {
  15563. var inserted = node === self.head ?
  15564. new Node(value, null, node, self) :
  15565. new Node(value, node, node.next, self)
  15566. if (inserted.next === null) {
  15567. self.tail = inserted
  15568. }
  15569. if (inserted.prev === null) {
  15570. self.head = inserted
  15571. }
  15572. self.length++
  15573. return inserted
  15574. }
  15575. function push (self, item) {
  15576. self.tail = new Node(item, self.tail, null, self)
  15577. if (!self.head) {
  15578. self.head = self.tail
  15579. }
  15580. self.length++
  15581. }
  15582. function unshift (self, item) {
  15583. self.head = new Node(item, null, self.head, self)
  15584. if (!self.tail) {
  15585. self.tail = self.head
  15586. }
  15587. self.length++
  15588. }
  15589. function Node (value, prev, next, list) {
  15590. if (!(this instanceof Node)) {
  15591. return new Node(value, prev, next, list)
  15592. }
  15593. this.list = list
  15594. this.value = value
  15595. if (prev) {
  15596. prev.next = this
  15597. this.prev = prev
  15598. } else {
  15599. this.prev = null
  15600. }
  15601. if (next) {
  15602. next.prev = this
  15603. this.next = next
  15604. } else {
  15605. this.next = null
  15606. }
  15607. }
  15608. try {
  15609. // add if support for Symbol.iterator is present
  15610. __webpack_require__(49602)(Yallist)
  15611. } catch (er) {}
  15612. /***/ }),
  15613. /***/ 4195:
  15614. /***/ ((module) => {
  15615. "use strict";
  15616. module.exports = JSON.parse('{"name":"snyk-policy","description":"Snyk\'s policy parser and matching logic","main":"lib/index.js","scripts":{"lint":"run-p --max-parallel=${JOBS:-6} --aggregate-output lint:*","lint:eslint":"eslint -c .eslintrc lib","lint:commits":"commitlint --from=HEAD~20","format":"prettier --write \'{lib,test}/**/*.?s\'","check-tests":"! grep \'test.only\' test/**/*.test.js -n","env":"node -e \'console.log(process.env, process.versions)\'","tap":"tap test/**/*.test.js -R spec --timeout=60","test":"npm run check-tests && npm run tap"},"keywords":["snyk"],"author":"Remy Sharp","license":"Apache-2.0","devDependencies":{"@commitlint/cli":"^12.1.4","eslint":"^5.0.0","eslint-config-prettier":"^5.0.0","npm-run-all":"^4.1.5","prettier":"^2.0.5","proxyquire":"^2.1.0","sinon":"^4.0.0","tap":"^12.0.1","tap-only":"0.0.5"},"dependencies":{"debug":"^4.1.1","email-validator":"^2.0.4","js-yaml":"^3.13.1","lodash.clonedeep":"^4.5.0","promise-fs":"^2.1.1","semver":"^7.3.4","snyk-module":"^3.0.0","snyk-resolve":"^1.1.0","snyk-try-require":"^2.0.2"},"repository":{"type":"git","url":"https://github.com/snyk/policy.git"},"version":"1.25.0"}');
  15617. /***/ })
  15618. };
  15619. ;
  15620. //# sourceMappingURL=535.index.js.map