babel-worker.js 1.3 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024
  1. (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
  2. 'use strict';
  3. module.exports = function () {
  4. return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g;
  5. };
  6. },{}],2:[function(require,module,exports){
  7. 'use strict';
  8. function assembleStyles () {
  9. var styles = {
  10. modifiers: {
  11. reset: [0, 0],
  12. bold: [1, 22], // 21 isn't widely supported and 22 does the same thing
  13. dim: [2, 22],
  14. italic: [3, 23],
  15. underline: [4, 24],
  16. inverse: [7, 27],
  17. hidden: [8, 28],
  18. strikethrough: [9, 29]
  19. },
  20. colors: {
  21. black: [30, 39],
  22. red: [31, 39],
  23. green: [32, 39],
  24. yellow: [33, 39],
  25. blue: [34, 39],
  26. magenta: [35, 39],
  27. cyan: [36, 39],
  28. white: [37, 39],
  29. gray: [90, 39]
  30. },
  31. bgColors: {
  32. bgBlack: [40, 49],
  33. bgRed: [41, 49],
  34. bgGreen: [42, 49],
  35. bgYellow: [43, 49],
  36. bgBlue: [44, 49],
  37. bgMagenta: [45, 49],
  38. bgCyan: [46, 49],
  39. bgWhite: [47, 49]
  40. }
  41. };
  42. // fix humans
  43. styles.colors.grey = styles.colors.gray;
  44. Object.keys(styles).forEach(function (groupName) {
  45. var group = styles[groupName];
  46. Object.keys(group).forEach(function (styleName) {
  47. var style = group[styleName];
  48. styles[styleName] = group[styleName] = {
  49. open: '\u001b[' + style[0] + 'm',
  50. close: '\u001b[' + style[1] + 'm'
  51. };
  52. });
  53. Object.defineProperty(styles, groupName, {
  54. value: group,
  55. enumerable: false
  56. });
  57. });
  58. return styles;
  59. }
  60. Object.defineProperty(module, 'exports', {
  61. enumerable: true,
  62. get: assembleStyles
  63. });
  64. },{}],3:[function(require,module,exports){
  65. "use strict";
  66. exports.__esModule = true;
  67. exports.default = function (rawLines, lineNumber, colNumber) {
  68. var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
  69. colNumber = Math.max(colNumber, 0);
  70. var highlighted = opts.highlightCode && _chalk2.default.supportsColor || opts.forceColor;
  71. var chalk = _chalk2.default;
  72. if (opts.forceColor) {
  73. chalk = new _chalk2.default.constructor({ enabled: true });
  74. }
  75. var maybeHighlight = function maybeHighlight(chalkFn, string) {
  76. return highlighted ? chalkFn(string) : string;
  77. };
  78. var defs = getDefs(chalk);
  79. if (highlighted) rawLines = highlight(defs, rawLines);
  80. var linesAbove = opts.linesAbove || 2;
  81. var linesBelow = opts.linesBelow || 3;
  82. var lines = rawLines.split(NEWLINE);
  83. var start = Math.max(lineNumber - (linesAbove + 1), 0);
  84. var end = Math.min(lines.length, lineNumber + linesBelow);
  85. if (!lineNumber && !colNumber) {
  86. start = 0;
  87. end = lines.length;
  88. }
  89. var numberMaxWidth = String(end).length;
  90. var frame = lines.slice(start, end).map(function (line, index) {
  91. var number = start + 1 + index;
  92. var paddedNumber = (" " + number).slice(-numberMaxWidth);
  93. var gutter = " " + paddedNumber + " | ";
  94. if (number === lineNumber) {
  95. var markerLine = "";
  96. if (colNumber) {
  97. var markerSpacing = line.slice(0, colNumber - 1).replace(/[^\t]/g, " ");
  98. markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, maybeHighlight(defs.marker, "^")].join("");
  99. }
  100. return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join("");
  101. } else {
  102. return " " + maybeHighlight(defs.gutter, gutter) + line;
  103. }
  104. }).join("\n");
  105. if (highlighted) {
  106. return chalk.reset(frame);
  107. } else {
  108. return frame;
  109. }
  110. };
  111. var _jsTokens = require("js-tokens");
  112. var _jsTokens2 = _interopRequireDefault(_jsTokens);
  113. var _esutils = require("esutils");
  114. var _esutils2 = _interopRequireDefault(_esutils);
  115. var _chalk = require("chalk");
  116. var _chalk2 = _interopRequireDefault(_chalk);
  117. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  118. function getDefs(chalk) {
  119. return {
  120. keyword: chalk.cyan,
  121. capitalized: chalk.yellow,
  122. jsx_tag: chalk.yellow,
  123. punctuator: chalk.yellow,
  124. number: chalk.magenta,
  125. string: chalk.green,
  126. regex: chalk.magenta,
  127. comment: chalk.grey,
  128. invalid: chalk.white.bgRed.bold,
  129. gutter: chalk.grey,
  130. marker: chalk.red.bold
  131. };
  132. }
  133. var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
  134. var JSX_TAG = /^[a-z][\w-]*$/i;
  135. var BRACKET = /^[()\[\]{}]$/;
  136. function getTokenType(match) {
  137. var _match$slice = match.slice(-2),
  138. offset = _match$slice[0],
  139. text = _match$slice[1];
  140. var token = (0, _jsTokens.matchToToken)(match);
  141. if (token.type === "name") {
  142. if (_esutils2.default.keyword.isReservedWordES6(token.value)) {
  143. return "keyword";
  144. }
  145. if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.substr(offset - 2, 2) == "</")) {
  146. return "jsx_tag";
  147. }
  148. if (token.value[0] !== token.value[0].toLowerCase()) {
  149. return "capitalized";
  150. }
  151. }
  152. if (token.type === "punctuator" && BRACKET.test(token.value)) {
  153. return "bracket";
  154. }
  155. return token.type;
  156. }
  157. function highlight(defs, text) {
  158. return text.replace(_jsTokens2.default, function () {
  159. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  160. args[_key] = arguments[_key];
  161. }
  162. var type = getTokenType(args);
  163. var colorize = defs[type];
  164. if (colorize) {
  165. return args[0].split(NEWLINE).map(function (str) {
  166. return colorize(str);
  167. }).join("\n");
  168. } else {
  169. return args[0];
  170. }
  171. });
  172. }
  173. module.exports = exports["default"];
  174. },{"chalk":122,"esutils":240,"js-tokens":248}],4:[function(require,module,exports){
  175. module.exports = require("./lib/api/node.js");
  176. },{"./lib/api/node.js":5}],5:[function(require,module,exports){
  177. "use strict";
  178. exports.__esModule = true;
  179. exports.transformFromAst = exports.transform = exports.analyse = exports.Pipeline = exports.OptionManager = exports.traverse = exports.types = exports.messages = exports.util = exports.version = exports.resolvePreset = exports.resolvePlugin = exports.template = exports.buildExternalHelpers = exports.options = exports.File = undefined;
  180. var _file = require("../transformation/file");
  181. Object.defineProperty(exports, "File", {
  182. enumerable: true,
  183. get: function get() {
  184. return _interopRequireDefault(_file).default;
  185. }
  186. });
  187. var _config = require("../transformation/file/options/config");
  188. Object.defineProperty(exports, "options", {
  189. enumerable: true,
  190. get: function get() {
  191. return _interopRequireDefault(_config).default;
  192. }
  193. });
  194. var _buildExternalHelpers = require("../tools/build-external-helpers");
  195. Object.defineProperty(exports, "buildExternalHelpers", {
  196. enumerable: true,
  197. get: function get() {
  198. return _interopRequireDefault(_buildExternalHelpers).default;
  199. }
  200. });
  201. var _babelTemplate = require("babel-template");
  202. Object.defineProperty(exports, "template", {
  203. enumerable: true,
  204. get: function get() {
  205. return _interopRequireDefault(_babelTemplate).default;
  206. }
  207. });
  208. var _resolvePlugin = require("../helpers/resolve-plugin");
  209. Object.defineProperty(exports, "resolvePlugin", {
  210. enumerable: true,
  211. get: function get() {
  212. return _interopRequireDefault(_resolvePlugin).default;
  213. }
  214. });
  215. var _resolvePreset = require("../helpers/resolve-preset");
  216. Object.defineProperty(exports, "resolvePreset", {
  217. enumerable: true,
  218. get: function get() {
  219. return _interopRequireDefault(_resolvePreset).default;
  220. }
  221. });
  222. var _package = require("../../package");
  223. Object.defineProperty(exports, "version", {
  224. enumerable: true,
  225. get: function get() {
  226. return _package.version;
  227. }
  228. });
  229. exports.Plugin = Plugin;
  230. exports.transformFile = transformFile;
  231. exports.transformFileSync = transformFileSync;
  232. var _fs = require("fs");
  233. var _fs2 = _interopRequireDefault(_fs);
  234. var _util = require("../util");
  235. var util = _interopRequireWildcard(_util);
  236. var _babelMessages = require("babel-messages");
  237. var messages = _interopRequireWildcard(_babelMessages);
  238. var _babelTypes = require("babel-types");
  239. var t = _interopRequireWildcard(_babelTypes);
  240. var _babelTraverse = require("babel-traverse");
  241. var _babelTraverse2 = _interopRequireDefault(_babelTraverse);
  242. var _optionManager = require("../transformation/file/options/option-manager");
  243. var _optionManager2 = _interopRequireDefault(_optionManager);
  244. var _pipeline = require("../transformation/pipeline");
  245. var _pipeline2 = _interopRequireDefault(_pipeline);
  246. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  247. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  248. exports.util = util;
  249. exports.messages = messages;
  250. exports.types = t;
  251. exports.traverse = _babelTraverse2.default;
  252. exports.OptionManager = _optionManager2.default;
  253. function Plugin(alias) {
  254. throw new Error("The (" + alias + ") Babel 5 plugin is being run with Babel 6.");
  255. }
  256. exports.Pipeline = _pipeline2.default;
  257. var pipeline = new _pipeline2.default();
  258. var analyse = exports.analyse = pipeline.analyse.bind(pipeline);
  259. var transform = exports.transform = pipeline.transform.bind(pipeline);
  260. var transformFromAst = exports.transformFromAst = pipeline.transformFromAst.bind(pipeline);
  261. function transformFile(filename, opts, callback) {
  262. if (typeof opts === "function") {
  263. callback = opts;
  264. opts = {};
  265. }
  266. opts.filename = filename;
  267. _fs2.default.readFile(filename, function (err, code) {
  268. var result = void 0;
  269. if (!err) {
  270. try {
  271. result = transform(code, opts);
  272. } catch (_err) {
  273. err = _err;
  274. }
  275. }
  276. if (err) {
  277. callback(err);
  278. } else {
  279. callback(null, result);
  280. }
  281. });
  282. }
  283. function transformFileSync(filename) {
  284. var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  285. opts.filename = filename;
  286. return transform(_fs2.default.readFileSync(filename, "utf8"), opts);
  287. }
  288. },{"../../package":31,"../helpers/resolve-plugin":11,"../helpers/resolve-preset":12,"../tools/build-external-helpers":15,"../transformation/file":16,"../transformation/file/options/config":20,"../transformation/file/options/option-manager":22,"../transformation/pipeline":27,"../util":30,"babel-messages":53,"babel-template":75,"babel-traverse":79,"babel-types":112,"fs":120}],6:[function(require,module,exports){
  289. "use strict";
  290. exports.__esModule = true;
  291. exports.default = getPossiblePluginNames;
  292. function getPossiblePluginNames(pluginName) {
  293. return ["babel-plugin-" + pluginName, pluginName];
  294. }
  295. module.exports = exports["default"];
  296. },{}],7:[function(require,module,exports){
  297. "use strict";
  298. exports.__esModule = true;
  299. exports.default = getPossiblePresetNames;
  300. function getPossiblePresetNames(presetName) {
  301. var possibleNames = ["babel-preset-" + presetName, presetName];
  302. var matches = presetName.match(/^(@[^/]+)\/(.+)$/);
  303. if (matches) {
  304. var orgName = matches[1],
  305. presetPath = matches[2];
  306. possibleNames.push(orgName + "/babel-preset-" + presetPath);
  307. }
  308. return possibleNames;
  309. }
  310. module.exports = exports["default"];
  311. },{}],8:[function(require,module,exports){
  312. "use strict";
  313. exports.__esModule = true;
  314. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  315. var _getIterator3 = _interopRequireDefault(_getIterator2);
  316. exports.default = function (dest, src) {
  317. if (!dest || !src) return;
  318. return (0, _mergeWith2.default)(dest, src, function (a, b) {
  319. if (b && Array.isArray(a)) {
  320. var newArray = b.slice(0);
  321. for (var _iterator = a, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  322. var _ref;
  323. if (_isArray) {
  324. if (_i >= _iterator.length) break;
  325. _ref = _iterator[_i++];
  326. } else {
  327. _i = _iterator.next();
  328. if (_i.done) break;
  329. _ref = _i.value;
  330. }
  331. var item = _ref;
  332. if (newArray.indexOf(item) < 0) {
  333. newArray.push(item);
  334. }
  335. }
  336. return newArray;
  337. }
  338. });
  339. };
  340. var _mergeWith = require("lodash/mergeWith");
  341. var _mergeWith2 = _interopRequireDefault(_mergeWith);
  342. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  343. module.exports = exports["default"];
  344. },{"babel-runtime/core-js/get-iterator":56,"lodash/mergeWith":451}],9:[function(require,module,exports){
  345. "use strict";
  346. exports.__esModule = true;
  347. exports.default = function (ast, comments, tokens) {
  348. if (ast) {
  349. if (ast.type === "Program") {
  350. return t.file(ast, comments || [], tokens || []);
  351. } else if (ast.type === "File") {
  352. return ast;
  353. }
  354. }
  355. throw new Error("Not a valid ast?");
  356. };
  357. var _babelTypes = require("babel-types");
  358. var t = _interopRequireWildcard(_babelTypes);
  359. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  360. module.exports = exports["default"];
  361. },{"babel-types":112}],10:[function(require,module,exports){
  362. "use strict";
  363. exports.__esModule = true;
  364. exports.default = resolveFromPossibleNames;
  365. var _resolve = require("./resolve");
  366. var _resolve2 = _interopRequireDefault(_resolve);
  367. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  368. function resolveFromPossibleNames(possibleNames, dirname) {
  369. return possibleNames.reduce(function (accum, curr) {
  370. return accum || (0, _resolve2.default)(curr, dirname);
  371. }, null);
  372. }
  373. module.exports = exports["default"];
  374. },{"./resolve":13}],11:[function(require,module,exports){
  375. (function (process){
  376. "use strict";
  377. exports.__esModule = true;
  378. exports.default = resolvePlugin;
  379. var _resolveFromPossibleNames = require("./resolve-from-possible-names");
  380. var _resolveFromPossibleNames2 = _interopRequireDefault(_resolveFromPossibleNames);
  381. var _getPossiblePluginNames = require("./get-possible-plugin-names");
  382. var _getPossiblePluginNames2 = _interopRequireDefault(_getPossiblePluginNames);
  383. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  384. function resolvePlugin(pluginName) {
  385. var dirname = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : process.cwd();
  386. return (0, _resolveFromPossibleNames2.default)((0, _getPossiblePluginNames2.default)(pluginName), dirname);
  387. }
  388. module.exports = exports["default"];
  389. }).call(this,require('_process'))
  390. },{"./get-possible-plugin-names":6,"./resolve-from-possible-names":10,"_process":471}],12:[function(require,module,exports){
  391. (function (process){
  392. "use strict";
  393. exports.__esModule = true;
  394. exports.default = resolvePreset;
  395. var _resolveFromPossibleNames = require("./resolve-from-possible-names");
  396. var _resolveFromPossibleNames2 = _interopRequireDefault(_resolveFromPossibleNames);
  397. var _getPossiblePresetNames = require("./get-possible-preset-names");
  398. var _getPossiblePresetNames2 = _interopRequireDefault(_getPossiblePresetNames);
  399. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  400. function resolvePreset(presetName) {
  401. var dirname = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : process.cwd();
  402. return (0, _resolveFromPossibleNames2.default)((0, _getPossiblePresetNames2.default)(presetName), dirname);
  403. }
  404. module.exports = exports["default"];
  405. }).call(this,require('_process'))
  406. },{"./get-possible-preset-names":7,"./resolve-from-possible-names":10,"_process":471}],13:[function(require,module,exports){
  407. (function (process){
  408. "use strict";
  409. exports.__esModule = true;
  410. var _typeof2 = require("babel-runtime/helpers/typeof");
  411. var _typeof3 = _interopRequireDefault(_typeof2);
  412. exports.default = function (loc) {
  413. var relative = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : process.cwd();
  414. if ((typeof _module2.default === "undefined" ? "undefined" : (0, _typeof3.default)(_module2.default)) === "object") return null;
  415. var relativeMod = relativeModules[relative];
  416. if (!relativeMod) {
  417. relativeMod = new _module2.default();
  418. var filename = _path2.default.join(relative, ".babelrc");
  419. relativeMod.id = filename;
  420. relativeMod.filename = filename;
  421. relativeMod.paths = _module2.default._nodeModulePaths(relative);
  422. relativeModules[relative] = relativeMod;
  423. }
  424. try {
  425. return _module2.default._resolveFilename(loc, relativeMod);
  426. } catch (err) {
  427. return null;
  428. }
  429. };
  430. var _module = require("module");
  431. var _module2 = _interopRequireDefault(_module);
  432. var _path = require("path");
  433. var _path2 = _interopRequireDefault(_path);
  434. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  435. var relativeModules = {};
  436. module.exports = exports["default"];
  437. }).call(this,require('_process'))
  438. },{"_process":471,"babel-runtime/helpers/typeof":74,"module":120,"path":469}],14:[function(require,module,exports){
  439. "use strict";
  440. exports.__esModule = true;
  441. var _map = require("babel-runtime/core-js/map");
  442. var _map2 = _interopRequireDefault(_map);
  443. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  444. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  445. var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn");
  446. var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
  447. var _inherits2 = require("babel-runtime/helpers/inherits");
  448. var _inherits3 = _interopRequireDefault(_inherits2);
  449. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  450. var Store = function (_Map) {
  451. (0, _inherits3.default)(Store, _Map);
  452. function Store() {
  453. (0, _classCallCheck3.default)(this, Store);
  454. var _this = (0, _possibleConstructorReturn3.default)(this, _Map.call(this));
  455. _this.dynamicData = {};
  456. return _this;
  457. }
  458. Store.prototype.setDynamic = function setDynamic(key, fn) {
  459. this.dynamicData[key] = fn;
  460. };
  461. Store.prototype.get = function get(key) {
  462. if (this.has(key)) {
  463. return _Map.prototype.get.call(this, key);
  464. } else {
  465. if (Object.prototype.hasOwnProperty.call(this.dynamicData, key)) {
  466. var val = this.dynamicData[key]();
  467. this.set(key, val);
  468. return val;
  469. }
  470. }
  471. };
  472. return Store;
  473. }(_map2.default);
  474. exports.default = Store;
  475. module.exports = exports["default"];
  476. },{"babel-runtime/core-js/map":58,"babel-runtime/helpers/classCallCheck":70,"babel-runtime/helpers/inherits":71,"babel-runtime/helpers/possibleConstructorReturn":73}],15:[function(require,module,exports){
  477. "use strict";
  478. exports.__esModule = true;
  479. exports.default = function (whitelist) {
  480. var outputType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "global";
  481. var namespace = t.identifier("babelHelpers");
  482. var builder = function builder(body) {
  483. return buildHelpers(body, namespace, whitelist);
  484. };
  485. var tree = void 0;
  486. var build = {
  487. global: buildGlobal,
  488. umd: buildUmd,
  489. var: buildVar
  490. }[outputType];
  491. if (build) {
  492. tree = build(namespace, builder);
  493. } else {
  494. throw new Error(messages.get("unsupportedOutputType", outputType));
  495. }
  496. return (0, _babelGenerator2.default)(tree).code;
  497. };
  498. var _babelHelpers = require("babel-helpers");
  499. var helpers = _interopRequireWildcard(_babelHelpers);
  500. var _babelGenerator = require("babel-generator");
  501. var _babelGenerator2 = _interopRequireDefault(_babelGenerator);
  502. var _babelMessages = require("babel-messages");
  503. var messages = _interopRequireWildcard(_babelMessages);
  504. var _babelTemplate = require("babel-template");
  505. var _babelTemplate2 = _interopRequireDefault(_babelTemplate);
  506. var _babelTypes = require("babel-types");
  507. var t = _interopRequireWildcard(_babelTypes);
  508. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  509. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  510. var buildUmdWrapper = (0, _babelTemplate2.default)("\n (function (root, factory) {\n if (typeof define === \"function\" && define.amd) {\n define(AMD_ARGUMENTS, factory);\n } else if (typeof exports === \"object\") {\n factory(COMMON_ARGUMENTS);\n } else {\n factory(BROWSER_ARGUMENTS);\n }\n })(UMD_ROOT, function (FACTORY_PARAMETERS) {\n FACTORY_BODY\n });\n");
  511. function buildGlobal(namespace, builder) {
  512. var body = [];
  513. var container = t.functionExpression(null, [t.identifier("global")], t.blockStatement(body));
  514. var tree = t.program([t.expressionStatement(t.callExpression(container, [helpers.get("selfGlobal")]))]);
  515. body.push(t.variableDeclaration("var", [t.variableDeclarator(namespace, t.assignmentExpression("=", t.memberExpression(t.identifier("global"), namespace), t.objectExpression([])))]));
  516. builder(body);
  517. return tree;
  518. }
  519. function buildUmd(namespace, builder) {
  520. var body = [];
  521. body.push(t.variableDeclaration("var", [t.variableDeclarator(namespace, t.identifier("global"))]));
  522. builder(body);
  523. return t.program([buildUmdWrapper({
  524. FACTORY_PARAMETERS: t.identifier("global"),
  525. BROWSER_ARGUMENTS: t.assignmentExpression("=", t.memberExpression(t.identifier("root"), namespace), t.objectExpression([])),
  526. COMMON_ARGUMENTS: t.identifier("exports"),
  527. AMD_ARGUMENTS: t.arrayExpression([t.stringLiteral("exports")]),
  528. FACTORY_BODY: body,
  529. UMD_ROOT: t.identifier("this")
  530. })]);
  531. }
  532. function buildVar(namespace, builder) {
  533. var body = [];
  534. body.push(t.variableDeclaration("var", [t.variableDeclarator(namespace, t.objectExpression([]))]));
  535. builder(body);
  536. body.push(t.expressionStatement(namespace));
  537. return t.program(body);
  538. }
  539. function buildHelpers(body, namespace, whitelist) {
  540. helpers.list.forEach(function (name) {
  541. if (whitelist && whitelist.indexOf(name) < 0) return;
  542. var key = t.identifier(name);
  543. body.push(t.expressionStatement(t.assignmentExpression("=", t.memberExpression(namespace, key), helpers.get(name))));
  544. });
  545. }
  546. module.exports = exports["default"];
  547. },{"babel-generator":43,"babel-helpers":52,"babel-messages":53,"babel-template":75,"babel-types":112}],16:[function(require,module,exports){
  548. (function (process){
  549. "use strict";
  550. exports.__esModule = true;
  551. exports.File = undefined;
  552. var _typeof2 = require("babel-runtime/helpers/typeof");
  553. var _typeof3 = _interopRequireDefault(_typeof2);
  554. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  555. var _getIterator3 = _interopRequireDefault(_getIterator2);
  556. var _create = require("babel-runtime/core-js/object/create");
  557. var _create2 = _interopRequireDefault(_create);
  558. var _assign = require("babel-runtime/core-js/object/assign");
  559. var _assign2 = _interopRequireDefault(_assign);
  560. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  561. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  562. var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn");
  563. var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
  564. var _inherits2 = require("babel-runtime/helpers/inherits");
  565. var _inherits3 = _interopRequireDefault(_inherits2);
  566. var _babelHelpers = require("babel-helpers");
  567. var _babelHelpers2 = _interopRequireDefault(_babelHelpers);
  568. var _metadata = require("./metadata");
  569. var metadataVisitor = _interopRequireWildcard(_metadata);
  570. var _convertSourceMap = require("convert-source-map");
  571. var _convertSourceMap2 = _interopRequireDefault(_convertSourceMap);
  572. var _optionManager = require("./options/option-manager");
  573. var _optionManager2 = _interopRequireDefault(_optionManager);
  574. var _pluginPass = require("../plugin-pass");
  575. var _pluginPass2 = _interopRequireDefault(_pluginPass);
  576. var _babelTraverse = require("babel-traverse");
  577. var _babelTraverse2 = _interopRequireDefault(_babelTraverse);
  578. var _sourceMap = require("source-map");
  579. var _sourceMap2 = _interopRequireDefault(_sourceMap);
  580. var _babelGenerator = require("babel-generator");
  581. var _babelGenerator2 = _interopRequireDefault(_babelGenerator);
  582. var _babelCodeFrame = require("babel-code-frame");
  583. var _babelCodeFrame2 = _interopRequireDefault(_babelCodeFrame);
  584. var _defaults = require("lodash/defaults");
  585. var _defaults2 = _interopRequireDefault(_defaults);
  586. var _logger = require("./logger");
  587. var _logger2 = _interopRequireDefault(_logger);
  588. var _store = require("../../store");
  589. var _store2 = _interopRequireDefault(_store);
  590. var _babylon = require("babylon");
  591. var _util = require("../../util");
  592. var util = _interopRequireWildcard(_util);
  593. var _path = require("path");
  594. var _path2 = _interopRequireDefault(_path);
  595. var _babelTypes = require("babel-types");
  596. var t = _interopRequireWildcard(_babelTypes);
  597. var _resolve = require("../../helpers/resolve");
  598. var _resolve2 = _interopRequireDefault(_resolve);
  599. var _blockHoist = require("../internal-plugins/block-hoist");
  600. var _blockHoist2 = _interopRequireDefault(_blockHoist);
  601. var _shadowFunctions = require("../internal-plugins/shadow-functions");
  602. var _shadowFunctions2 = _interopRequireDefault(_shadowFunctions);
  603. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  604. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  605. var shebangRegex = /^#!.*/;
  606. var INTERNAL_PLUGINS = [[_blockHoist2.default], [_shadowFunctions2.default]];
  607. var errorVisitor = {
  608. enter: function enter(path, state) {
  609. var loc = path.node.loc;
  610. if (loc) {
  611. state.loc = loc;
  612. path.stop();
  613. }
  614. }
  615. };
  616. var File = function (_Store) {
  617. (0, _inherits3.default)(File, _Store);
  618. function File() {
  619. var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  620. var pipeline = arguments[1];
  621. (0, _classCallCheck3.default)(this, File);
  622. var _this = (0, _possibleConstructorReturn3.default)(this, _Store.call(this));
  623. _this.pipeline = pipeline;
  624. _this.log = new _logger2.default(_this, opts.filename || "unknown");
  625. _this.opts = _this.initOptions(opts);
  626. _this.parserOpts = {
  627. sourceType: _this.opts.sourceType,
  628. sourceFileName: _this.opts.filename,
  629. plugins: []
  630. };
  631. _this.pluginVisitors = [];
  632. _this.pluginPasses = [];
  633. _this.buildPluginsForOptions(_this.opts);
  634. if (_this.opts.passPerPreset) {
  635. _this.perPresetOpts = [];
  636. _this.opts.presets.forEach(function (presetOpts) {
  637. var perPresetOpts = (0, _assign2.default)((0, _create2.default)(_this.opts), presetOpts);
  638. _this.perPresetOpts.push(perPresetOpts);
  639. _this.buildPluginsForOptions(perPresetOpts);
  640. });
  641. }
  642. _this.metadata = {
  643. usedHelpers: [],
  644. marked: [],
  645. modules: {
  646. imports: [],
  647. exports: {
  648. exported: [],
  649. specifiers: []
  650. }
  651. }
  652. };
  653. _this.dynamicImportTypes = {};
  654. _this.dynamicImportIds = {};
  655. _this.dynamicImports = [];
  656. _this.declarations = {};
  657. _this.usedHelpers = {};
  658. _this.path = null;
  659. _this.ast = {};
  660. _this.code = "";
  661. _this.shebang = "";
  662. _this.hub = new _babelTraverse.Hub(_this);
  663. return _this;
  664. }
  665. File.prototype.getMetadata = function getMetadata() {
  666. var has = false;
  667. for (var _iterator = this.ast.program.body, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  668. var _ref;
  669. if (_isArray) {
  670. if (_i >= _iterator.length) break;
  671. _ref = _iterator[_i++];
  672. } else {
  673. _i = _iterator.next();
  674. if (_i.done) break;
  675. _ref = _i.value;
  676. }
  677. var node = _ref;
  678. if (t.isModuleDeclaration(node)) {
  679. has = true;
  680. break;
  681. }
  682. }
  683. if (has) {
  684. this.path.traverse(metadataVisitor, this);
  685. }
  686. };
  687. File.prototype.initOptions = function initOptions(opts) {
  688. opts = new _optionManager2.default(this.log, this.pipeline).init(opts);
  689. if (opts.inputSourceMap) {
  690. opts.sourceMaps = true;
  691. }
  692. if (opts.moduleId) {
  693. opts.moduleIds = true;
  694. }
  695. opts.basename = _path2.default.basename(opts.filename, _path2.default.extname(opts.filename));
  696. opts.ignore = util.arrayify(opts.ignore, util.regexify);
  697. if (opts.only) opts.only = util.arrayify(opts.only, util.regexify);
  698. (0, _defaults2.default)(opts, {
  699. moduleRoot: opts.sourceRoot
  700. });
  701. (0, _defaults2.default)(opts, {
  702. sourceRoot: opts.moduleRoot
  703. });
  704. (0, _defaults2.default)(opts, {
  705. filenameRelative: opts.filename
  706. });
  707. var basenameRelative = _path2.default.basename(opts.filenameRelative);
  708. (0, _defaults2.default)(opts, {
  709. sourceFileName: basenameRelative,
  710. sourceMapTarget: basenameRelative
  711. });
  712. return opts;
  713. };
  714. File.prototype.buildPluginsForOptions = function buildPluginsForOptions(opts) {
  715. if (!Array.isArray(opts.plugins)) {
  716. return;
  717. }
  718. var plugins = opts.plugins.concat(INTERNAL_PLUGINS);
  719. var currentPluginVisitors = [];
  720. var currentPluginPasses = [];
  721. for (var _iterator2 = plugins, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  722. var _ref2;
  723. if (_isArray2) {
  724. if (_i2 >= _iterator2.length) break;
  725. _ref2 = _iterator2[_i2++];
  726. } else {
  727. _i2 = _iterator2.next();
  728. if (_i2.done) break;
  729. _ref2 = _i2.value;
  730. }
  731. var ref = _ref2;
  732. var plugin = ref[0],
  733. pluginOpts = ref[1];
  734. currentPluginVisitors.push(plugin.visitor);
  735. currentPluginPasses.push(new _pluginPass2.default(this, plugin, pluginOpts));
  736. if (plugin.manipulateOptions) {
  737. plugin.manipulateOptions(opts, this.parserOpts, this);
  738. }
  739. }
  740. this.pluginVisitors.push(currentPluginVisitors);
  741. this.pluginPasses.push(currentPluginPasses);
  742. };
  743. File.prototype.getModuleName = function getModuleName() {
  744. var opts = this.opts;
  745. if (!opts.moduleIds) {
  746. return null;
  747. }
  748. if (opts.moduleId != null && !opts.getModuleId) {
  749. return opts.moduleId;
  750. }
  751. var filenameRelative = opts.filenameRelative;
  752. var moduleName = "";
  753. if (opts.moduleRoot != null) {
  754. moduleName = opts.moduleRoot + "/";
  755. }
  756. if (!opts.filenameRelative) {
  757. return moduleName + opts.filename.replace(/^\//, "");
  758. }
  759. if (opts.sourceRoot != null) {
  760. var sourceRootRegEx = new RegExp("^" + opts.sourceRoot + "\/?");
  761. filenameRelative = filenameRelative.replace(sourceRootRegEx, "");
  762. }
  763. filenameRelative = filenameRelative.replace(/\.(\w*?)$/, "");
  764. moduleName += filenameRelative;
  765. moduleName = moduleName.replace(/\\/g, "/");
  766. if (opts.getModuleId) {
  767. return opts.getModuleId(moduleName) || moduleName;
  768. } else {
  769. return moduleName;
  770. }
  771. };
  772. File.prototype.resolveModuleSource = function resolveModuleSource(source) {
  773. var resolveModuleSource = this.opts.resolveModuleSource;
  774. if (resolveModuleSource) source = resolveModuleSource(source, this.opts.filename);
  775. return source;
  776. };
  777. File.prototype.addImport = function addImport(source, imported) {
  778. var name = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : imported;
  779. var alias = source + ":" + imported;
  780. var id = this.dynamicImportIds[alias];
  781. if (!id) {
  782. source = this.resolveModuleSource(source);
  783. id = this.dynamicImportIds[alias] = this.scope.generateUidIdentifier(name);
  784. var specifiers = [];
  785. if (imported === "*") {
  786. specifiers.push(t.importNamespaceSpecifier(id));
  787. } else if (imported === "default") {
  788. specifiers.push(t.importDefaultSpecifier(id));
  789. } else {
  790. specifiers.push(t.importSpecifier(id, t.identifier(imported)));
  791. }
  792. var declar = t.importDeclaration(specifiers, t.stringLiteral(source));
  793. declar._blockHoist = 3;
  794. this.path.unshiftContainer("body", declar);
  795. }
  796. return id;
  797. };
  798. File.prototype.addHelper = function addHelper(name) {
  799. var declar = this.declarations[name];
  800. if (declar) return declar;
  801. if (!this.usedHelpers[name]) {
  802. this.metadata.usedHelpers.push(name);
  803. this.usedHelpers[name] = true;
  804. }
  805. var generator = this.get("helperGenerator");
  806. var runtime = this.get("helpersNamespace");
  807. if (generator) {
  808. var res = generator(name);
  809. if (res) return res;
  810. } else if (runtime) {
  811. return t.memberExpression(runtime, t.identifier(name));
  812. }
  813. var ref = (0, _babelHelpers2.default)(name);
  814. var uid = this.declarations[name] = this.scope.generateUidIdentifier(name);
  815. if (t.isFunctionExpression(ref) && !ref.id) {
  816. ref.body._compact = true;
  817. ref._generated = true;
  818. ref.id = uid;
  819. ref.type = "FunctionDeclaration";
  820. this.path.unshiftContainer("body", ref);
  821. } else {
  822. ref._compact = true;
  823. this.scope.push({
  824. id: uid,
  825. init: ref,
  826. unique: true
  827. });
  828. }
  829. return uid;
  830. };
  831. File.prototype.addTemplateObject = function addTemplateObject(helperName, strings, raw) {
  832. var stringIds = raw.elements.map(function (string) {
  833. return string.value;
  834. });
  835. var name = helperName + "_" + raw.elements.length + "_" + stringIds.join(",");
  836. var declar = this.declarations[name];
  837. if (declar) return declar;
  838. var uid = this.declarations[name] = this.scope.generateUidIdentifier("templateObject");
  839. var helperId = this.addHelper(helperName);
  840. var init = t.callExpression(helperId, [strings, raw]);
  841. init._compact = true;
  842. this.scope.push({
  843. id: uid,
  844. init: init,
  845. _blockHoist: 1.9 });
  846. return uid;
  847. };
  848. File.prototype.buildCodeFrameError = function buildCodeFrameError(node, msg) {
  849. var Error = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : SyntaxError;
  850. var loc = node && (node.loc || node._loc);
  851. var err = new Error(msg);
  852. if (loc) {
  853. err.loc = loc.start;
  854. } else {
  855. (0, _babelTraverse2.default)(node, errorVisitor, this.scope, err);
  856. err.message += " (This is an error on an internal node. Probably an internal error";
  857. if (err.loc) {
  858. err.message += ". Location has been estimated.";
  859. }
  860. err.message += ")";
  861. }
  862. return err;
  863. };
  864. File.prototype.mergeSourceMap = function mergeSourceMap(map) {
  865. var inputMap = this.opts.inputSourceMap;
  866. if (inputMap) {
  867. var _ret = function () {
  868. var inputMapConsumer = new _sourceMap2.default.SourceMapConsumer(inputMap);
  869. var outputMapConsumer = new _sourceMap2.default.SourceMapConsumer(map);
  870. var mergedGenerator = new _sourceMap2.default.SourceMapGenerator({
  871. file: inputMapConsumer.file,
  872. sourceRoot: inputMapConsumer.sourceRoot
  873. });
  874. var source = outputMapConsumer.sources[0];
  875. inputMapConsumer.eachMapping(function (mapping) {
  876. var generatedPosition = outputMapConsumer.generatedPositionFor({
  877. line: mapping.generatedLine,
  878. column: mapping.generatedColumn,
  879. source: source
  880. });
  881. if (generatedPosition.column != null) {
  882. mergedGenerator.addMapping({
  883. source: mapping.source,
  884. original: mapping.source == null ? null : {
  885. line: mapping.originalLine,
  886. column: mapping.originalColumn
  887. },
  888. generated: generatedPosition
  889. });
  890. }
  891. });
  892. var mergedMap = mergedGenerator.toJSON();
  893. inputMap.mappings = mergedMap.mappings;
  894. return {
  895. v: inputMap
  896. };
  897. }();
  898. if ((typeof _ret === "undefined" ? "undefined" : (0, _typeof3.default)(_ret)) === "object") return _ret.v;
  899. } else {
  900. return map;
  901. }
  902. };
  903. File.prototype.parse = function parse(code) {
  904. var parseCode = _babylon.parse;
  905. var parserOpts = this.opts.parserOpts;
  906. if (parserOpts) {
  907. parserOpts = (0, _assign2.default)({}, this.parserOpts, parserOpts);
  908. if (parserOpts.parser) {
  909. if (typeof parserOpts.parser === "string") {
  910. var dirname = _path2.default.dirname(this.opts.filename) || process.cwd();
  911. var parser = (0, _resolve2.default)(parserOpts.parser, dirname);
  912. if (parser) {
  913. parseCode = require(parser).parse;
  914. } else {
  915. throw new Error("Couldn't find parser " + parserOpts.parser + " with \"parse\" method " + ("relative to directory " + dirname));
  916. }
  917. } else {
  918. parseCode = parserOpts.parser;
  919. }
  920. parserOpts.parser = {
  921. parse: function parse(source) {
  922. return (0, _babylon.parse)(source, parserOpts);
  923. }
  924. };
  925. }
  926. }
  927. this.log.debug("Parse start");
  928. var ast = parseCode(code, parserOpts || this.parserOpts);
  929. this.log.debug("Parse stop");
  930. return ast;
  931. };
  932. File.prototype._addAst = function _addAst(ast) {
  933. this.path = _babelTraverse.NodePath.get({
  934. hub: this.hub,
  935. parentPath: null,
  936. parent: ast,
  937. container: ast,
  938. key: "program"
  939. }).setContext();
  940. this.scope = this.path.scope;
  941. this.ast = ast;
  942. this.getMetadata();
  943. };
  944. File.prototype.addAst = function addAst(ast) {
  945. this.log.debug("Start set AST");
  946. this._addAst(ast);
  947. this.log.debug("End set AST");
  948. };
  949. File.prototype.transform = function transform() {
  950. for (var i = 0; i < this.pluginPasses.length; i++) {
  951. var pluginPasses = this.pluginPasses[i];
  952. this.call("pre", pluginPasses);
  953. this.log.debug("Start transform traverse");
  954. var visitor = _babelTraverse2.default.visitors.merge(this.pluginVisitors[i], pluginPasses, this.opts.wrapPluginVisitorMethod);
  955. (0, _babelTraverse2.default)(this.ast, visitor, this.scope);
  956. this.log.debug("End transform traverse");
  957. this.call("post", pluginPasses);
  958. }
  959. return this.generate();
  960. };
  961. File.prototype.wrap = function wrap(code, callback) {
  962. code = code + "";
  963. try {
  964. if (this.shouldIgnore()) {
  965. return this.makeResult({ code: code, ignored: true });
  966. } else {
  967. return callback();
  968. }
  969. } catch (err) {
  970. if (err._babel) {
  971. throw err;
  972. } else {
  973. err._babel = true;
  974. }
  975. var message = err.message = this.opts.filename + ": " + err.message;
  976. var loc = err.loc;
  977. if (loc) {
  978. err.codeFrame = (0, _babelCodeFrame2.default)(code, loc.line, loc.column + 1, this.opts);
  979. message += "\n" + err.codeFrame;
  980. }
  981. if (process.browser) {
  982. err.message = message;
  983. }
  984. if (err.stack) {
  985. var newStack = err.stack.replace(err.message, message);
  986. err.stack = newStack;
  987. }
  988. throw err;
  989. }
  990. };
  991. File.prototype.addCode = function addCode(code) {
  992. code = (code || "") + "";
  993. code = this.parseInputSourceMap(code);
  994. this.code = code;
  995. };
  996. File.prototype.parseCode = function parseCode() {
  997. this.parseShebang();
  998. var ast = this.parse(this.code);
  999. this.addAst(ast);
  1000. };
  1001. File.prototype.shouldIgnore = function shouldIgnore() {
  1002. var opts = this.opts;
  1003. return util.shouldIgnore(opts.filename, opts.ignore, opts.only);
  1004. };
  1005. File.prototype.call = function call(key, pluginPasses) {
  1006. for (var _iterator3 = pluginPasses, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) {
  1007. var _ref3;
  1008. if (_isArray3) {
  1009. if (_i3 >= _iterator3.length) break;
  1010. _ref3 = _iterator3[_i3++];
  1011. } else {
  1012. _i3 = _iterator3.next();
  1013. if (_i3.done) break;
  1014. _ref3 = _i3.value;
  1015. }
  1016. var pass = _ref3;
  1017. var plugin = pass.plugin;
  1018. var fn = plugin[key];
  1019. if (fn) fn.call(pass, this);
  1020. }
  1021. };
  1022. File.prototype.parseInputSourceMap = function parseInputSourceMap(code) {
  1023. var opts = this.opts;
  1024. if (opts.inputSourceMap !== false) {
  1025. var inputMap = _convertSourceMap2.default.fromSource(code);
  1026. if (inputMap) {
  1027. opts.inputSourceMap = inputMap.toObject();
  1028. code = _convertSourceMap2.default.removeComments(code);
  1029. }
  1030. }
  1031. return code;
  1032. };
  1033. File.prototype.parseShebang = function parseShebang() {
  1034. var shebangMatch = shebangRegex.exec(this.code);
  1035. if (shebangMatch) {
  1036. this.shebang = shebangMatch[0];
  1037. this.code = this.code.replace(shebangRegex, "");
  1038. }
  1039. };
  1040. File.prototype.makeResult = function makeResult(_ref4) {
  1041. var code = _ref4.code,
  1042. map = _ref4.map,
  1043. ast = _ref4.ast,
  1044. ignored = _ref4.ignored;
  1045. var result = {
  1046. metadata: null,
  1047. options: this.opts,
  1048. ignored: !!ignored,
  1049. code: null,
  1050. ast: null,
  1051. map: map || null
  1052. };
  1053. if (this.opts.code) {
  1054. result.code = code;
  1055. }
  1056. if (this.opts.ast) {
  1057. result.ast = ast;
  1058. }
  1059. if (this.opts.metadata) {
  1060. result.metadata = this.metadata;
  1061. }
  1062. return result;
  1063. };
  1064. File.prototype.generate = function generate() {
  1065. var opts = this.opts;
  1066. var ast = this.ast;
  1067. var result = { ast: ast };
  1068. if (!opts.code) return this.makeResult(result);
  1069. var gen = _babelGenerator2.default;
  1070. if (opts.generatorOpts.generator) {
  1071. gen = opts.generatorOpts.generator;
  1072. if (typeof gen === "string") {
  1073. var dirname = _path2.default.dirname(this.opts.filename) || process.cwd();
  1074. var generator = (0, _resolve2.default)(gen, dirname);
  1075. if (generator) {
  1076. gen = require(generator).print;
  1077. } else {
  1078. throw new Error("Couldn't find generator " + gen + " with \"print\" method relative " + ("to directory " + dirname));
  1079. }
  1080. }
  1081. }
  1082. this.log.debug("Generation start");
  1083. var _result = gen(ast, opts.generatorOpts ? (0, _assign2.default)(opts, opts.generatorOpts) : opts, this.code);
  1084. result.code = _result.code;
  1085. result.map = _result.map;
  1086. this.log.debug("Generation end");
  1087. if (this.shebang) {
  1088. result.code = this.shebang + "\n" + result.code;
  1089. }
  1090. if (result.map) {
  1091. result.map = this.mergeSourceMap(result.map);
  1092. }
  1093. if (opts.sourceMaps === "inline" || opts.sourceMaps === "both") {
  1094. result.code += "\n" + _convertSourceMap2.default.fromObject(result.map).toComment();
  1095. }
  1096. if (opts.sourceMaps === "inline") {
  1097. result.map = null;
  1098. }
  1099. return this.makeResult(result);
  1100. };
  1101. return File;
  1102. }(_store2.default);
  1103. exports.default = File;
  1104. exports.File = File;
  1105. }).call(this,require('_process'))
  1106. },{"../../helpers/resolve":13,"../../store":14,"../../util":30,"../internal-plugins/block-hoist":25,"../internal-plugins/shadow-functions":26,"../plugin-pass":28,"./logger":17,"./metadata":18,"./options/option-manager":22,"_process":471,"babel-code-frame":3,"babel-generator":43,"babel-helpers":52,"babel-runtime/core-js/get-iterator":56,"babel-runtime/core-js/object/assign":60,"babel-runtime/core-js/object/create":61,"babel-runtime/helpers/classCallCheck":70,"babel-runtime/helpers/inherits":71,"babel-runtime/helpers/possibleConstructorReturn":73,"babel-runtime/helpers/typeof":74,"babel-traverse":79,"babel-types":112,"babylon":116,"convert-source-map":124,"lodash/defaults":420,"path":469,"source-map":484}],17:[function(require,module,exports){
  1107. "use strict";
  1108. exports.__esModule = true;
  1109. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  1110. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  1111. var _node = require("debug/node");
  1112. var _node2 = _interopRequireDefault(_node);
  1113. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1114. var verboseDebug = (0, _node2.default)("babel:verbose");
  1115. var generalDebug = (0, _node2.default)("babel");
  1116. var seenDeprecatedMessages = [];
  1117. var Logger = function () {
  1118. function Logger(file, filename) {
  1119. (0, _classCallCheck3.default)(this, Logger);
  1120. this.filename = filename;
  1121. this.file = file;
  1122. }
  1123. Logger.prototype._buildMessage = function _buildMessage(msg) {
  1124. var parts = "[BABEL] " + this.filename;
  1125. if (msg) parts += ": " + msg;
  1126. return parts;
  1127. };
  1128. Logger.prototype.warn = function warn(msg) {
  1129. console.warn(this._buildMessage(msg));
  1130. };
  1131. Logger.prototype.error = function error(msg) {
  1132. var Constructor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Error;
  1133. throw new Constructor(this._buildMessage(msg));
  1134. };
  1135. Logger.prototype.deprecate = function deprecate(msg) {
  1136. if (this.file.opts && this.file.opts.suppressDeprecationMessages) return;
  1137. msg = this._buildMessage(msg);
  1138. if (seenDeprecatedMessages.indexOf(msg) >= 0) return;
  1139. seenDeprecatedMessages.push(msg);
  1140. console.error(msg);
  1141. };
  1142. Logger.prototype.verbose = function verbose(msg) {
  1143. if (verboseDebug.enabled) verboseDebug(this._buildMessage(msg));
  1144. };
  1145. Logger.prototype.debug = function debug(msg) {
  1146. if (generalDebug.enabled) generalDebug(this._buildMessage(msg));
  1147. };
  1148. Logger.prototype.deopt = function deopt(node, msg) {
  1149. this.debug(msg);
  1150. };
  1151. return Logger;
  1152. }();
  1153. exports.default = Logger;
  1154. module.exports = exports["default"];
  1155. },{"babel-runtime/helpers/classCallCheck":70,"debug/node":231}],18:[function(require,module,exports){
  1156. "use strict";
  1157. exports.__esModule = true;
  1158. exports.ImportDeclaration = exports.ModuleDeclaration = undefined;
  1159. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  1160. var _getIterator3 = _interopRequireDefault(_getIterator2);
  1161. exports.ExportDeclaration = ExportDeclaration;
  1162. exports.Scope = Scope;
  1163. var _babelTypes = require("babel-types");
  1164. var t = _interopRequireWildcard(_babelTypes);
  1165. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  1166. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1167. var ModuleDeclaration = exports.ModuleDeclaration = {
  1168. enter: function enter(path, file) {
  1169. var node = path.node;
  1170. if (node.source) {
  1171. node.source.value = file.resolveModuleSource(node.source.value);
  1172. }
  1173. }
  1174. };
  1175. var ImportDeclaration = exports.ImportDeclaration = {
  1176. exit: function exit(path, file) {
  1177. var node = path.node;
  1178. var specifiers = [];
  1179. var imported = [];
  1180. file.metadata.modules.imports.push({
  1181. source: node.source.value,
  1182. imported: imported,
  1183. specifiers: specifiers
  1184. });
  1185. for (var _iterator = path.get("specifiers"), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  1186. var _ref;
  1187. if (_isArray) {
  1188. if (_i >= _iterator.length) break;
  1189. _ref = _iterator[_i++];
  1190. } else {
  1191. _i = _iterator.next();
  1192. if (_i.done) break;
  1193. _ref = _i.value;
  1194. }
  1195. var specifier = _ref;
  1196. var local = specifier.node.local.name;
  1197. if (specifier.isImportDefaultSpecifier()) {
  1198. imported.push("default");
  1199. specifiers.push({
  1200. kind: "named",
  1201. imported: "default",
  1202. local: local
  1203. });
  1204. }
  1205. if (specifier.isImportSpecifier()) {
  1206. var importedName = specifier.node.imported.name;
  1207. imported.push(importedName);
  1208. specifiers.push({
  1209. kind: "named",
  1210. imported: importedName,
  1211. local: local
  1212. });
  1213. }
  1214. if (specifier.isImportNamespaceSpecifier()) {
  1215. imported.push("*");
  1216. specifiers.push({
  1217. kind: "namespace",
  1218. local: local
  1219. });
  1220. }
  1221. }
  1222. }
  1223. };
  1224. function ExportDeclaration(path, file) {
  1225. var node = path.node;
  1226. var source = node.source ? node.source.value : null;
  1227. var exports = file.metadata.modules.exports;
  1228. var declar = path.get("declaration");
  1229. if (declar.isStatement()) {
  1230. var bindings = declar.getBindingIdentifiers();
  1231. for (var name in bindings) {
  1232. exports.exported.push(name);
  1233. exports.specifiers.push({
  1234. kind: "local",
  1235. local: name,
  1236. exported: path.isExportDefaultDeclaration() ? "default" : name
  1237. });
  1238. }
  1239. }
  1240. if (path.isExportNamedDeclaration() && node.specifiers) {
  1241. for (var _iterator2 = node.specifiers, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  1242. var _ref2;
  1243. if (_isArray2) {
  1244. if (_i2 >= _iterator2.length) break;
  1245. _ref2 = _iterator2[_i2++];
  1246. } else {
  1247. _i2 = _iterator2.next();
  1248. if (_i2.done) break;
  1249. _ref2 = _i2.value;
  1250. }
  1251. var specifier = _ref2;
  1252. var exported = specifier.exported.name;
  1253. exports.exported.push(exported);
  1254. if (t.isExportDefaultSpecifier(specifier)) {
  1255. exports.specifiers.push({
  1256. kind: "external",
  1257. local: exported,
  1258. exported: exported,
  1259. source: source
  1260. });
  1261. }
  1262. if (t.isExportNamespaceSpecifier(specifier)) {
  1263. exports.specifiers.push({
  1264. kind: "external-namespace",
  1265. exported: exported,
  1266. source: source
  1267. });
  1268. }
  1269. var local = specifier.local;
  1270. if (!local) continue;
  1271. if (source) {
  1272. exports.specifiers.push({
  1273. kind: "external",
  1274. local: local.name,
  1275. exported: exported,
  1276. source: source
  1277. });
  1278. }
  1279. if (!source) {
  1280. exports.specifiers.push({
  1281. kind: "local",
  1282. local: local.name,
  1283. exported: exported
  1284. });
  1285. }
  1286. }
  1287. }
  1288. if (path.isExportAllDeclaration()) {
  1289. exports.specifiers.push({
  1290. kind: "external-all",
  1291. source: source
  1292. });
  1293. }
  1294. }
  1295. function Scope(path) {
  1296. path.skip();
  1297. }
  1298. },{"babel-runtime/core-js/get-iterator":56,"babel-types":112}],19:[function(require,module,exports){
  1299. (function (process){
  1300. "use strict";
  1301. exports.__esModule = true;
  1302. var _assign = require("babel-runtime/core-js/object/assign");
  1303. var _assign2 = _interopRequireDefault(_assign);
  1304. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  1305. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  1306. exports.default = buildConfigChain;
  1307. var _resolve = require("../../../helpers/resolve");
  1308. var _resolve2 = _interopRequireDefault(_resolve);
  1309. var _json = require("json5");
  1310. var _json2 = _interopRequireDefault(_json);
  1311. var _pathIsAbsolute = require("path-is-absolute");
  1312. var _pathIsAbsolute2 = _interopRequireDefault(_pathIsAbsolute);
  1313. var _path = require("path");
  1314. var _path2 = _interopRequireDefault(_path);
  1315. var _fs = require("fs");
  1316. var _fs2 = _interopRequireDefault(_fs);
  1317. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1318. var existsCache = {};
  1319. var jsonCache = {};
  1320. var BABELIGNORE_FILENAME = ".babelignore";
  1321. var BABELRC_FILENAME = ".babelrc";
  1322. var PACKAGE_FILENAME = "package.json";
  1323. function exists(filename) {
  1324. var cached = existsCache[filename];
  1325. if (cached == null) {
  1326. return existsCache[filename] = _fs2.default.existsSync(filename);
  1327. } else {
  1328. return cached;
  1329. }
  1330. }
  1331. function buildConfigChain() {
  1332. var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1333. var log = arguments[1];
  1334. var filename = opts.filename;
  1335. var builder = new ConfigChainBuilder(log);
  1336. if (opts.babelrc !== false) {
  1337. builder.findConfigs(filename);
  1338. }
  1339. builder.mergeConfig({
  1340. options: opts,
  1341. alias: "base",
  1342. dirname: filename && _path2.default.dirname(filename)
  1343. });
  1344. return builder.configs;
  1345. }
  1346. var ConfigChainBuilder = function () {
  1347. function ConfigChainBuilder(log) {
  1348. (0, _classCallCheck3.default)(this, ConfigChainBuilder);
  1349. this.resolvedConfigs = [];
  1350. this.configs = [];
  1351. this.log = log;
  1352. }
  1353. ConfigChainBuilder.prototype.findConfigs = function findConfigs(loc) {
  1354. if (!loc) return;
  1355. if (!(0, _pathIsAbsolute2.default)(loc)) {
  1356. loc = _path2.default.join(process.cwd(), loc);
  1357. }
  1358. var foundConfig = false;
  1359. var foundIgnore = false;
  1360. while (loc !== (loc = _path2.default.dirname(loc))) {
  1361. if (!foundConfig) {
  1362. var configLoc = _path2.default.join(loc, BABELRC_FILENAME);
  1363. if (exists(configLoc)) {
  1364. this.addConfig(configLoc);
  1365. foundConfig = true;
  1366. }
  1367. var pkgLoc = _path2.default.join(loc, PACKAGE_FILENAME);
  1368. if (!foundConfig && exists(pkgLoc)) {
  1369. foundConfig = this.addConfig(pkgLoc, "babel", JSON);
  1370. }
  1371. }
  1372. if (!foundIgnore) {
  1373. var ignoreLoc = _path2.default.join(loc, BABELIGNORE_FILENAME);
  1374. if (exists(ignoreLoc)) {
  1375. this.addIgnoreConfig(ignoreLoc);
  1376. foundIgnore = true;
  1377. }
  1378. }
  1379. if (foundIgnore && foundConfig) return;
  1380. }
  1381. };
  1382. ConfigChainBuilder.prototype.addIgnoreConfig = function addIgnoreConfig(loc) {
  1383. var file = _fs2.default.readFileSync(loc, "utf8");
  1384. var lines = file.split("\n");
  1385. lines = lines.map(function (line) {
  1386. return line.replace(/#(.*?)$/, "").trim();
  1387. }).filter(function (line) {
  1388. return !!line;
  1389. });
  1390. if (lines.length) {
  1391. this.mergeConfig({
  1392. options: { ignore: lines },
  1393. alias: loc,
  1394. dirname: _path2.default.dirname(loc)
  1395. });
  1396. }
  1397. };
  1398. ConfigChainBuilder.prototype.addConfig = function addConfig(loc, key) {
  1399. var json = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _json2.default;
  1400. if (this.resolvedConfigs.indexOf(loc) >= 0) {
  1401. return false;
  1402. }
  1403. this.resolvedConfigs.push(loc);
  1404. var content = _fs2.default.readFileSync(loc, "utf8");
  1405. var options = void 0;
  1406. try {
  1407. options = jsonCache[content] = jsonCache[content] || json.parse(content);
  1408. if (key) options = options[key];
  1409. } catch (err) {
  1410. err.message = loc + ": Error while parsing JSON - " + err.message;
  1411. throw err;
  1412. }
  1413. this.mergeConfig({
  1414. options: options,
  1415. alias: loc,
  1416. dirname: _path2.default.dirname(loc)
  1417. });
  1418. return !!options;
  1419. };
  1420. ConfigChainBuilder.prototype.mergeConfig = function mergeConfig(_ref) {
  1421. var options = _ref.options,
  1422. alias = _ref.alias,
  1423. loc = _ref.loc,
  1424. dirname = _ref.dirname;
  1425. if (!options) {
  1426. return false;
  1427. }
  1428. options = (0, _assign2.default)({}, options);
  1429. dirname = dirname || process.cwd();
  1430. loc = loc || alias;
  1431. if (options.extends) {
  1432. var extendsLoc = (0, _resolve2.default)(options.extends, dirname);
  1433. if (extendsLoc) {
  1434. this.addConfig(extendsLoc);
  1435. } else {
  1436. if (this.log) this.log.error("Couldn't resolve extends clause of " + options.extends + " in " + alias);
  1437. }
  1438. delete options.extends;
  1439. }
  1440. this.configs.push({
  1441. options: options,
  1442. alias: alias,
  1443. loc: loc,
  1444. dirname: dirname
  1445. });
  1446. var envOpts = void 0;
  1447. var envKey = process.env.BABEL_ENV || process.env.NODE_ENV || "development";
  1448. if (options.env) {
  1449. envOpts = options.env[envKey];
  1450. delete options.env;
  1451. }
  1452. this.mergeConfig({
  1453. options: envOpts,
  1454. alias: alias + ".env." + envKey,
  1455. dirname: dirname
  1456. });
  1457. };
  1458. return ConfigChainBuilder;
  1459. }();
  1460. module.exports = exports["default"];
  1461. }).call(this,require('_process'))
  1462. },{"../../../helpers/resolve":13,"_process":471,"babel-runtime/core-js/object/assign":60,"babel-runtime/helpers/classCallCheck":70,"fs":120,"json5":250,"path":469,"path-is-absolute":470}],20:[function(require,module,exports){
  1463. "use strict";
  1464. module.exports = {
  1465. filename: {
  1466. type: "filename",
  1467. description: "filename to use when reading from stdin - this will be used in source-maps, errors etc",
  1468. default: "unknown",
  1469. shorthand: "f"
  1470. },
  1471. filenameRelative: {
  1472. hidden: true,
  1473. type: "string"
  1474. },
  1475. inputSourceMap: {
  1476. hidden: true
  1477. },
  1478. env: {
  1479. hidden: true,
  1480. default: {}
  1481. },
  1482. mode: {
  1483. description: "",
  1484. hidden: true
  1485. },
  1486. retainLines: {
  1487. type: "boolean",
  1488. default: false,
  1489. description: "retain line numbers - will result in really ugly code"
  1490. },
  1491. highlightCode: {
  1492. description: "enable/disable ANSI syntax highlighting of code frames (on by default)",
  1493. type: "boolean",
  1494. default: true
  1495. },
  1496. suppressDeprecationMessages: {
  1497. type: "boolean",
  1498. default: false,
  1499. hidden: true
  1500. },
  1501. presets: {
  1502. type: "list",
  1503. description: "",
  1504. default: []
  1505. },
  1506. plugins: {
  1507. type: "list",
  1508. default: [],
  1509. description: ""
  1510. },
  1511. ignore: {
  1512. type: "list",
  1513. description: "list of glob paths to **not** compile",
  1514. default: []
  1515. },
  1516. only: {
  1517. type: "list",
  1518. description: "list of glob paths to **only** compile"
  1519. },
  1520. code: {
  1521. hidden: true,
  1522. default: true,
  1523. type: "boolean"
  1524. },
  1525. metadata: {
  1526. hidden: true,
  1527. default: true,
  1528. type: "boolean"
  1529. },
  1530. ast: {
  1531. hidden: true,
  1532. default: true,
  1533. type: "boolean"
  1534. },
  1535. extends: {
  1536. type: "string",
  1537. hidden: true
  1538. },
  1539. comments: {
  1540. type: "boolean",
  1541. default: true,
  1542. description: "write comments to generated output (true by default)"
  1543. },
  1544. shouldPrintComment: {
  1545. hidden: true,
  1546. description: "optional callback to control whether a comment should be inserted, when this is used the comments option is ignored"
  1547. },
  1548. wrapPluginVisitorMethod: {
  1549. hidden: true,
  1550. description: "optional callback to wrap all visitor methods"
  1551. },
  1552. compact: {
  1553. type: "booleanString",
  1554. default: "auto",
  1555. description: "do not include superfluous whitespace characters and line terminators [true|false|auto]"
  1556. },
  1557. minified: {
  1558. type: "boolean",
  1559. default: false,
  1560. description: "save as much bytes when printing [true|false]"
  1561. },
  1562. sourceMap: {
  1563. alias: "sourceMaps",
  1564. hidden: true
  1565. },
  1566. sourceMaps: {
  1567. type: "booleanString",
  1568. description: "[true|false|inline]",
  1569. default: false,
  1570. shorthand: "s"
  1571. },
  1572. sourceMapTarget: {
  1573. type: "string",
  1574. description: "set `file` on returned source map"
  1575. },
  1576. sourceFileName: {
  1577. type: "string",
  1578. description: "set `sources[0]` on returned source map"
  1579. },
  1580. sourceRoot: {
  1581. type: "filename",
  1582. description: "the root from which all sources are relative"
  1583. },
  1584. babelrc: {
  1585. description: "Whether or not to look up .babelrc and .babelignore files",
  1586. type: "boolean",
  1587. default: true
  1588. },
  1589. sourceType: {
  1590. description: "",
  1591. default: "module"
  1592. },
  1593. auxiliaryCommentBefore: {
  1594. type: "string",
  1595. description: "print a comment before any injected non-user code"
  1596. },
  1597. auxiliaryCommentAfter: {
  1598. type: "string",
  1599. description: "print a comment after any injected non-user code"
  1600. },
  1601. resolveModuleSource: {
  1602. hidden: true
  1603. },
  1604. getModuleId: {
  1605. hidden: true
  1606. },
  1607. moduleRoot: {
  1608. type: "filename",
  1609. description: "optional prefix for the AMD module formatter that will be prepend to the filename on module definitions"
  1610. },
  1611. moduleIds: {
  1612. type: "boolean",
  1613. default: false,
  1614. shorthand: "M",
  1615. description: "insert an explicit id for modules"
  1616. },
  1617. moduleId: {
  1618. description: "specify a custom name for module ids",
  1619. type: "string"
  1620. },
  1621. passPerPreset: {
  1622. description: "Whether to spawn a traversal pass per a preset. By default all presets are merged.",
  1623. type: "boolean",
  1624. default: false,
  1625. hidden: true
  1626. },
  1627. parserOpts: {
  1628. description: "Options to pass into the parser, or to change parsers (parserOpts.parser)",
  1629. default: false
  1630. },
  1631. generatorOpts: {
  1632. description: "Options to pass into the generator, or to change generators (generatorOpts.generator)",
  1633. default: false
  1634. }
  1635. };
  1636. },{}],21:[function(require,module,exports){
  1637. "use strict";
  1638. exports.__esModule = true;
  1639. exports.config = undefined;
  1640. exports.normaliseOptions = normaliseOptions;
  1641. var _parsers = require("./parsers");
  1642. var parsers = _interopRequireWildcard(_parsers);
  1643. var _config = require("./config");
  1644. var _config2 = _interopRequireDefault(_config);
  1645. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1646. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  1647. exports.config = _config2.default;
  1648. function normaliseOptions() {
  1649. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1650. for (var key in options) {
  1651. var val = options[key];
  1652. if (val == null) continue;
  1653. var opt = _config2.default[key];
  1654. if (opt && opt.alias) opt = _config2.default[opt.alias];
  1655. if (!opt) continue;
  1656. var parser = parsers[opt.type];
  1657. if (parser) val = parser(val);
  1658. options[key] = val;
  1659. }
  1660. return options;
  1661. }
  1662. },{"./config":20,"./parsers":23}],22:[function(require,module,exports){
  1663. (function (process){
  1664. "use strict";
  1665. exports.__esModule = true;
  1666. var _objectWithoutProperties2 = require("babel-runtime/helpers/objectWithoutProperties");
  1667. var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
  1668. var _stringify = require("babel-runtime/core-js/json/stringify");
  1669. var _stringify2 = _interopRequireDefault(_stringify);
  1670. var _assign = require("babel-runtime/core-js/object/assign");
  1671. var _assign2 = _interopRequireDefault(_assign);
  1672. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  1673. var _getIterator3 = _interopRequireDefault(_getIterator2);
  1674. var _typeof2 = require("babel-runtime/helpers/typeof");
  1675. var _typeof3 = _interopRequireDefault(_typeof2);
  1676. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  1677. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  1678. var _node = require("../../../api/node");
  1679. var context = _interopRequireWildcard(_node);
  1680. var _plugin2 = require("../../plugin");
  1681. var _plugin3 = _interopRequireDefault(_plugin2);
  1682. var _babelMessages = require("babel-messages");
  1683. var messages = _interopRequireWildcard(_babelMessages);
  1684. var _index = require("./index");
  1685. var _resolvePlugin = require("../../../helpers/resolve-plugin");
  1686. var _resolvePlugin2 = _interopRequireDefault(_resolvePlugin);
  1687. var _resolvePreset = require("../../../helpers/resolve-preset");
  1688. var _resolvePreset2 = _interopRequireDefault(_resolvePreset);
  1689. var _cloneDeepWith = require("lodash/cloneDeepWith");
  1690. var _cloneDeepWith2 = _interopRequireDefault(_cloneDeepWith);
  1691. var _clone = require("lodash/clone");
  1692. var _clone2 = _interopRequireDefault(_clone);
  1693. var _merge = require("../../../helpers/merge");
  1694. var _merge2 = _interopRequireDefault(_merge);
  1695. var _config2 = require("./config");
  1696. var _config3 = _interopRequireDefault(_config2);
  1697. var _removed = require("./removed");
  1698. var _removed2 = _interopRequireDefault(_removed);
  1699. var _buildConfigChain = require("./build-config-chain");
  1700. var _buildConfigChain2 = _interopRequireDefault(_buildConfigChain);
  1701. var _path = require("path");
  1702. var _path2 = _interopRequireDefault(_path);
  1703. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  1704. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1705. var OptionManager = function () {
  1706. function OptionManager(log) {
  1707. (0, _classCallCheck3.default)(this, OptionManager);
  1708. this.resolvedConfigs = [];
  1709. this.options = OptionManager.createBareOptions();
  1710. this.log = log;
  1711. }
  1712. OptionManager.memoisePluginContainer = function memoisePluginContainer(fn, loc, i, alias) {
  1713. for (var _iterator = OptionManager.memoisedPlugins, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  1714. var _ref;
  1715. if (_isArray) {
  1716. if (_i >= _iterator.length) break;
  1717. _ref = _iterator[_i++];
  1718. } else {
  1719. _i = _iterator.next();
  1720. if (_i.done) break;
  1721. _ref = _i.value;
  1722. }
  1723. var cache = _ref;
  1724. if (cache.container === fn) return cache.plugin;
  1725. }
  1726. var obj = void 0;
  1727. if (typeof fn === "function") {
  1728. obj = fn(context);
  1729. } else {
  1730. obj = fn;
  1731. }
  1732. if ((typeof obj === "undefined" ? "undefined" : (0, _typeof3.default)(obj)) === "object") {
  1733. var _plugin = new _plugin3.default(obj, alias);
  1734. OptionManager.memoisedPlugins.push({
  1735. container: fn,
  1736. plugin: _plugin
  1737. });
  1738. return _plugin;
  1739. } else {
  1740. throw new TypeError(messages.get("pluginNotObject", loc, i, typeof obj === "undefined" ? "undefined" : (0, _typeof3.default)(obj)) + loc + i);
  1741. }
  1742. };
  1743. OptionManager.createBareOptions = function createBareOptions() {
  1744. var opts = {};
  1745. for (var _key in _config3.default) {
  1746. var opt = _config3.default[_key];
  1747. opts[_key] = (0, _clone2.default)(opt.default);
  1748. }
  1749. return opts;
  1750. };
  1751. OptionManager.normalisePlugin = function normalisePlugin(plugin, loc, i, alias) {
  1752. plugin = plugin.__esModule ? plugin.default : plugin;
  1753. if (!(plugin instanceof _plugin3.default)) {
  1754. if (typeof plugin === "function" || (typeof plugin === "undefined" ? "undefined" : (0, _typeof3.default)(plugin)) === "object") {
  1755. plugin = OptionManager.memoisePluginContainer(plugin, loc, i, alias);
  1756. } else {
  1757. throw new TypeError(messages.get("pluginNotFunction", loc, i, typeof plugin === "undefined" ? "undefined" : (0, _typeof3.default)(plugin)));
  1758. }
  1759. }
  1760. plugin.init(loc, i);
  1761. return plugin;
  1762. };
  1763. OptionManager.normalisePlugins = function normalisePlugins(loc, dirname, plugins) {
  1764. return plugins.map(function (val, i) {
  1765. var plugin = void 0,
  1766. options = void 0;
  1767. if (!val) {
  1768. throw new TypeError("Falsy value found in plugins");
  1769. }
  1770. if (Array.isArray(val)) {
  1771. plugin = val[0];
  1772. options = val[1];
  1773. } else {
  1774. plugin = val;
  1775. }
  1776. var alias = typeof plugin === "string" ? plugin : loc + "$" + i;
  1777. if (typeof plugin === "string") {
  1778. var pluginLoc = (0, _resolvePlugin2.default)(plugin, dirname);
  1779. if (pluginLoc) {
  1780. plugin = require(pluginLoc);
  1781. } else {
  1782. throw new ReferenceError(messages.get("pluginUnknown", plugin, loc, i, dirname));
  1783. }
  1784. }
  1785. plugin = OptionManager.normalisePlugin(plugin, loc, i, alias);
  1786. return [plugin, options];
  1787. });
  1788. };
  1789. OptionManager.prototype.mergeOptions = function mergeOptions(_ref2) {
  1790. var _this = this;
  1791. var rawOpts = _ref2.options,
  1792. extendingOpts = _ref2.extending,
  1793. alias = _ref2.alias,
  1794. loc = _ref2.loc,
  1795. dirname = _ref2.dirname;
  1796. alias = alias || "foreign";
  1797. if (!rawOpts) return;
  1798. if ((typeof rawOpts === "undefined" ? "undefined" : (0, _typeof3.default)(rawOpts)) !== "object" || Array.isArray(rawOpts)) {
  1799. this.log.error("Invalid options type for " + alias, TypeError);
  1800. }
  1801. var opts = (0, _cloneDeepWith2.default)(rawOpts, function (val) {
  1802. if (val instanceof _plugin3.default) {
  1803. return val;
  1804. }
  1805. });
  1806. dirname = dirname || process.cwd();
  1807. loc = loc || alias;
  1808. for (var _key2 in opts) {
  1809. var option = _config3.default[_key2];
  1810. if (!option && this.log) {
  1811. if (_removed2.default[_key2]) {
  1812. this.log.error("Using removed Babel 5 option: " + alias + "." + _key2 + " - " + _removed2.default[_key2].message, ReferenceError);
  1813. } else {
  1814. var unknownOptErr = "Unknown option: " + alias + "." + _key2 + ". Check out http://babeljs.io/docs/usage/options/ for more information about options.";
  1815. var presetConfigErr = "A common cause of this error is the presence of a configuration options object without the corresponding preset name. Example:\n\nInvalid:\n `{ presets: [{option: value}] }`\nValid:\n `{ presets: [['presetName', {option: value}]] }`\n\nFor more detailed information on preset configuration, please see http://babeljs.io/docs/plugins/#pluginpresets-options.";
  1816. this.log.error(unknownOptErr + "\n\n" + presetConfigErr, ReferenceError);
  1817. }
  1818. }
  1819. }
  1820. (0, _index.normaliseOptions)(opts);
  1821. if (opts.plugins) {
  1822. opts.plugins = OptionManager.normalisePlugins(loc, dirname, opts.plugins);
  1823. }
  1824. if (opts.presets) {
  1825. if (opts.passPerPreset) {
  1826. opts.presets = this.resolvePresets(opts.presets, dirname, function (preset, presetLoc) {
  1827. _this.mergeOptions({
  1828. options: preset,
  1829. extending: preset,
  1830. alias: presetLoc,
  1831. loc: presetLoc,
  1832. dirname: dirname
  1833. });
  1834. });
  1835. } else {
  1836. this.mergePresets(opts.presets, dirname);
  1837. delete opts.presets;
  1838. }
  1839. }
  1840. if (rawOpts === extendingOpts) {
  1841. (0, _assign2.default)(extendingOpts, opts);
  1842. } else {
  1843. (0, _merge2.default)(extendingOpts || this.options, opts);
  1844. }
  1845. };
  1846. OptionManager.prototype.mergePresets = function mergePresets(presets, dirname) {
  1847. var _this2 = this;
  1848. this.resolvePresets(presets, dirname, function (presetOpts, presetLoc) {
  1849. _this2.mergeOptions({
  1850. options: presetOpts,
  1851. alias: presetLoc,
  1852. loc: presetLoc,
  1853. dirname: _path2.default.dirname(presetLoc || "")
  1854. });
  1855. });
  1856. };
  1857. OptionManager.prototype.resolvePresets = function resolvePresets(presets, dirname, onResolve) {
  1858. return presets.map(function (val) {
  1859. var options = void 0;
  1860. if (Array.isArray(val)) {
  1861. if (val.length > 2) {
  1862. throw new Error("Unexpected extra options " + (0, _stringify2.default)(val.slice(2)) + " passed to preset.");
  1863. }
  1864. var _val = val;
  1865. val = _val[0];
  1866. options = _val[1];
  1867. }
  1868. var presetLoc = void 0;
  1869. try {
  1870. if (typeof val === "string") {
  1871. presetLoc = (0, _resolvePreset2.default)(val, dirname);
  1872. if (!presetLoc) {
  1873. throw new Error("Couldn't find preset " + (0, _stringify2.default)(val) + " relative to directory " + (0, _stringify2.default)(dirname));
  1874. }
  1875. val = require(presetLoc);
  1876. }
  1877. if ((typeof val === "undefined" ? "undefined" : (0, _typeof3.default)(val)) === "object" && val.__esModule) {
  1878. if (val.default) {
  1879. val = val.default;
  1880. } else {
  1881. var _val2 = val,
  1882. __esModule = _val2.__esModule,
  1883. rest = (0, _objectWithoutProperties3.default)(_val2, ["__esModule"]);
  1884. val = rest;
  1885. }
  1886. }
  1887. if ((typeof val === "undefined" ? "undefined" : (0, _typeof3.default)(val)) === "object" && val.buildPreset) val = val.buildPreset;
  1888. if (typeof val !== "function" && options !== undefined) {
  1889. throw new Error("Options " + (0, _stringify2.default)(options) + " passed to " + (presetLoc || "a preset") + " which does not accept options.");
  1890. }
  1891. if (typeof val === "function") val = val(context, options);
  1892. if ((typeof val === "undefined" ? "undefined" : (0, _typeof3.default)(val)) !== "object") {
  1893. throw new Error("Unsupported preset format: " + val + ".");
  1894. }
  1895. onResolve && onResolve(val, presetLoc);
  1896. } catch (e) {
  1897. if (presetLoc) {
  1898. e.message += " (While processing preset: " + (0, _stringify2.default)(presetLoc) + ")";
  1899. }
  1900. throw e;
  1901. }
  1902. return val;
  1903. });
  1904. };
  1905. OptionManager.prototype.normaliseOptions = function normaliseOptions() {
  1906. var opts = this.options;
  1907. for (var _key3 in _config3.default) {
  1908. var option = _config3.default[_key3];
  1909. var val = opts[_key3];
  1910. if (!val && option.optional) continue;
  1911. if (option.alias) {
  1912. opts[option.alias] = opts[option.alias] || val;
  1913. } else {
  1914. opts[_key3] = val;
  1915. }
  1916. }
  1917. };
  1918. OptionManager.prototype.init = function init() {
  1919. var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1920. for (var _iterator2 = (0, _buildConfigChain2.default)(opts, this.log), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  1921. var _ref3;
  1922. if (_isArray2) {
  1923. if (_i2 >= _iterator2.length) break;
  1924. _ref3 = _iterator2[_i2++];
  1925. } else {
  1926. _i2 = _iterator2.next();
  1927. if (_i2.done) break;
  1928. _ref3 = _i2.value;
  1929. }
  1930. var _config = _ref3;
  1931. this.mergeOptions(_config);
  1932. }
  1933. this.normaliseOptions(opts);
  1934. return this.options;
  1935. };
  1936. return OptionManager;
  1937. }();
  1938. exports.default = OptionManager;
  1939. OptionManager.memoisedPlugins = [];
  1940. module.exports = exports["default"];
  1941. }).call(this,require('_process'))
  1942. },{"../../../api/node":5,"../../../helpers/merge":8,"../../../helpers/resolve-plugin":11,"../../../helpers/resolve-preset":12,"../../plugin":29,"./build-config-chain":19,"./config":20,"./index":21,"./removed":24,"_process":471,"babel-messages":53,"babel-runtime/core-js/get-iterator":56,"babel-runtime/core-js/json/stringify":57,"babel-runtime/core-js/object/assign":60,"babel-runtime/helpers/classCallCheck":70,"babel-runtime/helpers/objectWithoutProperties":72,"babel-runtime/helpers/typeof":74,"lodash/clone":416,"lodash/cloneDeepWith":418,"path":469}],23:[function(require,module,exports){
  1943. "use strict";
  1944. exports.__esModule = true;
  1945. exports.filename = undefined;
  1946. exports.boolean = boolean;
  1947. exports.booleanString = booleanString;
  1948. exports.list = list;
  1949. var _slash = require("slash");
  1950. var _slash2 = _interopRequireDefault(_slash);
  1951. var _util = require("../../../util");
  1952. var util = _interopRequireWildcard(_util);
  1953. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  1954. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1955. var filename = exports.filename = _slash2.default;
  1956. function boolean(val) {
  1957. return !!val;
  1958. }
  1959. function booleanString(val) {
  1960. return util.booleanify(val);
  1961. }
  1962. function list(val) {
  1963. return util.list(val);
  1964. }
  1965. },{"../../../util":30,"slash":473}],24:[function(require,module,exports){
  1966. "use strict";
  1967. module.exports = {
  1968. "auxiliaryComment": {
  1969. "message": "Use `auxiliaryCommentBefore` or `auxiliaryCommentAfter`"
  1970. },
  1971. "blacklist": {
  1972. "message": "Put the specific transforms you want in the `plugins` option"
  1973. },
  1974. "breakConfig": {
  1975. "message": "This is not a necessary option in Babel 6"
  1976. },
  1977. "experimental": {
  1978. "message": "Put the specific transforms you want in the `plugins` option"
  1979. },
  1980. "externalHelpers": {
  1981. "message": "Use the `external-helpers` plugin instead. Check out http://babeljs.io/docs/plugins/external-helpers/"
  1982. },
  1983. "extra": {
  1984. "message": ""
  1985. },
  1986. "jsxPragma": {
  1987. "message": "use the `pragma` option in the `react-jsx` plugin . Check out http://babeljs.io/docs/plugins/transform-react-jsx/"
  1988. },
  1989. "loose": {
  1990. "message": "Specify the `loose` option for the relevant plugin you are using or use a preset that sets the option."
  1991. },
  1992. "metadataUsedHelpers": {
  1993. "message": "Not required anymore as this is enabled by default"
  1994. },
  1995. "modules": {
  1996. "message": "Use the corresponding module transform plugin in the `plugins` option. Check out http://babeljs.io/docs/plugins/#modules"
  1997. },
  1998. "nonStandard": {
  1999. "message": "Use the `react-jsx` and `flow-strip-types` plugins to support JSX and Flow. Also check out the react preset http://babeljs.io/docs/plugins/preset-react/"
  2000. },
  2001. "optional": {
  2002. "message": "Put the specific transforms you want in the `plugins` option"
  2003. },
  2004. "sourceMapName": {
  2005. "message": "Use the `sourceMapTarget` option"
  2006. },
  2007. "stage": {
  2008. "message": "Check out the corresponding stage-x presets http://babeljs.io/docs/plugins/#presets"
  2009. },
  2010. "whitelist": {
  2011. "message": "Put the specific transforms you want in the `plugins` option"
  2012. }
  2013. };
  2014. },{}],25:[function(require,module,exports){
  2015. "use strict";
  2016. exports.__esModule = true;
  2017. var _plugin = require("../plugin");
  2018. var _plugin2 = _interopRequireDefault(_plugin);
  2019. var _sortBy = require("lodash/sortBy");
  2020. var _sortBy2 = _interopRequireDefault(_sortBy);
  2021. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2022. exports.default = new _plugin2.default({
  2023. name: "internal.blockHoist",
  2024. visitor: {
  2025. Block: {
  2026. exit: function exit(_ref) {
  2027. var node = _ref.node;
  2028. var hasChange = false;
  2029. for (var i = 0; i < node.body.length; i++) {
  2030. var bodyNode = node.body[i];
  2031. if (bodyNode && bodyNode._blockHoist != null) {
  2032. hasChange = true;
  2033. break;
  2034. }
  2035. }
  2036. if (!hasChange) return;
  2037. node.body = (0, _sortBy2.default)(node.body, function (bodyNode) {
  2038. var priority = bodyNode && bodyNode._blockHoist;
  2039. if (priority == null) priority = 1;
  2040. if (priority === true) priority = 2;
  2041. return -1 * priority;
  2042. });
  2043. }
  2044. }
  2045. }
  2046. });
  2047. module.exports = exports["default"];
  2048. },{"../plugin":29,"lodash/sortBy":455}],26:[function(require,module,exports){
  2049. "use strict";
  2050. exports.__esModule = true;
  2051. var _symbol = require("babel-runtime/core-js/symbol");
  2052. var _symbol2 = _interopRequireDefault(_symbol);
  2053. var _plugin = require("../plugin");
  2054. var _plugin2 = _interopRequireDefault(_plugin);
  2055. var _babelTypes = require("babel-types");
  2056. var t = _interopRequireWildcard(_babelTypes);
  2057. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  2058. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2059. var SUPER_THIS_BOUND = (0, _symbol2.default)("super this bound");
  2060. var superVisitor = {
  2061. CallExpression: function CallExpression(path) {
  2062. if (!path.get("callee").isSuper()) return;
  2063. var node = path.node;
  2064. if (node[SUPER_THIS_BOUND]) return;
  2065. node[SUPER_THIS_BOUND] = true;
  2066. path.replaceWith(t.assignmentExpression("=", this.id, node));
  2067. }
  2068. };
  2069. exports.default = new _plugin2.default({
  2070. name: "internal.shadowFunctions",
  2071. visitor: {
  2072. ThisExpression: function ThisExpression(path) {
  2073. remap(path, "this");
  2074. },
  2075. ReferencedIdentifier: function ReferencedIdentifier(path) {
  2076. if (path.node.name === "arguments") {
  2077. remap(path, "arguments");
  2078. }
  2079. }
  2080. }
  2081. });
  2082. function shouldShadow(path, shadowPath) {
  2083. if (path.is("_forceShadow")) {
  2084. return true;
  2085. } else {
  2086. return shadowPath;
  2087. }
  2088. }
  2089. function remap(path, key) {
  2090. var shadowPath = path.inShadow(key);
  2091. if (!shouldShadow(path, shadowPath)) return;
  2092. var shadowFunction = path.node._shadowedFunctionLiteral;
  2093. var currentFunction = void 0;
  2094. var passedShadowFunction = false;
  2095. var fnPath = path.find(function (innerPath) {
  2096. if (innerPath.parentPath && innerPath.parentPath.isClassProperty() && innerPath.key === "value") {
  2097. return true;
  2098. }
  2099. if (path === innerPath) return false;
  2100. if (innerPath.isProgram() || innerPath.isFunction()) {
  2101. currentFunction = currentFunction || innerPath;
  2102. }
  2103. if (innerPath.isProgram()) {
  2104. passedShadowFunction = true;
  2105. return true;
  2106. } else if (innerPath.isFunction() && !innerPath.isArrowFunctionExpression()) {
  2107. if (shadowFunction) {
  2108. if (innerPath === shadowFunction || innerPath.node === shadowFunction.node) return true;
  2109. } else {
  2110. if (!innerPath.is("shadow")) return true;
  2111. }
  2112. passedShadowFunction = true;
  2113. return false;
  2114. }
  2115. return false;
  2116. });
  2117. if (shadowFunction && fnPath.isProgram() && !shadowFunction.isProgram()) {
  2118. fnPath = path.findParent(function (p) {
  2119. return p.isProgram() || p.isFunction();
  2120. });
  2121. }
  2122. if (fnPath === currentFunction) return;
  2123. if (!passedShadowFunction) return;
  2124. var cached = fnPath.getData(key);
  2125. if (cached) return path.replaceWith(cached);
  2126. var id = path.scope.generateUidIdentifier(key);
  2127. fnPath.setData(key, id);
  2128. var classPath = fnPath.findParent(function (p) {
  2129. return p.isClass();
  2130. });
  2131. var hasSuperClass = !!(classPath && classPath.node && classPath.node.superClass);
  2132. if (key === "this" && fnPath.isMethod({ kind: "constructor" }) && hasSuperClass) {
  2133. fnPath.scope.push({ id: id });
  2134. fnPath.traverse(superVisitor, { id: id });
  2135. } else {
  2136. var init = key === "this" ? t.thisExpression() : t.identifier(key);
  2137. if (shadowFunction) init._shadowedFunctionLiteral = shadowFunction;
  2138. fnPath.scope.push({ id: id, init: init });
  2139. }
  2140. return path.replaceWith(id);
  2141. }
  2142. module.exports = exports["default"];
  2143. },{"../plugin":29,"babel-runtime/core-js/symbol":65,"babel-types":112}],27:[function(require,module,exports){
  2144. "use strict";
  2145. exports.__esModule = true;
  2146. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  2147. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  2148. var _normalizeAst = require("../helpers/normalize-ast");
  2149. var _normalizeAst2 = _interopRequireDefault(_normalizeAst);
  2150. var _plugin = require("./plugin");
  2151. var _plugin2 = _interopRequireDefault(_plugin);
  2152. var _file = require("./file");
  2153. var _file2 = _interopRequireDefault(_file);
  2154. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2155. var Pipeline = function () {
  2156. function Pipeline() {
  2157. (0, _classCallCheck3.default)(this, Pipeline);
  2158. }
  2159. Pipeline.prototype.lint = function lint(code) {
  2160. var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  2161. opts.code = false;
  2162. opts.mode = "lint";
  2163. return this.transform(code, opts);
  2164. };
  2165. Pipeline.prototype.pretransform = function pretransform(code, opts) {
  2166. var file = new _file2.default(opts, this);
  2167. return file.wrap(code, function () {
  2168. file.addCode(code);
  2169. file.parseCode(code);
  2170. return file;
  2171. });
  2172. };
  2173. Pipeline.prototype.transform = function transform(code, opts) {
  2174. var file = new _file2.default(opts, this);
  2175. return file.wrap(code, function () {
  2176. file.addCode(code);
  2177. file.parseCode(code);
  2178. return file.transform();
  2179. });
  2180. };
  2181. Pipeline.prototype.analyse = function analyse(code) {
  2182. var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  2183. var visitor = arguments[2];
  2184. opts.code = false;
  2185. if (visitor) {
  2186. opts.plugins = opts.plugins || [];
  2187. opts.plugins.push(new _plugin2.default({ visitor: visitor }));
  2188. }
  2189. return this.transform(code, opts).metadata;
  2190. };
  2191. Pipeline.prototype.transformFromAst = function transformFromAst(ast, code, opts) {
  2192. ast = (0, _normalizeAst2.default)(ast);
  2193. var file = new _file2.default(opts, this);
  2194. return file.wrap(code, function () {
  2195. file.addCode(code);
  2196. file.addAst(ast);
  2197. return file.transform();
  2198. });
  2199. };
  2200. return Pipeline;
  2201. }();
  2202. exports.default = Pipeline;
  2203. module.exports = exports["default"];
  2204. },{"../helpers/normalize-ast":9,"./file":16,"./plugin":29,"babel-runtime/helpers/classCallCheck":70}],28:[function(require,module,exports){
  2205. "use strict";
  2206. exports.__esModule = true;
  2207. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  2208. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  2209. var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn");
  2210. var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
  2211. var _inherits2 = require("babel-runtime/helpers/inherits");
  2212. var _inherits3 = _interopRequireDefault(_inherits2);
  2213. var _store = require("../store");
  2214. var _store2 = _interopRequireDefault(_store);
  2215. var _file5 = require("./file");
  2216. var _file6 = _interopRequireDefault(_file5);
  2217. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2218. var PluginPass = function (_Store) {
  2219. (0, _inherits3.default)(PluginPass, _Store);
  2220. function PluginPass(file, plugin) {
  2221. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  2222. (0, _classCallCheck3.default)(this, PluginPass);
  2223. var _this = (0, _possibleConstructorReturn3.default)(this, _Store.call(this));
  2224. _this.plugin = plugin;
  2225. _this.key = plugin.key;
  2226. _this.file = file;
  2227. _this.opts = options;
  2228. return _this;
  2229. }
  2230. PluginPass.prototype.addHelper = function addHelper() {
  2231. var _file;
  2232. return (_file = this.file).addHelper.apply(_file, arguments);
  2233. };
  2234. PluginPass.prototype.addImport = function addImport() {
  2235. var _file2;
  2236. return (_file2 = this.file).addImport.apply(_file2, arguments);
  2237. };
  2238. PluginPass.prototype.getModuleName = function getModuleName() {
  2239. var _file3;
  2240. return (_file3 = this.file).getModuleName.apply(_file3, arguments);
  2241. };
  2242. PluginPass.prototype.buildCodeFrameError = function buildCodeFrameError() {
  2243. var _file4;
  2244. return (_file4 = this.file).buildCodeFrameError.apply(_file4, arguments);
  2245. };
  2246. return PluginPass;
  2247. }(_store2.default);
  2248. exports.default = PluginPass;
  2249. module.exports = exports["default"];
  2250. },{"../store":14,"./file":16,"babel-runtime/helpers/classCallCheck":70,"babel-runtime/helpers/inherits":71,"babel-runtime/helpers/possibleConstructorReturn":73}],29:[function(require,module,exports){
  2251. "use strict";
  2252. exports.__esModule = true;
  2253. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  2254. var _getIterator3 = _interopRequireDefault(_getIterator2);
  2255. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  2256. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  2257. var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn");
  2258. var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
  2259. var _inherits2 = require("babel-runtime/helpers/inherits");
  2260. var _inherits3 = _interopRequireDefault(_inherits2);
  2261. var _optionManager = require("./file/options/option-manager");
  2262. var _optionManager2 = _interopRequireDefault(_optionManager);
  2263. var _babelMessages = require("babel-messages");
  2264. var messages = _interopRequireWildcard(_babelMessages);
  2265. var _store = require("../store");
  2266. var _store2 = _interopRequireDefault(_store);
  2267. var _babelTraverse = require("babel-traverse");
  2268. var _babelTraverse2 = _interopRequireDefault(_babelTraverse);
  2269. var _assign = require("lodash/assign");
  2270. var _assign2 = _interopRequireDefault(_assign);
  2271. var _clone = require("lodash/clone");
  2272. var _clone2 = _interopRequireDefault(_clone);
  2273. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  2274. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2275. var GLOBAL_VISITOR_PROPS = ["enter", "exit"];
  2276. var Plugin = function (_Store) {
  2277. (0, _inherits3.default)(Plugin, _Store);
  2278. function Plugin(plugin, key) {
  2279. (0, _classCallCheck3.default)(this, Plugin);
  2280. var _this = (0, _possibleConstructorReturn3.default)(this, _Store.call(this));
  2281. _this.initialized = false;
  2282. _this.raw = (0, _assign2.default)({}, plugin);
  2283. _this.key = _this.take("name") || key;
  2284. _this.manipulateOptions = _this.take("manipulateOptions");
  2285. _this.post = _this.take("post");
  2286. _this.pre = _this.take("pre");
  2287. _this.visitor = _this.normaliseVisitor((0, _clone2.default)(_this.take("visitor")) || {});
  2288. return _this;
  2289. }
  2290. Plugin.prototype.take = function take(key) {
  2291. var val = this.raw[key];
  2292. delete this.raw[key];
  2293. return val;
  2294. };
  2295. Plugin.prototype.chain = function chain(target, key) {
  2296. if (!target[key]) return this[key];
  2297. if (!this[key]) return target[key];
  2298. var fns = [target[key], this[key]];
  2299. return function () {
  2300. var val = void 0;
  2301. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  2302. args[_key] = arguments[_key];
  2303. }
  2304. for (var _iterator = fns, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  2305. var _ref;
  2306. if (_isArray) {
  2307. if (_i >= _iterator.length) break;
  2308. _ref = _iterator[_i++];
  2309. } else {
  2310. _i = _iterator.next();
  2311. if (_i.done) break;
  2312. _ref = _i.value;
  2313. }
  2314. var fn = _ref;
  2315. if (fn) {
  2316. var ret = fn.apply(this, args);
  2317. if (ret != null) val = ret;
  2318. }
  2319. }
  2320. return val;
  2321. };
  2322. };
  2323. Plugin.prototype.maybeInherit = function maybeInherit(loc) {
  2324. var inherits = this.take("inherits");
  2325. if (!inherits) return;
  2326. inherits = _optionManager2.default.normalisePlugin(inherits, loc, "inherits");
  2327. this.manipulateOptions = this.chain(inherits, "manipulateOptions");
  2328. this.post = this.chain(inherits, "post");
  2329. this.pre = this.chain(inherits, "pre");
  2330. this.visitor = _babelTraverse2.default.visitors.merge([inherits.visitor, this.visitor]);
  2331. };
  2332. Plugin.prototype.init = function init(loc, i) {
  2333. if (this.initialized) return;
  2334. this.initialized = true;
  2335. this.maybeInherit(loc);
  2336. for (var key in this.raw) {
  2337. throw new Error(messages.get("pluginInvalidProperty", loc, i, key));
  2338. }
  2339. };
  2340. Plugin.prototype.normaliseVisitor = function normaliseVisitor(visitor) {
  2341. for (var _iterator2 = GLOBAL_VISITOR_PROPS, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  2342. var _ref2;
  2343. if (_isArray2) {
  2344. if (_i2 >= _iterator2.length) break;
  2345. _ref2 = _iterator2[_i2++];
  2346. } else {
  2347. _i2 = _iterator2.next();
  2348. if (_i2.done) break;
  2349. _ref2 = _i2.value;
  2350. }
  2351. var key = _ref2;
  2352. if (visitor[key]) {
  2353. throw new Error("Plugins aren't allowed to specify catch-all enter/exit handlers. " + "Please target individual nodes.");
  2354. }
  2355. }
  2356. _babelTraverse2.default.explode(visitor);
  2357. return visitor;
  2358. };
  2359. return Plugin;
  2360. }(_store2.default);
  2361. exports.default = Plugin;
  2362. module.exports = exports["default"];
  2363. },{"../store":14,"./file/options/option-manager":22,"babel-messages":53,"babel-runtime/core-js/get-iterator":56,"babel-runtime/helpers/classCallCheck":70,"babel-runtime/helpers/inherits":71,"babel-runtime/helpers/possibleConstructorReturn":73,"babel-traverse":79,"lodash/assign":414,"lodash/clone":416}],30:[function(require,module,exports){
  2364. "use strict";
  2365. exports.__esModule = true;
  2366. exports.inspect = exports.inherits = undefined;
  2367. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  2368. var _getIterator3 = _interopRequireDefault(_getIterator2);
  2369. var _util = require("util");
  2370. Object.defineProperty(exports, "inherits", {
  2371. enumerable: true,
  2372. get: function get() {
  2373. return _util.inherits;
  2374. }
  2375. });
  2376. Object.defineProperty(exports, "inspect", {
  2377. enumerable: true,
  2378. get: function get() {
  2379. return _util.inspect;
  2380. }
  2381. });
  2382. exports.canCompile = canCompile;
  2383. exports.list = list;
  2384. exports.regexify = regexify;
  2385. exports.arrayify = arrayify;
  2386. exports.booleanify = booleanify;
  2387. exports.shouldIgnore = shouldIgnore;
  2388. var _escapeRegExp = require("lodash/escapeRegExp");
  2389. var _escapeRegExp2 = _interopRequireDefault(_escapeRegExp);
  2390. var _startsWith = require("lodash/startsWith");
  2391. var _startsWith2 = _interopRequireDefault(_startsWith);
  2392. var _minimatch = require("minimatch");
  2393. var _minimatch2 = _interopRequireDefault(_minimatch);
  2394. var _includes = require("lodash/includes");
  2395. var _includes2 = _interopRequireDefault(_includes);
  2396. var _isRegExp = require("lodash/isRegExp");
  2397. var _isRegExp2 = _interopRequireDefault(_isRegExp);
  2398. var _path = require("path");
  2399. var _path2 = _interopRequireDefault(_path);
  2400. var _slash = require("slash");
  2401. var _slash2 = _interopRequireDefault(_slash);
  2402. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2403. function canCompile(filename, altExts) {
  2404. var exts = altExts || canCompile.EXTENSIONS;
  2405. var ext = _path2.default.extname(filename);
  2406. return (0, _includes2.default)(exts, ext);
  2407. }
  2408. canCompile.EXTENSIONS = [".js", ".jsx", ".es6", ".es"];
  2409. function list(val) {
  2410. if (!val) {
  2411. return [];
  2412. } else if (Array.isArray(val)) {
  2413. return val;
  2414. } else if (typeof val === "string") {
  2415. return val.split(",");
  2416. } else {
  2417. return [val];
  2418. }
  2419. }
  2420. function regexify(val) {
  2421. if (!val) {
  2422. return new RegExp(/.^/);
  2423. }
  2424. if (Array.isArray(val)) {
  2425. val = new RegExp(val.map(_escapeRegExp2.default).join("|"), "i");
  2426. }
  2427. if (typeof val === "string") {
  2428. val = (0, _slash2.default)(val);
  2429. if ((0, _startsWith2.default)(val, "./") || (0, _startsWith2.default)(val, "*/")) val = val.slice(2);
  2430. if ((0, _startsWith2.default)(val, "**/")) val = val.slice(3);
  2431. var regex = _minimatch2.default.makeRe(val, { nocase: true });
  2432. return new RegExp(regex.source.slice(1, -1), "i");
  2433. }
  2434. if ((0, _isRegExp2.default)(val)) {
  2435. return val;
  2436. }
  2437. throw new TypeError("illegal type for regexify");
  2438. }
  2439. function arrayify(val, mapFn) {
  2440. if (!val) return [];
  2441. if (typeof val === "boolean") return arrayify([val], mapFn);
  2442. if (typeof val === "string") return arrayify(list(val), mapFn);
  2443. if (Array.isArray(val)) {
  2444. if (mapFn) val = val.map(mapFn);
  2445. return val;
  2446. }
  2447. return [val];
  2448. }
  2449. function booleanify(val) {
  2450. if (val === "true" || val == 1) {
  2451. return true;
  2452. }
  2453. if (val === "false" || val == 0 || !val) {
  2454. return false;
  2455. }
  2456. return val;
  2457. }
  2458. function shouldIgnore(filename) {
  2459. var ignore = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  2460. var only = arguments[2];
  2461. filename = filename.replace(/\\/g, "/");
  2462. if (only) {
  2463. for (var _iterator = only, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  2464. var _ref;
  2465. if (_isArray) {
  2466. if (_i >= _iterator.length) break;
  2467. _ref = _iterator[_i++];
  2468. } else {
  2469. _i = _iterator.next();
  2470. if (_i.done) break;
  2471. _ref = _i.value;
  2472. }
  2473. var pattern = _ref;
  2474. if (_shouldIgnore(pattern, filename)) return false;
  2475. }
  2476. return true;
  2477. } else if (ignore.length) {
  2478. for (var _iterator2 = ignore, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  2479. var _ref2;
  2480. if (_isArray2) {
  2481. if (_i2 >= _iterator2.length) break;
  2482. _ref2 = _iterator2[_i2++];
  2483. } else {
  2484. _i2 = _iterator2.next();
  2485. if (_i2.done) break;
  2486. _ref2 = _i2.value;
  2487. }
  2488. var _pattern = _ref2;
  2489. if (_shouldIgnore(_pattern, filename)) return true;
  2490. }
  2491. }
  2492. return false;
  2493. }
  2494. function _shouldIgnore(pattern, filename) {
  2495. if (typeof pattern === "function") {
  2496. return pattern(filename);
  2497. } else {
  2498. return pattern.test(filename);
  2499. }
  2500. }
  2501. },{"babel-runtime/core-js/get-iterator":56,"lodash/escapeRegExp":422,"lodash/includes":431,"lodash/isRegExp":443,"lodash/startsWith":456,"minimatch":466,"path":469,"slash":473,"util":492}],31:[function(require,module,exports){
  2502. module.exports={
  2503. "_args": [
  2504. [
  2505. {
  2506. "raw": "babel-core@^6.22.1",
  2507. "scope": null,
  2508. "escapedName": "babel-core",
  2509. "name": "babel-core",
  2510. "rawSpec": "^6.22.1",
  2511. "spec": ">=6.22.1 <7.0.0",
  2512. "type": "range"
  2513. },
  2514. "/home/directxman12/dev/noVNC"
  2515. ]
  2516. ],
  2517. "_from": "babel-core@>=6.22.1 <7.0.0",
  2518. "_id": "babel-core@6.23.1",
  2519. "_inCache": true,
  2520. "_location": "/babel-core",
  2521. "_nodeVersion": "6.9.1",
  2522. "_npmOperationalInternal": {
  2523. "host": "packages-12-west.internal.npmjs.com",
  2524. "tmp": "tmp/babel-core-6.23.1.tgz_1487038699717_0.8698694983031601"
  2525. },
  2526. "_npmUser": {
  2527. "name": "loganfsmyth",
  2528. "email": "loganfsmyth@gmail.com"
  2529. },
  2530. "_npmVersion": "3.10.8",
  2531. "_phantomChildren": {},
  2532. "_requested": {
  2533. "raw": "babel-core@^6.22.1",
  2534. "scope": null,
  2535. "escapedName": "babel-core",
  2536. "name": "babel-core",
  2537. "rawSpec": "^6.22.1",
  2538. "spec": ">=6.22.1 <7.0.0",
  2539. "type": "range"
  2540. },
  2541. "_requiredBy": [
  2542. "#DEV:/",
  2543. "/babel-register",
  2544. "/babelify",
  2545. "/karma-babel-preprocessor"
  2546. ],
  2547. "_resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.23.1.tgz",
  2548. "_shasum": "c143cb621bb2f621710c220c5d579d15b8a442df",
  2549. "_shrinkwrap": null,
  2550. "_spec": "babel-core@^6.22.1",
  2551. "_where": "/home/directxman12/dev/noVNC",
  2552. "author": {
  2553. "name": "Sebastian McKenzie",
  2554. "email": "sebmck@gmail.com"
  2555. },
  2556. "dependencies": {
  2557. "babel-code-frame": "^6.22.0",
  2558. "babel-generator": "^6.23.0",
  2559. "babel-helpers": "^6.23.0",
  2560. "babel-messages": "^6.23.0",
  2561. "babel-register": "^6.23.0",
  2562. "babel-runtime": "^6.22.0",
  2563. "babel-template": "^6.23.0",
  2564. "babel-traverse": "^6.23.1",
  2565. "babel-types": "^6.23.0",
  2566. "babylon": "^6.11.0",
  2567. "convert-source-map": "^1.1.0",
  2568. "debug": "^2.1.1",
  2569. "json5": "^0.5.0",
  2570. "lodash": "^4.2.0",
  2571. "minimatch": "^3.0.2",
  2572. "path-is-absolute": "^1.0.0",
  2573. "private": "^0.1.6",
  2574. "slash": "^1.0.0",
  2575. "source-map": "^0.5.0"
  2576. },
  2577. "description": "Babel compiler core.",
  2578. "devDependencies": {
  2579. "babel-helper-fixtures": "^6.22.0",
  2580. "babel-helper-transform-fixture-test-runner": "^6.23.0",
  2581. "babel-polyfill": "^6.23.0"
  2582. },
  2583. "directories": {},
  2584. "dist": {
  2585. "shasum": "c143cb621bb2f621710c220c5d579d15b8a442df",
  2586. "tarball": "https://registry.npmjs.org/babel-core/-/babel-core-6.23.1.tgz"
  2587. },
  2588. "homepage": "https://babeljs.io/",
  2589. "keywords": [
  2590. "6to5",
  2591. "babel",
  2592. "classes",
  2593. "const",
  2594. "es6",
  2595. "harmony",
  2596. "let",
  2597. "modules",
  2598. "transpile",
  2599. "transpiler",
  2600. "var",
  2601. "babel-core",
  2602. "compiler"
  2603. ],
  2604. "license": "MIT",
  2605. "maintainers": [
  2606. {
  2607. "name": "amasad",
  2608. "email": "amjad.masad@gmail.com"
  2609. },
  2610. {
  2611. "name": "hzoo",
  2612. "email": "hi@henryzoo.com"
  2613. },
  2614. {
  2615. "name": "jmm",
  2616. "email": "npm-public@jessemccarthy.net"
  2617. },
  2618. {
  2619. "name": "loganfsmyth",
  2620. "email": "loganfsmyth@gmail.com"
  2621. },
  2622. {
  2623. "name": "sebmck",
  2624. "email": "sebmck@gmail.com"
  2625. },
  2626. {
  2627. "name": "thejameskyle",
  2628. "email": "me@thejameskyle.com"
  2629. }
  2630. ],
  2631. "name": "babel-core",
  2632. "optionalDependencies": {},
  2633. "readme": "ERROR: No README data found!",
  2634. "repository": {
  2635. "type": "git",
  2636. "url": "https://github.com/babel/babel/tree/master/packages/babel-core"
  2637. },
  2638. "scripts": {
  2639. "bench": "make bench",
  2640. "test": "make test"
  2641. },
  2642. "version": "6.23.1"
  2643. }
  2644. },{}],32:[function(require,module,exports){
  2645. "use strict";
  2646. exports.__esModule = true;
  2647. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  2648. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  2649. var _trimRight = require("trim-right");
  2650. var _trimRight2 = _interopRequireDefault(_trimRight);
  2651. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2652. var SPACES_RE = /^[ \t]+$/;
  2653. var Buffer = function () {
  2654. function Buffer(map) {
  2655. (0, _classCallCheck3.default)(this, Buffer);
  2656. this._map = null;
  2657. this._buf = [];
  2658. this._last = "";
  2659. this._queue = [];
  2660. this._position = {
  2661. line: 1,
  2662. column: 0
  2663. };
  2664. this._sourcePosition = {
  2665. identifierName: null,
  2666. line: null,
  2667. column: null,
  2668. filename: null
  2669. };
  2670. this._map = map;
  2671. }
  2672. Buffer.prototype.get = function get() {
  2673. this._flush();
  2674. var map = this._map;
  2675. var result = {
  2676. code: (0, _trimRight2.default)(this._buf.join("")),
  2677. map: null,
  2678. rawMappings: map && map.getRawMappings()
  2679. };
  2680. if (map) {
  2681. Object.defineProperty(result, "map", {
  2682. configurable: true,
  2683. enumerable: true,
  2684. get: function get() {
  2685. return this.map = map.get();
  2686. },
  2687. set: function set(value) {
  2688. Object.defineProperty(this, "map", { value: value, writable: true });
  2689. }
  2690. });
  2691. }
  2692. return result;
  2693. };
  2694. Buffer.prototype.append = function append(str) {
  2695. this._flush();
  2696. var _sourcePosition = this._sourcePosition,
  2697. line = _sourcePosition.line,
  2698. column = _sourcePosition.column,
  2699. filename = _sourcePosition.filename,
  2700. identifierName = _sourcePosition.identifierName;
  2701. this._append(str, line, column, identifierName, filename);
  2702. };
  2703. Buffer.prototype.queue = function queue(str) {
  2704. if (str === "\n") while (this._queue.length > 0 && SPACES_RE.test(this._queue[0][0])) {
  2705. this._queue.shift();
  2706. }var _sourcePosition2 = this._sourcePosition,
  2707. line = _sourcePosition2.line,
  2708. column = _sourcePosition2.column,
  2709. filename = _sourcePosition2.filename,
  2710. identifierName = _sourcePosition2.identifierName;
  2711. this._queue.unshift([str, line, column, identifierName, filename]);
  2712. };
  2713. Buffer.prototype._flush = function _flush() {
  2714. var item = void 0;
  2715. while (item = this._queue.pop()) {
  2716. this._append.apply(this, item);
  2717. }
  2718. };
  2719. Buffer.prototype._append = function _append(str, line, column, identifierName, filename) {
  2720. if (this._map && str[0] !== "\n") {
  2721. this._map.mark(this._position.line, this._position.column, line, column, identifierName, filename);
  2722. }
  2723. this._buf.push(str);
  2724. this._last = str[str.length - 1];
  2725. for (var i = 0; i < str.length; i++) {
  2726. if (str[i] === "\n") {
  2727. this._position.line++;
  2728. this._position.column = 0;
  2729. } else {
  2730. this._position.column++;
  2731. }
  2732. }
  2733. };
  2734. Buffer.prototype.removeTrailingNewline = function removeTrailingNewline() {
  2735. if (this._queue.length > 0 && this._queue[0][0] === "\n") this._queue.shift();
  2736. };
  2737. Buffer.prototype.removeLastSemicolon = function removeLastSemicolon() {
  2738. if (this._queue.length > 0 && this._queue[0][0] === ";") this._queue.shift();
  2739. };
  2740. Buffer.prototype.endsWith = function endsWith(suffix) {
  2741. if (suffix.length === 1) {
  2742. var last = void 0;
  2743. if (this._queue.length > 0) {
  2744. var str = this._queue[0][0];
  2745. last = str[str.length - 1];
  2746. } else {
  2747. last = this._last;
  2748. }
  2749. return last === suffix;
  2750. }
  2751. var end = this._last + this._queue.reduce(function (acc, item) {
  2752. return item[0] + acc;
  2753. }, "");
  2754. if (suffix.length <= end.length) {
  2755. return end.slice(-suffix.length) === suffix;
  2756. }
  2757. return false;
  2758. };
  2759. Buffer.prototype.hasContent = function hasContent() {
  2760. return this._queue.length > 0 || !!this._last;
  2761. };
  2762. Buffer.prototype.source = function source(prop, loc) {
  2763. if (prop && !loc) return;
  2764. var pos = loc ? loc[prop] : null;
  2765. this._sourcePosition.identifierName = loc && loc.identifierName || null;
  2766. this._sourcePosition.line = pos ? pos.line : null;
  2767. this._sourcePosition.column = pos ? pos.column : null;
  2768. this._sourcePosition.filename = loc && loc.filename || null;
  2769. };
  2770. Buffer.prototype.withSource = function withSource(prop, loc, cb) {
  2771. if (!this._map) return cb();
  2772. var originalLine = this._sourcePosition.line;
  2773. var originalColumn = this._sourcePosition.column;
  2774. var originalFilename = this._sourcePosition.filename;
  2775. var originalIdentifierName = this._sourcePosition.identifierName;
  2776. this.source(prop, loc);
  2777. cb();
  2778. this._sourcePosition.line = originalLine;
  2779. this._sourcePosition.column = originalColumn;
  2780. this._sourcePosition.filename = originalFilename;
  2781. this._sourcePosition.identifierName = originalIdentifierName;
  2782. };
  2783. Buffer.prototype.getCurrentColumn = function getCurrentColumn() {
  2784. var extra = this._queue.reduce(function (acc, item) {
  2785. return item[0] + acc;
  2786. }, "");
  2787. var lastIndex = extra.lastIndexOf("\n");
  2788. return lastIndex === -1 ? this._position.column + extra.length : extra.length - 1 - lastIndex;
  2789. };
  2790. Buffer.prototype.getCurrentLine = function getCurrentLine() {
  2791. var extra = this._queue.reduce(function (acc, item) {
  2792. return item[0] + acc;
  2793. }, "");
  2794. var count = 0;
  2795. for (var i = 0; i < extra.length; i++) {
  2796. if (extra[i] === "\n") count++;
  2797. }
  2798. return this._position.line + count;
  2799. };
  2800. return Buffer;
  2801. }();
  2802. exports.default = Buffer;
  2803. module.exports = exports["default"];
  2804. },{"babel-runtime/helpers/classCallCheck":70,"trim-right":488}],33:[function(require,module,exports){
  2805. "use strict";
  2806. exports.__esModule = true;
  2807. exports.File = File;
  2808. exports.Program = Program;
  2809. exports.BlockStatement = BlockStatement;
  2810. exports.Noop = Noop;
  2811. exports.Directive = Directive;
  2812. var _types = require("./types");
  2813. Object.defineProperty(exports, "DirectiveLiteral", {
  2814. enumerable: true,
  2815. get: function get() {
  2816. return _types.StringLiteral;
  2817. }
  2818. });
  2819. function File(node) {
  2820. this.print(node.program, node);
  2821. }
  2822. function Program(node) {
  2823. this.printInnerComments(node, false);
  2824. this.printSequence(node.directives, node);
  2825. if (node.directives && node.directives.length) this.newline();
  2826. this.printSequence(node.body, node);
  2827. }
  2828. function BlockStatement(node) {
  2829. this.token("{");
  2830. this.printInnerComments(node);
  2831. var hasDirectives = node.directives && node.directives.length;
  2832. if (node.body.length || hasDirectives) {
  2833. this.newline();
  2834. this.printSequence(node.directives, node, { indent: true });
  2835. if (hasDirectives) this.newline();
  2836. this.printSequence(node.body, node, { indent: true });
  2837. this.removeTrailingNewline();
  2838. this.source("end", node.loc);
  2839. if (!this.endsWith("\n")) this.newline();
  2840. this.rightBrace();
  2841. } else {
  2842. this.source("end", node.loc);
  2843. this.token("}");
  2844. }
  2845. }
  2846. function Noop() {}
  2847. function Directive(node) {
  2848. this.print(node.value, node);
  2849. this.semicolon();
  2850. }
  2851. },{"./types":42}],34:[function(require,module,exports){
  2852. "use strict";
  2853. exports.__esModule = true;
  2854. exports.ClassDeclaration = ClassDeclaration;
  2855. exports.ClassBody = ClassBody;
  2856. exports.ClassProperty = ClassProperty;
  2857. exports.ClassMethod = ClassMethod;
  2858. function ClassDeclaration(node) {
  2859. this.printJoin(node.decorators, node);
  2860. this.word("class");
  2861. if (node.id) {
  2862. this.space();
  2863. this.print(node.id, node);
  2864. }
  2865. this.print(node.typeParameters, node);
  2866. if (node.superClass) {
  2867. this.space();
  2868. this.word("extends");
  2869. this.space();
  2870. this.print(node.superClass, node);
  2871. this.print(node.superTypeParameters, node);
  2872. }
  2873. if (node.implements) {
  2874. this.space();
  2875. this.word("implements");
  2876. this.space();
  2877. this.printList(node.implements, node);
  2878. }
  2879. this.space();
  2880. this.print(node.body, node);
  2881. }
  2882. exports.ClassExpression = ClassDeclaration;
  2883. function ClassBody(node) {
  2884. this.token("{");
  2885. this.printInnerComments(node);
  2886. if (node.body.length === 0) {
  2887. this.token("}");
  2888. } else {
  2889. this.newline();
  2890. this.indent();
  2891. this.printSequence(node.body, node);
  2892. this.dedent();
  2893. if (!this.endsWith("\n")) this.newline();
  2894. this.rightBrace();
  2895. }
  2896. }
  2897. function ClassProperty(node) {
  2898. this.printJoin(node.decorators, node);
  2899. if (node.static) {
  2900. this.word("static");
  2901. this.space();
  2902. }
  2903. if (node.computed) {
  2904. this.token("[");
  2905. this.print(node.key, node);
  2906. this.token("]");
  2907. } else {
  2908. this._variance(node);
  2909. this.print(node.key, node);
  2910. }
  2911. this.print(node.typeAnnotation, node);
  2912. if (node.value) {
  2913. this.space();
  2914. this.token("=");
  2915. this.space();
  2916. this.print(node.value, node);
  2917. }
  2918. this.semicolon();
  2919. }
  2920. function ClassMethod(node) {
  2921. this.printJoin(node.decorators, node);
  2922. if (node.static) {
  2923. this.word("static");
  2924. this.space();
  2925. }
  2926. if (node.kind === "constructorCall") {
  2927. this.word("call");
  2928. this.space();
  2929. }
  2930. this._method(node);
  2931. }
  2932. },{}],35:[function(require,module,exports){
  2933. "use strict";
  2934. exports.__esModule = true;
  2935. exports.LogicalExpression = exports.BinaryExpression = exports.AwaitExpression = exports.YieldExpression = undefined;
  2936. exports.UnaryExpression = UnaryExpression;
  2937. exports.DoExpression = DoExpression;
  2938. exports.ParenthesizedExpression = ParenthesizedExpression;
  2939. exports.UpdateExpression = UpdateExpression;
  2940. exports.ConditionalExpression = ConditionalExpression;
  2941. exports.NewExpression = NewExpression;
  2942. exports.SequenceExpression = SequenceExpression;
  2943. exports.ThisExpression = ThisExpression;
  2944. exports.Super = Super;
  2945. exports.Decorator = Decorator;
  2946. exports.CallExpression = CallExpression;
  2947. exports.Import = Import;
  2948. exports.EmptyStatement = EmptyStatement;
  2949. exports.ExpressionStatement = ExpressionStatement;
  2950. exports.AssignmentPattern = AssignmentPattern;
  2951. exports.AssignmentExpression = AssignmentExpression;
  2952. exports.BindExpression = BindExpression;
  2953. exports.MemberExpression = MemberExpression;
  2954. exports.MetaProperty = MetaProperty;
  2955. var _babelTypes = require("babel-types");
  2956. var t = _interopRequireWildcard(_babelTypes);
  2957. var _node = require("../node");
  2958. var n = _interopRequireWildcard(_node);
  2959. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  2960. function UnaryExpression(node) {
  2961. if (node.operator === "void" || node.operator === "delete" || node.operator === "typeof") {
  2962. this.word(node.operator);
  2963. this.space();
  2964. } else {
  2965. this.token(node.operator);
  2966. }
  2967. this.print(node.argument, node);
  2968. }
  2969. function DoExpression(node) {
  2970. this.word("do");
  2971. this.space();
  2972. this.print(node.body, node);
  2973. }
  2974. function ParenthesizedExpression(node) {
  2975. this.token("(");
  2976. this.print(node.expression, node);
  2977. this.token(")");
  2978. }
  2979. function UpdateExpression(node) {
  2980. if (node.prefix) {
  2981. this.token(node.operator);
  2982. this.print(node.argument, node);
  2983. } else {
  2984. this.print(node.argument, node);
  2985. this.token(node.operator);
  2986. }
  2987. }
  2988. function ConditionalExpression(node) {
  2989. this.print(node.test, node);
  2990. this.space();
  2991. this.token("?");
  2992. this.space();
  2993. this.print(node.consequent, node);
  2994. this.space();
  2995. this.token(":");
  2996. this.space();
  2997. this.print(node.alternate, node);
  2998. }
  2999. function NewExpression(node, parent) {
  3000. this.word("new");
  3001. this.space();
  3002. this.print(node.callee, node);
  3003. if (node.arguments.length === 0 && this.format.minified && !t.isCallExpression(parent, { callee: node }) && !t.isMemberExpression(parent) && !t.isNewExpression(parent)) return;
  3004. this.token("(");
  3005. this.printList(node.arguments, node);
  3006. this.token(")");
  3007. }
  3008. function SequenceExpression(node) {
  3009. this.printList(node.expressions, node);
  3010. }
  3011. function ThisExpression() {
  3012. this.word("this");
  3013. }
  3014. function Super() {
  3015. this.word("super");
  3016. }
  3017. function Decorator(node) {
  3018. this.token("@");
  3019. this.print(node.expression, node);
  3020. this.newline();
  3021. }
  3022. function commaSeparatorNewline() {
  3023. this.token(",");
  3024. this.newline();
  3025. if (!this.endsWith("\n")) this.space();
  3026. }
  3027. function CallExpression(node) {
  3028. this.print(node.callee, node);
  3029. this.token("(");
  3030. var isPrettyCall = node._prettyCall;
  3031. var separator = void 0;
  3032. if (isPrettyCall) {
  3033. separator = commaSeparatorNewline;
  3034. this.newline();
  3035. this.indent();
  3036. }
  3037. this.printList(node.arguments, node, { separator: separator });
  3038. if (isPrettyCall) {
  3039. this.newline();
  3040. this.dedent();
  3041. }
  3042. this.token(")");
  3043. }
  3044. function Import() {
  3045. this.word("import");
  3046. }
  3047. function buildYieldAwait(keyword) {
  3048. return function (node) {
  3049. this.word(keyword);
  3050. if (node.delegate) {
  3051. this.token("*");
  3052. }
  3053. if (node.argument) {
  3054. this.space();
  3055. var terminatorState = this.startTerminatorless();
  3056. this.print(node.argument, node);
  3057. this.endTerminatorless(terminatorState);
  3058. }
  3059. };
  3060. }
  3061. var YieldExpression = exports.YieldExpression = buildYieldAwait("yield");
  3062. var AwaitExpression = exports.AwaitExpression = buildYieldAwait("await");
  3063. function EmptyStatement() {
  3064. this.semicolon(true);
  3065. }
  3066. function ExpressionStatement(node) {
  3067. this.print(node.expression, node);
  3068. this.semicolon();
  3069. }
  3070. function AssignmentPattern(node) {
  3071. this.print(node.left, node);
  3072. if (node.left.optional) this.token("?");
  3073. this.print(node.left.typeAnnotation, node);
  3074. this.space();
  3075. this.token("=");
  3076. this.space();
  3077. this.print(node.right, node);
  3078. }
  3079. function AssignmentExpression(node, parent) {
  3080. var parens = this.inForStatementInitCounter && node.operator === "in" && !n.needsParens(node, parent);
  3081. if (parens) {
  3082. this.token("(");
  3083. }
  3084. this.print(node.left, node);
  3085. this.space();
  3086. if (node.operator === "in" || node.operator === "instanceof") {
  3087. this.word(node.operator);
  3088. } else {
  3089. this.token(node.operator);
  3090. }
  3091. this.space();
  3092. this.print(node.right, node);
  3093. if (parens) {
  3094. this.token(")");
  3095. }
  3096. }
  3097. function BindExpression(node) {
  3098. this.print(node.object, node);
  3099. this.token("::");
  3100. this.print(node.callee, node);
  3101. }
  3102. exports.BinaryExpression = AssignmentExpression;
  3103. exports.LogicalExpression = AssignmentExpression;
  3104. function MemberExpression(node) {
  3105. this.print(node.object, node);
  3106. if (!node.computed && t.isMemberExpression(node.property)) {
  3107. throw new TypeError("Got a MemberExpression for MemberExpression property");
  3108. }
  3109. var computed = node.computed;
  3110. if (t.isLiteral(node.property) && typeof node.property.value === "number") {
  3111. computed = true;
  3112. }
  3113. if (computed) {
  3114. this.token("[");
  3115. this.print(node.property, node);
  3116. this.token("]");
  3117. } else {
  3118. this.token(".");
  3119. this.print(node.property, node);
  3120. }
  3121. }
  3122. function MetaProperty(node) {
  3123. this.print(node.meta, node);
  3124. this.token(".");
  3125. this.print(node.property, node);
  3126. }
  3127. },{"../node":44,"babel-types":112}],36:[function(require,module,exports){
  3128. "use strict";
  3129. exports.__esModule = true;
  3130. exports.AnyTypeAnnotation = AnyTypeAnnotation;
  3131. exports.ArrayTypeAnnotation = ArrayTypeAnnotation;
  3132. exports.BooleanTypeAnnotation = BooleanTypeAnnotation;
  3133. exports.BooleanLiteralTypeAnnotation = BooleanLiteralTypeAnnotation;
  3134. exports.NullLiteralTypeAnnotation = NullLiteralTypeAnnotation;
  3135. exports.DeclareClass = DeclareClass;
  3136. exports.DeclareFunction = DeclareFunction;
  3137. exports.DeclareInterface = DeclareInterface;
  3138. exports.DeclareModule = DeclareModule;
  3139. exports.DeclareModuleExports = DeclareModuleExports;
  3140. exports.DeclareTypeAlias = DeclareTypeAlias;
  3141. exports.DeclareVariable = DeclareVariable;
  3142. exports.ExistentialTypeParam = ExistentialTypeParam;
  3143. exports.FunctionTypeAnnotation = FunctionTypeAnnotation;
  3144. exports.FunctionTypeParam = FunctionTypeParam;
  3145. exports.InterfaceExtends = InterfaceExtends;
  3146. exports._interfaceish = _interfaceish;
  3147. exports._variance = _variance;
  3148. exports.InterfaceDeclaration = InterfaceDeclaration;
  3149. exports.IntersectionTypeAnnotation = IntersectionTypeAnnotation;
  3150. exports.MixedTypeAnnotation = MixedTypeAnnotation;
  3151. exports.EmptyTypeAnnotation = EmptyTypeAnnotation;
  3152. exports.NullableTypeAnnotation = NullableTypeAnnotation;
  3153. var _types = require("./types");
  3154. Object.defineProperty(exports, "NumericLiteralTypeAnnotation", {
  3155. enumerable: true,
  3156. get: function get() {
  3157. return _types.NumericLiteral;
  3158. }
  3159. });
  3160. Object.defineProperty(exports, "StringLiteralTypeAnnotation", {
  3161. enumerable: true,
  3162. get: function get() {
  3163. return _types.StringLiteral;
  3164. }
  3165. });
  3166. exports.NumberTypeAnnotation = NumberTypeAnnotation;
  3167. exports.StringTypeAnnotation = StringTypeAnnotation;
  3168. exports.ThisTypeAnnotation = ThisTypeAnnotation;
  3169. exports.TupleTypeAnnotation = TupleTypeAnnotation;
  3170. exports.TypeofTypeAnnotation = TypeofTypeAnnotation;
  3171. exports.TypeAlias = TypeAlias;
  3172. exports.TypeAnnotation = TypeAnnotation;
  3173. exports.TypeParameter = TypeParameter;
  3174. exports.TypeParameterInstantiation = TypeParameterInstantiation;
  3175. exports.ObjectTypeAnnotation = ObjectTypeAnnotation;
  3176. exports.ObjectTypeCallProperty = ObjectTypeCallProperty;
  3177. exports.ObjectTypeIndexer = ObjectTypeIndexer;
  3178. exports.ObjectTypeProperty = ObjectTypeProperty;
  3179. exports.QualifiedTypeIdentifier = QualifiedTypeIdentifier;
  3180. exports.UnionTypeAnnotation = UnionTypeAnnotation;
  3181. exports.TypeCastExpression = TypeCastExpression;
  3182. exports.VoidTypeAnnotation = VoidTypeAnnotation;
  3183. function AnyTypeAnnotation() {
  3184. this.word("any");
  3185. }
  3186. function ArrayTypeAnnotation(node) {
  3187. this.print(node.elementType, node);
  3188. this.token("[");
  3189. this.token("]");
  3190. }
  3191. function BooleanTypeAnnotation() {
  3192. this.word("boolean");
  3193. }
  3194. function BooleanLiteralTypeAnnotation(node) {
  3195. this.word(node.value ? "true" : "false");
  3196. }
  3197. function NullLiteralTypeAnnotation() {
  3198. this.word("null");
  3199. }
  3200. function DeclareClass(node) {
  3201. this.word("declare");
  3202. this.space();
  3203. this.word("class");
  3204. this.space();
  3205. this._interfaceish(node);
  3206. }
  3207. function DeclareFunction(node) {
  3208. this.word("declare");
  3209. this.space();
  3210. this.word("function");
  3211. this.space();
  3212. this.print(node.id, node);
  3213. this.print(node.id.typeAnnotation.typeAnnotation, node);
  3214. this.semicolon();
  3215. }
  3216. function DeclareInterface(node) {
  3217. this.word("declare");
  3218. this.space();
  3219. this.InterfaceDeclaration(node);
  3220. }
  3221. function DeclareModule(node) {
  3222. this.word("declare");
  3223. this.space();
  3224. this.word("module");
  3225. this.space();
  3226. this.print(node.id, node);
  3227. this.space();
  3228. this.print(node.body, node);
  3229. }
  3230. function DeclareModuleExports(node) {
  3231. this.word("declare");
  3232. this.space();
  3233. this.word("module");
  3234. this.token(".");
  3235. this.word("exports");
  3236. this.print(node.typeAnnotation, node);
  3237. }
  3238. function DeclareTypeAlias(node) {
  3239. this.word("declare");
  3240. this.space();
  3241. this.TypeAlias(node);
  3242. }
  3243. function DeclareVariable(node) {
  3244. this.word("declare");
  3245. this.space();
  3246. this.word("var");
  3247. this.space();
  3248. this.print(node.id, node);
  3249. this.print(node.id.typeAnnotation, node);
  3250. this.semicolon();
  3251. }
  3252. function ExistentialTypeParam() {
  3253. this.token("*");
  3254. }
  3255. function FunctionTypeAnnotation(node, parent) {
  3256. this.print(node.typeParameters, node);
  3257. this.token("(");
  3258. this.printList(node.params, node);
  3259. if (node.rest) {
  3260. if (node.params.length) {
  3261. this.token(",");
  3262. this.space();
  3263. }
  3264. this.token("...");
  3265. this.print(node.rest, node);
  3266. }
  3267. this.token(")");
  3268. if (parent.type === "ObjectTypeCallProperty" || parent.type === "DeclareFunction") {
  3269. this.token(":");
  3270. } else {
  3271. this.space();
  3272. this.token("=>");
  3273. }
  3274. this.space();
  3275. this.print(node.returnType, node);
  3276. }
  3277. function FunctionTypeParam(node) {
  3278. this.print(node.name, node);
  3279. if (node.optional) this.token("?");
  3280. this.token(":");
  3281. this.space();
  3282. this.print(node.typeAnnotation, node);
  3283. }
  3284. function InterfaceExtends(node) {
  3285. this.print(node.id, node);
  3286. this.print(node.typeParameters, node);
  3287. }
  3288. exports.ClassImplements = InterfaceExtends;
  3289. exports.GenericTypeAnnotation = InterfaceExtends;
  3290. function _interfaceish(node) {
  3291. this.print(node.id, node);
  3292. this.print(node.typeParameters, node);
  3293. if (node.extends.length) {
  3294. this.space();
  3295. this.word("extends");
  3296. this.space();
  3297. this.printList(node.extends, node);
  3298. }
  3299. if (node.mixins && node.mixins.length) {
  3300. this.space();
  3301. this.word("mixins");
  3302. this.space();
  3303. this.printList(node.mixins, node);
  3304. }
  3305. this.space();
  3306. this.print(node.body, node);
  3307. }
  3308. function _variance(node) {
  3309. if (node.variance === "plus") {
  3310. this.token("+");
  3311. } else if (node.variance === "minus") {
  3312. this.token("-");
  3313. }
  3314. }
  3315. function InterfaceDeclaration(node) {
  3316. this.word("interface");
  3317. this.space();
  3318. this._interfaceish(node);
  3319. }
  3320. function andSeparator() {
  3321. this.space();
  3322. this.token("&");
  3323. this.space();
  3324. }
  3325. function IntersectionTypeAnnotation(node) {
  3326. this.printJoin(node.types, node, { separator: andSeparator });
  3327. }
  3328. function MixedTypeAnnotation() {
  3329. this.word("mixed");
  3330. }
  3331. function EmptyTypeAnnotation() {
  3332. this.word("empty");
  3333. }
  3334. function NullableTypeAnnotation(node) {
  3335. this.token("?");
  3336. this.print(node.typeAnnotation, node);
  3337. }
  3338. function NumberTypeAnnotation() {
  3339. this.word("number");
  3340. }
  3341. function StringTypeAnnotation() {
  3342. this.word("string");
  3343. }
  3344. function ThisTypeAnnotation() {
  3345. this.word("this");
  3346. }
  3347. function TupleTypeAnnotation(node) {
  3348. this.token("[");
  3349. this.printList(node.types, node);
  3350. this.token("]");
  3351. }
  3352. function TypeofTypeAnnotation(node) {
  3353. this.word("typeof");
  3354. this.space();
  3355. this.print(node.argument, node);
  3356. }
  3357. function TypeAlias(node) {
  3358. this.word("type");
  3359. this.space();
  3360. this.print(node.id, node);
  3361. this.print(node.typeParameters, node);
  3362. this.space();
  3363. this.token("=");
  3364. this.space();
  3365. this.print(node.right, node);
  3366. this.semicolon();
  3367. }
  3368. function TypeAnnotation(node) {
  3369. this.token(":");
  3370. this.space();
  3371. if (node.optional) this.token("?");
  3372. this.print(node.typeAnnotation, node);
  3373. }
  3374. function TypeParameter(node) {
  3375. this._variance(node);
  3376. this.word(node.name);
  3377. if (node.bound) {
  3378. this.print(node.bound, node);
  3379. }
  3380. if (node.default) {
  3381. this.space();
  3382. this.token("=");
  3383. this.space();
  3384. this.print(node.default, node);
  3385. }
  3386. }
  3387. function TypeParameterInstantiation(node) {
  3388. this.token("<");
  3389. this.printList(node.params, node, {});
  3390. this.token(">");
  3391. }
  3392. exports.TypeParameterDeclaration = TypeParameterInstantiation;
  3393. function ObjectTypeAnnotation(node) {
  3394. var _this = this;
  3395. if (node.exact) {
  3396. this.token("{|");
  3397. } else {
  3398. this.token("{");
  3399. }
  3400. var props = node.properties.concat(node.callProperties, node.indexers);
  3401. if (props.length) {
  3402. this.space();
  3403. this.printJoin(props, node, {
  3404. addNewlines: function addNewlines(leading) {
  3405. if (leading && !props[0]) return 1;
  3406. },
  3407. indent: true,
  3408. statement: true,
  3409. iterator: function iterator() {
  3410. if (props.length !== 1) {
  3411. if (_this.format.flowCommaSeparator) {
  3412. _this.token(",");
  3413. } else {
  3414. _this.semicolon();
  3415. }
  3416. _this.space();
  3417. }
  3418. }
  3419. });
  3420. this.space();
  3421. }
  3422. if (node.exact) {
  3423. this.token("|}");
  3424. } else {
  3425. this.token("}");
  3426. }
  3427. }
  3428. function ObjectTypeCallProperty(node) {
  3429. if (node.static) {
  3430. this.word("static");
  3431. this.space();
  3432. }
  3433. this.print(node.value, node);
  3434. }
  3435. function ObjectTypeIndexer(node) {
  3436. if (node.static) {
  3437. this.word("static");
  3438. this.space();
  3439. }
  3440. this._variance(node);
  3441. this.token("[");
  3442. this.print(node.id, node);
  3443. this.token(":");
  3444. this.space();
  3445. this.print(node.key, node);
  3446. this.token("]");
  3447. this.token(":");
  3448. this.space();
  3449. this.print(node.value, node);
  3450. }
  3451. function ObjectTypeProperty(node) {
  3452. if (node.static) {
  3453. this.word("static");
  3454. this.space();
  3455. }
  3456. this._variance(node);
  3457. this.print(node.key, node);
  3458. if (node.optional) this.token("?");
  3459. this.token(":");
  3460. this.space();
  3461. this.print(node.value, node);
  3462. }
  3463. function QualifiedTypeIdentifier(node) {
  3464. this.print(node.qualification, node);
  3465. this.token(".");
  3466. this.print(node.id, node);
  3467. }
  3468. function orSeparator() {
  3469. this.space();
  3470. this.token("|");
  3471. this.space();
  3472. }
  3473. function UnionTypeAnnotation(node) {
  3474. this.printJoin(node.types, node, { separator: orSeparator });
  3475. }
  3476. function TypeCastExpression(node) {
  3477. this.token("(");
  3478. this.print(node.expression, node);
  3479. this.print(node.typeAnnotation, node);
  3480. this.token(")");
  3481. }
  3482. function VoidTypeAnnotation() {
  3483. this.word("void");
  3484. }
  3485. },{"./types":42}],37:[function(require,module,exports){
  3486. "use strict";
  3487. exports.__esModule = true;
  3488. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  3489. var _getIterator3 = _interopRequireDefault(_getIterator2);
  3490. exports.JSXAttribute = JSXAttribute;
  3491. exports.JSXIdentifier = JSXIdentifier;
  3492. exports.JSXNamespacedName = JSXNamespacedName;
  3493. exports.JSXMemberExpression = JSXMemberExpression;
  3494. exports.JSXSpreadAttribute = JSXSpreadAttribute;
  3495. exports.JSXExpressionContainer = JSXExpressionContainer;
  3496. exports.JSXSpreadChild = JSXSpreadChild;
  3497. exports.JSXText = JSXText;
  3498. exports.JSXElement = JSXElement;
  3499. exports.JSXOpeningElement = JSXOpeningElement;
  3500. exports.JSXClosingElement = JSXClosingElement;
  3501. exports.JSXEmptyExpression = JSXEmptyExpression;
  3502. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3503. function JSXAttribute(node) {
  3504. this.print(node.name, node);
  3505. if (node.value) {
  3506. this.token("=");
  3507. this.print(node.value, node);
  3508. }
  3509. }
  3510. function JSXIdentifier(node) {
  3511. this.word(node.name);
  3512. }
  3513. function JSXNamespacedName(node) {
  3514. this.print(node.namespace, node);
  3515. this.token(":");
  3516. this.print(node.name, node);
  3517. }
  3518. function JSXMemberExpression(node) {
  3519. this.print(node.object, node);
  3520. this.token(".");
  3521. this.print(node.property, node);
  3522. }
  3523. function JSXSpreadAttribute(node) {
  3524. this.token("{");
  3525. this.token("...");
  3526. this.print(node.argument, node);
  3527. this.token("}");
  3528. }
  3529. function JSXExpressionContainer(node) {
  3530. this.token("{");
  3531. this.print(node.expression, node);
  3532. this.token("}");
  3533. }
  3534. function JSXSpreadChild(node) {
  3535. this.token("{");
  3536. this.token("...");
  3537. this.print(node.expression, node);
  3538. this.token("}");
  3539. }
  3540. function JSXText(node) {
  3541. this.token(node.value);
  3542. }
  3543. function JSXElement(node) {
  3544. var open = node.openingElement;
  3545. this.print(open, node);
  3546. if (open.selfClosing) return;
  3547. this.indent();
  3548. for (var _iterator = node.children, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  3549. var _ref;
  3550. if (_isArray) {
  3551. if (_i >= _iterator.length) break;
  3552. _ref = _iterator[_i++];
  3553. } else {
  3554. _i = _iterator.next();
  3555. if (_i.done) break;
  3556. _ref = _i.value;
  3557. }
  3558. var child = _ref;
  3559. this.print(child, node);
  3560. }
  3561. this.dedent();
  3562. this.print(node.closingElement, node);
  3563. }
  3564. function spaceSeparator() {
  3565. this.space();
  3566. }
  3567. function JSXOpeningElement(node) {
  3568. this.token("<");
  3569. this.print(node.name, node);
  3570. if (node.attributes.length > 0) {
  3571. this.space();
  3572. this.printJoin(node.attributes, node, { separator: spaceSeparator });
  3573. }
  3574. if (node.selfClosing) {
  3575. this.space();
  3576. this.token("/>");
  3577. } else {
  3578. this.token(">");
  3579. }
  3580. }
  3581. function JSXClosingElement(node) {
  3582. this.token("</");
  3583. this.print(node.name, node);
  3584. this.token(">");
  3585. }
  3586. function JSXEmptyExpression() {}
  3587. },{"babel-runtime/core-js/get-iterator":56}],38:[function(require,module,exports){
  3588. "use strict";
  3589. exports.__esModule = true;
  3590. exports.FunctionDeclaration = undefined;
  3591. exports._params = _params;
  3592. exports._method = _method;
  3593. exports.FunctionExpression = FunctionExpression;
  3594. exports.ArrowFunctionExpression = ArrowFunctionExpression;
  3595. var _babelTypes = require("babel-types");
  3596. var t = _interopRequireWildcard(_babelTypes);
  3597. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  3598. function _params(node) {
  3599. var _this = this;
  3600. this.print(node.typeParameters, node);
  3601. this.token("(");
  3602. this.printList(node.params, node, {
  3603. iterator: function iterator(node) {
  3604. if (node.optional) _this.token("?");
  3605. _this.print(node.typeAnnotation, node);
  3606. }
  3607. });
  3608. this.token(")");
  3609. if (node.returnType) {
  3610. this.print(node.returnType, node);
  3611. }
  3612. }
  3613. function _method(node) {
  3614. var kind = node.kind;
  3615. var key = node.key;
  3616. if (kind === "method" || kind === "init") {
  3617. if (node.generator) {
  3618. this.token("*");
  3619. }
  3620. }
  3621. if (kind === "get" || kind === "set") {
  3622. this.word(kind);
  3623. this.space();
  3624. }
  3625. if (node.async) {
  3626. this.word("async");
  3627. this.space();
  3628. }
  3629. if (node.computed) {
  3630. this.token("[");
  3631. this.print(key, node);
  3632. this.token("]");
  3633. } else {
  3634. this.print(key, node);
  3635. }
  3636. this._params(node);
  3637. this.space();
  3638. this.print(node.body, node);
  3639. }
  3640. function FunctionExpression(node) {
  3641. if (node.async) {
  3642. this.word("async");
  3643. this.space();
  3644. }
  3645. this.word("function");
  3646. if (node.generator) this.token("*");
  3647. if (node.id) {
  3648. this.space();
  3649. this.print(node.id, node);
  3650. } else {
  3651. this.space();
  3652. }
  3653. this._params(node);
  3654. this.space();
  3655. this.print(node.body, node);
  3656. }
  3657. exports.FunctionDeclaration = FunctionExpression;
  3658. function ArrowFunctionExpression(node) {
  3659. if (node.async) {
  3660. this.word("async");
  3661. this.space();
  3662. }
  3663. var firstParam = node.params[0];
  3664. if (node.params.length === 1 && t.isIdentifier(firstParam) && !hasTypes(node, firstParam)) {
  3665. this.print(firstParam, node);
  3666. } else {
  3667. this._params(node);
  3668. }
  3669. this.space();
  3670. this.token("=>");
  3671. this.space();
  3672. this.print(node.body, node);
  3673. }
  3674. function hasTypes(node, param) {
  3675. return node.typeParameters || node.returnType || param.typeAnnotation || param.optional || param.trailingComments;
  3676. }
  3677. },{"babel-types":112}],39:[function(require,module,exports){
  3678. "use strict";
  3679. exports.__esModule = true;
  3680. exports.ImportSpecifier = ImportSpecifier;
  3681. exports.ImportDefaultSpecifier = ImportDefaultSpecifier;
  3682. exports.ExportDefaultSpecifier = ExportDefaultSpecifier;
  3683. exports.ExportSpecifier = ExportSpecifier;
  3684. exports.ExportNamespaceSpecifier = ExportNamespaceSpecifier;
  3685. exports.ExportAllDeclaration = ExportAllDeclaration;
  3686. exports.ExportNamedDeclaration = ExportNamedDeclaration;
  3687. exports.ExportDefaultDeclaration = ExportDefaultDeclaration;
  3688. exports.ImportDeclaration = ImportDeclaration;
  3689. exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier;
  3690. var _babelTypes = require("babel-types");
  3691. var t = _interopRequireWildcard(_babelTypes);
  3692. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  3693. function ImportSpecifier(node) {
  3694. if (node.importKind === "type" || node.importKind === "typeof") {
  3695. this.word(node.importKind);
  3696. this.space();
  3697. }
  3698. this.print(node.imported, node);
  3699. if (node.local && node.local.name !== node.imported.name) {
  3700. this.space();
  3701. this.word("as");
  3702. this.space();
  3703. this.print(node.local, node);
  3704. }
  3705. }
  3706. function ImportDefaultSpecifier(node) {
  3707. this.print(node.local, node);
  3708. }
  3709. function ExportDefaultSpecifier(node) {
  3710. this.print(node.exported, node);
  3711. }
  3712. function ExportSpecifier(node) {
  3713. this.print(node.local, node);
  3714. if (node.exported && node.local.name !== node.exported.name) {
  3715. this.space();
  3716. this.word("as");
  3717. this.space();
  3718. this.print(node.exported, node);
  3719. }
  3720. }
  3721. function ExportNamespaceSpecifier(node) {
  3722. this.token("*");
  3723. this.space();
  3724. this.word("as");
  3725. this.space();
  3726. this.print(node.exported, node);
  3727. }
  3728. function ExportAllDeclaration(node) {
  3729. this.word("export");
  3730. this.space();
  3731. this.token("*");
  3732. if (node.exported) {
  3733. this.space();
  3734. this.word("as");
  3735. this.space();
  3736. this.print(node.exported, node);
  3737. }
  3738. this.space();
  3739. this.word("from");
  3740. this.space();
  3741. this.print(node.source, node);
  3742. this.semicolon();
  3743. }
  3744. function ExportNamedDeclaration() {
  3745. this.word("export");
  3746. this.space();
  3747. ExportDeclaration.apply(this, arguments);
  3748. }
  3749. function ExportDefaultDeclaration() {
  3750. this.word("export");
  3751. this.space();
  3752. this.word("default");
  3753. this.space();
  3754. ExportDeclaration.apply(this, arguments);
  3755. }
  3756. function ExportDeclaration(node) {
  3757. if (node.declaration) {
  3758. var declar = node.declaration;
  3759. this.print(declar, node);
  3760. if (!t.isStatement(declar)) this.semicolon();
  3761. } else {
  3762. if (node.exportKind === "type") {
  3763. this.word("type");
  3764. this.space();
  3765. }
  3766. var specifiers = node.specifiers.slice(0);
  3767. var hasSpecial = false;
  3768. while (true) {
  3769. var first = specifiers[0];
  3770. if (t.isExportDefaultSpecifier(first) || t.isExportNamespaceSpecifier(first)) {
  3771. hasSpecial = true;
  3772. this.print(specifiers.shift(), node);
  3773. if (specifiers.length) {
  3774. this.token(",");
  3775. this.space();
  3776. }
  3777. } else {
  3778. break;
  3779. }
  3780. }
  3781. if (specifiers.length || !specifiers.length && !hasSpecial) {
  3782. this.token("{");
  3783. if (specifiers.length) {
  3784. this.space();
  3785. this.printList(specifiers, node);
  3786. this.space();
  3787. }
  3788. this.token("}");
  3789. }
  3790. if (node.source) {
  3791. this.space();
  3792. this.word("from");
  3793. this.space();
  3794. this.print(node.source, node);
  3795. }
  3796. this.semicolon();
  3797. }
  3798. }
  3799. function ImportDeclaration(node) {
  3800. this.word("import");
  3801. this.space();
  3802. if (node.importKind === "type" || node.importKind === "typeof") {
  3803. this.word(node.importKind);
  3804. this.space();
  3805. }
  3806. var specifiers = node.specifiers.slice(0);
  3807. if (specifiers && specifiers.length) {
  3808. while (true) {
  3809. var first = specifiers[0];
  3810. if (t.isImportDefaultSpecifier(first) || t.isImportNamespaceSpecifier(first)) {
  3811. this.print(specifiers.shift(), node);
  3812. if (specifiers.length) {
  3813. this.token(",");
  3814. this.space();
  3815. }
  3816. } else {
  3817. break;
  3818. }
  3819. }
  3820. if (specifiers.length) {
  3821. this.token("{");
  3822. this.space();
  3823. this.printList(specifiers, node);
  3824. this.space();
  3825. this.token("}");
  3826. }
  3827. this.space();
  3828. this.word("from");
  3829. this.space();
  3830. }
  3831. this.print(node.source, node);
  3832. this.semicolon();
  3833. }
  3834. function ImportNamespaceSpecifier(node) {
  3835. this.token("*");
  3836. this.space();
  3837. this.word("as");
  3838. this.space();
  3839. this.print(node.local, node);
  3840. }
  3841. },{"babel-types":112}],40:[function(require,module,exports){
  3842. "use strict";
  3843. exports.__esModule = true;
  3844. exports.ThrowStatement = exports.BreakStatement = exports.ReturnStatement = exports.ContinueStatement = exports.ForAwaitStatement = exports.ForOfStatement = exports.ForInStatement = undefined;
  3845. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  3846. var _getIterator3 = _interopRequireDefault(_getIterator2);
  3847. exports.WithStatement = WithStatement;
  3848. exports.IfStatement = IfStatement;
  3849. exports.ForStatement = ForStatement;
  3850. exports.WhileStatement = WhileStatement;
  3851. exports.DoWhileStatement = DoWhileStatement;
  3852. exports.LabeledStatement = LabeledStatement;
  3853. exports.TryStatement = TryStatement;
  3854. exports.CatchClause = CatchClause;
  3855. exports.SwitchStatement = SwitchStatement;
  3856. exports.SwitchCase = SwitchCase;
  3857. exports.DebuggerStatement = DebuggerStatement;
  3858. exports.VariableDeclaration = VariableDeclaration;
  3859. exports.VariableDeclarator = VariableDeclarator;
  3860. var _babelTypes = require("babel-types");
  3861. var t = _interopRequireWildcard(_babelTypes);
  3862. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  3863. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3864. function WithStatement(node) {
  3865. this.word("with");
  3866. this.space();
  3867. this.token("(");
  3868. this.print(node.object, node);
  3869. this.token(")");
  3870. this.printBlock(node);
  3871. }
  3872. function IfStatement(node) {
  3873. this.word("if");
  3874. this.space();
  3875. this.token("(");
  3876. this.print(node.test, node);
  3877. this.token(")");
  3878. this.space();
  3879. var needsBlock = node.alternate && t.isIfStatement(getLastStatement(node.consequent));
  3880. if (needsBlock) {
  3881. this.token("{");
  3882. this.newline();
  3883. this.indent();
  3884. }
  3885. this.printAndIndentOnComments(node.consequent, node);
  3886. if (needsBlock) {
  3887. this.dedent();
  3888. this.newline();
  3889. this.token("}");
  3890. }
  3891. if (node.alternate) {
  3892. if (this.endsWith("}")) this.space();
  3893. this.word("else");
  3894. this.space();
  3895. this.printAndIndentOnComments(node.alternate, node);
  3896. }
  3897. }
  3898. function getLastStatement(statement) {
  3899. if (!t.isStatement(statement.body)) return statement;
  3900. return getLastStatement(statement.body);
  3901. }
  3902. function ForStatement(node) {
  3903. this.word("for");
  3904. this.space();
  3905. this.token("(");
  3906. this.inForStatementInitCounter++;
  3907. this.print(node.init, node);
  3908. this.inForStatementInitCounter--;
  3909. this.token(";");
  3910. if (node.test) {
  3911. this.space();
  3912. this.print(node.test, node);
  3913. }
  3914. this.token(";");
  3915. if (node.update) {
  3916. this.space();
  3917. this.print(node.update, node);
  3918. }
  3919. this.token(")");
  3920. this.printBlock(node);
  3921. }
  3922. function WhileStatement(node) {
  3923. this.word("while");
  3924. this.space();
  3925. this.token("(");
  3926. this.print(node.test, node);
  3927. this.token(")");
  3928. this.printBlock(node);
  3929. }
  3930. var buildForXStatement = function buildForXStatement(op) {
  3931. return function (node) {
  3932. this.word("for");
  3933. this.space();
  3934. if (op === "await") {
  3935. this.word("await");
  3936. this.space();
  3937. op = "of";
  3938. }
  3939. this.token("(");
  3940. this.print(node.left, node);
  3941. this.space();
  3942. this.word(op);
  3943. this.space();
  3944. this.print(node.right, node);
  3945. this.token(")");
  3946. this.printBlock(node);
  3947. };
  3948. };
  3949. var ForInStatement = exports.ForInStatement = buildForXStatement("in");
  3950. var ForOfStatement = exports.ForOfStatement = buildForXStatement("of");
  3951. var ForAwaitStatement = exports.ForAwaitStatement = buildForXStatement("await");
  3952. function DoWhileStatement(node) {
  3953. this.word("do");
  3954. this.space();
  3955. this.print(node.body, node);
  3956. this.space();
  3957. this.word("while");
  3958. this.space();
  3959. this.token("(");
  3960. this.print(node.test, node);
  3961. this.token(")");
  3962. this.semicolon();
  3963. }
  3964. function buildLabelStatement(prefix) {
  3965. var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "label";
  3966. return function (node) {
  3967. this.word(prefix);
  3968. var label = node[key];
  3969. if (label) {
  3970. this.space();
  3971. var terminatorState = this.startTerminatorless();
  3972. this.print(label, node);
  3973. this.endTerminatorless(terminatorState);
  3974. }
  3975. this.semicolon();
  3976. };
  3977. }
  3978. var ContinueStatement = exports.ContinueStatement = buildLabelStatement("continue");
  3979. var ReturnStatement = exports.ReturnStatement = buildLabelStatement("return", "argument");
  3980. var BreakStatement = exports.BreakStatement = buildLabelStatement("break");
  3981. var ThrowStatement = exports.ThrowStatement = buildLabelStatement("throw", "argument");
  3982. function LabeledStatement(node) {
  3983. this.print(node.label, node);
  3984. this.token(":");
  3985. this.space();
  3986. this.print(node.body, node);
  3987. }
  3988. function TryStatement(node) {
  3989. this.word("try");
  3990. this.space();
  3991. this.print(node.block, node);
  3992. this.space();
  3993. if (node.handlers) {
  3994. this.print(node.handlers[0], node);
  3995. } else {
  3996. this.print(node.handler, node);
  3997. }
  3998. if (node.finalizer) {
  3999. this.space();
  4000. this.word("finally");
  4001. this.space();
  4002. this.print(node.finalizer, node);
  4003. }
  4004. }
  4005. function CatchClause(node) {
  4006. this.word("catch");
  4007. this.space();
  4008. this.token("(");
  4009. this.print(node.param, node);
  4010. this.token(")");
  4011. this.space();
  4012. this.print(node.body, node);
  4013. }
  4014. function SwitchStatement(node) {
  4015. this.word("switch");
  4016. this.space();
  4017. this.token("(");
  4018. this.print(node.discriminant, node);
  4019. this.token(")");
  4020. this.space();
  4021. this.token("{");
  4022. this.printSequence(node.cases, node, {
  4023. indent: true,
  4024. addNewlines: function addNewlines(leading, cas) {
  4025. if (!leading && node.cases[node.cases.length - 1] === cas) return -1;
  4026. }
  4027. });
  4028. this.token("}");
  4029. }
  4030. function SwitchCase(node) {
  4031. if (node.test) {
  4032. this.word("case");
  4033. this.space();
  4034. this.print(node.test, node);
  4035. this.token(":");
  4036. } else {
  4037. this.word("default");
  4038. this.token(":");
  4039. }
  4040. if (node.consequent.length) {
  4041. this.newline();
  4042. this.printSequence(node.consequent, node, { indent: true });
  4043. }
  4044. }
  4045. function DebuggerStatement() {
  4046. this.word("debugger");
  4047. this.semicolon();
  4048. }
  4049. function variableDeclarationIdent() {
  4050. this.token(",");
  4051. this.newline();
  4052. if (this.endsWith("\n")) for (var i = 0; i < 4; i++) {
  4053. this.space(true);
  4054. }
  4055. }
  4056. function constDeclarationIdent() {
  4057. this.token(",");
  4058. this.newline();
  4059. if (this.endsWith("\n")) for (var i = 0; i < 6; i++) {
  4060. this.space(true);
  4061. }
  4062. }
  4063. function VariableDeclaration(node, parent) {
  4064. this.word(node.kind);
  4065. this.space();
  4066. var hasInits = false;
  4067. if (!t.isFor(parent)) {
  4068. for (var _iterator = node.declarations, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  4069. var _ref;
  4070. if (_isArray) {
  4071. if (_i >= _iterator.length) break;
  4072. _ref = _iterator[_i++];
  4073. } else {
  4074. _i = _iterator.next();
  4075. if (_i.done) break;
  4076. _ref = _i.value;
  4077. }
  4078. var declar = _ref;
  4079. if (declar.init) {
  4080. hasInits = true;
  4081. }
  4082. }
  4083. }
  4084. var separator = void 0;
  4085. if (hasInits) {
  4086. separator = node.kind === "const" ? constDeclarationIdent : variableDeclarationIdent;
  4087. }
  4088. this.printList(node.declarations, node, { separator: separator });
  4089. if (t.isFor(parent)) {
  4090. if (parent.left === node || parent.init === node) return;
  4091. }
  4092. this.semicolon();
  4093. }
  4094. function VariableDeclarator(node) {
  4095. this.print(node.id, node);
  4096. this.print(node.id.typeAnnotation, node);
  4097. if (node.init) {
  4098. this.space();
  4099. this.token("=");
  4100. this.space();
  4101. this.print(node.init, node);
  4102. }
  4103. }
  4104. },{"babel-runtime/core-js/get-iterator":56,"babel-types":112}],41:[function(require,module,exports){
  4105. "use strict";
  4106. exports.__esModule = true;
  4107. exports.TaggedTemplateExpression = TaggedTemplateExpression;
  4108. exports.TemplateElement = TemplateElement;
  4109. exports.TemplateLiteral = TemplateLiteral;
  4110. function TaggedTemplateExpression(node) {
  4111. this.print(node.tag, node);
  4112. this.print(node.quasi, node);
  4113. }
  4114. function TemplateElement(node, parent) {
  4115. var isFirst = parent.quasis[0] === node;
  4116. var isLast = parent.quasis[parent.quasis.length - 1] === node;
  4117. var value = (isFirst ? "`" : "}") + node.value.raw + (isLast ? "`" : "${");
  4118. this.token(value);
  4119. }
  4120. function TemplateLiteral(node) {
  4121. var quasis = node.quasis;
  4122. for (var i = 0; i < quasis.length; i++) {
  4123. this.print(quasis[i], node);
  4124. if (i + 1 < quasis.length) {
  4125. this.print(node.expressions[i], node);
  4126. }
  4127. }
  4128. }
  4129. },{}],42:[function(require,module,exports){
  4130. "use strict";
  4131. exports.__esModule = true;
  4132. exports.ArrayPattern = exports.ObjectPattern = exports.RestProperty = exports.SpreadProperty = exports.SpreadElement = undefined;
  4133. exports.Identifier = Identifier;
  4134. exports.RestElement = RestElement;
  4135. exports.ObjectExpression = ObjectExpression;
  4136. exports.ObjectMethod = ObjectMethod;
  4137. exports.ObjectProperty = ObjectProperty;
  4138. exports.ArrayExpression = ArrayExpression;
  4139. exports.RegExpLiteral = RegExpLiteral;
  4140. exports.BooleanLiteral = BooleanLiteral;
  4141. exports.NullLiteral = NullLiteral;
  4142. exports.NumericLiteral = NumericLiteral;
  4143. exports.StringLiteral = StringLiteral;
  4144. var _babelTypes = require("babel-types");
  4145. var t = _interopRequireWildcard(_babelTypes);
  4146. var _jsesc = require("jsesc");
  4147. var _jsesc2 = _interopRequireDefault(_jsesc);
  4148. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4149. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  4150. function Identifier(node) {
  4151. if (node.variance) {
  4152. if (node.variance === "plus") {
  4153. this.token("+");
  4154. } else if (node.variance === "minus") {
  4155. this.token("-");
  4156. }
  4157. }
  4158. this.word(node.name);
  4159. }
  4160. function RestElement(node) {
  4161. this.token("...");
  4162. this.print(node.argument, node);
  4163. }
  4164. exports.SpreadElement = RestElement;
  4165. exports.SpreadProperty = RestElement;
  4166. exports.RestProperty = RestElement;
  4167. function ObjectExpression(node) {
  4168. var props = node.properties;
  4169. this.token("{");
  4170. this.printInnerComments(node);
  4171. if (props.length) {
  4172. this.space();
  4173. this.printList(props, node, { indent: true, statement: true });
  4174. this.space();
  4175. }
  4176. this.token("}");
  4177. }
  4178. exports.ObjectPattern = ObjectExpression;
  4179. function ObjectMethod(node) {
  4180. this.printJoin(node.decorators, node);
  4181. this._method(node);
  4182. }
  4183. function ObjectProperty(node) {
  4184. this.printJoin(node.decorators, node);
  4185. if (node.computed) {
  4186. this.token("[");
  4187. this.print(node.key, node);
  4188. this.token("]");
  4189. } else {
  4190. if (t.isAssignmentPattern(node.value) && t.isIdentifier(node.key) && node.key.name === node.value.left.name) {
  4191. this.print(node.value, node);
  4192. return;
  4193. }
  4194. this.print(node.key, node);
  4195. if (node.shorthand && t.isIdentifier(node.key) && t.isIdentifier(node.value) && node.key.name === node.value.name) {
  4196. return;
  4197. }
  4198. }
  4199. this.token(":");
  4200. this.space();
  4201. this.print(node.value, node);
  4202. }
  4203. function ArrayExpression(node) {
  4204. var elems = node.elements;
  4205. var len = elems.length;
  4206. this.token("[");
  4207. this.printInnerComments(node);
  4208. for (var i = 0; i < elems.length; i++) {
  4209. var elem = elems[i];
  4210. if (elem) {
  4211. if (i > 0) this.space();
  4212. this.print(elem, node);
  4213. if (i < len - 1) this.token(",");
  4214. } else {
  4215. this.token(",");
  4216. }
  4217. }
  4218. this.token("]");
  4219. }
  4220. exports.ArrayPattern = ArrayExpression;
  4221. function RegExpLiteral(node) {
  4222. this.word("/" + node.pattern + "/" + node.flags);
  4223. }
  4224. function BooleanLiteral(node) {
  4225. this.word(node.value ? "true" : "false");
  4226. }
  4227. function NullLiteral() {
  4228. this.word("null");
  4229. }
  4230. function NumericLiteral(node) {
  4231. var raw = this.getPossibleRaw(node);
  4232. var value = node.value + "";
  4233. if (raw == null) {
  4234. this.number(value);
  4235. } else if (this.format.minified) {
  4236. this.number(raw.length < value.length ? raw : value);
  4237. } else {
  4238. this.number(raw);
  4239. }
  4240. }
  4241. function StringLiteral(node, parent) {
  4242. var raw = this.getPossibleRaw(node);
  4243. if (!this.format.minified && raw != null) {
  4244. this.token(raw);
  4245. return;
  4246. }
  4247. var opts = {
  4248. quotes: t.isJSX(parent) ? "double" : this.format.quotes,
  4249. wrap: true
  4250. };
  4251. if (this.format.jsonCompatibleStrings) {
  4252. opts.json = true;
  4253. }
  4254. var val = (0, _jsesc2.default)(node.value, opts);
  4255. return this.token(val);
  4256. }
  4257. },{"babel-types":112,"jsesc":249}],43:[function(require,module,exports){
  4258. "use strict";
  4259. exports.__esModule = true;
  4260. exports.CodeGenerator = undefined;
  4261. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  4262. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  4263. var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn");
  4264. var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
  4265. var _inherits2 = require("babel-runtime/helpers/inherits");
  4266. var _inherits3 = _interopRequireDefault(_inherits2);
  4267. exports.default = function (ast, opts, code) {
  4268. var gen = new Generator(ast, opts, code);
  4269. return gen.generate();
  4270. };
  4271. var _detectIndent = require("detect-indent");
  4272. var _detectIndent2 = _interopRequireDefault(_detectIndent);
  4273. var _sourceMap = require("./source-map");
  4274. var _sourceMap2 = _interopRequireDefault(_sourceMap);
  4275. var _babelMessages = require("babel-messages");
  4276. var messages = _interopRequireWildcard(_babelMessages);
  4277. var _printer = require("./printer");
  4278. var _printer2 = _interopRequireDefault(_printer);
  4279. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  4280. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4281. var Generator = function (_Printer) {
  4282. (0, _inherits3.default)(Generator, _Printer);
  4283. function Generator(ast, opts, code) {
  4284. (0, _classCallCheck3.default)(this, Generator);
  4285. opts = opts || {};
  4286. var tokens = ast.tokens || [];
  4287. var format = normalizeOptions(code, opts, tokens);
  4288. var map = opts.sourceMaps ? new _sourceMap2.default(opts, code) : null;
  4289. var _this = (0, _possibleConstructorReturn3.default)(this, _Printer.call(this, format, map, tokens));
  4290. _this.ast = ast;
  4291. return _this;
  4292. }
  4293. Generator.prototype.generate = function generate() {
  4294. return _Printer.prototype.generate.call(this, this.ast);
  4295. };
  4296. return Generator;
  4297. }(_printer2.default);
  4298. function normalizeOptions(code, opts, tokens) {
  4299. var style = " ";
  4300. if (code && typeof code === "string") {
  4301. var indent = (0, _detectIndent2.default)(code).indent;
  4302. if (indent && indent !== " ") style = indent;
  4303. }
  4304. var format = {
  4305. auxiliaryCommentBefore: opts.auxiliaryCommentBefore,
  4306. auxiliaryCommentAfter: opts.auxiliaryCommentAfter,
  4307. shouldPrintComment: opts.shouldPrintComment,
  4308. retainLines: opts.retainLines,
  4309. retainFunctionParens: opts.retainFunctionParens,
  4310. comments: opts.comments == null || opts.comments,
  4311. compact: opts.compact,
  4312. minified: opts.minified,
  4313. concise: opts.concise,
  4314. quotes: opts.quotes || findCommonStringDelimiter(code, tokens),
  4315. jsonCompatibleStrings: opts.jsonCompatibleStrings,
  4316. indent: {
  4317. adjustMultilineComment: true,
  4318. style: style,
  4319. base: 0
  4320. },
  4321. flowCommaSeparator: opts.flowCommaSeparator
  4322. };
  4323. if (format.minified) {
  4324. format.compact = true;
  4325. format.shouldPrintComment = format.shouldPrintComment || function () {
  4326. return format.comments;
  4327. };
  4328. } else {
  4329. format.shouldPrintComment = format.shouldPrintComment || function (value) {
  4330. return format.comments || value.indexOf("@license") >= 0 || value.indexOf("@preserve") >= 0;
  4331. };
  4332. }
  4333. if (format.compact === "auto") {
  4334. format.compact = code.length > 500000;
  4335. if (format.compact) {
  4336. console.error("[BABEL] " + messages.get("codeGeneratorDeopt", opts.filename, "500KB"));
  4337. }
  4338. }
  4339. if (format.compact) {
  4340. format.indent.adjustMultilineComment = false;
  4341. }
  4342. return format;
  4343. }
  4344. function findCommonStringDelimiter(code, tokens) {
  4345. var DEFAULT_STRING_DELIMITER = "double";
  4346. if (!code) {
  4347. return DEFAULT_STRING_DELIMITER;
  4348. }
  4349. var occurences = {
  4350. single: 0,
  4351. double: 0
  4352. };
  4353. var checked = 0;
  4354. for (var i = 0; i < tokens.length; i++) {
  4355. var token = tokens[i];
  4356. if (token.type.label !== "string") continue;
  4357. var raw = code.slice(token.start, token.end);
  4358. if (raw[0] === "'") {
  4359. occurences.single++;
  4360. } else {
  4361. occurences.double++;
  4362. }
  4363. checked++;
  4364. if (checked >= 3) break;
  4365. }
  4366. if (occurences.single > occurences.double) {
  4367. return "single";
  4368. } else {
  4369. return "double";
  4370. }
  4371. }
  4372. var CodeGenerator = exports.CodeGenerator = function () {
  4373. function CodeGenerator(ast, opts, code) {
  4374. (0, _classCallCheck3.default)(this, CodeGenerator);
  4375. this._generator = new Generator(ast, opts, code);
  4376. }
  4377. CodeGenerator.prototype.generate = function generate() {
  4378. return this._generator.generate();
  4379. };
  4380. return CodeGenerator;
  4381. }();
  4382. },{"./printer":47,"./source-map":48,"babel-messages":53,"babel-runtime/helpers/classCallCheck":70,"babel-runtime/helpers/inherits":71,"babel-runtime/helpers/possibleConstructorReturn":73,"detect-indent":235}],44:[function(require,module,exports){
  4383. "use strict";
  4384. exports.__esModule = true;
  4385. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  4386. var _getIterator3 = _interopRequireDefault(_getIterator2);
  4387. var _keys = require("babel-runtime/core-js/object/keys");
  4388. var _keys2 = _interopRequireDefault(_keys);
  4389. exports.needsWhitespace = needsWhitespace;
  4390. exports.needsWhitespaceBefore = needsWhitespaceBefore;
  4391. exports.needsWhitespaceAfter = needsWhitespaceAfter;
  4392. exports.needsParens = needsParens;
  4393. var _whitespace = require("./whitespace");
  4394. var _whitespace2 = _interopRequireDefault(_whitespace);
  4395. var _parentheses = require("./parentheses");
  4396. var parens = _interopRequireWildcard(_parentheses);
  4397. var _babelTypes = require("babel-types");
  4398. var t = _interopRequireWildcard(_babelTypes);
  4399. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  4400. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4401. function expandAliases(obj) {
  4402. var newObj = {};
  4403. function add(type, func) {
  4404. var fn = newObj[type];
  4405. newObj[type] = fn ? function (node, parent, stack) {
  4406. var result = fn(node, parent, stack);
  4407. return result == null ? func(node, parent, stack) : result;
  4408. } : func;
  4409. }
  4410. for (var _iterator = (0, _keys2.default)(obj), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  4411. var _ref;
  4412. if (_isArray) {
  4413. if (_i >= _iterator.length) break;
  4414. _ref = _iterator[_i++];
  4415. } else {
  4416. _i = _iterator.next();
  4417. if (_i.done) break;
  4418. _ref = _i.value;
  4419. }
  4420. var type = _ref;
  4421. var aliases = t.FLIPPED_ALIAS_KEYS[type];
  4422. if (aliases) {
  4423. for (var _iterator2 = aliases, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  4424. var _ref2;
  4425. if (_isArray2) {
  4426. if (_i2 >= _iterator2.length) break;
  4427. _ref2 = _iterator2[_i2++];
  4428. } else {
  4429. _i2 = _iterator2.next();
  4430. if (_i2.done) break;
  4431. _ref2 = _i2.value;
  4432. }
  4433. var alias = _ref2;
  4434. add(alias, obj[type]);
  4435. }
  4436. } else {
  4437. add(type, obj[type]);
  4438. }
  4439. }
  4440. return newObj;
  4441. }
  4442. var expandedParens = expandAliases(parens);
  4443. var expandedWhitespaceNodes = expandAliases(_whitespace2.default.nodes);
  4444. var expandedWhitespaceList = expandAliases(_whitespace2.default.list);
  4445. function find(obj, node, parent, printStack) {
  4446. var fn = obj[node.type];
  4447. return fn ? fn(node, parent, printStack) : null;
  4448. }
  4449. function isOrHasCallExpression(node) {
  4450. if (t.isCallExpression(node)) {
  4451. return true;
  4452. }
  4453. if (t.isMemberExpression(node)) {
  4454. return isOrHasCallExpression(node.object) || !node.computed && isOrHasCallExpression(node.property);
  4455. } else {
  4456. return false;
  4457. }
  4458. }
  4459. function needsWhitespace(node, parent, type) {
  4460. if (!node) return 0;
  4461. if (t.isExpressionStatement(node)) {
  4462. node = node.expression;
  4463. }
  4464. var linesInfo = find(expandedWhitespaceNodes, node, parent);
  4465. if (!linesInfo) {
  4466. var items = find(expandedWhitespaceList, node, parent);
  4467. if (items) {
  4468. for (var i = 0; i < items.length; i++) {
  4469. linesInfo = needsWhitespace(items[i], node, type);
  4470. if (linesInfo) break;
  4471. }
  4472. }
  4473. }
  4474. return linesInfo && linesInfo[type] || 0;
  4475. }
  4476. function needsWhitespaceBefore(node, parent) {
  4477. return needsWhitespace(node, parent, "before");
  4478. }
  4479. function needsWhitespaceAfter(node, parent) {
  4480. return needsWhitespace(node, parent, "after");
  4481. }
  4482. function needsParens(node, parent, printStack) {
  4483. if (!parent) return false;
  4484. if (t.isNewExpression(parent) && parent.callee === node) {
  4485. if (isOrHasCallExpression(node)) return true;
  4486. }
  4487. return find(expandedParens, node, parent, printStack);
  4488. }
  4489. },{"./parentheses":45,"./whitespace":46,"babel-runtime/core-js/get-iterator":56,"babel-runtime/core-js/object/keys":63,"babel-types":112}],45:[function(require,module,exports){
  4490. "use strict";
  4491. exports.__esModule = true;
  4492. exports.AwaitExpression = exports.FunctionTypeAnnotation = undefined;
  4493. exports.NullableTypeAnnotation = NullableTypeAnnotation;
  4494. exports.UpdateExpression = UpdateExpression;
  4495. exports.ObjectExpression = ObjectExpression;
  4496. exports.Binary = Binary;
  4497. exports.BinaryExpression = BinaryExpression;
  4498. exports.SequenceExpression = SequenceExpression;
  4499. exports.YieldExpression = YieldExpression;
  4500. exports.ClassExpression = ClassExpression;
  4501. exports.UnaryLike = UnaryLike;
  4502. exports.FunctionExpression = FunctionExpression;
  4503. exports.ArrowFunctionExpression = ArrowFunctionExpression;
  4504. exports.ConditionalExpression = ConditionalExpression;
  4505. exports.AssignmentExpression = AssignmentExpression;
  4506. var _babelTypes = require("babel-types");
  4507. var t = _interopRequireWildcard(_babelTypes);
  4508. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  4509. var PRECEDENCE = {
  4510. "||": 0,
  4511. "&&": 1,
  4512. "|": 2,
  4513. "^": 3,
  4514. "&": 4,
  4515. "==": 5,
  4516. "===": 5,
  4517. "!=": 5,
  4518. "!==": 5,
  4519. "<": 6,
  4520. ">": 6,
  4521. "<=": 6,
  4522. ">=": 6,
  4523. in: 6,
  4524. instanceof: 6,
  4525. ">>": 7,
  4526. "<<": 7,
  4527. ">>>": 7,
  4528. "+": 8,
  4529. "-": 8,
  4530. "*": 9,
  4531. "/": 9,
  4532. "%": 9,
  4533. "**": 10
  4534. };
  4535. function NullableTypeAnnotation(node, parent) {
  4536. return t.isArrayTypeAnnotation(parent);
  4537. }
  4538. exports.FunctionTypeAnnotation = NullableTypeAnnotation;
  4539. function UpdateExpression(node, parent) {
  4540. if (t.isMemberExpression(parent) && parent.object === node) {
  4541. return true;
  4542. }
  4543. return false;
  4544. }
  4545. function ObjectExpression(node, parent, printStack) {
  4546. return isFirstInStatement(printStack, { considerArrow: true });
  4547. }
  4548. function Binary(node, parent) {
  4549. if ((t.isCallExpression(parent) || t.isNewExpression(parent)) && parent.callee === node) {
  4550. return true;
  4551. }
  4552. if (t.isUnaryLike(parent)) {
  4553. return true;
  4554. }
  4555. if (t.isMemberExpression(parent) && parent.object === node) {
  4556. return true;
  4557. }
  4558. if (t.isBinary(parent)) {
  4559. var parentOp = parent.operator;
  4560. var parentPos = PRECEDENCE[parentOp];
  4561. var nodeOp = node.operator;
  4562. var nodePos = PRECEDENCE[nodeOp];
  4563. if (parentPos > nodePos) {
  4564. return true;
  4565. }
  4566. if (parentPos === nodePos && parent.right === node && !t.isLogicalExpression(parent)) {
  4567. return true;
  4568. }
  4569. }
  4570. return false;
  4571. }
  4572. function BinaryExpression(node, parent) {
  4573. if (node.operator === "in") {
  4574. if (t.isVariableDeclarator(parent)) {
  4575. return true;
  4576. }
  4577. if (t.isFor(parent)) {
  4578. return true;
  4579. }
  4580. }
  4581. return false;
  4582. }
  4583. function SequenceExpression(node, parent) {
  4584. if (t.isForStatement(parent)) {
  4585. return false;
  4586. }
  4587. if (t.isExpressionStatement(parent) && parent.expression === node) {
  4588. return false;
  4589. }
  4590. if (t.isReturnStatement(parent)) {
  4591. return false;
  4592. }
  4593. if (t.isThrowStatement(parent)) {
  4594. return false;
  4595. }
  4596. if (t.isSwitchStatement(parent) && parent.discriminant === node) {
  4597. return false;
  4598. }
  4599. if (t.isWhileStatement(parent) && parent.test === node) {
  4600. return false;
  4601. }
  4602. if (t.isIfStatement(parent) && parent.test === node) {
  4603. return false;
  4604. }
  4605. if (t.isForInStatement(parent) && parent.right === node) {
  4606. return false;
  4607. }
  4608. return true;
  4609. }
  4610. function YieldExpression(node, parent) {
  4611. return t.isBinary(parent) || t.isUnaryLike(parent) || t.isCallExpression(parent) || t.isMemberExpression(parent) || t.isNewExpression(parent) || t.isConditionalExpression(parent) && node === parent.test;
  4612. }
  4613. exports.AwaitExpression = YieldExpression;
  4614. function ClassExpression(node, parent, printStack) {
  4615. return isFirstInStatement(printStack, { considerDefaultExports: true });
  4616. }
  4617. function UnaryLike(node, parent) {
  4618. if (t.isMemberExpression(parent, { object: node })) {
  4619. return true;
  4620. }
  4621. if (t.isCallExpression(parent, { callee: node }) || t.isNewExpression(parent, { callee: node })) {
  4622. return true;
  4623. }
  4624. return false;
  4625. }
  4626. function FunctionExpression(node, parent, printStack) {
  4627. return isFirstInStatement(printStack, { considerDefaultExports: true });
  4628. }
  4629. function ArrowFunctionExpression(node, parent) {
  4630. if (t.isExportDeclaration(parent) || t.isBinaryExpression(parent) || t.isLogicalExpression(parent) || t.isUnaryExpression(parent) || t.isTaggedTemplateExpression(parent)) {
  4631. return true;
  4632. }
  4633. return UnaryLike(node, parent);
  4634. }
  4635. function ConditionalExpression(node, parent) {
  4636. if (t.isUnaryLike(parent)) {
  4637. return true;
  4638. }
  4639. if (t.isBinary(parent)) {
  4640. return true;
  4641. }
  4642. if (t.isConditionalExpression(parent, { test: node })) {
  4643. return true;
  4644. }
  4645. if (t.isAwaitExpression(parent)) {
  4646. return true;
  4647. }
  4648. return UnaryLike(node, parent);
  4649. }
  4650. function AssignmentExpression(node) {
  4651. if (t.isObjectPattern(node.left)) {
  4652. return true;
  4653. } else {
  4654. return ConditionalExpression.apply(undefined, arguments);
  4655. }
  4656. }
  4657. function isFirstInStatement(printStack) {
  4658. var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  4659. _ref$considerArrow = _ref.considerArrow,
  4660. considerArrow = _ref$considerArrow === undefined ? false : _ref$considerArrow,
  4661. _ref$considerDefaultE = _ref.considerDefaultExports,
  4662. considerDefaultExports = _ref$considerDefaultE === undefined ? false : _ref$considerDefaultE;
  4663. var i = printStack.length - 1;
  4664. var node = printStack[i];
  4665. i--;
  4666. var parent = printStack[i];
  4667. while (i > 0) {
  4668. if (t.isExpressionStatement(parent, { expression: node })) {
  4669. return true;
  4670. }
  4671. if (t.isTaggedTemplateExpression(parent)) {
  4672. return true;
  4673. }
  4674. if (considerDefaultExports && t.isExportDefaultDeclaration(parent, { declaration: node })) {
  4675. return true;
  4676. }
  4677. if (considerArrow && t.isArrowFunctionExpression(parent, { body: node })) {
  4678. return true;
  4679. }
  4680. if (t.isCallExpression(parent, { callee: node }) || t.isSequenceExpression(parent) && parent.expressions[0] === node || t.isMemberExpression(parent, { object: node }) || t.isConditional(parent, { test: node }) || t.isBinary(parent, { left: node }) || t.isAssignmentExpression(parent, { left: node })) {
  4681. node = parent;
  4682. i--;
  4683. parent = printStack[i];
  4684. } else {
  4685. return false;
  4686. }
  4687. }
  4688. return false;
  4689. }
  4690. },{"babel-types":112}],46:[function(require,module,exports){
  4691. "use strict";
  4692. var _map = require("lodash/map");
  4693. var _map2 = _interopRequireDefault(_map);
  4694. var _babelTypes = require("babel-types");
  4695. var t = _interopRequireWildcard(_babelTypes);
  4696. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  4697. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4698. function crawl(node) {
  4699. var state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  4700. if (t.isMemberExpression(node)) {
  4701. crawl(node.object, state);
  4702. if (node.computed) crawl(node.property, state);
  4703. } else if (t.isBinary(node) || t.isAssignmentExpression(node)) {
  4704. crawl(node.left, state);
  4705. crawl(node.right, state);
  4706. } else if (t.isCallExpression(node)) {
  4707. state.hasCall = true;
  4708. crawl(node.callee, state);
  4709. } else if (t.isFunction(node)) {
  4710. state.hasFunction = true;
  4711. } else if (t.isIdentifier(node)) {
  4712. state.hasHelper = state.hasHelper || isHelper(node.callee);
  4713. }
  4714. return state;
  4715. }
  4716. function isHelper(node) {
  4717. if (t.isMemberExpression(node)) {
  4718. return isHelper(node.object) || isHelper(node.property);
  4719. } else if (t.isIdentifier(node)) {
  4720. return node.name === "require" || node.name[0] === "_";
  4721. } else if (t.isCallExpression(node)) {
  4722. return isHelper(node.callee);
  4723. } else if (t.isBinary(node) || t.isAssignmentExpression(node)) {
  4724. return t.isIdentifier(node.left) && isHelper(node.left) || isHelper(node.right);
  4725. } else {
  4726. return false;
  4727. }
  4728. }
  4729. function isType(node) {
  4730. return t.isLiteral(node) || t.isObjectExpression(node) || t.isArrayExpression(node) || t.isIdentifier(node) || t.isMemberExpression(node);
  4731. }
  4732. exports.nodes = {
  4733. AssignmentExpression: function AssignmentExpression(node) {
  4734. var state = crawl(node.right);
  4735. if (state.hasCall && state.hasHelper || state.hasFunction) {
  4736. return {
  4737. before: state.hasFunction,
  4738. after: true
  4739. };
  4740. }
  4741. },
  4742. SwitchCase: function SwitchCase(node, parent) {
  4743. return {
  4744. before: node.consequent.length || parent.cases[0] === node
  4745. };
  4746. },
  4747. LogicalExpression: function LogicalExpression(node) {
  4748. if (t.isFunction(node.left) || t.isFunction(node.right)) {
  4749. return {
  4750. after: true
  4751. };
  4752. }
  4753. },
  4754. Literal: function Literal(node) {
  4755. if (node.value === "use strict") {
  4756. return {
  4757. after: true
  4758. };
  4759. }
  4760. },
  4761. CallExpression: function CallExpression(node) {
  4762. if (t.isFunction(node.callee) || isHelper(node)) {
  4763. return {
  4764. before: true,
  4765. after: true
  4766. };
  4767. }
  4768. },
  4769. VariableDeclaration: function VariableDeclaration(node) {
  4770. for (var i = 0; i < node.declarations.length; i++) {
  4771. var declar = node.declarations[i];
  4772. var enabled = isHelper(declar.id) && !isType(declar.init);
  4773. if (!enabled) {
  4774. var state = crawl(declar.init);
  4775. enabled = isHelper(declar.init) && state.hasCall || state.hasFunction;
  4776. }
  4777. if (enabled) {
  4778. return {
  4779. before: true,
  4780. after: true
  4781. };
  4782. }
  4783. }
  4784. },
  4785. IfStatement: function IfStatement(node) {
  4786. if (t.isBlockStatement(node.consequent)) {
  4787. return {
  4788. before: true,
  4789. after: true
  4790. };
  4791. }
  4792. }
  4793. };
  4794. exports.nodes.ObjectProperty = exports.nodes.ObjectTypeProperty = exports.nodes.ObjectMethod = exports.nodes.SpreadProperty = function (node, parent) {
  4795. if (parent.properties[0] === node) {
  4796. return {
  4797. before: true
  4798. };
  4799. }
  4800. };
  4801. exports.list = {
  4802. VariableDeclaration: function VariableDeclaration(node) {
  4803. return (0, _map2.default)(node.declarations, "init");
  4804. },
  4805. ArrayExpression: function ArrayExpression(node) {
  4806. return node.elements;
  4807. },
  4808. ObjectExpression: function ObjectExpression(node) {
  4809. return node.properties;
  4810. }
  4811. };
  4812. [["Function", true], ["Class", true], ["Loop", true], ["LabeledStatement", true], ["SwitchStatement", true], ["TryStatement", true]].forEach(function (_ref) {
  4813. var type = _ref[0],
  4814. amounts = _ref[1];
  4815. if (typeof amounts === "boolean") {
  4816. amounts = { after: amounts, before: amounts };
  4817. }
  4818. [type].concat(t.FLIPPED_ALIAS_KEYS[type] || []).forEach(function (type) {
  4819. exports.nodes[type] = function () {
  4820. return amounts;
  4821. };
  4822. });
  4823. });
  4824. },{"babel-types":112,"lodash/map":449}],47:[function(require,module,exports){
  4825. "use strict";
  4826. exports.__esModule = true;
  4827. var _assign = require("babel-runtime/core-js/object/assign");
  4828. var _assign2 = _interopRequireDefault(_assign);
  4829. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  4830. var _getIterator3 = _interopRequireDefault(_getIterator2);
  4831. var _stringify = require("babel-runtime/core-js/json/stringify");
  4832. var _stringify2 = _interopRequireDefault(_stringify);
  4833. var _weakSet = require("babel-runtime/core-js/weak-set");
  4834. var _weakSet2 = _interopRequireDefault(_weakSet);
  4835. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  4836. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  4837. var _find = require("lodash/find");
  4838. var _find2 = _interopRequireDefault(_find);
  4839. var _findLast = require("lodash/findLast");
  4840. var _findLast2 = _interopRequireDefault(_findLast);
  4841. var _isInteger = require("lodash/isInteger");
  4842. var _isInteger2 = _interopRequireDefault(_isInteger);
  4843. var _repeat = require("lodash/repeat");
  4844. var _repeat2 = _interopRequireDefault(_repeat);
  4845. var _buffer = require("./buffer");
  4846. var _buffer2 = _interopRequireDefault(_buffer);
  4847. var _node = require("./node");
  4848. var n = _interopRequireWildcard(_node);
  4849. var _whitespace = require("./whitespace");
  4850. var _whitespace2 = _interopRequireDefault(_whitespace);
  4851. var _babelTypes = require("babel-types");
  4852. var t = _interopRequireWildcard(_babelTypes);
  4853. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  4854. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4855. var SCIENTIFIC_NOTATION = /e/i;
  4856. var ZERO_DECIMAL_INTEGER = /\.0+$/;
  4857. var NON_DECIMAL_LITERAL = /^0[box]/;
  4858. var Printer = function () {
  4859. function Printer(format, map, tokens) {
  4860. (0, _classCallCheck3.default)(this, Printer);
  4861. this.inForStatementInitCounter = 0;
  4862. this._printStack = [];
  4863. this._indent = 0;
  4864. this._insideAux = false;
  4865. this._printedCommentStarts = {};
  4866. this._parenPushNewlineState = null;
  4867. this._printAuxAfterOnNextUserNode = false;
  4868. this._printedComments = new _weakSet2.default();
  4869. this._endsWithInteger = false;
  4870. this._endsWithWord = false;
  4871. this.format = format || {};
  4872. this._buf = new _buffer2.default(map);
  4873. this._whitespace = tokens.length > 0 ? new _whitespace2.default(tokens) : null;
  4874. }
  4875. Printer.prototype.generate = function generate(ast) {
  4876. this.print(ast);
  4877. this._maybeAddAuxComment();
  4878. return this._buf.get();
  4879. };
  4880. Printer.prototype.indent = function indent() {
  4881. if (this.format.compact || this.format.concise) return;
  4882. this._indent++;
  4883. };
  4884. Printer.prototype.dedent = function dedent() {
  4885. if (this.format.compact || this.format.concise) return;
  4886. this._indent--;
  4887. };
  4888. Printer.prototype.semicolon = function semicolon() {
  4889. var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4890. this._maybeAddAuxComment();
  4891. this._append(";", !force);
  4892. };
  4893. Printer.prototype.rightBrace = function rightBrace() {
  4894. if (this.format.minified) {
  4895. this._buf.removeLastSemicolon();
  4896. }
  4897. this.token("}");
  4898. };
  4899. Printer.prototype.space = function space() {
  4900. var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4901. if (this.format.compact) return;
  4902. if (this._buf.hasContent() && !this.endsWith(" ") && !this.endsWith("\n") || force) {
  4903. this._space();
  4904. }
  4905. };
  4906. Printer.prototype.word = function word(str) {
  4907. if (this._endsWithWord) this._space();
  4908. this._maybeAddAuxComment();
  4909. this._append(str);
  4910. this._endsWithWord = true;
  4911. };
  4912. Printer.prototype.number = function number(str) {
  4913. this.word(str);
  4914. this._endsWithInteger = (0, _isInteger2.default)(+str) && !NON_DECIMAL_LITERAL.test(str) && !SCIENTIFIC_NOTATION.test(str) && !ZERO_DECIMAL_INTEGER.test(str) && str[str.length - 1] !== ".";
  4915. };
  4916. Printer.prototype.token = function token(str) {
  4917. if (str === "--" && this.endsWith("!") || str[0] === "+" && this.endsWith("+") || str[0] === "-" && this.endsWith("-") || str[0] === "." && this._endsWithInteger) {
  4918. this._space();
  4919. }
  4920. this._maybeAddAuxComment();
  4921. this._append(str);
  4922. };
  4923. Printer.prototype.newline = function newline(i) {
  4924. if (this.format.retainLines || this.format.compact) return;
  4925. if (this.format.concise) {
  4926. this.space();
  4927. return;
  4928. }
  4929. if (this.endsWith("\n\n")) return;
  4930. if (typeof i !== "number") i = 1;
  4931. i = Math.min(2, i);
  4932. if (this.endsWith("{\n") || this.endsWith(":\n")) i--;
  4933. if (i <= 0) return;
  4934. for (var j = 0; j < i; j++) {
  4935. this._newline();
  4936. }
  4937. };
  4938. Printer.prototype.endsWith = function endsWith(str) {
  4939. return this._buf.endsWith(str);
  4940. };
  4941. Printer.prototype.removeTrailingNewline = function removeTrailingNewline() {
  4942. this._buf.removeTrailingNewline();
  4943. };
  4944. Printer.prototype.source = function source(prop, loc) {
  4945. this._catchUp(prop, loc);
  4946. this._buf.source(prop, loc);
  4947. };
  4948. Printer.prototype.withSource = function withSource(prop, loc, cb) {
  4949. this._catchUp(prop, loc);
  4950. this._buf.withSource(prop, loc, cb);
  4951. };
  4952. Printer.prototype._space = function _space() {
  4953. this._append(" ", true);
  4954. };
  4955. Printer.prototype._newline = function _newline() {
  4956. this._append("\n", true);
  4957. };
  4958. Printer.prototype._append = function _append(str) {
  4959. var queue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  4960. this._maybeAddParen(str);
  4961. this._maybeIndent(str);
  4962. if (queue) this._buf.queue(str);else this._buf.append(str);
  4963. this._endsWithWord = false;
  4964. this._endsWithInteger = false;
  4965. };
  4966. Printer.prototype._maybeIndent = function _maybeIndent(str) {
  4967. if (this._indent && this.endsWith("\n") && str[0] !== "\n") {
  4968. this._buf.queue(this._getIndent());
  4969. }
  4970. };
  4971. Printer.prototype._maybeAddParen = function _maybeAddParen(str) {
  4972. var parenPushNewlineState = this._parenPushNewlineState;
  4973. if (!parenPushNewlineState) return;
  4974. this._parenPushNewlineState = null;
  4975. var i = void 0;
  4976. for (i = 0; i < str.length && str[i] === " "; i++) {
  4977. continue;
  4978. }if (i === str.length) return;
  4979. var cha = str[i];
  4980. if (cha === "\n" || cha === "/") {
  4981. this.token("(");
  4982. this.indent();
  4983. parenPushNewlineState.printed = true;
  4984. }
  4985. };
  4986. Printer.prototype._catchUp = function _catchUp(prop, loc) {
  4987. if (!this.format.retainLines) return;
  4988. var pos = loc ? loc[prop] : null;
  4989. if (pos && pos.line !== null) {
  4990. var count = pos.line - this._buf.getCurrentLine();
  4991. for (var i = 0; i < count; i++) {
  4992. this._newline();
  4993. }
  4994. }
  4995. };
  4996. Printer.prototype._getIndent = function _getIndent() {
  4997. return (0, _repeat2.default)(this.format.indent.style, this._indent);
  4998. };
  4999. Printer.prototype.startTerminatorless = function startTerminatorless() {
  5000. return this._parenPushNewlineState = {
  5001. printed: false
  5002. };
  5003. };
  5004. Printer.prototype.endTerminatorless = function endTerminatorless(state) {
  5005. if (state.printed) {
  5006. this.dedent();
  5007. this.newline();
  5008. this.token(")");
  5009. }
  5010. };
  5011. Printer.prototype.print = function print(node, parent) {
  5012. var _this = this;
  5013. if (!node) return;
  5014. var oldConcise = this.format.concise;
  5015. if (node._compact) {
  5016. this.format.concise = true;
  5017. }
  5018. var printMethod = this[node.type];
  5019. if (!printMethod) {
  5020. throw new ReferenceError("unknown node of type " + (0, _stringify2.default)(node.type) + " with constructor " + (0, _stringify2.default)(node && node.constructor.name));
  5021. }
  5022. this._printStack.push(node);
  5023. var oldInAux = this._insideAux;
  5024. this._insideAux = !node.loc;
  5025. this._maybeAddAuxComment(this._insideAux && !oldInAux);
  5026. var needsParens = n.needsParens(node, parent, this._printStack);
  5027. if (this.format.retainFunctionParens && node.type === "FunctionExpression" && node.extra && node.extra.parenthesized) {
  5028. needsParens = true;
  5029. }
  5030. if (needsParens) this.token("(");
  5031. this._printLeadingComments(node, parent);
  5032. var loc = t.isProgram(node) || t.isFile(node) ? null : node.loc;
  5033. this.withSource("start", loc, function () {
  5034. _this[node.type](node, parent);
  5035. });
  5036. this._printTrailingComments(node, parent);
  5037. if (needsParens) this.token(")");
  5038. this._printStack.pop();
  5039. this.format.concise = oldConcise;
  5040. this._insideAux = oldInAux;
  5041. };
  5042. Printer.prototype._maybeAddAuxComment = function _maybeAddAuxComment(enteredPositionlessNode) {
  5043. if (enteredPositionlessNode) this._printAuxBeforeComment();
  5044. if (!this._insideAux) this._printAuxAfterComment();
  5045. };
  5046. Printer.prototype._printAuxBeforeComment = function _printAuxBeforeComment() {
  5047. if (this._printAuxAfterOnNextUserNode) return;
  5048. this._printAuxAfterOnNextUserNode = true;
  5049. var comment = this.format.auxiliaryCommentBefore;
  5050. if (comment) {
  5051. this._printComment({
  5052. type: "CommentBlock",
  5053. value: comment
  5054. });
  5055. }
  5056. };
  5057. Printer.prototype._printAuxAfterComment = function _printAuxAfterComment() {
  5058. if (!this._printAuxAfterOnNextUserNode) return;
  5059. this._printAuxAfterOnNextUserNode = false;
  5060. var comment = this.format.auxiliaryCommentAfter;
  5061. if (comment) {
  5062. this._printComment({
  5063. type: "CommentBlock",
  5064. value: comment
  5065. });
  5066. }
  5067. };
  5068. Printer.prototype.getPossibleRaw = function getPossibleRaw(node) {
  5069. var extra = node.extra;
  5070. if (extra && extra.raw != null && extra.rawValue != null && node.value === extra.rawValue) {
  5071. return extra.raw;
  5072. }
  5073. };
  5074. Printer.prototype.printJoin = function printJoin(nodes, parent) {
  5075. var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  5076. if (!nodes || !nodes.length) return;
  5077. if (opts.indent) this.indent();
  5078. var newlineOpts = {
  5079. addNewlines: opts.addNewlines
  5080. };
  5081. for (var i = 0; i < nodes.length; i++) {
  5082. var node = nodes[i];
  5083. if (!node) continue;
  5084. if (opts.statement) this._printNewline(true, node, parent, newlineOpts);
  5085. this.print(node, parent);
  5086. if (opts.iterator) {
  5087. opts.iterator(node, i);
  5088. }
  5089. if (opts.separator && i < nodes.length - 1) {
  5090. opts.separator.call(this);
  5091. }
  5092. if (opts.statement) this._printNewline(false, node, parent, newlineOpts);
  5093. }
  5094. if (opts.indent) this.dedent();
  5095. };
  5096. Printer.prototype.printAndIndentOnComments = function printAndIndentOnComments(node, parent) {
  5097. var indent = !!node.leadingComments;
  5098. if (indent) this.indent();
  5099. this.print(node, parent);
  5100. if (indent) this.dedent();
  5101. };
  5102. Printer.prototype.printBlock = function printBlock(parent) {
  5103. var node = parent.body;
  5104. if (!t.isEmptyStatement(node)) {
  5105. this.space();
  5106. }
  5107. this.print(node, parent);
  5108. };
  5109. Printer.prototype._printTrailingComments = function _printTrailingComments(node, parent) {
  5110. this._printComments(this._getComments(false, node, parent));
  5111. };
  5112. Printer.prototype._printLeadingComments = function _printLeadingComments(node, parent) {
  5113. this._printComments(this._getComments(true, node, parent));
  5114. };
  5115. Printer.prototype.printInnerComments = function printInnerComments(node) {
  5116. var indent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  5117. if (!node.innerComments) return;
  5118. if (indent) this.indent();
  5119. this._printComments(node.innerComments);
  5120. if (indent) this.dedent();
  5121. };
  5122. Printer.prototype.printSequence = function printSequence(nodes, parent) {
  5123. var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  5124. opts.statement = true;
  5125. return this.printJoin(nodes, parent, opts);
  5126. };
  5127. Printer.prototype.printList = function printList(items, parent) {
  5128. var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  5129. if (opts.separator == null) {
  5130. opts.separator = commaSeparator;
  5131. }
  5132. return this.printJoin(items, parent, opts);
  5133. };
  5134. Printer.prototype._printNewline = function _printNewline(leading, node, parent, opts) {
  5135. var _this2 = this;
  5136. if (this.format.retainLines || this.format.compact) return;
  5137. if (this.format.concise) {
  5138. this.space();
  5139. return;
  5140. }
  5141. var lines = 0;
  5142. if (node.start != null && !node._ignoreUserWhitespace && this._whitespace) {
  5143. if (leading) {
  5144. var _comments = node.leadingComments;
  5145. var _comment = _comments && (0, _find2.default)(_comments, function (comment) {
  5146. return !!comment.loc && _this2.format.shouldPrintComment(comment.value);
  5147. });
  5148. lines = this._whitespace.getNewlinesBefore(_comment || node);
  5149. } else {
  5150. var _comments2 = node.trailingComments;
  5151. var _comment2 = _comments2 && (0, _findLast2.default)(_comments2, function (comment) {
  5152. return !!comment.loc && _this2.format.shouldPrintComment(comment.value);
  5153. });
  5154. lines = this._whitespace.getNewlinesAfter(_comment2 || node);
  5155. }
  5156. } else {
  5157. if (!leading) lines++;
  5158. if (opts.addNewlines) lines += opts.addNewlines(leading, node) || 0;
  5159. var needs = n.needsWhitespaceAfter;
  5160. if (leading) needs = n.needsWhitespaceBefore;
  5161. if (needs(node, parent)) lines++;
  5162. if (!this._buf.hasContent()) lines = 0;
  5163. }
  5164. this.newline(lines);
  5165. };
  5166. Printer.prototype._getComments = function _getComments(leading, node) {
  5167. return node && (leading ? node.leadingComments : node.trailingComments) || [];
  5168. };
  5169. Printer.prototype._printComment = function _printComment(comment) {
  5170. var _this3 = this;
  5171. if (!this.format.shouldPrintComment(comment.value)) return;
  5172. if (comment.ignore) return;
  5173. if (this._printedComments.has(comment)) return;
  5174. this._printedComments.add(comment);
  5175. if (comment.start != null) {
  5176. if (this._printedCommentStarts[comment.start]) return;
  5177. this._printedCommentStarts[comment.start] = true;
  5178. }
  5179. this.newline(this._whitespace ? this._whitespace.getNewlinesBefore(comment) : 0);
  5180. if (!this.endsWith("[") && !this.endsWith("{")) this.space();
  5181. var val = comment.type === "CommentLine" ? "//" + comment.value + "\n" : "/*" + comment.value + "*/";
  5182. if (comment.type === "CommentBlock" && this.format.indent.adjustMultilineComment) {
  5183. var offset = comment.loc && comment.loc.start.column;
  5184. if (offset) {
  5185. var newlineRegex = new RegExp("\\n\\s{1," + offset + "}", "g");
  5186. val = val.replace(newlineRegex, "\n");
  5187. }
  5188. var indentSize = Math.max(this._getIndent().length, this._buf.getCurrentColumn());
  5189. val = val.replace(/\n(?!$)/g, "\n" + (0, _repeat2.default)(" ", indentSize));
  5190. }
  5191. this.withSource("start", comment.loc, function () {
  5192. _this3._append(val);
  5193. });
  5194. this.newline((this._whitespace ? this._whitespace.getNewlinesAfter(comment) : 0) + (comment.type === "CommentLine" ? -1 : 0));
  5195. };
  5196. Printer.prototype._printComments = function _printComments(comments) {
  5197. if (!comments || !comments.length) return;
  5198. for (var _iterator = comments, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  5199. var _ref;
  5200. if (_isArray) {
  5201. if (_i >= _iterator.length) break;
  5202. _ref = _iterator[_i++];
  5203. } else {
  5204. _i = _iterator.next();
  5205. if (_i.done) break;
  5206. _ref = _i.value;
  5207. }
  5208. var _comment3 = _ref;
  5209. this._printComment(_comment3);
  5210. }
  5211. };
  5212. return Printer;
  5213. }();
  5214. exports.default = Printer;
  5215. function commaSeparator() {
  5216. this.token(",");
  5217. this.space();
  5218. }
  5219. var _arr = [require("./generators/template-literals"), require("./generators/expressions"), require("./generators/statements"), require("./generators/classes"), require("./generators/methods"), require("./generators/modules"), require("./generators/types"), require("./generators/flow"), require("./generators/base"), require("./generators/jsx")];
  5220. for (var _i2 = 0; _i2 < _arr.length; _i2++) {
  5221. var generator = _arr[_i2];
  5222. (0, _assign2.default)(Printer.prototype, generator);
  5223. }
  5224. module.exports = exports["default"];
  5225. },{"./buffer":32,"./generators/base":33,"./generators/classes":34,"./generators/expressions":35,"./generators/flow":36,"./generators/jsx":37,"./generators/methods":38,"./generators/modules":39,"./generators/statements":40,"./generators/template-literals":41,"./generators/types":42,"./node":44,"./whitespace":49,"babel-runtime/core-js/get-iterator":56,"babel-runtime/core-js/json/stringify":57,"babel-runtime/core-js/object/assign":60,"babel-runtime/core-js/weak-set":69,"babel-runtime/helpers/classCallCheck":70,"babel-types":112,"lodash/find":423,"lodash/findLast":425,"lodash/isInteger":438,"lodash/repeat":454}],48:[function(require,module,exports){
  5226. "use strict";
  5227. exports.__esModule = true;
  5228. var _keys = require("babel-runtime/core-js/object/keys");
  5229. var _keys2 = _interopRequireDefault(_keys);
  5230. var _typeof2 = require("babel-runtime/helpers/typeof");
  5231. var _typeof3 = _interopRequireDefault(_typeof2);
  5232. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  5233. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  5234. var _sourceMap = require("source-map");
  5235. var _sourceMap2 = _interopRequireDefault(_sourceMap);
  5236. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5237. var SourceMap = function () {
  5238. function SourceMap(opts, code) {
  5239. (0, _classCallCheck3.default)(this, SourceMap);
  5240. this._cachedMap = null;
  5241. this._code = code;
  5242. this._opts = opts;
  5243. this._rawMappings = [];
  5244. }
  5245. SourceMap.prototype.get = function get() {
  5246. var _this = this;
  5247. if (!this._cachedMap) {
  5248. (function () {
  5249. var map = _this._cachedMap = new _sourceMap2.default.SourceMapGenerator({
  5250. file: _this._opts.sourceMapTarget,
  5251. sourceRoot: _this._opts.sourceRoot
  5252. });
  5253. var code = _this._code;
  5254. if (typeof code === "string") {
  5255. map.setSourceContent(_this._opts.sourceFileName, code);
  5256. } else if ((typeof code === "undefined" ? "undefined" : (0, _typeof3.default)(code)) === "object") {
  5257. (0, _keys2.default)(code).forEach(function (sourceFileName) {
  5258. map.setSourceContent(sourceFileName, code[sourceFileName]);
  5259. });
  5260. }
  5261. _this._rawMappings.forEach(map.addMapping, map);
  5262. })();
  5263. }
  5264. return this._cachedMap.toJSON();
  5265. };
  5266. SourceMap.prototype.getRawMappings = function getRawMappings() {
  5267. return this._rawMappings.slice();
  5268. };
  5269. SourceMap.prototype.mark = function mark(generatedLine, generatedColumn, line, column, identifierName, filename) {
  5270. if (this._lastGenLine !== generatedLine && line === null) return;
  5271. if (this._lastGenLine === generatedLine && this._lastSourceLine === line && this._lastSourceColumn === column) {
  5272. return;
  5273. }
  5274. this._cachedMap = null;
  5275. this._lastGenLine = generatedLine;
  5276. this._lastSourceLine = line;
  5277. this._lastSourceColumn = column;
  5278. this._rawMappings.push({
  5279. name: identifierName || undefined,
  5280. generated: {
  5281. line: generatedLine,
  5282. column: generatedColumn
  5283. },
  5284. source: line == null ? undefined : filename || this._opts.sourceFileName,
  5285. original: line == null ? undefined : {
  5286. line: line,
  5287. column: column
  5288. }
  5289. });
  5290. };
  5291. return SourceMap;
  5292. }();
  5293. exports.default = SourceMap;
  5294. module.exports = exports["default"];
  5295. },{"babel-runtime/core-js/object/keys":63,"babel-runtime/helpers/classCallCheck":70,"babel-runtime/helpers/typeof":74,"source-map":484}],49:[function(require,module,exports){
  5296. "use strict";
  5297. exports.__esModule = true;
  5298. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  5299. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  5300. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5301. var Whitespace = function () {
  5302. function Whitespace(tokens) {
  5303. (0, _classCallCheck3.default)(this, Whitespace);
  5304. this.tokens = tokens;
  5305. this.used = {};
  5306. }
  5307. Whitespace.prototype.getNewlinesBefore = function getNewlinesBefore(node) {
  5308. var startToken = void 0;
  5309. var endToken = void 0;
  5310. var tokens = this.tokens;
  5311. var index = this._findToken(function (token) {
  5312. return token.start - node.start;
  5313. }, 0, tokens.length);
  5314. if (index >= 0) {
  5315. while (index && node.start === tokens[index - 1].start) {
  5316. --index;
  5317. }startToken = tokens[index - 1];
  5318. endToken = tokens[index];
  5319. }
  5320. return this._getNewlinesBetween(startToken, endToken);
  5321. };
  5322. Whitespace.prototype.getNewlinesAfter = function getNewlinesAfter(node) {
  5323. var startToken = void 0;
  5324. var endToken = void 0;
  5325. var tokens = this.tokens;
  5326. var index = this._findToken(function (token) {
  5327. return token.end - node.end;
  5328. }, 0, tokens.length);
  5329. if (index >= 0) {
  5330. while (index && node.end === tokens[index - 1].end) {
  5331. --index;
  5332. }startToken = tokens[index];
  5333. endToken = tokens[index + 1];
  5334. if (endToken.type.label === ",") endToken = tokens[index + 2];
  5335. }
  5336. if (endToken && endToken.type.label === "eof") {
  5337. return 1;
  5338. } else {
  5339. return this._getNewlinesBetween(startToken, endToken);
  5340. }
  5341. };
  5342. Whitespace.prototype._getNewlinesBetween = function _getNewlinesBetween(startToken, endToken) {
  5343. if (!endToken || !endToken.loc) return 0;
  5344. var start = startToken ? startToken.loc.end.line : 1;
  5345. var end = endToken.loc.start.line;
  5346. var lines = 0;
  5347. for (var line = start; line < end; line++) {
  5348. if (typeof this.used[line] === "undefined") {
  5349. this.used[line] = true;
  5350. lines++;
  5351. }
  5352. }
  5353. return lines;
  5354. };
  5355. Whitespace.prototype._findToken = function _findToken(test, start, end) {
  5356. if (start >= end) return -1;
  5357. var middle = start + end >>> 1;
  5358. var match = test(this.tokens[middle]);
  5359. if (match < 0) {
  5360. return this._findToken(test, middle + 1, end);
  5361. } else if (match > 0) {
  5362. return this._findToken(test, start, middle);
  5363. } else if (match === 0) {
  5364. return middle;
  5365. }
  5366. return -1;
  5367. };
  5368. return Whitespace;
  5369. }();
  5370. exports.default = Whitespace;
  5371. module.exports = exports["default"];
  5372. },{"babel-runtime/helpers/classCallCheck":70}],50:[function(require,module,exports){
  5373. "use strict";
  5374. exports.__esModule = true;
  5375. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  5376. var _getIterator3 = _interopRequireDefault(_getIterator2);
  5377. exports.default = function (path, emit) {
  5378. var kind = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "var";
  5379. path.traverse(visitor, { kind: kind, emit: emit });
  5380. };
  5381. var _babelTypes = require("babel-types");
  5382. var t = _interopRequireWildcard(_babelTypes);
  5383. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  5384. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5385. var visitor = {
  5386. Scope: function Scope(path, state) {
  5387. if (state.kind === "let") path.skip();
  5388. },
  5389. Function: function Function(path) {
  5390. path.skip();
  5391. },
  5392. VariableDeclaration: function VariableDeclaration(path, state) {
  5393. if (state.kind && path.node.kind !== state.kind) return;
  5394. var nodes = [];
  5395. var declarations = path.get("declarations");
  5396. var firstId = void 0;
  5397. for (var _iterator = declarations, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  5398. var _ref;
  5399. if (_isArray) {
  5400. if (_i >= _iterator.length) break;
  5401. _ref = _iterator[_i++];
  5402. } else {
  5403. _i = _iterator.next();
  5404. if (_i.done) break;
  5405. _ref = _i.value;
  5406. }
  5407. var declar = _ref;
  5408. firstId = declar.node.id;
  5409. if (declar.node.init) {
  5410. nodes.push(t.expressionStatement(t.assignmentExpression("=", declar.node.id, declar.node.init)));
  5411. }
  5412. for (var name in declar.getBindingIdentifiers()) {
  5413. state.emit(t.identifier(name), name);
  5414. }
  5415. }
  5416. if (path.parentPath.isFor({ left: path.node })) {
  5417. path.replaceWith(firstId);
  5418. } else {
  5419. path.replaceWithMultiple(nodes);
  5420. }
  5421. }
  5422. };
  5423. module.exports = exports["default"];
  5424. },{"babel-runtime/core-js/get-iterator":56,"babel-types":112}],51:[function(require,module,exports){
  5425. "use strict";
  5426. exports.__esModule = true;
  5427. var _babelTemplate = require("babel-template");
  5428. var _babelTemplate2 = _interopRequireDefault(_babelTemplate);
  5429. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5430. var helpers = {};
  5431. exports.default = helpers;
  5432. helpers.typeof = (0, _babelTemplate2.default)("\n (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\")\n ? function (obj) { return typeof obj; }\n : function (obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype\n ? \"symbol\"\n : typeof obj;\n };\n");
  5433. helpers.jsx = (0, _babelTemplate2.default)("\n (function () {\n var REACT_ELEMENT_TYPE = (typeof Symbol === \"function\" && Symbol.for && Symbol.for(\"react.element\")) || 0xeac7;\n\n return function createRawReactElement (type, props, key, children) {\n var defaultProps = type && type.defaultProps;\n var childrenLength = arguments.length - 3;\n\n if (!props && childrenLength !== 0) {\n // If we're going to assign props.children, we create a new object now\n // to avoid mutating defaultProps.\n props = {};\n }\n if (props && defaultProps) {\n for (var propName in defaultProps) {\n if (props[propName] === void 0) {\n props[propName] = defaultProps[propName];\n }\n }\n } else if (!props) {\n props = defaultProps || {};\n }\n\n if (childrenLength === 1) {\n props.children = children;\n } else if (childrenLength > 1) {\n var childArray = Array(childrenLength);\n for (var i = 0; i < childrenLength; i++) {\n childArray[i] = arguments[i + 3];\n }\n props.children = childArray;\n }\n\n return {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key === undefined ? null : '' + key,\n ref: null,\n props: props,\n _owner: null,\n };\n };\n\n })()\n");
  5434. helpers.asyncIterator = (0, _babelTemplate2.default)("\n (function (iterable) {\n if (typeof Symbol === \"function\") {\n if (Symbol.asyncIterator) {\n var method = iterable[Symbol.asyncIterator];\n if (method != null) return method.call(iterable);\n }\n if (Symbol.iterator) {\n return iterable[Symbol.iterator]();\n }\n }\n throw new TypeError(\"Object is not async iterable\");\n })\n");
  5435. helpers.asyncGenerator = (0, _babelTemplate2.default)("\n (function () {\n function AwaitValue(value) {\n this.value = value;\n }\n\n function AsyncGenerator(gen) {\n var front, back;\n\n function send(key, arg) {\n return new Promise(function (resolve, reject) {\n var request = {\n key: key,\n arg: arg,\n resolve: resolve,\n reject: reject,\n next: null\n };\n\n if (back) {\n back = back.next = request;\n } else {\n front = back = request;\n resume(key, arg);\n }\n });\n }\n\n function resume(key, arg) {\n try {\n var result = gen[key](arg)\n var value = result.value;\n if (value instanceof AwaitValue) {\n Promise.resolve(value.value).then(\n function (arg) { resume(\"next\", arg); },\n function (arg) { resume(\"throw\", arg); });\n } else {\n settle(result.done ? \"return\" : \"normal\", result.value);\n }\n } catch (err) {\n settle(\"throw\", err);\n }\n }\n\n function settle(type, value) {\n switch (type) {\n case \"return\":\n front.resolve({ value: value, done: true });\n break;\n case \"throw\":\n front.reject(value);\n break;\n default:\n front.resolve({ value: value, done: false });\n break;\n }\n\n front = front.next;\n if (front) {\n resume(front.key, front.arg);\n } else {\n back = null;\n }\n }\n\n this._invoke = send;\n\n // Hide \"return\" method if generator return is not supported\n if (typeof gen.return !== \"function\") {\n this.return = undefined;\n }\n }\n\n if (typeof Symbol === \"function\" && Symbol.asyncIterator) {\n AsyncGenerator.prototype[Symbol.asyncIterator] = function () { return this; };\n }\n\n AsyncGenerator.prototype.next = function (arg) { return this._invoke(\"next\", arg); };\n AsyncGenerator.prototype.throw = function (arg) { return this._invoke(\"throw\", arg); };\n AsyncGenerator.prototype.return = function (arg) { return this._invoke(\"return\", arg); };\n\n return {\n wrap: function (fn) {\n return function () {\n return new AsyncGenerator(fn.apply(this, arguments));\n };\n },\n await: function (value) {\n return new AwaitValue(value);\n }\n };\n\n })()\n");
  5436. helpers.asyncGeneratorDelegate = (0, _babelTemplate2.default)("\n (function (inner, awaitWrap) {\n var iter = {}, waiting = false;\n\n function pump(key, value) {\n waiting = true;\n value = new Promise(function (resolve) { resolve(inner[key](value)); });\n return { done: false, value: awaitWrap(value) };\n };\n\n if (typeof Symbol === \"function\" && Symbol.iterator) {\n iter[Symbol.iterator] = function () { return this; };\n }\n\n iter.next = function (value) {\n if (waiting) {\n waiting = false;\n return value;\n }\n return pump(\"next\", value);\n };\n\n if (typeof inner.throw === \"function\") {\n iter.throw = function (value) {\n if (waiting) {\n waiting = false;\n throw value;\n }\n return pump(\"throw\", value);\n };\n }\n\n if (typeof inner.return === \"function\") {\n iter.return = function (value) {\n return pump(\"return\", value);\n };\n }\n\n return iter;\n })\n");
  5437. helpers.asyncToGenerator = (0, _babelTemplate2.default)("\n (function (fn) {\n return function () {\n var gen = fn.apply(this, arguments);\n return new Promise(function (resolve, reject) {\n function step(key, arg) {\n try {\n var info = gen[key](arg);\n var value = info.value;\n } catch (error) {\n reject(error);\n return;\n }\n\n if (info.done) {\n resolve(value);\n } else {\n return Promise.resolve(value).then(function (value) {\n step(\"next\", value);\n }, function (err) {\n step(\"throw\", err);\n });\n }\n }\n\n return step(\"next\");\n });\n };\n })\n");
  5438. helpers.classCallCheck = (0, _babelTemplate2.default)("\n (function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n });\n");
  5439. helpers.createClass = (0, _babelTemplate2.default)("\n (function() {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i ++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n })()\n");
  5440. helpers.defineEnumerableProperties = (0, _babelTemplate2.default)("\n (function (obj, descs) {\n for (var key in descs) {\n var desc = descs[key];\n desc.configurable = desc.enumerable = true;\n if (\"value\" in desc) desc.writable = true;\n Object.defineProperty(obj, key, desc);\n }\n return obj;\n })\n");
  5441. helpers.defaults = (0, _babelTemplate2.default)("\n (function (obj, defaults) {\n var keys = Object.getOwnPropertyNames(defaults);\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n var value = Object.getOwnPropertyDescriptor(defaults, key);\n if (value && value.configurable && obj[key] === undefined) {\n Object.defineProperty(obj, key, value);\n }\n }\n return obj;\n })\n");
  5442. helpers.defineProperty = (0, _babelTemplate2.default)("\n (function (obj, key, value) {\n // Shortcircuit the slow defineProperty path when possible.\n // We are trying to avoid issues where setters defined on the\n // prototype cause side effects under the fast path of simple\n // assignment. By checking for existence of the property with\n // the in operator, we can optimize most of this overhead away.\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n });\n");
  5443. helpers.extends = (0, _babelTemplate2.default)("\n Object.assign || (function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n })\n");
  5444. helpers.get = (0, _babelTemplate2.default)("\n (function get(object, property, receiver) {\n if (object === null) object = Function.prototype;\n\n var desc = Object.getOwnPropertyDescriptor(object, property);\n\n if (desc === undefined) {\n var parent = Object.getPrototypeOf(object);\n\n if (parent === null) {\n return undefined;\n } else {\n return get(parent, property, receiver);\n }\n } else if (\"value\" in desc) {\n return desc.value;\n } else {\n var getter = desc.get;\n\n if (getter === undefined) {\n return undefined;\n }\n\n return getter.call(receiver);\n }\n });\n");
  5445. helpers.inherits = (0, _babelTemplate2.default)("\n (function (subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass);\n }\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;\n })\n");
  5446. helpers.instanceof = (0, _babelTemplate2.default)("\n (function (left, right) {\n if (right != null && typeof Symbol !== \"undefined\" && right[Symbol.hasInstance]) {\n return right[Symbol.hasInstance](left);\n } else {\n return left instanceof right;\n }\n });\n");
  5447. helpers.interopRequireDefault = (0, _babelTemplate2.default)("\n (function (obj) {\n return obj && obj.__esModule ? obj : { default: obj };\n })\n");
  5448. helpers.interopRequireWildcard = (0, _babelTemplate2.default)("\n (function (obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n newObj.default = obj;\n return newObj;\n }\n })\n");
  5449. helpers.newArrowCheck = (0, _babelTemplate2.default)("\n (function (innerThis, boundThis) {\n if (innerThis !== boundThis) {\n throw new TypeError(\"Cannot instantiate an arrow function\");\n }\n });\n");
  5450. helpers.objectDestructuringEmpty = (0, _babelTemplate2.default)("\n (function (obj) {\n if (obj == null) throw new TypeError(\"Cannot destructure undefined\");\n });\n");
  5451. helpers.objectWithoutProperties = (0, _babelTemplate2.default)("\n (function (obj, keys) {\n var target = {};\n for (var i in obj) {\n if (keys.indexOf(i) >= 0) continue;\n if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;\n target[i] = obj[i];\n }\n return target;\n })\n");
  5452. helpers.possibleConstructorReturn = (0, _babelTemplate2.default)("\n (function (self, call) {\n if (!self) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self;\n });\n");
  5453. helpers.selfGlobal = (0, _babelTemplate2.default)("\n typeof global === \"undefined\" ? self : global\n");
  5454. helpers.set = (0, _babelTemplate2.default)("\n (function set(object, property, value, receiver) {\n var desc = Object.getOwnPropertyDescriptor(object, property);\n\n if (desc === undefined) {\n var parent = Object.getPrototypeOf(object);\n\n if (parent !== null) {\n set(parent, property, value, receiver);\n }\n } else if (\"value\" in desc && desc.writable) {\n desc.value = value;\n } else {\n var setter = desc.set;\n\n if (setter !== undefined) {\n setter.call(receiver, value);\n }\n }\n\n return value;\n });\n");
  5455. helpers.slicedToArray = (0, _babelTemplate2.default)("\n (function () {\n // Broken out into a separate function to avoid deoptimizations due to the try/catch for the\n // array iterator case.\n function sliceIterator(arr, i) {\n // this is an expanded form of `for...of` that properly supports abrupt completions of\n // iterators etc. variable names have been minimised to reduce the size of this massive\n // helper. sometimes spec compliancy is annoying :(\n //\n // _n = _iteratorNormalCompletion\n // _d = _didIteratorError\n // _e = _iteratorError\n // _i = _iterator\n // _s = _step\n\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"]) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n return _arr;\n }\n\n return function (arr, i) {\n if (Array.isArray(arr)) {\n return arr;\n } else if (Symbol.iterator in Object(arr)) {\n return sliceIterator(arr, i);\n } else {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n }\n };\n })();\n");
  5456. helpers.slicedToArrayLoose = (0, _babelTemplate2.default)("\n (function (arr, i) {\n if (Array.isArray(arr)) {\n return arr;\n } else if (Symbol.iterator in Object(arr)) {\n var _arr = [];\n for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {\n _arr.push(_step.value);\n if (i && _arr.length === i) break;\n }\n return _arr;\n } else {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n }\n });\n");
  5457. helpers.taggedTemplateLiteral = (0, _babelTemplate2.default)("\n (function (strings, raw) {\n return Object.freeze(Object.defineProperties(strings, {\n raw: { value: Object.freeze(raw) }\n }));\n });\n");
  5458. helpers.taggedTemplateLiteralLoose = (0, _babelTemplate2.default)("\n (function (strings, raw) {\n strings.raw = raw;\n return strings;\n });\n");
  5459. helpers.temporalRef = (0, _babelTemplate2.default)("\n (function (val, name, undef) {\n if (val === undef) {\n throw new ReferenceError(name + \" is not defined - temporal dead zone\");\n } else {\n return val;\n }\n })\n");
  5460. helpers.temporalUndefined = (0, _babelTemplate2.default)("\n ({})\n");
  5461. helpers.toArray = (0, _babelTemplate2.default)("\n (function (arr) {\n return Array.isArray(arr) ? arr : Array.from(arr);\n });\n");
  5462. helpers.toConsumableArray = (0, _babelTemplate2.default)("\n (function (arr) {\n if (Array.isArray(arr)) {\n for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];\n return arr2;\n } else {\n return Array.from(arr);\n }\n });\n");
  5463. module.exports = exports["default"];
  5464. },{"babel-template":75}],52:[function(require,module,exports){
  5465. "use strict";
  5466. exports.__esModule = true;
  5467. exports.list = undefined;
  5468. var _keys = require("babel-runtime/core-js/object/keys");
  5469. var _keys2 = _interopRequireDefault(_keys);
  5470. exports.get = get;
  5471. var _helpers = require("./helpers");
  5472. var _helpers2 = _interopRequireDefault(_helpers);
  5473. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5474. function get(name) {
  5475. var fn = _helpers2.default[name];
  5476. if (!fn) throw new ReferenceError("Unknown helper " + name);
  5477. return fn().expression;
  5478. }
  5479. var list = exports.list = (0, _keys2.default)(_helpers2.default).map(function (name) {
  5480. return name.replace(/^_/, "");
  5481. }).filter(function (name) {
  5482. return name !== "__esModule";
  5483. });
  5484. exports.default = get;
  5485. },{"./helpers":51,"babel-runtime/core-js/object/keys":63}],53:[function(require,module,exports){
  5486. "use strict";
  5487. exports.__esModule = true;
  5488. exports.MESSAGES = undefined;
  5489. var _stringify = require("babel-runtime/core-js/json/stringify");
  5490. var _stringify2 = _interopRequireDefault(_stringify);
  5491. exports.get = get;
  5492. exports.parseArgs = parseArgs;
  5493. var _util = require("util");
  5494. var util = _interopRequireWildcard(_util);
  5495. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  5496. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5497. var MESSAGES = exports.MESSAGES = {
  5498. tailCallReassignmentDeopt: "Function reference has been reassigned, so it will probably be dereferenced, therefore we can't optimise this with confidence",
  5499. classesIllegalBareSuper: "Illegal use of bare super",
  5500. classesIllegalSuperCall: "Direct super call is illegal in non-constructor, use super.$1() instead",
  5501. scopeDuplicateDeclaration: "Duplicate declaration $1",
  5502. settersNoRest: "Setters aren't allowed to have a rest",
  5503. noAssignmentsInForHead: "No assignments allowed in for-in/of head",
  5504. expectedMemberExpressionOrIdentifier: "Expected type MemberExpression or Identifier",
  5505. invalidParentForThisNode: "We don't know how to handle this node within the current parent - please open an issue",
  5506. readOnly: "$1 is read-only",
  5507. unknownForHead: "Unknown node type $1 in ForStatement",
  5508. didYouMean: "Did you mean $1?",
  5509. codeGeneratorDeopt: "Note: The code generator has deoptimised the styling of $1 as it exceeds the max of $2.",
  5510. missingTemplatesDirectory: "no templates directory - this is most likely the result of a broken `npm publish`. Please report to https://github.com/babel/babel/issues",
  5511. unsupportedOutputType: "Unsupported output type $1",
  5512. illegalMethodName: "Illegal method name $1",
  5513. lostTrackNodePath: "We lost track of this node's position, likely because the AST was directly manipulated",
  5514. modulesIllegalExportName: "Illegal export $1",
  5515. modulesDuplicateDeclarations: "Duplicate module declarations with the same source but in different scopes",
  5516. undeclaredVariable: "Reference to undeclared variable $1",
  5517. undeclaredVariableType: "Referencing a type alias outside of a type annotation",
  5518. undeclaredVariableSuggestion: "Reference to undeclared variable $1 - did you mean $2?",
  5519. traverseNeedsParent: "You must pass a scope and parentPath unless traversing a Program/File. Instead of that you tried to traverse a $1 node without passing scope and parentPath.",
  5520. traverseVerifyRootFunction: "You passed `traverse()` a function when it expected a visitor object, are you sure you didn't mean `{ enter: Function }`?",
  5521. traverseVerifyVisitorProperty: "You passed `traverse()` a visitor object with the property $1 that has the invalid property $2",
  5522. traverseVerifyNodeType: "You gave us a visitor for the node type $1 but it's not a valid type",
  5523. pluginNotObject: "Plugin $2 specified in $1 was expected to return an object when invoked but returned $3",
  5524. pluginNotFunction: "Plugin $2 specified in $1 was expected to return a function but returned $3",
  5525. pluginUnknown: "Unknown plugin $1 specified in $2 at $3, attempted to resolve relative to $4",
  5526. pluginInvalidProperty: "Plugin $2 specified in $1 provided an invalid property of $3"
  5527. };
  5528. function get(key) {
  5529. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  5530. args[_key - 1] = arguments[_key];
  5531. }
  5532. var msg = MESSAGES[key];
  5533. if (!msg) throw new ReferenceError("Unknown message " + (0, _stringify2.default)(key));
  5534. args = parseArgs(args);
  5535. return msg.replace(/\$(\d+)/g, function (str, i) {
  5536. return args[i - 1];
  5537. });
  5538. }
  5539. function parseArgs(args) {
  5540. return args.map(function (val) {
  5541. if (val != null && val.inspect) {
  5542. return val.inspect();
  5543. } else {
  5544. try {
  5545. return (0, _stringify2.default)(val) || val + "";
  5546. } catch (e) {
  5547. return util.inspect(val);
  5548. }
  5549. }
  5550. });
  5551. }
  5552. },{"babel-runtime/core-js/json/stringify":57,"util":492}],54:[function(require,module,exports){
  5553. "use strict";
  5554. exports.__esModule = true;
  5555. exports.default = function () {
  5556. return {
  5557. manipulateOptions: function manipulateOptions(opts, parserOpts) {
  5558. parserOpts.plugins.push("dynamicImport");
  5559. }
  5560. };
  5561. };
  5562. module.exports = exports["default"];
  5563. },{}],55:[function(require,module,exports){
  5564. "use strict";
  5565. exports.__esModule = true;
  5566. var _create = require("babel-runtime/core-js/object/create");
  5567. var _create2 = _interopRequireDefault(_create);
  5568. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  5569. var _getIterator3 = _interopRequireDefault(_getIterator2);
  5570. var _symbol = require("babel-runtime/core-js/symbol");
  5571. var _symbol2 = _interopRequireDefault(_symbol);
  5572. exports.default = function (_ref) {
  5573. var t = _ref.types;
  5574. var IGNORE_REASSIGNMENT_SYMBOL = (0, _symbol2.default)();
  5575. var reassignmentVisitor = {
  5576. "AssignmentExpression|UpdateExpression": function AssignmentExpressionUpdateExpression(path) {
  5577. if (path.node[IGNORE_REASSIGNMENT_SYMBOL]) return;
  5578. path.node[IGNORE_REASSIGNMENT_SYMBOL] = true;
  5579. var arg = path.get(path.isAssignmentExpression() ? "left" : "argument");
  5580. if (!arg.isIdentifier()) return;
  5581. var name = arg.node.name;
  5582. if (this.scope.getBinding(name) !== path.scope.getBinding(name)) return;
  5583. var exportedNames = this.exports[name];
  5584. if (!exportedNames) return;
  5585. var node = path.node;
  5586. var isPostUpdateExpression = path.isUpdateExpression() && !node.prefix;
  5587. if (isPostUpdateExpression) {
  5588. if (node.operator === "++") node = t.binaryExpression("+", node.argument, t.numericLiteral(1));else if (node.operator === "--") node = t.binaryExpression("-", node.argument, t.numericLiteral(1));else isPostUpdateExpression = false;
  5589. }
  5590. for (var _iterator = exportedNames, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  5591. var _ref2;
  5592. if (_isArray) {
  5593. if (_i >= _iterator.length) break;
  5594. _ref2 = _iterator[_i++];
  5595. } else {
  5596. _i = _iterator.next();
  5597. if (_i.done) break;
  5598. _ref2 = _i.value;
  5599. }
  5600. var exportedName = _ref2;
  5601. node = this.buildCall(exportedName, node).expression;
  5602. }
  5603. if (isPostUpdateExpression) node = t.sequenceExpression([node, path.node]);
  5604. path.replaceWith(node);
  5605. }
  5606. };
  5607. return {
  5608. visitor: {
  5609. CallExpression: function CallExpression(path, state) {
  5610. if (path.node.callee.type === TYPE_IMPORT) {
  5611. var contextIdent = state.contextIdent;
  5612. path.replaceWith(t.callExpression(t.memberExpression(contextIdent, t.identifier("import")), path.node.arguments));
  5613. }
  5614. },
  5615. ReferencedIdentifier: function ReferencedIdentifier(path, state) {
  5616. if (path.node.name == "__moduleName" && !path.scope.hasBinding("__moduleName")) {
  5617. path.replaceWith(t.memberExpression(state.contextIdent, t.identifier("id")));
  5618. }
  5619. },
  5620. Program: {
  5621. enter: function enter(path, state) {
  5622. state.contextIdent = path.scope.generateUidIdentifier("context");
  5623. },
  5624. exit: function exit(path, state) {
  5625. var exportIdent = path.scope.generateUidIdentifier("export");
  5626. var contextIdent = state.contextIdent;
  5627. var exportNames = (0, _create2.default)(null);
  5628. var modules = [];
  5629. var beforeBody = [];
  5630. var setters = [];
  5631. var sources = [];
  5632. var variableIds = [];
  5633. var removedPaths = [];
  5634. function addExportName(key, val) {
  5635. exportNames[key] = exportNames[key] || [];
  5636. exportNames[key].push(val);
  5637. }
  5638. function pushModule(source, key, specifiers) {
  5639. var module = void 0;
  5640. modules.forEach(function (m) {
  5641. if (m.key === source) {
  5642. module = m;
  5643. }
  5644. });
  5645. if (!module) {
  5646. modules.push(module = { key: source, imports: [], exports: [] });
  5647. }
  5648. module[key] = module[key].concat(specifiers);
  5649. }
  5650. function buildExportCall(name, val) {
  5651. return t.expressionStatement(t.callExpression(exportIdent, [t.stringLiteral(name), val]));
  5652. }
  5653. var body = path.get("body");
  5654. var canHoist = true;
  5655. for (var _iterator2 = body, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  5656. var _ref3;
  5657. if (_isArray2) {
  5658. if (_i2 >= _iterator2.length) break;
  5659. _ref3 = _iterator2[_i2++];
  5660. } else {
  5661. _i2 = _iterator2.next();
  5662. if (_i2.done) break;
  5663. _ref3 = _i2.value;
  5664. }
  5665. var _path = _ref3;
  5666. if (_path.isExportDeclaration()) _path = _path.get("declaration");
  5667. if (_path.isVariableDeclaration() && _path.node.kind !== "var") {
  5668. canHoist = false;
  5669. break;
  5670. }
  5671. }
  5672. for (var _iterator3 = body, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) {
  5673. var _ref4;
  5674. if (_isArray3) {
  5675. if (_i3 >= _iterator3.length) break;
  5676. _ref4 = _iterator3[_i3++];
  5677. } else {
  5678. _i3 = _iterator3.next();
  5679. if (_i3.done) break;
  5680. _ref4 = _i3.value;
  5681. }
  5682. var _path2 = _ref4;
  5683. if (canHoist && _path2.isFunctionDeclaration()) {
  5684. beforeBody.push(_path2.node);
  5685. removedPaths.push(_path2);
  5686. } else if (_path2.isImportDeclaration()) {
  5687. var source = _path2.node.source.value;
  5688. pushModule(source, "imports", _path2.node.specifiers);
  5689. for (var name in _path2.getBindingIdentifiers()) {
  5690. _path2.scope.removeBinding(name);
  5691. variableIds.push(t.identifier(name));
  5692. }
  5693. _path2.remove();
  5694. } else if (_path2.isExportAllDeclaration()) {
  5695. pushModule(_path2.node.source.value, "exports", _path2.node);
  5696. _path2.remove();
  5697. } else if (_path2.isExportDefaultDeclaration()) {
  5698. var declar = _path2.get("declaration");
  5699. if (declar.isClassDeclaration() || declar.isFunctionDeclaration()) {
  5700. var id = declar.node.id;
  5701. var nodes = [];
  5702. if (id) {
  5703. nodes.push(declar.node);
  5704. nodes.push(buildExportCall("default", id));
  5705. addExportName(id.name, "default");
  5706. } else {
  5707. nodes.push(buildExportCall("default", t.toExpression(declar.node)));
  5708. }
  5709. if (!canHoist || declar.isClassDeclaration()) {
  5710. _path2.replaceWithMultiple(nodes);
  5711. } else {
  5712. beforeBody = beforeBody.concat(nodes);
  5713. removedPaths.push(_path2);
  5714. }
  5715. } else {
  5716. _path2.replaceWith(buildExportCall("default", declar.node));
  5717. }
  5718. } else if (_path2.isExportNamedDeclaration()) {
  5719. var _declar = _path2.get("declaration");
  5720. if (_declar.node) {
  5721. _path2.replaceWith(_declar);
  5722. var _nodes = [];
  5723. var bindingIdentifiers = void 0;
  5724. if (_path2.isFunction()) {
  5725. var node = _declar.node;
  5726. var _name = node.id.name;
  5727. if (canHoist) {
  5728. addExportName(_name, _name);
  5729. beforeBody.push(node);
  5730. beforeBody.push(buildExportCall(_name, node.id));
  5731. removedPaths.push(_path2);
  5732. } else {
  5733. var _bindingIdentifiers;
  5734. bindingIdentifiers = (_bindingIdentifiers = {}, _bindingIdentifiers[_name] = node.id, _bindingIdentifiers);
  5735. }
  5736. } else {
  5737. bindingIdentifiers = _declar.getBindingIdentifiers();
  5738. }
  5739. for (var _name2 in bindingIdentifiers) {
  5740. addExportName(_name2, _name2);
  5741. _nodes.push(buildExportCall(_name2, t.identifier(_name2)));
  5742. }
  5743. _path2.insertAfter(_nodes);
  5744. } else {
  5745. var specifiers = _path2.node.specifiers;
  5746. if (specifiers && specifiers.length) {
  5747. if (_path2.node.source) {
  5748. pushModule(_path2.node.source.value, "exports", specifiers);
  5749. _path2.remove();
  5750. } else {
  5751. var _nodes2 = [];
  5752. for (var _iterator7 = specifiers, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : (0, _getIterator3.default)(_iterator7);;) {
  5753. var _ref8;
  5754. if (_isArray7) {
  5755. if (_i7 >= _iterator7.length) break;
  5756. _ref8 = _iterator7[_i7++];
  5757. } else {
  5758. _i7 = _iterator7.next();
  5759. if (_i7.done) break;
  5760. _ref8 = _i7.value;
  5761. }
  5762. var specifier = _ref8;
  5763. _nodes2.push(buildExportCall(specifier.exported.name, specifier.local));
  5764. addExportName(specifier.local.name, specifier.exported.name);
  5765. }
  5766. _path2.replaceWithMultiple(_nodes2);
  5767. }
  5768. }
  5769. }
  5770. }
  5771. }
  5772. modules.forEach(function (specifiers) {
  5773. var setterBody = [];
  5774. var target = path.scope.generateUidIdentifier(specifiers.key);
  5775. for (var _iterator4 = specifiers.imports, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) {
  5776. var _ref5;
  5777. if (_isArray4) {
  5778. if (_i4 >= _iterator4.length) break;
  5779. _ref5 = _iterator4[_i4++];
  5780. } else {
  5781. _i4 = _iterator4.next();
  5782. if (_i4.done) break;
  5783. _ref5 = _i4.value;
  5784. }
  5785. var specifier = _ref5;
  5786. if (t.isImportNamespaceSpecifier(specifier)) {
  5787. setterBody.push(t.expressionStatement(t.assignmentExpression("=", specifier.local, target)));
  5788. } else if (t.isImportDefaultSpecifier(specifier)) {
  5789. specifier = t.importSpecifier(specifier.local, t.identifier("default"));
  5790. }
  5791. if (t.isImportSpecifier(specifier)) {
  5792. setterBody.push(t.expressionStatement(t.assignmentExpression("=", specifier.local, t.memberExpression(target, specifier.imported))));
  5793. }
  5794. }
  5795. if (specifiers.exports.length) {
  5796. var exportObjRef = path.scope.generateUidIdentifier("exportObj");
  5797. setterBody.push(t.variableDeclaration("var", [t.variableDeclarator(exportObjRef, t.objectExpression([]))]));
  5798. for (var _iterator5 = specifiers.exports, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : (0, _getIterator3.default)(_iterator5);;) {
  5799. var _ref6;
  5800. if (_isArray5) {
  5801. if (_i5 >= _iterator5.length) break;
  5802. _ref6 = _iterator5[_i5++];
  5803. } else {
  5804. _i5 = _iterator5.next();
  5805. if (_i5.done) break;
  5806. _ref6 = _i5.value;
  5807. }
  5808. var node = _ref6;
  5809. if (t.isExportAllDeclaration(node)) {
  5810. setterBody.push(buildExportAll({
  5811. KEY: path.scope.generateUidIdentifier("key"),
  5812. EXPORT_OBJ: exportObjRef,
  5813. TARGET: target
  5814. }));
  5815. } else if (t.isExportSpecifier(node)) {
  5816. setterBody.push(t.expressionStatement(t.assignmentExpression("=", t.memberExpression(exportObjRef, node.exported), t.memberExpression(target, node.local))));
  5817. } else {}
  5818. }
  5819. setterBody.push(t.expressionStatement(t.callExpression(exportIdent, [exportObjRef])));
  5820. }
  5821. sources.push(t.stringLiteral(specifiers.key));
  5822. setters.push(t.functionExpression(null, [target], t.blockStatement(setterBody)));
  5823. });
  5824. var moduleName = this.getModuleName();
  5825. if (moduleName) moduleName = t.stringLiteral(moduleName);
  5826. if (canHoist) {
  5827. (0, _babelHelperHoistVariables2.default)(path, function (id) {
  5828. return variableIds.push(id);
  5829. });
  5830. }
  5831. if (variableIds.length) {
  5832. beforeBody.unshift(t.variableDeclaration("var", variableIds.map(function (id) {
  5833. return t.variableDeclarator(id);
  5834. })));
  5835. }
  5836. path.traverse(reassignmentVisitor, {
  5837. exports: exportNames,
  5838. buildCall: buildExportCall,
  5839. scope: path.scope
  5840. });
  5841. for (var _iterator6 = removedPaths, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : (0, _getIterator3.default)(_iterator6);;) {
  5842. var _ref7;
  5843. if (_isArray6) {
  5844. if (_i6 >= _iterator6.length) break;
  5845. _ref7 = _iterator6[_i6++];
  5846. } else {
  5847. _i6 = _iterator6.next();
  5848. if (_i6.done) break;
  5849. _ref7 = _i6.value;
  5850. }
  5851. var _path3 = _ref7;
  5852. _path3.remove();
  5853. }
  5854. path.node.body = [buildTemplate({
  5855. SYSTEM_REGISTER: t.memberExpression(t.identifier(state.opts.systemGlobal || "System"), t.identifier("register")),
  5856. BEFORE_BODY: beforeBody,
  5857. MODULE_NAME: moduleName,
  5858. SETTERS: setters,
  5859. SOURCES: sources,
  5860. BODY: path.node.body,
  5861. EXPORT_IDENTIFIER: exportIdent,
  5862. CONTEXT_IDENTIFIER: contextIdent
  5863. })];
  5864. }
  5865. }
  5866. }
  5867. };
  5868. };
  5869. var _babelHelperHoistVariables = require("babel-helper-hoist-variables");
  5870. var _babelHelperHoistVariables2 = _interopRequireDefault(_babelHelperHoistVariables);
  5871. var _babelTemplate = require("babel-template");
  5872. var _babelTemplate2 = _interopRequireDefault(_babelTemplate);
  5873. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5874. var buildTemplate = (0, _babelTemplate2.default)("\n SYSTEM_REGISTER(MODULE_NAME, [SOURCES], function (EXPORT_IDENTIFIER, CONTEXT_IDENTIFIER) {\n \"use strict\";\n BEFORE_BODY;\n return {\n setters: [SETTERS],\n execute: function () {\n BODY;\n }\n };\n });\n");
  5875. var buildExportAll = (0, _babelTemplate2.default)("\n for (var KEY in TARGET) {\n if (KEY !== \"default\" && KEY !== \"__esModule\") EXPORT_OBJ[KEY] = TARGET[KEY];\n }\n");
  5876. var TYPE_IMPORT = "Import";
  5877. module.exports = exports["default"];
  5878. },{"babel-helper-hoist-variables":50,"babel-runtime/core-js/get-iterator":56,"babel-runtime/core-js/object/create":61,"babel-runtime/core-js/symbol":65,"babel-template":75}],56:[function(require,module,exports){
  5879. module.exports = { "default": require("core-js/library/fn/get-iterator"), __esModule: true };
  5880. },{"core-js/library/fn/get-iterator":125}],57:[function(require,module,exports){
  5881. module.exports = { "default": require("core-js/library/fn/json/stringify"), __esModule: true };
  5882. },{"core-js/library/fn/json/stringify":126}],58:[function(require,module,exports){
  5883. module.exports = { "default": require("core-js/library/fn/map"), __esModule: true };
  5884. },{"core-js/library/fn/map":127}],59:[function(require,module,exports){
  5885. module.exports = { "default": require("core-js/library/fn/number/max-safe-integer"), __esModule: true };
  5886. },{"core-js/library/fn/number/max-safe-integer":128}],60:[function(require,module,exports){
  5887. module.exports = { "default": require("core-js/library/fn/object/assign"), __esModule: true };
  5888. },{"core-js/library/fn/object/assign":129}],61:[function(require,module,exports){
  5889. module.exports = { "default": require("core-js/library/fn/object/create"), __esModule: true };
  5890. },{"core-js/library/fn/object/create":130}],62:[function(require,module,exports){
  5891. module.exports = { "default": require("core-js/library/fn/object/get-own-property-symbols"), __esModule: true };
  5892. },{"core-js/library/fn/object/get-own-property-symbols":131}],63:[function(require,module,exports){
  5893. module.exports = { "default": require("core-js/library/fn/object/keys"), __esModule: true };
  5894. },{"core-js/library/fn/object/keys":132}],64:[function(require,module,exports){
  5895. module.exports = { "default": require("core-js/library/fn/object/set-prototype-of"), __esModule: true };
  5896. },{"core-js/library/fn/object/set-prototype-of":133}],65:[function(require,module,exports){
  5897. module.exports = { "default": require("core-js/library/fn/symbol"), __esModule: true };
  5898. },{"core-js/library/fn/symbol":135}],66:[function(require,module,exports){
  5899. module.exports = { "default": require("core-js/library/fn/symbol/for"), __esModule: true };
  5900. },{"core-js/library/fn/symbol/for":134}],67:[function(require,module,exports){
  5901. module.exports = { "default": require("core-js/library/fn/symbol/iterator"), __esModule: true };
  5902. },{"core-js/library/fn/symbol/iterator":136}],68:[function(require,module,exports){
  5903. module.exports = { "default": require("core-js/library/fn/weak-map"), __esModule: true };
  5904. },{"core-js/library/fn/weak-map":137}],69:[function(require,module,exports){
  5905. module.exports = { "default": require("core-js/library/fn/weak-set"), __esModule: true };
  5906. },{"core-js/library/fn/weak-set":138}],70:[function(require,module,exports){
  5907. "use strict";
  5908. exports.__esModule = true;
  5909. exports.default = function (instance, Constructor) {
  5910. if (!(instance instanceof Constructor)) {
  5911. throw new TypeError("Cannot call a class as a function");
  5912. }
  5913. };
  5914. },{}],71:[function(require,module,exports){
  5915. "use strict";
  5916. exports.__esModule = true;
  5917. var _setPrototypeOf = require("../core-js/object/set-prototype-of");
  5918. var _setPrototypeOf2 = _interopRequireDefault(_setPrototypeOf);
  5919. var _create = require("../core-js/object/create");
  5920. var _create2 = _interopRequireDefault(_create);
  5921. var _typeof2 = require("../helpers/typeof");
  5922. var _typeof3 = _interopRequireDefault(_typeof2);
  5923. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5924. exports.default = function (subClass, superClass) {
  5925. if (typeof superClass !== "function" && superClass !== null) {
  5926. throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : (0, _typeof3.default)(superClass)));
  5927. }
  5928. subClass.prototype = (0, _create2.default)(superClass && superClass.prototype, {
  5929. constructor: {
  5930. value: subClass,
  5931. enumerable: false,
  5932. writable: true,
  5933. configurable: true
  5934. }
  5935. });
  5936. if (superClass) _setPrototypeOf2.default ? (0, _setPrototypeOf2.default)(subClass, superClass) : subClass.__proto__ = superClass;
  5937. };
  5938. },{"../core-js/object/create":61,"../core-js/object/set-prototype-of":64,"../helpers/typeof":74}],72:[function(require,module,exports){
  5939. "use strict";
  5940. exports.__esModule = true;
  5941. exports.default = function (obj, keys) {
  5942. var target = {};
  5943. for (var i in obj) {
  5944. if (keys.indexOf(i) >= 0) continue;
  5945. if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
  5946. target[i] = obj[i];
  5947. }
  5948. return target;
  5949. };
  5950. },{}],73:[function(require,module,exports){
  5951. "use strict";
  5952. exports.__esModule = true;
  5953. var _typeof2 = require("../helpers/typeof");
  5954. var _typeof3 = _interopRequireDefault(_typeof2);
  5955. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5956. exports.default = function (self, call) {
  5957. if (!self) {
  5958. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  5959. }
  5960. return call && ((typeof call === "undefined" ? "undefined" : (0, _typeof3.default)(call)) === "object" || typeof call === "function") ? call : self;
  5961. };
  5962. },{"../helpers/typeof":74}],74:[function(require,module,exports){
  5963. "use strict";
  5964. exports.__esModule = true;
  5965. var _iterator = require("../core-js/symbol/iterator");
  5966. var _iterator2 = _interopRequireDefault(_iterator);
  5967. var _symbol = require("../core-js/symbol");
  5968. var _symbol2 = _interopRequireDefault(_symbol);
  5969. var _typeof = typeof _symbol2.default === "function" && typeof _iterator2.default === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj; };
  5970. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5971. exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) {
  5972. return typeof obj === "undefined" ? "undefined" : _typeof(obj);
  5973. } : function (obj) {
  5974. return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
  5975. };
  5976. },{"../core-js/symbol":65,"../core-js/symbol/iterator":67}],75:[function(require,module,exports){
  5977. "use strict";
  5978. exports.__esModule = true;
  5979. var _symbol = require("babel-runtime/core-js/symbol");
  5980. var _symbol2 = _interopRequireDefault(_symbol);
  5981. exports.default = function (code, opts) {
  5982. var stack = void 0;
  5983. try {
  5984. throw new Error();
  5985. } catch (error) {
  5986. if (error.stack) {
  5987. stack = error.stack.split("\n").slice(1).join("\n");
  5988. }
  5989. }
  5990. opts = (0, _assign2.default)({
  5991. allowReturnOutsideFunction: true,
  5992. allowSuperOutsideMethod: true,
  5993. preserveComments: false
  5994. }, opts);
  5995. var _getAst = function getAst() {
  5996. var ast = void 0;
  5997. try {
  5998. ast = babylon.parse(code, opts);
  5999. ast = _babelTraverse2.default.removeProperties(ast, { preserveComments: opts.preserveComments });
  6000. _babelTraverse2.default.cheap(ast, function (node) {
  6001. node[FROM_TEMPLATE] = true;
  6002. });
  6003. } catch (err) {
  6004. err.stack = err.stack + "from\n" + stack;
  6005. throw err;
  6006. }
  6007. _getAst = function getAst() {
  6008. return ast;
  6009. };
  6010. return ast;
  6011. };
  6012. return function () {
  6013. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  6014. args[_key] = arguments[_key];
  6015. }
  6016. return useTemplate(_getAst(), args);
  6017. };
  6018. };
  6019. var _cloneDeep = require("lodash/cloneDeep");
  6020. var _cloneDeep2 = _interopRequireDefault(_cloneDeep);
  6021. var _assign = require("lodash/assign");
  6022. var _assign2 = _interopRequireDefault(_assign);
  6023. var _has = require("lodash/has");
  6024. var _has2 = _interopRequireDefault(_has);
  6025. var _babelTraverse = require("babel-traverse");
  6026. var _babelTraverse2 = _interopRequireDefault(_babelTraverse);
  6027. var _babylon = require("babylon");
  6028. var babylon = _interopRequireWildcard(_babylon);
  6029. var _babelTypes = require("babel-types");
  6030. var t = _interopRequireWildcard(_babelTypes);
  6031. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  6032. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6033. var FROM_TEMPLATE = "_fromTemplate";
  6034. var TEMPLATE_SKIP = (0, _symbol2.default)();
  6035. function useTemplate(ast, nodes) {
  6036. ast = (0, _cloneDeep2.default)(ast);
  6037. var _ast = ast,
  6038. program = _ast.program;
  6039. if (nodes.length) {
  6040. (0, _babelTraverse2.default)(ast, templateVisitor, null, nodes);
  6041. }
  6042. if (program.body.length > 1) {
  6043. return program.body;
  6044. } else {
  6045. return program.body[0];
  6046. }
  6047. }
  6048. var templateVisitor = {
  6049. noScope: true,
  6050. enter: function enter(path, args) {
  6051. var node = path.node;
  6052. if (node[TEMPLATE_SKIP]) return path.skip();
  6053. if (t.isExpressionStatement(node)) {
  6054. node = node.expression;
  6055. }
  6056. var replacement = void 0;
  6057. if (t.isIdentifier(node) && node[FROM_TEMPLATE]) {
  6058. if ((0, _has2.default)(args[0], node.name)) {
  6059. replacement = args[0][node.name];
  6060. } else if (node.name[0] === "$") {
  6061. var i = +node.name.slice(1);
  6062. if (args[i]) replacement = args[i];
  6063. }
  6064. }
  6065. if (replacement === null) {
  6066. path.remove();
  6067. }
  6068. if (replacement) {
  6069. replacement[TEMPLATE_SKIP] = true;
  6070. path.replaceInline(replacement);
  6071. }
  6072. },
  6073. exit: function exit(_ref) {
  6074. var node = _ref.node;
  6075. if (!node.loc) _babelTraverse2.default.clearNode(node);
  6076. }
  6077. };
  6078. module.exports = exports["default"];
  6079. },{"babel-runtime/core-js/symbol":65,"babel-traverse":79,"babel-types":112,"babylon":116,"lodash/assign":414,"lodash/cloneDeep":417,"lodash/has":428}],76:[function(require,module,exports){
  6080. "use strict";
  6081. exports.__esModule = true;
  6082. exports.scope = exports.path = undefined;
  6083. var _weakMap = require("babel-runtime/core-js/weak-map");
  6084. var _weakMap2 = _interopRequireDefault(_weakMap);
  6085. exports.clear = clear;
  6086. exports.clearPath = clearPath;
  6087. exports.clearScope = clearScope;
  6088. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6089. var path = exports.path = new _weakMap2.default();
  6090. var scope = exports.scope = new _weakMap2.default();
  6091. function clear() {
  6092. clearPath();
  6093. clearScope();
  6094. }
  6095. function clearPath() {
  6096. exports.path = path = new _weakMap2.default();
  6097. }
  6098. function clearScope() {
  6099. exports.scope = scope = new _weakMap2.default();
  6100. }
  6101. },{"babel-runtime/core-js/weak-map":68}],77:[function(require,module,exports){
  6102. (function (process){
  6103. "use strict";
  6104. exports.__esModule = true;
  6105. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  6106. var _getIterator3 = _interopRequireDefault(_getIterator2);
  6107. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  6108. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  6109. var _path2 = require("./path");
  6110. var _path3 = _interopRequireDefault(_path2);
  6111. var _babelTypes = require("babel-types");
  6112. var t = _interopRequireWildcard(_babelTypes);
  6113. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  6114. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6115. var testing = process.env.NODE_ENV === "test";
  6116. var TraversalContext = function () {
  6117. function TraversalContext(scope, opts, state, parentPath) {
  6118. (0, _classCallCheck3.default)(this, TraversalContext);
  6119. this.queue = null;
  6120. this.parentPath = parentPath;
  6121. this.scope = scope;
  6122. this.state = state;
  6123. this.opts = opts;
  6124. }
  6125. TraversalContext.prototype.shouldVisit = function shouldVisit(node) {
  6126. var opts = this.opts;
  6127. if (opts.enter || opts.exit) return true;
  6128. if (opts[node.type]) return true;
  6129. var keys = t.VISITOR_KEYS[node.type];
  6130. if (!keys || !keys.length) return false;
  6131. for (var _iterator = keys, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  6132. var _ref;
  6133. if (_isArray) {
  6134. if (_i >= _iterator.length) break;
  6135. _ref = _iterator[_i++];
  6136. } else {
  6137. _i = _iterator.next();
  6138. if (_i.done) break;
  6139. _ref = _i.value;
  6140. }
  6141. var key = _ref;
  6142. if (node[key]) return true;
  6143. }
  6144. return false;
  6145. };
  6146. TraversalContext.prototype.create = function create(node, obj, key, listKey) {
  6147. return _path3.default.get({
  6148. parentPath: this.parentPath,
  6149. parent: node,
  6150. container: obj,
  6151. key: key,
  6152. listKey: listKey
  6153. });
  6154. };
  6155. TraversalContext.prototype.maybeQueue = function maybeQueue(path, notPriority) {
  6156. if (this.trap) {
  6157. throw new Error("Infinite cycle detected");
  6158. }
  6159. if (this.queue) {
  6160. if (notPriority) {
  6161. this.queue.push(path);
  6162. } else {
  6163. this.priorityQueue.push(path);
  6164. }
  6165. }
  6166. };
  6167. TraversalContext.prototype.visitMultiple = function visitMultiple(container, parent, listKey) {
  6168. if (container.length === 0) return false;
  6169. var queue = [];
  6170. for (var key = 0; key < container.length; key++) {
  6171. var node = container[key];
  6172. if (node && this.shouldVisit(node)) {
  6173. queue.push(this.create(parent, container, key, listKey));
  6174. }
  6175. }
  6176. return this.visitQueue(queue);
  6177. };
  6178. TraversalContext.prototype.visitSingle = function visitSingle(node, key) {
  6179. if (this.shouldVisit(node[key])) {
  6180. return this.visitQueue([this.create(node, node, key)]);
  6181. } else {
  6182. return false;
  6183. }
  6184. };
  6185. TraversalContext.prototype.visitQueue = function visitQueue(queue) {
  6186. this.queue = queue;
  6187. this.priorityQueue = [];
  6188. var visited = [];
  6189. var stop = false;
  6190. for (var _iterator2 = queue, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  6191. var _ref2;
  6192. if (_isArray2) {
  6193. if (_i2 >= _iterator2.length) break;
  6194. _ref2 = _iterator2[_i2++];
  6195. } else {
  6196. _i2 = _iterator2.next();
  6197. if (_i2.done) break;
  6198. _ref2 = _i2.value;
  6199. }
  6200. var path = _ref2;
  6201. path.resync();
  6202. if (path.contexts.length === 0 || path.contexts[path.contexts.length - 1] !== this) {
  6203. path.pushContext(this);
  6204. }
  6205. if (path.key === null) continue;
  6206. if (testing && queue.length >= 10000) {
  6207. this.trap = true;
  6208. }
  6209. if (visited.indexOf(path.node) >= 0) continue;
  6210. visited.push(path.node);
  6211. if (path.visit()) {
  6212. stop = true;
  6213. break;
  6214. }
  6215. if (this.priorityQueue.length) {
  6216. stop = this.visitQueue(this.priorityQueue);
  6217. this.priorityQueue = [];
  6218. this.queue = queue;
  6219. if (stop) break;
  6220. }
  6221. }
  6222. for (var _iterator3 = queue, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) {
  6223. var _ref3;
  6224. if (_isArray3) {
  6225. if (_i3 >= _iterator3.length) break;
  6226. _ref3 = _iterator3[_i3++];
  6227. } else {
  6228. _i3 = _iterator3.next();
  6229. if (_i3.done) break;
  6230. _ref3 = _i3.value;
  6231. }
  6232. var _path = _ref3;
  6233. _path.popContext();
  6234. }
  6235. this.queue = null;
  6236. return stop;
  6237. };
  6238. TraversalContext.prototype.visit = function visit(node, key) {
  6239. var nodes = node[key];
  6240. if (!nodes) return false;
  6241. if (Array.isArray(nodes)) {
  6242. return this.visitMultiple(nodes, node, key);
  6243. } else {
  6244. return this.visitSingle(node, key);
  6245. }
  6246. };
  6247. return TraversalContext;
  6248. }();
  6249. exports.default = TraversalContext;
  6250. module.exports = exports["default"];
  6251. }).call(this,require('_process'))
  6252. },{"./path":86,"_process":471,"babel-runtime/core-js/get-iterator":56,"babel-runtime/helpers/classCallCheck":70,"babel-types":112}],78:[function(require,module,exports){
  6253. "use strict";
  6254. exports.__esModule = true;
  6255. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  6256. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  6257. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6258. var Hub = function Hub(file, options) {
  6259. (0, _classCallCheck3.default)(this, Hub);
  6260. this.file = file;
  6261. this.options = options;
  6262. };
  6263. exports.default = Hub;
  6264. module.exports = exports["default"];
  6265. },{"babel-runtime/helpers/classCallCheck":70}],79:[function(require,module,exports){
  6266. "use strict";
  6267. exports.__esModule = true;
  6268. exports.visitors = exports.Hub = exports.Scope = exports.NodePath = undefined;
  6269. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  6270. var _getIterator3 = _interopRequireDefault(_getIterator2);
  6271. var _path = require("./path");
  6272. Object.defineProperty(exports, "NodePath", {
  6273. enumerable: true,
  6274. get: function get() {
  6275. return _interopRequireDefault(_path).default;
  6276. }
  6277. });
  6278. var _scope = require("./scope");
  6279. Object.defineProperty(exports, "Scope", {
  6280. enumerable: true,
  6281. get: function get() {
  6282. return _interopRequireDefault(_scope).default;
  6283. }
  6284. });
  6285. var _hub = require("./hub");
  6286. Object.defineProperty(exports, "Hub", {
  6287. enumerable: true,
  6288. get: function get() {
  6289. return _interopRequireDefault(_hub).default;
  6290. }
  6291. });
  6292. exports.default = traverse;
  6293. var _context = require("./context");
  6294. var _context2 = _interopRequireDefault(_context);
  6295. var _visitors = require("./visitors");
  6296. var visitors = _interopRequireWildcard(_visitors);
  6297. var _babelMessages = require("babel-messages");
  6298. var messages = _interopRequireWildcard(_babelMessages);
  6299. var _includes = require("lodash/includes");
  6300. var _includes2 = _interopRequireDefault(_includes);
  6301. var _babelTypes = require("babel-types");
  6302. var t = _interopRequireWildcard(_babelTypes);
  6303. var _cache = require("./cache");
  6304. var cache = _interopRequireWildcard(_cache);
  6305. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  6306. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6307. exports.visitors = visitors;
  6308. function traverse(parent, opts, scope, state, parentPath) {
  6309. if (!parent) return;
  6310. if (!opts) opts = {};
  6311. if (!opts.noScope && !scope) {
  6312. if (parent.type !== "Program" && parent.type !== "File") {
  6313. throw new Error(messages.get("traverseNeedsParent", parent.type));
  6314. }
  6315. }
  6316. visitors.explode(opts);
  6317. traverse.node(parent, opts, scope, state, parentPath);
  6318. }
  6319. traverse.visitors = visitors;
  6320. traverse.verify = visitors.verify;
  6321. traverse.explode = visitors.explode;
  6322. traverse.NodePath = require("./path");
  6323. traverse.Scope = require("./scope");
  6324. traverse.Hub = require("./hub");
  6325. traverse.cheap = function (node, enter) {
  6326. return t.traverseFast(node, enter);
  6327. };
  6328. traverse.node = function (node, opts, scope, state, parentPath, skipKeys) {
  6329. var keys = t.VISITOR_KEYS[node.type];
  6330. if (!keys) return;
  6331. var context = new _context2.default(scope, opts, state, parentPath);
  6332. for (var _iterator = keys, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  6333. var _ref;
  6334. if (_isArray) {
  6335. if (_i >= _iterator.length) break;
  6336. _ref = _iterator[_i++];
  6337. } else {
  6338. _i = _iterator.next();
  6339. if (_i.done) break;
  6340. _ref = _i.value;
  6341. }
  6342. var key = _ref;
  6343. if (skipKeys && skipKeys[key]) continue;
  6344. if (context.visit(node, key)) return;
  6345. }
  6346. };
  6347. traverse.clearNode = function (node, opts) {
  6348. t.removeProperties(node, opts);
  6349. cache.path.delete(node);
  6350. };
  6351. traverse.removeProperties = function (tree, opts) {
  6352. t.traverseFast(tree, traverse.clearNode, opts);
  6353. return tree;
  6354. };
  6355. function hasBlacklistedType(path, state) {
  6356. if (path.node.type === state.type) {
  6357. state.has = true;
  6358. path.stop();
  6359. }
  6360. }
  6361. traverse.hasType = function (tree, scope, type, blacklistTypes) {
  6362. if ((0, _includes2.default)(blacklistTypes, tree.type)) return false;
  6363. if (tree.type === type) return true;
  6364. var state = {
  6365. has: false,
  6366. type: type
  6367. };
  6368. traverse(tree, {
  6369. blacklist: blacklistTypes,
  6370. enter: hasBlacklistedType
  6371. }, scope, state);
  6372. return state.has;
  6373. };
  6374. traverse.clearCache = function () {
  6375. cache.clear();
  6376. };
  6377. traverse.clearCache.clearPath = cache.clearPath;
  6378. traverse.clearCache.clearScope = cache.clearScope;
  6379. traverse.copyCache = function (source, destination) {
  6380. if (cache.path.has(source)) {
  6381. cache.path.set(destination, cache.path.get(source));
  6382. }
  6383. };
  6384. },{"./cache":76,"./context":77,"./hub":78,"./path":86,"./scope":98,"./visitors":100,"babel-messages":53,"babel-runtime/core-js/get-iterator":56,"babel-types":112,"lodash/includes":431}],80:[function(require,module,exports){
  6385. "use strict";
  6386. exports.__esModule = true;
  6387. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  6388. var _getIterator3 = _interopRequireDefault(_getIterator2);
  6389. exports.findParent = findParent;
  6390. exports.find = find;
  6391. exports.getFunctionParent = getFunctionParent;
  6392. exports.getStatementParent = getStatementParent;
  6393. exports.getEarliestCommonAncestorFrom = getEarliestCommonAncestorFrom;
  6394. exports.getDeepestCommonAncestorFrom = getDeepestCommonAncestorFrom;
  6395. exports.getAncestry = getAncestry;
  6396. exports.isAncestor = isAncestor;
  6397. exports.isDescendant = isDescendant;
  6398. exports.inType = inType;
  6399. exports.inShadow = inShadow;
  6400. var _babelTypes = require("babel-types");
  6401. var t = _interopRequireWildcard(_babelTypes);
  6402. var _index = require("./index");
  6403. var _index2 = _interopRequireDefault(_index);
  6404. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  6405. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6406. function findParent(callback) {
  6407. var path = this;
  6408. while (path = path.parentPath) {
  6409. if (callback(path)) return path;
  6410. }
  6411. return null;
  6412. }
  6413. function find(callback) {
  6414. var path = this;
  6415. do {
  6416. if (callback(path)) return path;
  6417. } while (path = path.parentPath);
  6418. return null;
  6419. }
  6420. function getFunctionParent() {
  6421. return this.findParent(function (path) {
  6422. return path.isFunction() || path.isProgram();
  6423. });
  6424. }
  6425. function getStatementParent() {
  6426. var path = this;
  6427. do {
  6428. if (Array.isArray(path.container)) {
  6429. return path;
  6430. }
  6431. } while (path = path.parentPath);
  6432. }
  6433. function getEarliestCommonAncestorFrom(paths) {
  6434. return this.getDeepestCommonAncestorFrom(paths, function (deepest, i, ancestries) {
  6435. var earliest = void 0;
  6436. var keys = t.VISITOR_KEYS[deepest.type];
  6437. for (var _iterator = ancestries, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  6438. var _ref;
  6439. if (_isArray) {
  6440. if (_i >= _iterator.length) break;
  6441. _ref = _iterator[_i++];
  6442. } else {
  6443. _i = _iterator.next();
  6444. if (_i.done) break;
  6445. _ref = _i.value;
  6446. }
  6447. var ancestry = _ref;
  6448. var path = ancestry[i + 1];
  6449. if (!earliest) {
  6450. earliest = path;
  6451. continue;
  6452. }
  6453. if (path.listKey && earliest.listKey === path.listKey) {
  6454. if (path.key < earliest.key) {
  6455. earliest = path;
  6456. continue;
  6457. }
  6458. }
  6459. var earliestKeyIndex = keys.indexOf(earliest.parentKey);
  6460. var currentKeyIndex = keys.indexOf(path.parentKey);
  6461. if (earliestKeyIndex > currentKeyIndex) {
  6462. earliest = path;
  6463. }
  6464. }
  6465. return earliest;
  6466. });
  6467. }
  6468. function getDeepestCommonAncestorFrom(paths, filter) {
  6469. var _this = this;
  6470. if (!paths.length) {
  6471. return this;
  6472. }
  6473. if (paths.length === 1) {
  6474. return paths[0];
  6475. }
  6476. var minDepth = Infinity;
  6477. var lastCommonIndex = void 0,
  6478. lastCommon = void 0;
  6479. var ancestries = paths.map(function (path) {
  6480. var ancestry = [];
  6481. do {
  6482. ancestry.unshift(path);
  6483. } while ((path = path.parentPath) && path !== _this);
  6484. if (ancestry.length < minDepth) {
  6485. minDepth = ancestry.length;
  6486. }
  6487. return ancestry;
  6488. });
  6489. var first = ancestries[0];
  6490. depthLoop: for (var i = 0; i < minDepth; i++) {
  6491. var shouldMatch = first[i];
  6492. for (var _iterator2 = ancestries, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  6493. var _ref2;
  6494. if (_isArray2) {
  6495. if (_i2 >= _iterator2.length) break;
  6496. _ref2 = _iterator2[_i2++];
  6497. } else {
  6498. _i2 = _iterator2.next();
  6499. if (_i2.done) break;
  6500. _ref2 = _i2.value;
  6501. }
  6502. var ancestry = _ref2;
  6503. if (ancestry[i] !== shouldMatch) {
  6504. break depthLoop;
  6505. }
  6506. }
  6507. lastCommonIndex = i;
  6508. lastCommon = shouldMatch;
  6509. }
  6510. if (lastCommon) {
  6511. if (filter) {
  6512. return filter(lastCommon, lastCommonIndex, ancestries);
  6513. } else {
  6514. return lastCommon;
  6515. }
  6516. } else {
  6517. throw new Error("Couldn't find intersection");
  6518. }
  6519. }
  6520. function getAncestry() {
  6521. var path = this;
  6522. var paths = [];
  6523. do {
  6524. paths.push(path);
  6525. } while (path = path.parentPath);
  6526. return paths;
  6527. }
  6528. function isAncestor(maybeDescendant) {
  6529. return maybeDescendant.isDescendant(this);
  6530. }
  6531. function isDescendant(maybeAncestor) {
  6532. return !!this.findParent(function (parent) {
  6533. return parent === maybeAncestor;
  6534. });
  6535. }
  6536. function inType() {
  6537. var path = this;
  6538. while (path) {
  6539. for (var _iterator3 = arguments, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) {
  6540. var _ref3;
  6541. if (_isArray3) {
  6542. if (_i3 >= _iterator3.length) break;
  6543. _ref3 = _iterator3[_i3++];
  6544. } else {
  6545. _i3 = _iterator3.next();
  6546. if (_i3.done) break;
  6547. _ref3 = _i3.value;
  6548. }
  6549. var type = _ref3;
  6550. if (path.node.type === type) return true;
  6551. }
  6552. path = path.parentPath;
  6553. }
  6554. return false;
  6555. }
  6556. function inShadow(key) {
  6557. var parentFn = this.isFunction() ? this : this.findParent(function (p) {
  6558. return p.isFunction();
  6559. });
  6560. if (!parentFn) return;
  6561. if (parentFn.isFunctionExpression() || parentFn.isFunctionDeclaration()) {
  6562. var shadow = parentFn.node.shadow;
  6563. if (shadow && (!key || shadow[key] !== false)) {
  6564. return parentFn;
  6565. }
  6566. } else if (parentFn.isArrowFunctionExpression()) {
  6567. return parentFn;
  6568. }
  6569. return null;
  6570. }
  6571. },{"./index":86,"babel-runtime/core-js/get-iterator":56,"babel-types":112}],81:[function(require,module,exports){
  6572. "use strict";
  6573. exports.__esModule = true;
  6574. exports.shareCommentsWithSiblings = shareCommentsWithSiblings;
  6575. exports.addComment = addComment;
  6576. exports.addComments = addComments;
  6577. function shareCommentsWithSiblings() {
  6578. if (typeof this.key === "string") return;
  6579. var node = this.node;
  6580. if (!node) return;
  6581. var trailing = node.trailingComments;
  6582. var leading = node.leadingComments;
  6583. if (!trailing && !leading) return;
  6584. var prev = this.getSibling(this.key - 1);
  6585. var next = this.getSibling(this.key + 1);
  6586. if (!prev.node) prev = next;
  6587. if (!next.node) next = prev;
  6588. prev.addComments("trailing", leading);
  6589. next.addComments("leading", trailing);
  6590. }
  6591. function addComment(type, content, line) {
  6592. this.addComments(type, [{
  6593. type: line ? "CommentLine" : "CommentBlock",
  6594. value: content
  6595. }]);
  6596. }
  6597. function addComments(type, comments) {
  6598. if (!comments) return;
  6599. var node = this.node;
  6600. if (!node) return;
  6601. var key = type + "Comments";
  6602. if (node[key]) {
  6603. node[key] = node[key].concat(comments);
  6604. } else {
  6605. node[key] = comments;
  6606. }
  6607. }
  6608. },{}],82:[function(require,module,exports){
  6609. "use strict";
  6610. exports.__esModule = true;
  6611. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  6612. var _getIterator3 = _interopRequireDefault(_getIterator2);
  6613. exports.call = call;
  6614. exports._call = _call;
  6615. exports.isBlacklisted = isBlacklisted;
  6616. exports.visit = visit;
  6617. exports.skip = skip;
  6618. exports.skipKey = skipKey;
  6619. exports.stop = stop;
  6620. exports.setScope = setScope;
  6621. exports.setContext = setContext;
  6622. exports.resync = resync;
  6623. exports._resyncParent = _resyncParent;
  6624. exports._resyncKey = _resyncKey;
  6625. exports._resyncList = _resyncList;
  6626. exports._resyncRemoved = _resyncRemoved;
  6627. exports.popContext = popContext;
  6628. exports.pushContext = pushContext;
  6629. exports.setup = setup;
  6630. exports.setKey = setKey;
  6631. exports.requeue = requeue;
  6632. exports._getQueueContexts = _getQueueContexts;
  6633. var _index = require("../index");
  6634. var _index2 = _interopRequireDefault(_index);
  6635. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6636. function call(key) {
  6637. var opts = this.opts;
  6638. this.debug(function () {
  6639. return key;
  6640. });
  6641. if (this.node) {
  6642. if (this._call(opts[key])) return true;
  6643. }
  6644. if (this.node) {
  6645. return this._call(opts[this.node.type] && opts[this.node.type][key]);
  6646. }
  6647. return false;
  6648. }
  6649. function _call(fns) {
  6650. if (!fns) return false;
  6651. for (var _iterator = fns, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  6652. var _ref;
  6653. if (_isArray) {
  6654. if (_i >= _iterator.length) break;
  6655. _ref = _iterator[_i++];
  6656. } else {
  6657. _i = _iterator.next();
  6658. if (_i.done) break;
  6659. _ref = _i.value;
  6660. }
  6661. var fn = _ref;
  6662. if (!fn) continue;
  6663. var node = this.node;
  6664. if (!node) return true;
  6665. var ret = fn.call(this.state, this, this.state);
  6666. if (ret) throw new Error("Unexpected return value from visitor method " + fn);
  6667. if (this.node !== node) return true;
  6668. if (this.shouldStop || this.shouldSkip || this.removed) return true;
  6669. }
  6670. return false;
  6671. }
  6672. function isBlacklisted() {
  6673. var blacklist = this.opts.blacklist;
  6674. return blacklist && blacklist.indexOf(this.node.type) > -1;
  6675. }
  6676. function visit() {
  6677. if (!this.node) {
  6678. return false;
  6679. }
  6680. if (this.isBlacklisted()) {
  6681. return false;
  6682. }
  6683. if (this.opts.shouldSkip && this.opts.shouldSkip(this)) {
  6684. return false;
  6685. }
  6686. if (this.call("enter") || this.shouldSkip) {
  6687. this.debug(function () {
  6688. return "Skip...";
  6689. });
  6690. return this.shouldStop;
  6691. }
  6692. this.debug(function () {
  6693. return "Recursing into...";
  6694. });
  6695. _index2.default.node(this.node, this.opts, this.scope, this.state, this, this.skipKeys);
  6696. this.call("exit");
  6697. return this.shouldStop;
  6698. }
  6699. function skip() {
  6700. this.shouldSkip = true;
  6701. }
  6702. function skipKey(key) {
  6703. this.skipKeys[key] = true;
  6704. }
  6705. function stop() {
  6706. this.shouldStop = true;
  6707. this.shouldSkip = true;
  6708. }
  6709. function setScope() {
  6710. if (this.opts && this.opts.noScope) return;
  6711. var target = this.context && this.context.scope;
  6712. if (!target) {
  6713. var path = this.parentPath;
  6714. while (path && !target) {
  6715. if (path.opts && path.opts.noScope) return;
  6716. target = path.scope;
  6717. path = path.parentPath;
  6718. }
  6719. }
  6720. this.scope = this.getScope(target);
  6721. if (this.scope) this.scope.init();
  6722. }
  6723. function setContext(context) {
  6724. this.shouldSkip = false;
  6725. this.shouldStop = false;
  6726. this.removed = false;
  6727. this.skipKeys = {};
  6728. if (context) {
  6729. this.context = context;
  6730. this.state = context.state;
  6731. this.opts = context.opts;
  6732. }
  6733. this.setScope();
  6734. return this;
  6735. }
  6736. function resync() {
  6737. if (this.removed) return;
  6738. this._resyncParent();
  6739. this._resyncList();
  6740. this._resyncKey();
  6741. }
  6742. function _resyncParent() {
  6743. if (this.parentPath) {
  6744. this.parent = this.parentPath.node;
  6745. }
  6746. }
  6747. function _resyncKey() {
  6748. if (!this.container) return;
  6749. if (this.node === this.container[this.key]) return;
  6750. if (Array.isArray(this.container)) {
  6751. for (var i = 0; i < this.container.length; i++) {
  6752. if (this.container[i] === this.node) {
  6753. return this.setKey(i);
  6754. }
  6755. }
  6756. } else {
  6757. for (var key in this.container) {
  6758. if (this.container[key] === this.node) {
  6759. return this.setKey(key);
  6760. }
  6761. }
  6762. }
  6763. this.key = null;
  6764. }
  6765. function _resyncList() {
  6766. if (!this.parent || !this.inList) return;
  6767. var newContainer = this.parent[this.listKey];
  6768. if (this.container === newContainer) return;
  6769. this.container = newContainer || null;
  6770. }
  6771. function _resyncRemoved() {
  6772. if (this.key == null || !this.container || this.container[this.key] !== this.node) {
  6773. this._markRemoved();
  6774. }
  6775. }
  6776. function popContext() {
  6777. this.contexts.pop();
  6778. this.setContext(this.contexts[this.contexts.length - 1]);
  6779. }
  6780. function pushContext(context) {
  6781. this.contexts.push(context);
  6782. this.setContext(context);
  6783. }
  6784. function setup(parentPath, container, listKey, key) {
  6785. this.inList = !!listKey;
  6786. this.listKey = listKey;
  6787. this.parentKey = listKey || key;
  6788. this.container = container;
  6789. this.parentPath = parentPath || this.parentPath;
  6790. this.setKey(key);
  6791. }
  6792. function setKey(key) {
  6793. this.key = key;
  6794. this.node = this.container[this.key];
  6795. this.type = this.node && this.node.type;
  6796. }
  6797. function requeue() {
  6798. var pathToQueue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this;
  6799. if (pathToQueue.removed) return;
  6800. var contexts = this.contexts;
  6801. for (var _iterator2 = contexts, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  6802. var _ref2;
  6803. if (_isArray2) {
  6804. if (_i2 >= _iterator2.length) break;
  6805. _ref2 = _iterator2[_i2++];
  6806. } else {
  6807. _i2 = _iterator2.next();
  6808. if (_i2.done) break;
  6809. _ref2 = _i2.value;
  6810. }
  6811. var context = _ref2;
  6812. context.maybeQueue(pathToQueue);
  6813. }
  6814. }
  6815. function _getQueueContexts() {
  6816. var path = this;
  6817. var contexts = this.contexts;
  6818. while (!contexts.length) {
  6819. path = path.parentPath;
  6820. contexts = path.contexts;
  6821. }
  6822. return contexts;
  6823. }
  6824. },{"../index":79,"babel-runtime/core-js/get-iterator":56}],83:[function(require,module,exports){
  6825. "use strict";
  6826. exports.__esModule = true;
  6827. exports.toComputedKey = toComputedKey;
  6828. exports.ensureBlock = ensureBlock;
  6829. exports.arrowFunctionToShadowed = arrowFunctionToShadowed;
  6830. var _babelTypes = require("babel-types");
  6831. var t = _interopRequireWildcard(_babelTypes);
  6832. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  6833. function toComputedKey() {
  6834. var node = this.node;
  6835. var key = void 0;
  6836. if (this.isMemberExpression()) {
  6837. key = node.property;
  6838. } else if (this.isProperty() || this.isMethod()) {
  6839. key = node.key;
  6840. } else {
  6841. throw new ReferenceError("todo");
  6842. }
  6843. if (!node.computed) {
  6844. if (t.isIdentifier(key)) key = t.stringLiteral(key.name);
  6845. }
  6846. return key;
  6847. }
  6848. function ensureBlock() {
  6849. return t.ensureBlock(this.node);
  6850. }
  6851. function arrowFunctionToShadowed() {
  6852. if (!this.isArrowFunctionExpression()) return;
  6853. this.ensureBlock();
  6854. var node = this.node;
  6855. node.expression = false;
  6856. node.type = "FunctionExpression";
  6857. node.shadow = node.shadow || true;
  6858. }
  6859. },{"babel-types":112}],84:[function(require,module,exports){
  6860. (function (global){
  6861. "use strict";
  6862. exports.__esModule = true;
  6863. var _typeof2 = require("babel-runtime/helpers/typeof");
  6864. var _typeof3 = _interopRequireDefault(_typeof2);
  6865. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  6866. var _getIterator3 = _interopRequireDefault(_getIterator2);
  6867. var _map = require("babel-runtime/core-js/map");
  6868. var _map2 = _interopRequireDefault(_map);
  6869. exports.evaluateTruthy = evaluateTruthy;
  6870. exports.evaluate = evaluate;
  6871. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6872. var VALID_CALLEES = ["String", "Number", "Math"];
  6873. var INVALID_METHODS = ["random"];
  6874. function evaluateTruthy() {
  6875. var res = this.evaluate();
  6876. if (res.confident) return !!res.value;
  6877. }
  6878. function evaluate() {
  6879. var confident = true;
  6880. var deoptPath = void 0;
  6881. var seen = new _map2.default();
  6882. function deopt(path) {
  6883. if (!confident) return;
  6884. deoptPath = path;
  6885. confident = false;
  6886. }
  6887. var value = evaluate(this);
  6888. if (!confident) value = undefined;
  6889. return {
  6890. confident: confident,
  6891. deopt: deoptPath,
  6892. value: value
  6893. };
  6894. function evaluate(path) {
  6895. var node = path.node;
  6896. if (seen.has(node)) {
  6897. var existing = seen.get(node);
  6898. if (existing.resolved) {
  6899. return existing.value;
  6900. } else {
  6901. deopt(path);
  6902. return;
  6903. }
  6904. } else {
  6905. var item = { resolved: false };
  6906. seen.set(node, item);
  6907. var val = _evaluate(path);
  6908. if (confident) {
  6909. item.resolved = true;
  6910. item.value = val;
  6911. }
  6912. return val;
  6913. }
  6914. }
  6915. function _evaluate(path) {
  6916. if (!confident) return;
  6917. var node = path.node;
  6918. if (path.isSequenceExpression()) {
  6919. var exprs = path.get("expressions");
  6920. return evaluate(exprs[exprs.length - 1]);
  6921. }
  6922. if (path.isStringLiteral() || path.isNumericLiteral() || path.isBooleanLiteral()) {
  6923. return node.value;
  6924. }
  6925. if (path.isNullLiteral()) {
  6926. return null;
  6927. }
  6928. if (path.isTemplateLiteral()) {
  6929. var str = "";
  6930. var i = 0;
  6931. var _exprs = path.get("expressions");
  6932. for (var _iterator = node.quasis, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  6933. var _ref;
  6934. if (_isArray) {
  6935. if (_i >= _iterator.length) break;
  6936. _ref = _iterator[_i++];
  6937. } else {
  6938. _i = _iterator.next();
  6939. if (_i.done) break;
  6940. _ref = _i.value;
  6941. }
  6942. var elem = _ref;
  6943. if (!confident) break;
  6944. str += elem.value.cooked;
  6945. var expr = _exprs[i++];
  6946. if (expr) str += String(evaluate(expr));
  6947. }
  6948. if (!confident) return;
  6949. return str;
  6950. }
  6951. if (path.isConditionalExpression()) {
  6952. var testResult = evaluate(path.get("test"));
  6953. if (!confident) return;
  6954. if (testResult) {
  6955. return evaluate(path.get("consequent"));
  6956. } else {
  6957. return evaluate(path.get("alternate"));
  6958. }
  6959. }
  6960. if (path.isExpressionWrapper()) {
  6961. return evaluate(path.get("expression"));
  6962. }
  6963. if (path.isMemberExpression() && !path.parentPath.isCallExpression({ callee: node })) {
  6964. var property = path.get("property");
  6965. var object = path.get("object");
  6966. if (object.isLiteral() && property.isIdentifier()) {
  6967. var _value = object.node.value;
  6968. var type = typeof _value === "undefined" ? "undefined" : (0, _typeof3.default)(_value);
  6969. if (type === "number" || type === "string") {
  6970. return _value[property.node.name];
  6971. }
  6972. }
  6973. }
  6974. if (path.isReferencedIdentifier()) {
  6975. var binding = path.scope.getBinding(node.name);
  6976. if (binding && binding.constantViolations.length > 0) {
  6977. return deopt(binding.path);
  6978. }
  6979. if (binding && path.node.start < binding.path.node.end) {
  6980. return deopt(binding.path);
  6981. }
  6982. if (binding && binding.hasValue) {
  6983. return binding.value;
  6984. } else {
  6985. if (node.name === "undefined") {
  6986. return binding ? deopt(binding.path) : undefined;
  6987. } else if (node.name === "Infinity") {
  6988. return binding ? deopt(binding.path) : Infinity;
  6989. } else if (node.name === "NaN") {
  6990. return binding ? deopt(binding.path) : NaN;
  6991. }
  6992. var resolved = path.resolve();
  6993. if (resolved === path) {
  6994. return deopt(path);
  6995. } else {
  6996. return evaluate(resolved);
  6997. }
  6998. }
  6999. }
  7000. if (path.isUnaryExpression({ prefix: true })) {
  7001. if (node.operator === "void") {
  7002. return undefined;
  7003. }
  7004. var argument = path.get("argument");
  7005. if (node.operator === "typeof" && (argument.isFunction() || argument.isClass())) {
  7006. return "function";
  7007. }
  7008. var arg = evaluate(argument);
  7009. if (!confident) return;
  7010. switch (node.operator) {
  7011. case "!":
  7012. return !arg;
  7013. case "+":
  7014. return +arg;
  7015. case "-":
  7016. return -arg;
  7017. case "~":
  7018. return ~arg;
  7019. case "typeof":
  7020. return typeof arg === "undefined" ? "undefined" : (0, _typeof3.default)(arg);
  7021. }
  7022. }
  7023. if (path.isArrayExpression()) {
  7024. var arr = [];
  7025. var elems = path.get("elements");
  7026. for (var _iterator2 = elems, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  7027. var _ref2;
  7028. if (_isArray2) {
  7029. if (_i2 >= _iterator2.length) break;
  7030. _ref2 = _iterator2[_i2++];
  7031. } else {
  7032. _i2 = _iterator2.next();
  7033. if (_i2.done) break;
  7034. _ref2 = _i2.value;
  7035. }
  7036. var _elem = _ref2;
  7037. _elem = _elem.evaluate();
  7038. if (_elem.confident) {
  7039. arr.push(_elem.value);
  7040. } else {
  7041. return deopt(_elem);
  7042. }
  7043. }
  7044. return arr;
  7045. }
  7046. if (path.isObjectExpression()) {
  7047. var obj = {};
  7048. var props = path.get("properties");
  7049. for (var _iterator3 = props, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) {
  7050. var _ref3;
  7051. if (_isArray3) {
  7052. if (_i3 >= _iterator3.length) break;
  7053. _ref3 = _iterator3[_i3++];
  7054. } else {
  7055. _i3 = _iterator3.next();
  7056. if (_i3.done) break;
  7057. _ref3 = _i3.value;
  7058. }
  7059. var prop = _ref3;
  7060. if (prop.isObjectMethod() || prop.isSpreadProperty()) {
  7061. return deopt(prop);
  7062. }
  7063. var keyPath = prop.get("key");
  7064. var key = keyPath;
  7065. if (prop.node.computed) {
  7066. key = key.evaluate();
  7067. if (!key.confident) {
  7068. return deopt(keyPath);
  7069. }
  7070. key = key.value;
  7071. } else if (key.isIdentifier()) {
  7072. key = key.node.name;
  7073. } else {
  7074. key = key.node.value;
  7075. }
  7076. var valuePath = prop.get("value");
  7077. var _value2 = valuePath.evaluate();
  7078. if (!_value2.confident) {
  7079. return deopt(valuePath);
  7080. }
  7081. _value2 = _value2.value;
  7082. obj[key] = _value2;
  7083. }
  7084. return obj;
  7085. }
  7086. if (path.isLogicalExpression()) {
  7087. var wasConfident = confident;
  7088. var left = evaluate(path.get("left"));
  7089. var leftConfident = confident;
  7090. confident = wasConfident;
  7091. var right = evaluate(path.get("right"));
  7092. var rightConfident = confident;
  7093. confident = leftConfident && rightConfident;
  7094. switch (node.operator) {
  7095. case "||":
  7096. if (left && leftConfident) {
  7097. confident = true;
  7098. return left;
  7099. }
  7100. if (!confident) return;
  7101. return left || right;
  7102. case "&&":
  7103. if (!left && leftConfident || !right && rightConfident) {
  7104. confident = true;
  7105. }
  7106. if (!confident) return;
  7107. return left && right;
  7108. }
  7109. }
  7110. if (path.isBinaryExpression()) {
  7111. var _left = evaluate(path.get("left"));
  7112. if (!confident) return;
  7113. var _right = evaluate(path.get("right"));
  7114. if (!confident) return;
  7115. switch (node.operator) {
  7116. case "-":
  7117. return _left - _right;
  7118. case "+":
  7119. return _left + _right;
  7120. case "/":
  7121. return _left / _right;
  7122. case "*":
  7123. return _left * _right;
  7124. case "%":
  7125. return _left % _right;
  7126. case "**":
  7127. return Math.pow(_left, _right);
  7128. case "<":
  7129. return _left < _right;
  7130. case ">":
  7131. return _left > _right;
  7132. case "<=":
  7133. return _left <= _right;
  7134. case ">=":
  7135. return _left >= _right;
  7136. case "==":
  7137. return _left == _right;
  7138. case "!=":
  7139. return _left != _right;
  7140. case "===":
  7141. return _left === _right;
  7142. case "!==":
  7143. return _left !== _right;
  7144. case "|":
  7145. return _left | _right;
  7146. case "&":
  7147. return _left & _right;
  7148. case "^":
  7149. return _left ^ _right;
  7150. case "<<":
  7151. return _left << _right;
  7152. case ">>":
  7153. return _left >> _right;
  7154. case ">>>":
  7155. return _left >>> _right;
  7156. }
  7157. }
  7158. if (path.isCallExpression()) {
  7159. var callee = path.get("callee");
  7160. var context = void 0;
  7161. var func = void 0;
  7162. if (callee.isIdentifier() && !path.scope.getBinding(callee.node.name, true) && VALID_CALLEES.indexOf(callee.node.name) >= 0) {
  7163. func = global[node.callee.name];
  7164. }
  7165. if (callee.isMemberExpression()) {
  7166. var _object = callee.get("object");
  7167. var _property = callee.get("property");
  7168. if (_object.isIdentifier() && _property.isIdentifier() && VALID_CALLEES.indexOf(_object.node.name) >= 0 && INVALID_METHODS.indexOf(_property.node.name) < 0) {
  7169. context = global[_object.node.name];
  7170. func = context[_property.node.name];
  7171. }
  7172. if (_object.isLiteral() && _property.isIdentifier()) {
  7173. var _type = (0, _typeof3.default)(_object.node.value);
  7174. if (_type === "string" || _type === "number") {
  7175. context = _object.node.value;
  7176. func = context[_property.node.name];
  7177. }
  7178. }
  7179. }
  7180. if (func) {
  7181. var args = path.get("arguments").map(evaluate);
  7182. if (!confident) return;
  7183. return func.apply(context, args);
  7184. }
  7185. }
  7186. deopt(path);
  7187. }
  7188. }
  7189. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  7190. },{"babel-runtime/core-js/get-iterator":56,"babel-runtime/core-js/map":58,"babel-runtime/helpers/typeof":74}],85:[function(require,module,exports){
  7191. "use strict";
  7192. exports.__esModule = true;
  7193. var _create = require("babel-runtime/core-js/object/create");
  7194. var _create2 = _interopRequireDefault(_create);
  7195. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  7196. var _getIterator3 = _interopRequireDefault(_getIterator2);
  7197. exports.getStatementParent = getStatementParent;
  7198. exports.getOpposite = getOpposite;
  7199. exports.getCompletionRecords = getCompletionRecords;
  7200. exports.getSibling = getSibling;
  7201. exports.getPrevSibling = getPrevSibling;
  7202. exports.getNextSibling = getNextSibling;
  7203. exports.getAllNextSiblings = getAllNextSiblings;
  7204. exports.getAllPrevSiblings = getAllPrevSiblings;
  7205. exports.get = get;
  7206. exports._getKey = _getKey;
  7207. exports._getPattern = _getPattern;
  7208. exports.getBindingIdentifiers = getBindingIdentifiers;
  7209. exports.getOuterBindingIdentifiers = getOuterBindingIdentifiers;
  7210. exports.getBindingIdentifierPaths = getBindingIdentifierPaths;
  7211. exports.getOuterBindingIdentifierPaths = getOuterBindingIdentifierPaths;
  7212. var _index = require("./index");
  7213. var _index2 = _interopRequireDefault(_index);
  7214. var _babelTypes = require("babel-types");
  7215. var t = _interopRequireWildcard(_babelTypes);
  7216. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  7217. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7218. function getStatementParent() {
  7219. var path = this;
  7220. do {
  7221. if (!path.parentPath || Array.isArray(path.container) && path.isStatement()) {
  7222. break;
  7223. } else {
  7224. path = path.parentPath;
  7225. }
  7226. } while (path);
  7227. if (path && (path.isProgram() || path.isFile())) {
  7228. throw new Error("File/Program node, we can't possibly find a statement parent to this");
  7229. }
  7230. return path;
  7231. }
  7232. function getOpposite() {
  7233. if (this.key === "left") {
  7234. return this.getSibling("right");
  7235. } else if (this.key === "right") {
  7236. return this.getSibling("left");
  7237. }
  7238. }
  7239. function getCompletionRecords() {
  7240. var paths = [];
  7241. var add = function add(path) {
  7242. if (path) paths = paths.concat(path.getCompletionRecords());
  7243. };
  7244. if (this.isIfStatement()) {
  7245. add(this.get("consequent"));
  7246. add(this.get("alternate"));
  7247. } else if (this.isDoExpression() || this.isFor() || this.isWhile()) {
  7248. add(this.get("body"));
  7249. } else if (this.isProgram() || this.isBlockStatement()) {
  7250. add(this.get("body").pop());
  7251. } else if (this.isFunction()) {
  7252. return this.get("body").getCompletionRecords();
  7253. } else if (this.isTryStatement()) {
  7254. add(this.get("block"));
  7255. add(this.get("handler"));
  7256. add(this.get("finalizer"));
  7257. } else {
  7258. paths.push(this);
  7259. }
  7260. return paths;
  7261. }
  7262. function getSibling(key) {
  7263. return _index2.default.get({
  7264. parentPath: this.parentPath,
  7265. parent: this.parent,
  7266. container: this.container,
  7267. listKey: this.listKey,
  7268. key: key
  7269. });
  7270. }
  7271. function getPrevSibling() {
  7272. return this.getSibling(this.key - 1);
  7273. }
  7274. function getNextSibling() {
  7275. return this.getSibling(this.key + 1);
  7276. }
  7277. function getAllNextSiblings() {
  7278. var _key = this.key;
  7279. var sibling = this.getSibling(++_key);
  7280. var siblings = [];
  7281. while (sibling.node) {
  7282. siblings.push(sibling);
  7283. sibling = this.getSibling(++_key);
  7284. }
  7285. return siblings;
  7286. }
  7287. function getAllPrevSiblings() {
  7288. var _key = this.key;
  7289. var sibling = this.getSibling(--_key);
  7290. var siblings = [];
  7291. while (sibling.node) {
  7292. siblings.push(sibling);
  7293. sibling = this.getSibling(--_key);
  7294. }
  7295. return siblings;
  7296. }
  7297. function get(key, context) {
  7298. if (context === true) context = this.context;
  7299. var parts = key.split(".");
  7300. if (parts.length === 1) {
  7301. return this._getKey(key, context);
  7302. } else {
  7303. return this._getPattern(parts, context);
  7304. }
  7305. }
  7306. function _getKey(key, context) {
  7307. var _this = this;
  7308. var node = this.node;
  7309. var container = node[key];
  7310. if (Array.isArray(container)) {
  7311. return container.map(function (_, i) {
  7312. return _index2.default.get({
  7313. listKey: key,
  7314. parentPath: _this,
  7315. parent: node,
  7316. container: container,
  7317. key: i
  7318. }).setContext(context);
  7319. });
  7320. } else {
  7321. return _index2.default.get({
  7322. parentPath: this,
  7323. parent: node,
  7324. container: node,
  7325. key: key
  7326. }).setContext(context);
  7327. }
  7328. }
  7329. function _getPattern(parts, context) {
  7330. var path = this;
  7331. for (var _iterator = parts, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  7332. var _ref;
  7333. if (_isArray) {
  7334. if (_i >= _iterator.length) break;
  7335. _ref = _iterator[_i++];
  7336. } else {
  7337. _i = _iterator.next();
  7338. if (_i.done) break;
  7339. _ref = _i.value;
  7340. }
  7341. var part = _ref;
  7342. if (part === ".") {
  7343. path = path.parentPath;
  7344. } else {
  7345. if (Array.isArray(path)) {
  7346. path = path[part];
  7347. } else {
  7348. path = path.get(part, context);
  7349. }
  7350. }
  7351. }
  7352. return path;
  7353. }
  7354. function getBindingIdentifiers(duplicates) {
  7355. return t.getBindingIdentifiers(this.node, duplicates);
  7356. }
  7357. function getOuterBindingIdentifiers(duplicates) {
  7358. return t.getOuterBindingIdentifiers(this.node, duplicates);
  7359. }
  7360. function getBindingIdentifierPaths() {
  7361. var duplicates = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  7362. var outerOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  7363. var path = this;
  7364. var search = [].concat(path);
  7365. var ids = (0, _create2.default)(null);
  7366. while (search.length) {
  7367. var id = search.shift();
  7368. if (!id) continue;
  7369. if (!id.node) continue;
  7370. var keys = t.getBindingIdentifiers.keys[id.node.type];
  7371. if (id.isIdentifier()) {
  7372. if (duplicates) {
  7373. var _ids = ids[id.node.name] = ids[id.node.name] || [];
  7374. _ids.push(id);
  7375. } else {
  7376. ids[id.node.name] = id;
  7377. }
  7378. continue;
  7379. }
  7380. if (id.isExportDeclaration()) {
  7381. var declaration = id.get("declaration");
  7382. if (declaration.isDeclaration()) {
  7383. search.push(declaration);
  7384. }
  7385. continue;
  7386. }
  7387. if (outerOnly) {
  7388. if (id.isFunctionDeclaration()) {
  7389. search.push(id.get("id"));
  7390. continue;
  7391. }
  7392. if (id.isFunctionExpression()) {
  7393. continue;
  7394. }
  7395. }
  7396. if (keys) {
  7397. for (var i = 0; i < keys.length; i++) {
  7398. var key = keys[i];
  7399. var child = id.get(key);
  7400. if (Array.isArray(child) || child.node) {
  7401. search = search.concat(child);
  7402. }
  7403. }
  7404. }
  7405. }
  7406. return ids;
  7407. }
  7408. function getOuterBindingIdentifierPaths(duplicates) {
  7409. return this.getBindingIdentifierPaths(duplicates, true);
  7410. }
  7411. },{"./index":86,"babel-runtime/core-js/get-iterator":56,"babel-runtime/core-js/object/create":61,"babel-types":112}],86:[function(require,module,exports){
  7412. "use strict";
  7413. exports.__esModule = true;
  7414. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  7415. var _getIterator3 = _interopRequireDefault(_getIterator2);
  7416. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  7417. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  7418. var _virtualTypes = require("./lib/virtual-types");
  7419. var virtualTypes = _interopRequireWildcard(_virtualTypes);
  7420. var _debug2 = require("debug");
  7421. var _debug3 = _interopRequireDefault(_debug2);
  7422. var _invariant = require("invariant");
  7423. var _invariant2 = _interopRequireDefault(_invariant);
  7424. var _index = require("../index");
  7425. var _index2 = _interopRequireDefault(_index);
  7426. var _assign = require("lodash/assign");
  7427. var _assign2 = _interopRequireDefault(_assign);
  7428. var _scope = require("../scope");
  7429. var _scope2 = _interopRequireDefault(_scope);
  7430. var _babelTypes = require("babel-types");
  7431. var t = _interopRequireWildcard(_babelTypes);
  7432. var _cache = require("../cache");
  7433. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  7434. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7435. var _debug = (0, _debug3.default)("babel");
  7436. var NodePath = function () {
  7437. function NodePath(hub, parent) {
  7438. (0, _classCallCheck3.default)(this, NodePath);
  7439. this.parent = parent;
  7440. this.hub = hub;
  7441. this.contexts = [];
  7442. this.data = {};
  7443. this.shouldSkip = false;
  7444. this.shouldStop = false;
  7445. this.removed = false;
  7446. this.state = null;
  7447. this.opts = null;
  7448. this.skipKeys = null;
  7449. this.parentPath = null;
  7450. this.context = null;
  7451. this.container = null;
  7452. this.listKey = null;
  7453. this.inList = false;
  7454. this.parentKey = null;
  7455. this.key = null;
  7456. this.node = null;
  7457. this.scope = null;
  7458. this.type = null;
  7459. this.typeAnnotation = null;
  7460. }
  7461. NodePath.get = function get(_ref) {
  7462. var hub = _ref.hub,
  7463. parentPath = _ref.parentPath,
  7464. parent = _ref.parent,
  7465. container = _ref.container,
  7466. listKey = _ref.listKey,
  7467. key = _ref.key;
  7468. if (!hub && parentPath) {
  7469. hub = parentPath.hub;
  7470. }
  7471. (0, _invariant2.default)(parent, "To get a node path the parent needs to exist");
  7472. var targetNode = container[key];
  7473. var paths = _cache.path.get(parent) || [];
  7474. if (!_cache.path.has(parent)) {
  7475. _cache.path.set(parent, paths);
  7476. }
  7477. var path = void 0;
  7478. for (var i = 0; i < paths.length; i++) {
  7479. var pathCheck = paths[i];
  7480. if (pathCheck.node === targetNode) {
  7481. path = pathCheck;
  7482. break;
  7483. }
  7484. }
  7485. if (!path) {
  7486. path = new NodePath(hub, parent);
  7487. paths.push(path);
  7488. }
  7489. path.setup(parentPath, container, listKey, key);
  7490. return path;
  7491. };
  7492. NodePath.prototype.getScope = function getScope(scope) {
  7493. var ourScope = scope;
  7494. if (this.isScope()) {
  7495. ourScope = new _scope2.default(this, scope);
  7496. }
  7497. return ourScope;
  7498. };
  7499. NodePath.prototype.setData = function setData(key, val) {
  7500. return this.data[key] = val;
  7501. };
  7502. NodePath.prototype.getData = function getData(key, def) {
  7503. var val = this.data[key];
  7504. if (!val && def) val = this.data[key] = def;
  7505. return val;
  7506. };
  7507. NodePath.prototype.buildCodeFrameError = function buildCodeFrameError(msg) {
  7508. var Error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : SyntaxError;
  7509. return this.hub.file.buildCodeFrameError(this.node, msg, Error);
  7510. };
  7511. NodePath.prototype.traverse = function traverse(visitor, state) {
  7512. (0, _index2.default)(this.node, visitor, this.scope, state, this);
  7513. };
  7514. NodePath.prototype.mark = function mark(type, message) {
  7515. this.hub.file.metadata.marked.push({
  7516. type: type,
  7517. message: message,
  7518. loc: this.node.loc
  7519. });
  7520. };
  7521. NodePath.prototype.set = function set(key, node) {
  7522. t.validate(this.node, key, node);
  7523. this.node[key] = node;
  7524. };
  7525. NodePath.prototype.getPathLocation = function getPathLocation() {
  7526. var parts = [];
  7527. var path = this;
  7528. do {
  7529. var key = path.key;
  7530. if (path.inList) key = path.listKey + "[" + key + "]";
  7531. parts.unshift(key);
  7532. } while (path = path.parentPath);
  7533. return parts.join(".");
  7534. };
  7535. NodePath.prototype.debug = function debug(buildMessage) {
  7536. if (!_debug.enabled) return;
  7537. _debug(this.getPathLocation() + " " + this.type + ": " + buildMessage());
  7538. };
  7539. return NodePath;
  7540. }();
  7541. exports.default = NodePath;
  7542. (0, _assign2.default)(NodePath.prototype, require("./ancestry"));
  7543. (0, _assign2.default)(NodePath.prototype, require("./inference"));
  7544. (0, _assign2.default)(NodePath.prototype, require("./replacement"));
  7545. (0, _assign2.default)(NodePath.prototype, require("./evaluation"));
  7546. (0, _assign2.default)(NodePath.prototype, require("./conversion"));
  7547. (0, _assign2.default)(NodePath.prototype, require("./introspection"));
  7548. (0, _assign2.default)(NodePath.prototype, require("./context"));
  7549. (0, _assign2.default)(NodePath.prototype, require("./removal"));
  7550. (0, _assign2.default)(NodePath.prototype, require("./modification"));
  7551. (0, _assign2.default)(NodePath.prototype, require("./family"));
  7552. (0, _assign2.default)(NodePath.prototype, require("./comments"));
  7553. var _loop2 = function _loop2() {
  7554. if (_isArray) {
  7555. if (_i >= _iterator.length) return "break";
  7556. _ref2 = _iterator[_i++];
  7557. } else {
  7558. _i = _iterator.next();
  7559. if (_i.done) return "break";
  7560. _ref2 = _i.value;
  7561. }
  7562. var type = _ref2;
  7563. var typeKey = "is" + type;
  7564. NodePath.prototype[typeKey] = function (opts) {
  7565. return t[typeKey](this.node, opts);
  7566. };
  7567. NodePath.prototype["assert" + type] = function (opts) {
  7568. if (!this[typeKey](opts)) {
  7569. throw new TypeError("Expected node path of type " + type);
  7570. }
  7571. };
  7572. };
  7573. for (var _iterator = t.TYPES, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  7574. var _ref2;
  7575. var _ret2 = _loop2();
  7576. if (_ret2 === "break") break;
  7577. }
  7578. var _loop = function _loop(type) {
  7579. if (type[0] === "_") return "continue";
  7580. if (t.TYPES.indexOf(type) < 0) t.TYPES.push(type);
  7581. var virtualType = virtualTypes[type];
  7582. NodePath.prototype["is" + type] = function (opts) {
  7583. return virtualType.checkPath(this, opts);
  7584. };
  7585. };
  7586. for (var type in virtualTypes) {
  7587. var _ret = _loop(type);
  7588. if (_ret === "continue") continue;
  7589. }
  7590. module.exports = exports["default"];
  7591. },{"../cache":76,"../index":79,"../scope":98,"./ancestry":80,"./comments":81,"./context":82,"./conversion":83,"./evaluation":84,"./family":85,"./inference":87,"./introspection":90,"./lib/virtual-types":93,"./modification":94,"./removal":95,"./replacement":96,"babel-runtime/core-js/get-iterator":56,"babel-runtime/helpers/classCallCheck":70,"babel-types":112,"debug":232,"invariant":245,"lodash/assign":414}],87:[function(require,module,exports){
  7592. "use strict";
  7593. exports.__esModule = true;
  7594. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  7595. var _getIterator3 = _interopRequireDefault(_getIterator2);
  7596. exports.getTypeAnnotation = getTypeAnnotation;
  7597. exports._getTypeAnnotation = _getTypeAnnotation;
  7598. exports.isBaseType = isBaseType;
  7599. exports.couldBeBaseType = couldBeBaseType;
  7600. exports.baseTypeStrictlyMatches = baseTypeStrictlyMatches;
  7601. exports.isGenericType = isGenericType;
  7602. var _inferers = require("./inferers");
  7603. var inferers = _interopRequireWildcard(_inferers);
  7604. var _babelTypes = require("babel-types");
  7605. var t = _interopRequireWildcard(_babelTypes);
  7606. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  7607. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7608. function getTypeAnnotation() {
  7609. if (this.typeAnnotation) return this.typeAnnotation;
  7610. var type = this._getTypeAnnotation() || t.anyTypeAnnotation();
  7611. if (t.isTypeAnnotation(type)) type = type.typeAnnotation;
  7612. return this.typeAnnotation = type;
  7613. }
  7614. function _getTypeAnnotation() {
  7615. var node = this.node;
  7616. if (!node) {
  7617. if (this.key === "init" && this.parentPath.isVariableDeclarator()) {
  7618. var declar = this.parentPath.parentPath;
  7619. var declarParent = declar.parentPath;
  7620. if (declar.key === "left" && declarParent.isForInStatement()) {
  7621. return t.stringTypeAnnotation();
  7622. }
  7623. if (declar.key === "left" && declarParent.isForOfStatement()) {
  7624. return t.anyTypeAnnotation();
  7625. }
  7626. return t.voidTypeAnnotation();
  7627. } else {
  7628. return;
  7629. }
  7630. }
  7631. if (node.typeAnnotation) {
  7632. return node.typeAnnotation;
  7633. }
  7634. var inferer = inferers[node.type];
  7635. if (inferer) {
  7636. return inferer.call(this, node);
  7637. }
  7638. inferer = inferers[this.parentPath.type];
  7639. if (inferer && inferer.validParent) {
  7640. return this.parentPath.getTypeAnnotation();
  7641. }
  7642. }
  7643. function isBaseType(baseName, soft) {
  7644. return _isBaseType(baseName, this.getTypeAnnotation(), soft);
  7645. }
  7646. function _isBaseType(baseName, type, soft) {
  7647. if (baseName === "string") {
  7648. return t.isStringTypeAnnotation(type);
  7649. } else if (baseName === "number") {
  7650. return t.isNumberTypeAnnotation(type);
  7651. } else if (baseName === "boolean") {
  7652. return t.isBooleanTypeAnnotation(type);
  7653. } else if (baseName === "any") {
  7654. return t.isAnyTypeAnnotation(type);
  7655. } else if (baseName === "mixed") {
  7656. return t.isMixedTypeAnnotation(type);
  7657. } else if (baseName === "empty") {
  7658. return t.isEmptyTypeAnnotation(type);
  7659. } else if (baseName === "void") {
  7660. return t.isVoidTypeAnnotation(type);
  7661. } else {
  7662. if (soft) {
  7663. return false;
  7664. } else {
  7665. throw new Error("Unknown base type " + baseName);
  7666. }
  7667. }
  7668. }
  7669. function couldBeBaseType(name) {
  7670. var type = this.getTypeAnnotation();
  7671. if (t.isAnyTypeAnnotation(type)) return true;
  7672. if (t.isUnionTypeAnnotation(type)) {
  7673. for (var _iterator = type.types, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  7674. var _ref;
  7675. if (_isArray) {
  7676. if (_i >= _iterator.length) break;
  7677. _ref = _iterator[_i++];
  7678. } else {
  7679. _i = _iterator.next();
  7680. if (_i.done) break;
  7681. _ref = _i.value;
  7682. }
  7683. var type2 = _ref;
  7684. if (t.isAnyTypeAnnotation(type2) || _isBaseType(name, type2, true)) {
  7685. return true;
  7686. }
  7687. }
  7688. return false;
  7689. } else {
  7690. return _isBaseType(name, type, true);
  7691. }
  7692. }
  7693. function baseTypeStrictlyMatches(right) {
  7694. var left = this.getTypeAnnotation();
  7695. right = right.getTypeAnnotation();
  7696. if (!t.isAnyTypeAnnotation(left) && t.isFlowBaseAnnotation(left)) {
  7697. return right.type === left.type;
  7698. }
  7699. }
  7700. function isGenericType(genericName) {
  7701. var type = this.getTypeAnnotation();
  7702. return t.isGenericTypeAnnotation(type) && t.isIdentifier(type.id, { name: genericName });
  7703. }
  7704. },{"./inferers":89,"babel-runtime/core-js/get-iterator":56,"babel-types":112}],88:[function(require,module,exports){
  7705. "use strict";
  7706. exports.__esModule = true;
  7707. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  7708. var _getIterator3 = _interopRequireDefault(_getIterator2);
  7709. exports.default = function (node) {
  7710. if (!this.isReferenced()) return;
  7711. var binding = this.scope.getBinding(node.name);
  7712. if (binding) {
  7713. if (binding.identifier.typeAnnotation) {
  7714. return binding.identifier.typeAnnotation;
  7715. } else {
  7716. return getTypeAnnotationBindingConstantViolations(this, node.name);
  7717. }
  7718. }
  7719. if (node.name === "undefined") {
  7720. return t.voidTypeAnnotation();
  7721. } else if (node.name === "NaN" || node.name === "Infinity") {
  7722. return t.numberTypeAnnotation();
  7723. } else if (node.name === "arguments") {}
  7724. };
  7725. var _babelTypes = require("babel-types");
  7726. var t = _interopRequireWildcard(_babelTypes);
  7727. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  7728. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7729. function getTypeAnnotationBindingConstantViolations(path, name) {
  7730. var binding = path.scope.getBinding(name);
  7731. var types = [];
  7732. path.typeAnnotation = t.unionTypeAnnotation(types);
  7733. var functionConstantViolations = [];
  7734. var constantViolations = getConstantViolationsBefore(binding, path, functionConstantViolations);
  7735. var testType = getConditionalAnnotation(path, name);
  7736. if (testType) {
  7737. (function () {
  7738. var testConstantViolations = getConstantViolationsBefore(binding, testType.ifStatement);
  7739. constantViolations = constantViolations.filter(function (path) {
  7740. return testConstantViolations.indexOf(path) < 0;
  7741. });
  7742. types.push(testType.typeAnnotation);
  7743. })();
  7744. }
  7745. if (constantViolations.length) {
  7746. constantViolations = constantViolations.concat(functionConstantViolations);
  7747. for (var _iterator = constantViolations, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  7748. var _ref;
  7749. if (_isArray) {
  7750. if (_i >= _iterator.length) break;
  7751. _ref = _iterator[_i++];
  7752. } else {
  7753. _i = _iterator.next();
  7754. if (_i.done) break;
  7755. _ref = _i.value;
  7756. }
  7757. var violation = _ref;
  7758. types.push(violation.getTypeAnnotation());
  7759. }
  7760. }
  7761. if (types.length) {
  7762. return t.createUnionTypeAnnotation(types);
  7763. }
  7764. }
  7765. function getConstantViolationsBefore(binding, path, functions) {
  7766. var violations = binding.constantViolations.slice();
  7767. violations.unshift(binding.path);
  7768. return violations.filter(function (violation) {
  7769. violation = violation.resolve();
  7770. var status = violation._guessExecutionStatusRelativeTo(path);
  7771. if (functions && status === "function") functions.push(violation);
  7772. return status === "before";
  7773. });
  7774. }
  7775. function inferAnnotationFromBinaryExpression(name, path) {
  7776. var operator = path.node.operator;
  7777. var right = path.get("right").resolve();
  7778. var left = path.get("left").resolve();
  7779. var target = void 0;
  7780. if (left.isIdentifier({ name: name })) {
  7781. target = right;
  7782. } else if (right.isIdentifier({ name: name })) {
  7783. target = left;
  7784. }
  7785. if (target) {
  7786. if (operator === "===") {
  7787. return target.getTypeAnnotation();
  7788. } else if (t.BOOLEAN_NUMBER_BINARY_OPERATORS.indexOf(operator) >= 0) {
  7789. return t.numberTypeAnnotation();
  7790. } else {
  7791. return;
  7792. }
  7793. } else {
  7794. if (operator !== "===") return;
  7795. }
  7796. var typeofPath = void 0;
  7797. var typePath = void 0;
  7798. if (left.isUnaryExpression({ operator: "typeof" })) {
  7799. typeofPath = left;
  7800. typePath = right;
  7801. } else if (right.isUnaryExpression({ operator: "typeof" })) {
  7802. typeofPath = right;
  7803. typePath = left;
  7804. }
  7805. if (!typePath && !typeofPath) return;
  7806. typePath = typePath.resolve();
  7807. if (!typePath.isLiteral()) return;
  7808. var typeValue = typePath.node.value;
  7809. if (typeof typeValue !== "string") return;
  7810. if (!typeofPath.get("argument").isIdentifier({ name: name })) return;
  7811. return t.createTypeAnnotationBasedOnTypeof(typePath.node.value);
  7812. }
  7813. function getParentConditionalPath(path) {
  7814. var parentPath = void 0;
  7815. while (parentPath = path.parentPath) {
  7816. if (parentPath.isIfStatement() || parentPath.isConditionalExpression()) {
  7817. if (path.key === "test") {
  7818. return;
  7819. } else {
  7820. return parentPath;
  7821. }
  7822. } else {
  7823. path = parentPath;
  7824. }
  7825. }
  7826. }
  7827. function getConditionalAnnotation(path, name) {
  7828. var ifStatement = getParentConditionalPath(path);
  7829. if (!ifStatement) return;
  7830. var test = ifStatement.get("test");
  7831. var paths = [test];
  7832. var types = [];
  7833. do {
  7834. var _path = paths.shift().resolve();
  7835. if (_path.isLogicalExpression()) {
  7836. paths.push(_path.get("left"));
  7837. paths.push(_path.get("right"));
  7838. }
  7839. if (_path.isBinaryExpression()) {
  7840. var type = inferAnnotationFromBinaryExpression(name, _path);
  7841. if (type) types.push(type);
  7842. }
  7843. } while (paths.length);
  7844. if (types.length) {
  7845. return {
  7846. typeAnnotation: t.createUnionTypeAnnotation(types),
  7847. ifStatement: ifStatement
  7848. };
  7849. } else {
  7850. return getConditionalAnnotation(ifStatement, name);
  7851. }
  7852. }
  7853. module.exports = exports["default"];
  7854. },{"babel-runtime/core-js/get-iterator":56,"babel-types":112}],89:[function(require,module,exports){
  7855. "use strict";
  7856. exports.__esModule = true;
  7857. exports.ClassDeclaration = exports.ClassExpression = exports.FunctionDeclaration = exports.ArrowFunctionExpression = exports.FunctionExpression = exports.Identifier = undefined;
  7858. var _infererReference = require("./inferer-reference");
  7859. Object.defineProperty(exports, "Identifier", {
  7860. enumerable: true,
  7861. get: function get() {
  7862. return _interopRequireDefault(_infererReference).default;
  7863. }
  7864. });
  7865. exports.VariableDeclarator = VariableDeclarator;
  7866. exports.TypeCastExpression = TypeCastExpression;
  7867. exports.NewExpression = NewExpression;
  7868. exports.TemplateLiteral = TemplateLiteral;
  7869. exports.UnaryExpression = UnaryExpression;
  7870. exports.BinaryExpression = BinaryExpression;
  7871. exports.LogicalExpression = LogicalExpression;
  7872. exports.ConditionalExpression = ConditionalExpression;
  7873. exports.SequenceExpression = SequenceExpression;
  7874. exports.AssignmentExpression = AssignmentExpression;
  7875. exports.UpdateExpression = UpdateExpression;
  7876. exports.StringLiteral = StringLiteral;
  7877. exports.NumericLiteral = NumericLiteral;
  7878. exports.BooleanLiteral = BooleanLiteral;
  7879. exports.NullLiteral = NullLiteral;
  7880. exports.RegExpLiteral = RegExpLiteral;
  7881. exports.ObjectExpression = ObjectExpression;
  7882. exports.ArrayExpression = ArrayExpression;
  7883. exports.RestElement = RestElement;
  7884. exports.CallExpression = CallExpression;
  7885. exports.TaggedTemplateExpression = TaggedTemplateExpression;
  7886. var _babelTypes = require("babel-types");
  7887. var t = _interopRequireWildcard(_babelTypes);
  7888. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  7889. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7890. function VariableDeclarator() {
  7891. var id = this.get("id");
  7892. if (id.isIdentifier()) {
  7893. return this.get("init").getTypeAnnotation();
  7894. } else {
  7895. return;
  7896. }
  7897. }
  7898. function TypeCastExpression(node) {
  7899. return node.typeAnnotation;
  7900. }
  7901. TypeCastExpression.validParent = true;
  7902. function NewExpression(node) {
  7903. if (this.get("callee").isIdentifier()) {
  7904. return t.genericTypeAnnotation(node.callee);
  7905. }
  7906. }
  7907. function TemplateLiteral() {
  7908. return t.stringTypeAnnotation();
  7909. }
  7910. function UnaryExpression(node) {
  7911. var operator = node.operator;
  7912. if (operator === "void") {
  7913. return t.voidTypeAnnotation();
  7914. } else if (t.NUMBER_UNARY_OPERATORS.indexOf(operator) >= 0) {
  7915. return t.numberTypeAnnotation();
  7916. } else if (t.STRING_UNARY_OPERATORS.indexOf(operator) >= 0) {
  7917. return t.stringTypeAnnotation();
  7918. } else if (t.BOOLEAN_UNARY_OPERATORS.indexOf(operator) >= 0) {
  7919. return t.booleanTypeAnnotation();
  7920. }
  7921. }
  7922. function BinaryExpression(node) {
  7923. var operator = node.operator;
  7924. if (t.NUMBER_BINARY_OPERATORS.indexOf(operator) >= 0) {
  7925. return t.numberTypeAnnotation();
  7926. } else if (t.BOOLEAN_BINARY_OPERATORS.indexOf(operator) >= 0) {
  7927. return t.booleanTypeAnnotation();
  7928. } else if (operator === "+") {
  7929. var right = this.get("right");
  7930. var left = this.get("left");
  7931. if (left.isBaseType("number") && right.isBaseType("number")) {
  7932. return t.numberTypeAnnotation();
  7933. } else if (left.isBaseType("string") || right.isBaseType("string")) {
  7934. return t.stringTypeAnnotation();
  7935. }
  7936. return t.unionTypeAnnotation([t.stringTypeAnnotation(), t.numberTypeAnnotation()]);
  7937. }
  7938. }
  7939. function LogicalExpression() {
  7940. return t.createUnionTypeAnnotation([this.get("left").getTypeAnnotation(), this.get("right").getTypeAnnotation()]);
  7941. }
  7942. function ConditionalExpression() {
  7943. return t.createUnionTypeAnnotation([this.get("consequent").getTypeAnnotation(), this.get("alternate").getTypeAnnotation()]);
  7944. }
  7945. function SequenceExpression() {
  7946. return this.get("expressions").pop().getTypeAnnotation();
  7947. }
  7948. function AssignmentExpression() {
  7949. return this.get("right").getTypeAnnotation();
  7950. }
  7951. function UpdateExpression(node) {
  7952. var operator = node.operator;
  7953. if (operator === "++" || operator === "--") {
  7954. return t.numberTypeAnnotation();
  7955. }
  7956. }
  7957. function StringLiteral() {
  7958. return t.stringTypeAnnotation();
  7959. }
  7960. function NumericLiteral() {
  7961. return t.numberTypeAnnotation();
  7962. }
  7963. function BooleanLiteral() {
  7964. return t.booleanTypeAnnotation();
  7965. }
  7966. function NullLiteral() {
  7967. return t.nullLiteralTypeAnnotation();
  7968. }
  7969. function RegExpLiteral() {
  7970. return t.genericTypeAnnotation(t.identifier("RegExp"));
  7971. }
  7972. function ObjectExpression() {
  7973. return t.genericTypeAnnotation(t.identifier("Object"));
  7974. }
  7975. function ArrayExpression() {
  7976. return t.genericTypeAnnotation(t.identifier("Array"));
  7977. }
  7978. function RestElement() {
  7979. return ArrayExpression();
  7980. }
  7981. RestElement.validParent = true;
  7982. function Func() {
  7983. return t.genericTypeAnnotation(t.identifier("Function"));
  7984. }
  7985. exports.FunctionExpression = Func;
  7986. exports.ArrowFunctionExpression = Func;
  7987. exports.FunctionDeclaration = Func;
  7988. exports.ClassExpression = Func;
  7989. exports.ClassDeclaration = Func;
  7990. function CallExpression() {
  7991. return resolveCall(this.get("callee"));
  7992. }
  7993. function TaggedTemplateExpression() {
  7994. return resolveCall(this.get("tag"));
  7995. }
  7996. function resolveCall(callee) {
  7997. callee = callee.resolve();
  7998. if (callee.isFunction()) {
  7999. if (callee.is("async")) {
  8000. if (callee.is("generator")) {
  8001. return t.genericTypeAnnotation(t.identifier("AsyncIterator"));
  8002. } else {
  8003. return t.genericTypeAnnotation(t.identifier("Promise"));
  8004. }
  8005. } else {
  8006. if (callee.node.returnType) {
  8007. return callee.node.returnType;
  8008. } else {}
  8009. }
  8010. }
  8011. }
  8012. },{"./inferer-reference":88,"babel-types":112}],90:[function(require,module,exports){
  8013. "use strict";
  8014. exports.__esModule = true;
  8015. exports.is = undefined;
  8016. var _typeof2 = require("babel-runtime/helpers/typeof");
  8017. var _typeof3 = _interopRequireDefault(_typeof2);
  8018. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  8019. var _getIterator3 = _interopRequireDefault(_getIterator2);
  8020. exports.matchesPattern = matchesPattern;
  8021. exports.has = has;
  8022. exports.isStatic = isStatic;
  8023. exports.isnt = isnt;
  8024. exports.equals = equals;
  8025. exports.isNodeType = isNodeType;
  8026. exports.canHaveVariableDeclarationOrExpression = canHaveVariableDeclarationOrExpression;
  8027. exports.canSwapBetweenExpressionAndStatement = canSwapBetweenExpressionAndStatement;
  8028. exports.isCompletionRecord = isCompletionRecord;
  8029. exports.isStatementOrBlock = isStatementOrBlock;
  8030. exports.referencesImport = referencesImport;
  8031. exports.getSource = getSource;
  8032. exports.willIMaybeExecuteBefore = willIMaybeExecuteBefore;
  8033. exports._guessExecutionStatusRelativeTo = _guessExecutionStatusRelativeTo;
  8034. exports._guessExecutionStatusRelativeToDifferentFunctions = _guessExecutionStatusRelativeToDifferentFunctions;
  8035. exports.resolve = resolve;
  8036. exports._resolve = _resolve;
  8037. var _includes = require("lodash/includes");
  8038. var _includes2 = _interopRequireDefault(_includes);
  8039. var _babelTypes = require("babel-types");
  8040. var t = _interopRequireWildcard(_babelTypes);
  8041. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  8042. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8043. function matchesPattern(pattern, allowPartial) {
  8044. if (!this.isMemberExpression()) return false;
  8045. var parts = pattern.split(".");
  8046. var search = [this.node];
  8047. var i = 0;
  8048. function matches(name) {
  8049. var part = parts[i];
  8050. return part === "*" || name === part;
  8051. }
  8052. while (search.length) {
  8053. var node = search.shift();
  8054. if (allowPartial && i === parts.length) {
  8055. return true;
  8056. }
  8057. if (t.isIdentifier(node)) {
  8058. if (!matches(node.name)) return false;
  8059. } else if (t.isLiteral(node)) {
  8060. if (!matches(node.value)) return false;
  8061. } else if (t.isMemberExpression(node)) {
  8062. if (node.computed && !t.isLiteral(node.property)) {
  8063. return false;
  8064. } else {
  8065. search.unshift(node.property);
  8066. search.unshift(node.object);
  8067. continue;
  8068. }
  8069. } else if (t.isThisExpression(node)) {
  8070. if (!matches("this")) return false;
  8071. } else {
  8072. return false;
  8073. }
  8074. if (++i > parts.length) {
  8075. return false;
  8076. }
  8077. }
  8078. return i === parts.length;
  8079. }
  8080. function has(key) {
  8081. var val = this.node && this.node[key];
  8082. if (val && Array.isArray(val)) {
  8083. return !!val.length;
  8084. } else {
  8085. return !!val;
  8086. }
  8087. }
  8088. function isStatic() {
  8089. return this.scope.isStatic(this.node);
  8090. }
  8091. var is = exports.is = has;
  8092. function isnt(key) {
  8093. return !this.has(key);
  8094. }
  8095. function equals(key, value) {
  8096. return this.node[key] === value;
  8097. }
  8098. function isNodeType(type) {
  8099. return t.isType(this.type, type);
  8100. }
  8101. function canHaveVariableDeclarationOrExpression() {
  8102. return (this.key === "init" || this.key === "left") && this.parentPath.isFor();
  8103. }
  8104. function canSwapBetweenExpressionAndStatement(replacement) {
  8105. if (this.key !== "body" || !this.parentPath.isArrowFunctionExpression()) {
  8106. return false;
  8107. }
  8108. if (this.isExpression()) {
  8109. return t.isBlockStatement(replacement);
  8110. } else if (this.isBlockStatement()) {
  8111. return t.isExpression(replacement);
  8112. }
  8113. return false;
  8114. }
  8115. function isCompletionRecord(allowInsideFunction) {
  8116. var path = this;
  8117. var first = true;
  8118. do {
  8119. var container = path.container;
  8120. if (path.isFunction() && !first) {
  8121. return !!allowInsideFunction;
  8122. }
  8123. first = false;
  8124. if (Array.isArray(container) && path.key !== container.length - 1) {
  8125. return false;
  8126. }
  8127. } while ((path = path.parentPath) && !path.isProgram());
  8128. return true;
  8129. }
  8130. function isStatementOrBlock() {
  8131. if (this.parentPath.isLabeledStatement() || t.isBlockStatement(this.container)) {
  8132. return false;
  8133. } else {
  8134. return (0, _includes2.default)(t.STATEMENT_OR_BLOCK_KEYS, this.key);
  8135. }
  8136. }
  8137. function referencesImport(moduleSource, importName) {
  8138. if (!this.isReferencedIdentifier()) return false;
  8139. var binding = this.scope.getBinding(this.node.name);
  8140. if (!binding || binding.kind !== "module") return false;
  8141. var path = binding.path;
  8142. var parent = path.parentPath;
  8143. if (!parent.isImportDeclaration()) return false;
  8144. if (parent.node.source.value === moduleSource) {
  8145. if (!importName) return true;
  8146. } else {
  8147. return false;
  8148. }
  8149. if (path.isImportDefaultSpecifier() && importName === "default") {
  8150. return true;
  8151. }
  8152. if (path.isImportNamespaceSpecifier() && importName === "*") {
  8153. return true;
  8154. }
  8155. if (path.isImportSpecifier() && path.node.imported.name === importName) {
  8156. return true;
  8157. }
  8158. return false;
  8159. }
  8160. function getSource() {
  8161. var node = this.node;
  8162. if (node.end) {
  8163. return this.hub.file.code.slice(node.start, node.end);
  8164. } else {
  8165. return "";
  8166. }
  8167. }
  8168. function willIMaybeExecuteBefore(target) {
  8169. return this._guessExecutionStatusRelativeTo(target) !== "after";
  8170. }
  8171. function _guessExecutionStatusRelativeTo(target) {
  8172. var targetFuncParent = target.scope.getFunctionParent();
  8173. var selfFuncParent = this.scope.getFunctionParent();
  8174. if (targetFuncParent.node !== selfFuncParent.node) {
  8175. var status = this._guessExecutionStatusRelativeToDifferentFunctions(targetFuncParent);
  8176. if (status) {
  8177. return status;
  8178. } else {
  8179. target = targetFuncParent.path;
  8180. }
  8181. }
  8182. var targetPaths = target.getAncestry();
  8183. if (targetPaths.indexOf(this) >= 0) return "after";
  8184. var selfPaths = this.getAncestry();
  8185. var commonPath = void 0;
  8186. var targetIndex = void 0;
  8187. var selfIndex = void 0;
  8188. for (selfIndex = 0; selfIndex < selfPaths.length; selfIndex++) {
  8189. var selfPath = selfPaths[selfIndex];
  8190. targetIndex = targetPaths.indexOf(selfPath);
  8191. if (targetIndex >= 0) {
  8192. commonPath = selfPath;
  8193. break;
  8194. }
  8195. }
  8196. if (!commonPath) {
  8197. return "before";
  8198. }
  8199. var targetRelationship = targetPaths[targetIndex - 1];
  8200. var selfRelationship = selfPaths[selfIndex - 1];
  8201. if (!targetRelationship || !selfRelationship) {
  8202. return "before";
  8203. }
  8204. if (targetRelationship.listKey && targetRelationship.container === selfRelationship.container) {
  8205. return targetRelationship.key > selfRelationship.key ? "before" : "after";
  8206. }
  8207. var targetKeyPosition = t.VISITOR_KEYS[targetRelationship.type].indexOf(targetRelationship.key);
  8208. var selfKeyPosition = t.VISITOR_KEYS[selfRelationship.type].indexOf(selfRelationship.key);
  8209. return targetKeyPosition > selfKeyPosition ? "before" : "after";
  8210. }
  8211. function _guessExecutionStatusRelativeToDifferentFunctions(targetFuncParent) {
  8212. var targetFuncPath = targetFuncParent.path;
  8213. if (!targetFuncPath.isFunctionDeclaration()) return;
  8214. var binding = targetFuncPath.scope.getBinding(targetFuncPath.node.id.name);
  8215. if (!binding.references) return "before";
  8216. var referencePaths = binding.referencePaths;
  8217. for (var _iterator = referencePaths, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  8218. var _ref;
  8219. if (_isArray) {
  8220. if (_i >= _iterator.length) break;
  8221. _ref = _iterator[_i++];
  8222. } else {
  8223. _i = _iterator.next();
  8224. if (_i.done) break;
  8225. _ref = _i.value;
  8226. }
  8227. var path = _ref;
  8228. if (path.key !== "callee" || !path.parentPath.isCallExpression()) {
  8229. return;
  8230. }
  8231. }
  8232. var allStatus = void 0;
  8233. for (var _iterator2 = referencePaths, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  8234. var _ref2;
  8235. if (_isArray2) {
  8236. if (_i2 >= _iterator2.length) break;
  8237. _ref2 = _iterator2[_i2++];
  8238. } else {
  8239. _i2 = _iterator2.next();
  8240. if (_i2.done) break;
  8241. _ref2 = _i2.value;
  8242. }
  8243. var _path = _ref2;
  8244. var childOfFunction = !!_path.find(function (path) {
  8245. return path.node === targetFuncPath.node;
  8246. });
  8247. if (childOfFunction) continue;
  8248. var status = this._guessExecutionStatusRelativeTo(_path);
  8249. if (allStatus) {
  8250. if (allStatus !== status) return;
  8251. } else {
  8252. allStatus = status;
  8253. }
  8254. }
  8255. return allStatus;
  8256. }
  8257. function resolve(dangerous, resolved) {
  8258. return this._resolve(dangerous, resolved) || this;
  8259. }
  8260. function _resolve(dangerous, resolved) {
  8261. var _this = this;
  8262. if (resolved && resolved.indexOf(this) >= 0) return;
  8263. resolved = resolved || [];
  8264. resolved.push(this);
  8265. if (this.isVariableDeclarator()) {
  8266. if (this.get("id").isIdentifier()) {
  8267. return this.get("init").resolve(dangerous, resolved);
  8268. } else {}
  8269. } else if (this.isReferencedIdentifier()) {
  8270. var binding = this.scope.getBinding(this.node.name);
  8271. if (!binding) return;
  8272. if (!binding.constant) return;
  8273. if (binding.kind === "module") return;
  8274. if (binding.path !== this) {
  8275. var _ret = function () {
  8276. var ret = binding.path.resolve(dangerous, resolved);
  8277. if (_this.find(function (parent) {
  8278. return parent.node === ret.node;
  8279. })) return {
  8280. v: void 0
  8281. };
  8282. return {
  8283. v: ret
  8284. };
  8285. }();
  8286. if ((typeof _ret === "undefined" ? "undefined" : (0, _typeof3.default)(_ret)) === "object") return _ret.v;
  8287. }
  8288. } else if (this.isTypeCastExpression()) {
  8289. return this.get("expression").resolve(dangerous, resolved);
  8290. } else if (dangerous && this.isMemberExpression()) {
  8291. var targetKey = this.toComputedKey();
  8292. if (!t.isLiteral(targetKey)) return;
  8293. var targetName = targetKey.value;
  8294. var target = this.get("object").resolve(dangerous, resolved);
  8295. if (target.isObjectExpression()) {
  8296. var props = target.get("properties");
  8297. for (var _iterator3 = props, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) {
  8298. var _ref3;
  8299. if (_isArray3) {
  8300. if (_i3 >= _iterator3.length) break;
  8301. _ref3 = _iterator3[_i3++];
  8302. } else {
  8303. _i3 = _iterator3.next();
  8304. if (_i3.done) break;
  8305. _ref3 = _i3.value;
  8306. }
  8307. var prop = _ref3;
  8308. if (!prop.isProperty()) continue;
  8309. var key = prop.get("key");
  8310. var match = prop.isnt("computed") && key.isIdentifier({ name: targetName });
  8311. match = match || key.isLiteral({ value: targetName });
  8312. if (match) return prop.get("value").resolve(dangerous, resolved);
  8313. }
  8314. } else if (target.isArrayExpression() && !isNaN(+targetName)) {
  8315. var elems = target.get("elements");
  8316. var elem = elems[targetName];
  8317. if (elem) return elem.resolve(dangerous, resolved);
  8318. }
  8319. }
  8320. }
  8321. },{"babel-runtime/core-js/get-iterator":56,"babel-runtime/helpers/typeof":74,"babel-types":112,"lodash/includes":431}],91:[function(require,module,exports){
  8322. "use strict";
  8323. exports.__esModule = true;
  8324. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  8325. var _getIterator3 = _interopRequireDefault(_getIterator2);
  8326. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  8327. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  8328. var _babelTypes = require("babel-types");
  8329. var t = _interopRequireWildcard(_babelTypes);
  8330. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  8331. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8332. var referenceVisitor = {
  8333. ReferencedIdentifier: function ReferencedIdentifier(path, state) {
  8334. if (path.isJSXIdentifier() && _babelTypes.react.isCompatTag(path.node.name) && !path.parentPath.isJSXMemberExpression()) {
  8335. return;
  8336. }
  8337. if (path.node.name === "this") {
  8338. var scope = path.scope;
  8339. do {
  8340. if (scope.path.isFunction() && !scope.path.isArrowFunctionExpression()) break;
  8341. } while (scope = scope.parent);
  8342. if (scope) state.breakOnScopePaths.push(scope.path);
  8343. }
  8344. var binding = path.scope.getBinding(path.node.name);
  8345. if (!binding) return;
  8346. if (binding !== state.scope.getBinding(path.node.name)) return;
  8347. state.bindings[path.node.name] = binding;
  8348. }
  8349. };
  8350. var PathHoister = function () {
  8351. function PathHoister(path, scope) {
  8352. (0, _classCallCheck3.default)(this, PathHoister);
  8353. this.breakOnScopePaths = [];
  8354. this.bindings = {};
  8355. this.scopes = [];
  8356. this.scope = scope;
  8357. this.path = path;
  8358. this.attachAfter = false;
  8359. }
  8360. PathHoister.prototype.isCompatibleScope = function isCompatibleScope(scope) {
  8361. for (var key in this.bindings) {
  8362. var binding = this.bindings[key];
  8363. if (!scope.bindingIdentifierEquals(key, binding.identifier)) {
  8364. return false;
  8365. }
  8366. }
  8367. return true;
  8368. };
  8369. PathHoister.prototype.getCompatibleScopes = function getCompatibleScopes() {
  8370. var scope = this.path.scope;
  8371. do {
  8372. if (this.isCompatibleScope(scope)) {
  8373. this.scopes.push(scope);
  8374. } else {
  8375. break;
  8376. }
  8377. if (this.breakOnScopePaths.indexOf(scope.path) >= 0) {
  8378. break;
  8379. }
  8380. } while (scope = scope.parent);
  8381. };
  8382. PathHoister.prototype.getAttachmentPath = function getAttachmentPath() {
  8383. var path = this._getAttachmentPath();
  8384. if (!path) return;
  8385. var targetScope = path.scope;
  8386. if (targetScope.path === path) {
  8387. targetScope = path.scope.parent;
  8388. }
  8389. if (targetScope.path.isProgram() || targetScope.path.isFunction()) {
  8390. for (var name in this.bindings) {
  8391. if (!targetScope.hasOwnBinding(name)) continue;
  8392. var binding = this.bindings[name];
  8393. if (binding.kind === "param") continue;
  8394. if (this.getAttachmentParentForPath(binding.path).key > path.key) {
  8395. this.attachAfter = true;
  8396. path = binding.path;
  8397. for (var _iterator = binding.constantViolations, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  8398. var _ref;
  8399. if (_isArray) {
  8400. if (_i >= _iterator.length) break;
  8401. _ref = _iterator[_i++];
  8402. } else {
  8403. _i = _iterator.next();
  8404. if (_i.done) break;
  8405. _ref = _i.value;
  8406. }
  8407. var violationPath = _ref;
  8408. if (this.getAttachmentParentForPath(violationPath).key > path.key) {
  8409. path = violationPath;
  8410. }
  8411. }
  8412. }
  8413. }
  8414. }
  8415. return path;
  8416. };
  8417. PathHoister.prototype._getAttachmentPath = function _getAttachmentPath() {
  8418. var scopes = this.scopes;
  8419. var scope = scopes.pop();
  8420. if (!scope) return;
  8421. if (scope.path.isFunction()) {
  8422. if (this.hasOwnParamBindings(scope)) {
  8423. if (this.scope === scope) return;
  8424. return scope.path.get("body").get("body")[0];
  8425. } else {
  8426. return this.getNextScopeAttachmentParent();
  8427. }
  8428. } else if (scope.path.isProgram()) {
  8429. return this.getNextScopeAttachmentParent();
  8430. }
  8431. };
  8432. PathHoister.prototype.getNextScopeAttachmentParent = function getNextScopeAttachmentParent() {
  8433. var scope = this.scopes.pop();
  8434. if (scope) return this.getAttachmentParentForPath(scope.path);
  8435. };
  8436. PathHoister.prototype.getAttachmentParentForPath = function getAttachmentParentForPath(path) {
  8437. do {
  8438. if (!path.parentPath || Array.isArray(path.container) && path.isStatement() || path.isVariableDeclarator() && path.parentPath.node !== null && path.parentPath.node.declarations.length > 1) return path;
  8439. } while (path = path.parentPath);
  8440. };
  8441. PathHoister.prototype.hasOwnParamBindings = function hasOwnParamBindings(scope) {
  8442. for (var name in this.bindings) {
  8443. if (!scope.hasOwnBinding(name)) continue;
  8444. var binding = this.bindings[name];
  8445. if (binding.kind === "param" && binding.constant) return true;
  8446. }
  8447. return false;
  8448. };
  8449. PathHoister.prototype.run = function run() {
  8450. var node = this.path.node;
  8451. if (node._hoisted) return;
  8452. node._hoisted = true;
  8453. this.path.traverse(referenceVisitor, this);
  8454. this.getCompatibleScopes();
  8455. var attachTo = this.getAttachmentPath();
  8456. if (!attachTo) return;
  8457. if (attachTo.getFunctionParent() === this.path.getFunctionParent()) return;
  8458. var uid = attachTo.scope.generateUidIdentifier("ref");
  8459. var declarator = t.variableDeclarator(uid, this.path.node);
  8460. var insertFn = this.attachAfter ? "insertAfter" : "insertBefore";
  8461. attachTo[insertFn]([attachTo.isVariableDeclarator() ? declarator : t.variableDeclaration("var", [declarator])]);
  8462. var parent = this.path.parentPath;
  8463. if (parent.isJSXElement() && this.path.container === parent.node.children) {
  8464. uid = t.JSXExpressionContainer(uid);
  8465. }
  8466. this.path.replaceWith(uid);
  8467. };
  8468. return PathHoister;
  8469. }();
  8470. exports.default = PathHoister;
  8471. module.exports = exports["default"];
  8472. },{"babel-runtime/core-js/get-iterator":56,"babel-runtime/helpers/classCallCheck":70,"babel-types":112}],92:[function(require,module,exports){
  8473. "use strict";
  8474. exports.__esModule = true;
  8475. var hooks = exports.hooks = [function (self, parent) {
  8476. var removeParent = self.key === "test" && (parent.isWhile() || parent.isSwitchCase()) || self.key === "declaration" && parent.isExportDeclaration() || self.key === "body" && parent.isLabeledStatement() || self.listKey === "declarations" && parent.isVariableDeclaration() && parent.node.declarations.length === 1 || self.key === "expression" && parent.isExpressionStatement();
  8477. if (removeParent) {
  8478. parent.remove();
  8479. return true;
  8480. }
  8481. }, function (self, parent) {
  8482. if (parent.isSequenceExpression() && parent.node.expressions.length === 1) {
  8483. parent.replaceWith(parent.node.expressions[0]);
  8484. return true;
  8485. }
  8486. }, function (self, parent) {
  8487. if (parent.isBinary()) {
  8488. if (self.key === "left") {
  8489. parent.replaceWith(parent.node.right);
  8490. } else {
  8491. parent.replaceWith(parent.node.left);
  8492. }
  8493. return true;
  8494. }
  8495. }, function (self, parent) {
  8496. if (parent.isIfStatement() && (self.key === "consequent" || self.key === "alternate") || self.key === "body" && (parent.isLoop() || parent.isArrowFunctionExpression())) {
  8497. self.replaceWith({
  8498. type: "BlockStatement",
  8499. body: []
  8500. });
  8501. return true;
  8502. }
  8503. }];
  8504. },{}],93:[function(require,module,exports){
  8505. "use strict";
  8506. exports.__esModule = true;
  8507. exports.Flow = exports.Pure = exports.Generated = exports.User = exports.Var = exports.BlockScoped = exports.Referenced = exports.Scope = exports.Expression = exports.Statement = exports.BindingIdentifier = exports.ReferencedMemberExpression = exports.ReferencedIdentifier = undefined;
  8508. var _babelTypes = require("babel-types");
  8509. var t = _interopRequireWildcard(_babelTypes);
  8510. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  8511. var ReferencedIdentifier = exports.ReferencedIdentifier = {
  8512. types: ["Identifier", "JSXIdentifier"],
  8513. checkPath: function checkPath(_ref, opts) {
  8514. var node = _ref.node,
  8515. parent = _ref.parent;
  8516. if (!t.isIdentifier(node, opts) && !t.isJSXMemberExpression(parent, opts)) {
  8517. if (t.isJSXIdentifier(node, opts)) {
  8518. if (_babelTypes.react.isCompatTag(node.name)) return false;
  8519. } else {
  8520. return false;
  8521. }
  8522. }
  8523. return t.isReferenced(node, parent);
  8524. }
  8525. };
  8526. var ReferencedMemberExpression = exports.ReferencedMemberExpression = {
  8527. types: ["MemberExpression"],
  8528. checkPath: function checkPath(_ref2) {
  8529. var node = _ref2.node,
  8530. parent = _ref2.parent;
  8531. return t.isMemberExpression(node) && t.isReferenced(node, parent);
  8532. }
  8533. };
  8534. var BindingIdentifier = exports.BindingIdentifier = {
  8535. types: ["Identifier"],
  8536. checkPath: function checkPath(_ref3) {
  8537. var node = _ref3.node,
  8538. parent = _ref3.parent;
  8539. return t.isIdentifier(node) && t.isBinding(node, parent);
  8540. }
  8541. };
  8542. var Statement = exports.Statement = {
  8543. types: ["Statement"],
  8544. checkPath: function checkPath(_ref4) {
  8545. var node = _ref4.node,
  8546. parent = _ref4.parent;
  8547. if (t.isStatement(node)) {
  8548. if (t.isVariableDeclaration(node)) {
  8549. if (t.isForXStatement(parent, { left: node })) return false;
  8550. if (t.isForStatement(parent, { init: node })) return false;
  8551. }
  8552. return true;
  8553. } else {
  8554. return false;
  8555. }
  8556. }
  8557. };
  8558. var Expression = exports.Expression = {
  8559. types: ["Expression"],
  8560. checkPath: function checkPath(path) {
  8561. if (path.isIdentifier()) {
  8562. return path.isReferencedIdentifier();
  8563. } else {
  8564. return t.isExpression(path.node);
  8565. }
  8566. }
  8567. };
  8568. var Scope = exports.Scope = {
  8569. types: ["Scopable"],
  8570. checkPath: function checkPath(path) {
  8571. return t.isScope(path.node, path.parent);
  8572. }
  8573. };
  8574. var Referenced = exports.Referenced = {
  8575. checkPath: function checkPath(path) {
  8576. return t.isReferenced(path.node, path.parent);
  8577. }
  8578. };
  8579. var BlockScoped = exports.BlockScoped = {
  8580. checkPath: function checkPath(path) {
  8581. return t.isBlockScoped(path.node);
  8582. }
  8583. };
  8584. var Var = exports.Var = {
  8585. types: ["VariableDeclaration"],
  8586. checkPath: function checkPath(path) {
  8587. return t.isVar(path.node);
  8588. }
  8589. };
  8590. var User = exports.User = {
  8591. checkPath: function checkPath(path) {
  8592. return path.node && !!path.node.loc;
  8593. }
  8594. };
  8595. var Generated = exports.Generated = {
  8596. checkPath: function checkPath(path) {
  8597. return !path.isUser();
  8598. }
  8599. };
  8600. var Pure = exports.Pure = {
  8601. checkPath: function checkPath(path, opts) {
  8602. return path.scope.isPure(path.node, opts);
  8603. }
  8604. };
  8605. var Flow = exports.Flow = {
  8606. types: ["Flow", "ImportDeclaration", "ExportDeclaration", "ImportSpecifier"],
  8607. checkPath: function checkPath(_ref5) {
  8608. var node = _ref5.node;
  8609. if (t.isFlow(node)) {
  8610. return true;
  8611. } else if (t.isImportDeclaration(node)) {
  8612. return node.importKind === "type" || node.importKind === "typeof";
  8613. } else if (t.isExportDeclaration(node)) {
  8614. return node.exportKind === "type";
  8615. } else if (t.isImportSpecifier(node)) {
  8616. return node.importKind === "type" || node.importKind === "typeof";
  8617. } else {
  8618. return false;
  8619. }
  8620. }
  8621. };
  8622. },{"babel-types":112}],94:[function(require,module,exports){
  8623. "use strict";
  8624. exports.__esModule = true;
  8625. var _typeof2 = require("babel-runtime/helpers/typeof");
  8626. var _typeof3 = _interopRequireDefault(_typeof2);
  8627. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  8628. var _getIterator3 = _interopRequireDefault(_getIterator2);
  8629. exports.insertBefore = insertBefore;
  8630. exports._containerInsert = _containerInsert;
  8631. exports._containerInsertBefore = _containerInsertBefore;
  8632. exports._containerInsertAfter = _containerInsertAfter;
  8633. exports._maybePopFromStatements = _maybePopFromStatements;
  8634. exports.insertAfter = insertAfter;
  8635. exports.updateSiblingKeys = updateSiblingKeys;
  8636. exports._verifyNodeList = _verifyNodeList;
  8637. exports.unshiftContainer = unshiftContainer;
  8638. exports.pushContainer = pushContainer;
  8639. exports.hoist = hoist;
  8640. var _cache = require("../cache");
  8641. var _hoister = require("./lib/hoister");
  8642. var _hoister2 = _interopRequireDefault(_hoister);
  8643. var _index = require("./index");
  8644. var _index2 = _interopRequireDefault(_index);
  8645. var _babelTypes = require("babel-types");
  8646. var t = _interopRequireWildcard(_babelTypes);
  8647. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  8648. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8649. function insertBefore(nodes) {
  8650. this._assertUnremoved();
  8651. nodes = this._verifyNodeList(nodes);
  8652. if (this.parentPath.isExpressionStatement() || this.parentPath.isLabeledStatement()) {
  8653. return this.parentPath.insertBefore(nodes);
  8654. } else if (this.isNodeType("Expression") || this.parentPath.isForStatement() && this.key === "init") {
  8655. if (this.node) nodes.push(this.node);
  8656. this.replaceExpressionWithStatements(nodes);
  8657. } else {
  8658. this._maybePopFromStatements(nodes);
  8659. if (Array.isArray(this.container)) {
  8660. return this._containerInsertBefore(nodes);
  8661. } else if (this.isStatementOrBlock()) {
  8662. if (this.node) nodes.push(this.node);
  8663. this._replaceWith(t.blockStatement(nodes));
  8664. } else {
  8665. throw new Error("We don't know what to do with this node type. " + "We were previously a Statement but we can't fit in here?");
  8666. }
  8667. }
  8668. return [this];
  8669. }
  8670. function _containerInsert(from, nodes) {
  8671. this.updateSiblingKeys(from, nodes.length);
  8672. var paths = [];
  8673. for (var i = 0; i < nodes.length; i++) {
  8674. var to = from + i;
  8675. var node = nodes[i];
  8676. this.container.splice(to, 0, node);
  8677. if (this.context) {
  8678. var path = this.context.create(this.parent, this.container, to, this.listKey);
  8679. if (this.context.queue) path.pushContext(this.context);
  8680. paths.push(path);
  8681. } else {
  8682. paths.push(_index2.default.get({
  8683. parentPath: this.parentPath,
  8684. parent: this.parent,
  8685. container: this.container,
  8686. listKey: this.listKey,
  8687. key: to
  8688. }));
  8689. }
  8690. }
  8691. var contexts = this._getQueueContexts();
  8692. for (var _iterator = paths, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  8693. var _ref;
  8694. if (_isArray) {
  8695. if (_i >= _iterator.length) break;
  8696. _ref = _iterator[_i++];
  8697. } else {
  8698. _i = _iterator.next();
  8699. if (_i.done) break;
  8700. _ref = _i.value;
  8701. }
  8702. var _path = _ref;
  8703. _path.setScope();
  8704. _path.debug(function () {
  8705. return "Inserted.";
  8706. });
  8707. for (var _iterator2 = contexts, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  8708. var _ref2;
  8709. if (_isArray2) {
  8710. if (_i2 >= _iterator2.length) break;
  8711. _ref2 = _iterator2[_i2++];
  8712. } else {
  8713. _i2 = _iterator2.next();
  8714. if (_i2.done) break;
  8715. _ref2 = _i2.value;
  8716. }
  8717. var context = _ref2;
  8718. context.maybeQueue(_path, true);
  8719. }
  8720. }
  8721. return paths;
  8722. }
  8723. function _containerInsertBefore(nodes) {
  8724. return this._containerInsert(this.key, nodes);
  8725. }
  8726. function _containerInsertAfter(nodes) {
  8727. return this._containerInsert(this.key + 1, nodes);
  8728. }
  8729. function _maybePopFromStatements(nodes) {
  8730. var last = nodes[nodes.length - 1];
  8731. var isIdentifier = t.isIdentifier(last) || t.isExpressionStatement(last) && t.isIdentifier(last.expression);
  8732. if (isIdentifier && !this.isCompletionRecord()) {
  8733. nodes.pop();
  8734. }
  8735. }
  8736. function insertAfter(nodes) {
  8737. this._assertUnremoved();
  8738. nodes = this._verifyNodeList(nodes);
  8739. if (this.parentPath.isExpressionStatement() || this.parentPath.isLabeledStatement()) {
  8740. return this.parentPath.insertAfter(nodes);
  8741. } else if (this.isNodeType("Expression") || this.parentPath.isForStatement() && this.key === "init") {
  8742. if (this.node) {
  8743. var temp = this.scope.generateDeclaredUidIdentifier();
  8744. nodes.unshift(t.expressionStatement(t.assignmentExpression("=", temp, this.node)));
  8745. nodes.push(t.expressionStatement(temp));
  8746. }
  8747. this.replaceExpressionWithStatements(nodes);
  8748. } else {
  8749. this._maybePopFromStatements(nodes);
  8750. if (Array.isArray(this.container)) {
  8751. return this._containerInsertAfter(nodes);
  8752. } else if (this.isStatementOrBlock()) {
  8753. if (this.node) nodes.unshift(this.node);
  8754. this._replaceWith(t.blockStatement(nodes));
  8755. } else {
  8756. throw new Error("We don't know what to do with this node type. " + "We were previously a Statement but we can't fit in here?");
  8757. }
  8758. }
  8759. return [this];
  8760. }
  8761. function updateSiblingKeys(fromIndex, incrementBy) {
  8762. if (!this.parent) return;
  8763. var paths = _cache.path.get(this.parent);
  8764. for (var i = 0; i < paths.length; i++) {
  8765. var path = paths[i];
  8766. if (path.key >= fromIndex) {
  8767. path.key += incrementBy;
  8768. }
  8769. }
  8770. }
  8771. function _verifyNodeList(nodes) {
  8772. if (!nodes) {
  8773. return [];
  8774. }
  8775. if (nodes.constructor !== Array) {
  8776. nodes = [nodes];
  8777. }
  8778. for (var i = 0; i < nodes.length; i++) {
  8779. var node = nodes[i];
  8780. var msg = void 0;
  8781. if (!node) {
  8782. msg = "has falsy node";
  8783. } else if ((typeof node === "undefined" ? "undefined" : (0, _typeof3.default)(node)) !== "object") {
  8784. msg = "contains a non-object node";
  8785. } else if (!node.type) {
  8786. msg = "without a type";
  8787. } else if (node instanceof _index2.default) {
  8788. msg = "has a NodePath when it expected a raw object";
  8789. }
  8790. if (msg) {
  8791. var type = Array.isArray(node) ? "array" : typeof node === "undefined" ? "undefined" : (0, _typeof3.default)(node);
  8792. throw new Error("Node list " + msg + " with the index of " + i + " and type of " + type);
  8793. }
  8794. }
  8795. return nodes;
  8796. }
  8797. function unshiftContainer(listKey, nodes) {
  8798. this._assertUnremoved();
  8799. nodes = this._verifyNodeList(nodes);
  8800. var path = _index2.default.get({
  8801. parentPath: this,
  8802. parent: this.node,
  8803. container: this.node[listKey],
  8804. listKey: listKey,
  8805. key: 0
  8806. });
  8807. return path.insertBefore(nodes);
  8808. }
  8809. function pushContainer(listKey, nodes) {
  8810. this._assertUnremoved();
  8811. nodes = this._verifyNodeList(nodes);
  8812. var container = this.node[listKey];
  8813. var path = _index2.default.get({
  8814. parentPath: this,
  8815. parent: this.node,
  8816. container: container,
  8817. listKey: listKey,
  8818. key: container.length
  8819. });
  8820. return path.replaceWithMultiple(nodes);
  8821. }
  8822. function hoist() {
  8823. var scope = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.scope;
  8824. var hoister = new _hoister2.default(this, scope);
  8825. return hoister.run();
  8826. }
  8827. },{"../cache":76,"./index":86,"./lib/hoister":91,"babel-runtime/core-js/get-iterator":56,"babel-runtime/helpers/typeof":74,"babel-types":112}],95:[function(require,module,exports){
  8828. "use strict";
  8829. exports.__esModule = true;
  8830. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  8831. var _getIterator3 = _interopRequireDefault(_getIterator2);
  8832. exports.remove = remove;
  8833. exports._callRemovalHooks = _callRemovalHooks;
  8834. exports._remove = _remove;
  8835. exports._markRemoved = _markRemoved;
  8836. exports._assertUnremoved = _assertUnremoved;
  8837. var _removalHooks = require("./lib/removal-hooks");
  8838. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8839. function remove() {
  8840. this._assertUnremoved();
  8841. this.resync();
  8842. if (this._callRemovalHooks()) {
  8843. this._markRemoved();
  8844. return;
  8845. }
  8846. this.shareCommentsWithSiblings();
  8847. this._remove();
  8848. this._markRemoved();
  8849. }
  8850. function _callRemovalHooks() {
  8851. for (var _iterator = _removalHooks.hooks, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  8852. var _ref;
  8853. if (_isArray) {
  8854. if (_i >= _iterator.length) break;
  8855. _ref = _iterator[_i++];
  8856. } else {
  8857. _i = _iterator.next();
  8858. if (_i.done) break;
  8859. _ref = _i.value;
  8860. }
  8861. var fn = _ref;
  8862. if (fn(this, this.parentPath)) return true;
  8863. }
  8864. }
  8865. function _remove() {
  8866. if (Array.isArray(this.container)) {
  8867. this.container.splice(this.key, 1);
  8868. this.updateSiblingKeys(this.key, -1);
  8869. } else {
  8870. this._replaceWith(null);
  8871. }
  8872. }
  8873. function _markRemoved() {
  8874. this.shouldSkip = true;
  8875. this.removed = true;
  8876. this.node = null;
  8877. }
  8878. function _assertUnremoved() {
  8879. if (this.removed) {
  8880. throw this.buildCodeFrameError("NodePath has been removed so is read-only.");
  8881. }
  8882. }
  8883. },{"./lib/removal-hooks":92,"babel-runtime/core-js/get-iterator":56}],96:[function(require,module,exports){
  8884. "use strict";
  8885. exports.__esModule = true;
  8886. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  8887. var _getIterator3 = _interopRequireDefault(_getIterator2);
  8888. exports.replaceWithMultiple = replaceWithMultiple;
  8889. exports.replaceWithSourceString = replaceWithSourceString;
  8890. exports.replaceWith = replaceWith;
  8891. exports._replaceWith = _replaceWith;
  8892. exports.replaceExpressionWithStatements = replaceExpressionWithStatements;
  8893. exports.replaceInline = replaceInline;
  8894. var _babelCodeFrame = require("babel-code-frame");
  8895. var _babelCodeFrame2 = _interopRequireDefault(_babelCodeFrame);
  8896. var _index = require("../index");
  8897. var _index2 = _interopRequireDefault(_index);
  8898. var _index3 = require("./index");
  8899. var _index4 = _interopRequireDefault(_index3);
  8900. var _babylon = require("babylon");
  8901. var _babelTypes = require("babel-types");
  8902. var t = _interopRequireWildcard(_babelTypes);
  8903. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  8904. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8905. var hoistVariablesVisitor = {
  8906. Function: function Function(path) {
  8907. path.skip();
  8908. },
  8909. VariableDeclaration: function VariableDeclaration(path) {
  8910. if (path.node.kind !== "var") return;
  8911. var bindings = path.getBindingIdentifiers();
  8912. for (var key in bindings) {
  8913. path.scope.push({ id: bindings[key] });
  8914. }
  8915. var exprs = [];
  8916. for (var _iterator = path.node.declarations, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  8917. var _ref;
  8918. if (_isArray) {
  8919. if (_i >= _iterator.length) break;
  8920. _ref = _iterator[_i++];
  8921. } else {
  8922. _i = _iterator.next();
  8923. if (_i.done) break;
  8924. _ref = _i.value;
  8925. }
  8926. var declar = _ref;
  8927. if (declar.init) {
  8928. exprs.push(t.expressionStatement(t.assignmentExpression("=", declar.id, declar.init)));
  8929. }
  8930. }
  8931. path.replaceWithMultiple(exprs);
  8932. }
  8933. };
  8934. function replaceWithMultiple(nodes) {
  8935. this.resync();
  8936. nodes = this._verifyNodeList(nodes);
  8937. t.inheritLeadingComments(nodes[0], this.node);
  8938. t.inheritTrailingComments(nodes[nodes.length - 1], this.node);
  8939. this.node = this.container[this.key] = null;
  8940. this.insertAfter(nodes);
  8941. if (this.node) {
  8942. this.requeue();
  8943. } else {
  8944. this.remove();
  8945. }
  8946. }
  8947. function replaceWithSourceString(replacement) {
  8948. this.resync();
  8949. try {
  8950. replacement = "(" + replacement + ")";
  8951. replacement = (0, _babylon.parse)(replacement);
  8952. } catch (err) {
  8953. var loc = err.loc;
  8954. if (loc) {
  8955. err.message += " - make sure this is an expression.";
  8956. err.message += "\n" + (0, _babelCodeFrame2.default)(replacement, loc.line, loc.column + 1);
  8957. }
  8958. throw err;
  8959. }
  8960. replacement = replacement.program.body[0].expression;
  8961. _index2.default.removeProperties(replacement);
  8962. return this.replaceWith(replacement);
  8963. }
  8964. function replaceWith(replacement) {
  8965. this.resync();
  8966. if (this.removed) {
  8967. throw new Error("You can't replace this node, we've already removed it");
  8968. }
  8969. if (replacement instanceof _index4.default) {
  8970. replacement = replacement.node;
  8971. }
  8972. if (!replacement) {
  8973. throw new Error("You passed `path.replaceWith()` a falsy node, use `path.remove()` instead");
  8974. }
  8975. if (this.node === replacement) {
  8976. return;
  8977. }
  8978. if (this.isProgram() && !t.isProgram(replacement)) {
  8979. throw new Error("You can only replace a Program root node with another Program node");
  8980. }
  8981. if (Array.isArray(replacement)) {
  8982. throw new Error("Don't use `path.replaceWith()` with an array of nodes, use `path.replaceWithMultiple()`");
  8983. }
  8984. if (typeof replacement === "string") {
  8985. throw new Error("Don't use `path.replaceWith()` with a source string, use `path.replaceWithSourceString()`");
  8986. }
  8987. if (this.isNodeType("Statement") && t.isExpression(replacement)) {
  8988. if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement)) {
  8989. replacement = t.expressionStatement(replacement);
  8990. }
  8991. }
  8992. if (this.isNodeType("Expression") && t.isStatement(replacement)) {
  8993. if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement)) {
  8994. return this.replaceExpressionWithStatements([replacement]);
  8995. }
  8996. }
  8997. var oldNode = this.node;
  8998. if (oldNode) {
  8999. t.inheritsComments(replacement, oldNode);
  9000. t.removeComments(oldNode);
  9001. }
  9002. this._replaceWith(replacement);
  9003. this.type = replacement.type;
  9004. this.setScope();
  9005. this.requeue();
  9006. }
  9007. function _replaceWith(node) {
  9008. if (!this.container) {
  9009. throw new ReferenceError("Container is falsy");
  9010. }
  9011. if (this.inList) {
  9012. t.validate(this.parent, this.key, [node]);
  9013. } else {
  9014. t.validate(this.parent, this.key, node);
  9015. }
  9016. this.debug(function () {
  9017. return "Replace with " + (node && node.type);
  9018. });
  9019. this.node = this.container[this.key] = node;
  9020. }
  9021. function replaceExpressionWithStatements(nodes) {
  9022. this.resync();
  9023. var toSequenceExpression = t.toSequenceExpression(nodes, this.scope);
  9024. if (t.isSequenceExpression(toSequenceExpression)) {
  9025. var exprs = toSequenceExpression.expressions;
  9026. if (exprs.length >= 2 && this.parentPath.isExpressionStatement()) {
  9027. this._maybePopFromStatements(exprs);
  9028. }
  9029. if (exprs.length === 1) {
  9030. this.replaceWith(exprs[0]);
  9031. } else {
  9032. this.replaceWith(toSequenceExpression);
  9033. }
  9034. } else if (toSequenceExpression) {
  9035. this.replaceWith(toSequenceExpression);
  9036. } else {
  9037. var container = t.functionExpression(null, [], t.blockStatement(nodes));
  9038. container.shadow = true;
  9039. this.replaceWith(t.callExpression(container, []));
  9040. this.traverse(hoistVariablesVisitor);
  9041. var completionRecords = this.get("callee").getCompletionRecords();
  9042. for (var _iterator2 = completionRecords, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  9043. var _ref2;
  9044. if (_isArray2) {
  9045. if (_i2 >= _iterator2.length) break;
  9046. _ref2 = _iterator2[_i2++];
  9047. } else {
  9048. _i2 = _iterator2.next();
  9049. if (_i2.done) break;
  9050. _ref2 = _i2.value;
  9051. }
  9052. var path = _ref2;
  9053. if (!path.isExpressionStatement()) continue;
  9054. var loop = path.findParent(function (path) {
  9055. return path.isLoop();
  9056. });
  9057. if (loop) {
  9058. var uid = loop.getData("expressionReplacementReturnUid");
  9059. if (!uid) {
  9060. var callee = this.get("callee");
  9061. uid = callee.scope.generateDeclaredUidIdentifier("ret");
  9062. callee.get("body").pushContainer("body", t.returnStatement(uid));
  9063. loop.setData("expressionReplacementReturnUid", uid);
  9064. } else {
  9065. uid = t.identifier(uid.name);
  9066. }
  9067. path.get("expression").replaceWith(t.assignmentExpression("=", uid, path.node.expression));
  9068. } else {
  9069. path.replaceWith(t.returnStatement(path.node.expression));
  9070. }
  9071. }
  9072. return this.node;
  9073. }
  9074. }
  9075. function replaceInline(nodes) {
  9076. this.resync();
  9077. if (Array.isArray(nodes)) {
  9078. if (Array.isArray(this.container)) {
  9079. nodes = this._verifyNodeList(nodes);
  9080. this._containerInsertAfter(nodes);
  9081. return this.remove();
  9082. } else {
  9083. return this.replaceWithMultiple(nodes);
  9084. }
  9085. } else {
  9086. return this.replaceWith(nodes);
  9087. }
  9088. }
  9089. },{"../index":79,"./index":86,"babel-code-frame":3,"babel-runtime/core-js/get-iterator":56,"babel-types":112,"babylon":116}],97:[function(require,module,exports){
  9090. "use strict";
  9091. exports.__esModule = true;
  9092. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  9093. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  9094. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9095. var Binding = function () {
  9096. function Binding(_ref) {
  9097. var existing = _ref.existing,
  9098. identifier = _ref.identifier,
  9099. scope = _ref.scope,
  9100. path = _ref.path,
  9101. kind = _ref.kind;
  9102. (0, _classCallCheck3.default)(this, Binding);
  9103. this.identifier = identifier;
  9104. this.scope = scope;
  9105. this.path = path;
  9106. this.kind = kind;
  9107. this.constantViolations = [];
  9108. this.constant = true;
  9109. this.referencePaths = [];
  9110. this.referenced = false;
  9111. this.references = 0;
  9112. this.clearValue();
  9113. if (existing) {
  9114. this.constantViolations = [].concat(existing.path, existing.constantViolations, this.constantViolations);
  9115. }
  9116. }
  9117. Binding.prototype.deoptValue = function deoptValue() {
  9118. this.clearValue();
  9119. this.hasDeoptedValue = true;
  9120. };
  9121. Binding.prototype.setValue = function setValue(value) {
  9122. if (this.hasDeoptedValue) return;
  9123. this.hasValue = true;
  9124. this.value = value;
  9125. };
  9126. Binding.prototype.clearValue = function clearValue() {
  9127. this.hasDeoptedValue = false;
  9128. this.hasValue = false;
  9129. this.value = null;
  9130. };
  9131. Binding.prototype.reassign = function reassign(path) {
  9132. this.constant = false;
  9133. if (this.constantViolations.indexOf(path) !== -1) {
  9134. return;
  9135. }
  9136. this.constantViolations.push(path);
  9137. };
  9138. Binding.prototype.reference = function reference(path) {
  9139. if (this.referencePaths.indexOf(path) !== -1) {
  9140. return;
  9141. }
  9142. this.referenced = true;
  9143. this.references++;
  9144. this.referencePaths.push(path);
  9145. };
  9146. Binding.prototype.dereference = function dereference() {
  9147. this.references--;
  9148. this.referenced = !!this.references;
  9149. };
  9150. return Binding;
  9151. }();
  9152. exports.default = Binding;
  9153. module.exports = exports["default"];
  9154. },{"babel-runtime/helpers/classCallCheck":70}],98:[function(require,module,exports){
  9155. "use strict";
  9156. exports.__esModule = true;
  9157. var _keys = require("babel-runtime/core-js/object/keys");
  9158. var _keys2 = _interopRequireDefault(_keys);
  9159. var _create = require("babel-runtime/core-js/object/create");
  9160. var _create2 = _interopRequireDefault(_create);
  9161. var _map = require("babel-runtime/core-js/map");
  9162. var _map2 = _interopRequireDefault(_map);
  9163. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  9164. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  9165. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  9166. var _getIterator3 = _interopRequireDefault(_getIterator2);
  9167. var _includes = require("lodash/includes");
  9168. var _includes2 = _interopRequireDefault(_includes);
  9169. var _repeat = require("lodash/repeat");
  9170. var _repeat2 = _interopRequireDefault(_repeat);
  9171. var _renamer = require("./lib/renamer");
  9172. var _renamer2 = _interopRequireDefault(_renamer);
  9173. var _index = require("../index");
  9174. var _index2 = _interopRequireDefault(_index);
  9175. var _defaults = require("lodash/defaults");
  9176. var _defaults2 = _interopRequireDefault(_defaults);
  9177. var _babelMessages = require("babel-messages");
  9178. var messages = _interopRequireWildcard(_babelMessages);
  9179. var _binding2 = require("./binding");
  9180. var _binding3 = _interopRequireDefault(_binding2);
  9181. var _globals = require("globals");
  9182. var _globals2 = _interopRequireDefault(_globals);
  9183. var _babelTypes = require("babel-types");
  9184. var t = _interopRequireWildcard(_babelTypes);
  9185. var _cache = require("../cache");
  9186. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  9187. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9188. var _crawlCallsCount = 0;
  9189. function getCache(path, parentScope, self) {
  9190. var scopes = _cache.scope.get(path.node) || [];
  9191. for (var _iterator = scopes, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  9192. var _ref;
  9193. if (_isArray) {
  9194. if (_i >= _iterator.length) break;
  9195. _ref = _iterator[_i++];
  9196. } else {
  9197. _i = _iterator.next();
  9198. if (_i.done) break;
  9199. _ref = _i.value;
  9200. }
  9201. var scope = _ref;
  9202. if (scope.parent === parentScope && scope.path === path) return scope;
  9203. }
  9204. scopes.push(self);
  9205. if (!_cache.scope.has(path.node)) {
  9206. _cache.scope.set(path.node, scopes);
  9207. }
  9208. }
  9209. function gatherNodeParts(node, parts) {
  9210. if (t.isModuleDeclaration(node)) {
  9211. if (node.source) {
  9212. gatherNodeParts(node.source, parts);
  9213. } else if (node.specifiers && node.specifiers.length) {
  9214. for (var _iterator2 = node.specifiers, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  9215. var _ref2;
  9216. if (_isArray2) {
  9217. if (_i2 >= _iterator2.length) break;
  9218. _ref2 = _iterator2[_i2++];
  9219. } else {
  9220. _i2 = _iterator2.next();
  9221. if (_i2.done) break;
  9222. _ref2 = _i2.value;
  9223. }
  9224. var specifier = _ref2;
  9225. gatherNodeParts(specifier, parts);
  9226. }
  9227. } else if (node.declaration) {
  9228. gatherNodeParts(node.declaration, parts);
  9229. }
  9230. } else if (t.isModuleSpecifier(node)) {
  9231. gatherNodeParts(node.local, parts);
  9232. } else if (t.isMemberExpression(node)) {
  9233. gatherNodeParts(node.object, parts);
  9234. gatherNodeParts(node.property, parts);
  9235. } else if (t.isIdentifier(node)) {
  9236. parts.push(node.name);
  9237. } else if (t.isLiteral(node)) {
  9238. parts.push(node.value);
  9239. } else if (t.isCallExpression(node)) {
  9240. gatherNodeParts(node.callee, parts);
  9241. } else if (t.isObjectExpression(node) || t.isObjectPattern(node)) {
  9242. for (var _iterator3 = node.properties, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) {
  9243. var _ref3;
  9244. if (_isArray3) {
  9245. if (_i3 >= _iterator3.length) break;
  9246. _ref3 = _iterator3[_i3++];
  9247. } else {
  9248. _i3 = _iterator3.next();
  9249. if (_i3.done) break;
  9250. _ref3 = _i3.value;
  9251. }
  9252. var prop = _ref3;
  9253. gatherNodeParts(prop.key || prop.argument, parts);
  9254. }
  9255. }
  9256. }
  9257. var collectorVisitor = {
  9258. For: function For(path) {
  9259. for (var _iterator4 = t.FOR_INIT_KEYS, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) {
  9260. var _ref4;
  9261. if (_isArray4) {
  9262. if (_i4 >= _iterator4.length) break;
  9263. _ref4 = _iterator4[_i4++];
  9264. } else {
  9265. _i4 = _iterator4.next();
  9266. if (_i4.done) break;
  9267. _ref4 = _i4.value;
  9268. }
  9269. var key = _ref4;
  9270. var declar = path.get(key);
  9271. if (declar.isVar()) path.scope.getFunctionParent().registerBinding("var", declar);
  9272. }
  9273. },
  9274. Declaration: function Declaration(path) {
  9275. if (path.isBlockScoped()) return;
  9276. if (path.isExportDeclaration() && path.get("declaration").isDeclaration()) return;
  9277. path.scope.getFunctionParent().registerDeclaration(path);
  9278. },
  9279. ReferencedIdentifier: function ReferencedIdentifier(path, state) {
  9280. state.references.push(path);
  9281. },
  9282. ForXStatement: function ForXStatement(path, state) {
  9283. var left = path.get("left");
  9284. if (left.isPattern() || left.isIdentifier()) {
  9285. state.constantViolations.push(left);
  9286. }
  9287. },
  9288. ExportDeclaration: {
  9289. exit: function exit(path) {
  9290. var node = path.node,
  9291. scope = path.scope;
  9292. var declar = node.declaration;
  9293. if (t.isClassDeclaration(declar) || t.isFunctionDeclaration(declar)) {
  9294. var _id = declar.id;
  9295. if (!_id) return;
  9296. var binding = scope.getBinding(_id.name);
  9297. if (binding) binding.reference(path);
  9298. } else if (t.isVariableDeclaration(declar)) {
  9299. for (var _iterator5 = declar.declarations, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : (0, _getIterator3.default)(_iterator5);;) {
  9300. var _ref5;
  9301. if (_isArray5) {
  9302. if (_i5 >= _iterator5.length) break;
  9303. _ref5 = _iterator5[_i5++];
  9304. } else {
  9305. _i5 = _iterator5.next();
  9306. if (_i5.done) break;
  9307. _ref5 = _i5.value;
  9308. }
  9309. var decl = _ref5;
  9310. var ids = t.getBindingIdentifiers(decl);
  9311. for (var name in ids) {
  9312. var _binding = scope.getBinding(name);
  9313. if (_binding) _binding.reference(path);
  9314. }
  9315. }
  9316. }
  9317. }
  9318. },
  9319. LabeledStatement: function LabeledStatement(path) {
  9320. path.scope.getProgramParent().addGlobal(path.node);
  9321. path.scope.getBlockParent().registerDeclaration(path);
  9322. },
  9323. AssignmentExpression: function AssignmentExpression(path, state) {
  9324. state.assignments.push(path);
  9325. },
  9326. UpdateExpression: function UpdateExpression(path, state) {
  9327. state.constantViolations.push(path.get("argument"));
  9328. },
  9329. UnaryExpression: function UnaryExpression(path, state) {
  9330. if (path.node.operator === "delete") {
  9331. state.constantViolations.push(path.get("argument"));
  9332. }
  9333. },
  9334. BlockScoped: function BlockScoped(path) {
  9335. var scope = path.scope;
  9336. if (scope.path === path) scope = scope.parent;
  9337. scope.getBlockParent().registerDeclaration(path);
  9338. },
  9339. ClassDeclaration: function ClassDeclaration(path) {
  9340. var id = path.node.id;
  9341. if (!id) return;
  9342. var name = id.name;
  9343. path.scope.bindings[name] = path.scope.getBinding(name);
  9344. },
  9345. Block: function Block(path) {
  9346. var paths = path.get("body");
  9347. for (var _iterator6 = paths, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : (0, _getIterator3.default)(_iterator6);;) {
  9348. var _ref6;
  9349. if (_isArray6) {
  9350. if (_i6 >= _iterator6.length) break;
  9351. _ref6 = _iterator6[_i6++];
  9352. } else {
  9353. _i6 = _iterator6.next();
  9354. if (_i6.done) break;
  9355. _ref6 = _i6.value;
  9356. }
  9357. var bodyPath = _ref6;
  9358. if (bodyPath.isFunctionDeclaration()) {
  9359. path.scope.getBlockParent().registerDeclaration(bodyPath);
  9360. }
  9361. }
  9362. }
  9363. };
  9364. var uid = 0;
  9365. var Scope = function () {
  9366. function Scope(path, parentScope) {
  9367. (0, _classCallCheck3.default)(this, Scope);
  9368. if (parentScope && parentScope.block === path.node) {
  9369. return parentScope;
  9370. }
  9371. var cached = getCache(path, parentScope, this);
  9372. if (cached) return cached;
  9373. this.uid = uid++;
  9374. this.parent = parentScope;
  9375. this.hub = path.hub;
  9376. this.parentBlock = path.parent;
  9377. this.block = path.node;
  9378. this.path = path;
  9379. this.labels = new _map2.default();
  9380. }
  9381. Scope.prototype.traverse = function traverse(node, opts, state) {
  9382. (0, _index2.default)(node, opts, this, state, this.path);
  9383. };
  9384. Scope.prototype.generateDeclaredUidIdentifier = function generateDeclaredUidIdentifier() {
  9385. var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "temp";
  9386. var id = this.generateUidIdentifier(name);
  9387. this.push({ id: id });
  9388. return id;
  9389. };
  9390. Scope.prototype.generateUidIdentifier = function generateUidIdentifier() {
  9391. var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "temp";
  9392. return t.identifier(this.generateUid(name));
  9393. };
  9394. Scope.prototype.generateUid = function generateUid() {
  9395. var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "temp";
  9396. name = t.toIdentifier(name).replace(/^_+/, "").replace(/[0-9]+$/g, "");
  9397. var uid = void 0;
  9398. var i = 0;
  9399. do {
  9400. uid = this._generateUid(name, i);
  9401. i++;
  9402. } while (this.hasLabel(uid) || this.hasBinding(uid) || this.hasGlobal(uid) || this.hasReference(uid));
  9403. var program = this.getProgramParent();
  9404. program.references[uid] = true;
  9405. program.uids[uid] = true;
  9406. return uid;
  9407. };
  9408. Scope.prototype._generateUid = function _generateUid(name, i) {
  9409. var id = name;
  9410. if (i > 1) id += i;
  9411. return "_" + id;
  9412. };
  9413. Scope.prototype.generateUidIdentifierBasedOnNode = function generateUidIdentifierBasedOnNode(parent, defaultName) {
  9414. var node = parent;
  9415. if (t.isAssignmentExpression(parent)) {
  9416. node = parent.left;
  9417. } else if (t.isVariableDeclarator(parent)) {
  9418. node = parent.id;
  9419. } else if (t.isObjectProperty(node) || t.isObjectMethod(node)) {
  9420. node = node.key;
  9421. }
  9422. var parts = [];
  9423. gatherNodeParts(node, parts);
  9424. var id = parts.join("$");
  9425. id = id.replace(/^_/, "") || defaultName || "ref";
  9426. return this.generateUidIdentifier(id.slice(0, 20));
  9427. };
  9428. Scope.prototype.isStatic = function isStatic(node) {
  9429. if (t.isThisExpression(node) || t.isSuper(node)) {
  9430. return true;
  9431. }
  9432. if (t.isIdentifier(node)) {
  9433. var binding = this.getBinding(node.name);
  9434. if (binding) {
  9435. return binding.constant;
  9436. } else {
  9437. return this.hasBinding(node.name);
  9438. }
  9439. }
  9440. return false;
  9441. };
  9442. Scope.prototype.maybeGenerateMemoised = function maybeGenerateMemoised(node, dontPush) {
  9443. if (this.isStatic(node)) {
  9444. return null;
  9445. } else {
  9446. var _id2 = this.generateUidIdentifierBasedOnNode(node);
  9447. if (!dontPush) this.push({ id: _id2 });
  9448. return _id2;
  9449. }
  9450. };
  9451. Scope.prototype.checkBlockScopedCollisions = function checkBlockScopedCollisions(local, kind, name, id) {
  9452. if (kind === "param") return;
  9453. if (kind === "hoisted" && local.kind === "let") return;
  9454. var duplicate = kind === "let" || local.kind === "let" || local.kind === "const" || local.kind === "module" || local.kind === "param" && (kind === "let" || kind === "const");
  9455. if (duplicate) {
  9456. throw this.hub.file.buildCodeFrameError(id, messages.get("scopeDuplicateDeclaration", name), TypeError);
  9457. }
  9458. };
  9459. Scope.prototype.rename = function rename(oldName, newName, block) {
  9460. var binding = this.getBinding(oldName);
  9461. if (binding) {
  9462. newName = newName || this.generateUidIdentifier(oldName).name;
  9463. return new _renamer2.default(binding, oldName, newName).rename(block);
  9464. }
  9465. };
  9466. Scope.prototype._renameFromMap = function _renameFromMap(map, oldName, newName, value) {
  9467. if (map[oldName]) {
  9468. map[newName] = value;
  9469. map[oldName] = null;
  9470. }
  9471. };
  9472. Scope.prototype.dump = function dump() {
  9473. var sep = (0, _repeat2.default)("-", 60);
  9474. console.log(sep);
  9475. var scope = this;
  9476. do {
  9477. console.log("#", scope.block.type);
  9478. for (var name in scope.bindings) {
  9479. var binding = scope.bindings[name];
  9480. console.log(" -", name, {
  9481. constant: binding.constant,
  9482. references: binding.references,
  9483. violations: binding.constantViolations.length,
  9484. kind: binding.kind
  9485. });
  9486. }
  9487. } while (scope = scope.parent);
  9488. console.log(sep);
  9489. };
  9490. Scope.prototype.toArray = function toArray(node, i) {
  9491. var file = this.hub.file;
  9492. if (t.isIdentifier(node)) {
  9493. var binding = this.getBinding(node.name);
  9494. if (binding && binding.constant && binding.path.isGenericType("Array")) return node;
  9495. }
  9496. if (t.isArrayExpression(node)) {
  9497. return node;
  9498. }
  9499. if (t.isIdentifier(node, { name: "arguments" })) {
  9500. return t.callExpression(t.memberExpression(t.memberExpression(t.memberExpression(t.identifier("Array"), t.identifier("prototype")), t.identifier("slice")), t.identifier("call")), [node]);
  9501. }
  9502. var helperName = "toArray";
  9503. var args = [node];
  9504. if (i === true) {
  9505. helperName = "toConsumableArray";
  9506. } else if (i) {
  9507. args.push(t.numericLiteral(i));
  9508. helperName = "slicedToArray";
  9509. }
  9510. return t.callExpression(file.addHelper(helperName), args);
  9511. };
  9512. Scope.prototype.hasLabel = function hasLabel(name) {
  9513. return !!this.getLabel(name);
  9514. };
  9515. Scope.prototype.getLabel = function getLabel(name) {
  9516. return this.labels.get(name);
  9517. };
  9518. Scope.prototype.registerLabel = function registerLabel(path) {
  9519. this.labels.set(path.node.label.name, path);
  9520. };
  9521. Scope.prototype.registerDeclaration = function registerDeclaration(path) {
  9522. if (path.isLabeledStatement()) {
  9523. this.registerLabel(path);
  9524. } else if (path.isFunctionDeclaration()) {
  9525. this.registerBinding("hoisted", path.get("id"), path);
  9526. } else if (path.isVariableDeclaration()) {
  9527. var declarations = path.get("declarations");
  9528. for (var _iterator7 = declarations, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : (0, _getIterator3.default)(_iterator7);;) {
  9529. var _ref7;
  9530. if (_isArray7) {
  9531. if (_i7 >= _iterator7.length) break;
  9532. _ref7 = _iterator7[_i7++];
  9533. } else {
  9534. _i7 = _iterator7.next();
  9535. if (_i7.done) break;
  9536. _ref7 = _i7.value;
  9537. }
  9538. var declar = _ref7;
  9539. this.registerBinding(path.node.kind, declar);
  9540. }
  9541. } else if (path.isClassDeclaration()) {
  9542. this.registerBinding("let", path);
  9543. } else if (path.isImportDeclaration()) {
  9544. var specifiers = path.get("specifiers");
  9545. for (var _iterator8 = specifiers, _isArray8 = Array.isArray(_iterator8), _i8 = 0, _iterator8 = _isArray8 ? _iterator8 : (0, _getIterator3.default)(_iterator8);;) {
  9546. var _ref8;
  9547. if (_isArray8) {
  9548. if (_i8 >= _iterator8.length) break;
  9549. _ref8 = _iterator8[_i8++];
  9550. } else {
  9551. _i8 = _iterator8.next();
  9552. if (_i8.done) break;
  9553. _ref8 = _i8.value;
  9554. }
  9555. var specifier = _ref8;
  9556. this.registerBinding("module", specifier);
  9557. }
  9558. } else if (path.isExportDeclaration()) {
  9559. var _declar = path.get("declaration");
  9560. if (_declar.isClassDeclaration() || _declar.isFunctionDeclaration() || _declar.isVariableDeclaration()) {
  9561. this.registerDeclaration(_declar);
  9562. }
  9563. } else {
  9564. this.registerBinding("unknown", path);
  9565. }
  9566. };
  9567. Scope.prototype.buildUndefinedNode = function buildUndefinedNode() {
  9568. if (this.hasBinding("undefined")) {
  9569. return t.unaryExpression("void", t.numericLiteral(0), true);
  9570. } else {
  9571. return t.identifier("undefined");
  9572. }
  9573. };
  9574. Scope.prototype.registerConstantViolation = function registerConstantViolation(path) {
  9575. var ids = path.getBindingIdentifiers();
  9576. for (var name in ids) {
  9577. var binding = this.getBinding(name);
  9578. if (binding) binding.reassign(path);
  9579. }
  9580. };
  9581. Scope.prototype.registerBinding = function registerBinding(kind, path) {
  9582. var bindingPath = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : path;
  9583. if (!kind) throw new ReferenceError("no `kind`");
  9584. if (path.isVariableDeclaration()) {
  9585. var declarators = path.get("declarations");
  9586. for (var _iterator9 = declarators, _isArray9 = Array.isArray(_iterator9), _i9 = 0, _iterator9 = _isArray9 ? _iterator9 : (0, _getIterator3.default)(_iterator9);;) {
  9587. var _ref9;
  9588. if (_isArray9) {
  9589. if (_i9 >= _iterator9.length) break;
  9590. _ref9 = _iterator9[_i9++];
  9591. } else {
  9592. _i9 = _iterator9.next();
  9593. if (_i9.done) break;
  9594. _ref9 = _i9.value;
  9595. }
  9596. var declar = _ref9;
  9597. this.registerBinding(kind, declar);
  9598. }
  9599. return;
  9600. }
  9601. var parent = this.getProgramParent();
  9602. var ids = path.getBindingIdentifiers(true);
  9603. for (var name in ids) {
  9604. for (var _iterator10 = ids[name], _isArray10 = Array.isArray(_iterator10), _i10 = 0, _iterator10 = _isArray10 ? _iterator10 : (0, _getIterator3.default)(_iterator10);;) {
  9605. var _ref10;
  9606. if (_isArray10) {
  9607. if (_i10 >= _iterator10.length) break;
  9608. _ref10 = _iterator10[_i10++];
  9609. } else {
  9610. _i10 = _iterator10.next();
  9611. if (_i10.done) break;
  9612. _ref10 = _i10.value;
  9613. }
  9614. var _id3 = _ref10;
  9615. var local = this.getOwnBinding(name);
  9616. if (local) {
  9617. if (local.identifier === _id3) continue;
  9618. this.checkBlockScopedCollisions(local, kind, name, _id3);
  9619. }
  9620. if (local && local.path.isFlow()) local = null;
  9621. parent.references[name] = true;
  9622. this.bindings[name] = new _binding3.default({
  9623. identifier: _id3,
  9624. existing: local,
  9625. scope: this,
  9626. path: bindingPath,
  9627. kind: kind
  9628. });
  9629. }
  9630. }
  9631. };
  9632. Scope.prototype.addGlobal = function addGlobal(node) {
  9633. this.globals[node.name] = node;
  9634. };
  9635. Scope.prototype.hasUid = function hasUid(name) {
  9636. var scope = this;
  9637. do {
  9638. if (scope.uids[name]) return true;
  9639. } while (scope = scope.parent);
  9640. return false;
  9641. };
  9642. Scope.prototype.hasGlobal = function hasGlobal(name) {
  9643. var scope = this;
  9644. do {
  9645. if (scope.globals[name]) return true;
  9646. } while (scope = scope.parent);
  9647. return false;
  9648. };
  9649. Scope.prototype.hasReference = function hasReference(name) {
  9650. var scope = this;
  9651. do {
  9652. if (scope.references[name]) return true;
  9653. } while (scope = scope.parent);
  9654. return false;
  9655. };
  9656. Scope.prototype.isPure = function isPure(node, constantsOnly) {
  9657. if (t.isIdentifier(node)) {
  9658. var binding = this.getBinding(node.name);
  9659. if (!binding) return false;
  9660. if (constantsOnly) return binding.constant;
  9661. return true;
  9662. } else if (t.isClass(node)) {
  9663. if (node.superClass && !this.isPure(node.superClass, constantsOnly)) return false;
  9664. return this.isPure(node.body, constantsOnly);
  9665. } else if (t.isClassBody(node)) {
  9666. for (var _iterator11 = node.body, _isArray11 = Array.isArray(_iterator11), _i11 = 0, _iterator11 = _isArray11 ? _iterator11 : (0, _getIterator3.default)(_iterator11);;) {
  9667. var _ref11;
  9668. if (_isArray11) {
  9669. if (_i11 >= _iterator11.length) break;
  9670. _ref11 = _iterator11[_i11++];
  9671. } else {
  9672. _i11 = _iterator11.next();
  9673. if (_i11.done) break;
  9674. _ref11 = _i11.value;
  9675. }
  9676. var method = _ref11;
  9677. if (!this.isPure(method, constantsOnly)) return false;
  9678. }
  9679. return true;
  9680. } else if (t.isBinary(node)) {
  9681. return this.isPure(node.left, constantsOnly) && this.isPure(node.right, constantsOnly);
  9682. } else if (t.isArrayExpression(node)) {
  9683. for (var _iterator12 = node.elements, _isArray12 = Array.isArray(_iterator12), _i12 = 0, _iterator12 = _isArray12 ? _iterator12 : (0, _getIterator3.default)(_iterator12);;) {
  9684. var _ref12;
  9685. if (_isArray12) {
  9686. if (_i12 >= _iterator12.length) break;
  9687. _ref12 = _iterator12[_i12++];
  9688. } else {
  9689. _i12 = _iterator12.next();
  9690. if (_i12.done) break;
  9691. _ref12 = _i12.value;
  9692. }
  9693. var elem = _ref12;
  9694. if (!this.isPure(elem, constantsOnly)) return false;
  9695. }
  9696. return true;
  9697. } else if (t.isObjectExpression(node)) {
  9698. for (var _iterator13 = node.properties, _isArray13 = Array.isArray(_iterator13), _i13 = 0, _iterator13 = _isArray13 ? _iterator13 : (0, _getIterator3.default)(_iterator13);;) {
  9699. var _ref13;
  9700. if (_isArray13) {
  9701. if (_i13 >= _iterator13.length) break;
  9702. _ref13 = _iterator13[_i13++];
  9703. } else {
  9704. _i13 = _iterator13.next();
  9705. if (_i13.done) break;
  9706. _ref13 = _i13.value;
  9707. }
  9708. var prop = _ref13;
  9709. if (!this.isPure(prop, constantsOnly)) return false;
  9710. }
  9711. return true;
  9712. } else if (t.isClassMethod(node)) {
  9713. if (node.computed && !this.isPure(node.key, constantsOnly)) return false;
  9714. if (node.kind === "get" || node.kind === "set") return false;
  9715. return true;
  9716. } else if (t.isClassProperty(node) || t.isObjectProperty(node)) {
  9717. if (node.computed && !this.isPure(node.key, constantsOnly)) return false;
  9718. return this.isPure(node.value, constantsOnly);
  9719. } else if (t.isUnaryExpression(node)) {
  9720. return this.isPure(node.argument, constantsOnly);
  9721. } else {
  9722. return t.isPureish(node);
  9723. }
  9724. };
  9725. Scope.prototype.setData = function setData(key, val) {
  9726. return this.data[key] = val;
  9727. };
  9728. Scope.prototype.getData = function getData(key) {
  9729. var scope = this;
  9730. do {
  9731. var data = scope.data[key];
  9732. if (data != null) return data;
  9733. } while (scope = scope.parent);
  9734. };
  9735. Scope.prototype.removeData = function removeData(key) {
  9736. var scope = this;
  9737. do {
  9738. var data = scope.data[key];
  9739. if (data != null) scope.data[key] = null;
  9740. } while (scope = scope.parent);
  9741. };
  9742. Scope.prototype.init = function init() {
  9743. if (!this.references) this.crawl();
  9744. };
  9745. Scope.prototype.crawl = function crawl() {
  9746. _crawlCallsCount++;
  9747. this._crawl();
  9748. _crawlCallsCount--;
  9749. };
  9750. Scope.prototype._crawl = function _crawl() {
  9751. var path = this.path;
  9752. this.references = (0, _create2.default)(null);
  9753. this.bindings = (0, _create2.default)(null);
  9754. this.globals = (0, _create2.default)(null);
  9755. this.uids = (0, _create2.default)(null);
  9756. this.data = (0, _create2.default)(null);
  9757. if (path.isLoop()) {
  9758. for (var _iterator14 = t.FOR_INIT_KEYS, _isArray14 = Array.isArray(_iterator14), _i14 = 0, _iterator14 = _isArray14 ? _iterator14 : (0, _getIterator3.default)(_iterator14);;) {
  9759. var _ref14;
  9760. if (_isArray14) {
  9761. if (_i14 >= _iterator14.length) break;
  9762. _ref14 = _iterator14[_i14++];
  9763. } else {
  9764. _i14 = _iterator14.next();
  9765. if (_i14.done) break;
  9766. _ref14 = _i14.value;
  9767. }
  9768. var key = _ref14;
  9769. var node = path.get(key);
  9770. if (node.isBlockScoped()) this.registerBinding(node.node.kind, node);
  9771. }
  9772. }
  9773. if (path.isFunctionExpression() && path.has("id")) {
  9774. if (!path.get("id").node[t.NOT_LOCAL_BINDING]) {
  9775. this.registerBinding("local", path.get("id"), path);
  9776. }
  9777. }
  9778. if (path.isClassExpression() && path.has("id")) {
  9779. if (!path.get("id").node[t.NOT_LOCAL_BINDING]) {
  9780. this.registerBinding("local", path);
  9781. }
  9782. }
  9783. if (path.isFunction()) {
  9784. var params = path.get("params");
  9785. for (var _iterator15 = params, _isArray15 = Array.isArray(_iterator15), _i15 = 0, _iterator15 = _isArray15 ? _iterator15 : (0, _getIterator3.default)(_iterator15);;) {
  9786. var _ref15;
  9787. if (_isArray15) {
  9788. if (_i15 >= _iterator15.length) break;
  9789. _ref15 = _iterator15[_i15++];
  9790. } else {
  9791. _i15 = _iterator15.next();
  9792. if (_i15.done) break;
  9793. _ref15 = _i15.value;
  9794. }
  9795. var param = _ref15;
  9796. this.registerBinding("param", param);
  9797. }
  9798. }
  9799. if (path.isCatchClause()) {
  9800. this.registerBinding("let", path);
  9801. }
  9802. var parent = this.getProgramParent();
  9803. if (parent.crawling) return;
  9804. var state = {
  9805. references: [],
  9806. constantViolations: [],
  9807. assignments: []
  9808. };
  9809. this.crawling = true;
  9810. path.traverse(collectorVisitor, state);
  9811. this.crawling = false;
  9812. for (var _iterator16 = state.assignments, _isArray16 = Array.isArray(_iterator16), _i16 = 0, _iterator16 = _isArray16 ? _iterator16 : (0, _getIterator3.default)(_iterator16);;) {
  9813. var _ref16;
  9814. if (_isArray16) {
  9815. if (_i16 >= _iterator16.length) break;
  9816. _ref16 = _iterator16[_i16++];
  9817. } else {
  9818. _i16 = _iterator16.next();
  9819. if (_i16.done) break;
  9820. _ref16 = _i16.value;
  9821. }
  9822. var _path = _ref16;
  9823. var ids = _path.getBindingIdentifiers();
  9824. var programParent = void 0;
  9825. for (var name in ids) {
  9826. if (_path.scope.getBinding(name)) continue;
  9827. programParent = programParent || _path.scope.getProgramParent();
  9828. programParent.addGlobal(ids[name]);
  9829. }
  9830. _path.scope.registerConstantViolation(_path);
  9831. }
  9832. for (var _iterator17 = state.references, _isArray17 = Array.isArray(_iterator17), _i17 = 0, _iterator17 = _isArray17 ? _iterator17 : (0, _getIterator3.default)(_iterator17);;) {
  9833. var _ref17;
  9834. if (_isArray17) {
  9835. if (_i17 >= _iterator17.length) break;
  9836. _ref17 = _iterator17[_i17++];
  9837. } else {
  9838. _i17 = _iterator17.next();
  9839. if (_i17.done) break;
  9840. _ref17 = _i17.value;
  9841. }
  9842. var ref = _ref17;
  9843. var binding = ref.scope.getBinding(ref.node.name);
  9844. if (binding) {
  9845. binding.reference(ref);
  9846. } else {
  9847. ref.scope.getProgramParent().addGlobal(ref.node);
  9848. }
  9849. }
  9850. for (var _iterator18 = state.constantViolations, _isArray18 = Array.isArray(_iterator18), _i18 = 0, _iterator18 = _isArray18 ? _iterator18 : (0, _getIterator3.default)(_iterator18);;) {
  9851. var _ref18;
  9852. if (_isArray18) {
  9853. if (_i18 >= _iterator18.length) break;
  9854. _ref18 = _iterator18[_i18++];
  9855. } else {
  9856. _i18 = _iterator18.next();
  9857. if (_i18.done) break;
  9858. _ref18 = _i18.value;
  9859. }
  9860. var _path2 = _ref18;
  9861. _path2.scope.registerConstantViolation(_path2);
  9862. }
  9863. };
  9864. Scope.prototype.push = function push(opts) {
  9865. var path = this.path;
  9866. if (!path.isBlockStatement() && !path.isProgram()) {
  9867. path = this.getBlockParent().path;
  9868. }
  9869. if (path.isSwitchStatement()) {
  9870. path = this.getFunctionParent().path;
  9871. }
  9872. if (path.isLoop() || path.isCatchClause() || path.isFunction()) {
  9873. t.ensureBlock(path.node);
  9874. path = path.get("body");
  9875. }
  9876. var unique = opts.unique;
  9877. var kind = opts.kind || "var";
  9878. var blockHoist = opts._blockHoist == null ? 2 : opts._blockHoist;
  9879. var dataKey = "declaration:" + kind + ":" + blockHoist;
  9880. var declarPath = !unique && path.getData(dataKey);
  9881. if (!declarPath) {
  9882. var declar = t.variableDeclaration(kind, []);
  9883. declar._generated = true;
  9884. declar._blockHoist = blockHoist;
  9885. var _path$unshiftContaine = path.unshiftContainer("body", [declar]);
  9886. declarPath = _path$unshiftContaine[0];
  9887. if (!unique) path.setData(dataKey, declarPath);
  9888. }
  9889. var declarator = t.variableDeclarator(opts.id, opts.init);
  9890. declarPath.node.declarations.push(declarator);
  9891. this.registerBinding(kind, declarPath.get("declarations").pop());
  9892. };
  9893. Scope.prototype.getProgramParent = function getProgramParent() {
  9894. var scope = this;
  9895. do {
  9896. if (scope.path.isProgram()) {
  9897. return scope;
  9898. }
  9899. } while (scope = scope.parent);
  9900. throw new Error("We couldn't find a Function or Program...");
  9901. };
  9902. Scope.prototype.getFunctionParent = function getFunctionParent() {
  9903. var scope = this;
  9904. do {
  9905. if (scope.path.isFunctionParent()) {
  9906. return scope;
  9907. }
  9908. } while (scope = scope.parent);
  9909. throw new Error("We couldn't find a Function or Program...");
  9910. };
  9911. Scope.prototype.getBlockParent = function getBlockParent() {
  9912. var scope = this;
  9913. do {
  9914. if (scope.path.isBlockParent()) {
  9915. return scope;
  9916. }
  9917. } while (scope = scope.parent);
  9918. throw new Error("We couldn't find a BlockStatement, For, Switch, Function, Loop or Program...");
  9919. };
  9920. Scope.prototype.getAllBindings = function getAllBindings() {
  9921. var ids = (0, _create2.default)(null);
  9922. var scope = this;
  9923. do {
  9924. (0, _defaults2.default)(ids, scope.bindings);
  9925. scope = scope.parent;
  9926. } while (scope);
  9927. return ids;
  9928. };
  9929. Scope.prototype.getAllBindingsOfKind = function getAllBindingsOfKind() {
  9930. var ids = (0, _create2.default)(null);
  9931. for (var _iterator19 = arguments, _isArray19 = Array.isArray(_iterator19), _i19 = 0, _iterator19 = _isArray19 ? _iterator19 : (0, _getIterator3.default)(_iterator19);;) {
  9932. var _ref19;
  9933. if (_isArray19) {
  9934. if (_i19 >= _iterator19.length) break;
  9935. _ref19 = _iterator19[_i19++];
  9936. } else {
  9937. _i19 = _iterator19.next();
  9938. if (_i19.done) break;
  9939. _ref19 = _i19.value;
  9940. }
  9941. var kind = _ref19;
  9942. var scope = this;
  9943. do {
  9944. for (var name in scope.bindings) {
  9945. var binding = scope.bindings[name];
  9946. if (binding.kind === kind) ids[name] = binding;
  9947. }
  9948. scope = scope.parent;
  9949. } while (scope);
  9950. }
  9951. return ids;
  9952. };
  9953. Scope.prototype.bindingIdentifierEquals = function bindingIdentifierEquals(name, node) {
  9954. return this.getBindingIdentifier(name) === node;
  9955. };
  9956. Scope.prototype.warnOnFlowBinding = function warnOnFlowBinding(binding) {
  9957. if (_crawlCallsCount === 0 && binding && binding.path.isFlow()) {
  9958. console.warn("\n You or one of the Babel plugins you are using are using Flow declarations as bindings.\n Support for this will be removed in version 6.8. To find out the caller, grep for this\n message and change it to a `console.trace()`.\n ");
  9959. }
  9960. return binding;
  9961. };
  9962. Scope.prototype.getBinding = function getBinding(name) {
  9963. var scope = this;
  9964. do {
  9965. var binding = scope.getOwnBinding(name);
  9966. if (binding) return this.warnOnFlowBinding(binding);
  9967. } while (scope = scope.parent);
  9968. };
  9969. Scope.prototype.getOwnBinding = function getOwnBinding(name) {
  9970. return this.warnOnFlowBinding(this.bindings[name]);
  9971. };
  9972. Scope.prototype.getBindingIdentifier = function getBindingIdentifier(name) {
  9973. var info = this.getBinding(name);
  9974. return info && info.identifier;
  9975. };
  9976. Scope.prototype.getOwnBindingIdentifier = function getOwnBindingIdentifier(name) {
  9977. var binding = this.bindings[name];
  9978. return binding && binding.identifier;
  9979. };
  9980. Scope.prototype.hasOwnBinding = function hasOwnBinding(name) {
  9981. return !!this.getOwnBinding(name);
  9982. };
  9983. Scope.prototype.hasBinding = function hasBinding(name, noGlobals) {
  9984. if (!name) return false;
  9985. if (this.hasOwnBinding(name)) return true;
  9986. if (this.parentHasBinding(name, noGlobals)) return true;
  9987. if (this.hasUid(name)) return true;
  9988. if (!noGlobals && (0, _includes2.default)(Scope.globals, name)) return true;
  9989. if (!noGlobals && (0, _includes2.default)(Scope.contextVariables, name)) return true;
  9990. return false;
  9991. };
  9992. Scope.prototype.parentHasBinding = function parentHasBinding(name, noGlobals) {
  9993. return this.parent && this.parent.hasBinding(name, noGlobals);
  9994. };
  9995. Scope.prototype.moveBindingTo = function moveBindingTo(name, scope) {
  9996. var info = this.getBinding(name);
  9997. if (info) {
  9998. info.scope.removeOwnBinding(name);
  9999. info.scope = scope;
  10000. scope.bindings[name] = info;
  10001. }
  10002. };
  10003. Scope.prototype.removeOwnBinding = function removeOwnBinding(name) {
  10004. delete this.bindings[name];
  10005. };
  10006. Scope.prototype.removeBinding = function removeBinding(name) {
  10007. var info = this.getBinding(name);
  10008. if (info) {
  10009. info.scope.removeOwnBinding(name);
  10010. }
  10011. var scope = this;
  10012. do {
  10013. if (scope.uids[name]) {
  10014. scope.uids[name] = false;
  10015. }
  10016. } while (scope = scope.parent);
  10017. };
  10018. return Scope;
  10019. }();
  10020. Scope.globals = (0, _keys2.default)(_globals2.default.builtin);
  10021. Scope.contextVariables = ["arguments", "undefined", "Infinity", "NaN"];
  10022. exports.default = Scope;
  10023. module.exports = exports["default"];
  10024. },{"../cache":76,"../index":79,"./binding":97,"./lib/renamer":99,"babel-messages":53,"babel-runtime/core-js/get-iterator":56,"babel-runtime/core-js/map":58,"babel-runtime/core-js/object/create":61,"babel-runtime/core-js/object/keys":63,"babel-runtime/helpers/classCallCheck":70,"babel-types":112,"globals":242,"lodash/defaults":420,"lodash/includes":431,"lodash/repeat":454}],99:[function(require,module,exports){
  10025. "use strict";
  10026. exports.__esModule = true;
  10027. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  10028. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  10029. var _binding = require("../binding");
  10030. var _binding2 = _interopRequireDefault(_binding);
  10031. var _babelTypes = require("babel-types");
  10032. var t = _interopRequireWildcard(_babelTypes);
  10033. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  10034. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10035. var renameVisitor = {
  10036. ReferencedIdentifier: function ReferencedIdentifier(_ref, state) {
  10037. var node = _ref.node;
  10038. if (node.name === state.oldName) {
  10039. node.name = state.newName;
  10040. }
  10041. },
  10042. Scope: function Scope(path, state) {
  10043. if (!path.scope.bindingIdentifierEquals(state.oldName, state.binding.identifier)) {
  10044. path.skip();
  10045. }
  10046. },
  10047. "AssignmentExpression|Declaration": function AssignmentExpressionDeclaration(path, state) {
  10048. var ids = path.getOuterBindingIdentifiers();
  10049. for (var name in ids) {
  10050. if (name === state.oldName) ids[name].name = state.newName;
  10051. }
  10052. }
  10053. };
  10054. var Renamer = function () {
  10055. function Renamer(binding, oldName, newName) {
  10056. (0, _classCallCheck3.default)(this, Renamer);
  10057. this.newName = newName;
  10058. this.oldName = oldName;
  10059. this.binding = binding;
  10060. }
  10061. Renamer.prototype.maybeConvertFromExportDeclaration = function maybeConvertFromExportDeclaration(parentDeclar) {
  10062. var exportDeclar = parentDeclar.parentPath.isExportDeclaration() && parentDeclar.parentPath;
  10063. if (!exportDeclar) return;
  10064. var isDefault = exportDeclar.isExportDefaultDeclaration();
  10065. if (isDefault && (parentDeclar.isFunctionDeclaration() || parentDeclar.isClassDeclaration()) && !parentDeclar.node.id) {
  10066. parentDeclar.node.id = parentDeclar.scope.generateUidIdentifier("default");
  10067. }
  10068. var bindingIdentifiers = parentDeclar.getOuterBindingIdentifiers();
  10069. var specifiers = [];
  10070. for (var name in bindingIdentifiers) {
  10071. var localName = name === this.oldName ? this.newName : name;
  10072. var exportedName = isDefault ? "default" : name;
  10073. specifiers.push(t.exportSpecifier(t.identifier(localName), t.identifier(exportedName)));
  10074. }
  10075. if (specifiers.length) {
  10076. var aliasDeclar = t.exportNamedDeclaration(null, specifiers);
  10077. if (parentDeclar.isFunctionDeclaration()) {
  10078. aliasDeclar._blockHoist = 3;
  10079. }
  10080. exportDeclar.insertAfter(aliasDeclar);
  10081. exportDeclar.replaceWith(parentDeclar.node);
  10082. }
  10083. };
  10084. Renamer.prototype.maybeConvertFromClassFunctionDeclaration = function maybeConvertFromClassFunctionDeclaration(path) {
  10085. return;
  10086. if (!path.isFunctionDeclaration() && !path.isClassDeclaration()) return;
  10087. if (this.binding.kind !== "hoisted") return;
  10088. path.node.id = t.identifier(this.oldName);
  10089. path.node._blockHoist = 3;
  10090. path.replaceWith(t.variableDeclaration("let", [t.variableDeclarator(t.identifier(this.newName), t.toExpression(path.node))]));
  10091. };
  10092. Renamer.prototype.maybeConvertFromClassFunctionExpression = function maybeConvertFromClassFunctionExpression(path) {
  10093. return;
  10094. if (!path.isFunctionExpression() && !path.isClassExpression()) return;
  10095. if (this.binding.kind !== "local") return;
  10096. path.node.id = t.identifier(this.oldName);
  10097. this.binding.scope.parent.push({
  10098. id: t.identifier(this.newName)
  10099. });
  10100. path.replaceWith(t.assignmentExpression("=", t.identifier(this.newName), path.node));
  10101. };
  10102. Renamer.prototype.rename = function rename(block) {
  10103. var binding = this.binding,
  10104. oldName = this.oldName,
  10105. newName = this.newName;
  10106. var scope = binding.scope,
  10107. path = binding.path;
  10108. var parentDeclar = path.find(function (path) {
  10109. return path.isDeclaration() || path.isFunctionExpression();
  10110. });
  10111. if (parentDeclar) {
  10112. this.maybeConvertFromExportDeclaration(parentDeclar);
  10113. }
  10114. scope.traverse(block || scope.block, renameVisitor, this);
  10115. if (!block) {
  10116. scope.removeOwnBinding(oldName);
  10117. scope.bindings[newName] = binding;
  10118. this.binding.identifier.name = newName;
  10119. }
  10120. if (binding.type === "hoisted") {}
  10121. if (parentDeclar) {
  10122. this.maybeConvertFromClassFunctionDeclaration(parentDeclar);
  10123. this.maybeConvertFromClassFunctionExpression(parentDeclar);
  10124. }
  10125. };
  10126. return Renamer;
  10127. }();
  10128. exports.default = Renamer;
  10129. module.exports = exports["default"];
  10130. },{"../binding":97,"babel-runtime/helpers/classCallCheck":70,"babel-types":112}],100:[function(require,module,exports){
  10131. "use strict";
  10132. exports.__esModule = true;
  10133. var _typeof2 = require("babel-runtime/helpers/typeof");
  10134. var _typeof3 = _interopRequireDefault(_typeof2);
  10135. var _keys = require("babel-runtime/core-js/object/keys");
  10136. var _keys2 = _interopRequireDefault(_keys);
  10137. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  10138. var _getIterator3 = _interopRequireDefault(_getIterator2);
  10139. exports.explode = explode;
  10140. exports.verify = verify;
  10141. exports.merge = merge;
  10142. var _virtualTypes = require("./path/lib/virtual-types");
  10143. var virtualTypes = _interopRequireWildcard(_virtualTypes);
  10144. var _babelMessages = require("babel-messages");
  10145. var messages = _interopRequireWildcard(_babelMessages);
  10146. var _babelTypes = require("babel-types");
  10147. var t = _interopRequireWildcard(_babelTypes);
  10148. var _clone = require("lodash/clone");
  10149. var _clone2 = _interopRequireDefault(_clone);
  10150. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  10151. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10152. function explode(visitor) {
  10153. if (visitor._exploded) return visitor;
  10154. visitor._exploded = true;
  10155. for (var nodeType in visitor) {
  10156. if (shouldIgnoreKey(nodeType)) continue;
  10157. var parts = nodeType.split("|");
  10158. if (parts.length === 1) continue;
  10159. var fns = visitor[nodeType];
  10160. delete visitor[nodeType];
  10161. for (var _iterator = parts, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  10162. var _ref;
  10163. if (_isArray) {
  10164. if (_i >= _iterator.length) break;
  10165. _ref = _iterator[_i++];
  10166. } else {
  10167. _i = _iterator.next();
  10168. if (_i.done) break;
  10169. _ref = _i.value;
  10170. }
  10171. var part = _ref;
  10172. visitor[part] = fns;
  10173. }
  10174. }
  10175. verify(visitor);
  10176. delete visitor.__esModule;
  10177. ensureEntranceObjects(visitor);
  10178. ensureCallbackArrays(visitor);
  10179. for (var _iterator2 = (0, _keys2.default)(visitor), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  10180. var _ref2;
  10181. if (_isArray2) {
  10182. if (_i2 >= _iterator2.length) break;
  10183. _ref2 = _iterator2[_i2++];
  10184. } else {
  10185. _i2 = _iterator2.next();
  10186. if (_i2.done) break;
  10187. _ref2 = _i2.value;
  10188. }
  10189. var _nodeType3 = _ref2;
  10190. if (shouldIgnoreKey(_nodeType3)) continue;
  10191. var wrapper = virtualTypes[_nodeType3];
  10192. if (!wrapper) continue;
  10193. var _fns2 = visitor[_nodeType3];
  10194. for (var type in _fns2) {
  10195. _fns2[type] = wrapCheck(wrapper, _fns2[type]);
  10196. }
  10197. delete visitor[_nodeType3];
  10198. if (wrapper.types) {
  10199. for (var _iterator4 = wrapper.types, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) {
  10200. var _ref4;
  10201. if (_isArray4) {
  10202. if (_i4 >= _iterator4.length) break;
  10203. _ref4 = _iterator4[_i4++];
  10204. } else {
  10205. _i4 = _iterator4.next();
  10206. if (_i4.done) break;
  10207. _ref4 = _i4.value;
  10208. }
  10209. var _type = _ref4;
  10210. if (visitor[_type]) {
  10211. mergePair(visitor[_type], _fns2);
  10212. } else {
  10213. visitor[_type] = _fns2;
  10214. }
  10215. }
  10216. } else {
  10217. mergePair(visitor, _fns2);
  10218. }
  10219. }
  10220. for (var _nodeType in visitor) {
  10221. if (shouldIgnoreKey(_nodeType)) continue;
  10222. var _fns = visitor[_nodeType];
  10223. var aliases = t.FLIPPED_ALIAS_KEYS[_nodeType];
  10224. var deprecratedKey = t.DEPRECATED_KEYS[_nodeType];
  10225. if (deprecratedKey) {
  10226. console.trace("Visitor defined for " + _nodeType + " but it has been renamed to " + deprecratedKey);
  10227. aliases = [deprecratedKey];
  10228. }
  10229. if (!aliases) continue;
  10230. delete visitor[_nodeType];
  10231. for (var _iterator3 = aliases, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) {
  10232. var _ref3;
  10233. if (_isArray3) {
  10234. if (_i3 >= _iterator3.length) break;
  10235. _ref3 = _iterator3[_i3++];
  10236. } else {
  10237. _i3 = _iterator3.next();
  10238. if (_i3.done) break;
  10239. _ref3 = _i3.value;
  10240. }
  10241. var alias = _ref3;
  10242. var existing = visitor[alias];
  10243. if (existing) {
  10244. mergePair(existing, _fns);
  10245. } else {
  10246. visitor[alias] = (0, _clone2.default)(_fns);
  10247. }
  10248. }
  10249. }
  10250. for (var _nodeType2 in visitor) {
  10251. if (shouldIgnoreKey(_nodeType2)) continue;
  10252. ensureCallbackArrays(visitor[_nodeType2]);
  10253. }
  10254. return visitor;
  10255. }
  10256. function verify(visitor) {
  10257. if (visitor._verified) return;
  10258. if (typeof visitor === "function") {
  10259. throw new Error(messages.get("traverseVerifyRootFunction"));
  10260. }
  10261. for (var nodeType in visitor) {
  10262. if (nodeType === "enter" || nodeType === "exit") {
  10263. validateVisitorMethods(nodeType, visitor[nodeType]);
  10264. }
  10265. if (shouldIgnoreKey(nodeType)) continue;
  10266. if (t.TYPES.indexOf(nodeType) < 0) {
  10267. throw new Error(messages.get("traverseVerifyNodeType", nodeType));
  10268. }
  10269. var visitors = visitor[nodeType];
  10270. if ((typeof visitors === "undefined" ? "undefined" : (0, _typeof3.default)(visitors)) === "object") {
  10271. for (var visitorKey in visitors) {
  10272. if (visitorKey === "enter" || visitorKey === "exit") {
  10273. validateVisitorMethods(nodeType + "." + visitorKey, visitors[visitorKey]);
  10274. } else {
  10275. throw new Error(messages.get("traverseVerifyVisitorProperty", nodeType, visitorKey));
  10276. }
  10277. }
  10278. }
  10279. }
  10280. visitor._verified = true;
  10281. }
  10282. function validateVisitorMethods(path, val) {
  10283. var fns = [].concat(val);
  10284. for (var _iterator5 = fns, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : (0, _getIterator3.default)(_iterator5);;) {
  10285. var _ref5;
  10286. if (_isArray5) {
  10287. if (_i5 >= _iterator5.length) break;
  10288. _ref5 = _iterator5[_i5++];
  10289. } else {
  10290. _i5 = _iterator5.next();
  10291. if (_i5.done) break;
  10292. _ref5 = _i5.value;
  10293. }
  10294. var fn = _ref5;
  10295. if (typeof fn !== "function") {
  10296. throw new TypeError("Non-function found defined in " + path + " with type " + (typeof fn === "undefined" ? "undefined" : (0, _typeof3.default)(fn)));
  10297. }
  10298. }
  10299. }
  10300. function merge(visitors) {
  10301. var states = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  10302. var wrapper = arguments[2];
  10303. var rootVisitor = {};
  10304. for (var i = 0; i < visitors.length; i++) {
  10305. var visitor = visitors[i];
  10306. var state = states[i];
  10307. explode(visitor);
  10308. for (var type in visitor) {
  10309. var visitorType = visitor[type];
  10310. if (state || wrapper) {
  10311. visitorType = wrapWithStateOrWrapper(visitorType, state, wrapper);
  10312. }
  10313. var nodeVisitor = rootVisitor[type] = rootVisitor[type] || {};
  10314. mergePair(nodeVisitor, visitorType);
  10315. }
  10316. }
  10317. return rootVisitor;
  10318. }
  10319. function wrapWithStateOrWrapper(oldVisitor, state, wrapper) {
  10320. var newVisitor = {};
  10321. var _loop = function _loop(key) {
  10322. var fns = oldVisitor[key];
  10323. if (!Array.isArray(fns)) return "continue";
  10324. fns = fns.map(function (fn) {
  10325. var newFn = fn;
  10326. if (state) {
  10327. newFn = function newFn(path) {
  10328. return fn.call(state, path, state);
  10329. };
  10330. }
  10331. if (wrapper) {
  10332. newFn = wrapper(state.key, key, newFn);
  10333. }
  10334. return newFn;
  10335. });
  10336. newVisitor[key] = fns;
  10337. };
  10338. for (var key in oldVisitor) {
  10339. var _ret = _loop(key);
  10340. if (_ret === "continue") continue;
  10341. }
  10342. return newVisitor;
  10343. }
  10344. function ensureEntranceObjects(obj) {
  10345. for (var key in obj) {
  10346. if (shouldIgnoreKey(key)) continue;
  10347. var fns = obj[key];
  10348. if (typeof fns === "function") {
  10349. obj[key] = { enter: fns };
  10350. }
  10351. }
  10352. }
  10353. function ensureCallbackArrays(obj) {
  10354. if (obj.enter && !Array.isArray(obj.enter)) obj.enter = [obj.enter];
  10355. if (obj.exit && !Array.isArray(obj.exit)) obj.exit = [obj.exit];
  10356. }
  10357. function wrapCheck(wrapper, fn) {
  10358. var newFn = function newFn(path) {
  10359. if (wrapper.checkPath(path)) {
  10360. return fn.apply(this, arguments);
  10361. }
  10362. };
  10363. newFn.toString = function () {
  10364. return fn.toString();
  10365. };
  10366. return newFn;
  10367. }
  10368. function shouldIgnoreKey(key) {
  10369. if (key[0] === "_") return true;
  10370. if (key === "enter" || key === "exit" || key === "shouldSkip") return true;
  10371. if (key === "blacklist" || key === "noScope" || key === "skipKeys") return true;
  10372. return false;
  10373. }
  10374. function mergePair(dest, src) {
  10375. for (var key in src) {
  10376. dest[key] = [].concat(dest[key] || [], src[key]);
  10377. }
  10378. }
  10379. },{"./path/lib/virtual-types":93,"babel-messages":53,"babel-runtime/core-js/get-iterator":56,"babel-runtime/core-js/object/keys":63,"babel-runtime/helpers/typeof":74,"babel-types":112,"lodash/clone":416}],101:[function(require,module,exports){
  10380. "use strict";
  10381. exports.__esModule = true;
  10382. exports.NOT_LOCAL_BINDING = exports.BLOCK_SCOPED_SYMBOL = exports.INHERIT_KEYS = exports.UNARY_OPERATORS = exports.STRING_UNARY_OPERATORS = exports.NUMBER_UNARY_OPERATORS = exports.BOOLEAN_UNARY_OPERATORS = exports.BINARY_OPERATORS = exports.NUMBER_BINARY_OPERATORS = exports.BOOLEAN_BINARY_OPERATORS = exports.COMPARISON_BINARY_OPERATORS = exports.EQUALITY_BINARY_OPERATORS = exports.BOOLEAN_NUMBER_BINARY_OPERATORS = exports.UPDATE_OPERATORS = exports.LOGICAL_OPERATORS = exports.COMMENT_KEYS = exports.FOR_INIT_KEYS = exports.FLATTENABLE_KEYS = exports.STATEMENT_OR_BLOCK_KEYS = undefined;
  10383. var _for = require("babel-runtime/core-js/symbol/for");
  10384. var _for2 = _interopRequireDefault(_for);
  10385. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10386. var STATEMENT_OR_BLOCK_KEYS = exports.STATEMENT_OR_BLOCK_KEYS = ["consequent", "body", "alternate"];
  10387. var FLATTENABLE_KEYS = exports.FLATTENABLE_KEYS = ["body", "expressions"];
  10388. var FOR_INIT_KEYS = exports.FOR_INIT_KEYS = ["left", "init"];
  10389. var COMMENT_KEYS = exports.COMMENT_KEYS = ["leadingComments", "trailingComments", "innerComments"];
  10390. var LOGICAL_OPERATORS = exports.LOGICAL_OPERATORS = ["||", "&&"];
  10391. var UPDATE_OPERATORS = exports.UPDATE_OPERATORS = ["++", "--"];
  10392. var BOOLEAN_NUMBER_BINARY_OPERATORS = exports.BOOLEAN_NUMBER_BINARY_OPERATORS = [">", "<", ">=", "<="];
  10393. var EQUALITY_BINARY_OPERATORS = exports.EQUALITY_BINARY_OPERATORS = ["==", "===", "!=", "!=="];
  10394. var COMPARISON_BINARY_OPERATORS = exports.COMPARISON_BINARY_OPERATORS = [].concat(EQUALITY_BINARY_OPERATORS, ["in", "instanceof"]);
  10395. var BOOLEAN_BINARY_OPERATORS = exports.BOOLEAN_BINARY_OPERATORS = [].concat(COMPARISON_BINARY_OPERATORS, BOOLEAN_NUMBER_BINARY_OPERATORS);
  10396. var NUMBER_BINARY_OPERATORS = exports.NUMBER_BINARY_OPERATORS = ["-", "/", "%", "*", "**", "&", "|", ">>", ">>>", "<<", "^"];
  10397. var BINARY_OPERATORS = exports.BINARY_OPERATORS = ["+"].concat(NUMBER_BINARY_OPERATORS, BOOLEAN_BINARY_OPERATORS);
  10398. var BOOLEAN_UNARY_OPERATORS = exports.BOOLEAN_UNARY_OPERATORS = ["delete", "!"];
  10399. var NUMBER_UNARY_OPERATORS = exports.NUMBER_UNARY_OPERATORS = ["+", "-", "++", "--", "~"];
  10400. var STRING_UNARY_OPERATORS = exports.STRING_UNARY_OPERATORS = ["typeof"];
  10401. var UNARY_OPERATORS = exports.UNARY_OPERATORS = ["void"].concat(BOOLEAN_UNARY_OPERATORS, NUMBER_UNARY_OPERATORS, STRING_UNARY_OPERATORS);
  10402. var INHERIT_KEYS = exports.INHERIT_KEYS = {
  10403. optional: ["typeAnnotation", "typeParameters", "returnType"],
  10404. force: ["start", "loc", "end"]
  10405. };
  10406. var BLOCK_SCOPED_SYMBOL = exports.BLOCK_SCOPED_SYMBOL = (0, _for2.default)("var used to be block scoped");
  10407. var NOT_LOCAL_BINDING = exports.NOT_LOCAL_BINDING = (0, _for2.default)("should not be considered a local binding");
  10408. },{"babel-runtime/core-js/symbol/for":66}],102:[function(require,module,exports){
  10409. "use strict";
  10410. exports.__esModule = true;
  10411. var _maxSafeInteger = require("babel-runtime/core-js/number/max-safe-integer");
  10412. var _maxSafeInteger2 = _interopRequireDefault(_maxSafeInteger);
  10413. var _stringify = require("babel-runtime/core-js/json/stringify");
  10414. var _stringify2 = _interopRequireDefault(_stringify);
  10415. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  10416. var _getIterator3 = _interopRequireDefault(_getIterator2);
  10417. exports.toComputedKey = toComputedKey;
  10418. exports.toSequenceExpression = toSequenceExpression;
  10419. exports.toKeyAlias = toKeyAlias;
  10420. exports.toIdentifier = toIdentifier;
  10421. exports.toBindingIdentifierName = toBindingIdentifierName;
  10422. exports.toStatement = toStatement;
  10423. exports.toExpression = toExpression;
  10424. exports.toBlock = toBlock;
  10425. exports.valueToNode = valueToNode;
  10426. var _isPlainObject = require("lodash/isPlainObject");
  10427. var _isPlainObject2 = _interopRequireDefault(_isPlainObject);
  10428. var _isRegExp = require("lodash/isRegExp");
  10429. var _isRegExp2 = _interopRequireDefault(_isRegExp);
  10430. var _index = require("./index");
  10431. var t = _interopRequireWildcard(_index);
  10432. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  10433. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10434. function toComputedKey(node) {
  10435. var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : node.key || node.property;
  10436. if (!node.computed) {
  10437. if (t.isIdentifier(key)) key = t.stringLiteral(key.name);
  10438. }
  10439. return key;
  10440. }
  10441. function toSequenceExpression(nodes, scope) {
  10442. if (!nodes || !nodes.length) return;
  10443. var declars = [];
  10444. var bailed = false;
  10445. var result = convert(nodes);
  10446. if (bailed) return;
  10447. for (var i = 0; i < declars.length; i++) {
  10448. scope.push(declars[i]);
  10449. }
  10450. return result;
  10451. function convert(nodes) {
  10452. var ensureLastUndefined = false;
  10453. var exprs = [];
  10454. for (var _iterator = nodes, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  10455. var _ref;
  10456. if (_isArray) {
  10457. if (_i >= _iterator.length) break;
  10458. _ref = _iterator[_i++];
  10459. } else {
  10460. _i = _iterator.next();
  10461. if (_i.done) break;
  10462. _ref = _i.value;
  10463. }
  10464. var node = _ref;
  10465. if (t.isExpression(node)) {
  10466. exprs.push(node);
  10467. } else if (t.isExpressionStatement(node)) {
  10468. exprs.push(node.expression);
  10469. } else if (t.isVariableDeclaration(node)) {
  10470. if (node.kind !== "var") return bailed = true;
  10471. for (var _iterator2 = node.declarations, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  10472. var _ref2;
  10473. if (_isArray2) {
  10474. if (_i2 >= _iterator2.length) break;
  10475. _ref2 = _iterator2[_i2++];
  10476. } else {
  10477. _i2 = _iterator2.next();
  10478. if (_i2.done) break;
  10479. _ref2 = _i2.value;
  10480. }
  10481. var declar = _ref2;
  10482. var bindings = t.getBindingIdentifiers(declar);
  10483. for (var key in bindings) {
  10484. declars.push({
  10485. kind: node.kind,
  10486. id: bindings[key]
  10487. });
  10488. }
  10489. if (declar.init) {
  10490. exprs.push(t.assignmentExpression("=", declar.id, declar.init));
  10491. }
  10492. }
  10493. ensureLastUndefined = true;
  10494. continue;
  10495. } else if (t.isIfStatement(node)) {
  10496. var consequent = node.consequent ? convert([node.consequent]) : scope.buildUndefinedNode();
  10497. var alternate = node.alternate ? convert([node.alternate]) : scope.buildUndefinedNode();
  10498. if (!consequent || !alternate) return bailed = true;
  10499. exprs.push(t.conditionalExpression(node.test, consequent, alternate));
  10500. } else if (t.isBlockStatement(node)) {
  10501. exprs.push(convert(node.body));
  10502. } else if (t.isEmptyStatement(node)) {
  10503. ensureLastUndefined = true;
  10504. continue;
  10505. } else {
  10506. return bailed = true;
  10507. }
  10508. ensureLastUndefined = false;
  10509. }
  10510. if (ensureLastUndefined || exprs.length === 0) {
  10511. exprs.push(scope.buildUndefinedNode());
  10512. }
  10513. if (exprs.length === 1) {
  10514. return exprs[0];
  10515. } else {
  10516. return t.sequenceExpression(exprs);
  10517. }
  10518. }
  10519. }
  10520. function toKeyAlias(node) {
  10521. var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : node.key;
  10522. var alias = void 0;
  10523. if (node.kind === "method") {
  10524. return toKeyAlias.increment() + "";
  10525. } else if (t.isIdentifier(key)) {
  10526. alias = key.name;
  10527. } else if (t.isStringLiteral(key)) {
  10528. alias = (0, _stringify2.default)(key.value);
  10529. } else {
  10530. alias = (0, _stringify2.default)(t.removePropertiesDeep(t.cloneDeep(key)));
  10531. }
  10532. if (node.computed) {
  10533. alias = "[" + alias + "]";
  10534. }
  10535. if (node.static) {
  10536. alias = "static:" + alias;
  10537. }
  10538. return alias;
  10539. }
  10540. toKeyAlias.uid = 0;
  10541. toKeyAlias.increment = function () {
  10542. if (toKeyAlias.uid >= _maxSafeInteger2.default) {
  10543. return toKeyAlias.uid = 0;
  10544. } else {
  10545. return toKeyAlias.uid++;
  10546. }
  10547. };
  10548. function toIdentifier(name) {
  10549. name = name + "";
  10550. name = name.replace(/[^a-zA-Z0-9$_]/g, "-");
  10551. name = name.replace(/^[-0-9]+/, "");
  10552. name = name.replace(/[-\s]+(.)?/g, function (match, c) {
  10553. return c ? c.toUpperCase() : "";
  10554. });
  10555. if (!t.isValidIdentifier(name)) {
  10556. name = "_" + name;
  10557. }
  10558. return name || "_";
  10559. }
  10560. function toBindingIdentifierName(name) {
  10561. name = toIdentifier(name);
  10562. if (name === "eval" || name === "arguments") name = "_" + name;
  10563. return name;
  10564. }
  10565. function toStatement(node, ignore) {
  10566. if (t.isStatement(node)) {
  10567. return node;
  10568. }
  10569. var mustHaveId = false;
  10570. var newType = void 0;
  10571. if (t.isClass(node)) {
  10572. mustHaveId = true;
  10573. newType = "ClassDeclaration";
  10574. } else if (t.isFunction(node)) {
  10575. mustHaveId = true;
  10576. newType = "FunctionDeclaration";
  10577. } else if (t.isAssignmentExpression(node)) {
  10578. return t.expressionStatement(node);
  10579. }
  10580. if (mustHaveId && !node.id) {
  10581. newType = false;
  10582. }
  10583. if (!newType) {
  10584. if (ignore) {
  10585. return false;
  10586. } else {
  10587. throw new Error("cannot turn " + node.type + " to a statement");
  10588. }
  10589. }
  10590. node.type = newType;
  10591. return node;
  10592. }
  10593. function toExpression(node) {
  10594. if (t.isExpressionStatement(node)) {
  10595. node = node.expression;
  10596. }
  10597. if (t.isExpression(node)) {
  10598. return node;
  10599. }
  10600. if (t.isClass(node)) {
  10601. node.type = "ClassExpression";
  10602. } else if (t.isFunction(node)) {
  10603. node.type = "FunctionExpression";
  10604. }
  10605. if (!t.isExpression(node)) {
  10606. throw new Error("cannot turn " + node.type + " to an expression");
  10607. }
  10608. return node;
  10609. }
  10610. function toBlock(node, parent) {
  10611. if (t.isBlockStatement(node)) {
  10612. return node;
  10613. }
  10614. if (t.isEmptyStatement(node)) {
  10615. node = [];
  10616. }
  10617. if (!Array.isArray(node)) {
  10618. if (!t.isStatement(node)) {
  10619. if (t.isFunction(parent)) {
  10620. node = t.returnStatement(node);
  10621. } else {
  10622. node = t.expressionStatement(node);
  10623. }
  10624. }
  10625. node = [node];
  10626. }
  10627. return t.blockStatement(node);
  10628. }
  10629. function valueToNode(value) {
  10630. if (value === undefined) {
  10631. return t.identifier("undefined");
  10632. }
  10633. if (value === true || value === false) {
  10634. return t.booleanLiteral(value);
  10635. }
  10636. if (value === null) {
  10637. return t.nullLiteral();
  10638. }
  10639. if (typeof value === "string") {
  10640. return t.stringLiteral(value);
  10641. }
  10642. if (typeof value === "number") {
  10643. return t.numericLiteral(value);
  10644. }
  10645. if ((0, _isRegExp2.default)(value)) {
  10646. var pattern = value.source;
  10647. var flags = value.toString().match(/\/([a-z]+|)$/)[1];
  10648. return t.regExpLiteral(pattern, flags);
  10649. }
  10650. if (Array.isArray(value)) {
  10651. return t.arrayExpression(value.map(t.valueToNode));
  10652. }
  10653. if ((0, _isPlainObject2.default)(value)) {
  10654. var props = [];
  10655. for (var key in value) {
  10656. var nodeKey = void 0;
  10657. if (t.isValidIdentifier(key)) {
  10658. nodeKey = t.identifier(key);
  10659. } else {
  10660. nodeKey = t.stringLiteral(key);
  10661. }
  10662. props.push(t.objectProperty(nodeKey, t.valueToNode(value[key])));
  10663. }
  10664. return t.objectExpression(props);
  10665. }
  10666. throw new Error("don't know how to turn this value into a node");
  10667. }
  10668. },{"./index":112,"babel-runtime/core-js/get-iterator":56,"babel-runtime/core-js/json/stringify":57,"babel-runtime/core-js/number/max-safe-integer":59,"lodash/isPlainObject":442,"lodash/isRegExp":443}],103:[function(require,module,exports){
  10669. "use strict";
  10670. var _index = require("../index");
  10671. var t = _interopRequireWildcard(_index);
  10672. var _constants = require("../constants");
  10673. var _index2 = require("./index");
  10674. var _index3 = _interopRequireDefault(_index2);
  10675. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10676. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  10677. (0, _index3.default)("ArrayExpression", {
  10678. fields: {
  10679. elements: {
  10680. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeOrValueType)("null", "Expression", "SpreadElement"))),
  10681. default: []
  10682. }
  10683. },
  10684. visitor: ["elements"],
  10685. aliases: ["Expression"]
  10686. });
  10687. (0, _index3.default)("AssignmentExpression", {
  10688. fields: {
  10689. operator: {
  10690. validate: (0, _index2.assertValueType)("string")
  10691. },
  10692. left: {
  10693. validate: (0, _index2.assertNodeType)("LVal")
  10694. },
  10695. right: {
  10696. validate: (0, _index2.assertNodeType)("Expression")
  10697. }
  10698. },
  10699. builder: ["operator", "left", "right"],
  10700. visitor: ["left", "right"],
  10701. aliases: ["Expression"]
  10702. });
  10703. (0, _index3.default)("BinaryExpression", {
  10704. builder: ["operator", "left", "right"],
  10705. fields: {
  10706. operator: {
  10707. validate: _index2.assertOneOf.apply(undefined, _constants.BINARY_OPERATORS)
  10708. },
  10709. left: {
  10710. validate: (0, _index2.assertNodeType)("Expression")
  10711. },
  10712. right: {
  10713. validate: (0, _index2.assertNodeType)("Expression")
  10714. }
  10715. },
  10716. visitor: ["left", "right"],
  10717. aliases: ["Binary", "Expression"]
  10718. });
  10719. (0, _index3.default)("Directive", {
  10720. visitor: ["value"],
  10721. fields: {
  10722. value: {
  10723. validate: (0, _index2.assertNodeType)("DirectiveLiteral")
  10724. }
  10725. }
  10726. });
  10727. (0, _index3.default)("DirectiveLiteral", {
  10728. builder: ["value"],
  10729. fields: {
  10730. value: {
  10731. validate: (0, _index2.assertValueType)("string")
  10732. }
  10733. }
  10734. });
  10735. (0, _index3.default)("BlockStatement", {
  10736. builder: ["body", "directives"],
  10737. visitor: ["directives", "body"],
  10738. fields: {
  10739. directives: {
  10740. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Directive"))),
  10741. default: []
  10742. },
  10743. body: {
  10744. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Statement")))
  10745. }
  10746. },
  10747. aliases: ["Scopable", "BlockParent", "Block", "Statement"]
  10748. });
  10749. (0, _index3.default)("BreakStatement", {
  10750. visitor: ["label"],
  10751. fields: {
  10752. label: {
  10753. validate: (0, _index2.assertNodeType)("Identifier"),
  10754. optional: true
  10755. }
  10756. },
  10757. aliases: ["Statement", "Terminatorless", "CompletionStatement"]
  10758. });
  10759. (0, _index3.default)("CallExpression", {
  10760. visitor: ["callee", "arguments"],
  10761. fields: {
  10762. callee: {
  10763. validate: (0, _index2.assertNodeType)("Expression")
  10764. },
  10765. arguments: {
  10766. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Expression", "SpreadElement")))
  10767. }
  10768. },
  10769. aliases: ["Expression"]
  10770. });
  10771. (0, _index3.default)("CatchClause", {
  10772. visitor: ["param", "body"],
  10773. fields: {
  10774. param: {
  10775. validate: (0, _index2.assertNodeType)("Identifier")
  10776. },
  10777. body: {
  10778. validate: (0, _index2.assertNodeType)("BlockStatement")
  10779. }
  10780. },
  10781. aliases: ["Scopable"]
  10782. });
  10783. (0, _index3.default)("ConditionalExpression", {
  10784. visitor: ["test", "consequent", "alternate"],
  10785. fields: {
  10786. test: {
  10787. validate: (0, _index2.assertNodeType)("Expression")
  10788. },
  10789. consequent: {
  10790. validate: (0, _index2.assertNodeType)("Expression")
  10791. },
  10792. alternate: {
  10793. validate: (0, _index2.assertNodeType)("Expression")
  10794. }
  10795. },
  10796. aliases: ["Expression", "Conditional"]
  10797. });
  10798. (0, _index3.default)("ContinueStatement", {
  10799. visitor: ["label"],
  10800. fields: {
  10801. label: {
  10802. validate: (0, _index2.assertNodeType)("Identifier"),
  10803. optional: true
  10804. }
  10805. },
  10806. aliases: ["Statement", "Terminatorless", "CompletionStatement"]
  10807. });
  10808. (0, _index3.default)("DebuggerStatement", {
  10809. aliases: ["Statement"]
  10810. });
  10811. (0, _index3.default)("DoWhileStatement", {
  10812. visitor: ["test", "body"],
  10813. fields: {
  10814. test: {
  10815. validate: (0, _index2.assertNodeType)("Expression")
  10816. },
  10817. body: {
  10818. validate: (0, _index2.assertNodeType)("Statement")
  10819. }
  10820. },
  10821. aliases: ["Statement", "BlockParent", "Loop", "While", "Scopable"]
  10822. });
  10823. (0, _index3.default)("EmptyStatement", {
  10824. aliases: ["Statement"]
  10825. });
  10826. (0, _index3.default)("ExpressionStatement", {
  10827. visitor: ["expression"],
  10828. fields: {
  10829. expression: {
  10830. validate: (0, _index2.assertNodeType)("Expression")
  10831. }
  10832. },
  10833. aliases: ["Statement", "ExpressionWrapper"]
  10834. });
  10835. (0, _index3.default)("File", {
  10836. builder: ["program", "comments", "tokens"],
  10837. visitor: ["program"],
  10838. fields: {
  10839. program: {
  10840. validate: (0, _index2.assertNodeType)("Program")
  10841. }
  10842. }
  10843. });
  10844. (0, _index3.default)("ForInStatement", {
  10845. visitor: ["left", "right", "body"],
  10846. aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"],
  10847. fields: {
  10848. left: {
  10849. validate: (0, _index2.assertNodeType)("VariableDeclaration", "LVal")
  10850. },
  10851. right: {
  10852. validate: (0, _index2.assertNodeType)("Expression")
  10853. },
  10854. body: {
  10855. validate: (0, _index2.assertNodeType)("Statement")
  10856. }
  10857. }
  10858. });
  10859. (0, _index3.default)("ForStatement", {
  10860. visitor: ["init", "test", "update", "body"],
  10861. aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop"],
  10862. fields: {
  10863. init: {
  10864. validate: (0, _index2.assertNodeType)("VariableDeclaration", "Expression"),
  10865. optional: true
  10866. },
  10867. test: {
  10868. validate: (0, _index2.assertNodeType)("Expression"),
  10869. optional: true
  10870. },
  10871. update: {
  10872. validate: (0, _index2.assertNodeType)("Expression"),
  10873. optional: true
  10874. },
  10875. body: {
  10876. validate: (0, _index2.assertNodeType)("Statement")
  10877. }
  10878. }
  10879. });
  10880. (0, _index3.default)("FunctionDeclaration", {
  10881. builder: ["id", "params", "body", "generator", "async"],
  10882. visitor: ["id", "params", "body", "returnType", "typeParameters"],
  10883. fields: {
  10884. id: {
  10885. validate: (0, _index2.assertNodeType)("Identifier")
  10886. },
  10887. params: {
  10888. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("LVal")))
  10889. },
  10890. body: {
  10891. validate: (0, _index2.assertNodeType)("BlockStatement")
  10892. },
  10893. generator: {
  10894. default: false,
  10895. validate: (0, _index2.assertValueType)("boolean")
  10896. },
  10897. async: {
  10898. default: false,
  10899. validate: (0, _index2.assertValueType)("boolean")
  10900. }
  10901. },
  10902. aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Statement", "Pureish", "Declaration"]
  10903. });
  10904. (0, _index3.default)("FunctionExpression", {
  10905. inherits: "FunctionDeclaration",
  10906. aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"],
  10907. fields: {
  10908. id: {
  10909. validate: (0, _index2.assertNodeType)("Identifier"),
  10910. optional: true
  10911. },
  10912. params: {
  10913. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("LVal")))
  10914. },
  10915. body: {
  10916. validate: (0, _index2.assertNodeType)("BlockStatement")
  10917. },
  10918. generator: {
  10919. default: false,
  10920. validate: (0, _index2.assertValueType)("boolean")
  10921. },
  10922. async: {
  10923. default: false,
  10924. validate: (0, _index2.assertValueType)("boolean")
  10925. }
  10926. }
  10927. });
  10928. (0, _index3.default)("Identifier", {
  10929. builder: ["name"],
  10930. visitor: ["typeAnnotation"],
  10931. aliases: ["Expression", "LVal"],
  10932. fields: {
  10933. name: {
  10934. validate: function validate(node, key, val) {
  10935. if (!t.isValidIdentifier(val)) {}
  10936. }
  10937. },
  10938. decorators: {
  10939. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Decorator")))
  10940. }
  10941. }
  10942. });
  10943. (0, _index3.default)("IfStatement", {
  10944. visitor: ["test", "consequent", "alternate"],
  10945. aliases: ["Statement", "Conditional"],
  10946. fields: {
  10947. test: {
  10948. validate: (0, _index2.assertNodeType)("Expression")
  10949. },
  10950. consequent: {
  10951. validate: (0, _index2.assertNodeType)("Statement")
  10952. },
  10953. alternate: {
  10954. optional: true,
  10955. validate: (0, _index2.assertNodeType)("Statement")
  10956. }
  10957. }
  10958. });
  10959. (0, _index3.default)("LabeledStatement", {
  10960. visitor: ["label", "body"],
  10961. aliases: ["Statement"],
  10962. fields: {
  10963. label: {
  10964. validate: (0, _index2.assertNodeType)("Identifier")
  10965. },
  10966. body: {
  10967. validate: (0, _index2.assertNodeType)("Statement")
  10968. }
  10969. }
  10970. });
  10971. (0, _index3.default)("StringLiteral", {
  10972. builder: ["value"],
  10973. fields: {
  10974. value: {
  10975. validate: (0, _index2.assertValueType)("string")
  10976. }
  10977. },
  10978. aliases: ["Expression", "Pureish", "Literal", "Immutable"]
  10979. });
  10980. (0, _index3.default)("NumericLiteral", {
  10981. builder: ["value"],
  10982. deprecatedAlias: "NumberLiteral",
  10983. fields: {
  10984. value: {
  10985. validate: (0, _index2.assertValueType)("number")
  10986. }
  10987. },
  10988. aliases: ["Expression", "Pureish", "Literal", "Immutable"]
  10989. });
  10990. (0, _index3.default)("NullLiteral", {
  10991. aliases: ["Expression", "Pureish", "Literal", "Immutable"]
  10992. });
  10993. (0, _index3.default)("BooleanLiteral", {
  10994. builder: ["value"],
  10995. fields: {
  10996. value: {
  10997. validate: (0, _index2.assertValueType)("boolean")
  10998. }
  10999. },
  11000. aliases: ["Expression", "Pureish", "Literal", "Immutable"]
  11001. });
  11002. (0, _index3.default)("RegExpLiteral", {
  11003. builder: ["pattern", "flags"],
  11004. deprecatedAlias: "RegexLiteral",
  11005. aliases: ["Expression", "Literal"],
  11006. fields: {
  11007. pattern: {
  11008. validate: (0, _index2.assertValueType)("string")
  11009. },
  11010. flags: {
  11011. validate: (0, _index2.assertValueType)("string"),
  11012. default: ""
  11013. }
  11014. }
  11015. });
  11016. (0, _index3.default)("LogicalExpression", {
  11017. builder: ["operator", "left", "right"],
  11018. visitor: ["left", "right"],
  11019. aliases: ["Binary", "Expression"],
  11020. fields: {
  11021. operator: {
  11022. validate: _index2.assertOneOf.apply(undefined, _constants.LOGICAL_OPERATORS)
  11023. },
  11024. left: {
  11025. validate: (0, _index2.assertNodeType)("Expression")
  11026. },
  11027. right: {
  11028. validate: (0, _index2.assertNodeType)("Expression")
  11029. }
  11030. }
  11031. });
  11032. (0, _index3.default)("MemberExpression", {
  11033. builder: ["object", "property", "computed"],
  11034. visitor: ["object", "property"],
  11035. aliases: ["Expression", "LVal"],
  11036. fields: {
  11037. object: {
  11038. validate: (0, _index2.assertNodeType)("Expression")
  11039. },
  11040. property: {
  11041. validate: function validate(node, key, val) {
  11042. var expectedType = node.computed ? "Expression" : "Identifier";
  11043. (0, _index2.assertNodeType)(expectedType)(node, key, val);
  11044. }
  11045. },
  11046. computed: {
  11047. default: false
  11048. }
  11049. }
  11050. });
  11051. (0, _index3.default)("NewExpression", {
  11052. visitor: ["callee", "arguments"],
  11053. aliases: ["Expression"],
  11054. fields: {
  11055. callee: {
  11056. validate: (0, _index2.assertNodeType)("Expression")
  11057. },
  11058. arguments: {
  11059. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Expression", "SpreadElement")))
  11060. }
  11061. }
  11062. });
  11063. (0, _index3.default)("Program", {
  11064. visitor: ["directives", "body"],
  11065. builder: ["body", "directives"],
  11066. fields: {
  11067. directives: {
  11068. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Directive"))),
  11069. default: []
  11070. },
  11071. body: {
  11072. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Statement")))
  11073. }
  11074. },
  11075. aliases: ["Scopable", "BlockParent", "Block", "FunctionParent"]
  11076. });
  11077. (0, _index3.default)("ObjectExpression", {
  11078. visitor: ["properties"],
  11079. aliases: ["Expression"],
  11080. fields: {
  11081. properties: {
  11082. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("ObjectMethod", "ObjectProperty", "SpreadProperty")))
  11083. }
  11084. }
  11085. });
  11086. (0, _index3.default)("ObjectMethod", {
  11087. builder: ["kind", "key", "params", "body", "computed"],
  11088. fields: {
  11089. kind: {
  11090. validate: (0, _index2.chain)((0, _index2.assertValueType)("string"), (0, _index2.assertOneOf)("method", "get", "set")),
  11091. default: "method"
  11092. },
  11093. computed: {
  11094. validate: (0, _index2.assertValueType)("boolean"),
  11095. default: false
  11096. },
  11097. key: {
  11098. validate: function validate(node, key, val) {
  11099. var expectedTypes = node.computed ? ["Expression"] : ["Identifier", "StringLiteral", "NumericLiteral"];
  11100. _index2.assertNodeType.apply(undefined, expectedTypes)(node, key, val);
  11101. }
  11102. },
  11103. decorators: {
  11104. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Decorator")))
  11105. },
  11106. body: {
  11107. validate: (0, _index2.assertNodeType)("BlockStatement")
  11108. },
  11109. generator: {
  11110. default: false,
  11111. validate: (0, _index2.assertValueType)("boolean")
  11112. },
  11113. async: {
  11114. default: false,
  11115. validate: (0, _index2.assertValueType)("boolean")
  11116. }
  11117. },
  11118. visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"],
  11119. aliases: ["UserWhitespacable", "Function", "Scopable", "BlockParent", "FunctionParent", "Method", "ObjectMember"]
  11120. });
  11121. (0, _index3.default)("ObjectProperty", {
  11122. builder: ["key", "value", "computed", "shorthand", "decorators"],
  11123. fields: {
  11124. computed: {
  11125. validate: (0, _index2.assertValueType)("boolean"),
  11126. default: false
  11127. },
  11128. key: {
  11129. validate: function validate(node, key, val) {
  11130. var expectedTypes = node.computed ? ["Expression"] : ["Identifier", "StringLiteral", "NumericLiteral"];
  11131. _index2.assertNodeType.apply(undefined, expectedTypes)(node, key, val);
  11132. }
  11133. },
  11134. value: {
  11135. validate: (0, _index2.assertNodeType)("Expression")
  11136. },
  11137. shorthand: {
  11138. validate: (0, _index2.assertValueType)("boolean"),
  11139. default: false
  11140. },
  11141. decorators: {
  11142. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Decorator"))),
  11143. optional: true
  11144. }
  11145. },
  11146. visitor: ["key", "value", "decorators"],
  11147. aliases: ["UserWhitespacable", "Property", "ObjectMember"]
  11148. });
  11149. (0, _index3.default)("RestElement", {
  11150. visitor: ["argument", "typeAnnotation"],
  11151. aliases: ["LVal"],
  11152. fields: {
  11153. argument: {
  11154. validate: (0, _index2.assertNodeType)("LVal")
  11155. },
  11156. decorators: {
  11157. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Decorator")))
  11158. }
  11159. }
  11160. });
  11161. (0, _index3.default)("ReturnStatement", {
  11162. visitor: ["argument"],
  11163. aliases: ["Statement", "Terminatorless", "CompletionStatement"],
  11164. fields: {
  11165. argument: {
  11166. validate: (0, _index2.assertNodeType)("Expression"),
  11167. optional: true
  11168. }
  11169. }
  11170. });
  11171. (0, _index3.default)("SequenceExpression", {
  11172. visitor: ["expressions"],
  11173. fields: {
  11174. expressions: {
  11175. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Expression")))
  11176. }
  11177. },
  11178. aliases: ["Expression"]
  11179. });
  11180. (0, _index3.default)("SwitchCase", {
  11181. visitor: ["test", "consequent"],
  11182. fields: {
  11183. test: {
  11184. validate: (0, _index2.assertNodeType)("Expression"),
  11185. optional: true
  11186. },
  11187. consequent: {
  11188. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Statement")))
  11189. }
  11190. }
  11191. });
  11192. (0, _index3.default)("SwitchStatement", {
  11193. visitor: ["discriminant", "cases"],
  11194. aliases: ["Statement", "BlockParent", "Scopable"],
  11195. fields: {
  11196. discriminant: {
  11197. validate: (0, _index2.assertNodeType)("Expression")
  11198. },
  11199. cases: {
  11200. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("SwitchCase")))
  11201. }
  11202. }
  11203. });
  11204. (0, _index3.default)("ThisExpression", {
  11205. aliases: ["Expression"]
  11206. });
  11207. (0, _index3.default)("ThrowStatement", {
  11208. visitor: ["argument"],
  11209. aliases: ["Statement", "Terminatorless", "CompletionStatement"],
  11210. fields: {
  11211. argument: {
  11212. validate: (0, _index2.assertNodeType)("Expression")
  11213. }
  11214. }
  11215. });
  11216. (0, _index3.default)("TryStatement", {
  11217. visitor: ["block", "handler", "finalizer"],
  11218. aliases: ["Statement"],
  11219. fields: {
  11220. body: {
  11221. validate: (0, _index2.assertNodeType)("BlockStatement")
  11222. },
  11223. handler: {
  11224. optional: true,
  11225. handler: (0, _index2.assertNodeType)("BlockStatement")
  11226. },
  11227. finalizer: {
  11228. optional: true,
  11229. validate: (0, _index2.assertNodeType)("BlockStatement")
  11230. }
  11231. }
  11232. });
  11233. (0, _index3.default)("UnaryExpression", {
  11234. builder: ["operator", "argument", "prefix"],
  11235. fields: {
  11236. prefix: {
  11237. default: true
  11238. },
  11239. argument: {
  11240. validate: (0, _index2.assertNodeType)("Expression")
  11241. },
  11242. operator: {
  11243. validate: _index2.assertOneOf.apply(undefined, _constants.UNARY_OPERATORS)
  11244. }
  11245. },
  11246. visitor: ["argument"],
  11247. aliases: ["UnaryLike", "Expression"]
  11248. });
  11249. (0, _index3.default)("UpdateExpression", {
  11250. builder: ["operator", "argument", "prefix"],
  11251. fields: {
  11252. prefix: {
  11253. default: false
  11254. },
  11255. argument: {
  11256. validate: (0, _index2.assertNodeType)("Expression")
  11257. },
  11258. operator: {
  11259. validate: _index2.assertOneOf.apply(undefined, _constants.UPDATE_OPERATORS)
  11260. }
  11261. },
  11262. visitor: ["argument"],
  11263. aliases: ["Expression"]
  11264. });
  11265. (0, _index3.default)("VariableDeclaration", {
  11266. builder: ["kind", "declarations"],
  11267. visitor: ["declarations"],
  11268. aliases: ["Statement", "Declaration"],
  11269. fields: {
  11270. kind: {
  11271. validate: (0, _index2.chain)((0, _index2.assertValueType)("string"), (0, _index2.assertOneOf)("var", "let", "const"))
  11272. },
  11273. declarations: {
  11274. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("VariableDeclarator")))
  11275. }
  11276. }
  11277. });
  11278. (0, _index3.default)("VariableDeclarator", {
  11279. visitor: ["id", "init"],
  11280. fields: {
  11281. id: {
  11282. validate: (0, _index2.assertNodeType)("LVal")
  11283. },
  11284. init: {
  11285. optional: true,
  11286. validate: (0, _index2.assertNodeType)("Expression")
  11287. }
  11288. }
  11289. });
  11290. (0, _index3.default)("WhileStatement", {
  11291. visitor: ["test", "body"],
  11292. aliases: ["Statement", "BlockParent", "Loop", "While", "Scopable"],
  11293. fields: {
  11294. test: {
  11295. validate: (0, _index2.assertNodeType)("Expression")
  11296. },
  11297. body: {
  11298. validate: (0, _index2.assertNodeType)("BlockStatement", "Statement")
  11299. }
  11300. }
  11301. });
  11302. (0, _index3.default)("WithStatement", {
  11303. visitor: ["object", "body"],
  11304. aliases: ["Statement"],
  11305. fields: {
  11306. object: {
  11307. object: (0, _index2.assertNodeType)("Expression")
  11308. },
  11309. body: {
  11310. validate: (0, _index2.assertNodeType)("BlockStatement", "Statement")
  11311. }
  11312. }
  11313. });
  11314. },{"../constants":101,"../index":112,"./index":107}],104:[function(require,module,exports){
  11315. "use strict";
  11316. var _index = require("./index");
  11317. var _index2 = _interopRequireDefault(_index);
  11318. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  11319. (0, _index2.default)("AssignmentPattern", {
  11320. visitor: ["left", "right"],
  11321. aliases: ["Pattern", "LVal"],
  11322. fields: {
  11323. left: {
  11324. validate: (0, _index.assertNodeType)("Identifier")
  11325. },
  11326. right: {
  11327. validate: (0, _index.assertNodeType)("Expression")
  11328. },
  11329. decorators: {
  11330. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Decorator")))
  11331. }
  11332. }
  11333. });
  11334. (0, _index2.default)("ArrayPattern", {
  11335. visitor: ["elements", "typeAnnotation"],
  11336. aliases: ["Pattern", "LVal"],
  11337. fields: {
  11338. elements: {
  11339. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Expression")))
  11340. },
  11341. decorators: {
  11342. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Decorator")))
  11343. }
  11344. }
  11345. });
  11346. (0, _index2.default)("ArrowFunctionExpression", {
  11347. builder: ["params", "body", "async"],
  11348. visitor: ["params", "body", "returnType", "typeParameters"],
  11349. aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"],
  11350. fields: {
  11351. params: {
  11352. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("LVal")))
  11353. },
  11354. body: {
  11355. validate: (0, _index.assertNodeType)("BlockStatement", "Expression")
  11356. },
  11357. async: {
  11358. validate: (0, _index.assertValueType)("boolean"),
  11359. default: false
  11360. }
  11361. }
  11362. });
  11363. (0, _index2.default)("ClassBody", {
  11364. visitor: ["body"],
  11365. fields: {
  11366. body: {
  11367. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("ClassMethod", "ClassProperty")))
  11368. }
  11369. }
  11370. });
  11371. (0, _index2.default)("ClassDeclaration", {
  11372. builder: ["id", "superClass", "body", "decorators"],
  11373. visitor: ["id", "body", "superClass", "mixins", "typeParameters", "superTypeParameters", "implements", "decorators"],
  11374. aliases: ["Scopable", "Class", "Statement", "Declaration", "Pureish"],
  11375. fields: {
  11376. id: {
  11377. validate: (0, _index.assertNodeType)("Identifier")
  11378. },
  11379. body: {
  11380. validate: (0, _index.assertNodeType)("ClassBody")
  11381. },
  11382. superClass: {
  11383. optional: true,
  11384. validate: (0, _index.assertNodeType)("Expression")
  11385. },
  11386. decorators: {
  11387. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Decorator")))
  11388. }
  11389. }
  11390. });
  11391. (0, _index2.default)("ClassExpression", {
  11392. inherits: "ClassDeclaration",
  11393. aliases: ["Scopable", "Class", "Expression", "Pureish"],
  11394. fields: {
  11395. id: {
  11396. optional: true,
  11397. validate: (0, _index.assertNodeType)("Identifier")
  11398. },
  11399. body: {
  11400. validate: (0, _index.assertNodeType)("ClassBody")
  11401. },
  11402. superClass: {
  11403. optional: true,
  11404. validate: (0, _index.assertNodeType)("Expression")
  11405. },
  11406. decorators: {
  11407. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Decorator")))
  11408. }
  11409. }
  11410. });
  11411. (0, _index2.default)("ExportAllDeclaration", {
  11412. visitor: ["source"],
  11413. aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"],
  11414. fields: {
  11415. source: {
  11416. validate: (0, _index.assertNodeType)("StringLiteral")
  11417. }
  11418. }
  11419. });
  11420. (0, _index2.default)("ExportDefaultDeclaration", {
  11421. visitor: ["declaration"],
  11422. aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"],
  11423. fields: {
  11424. declaration: {
  11425. validate: (0, _index.assertNodeType)("FunctionDeclaration", "ClassDeclaration", "Expression")
  11426. }
  11427. }
  11428. });
  11429. (0, _index2.default)("ExportNamedDeclaration", {
  11430. visitor: ["declaration", "specifiers", "source"],
  11431. aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"],
  11432. fields: {
  11433. declaration: {
  11434. validate: (0, _index.assertNodeType)("Declaration"),
  11435. optional: true
  11436. },
  11437. specifiers: {
  11438. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("ExportSpecifier")))
  11439. },
  11440. source: {
  11441. validate: (0, _index.assertNodeType)("StringLiteral"),
  11442. optional: true
  11443. }
  11444. }
  11445. });
  11446. (0, _index2.default)("ExportSpecifier", {
  11447. visitor: ["local", "exported"],
  11448. aliases: ["ModuleSpecifier"],
  11449. fields: {
  11450. local: {
  11451. validate: (0, _index.assertNodeType)("Identifier")
  11452. },
  11453. exported: {
  11454. validate: (0, _index.assertNodeType)("Identifier")
  11455. }
  11456. }
  11457. });
  11458. (0, _index2.default)("ForOfStatement", {
  11459. visitor: ["left", "right", "body"],
  11460. aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"],
  11461. fields: {
  11462. left: {
  11463. validate: (0, _index.assertNodeType)("VariableDeclaration", "LVal")
  11464. },
  11465. right: {
  11466. validate: (0, _index.assertNodeType)("Expression")
  11467. },
  11468. body: {
  11469. validate: (0, _index.assertNodeType)("Statement")
  11470. }
  11471. }
  11472. });
  11473. (0, _index2.default)("ImportDeclaration", {
  11474. visitor: ["specifiers", "source"],
  11475. aliases: ["Statement", "Declaration", "ModuleDeclaration"],
  11476. fields: {
  11477. specifiers: {
  11478. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("ImportSpecifier", "ImportDefaultSpecifier", "ImportNamespaceSpecifier")))
  11479. },
  11480. source: {
  11481. validate: (0, _index.assertNodeType)("StringLiteral")
  11482. }
  11483. }
  11484. });
  11485. (0, _index2.default)("ImportDefaultSpecifier", {
  11486. visitor: ["local"],
  11487. aliases: ["ModuleSpecifier"],
  11488. fields: {
  11489. local: {
  11490. validate: (0, _index.assertNodeType)("Identifier")
  11491. }
  11492. }
  11493. });
  11494. (0, _index2.default)("ImportNamespaceSpecifier", {
  11495. visitor: ["local"],
  11496. aliases: ["ModuleSpecifier"],
  11497. fields: {
  11498. local: {
  11499. validate: (0, _index.assertNodeType)("Identifier")
  11500. }
  11501. }
  11502. });
  11503. (0, _index2.default)("ImportSpecifier", {
  11504. visitor: ["local", "imported"],
  11505. aliases: ["ModuleSpecifier"],
  11506. fields: {
  11507. local: {
  11508. validate: (0, _index.assertNodeType)("Identifier")
  11509. },
  11510. imported: {
  11511. validate: (0, _index.assertNodeType)("Identifier")
  11512. },
  11513. importKind: {
  11514. validate: (0, _index.assertOneOf)(null, "type", "typeof")
  11515. }
  11516. }
  11517. });
  11518. (0, _index2.default)("MetaProperty", {
  11519. visitor: ["meta", "property"],
  11520. aliases: ["Expression"],
  11521. fields: {
  11522. meta: {
  11523. validate: (0, _index.assertValueType)("string")
  11524. },
  11525. property: {
  11526. validate: (0, _index.assertValueType)("string")
  11527. }
  11528. }
  11529. });
  11530. (0, _index2.default)("ClassMethod", {
  11531. aliases: ["Function", "Scopable", "BlockParent", "FunctionParent", "Method"],
  11532. builder: ["kind", "key", "params", "body", "computed", "static"],
  11533. visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"],
  11534. fields: {
  11535. kind: {
  11536. validate: (0, _index.chain)((0, _index.assertValueType)("string"), (0, _index.assertOneOf)("get", "set", "method", "constructor")),
  11537. default: "method"
  11538. },
  11539. computed: {
  11540. default: false,
  11541. validate: (0, _index.assertValueType)("boolean")
  11542. },
  11543. static: {
  11544. default: false,
  11545. validate: (0, _index.assertValueType)("boolean")
  11546. },
  11547. key: {
  11548. validate: function validate(node, key, val) {
  11549. var expectedTypes = node.computed ? ["Expression"] : ["Identifier", "StringLiteral", "NumericLiteral"];
  11550. _index.assertNodeType.apply(undefined, expectedTypes)(node, key, val);
  11551. }
  11552. },
  11553. params: {
  11554. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("LVal")))
  11555. },
  11556. body: {
  11557. validate: (0, _index.assertNodeType)("BlockStatement")
  11558. },
  11559. generator: {
  11560. default: false,
  11561. validate: (0, _index.assertValueType)("boolean")
  11562. },
  11563. async: {
  11564. default: false,
  11565. validate: (0, _index.assertValueType)("boolean")
  11566. }
  11567. }
  11568. });
  11569. (0, _index2.default)("ObjectPattern", {
  11570. visitor: ["properties", "typeAnnotation"],
  11571. aliases: ["Pattern", "LVal"],
  11572. fields: {
  11573. properties: {
  11574. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("RestProperty", "Property")))
  11575. },
  11576. decorators: {
  11577. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Decorator")))
  11578. }
  11579. }
  11580. });
  11581. (0, _index2.default)("SpreadElement", {
  11582. visitor: ["argument"],
  11583. aliases: ["UnaryLike"],
  11584. fields: {
  11585. argument: {
  11586. validate: (0, _index.assertNodeType)("Expression")
  11587. }
  11588. }
  11589. });
  11590. (0, _index2.default)("Super", {
  11591. aliases: ["Expression"]
  11592. });
  11593. (0, _index2.default)("TaggedTemplateExpression", {
  11594. visitor: ["tag", "quasi"],
  11595. aliases: ["Expression"],
  11596. fields: {
  11597. tag: {
  11598. validate: (0, _index.assertNodeType)("Expression")
  11599. },
  11600. quasi: {
  11601. validate: (0, _index.assertNodeType)("TemplateLiteral")
  11602. }
  11603. }
  11604. });
  11605. (0, _index2.default)("TemplateElement", {
  11606. builder: ["value", "tail"],
  11607. fields: {
  11608. value: {},
  11609. tail: {
  11610. validate: (0, _index.assertValueType)("boolean"),
  11611. default: false
  11612. }
  11613. }
  11614. });
  11615. (0, _index2.default)("TemplateLiteral", {
  11616. visitor: ["quasis", "expressions"],
  11617. aliases: ["Expression", "Literal"],
  11618. fields: {
  11619. quasis: {
  11620. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("TemplateElement")))
  11621. },
  11622. expressions: {
  11623. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Expression")))
  11624. }
  11625. }
  11626. });
  11627. (0, _index2.default)("YieldExpression", {
  11628. builder: ["argument", "delegate"],
  11629. visitor: ["argument"],
  11630. aliases: ["Expression", "Terminatorless"],
  11631. fields: {
  11632. delegate: {
  11633. validate: (0, _index.assertValueType)("boolean"),
  11634. default: false
  11635. },
  11636. argument: {
  11637. optional: true,
  11638. validate: (0, _index.assertNodeType)("Expression")
  11639. }
  11640. }
  11641. });
  11642. },{"./index":107}],105:[function(require,module,exports){
  11643. "use strict";
  11644. var _index = require("./index");
  11645. var _index2 = _interopRequireDefault(_index);
  11646. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  11647. (0, _index2.default)("AwaitExpression", {
  11648. builder: ["argument"],
  11649. visitor: ["argument"],
  11650. aliases: ["Expression", "Terminatorless"],
  11651. fields: {
  11652. argument: {
  11653. validate: (0, _index.assertNodeType)("Expression")
  11654. }
  11655. }
  11656. });
  11657. (0, _index2.default)("ForAwaitStatement", {
  11658. visitor: ["left", "right", "body"],
  11659. aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"],
  11660. fields: {
  11661. left: {
  11662. validate: (0, _index.assertNodeType)("VariableDeclaration", "LVal")
  11663. },
  11664. right: {
  11665. validate: (0, _index.assertNodeType)("Expression")
  11666. },
  11667. body: {
  11668. validate: (0, _index.assertNodeType)("Statement")
  11669. }
  11670. }
  11671. });
  11672. (0, _index2.default)("BindExpression", {
  11673. visitor: ["object", "callee"],
  11674. aliases: ["Expression"],
  11675. fields: {}
  11676. });
  11677. (0, _index2.default)("Import", {
  11678. aliases: ["Expression"]
  11679. });
  11680. (0, _index2.default)("Decorator", {
  11681. visitor: ["expression"],
  11682. fields: {
  11683. expression: {
  11684. validate: (0, _index.assertNodeType)("Expression")
  11685. }
  11686. }
  11687. });
  11688. (0, _index2.default)("DoExpression", {
  11689. visitor: ["body"],
  11690. aliases: ["Expression"],
  11691. fields: {
  11692. body: {
  11693. validate: (0, _index.assertNodeType)("BlockStatement")
  11694. }
  11695. }
  11696. });
  11697. (0, _index2.default)("ExportDefaultSpecifier", {
  11698. visitor: ["exported"],
  11699. aliases: ["ModuleSpecifier"],
  11700. fields: {
  11701. exported: {
  11702. validate: (0, _index.assertNodeType)("Identifier")
  11703. }
  11704. }
  11705. });
  11706. (0, _index2.default)("ExportNamespaceSpecifier", {
  11707. visitor: ["exported"],
  11708. aliases: ["ModuleSpecifier"],
  11709. fields: {
  11710. exported: {
  11711. validate: (0, _index.assertNodeType)("Identifier")
  11712. }
  11713. }
  11714. });
  11715. (0, _index2.default)("RestProperty", {
  11716. visitor: ["argument"],
  11717. aliases: ["UnaryLike"],
  11718. fields: {
  11719. argument: {
  11720. validate: (0, _index.assertNodeType)("LVal")
  11721. }
  11722. }
  11723. });
  11724. (0, _index2.default)("SpreadProperty", {
  11725. visitor: ["argument"],
  11726. aliases: ["UnaryLike"],
  11727. fields: {
  11728. argument: {
  11729. validate: (0, _index.assertNodeType)("Expression")
  11730. }
  11731. }
  11732. });
  11733. },{"./index":107}],106:[function(require,module,exports){
  11734. "use strict";
  11735. var _index = require("./index");
  11736. var _index2 = _interopRequireDefault(_index);
  11737. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  11738. (0, _index2.default)("AnyTypeAnnotation", {
  11739. aliases: ["Flow", "FlowBaseAnnotation"],
  11740. fields: {}
  11741. });
  11742. (0, _index2.default)("ArrayTypeAnnotation", {
  11743. visitor: ["elementType"],
  11744. aliases: ["Flow"],
  11745. fields: {}
  11746. });
  11747. (0, _index2.default)("BooleanTypeAnnotation", {
  11748. aliases: ["Flow", "FlowBaseAnnotation"],
  11749. fields: {}
  11750. });
  11751. (0, _index2.default)("BooleanLiteralTypeAnnotation", {
  11752. aliases: ["Flow"],
  11753. fields: {}
  11754. });
  11755. (0, _index2.default)("NullLiteralTypeAnnotation", {
  11756. aliases: ["Flow", "FlowBaseAnnotation"],
  11757. fields: {}
  11758. });
  11759. (0, _index2.default)("ClassImplements", {
  11760. visitor: ["id", "typeParameters"],
  11761. aliases: ["Flow"],
  11762. fields: {}
  11763. });
  11764. (0, _index2.default)("ClassProperty", {
  11765. visitor: ["key", "value", "typeAnnotation", "decorators"],
  11766. builder: ["key", "value", "typeAnnotation", "decorators", "computed"],
  11767. aliases: ["Property"],
  11768. fields: {
  11769. computed: {
  11770. validate: (0, _index.assertValueType)("boolean"),
  11771. default: false
  11772. }
  11773. }
  11774. });
  11775. (0, _index2.default)("DeclareClass", {
  11776. visitor: ["id", "typeParameters", "extends", "body"],
  11777. aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
  11778. fields: {}
  11779. });
  11780. (0, _index2.default)("DeclareFunction", {
  11781. visitor: ["id"],
  11782. aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
  11783. fields: {}
  11784. });
  11785. (0, _index2.default)("DeclareInterface", {
  11786. visitor: ["id", "typeParameters", "extends", "body"],
  11787. aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
  11788. fields: {}
  11789. });
  11790. (0, _index2.default)("DeclareModule", {
  11791. visitor: ["id", "body"],
  11792. aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
  11793. fields: {}
  11794. });
  11795. (0, _index2.default)("DeclareModuleExports", {
  11796. visitor: ["typeAnnotation"],
  11797. aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
  11798. fields: {}
  11799. });
  11800. (0, _index2.default)("DeclareTypeAlias", {
  11801. visitor: ["id", "typeParameters", "right"],
  11802. aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
  11803. fields: {}
  11804. });
  11805. (0, _index2.default)("DeclareVariable", {
  11806. visitor: ["id"],
  11807. aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
  11808. fields: {}
  11809. });
  11810. (0, _index2.default)("ExistentialTypeParam", {
  11811. aliases: ["Flow"]
  11812. });
  11813. (0, _index2.default)("FunctionTypeAnnotation", {
  11814. visitor: ["typeParameters", "params", "rest", "returnType"],
  11815. aliases: ["Flow"],
  11816. fields: {}
  11817. });
  11818. (0, _index2.default)("FunctionTypeParam", {
  11819. visitor: ["name", "typeAnnotation"],
  11820. aliases: ["Flow"],
  11821. fields: {}
  11822. });
  11823. (0, _index2.default)("GenericTypeAnnotation", {
  11824. visitor: ["id", "typeParameters"],
  11825. aliases: ["Flow"],
  11826. fields: {}
  11827. });
  11828. (0, _index2.default)("InterfaceExtends", {
  11829. visitor: ["id", "typeParameters"],
  11830. aliases: ["Flow"],
  11831. fields: {}
  11832. });
  11833. (0, _index2.default)("InterfaceDeclaration", {
  11834. visitor: ["id", "typeParameters", "extends", "body"],
  11835. aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
  11836. fields: {}
  11837. });
  11838. (0, _index2.default)("IntersectionTypeAnnotation", {
  11839. visitor: ["types"],
  11840. aliases: ["Flow"],
  11841. fields: {}
  11842. });
  11843. (0, _index2.default)("MixedTypeAnnotation", {
  11844. aliases: ["Flow", "FlowBaseAnnotation"]
  11845. });
  11846. (0, _index2.default)("EmptyTypeAnnotation", {
  11847. aliases: ["Flow", "FlowBaseAnnotation"]
  11848. });
  11849. (0, _index2.default)("NullableTypeAnnotation", {
  11850. visitor: ["typeAnnotation"],
  11851. aliases: ["Flow"],
  11852. fields: {}
  11853. });
  11854. (0, _index2.default)("NumericLiteralTypeAnnotation", {
  11855. aliases: ["Flow"],
  11856. fields: {}
  11857. });
  11858. (0, _index2.default)("NumberTypeAnnotation", {
  11859. aliases: ["Flow", "FlowBaseAnnotation"],
  11860. fields: {}
  11861. });
  11862. (0, _index2.default)("StringLiteralTypeAnnotation", {
  11863. aliases: ["Flow"],
  11864. fields: {}
  11865. });
  11866. (0, _index2.default)("StringTypeAnnotation", {
  11867. aliases: ["Flow", "FlowBaseAnnotation"],
  11868. fields: {}
  11869. });
  11870. (0, _index2.default)("ThisTypeAnnotation", {
  11871. aliases: ["Flow", "FlowBaseAnnotation"],
  11872. fields: {}
  11873. });
  11874. (0, _index2.default)("TupleTypeAnnotation", {
  11875. visitor: ["types"],
  11876. aliases: ["Flow"],
  11877. fields: {}
  11878. });
  11879. (0, _index2.default)("TypeofTypeAnnotation", {
  11880. visitor: ["argument"],
  11881. aliases: ["Flow"],
  11882. fields: {}
  11883. });
  11884. (0, _index2.default)("TypeAlias", {
  11885. visitor: ["id", "typeParameters", "right"],
  11886. aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
  11887. fields: {}
  11888. });
  11889. (0, _index2.default)("TypeAnnotation", {
  11890. visitor: ["typeAnnotation"],
  11891. aliases: ["Flow"],
  11892. fields: {}
  11893. });
  11894. (0, _index2.default)("TypeCastExpression", {
  11895. visitor: ["expression", "typeAnnotation"],
  11896. aliases: ["Flow", "ExpressionWrapper", "Expression"],
  11897. fields: {}
  11898. });
  11899. (0, _index2.default)("TypeParameter", {
  11900. visitor: ["bound"],
  11901. aliases: ["Flow"],
  11902. fields: {}
  11903. });
  11904. (0, _index2.default)("TypeParameterDeclaration", {
  11905. visitor: ["params"],
  11906. aliases: ["Flow"],
  11907. fields: {}
  11908. });
  11909. (0, _index2.default)("TypeParameterInstantiation", {
  11910. visitor: ["params"],
  11911. aliases: ["Flow"],
  11912. fields: {}
  11913. });
  11914. (0, _index2.default)("ObjectTypeAnnotation", {
  11915. visitor: ["properties", "indexers", "callProperties"],
  11916. aliases: ["Flow"],
  11917. fields: {}
  11918. });
  11919. (0, _index2.default)("ObjectTypeCallProperty", {
  11920. visitor: ["value"],
  11921. aliases: ["Flow", "UserWhitespacable"],
  11922. fields: {}
  11923. });
  11924. (0, _index2.default)("ObjectTypeIndexer", {
  11925. visitor: ["id", "key", "value"],
  11926. aliases: ["Flow", "UserWhitespacable"],
  11927. fields: {}
  11928. });
  11929. (0, _index2.default)("ObjectTypeProperty", {
  11930. visitor: ["key", "value"],
  11931. aliases: ["Flow", "UserWhitespacable"],
  11932. fields: {}
  11933. });
  11934. (0, _index2.default)("QualifiedTypeIdentifier", {
  11935. visitor: ["id", "qualification"],
  11936. aliases: ["Flow"],
  11937. fields: {}
  11938. });
  11939. (0, _index2.default)("UnionTypeAnnotation", {
  11940. visitor: ["types"],
  11941. aliases: ["Flow"],
  11942. fields: {}
  11943. });
  11944. (0, _index2.default)("VoidTypeAnnotation", {
  11945. aliases: ["Flow", "FlowBaseAnnotation"],
  11946. fields: {}
  11947. });
  11948. },{"./index":107}],107:[function(require,module,exports){
  11949. "use strict";
  11950. exports.__esModule = true;
  11951. exports.DEPRECATED_KEYS = exports.BUILDER_KEYS = exports.NODE_FIELDS = exports.ALIAS_KEYS = exports.VISITOR_KEYS = undefined;
  11952. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  11953. var _getIterator3 = _interopRequireDefault(_getIterator2);
  11954. var _stringify = require("babel-runtime/core-js/json/stringify");
  11955. var _stringify2 = _interopRequireDefault(_stringify);
  11956. var _typeof2 = require("babel-runtime/helpers/typeof");
  11957. var _typeof3 = _interopRequireDefault(_typeof2);
  11958. exports.assertEach = assertEach;
  11959. exports.assertOneOf = assertOneOf;
  11960. exports.assertNodeType = assertNodeType;
  11961. exports.assertNodeOrValueType = assertNodeOrValueType;
  11962. exports.assertValueType = assertValueType;
  11963. exports.chain = chain;
  11964. exports.default = defineType;
  11965. var _index = require("../index");
  11966. var t = _interopRequireWildcard(_index);
  11967. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  11968. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  11969. var VISITOR_KEYS = exports.VISITOR_KEYS = {};
  11970. var ALIAS_KEYS = exports.ALIAS_KEYS = {};
  11971. var NODE_FIELDS = exports.NODE_FIELDS = {};
  11972. var BUILDER_KEYS = exports.BUILDER_KEYS = {};
  11973. var DEPRECATED_KEYS = exports.DEPRECATED_KEYS = {};
  11974. function getType(val) {
  11975. if (Array.isArray(val)) {
  11976. return "array";
  11977. } else if (val === null) {
  11978. return "null";
  11979. } else if (val === undefined) {
  11980. return "undefined";
  11981. } else {
  11982. return typeof val === "undefined" ? "undefined" : (0, _typeof3.default)(val);
  11983. }
  11984. }
  11985. function assertEach(callback) {
  11986. function validator(node, key, val) {
  11987. if (!Array.isArray(val)) return;
  11988. for (var i = 0; i < val.length; i++) {
  11989. callback(node, key + "[" + i + "]", val[i]);
  11990. }
  11991. }
  11992. validator.each = callback;
  11993. return validator;
  11994. }
  11995. function assertOneOf() {
  11996. for (var _len = arguments.length, vals = Array(_len), _key = 0; _key < _len; _key++) {
  11997. vals[_key] = arguments[_key];
  11998. }
  11999. function validate(node, key, val) {
  12000. if (vals.indexOf(val) < 0) {
  12001. throw new TypeError("Property " + key + " expected value to be one of " + (0, _stringify2.default)(vals) + " but got " + (0, _stringify2.default)(val));
  12002. }
  12003. }
  12004. validate.oneOf = vals;
  12005. return validate;
  12006. }
  12007. function assertNodeType() {
  12008. for (var _len2 = arguments.length, types = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  12009. types[_key2] = arguments[_key2];
  12010. }
  12011. function validate(node, key, val) {
  12012. var valid = false;
  12013. for (var _iterator = types, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  12014. var _ref;
  12015. if (_isArray) {
  12016. if (_i >= _iterator.length) break;
  12017. _ref = _iterator[_i++];
  12018. } else {
  12019. _i = _iterator.next();
  12020. if (_i.done) break;
  12021. _ref = _i.value;
  12022. }
  12023. var type = _ref;
  12024. if (t.is(type, val)) {
  12025. valid = true;
  12026. break;
  12027. }
  12028. }
  12029. if (!valid) {
  12030. throw new TypeError("Property " + key + " of " + node.type + " expected node to be of a type " + (0, _stringify2.default)(types) + " " + ("but instead got " + (0, _stringify2.default)(val && val.type)));
  12031. }
  12032. }
  12033. validate.oneOfNodeTypes = types;
  12034. return validate;
  12035. }
  12036. function assertNodeOrValueType() {
  12037. for (var _len3 = arguments.length, types = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  12038. types[_key3] = arguments[_key3];
  12039. }
  12040. function validate(node, key, val) {
  12041. var valid = false;
  12042. for (var _iterator2 = types, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  12043. var _ref2;
  12044. if (_isArray2) {
  12045. if (_i2 >= _iterator2.length) break;
  12046. _ref2 = _iterator2[_i2++];
  12047. } else {
  12048. _i2 = _iterator2.next();
  12049. if (_i2.done) break;
  12050. _ref2 = _i2.value;
  12051. }
  12052. var type = _ref2;
  12053. if (getType(val) === type || t.is(type, val)) {
  12054. valid = true;
  12055. break;
  12056. }
  12057. }
  12058. if (!valid) {
  12059. throw new TypeError("Property " + key + " of " + node.type + " expected node to be of a type " + (0, _stringify2.default)(types) + " " + ("but instead got " + (0, _stringify2.default)(val && val.type)));
  12060. }
  12061. }
  12062. validate.oneOfNodeOrValueTypes = types;
  12063. return validate;
  12064. }
  12065. function assertValueType(type) {
  12066. function validate(node, key, val) {
  12067. var valid = getType(val) === type;
  12068. if (!valid) {
  12069. throw new TypeError("Property " + key + " expected type of " + type + " but got " + getType(val));
  12070. }
  12071. }
  12072. validate.type = type;
  12073. return validate;
  12074. }
  12075. function chain() {
  12076. for (var _len4 = arguments.length, fns = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  12077. fns[_key4] = arguments[_key4];
  12078. }
  12079. function validate() {
  12080. for (var _iterator3 = fns, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) {
  12081. var _ref3;
  12082. if (_isArray3) {
  12083. if (_i3 >= _iterator3.length) break;
  12084. _ref3 = _iterator3[_i3++];
  12085. } else {
  12086. _i3 = _iterator3.next();
  12087. if (_i3.done) break;
  12088. _ref3 = _i3.value;
  12089. }
  12090. var fn = _ref3;
  12091. fn.apply(undefined, arguments);
  12092. }
  12093. }
  12094. validate.chainOf = fns;
  12095. return validate;
  12096. }
  12097. function defineType(type) {
  12098. var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  12099. var inherits = opts.inherits && store[opts.inherits] || {};
  12100. opts.fields = opts.fields || inherits.fields || {};
  12101. opts.visitor = opts.visitor || inherits.visitor || [];
  12102. opts.aliases = opts.aliases || inherits.aliases || [];
  12103. opts.builder = opts.builder || inherits.builder || opts.visitor || [];
  12104. if (opts.deprecatedAlias) {
  12105. DEPRECATED_KEYS[opts.deprecatedAlias] = type;
  12106. }
  12107. for (var _iterator4 = opts.visitor.concat(opts.builder), _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) {
  12108. var _ref4;
  12109. if (_isArray4) {
  12110. if (_i4 >= _iterator4.length) break;
  12111. _ref4 = _iterator4[_i4++];
  12112. } else {
  12113. _i4 = _iterator4.next();
  12114. if (_i4.done) break;
  12115. _ref4 = _i4.value;
  12116. }
  12117. var _key5 = _ref4;
  12118. opts.fields[_key5] = opts.fields[_key5] || {};
  12119. }
  12120. for (var key in opts.fields) {
  12121. var field = opts.fields[key];
  12122. if (opts.builder.indexOf(key) === -1) {
  12123. field.optional = true;
  12124. }
  12125. if (field.default === undefined) {
  12126. field.default = null;
  12127. } else if (!field.validate) {
  12128. field.validate = assertValueType(getType(field.default));
  12129. }
  12130. }
  12131. VISITOR_KEYS[type] = opts.visitor;
  12132. BUILDER_KEYS[type] = opts.builder;
  12133. NODE_FIELDS[type] = opts.fields;
  12134. ALIAS_KEYS[type] = opts.aliases;
  12135. store[type] = opts;
  12136. }
  12137. var store = {};
  12138. },{"../index":112,"babel-runtime/core-js/get-iterator":56,"babel-runtime/core-js/json/stringify":57,"babel-runtime/helpers/typeof":74}],108:[function(require,module,exports){
  12139. "use strict";
  12140. require("./index");
  12141. require("./core");
  12142. require("./es2015");
  12143. require("./flow");
  12144. require("./jsx");
  12145. require("./misc");
  12146. require("./experimental");
  12147. },{"./core":103,"./es2015":104,"./experimental":105,"./flow":106,"./index":107,"./jsx":109,"./misc":110}],109:[function(require,module,exports){
  12148. "use strict";
  12149. var _index = require("./index");
  12150. var _index2 = _interopRequireDefault(_index);
  12151. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  12152. (0, _index2.default)("JSXAttribute", {
  12153. visitor: ["name", "value"],
  12154. aliases: ["JSX", "Immutable"],
  12155. fields: {
  12156. name: {
  12157. validate: (0, _index.assertNodeType)("JSXIdentifier", "JSXNamespacedName")
  12158. },
  12159. value: {
  12160. optional: true,
  12161. validate: (0, _index.assertNodeType)("JSXElement", "StringLiteral", "JSXExpressionContainer")
  12162. }
  12163. }
  12164. });
  12165. (0, _index2.default)("JSXClosingElement", {
  12166. visitor: ["name"],
  12167. aliases: ["JSX", "Immutable"],
  12168. fields: {
  12169. name: {
  12170. validate: (0, _index.assertNodeType)("JSXIdentifier", "JSXMemberExpression")
  12171. }
  12172. }
  12173. });
  12174. (0, _index2.default)("JSXElement", {
  12175. builder: ["openingElement", "closingElement", "children", "selfClosing"],
  12176. visitor: ["openingElement", "children", "closingElement"],
  12177. aliases: ["JSX", "Immutable", "Expression"],
  12178. fields: {
  12179. openingElement: {
  12180. validate: (0, _index.assertNodeType)("JSXOpeningElement")
  12181. },
  12182. closingElement: {
  12183. optional: true,
  12184. validate: (0, _index.assertNodeType)("JSXClosingElement")
  12185. },
  12186. children: {
  12187. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("JSXText", "JSXExpressionContainer", "JSXSpreadChild", "JSXElement")))
  12188. }
  12189. }
  12190. });
  12191. (0, _index2.default)("JSXEmptyExpression", {
  12192. aliases: ["JSX", "Expression"]
  12193. });
  12194. (0, _index2.default)("JSXExpressionContainer", {
  12195. visitor: ["expression"],
  12196. aliases: ["JSX", "Immutable"],
  12197. fields: {
  12198. expression: {
  12199. validate: (0, _index.assertNodeType)("Expression")
  12200. }
  12201. }
  12202. });
  12203. (0, _index2.default)("JSXSpreadChild", {
  12204. visitor: ["expression"],
  12205. aliases: ["JSX", "Immutable"],
  12206. fields: {
  12207. expression: {
  12208. validate: (0, _index.assertNodeType)("Expression")
  12209. }
  12210. }
  12211. });
  12212. (0, _index2.default)("JSXIdentifier", {
  12213. builder: ["name"],
  12214. aliases: ["JSX", "Expression"],
  12215. fields: {
  12216. name: {
  12217. validate: (0, _index.assertValueType)("string")
  12218. }
  12219. }
  12220. });
  12221. (0, _index2.default)("JSXMemberExpression", {
  12222. visitor: ["object", "property"],
  12223. aliases: ["JSX", "Expression"],
  12224. fields: {
  12225. object: {
  12226. validate: (0, _index.assertNodeType)("JSXMemberExpression", "JSXIdentifier")
  12227. },
  12228. property: {
  12229. validate: (0, _index.assertNodeType)("JSXIdentifier")
  12230. }
  12231. }
  12232. });
  12233. (0, _index2.default)("JSXNamespacedName", {
  12234. visitor: ["namespace", "name"],
  12235. aliases: ["JSX"],
  12236. fields: {
  12237. namespace: {
  12238. validate: (0, _index.assertNodeType)("JSXIdentifier")
  12239. },
  12240. name: {
  12241. validate: (0, _index.assertNodeType)("JSXIdentifier")
  12242. }
  12243. }
  12244. });
  12245. (0, _index2.default)("JSXOpeningElement", {
  12246. builder: ["name", "attributes", "selfClosing"],
  12247. visitor: ["name", "attributes"],
  12248. aliases: ["JSX", "Immutable"],
  12249. fields: {
  12250. name: {
  12251. validate: (0, _index.assertNodeType)("JSXIdentifier", "JSXMemberExpression")
  12252. },
  12253. selfClosing: {
  12254. default: false,
  12255. validate: (0, _index.assertValueType)("boolean")
  12256. },
  12257. attributes: {
  12258. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("JSXAttribute", "JSXSpreadAttribute")))
  12259. }
  12260. }
  12261. });
  12262. (0, _index2.default)("JSXSpreadAttribute", {
  12263. visitor: ["argument"],
  12264. aliases: ["JSX"],
  12265. fields: {
  12266. argument: {
  12267. validate: (0, _index.assertNodeType)("Expression")
  12268. }
  12269. }
  12270. });
  12271. (0, _index2.default)("JSXText", {
  12272. aliases: ["JSX", "Immutable"],
  12273. builder: ["value"],
  12274. fields: {
  12275. value: {
  12276. validate: (0, _index.assertValueType)("string")
  12277. }
  12278. }
  12279. });
  12280. },{"./index":107}],110:[function(require,module,exports){
  12281. "use strict";
  12282. var _index = require("./index");
  12283. var _index2 = _interopRequireDefault(_index);
  12284. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  12285. (0, _index2.default)("Noop", {
  12286. visitor: []
  12287. });
  12288. (0, _index2.default)("ParenthesizedExpression", {
  12289. visitor: ["expression"],
  12290. aliases: ["Expression", "ExpressionWrapper"],
  12291. fields: {
  12292. expression: {
  12293. validate: (0, _index.assertNodeType)("Expression")
  12294. }
  12295. }
  12296. });
  12297. },{"./index":107}],111:[function(require,module,exports){
  12298. "use strict";
  12299. exports.__esModule = true;
  12300. exports.createUnionTypeAnnotation = createUnionTypeAnnotation;
  12301. exports.removeTypeDuplicates = removeTypeDuplicates;
  12302. exports.createTypeAnnotationBasedOnTypeof = createTypeAnnotationBasedOnTypeof;
  12303. var _index = require("./index");
  12304. var t = _interopRequireWildcard(_index);
  12305. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  12306. function createUnionTypeAnnotation(types) {
  12307. var flattened = removeTypeDuplicates(types);
  12308. if (flattened.length === 1) {
  12309. return flattened[0];
  12310. } else {
  12311. return t.unionTypeAnnotation(flattened);
  12312. }
  12313. }
  12314. function removeTypeDuplicates(nodes) {
  12315. var generics = {};
  12316. var bases = {};
  12317. var typeGroups = [];
  12318. var types = [];
  12319. for (var i = 0; i < nodes.length; i++) {
  12320. var node = nodes[i];
  12321. if (!node) continue;
  12322. if (types.indexOf(node) >= 0) {
  12323. continue;
  12324. }
  12325. if (t.isAnyTypeAnnotation(node)) {
  12326. return [node];
  12327. }
  12328. if (t.isFlowBaseAnnotation(node)) {
  12329. bases[node.type] = node;
  12330. continue;
  12331. }
  12332. if (t.isUnionTypeAnnotation(node)) {
  12333. if (typeGroups.indexOf(node.types) < 0) {
  12334. nodes = nodes.concat(node.types);
  12335. typeGroups.push(node.types);
  12336. }
  12337. continue;
  12338. }
  12339. if (t.isGenericTypeAnnotation(node)) {
  12340. var name = node.id.name;
  12341. if (generics[name]) {
  12342. var existing = generics[name];
  12343. if (existing.typeParameters) {
  12344. if (node.typeParameters) {
  12345. existing.typeParameters.params = removeTypeDuplicates(existing.typeParameters.params.concat(node.typeParameters.params));
  12346. }
  12347. } else {
  12348. existing = node.typeParameters;
  12349. }
  12350. } else {
  12351. generics[name] = node;
  12352. }
  12353. continue;
  12354. }
  12355. types.push(node);
  12356. }
  12357. for (var type in bases) {
  12358. types.push(bases[type]);
  12359. }
  12360. for (var _name in generics) {
  12361. types.push(generics[_name]);
  12362. }
  12363. return types;
  12364. }
  12365. function createTypeAnnotationBasedOnTypeof(type) {
  12366. if (type === "string") {
  12367. return t.stringTypeAnnotation();
  12368. } else if (type === "number") {
  12369. return t.numberTypeAnnotation();
  12370. } else if (type === "undefined") {
  12371. return t.voidTypeAnnotation();
  12372. } else if (type === "boolean") {
  12373. return t.booleanTypeAnnotation();
  12374. } else if (type === "function") {
  12375. return t.genericTypeAnnotation(t.identifier("Function"));
  12376. } else if (type === "object") {
  12377. return t.genericTypeAnnotation(t.identifier("Object"));
  12378. } else if (type === "symbol") {
  12379. return t.genericTypeAnnotation(t.identifier("Symbol"));
  12380. } else {
  12381. throw new Error("Invalid typeof value");
  12382. }
  12383. }
  12384. },{"./index":112}],112:[function(require,module,exports){
  12385. "use strict";
  12386. exports.__esModule = true;
  12387. exports.createTypeAnnotationBasedOnTypeof = exports.removeTypeDuplicates = exports.createUnionTypeAnnotation = exports.valueToNode = exports.toBlock = exports.toExpression = exports.toStatement = exports.toBindingIdentifierName = exports.toIdentifier = exports.toKeyAlias = exports.toSequenceExpression = exports.toComputedKey = exports.isNodesEquivalent = exports.isImmutable = exports.isScope = exports.isSpecifierDefault = exports.isVar = exports.isBlockScoped = exports.isLet = exports.isValidIdentifier = exports.isReferenced = exports.isBinding = exports.getOuterBindingIdentifiers = exports.getBindingIdentifiers = exports.TYPES = exports.react = exports.DEPRECATED_KEYS = exports.BUILDER_KEYS = exports.NODE_FIELDS = exports.ALIAS_KEYS = exports.VISITOR_KEYS = exports.NOT_LOCAL_BINDING = exports.BLOCK_SCOPED_SYMBOL = exports.INHERIT_KEYS = exports.UNARY_OPERATORS = exports.STRING_UNARY_OPERATORS = exports.NUMBER_UNARY_OPERATORS = exports.BOOLEAN_UNARY_OPERATORS = exports.BINARY_OPERATORS = exports.NUMBER_BINARY_OPERATORS = exports.BOOLEAN_BINARY_OPERATORS = exports.COMPARISON_BINARY_OPERATORS = exports.EQUALITY_BINARY_OPERATORS = exports.BOOLEAN_NUMBER_BINARY_OPERATORS = exports.UPDATE_OPERATORS = exports.LOGICAL_OPERATORS = exports.COMMENT_KEYS = exports.FOR_INIT_KEYS = exports.FLATTENABLE_KEYS = exports.STATEMENT_OR_BLOCK_KEYS = undefined;
  12388. var _getOwnPropertySymbols = require("babel-runtime/core-js/object/get-own-property-symbols");
  12389. var _getOwnPropertySymbols2 = _interopRequireDefault(_getOwnPropertySymbols);
  12390. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  12391. var _getIterator3 = _interopRequireDefault(_getIterator2);
  12392. var _keys = require("babel-runtime/core-js/object/keys");
  12393. var _keys2 = _interopRequireDefault(_keys);
  12394. var _stringify = require("babel-runtime/core-js/json/stringify");
  12395. var _stringify2 = _interopRequireDefault(_stringify);
  12396. var _constants = require("./constants");
  12397. Object.defineProperty(exports, "STATEMENT_OR_BLOCK_KEYS", {
  12398. enumerable: true,
  12399. get: function get() {
  12400. return _constants.STATEMENT_OR_BLOCK_KEYS;
  12401. }
  12402. });
  12403. Object.defineProperty(exports, "FLATTENABLE_KEYS", {
  12404. enumerable: true,
  12405. get: function get() {
  12406. return _constants.FLATTENABLE_KEYS;
  12407. }
  12408. });
  12409. Object.defineProperty(exports, "FOR_INIT_KEYS", {
  12410. enumerable: true,
  12411. get: function get() {
  12412. return _constants.FOR_INIT_KEYS;
  12413. }
  12414. });
  12415. Object.defineProperty(exports, "COMMENT_KEYS", {
  12416. enumerable: true,
  12417. get: function get() {
  12418. return _constants.COMMENT_KEYS;
  12419. }
  12420. });
  12421. Object.defineProperty(exports, "LOGICAL_OPERATORS", {
  12422. enumerable: true,
  12423. get: function get() {
  12424. return _constants.LOGICAL_OPERATORS;
  12425. }
  12426. });
  12427. Object.defineProperty(exports, "UPDATE_OPERATORS", {
  12428. enumerable: true,
  12429. get: function get() {
  12430. return _constants.UPDATE_OPERATORS;
  12431. }
  12432. });
  12433. Object.defineProperty(exports, "BOOLEAN_NUMBER_BINARY_OPERATORS", {
  12434. enumerable: true,
  12435. get: function get() {
  12436. return _constants.BOOLEAN_NUMBER_BINARY_OPERATORS;
  12437. }
  12438. });
  12439. Object.defineProperty(exports, "EQUALITY_BINARY_OPERATORS", {
  12440. enumerable: true,
  12441. get: function get() {
  12442. return _constants.EQUALITY_BINARY_OPERATORS;
  12443. }
  12444. });
  12445. Object.defineProperty(exports, "COMPARISON_BINARY_OPERATORS", {
  12446. enumerable: true,
  12447. get: function get() {
  12448. return _constants.COMPARISON_BINARY_OPERATORS;
  12449. }
  12450. });
  12451. Object.defineProperty(exports, "BOOLEAN_BINARY_OPERATORS", {
  12452. enumerable: true,
  12453. get: function get() {
  12454. return _constants.BOOLEAN_BINARY_OPERATORS;
  12455. }
  12456. });
  12457. Object.defineProperty(exports, "NUMBER_BINARY_OPERATORS", {
  12458. enumerable: true,
  12459. get: function get() {
  12460. return _constants.NUMBER_BINARY_OPERATORS;
  12461. }
  12462. });
  12463. Object.defineProperty(exports, "BINARY_OPERATORS", {
  12464. enumerable: true,
  12465. get: function get() {
  12466. return _constants.BINARY_OPERATORS;
  12467. }
  12468. });
  12469. Object.defineProperty(exports, "BOOLEAN_UNARY_OPERATORS", {
  12470. enumerable: true,
  12471. get: function get() {
  12472. return _constants.BOOLEAN_UNARY_OPERATORS;
  12473. }
  12474. });
  12475. Object.defineProperty(exports, "NUMBER_UNARY_OPERATORS", {
  12476. enumerable: true,
  12477. get: function get() {
  12478. return _constants.NUMBER_UNARY_OPERATORS;
  12479. }
  12480. });
  12481. Object.defineProperty(exports, "STRING_UNARY_OPERATORS", {
  12482. enumerable: true,
  12483. get: function get() {
  12484. return _constants.STRING_UNARY_OPERATORS;
  12485. }
  12486. });
  12487. Object.defineProperty(exports, "UNARY_OPERATORS", {
  12488. enumerable: true,
  12489. get: function get() {
  12490. return _constants.UNARY_OPERATORS;
  12491. }
  12492. });
  12493. Object.defineProperty(exports, "INHERIT_KEYS", {
  12494. enumerable: true,
  12495. get: function get() {
  12496. return _constants.INHERIT_KEYS;
  12497. }
  12498. });
  12499. Object.defineProperty(exports, "BLOCK_SCOPED_SYMBOL", {
  12500. enumerable: true,
  12501. get: function get() {
  12502. return _constants.BLOCK_SCOPED_SYMBOL;
  12503. }
  12504. });
  12505. Object.defineProperty(exports, "NOT_LOCAL_BINDING", {
  12506. enumerable: true,
  12507. get: function get() {
  12508. return _constants.NOT_LOCAL_BINDING;
  12509. }
  12510. });
  12511. exports.is = is;
  12512. exports.isType = isType;
  12513. exports.validate = validate;
  12514. exports.shallowEqual = shallowEqual;
  12515. exports.appendToMemberExpression = appendToMemberExpression;
  12516. exports.prependToMemberExpression = prependToMemberExpression;
  12517. exports.ensureBlock = ensureBlock;
  12518. exports.clone = clone;
  12519. exports.cloneWithoutLoc = cloneWithoutLoc;
  12520. exports.cloneDeep = cloneDeep;
  12521. exports.buildMatchMemberExpression = buildMatchMemberExpression;
  12522. exports.removeComments = removeComments;
  12523. exports.inheritsComments = inheritsComments;
  12524. exports.inheritTrailingComments = inheritTrailingComments;
  12525. exports.inheritLeadingComments = inheritLeadingComments;
  12526. exports.inheritInnerComments = inheritInnerComments;
  12527. exports.inherits = inherits;
  12528. exports.assertNode = assertNode;
  12529. exports.isNode = isNode;
  12530. exports.traverseFast = traverseFast;
  12531. exports.removeProperties = removeProperties;
  12532. exports.removePropertiesDeep = removePropertiesDeep;
  12533. var _retrievers = require("./retrievers");
  12534. Object.defineProperty(exports, "getBindingIdentifiers", {
  12535. enumerable: true,
  12536. get: function get() {
  12537. return _retrievers.getBindingIdentifiers;
  12538. }
  12539. });
  12540. Object.defineProperty(exports, "getOuterBindingIdentifiers", {
  12541. enumerable: true,
  12542. get: function get() {
  12543. return _retrievers.getOuterBindingIdentifiers;
  12544. }
  12545. });
  12546. var _validators = require("./validators");
  12547. Object.defineProperty(exports, "isBinding", {
  12548. enumerable: true,
  12549. get: function get() {
  12550. return _validators.isBinding;
  12551. }
  12552. });
  12553. Object.defineProperty(exports, "isReferenced", {
  12554. enumerable: true,
  12555. get: function get() {
  12556. return _validators.isReferenced;
  12557. }
  12558. });
  12559. Object.defineProperty(exports, "isValidIdentifier", {
  12560. enumerable: true,
  12561. get: function get() {
  12562. return _validators.isValidIdentifier;
  12563. }
  12564. });
  12565. Object.defineProperty(exports, "isLet", {
  12566. enumerable: true,
  12567. get: function get() {
  12568. return _validators.isLet;
  12569. }
  12570. });
  12571. Object.defineProperty(exports, "isBlockScoped", {
  12572. enumerable: true,
  12573. get: function get() {
  12574. return _validators.isBlockScoped;
  12575. }
  12576. });
  12577. Object.defineProperty(exports, "isVar", {
  12578. enumerable: true,
  12579. get: function get() {
  12580. return _validators.isVar;
  12581. }
  12582. });
  12583. Object.defineProperty(exports, "isSpecifierDefault", {
  12584. enumerable: true,
  12585. get: function get() {
  12586. return _validators.isSpecifierDefault;
  12587. }
  12588. });
  12589. Object.defineProperty(exports, "isScope", {
  12590. enumerable: true,
  12591. get: function get() {
  12592. return _validators.isScope;
  12593. }
  12594. });
  12595. Object.defineProperty(exports, "isImmutable", {
  12596. enumerable: true,
  12597. get: function get() {
  12598. return _validators.isImmutable;
  12599. }
  12600. });
  12601. Object.defineProperty(exports, "isNodesEquivalent", {
  12602. enumerable: true,
  12603. get: function get() {
  12604. return _validators.isNodesEquivalent;
  12605. }
  12606. });
  12607. var _converters = require("./converters");
  12608. Object.defineProperty(exports, "toComputedKey", {
  12609. enumerable: true,
  12610. get: function get() {
  12611. return _converters.toComputedKey;
  12612. }
  12613. });
  12614. Object.defineProperty(exports, "toSequenceExpression", {
  12615. enumerable: true,
  12616. get: function get() {
  12617. return _converters.toSequenceExpression;
  12618. }
  12619. });
  12620. Object.defineProperty(exports, "toKeyAlias", {
  12621. enumerable: true,
  12622. get: function get() {
  12623. return _converters.toKeyAlias;
  12624. }
  12625. });
  12626. Object.defineProperty(exports, "toIdentifier", {
  12627. enumerable: true,
  12628. get: function get() {
  12629. return _converters.toIdentifier;
  12630. }
  12631. });
  12632. Object.defineProperty(exports, "toBindingIdentifierName", {
  12633. enumerable: true,
  12634. get: function get() {
  12635. return _converters.toBindingIdentifierName;
  12636. }
  12637. });
  12638. Object.defineProperty(exports, "toStatement", {
  12639. enumerable: true,
  12640. get: function get() {
  12641. return _converters.toStatement;
  12642. }
  12643. });
  12644. Object.defineProperty(exports, "toExpression", {
  12645. enumerable: true,
  12646. get: function get() {
  12647. return _converters.toExpression;
  12648. }
  12649. });
  12650. Object.defineProperty(exports, "toBlock", {
  12651. enumerable: true,
  12652. get: function get() {
  12653. return _converters.toBlock;
  12654. }
  12655. });
  12656. Object.defineProperty(exports, "valueToNode", {
  12657. enumerable: true,
  12658. get: function get() {
  12659. return _converters.valueToNode;
  12660. }
  12661. });
  12662. var _flow = require("./flow");
  12663. Object.defineProperty(exports, "createUnionTypeAnnotation", {
  12664. enumerable: true,
  12665. get: function get() {
  12666. return _flow.createUnionTypeAnnotation;
  12667. }
  12668. });
  12669. Object.defineProperty(exports, "removeTypeDuplicates", {
  12670. enumerable: true,
  12671. get: function get() {
  12672. return _flow.removeTypeDuplicates;
  12673. }
  12674. });
  12675. Object.defineProperty(exports, "createTypeAnnotationBasedOnTypeof", {
  12676. enumerable: true,
  12677. get: function get() {
  12678. return _flow.createTypeAnnotationBasedOnTypeof;
  12679. }
  12680. });
  12681. var _toFastProperties = require("to-fast-properties");
  12682. var _toFastProperties2 = _interopRequireDefault(_toFastProperties);
  12683. var _clone = require("lodash/clone");
  12684. var _clone2 = _interopRequireDefault(_clone);
  12685. var _uniq = require("lodash/uniq");
  12686. var _uniq2 = _interopRequireDefault(_uniq);
  12687. require("./definitions/init");
  12688. var _definitions = require("./definitions");
  12689. var _react2 = require("./react");
  12690. var _react = _interopRequireWildcard(_react2);
  12691. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  12692. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  12693. var t = exports;
  12694. function registerType(type) {
  12695. var is = t["is" + type];
  12696. if (!is) {
  12697. is = t["is" + type] = function (node, opts) {
  12698. return t.is(type, node, opts);
  12699. };
  12700. }
  12701. t["assert" + type] = function (node, opts) {
  12702. opts = opts || {};
  12703. if (!is(node, opts)) {
  12704. throw new Error("Expected type " + (0, _stringify2.default)(type) + " with option " + (0, _stringify2.default)(opts));
  12705. }
  12706. };
  12707. }
  12708. exports.VISITOR_KEYS = _definitions.VISITOR_KEYS;
  12709. exports.ALIAS_KEYS = _definitions.ALIAS_KEYS;
  12710. exports.NODE_FIELDS = _definitions.NODE_FIELDS;
  12711. exports.BUILDER_KEYS = _definitions.BUILDER_KEYS;
  12712. exports.DEPRECATED_KEYS = _definitions.DEPRECATED_KEYS;
  12713. exports.react = _react;
  12714. for (var type in t.VISITOR_KEYS) {
  12715. registerType(type);
  12716. }
  12717. t.FLIPPED_ALIAS_KEYS = {};
  12718. (0, _keys2.default)(t.ALIAS_KEYS).forEach(function (type) {
  12719. t.ALIAS_KEYS[type].forEach(function (alias) {
  12720. var types = t.FLIPPED_ALIAS_KEYS[alias] = t.FLIPPED_ALIAS_KEYS[alias] || [];
  12721. types.push(type);
  12722. });
  12723. });
  12724. (0, _keys2.default)(t.FLIPPED_ALIAS_KEYS).forEach(function (type) {
  12725. t[type.toUpperCase() + "_TYPES"] = t.FLIPPED_ALIAS_KEYS[type];
  12726. registerType(type);
  12727. });
  12728. var TYPES = exports.TYPES = (0, _keys2.default)(t.VISITOR_KEYS).concat((0, _keys2.default)(t.FLIPPED_ALIAS_KEYS)).concat((0, _keys2.default)(t.DEPRECATED_KEYS));
  12729. function is(type, node, opts) {
  12730. if (!node) return false;
  12731. var matches = isType(node.type, type);
  12732. if (!matches) return false;
  12733. if (typeof opts === "undefined") {
  12734. return true;
  12735. } else {
  12736. return t.shallowEqual(node, opts);
  12737. }
  12738. }
  12739. function isType(nodeType, targetType) {
  12740. if (nodeType === targetType) return true;
  12741. if (t.ALIAS_KEYS[targetType]) return false;
  12742. var aliases = t.FLIPPED_ALIAS_KEYS[targetType];
  12743. if (aliases) {
  12744. if (aliases[0] === nodeType) return true;
  12745. for (var _iterator = aliases, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  12746. var _ref;
  12747. if (_isArray) {
  12748. if (_i >= _iterator.length) break;
  12749. _ref = _iterator[_i++];
  12750. } else {
  12751. _i = _iterator.next();
  12752. if (_i.done) break;
  12753. _ref = _i.value;
  12754. }
  12755. var alias = _ref;
  12756. if (nodeType === alias) return true;
  12757. }
  12758. }
  12759. return false;
  12760. }
  12761. (0, _keys2.default)(t.BUILDER_KEYS).forEach(function (type) {
  12762. var keys = t.BUILDER_KEYS[type];
  12763. function builder() {
  12764. if (arguments.length > keys.length) {
  12765. throw new Error("t." + type + ": Too many arguments passed. Received " + arguments.length + " but can receive " + ("no more than " + keys.length));
  12766. }
  12767. var node = {};
  12768. node.type = type;
  12769. var i = 0;
  12770. for (var _iterator2 = keys, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  12771. var _ref2;
  12772. if (_isArray2) {
  12773. if (_i2 >= _iterator2.length) break;
  12774. _ref2 = _iterator2[_i2++];
  12775. } else {
  12776. _i2 = _iterator2.next();
  12777. if (_i2.done) break;
  12778. _ref2 = _i2.value;
  12779. }
  12780. var _key = _ref2;
  12781. var field = t.NODE_FIELDS[type][_key];
  12782. var arg = arguments[i++];
  12783. if (arg === undefined) arg = (0, _clone2.default)(field.default);
  12784. node[_key] = arg;
  12785. }
  12786. for (var key in node) {
  12787. validate(node, key, node[key]);
  12788. }
  12789. return node;
  12790. }
  12791. t[type] = builder;
  12792. t[type[0].toLowerCase() + type.slice(1)] = builder;
  12793. });
  12794. var _loop = function _loop(_type) {
  12795. var newType = t.DEPRECATED_KEYS[_type];
  12796. function proxy(fn) {
  12797. return function () {
  12798. console.trace("The node type " + _type + " has been renamed to " + newType);
  12799. return fn.apply(this, arguments);
  12800. };
  12801. }
  12802. t[_type] = t[_type[0].toLowerCase() + _type.slice(1)] = proxy(t[newType]);
  12803. t["is" + _type] = proxy(t["is" + newType]);
  12804. t["assert" + _type] = proxy(t["assert" + newType]);
  12805. };
  12806. for (var _type in t.DEPRECATED_KEYS) {
  12807. _loop(_type);
  12808. }
  12809. function validate(node, key, val) {
  12810. if (!node) return;
  12811. var fields = t.NODE_FIELDS[node.type];
  12812. if (!fields) return;
  12813. var field = fields[key];
  12814. if (!field || !field.validate) return;
  12815. if (field.optional && val == null) return;
  12816. field.validate(node, key, val);
  12817. }
  12818. function shallowEqual(actual, expected) {
  12819. var keys = (0, _keys2.default)(expected);
  12820. for (var _iterator3 = keys, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) {
  12821. var _ref3;
  12822. if (_isArray3) {
  12823. if (_i3 >= _iterator3.length) break;
  12824. _ref3 = _iterator3[_i3++];
  12825. } else {
  12826. _i3 = _iterator3.next();
  12827. if (_i3.done) break;
  12828. _ref3 = _i3.value;
  12829. }
  12830. var key = _ref3;
  12831. if (actual[key] !== expected[key]) {
  12832. return false;
  12833. }
  12834. }
  12835. return true;
  12836. }
  12837. function appendToMemberExpression(member, append, computed) {
  12838. member.object = t.memberExpression(member.object, member.property, member.computed);
  12839. member.property = append;
  12840. member.computed = !!computed;
  12841. return member;
  12842. }
  12843. function prependToMemberExpression(member, prepend) {
  12844. member.object = t.memberExpression(prepend, member.object);
  12845. return member;
  12846. }
  12847. function ensureBlock(node) {
  12848. var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "body";
  12849. return node[key] = t.toBlock(node[key], node);
  12850. }
  12851. function clone(node) {
  12852. if (!node) return node;
  12853. var newNode = {};
  12854. for (var key in node) {
  12855. if (key[0] === "_") continue;
  12856. newNode[key] = node[key];
  12857. }
  12858. return newNode;
  12859. }
  12860. function cloneWithoutLoc(node) {
  12861. var newNode = clone(node);
  12862. delete newNode.loc;
  12863. return newNode;
  12864. }
  12865. function cloneDeep(node) {
  12866. if (!node) return node;
  12867. var newNode = {};
  12868. for (var key in node) {
  12869. if (key[0] === "_") continue;
  12870. var val = node[key];
  12871. if (val) {
  12872. if (val.type) {
  12873. val = t.cloneDeep(val);
  12874. } else if (Array.isArray(val)) {
  12875. val = val.map(t.cloneDeep);
  12876. }
  12877. }
  12878. newNode[key] = val;
  12879. }
  12880. return newNode;
  12881. }
  12882. function buildMatchMemberExpression(match, allowPartial) {
  12883. var parts = match.split(".");
  12884. return function (member) {
  12885. if (!t.isMemberExpression(member)) return false;
  12886. var search = [member];
  12887. var i = 0;
  12888. while (search.length) {
  12889. var node = search.shift();
  12890. if (allowPartial && i === parts.length) {
  12891. return true;
  12892. }
  12893. if (t.isIdentifier(node)) {
  12894. if (parts[i] !== node.name) return false;
  12895. } else if (t.isStringLiteral(node)) {
  12896. if (parts[i] !== node.value) return false;
  12897. } else if (t.isMemberExpression(node)) {
  12898. if (node.computed && !t.isStringLiteral(node.property)) {
  12899. return false;
  12900. } else {
  12901. search.push(node.object);
  12902. search.push(node.property);
  12903. continue;
  12904. }
  12905. } else {
  12906. return false;
  12907. }
  12908. if (++i > parts.length) {
  12909. return false;
  12910. }
  12911. }
  12912. return true;
  12913. };
  12914. }
  12915. function removeComments(node) {
  12916. for (var _iterator4 = t.COMMENT_KEYS, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) {
  12917. var _ref4;
  12918. if (_isArray4) {
  12919. if (_i4 >= _iterator4.length) break;
  12920. _ref4 = _iterator4[_i4++];
  12921. } else {
  12922. _i4 = _iterator4.next();
  12923. if (_i4.done) break;
  12924. _ref4 = _i4.value;
  12925. }
  12926. var key = _ref4;
  12927. delete node[key];
  12928. }
  12929. return node;
  12930. }
  12931. function inheritsComments(child, parent) {
  12932. inheritTrailingComments(child, parent);
  12933. inheritLeadingComments(child, parent);
  12934. inheritInnerComments(child, parent);
  12935. return child;
  12936. }
  12937. function inheritTrailingComments(child, parent) {
  12938. _inheritComments("trailingComments", child, parent);
  12939. }
  12940. function inheritLeadingComments(child, parent) {
  12941. _inheritComments("leadingComments", child, parent);
  12942. }
  12943. function inheritInnerComments(child, parent) {
  12944. _inheritComments("innerComments", child, parent);
  12945. }
  12946. function _inheritComments(key, child, parent) {
  12947. if (child && parent) {
  12948. child[key] = (0, _uniq2.default)([].concat(child[key], parent[key]).filter(Boolean));
  12949. }
  12950. }
  12951. function inherits(child, parent) {
  12952. if (!child || !parent) return child;
  12953. for (var _iterator5 = t.INHERIT_KEYS.optional, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : (0, _getIterator3.default)(_iterator5);;) {
  12954. var _ref5;
  12955. if (_isArray5) {
  12956. if (_i5 >= _iterator5.length) break;
  12957. _ref5 = _iterator5[_i5++];
  12958. } else {
  12959. _i5 = _iterator5.next();
  12960. if (_i5.done) break;
  12961. _ref5 = _i5.value;
  12962. }
  12963. var _key2 = _ref5;
  12964. if (child[_key2] == null) {
  12965. child[_key2] = parent[_key2];
  12966. }
  12967. }
  12968. for (var key in parent) {
  12969. if (key[0] === "_") child[key] = parent[key];
  12970. }
  12971. for (var _iterator6 = t.INHERIT_KEYS.force, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : (0, _getIterator3.default)(_iterator6);;) {
  12972. var _ref6;
  12973. if (_isArray6) {
  12974. if (_i6 >= _iterator6.length) break;
  12975. _ref6 = _iterator6[_i6++];
  12976. } else {
  12977. _i6 = _iterator6.next();
  12978. if (_i6.done) break;
  12979. _ref6 = _i6.value;
  12980. }
  12981. var _key3 = _ref6;
  12982. child[_key3] = parent[_key3];
  12983. }
  12984. t.inheritsComments(child, parent);
  12985. return child;
  12986. }
  12987. function assertNode(node) {
  12988. if (!isNode(node)) {
  12989. throw new TypeError("Not a valid node " + (node && node.type));
  12990. }
  12991. }
  12992. function isNode(node) {
  12993. return !!(node && _definitions.VISITOR_KEYS[node.type]);
  12994. }
  12995. (0, _toFastProperties2.default)(t);
  12996. (0, _toFastProperties2.default)(t.VISITOR_KEYS);
  12997. function traverseFast(node, enter, opts) {
  12998. if (!node) return;
  12999. var keys = t.VISITOR_KEYS[node.type];
  13000. if (!keys) return;
  13001. opts = opts || {};
  13002. enter(node, opts);
  13003. for (var _iterator7 = keys, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : (0, _getIterator3.default)(_iterator7);;) {
  13004. var _ref7;
  13005. if (_isArray7) {
  13006. if (_i7 >= _iterator7.length) break;
  13007. _ref7 = _iterator7[_i7++];
  13008. } else {
  13009. _i7 = _iterator7.next();
  13010. if (_i7.done) break;
  13011. _ref7 = _i7.value;
  13012. }
  13013. var key = _ref7;
  13014. var subNode = node[key];
  13015. if (Array.isArray(subNode)) {
  13016. for (var _iterator8 = subNode, _isArray8 = Array.isArray(_iterator8), _i8 = 0, _iterator8 = _isArray8 ? _iterator8 : (0, _getIterator3.default)(_iterator8);;) {
  13017. var _ref8;
  13018. if (_isArray8) {
  13019. if (_i8 >= _iterator8.length) break;
  13020. _ref8 = _iterator8[_i8++];
  13021. } else {
  13022. _i8 = _iterator8.next();
  13023. if (_i8.done) break;
  13024. _ref8 = _i8.value;
  13025. }
  13026. var _node = _ref8;
  13027. traverseFast(_node, enter, opts);
  13028. }
  13029. } else {
  13030. traverseFast(subNode, enter, opts);
  13031. }
  13032. }
  13033. }
  13034. var CLEAR_KEYS = ["tokens", "start", "end", "loc", "raw", "rawValue"];
  13035. var CLEAR_KEYS_PLUS_COMMENTS = t.COMMENT_KEYS.concat(["comments"]).concat(CLEAR_KEYS);
  13036. function removeProperties(node, opts) {
  13037. opts = opts || {};
  13038. var map = opts.preserveComments ? CLEAR_KEYS : CLEAR_KEYS_PLUS_COMMENTS;
  13039. for (var _iterator9 = map, _isArray9 = Array.isArray(_iterator9), _i9 = 0, _iterator9 = _isArray9 ? _iterator9 : (0, _getIterator3.default)(_iterator9);;) {
  13040. var _ref9;
  13041. if (_isArray9) {
  13042. if (_i9 >= _iterator9.length) break;
  13043. _ref9 = _iterator9[_i9++];
  13044. } else {
  13045. _i9 = _iterator9.next();
  13046. if (_i9.done) break;
  13047. _ref9 = _i9.value;
  13048. }
  13049. var _key4 = _ref9;
  13050. if (node[_key4] != null) node[_key4] = undefined;
  13051. }
  13052. for (var key in node) {
  13053. if (key[0] === "_" && node[key] != null) node[key] = undefined;
  13054. }
  13055. var syms = (0, _getOwnPropertySymbols2.default)(node);
  13056. for (var _iterator10 = syms, _isArray10 = Array.isArray(_iterator10), _i10 = 0, _iterator10 = _isArray10 ? _iterator10 : (0, _getIterator3.default)(_iterator10);;) {
  13057. var _ref10;
  13058. if (_isArray10) {
  13059. if (_i10 >= _iterator10.length) break;
  13060. _ref10 = _iterator10[_i10++];
  13061. } else {
  13062. _i10 = _iterator10.next();
  13063. if (_i10.done) break;
  13064. _ref10 = _i10.value;
  13065. }
  13066. var sym = _ref10;
  13067. node[sym] = null;
  13068. }
  13069. }
  13070. function removePropertiesDeep(tree, opts) {
  13071. traverseFast(tree, removeProperties, opts);
  13072. return tree;
  13073. }
  13074. },{"./constants":101,"./converters":102,"./definitions":107,"./definitions/init":108,"./flow":111,"./react":113,"./retrievers":114,"./validators":115,"babel-runtime/core-js/get-iterator":56,"babel-runtime/core-js/json/stringify":57,"babel-runtime/core-js/object/get-own-property-symbols":62,"babel-runtime/core-js/object/keys":63,"lodash/clone":416,"lodash/uniq":464,"to-fast-properties":487}],113:[function(require,module,exports){
  13075. "use strict";
  13076. exports.__esModule = true;
  13077. exports.isReactComponent = undefined;
  13078. exports.isCompatTag = isCompatTag;
  13079. exports.buildChildren = buildChildren;
  13080. var _index = require("./index");
  13081. var t = _interopRequireWildcard(_index);
  13082. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  13083. var isReactComponent = exports.isReactComponent = t.buildMatchMemberExpression("React.Component");
  13084. function isCompatTag(tagName) {
  13085. return !!tagName && /^[a-z]|\-/.test(tagName);
  13086. }
  13087. function cleanJSXElementLiteralChild(child, args) {
  13088. var lines = child.value.split(/\r\n|\n|\r/);
  13089. var lastNonEmptyLine = 0;
  13090. for (var i = 0; i < lines.length; i++) {
  13091. if (lines[i].match(/[^ \t]/)) {
  13092. lastNonEmptyLine = i;
  13093. }
  13094. }
  13095. var str = "";
  13096. for (var _i = 0; _i < lines.length; _i++) {
  13097. var line = lines[_i];
  13098. var isFirstLine = _i === 0;
  13099. var isLastLine = _i === lines.length - 1;
  13100. var isLastNonEmptyLine = _i === lastNonEmptyLine;
  13101. var trimmedLine = line.replace(/\t/g, " ");
  13102. if (!isFirstLine) {
  13103. trimmedLine = trimmedLine.replace(/^[ ]+/, "");
  13104. }
  13105. if (!isLastLine) {
  13106. trimmedLine = trimmedLine.replace(/[ ]+$/, "");
  13107. }
  13108. if (trimmedLine) {
  13109. if (!isLastNonEmptyLine) {
  13110. trimmedLine += " ";
  13111. }
  13112. str += trimmedLine;
  13113. }
  13114. }
  13115. if (str) args.push(t.stringLiteral(str));
  13116. }
  13117. function buildChildren(node) {
  13118. var elems = [];
  13119. for (var i = 0; i < node.children.length; i++) {
  13120. var child = node.children[i];
  13121. if (t.isJSXText(child)) {
  13122. cleanJSXElementLiteralChild(child, elems);
  13123. continue;
  13124. }
  13125. if (t.isJSXExpressionContainer(child)) child = child.expression;
  13126. if (t.isJSXEmptyExpression(child)) continue;
  13127. elems.push(child);
  13128. }
  13129. return elems;
  13130. }
  13131. },{"./index":112}],114:[function(require,module,exports){
  13132. "use strict";
  13133. exports.__esModule = true;
  13134. var _create = require("babel-runtime/core-js/object/create");
  13135. var _create2 = _interopRequireDefault(_create);
  13136. exports.getBindingIdentifiers = getBindingIdentifiers;
  13137. exports.getOuterBindingIdentifiers = getOuterBindingIdentifiers;
  13138. var _index = require("./index");
  13139. var t = _interopRequireWildcard(_index);
  13140. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  13141. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  13142. function getBindingIdentifiers(node, duplicates, outerOnly) {
  13143. var search = [].concat(node);
  13144. var ids = (0, _create2.default)(null);
  13145. while (search.length) {
  13146. var id = search.shift();
  13147. if (!id) continue;
  13148. var keys = t.getBindingIdentifiers.keys[id.type];
  13149. if (t.isIdentifier(id)) {
  13150. if (duplicates) {
  13151. var _ids = ids[id.name] = ids[id.name] || [];
  13152. _ids.push(id);
  13153. } else {
  13154. ids[id.name] = id;
  13155. }
  13156. continue;
  13157. }
  13158. if (t.isExportDeclaration(id)) {
  13159. if (t.isDeclaration(id.declaration)) {
  13160. search.push(id.declaration);
  13161. }
  13162. continue;
  13163. }
  13164. if (outerOnly) {
  13165. if (t.isFunctionDeclaration(id)) {
  13166. search.push(id.id);
  13167. continue;
  13168. }
  13169. if (t.isFunctionExpression(id)) {
  13170. continue;
  13171. }
  13172. }
  13173. if (keys) {
  13174. for (var i = 0; i < keys.length; i++) {
  13175. var key = keys[i];
  13176. if (id[key]) {
  13177. search = search.concat(id[key]);
  13178. }
  13179. }
  13180. }
  13181. }
  13182. return ids;
  13183. }
  13184. getBindingIdentifiers.keys = {
  13185. DeclareClass: ["id"],
  13186. DeclareFunction: ["id"],
  13187. DeclareModule: ["id"],
  13188. DeclareVariable: ["id"],
  13189. InterfaceDeclaration: ["id"],
  13190. TypeAlias: ["id"],
  13191. CatchClause: ["param"],
  13192. LabeledStatement: ["label"],
  13193. UnaryExpression: ["argument"],
  13194. AssignmentExpression: ["left"],
  13195. ImportSpecifier: ["local"],
  13196. ImportNamespaceSpecifier: ["local"],
  13197. ImportDefaultSpecifier: ["local"],
  13198. ImportDeclaration: ["specifiers"],
  13199. ExportSpecifier: ["exported"],
  13200. ExportNamespaceSpecifier: ["exported"],
  13201. ExportDefaultSpecifier: ["exported"],
  13202. FunctionDeclaration: ["id", "params"],
  13203. FunctionExpression: ["id", "params"],
  13204. ClassDeclaration: ["id"],
  13205. ClassExpression: ["id"],
  13206. RestElement: ["argument"],
  13207. UpdateExpression: ["argument"],
  13208. RestProperty: ["argument"],
  13209. ObjectProperty: ["value"],
  13210. AssignmentPattern: ["left"],
  13211. ArrayPattern: ["elements"],
  13212. ObjectPattern: ["properties"],
  13213. VariableDeclaration: ["declarations"],
  13214. VariableDeclarator: ["id"]
  13215. };
  13216. function getOuterBindingIdentifiers(node, duplicates) {
  13217. return getBindingIdentifiers(node, duplicates, true);
  13218. }
  13219. },{"./index":112,"babel-runtime/core-js/object/create":61}],115:[function(require,module,exports){
  13220. "use strict";
  13221. exports.__esModule = true;
  13222. var _keys = require("babel-runtime/core-js/object/keys");
  13223. var _keys2 = _interopRequireDefault(_keys);
  13224. var _typeof2 = require("babel-runtime/helpers/typeof");
  13225. var _typeof3 = _interopRequireDefault(_typeof2);
  13226. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  13227. var _getIterator3 = _interopRequireDefault(_getIterator2);
  13228. exports.isBinding = isBinding;
  13229. exports.isReferenced = isReferenced;
  13230. exports.isValidIdentifier = isValidIdentifier;
  13231. exports.isLet = isLet;
  13232. exports.isBlockScoped = isBlockScoped;
  13233. exports.isVar = isVar;
  13234. exports.isSpecifierDefault = isSpecifierDefault;
  13235. exports.isScope = isScope;
  13236. exports.isImmutable = isImmutable;
  13237. exports.isNodesEquivalent = isNodesEquivalent;
  13238. var _retrievers = require("./retrievers");
  13239. var _esutils = require("esutils");
  13240. var _esutils2 = _interopRequireDefault(_esutils);
  13241. var _index = require("./index");
  13242. var t = _interopRequireWildcard(_index);
  13243. var _constants = require("./constants");
  13244. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  13245. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  13246. function isBinding(node, parent) {
  13247. var keys = _retrievers.getBindingIdentifiers.keys[parent.type];
  13248. if (keys) {
  13249. for (var i = 0; i < keys.length; i++) {
  13250. var key = keys[i];
  13251. var val = parent[key];
  13252. if (Array.isArray(val)) {
  13253. if (val.indexOf(node) >= 0) return true;
  13254. } else {
  13255. if (val === node) return true;
  13256. }
  13257. }
  13258. }
  13259. return false;
  13260. }
  13261. function isReferenced(node, parent) {
  13262. switch (parent.type) {
  13263. case "BindExpression":
  13264. return parent.object === node || parent.callee === node;
  13265. case "MemberExpression":
  13266. case "JSXMemberExpression":
  13267. if (parent.property === node && parent.computed) {
  13268. return true;
  13269. } else if (parent.object === node) {
  13270. return true;
  13271. } else {
  13272. return false;
  13273. }
  13274. case "MetaProperty":
  13275. return false;
  13276. case "ObjectProperty":
  13277. if (parent.key === node) {
  13278. return parent.computed;
  13279. }
  13280. case "VariableDeclarator":
  13281. return parent.id !== node;
  13282. case "ArrowFunctionExpression":
  13283. case "FunctionDeclaration":
  13284. case "FunctionExpression":
  13285. for (var _iterator = parent.params, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  13286. var _ref;
  13287. if (_isArray) {
  13288. if (_i >= _iterator.length) break;
  13289. _ref = _iterator[_i++];
  13290. } else {
  13291. _i = _iterator.next();
  13292. if (_i.done) break;
  13293. _ref = _i.value;
  13294. }
  13295. var param = _ref;
  13296. if (param === node) return false;
  13297. }
  13298. return parent.id !== node;
  13299. case "ExportSpecifier":
  13300. if (parent.source) {
  13301. return false;
  13302. } else {
  13303. return parent.local === node;
  13304. }
  13305. case "ExportNamespaceSpecifier":
  13306. case "ExportDefaultSpecifier":
  13307. return false;
  13308. case "JSXAttribute":
  13309. return parent.name !== node;
  13310. case "ClassProperty":
  13311. if (parent.key === node) {
  13312. return parent.computed;
  13313. } else {
  13314. return parent.value === node;
  13315. }
  13316. case "ImportDefaultSpecifier":
  13317. case "ImportNamespaceSpecifier":
  13318. case "ImportSpecifier":
  13319. return false;
  13320. case "ClassDeclaration":
  13321. case "ClassExpression":
  13322. return parent.id !== node;
  13323. case "ClassMethod":
  13324. case "ObjectMethod":
  13325. return parent.key === node && parent.computed;
  13326. case "LabeledStatement":
  13327. return false;
  13328. case "CatchClause":
  13329. return parent.param !== node;
  13330. case "RestElement":
  13331. return false;
  13332. case "AssignmentExpression":
  13333. return parent.right === node;
  13334. case "AssignmentPattern":
  13335. return parent.right === node;
  13336. case "ObjectPattern":
  13337. case "ArrayPattern":
  13338. return false;
  13339. }
  13340. return true;
  13341. }
  13342. function isValidIdentifier(name) {
  13343. if (typeof name !== "string" || _esutils2.default.keyword.isReservedWordES6(name, true)) {
  13344. return false;
  13345. } else {
  13346. return _esutils2.default.keyword.isIdentifierNameES6(name);
  13347. }
  13348. }
  13349. function isLet(node) {
  13350. return t.isVariableDeclaration(node) && (node.kind !== "var" || node[_constants.BLOCK_SCOPED_SYMBOL]);
  13351. }
  13352. function isBlockScoped(node) {
  13353. return t.isFunctionDeclaration(node) || t.isClassDeclaration(node) || t.isLet(node);
  13354. }
  13355. function isVar(node) {
  13356. return t.isVariableDeclaration(node, { kind: "var" }) && !node[_constants.BLOCK_SCOPED_SYMBOL];
  13357. }
  13358. function isSpecifierDefault(specifier) {
  13359. return t.isImportDefaultSpecifier(specifier) || t.isIdentifier(specifier.imported || specifier.exported, { name: "default" });
  13360. }
  13361. function isScope(node, parent) {
  13362. if (t.isBlockStatement(node) && t.isFunction(parent, { body: node })) {
  13363. return false;
  13364. }
  13365. return t.isScopable(node);
  13366. }
  13367. function isImmutable(node) {
  13368. if (t.isType(node.type, "Immutable")) return true;
  13369. if (t.isIdentifier(node)) {
  13370. if (node.name === "undefined") {
  13371. return true;
  13372. } else {
  13373. return false;
  13374. }
  13375. }
  13376. return false;
  13377. }
  13378. function isNodesEquivalent(a, b) {
  13379. if ((typeof a === "undefined" ? "undefined" : (0, _typeof3.default)(a)) !== "object" || (typeof a === "undefined" ? "undefined" : (0, _typeof3.default)(a)) !== "object" || a == null || b == null) {
  13380. return a === b;
  13381. }
  13382. if (a.type !== b.type) {
  13383. return false;
  13384. }
  13385. var fields = (0, _keys2.default)(t.NODE_FIELDS[a.type] || a.type);
  13386. for (var _iterator2 = fields, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  13387. var _ref2;
  13388. if (_isArray2) {
  13389. if (_i2 >= _iterator2.length) break;
  13390. _ref2 = _iterator2[_i2++];
  13391. } else {
  13392. _i2 = _iterator2.next();
  13393. if (_i2.done) break;
  13394. _ref2 = _i2.value;
  13395. }
  13396. var field = _ref2;
  13397. if ((0, _typeof3.default)(a[field]) !== (0, _typeof3.default)(b[field])) {
  13398. return false;
  13399. }
  13400. if (Array.isArray(a[field])) {
  13401. if (!Array.isArray(b[field])) {
  13402. return false;
  13403. }
  13404. if (a[field].length !== b[field].length) {
  13405. return false;
  13406. }
  13407. for (var i = 0; i < a[field].length; i++) {
  13408. if (!isNodesEquivalent(a[field][i], b[field][i])) {
  13409. return false;
  13410. }
  13411. }
  13412. continue;
  13413. }
  13414. if (!isNodesEquivalent(a[field], b[field])) {
  13415. return false;
  13416. }
  13417. }
  13418. return true;
  13419. }
  13420. },{"./constants":101,"./index":112,"./retrievers":114,"babel-runtime/core-js/get-iterator":56,"babel-runtime/core-js/object/keys":63,"babel-runtime/helpers/typeof":74,"esutils":240}],116:[function(require,module,exports){
  13421. 'use strict';
  13422. Object.defineProperty(exports, '__esModule', { value: true });
  13423. /* eslint max-len: 0 */
  13424. // This is a trick taken from Esprima. It turns out that, on
  13425. // non-Chrome browsers, to check whether a string is in a set, a
  13426. // predicate containing a big ugly `switch` statement is faster than
  13427. // a regular expression, and on Chrome the two are about on par.
  13428. // This function uses `eval` (non-lexical) to produce such a
  13429. // predicate from a space-separated string of words.
  13430. //
  13431. // It starts by sorting the words by length.
  13432. function makePredicate(words) {
  13433. words = words.split(" ");
  13434. return function (str) {
  13435. return words.indexOf(str) >= 0;
  13436. };
  13437. }
  13438. // Reserved word lists for various dialects of the language
  13439. var reservedWords = {
  13440. 6: makePredicate("enum await"),
  13441. strict: makePredicate("implements interface let package private protected public static yield"),
  13442. strictBind: makePredicate("eval arguments")
  13443. };
  13444. // And the keywords
  13445. var isKeyword = makePredicate("break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this let const class extends export import yield super");
  13446. // ## Character categories
  13447. // Big ugly regular expressions that match characters in the
  13448. // whitespace, identifier, and identifier-start categories. These
  13449. // are only applied when a character is found to actually have a
  13450. // code point above 128.
  13451. // Generated by `bin/generate-identifier-regex.js`.
  13452. var nonASCIIidentifierStartChars = "\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\u08B6-\u08BD\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\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\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\u1C80-\u1C88\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-\uA7AE\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";
  13453. var nonASCIIidentifierChars = "\u200C\u200D\xB7\u0300-\u036F\u0387\u0483-\u0487\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u0669\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u06F0-\u06F9\u0711\u0730-\u074A\u07A6-\u07B0\u07C0-\u07C9\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D4-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0966-\u096F\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09E6-\u09EF\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A66-\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B66-\u0B6F\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0CE6-\u0CEF\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D66-\u0D6F\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0E50-\u0E59\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0ED0-\u0ED9\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1040-\u1049\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F-\u109D\u135D-\u135F\u1369-\u1371\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u18A9\u1920-\u192B\u1930-\u193B\u1946-\u194F\u19D0-\u19DA\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AB0-\u1ABD\u1B00-\u1B04\u1B34-\u1B44\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BB0-\u1BB9\u1BE6-\u1BF3\u1C24-\u1C37\u1C40-\u1C49\u1C50-\u1C59\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFB-\u1DFF\u203F\u2040\u2054\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA620-\uA629\uA66F\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F1\uA900-\uA909\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9D0-\uA9D9\uA9E5\uA9F0-\uA9F9\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA50-\uAA59\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uABF0-\uABF9\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFF10-\uFF19\uFF3F";
  13454. var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
  13455. var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
  13456. nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
  13457. // These are a run-length and offset encoded representation of the
  13458. // >0xffff code points that are a valid part of identifiers. The
  13459. // offset starts at 0x10000, and each pair of numbers represents an
  13460. // offset to the next range, and then a size of the range. They were
  13461. // generated by `bin/generate-identifier-regex.js`.
  13462. // eslint-disable-next-line comma-spacing
  13463. var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 17, 26, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 157, 310, 10, 21, 11, 7, 153, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 26, 45, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 785, 52, 76, 44, 33, 24, 27, 35, 42, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 85, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 159, 52, 19, 3, 54, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 86, 25, 391, 63, 32, 0, 449, 56, 264, 8, 2, 36, 18, 0, 50, 29, 881, 921, 103, 110, 18, 195, 2749, 1070, 4050, 582, 8634, 568, 8, 30, 114, 29, 19, 47, 17, 3, 32, 20, 6, 18, 881, 68, 12, 0, 67, 12, 65, 0, 32, 6124, 20, 754, 9486, 1, 3071, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 4149, 196, 60, 67, 1213, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42710, 42, 4148, 12, 221, 3, 5761, 10591, 541];
  13464. // eslint-disable-next-line comma-spacing
  13465. var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 1306, 2, 54, 14, 32, 9, 16, 3, 46, 10, 54, 9, 7, 2, 37, 13, 2, 9, 52, 0, 13, 2, 49, 13, 10, 2, 4, 9, 83, 11, 7, 0, 161, 11, 6, 9, 7, 3, 57, 0, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 193, 17, 10, 9, 87, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 84, 14, 5, 9, 423, 9, 838, 7, 2, 7, 17, 9, 57, 21, 2, 13, 19882, 9, 135, 4, 60, 6, 26, 9, 1016, 45, 17, 3, 19723, 1, 5319, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 2214, 6, 110, 6, 6, 9, 792487, 239];
  13466. // This has a complexity linear to the value of the code. The
  13467. // assumption is that looking up astral identifier characters is
  13468. // rare.
  13469. function isInAstralSet(code, set) {
  13470. var pos = 0x10000;
  13471. for (var i = 0; i < set.length; i += 2) {
  13472. pos += set[i];
  13473. if (pos > code) return false;
  13474. pos += set[i + 1];
  13475. if (pos >= code) return true;
  13476. }
  13477. }
  13478. // Test whether a given character code starts an identifier.
  13479. function isIdentifierStart(code) {
  13480. if (code < 65) return code === 36;
  13481. if (code < 91) return true;
  13482. if (code < 97) return code === 95;
  13483. if (code < 123) return true;
  13484. if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code));
  13485. return isInAstralSet(code, astralIdentifierStartCodes);
  13486. }
  13487. // Test whether a given character is part of an identifier.
  13488. function isIdentifierChar(code) {
  13489. if (code < 48) return code === 36;
  13490. if (code < 58) return true;
  13491. if (code < 65) return false;
  13492. if (code < 91) return true;
  13493. if (code < 97) return code === 95;
  13494. if (code < 123) return true;
  13495. if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));
  13496. return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
  13497. }
  13498. // A second optional argument can be given to further configure
  13499. var defaultOptions = {
  13500. // Source type ("script" or "module") for different semantics
  13501. sourceType: "script",
  13502. // Source filename.
  13503. sourceFilename: undefined,
  13504. // Line from which to start counting source. Useful for
  13505. // integration with other tools.
  13506. startLine: 1,
  13507. // When enabled, a return at the top level is not considered an
  13508. // error.
  13509. allowReturnOutsideFunction: false,
  13510. // When enabled, import/export statements are not constrained to
  13511. // appearing at the top of the program.
  13512. allowImportExportEverywhere: false,
  13513. // TODO
  13514. allowSuperOutsideMethod: false,
  13515. // An array of plugins to enable
  13516. plugins: [],
  13517. // TODO
  13518. strictMode: null
  13519. };
  13520. // Interpret and default an options object
  13521. function getOptions(opts) {
  13522. var options = {};
  13523. for (var key in defaultOptions) {
  13524. options[key] = opts && key in opts ? opts[key] : defaultOptions[key];
  13525. }
  13526. return options;
  13527. }
  13528. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
  13529. return typeof obj;
  13530. } : function (obj) {
  13531. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  13532. };
  13533. var classCallCheck = function (instance, Constructor) {
  13534. if (!(instance instanceof Constructor)) {
  13535. throw new TypeError("Cannot call a class as a function");
  13536. }
  13537. };
  13538. var inherits = function (subClass, superClass) {
  13539. if (typeof superClass !== "function" && superClass !== null) {
  13540. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  13541. }
  13542. subClass.prototype = Object.create(superClass && superClass.prototype, {
  13543. constructor: {
  13544. value: subClass,
  13545. enumerable: false,
  13546. writable: true,
  13547. configurable: true
  13548. }
  13549. });
  13550. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  13551. };
  13552. var possibleConstructorReturn = function (self, call) {
  13553. if (!self) {
  13554. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  13555. }
  13556. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  13557. };
  13558. // ## Token types
  13559. // The assignment of fine-grained, information-carrying type objects
  13560. // allows the tokenizer to store the information it has about a
  13561. // token in a way that is very cheap for the parser to look up.
  13562. // All token type variables start with an underscore, to make them
  13563. // easy to recognize.
  13564. // The `beforeExpr` property is used to disambiguate between regular
  13565. // expressions and divisions. It is set on all token types that can
  13566. // be followed by an expression (thus, a slash after them would be a
  13567. // regular expression).
  13568. //
  13569. // `isLoop` marks a keyword as starting a loop, which is important
  13570. // to know when parsing a label, in order to allow or disallow
  13571. // continue jumps to that label.
  13572. var beforeExpr = true;
  13573. var startsExpr = true;
  13574. var isLoop = true;
  13575. var isAssign = true;
  13576. var prefix = true;
  13577. var postfix = true;
  13578. var TokenType = function TokenType(label) {
  13579. var conf = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  13580. classCallCheck(this, TokenType);
  13581. this.label = label;
  13582. this.keyword = conf.keyword;
  13583. this.beforeExpr = !!conf.beforeExpr;
  13584. this.startsExpr = !!conf.startsExpr;
  13585. this.rightAssociative = !!conf.rightAssociative;
  13586. this.isLoop = !!conf.isLoop;
  13587. this.isAssign = !!conf.isAssign;
  13588. this.prefix = !!conf.prefix;
  13589. this.postfix = !!conf.postfix;
  13590. this.binop = conf.binop || null;
  13591. this.updateContext = null;
  13592. };
  13593. var KeywordTokenType = function (_TokenType) {
  13594. inherits(KeywordTokenType, _TokenType);
  13595. function KeywordTokenType(name) {
  13596. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  13597. classCallCheck(this, KeywordTokenType);
  13598. options.keyword = name;
  13599. return possibleConstructorReturn(this, _TokenType.call(this, name, options));
  13600. }
  13601. return KeywordTokenType;
  13602. }(TokenType);
  13603. var BinopTokenType = function (_TokenType2) {
  13604. inherits(BinopTokenType, _TokenType2);
  13605. function BinopTokenType(name, prec) {
  13606. classCallCheck(this, BinopTokenType);
  13607. return possibleConstructorReturn(this, _TokenType2.call(this, name, { beforeExpr: beforeExpr, binop: prec }));
  13608. }
  13609. return BinopTokenType;
  13610. }(TokenType);
  13611. var types = {
  13612. num: new TokenType("num", { startsExpr: startsExpr }),
  13613. regexp: new TokenType("regexp", { startsExpr: startsExpr }),
  13614. string: new TokenType("string", { startsExpr: startsExpr }),
  13615. name: new TokenType("name", { startsExpr: startsExpr }),
  13616. eof: new TokenType("eof"),
  13617. // Punctuation token types.
  13618. bracketL: new TokenType("[", { beforeExpr: beforeExpr, startsExpr: startsExpr }),
  13619. bracketR: new TokenType("]"),
  13620. braceL: new TokenType("{", { beforeExpr: beforeExpr, startsExpr: startsExpr }),
  13621. braceBarL: new TokenType("{|", { beforeExpr: beforeExpr, startsExpr: startsExpr }),
  13622. braceR: new TokenType("}"),
  13623. braceBarR: new TokenType("|}"),
  13624. parenL: new TokenType("(", { beforeExpr: beforeExpr, startsExpr: startsExpr }),
  13625. parenR: new TokenType(")"),
  13626. comma: new TokenType(",", { beforeExpr: beforeExpr }),
  13627. semi: new TokenType(";", { beforeExpr: beforeExpr }),
  13628. colon: new TokenType(":", { beforeExpr: beforeExpr }),
  13629. doubleColon: new TokenType("::", { beforeExpr: beforeExpr }),
  13630. dot: new TokenType("."),
  13631. question: new TokenType("?", { beforeExpr: beforeExpr }),
  13632. arrow: new TokenType("=>", { beforeExpr: beforeExpr }),
  13633. template: new TokenType("template"),
  13634. ellipsis: new TokenType("...", { beforeExpr: beforeExpr }),
  13635. backQuote: new TokenType("`", { startsExpr: startsExpr }),
  13636. dollarBraceL: new TokenType("${", { beforeExpr: beforeExpr, startsExpr: startsExpr }),
  13637. at: new TokenType("@"),
  13638. // Operators. These carry several kinds of properties to help the
  13639. // parser use them properly (the presence of these properties is
  13640. // what categorizes them as operators).
  13641. //
  13642. // `binop`, when present, specifies that this operator is a binary
  13643. // operator, and will refer to its precedence.
  13644. //
  13645. // `prefix` and `postfix` mark the operator as a prefix or postfix
  13646. // unary operator.
  13647. //
  13648. // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as
  13649. // binary operators with a very low precedence, that should result
  13650. // in AssignmentExpression nodes.
  13651. eq: new TokenType("=", { beforeExpr: beforeExpr, isAssign: isAssign }),
  13652. assign: new TokenType("_=", { beforeExpr: beforeExpr, isAssign: isAssign }),
  13653. incDec: new TokenType("++/--", { prefix: prefix, postfix: postfix, startsExpr: startsExpr }),
  13654. prefix: new TokenType("prefix", { beforeExpr: beforeExpr, prefix: prefix, startsExpr: startsExpr }),
  13655. logicalOR: new BinopTokenType("||", 1),
  13656. logicalAND: new BinopTokenType("&&", 2),
  13657. bitwiseOR: new BinopTokenType("|", 3),
  13658. bitwiseXOR: new BinopTokenType("^", 4),
  13659. bitwiseAND: new BinopTokenType("&", 5),
  13660. equality: new BinopTokenType("==/!=", 6),
  13661. relational: new BinopTokenType("</>", 7),
  13662. bitShift: new BinopTokenType("<</>>", 8),
  13663. plusMin: new TokenType("+/-", { beforeExpr: beforeExpr, binop: 9, prefix: prefix, startsExpr: startsExpr }),
  13664. modulo: new BinopTokenType("%", 10),
  13665. star: new BinopTokenType("*", 10),
  13666. slash: new BinopTokenType("/", 10),
  13667. exponent: new TokenType("**", { beforeExpr: beforeExpr, binop: 11, rightAssociative: true })
  13668. };
  13669. var keywords = {
  13670. "break": new KeywordTokenType("break"),
  13671. "case": new KeywordTokenType("case", { beforeExpr: beforeExpr }),
  13672. "catch": new KeywordTokenType("catch"),
  13673. "continue": new KeywordTokenType("continue"),
  13674. "debugger": new KeywordTokenType("debugger"),
  13675. "default": new KeywordTokenType("default", { beforeExpr: beforeExpr }),
  13676. "do": new KeywordTokenType("do", { isLoop: isLoop, beforeExpr: beforeExpr }),
  13677. "else": new KeywordTokenType("else", { beforeExpr: beforeExpr }),
  13678. "finally": new KeywordTokenType("finally"),
  13679. "for": new KeywordTokenType("for", { isLoop: isLoop }),
  13680. "function": new KeywordTokenType("function", { startsExpr: startsExpr }),
  13681. "if": new KeywordTokenType("if"),
  13682. "return": new KeywordTokenType("return", { beforeExpr: beforeExpr }),
  13683. "switch": new KeywordTokenType("switch"),
  13684. "throw": new KeywordTokenType("throw", { beforeExpr: beforeExpr }),
  13685. "try": new KeywordTokenType("try"),
  13686. "var": new KeywordTokenType("var"),
  13687. "let": new KeywordTokenType("let"),
  13688. "const": new KeywordTokenType("const"),
  13689. "while": new KeywordTokenType("while", { isLoop: isLoop }),
  13690. "with": new KeywordTokenType("with"),
  13691. "new": new KeywordTokenType("new", { beforeExpr: beforeExpr, startsExpr: startsExpr }),
  13692. "this": new KeywordTokenType("this", { startsExpr: startsExpr }),
  13693. "super": new KeywordTokenType("super", { startsExpr: startsExpr }),
  13694. "class": new KeywordTokenType("class"),
  13695. "extends": new KeywordTokenType("extends", { beforeExpr: beforeExpr }),
  13696. "export": new KeywordTokenType("export"),
  13697. "import": new KeywordTokenType("import"),
  13698. "yield": new KeywordTokenType("yield", { beforeExpr: beforeExpr, startsExpr: startsExpr }),
  13699. "null": new KeywordTokenType("null", { startsExpr: startsExpr }),
  13700. "true": new KeywordTokenType("true", { startsExpr: startsExpr }),
  13701. "false": new KeywordTokenType("false", { startsExpr: startsExpr }),
  13702. "in": new KeywordTokenType("in", { beforeExpr: beforeExpr, binop: 7 }),
  13703. "instanceof": new KeywordTokenType("instanceof", { beforeExpr: beforeExpr, binop: 7 }),
  13704. "typeof": new KeywordTokenType("typeof", { beforeExpr: beforeExpr, prefix: prefix, startsExpr: startsExpr }),
  13705. "void": new KeywordTokenType("void", { beforeExpr: beforeExpr, prefix: prefix, startsExpr: startsExpr }),
  13706. "delete": new KeywordTokenType("delete", { beforeExpr: beforeExpr, prefix: prefix, startsExpr: startsExpr })
  13707. };
  13708. // Map keyword names to token types.
  13709. Object.keys(keywords).forEach(function (name) {
  13710. types["_" + name] = keywords[name];
  13711. });
  13712. // Matches a whole line break (where CRLF is considered a single
  13713. // line break). Used to count lines.
  13714. var lineBreak = /\r\n?|\n|\u2028|\u2029/;
  13715. var lineBreakG = new RegExp(lineBreak.source, "g");
  13716. function isNewLine(code) {
  13717. return code === 10 || code === 13 || code === 0x2028 || code === 0x2029;
  13718. }
  13719. var nonASCIIwhitespace = /[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;
  13720. // The algorithm used to determine whether a regexp can appear at a
  13721. // given point in the program is loosely based on sweet.js' approach.
  13722. // See https://github.com/mozilla/sweet.js/wiki/design
  13723. var TokContext = function TokContext(token, isExpr, preserveSpace, override) {
  13724. classCallCheck(this, TokContext);
  13725. this.token = token;
  13726. this.isExpr = !!isExpr;
  13727. this.preserveSpace = !!preserveSpace;
  13728. this.override = override;
  13729. };
  13730. var types$1 = {
  13731. braceStatement: new TokContext("{", false),
  13732. braceExpression: new TokContext("{", true),
  13733. templateQuasi: new TokContext("${", true),
  13734. parenStatement: new TokContext("(", false),
  13735. parenExpression: new TokContext("(", true),
  13736. template: new TokContext("`", true, true, function (p) {
  13737. return p.readTmplToken();
  13738. }),
  13739. functionExpression: new TokContext("function", true)
  13740. };
  13741. // Token-specific context update code
  13742. types.parenR.updateContext = types.braceR.updateContext = function () {
  13743. if (this.state.context.length === 1) {
  13744. this.state.exprAllowed = true;
  13745. return;
  13746. }
  13747. var out = this.state.context.pop();
  13748. if (out === types$1.braceStatement && this.curContext() === types$1.functionExpression) {
  13749. this.state.context.pop();
  13750. this.state.exprAllowed = false;
  13751. } else if (out === types$1.templateQuasi) {
  13752. this.state.exprAllowed = true;
  13753. } else {
  13754. this.state.exprAllowed = !out.isExpr;
  13755. }
  13756. };
  13757. types.name.updateContext = function (prevType) {
  13758. this.state.exprAllowed = false;
  13759. if (prevType === types._let || prevType === types._const || prevType === types._var) {
  13760. if (lineBreak.test(this.input.slice(this.state.end))) {
  13761. this.state.exprAllowed = true;
  13762. }
  13763. }
  13764. };
  13765. types.braceL.updateContext = function (prevType) {
  13766. this.state.context.push(this.braceIsBlock(prevType) ? types$1.braceStatement : types$1.braceExpression);
  13767. this.state.exprAllowed = true;
  13768. };
  13769. types.dollarBraceL.updateContext = function () {
  13770. this.state.context.push(types$1.templateQuasi);
  13771. this.state.exprAllowed = true;
  13772. };
  13773. types.parenL.updateContext = function (prevType) {
  13774. var statementParens = prevType === types._if || prevType === types._for || prevType === types._with || prevType === types._while;
  13775. this.state.context.push(statementParens ? types$1.parenStatement : types$1.parenExpression);
  13776. this.state.exprAllowed = true;
  13777. };
  13778. types.incDec.updateContext = function () {
  13779. // tokExprAllowed stays unchanged
  13780. };
  13781. types._function.updateContext = function () {
  13782. if (this.curContext() !== types$1.braceStatement) {
  13783. this.state.context.push(types$1.functionExpression);
  13784. }
  13785. this.state.exprAllowed = false;
  13786. };
  13787. types.backQuote.updateContext = function () {
  13788. if (this.curContext() === types$1.template) {
  13789. this.state.context.pop();
  13790. } else {
  13791. this.state.context.push(types$1.template);
  13792. }
  13793. this.state.exprAllowed = false;
  13794. };
  13795. // These are used when `options.locations` is on, for the
  13796. // `startLoc` and `endLoc` properties.
  13797. var Position = function Position(line, col) {
  13798. classCallCheck(this, Position);
  13799. this.line = line;
  13800. this.column = col;
  13801. };
  13802. var SourceLocation = function SourceLocation(start, end) {
  13803. classCallCheck(this, SourceLocation);
  13804. this.start = start;
  13805. this.end = end;
  13806. };
  13807. // The `getLineInfo` function is mostly useful when the
  13808. // `locations` option is off (for performance reasons) and you
  13809. // want to find the line/column position for a given character
  13810. // offset. `input` should be the code string that the offset refers
  13811. // into.
  13812. function getLineInfo(input, offset) {
  13813. for (var line = 1, cur = 0;;) {
  13814. lineBreakG.lastIndex = cur;
  13815. var match = lineBreakG.exec(input);
  13816. if (match && match.index < offset) {
  13817. ++line;
  13818. cur = match.index + match[0].length;
  13819. } else {
  13820. return new Position(line, offset - cur);
  13821. }
  13822. }
  13823. }
  13824. var State = function () {
  13825. function State() {
  13826. classCallCheck(this, State);
  13827. }
  13828. State.prototype.init = function init(options, input) {
  13829. this.strict = options.strictMode === false ? false : options.sourceType === "module";
  13830. this.input = input;
  13831. this.potentialArrowAt = -1;
  13832. this.inMethod = this.inFunction = this.inGenerator = this.inAsync = this.inPropertyName = this.inType = this.noAnonFunctionType = false;
  13833. this.labels = [];
  13834. this.decorators = [];
  13835. this.tokens = [];
  13836. this.comments = [];
  13837. this.trailingComments = [];
  13838. this.leadingComments = [];
  13839. this.commentStack = [];
  13840. this.pos = this.lineStart = 0;
  13841. this.curLine = options.startLine;
  13842. this.type = types.eof;
  13843. this.value = null;
  13844. this.start = this.end = this.pos;
  13845. this.startLoc = this.endLoc = this.curPosition();
  13846. this.lastTokEndLoc = this.lastTokStartLoc = null;
  13847. this.lastTokStart = this.lastTokEnd = this.pos;
  13848. this.context = [types$1.braceStatement];
  13849. this.exprAllowed = true;
  13850. this.containsEsc = this.containsOctal = false;
  13851. this.octalPosition = null;
  13852. this.exportedIdentifiers = [];
  13853. return this;
  13854. };
  13855. // TODO
  13856. // TODO
  13857. // Used to signify the start of a potential arrow function
  13858. // Flags to track whether we are in a function, a generator.
  13859. // Labels in scope.
  13860. // Leading decorators.
  13861. // Token store.
  13862. // Comment store.
  13863. // Comment attachment store
  13864. // The current position of the tokenizer in the input.
  13865. // Properties of the current token:
  13866. // Its type
  13867. // For tokens that include more information than their type, the value
  13868. // Its start and end offset
  13869. // And, if locations are used, the {line, column} object
  13870. // corresponding to those offsets
  13871. // Position information for the previous token
  13872. // The context stack is used to superficially track syntactic
  13873. // context to predict whether a regular expression is allowed in a
  13874. // given position.
  13875. // Used to signal to callers of `readWord1` whether the word
  13876. // contained any escape sequences. This is needed because words with
  13877. // escape sequences must not be interpreted as keywords.
  13878. // TODO
  13879. // Names of exports store. `default` is stored as a name for both
  13880. // `export default foo;` and `export { foo as default };`.
  13881. State.prototype.curPosition = function curPosition() {
  13882. return new Position(this.curLine, this.pos - this.lineStart);
  13883. };
  13884. State.prototype.clone = function clone(skipArrays) {
  13885. var state = new State();
  13886. for (var key in this) {
  13887. var val = this[key];
  13888. if ((!skipArrays || key === "context") && Array.isArray(val)) {
  13889. val = val.slice();
  13890. }
  13891. state[key] = val;
  13892. }
  13893. return state;
  13894. };
  13895. return State;
  13896. }();
  13897. // Object type used to represent tokens. Note that normally, tokens
  13898. // simply exist as properties on the parser object. This is only
  13899. // used for the onToken callback and the external tokenizer.
  13900. var Token = function Token(state) {
  13901. classCallCheck(this, Token);
  13902. this.type = state.type;
  13903. this.value = state.value;
  13904. this.start = state.start;
  13905. this.end = state.end;
  13906. this.loc = new SourceLocation(state.startLoc, state.endLoc);
  13907. };
  13908. // ## Tokenizer
  13909. function codePointToString(code) {
  13910. // UTF-16 Decoding
  13911. if (code <= 0xFFFF) {
  13912. return String.fromCharCode(code);
  13913. } else {
  13914. return String.fromCharCode((code - 0x10000 >> 10) + 0xD800, (code - 0x10000 & 1023) + 0xDC00);
  13915. }
  13916. }
  13917. var Tokenizer = function () {
  13918. function Tokenizer(options, input) {
  13919. classCallCheck(this, Tokenizer);
  13920. this.state = new State();
  13921. this.state.init(options, input);
  13922. }
  13923. // Move to the next token
  13924. Tokenizer.prototype.next = function next() {
  13925. if (!this.isLookahead) {
  13926. this.state.tokens.push(new Token(this.state));
  13927. }
  13928. this.state.lastTokEnd = this.state.end;
  13929. this.state.lastTokStart = this.state.start;
  13930. this.state.lastTokEndLoc = this.state.endLoc;
  13931. this.state.lastTokStartLoc = this.state.startLoc;
  13932. this.nextToken();
  13933. };
  13934. // TODO
  13935. Tokenizer.prototype.eat = function eat(type) {
  13936. if (this.match(type)) {
  13937. this.next();
  13938. return true;
  13939. } else {
  13940. return false;
  13941. }
  13942. };
  13943. // TODO
  13944. Tokenizer.prototype.match = function match(type) {
  13945. return this.state.type === type;
  13946. };
  13947. // TODO
  13948. Tokenizer.prototype.isKeyword = function isKeyword$$1(word) {
  13949. return isKeyword(word);
  13950. };
  13951. // TODO
  13952. Tokenizer.prototype.lookahead = function lookahead() {
  13953. var old = this.state;
  13954. this.state = old.clone(true);
  13955. this.isLookahead = true;
  13956. this.next();
  13957. this.isLookahead = false;
  13958. var curr = this.state.clone(true);
  13959. this.state = old;
  13960. return curr;
  13961. };
  13962. // Toggle strict mode. Re-reads the next number or string to please
  13963. // pedantic tests (`"use strict"; 010;` should fail).
  13964. Tokenizer.prototype.setStrict = function setStrict(strict) {
  13965. this.state.strict = strict;
  13966. if (!this.match(types.num) && !this.match(types.string)) return;
  13967. this.state.pos = this.state.start;
  13968. while (this.state.pos < this.state.lineStart) {
  13969. this.state.lineStart = this.input.lastIndexOf("\n", this.state.lineStart - 2) + 1;
  13970. --this.state.curLine;
  13971. }
  13972. this.nextToken();
  13973. };
  13974. Tokenizer.prototype.curContext = function curContext() {
  13975. return this.state.context[this.state.context.length - 1];
  13976. };
  13977. // Read a single token, updating the parser object's token-related
  13978. // properties.
  13979. Tokenizer.prototype.nextToken = function nextToken() {
  13980. var curContext = this.curContext();
  13981. if (!curContext || !curContext.preserveSpace) this.skipSpace();
  13982. this.state.containsOctal = false;
  13983. this.state.octalPosition = null;
  13984. this.state.start = this.state.pos;
  13985. this.state.startLoc = this.state.curPosition();
  13986. if (this.state.pos >= this.input.length) return this.finishToken(types.eof);
  13987. if (curContext.override) {
  13988. return curContext.override(this);
  13989. } else {
  13990. return this.readToken(this.fullCharCodeAtPos());
  13991. }
  13992. };
  13993. Tokenizer.prototype.readToken = function readToken(code) {
  13994. // Identifier or keyword. '\uXXXX' sequences are allowed in
  13995. // identifiers, so '\' also dispatches to that.
  13996. if (isIdentifierStart(code) || code === 92 /* '\' */) {
  13997. return this.readWord();
  13998. } else {
  13999. return this.getTokenFromCode(code);
  14000. }
  14001. };
  14002. Tokenizer.prototype.fullCharCodeAtPos = function fullCharCodeAtPos() {
  14003. var code = this.input.charCodeAt(this.state.pos);
  14004. if (code <= 0xd7ff || code >= 0xe000) return code;
  14005. var next = this.input.charCodeAt(this.state.pos + 1);
  14006. return (code << 10) + next - 0x35fdc00;
  14007. };
  14008. Tokenizer.prototype.pushComment = function pushComment(block, text, start, end, startLoc, endLoc) {
  14009. var comment = {
  14010. type: block ? "CommentBlock" : "CommentLine",
  14011. value: text,
  14012. start: start,
  14013. end: end,
  14014. loc: new SourceLocation(startLoc, endLoc)
  14015. };
  14016. if (!this.isLookahead) {
  14017. this.state.tokens.push(comment);
  14018. this.state.comments.push(comment);
  14019. this.addComment(comment);
  14020. }
  14021. };
  14022. Tokenizer.prototype.skipBlockComment = function skipBlockComment() {
  14023. var startLoc = this.state.curPosition();
  14024. var start = this.state.pos;
  14025. var end = this.input.indexOf("*/", this.state.pos += 2);
  14026. if (end === -1) this.raise(this.state.pos - 2, "Unterminated comment");
  14027. this.state.pos = end + 2;
  14028. lineBreakG.lastIndex = start;
  14029. var match = void 0;
  14030. while ((match = lineBreakG.exec(this.input)) && match.index < this.state.pos) {
  14031. ++this.state.curLine;
  14032. this.state.lineStart = match.index + match[0].length;
  14033. }
  14034. this.pushComment(true, this.input.slice(start + 2, end), start, this.state.pos, startLoc, this.state.curPosition());
  14035. };
  14036. Tokenizer.prototype.skipLineComment = function skipLineComment(startSkip) {
  14037. var start = this.state.pos;
  14038. var startLoc = this.state.curPosition();
  14039. var ch = this.input.charCodeAt(this.state.pos += startSkip);
  14040. while (this.state.pos < this.input.length && ch !== 10 && ch !== 13 && ch !== 8232 && ch !== 8233) {
  14041. ++this.state.pos;
  14042. ch = this.input.charCodeAt(this.state.pos);
  14043. }
  14044. this.pushComment(false, this.input.slice(start + startSkip, this.state.pos), start, this.state.pos, startLoc, this.state.curPosition());
  14045. };
  14046. // Called at the start of the parse and after every token. Skips
  14047. // whitespace and comments, and.
  14048. Tokenizer.prototype.skipSpace = function skipSpace() {
  14049. loop: while (this.state.pos < this.input.length) {
  14050. var ch = this.input.charCodeAt(this.state.pos);
  14051. switch (ch) {
  14052. case 32:case 160:
  14053. // ' '
  14054. ++this.state.pos;
  14055. break;
  14056. case 13:
  14057. if (this.input.charCodeAt(this.state.pos + 1) === 10) {
  14058. ++this.state.pos;
  14059. }
  14060. case 10:case 8232:case 8233:
  14061. ++this.state.pos;
  14062. ++this.state.curLine;
  14063. this.state.lineStart = this.state.pos;
  14064. break;
  14065. case 47:
  14066. // '/'
  14067. switch (this.input.charCodeAt(this.state.pos + 1)) {
  14068. case 42:
  14069. // '*'
  14070. this.skipBlockComment();
  14071. break;
  14072. case 47:
  14073. this.skipLineComment(2);
  14074. break;
  14075. default:
  14076. break loop;
  14077. }
  14078. break;
  14079. default:
  14080. if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) {
  14081. ++this.state.pos;
  14082. } else {
  14083. break loop;
  14084. }
  14085. }
  14086. }
  14087. };
  14088. // Called at the end of every token. Sets `end`, `val`, and
  14089. // maintains `context` and `exprAllowed`, and skips the space after
  14090. // the token, so that the next one's `start` will point at the
  14091. // right position.
  14092. Tokenizer.prototype.finishToken = function finishToken(type, val) {
  14093. this.state.end = this.state.pos;
  14094. this.state.endLoc = this.state.curPosition();
  14095. var prevType = this.state.type;
  14096. this.state.type = type;
  14097. this.state.value = val;
  14098. this.updateContext(prevType);
  14099. };
  14100. // ### Token reading
  14101. // This is the function that is called to fetch the next token. It
  14102. // is somewhat obscure, because it works in character codes rather
  14103. // than characters, and because operator parsing has been inlined
  14104. // into it.
  14105. //
  14106. // All in the name of speed.
  14107. //
  14108. Tokenizer.prototype.readToken_dot = function readToken_dot() {
  14109. var next = this.input.charCodeAt(this.state.pos + 1);
  14110. if (next >= 48 && next <= 57) {
  14111. return this.readNumber(true);
  14112. }
  14113. var next2 = this.input.charCodeAt(this.state.pos + 2);
  14114. if (next === 46 && next2 === 46) {
  14115. // 46 = dot '.'
  14116. this.state.pos += 3;
  14117. return this.finishToken(types.ellipsis);
  14118. } else {
  14119. ++this.state.pos;
  14120. return this.finishToken(types.dot);
  14121. }
  14122. };
  14123. Tokenizer.prototype.readToken_slash = function readToken_slash() {
  14124. // '/'
  14125. if (this.state.exprAllowed) {
  14126. ++this.state.pos;
  14127. return this.readRegexp();
  14128. }
  14129. var next = this.input.charCodeAt(this.state.pos + 1);
  14130. if (next === 61) {
  14131. return this.finishOp(types.assign, 2);
  14132. } else {
  14133. return this.finishOp(types.slash, 1);
  14134. }
  14135. };
  14136. Tokenizer.prototype.readToken_mult_modulo = function readToken_mult_modulo(code) {
  14137. // '%*'
  14138. var type = code === 42 ? types.star : types.modulo;
  14139. var width = 1;
  14140. var next = this.input.charCodeAt(this.state.pos + 1);
  14141. if (next === 42) {
  14142. // '*'
  14143. width++;
  14144. next = this.input.charCodeAt(this.state.pos + 2);
  14145. type = types.exponent;
  14146. }
  14147. if (next === 61) {
  14148. width++;
  14149. type = types.assign;
  14150. }
  14151. return this.finishOp(type, width);
  14152. };
  14153. Tokenizer.prototype.readToken_pipe_amp = function readToken_pipe_amp(code) {
  14154. // '|&'
  14155. var next = this.input.charCodeAt(this.state.pos + 1);
  14156. if (next === code) return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2);
  14157. if (next === 61) return this.finishOp(types.assign, 2);
  14158. if (code === 124 && next === 125 && this.hasPlugin("flow")) return this.finishOp(types.braceBarR, 2);
  14159. return this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1);
  14160. };
  14161. Tokenizer.prototype.readToken_caret = function readToken_caret() {
  14162. // '^'
  14163. var next = this.input.charCodeAt(this.state.pos + 1);
  14164. if (next === 61) {
  14165. return this.finishOp(types.assign, 2);
  14166. } else {
  14167. return this.finishOp(types.bitwiseXOR, 1);
  14168. }
  14169. };
  14170. Tokenizer.prototype.readToken_plus_min = function readToken_plus_min(code) {
  14171. // '+-'
  14172. var next = this.input.charCodeAt(this.state.pos + 1);
  14173. if (next === code) {
  14174. if (next === 45 && this.input.charCodeAt(this.state.pos + 2) === 62 && lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.pos))) {
  14175. // A `-->` line comment
  14176. this.skipLineComment(3);
  14177. this.skipSpace();
  14178. return this.nextToken();
  14179. }
  14180. return this.finishOp(types.incDec, 2);
  14181. }
  14182. if (next === 61) {
  14183. return this.finishOp(types.assign, 2);
  14184. } else {
  14185. return this.finishOp(types.plusMin, 1);
  14186. }
  14187. };
  14188. Tokenizer.prototype.readToken_lt_gt = function readToken_lt_gt(code) {
  14189. // '<>'
  14190. var next = this.input.charCodeAt(this.state.pos + 1);
  14191. var size = 1;
  14192. if (next === code) {
  14193. size = code === 62 && this.input.charCodeAt(this.state.pos + 2) === 62 ? 3 : 2;
  14194. if (this.input.charCodeAt(this.state.pos + size) === 61) return this.finishOp(types.assign, size + 1);
  14195. return this.finishOp(types.bitShift, size);
  14196. }
  14197. if (next === 33 && code === 60 && this.input.charCodeAt(this.state.pos + 2) === 45 && this.input.charCodeAt(this.state.pos + 3) === 45) {
  14198. if (this.inModule) this.unexpected();
  14199. // `<!--`, an XML-style comment that should be interpreted as a line comment
  14200. this.skipLineComment(4);
  14201. this.skipSpace();
  14202. return this.nextToken();
  14203. }
  14204. if (next === 61) {
  14205. // <= | >=
  14206. size = 2;
  14207. }
  14208. return this.finishOp(types.relational, size);
  14209. };
  14210. Tokenizer.prototype.readToken_eq_excl = function readToken_eq_excl(code) {
  14211. // '=!'
  14212. var next = this.input.charCodeAt(this.state.pos + 1);
  14213. if (next === 61) return this.finishOp(types.equality, this.input.charCodeAt(this.state.pos + 2) === 61 ? 3 : 2);
  14214. if (code === 61 && next === 62) {
  14215. // '=>'
  14216. this.state.pos += 2;
  14217. return this.finishToken(types.arrow);
  14218. }
  14219. return this.finishOp(code === 61 ? types.eq : types.prefix, 1);
  14220. };
  14221. Tokenizer.prototype.getTokenFromCode = function getTokenFromCode(code) {
  14222. switch (code) {
  14223. // The interpretation of a dot depends on whether it is followed
  14224. // by a digit or another two dots.
  14225. case 46:
  14226. // '.'
  14227. return this.readToken_dot();
  14228. // Punctuation tokens.
  14229. case 40:
  14230. ++this.state.pos;return this.finishToken(types.parenL);
  14231. case 41:
  14232. ++this.state.pos;return this.finishToken(types.parenR);
  14233. case 59:
  14234. ++this.state.pos;return this.finishToken(types.semi);
  14235. case 44:
  14236. ++this.state.pos;return this.finishToken(types.comma);
  14237. case 91:
  14238. ++this.state.pos;return this.finishToken(types.bracketL);
  14239. case 93:
  14240. ++this.state.pos;return this.finishToken(types.bracketR);
  14241. case 123:
  14242. if (this.hasPlugin("flow") && this.input.charCodeAt(this.state.pos + 1) === 124) {
  14243. return this.finishOp(types.braceBarL, 2);
  14244. } else {
  14245. ++this.state.pos;
  14246. return this.finishToken(types.braceL);
  14247. }
  14248. case 125:
  14249. ++this.state.pos;return this.finishToken(types.braceR);
  14250. case 58:
  14251. if (this.hasPlugin("functionBind") && this.input.charCodeAt(this.state.pos + 1) === 58) {
  14252. return this.finishOp(types.doubleColon, 2);
  14253. } else {
  14254. ++this.state.pos;
  14255. return this.finishToken(types.colon);
  14256. }
  14257. case 63:
  14258. ++this.state.pos;return this.finishToken(types.question);
  14259. case 64:
  14260. ++this.state.pos;return this.finishToken(types.at);
  14261. case 96:
  14262. // '`'
  14263. ++this.state.pos;
  14264. return this.finishToken(types.backQuote);
  14265. case 48:
  14266. // '0'
  14267. var next = this.input.charCodeAt(this.state.pos + 1);
  14268. if (next === 120 || next === 88) return this.readRadixNumber(16); // '0x', '0X' - hex number
  14269. if (next === 111 || next === 79) return this.readRadixNumber(8); // '0o', '0O' - octal number
  14270. if (next === 98 || next === 66) return this.readRadixNumber(2); // '0b', '0B' - binary number
  14271. // Anything else beginning with a digit is an integer, octal
  14272. // number, or float.
  14273. case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:
  14274. // 1-9
  14275. return this.readNumber(false);
  14276. // Quotes produce strings.
  14277. case 34:case 39:
  14278. // '"', "'"
  14279. return this.readString(code);
  14280. // Operators are parsed inline in tiny state machines. '=' (61) is
  14281. // often referred to. `finishOp` simply skips the amount of
  14282. // characters it is given as second argument, and returns a token
  14283. // of the type given by its first argument.
  14284. case 47:
  14285. // '/'
  14286. return this.readToken_slash();
  14287. case 37:case 42:
  14288. // '%*'
  14289. return this.readToken_mult_modulo(code);
  14290. case 124:case 38:
  14291. // '|&'
  14292. return this.readToken_pipe_amp(code);
  14293. case 94:
  14294. // '^'
  14295. return this.readToken_caret();
  14296. case 43:case 45:
  14297. // '+-'
  14298. return this.readToken_plus_min(code);
  14299. case 60:case 62:
  14300. // '<>'
  14301. return this.readToken_lt_gt(code);
  14302. case 61:case 33:
  14303. // '=!'
  14304. return this.readToken_eq_excl(code);
  14305. case 126:
  14306. // '~'
  14307. return this.finishOp(types.prefix, 1);
  14308. }
  14309. this.raise(this.state.pos, "Unexpected character '" + codePointToString(code) + "'");
  14310. };
  14311. Tokenizer.prototype.finishOp = function finishOp(type, size) {
  14312. var str = this.input.slice(this.state.pos, this.state.pos + size);
  14313. this.state.pos += size;
  14314. return this.finishToken(type, str);
  14315. };
  14316. Tokenizer.prototype.readRegexp = function readRegexp() {
  14317. var start = this.state.pos;
  14318. var escaped = void 0,
  14319. inClass = void 0;
  14320. for (;;) {
  14321. if (this.state.pos >= this.input.length) this.raise(start, "Unterminated regular expression");
  14322. var ch = this.input.charAt(this.state.pos);
  14323. if (lineBreak.test(ch)) {
  14324. this.raise(start, "Unterminated regular expression");
  14325. }
  14326. if (escaped) {
  14327. escaped = false;
  14328. } else {
  14329. if (ch === "[") {
  14330. inClass = true;
  14331. } else if (ch === "]" && inClass) {
  14332. inClass = false;
  14333. } else if (ch === "/" && !inClass) {
  14334. break;
  14335. }
  14336. escaped = ch === "\\";
  14337. }
  14338. ++this.state.pos;
  14339. }
  14340. var content = this.input.slice(start, this.state.pos);
  14341. ++this.state.pos;
  14342. // Need to use `readWord1` because '\uXXXX' sequences are allowed
  14343. // here (don't ask).
  14344. var mods = this.readWord1();
  14345. if (mods) {
  14346. var validFlags = /^[gmsiyu]*$/;
  14347. if (!validFlags.test(mods)) this.raise(start, "Invalid regular expression flag");
  14348. }
  14349. return this.finishToken(types.regexp, {
  14350. pattern: content,
  14351. flags: mods
  14352. });
  14353. };
  14354. // Read an integer in the given radix. Return null if zero digits
  14355. // were read, the integer value otherwise. When `len` is given, this
  14356. // will return `null` unless the integer has exactly `len` digits.
  14357. Tokenizer.prototype.readInt = function readInt(radix, len) {
  14358. var start = this.state.pos;
  14359. var total = 0;
  14360. for (var i = 0, e = len == null ? Infinity : len; i < e; ++i) {
  14361. var code = this.input.charCodeAt(this.state.pos);
  14362. var val = void 0;
  14363. if (code >= 97) {
  14364. val = code - 97 + 10; // a
  14365. } else if (code >= 65) {
  14366. val = code - 65 + 10; // A
  14367. } else if (code >= 48 && code <= 57) {
  14368. val = code - 48; // 0-9
  14369. } else {
  14370. val = Infinity;
  14371. }
  14372. if (val >= radix) break;
  14373. ++this.state.pos;
  14374. total = total * radix + val;
  14375. }
  14376. if (this.state.pos === start || len != null && this.state.pos - start !== len) return null;
  14377. return total;
  14378. };
  14379. Tokenizer.prototype.readRadixNumber = function readRadixNumber(radix) {
  14380. this.state.pos += 2; // 0x
  14381. var val = this.readInt(radix);
  14382. if (val == null) this.raise(this.state.start + 2, "Expected number in radix " + radix);
  14383. if (isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.state.pos, "Identifier directly after number");
  14384. return this.finishToken(types.num, val);
  14385. };
  14386. // Read an integer, octal integer, or floating-point number.
  14387. Tokenizer.prototype.readNumber = function readNumber(startsWithDot) {
  14388. var start = this.state.pos;
  14389. var octal = this.input.charCodeAt(this.state.pos) === 48;
  14390. var isFloat = false;
  14391. if (!startsWithDot && this.readInt(10) === null) this.raise(start, "Invalid number");
  14392. var next = this.input.charCodeAt(this.state.pos);
  14393. if (next === 46) {
  14394. // '.'
  14395. ++this.state.pos;
  14396. this.readInt(10);
  14397. isFloat = true;
  14398. next = this.input.charCodeAt(this.state.pos);
  14399. }
  14400. if (next === 69 || next === 101) {
  14401. // 'eE'
  14402. next = this.input.charCodeAt(++this.state.pos);
  14403. if (next === 43 || next === 45) ++this.state.pos; // '+-'
  14404. if (this.readInt(10) === null) this.raise(start, "Invalid number");
  14405. isFloat = true;
  14406. }
  14407. if (isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.state.pos, "Identifier directly after number");
  14408. var str = this.input.slice(start, this.state.pos);
  14409. var val = void 0;
  14410. if (isFloat) {
  14411. val = parseFloat(str);
  14412. } else if (!octal || str.length === 1) {
  14413. val = parseInt(str, 10);
  14414. } else if (/[89]/.test(str) || this.state.strict) {
  14415. this.raise(start, "Invalid number");
  14416. } else {
  14417. val = parseInt(str, 8);
  14418. }
  14419. return this.finishToken(types.num, val);
  14420. };
  14421. // Read a string value, interpreting backslash-escapes.
  14422. Tokenizer.prototype.readCodePoint = function readCodePoint() {
  14423. var ch = this.input.charCodeAt(this.state.pos);
  14424. var code = void 0;
  14425. if (ch === 123) {
  14426. var codePos = ++this.state.pos;
  14427. code = this.readHexChar(this.input.indexOf("}", this.state.pos) - this.state.pos);
  14428. ++this.state.pos;
  14429. if (code > 0x10FFFF) this.raise(codePos, "Code point out of bounds");
  14430. } else {
  14431. code = this.readHexChar(4);
  14432. }
  14433. return code;
  14434. };
  14435. Tokenizer.prototype.readString = function readString(quote) {
  14436. var out = "",
  14437. chunkStart = ++this.state.pos;
  14438. for (;;) {
  14439. if (this.state.pos >= this.input.length) this.raise(this.state.start, "Unterminated string constant");
  14440. var ch = this.input.charCodeAt(this.state.pos);
  14441. if (ch === quote) break;
  14442. if (ch === 92) {
  14443. // '\'
  14444. out += this.input.slice(chunkStart, this.state.pos);
  14445. out += this.readEscapedChar(false);
  14446. chunkStart = this.state.pos;
  14447. } else {
  14448. if (isNewLine(ch)) this.raise(this.state.start, "Unterminated string constant");
  14449. ++this.state.pos;
  14450. }
  14451. }
  14452. out += this.input.slice(chunkStart, this.state.pos++);
  14453. return this.finishToken(types.string, out);
  14454. };
  14455. // Reads template string tokens.
  14456. Tokenizer.prototype.readTmplToken = function readTmplToken() {
  14457. var out = "",
  14458. chunkStart = this.state.pos;
  14459. for (;;) {
  14460. if (this.state.pos >= this.input.length) this.raise(this.state.start, "Unterminated template");
  14461. var ch = this.input.charCodeAt(this.state.pos);
  14462. if (ch === 96 || ch === 36 && this.input.charCodeAt(this.state.pos + 1) === 123) {
  14463. // '`', '${'
  14464. if (this.state.pos === this.state.start && this.match(types.template)) {
  14465. if (ch === 36) {
  14466. this.state.pos += 2;
  14467. return this.finishToken(types.dollarBraceL);
  14468. } else {
  14469. ++this.state.pos;
  14470. return this.finishToken(types.backQuote);
  14471. }
  14472. }
  14473. out += this.input.slice(chunkStart, this.state.pos);
  14474. return this.finishToken(types.template, out);
  14475. }
  14476. if (ch === 92) {
  14477. // '\'
  14478. out += this.input.slice(chunkStart, this.state.pos);
  14479. out += this.readEscapedChar(true);
  14480. chunkStart = this.state.pos;
  14481. } else if (isNewLine(ch)) {
  14482. out += this.input.slice(chunkStart, this.state.pos);
  14483. ++this.state.pos;
  14484. switch (ch) {
  14485. case 13:
  14486. if (this.input.charCodeAt(this.state.pos) === 10) ++this.state.pos;
  14487. case 10:
  14488. out += "\n";
  14489. break;
  14490. default:
  14491. out += String.fromCharCode(ch);
  14492. break;
  14493. }
  14494. ++this.state.curLine;
  14495. this.state.lineStart = this.state.pos;
  14496. chunkStart = this.state.pos;
  14497. } else {
  14498. ++this.state.pos;
  14499. }
  14500. }
  14501. };
  14502. // Used to read escaped characters
  14503. Tokenizer.prototype.readEscapedChar = function readEscapedChar(inTemplate) {
  14504. var ch = this.input.charCodeAt(++this.state.pos);
  14505. ++this.state.pos;
  14506. switch (ch) {
  14507. case 110:
  14508. return "\n"; // 'n' -> '\n'
  14509. case 114:
  14510. return "\r"; // 'r' -> '\r'
  14511. case 120:
  14512. return String.fromCharCode(this.readHexChar(2)); // 'x'
  14513. case 117:
  14514. return codePointToString(this.readCodePoint()); // 'u'
  14515. case 116:
  14516. return "\t"; // 't' -> '\t'
  14517. case 98:
  14518. return "\b"; // 'b' -> '\b'
  14519. case 118:
  14520. return "\x0B"; // 'v' -> '\u000b'
  14521. case 102:
  14522. return "\f"; // 'f' -> '\f'
  14523. case 13:
  14524. if (this.input.charCodeAt(this.state.pos) === 10) ++this.state.pos; // '\r\n'
  14525. case 10:
  14526. // ' \n'
  14527. this.state.lineStart = this.state.pos;
  14528. ++this.state.curLine;
  14529. return "";
  14530. default:
  14531. if (ch >= 48 && ch <= 55) {
  14532. var octalStr = this.input.substr(this.state.pos - 1, 3).match(/^[0-7]+/)[0];
  14533. var octal = parseInt(octalStr, 8);
  14534. if (octal > 255) {
  14535. octalStr = octalStr.slice(0, -1);
  14536. octal = parseInt(octalStr, 8);
  14537. }
  14538. if (octal > 0) {
  14539. if (!this.state.containsOctal) {
  14540. this.state.containsOctal = true;
  14541. this.state.octalPosition = this.state.pos - 2;
  14542. }
  14543. if (this.state.strict || inTemplate) {
  14544. this.raise(this.state.pos - 2, "Octal literal in strict mode");
  14545. }
  14546. }
  14547. this.state.pos += octalStr.length - 1;
  14548. return String.fromCharCode(octal);
  14549. }
  14550. return String.fromCharCode(ch);
  14551. }
  14552. };
  14553. // Used to read character escape sequences ('\x', '\u', '\U').
  14554. Tokenizer.prototype.readHexChar = function readHexChar(len) {
  14555. var codePos = this.state.pos;
  14556. var n = this.readInt(16, len);
  14557. if (n === null) this.raise(codePos, "Bad character escape sequence");
  14558. return n;
  14559. };
  14560. // Read an identifier, and return it as a string. Sets `this.state.containsEsc`
  14561. // to whether the word contained a '\u' escape.
  14562. //
  14563. // Incrementally adds only escaped chars, adding other chunks as-is
  14564. // as a micro-optimization.
  14565. Tokenizer.prototype.readWord1 = function readWord1() {
  14566. this.state.containsEsc = false;
  14567. var word = "",
  14568. first = true,
  14569. chunkStart = this.state.pos;
  14570. while (this.state.pos < this.input.length) {
  14571. var ch = this.fullCharCodeAtPos();
  14572. if (isIdentifierChar(ch)) {
  14573. this.state.pos += ch <= 0xffff ? 1 : 2;
  14574. } else if (ch === 92) {
  14575. // "\"
  14576. this.state.containsEsc = true;
  14577. word += this.input.slice(chunkStart, this.state.pos);
  14578. var escStart = this.state.pos;
  14579. if (this.input.charCodeAt(++this.state.pos) !== 117) {
  14580. // "u"
  14581. this.raise(this.state.pos, "Expecting Unicode escape sequence \\uXXXX");
  14582. }
  14583. ++this.state.pos;
  14584. var esc = this.readCodePoint();
  14585. if (!(first ? isIdentifierStart : isIdentifierChar)(esc, true)) {
  14586. this.raise(escStart, "Invalid Unicode escape");
  14587. }
  14588. word += codePointToString(esc);
  14589. chunkStart = this.state.pos;
  14590. } else {
  14591. break;
  14592. }
  14593. first = false;
  14594. }
  14595. return word + this.input.slice(chunkStart, this.state.pos);
  14596. };
  14597. // Read an identifier or keyword token. Will check for reserved
  14598. // words when necessary.
  14599. Tokenizer.prototype.readWord = function readWord() {
  14600. var word = this.readWord1();
  14601. var type = types.name;
  14602. if (!this.state.containsEsc && this.isKeyword(word)) {
  14603. type = keywords[word];
  14604. }
  14605. return this.finishToken(type, word);
  14606. };
  14607. Tokenizer.prototype.braceIsBlock = function braceIsBlock(prevType) {
  14608. if (prevType === types.colon) {
  14609. var parent = this.curContext();
  14610. if (parent === types$1.braceStatement || parent === types$1.braceExpression) {
  14611. return !parent.isExpr;
  14612. }
  14613. }
  14614. if (prevType === types._return) {
  14615. return lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start));
  14616. }
  14617. if (prevType === types._else || prevType === types.semi || prevType === types.eof || prevType === types.parenR) {
  14618. return true;
  14619. }
  14620. if (prevType === types.braceL) {
  14621. return this.curContext() === types$1.braceStatement;
  14622. }
  14623. return !this.state.exprAllowed;
  14624. };
  14625. Tokenizer.prototype.updateContext = function updateContext(prevType) {
  14626. var type = this.state.type;
  14627. var update = void 0;
  14628. if (type.keyword && prevType === types.dot) {
  14629. this.state.exprAllowed = false;
  14630. } else if (update = type.updateContext) {
  14631. update.call(this, prevType);
  14632. } else {
  14633. this.state.exprAllowed = type.beforeExpr;
  14634. }
  14635. };
  14636. return Tokenizer;
  14637. }();
  14638. var plugins = {};
  14639. var frozenDeprecatedWildcardPluginList = ["jsx", "doExpressions", "objectRestSpread", "decorators", "classProperties", "exportExtensions", "asyncGenerators", "functionBind", "functionSent", "dynamicImport", "flow"];
  14640. var Parser = function (_Tokenizer) {
  14641. inherits(Parser, _Tokenizer);
  14642. function Parser(options, input) {
  14643. classCallCheck(this, Parser);
  14644. options = getOptions(options);
  14645. var _this = possibleConstructorReturn(this, _Tokenizer.call(this, options, input));
  14646. _this.options = options;
  14647. _this.inModule = _this.options.sourceType === "module";
  14648. _this.input = input;
  14649. _this.plugins = _this.loadPlugins(_this.options.plugins);
  14650. _this.filename = options.sourceFilename;
  14651. // If enabled, skip leading hashbang line.
  14652. if (_this.state.pos === 0 && _this.input[0] === "#" && _this.input[1] === "!") {
  14653. _this.skipLineComment(2);
  14654. }
  14655. return _this;
  14656. }
  14657. Parser.prototype.isReservedWord = function isReservedWord(word) {
  14658. if (word === "await") {
  14659. return this.inModule;
  14660. } else {
  14661. return reservedWords[6](word);
  14662. }
  14663. };
  14664. Parser.prototype.hasPlugin = function hasPlugin(name) {
  14665. if (this.plugins["*"] && frozenDeprecatedWildcardPluginList.indexOf(name) > -1) {
  14666. return true;
  14667. }
  14668. return !!this.plugins[name];
  14669. };
  14670. Parser.prototype.extend = function extend(name, f) {
  14671. this[name] = f(this[name]);
  14672. };
  14673. Parser.prototype.loadAllPlugins = function loadAllPlugins() {
  14674. var _this2 = this;
  14675. // ensure flow plugin loads last, also ensure estree is not loaded with *
  14676. var pluginNames = Object.keys(plugins).filter(function (name) {
  14677. return name !== "flow" && name !== "estree";
  14678. });
  14679. pluginNames.push("flow");
  14680. pluginNames.forEach(function (name) {
  14681. var plugin = plugins[name];
  14682. if (plugin) plugin(_this2);
  14683. });
  14684. };
  14685. Parser.prototype.loadPlugins = function loadPlugins(pluginList) {
  14686. // TODO: Deprecate "*" option in next major version of Babylon
  14687. if (pluginList.indexOf("*") >= 0) {
  14688. this.loadAllPlugins();
  14689. return { "*": true };
  14690. }
  14691. var pluginMap = {};
  14692. if (pluginList.indexOf("flow") >= 0) {
  14693. // ensure flow plugin loads last
  14694. pluginList = pluginList.filter(function (plugin) {
  14695. return plugin !== "flow";
  14696. });
  14697. pluginList.push("flow");
  14698. }
  14699. if (pluginList.indexOf("estree") >= 0) {
  14700. // ensure estree plugin loads first
  14701. pluginList = pluginList.filter(function (plugin) {
  14702. return plugin !== "estree";
  14703. });
  14704. pluginList.unshift("estree");
  14705. }
  14706. for (var _iterator = pluginList, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
  14707. var _ref;
  14708. if (_isArray) {
  14709. if (_i >= _iterator.length) break;
  14710. _ref = _iterator[_i++];
  14711. } else {
  14712. _i = _iterator.next();
  14713. if (_i.done) break;
  14714. _ref = _i.value;
  14715. }
  14716. var name = _ref;
  14717. if (!pluginMap[name]) {
  14718. pluginMap[name] = true;
  14719. var plugin = plugins[name];
  14720. if (plugin) plugin(this);
  14721. }
  14722. }
  14723. return pluginMap;
  14724. };
  14725. Parser.prototype.parse = function parse() {
  14726. var file = this.startNode();
  14727. var program = this.startNode();
  14728. this.nextToken();
  14729. return this.parseTopLevel(file, program);
  14730. };
  14731. return Parser;
  14732. }(Tokenizer);
  14733. var pp = Parser.prototype;
  14734. // ## Parser utilities
  14735. // TODO
  14736. pp.addExtra = function (node, key, val) {
  14737. if (!node) return;
  14738. var extra = node.extra = node.extra || {};
  14739. extra[key] = val;
  14740. };
  14741. // TODO
  14742. pp.isRelational = function (op) {
  14743. return this.match(types.relational) && this.state.value === op;
  14744. };
  14745. // TODO
  14746. pp.expectRelational = function (op) {
  14747. if (this.isRelational(op)) {
  14748. this.next();
  14749. } else {
  14750. this.unexpected(null, types.relational);
  14751. }
  14752. };
  14753. // Tests whether parsed token is a contextual keyword.
  14754. pp.isContextual = function (name) {
  14755. return this.match(types.name) && this.state.value === name;
  14756. };
  14757. // Consumes contextual keyword if possible.
  14758. pp.eatContextual = function (name) {
  14759. return this.state.value === name && this.eat(types.name);
  14760. };
  14761. // Asserts that following token is given contextual keyword.
  14762. pp.expectContextual = function (name, message) {
  14763. if (!this.eatContextual(name)) this.unexpected(null, message);
  14764. };
  14765. // Test whether a semicolon can be inserted at the current position.
  14766. pp.canInsertSemicolon = function () {
  14767. return this.match(types.eof) || this.match(types.braceR) || lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start));
  14768. };
  14769. // TODO
  14770. pp.isLineTerminator = function () {
  14771. return this.eat(types.semi) || this.canInsertSemicolon();
  14772. };
  14773. // Consume a semicolon, or, failing that, see if we are allowed to
  14774. // pretend that there is a semicolon at this position.
  14775. pp.semicolon = function () {
  14776. if (!this.isLineTerminator()) this.unexpected(null, types.semi);
  14777. };
  14778. // Expect a token of a given type. If found, consume it, otherwise,
  14779. // raise an unexpected token error at given pos.
  14780. pp.expect = function (type, pos) {
  14781. return this.eat(type) || this.unexpected(pos, type);
  14782. };
  14783. // Raise an unexpected token error. Can take the expected token type
  14784. // instead of a message string.
  14785. pp.unexpected = function (pos) {
  14786. var messageOrType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "Unexpected token";
  14787. if (messageOrType && (typeof messageOrType === "undefined" ? "undefined" : _typeof(messageOrType)) === "object" && messageOrType.label) {
  14788. messageOrType = "Unexpected token, expected " + messageOrType.label;
  14789. }
  14790. this.raise(pos != null ? pos : this.state.start, messageOrType);
  14791. };
  14792. /* eslint max-len: 0 */
  14793. var pp$1 = Parser.prototype;
  14794. // ### Statement parsing
  14795. // Parse a program. Initializes the parser, reads any number of
  14796. // statements, and wraps them in a Program node. Optionally takes a
  14797. // `program` argument. If present, the statements will be appended
  14798. // to its body instead of creating a new node.
  14799. pp$1.parseTopLevel = function (file, program) {
  14800. program.sourceType = this.options.sourceType;
  14801. this.parseBlockBody(program, true, true, types.eof);
  14802. file.program = this.finishNode(program, "Program");
  14803. file.comments = this.state.comments;
  14804. file.tokens = this.state.tokens;
  14805. return this.finishNode(file, "File");
  14806. };
  14807. var loopLabel = { kind: "loop" };
  14808. var switchLabel = { kind: "switch" };
  14809. // TODO
  14810. pp$1.stmtToDirective = function (stmt) {
  14811. var expr = stmt.expression;
  14812. var directiveLiteral = this.startNodeAt(expr.start, expr.loc.start);
  14813. var directive = this.startNodeAt(stmt.start, stmt.loc.start);
  14814. var raw = this.input.slice(expr.start, expr.end);
  14815. var val = directiveLiteral.value = raw.slice(1, -1); // remove quotes
  14816. this.addExtra(directiveLiteral, "raw", raw);
  14817. this.addExtra(directiveLiteral, "rawValue", val);
  14818. directive.value = this.finishNodeAt(directiveLiteral, "DirectiveLiteral", expr.end, expr.loc.end);
  14819. return this.finishNodeAt(directive, "Directive", stmt.end, stmt.loc.end);
  14820. };
  14821. // Parse a single statement.
  14822. //
  14823. // If expecting a statement and finding a slash operator, parse a
  14824. // regular expression literal. This is to handle cases like
  14825. // `if (foo) /blah/.exec(foo)`, where looking at the previous token
  14826. // does not help.
  14827. pp$1.parseStatement = function (declaration, topLevel) {
  14828. if (this.match(types.at)) {
  14829. this.parseDecorators(true);
  14830. }
  14831. var starttype = this.state.type;
  14832. var node = this.startNode();
  14833. // Most types of statements are recognized by the keyword they
  14834. // start with. Many are trivial to parse, some require a bit of
  14835. // complexity.
  14836. switch (starttype) {
  14837. case types._break:case types._continue:
  14838. return this.parseBreakContinueStatement(node, starttype.keyword);
  14839. case types._debugger:
  14840. return this.parseDebuggerStatement(node);
  14841. case types._do:
  14842. return this.parseDoStatement(node);
  14843. case types._for:
  14844. return this.parseForStatement(node);
  14845. case types._function:
  14846. if (!declaration) this.unexpected();
  14847. return this.parseFunctionStatement(node);
  14848. case types._class:
  14849. if (!declaration) this.unexpected();
  14850. return this.parseClass(node, true);
  14851. case types._if:
  14852. return this.parseIfStatement(node);
  14853. case types._return:
  14854. return this.parseReturnStatement(node);
  14855. case types._switch:
  14856. return this.parseSwitchStatement(node);
  14857. case types._throw:
  14858. return this.parseThrowStatement(node);
  14859. case types._try:
  14860. return this.parseTryStatement(node);
  14861. case types._let:
  14862. case types._const:
  14863. if (!declaration) this.unexpected(); // NOTE: falls through to _var
  14864. case types._var:
  14865. return this.parseVarStatement(node, starttype);
  14866. case types._while:
  14867. return this.parseWhileStatement(node);
  14868. case types._with:
  14869. return this.parseWithStatement(node);
  14870. case types.braceL:
  14871. return this.parseBlock();
  14872. case types.semi:
  14873. return this.parseEmptyStatement(node);
  14874. case types._export:
  14875. case types._import:
  14876. if (this.hasPlugin("dynamicImport") && this.lookahead().type === types.parenL) break;
  14877. if (!this.options.allowImportExportEverywhere) {
  14878. if (!topLevel) {
  14879. this.raise(this.state.start, "'import' and 'export' may only appear at the top level");
  14880. }
  14881. if (!this.inModule) {
  14882. this.raise(this.state.start, "'import' and 'export' may appear only with 'sourceType: module'");
  14883. }
  14884. }
  14885. return starttype === types._import ? this.parseImport(node) : this.parseExport(node);
  14886. case types.name:
  14887. if (this.state.value === "async") {
  14888. // peek ahead and see if next token is a function
  14889. var state = this.state.clone();
  14890. this.next();
  14891. if (this.match(types._function) && !this.canInsertSemicolon()) {
  14892. this.expect(types._function);
  14893. return this.parseFunction(node, true, false, true);
  14894. } else {
  14895. this.state = state;
  14896. }
  14897. }
  14898. }
  14899. // If the statement does not start with a statement keyword or a
  14900. // brace, it's an ExpressionStatement or LabeledStatement. We
  14901. // simply start parsing an expression, and afterwards, if the
  14902. // next token is a colon and the expression was a simple
  14903. // Identifier node, we switch to interpreting it as a label.
  14904. var maybeName = this.state.value;
  14905. var expr = this.parseExpression();
  14906. if (starttype === types.name && expr.type === "Identifier" && this.eat(types.colon)) {
  14907. return this.parseLabeledStatement(node, maybeName, expr);
  14908. } else {
  14909. return this.parseExpressionStatement(node, expr);
  14910. }
  14911. };
  14912. pp$1.takeDecorators = function (node) {
  14913. if (this.state.decorators.length) {
  14914. node.decorators = this.state.decorators;
  14915. this.state.decorators = [];
  14916. }
  14917. };
  14918. pp$1.parseDecorators = function (allowExport) {
  14919. while (this.match(types.at)) {
  14920. var decorator = this.parseDecorator();
  14921. this.state.decorators.push(decorator);
  14922. }
  14923. if (allowExport && this.match(types._export)) {
  14924. return;
  14925. }
  14926. if (!this.match(types._class)) {
  14927. this.raise(this.state.start, "Leading decorators must be attached to a class declaration");
  14928. }
  14929. };
  14930. pp$1.parseDecorator = function () {
  14931. if (!this.hasPlugin("decorators")) {
  14932. this.unexpected();
  14933. }
  14934. var node = this.startNode();
  14935. this.next();
  14936. node.expression = this.parseMaybeAssign();
  14937. return this.finishNode(node, "Decorator");
  14938. };
  14939. pp$1.parseBreakContinueStatement = function (node, keyword) {
  14940. var isBreak = keyword === "break";
  14941. this.next();
  14942. if (this.isLineTerminator()) {
  14943. node.label = null;
  14944. } else if (!this.match(types.name)) {
  14945. this.unexpected();
  14946. } else {
  14947. node.label = this.parseIdentifier();
  14948. this.semicolon();
  14949. }
  14950. // Verify that there is an actual destination to break or
  14951. // continue to.
  14952. var i = void 0;
  14953. for (i = 0; i < this.state.labels.length; ++i) {
  14954. var lab = this.state.labels[i];
  14955. if (node.label == null || lab.name === node.label.name) {
  14956. if (lab.kind != null && (isBreak || lab.kind === "loop")) break;
  14957. if (node.label && isBreak) break;
  14958. }
  14959. }
  14960. if (i === this.state.labels.length) this.raise(node.start, "Unsyntactic " + keyword);
  14961. return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement");
  14962. };
  14963. pp$1.parseDebuggerStatement = function (node) {
  14964. this.next();
  14965. this.semicolon();
  14966. return this.finishNode(node, "DebuggerStatement");
  14967. };
  14968. pp$1.parseDoStatement = function (node) {
  14969. this.next();
  14970. this.state.labels.push(loopLabel);
  14971. node.body = this.parseStatement(false);
  14972. this.state.labels.pop();
  14973. this.expect(types._while);
  14974. node.test = this.parseParenExpression();
  14975. this.eat(types.semi);
  14976. return this.finishNode(node, "DoWhileStatement");
  14977. };
  14978. // Disambiguating between a `for` and a `for`/`in` or `for`/`of`
  14979. // loop is non-trivial. Basically, we have to parse the init `var`
  14980. // statement or expression, disallowing the `in` operator (see
  14981. // the second parameter to `parseExpression`), and then check
  14982. // whether the next token is `in` or `of`. When there is no init
  14983. // part (semicolon immediately after the opening parenthesis), it
  14984. // is a regular `for` loop.
  14985. pp$1.parseForStatement = function (node) {
  14986. this.next();
  14987. this.state.labels.push(loopLabel);
  14988. var forAwait = false;
  14989. if (this.hasPlugin("asyncGenerators") && this.state.inAsync && this.isContextual("await")) {
  14990. forAwait = true;
  14991. this.next();
  14992. }
  14993. this.expect(types.parenL);
  14994. if (this.match(types.semi)) {
  14995. if (forAwait) {
  14996. this.unexpected();
  14997. }
  14998. return this.parseFor(node, null);
  14999. }
  15000. if (this.match(types._var) || this.match(types._let) || this.match(types._const)) {
  15001. var _init = this.startNode();
  15002. var varKind = this.state.type;
  15003. this.next();
  15004. this.parseVar(_init, true, varKind);
  15005. this.finishNode(_init, "VariableDeclaration");
  15006. if (this.match(types._in) || this.isContextual("of")) {
  15007. if (_init.declarations.length === 1 && !_init.declarations[0].init) {
  15008. return this.parseForIn(node, _init, forAwait);
  15009. }
  15010. }
  15011. if (forAwait) {
  15012. this.unexpected();
  15013. }
  15014. return this.parseFor(node, _init);
  15015. }
  15016. var refShorthandDefaultPos = { start: 0 };
  15017. var init = this.parseExpression(true, refShorthandDefaultPos);
  15018. if (this.match(types._in) || this.isContextual("of")) {
  15019. var description = this.isContextual("of") ? "for-of statement" : "for-in statement";
  15020. this.toAssignable(init, undefined, description);
  15021. this.checkLVal(init, undefined, undefined, description);
  15022. return this.parseForIn(node, init, forAwait);
  15023. } else if (refShorthandDefaultPos.start) {
  15024. this.unexpected(refShorthandDefaultPos.start);
  15025. }
  15026. if (forAwait) {
  15027. this.unexpected();
  15028. }
  15029. return this.parseFor(node, init);
  15030. };
  15031. pp$1.parseFunctionStatement = function (node) {
  15032. this.next();
  15033. return this.parseFunction(node, true);
  15034. };
  15035. pp$1.parseIfStatement = function (node) {
  15036. this.next();
  15037. node.test = this.parseParenExpression();
  15038. node.consequent = this.parseStatement(false);
  15039. node.alternate = this.eat(types._else) ? this.parseStatement(false) : null;
  15040. return this.finishNode(node, "IfStatement");
  15041. };
  15042. pp$1.parseReturnStatement = function (node) {
  15043. if (!this.state.inFunction && !this.options.allowReturnOutsideFunction) {
  15044. this.raise(this.state.start, "'return' outside of function");
  15045. }
  15046. this.next();
  15047. // In `return` (and `break`/`continue`), the keywords with
  15048. // optional arguments, we eagerly look for a semicolon or the
  15049. // possibility to insert one.
  15050. if (this.isLineTerminator()) {
  15051. node.argument = null;
  15052. } else {
  15053. node.argument = this.parseExpression();
  15054. this.semicolon();
  15055. }
  15056. return this.finishNode(node, "ReturnStatement");
  15057. };
  15058. pp$1.parseSwitchStatement = function (node) {
  15059. this.next();
  15060. node.discriminant = this.parseParenExpression();
  15061. node.cases = [];
  15062. this.expect(types.braceL);
  15063. this.state.labels.push(switchLabel);
  15064. // Statements under must be grouped (by label) in SwitchCase
  15065. // nodes. `cur` is used to keep the node that we are currently
  15066. // adding statements to.
  15067. var cur = void 0;
  15068. for (var sawDefault; !this.match(types.braceR);) {
  15069. if (this.match(types._case) || this.match(types._default)) {
  15070. var isCase = this.match(types._case);
  15071. if (cur) this.finishNode(cur, "SwitchCase");
  15072. node.cases.push(cur = this.startNode());
  15073. cur.consequent = [];
  15074. this.next();
  15075. if (isCase) {
  15076. cur.test = this.parseExpression();
  15077. } else {
  15078. if (sawDefault) this.raise(this.state.lastTokStart, "Multiple default clauses");
  15079. sawDefault = true;
  15080. cur.test = null;
  15081. }
  15082. this.expect(types.colon);
  15083. } else {
  15084. if (cur) {
  15085. cur.consequent.push(this.parseStatement(true));
  15086. } else {
  15087. this.unexpected();
  15088. }
  15089. }
  15090. }
  15091. if (cur) this.finishNode(cur, "SwitchCase");
  15092. this.next(); // Closing brace
  15093. this.state.labels.pop();
  15094. return this.finishNode(node, "SwitchStatement");
  15095. };
  15096. pp$1.parseThrowStatement = function (node) {
  15097. this.next();
  15098. if (lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start))) this.raise(this.state.lastTokEnd, "Illegal newline after throw");
  15099. node.argument = this.parseExpression();
  15100. this.semicolon();
  15101. return this.finishNode(node, "ThrowStatement");
  15102. };
  15103. // Reused empty array added for node fields that are always empty.
  15104. var empty = [];
  15105. pp$1.parseTryStatement = function (node) {
  15106. this.next();
  15107. node.block = this.parseBlock();
  15108. node.handler = null;
  15109. if (this.match(types._catch)) {
  15110. var clause = this.startNode();
  15111. this.next();
  15112. this.expect(types.parenL);
  15113. clause.param = this.parseBindingAtom();
  15114. this.checkLVal(clause.param, true, Object.create(null), "catch clause");
  15115. this.expect(types.parenR);
  15116. clause.body = this.parseBlock();
  15117. node.handler = this.finishNode(clause, "CatchClause");
  15118. }
  15119. node.guardedHandlers = empty;
  15120. node.finalizer = this.eat(types._finally) ? this.parseBlock() : null;
  15121. if (!node.handler && !node.finalizer) {
  15122. this.raise(node.start, "Missing catch or finally clause");
  15123. }
  15124. return this.finishNode(node, "TryStatement");
  15125. };
  15126. pp$1.parseVarStatement = function (node, kind) {
  15127. this.next();
  15128. this.parseVar(node, false, kind);
  15129. this.semicolon();
  15130. return this.finishNode(node, "VariableDeclaration");
  15131. };
  15132. pp$1.parseWhileStatement = function (node) {
  15133. this.next();
  15134. node.test = this.parseParenExpression();
  15135. this.state.labels.push(loopLabel);
  15136. node.body = this.parseStatement(false);
  15137. this.state.labels.pop();
  15138. return this.finishNode(node, "WhileStatement");
  15139. };
  15140. pp$1.parseWithStatement = function (node) {
  15141. if (this.state.strict) this.raise(this.state.start, "'with' in strict mode");
  15142. this.next();
  15143. node.object = this.parseParenExpression();
  15144. node.body = this.parseStatement(false);
  15145. return this.finishNode(node, "WithStatement");
  15146. };
  15147. pp$1.parseEmptyStatement = function (node) {
  15148. this.next();
  15149. return this.finishNode(node, "EmptyStatement");
  15150. };
  15151. pp$1.parseLabeledStatement = function (node, maybeName, expr) {
  15152. for (var _iterator = this.state.labels, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
  15153. var _ref;
  15154. if (_isArray) {
  15155. if (_i >= _iterator.length) break;
  15156. _ref = _iterator[_i++];
  15157. } else {
  15158. _i = _iterator.next();
  15159. if (_i.done) break;
  15160. _ref = _i.value;
  15161. }
  15162. var _label = _ref;
  15163. if (_label.name === maybeName) {
  15164. this.raise(expr.start, "Label '" + maybeName + "' is already declared");
  15165. }
  15166. }
  15167. var kind = this.state.type.isLoop ? "loop" : this.match(types._switch) ? "switch" : null;
  15168. for (var i = this.state.labels.length - 1; i >= 0; i--) {
  15169. var label = this.state.labels[i];
  15170. if (label.statementStart === node.start) {
  15171. label.statementStart = this.state.start;
  15172. label.kind = kind;
  15173. } else {
  15174. break;
  15175. }
  15176. }
  15177. this.state.labels.push({ name: maybeName, kind: kind, statementStart: this.state.start });
  15178. node.body = this.parseStatement(true);
  15179. this.state.labels.pop();
  15180. node.label = expr;
  15181. return this.finishNode(node, "LabeledStatement");
  15182. };
  15183. pp$1.parseExpressionStatement = function (node, expr) {
  15184. node.expression = expr;
  15185. this.semicolon();
  15186. return this.finishNode(node, "ExpressionStatement");
  15187. };
  15188. // Parse a semicolon-enclosed block of statements, handling `"use
  15189. // strict"` declarations when `allowStrict` is true (used for
  15190. // function bodies).
  15191. pp$1.parseBlock = function (allowDirectives) {
  15192. var node = this.startNode();
  15193. this.expect(types.braceL);
  15194. this.parseBlockBody(node, allowDirectives, false, types.braceR);
  15195. return this.finishNode(node, "BlockStatement");
  15196. };
  15197. pp$1.isValidDirective = function (stmt) {
  15198. return stmt.type === "ExpressionStatement" && stmt.expression.type === "StringLiteral" && !stmt.expression.extra.parenthesized;
  15199. };
  15200. pp$1.parseBlockBody = function (node, allowDirectives, topLevel, end) {
  15201. node.body = [];
  15202. node.directives = [];
  15203. var parsedNonDirective = false;
  15204. var oldStrict = void 0;
  15205. var octalPosition = void 0;
  15206. while (!this.eat(end)) {
  15207. if (!parsedNonDirective && this.state.containsOctal && !octalPosition) {
  15208. octalPosition = this.state.octalPosition;
  15209. }
  15210. var stmt = this.parseStatement(true, topLevel);
  15211. if (allowDirectives && !parsedNonDirective && this.isValidDirective(stmt)) {
  15212. var directive = this.stmtToDirective(stmt);
  15213. node.directives.push(directive);
  15214. if (oldStrict === undefined && directive.value.value === "use strict") {
  15215. oldStrict = this.state.strict;
  15216. this.setStrict(true);
  15217. if (octalPosition) {
  15218. this.raise(octalPosition, "Octal literal in strict mode");
  15219. }
  15220. }
  15221. continue;
  15222. }
  15223. parsedNonDirective = true;
  15224. node.body.push(stmt);
  15225. }
  15226. if (oldStrict === false) {
  15227. this.setStrict(false);
  15228. }
  15229. };
  15230. // Parse a regular `for` loop. The disambiguation code in
  15231. // `parseStatement` will already have parsed the init statement or
  15232. // expression.
  15233. pp$1.parseFor = function (node, init) {
  15234. node.init = init;
  15235. this.expect(types.semi);
  15236. node.test = this.match(types.semi) ? null : this.parseExpression();
  15237. this.expect(types.semi);
  15238. node.update = this.match(types.parenR) ? null : this.parseExpression();
  15239. this.expect(types.parenR);
  15240. node.body = this.parseStatement(false);
  15241. this.state.labels.pop();
  15242. return this.finishNode(node, "ForStatement");
  15243. };
  15244. // Parse a `for`/`in` and `for`/`of` loop, which are almost
  15245. // same from parser's perspective.
  15246. pp$1.parseForIn = function (node, init, forAwait) {
  15247. var type = void 0;
  15248. if (forAwait) {
  15249. this.eatContextual("of");
  15250. type = "ForAwaitStatement";
  15251. } else {
  15252. type = this.match(types._in) ? "ForInStatement" : "ForOfStatement";
  15253. this.next();
  15254. }
  15255. node.left = init;
  15256. node.right = this.parseExpression();
  15257. this.expect(types.parenR);
  15258. node.body = this.parseStatement(false);
  15259. this.state.labels.pop();
  15260. return this.finishNode(node, type);
  15261. };
  15262. // Parse a list of variable declarations.
  15263. pp$1.parseVar = function (node, isFor, kind) {
  15264. node.declarations = [];
  15265. node.kind = kind.keyword;
  15266. for (;;) {
  15267. var decl = this.startNode();
  15268. this.parseVarHead(decl);
  15269. if (this.eat(types.eq)) {
  15270. decl.init = this.parseMaybeAssign(isFor);
  15271. } else if (kind === types._const && !(this.match(types._in) || this.isContextual("of"))) {
  15272. this.unexpected();
  15273. } else if (decl.id.type !== "Identifier" && !(isFor && (this.match(types._in) || this.isContextual("of")))) {
  15274. this.raise(this.state.lastTokEnd, "Complex binding patterns require an initialization value");
  15275. } else {
  15276. decl.init = null;
  15277. }
  15278. node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
  15279. if (!this.eat(types.comma)) break;
  15280. }
  15281. return node;
  15282. };
  15283. pp$1.parseVarHead = function (decl) {
  15284. decl.id = this.parseBindingAtom();
  15285. this.checkLVal(decl.id, true, undefined, "variable declaration");
  15286. };
  15287. // Parse a function declaration or literal (depending on the
  15288. // `isStatement` parameter).
  15289. pp$1.parseFunction = function (node, isStatement, allowExpressionBody, isAsync, optionalId) {
  15290. var oldInMethod = this.state.inMethod;
  15291. this.state.inMethod = false;
  15292. this.initFunction(node, isAsync);
  15293. if (this.match(types.star)) {
  15294. if (node.async && !this.hasPlugin("asyncGenerators")) {
  15295. this.unexpected();
  15296. } else {
  15297. node.generator = true;
  15298. this.next();
  15299. }
  15300. }
  15301. if (isStatement && !optionalId && !this.match(types.name) && !this.match(types._yield)) {
  15302. this.unexpected();
  15303. }
  15304. if (this.match(types.name) || this.match(types._yield)) {
  15305. node.id = this.parseBindingIdentifier();
  15306. }
  15307. this.parseFunctionParams(node);
  15308. this.parseFunctionBody(node, allowExpressionBody);
  15309. this.state.inMethod = oldInMethod;
  15310. return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression");
  15311. };
  15312. pp$1.parseFunctionParams = function (node) {
  15313. this.expect(types.parenL);
  15314. node.params = this.parseBindingList(types.parenR);
  15315. };
  15316. // Parse a class declaration or literal (depending on the
  15317. // `isStatement` parameter).
  15318. pp$1.parseClass = function (node, isStatement, optionalId) {
  15319. this.next();
  15320. this.takeDecorators(node);
  15321. this.parseClassId(node, isStatement, optionalId);
  15322. this.parseClassSuper(node);
  15323. this.parseClassBody(node);
  15324. return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression");
  15325. };
  15326. pp$1.isClassProperty = function () {
  15327. return this.match(types.eq) || this.isLineTerminator();
  15328. };
  15329. pp$1.isClassMutatorStarter = function () {
  15330. return false;
  15331. };
  15332. pp$1.parseClassBody = function (node) {
  15333. // class bodies are implicitly strict
  15334. var oldStrict = this.state.strict;
  15335. this.state.strict = true;
  15336. var hadConstructorCall = false;
  15337. var hadConstructor = false;
  15338. var decorators = [];
  15339. var classBody = this.startNode();
  15340. classBody.body = [];
  15341. this.expect(types.braceL);
  15342. while (!this.eat(types.braceR)) {
  15343. if (this.eat(types.semi)) {
  15344. if (decorators.length > 0) {
  15345. this.raise(this.state.lastTokEnd, "Decorators must not be followed by a semicolon");
  15346. }
  15347. continue;
  15348. }
  15349. if (this.match(types.at)) {
  15350. decorators.push(this.parseDecorator());
  15351. continue;
  15352. }
  15353. var method = this.startNode();
  15354. // steal the decorators if there are any
  15355. if (decorators.length) {
  15356. method.decorators = decorators;
  15357. decorators = [];
  15358. }
  15359. var isConstructorCall = false;
  15360. var isMaybeStatic = this.match(types.name) && this.state.value === "static";
  15361. var isGenerator = this.eat(types.star);
  15362. var isGetSet = false;
  15363. var isAsync = false;
  15364. this.parsePropertyName(method);
  15365. method.static = isMaybeStatic && !this.match(types.parenL);
  15366. if (method.static) {
  15367. isGenerator = this.eat(types.star);
  15368. this.parsePropertyName(method);
  15369. }
  15370. if (!isGenerator) {
  15371. if (this.isClassProperty()) {
  15372. classBody.body.push(this.parseClassProperty(method));
  15373. continue;
  15374. }
  15375. if (method.key.type === "Identifier" && !method.computed && this.hasPlugin("classConstructorCall") && method.key.name === "call" && this.match(types.name) && this.state.value === "constructor") {
  15376. isConstructorCall = true;
  15377. this.parsePropertyName(method);
  15378. }
  15379. }
  15380. var isAsyncMethod = !this.match(types.parenL) && !method.computed && method.key.type === "Identifier" && method.key.name === "async";
  15381. if (isAsyncMethod) {
  15382. if (this.hasPlugin("asyncGenerators") && this.eat(types.star)) isGenerator = true;
  15383. isAsync = true;
  15384. this.parsePropertyName(method);
  15385. }
  15386. method.kind = "method";
  15387. if (!method.computed) {
  15388. var key = method.key;
  15389. // handle get/set methods
  15390. // eg. class Foo { get bar() {} set bar() {} }
  15391. if (!isAsync && !isGenerator && !this.isClassMutatorStarter() && key.type === "Identifier" && !this.match(types.parenL) && (key.name === "get" || key.name === "set")) {
  15392. isGetSet = true;
  15393. method.kind = key.name;
  15394. key = this.parsePropertyName(method);
  15395. }
  15396. // disallow invalid constructors
  15397. var isConstructor = !isConstructorCall && !method.static && (key.name === "constructor" || // Identifier
  15398. key.value === "constructor" // Literal
  15399. );
  15400. if (isConstructor) {
  15401. if (hadConstructor) this.raise(key.start, "Duplicate constructor in the same class");
  15402. if (isGetSet) this.raise(key.start, "Constructor can't have get/set modifier");
  15403. if (isGenerator) this.raise(key.start, "Constructor can't be a generator");
  15404. if (isAsync) this.raise(key.start, "Constructor can't be an async function");
  15405. method.kind = "constructor";
  15406. hadConstructor = true;
  15407. }
  15408. // disallow static prototype method
  15409. var isStaticPrototype = method.static && (key.name === "prototype" || // Identifier
  15410. key.value === "prototype" // Literal
  15411. );
  15412. if (isStaticPrototype) {
  15413. this.raise(key.start, "Classes may not have static property named prototype");
  15414. }
  15415. }
  15416. // convert constructor to a constructor call
  15417. if (isConstructorCall) {
  15418. if (hadConstructorCall) this.raise(method.start, "Duplicate constructor call in the same class");
  15419. method.kind = "constructorCall";
  15420. hadConstructorCall = true;
  15421. }
  15422. // disallow decorators on class constructors
  15423. if ((method.kind === "constructor" || method.kind === "constructorCall") && method.decorators) {
  15424. this.raise(method.start, "You can't attach decorators to a class constructor");
  15425. }
  15426. this.parseClassMethod(classBody, method, isGenerator, isAsync);
  15427. if (isGetSet) {
  15428. this.checkGetterSetterParamCount(method);
  15429. }
  15430. }
  15431. if (decorators.length) {
  15432. this.raise(this.state.start, "You have trailing decorators with no method");
  15433. }
  15434. node.body = this.finishNode(classBody, "ClassBody");
  15435. this.state.strict = oldStrict;
  15436. };
  15437. pp$1.parseClassProperty = function (node) {
  15438. if (this.match(types.eq)) {
  15439. if (!this.hasPlugin("classProperties")) this.unexpected();
  15440. this.next();
  15441. node.value = this.parseMaybeAssign();
  15442. } else {
  15443. node.value = null;
  15444. }
  15445. this.semicolon();
  15446. return this.finishNode(node, "ClassProperty");
  15447. };
  15448. pp$1.parseClassMethod = function (classBody, method, isGenerator, isAsync) {
  15449. this.parseMethod(method, isGenerator, isAsync);
  15450. classBody.body.push(this.finishNode(method, "ClassMethod"));
  15451. };
  15452. pp$1.parseClassId = function (node, isStatement, optionalId) {
  15453. if (this.match(types.name)) {
  15454. node.id = this.parseIdentifier();
  15455. } else {
  15456. if (optionalId || !isStatement) {
  15457. node.id = null;
  15458. } else {
  15459. this.unexpected();
  15460. }
  15461. }
  15462. };
  15463. pp$1.parseClassSuper = function (node) {
  15464. node.superClass = this.eat(types._extends) ? this.parseExprSubscripts() : null;
  15465. };
  15466. // Parses module export declaration.
  15467. pp$1.parseExport = function (node) {
  15468. this.next();
  15469. // export * from '...'
  15470. if (this.match(types.star)) {
  15471. var specifier = this.startNode();
  15472. this.next();
  15473. if (this.hasPlugin("exportExtensions") && this.eatContextual("as")) {
  15474. specifier.exported = this.parseIdentifier();
  15475. node.specifiers = [this.finishNode(specifier, "ExportNamespaceSpecifier")];
  15476. this.parseExportSpecifiersMaybe(node);
  15477. this.parseExportFrom(node, true);
  15478. } else {
  15479. this.parseExportFrom(node, true);
  15480. return this.finishNode(node, "ExportAllDeclaration");
  15481. }
  15482. } else if (this.hasPlugin("exportExtensions") && this.isExportDefaultSpecifier()) {
  15483. var _specifier = this.startNode();
  15484. _specifier.exported = this.parseIdentifier(true);
  15485. node.specifiers = [this.finishNode(_specifier, "ExportDefaultSpecifier")];
  15486. if (this.match(types.comma) && this.lookahead().type === types.star) {
  15487. this.expect(types.comma);
  15488. var _specifier2 = this.startNode();
  15489. this.expect(types.star);
  15490. this.expectContextual("as");
  15491. _specifier2.exported = this.parseIdentifier();
  15492. node.specifiers.push(this.finishNode(_specifier2, "ExportNamespaceSpecifier"));
  15493. } else {
  15494. this.parseExportSpecifiersMaybe(node);
  15495. }
  15496. this.parseExportFrom(node, true);
  15497. } else if (this.eat(types._default)) {
  15498. // export default ...
  15499. var expr = this.startNode();
  15500. var needsSemi = false;
  15501. if (this.eat(types._function)) {
  15502. expr = this.parseFunction(expr, true, false, false, true);
  15503. } else if (this.match(types._class)) {
  15504. expr = this.parseClass(expr, true, true);
  15505. } else {
  15506. needsSemi = true;
  15507. expr = this.parseMaybeAssign();
  15508. }
  15509. node.declaration = expr;
  15510. if (needsSemi) this.semicolon();
  15511. this.checkExport(node, true, true);
  15512. return this.finishNode(node, "ExportDefaultDeclaration");
  15513. } else if (this.shouldParseExportDeclaration()) {
  15514. node.specifiers = [];
  15515. node.source = null;
  15516. node.declaration = this.parseExportDeclaration(node);
  15517. } else {
  15518. // export { x, y as z } [from '...']
  15519. node.declaration = null;
  15520. node.specifiers = this.parseExportSpecifiers();
  15521. this.parseExportFrom(node);
  15522. }
  15523. this.checkExport(node, true);
  15524. return this.finishNode(node, "ExportNamedDeclaration");
  15525. };
  15526. pp$1.parseExportDeclaration = function () {
  15527. return this.parseStatement(true);
  15528. };
  15529. pp$1.isExportDefaultSpecifier = function () {
  15530. if (this.match(types.name)) {
  15531. return this.state.value !== "type" && this.state.value !== "async" && this.state.value !== "interface";
  15532. }
  15533. if (!this.match(types._default)) {
  15534. return false;
  15535. }
  15536. var lookahead = this.lookahead();
  15537. return lookahead.type === types.comma || lookahead.type === types.name && lookahead.value === "from";
  15538. };
  15539. pp$1.parseExportSpecifiersMaybe = function (node) {
  15540. if (this.eat(types.comma)) {
  15541. node.specifiers = node.specifiers.concat(this.parseExportSpecifiers());
  15542. }
  15543. };
  15544. pp$1.parseExportFrom = function (node, expect) {
  15545. if (this.eatContextual("from")) {
  15546. node.source = this.match(types.string) ? this.parseExprAtom() : this.unexpected();
  15547. this.checkExport(node);
  15548. } else {
  15549. if (expect) {
  15550. this.unexpected();
  15551. } else {
  15552. node.source = null;
  15553. }
  15554. }
  15555. this.semicolon();
  15556. };
  15557. pp$1.shouldParseExportDeclaration = function () {
  15558. return this.state.type.keyword === "var" || this.state.type.keyword === "const" || this.state.type.keyword === "let" || this.state.type.keyword === "function" || this.state.type.keyword === "class" || this.isContextual("async");
  15559. };
  15560. pp$1.checkExport = function (node, checkNames, isDefault) {
  15561. if (checkNames) {
  15562. // Check for duplicate exports
  15563. if (isDefault) {
  15564. // Default exports
  15565. this.checkDuplicateExports(node, "default");
  15566. } else if (node.specifiers && node.specifiers.length) {
  15567. // Named exports
  15568. for (var _iterator2 = node.specifiers, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
  15569. var _ref2;
  15570. if (_isArray2) {
  15571. if (_i2 >= _iterator2.length) break;
  15572. _ref2 = _iterator2[_i2++];
  15573. } else {
  15574. _i2 = _iterator2.next();
  15575. if (_i2.done) break;
  15576. _ref2 = _i2.value;
  15577. }
  15578. var specifier = _ref2;
  15579. this.checkDuplicateExports(specifier, specifier.exported.name);
  15580. }
  15581. } else if (node.declaration) {
  15582. // Exported declarations
  15583. if (node.declaration.type === "FunctionDeclaration" || node.declaration.type === "ClassDeclaration") {
  15584. this.checkDuplicateExports(node, node.declaration.id.name);
  15585. } else if (node.declaration.type === "VariableDeclaration") {
  15586. for (var _iterator3 = node.declaration.declarations, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
  15587. var _ref3;
  15588. if (_isArray3) {
  15589. if (_i3 >= _iterator3.length) break;
  15590. _ref3 = _iterator3[_i3++];
  15591. } else {
  15592. _i3 = _iterator3.next();
  15593. if (_i3.done) break;
  15594. _ref3 = _i3.value;
  15595. }
  15596. var declaration = _ref3;
  15597. this.checkDeclaration(declaration.id);
  15598. }
  15599. }
  15600. }
  15601. }
  15602. if (this.state.decorators.length) {
  15603. var isClass = node.declaration && (node.declaration.type === "ClassDeclaration" || node.declaration.type === "ClassExpression");
  15604. if (!node.declaration || !isClass) {
  15605. this.raise(node.start, "You can only use decorators on an export when exporting a class");
  15606. }
  15607. this.takeDecorators(node.declaration);
  15608. }
  15609. };
  15610. pp$1.checkDeclaration = function (node) {
  15611. if (node.type === "ObjectPattern") {
  15612. for (var _iterator4 = node.properties, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) {
  15613. var _ref4;
  15614. if (_isArray4) {
  15615. if (_i4 >= _iterator4.length) break;
  15616. _ref4 = _iterator4[_i4++];
  15617. } else {
  15618. _i4 = _iterator4.next();
  15619. if (_i4.done) break;
  15620. _ref4 = _i4.value;
  15621. }
  15622. var prop = _ref4;
  15623. this.checkDeclaration(prop);
  15624. }
  15625. } else if (node.type === "ArrayPattern") {
  15626. for (var _iterator5 = node.elements, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) {
  15627. var _ref5;
  15628. if (_isArray5) {
  15629. if (_i5 >= _iterator5.length) break;
  15630. _ref5 = _iterator5[_i5++];
  15631. } else {
  15632. _i5 = _iterator5.next();
  15633. if (_i5.done) break;
  15634. _ref5 = _i5.value;
  15635. }
  15636. var elem = _ref5;
  15637. if (elem) {
  15638. this.checkDeclaration(elem);
  15639. }
  15640. }
  15641. } else if (node.type === "ObjectProperty") {
  15642. this.checkDeclaration(node.value);
  15643. } else if (node.type === "RestElement" || node.type === "RestProperty") {
  15644. this.checkDeclaration(node.argument);
  15645. } else if (node.type === "Identifier") {
  15646. this.checkDuplicateExports(node, node.name);
  15647. }
  15648. };
  15649. pp$1.checkDuplicateExports = function (node, name) {
  15650. if (this.state.exportedIdentifiers.indexOf(name) > -1) {
  15651. this.raiseDuplicateExportError(node, name);
  15652. }
  15653. this.state.exportedIdentifiers.push(name);
  15654. };
  15655. pp$1.raiseDuplicateExportError = function (node, name) {
  15656. this.raise(node.start, name === "default" ? "Only one default export allowed per module." : "`" + name + "` has already been exported. Exported identifiers must be unique.");
  15657. };
  15658. // Parses a comma-separated list of module exports.
  15659. pp$1.parseExportSpecifiers = function () {
  15660. var nodes = [];
  15661. var first = true;
  15662. var needsFrom = void 0;
  15663. // export { x, y as z } [from '...']
  15664. this.expect(types.braceL);
  15665. while (!this.eat(types.braceR)) {
  15666. if (first) {
  15667. first = false;
  15668. } else {
  15669. this.expect(types.comma);
  15670. if (this.eat(types.braceR)) break;
  15671. }
  15672. var isDefault = this.match(types._default);
  15673. if (isDefault && !needsFrom) needsFrom = true;
  15674. var node = this.startNode();
  15675. node.local = this.parseIdentifier(isDefault);
  15676. node.exported = this.eatContextual("as") ? this.parseIdentifier(true) : node.local.__clone();
  15677. nodes.push(this.finishNode(node, "ExportSpecifier"));
  15678. }
  15679. // https://github.com/ember-cli/ember-cli/pull/3739
  15680. if (needsFrom && !this.isContextual("from")) {
  15681. this.unexpected();
  15682. }
  15683. return nodes;
  15684. };
  15685. // Parses import declaration.
  15686. pp$1.parseImport = function (node) {
  15687. this.eat(types._import);
  15688. // import '...'
  15689. if (this.match(types.string)) {
  15690. node.specifiers = [];
  15691. node.source = this.parseExprAtom();
  15692. } else {
  15693. node.specifiers = [];
  15694. this.parseImportSpecifiers(node);
  15695. this.expectContextual("from");
  15696. node.source = this.match(types.string) ? this.parseExprAtom() : this.unexpected();
  15697. }
  15698. this.semicolon();
  15699. return this.finishNode(node, "ImportDeclaration");
  15700. };
  15701. // Parses a comma-separated list of module imports.
  15702. pp$1.parseImportSpecifiers = function (node) {
  15703. var first = true;
  15704. if (this.match(types.name)) {
  15705. // import defaultObj, { x, y as z } from '...'
  15706. var startPos = this.state.start;
  15707. var startLoc = this.state.startLoc;
  15708. node.specifiers.push(this.parseImportSpecifierDefault(this.parseIdentifier(), startPos, startLoc));
  15709. if (!this.eat(types.comma)) return;
  15710. }
  15711. if (this.match(types.star)) {
  15712. var specifier = this.startNode();
  15713. this.next();
  15714. this.expectContextual("as");
  15715. specifier.local = this.parseIdentifier();
  15716. this.checkLVal(specifier.local, true, undefined, "import namespace specifier");
  15717. node.specifiers.push(this.finishNode(specifier, "ImportNamespaceSpecifier"));
  15718. return;
  15719. }
  15720. this.expect(types.braceL);
  15721. while (!this.eat(types.braceR)) {
  15722. if (first) {
  15723. first = false;
  15724. } else {
  15725. // Detect an attempt to deep destructure
  15726. if (this.eat(types.colon)) {
  15727. this.unexpected(null, "ES2015 named imports do not destructure. Use another statement for destructuring after the import.");
  15728. }
  15729. this.expect(types.comma);
  15730. if (this.eat(types.braceR)) break;
  15731. }
  15732. this.parseImportSpecifier(node);
  15733. }
  15734. };
  15735. pp$1.parseImportSpecifier = function (node) {
  15736. var specifier = this.startNode();
  15737. specifier.imported = this.parseIdentifier(true);
  15738. if (this.eatContextual("as")) {
  15739. specifier.local = this.parseIdentifier();
  15740. } else {
  15741. this.checkReservedWord(specifier.imported.name, specifier.start, true, true);
  15742. specifier.local = specifier.imported.__clone();
  15743. }
  15744. this.checkLVal(specifier.local, true, undefined, "import specifier");
  15745. node.specifiers.push(this.finishNode(specifier, "ImportSpecifier"));
  15746. };
  15747. pp$1.parseImportSpecifierDefault = function (id, startPos, startLoc) {
  15748. var node = this.startNodeAt(startPos, startLoc);
  15749. node.local = id;
  15750. this.checkLVal(node.local, true, undefined, "default import specifier");
  15751. return this.finishNode(node, "ImportDefaultSpecifier");
  15752. };
  15753. var pp$2 = Parser.prototype;
  15754. // Convert existing expression atom to assignable pattern
  15755. // if possible.
  15756. pp$2.toAssignable = function (node, isBinding, contextDescription) {
  15757. if (node) {
  15758. switch (node.type) {
  15759. case "Identifier":
  15760. case "ObjectPattern":
  15761. case "ArrayPattern":
  15762. case "AssignmentPattern":
  15763. break;
  15764. case "ObjectExpression":
  15765. node.type = "ObjectPattern";
  15766. for (var _iterator = node.properties, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
  15767. var _ref;
  15768. if (_isArray) {
  15769. if (_i >= _iterator.length) break;
  15770. _ref = _iterator[_i++];
  15771. } else {
  15772. _i = _iterator.next();
  15773. if (_i.done) break;
  15774. _ref = _i.value;
  15775. }
  15776. var prop = _ref;
  15777. if (prop.type === "ObjectMethod") {
  15778. if (prop.kind === "get" || prop.kind === "set") {
  15779. this.raise(prop.key.start, "Object pattern can't contain getter or setter");
  15780. } else {
  15781. this.raise(prop.key.start, "Object pattern can't contain methods");
  15782. }
  15783. } else {
  15784. this.toAssignable(prop, isBinding, "object destructuring pattern");
  15785. }
  15786. }
  15787. break;
  15788. case "ObjectProperty":
  15789. this.toAssignable(node.value, isBinding, contextDescription);
  15790. break;
  15791. case "SpreadProperty":
  15792. node.type = "RestProperty";
  15793. break;
  15794. case "ArrayExpression":
  15795. node.type = "ArrayPattern";
  15796. this.toAssignableList(node.elements, isBinding, contextDescription);
  15797. break;
  15798. case "AssignmentExpression":
  15799. if (node.operator === "=") {
  15800. node.type = "AssignmentPattern";
  15801. delete node.operator;
  15802. } else {
  15803. this.raise(node.left.end, "Only '=' operator can be used for specifying default value.");
  15804. }
  15805. break;
  15806. case "MemberExpression":
  15807. if (!isBinding) break;
  15808. default:
  15809. {
  15810. var message = "Invalid left-hand side" + (contextDescription ? " in " + contextDescription : /* istanbul ignore next */"expression");
  15811. this.raise(node.start, message);
  15812. }
  15813. }
  15814. }
  15815. return node;
  15816. };
  15817. // Convert list of expression atoms to binding list.
  15818. pp$2.toAssignableList = function (exprList, isBinding, contextDescription) {
  15819. var end = exprList.length;
  15820. if (end) {
  15821. var last = exprList[end - 1];
  15822. if (last && last.type === "RestElement") {
  15823. --end;
  15824. } else if (last && last.type === "SpreadElement") {
  15825. last.type = "RestElement";
  15826. var arg = last.argument;
  15827. this.toAssignable(arg, isBinding, contextDescription);
  15828. if (arg.type !== "Identifier" && arg.type !== "MemberExpression" && arg.type !== "ArrayPattern") {
  15829. this.unexpected(arg.start);
  15830. }
  15831. --end;
  15832. }
  15833. }
  15834. for (var i = 0; i < end; i++) {
  15835. var elt = exprList[i];
  15836. if (elt) this.toAssignable(elt, isBinding, contextDescription);
  15837. }
  15838. return exprList;
  15839. };
  15840. // Convert list of expression atoms to a list of
  15841. pp$2.toReferencedList = function (exprList) {
  15842. return exprList;
  15843. };
  15844. // Parses spread element.
  15845. pp$2.parseSpread = function (refShorthandDefaultPos) {
  15846. var node = this.startNode();
  15847. this.next();
  15848. node.argument = this.parseMaybeAssign(false, refShorthandDefaultPos);
  15849. return this.finishNode(node, "SpreadElement");
  15850. };
  15851. pp$2.parseRest = function () {
  15852. var node = this.startNode();
  15853. this.next();
  15854. node.argument = this.parseBindingIdentifier();
  15855. return this.finishNode(node, "RestElement");
  15856. };
  15857. pp$2.shouldAllowYieldIdentifier = function () {
  15858. return this.match(types._yield) && !this.state.strict && !this.state.inGenerator;
  15859. };
  15860. pp$2.parseBindingIdentifier = function () {
  15861. return this.parseIdentifier(this.shouldAllowYieldIdentifier());
  15862. };
  15863. // Parses lvalue (assignable) atom.
  15864. pp$2.parseBindingAtom = function () {
  15865. switch (this.state.type) {
  15866. case types._yield:
  15867. if (this.state.strict || this.state.inGenerator) this.unexpected();
  15868. // fall-through
  15869. case types.name:
  15870. return this.parseIdentifier(true);
  15871. case types.bracketL:
  15872. var node = this.startNode();
  15873. this.next();
  15874. node.elements = this.parseBindingList(types.bracketR, true);
  15875. return this.finishNode(node, "ArrayPattern");
  15876. case types.braceL:
  15877. return this.parseObj(true);
  15878. default:
  15879. this.unexpected();
  15880. }
  15881. };
  15882. pp$2.parseBindingList = function (close, allowEmpty) {
  15883. var elts = [];
  15884. var first = true;
  15885. while (!this.eat(close)) {
  15886. if (first) {
  15887. first = false;
  15888. } else {
  15889. this.expect(types.comma);
  15890. }
  15891. if (allowEmpty && this.match(types.comma)) {
  15892. elts.push(null);
  15893. } else if (this.eat(close)) {
  15894. break;
  15895. } else if (this.match(types.ellipsis)) {
  15896. elts.push(this.parseAssignableListItemTypes(this.parseRest()));
  15897. this.expect(close);
  15898. break;
  15899. } else {
  15900. var decorators = [];
  15901. while (this.match(types.at)) {
  15902. decorators.push(this.parseDecorator());
  15903. }
  15904. var left = this.parseMaybeDefault();
  15905. if (decorators.length) {
  15906. left.decorators = decorators;
  15907. }
  15908. this.parseAssignableListItemTypes(left);
  15909. elts.push(this.parseMaybeDefault(left.start, left.loc.start, left));
  15910. }
  15911. }
  15912. return elts;
  15913. };
  15914. pp$2.parseAssignableListItemTypes = function (param) {
  15915. return param;
  15916. };
  15917. // Parses assignment pattern around given atom if possible.
  15918. pp$2.parseMaybeDefault = function (startPos, startLoc, left) {
  15919. startLoc = startLoc || this.state.startLoc;
  15920. startPos = startPos || this.state.start;
  15921. left = left || this.parseBindingAtom();
  15922. if (!this.eat(types.eq)) return left;
  15923. var node = this.startNodeAt(startPos, startLoc);
  15924. node.left = left;
  15925. node.right = this.parseMaybeAssign();
  15926. return this.finishNode(node, "AssignmentPattern");
  15927. };
  15928. // Verify that a node is an lval — something that can be assigned
  15929. // to.
  15930. pp$2.checkLVal = function (expr, isBinding, checkClashes, contextDescription) {
  15931. switch (expr.type) {
  15932. case "Identifier":
  15933. this.checkReservedWord(expr.name, expr.start, false, true);
  15934. if (checkClashes) {
  15935. // we need to prefix this with an underscore for the cases where we have a key of
  15936. // `__proto__`. there's a bug in old V8 where the following wouldn't work:
  15937. //
  15938. // > var obj = Object.create(null);
  15939. // undefined
  15940. // > obj.__proto__
  15941. // null
  15942. // > obj.__proto__ = true;
  15943. // true
  15944. // > obj.__proto__
  15945. // null
  15946. var key = "_" + expr.name;
  15947. if (checkClashes[key]) {
  15948. this.raise(expr.start, "Argument name clash in strict mode");
  15949. } else {
  15950. checkClashes[key] = true;
  15951. }
  15952. }
  15953. break;
  15954. case "MemberExpression":
  15955. if (isBinding) this.raise(expr.start, (isBinding ? "Binding" : "Assigning to") + " member expression");
  15956. break;
  15957. case "ObjectPattern":
  15958. for (var _iterator2 = expr.properties, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
  15959. var _ref2;
  15960. if (_isArray2) {
  15961. if (_i2 >= _iterator2.length) break;
  15962. _ref2 = _iterator2[_i2++];
  15963. } else {
  15964. _i2 = _iterator2.next();
  15965. if (_i2.done) break;
  15966. _ref2 = _i2.value;
  15967. }
  15968. var prop = _ref2;
  15969. if (prop.type === "ObjectProperty") prop = prop.value;
  15970. this.checkLVal(prop, isBinding, checkClashes, "object destructuring pattern");
  15971. }
  15972. break;
  15973. case "ArrayPattern":
  15974. for (var _iterator3 = expr.elements, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
  15975. var _ref3;
  15976. if (_isArray3) {
  15977. if (_i3 >= _iterator3.length) break;
  15978. _ref3 = _iterator3[_i3++];
  15979. } else {
  15980. _i3 = _iterator3.next();
  15981. if (_i3.done) break;
  15982. _ref3 = _i3.value;
  15983. }
  15984. var elem = _ref3;
  15985. if (elem) this.checkLVal(elem, isBinding, checkClashes, "array destructuring pattern");
  15986. }
  15987. break;
  15988. case "AssignmentPattern":
  15989. this.checkLVal(expr.left, isBinding, checkClashes, "assignment pattern");
  15990. break;
  15991. case "RestProperty":
  15992. this.checkLVal(expr.argument, isBinding, checkClashes, "rest property");
  15993. break;
  15994. case "RestElement":
  15995. this.checkLVal(expr.argument, isBinding, checkClashes, "rest element");
  15996. break;
  15997. default:
  15998. {
  15999. var message = (isBinding ? /* istanbul ignore next */"Binding invalid" : "Invalid") + " left-hand side" + (contextDescription ? " in " + contextDescription : /* istanbul ignore next */"expression");
  16000. this.raise(expr.start, message);
  16001. }
  16002. }
  16003. };
  16004. /* eslint max-len: 0 */
  16005. // A recursive descent parser operates by defining functions for all
  16006. // syntactic elements, and recursively calling those, each function
  16007. // advancing the input stream and returning an AST node. Precedence
  16008. // of constructs (for example, the fact that `!x[1]` means `!(x[1])`
  16009. // instead of `(!x)[1]` is handled by the fact that the parser
  16010. // function that parses unary prefix operators is called first, and
  16011. // in turn calls the function that parses `[]` subscripts — that
  16012. // way, it'll receive the node for `x[1]` already parsed, and wraps
  16013. // *that* in the unary operator node.
  16014. //
  16015. // Acorn uses an [operator precedence parser][opp] to handle binary
  16016. // operator precedence, because it is much more compact than using
  16017. // the technique outlined above, which uses different, nesting
  16018. // functions to specify precedence, for all of the ten binary
  16019. // precedence levels that JavaScript defines.
  16020. //
  16021. // [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser
  16022. var pp$3 = Parser.prototype;
  16023. // Check if property name clashes with already added.
  16024. // Object/class getters and setters are not allowed to clash —
  16025. // either with each other or with an init property — and in
  16026. // strict mode, init properties are also not allowed to be repeated.
  16027. pp$3.checkPropClash = function (prop, propHash) {
  16028. if (prop.computed || prop.kind) return;
  16029. var key = prop.key;
  16030. // It is either an Identifier or a String/NumericLiteral
  16031. var name = key.type === "Identifier" ? key.name : String(key.value);
  16032. if (name === "__proto__") {
  16033. if (propHash.proto) this.raise(key.start, "Redefinition of __proto__ property");
  16034. propHash.proto = true;
  16035. }
  16036. };
  16037. // Convenience method to parse an Expression only
  16038. pp$3.getExpression = function () {
  16039. this.nextToken();
  16040. var expr = this.parseExpression();
  16041. if (!this.match(types.eof)) {
  16042. this.unexpected();
  16043. }
  16044. return expr;
  16045. };
  16046. // ### Expression parsing
  16047. // These nest, from the most general expression type at the top to
  16048. // 'atomic', nondivisible expression types at the bottom. Most of
  16049. // the functions will simply let the function (s) below them parse,
  16050. // and, *if* the syntactic construct they handle is present, wrap
  16051. // the AST node that the inner parser gave them in another node.
  16052. // Parse a full expression. The optional arguments are used to
  16053. // forbid the `in` operator (in for loops initalization expressions)
  16054. // and provide reference for storing '=' operator inside shorthand
  16055. // property assignment in contexts where both object expression
  16056. // and object pattern might appear (so it's possible to raise
  16057. // delayed syntax error at correct position).
  16058. pp$3.parseExpression = function (noIn, refShorthandDefaultPos) {
  16059. var startPos = this.state.start;
  16060. var startLoc = this.state.startLoc;
  16061. var expr = this.parseMaybeAssign(noIn, refShorthandDefaultPos);
  16062. if (this.match(types.comma)) {
  16063. var node = this.startNodeAt(startPos, startLoc);
  16064. node.expressions = [expr];
  16065. while (this.eat(types.comma)) {
  16066. node.expressions.push(this.parseMaybeAssign(noIn, refShorthandDefaultPos));
  16067. }
  16068. this.toReferencedList(node.expressions);
  16069. return this.finishNode(node, "SequenceExpression");
  16070. }
  16071. return expr;
  16072. };
  16073. // Parse an assignment expression. This includes applications of
  16074. // operators like `+=`.
  16075. pp$3.parseMaybeAssign = function (noIn, refShorthandDefaultPos, afterLeftParse, refNeedsArrowPos) {
  16076. var startPos = this.state.start;
  16077. var startLoc = this.state.startLoc;
  16078. if (this.match(types._yield) && this.state.inGenerator) {
  16079. var _left = this.parseYield();
  16080. if (afterLeftParse) _left = afterLeftParse.call(this, _left, startPos, startLoc);
  16081. return _left;
  16082. }
  16083. var failOnShorthandAssign = void 0;
  16084. if (refShorthandDefaultPos) {
  16085. failOnShorthandAssign = false;
  16086. } else {
  16087. refShorthandDefaultPos = { start: 0 };
  16088. failOnShorthandAssign = true;
  16089. }
  16090. if (this.match(types.parenL) || this.match(types.name)) {
  16091. this.state.potentialArrowAt = this.state.start;
  16092. }
  16093. var left = this.parseMaybeConditional(noIn, refShorthandDefaultPos, refNeedsArrowPos);
  16094. if (afterLeftParse) left = afterLeftParse.call(this, left, startPos, startLoc);
  16095. if (this.state.type.isAssign) {
  16096. var node = this.startNodeAt(startPos, startLoc);
  16097. node.operator = this.state.value;
  16098. node.left = this.match(types.eq) ? this.toAssignable(left, undefined, "assignment expression") : left;
  16099. refShorthandDefaultPos.start = 0; // reset because shorthand default was used correctly
  16100. this.checkLVal(left, undefined, undefined, "assignment expression");
  16101. if (left.extra && left.extra.parenthesized) {
  16102. var errorMsg = void 0;
  16103. if (left.type === "ObjectPattern") {
  16104. errorMsg = "`({a}) = 0` use `({a} = 0)`";
  16105. } else if (left.type === "ArrayPattern") {
  16106. errorMsg = "`([a]) = 0` use `([a] = 0)`";
  16107. }
  16108. if (errorMsg) {
  16109. this.raise(left.start, "You're trying to assign to a parenthesized expression, eg. instead of " + errorMsg);
  16110. }
  16111. }
  16112. this.next();
  16113. node.right = this.parseMaybeAssign(noIn);
  16114. return this.finishNode(node, "AssignmentExpression");
  16115. } else if (failOnShorthandAssign && refShorthandDefaultPos.start) {
  16116. this.unexpected(refShorthandDefaultPos.start);
  16117. }
  16118. return left;
  16119. };
  16120. // Parse a ternary conditional (`?:`) operator.
  16121. pp$3.parseMaybeConditional = function (noIn, refShorthandDefaultPos, refNeedsArrowPos) {
  16122. var startPos = this.state.start;
  16123. var startLoc = this.state.startLoc;
  16124. var expr = this.parseExprOps(noIn, refShorthandDefaultPos);
  16125. if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr;
  16126. return this.parseConditional(expr, noIn, startPos, startLoc, refNeedsArrowPos);
  16127. };
  16128. pp$3.parseConditional = function (expr, noIn, startPos, startLoc) {
  16129. if (this.eat(types.question)) {
  16130. var node = this.startNodeAt(startPos, startLoc);
  16131. node.test = expr;
  16132. node.consequent = this.parseMaybeAssign();
  16133. this.expect(types.colon);
  16134. node.alternate = this.parseMaybeAssign(noIn);
  16135. return this.finishNode(node, "ConditionalExpression");
  16136. }
  16137. return expr;
  16138. };
  16139. // Start the precedence parser.
  16140. pp$3.parseExprOps = function (noIn, refShorthandDefaultPos) {
  16141. var startPos = this.state.start;
  16142. var startLoc = this.state.startLoc;
  16143. var expr = this.parseMaybeUnary(refShorthandDefaultPos);
  16144. if (refShorthandDefaultPos && refShorthandDefaultPos.start) {
  16145. return expr;
  16146. } else {
  16147. return this.parseExprOp(expr, startPos, startLoc, -1, noIn);
  16148. }
  16149. };
  16150. // Parse binary operators with the operator precedence parsing
  16151. // algorithm. `left` is the left-hand side of the operator.
  16152. // `minPrec` provides context that allows the function to stop and
  16153. // defer further parser to one of its callers when it encounters an
  16154. // operator that has a lower precedence than the set it is parsing.
  16155. pp$3.parseExprOp = function (left, leftStartPos, leftStartLoc, minPrec, noIn) {
  16156. var prec = this.state.type.binop;
  16157. if (prec != null && (!noIn || !this.match(types._in))) {
  16158. if (prec > minPrec) {
  16159. var node = this.startNodeAt(leftStartPos, leftStartLoc);
  16160. node.left = left;
  16161. node.operator = this.state.value;
  16162. if (node.operator === "**" && left.type === "UnaryExpression" && left.extra && !left.extra.parenthesizedArgument && !left.extra.parenthesized) {
  16163. this.raise(left.argument.start, "Illegal expression. Wrap left hand side or entire exponentiation in parentheses.");
  16164. }
  16165. var op = this.state.type;
  16166. this.next();
  16167. var startPos = this.state.start;
  16168. var startLoc = this.state.startLoc;
  16169. node.right = this.parseExprOp(this.parseMaybeUnary(), startPos, startLoc, op.rightAssociative ? prec - 1 : prec, noIn);
  16170. this.finishNode(node, op === types.logicalOR || op === types.logicalAND ? "LogicalExpression" : "BinaryExpression");
  16171. return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn);
  16172. }
  16173. }
  16174. return left;
  16175. };
  16176. // Parse unary operators, both prefix and postfix.
  16177. pp$3.parseMaybeUnary = function (refShorthandDefaultPos) {
  16178. if (this.state.type.prefix) {
  16179. var node = this.startNode();
  16180. var update = this.match(types.incDec);
  16181. node.operator = this.state.value;
  16182. node.prefix = true;
  16183. this.next();
  16184. var argType = this.state.type;
  16185. node.argument = this.parseMaybeUnary();
  16186. this.addExtra(node, "parenthesizedArgument", argType === types.parenL && (!node.argument.extra || !node.argument.extra.parenthesized));
  16187. if (refShorthandDefaultPos && refShorthandDefaultPos.start) {
  16188. this.unexpected(refShorthandDefaultPos.start);
  16189. }
  16190. if (update) {
  16191. this.checkLVal(node.argument, undefined, undefined, "prefix operation");
  16192. } else if (this.state.strict && node.operator === "delete" && node.argument.type === "Identifier") {
  16193. this.raise(node.start, "Deleting local variable in strict mode");
  16194. }
  16195. return this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
  16196. }
  16197. var startPos = this.state.start;
  16198. var startLoc = this.state.startLoc;
  16199. var expr = this.parseExprSubscripts(refShorthandDefaultPos);
  16200. if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr;
  16201. while (this.state.type.postfix && !this.canInsertSemicolon()) {
  16202. var _node = this.startNodeAt(startPos, startLoc);
  16203. _node.operator = this.state.value;
  16204. _node.prefix = false;
  16205. _node.argument = expr;
  16206. this.checkLVal(expr, undefined, undefined, "postfix operation");
  16207. this.next();
  16208. expr = this.finishNode(_node, "UpdateExpression");
  16209. }
  16210. return expr;
  16211. };
  16212. // Parse call, dot, and `[]`-subscript expressions.
  16213. pp$3.parseExprSubscripts = function (refShorthandDefaultPos) {
  16214. var startPos = this.state.start;
  16215. var startLoc = this.state.startLoc;
  16216. var potentialArrowAt = this.state.potentialArrowAt;
  16217. var expr = this.parseExprAtom(refShorthandDefaultPos);
  16218. if (expr.type === "ArrowFunctionExpression" && expr.start === potentialArrowAt) {
  16219. return expr;
  16220. }
  16221. if (refShorthandDefaultPos && refShorthandDefaultPos.start) {
  16222. return expr;
  16223. }
  16224. return this.parseSubscripts(expr, startPos, startLoc);
  16225. };
  16226. pp$3.parseSubscripts = function (base, startPos, startLoc, noCalls) {
  16227. for (;;) {
  16228. if (!noCalls && this.eat(types.doubleColon)) {
  16229. var node = this.startNodeAt(startPos, startLoc);
  16230. node.object = base;
  16231. node.callee = this.parseNoCallExpr();
  16232. return this.parseSubscripts(this.finishNode(node, "BindExpression"), startPos, startLoc, noCalls);
  16233. } else if (this.eat(types.dot)) {
  16234. var _node2 = this.startNodeAt(startPos, startLoc);
  16235. _node2.object = base;
  16236. _node2.property = this.parseIdentifier(true);
  16237. _node2.computed = false;
  16238. base = this.finishNode(_node2, "MemberExpression");
  16239. } else if (this.eat(types.bracketL)) {
  16240. var _node3 = this.startNodeAt(startPos, startLoc);
  16241. _node3.object = base;
  16242. _node3.property = this.parseExpression();
  16243. _node3.computed = true;
  16244. this.expect(types.bracketR);
  16245. base = this.finishNode(_node3, "MemberExpression");
  16246. } else if (!noCalls && this.match(types.parenL)) {
  16247. var possibleAsync = this.state.potentialArrowAt === base.start && base.type === "Identifier" && base.name === "async" && !this.canInsertSemicolon();
  16248. this.next();
  16249. var _node4 = this.startNodeAt(startPos, startLoc);
  16250. _node4.callee = base;
  16251. _node4.arguments = this.parseCallExpressionArguments(types.parenR, possibleAsync);
  16252. if (_node4.callee.type === "Import" && _node4.arguments.length !== 1) {
  16253. this.raise(_node4.start, "import() requires exactly one argument");
  16254. }
  16255. base = this.finishNode(_node4, "CallExpression");
  16256. if (possibleAsync && this.shouldParseAsyncArrow()) {
  16257. return this.parseAsyncArrowFromCallExpression(this.startNodeAt(startPos, startLoc), _node4);
  16258. } else {
  16259. this.toReferencedList(_node4.arguments);
  16260. }
  16261. } else if (this.match(types.backQuote)) {
  16262. var _node5 = this.startNodeAt(startPos, startLoc);
  16263. _node5.tag = base;
  16264. _node5.quasi = this.parseTemplate();
  16265. base = this.finishNode(_node5, "TaggedTemplateExpression");
  16266. } else {
  16267. return base;
  16268. }
  16269. }
  16270. };
  16271. pp$3.parseCallExpressionArguments = function (close, possibleAsyncArrow) {
  16272. var elts = [];
  16273. var innerParenStart = void 0;
  16274. var first = true;
  16275. while (!this.eat(close)) {
  16276. if (first) {
  16277. first = false;
  16278. } else {
  16279. this.expect(types.comma);
  16280. if (this.eat(close)) break;
  16281. }
  16282. // we need to make sure that if this is an async arrow functions, that we don't allow inner parens inside the params
  16283. if (this.match(types.parenL) && !innerParenStart) {
  16284. innerParenStart = this.state.start;
  16285. }
  16286. elts.push(this.parseExprListItem(false, possibleAsyncArrow ? { start: 0 } : undefined, possibleAsyncArrow ? { start: 0 } : undefined));
  16287. }
  16288. // we found an async arrow function so let's not allow any inner parens
  16289. if (possibleAsyncArrow && innerParenStart && this.shouldParseAsyncArrow()) {
  16290. this.unexpected();
  16291. }
  16292. return elts;
  16293. };
  16294. pp$3.shouldParseAsyncArrow = function () {
  16295. return this.match(types.arrow);
  16296. };
  16297. pp$3.parseAsyncArrowFromCallExpression = function (node, call) {
  16298. this.expect(types.arrow);
  16299. return this.parseArrowExpression(node, call.arguments, true);
  16300. };
  16301. // Parse a no-call expression (like argument of `new` or `::` operators).
  16302. pp$3.parseNoCallExpr = function () {
  16303. var startPos = this.state.start;
  16304. var startLoc = this.state.startLoc;
  16305. return this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true);
  16306. };
  16307. // Parse an atomic expression — either a single token that is an
  16308. // expression, an expression started by a keyword like `function` or
  16309. // `new`, or an expression wrapped in punctuation like `()`, `[]`,
  16310. // or `{}`.
  16311. pp$3.parseExprAtom = function (refShorthandDefaultPos) {
  16312. var canBeArrow = this.state.potentialArrowAt === this.state.start;
  16313. var node = void 0;
  16314. switch (this.state.type) {
  16315. case types._super:
  16316. if (!this.state.inMethod && !this.options.allowSuperOutsideMethod) {
  16317. this.raise(this.state.start, "'super' outside of function or class");
  16318. }
  16319. node = this.startNode();
  16320. this.next();
  16321. if (!this.match(types.parenL) && !this.match(types.bracketL) && !this.match(types.dot)) {
  16322. this.unexpected();
  16323. }
  16324. if (this.match(types.parenL) && this.state.inMethod !== "constructor" && !this.options.allowSuperOutsideMethod) {
  16325. this.raise(node.start, "super() outside of class constructor");
  16326. }
  16327. return this.finishNode(node, "Super");
  16328. case types._import:
  16329. if (!this.hasPlugin("dynamicImport")) this.unexpected();
  16330. node = this.startNode();
  16331. this.next();
  16332. if (!this.match(types.parenL)) {
  16333. this.unexpected(null, types.parenL);
  16334. }
  16335. return this.finishNode(node, "Import");
  16336. case types._this:
  16337. node = this.startNode();
  16338. this.next();
  16339. return this.finishNode(node, "ThisExpression");
  16340. case types._yield:
  16341. if (this.state.inGenerator) this.unexpected();
  16342. case types.name:
  16343. node = this.startNode();
  16344. var allowAwait = this.state.value === "await" && this.state.inAsync;
  16345. var allowYield = this.shouldAllowYieldIdentifier();
  16346. var id = this.parseIdentifier(allowAwait || allowYield);
  16347. if (id.name === "await") {
  16348. if (this.state.inAsync || this.inModule) {
  16349. return this.parseAwait(node);
  16350. }
  16351. } else if (id.name === "async" && this.match(types._function) && !this.canInsertSemicolon()) {
  16352. this.next();
  16353. return this.parseFunction(node, false, false, true);
  16354. } else if (canBeArrow && id.name === "async" && this.match(types.name)) {
  16355. var params = [this.parseIdentifier()];
  16356. this.expect(types.arrow);
  16357. // let foo = bar => {};
  16358. return this.parseArrowExpression(node, params, true);
  16359. }
  16360. if (canBeArrow && !this.canInsertSemicolon() && this.eat(types.arrow)) {
  16361. return this.parseArrowExpression(node, [id]);
  16362. }
  16363. return id;
  16364. case types._do:
  16365. if (this.hasPlugin("doExpressions")) {
  16366. var _node6 = this.startNode();
  16367. this.next();
  16368. var oldInFunction = this.state.inFunction;
  16369. var oldLabels = this.state.labels;
  16370. this.state.labels = [];
  16371. this.state.inFunction = false;
  16372. _node6.body = this.parseBlock(false, true);
  16373. this.state.inFunction = oldInFunction;
  16374. this.state.labels = oldLabels;
  16375. return this.finishNode(_node6, "DoExpression");
  16376. }
  16377. case types.regexp:
  16378. var value = this.state.value;
  16379. node = this.parseLiteral(value.value, "RegExpLiteral");
  16380. node.pattern = value.pattern;
  16381. node.flags = value.flags;
  16382. return node;
  16383. case types.num:
  16384. return this.parseLiteral(this.state.value, "NumericLiteral");
  16385. case types.string:
  16386. return this.parseLiteral(this.state.value, "StringLiteral");
  16387. case types._null:
  16388. node = this.startNode();
  16389. this.next();
  16390. return this.finishNode(node, "NullLiteral");
  16391. case types._true:case types._false:
  16392. node = this.startNode();
  16393. node.value = this.match(types._true);
  16394. this.next();
  16395. return this.finishNode(node, "BooleanLiteral");
  16396. case types.parenL:
  16397. return this.parseParenAndDistinguishExpression(null, null, canBeArrow);
  16398. case types.bracketL:
  16399. node = this.startNode();
  16400. this.next();
  16401. node.elements = this.parseExprList(types.bracketR, true, refShorthandDefaultPos);
  16402. this.toReferencedList(node.elements);
  16403. return this.finishNode(node, "ArrayExpression");
  16404. case types.braceL:
  16405. return this.parseObj(false, refShorthandDefaultPos);
  16406. case types._function:
  16407. return this.parseFunctionExpression();
  16408. case types.at:
  16409. this.parseDecorators();
  16410. case types._class:
  16411. node = this.startNode();
  16412. this.takeDecorators(node);
  16413. return this.parseClass(node, false);
  16414. case types._new:
  16415. return this.parseNew();
  16416. case types.backQuote:
  16417. return this.parseTemplate();
  16418. case types.doubleColon:
  16419. node = this.startNode();
  16420. this.next();
  16421. node.object = null;
  16422. var callee = node.callee = this.parseNoCallExpr();
  16423. if (callee.type === "MemberExpression") {
  16424. return this.finishNode(node, "BindExpression");
  16425. } else {
  16426. this.raise(callee.start, "Binding should be performed on object property.");
  16427. }
  16428. default:
  16429. this.unexpected();
  16430. }
  16431. };
  16432. pp$3.parseFunctionExpression = function () {
  16433. var node = this.startNode();
  16434. var meta = this.parseIdentifier(true);
  16435. if (this.state.inGenerator && this.eat(types.dot) && this.hasPlugin("functionSent")) {
  16436. return this.parseMetaProperty(node, meta, "sent");
  16437. } else {
  16438. return this.parseFunction(node, false);
  16439. }
  16440. };
  16441. pp$3.parseMetaProperty = function (node, meta, propertyName) {
  16442. node.meta = meta;
  16443. node.property = this.parseIdentifier(true);
  16444. if (node.property.name !== propertyName) {
  16445. this.raise(node.property.start, "The only valid meta property for new is " + meta.name + "." + propertyName);
  16446. }
  16447. return this.finishNode(node, "MetaProperty");
  16448. };
  16449. pp$3.parseLiteral = function (value, type, startPos, startLoc) {
  16450. startPos = startPos || this.state.start;
  16451. startLoc = startLoc || this.state.startLoc;
  16452. var node = this.startNodeAt(startPos, startLoc);
  16453. this.addExtra(node, "rawValue", value);
  16454. this.addExtra(node, "raw", this.input.slice(startPos, this.state.end));
  16455. node.value = value;
  16456. this.next();
  16457. return this.finishNode(node, type);
  16458. };
  16459. pp$3.parseParenExpression = function () {
  16460. this.expect(types.parenL);
  16461. var val = this.parseExpression();
  16462. this.expect(types.parenR);
  16463. return val;
  16464. };
  16465. pp$3.parseParenAndDistinguishExpression = function (startPos, startLoc, canBeArrow) {
  16466. startPos = startPos || this.state.start;
  16467. startLoc = startLoc || this.state.startLoc;
  16468. var val = void 0;
  16469. this.expect(types.parenL);
  16470. var innerStartPos = this.state.start;
  16471. var innerStartLoc = this.state.startLoc;
  16472. var exprList = [];
  16473. var refShorthandDefaultPos = { start: 0 };
  16474. var refNeedsArrowPos = { start: 0 };
  16475. var first = true;
  16476. var spreadStart = void 0;
  16477. var optionalCommaStart = void 0;
  16478. while (!this.match(types.parenR)) {
  16479. if (first) {
  16480. first = false;
  16481. } else {
  16482. this.expect(types.comma, refNeedsArrowPos.start || null);
  16483. if (this.match(types.parenR)) {
  16484. optionalCommaStart = this.state.start;
  16485. break;
  16486. }
  16487. }
  16488. if (this.match(types.ellipsis)) {
  16489. var spreadNodeStartPos = this.state.start;
  16490. var spreadNodeStartLoc = this.state.startLoc;
  16491. spreadStart = this.state.start;
  16492. exprList.push(this.parseParenItem(this.parseRest(), spreadNodeStartLoc, spreadNodeStartPos));
  16493. break;
  16494. } else {
  16495. exprList.push(this.parseMaybeAssign(false, refShorthandDefaultPos, this.parseParenItem, refNeedsArrowPos));
  16496. }
  16497. }
  16498. var innerEndPos = this.state.start;
  16499. var innerEndLoc = this.state.startLoc;
  16500. this.expect(types.parenR);
  16501. var arrowNode = this.startNodeAt(startPos, startLoc);
  16502. if (canBeArrow && this.shouldParseArrow() && (arrowNode = this.parseArrow(arrowNode))) {
  16503. for (var _iterator = exprList, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
  16504. var _ref;
  16505. if (_isArray) {
  16506. if (_i >= _iterator.length) break;
  16507. _ref = _iterator[_i++];
  16508. } else {
  16509. _i = _iterator.next();
  16510. if (_i.done) break;
  16511. _ref = _i.value;
  16512. }
  16513. var param = _ref;
  16514. if (param.extra && param.extra.parenthesized) this.unexpected(param.extra.parenStart);
  16515. }
  16516. return this.parseArrowExpression(arrowNode, exprList);
  16517. }
  16518. if (!exprList.length) {
  16519. this.unexpected(this.state.lastTokStart);
  16520. }
  16521. if (optionalCommaStart) this.unexpected(optionalCommaStart);
  16522. if (spreadStart) this.unexpected(spreadStart);
  16523. if (refShorthandDefaultPos.start) this.unexpected(refShorthandDefaultPos.start);
  16524. if (refNeedsArrowPos.start) this.unexpected(refNeedsArrowPos.start);
  16525. if (exprList.length > 1) {
  16526. val = this.startNodeAt(innerStartPos, innerStartLoc);
  16527. val.expressions = exprList;
  16528. this.toReferencedList(val.expressions);
  16529. this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc);
  16530. } else {
  16531. val = exprList[0];
  16532. }
  16533. this.addExtra(val, "parenthesized", true);
  16534. this.addExtra(val, "parenStart", startPos);
  16535. return val;
  16536. };
  16537. pp$3.shouldParseArrow = function () {
  16538. return !this.canInsertSemicolon();
  16539. };
  16540. pp$3.parseArrow = function (node) {
  16541. if (this.eat(types.arrow)) {
  16542. return node;
  16543. }
  16544. };
  16545. pp$3.parseParenItem = function (node) {
  16546. return node;
  16547. };
  16548. // New's precedence is slightly tricky. It must allow its argument
  16549. // to be a `[]` or dot subscript expression, but not a call — at
  16550. // least, not without wrapping it in parentheses. Thus, it uses the
  16551. pp$3.parseNew = function () {
  16552. var node = this.startNode();
  16553. var meta = this.parseIdentifier(true);
  16554. if (this.eat(types.dot)) {
  16555. return this.parseMetaProperty(node, meta, "target");
  16556. }
  16557. node.callee = this.parseNoCallExpr();
  16558. if (this.eat(types.parenL)) {
  16559. node.arguments = this.parseExprList(types.parenR);
  16560. this.toReferencedList(node.arguments);
  16561. } else {
  16562. node.arguments = [];
  16563. }
  16564. return this.finishNode(node, "NewExpression");
  16565. };
  16566. // Parse template expression.
  16567. pp$3.parseTemplateElement = function () {
  16568. var elem = this.startNode();
  16569. elem.value = {
  16570. raw: this.input.slice(this.state.start, this.state.end).replace(/\r\n?/g, "\n"),
  16571. cooked: this.state.value
  16572. };
  16573. this.next();
  16574. elem.tail = this.match(types.backQuote);
  16575. return this.finishNode(elem, "TemplateElement");
  16576. };
  16577. pp$3.parseTemplate = function () {
  16578. var node = this.startNode();
  16579. this.next();
  16580. node.expressions = [];
  16581. var curElt = this.parseTemplateElement();
  16582. node.quasis = [curElt];
  16583. while (!curElt.tail) {
  16584. this.expect(types.dollarBraceL);
  16585. node.expressions.push(this.parseExpression());
  16586. this.expect(types.braceR);
  16587. node.quasis.push(curElt = this.parseTemplateElement());
  16588. }
  16589. this.next();
  16590. return this.finishNode(node, "TemplateLiteral");
  16591. };
  16592. // Parse an object literal or binding pattern.
  16593. pp$3.parseObj = function (isPattern, refShorthandDefaultPos) {
  16594. var decorators = [];
  16595. var propHash = Object.create(null);
  16596. var first = true;
  16597. var node = this.startNode();
  16598. node.properties = [];
  16599. this.next();
  16600. var firstRestLocation = null;
  16601. while (!this.eat(types.braceR)) {
  16602. if (first) {
  16603. first = false;
  16604. } else {
  16605. this.expect(types.comma);
  16606. if (this.eat(types.braceR)) break;
  16607. }
  16608. while (this.match(types.at)) {
  16609. decorators.push(this.parseDecorator());
  16610. }
  16611. var prop = this.startNode(),
  16612. isGenerator = false,
  16613. isAsync = false,
  16614. startPos = void 0,
  16615. startLoc = void 0;
  16616. if (decorators.length) {
  16617. prop.decorators = decorators;
  16618. decorators = [];
  16619. }
  16620. if (this.hasPlugin("objectRestSpread") && this.match(types.ellipsis)) {
  16621. prop = this.parseSpread(isPattern ? { start: 0 } : undefined);
  16622. prop.type = isPattern ? "RestProperty" : "SpreadProperty";
  16623. if (isPattern) this.toAssignable(prop.argument, true, "object pattern");
  16624. node.properties.push(prop);
  16625. if (isPattern) {
  16626. var position = this.state.start;
  16627. if (firstRestLocation !== null) {
  16628. this.unexpected(firstRestLocation, "Cannot have multiple rest elements when destructuring");
  16629. } else if (this.eat(types.braceR)) {
  16630. break;
  16631. } else if (this.match(types.comma) && this.lookahead().type === types.braceR) {
  16632. // TODO: temporary rollback
  16633. // this.unexpected(position, "A trailing comma is not permitted after the rest element");
  16634. continue;
  16635. } else {
  16636. firstRestLocation = position;
  16637. continue;
  16638. }
  16639. } else {
  16640. continue;
  16641. }
  16642. }
  16643. prop.method = false;
  16644. prop.shorthand = false;
  16645. if (isPattern || refShorthandDefaultPos) {
  16646. startPos = this.state.start;
  16647. startLoc = this.state.startLoc;
  16648. }
  16649. if (!isPattern) {
  16650. isGenerator = this.eat(types.star);
  16651. }
  16652. if (!isPattern && this.isContextual("async")) {
  16653. if (isGenerator) this.unexpected();
  16654. var asyncId = this.parseIdentifier();
  16655. if (this.match(types.colon) || this.match(types.parenL) || this.match(types.braceR) || this.match(types.eq) || this.match(types.comma)) {
  16656. prop.key = asyncId;
  16657. prop.computed = false;
  16658. } else {
  16659. isAsync = true;
  16660. if (this.hasPlugin("asyncGenerators")) isGenerator = this.eat(types.star);
  16661. this.parsePropertyName(prop);
  16662. }
  16663. } else {
  16664. this.parsePropertyName(prop);
  16665. }
  16666. this.parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, isPattern, refShorthandDefaultPos);
  16667. this.checkPropClash(prop, propHash);
  16668. if (prop.shorthand) {
  16669. this.addExtra(prop, "shorthand", true);
  16670. }
  16671. node.properties.push(prop);
  16672. }
  16673. if (firstRestLocation !== null) {
  16674. this.unexpected(firstRestLocation, "The rest element has to be the last element when destructuring");
  16675. }
  16676. if (decorators.length) {
  16677. this.raise(this.state.start, "You have trailing decorators with no property");
  16678. }
  16679. return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression");
  16680. };
  16681. pp$3.isGetterOrSetterMethod = function (prop, isPattern) {
  16682. return !isPattern && !prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && (this.match(types.string) || // get "string"() {}
  16683. this.match(types.num) || // get 1() {}
  16684. this.match(types.bracketL) || // get ["string"]() {}
  16685. this.match(types.name) || // get foo() {}
  16686. this.state.type.keyword // get debugger() {}
  16687. );
  16688. };
  16689. // get methods aren't allowed to have any parameters
  16690. // set methods must have exactly 1 parameter
  16691. pp$3.checkGetterSetterParamCount = function (method) {
  16692. var paramCount = method.kind === "get" ? 0 : 1;
  16693. if (method.params.length !== paramCount) {
  16694. var start = method.start;
  16695. if (method.kind === "get") {
  16696. this.raise(start, "getter should have no params");
  16697. } else {
  16698. this.raise(start, "setter should have exactly one param");
  16699. }
  16700. }
  16701. };
  16702. pp$3.parseObjectMethod = function (prop, isGenerator, isAsync, isPattern) {
  16703. if (isAsync || isGenerator || this.match(types.parenL)) {
  16704. if (isPattern) this.unexpected();
  16705. prop.kind = "method";
  16706. prop.method = true;
  16707. this.parseMethod(prop, isGenerator, isAsync);
  16708. return this.finishNode(prop, "ObjectMethod");
  16709. }
  16710. if (this.isGetterOrSetterMethod(prop, isPattern)) {
  16711. if (isGenerator || isAsync) this.unexpected();
  16712. prop.kind = prop.key.name;
  16713. this.parsePropertyName(prop);
  16714. this.parseMethod(prop);
  16715. this.checkGetterSetterParamCount(prop);
  16716. return this.finishNode(prop, "ObjectMethod");
  16717. }
  16718. };
  16719. pp$3.parseObjectProperty = function (prop, startPos, startLoc, isPattern, refShorthandDefaultPos) {
  16720. if (this.eat(types.colon)) {
  16721. prop.value = isPattern ? this.parseMaybeDefault(this.state.start, this.state.startLoc) : this.parseMaybeAssign(false, refShorthandDefaultPos);
  16722. return this.finishNode(prop, "ObjectProperty");
  16723. }
  16724. if (!prop.computed && prop.key.type === "Identifier") {
  16725. if (isPattern) {
  16726. this.checkReservedWord(prop.key.name, prop.key.start, true, true);
  16727. prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key.__clone());
  16728. } else if (this.match(types.eq) && refShorthandDefaultPos) {
  16729. if (!refShorthandDefaultPos.start) {
  16730. refShorthandDefaultPos.start = this.state.start;
  16731. }
  16732. prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key.__clone());
  16733. } else {
  16734. prop.value = prop.key.__clone();
  16735. }
  16736. prop.shorthand = true;
  16737. return this.finishNode(prop, "ObjectProperty");
  16738. }
  16739. };
  16740. pp$3.parseObjPropValue = function (prop, startPos, startLoc, isGenerator, isAsync, isPattern, refShorthandDefaultPos) {
  16741. var node = this.parseObjectMethod(prop, isGenerator, isAsync, isPattern) || this.parseObjectProperty(prop, startPos, startLoc, isPattern, refShorthandDefaultPos);
  16742. if (!node) this.unexpected();
  16743. return node;
  16744. };
  16745. pp$3.parsePropertyName = function (prop) {
  16746. if (this.eat(types.bracketL)) {
  16747. prop.computed = true;
  16748. prop.key = this.parseMaybeAssign();
  16749. this.expect(types.bracketR);
  16750. } else {
  16751. prop.computed = false;
  16752. var oldInPropertyName = this.state.inPropertyName;
  16753. this.state.inPropertyName = true;
  16754. prop.key = this.match(types.num) || this.match(types.string) ? this.parseExprAtom() : this.parseIdentifier(true);
  16755. this.state.inPropertyName = oldInPropertyName;
  16756. }
  16757. return prop.key;
  16758. };
  16759. // Initialize empty function node.
  16760. pp$3.initFunction = function (node, isAsync) {
  16761. node.id = null;
  16762. node.generator = false;
  16763. node.expression = false;
  16764. node.async = !!isAsync;
  16765. };
  16766. // Parse object or class method.
  16767. pp$3.parseMethod = function (node, isGenerator, isAsync) {
  16768. var oldInMethod = this.state.inMethod;
  16769. this.state.inMethod = node.kind || true;
  16770. this.initFunction(node, isAsync);
  16771. this.expect(types.parenL);
  16772. node.params = this.parseBindingList(types.parenR);
  16773. node.generator = !!isGenerator;
  16774. this.parseFunctionBody(node);
  16775. this.state.inMethod = oldInMethod;
  16776. return node;
  16777. };
  16778. // Parse arrow function expression with given parameters.
  16779. pp$3.parseArrowExpression = function (node, params, isAsync) {
  16780. this.initFunction(node, isAsync);
  16781. node.params = this.toAssignableList(params, true, "arrow function parameters");
  16782. this.parseFunctionBody(node, true);
  16783. return this.finishNode(node, "ArrowFunctionExpression");
  16784. };
  16785. pp$3.isStrictBody = function (node, isExpression) {
  16786. if (!isExpression && node.body.directives.length) {
  16787. for (var _iterator2 = node.body.directives, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
  16788. var _ref2;
  16789. if (_isArray2) {
  16790. if (_i2 >= _iterator2.length) break;
  16791. _ref2 = _iterator2[_i2++];
  16792. } else {
  16793. _i2 = _iterator2.next();
  16794. if (_i2.done) break;
  16795. _ref2 = _i2.value;
  16796. }
  16797. var directive = _ref2;
  16798. if (directive.value.value === "use strict") {
  16799. return true;
  16800. }
  16801. }
  16802. }
  16803. return false;
  16804. };
  16805. // Parse function body and check parameters.
  16806. pp$3.parseFunctionBody = function (node, allowExpression) {
  16807. var isExpression = allowExpression && !this.match(types.braceL);
  16808. var oldInAsync = this.state.inAsync;
  16809. this.state.inAsync = node.async;
  16810. if (isExpression) {
  16811. node.body = this.parseMaybeAssign();
  16812. node.expression = true;
  16813. } else {
  16814. // Start a new scope with regard to labels and the `inFunction`
  16815. // flag (restore them to their old value afterwards).
  16816. var oldInFunc = this.state.inFunction;
  16817. var oldInGen = this.state.inGenerator;
  16818. var oldLabels = this.state.labels;
  16819. this.state.inFunction = true;this.state.inGenerator = node.generator;this.state.labels = [];
  16820. node.body = this.parseBlock(true);
  16821. node.expression = false;
  16822. this.state.inFunction = oldInFunc;this.state.inGenerator = oldInGen;this.state.labels = oldLabels;
  16823. }
  16824. this.state.inAsync = oldInAsync;
  16825. // If this is a strict mode function, verify that argument names
  16826. // are not repeated, and it does not try to bind the words `eval`
  16827. // or `arguments`.
  16828. var isStrict = this.isStrictBody(node, isExpression);
  16829. // Also check when allowExpression === true for arrow functions
  16830. var checkLVal = this.state.strict || allowExpression || isStrict;
  16831. if (isStrict && node.id && node.id.type === "Identifier" && node.id.name === "yield") {
  16832. this.raise(node.id.start, "Binding yield in strict mode");
  16833. }
  16834. if (checkLVal) {
  16835. var nameHash = Object.create(null);
  16836. var oldStrict = this.state.strict;
  16837. if (isStrict) this.state.strict = true;
  16838. if (node.id) {
  16839. this.checkLVal(node.id, true, undefined, "function name");
  16840. }
  16841. for (var _iterator3 = node.params, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
  16842. var _ref3;
  16843. if (_isArray3) {
  16844. if (_i3 >= _iterator3.length) break;
  16845. _ref3 = _iterator3[_i3++];
  16846. } else {
  16847. _i3 = _iterator3.next();
  16848. if (_i3.done) break;
  16849. _ref3 = _i3.value;
  16850. }
  16851. var param = _ref3;
  16852. if (isStrict && param.type !== "Identifier") {
  16853. this.raise(param.start, "Non-simple parameter in strict mode");
  16854. }
  16855. this.checkLVal(param, true, nameHash, "function parameter list");
  16856. }
  16857. this.state.strict = oldStrict;
  16858. }
  16859. };
  16860. // Parses a comma-separated list of expressions, and returns them as
  16861. // an array. `close` is the token type that ends the list, and
  16862. // `allowEmpty` can be turned on to allow subsequent commas with
  16863. // nothing in between them to be parsed as `null` (which is needed
  16864. // for array literals).
  16865. pp$3.parseExprList = function (close, allowEmpty, refShorthandDefaultPos) {
  16866. var elts = [];
  16867. var first = true;
  16868. while (!this.eat(close)) {
  16869. if (first) {
  16870. first = false;
  16871. } else {
  16872. this.expect(types.comma);
  16873. if (this.eat(close)) break;
  16874. }
  16875. elts.push(this.parseExprListItem(allowEmpty, refShorthandDefaultPos));
  16876. }
  16877. return elts;
  16878. };
  16879. pp$3.parseExprListItem = function (allowEmpty, refShorthandDefaultPos, refNeedsArrowPos) {
  16880. var elt = void 0;
  16881. if (allowEmpty && this.match(types.comma)) {
  16882. elt = null;
  16883. } else if (this.match(types.ellipsis)) {
  16884. elt = this.parseSpread(refShorthandDefaultPos);
  16885. } else {
  16886. elt = this.parseMaybeAssign(false, refShorthandDefaultPos, this.parseParenItem, refNeedsArrowPos);
  16887. }
  16888. return elt;
  16889. };
  16890. // Parse the next token as an identifier. If `liberal` is true (used
  16891. // when parsing properties), it will also convert keywords into
  16892. // identifiers.
  16893. pp$3.parseIdentifier = function (liberal) {
  16894. var node = this.startNode();
  16895. if (!liberal) {
  16896. this.checkReservedWord(this.state.value, this.state.start, !!this.state.type.keyword, false);
  16897. }
  16898. if (this.match(types.name)) {
  16899. node.name = this.state.value;
  16900. } else if (this.state.type.keyword) {
  16901. node.name = this.state.type.keyword;
  16902. } else {
  16903. this.unexpected();
  16904. }
  16905. if (!liberal && node.name === "await" && this.state.inAsync) {
  16906. this.raise(node.start, "invalid use of await inside of an async function");
  16907. }
  16908. node.loc.identifierName = node.name;
  16909. this.next();
  16910. return this.finishNode(node, "Identifier");
  16911. };
  16912. pp$3.checkReservedWord = function (word, startLoc, checkKeywords, isBinding) {
  16913. if (this.isReservedWord(word) || checkKeywords && this.isKeyword(word)) {
  16914. this.raise(startLoc, word + " is a reserved word");
  16915. }
  16916. if (this.state.strict && (reservedWords.strict(word) || isBinding && reservedWords.strictBind(word))) {
  16917. this.raise(startLoc, word + " is a reserved word in strict mode");
  16918. }
  16919. };
  16920. // Parses await expression inside async function.
  16921. pp$3.parseAwait = function (node) {
  16922. // istanbul ignore next: this condition is checked at the call site so won't be hit here
  16923. if (!this.state.inAsync) {
  16924. this.unexpected();
  16925. }
  16926. if (this.match(types.star)) {
  16927. this.raise(node.start, "await* has been removed from the async functions proposal. Use Promise.all() instead.");
  16928. }
  16929. node.argument = this.parseMaybeUnary();
  16930. return this.finishNode(node, "AwaitExpression");
  16931. };
  16932. // Parses yield expression inside generator.
  16933. pp$3.parseYield = function () {
  16934. var node = this.startNode();
  16935. this.next();
  16936. if (this.match(types.semi) || this.canInsertSemicolon() || !this.match(types.star) && !this.state.type.startsExpr) {
  16937. node.delegate = false;
  16938. node.argument = null;
  16939. } else {
  16940. node.delegate = this.eat(types.star);
  16941. node.argument = this.parseMaybeAssign();
  16942. }
  16943. return this.finishNode(node, "YieldExpression");
  16944. };
  16945. // Start an AST node, attaching a start offset.
  16946. var pp$4 = Parser.prototype;
  16947. var commentKeys = ["leadingComments", "trailingComments", "innerComments"];
  16948. var Node = function () {
  16949. function Node(pos, loc, filename) {
  16950. classCallCheck(this, Node);
  16951. this.type = "";
  16952. this.start = pos;
  16953. this.end = 0;
  16954. this.loc = new SourceLocation(loc);
  16955. if (filename) this.loc.filename = filename;
  16956. }
  16957. Node.prototype.__clone = function __clone() {
  16958. var node2 = new Node();
  16959. for (var key in this) {
  16960. // Do not clone comments that are already attached to the node
  16961. if (commentKeys.indexOf(key) < 0) {
  16962. node2[key] = this[key];
  16963. }
  16964. }
  16965. return node2;
  16966. };
  16967. return Node;
  16968. }();
  16969. pp$4.startNode = function () {
  16970. return new Node(this.state.start, this.state.startLoc, this.filename);
  16971. };
  16972. pp$4.startNodeAt = function (pos, loc) {
  16973. return new Node(pos, loc, this.filename);
  16974. };
  16975. function finishNodeAt(node, type, pos, loc) {
  16976. node.type = type;
  16977. node.end = pos;
  16978. node.loc.end = loc;
  16979. this.processComment(node);
  16980. return node;
  16981. }
  16982. // Finish an AST node, adding `type` and `end` properties.
  16983. pp$4.finishNode = function (node, type) {
  16984. return finishNodeAt.call(this, node, type, this.state.lastTokEnd, this.state.lastTokEndLoc);
  16985. };
  16986. // Finish node at given position
  16987. pp$4.finishNodeAt = function (node, type, pos, loc) {
  16988. return finishNodeAt.call(this, node, type, pos, loc);
  16989. };
  16990. var pp$5 = Parser.prototype;
  16991. // This function is used to raise exceptions on parse errors. It
  16992. // takes an offset integer (into the current `input`) to indicate
  16993. // the location of the error, attaches the position to the end
  16994. // of the error message, and then raises a `SyntaxError` with that
  16995. // message.
  16996. pp$5.raise = function (pos, message) {
  16997. var loc = getLineInfo(this.input, pos);
  16998. message += " (" + loc.line + ":" + loc.column + ")";
  16999. var err = new SyntaxError(message);
  17000. err.pos = pos;
  17001. err.loc = loc;
  17002. throw err;
  17003. };
  17004. /* eslint max-len: 0 */
  17005. /**
  17006. * Based on the comment attachment algorithm used in espree and estraverse.
  17007. *
  17008. * Redistribution and use in source and binary forms, with or without
  17009. * modification, are permitted provided that the following conditions are met:
  17010. *
  17011. * * Redistributions of source code must retain the above copyright
  17012. * notice, this list of conditions and the following disclaimer.
  17013. * * Redistributions in binary form must reproduce the above copyright
  17014. * notice, this list of conditions and the following disclaimer in the
  17015. * documentation and/or other materials provided with the distribution.
  17016. *
  17017. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  17018. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  17019. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  17020. * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  17021. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  17022. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  17023. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  17024. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  17025. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  17026. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  17027. */
  17028. function last(stack) {
  17029. return stack[stack.length - 1];
  17030. }
  17031. var pp$6 = Parser.prototype;
  17032. pp$6.addComment = function (comment) {
  17033. if (this.filename) comment.loc.filename = this.filename;
  17034. this.state.trailingComments.push(comment);
  17035. this.state.leadingComments.push(comment);
  17036. };
  17037. pp$6.processComment = function (node) {
  17038. if (node.type === "Program" && node.body.length > 0) return;
  17039. var stack = this.state.commentStack;
  17040. var lastChild = void 0,
  17041. trailingComments = void 0,
  17042. i = void 0,
  17043. j = void 0;
  17044. if (this.state.trailingComments.length > 0) {
  17045. // If the first comment in trailingComments comes after the
  17046. // current node, then we're good - all comments in the array will
  17047. // come after the node and so it's safe to add them as official
  17048. // trailingComments.
  17049. if (this.state.trailingComments[0].start >= node.end) {
  17050. trailingComments = this.state.trailingComments;
  17051. this.state.trailingComments = [];
  17052. } else {
  17053. // Otherwise, if the first comment doesn't come after the
  17054. // current node, that means we have a mix of leading and trailing
  17055. // comments in the array and that leadingComments contains the
  17056. // same items as trailingComments. Reset trailingComments to
  17057. // zero items and we'll handle this by evaluating leadingComments
  17058. // later.
  17059. this.state.trailingComments.length = 0;
  17060. }
  17061. } else {
  17062. var lastInStack = last(stack);
  17063. if (stack.length > 0 && lastInStack.trailingComments && lastInStack.trailingComments[0].start >= node.end) {
  17064. trailingComments = lastInStack.trailingComments;
  17065. lastInStack.trailingComments = null;
  17066. }
  17067. }
  17068. // Eating the stack.
  17069. while (stack.length > 0 && last(stack).start >= node.start) {
  17070. lastChild = stack.pop();
  17071. }
  17072. if (lastChild) {
  17073. if (lastChild.leadingComments) {
  17074. if (lastChild !== node && last(lastChild.leadingComments).end <= node.start) {
  17075. node.leadingComments = lastChild.leadingComments;
  17076. lastChild.leadingComments = null;
  17077. } else {
  17078. // A leading comment for an anonymous class had been stolen by its first ClassMethod,
  17079. // so this takes back the leading comment.
  17080. // See also: https://github.com/eslint/espree/issues/158
  17081. for (i = lastChild.leadingComments.length - 2; i >= 0; --i) {
  17082. if (lastChild.leadingComments[i].end <= node.start) {
  17083. node.leadingComments = lastChild.leadingComments.splice(0, i + 1);
  17084. break;
  17085. }
  17086. }
  17087. }
  17088. }
  17089. } else if (this.state.leadingComments.length > 0) {
  17090. if (last(this.state.leadingComments).end <= node.start) {
  17091. if (this.state.commentPreviousNode) {
  17092. for (j = 0; j < this.state.leadingComments.length; j++) {
  17093. if (this.state.leadingComments[j].end < this.state.commentPreviousNode.end) {
  17094. this.state.leadingComments.splice(j, 1);
  17095. j--;
  17096. }
  17097. }
  17098. }
  17099. if (this.state.leadingComments.length > 0) {
  17100. node.leadingComments = this.state.leadingComments;
  17101. this.state.leadingComments = [];
  17102. }
  17103. } else {
  17104. // https://github.com/eslint/espree/issues/2
  17105. //
  17106. // In special cases, such as return (without a value) and
  17107. // debugger, all comments will end up as leadingComments and
  17108. // will otherwise be eliminated. This step runs when the
  17109. // commentStack is empty and there are comments left
  17110. // in leadingComments.
  17111. //
  17112. // This loop figures out the stopping point between the actual
  17113. // leading and trailing comments by finding the location of the
  17114. // first comment that comes after the given node.
  17115. for (i = 0; i < this.state.leadingComments.length; i++) {
  17116. if (this.state.leadingComments[i].end > node.start) {
  17117. break;
  17118. }
  17119. }
  17120. // Split the array based on the location of the first comment
  17121. // that comes after the node. Keep in mind that this could
  17122. // result in an empty array, and if so, the array must be
  17123. // deleted.
  17124. node.leadingComments = this.state.leadingComments.slice(0, i);
  17125. if (node.leadingComments.length === 0) {
  17126. node.leadingComments = null;
  17127. }
  17128. // Similarly, trailing comments are attached later. The variable
  17129. // must be reset to null if there are no trailing comments.
  17130. trailingComments = this.state.leadingComments.slice(i);
  17131. if (trailingComments.length === 0) {
  17132. trailingComments = null;
  17133. }
  17134. }
  17135. }
  17136. this.state.commentPreviousNode = node;
  17137. if (trailingComments) {
  17138. if (trailingComments.length && trailingComments[0].start >= node.start && last(trailingComments).end <= node.end) {
  17139. node.innerComments = trailingComments;
  17140. } else {
  17141. node.trailingComments = trailingComments;
  17142. }
  17143. }
  17144. stack.push(node);
  17145. };
  17146. var pp$7 = Parser.prototype;
  17147. pp$7.estreeParseRegExpLiteral = function (_ref) {
  17148. var pattern = _ref.pattern,
  17149. flags = _ref.flags;
  17150. var regex = null;
  17151. try {
  17152. regex = new RegExp(pattern, flags);
  17153. } catch (e) {
  17154. // In environments that don't support these flags value will
  17155. // be null as the regex can't be represented natively.
  17156. }
  17157. var node = this.estreeParseLiteral(regex);
  17158. node.regex = { pattern: pattern, flags: flags };
  17159. return node;
  17160. };
  17161. pp$7.estreeParseLiteral = function (value) {
  17162. return this.parseLiteral(value, "Literal");
  17163. };
  17164. pp$7.directiveToStmt = function (directive) {
  17165. var directiveLiteral = directive.value;
  17166. var stmt = this.startNodeAt(directive.start, directive.loc.start);
  17167. var expression = this.startNodeAt(directiveLiteral.start, directiveLiteral.loc.start);
  17168. expression.value = directiveLiteral.value;
  17169. expression.raw = directiveLiteral.extra.raw;
  17170. stmt.expression = this.finishNodeAt(expression, "Literal", directiveLiteral.end, directiveLiteral.loc.end);
  17171. stmt.directive = directiveLiteral.extra.raw.slice(1, -1);
  17172. return this.finishNodeAt(stmt, "ExpressionStatement", directive.end, directive.loc.end);
  17173. };
  17174. function isSimpleProperty(node) {
  17175. return node && node.type === "Property" && node.kind === "init" && node.method === false;
  17176. }
  17177. var estreePlugin = function (instance) {
  17178. instance.extend("checkDeclaration", function (inner) {
  17179. return function (node) {
  17180. if (isSimpleProperty(node)) {
  17181. this.checkDeclaration(node.value);
  17182. } else {
  17183. inner.call(this, node);
  17184. }
  17185. };
  17186. });
  17187. instance.extend("checkGetterSetterParamCount", function () {
  17188. return function (prop) {
  17189. var paramCount = prop.kind === "get" ? 0 : 1;
  17190. if (prop.value.params.length !== paramCount) {
  17191. var start = prop.start;
  17192. if (prop.kind === "get") {
  17193. this.raise(start, "getter should have no params");
  17194. } else {
  17195. this.raise(start, "setter should have exactly one param");
  17196. }
  17197. }
  17198. };
  17199. });
  17200. instance.extend("checkLVal", function (inner) {
  17201. return function (expr, isBinding, checkClashes) {
  17202. var _this = this;
  17203. switch (expr.type) {
  17204. case "ObjectPattern":
  17205. expr.properties.forEach(function (prop) {
  17206. _this.checkLVal(prop.type === "Property" ? prop.value : prop, isBinding, checkClashes, "object destructuring pattern");
  17207. });
  17208. break;
  17209. default:
  17210. for (var _len = arguments.length, args = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
  17211. args[_key - 3] = arguments[_key];
  17212. }
  17213. inner.call.apply(inner, [this, expr, isBinding, checkClashes].concat(args));
  17214. }
  17215. };
  17216. });
  17217. instance.extend("checkPropClash", function () {
  17218. return function (prop, propHash) {
  17219. if (prop.computed || !isSimpleProperty(prop)) return;
  17220. var key = prop.key;
  17221. // It is either an Identifier or a String/NumericLiteral
  17222. var name = key.type === "Identifier" ? key.name : String(key.value);
  17223. if (name === "__proto__") {
  17224. if (propHash.proto) this.raise(key.start, "Redefinition of __proto__ property");
  17225. propHash.proto = true;
  17226. }
  17227. };
  17228. });
  17229. instance.extend("isStrictBody", function () {
  17230. return function (node, isExpression) {
  17231. if (!isExpression && node.body.body.length > 0) {
  17232. for (var _iterator = node.body.body, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
  17233. var _ref2;
  17234. if (_isArray) {
  17235. if (_i >= _iterator.length) break;
  17236. _ref2 = _iterator[_i++];
  17237. } else {
  17238. _i = _iterator.next();
  17239. if (_i.done) break;
  17240. _ref2 = _i.value;
  17241. }
  17242. var directive = _ref2;
  17243. if (directive.type === "ExpressionStatement" && directive.expression.type === "Literal") {
  17244. if (directive.expression.value === "use strict") return true;
  17245. } else {
  17246. // Break for the first non literal expression
  17247. break;
  17248. }
  17249. }
  17250. }
  17251. return false;
  17252. };
  17253. });
  17254. instance.extend("isValidDirective", function () {
  17255. return function (stmt) {
  17256. return stmt.type === "ExpressionStatement" && stmt.expression.type === "Literal" && typeof stmt.expression.value === "string" && (!stmt.expression.extra || !stmt.expression.extra.parenthesized);
  17257. };
  17258. });
  17259. instance.extend("parseBlockBody", function (inner) {
  17260. return function (node) {
  17261. var _this2 = this;
  17262. for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  17263. args[_key2 - 1] = arguments[_key2];
  17264. }
  17265. inner.call.apply(inner, [this, node].concat(args));
  17266. node.directives.reverse().forEach(function (directive) {
  17267. node.body.unshift(_this2.directiveToStmt(directive));
  17268. });
  17269. delete node.directives;
  17270. };
  17271. });
  17272. instance.extend("parseClassMethod", function (inner) {
  17273. return function (classBody) {
  17274. for (var _len3 = arguments.length, args = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
  17275. args[_key3 - 1] = arguments[_key3];
  17276. }
  17277. inner.call.apply(inner, [this, classBody].concat(args));
  17278. var body = classBody.body;
  17279. body[body.length - 1].type = "MethodDefinition";
  17280. };
  17281. });
  17282. instance.extend("parseExprAtom", function (inner) {
  17283. return function () {
  17284. switch (this.state.type) {
  17285. case types.regexp:
  17286. return this.estreeParseRegExpLiteral(this.state.value);
  17287. case types.num:
  17288. case types.string:
  17289. return this.estreeParseLiteral(this.state.value);
  17290. case types._null:
  17291. return this.estreeParseLiteral(null);
  17292. case types._true:
  17293. return this.estreeParseLiteral(true);
  17294. case types._false:
  17295. return this.estreeParseLiteral(false);
  17296. default:
  17297. for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  17298. args[_key4] = arguments[_key4];
  17299. }
  17300. return inner.call.apply(inner, [this].concat(args));
  17301. }
  17302. };
  17303. });
  17304. instance.extend("parseLiteral", function (inner) {
  17305. return function () {
  17306. for (var _len5 = arguments.length, args = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
  17307. args[_key5] = arguments[_key5];
  17308. }
  17309. var node = inner.call.apply(inner, [this].concat(args));
  17310. node.raw = node.extra.raw;
  17311. delete node.extra;
  17312. return node;
  17313. };
  17314. });
  17315. instance.extend("parseMethod", function (inner) {
  17316. return function (node) {
  17317. var funcNode = this.startNode();
  17318. funcNode.kind = node.kind; // provide kind, so inner method correctly sets state
  17319. for (var _len6 = arguments.length, args = Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) {
  17320. args[_key6 - 1] = arguments[_key6];
  17321. }
  17322. funcNode = inner.call.apply(inner, [this, funcNode].concat(args));
  17323. delete funcNode.kind;
  17324. node.value = this.finishNode(funcNode, "FunctionExpression");
  17325. return node;
  17326. };
  17327. });
  17328. instance.extend("parseObjectMethod", function (inner) {
  17329. return function () {
  17330. for (var _len7 = arguments.length, args = Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
  17331. args[_key7] = arguments[_key7];
  17332. }
  17333. var node = inner.call.apply(inner, [this].concat(args));
  17334. if (node) {
  17335. if (node.kind === "method") node.kind = "init";
  17336. node.type = "Property";
  17337. }
  17338. return node;
  17339. };
  17340. });
  17341. instance.extend("parseObjectProperty", function (inner) {
  17342. return function () {
  17343. for (var _len8 = arguments.length, args = Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
  17344. args[_key8] = arguments[_key8];
  17345. }
  17346. var node = inner.call.apply(inner, [this].concat(args));
  17347. if (node) {
  17348. node.kind = "init";
  17349. node.type = "Property";
  17350. }
  17351. return node;
  17352. };
  17353. });
  17354. instance.extend("toAssignable", function (inner) {
  17355. return function (node, isBinding) {
  17356. for (var _len9 = arguments.length, args = Array(_len9 > 2 ? _len9 - 2 : 0), _key9 = 2; _key9 < _len9; _key9++) {
  17357. args[_key9 - 2] = arguments[_key9];
  17358. }
  17359. if (isSimpleProperty(node)) {
  17360. this.toAssignable.apply(this, [node.value, isBinding].concat(args));
  17361. return node;
  17362. } else if (node.type === "ObjectExpression") {
  17363. node.type = "ObjectPattern";
  17364. for (var _iterator2 = node.properties, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
  17365. var _ref3;
  17366. if (_isArray2) {
  17367. if (_i2 >= _iterator2.length) break;
  17368. _ref3 = _iterator2[_i2++];
  17369. } else {
  17370. _i2 = _iterator2.next();
  17371. if (_i2.done) break;
  17372. _ref3 = _i2.value;
  17373. }
  17374. var prop = _ref3;
  17375. if (prop.kind === "get" || prop.kind === "set") {
  17376. this.raise(prop.key.start, "Object pattern can't contain getter or setter");
  17377. } else if (prop.method) {
  17378. this.raise(prop.key.start, "Object pattern can't contain methods");
  17379. } else {
  17380. this.toAssignable(prop, isBinding, "object destructuring pattern");
  17381. }
  17382. }
  17383. return node;
  17384. }
  17385. return inner.call.apply(inner, [this, node, isBinding].concat(args));
  17386. };
  17387. });
  17388. };
  17389. /* eslint max-len: 0 */
  17390. var primitiveTypes = ["any", "mixed", "empty", "bool", "boolean", "number", "string", "void", "null"];
  17391. var pp$8 = Parser.prototype;
  17392. pp$8.flowParseTypeInitialiser = function (tok) {
  17393. var oldInType = this.state.inType;
  17394. this.state.inType = true;
  17395. this.expect(tok || types.colon);
  17396. var type = this.flowParseType();
  17397. this.state.inType = oldInType;
  17398. return type;
  17399. };
  17400. pp$8.flowParsePredicate = function () {
  17401. var node = this.startNode();
  17402. var moduloLoc = this.state.startLoc;
  17403. var moduloPos = this.state.start;
  17404. this.expect(types.modulo);
  17405. var checksLoc = this.state.startLoc;
  17406. this.expectContextual("checks");
  17407. // Force '%' and 'checks' to be adjacent
  17408. if (moduloLoc.line !== checksLoc.line || moduloLoc.column !== checksLoc.column - 1) {
  17409. this.raise(moduloPos, "Spaces between ´%´ and ´checks´ are not allowed here.");
  17410. }
  17411. if (this.eat(types.parenL)) {
  17412. node.expression = this.parseExpression();
  17413. this.expect(types.parenR);
  17414. return this.finishNode(node, "DeclaredPredicate");
  17415. } else {
  17416. return this.finishNode(node, "InferredPredicate");
  17417. }
  17418. };
  17419. pp$8.flowParseTypeAndPredicateInitialiser = function () {
  17420. var oldInType = this.state.inType;
  17421. this.state.inType = true;
  17422. this.expect(types.colon);
  17423. var type = null;
  17424. var predicate = null;
  17425. if (this.match(types.modulo)) {
  17426. this.state.inType = oldInType;
  17427. predicate = this.flowParsePredicate();
  17428. } else {
  17429. type = this.flowParseType();
  17430. this.state.inType = oldInType;
  17431. if (this.match(types.modulo)) {
  17432. predicate = this.flowParsePredicate();
  17433. }
  17434. }
  17435. return [type, predicate];
  17436. };
  17437. pp$8.flowParseDeclareClass = function (node) {
  17438. this.next();
  17439. this.flowParseInterfaceish(node, true);
  17440. return this.finishNode(node, "DeclareClass");
  17441. };
  17442. pp$8.flowParseDeclareFunction = function (node) {
  17443. this.next();
  17444. var id = node.id = this.parseIdentifier();
  17445. var typeNode = this.startNode();
  17446. var typeContainer = this.startNode();
  17447. if (this.isRelational("<")) {
  17448. typeNode.typeParameters = this.flowParseTypeParameterDeclaration();
  17449. } else {
  17450. typeNode.typeParameters = null;
  17451. }
  17452. this.expect(types.parenL);
  17453. var tmp = this.flowParseFunctionTypeParams();
  17454. typeNode.params = tmp.params;
  17455. typeNode.rest = tmp.rest;
  17456. this.expect(types.parenR);
  17457. var predicate = null;
  17458. var _flowParseTypeAndPred = this.flowParseTypeAndPredicateInitialiser();
  17459. typeNode.returnType = _flowParseTypeAndPred[0];
  17460. predicate = _flowParseTypeAndPred[1];
  17461. typeContainer.typeAnnotation = this.finishNode(typeNode, "FunctionTypeAnnotation");
  17462. typeContainer.predicate = predicate;
  17463. id.typeAnnotation = this.finishNode(typeContainer, "TypeAnnotation");
  17464. this.finishNode(id, id.type);
  17465. this.semicolon();
  17466. return this.finishNode(node, "DeclareFunction");
  17467. };
  17468. pp$8.flowParseDeclare = function (node) {
  17469. if (this.match(types._class)) {
  17470. return this.flowParseDeclareClass(node);
  17471. } else if (this.match(types._function)) {
  17472. return this.flowParseDeclareFunction(node);
  17473. } else if (this.match(types._var)) {
  17474. return this.flowParseDeclareVariable(node);
  17475. } else if (this.isContextual("module")) {
  17476. if (this.lookahead().type === types.dot) {
  17477. return this.flowParseDeclareModuleExports(node);
  17478. } else {
  17479. return this.flowParseDeclareModule(node);
  17480. }
  17481. } else if (this.isContextual("type")) {
  17482. return this.flowParseDeclareTypeAlias(node);
  17483. } else if (this.isContextual("interface")) {
  17484. return this.flowParseDeclareInterface(node);
  17485. } else {
  17486. this.unexpected();
  17487. }
  17488. };
  17489. pp$8.flowParseDeclareVariable = function (node) {
  17490. this.next();
  17491. node.id = this.flowParseTypeAnnotatableIdentifier();
  17492. this.semicolon();
  17493. return this.finishNode(node, "DeclareVariable");
  17494. };
  17495. pp$8.flowParseDeclareModule = function (node) {
  17496. this.next();
  17497. if (this.match(types.string)) {
  17498. node.id = this.parseExprAtom();
  17499. } else {
  17500. node.id = this.parseIdentifier();
  17501. }
  17502. var bodyNode = node.body = this.startNode();
  17503. var body = bodyNode.body = [];
  17504. this.expect(types.braceL);
  17505. while (!this.match(types.braceR)) {
  17506. var _bodyNode = this.startNode();
  17507. if (this.match(types._import)) {
  17508. var lookahead = this.lookahead();
  17509. if (lookahead.value !== "type" && lookahead.value !== "typeof") {
  17510. this.unexpected(null, "Imports within a `declare module` body must always be `import type` or `import typeof`");
  17511. }
  17512. this.parseImport(_bodyNode);
  17513. } else {
  17514. this.expectContextual("declare", "Only declares and type imports are allowed inside declare module");
  17515. _bodyNode = this.flowParseDeclare(_bodyNode, true);
  17516. }
  17517. body.push(_bodyNode);
  17518. }
  17519. this.expect(types.braceR);
  17520. this.finishNode(bodyNode, "BlockStatement");
  17521. return this.finishNode(node, "DeclareModule");
  17522. };
  17523. pp$8.flowParseDeclareModuleExports = function (node) {
  17524. this.expectContextual("module");
  17525. this.expect(types.dot);
  17526. this.expectContextual("exports");
  17527. node.typeAnnotation = this.flowParseTypeAnnotation();
  17528. this.semicolon();
  17529. return this.finishNode(node, "DeclareModuleExports");
  17530. };
  17531. pp$8.flowParseDeclareTypeAlias = function (node) {
  17532. this.next();
  17533. this.flowParseTypeAlias(node);
  17534. return this.finishNode(node, "DeclareTypeAlias");
  17535. };
  17536. pp$8.flowParseDeclareInterface = function (node) {
  17537. this.next();
  17538. this.flowParseInterfaceish(node);
  17539. return this.finishNode(node, "DeclareInterface");
  17540. };
  17541. // Interfaces
  17542. pp$8.flowParseInterfaceish = function (node, allowStatic) {
  17543. node.id = this.parseIdentifier();
  17544. if (this.isRelational("<")) {
  17545. node.typeParameters = this.flowParseTypeParameterDeclaration();
  17546. } else {
  17547. node.typeParameters = null;
  17548. }
  17549. node.extends = [];
  17550. node.mixins = [];
  17551. if (this.eat(types._extends)) {
  17552. do {
  17553. node.extends.push(this.flowParseInterfaceExtends());
  17554. } while (this.eat(types.comma));
  17555. }
  17556. if (this.isContextual("mixins")) {
  17557. this.next();
  17558. do {
  17559. node.mixins.push(this.flowParseInterfaceExtends());
  17560. } while (this.eat(types.comma));
  17561. }
  17562. node.body = this.flowParseObjectType(allowStatic);
  17563. };
  17564. pp$8.flowParseInterfaceExtends = function () {
  17565. var node = this.startNode();
  17566. node.id = this.flowParseQualifiedTypeIdentifier();
  17567. if (this.isRelational("<")) {
  17568. node.typeParameters = this.flowParseTypeParameterInstantiation();
  17569. } else {
  17570. node.typeParameters = null;
  17571. }
  17572. return this.finishNode(node, "InterfaceExtends");
  17573. };
  17574. pp$8.flowParseInterface = function (node) {
  17575. this.flowParseInterfaceish(node, false);
  17576. return this.finishNode(node, "InterfaceDeclaration");
  17577. };
  17578. pp$8.flowParseRestrictedIdentifier = function (liberal) {
  17579. if (primitiveTypes.indexOf(this.state.value) > -1) {
  17580. this.raise(this.state.start, "Cannot overwrite primitive type " + this.state.value);
  17581. }
  17582. return this.parseIdentifier(liberal);
  17583. };
  17584. // Type aliases
  17585. pp$8.flowParseTypeAlias = function (node) {
  17586. node.id = this.flowParseRestrictedIdentifier();
  17587. if (this.isRelational("<")) {
  17588. node.typeParameters = this.flowParseTypeParameterDeclaration();
  17589. } else {
  17590. node.typeParameters = null;
  17591. }
  17592. node.right = this.flowParseTypeInitialiser(types.eq);
  17593. this.semicolon();
  17594. return this.finishNode(node, "TypeAlias");
  17595. };
  17596. // Type annotations
  17597. pp$8.flowParseTypeParameter = function () {
  17598. var node = this.startNode();
  17599. var variance = this.flowParseVariance();
  17600. var ident = this.flowParseTypeAnnotatableIdentifier();
  17601. node.name = ident.name;
  17602. node.variance = variance;
  17603. node.bound = ident.typeAnnotation;
  17604. if (this.match(types.eq)) {
  17605. this.eat(types.eq);
  17606. node.default = this.flowParseType();
  17607. }
  17608. return this.finishNode(node, "TypeParameter");
  17609. };
  17610. pp$8.flowParseTypeParameterDeclaration = function () {
  17611. var oldInType = this.state.inType;
  17612. var node = this.startNode();
  17613. node.params = [];
  17614. this.state.inType = true;
  17615. // istanbul ignore else: this condition is already checked at all call sites
  17616. if (this.isRelational("<") || this.match(types.jsxTagStart)) {
  17617. this.next();
  17618. } else {
  17619. this.unexpected();
  17620. }
  17621. do {
  17622. node.params.push(this.flowParseTypeParameter());
  17623. if (!this.isRelational(">")) {
  17624. this.expect(types.comma);
  17625. }
  17626. } while (!this.isRelational(">"));
  17627. this.expectRelational(">");
  17628. this.state.inType = oldInType;
  17629. return this.finishNode(node, "TypeParameterDeclaration");
  17630. };
  17631. pp$8.flowParseTypeParameterInstantiation = function () {
  17632. var node = this.startNode();
  17633. var oldInType = this.state.inType;
  17634. node.params = [];
  17635. this.state.inType = true;
  17636. this.expectRelational("<");
  17637. while (!this.isRelational(">")) {
  17638. node.params.push(this.flowParseType());
  17639. if (!this.isRelational(">")) {
  17640. this.expect(types.comma);
  17641. }
  17642. }
  17643. this.expectRelational(">");
  17644. this.state.inType = oldInType;
  17645. return this.finishNode(node, "TypeParameterInstantiation");
  17646. };
  17647. pp$8.flowParseObjectPropertyKey = function () {
  17648. return this.match(types.num) || this.match(types.string) ? this.parseExprAtom() : this.parseIdentifier(true);
  17649. };
  17650. pp$8.flowParseObjectTypeIndexer = function (node, isStatic, variance) {
  17651. node.static = isStatic;
  17652. this.expect(types.bracketL);
  17653. if (this.lookahead().type === types.colon) {
  17654. node.id = this.flowParseObjectPropertyKey();
  17655. node.key = this.flowParseTypeInitialiser();
  17656. } else {
  17657. node.id = null;
  17658. node.key = this.flowParseType();
  17659. }
  17660. this.expect(types.bracketR);
  17661. node.value = this.flowParseTypeInitialiser();
  17662. node.variance = variance;
  17663. this.flowObjectTypeSemicolon();
  17664. return this.finishNode(node, "ObjectTypeIndexer");
  17665. };
  17666. pp$8.flowParseObjectTypeMethodish = function (node) {
  17667. node.params = [];
  17668. node.rest = null;
  17669. node.typeParameters = null;
  17670. if (this.isRelational("<")) {
  17671. node.typeParameters = this.flowParseTypeParameterDeclaration();
  17672. }
  17673. this.expect(types.parenL);
  17674. while (this.match(types.name)) {
  17675. node.params.push(this.flowParseFunctionTypeParam());
  17676. if (!this.match(types.parenR)) {
  17677. this.expect(types.comma);
  17678. }
  17679. }
  17680. if (this.eat(types.ellipsis)) {
  17681. node.rest = this.flowParseFunctionTypeParam();
  17682. }
  17683. this.expect(types.parenR);
  17684. node.returnType = this.flowParseTypeInitialiser();
  17685. return this.finishNode(node, "FunctionTypeAnnotation");
  17686. };
  17687. pp$8.flowParseObjectTypeMethod = function (startPos, startLoc, isStatic, key) {
  17688. var node = this.startNodeAt(startPos, startLoc);
  17689. node.value = this.flowParseObjectTypeMethodish(this.startNodeAt(startPos, startLoc));
  17690. node.static = isStatic;
  17691. node.key = key;
  17692. node.optional = false;
  17693. this.flowObjectTypeSemicolon();
  17694. return this.finishNode(node, "ObjectTypeProperty");
  17695. };
  17696. pp$8.flowParseObjectTypeCallProperty = function (node, isStatic) {
  17697. var valueNode = this.startNode();
  17698. node.static = isStatic;
  17699. node.value = this.flowParseObjectTypeMethodish(valueNode);
  17700. this.flowObjectTypeSemicolon();
  17701. return this.finishNode(node, "ObjectTypeCallProperty");
  17702. };
  17703. pp$8.flowParseObjectType = function (allowStatic, allowExact) {
  17704. var oldInType = this.state.inType;
  17705. this.state.inType = true;
  17706. var nodeStart = this.startNode();
  17707. var node = void 0;
  17708. var propertyKey = void 0;
  17709. var isStatic = false;
  17710. nodeStart.callProperties = [];
  17711. nodeStart.properties = [];
  17712. nodeStart.indexers = [];
  17713. var endDelim = void 0;
  17714. var exact = void 0;
  17715. if (allowExact && this.match(types.braceBarL)) {
  17716. this.expect(types.braceBarL);
  17717. endDelim = types.braceBarR;
  17718. exact = true;
  17719. } else {
  17720. this.expect(types.braceL);
  17721. endDelim = types.braceR;
  17722. exact = false;
  17723. }
  17724. nodeStart.exact = exact;
  17725. while (!this.match(endDelim)) {
  17726. var optional = false;
  17727. var startPos = this.state.start;
  17728. var startLoc = this.state.startLoc;
  17729. node = this.startNode();
  17730. if (allowStatic && this.isContextual("static") && this.lookahead().type !== types.colon) {
  17731. this.next();
  17732. isStatic = true;
  17733. }
  17734. var variancePos = this.state.start;
  17735. var variance = this.flowParseVariance();
  17736. if (this.match(types.bracketL)) {
  17737. nodeStart.indexers.push(this.flowParseObjectTypeIndexer(node, isStatic, variance));
  17738. } else if (this.match(types.parenL) || this.isRelational("<")) {
  17739. if (variance) {
  17740. this.unexpected(variancePos);
  17741. }
  17742. nodeStart.callProperties.push(this.flowParseObjectTypeCallProperty(node, isStatic));
  17743. } else {
  17744. propertyKey = this.flowParseObjectPropertyKey();
  17745. if (this.isRelational("<") || this.match(types.parenL)) {
  17746. // This is a method property
  17747. if (variance) {
  17748. this.unexpected(variancePos);
  17749. }
  17750. nodeStart.properties.push(this.flowParseObjectTypeMethod(startPos, startLoc, isStatic, propertyKey));
  17751. } else {
  17752. if (this.eat(types.question)) {
  17753. optional = true;
  17754. }
  17755. node.key = propertyKey;
  17756. node.value = this.flowParseTypeInitialiser();
  17757. node.optional = optional;
  17758. node.static = isStatic;
  17759. node.variance = variance;
  17760. this.flowObjectTypeSemicolon();
  17761. nodeStart.properties.push(this.finishNode(node, "ObjectTypeProperty"));
  17762. }
  17763. }
  17764. isStatic = false;
  17765. }
  17766. this.expect(endDelim);
  17767. var out = this.finishNode(nodeStart, "ObjectTypeAnnotation");
  17768. this.state.inType = oldInType;
  17769. return out;
  17770. };
  17771. pp$8.flowObjectTypeSemicolon = function () {
  17772. if (!this.eat(types.semi) && !this.eat(types.comma) && !this.match(types.braceR) && !this.match(types.braceBarR)) {
  17773. this.unexpected();
  17774. }
  17775. };
  17776. pp$8.flowParseQualifiedTypeIdentifier = function (startPos, startLoc, id) {
  17777. startPos = startPos || this.state.start;
  17778. startLoc = startLoc || this.state.startLoc;
  17779. var node = id || this.parseIdentifier();
  17780. while (this.eat(types.dot)) {
  17781. var node2 = this.startNodeAt(startPos, startLoc);
  17782. node2.qualification = node;
  17783. node2.id = this.parseIdentifier();
  17784. node = this.finishNode(node2, "QualifiedTypeIdentifier");
  17785. }
  17786. return node;
  17787. };
  17788. pp$8.flowParseGenericType = function (startPos, startLoc, id) {
  17789. var node = this.startNodeAt(startPos, startLoc);
  17790. node.typeParameters = null;
  17791. node.id = this.flowParseQualifiedTypeIdentifier(startPos, startLoc, id);
  17792. if (this.isRelational("<")) {
  17793. node.typeParameters = this.flowParseTypeParameterInstantiation();
  17794. }
  17795. return this.finishNode(node, "GenericTypeAnnotation");
  17796. };
  17797. pp$8.flowParseTypeofType = function () {
  17798. var node = this.startNode();
  17799. this.expect(types._typeof);
  17800. node.argument = this.flowParsePrimaryType();
  17801. return this.finishNode(node, "TypeofTypeAnnotation");
  17802. };
  17803. pp$8.flowParseTupleType = function () {
  17804. var node = this.startNode();
  17805. node.types = [];
  17806. this.expect(types.bracketL);
  17807. // We allow trailing commas
  17808. while (this.state.pos < this.input.length && !this.match(types.bracketR)) {
  17809. node.types.push(this.flowParseType());
  17810. if (this.match(types.bracketR)) break;
  17811. this.expect(types.comma);
  17812. }
  17813. this.expect(types.bracketR);
  17814. return this.finishNode(node, "TupleTypeAnnotation");
  17815. };
  17816. pp$8.flowParseFunctionTypeParam = function () {
  17817. var name = null;
  17818. var optional = false;
  17819. var typeAnnotation = null;
  17820. var node = this.startNode();
  17821. var lh = this.lookahead();
  17822. if (lh.type === types.colon || lh.type === types.question) {
  17823. name = this.parseIdentifier();
  17824. if (this.eat(types.question)) {
  17825. optional = true;
  17826. }
  17827. typeAnnotation = this.flowParseTypeInitialiser();
  17828. } else {
  17829. typeAnnotation = this.flowParseType();
  17830. }
  17831. node.name = name;
  17832. node.optional = optional;
  17833. node.typeAnnotation = typeAnnotation;
  17834. return this.finishNode(node, "FunctionTypeParam");
  17835. };
  17836. pp$8.reinterpretTypeAsFunctionTypeParam = function (type) {
  17837. var node = this.startNodeAt(type.start, type.loc);
  17838. node.name = null;
  17839. node.optional = false;
  17840. node.typeAnnotation = type;
  17841. return this.finishNode(node, "FunctionTypeParam");
  17842. };
  17843. pp$8.flowParseFunctionTypeParams = function () {
  17844. var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  17845. var ret = { params: params, rest: null };
  17846. while (!this.match(types.parenR) && !this.match(types.ellipsis)) {
  17847. ret.params.push(this.flowParseFunctionTypeParam());
  17848. if (!this.match(types.parenR)) {
  17849. this.expect(types.comma);
  17850. }
  17851. }
  17852. if (this.eat(types.ellipsis)) {
  17853. ret.rest = this.flowParseFunctionTypeParam();
  17854. }
  17855. return ret;
  17856. };
  17857. pp$8.flowIdentToTypeAnnotation = function (startPos, startLoc, node, id) {
  17858. switch (id.name) {
  17859. case "any":
  17860. return this.finishNode(node, "AnyTypeAnnotation");
  17861. case "void":
  17862. return this.finishNode(node, "VoidTypeAnnotation");
  17863. case "bool":
  17864. case "boolean":
  17865. return this.finishNode(node, "BooleanTypeAnnotation");
  17866. case "mixed":
  17867. return this.finishNode(node, "MixedTypeAnnotation");
  17868. case "empty":
  17869. return this.finishNode(node, "EmptyTypeAnnotation");
  17870. case "number":
  17871. return this.finishNode(node, "NumberTypeAnnotation");
  17872. case "string":
  17873. return this.finishNode(node, "StringTypeAnnotation");
  17874. default:
  17875. return this.flowParseGenericType(startPos, startLoc, id);
  17876. }
  17877. };
  17878. // The parsing of types roughly parallels the parsing of expressions, and
  17879. // primary types are kind of like primary expressions...they're the
  17880. // primitives with which other types are constructed.
  17881. pp$8.flowParsePrimaryType = function () {
  17882. var startPos = this.state.start;
  17883. var startLoc = this.state.startLoc;
  17884. var node = this.startNode();
  17885. var tmp = void 0;
  17886. var type = void 0;
  17887. var isGroupedType = false;
  17888. var oldNoAnonFunctionType = this.state.noAnonFunctionType;
  17889. switch (this.state.type) {
  17890. case types.name:
  17891. return this.flowIdentToTypeAnnotation(startPos, startLoc, node, this.parseIdentifier());
  17892. case types.braceL:
  17893. return this.flowParseObjectType(false, false);
  17894. case types.braceBarL:
  17895. return this.flowParseObjectType(false, true);
  17896. case types.bracketL:
  17897. return this.flowParseTupleType();
  17898. case types.relational:
  17899. if (this.state.value === "<") {
  17900. node.typeParameters = this.flowParseTypeParameterDeclaration();
  17901. this.expect(types.parenL);
  17902. tmp = this.flowParseFunctionTypeParams();
  17903. node.params = tmp.params;
  17904. node.rest = tmp.rest;
  17905. this.expect(types.parenR);
  17906. this.expect(types.arrow);
  17907. node.returnType = this.flowParseType();
  17908. return this.finishNode(node, "FunctionTypeAnnotation");
  17909. }
  17910. break;
  17911. case types.parenL:
  17912. this.next();
  17913. // Check to see if this is actually a grouped type
  17914. if (!this.match(types.parenR) && !this.match(types.ellipsis)) {
  17915. if (this.match(types.name)) {
  17916. var token = this.lookahead().type;
  17917. isGroupedType = token !== types.question && token !== types.colon;
  17918. } else {
  17919. isGroupedType = true;
  17920. }
  17921. }
  17922. if (isGroupedType) {
  17923. this.state.noAnonFunctionType = false;
  17924. type = this.flowParseType();
  17925. this.state.noAnonFunctionType = oldNoAnonFunctionType;
  17926. // A `,` or a `) =>` means this is an anonymous function type
  17927. if (this.state.noAnonFunctionType || !(this.match(types.comma) || this.match(types.parenR) && this.lookahead().type === types.arrow)) {
  17928. this.expect(types.parenR);
  17929. return type;
  17930. } else {
  17931. // Eat a comma if there is one
  17932. this.eat(types.comma);
  17933. }
  17934. }
  17935. if (type) {
  17936. tmp = this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(type)]);
  17937. } else {
  17938. tmp = this.flowParseFunctionTypeParams();
  17939. }
  17940. node.params = tmp.params;
  17941. node.rest = tmp.rest;
  17942. this.expect(types.parenR);
  17943. this.expect(types.arrow);
  17944. node.returnType = this.flowParseType();
  17945. node.typeParameters = null;
  17946. return this.finishNode(node, "FunctionTypeAnnotation");
  17947. case types.string:
  17948. return this.parseLiteral(this.state.value, "StringLiteralTypeAnnotation");
  17949. case types._true:case types._false:
  17950. node.value = this.match(types._true);
  17951. this.next();
  17952. return this.finishNode(node, "BooleanLiteralTypeAnnotation");
  17953. case types.plusMin:
  17954. if (this.state.value === "-") {
  17955. this.next();
  17956. if (!this.match(types.num)) this.unexpected(null, "Unexpected token, expected number");
  17957. return this.parseLiteral(-this.state.value, "NumericLiteralTypeAnnotation", node.start, node.loc.start);
  17958. }
  17959. this.unexpected();
  17960. case types.num:
  17961. return this.parseLiteral(this.state.value, "NumericLiteralTypeAnnotation");
  17962. case types._null:
  17963. node.value = this.match(types._null);
  17964. this.next();
  17965. return this.finishNode(node, "NullLiteralTypeAnnotation");
  17966. case types._this:
  17967. node.value = this.match(types._this);
  17968. this.next();
  17969. return this.finishNode(node, "ThisTypeAnnotation");
  17970. case types.star:
  17971. this.next();
  17972. return this.finishNode(node, "ExistentialTypeParam");
  17973. default:
  17974. if (this.state.type.keyword === "typeof") {
  17975. return this.flowParseTypeofType();
  17976. }
  17977. }
  17978. this.unexpected();
  17979. };
  17980. pp$8.flowParsePostfixType = function () {
  17981. var startPos = this.state.start,
  17982. startLoc = this.state.startLoc;
  17983. var type = this.flowParsePrimaryType();
  17984. while (!this.canInsertSemicolon() && this.match(types.bracketL)) {
  17985. var node = this.startNodeAt(startPos, startLoc);
  17986. node.elementType = type;
  17987. this.expect(types.bracketL);
  17988. this.expect(types.bracketR);
  17989. type = this.finishNode(node, "ArrayTypeAnnotation");
  17990. }
  17991. return type;
  17992. };
  17993. pp$8.flowParsePrefixType = function () {
  17994. var node = this.startNode();
  17995. if (this.eat(types.question)) {
  17996. node.typeAnnotation = this.flowParsePrefixType();
  17997. return this.finishNode(node, "NullableTypeAnnotation");
  17998. } else {
  17999. return this.flowParsePostfixType();
  18000. }
  18001. };
  18002. pp$8.flowParseAnonFunctionWithoutParens = function () {
  18003. var param = this.flowParsePrefixType();
  18004. if (!this.state.noAnonFunctionType && this.eat(types.arrow)) {
  18005. var node = this.startNodeAt(param.start, param.loc);
  18006. node.params = [this.reinterpretTypeAsFunctionTypeParam(param)];
  18007. node.rest = null;
  18008. node.returnType = this.flowParseType();
  18009. node.typeParameters = null;
  18010. return this.finishNode(node, "FunctionTypeAnnotation");
  18011. }
  18012. return param;
  18013. };
  18014. pp$8.flowParseIntersectionType = function () {
  18015. var node = this.startNode();
  18016. this.eat(types.bitwiseAND);
  18017. var type = this.flowParseAnonFunctionWithoutParens();
  18018. node.types = [type];
  18019. while (this.eat(types.bitwiseAND)) {
  18020. node.types.push(this.flowParseAnonFunctionWithoutParens());
  18021. }
  18022. return node.types.length === 1 ? type : this.finishNode(node, "IntersectionTypeAnnotation");
  18023. };
  18024. pp$8.flowParseUnionType = function () {
  18025. var node = this.startNode();
  18026. this.eat(types.bitwiseOR);
  18027. var type = this.flowParseIntersectionType();
  18028. node.types = [type];
  18029. while (this.eat(types.bitwiseOR)) {
  18030. node.types.push(this.flowParseIntersectionType());
  18031. }
  18032. return node.types.length === 1 ? type : this.finishNode(node, "UnionTypeAnnotation");
  18033. };
  18034. pp$8.flowParseType = function () {
  18035. var oldInType = this.state.inType;
  18036. this.state.inType = true;
  18037. var type = this.flowParseUnionType();
  18038. this.state.inType = oldInType;
  18039. return type;
  18040. };
  18041. pp$8.flowParseTypeAnnotation = function () {
  18042. var node = this.startNode();
  18043. node.typeAnnotation = this.flowParseTypeInitialiser();
  18044. return this.finishNode(node, "TypeAnnotation");
  18045. };
  18046. pp$8.flowParseTypeAndPredicateAnnotation = function () {
  18047. var node = this.startNode();
  18048. var _flowParseTypeAndPred2 = this.flowParseTypeAndPredicateInitialiser();
  18049. node.typeAnnotation = _flowParseTypeAndPred2[0];
  18050. node.predicate = _flowParseTypeAndPred2[1];
  18051. return this.finishNode(node, "TypeAnnotation");
  18052. };
  18053. pp$8.flowParseTypeAnnotatableIdentifier = function () {
  18054. var ident = this.flowParseRestrictedIdentifier();
  18055. if (this.match(types.colon)) {
  18056. ident.typeAnnotation = this.flowParseTypeAnnotation();
  18057. this.finishNode(ident, ident.type);
  18058. }
  18059. return ident;
  18060. };
  18061. pp$8.typeCastToParameter = function (node) {
  18062. node.expression.typeAnnotation = node.typeAnnotation;
  18063. return this.finishNodeAt(node.expression, node.expression.type, node.typeAnnotation.end, node.typeAnnotation.loc.end);
  18064. };
  18065. pp$8.flowParseVariance = function () {
  18066. var variance = null;
  18067. if (this.match(types.plusMin)) {
  18068. if (this.state.value === "+") {
  18069. variance = "plus";
  18070. } else if (this.state.value === "-") {
  18071. variance = "minus";
  18072. }
  18073. this.next();
  18074. }
  18075. return variance;
  18076. };
  18077. var flowPlugin = function (instance) {
  18078. // plain function return types: function name(): string {}
  18079. instance.extend("parseFunctionBody", function (inner) {
  18080. return function (node, allowExpression) {
  18081. if (this.match(types.colon) && !allowExpression) {
  18082. // if allowExpression is true then we're parsing an arrow function and if
  18083. // there's a return type then it's been handled elsewhere
  18084. node.returnType = this.flowParseTypeAndPredicateAnnotation();
  18085. }
  18086. return inner.call(this, node, allowExpression);
  18087. };
  18088. });
  18089. // interfaces
  18090. instance.extend("parseStatement", function (inner) {
  18091. return function (declaration, topLevel) {
  18092. // strict mode handling of `interface` since it's a reserved word
  18093. if (this.state.strict && this.match(types.name) && this.state.value === "interface") {
  18094. var node = this.startNode();
  18095. this.next();
  18096. return this.flowParseInterface(node);
  18097. } else {
  18098. return inner.call(this, declaration, topLevel);
  18099. }
  18100. };
  18101. });
  18102. // declares, interfaces and type aliases
  18103. instance.extend("parseExpressionStatement", function (inner) {
  18104. return function (node, expr) {
  18105. if (expr.type === "Identifier") {
  18106. if (expr.name === "declare") {
  18107. if (this.match(types._class) || this.match(types.name) || this.match(types._function) || this.match(types._var)) {
  18108. return this.flowParseDeclare(node);
  18109. }
  18110. } else if (this.match(types.name)) {
  18111. if (expr.name === "interface") {
  18112. return this.flowParseInterface(node);
  18113. } else if (expr.name === "type") {
  18114. return this.flowParseTypeAlias(node);
  18115. }
  18116. }
  18117. }
  18118. return inner.call(this, node, expr);
  18119. };
  18120. });
  18121. // export type
  18122. instance.extend("shouldParseExportDeclaration", function (inner) {
  18123. return function () {
  18124. return this.isContextual("type") || this.isContextual("interface") || inner.call(this);
  18125. };
  18126. });
  18127. instance.extend("parseConditional", function (inner) {
  18128. return function (expr, noIn, startPos, startLoc, refNeedsArrowPos) {
  18129. // only do the expensive clone if there is a question mark
  18130. // and if we come from inside parens
  18131. if (refNeedsArrowPos && this.match(types.question)) {
  18132. var state = this.state.clone();
  18133. try {
  18134. return inner.call(this, expr, noIn, startPos, startLoc);
  18135. } catch (err) {
  18136. if (err instanceof SyntaxError) {
  18137. this.state = state;
  18138. refNeedsArrowPos.start = err.pos || this.state.start;
  18139. return expr;
  18140. } else {
  18141. // istanbul ignore next: no such error is expected
  18142. throw err;
  18143. }
  18144. }
  18145. }
  18146. return inner.call(this, expr, noIn, startPos, startLoc);
  18147. };
  18148. });
  18149. instance.extend("parseParenItem", function (inner) {
  18150. return function (node, startLoc, startPos) {
  18151. node = inner.call(this, node, startLoc, startPos);
  18152. if (this.eat(types.question)) {
  18153. node.optional = true;
  18154. }
  18155. if (this.match(types.colon)) {
  18156. var typeCastNode = this.startNodeAt(startLoc, startPos);
  18157. typeCastNode.expression = node;
  18158. typeCastNode.typeAnnotation = this.flowParseTypeAnnotation();
  18159. return this.finishNode(typeCastNode, "TypeCastExpression");
  18160. }
  18161. return node;
  18162. };
  18163. });
  18164. instance.extend("parseExport", function (inner) {
  18165. return function (node) {
  18166. node = inner.call(this, node);
  18167. if (node.type === "ExportNamedDeclaration") {
  18168. node.exportKind = node.exportKind || "value";
  18169. }
  18170. return node;
  18171. };
  18172. });
  18173. instance.extend("parseExportDeclaration", function (inner) {
  18174. return function (node) {
  18175. if (this.isContextual("type")) {
  18176. node.exportKind = "type";
  18177. var declarationNode = this.startNode();
  18178. this.next();
  18179. if (this.match(types.braceL)) {
  18180. // export type { foo, bar };
  18181. node.specifiers = this.parseExportSpecifiers();
  18182. this.parseExportFrom(node);
  18183. return null;
  18184. } else {
  18185. // export type Foo = Bar;
  18186. return this.flowParseTypeAlias(declarationNode);
  18187. }
  18188. } else if (this.isContextual("interface")) {
  18189. node.exportKind = "type";
  18190. var _declarationNode = this.startNode();
  18191. this.next();
  18192. return this.flowParseInterface(_declarationNode);
  18193. } else {
  18194. return inner.call(this, node);
  18195. }
  18196. };
  18197. });
  18198. instance.extend("parseClassId", function (inner) {
  18199. return function (node) {
  18200. inner.apply(this, arguments);
  18201. if (this.isRelational("<")) {
  18202. node.typeParameters = this.flowParseTypeParameterDeclaration();
  18203. }
  18204. };
  18205. });
  18206. // don't consider `void` to be a keyword as then it'll use the void token type
  18207. // and set startExpr
  18208. instance.extend("isKeyword", function (inner) {
  18209. return function (name) {
  18210. if (this.state.inType && name === "void") {
  18211. return false;
  18212. } else {
  18213. return inner.call(this, name);
  18214. }
  18215. };
  18216. });
  18217. // ensure that inside flow types, we bypass the jsx parser plugin
  18218. instance.extend("readToken", function (inner) {
  18219. return function (code) {
  18220. if (this.state.inType && (code === 62 || code === 60)) {
  18221. return this.finishOp(types.relational, 1);
  18222. } else {
  18223. return inner.call(this, code);
  18224. }
  18225. };
  18226. });
  18227. // don't lex any token as a jsx one inside a flow type
  18228. instance.extend("jsx_readToken", function (inner) {
  18229. return function () {
  18230. if (!this.state.inType) return inner.call(this);
  18231. };
  18232. });
  18233. instance.extend("toAssignable", function (inner) {
  18234. return function (node, isBinding, contextDescription) {
  18235. if (node.type === "TypeCastExpression") {
  18236. return inner.call(this, this.typeCastToParameter(node), isBinding, contextDescription);
  18237. } else {
  18238. return inner.call(this, node, isBinding, contextDescription);
  18239. }
  18240. };
  18241. });
  18242. // turn type casts that we found in function parameter head into type annotated params
  18243. instance.extend("toAssignableList", function (inner) {
  18244. return function (exprList, isBinding, contextDescription) {
  18245. for (var i = 0; i < exprList.length; i++) {
  18246. var expr = exprList[i];
  18247. if (expr && expr.type === "TypeCastExpression") {
  18248. exprList[i] = this.typeCastToParameter(expr);
  18249. }
  18250. }
  18251. return inner.call(this, exprList, isBinding, contextDescription);
  18252. };
  18253. });
  18254. // this is a list of nodes, from something like a call expression, we need to filter the
  18255. // type casts that we've found that are illegal in this context
  18256. instance.extend("toReferencedList", function () {
  18257. return function (exprList) {
  18258. for (var i = 0; i < exprList.length; i++) {
  18259. var expr = exprList[i];
  18260. if (expr && expr._exprListItem && expr.type === "TypeCastExpression") {
  18261. this.raise(expr.start, "Unexpected type cast");
  18262. }
  18263. }
  18264. return exprList;
  18265. };
  18266. });
  18267. // parse an item inside a expression list eg. `(NODE, NODE)` where NODE represents
  18268. // the position where this function is called
  18269. instance.extend("parseExprListItem", function (inner) {
  18270. return function () {
  18271. var container = this.startNode();
  18272. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  18273. args[_key] = arguments[_key];
  18274. }
  18275. var node = inner.call.apply(inner, [this].concat(args));
  18276. if (this.match(types.colon)) {
  18277. container._exprListItem = true;
  18278. container.expression = node;
  18279. container.typeAnnotation = this.flowParseTypeAnnotation();
  18280. return this.finishNode(container, "TypeCastExpression");
  18281. } else {
  18282. return node;
  18283. }
  18284. };
  18285. });
  18286. instance.extend("checkLVal", function (inner) {
  18287. return function (node) {
  18288. if (node.type !== "TypeCastExpression") {
  18289. return inner.apply(this, arguments);
  18290. }
  18291. };
  18292. });
  18293. // parse class property type annotations
  18294. instance.extend("parseClassProperty", function (inner) {
  18295. return function (node) {
  18296. delete node.variancePos;
  18297. if (this.match(types.colon)) {
  18298. node.typeAnnotation = this.flowParseTypeAnnotation();
  18299. }
  18300. return inner.call(this, node);
  18301. };
  18302. });
  18303. // determine whether or not we're currently in the position where a class property would appear
  18304. instance.extend("isClassProperty", function (inner) {
  18305. return function () {
  18306. return this.match(types.colon) || inner.call(this);
  18307. };
  18308. });
  18309. // parse type parameters for class methods
  18310. instance.extend("parseClassMethod", function (inner) {
  18311. return function (classBody, method) {
  18312. if (method.variance) {
  18313. this.unexpected(method.variancePos);
  18314. }
  18315. delete method.variance;
  18316. delete method.variancePos;
  18317. if (this.isRelational("<")) {
  18318. method.typeParameters = this.flowParseTypeParameterDeclaration();
  18319. }
  18320. for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
  18321. args[_key2 - 2] = arguments[_key2];
  18322. }
  18323. inner.call.apply(inner, [this, classBody, method].concat(args));
  18324. };
  18325. });
  18326. // parse a the super class type parameters and implements
  18327. instance.extend("parseClassSuper", function (inner) {
  18328. return function (node, isStatement) {
  18329. inner.call(this, node, isStatement);
  18330. if (node.superClass && this.isRelational("<")) {
  18331. node.superTypeParameters = this.flowParseTypeParameterInstantiation();
  18332. }
  18333. if (this.isContextual("implements")) {
  18334. this.next();
  18335. var implemented = node.implements = [];
  18336. do {
  18337. var _node = this.startNode();
  18338. _node.id = this.parseIdentifier();
  18339. if (this.isRelational("<")) {
  18340. _node.typeParameters = this.flowParseTypeParameterInstantiation();
  18341. } else {
  18342. _node.typeParameters = null;
  18343. }
  18344. implemented.push(this.finishNode(_node, "ClassImplements"));
  18345. } while (this.eat(types.comma));
  18346. }
  18347. };
  18348. });
  18349. instance.extend("parsePropertyName", function (inner) {
  18350. return function (node) {
  18351. var variancePos = this.state.start;
  18352. var variance = this.flowParseVariance();
  18353. var key = inner.call(this, node);
  18354. node.variance = variance;
  18355. node.variancePos = variancePos;
  18356. return key;
  18357. };
  18358. });
  18359. // parse type parameters for object method shorthand
  18360. instance.extend("parseObjPropValue", function (inner) {
  18361. return function (prop) {
  18362. if (prop.variance) {
  18363. this.unexpected(prop.variancePos);
  18364. }
  18365. delete prop.variance;
  18366. delete prop.variancePos;
  18367. var typeParameters = void 0;
  18368. // method shorthand
  18369. if (this.isRelational("<")) {
  18370. typeParameters = this.flowParseTypeParameterDeclaration();
  18371. if (!this.match(types.parenL)) this.unexpected();
  18372. }
  18373. inner.apply(this, arguments);
  18374. // add typeParameters if we found them
  18375. if (typeParameters) {
  18376. (prop.value || prop).typeParameters = typeParameters;
  18377. }
  18378. };
  18379. });
  18380. instance.extend("parseAssignableListItemTypes", function () {
  18381. return function (param) {
  18382. if (this.eat(types.question)) {
  18383. param.optional = true;
  18384. }
  18385. if (this.match(types.colon)) {
  18386. param.typeAnnotation = this.flowParseTypeAnnotation();
  18387. }
  18388. this.finishNode(param, param.type);
  18389. return param;
  18390. };
  18391. });
  18392. instance.extend("parseMaybeDefault", function (inner) {
  18393. return function () {
  18394. for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  18395. args[_key3] = arguments[_key3];
  18396. }
  18397. var node = inner.apply(this, args);
  18398. if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) {
  18399. this.raise(node.typeAnnotation.start, "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`");
  18400. }
  18401. return node;
  18402. };
  18403. });
  18404. // parse typeof and type imports
  18405. instance.extend("parseImportSpecifiers", function (inner) {
  18406. return function (node) {
  18407. node.importKind = "value";
  18408. var kind = null;
  18409. if (this.match(types._typeof)) {
  18410. kind = "typeof";
  18411. } else if (this.isContextual("type")) {
  18412. kind = "type";
  18413. }
  18414. if (kind) {
  18415. var lh = this.lookahead();
  18416. if (lh.type === types.name && lh.value !== "from" || lh.type === types.braceL || lh.type === types.star) {
  18417. this.next();
  18418. node.importKind = kind;
  18419. }
  18420. }
  18421. inner.call(this, node);
  18422. };
  18423. });
  18424. // parse import-type/typeof shorthand
  18425. instance.extend("parseImportSpecifier", function () {
  18426. return function (node) {
  18427. var specifier = this.startNode();
  18428. var firstIdentLoc = this.state.start;
  18429. var firstIdent = this.parseIdentifier(true);
  18430. var specifierTypeKind = null;
  18431. if (firstIdent.name === "type") {
  18432. specifierTypeKind = "type";
  18433. } else if (firstIdent.name === "typeof") {
  18434. specifierTypeKind = "typeof";
  18435. }
  18436. var isBinding = false;
  18437. if (this.isContextual("as")) {
  18438. var as_ident = this.parseIdentifier(true);
  18439. if (specifierTypeKind !== null && !this.match(types.name) && !this.state.type.keyword) {
  18440. // `import {type as ,` or `import {type as }`
  18441. specifier.imported = as_ident;
  18442. specifier.importKind = specifierTypeKind;
  18443. specifier.local = as_ident.__clone();
  18444. } else {
  18445. // `import {type as foo`
  18446. specifier.imported = firstIdent;
  18447. specifier.importKind = null;
  18448. specifier.local = this.parseIdentifier();
  18449. }
  18450. } else if (specifierTypeKind !== null && (this.match(types.name) || this.state.type.keyword)) {
  18451. // `import {type foo`
  18452. specifier.imported = this.parseIdentifier(true);
  18453. specifier.importKind = specifierTypeKind;
  18454. if (this.eatContextual("as")) {
  18455. specifier.local = this.parseIdentifier();
  18456. } else {
  18457. isBinding = true;
  18458. specifier.local = specifier.imported.__clone();
  18459. }
  18460. } else {
  18461. isBinding = true;
  18462. specifier.imported = firstIdent;
  18463. specifier.importKind = null;
  18464. specifier.local = specifier.imported.__clone();
  18465. }
  18466. if ((node.importKind === "type" || node.importKind === "typeof") && (specifier.importKind === "type" || specifier.importKind === "typeof")) {
  18467. this.raise(firstIdentLoc, "`The `type` and `typeof` keywords on named imports can only be used on regular `import` statements. It cannot be used with `import type` or `import typeof` statements`");
  18468. }
  18469. if (isBinding) this.checkReservedWord(specifier.local.name, specifier.start, true, true);
  18470. this.checkLVal(specifier.local, true, undefined, "import specifier");
  18471. node.specifiers.push(this.finishNode(specifier, "ImportSpecifier"));
  18472. };
  18473. });
  18474. // parse function type parameters - function foo<T>() {}
  18475. instance.extend("parseFunctionParams", function (inner) {
  18476. return function (node) {
  18477. if (this.isRelational("<")) {
  18478. node.typeParameters = this.flowParseTypeParameterDeclaration();
  18479. }
  18480. inner.call(this, node);
  18481. };
  18482. });
  18483. // parse flow type annotations on variable declarator heads - let foo: string = bar
  18484. instance.extend("parseVarHead", function (inner) {
  18485. return function (decl) {
  18486. inner.call(this, decl);
  18487. if (this.match(types.colon)) {
  18488. decl.id.typeAnnotation = this.flowParseTypeAnnotation();
  18489. this.finishNode(decl.id, decl.id.type);
  18490. }
  18491. };
  18492. });
  18493. // parse the return type of an async arrow function - let foo = (async (): number => {});
  18494. instance.extend("parseAsyncArrowFromCallExpression", function (inner) {
  18495. return function (node, call) {
  18496. if (this.match(types.colon)) {
  18497. var oldNoAnonFunctionType = this.state.noAnonFunctionType;
  18498. this.state.noAnonFunctionType = true;
  18499. node.returnType = this.flowParseTypeAnnotation();
  18500. this.state.noAnonFunctionType = oldNoAnonFunctionType;
  18501. }
  18502. return inner.call(this, node, call);
  18503. };
  18504. });
  18505. // todo description
  18506. instance.extend("shouldParseAsyncArrow", function (inner) {
  18507. return function () {
  18508. return this.match(types.colon) || inner.call(this);
  18509. };
  18510. });
  18511. // We need to support type parameter declarations for arrow functions. This
  18512. // is tricky. There are three situations we need to handle
  18513. //
  18514. // 1. This is either JSX or an arrow function. We'll try JSX first. If that
  18515. // fails, we'll try an arrow function. If that fails, we'll throw the JSX
  18516. // error.
  18517. // 2. This is an arrow function. We'll parse the type parameter declaration,
  18518. // parse the rest, make sure the rest is an arrow function, and go from
  18519. // there
  18520. // 3. This is neither. Just call the inner function
  18521. instance.extend("parseMaybeAssign", function (inner) {
  18522. return function () {
  18523. var jsxError = null;
  18524. for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  18525. args[_key4] = arguments[_key4];
  18526. }
  18527. if (types.jsxTagStart && this.match(types.jsxTagStart)) {
  18528. var state = this.state.clone();
  18529. try {
  18530. return inner.apply(this, args);
  18531. } catch (err) {
  18532. if (err instanceof SyntaxError) {
  18533. this.state = state;
  18534. jsxError = err;
  18535. } else {
  18536. // istanbul ignore next: no such error is expected
  18537. throw err;
  18538. }
  18539. }
  18540. }
  18541. // Need to push something onto the context to stop
  18542. // the JSX plugin from messing with the tokens
  18543. this.state.context.push(types$1.parenExpression);
  18544. if (jsxError != null || this.isRelational("<")) {
  18545. var arrowExpression = void 0;
  18546. var typeParameters = void 0;
  18547. try {
  18548. typeParameters = this.flowParseTypeParameterDeclaration();
  18549. arrowExpression = inner.apply(this, args);
  18550. arrowExpression.typeParameters = typeParameters;
  18551. arrowExpression.start = typeParameters.start;
  18552. arrowExpression.loc.start = typeParameters.loc.start;
  18553. } catch (err) {
  18554. throw jsxError || err;
  18555. }
  18556. if (arrowExpression.type === "ArrowFunctionExpression") {
  18557. return arrowExpression;
  18558. } else if (jsxError != null) {
  18559. throw jsxError;
  18560. } else {
  18561. this.raise(typeParameters.start, "Expected an arrow function after this type parameter declaration");
  18562. }
  18563. }
  18564. this.state.context.pop();
  18565. return inner.apply(this, args);
  18566. };
  18567. });
  18568. // handle return types for arrow functions
  18569. instance.extend("parseArrow", function (inner) {
  18570. return function (node) {
  18571. if (this.match(types.colon)) {
  18572. var state = this.state.clone();
  18573. try {
  18574. var oldNoAnonFunctionType = this.state.noAnonFunctionType;
  18575. this.state.noAnonFunctionType = true;
  18576. var returnType = this.flowParseTypeAndPredicateAnnotation();
  18577. this.state.noAnonFunctionType = oldNoAnonFunctionType;
  18578. if (this.canInsertSemicolon()) this.unexpected();
  18579. if (!this.match(types.arrow)) this.unexpected();
  18580. // assign after it is clear it is an arrow
  18581. node.returnType = returnType;
  18582. } catch (err) {
  18583. if (err instanceof SyntaxError) {
  18584. this.state = state;
  18585. } else {
  18586. // istanbul ignore next: no such error is expected
  18587. throw err;
  18588. }
  18589. }
  18590. }
  18591. return inner.call(this, node);
  18592. };
  18593. });
  18594. instance.extend("shouldParseArrow", function (inner) {
  18595. return function () {
  18596. return this.match(types.colon) || inner.call(this);
  18597. };
  18598. });
  18599. instance.extend("isClassMutatorStarter", function (inner) {
  18600. return function () {
  18601. if (this.isRelational("<")) {
  18602. return true;
  18603. } else {
  18604. return inner.call(this);
  18605. }
  18606. };
  18607. });
  18608. };
  18609. // Adapted from String.fromcodepoint to export the function without modifying String
  18610. /*! https://mths.be/fromcodepoint v0.2.1 by @mathias */
  18611. // The MIT License (MIT)
  18612. // Copyright (c) Mathias Bynens
  18613. //
  18614. // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
  18615. // associated documentation files (the "Software"), to deal in the Software without restriction,
  18616. // including without limitation the rights to use, copy, modify, merge, publish, distribute,
  18617. // sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
  18618. // furnished to do so, subject to the following conditions:
  18619. //
  18620. // The above copyright notice and this permission notice shall be included in all copies or
  18621. // substantial portions of the Software.
  18622. //
  18623. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
  18624. // NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  18625. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  18626. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18627. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  18628. var fromCodePoint = String.fromCodePoint;
  18629. if (!fromCodePoint) {
  18630. var stringFromCharCode = String.fromCharCode;
  18631. var floor = Math.floor;
  18632. fromCodePoint = function fromCodePoint() {
  18633. var MAX_SIZE = 0x4000;
  18634. var codeUnits = [];
  18635. var highSurrogate = void 0;
  18636. var lowSurrogate = void 0;
  18637. var index = -1;
  18638. var length = arguments.length;
  18639. if (!length) {
  18640. return "";
  18641. }
  18642. var result = "";
  18643. while (++index < length) {
  18644. var codePoint = Number(arguments[index]);
  18645. if (!isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`
  18646. codePoint < 0 || // not a valid Unicode code point
  18647. codePoint > 0x10FFFF || // not a valid Unicode code point
  18648. floor(codePoint) != codePoint // not an integer
  18649. ) {
  18650. throw RangeError("Invalid code point: " + codePoint);
  18651. }
  18652. if (codePoint <= 0xFFFF) {
  18653. // BMP code point
  18654. codeUnits.push(codePoint);
  18655. } else {
  18656. // Astral code point; split in surrogate halves
  18657. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  18658. codePoint -= 0x10000;
  18659. highSurrogate = (codePoint >> 10) + 0xD800;
  18660. lowSurrogate = codePoint % 0x400 + 0xDC00;
  18661. codeUnits.push(highSurrogate, lowSurrogate);
  18662. }
  18663. if (index + 1 == length || codeUnits.length > MAX_SIZE) {
  18664. result += stringFromCharCode.apply(null, codeUnits);
  18665. codeUnits.length = 0;
  18666. }
  18667. }
  18668. return result;
  18669. };
  18670. }
  18671. var fromCodePoint$1 = fromCodePoint;
  18672. var XHTMLEntities = {
  18673. quot: "\"",
  18674. amp: "&",
  18675. apos: "'",
  18676. lt: "<",
  18677. gt: ">",
  18678. nbsp: "\xA0",
  18679. iexcl: "\xA1",
  18680. cent: "\xA2",
  18681. pound: "\xA3",
  18682. curren: "\xA4",
  18683. yen: "\xA5",
  18684. brvbar: "\xA6",
  18685. sect: "\xA7",
  18686. uml: "\xA8",
  18687. copy: "\xA9",
  18688. ordf: "\xAA",
  18689. laquo: "\xAB",
  18690. not: "\xAC",
  18691. shy: "\xAD",
  18692. reg: "\xAE",
  18693. macr: "\xAF",
  18694. deg: "\xB0",
  18695. plusmn: "\xB1",
  18696. sup2: "\xB2",
  18697. sup3: "\xB3",
  18698. acute: "\xB4",
  18699. micro: "\xB5",
  18700. para: "\xB6",
  18701. middot: "\xB7",
  18702. cedil: "\xB8",
  18703. sup1: "\xB9",
  18704. ordm: "\xBA",
  18705. raquo: "\xBB",
  18706. frac14: "\xBC",
  18707. frac12: "\xBD",
  18708. frac34: "\xBE",
  18709. iquest: "\xBF",
  18710. Agrave: "\xC0",
  18711. Aacute: "\xC1",
  18712. Acirc: "\xC2",
  18713. Atilde: "\xC3",
  18714. Auml: "\xC4",
  18715. Aring: "\xC5",
  18716. AElig: "\xC6",
  18717. Ccedil: "\xC7",
  18718. Egrave: "\xC8",
  18719. Eacute: "\xC9",
  18720. Ecirc: "\xCA",
  18721. Euml: "\xCB",
  18722. Igrave: "\xCC",
  18723. Iacute: "\xCD",
  18724. Icirc: "\xCE",
  18725. Iuml: "\xCF",
  18726. ETH: "\xD0",
  18727. Ntilde: "\xD1",
  18728. Ograve: "\xD2",
  18729. Oacute: "\xD3",
  18730. Ocirc: "\xD4",
  18731. Otilde: "\xD5",
  18732. Ouml: "\xD6",
  18733. times: "\xD7",
  18734. Oslash: "\xD8",
  18735. Ugrave: "\xD9",
  18736. Uacute: "\xDA",
  18737. Ucirc: "\xDB",
  18738. Uuml: "\xDC",
  18739. Yacute: "\xDD",
  18740. THORN: "\xDE",
  18741. szlig: "\xDF",
  18742. agrave: "\xE0",
  18743. aacute: "\xE1",
  18744. acirc: "\xE2",
  18745. atilde: "\xE3",
  18746. auml: "\xE4",
  18747. aring: "\xE5",
  18748. aelig: "\xE6",
  18749. ccedil: "\xE7",
  18750. egrave: "\xE8",
  18751. eacute: "\xE9",
  18752. ecirc: "\xEA",
  18753. euml: "\xEB",
  18754. igrave: "\xEC",
  18755. iacute: "\xED",
  18756. icirc: "\xEE",
  18757. iuml: "\xEF",
  18758. eth: "\xF0",
  18759. ntilde: "\xF1",
  18760. ograve: "\xF2",
  18761. oacute: "\xF3",
  18762. ocirc: "\xF4",
  18763. otilde: "\xF5",
  18764. ouml: "\xF6",
  18765. divide: "\xF7",
  18766. oslash: "\xF8",
  18767. ugrave: "\xF9",
  18768. uacute: "\xFA",
  18769. ucirc: "\xFB",
  18770. uuml: "\xFC",
  18771. yacute: "\xFD",
  18772. thorn: "\xFE",
  18773. yuml: "\xFF",
  18774. OElig: "\u0152",
  18775. oelig: "\u0153",
  18776. Scaron: "\u0160",
  18777. scaron: "\u0161",
  18778. Yuml: "\u0178",
  18779. fnof: "\u0192",
  18780. circ: "\u02C6",
  18781. tilde: "\u02DC",
  18782. Alpha: "\u0391",
  18783. Beta: "\u0392",
  18784. Gamma: "\u0393",
  18785. Delta: "\u0394",
  18786. Epsilon: "\u0395",
  18787. Zeta: "\u0396",
  18788. Eta: "\u0397",
  18789. Theta: "\u0398",
  18790. Iota: "\u0399",
  18791. Kappa: "\u039A",
  18792. Lambda: "\u039B",
  18793. Mu: "\u039C",
  18794. Nu: "\u039D",
  18795. Xi: "\u039E",
  18796. Omicron: "\u039F",
  18797. Pi: "\u03A0",
  18798. Rho: "\u03A1",
  18799. Sigma: "\u03A3",
  18800. Tau: "\u03A4",
  18801. Upsilon: "\u03A5",
  18802. Phi: "\u03A6",
  18803. Chi: "\u03A7",
  18804. Psi: "\u03A8",
  18805. Omega: "\u03A9",
  18806. alpha: "\u03B1",
  18807. beta: "\u03B2",
  18808. gamma: "\u03B3",
  18809. delta: "\u03B4",
  18810. epsilon: "\u03B5",
  18811. zeta: "\u03B6",
  18812. eta: "\u03B7",
  18813. theta: "\u03B8",
  18814. iota: "\u03B9",
  18815. kappa: "\u03BA",
  18816. lambda: "\u03BB",
  18817. mu: "\u03BC",
  18818. nu: "\u03BD",
  18819. xi: "\u03BE",
  18820. omicron: "\u03BF",
  18821. pi: "\u03C0",
  18822. rho: "\u03C1",
  18823. sigmaf: "\u03C2",
  18824. sigma: "\u03C3",
  18825. tau: "\u03C4",
  18826. upsilon: "\u03C5",
  18827. phi: "\u03C6",
  18828. chi: "\u03C7",
  18829. psi: "\u03C8",
  18830. omega: "\u03C9",
  18831. thetasym: "\u03D1",
  18832. upsih: "\u03D2",
  18833. piv: "\u03D6",
  18834. ensp: "\u2002",
  18835. emsp: "\u2003",
  18836. thinsp: "\u2009",
  18837. zwnj: "\u200C",
  18838. zwj: "\u200D",
  18839. lrm: "\u200E",
  18840. rlm: "\u200F",
  18841. ndash: "\u2013",
  18842. mdash: "\u2014",
  18843. lsquo: "\u2018",
  18844. rsquo: "\u2019",
  18845. sbquo: "\u201A",
  18846. ldquo: "\u201C",
  18847. rdquo: "\u201D",
  18848. bdquo: "\u201E",
  18849. dagger: "\u2020",
  18850. Dagger: "\u2021",
  18851. bull: "\u2022",
  18852. hellip: "\u2026",
  18853. permil: "\u2030",
  18854. prime: "\u2032",
  18855. Prime: "\u2033",
  18856. lsaquo: "\u2039",
  18857. rsaquo: "\u203A",
  18858. oline: "\u203E",
  18859. frasl: "\u2044",
  18860. euro: "\u20AC",
  18861. image: "\u2111",
  18862. weierp: "\u2118",
  18863. real: "\u211C",
  18864. trade: "\u2122",
  18865. alefsym: "\u2135",
  18866. larr: "\u2190",
  18867. uarr: "\u2191",
  18868. rarr: "\u2192",
  18869. darr: "\u2193",
  18870. harr: "\u2194",
  18871. crarr: "\u21B5",
  18872. lArr: "\u21D0",
  18873. uArr: "\u21D1",
  18874. rArr: "\u21D2",
  18875. dArr: "\u21D3",
  18876. hArr: "\u21D4",
  18877. forall: "\u2200",
  18878. part: "\u2202",
  18879. exist: "\u2203",
  18880. empty: "\u2205",
  18881. nabla: "\u2207",
  18882. isin: "\u2208",
  18883. notin: "\u2209",
  18884. ni: "\u220B",
  18885. prod: "\u220F",
  18886. sum: "\u2211",
  18887. minus: "\u2212",
  18888. lowast: "\u2217",
  18889. radic: "\u221A",
  18890. prop: "\u221D",
  18891. infin: "\u221E",
  18892. ang: "\u2220",
  18893. and: "\u2227",
  18894. or: "\u2228",
  18895. cap: "\u2229",
  18896. cup: "\u222A",
  18897. "int": "\u222B",
  18898. there4: "\u2234",
  18899. sim: "\u223C",
  18900. cong: "\u2245",
  18901. asymp: "\u2248",
  18902. ne: "\u2260",
  18903. equiv: "\u2261",
  18904. le: "\u2264",
  18905. ge: "\u2265",
  18906. sub: "\u2282",
  18907. sup: "\u2283",
  18908. nsub: "\u2284",
  18909. sube: "\u2286",
  18910. supe: "\u2287",
  18911. oplus: "\u2295",
  18912. otimes: "\u2297",
  18913. perp: "\u22A5",
  18914. sdot: "\u22C5",
  18915. lceil: "\u2308",
  18916. rceil: "\u2309",
  18917. lfloor: "\u230A",
  18918. rfloor: "\u230B",
  18919. lang: "\u2329",
  18920. rang: "\u232A",
  18921. loz: "\u25CA",
  18922. spades: "\u2660",
  18923. clubs: "\u2663",
  18924. hearts: "\u2665",
  18925. diams: "\u2666"
  18926. };
  18927. var HEX_NUMBER = /^[\da-fA-F]+$/;
  18928. var DECIMAL_NUMBER = /^\d+$/;
  18929. types$1.j_oTag = new TokContext("<tag", false);
  18930. types$1.j_cTag = new TokContext("</tag", false);
  18931. types$1.j_expr = new TokContext("<tag>...</tag>", true, true);
  18932. types.jsxName = new TokenType("jsxName");
  18933. types.jsxText = new TokenType("jsxText", { beforeExpr: true });
  18934. types.jsxTagStart = new TokenType("jsxTagStart", { startsExpr: true });
  18935. types.jsxTagEnd = new TokenType("jsxTagEnd");
  18936. types.jsxTagStart.updateContext = function () {
  18937. this.state.context.push(types$1.j_expr); // treat as beginning of JSX expression
  18938. this.state.context.push(types$1.j_oTag); // start opening tag context
  18939. this.state.exprAllowed = false;
  18940. };
  18941. types.jsxTagEnd.updateContext = function (prevType) {
  18942. var out = this.state.context.pop();
  18943. if (out === types$1.j_oTag && prevType === types.slash || out === types$1.j_cTag) {
  18944. this.state.context.pop();
  18945. this.state.exprAllowed = this.curContext() === types$1.j_expr;
  18946. } else {
  18947. this.state.exprAllowed = true;
  18948. }
  18949. };
  18950. var pp$9 = Parser.prototype;
  18951. // Reads inline JSX contents token.
  18952. pp$9.jsxReadToken = function () {
  18953. var out = "";
  18954. var chunkStart = this.state.pos;
  18955. for (;;) {
  18956. if (this.state.pos >= this.input.length) {
  18957. this.raise(this.state.start, "Unterminated JSX contents");
  18958. }
  18959. var ch = this.input.charCodeAt(this.state.pos);
  18960. switch (ch) {
  18961. case 60: // "<"
  18962. case 123:
  18963. // "{"
  18964. if (this.state.pos === this.state.start) {
  18965. if (ch === 60 && this.state.exprAllowed) {
  18966. ++this.state.pos;
  18967. return this.finishToken(types.jsxTagStart);
  18968. }
  18969. return this.getTokenFromCode(ch);
  18970. }
  18971. out += this.input.slice(chunkStart, this.state.pos);
  18972. return this.finishToken(types.jsxText, out);
  18973. case 38:
  18974. // "&"
  18975. out += this.input.slice(chunkStart, this.state.pos);
  18976. out += this.jsxReadEntity();
  18977. chunkStart = this.state.pos;
  18978. break;
  18979. default:
  18980. if (isNewLine(ch)) {
  18981. out += this.input.slice(chunkStart, this.state.pos);
  18982. out += this.jsxReadNewLine(true);
  18983. chunkStart = this.state.pos;
  18984. } else {
  18985. ++this.state.pos;
  18986. }
  18987. }
  18988. }
  18989. };
  18990. pp$9.jsxReadNewLine = function (normalizeCRLF) {
  18991. var ch = this.input.charCodeAt(this.state.pos);
  18992. var out = void 0;
  18993. ++this.state.pos;
  18994. if (ch === 13 && this.input.charCodeAt(this.state.pos) === 10) {
  18995. ++this.state.pos;
  18996. out = normalizeCRLF ? "\n" : "\r\n";
  18997. } else {
  18998. out = String.fromCharCode(ch);
  18999. }
  19000. ++this.state.curLine;
  19001. this.state.lineStart = this.state.pos;
  19002. return out;
  19003. };
  19004. pp$9.jsxReadString = function (quote) {
  19005. var out = "";
  19006. var chunkStart = ++this.state.pos;
  19007. for (;;) {
  19008. if (this.state.pos >= this.input.length) {
  19009. this.raise(this.state.start, "Unterminated string constant");
  19010. }
  19011. var ch = this.input.charCodeAt(this.state.pos);
  19012. if (ch === quote) break;
  19013. if (ch === 38) {
  19014. // "&"
  19015. out += this.input.slice(chunkStart, this.state.pos);
  19016. out += this.jsxReadEntity();
  19017. chunkStart = this.state.pos;
  19018. } else if (isNewLine(ch)) {
  19019. out += this.input.slice(chunkStart, this.state.pos);
  19020. out += this.jsxReadNewLine(false);
  19021. chunkStart = this.state.pos;
  19022. } else {
  19023. ++this.state.pos;
  19024. }
  19025. }
  19026. out += this.input.slice(chunkStart, this.state.pos++);
  19027. return this.finishToken(types.string, out);
  19028. };
  19029. pp$9.jsxReadEntity = function () {
  19030. var str = "";
  19031. var count = 0;
  19032. var entity = void 0;
  19033. var ch = this.input[this.state.pos];
  19034. var startPos = ++this.state.pos;
  19035. while (this.state.pos < this.input.length && count++ < 10) {
  19036. ch = this.input[this.state.pos++];
  19037. if (ch === ";") {
  19038. if (str[0] === "#") {
  19039. if (str[1] === "x") {
  19040. str = str.substr(2);
  19041. if (HEX_NUMBER.test(str)) entity = fromCodePoint$1(parseInt(str, 16));
  19042. } else {
  19043. str = str.substr(1);
  19044. if (DECIMAL_NUMBER.test(str)) entity = fromCodePoint$1(parseInt(str, 10));
  19045. }
  19046. } else {
  19047. entity = XHTMLEntities[str];
  19048. }
  19049. break;
  19050. }
  19051. str += ch;
  19052. }
  19053. if (!entity) {
  19054. this.state.pos = startPos;
  19055. return "&";
  19056. }
  19057. return entity;
  19058. };
  19059. // Read a JSX identifier (valid tag or attribute name).
  19060. //
  19061. // Optimized version since JSX identifiers can"t contain
  19062. // escape characters and so can be read as single slice.
  19063. // Also assumes that first character was already checked
  19064. // by isIdentifierStart in readToken.
  19065. pp$9.jsxReadWord = function () {
  19066. var ch = void 0;
  19067. var start = this.state.pos;
  19068. do {
  19069. ch = this.input.charCodeAt(++this.state.pos);
  19070. } while (isIdentifierChar(ch) || ch === 45); // "-"
  19071. return this.finishToken(types.jsxName, this.input.slice(start, this.state.pos));
  19072. };
  19073. // Transforms JSX element name to string.
  19074. function getQualifiedJSXName(object) {
  19075. if (object.type === "JSXIdentifier") {
  19076. return object.name;
  19077. }
  19078. if (object.type === "JSXNamespacedName") {
  19079. return object.namespace.name + ":" + object.name.name;
  19080. }
  19081. if (object.type === "JSXMemberExpression") {
  19082. return getQualifiedJSXName(object.object) + "." + getQualifiedJSXName(object.property);
  19083. }
  19084. }
  19085. // Parse next token as JSX identifier
  19086. pp$9.jsxParseIdentifier = function () {
  19087. var node = this.startNode();
  19088. if (this.match(types.jsxName)) {
  19089. node.name = this.state.value;
  19090. } else if (this.state.type.keyword) {
  19091. node.name = this.state.type.keyword;
  19092. } else {
  19093. this.unexpected();
  19094. }
  19095. this.next();
  19096. return this.finishNode(node, "JSXIdentifier");
  19097. };
  19098. // Parse namespaced identifier.
  19099. pp$9.jsxParseNamespacedName = function () {
  19100. var startPos = this.state.start;
  19101. var startLoc = this.state.startLoc;
  19102. var name = this.jsxParseIdentifier();
  19103. if (!this.eat(types.colon)) return name;
  19104. var node = this.startNodeAt(startPos, startLoc);
  19105. node.namespace = name;
  19106. node.name = this.jsxParseIdentifier();
  19107. return this.finishNode(node, "JSXNamespacedName");
  19108. };
  19109. // Parses element name in any form - namespaced, member
  19110. // or single identifier.
  19111. pp$9.jsxParseElementName = function () {
  19112. var startPos = this.state.start;
  19113. var startLoc = this.state.startLoc;
  19114. var node = this.jsxParseNamespacedName();
  19115. while (this.eat(types.dot)) {
  19116. var newNode = this.startNodeAt(startPos, startLoc);
  19117. newNode.object = node;
  19118. newNode.property = this.jsxParseIdentifier();
  19119. node = this.finishNode(newNode, "JSXMemberExpression");
  19120. }
  19121. return node;
  19122. };
  19123. // Parses any type of JSX attribute value.
  19124. pp$9.jsxParseAttributeValue = function () {
  19125. var node = void 0;
  19126. switch (this.state.type) {
  19127. case types.braceL:
  19128. node = this.jsxParseExpressionContainer();
  19129. if (node.expression.type === "JSXEmptyExpression") {
  19130. this.raise(node.start, "JSX attributes must only be assigned a non-empty expression");
  19131. } else {
  19132. return node;
  19133. }
  19134. case types.jsxTagStart:
  19135. case types.string:
  19136. node = this.parseExprAtom();
  19137. node.extra = null;
  19138. return node;
  19139. default:
  19140. this.raise(this.state.start, "JSX value should be either an expression or a quoted JSX text");
  19141. }
  19142. };
  19143. // JSXEmptyExpression is unique type since it doesn't actually parse anything,
  19144. // and so it should start at the end of last read token (left brace) and finish
  19145. // at the beginning of the next one (right brace).
  19146. pp$9.jsxParseEmptyExpression = function () {
  19147. var node = this.startNodeAt(this.state.lastTokEnd, this.state.lastTokEndLoc);
  19148. return this.finishNodeAt(node, "JSXEmptyExpression", this.state.start, this.state.startLoc);
  19149. };
  19150. // Parse JSX spread child
  19151. pp$9.jsxParseSpreadChild = function () {
  19152. var node = this.startNode();
  19153. this.expect(types.braceL);
  19154. this.expect(types.ellipsis);
  19155. node.expression = this.parseExpression();
  19156. this.expect(types.braceR);
  19157. return this.finishNode(node, "JSXSpreadChild");
  19158. };
  19159. // Parses JSX expression enclosed into curly brackets.
  19160. pp$9.jsxParseExpressionContainer = function () {
  19161. var node = this.startNode();
  19162. this.next();
  19163. if (this.match(types.braceR)) {
  19164. node.expression = this.jsxParseEmptyExpression();
  19165. } else {
  19166. node.expression = this.parseExpression();
  19167. }
  19168. this.expect(types.braceR);
  19169. return this.finishNode(node, "JSXExpressionContainer");
  19170. };
  19171. // Parses following JSX attribute name-value pair.
  19172. pp$9.jsxParseAttribute = function () {
  19173. var node = this.startNode();
  19174. if (this.eat(types.braceL)) {
  19175. this.expect(types.ellipsis);
  19176. node.argument = this.parseMaybeAssign();
  19177. this.expect(types.braceR);
  19178. return this.finishNode(node, "JSXSpreadAttribute");
  19179. }
  19180. node.name = this.jsxParseNamespacedName();
  19181. node.value = this.eat(types.eq) ? this.jsxParseAttributeValue() : null;
  19182. return this.finishNode(node, "JSXAttribute");
  19183. };
  19184. // Parses JSX opening tag starting after "<".
  19185. pp$9.jsxParseOpeningElementAt = function (startPos, startLoc) {
  19186. var node = this.startNodeAt(startPos, startLoc);
  19187. node.attributes = [];
  19188. node.name = this.jsxParseElementName();
  19189. while (!this.match(types.slash) && !this.match(types.jsxTagEnd)) {
  19190. node.attributes.push(this.jsxParseAttribute());
  19191. }
  19192. node.selfClosing = this.eat(types.slash);
  19193. this.expect(types.jsxTagEnd);
  19194. return this.finishNode(node, "JSXOpeningElement");
  19195. };
  19196. // Parses JSX closing tag starting after "</".
  19197. pp$9.jsxParseClosingElementAt = function (startPos, startLoc) {
  19198. var node = this.startNodeAt(startPos, startLoc);
  19199. node.name = this.jsxParseElementName();
  19200. this.expect(types.jsxTagEnd);
  19201. return this.finishNode(node, "JSXClosingElement");
  19202. };
  19203. // Parses entire JSX element, including it"s opening tag
  19204. // (starting after "<"), attributes, contents and closing tag.
  19205. pp$9.jsxParseElementAt = function (startPos, startLoc) {
  19206. var node = this.startNodeAt(startPos, startLoc);
  19207. var children = [];
  19208. var openingElement = this.jsxParseOpeningElementAt(startPos, startLoc);
  19209. var closingElement = null;
  19210. if (!openingElement.selfClosing) {
  19211. contents: for (;;) {
  19212. switch (this.state.type) {
  19213. case types.jsxTagStart:
  19214. startPos = this.state.start;startLoc = this.state.startLoc;
  19215. this.next();
  19216. if (this.eat(types.slash)) {
  19217. closingElement = this.jsxParseClosingElementAt(startPos, startLoc);
  19218. break contents;
  19219. }
  19220. children.push(this.jsxParseElementAt(startPos, startLoc));
  19221. break;
  19222. case types.jsxText:
  19223. children.push(this.parseExprAtom());
  19224. break;
  19225. case types.braceL:
  19226. if (this.lookahead().type === types.ellipsis) {
  19227. children.push(this.jsxParseSpreadChild());
  19228. } else {
  19229. children.push(this.jsxParseExpressionContainer());
  19230. }
  19231. break;
  19232. // istanbul ignore next - should never happen
  19233. default:
  19234. this.unexpected();
  19235. }
  19236. }
  19237. if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) {
  19238. this.raise(closingElement.start, "Expected corresponding JSX closing tag for <" + getQualifiedJSXName(openingElement.name) + ">");
  19239. }
  19240. }
  19241. node.openingElement = openingElement;
  19242. node.closingElement = closingElement;
  19243. node.children = children;
  19244. if (this.match(types.relational) && this.state.value === "<") {
  19245. this.raise(this.state.start, "Adjacent JSX elements must be wrapped in an enclosing tag");
  19246. }
  19247. return this.finishNode(node, "JSXElement");
  19248. };
  19249. // Parses entire JSX element from current position.
  19250. pp$9.jsxParseElement = function () {
  19251. var startPos = this.state.start;
  19252. var startLoc = this.state.startLoc;
  19253. this.next();
  19254. return this.jsxParseElementAt(startPos, startLoc);
  19255. };
  19256. var jsxPlugin = function (instance) {
  19257. instance.extend("parseExprAtom", function (inner) {
  19258. return function (refShortHandDefaultPos) {
  19259. if (this.match(types.jsxText)) {
  19260. var node = this.parseLiteral(this.state.value, "JSXText");
  19261. // https://github.com/babel/babel/issues/2078
  19262. node.extra = null;
  19263. return node;
  19264. } else if (this.match(types.jsxTagStart)) {
  19265. return this.jsxParseElement();
  19266. } else {
  19267. return inner.call(this, refShortHandDefaultPos);
  19268. }
  19269. };
  19270. });
  19271. instance.extend("readToken", function (inner) {
  19272. return function (code) {
  19273. if (this.state.inPropertyName) return inner.call(this, code);
  19274. var context = this.curContext();
  19275. if (context === types$1.j_expr) {
  19276. return this.jsxReadToken();
  19277. }
  19278. if (context === types$1.j_oTag || context === types$1.j_cTag) {
  19279. if (isIdentifierStart(code)) {
  19280. return this.jsxReadWord();
  19281. }
  19282. if (code === 62) {
  19283. ++this.state.pos;
  19284. return this.finishToken(types.jsxTagEnd);
  19285. }
  19286. if ((code === 34 || code === 39) && context === types$1.j_oTag) {
  19287. return this.jsxReadString(code);
  19288. }
  19289. }
  19290. if (code === 60 && this.state.exprAllowed) {
  19291. ++this.state.pos;
  19292. return this.finishToken(types.jsxTagStart);
  19293. }
  19294. return inner.call(this, code);
  19295. };
  19296. });
  19297. instance.extend("updateContext", function (inner) {
  19298. return function (prevType) {
  19299. if (this.match(types.braceL)) {
  19300. var curContext = this.curContext();
  19301. if (curContext === types$1.j_oTag) {
  19302. this.state.context.push(types$1.braceExpression);
  19303. } else if (curContext === types$1.j_expr) {
  19304. this.state.context.push(types$1.templateQuasi);
  19305. } else {
  19306. inner.call(this, prevType);
  19307. }
  19308. this.state.exprAllowed = true;
  19309. } else if (this.match(types.slash) && prevType === types.jsxTagStart) {
  19310. this.state.context.length -= 2; // do not consider JSX expr -> JSX open tag -> ... anymore
  19311. this.state.context.push(types$1.j_cTag); // reconsider as closing tag context
  19312. this.state.exprAllowed = false;
  19313. } else {
  19314. return inner.call(this, prevType);
  19315. }
  19316. };
  19317. });
  19318. };
  19319. plugins.estree = estreePlugin;
  19320. plugins.flow = flowPlugin;
  19321. plugins.jsx = jsxPlugin;
  19322. function parse(input, options) {
  19323. return new Parser(options, input).parse();
  19324. }
  19325. function parseExpression(input, options) {
  19326. var parser = new Parser(options, input);
  19327. if (parser.options.strictMode) {
  19328. parser.state.strict = true;
  19329. }
  19330. return parser.getExpression();
  19331. }
  19332. exports.parse = parse;
  19333. exports.parseExpression = parseExpression;
  19334. exports.tokTypes = types;
  19335. },{}],117:[function(require,module,exports){
  19336. module.exports = balanced;
  19337. function balanced(a, b, str) {
  19338. if (a instanceof RegExp) a = maybeMatch(a, str);
  19339. if (b instanceof RegExp) b = maybeMatch(b, str);
  19340. var r = range(a, b, str);
  19341. return r && {
  19342. start: r[0],
  19343. end: r[1],
  19344. pre: str.slice(0, r[0]),
  19345. body: str.slice(r[0] + a.length, r[1]),
  19346. post: str.slice(r[1] + b.length)
  19347. };
  19348. }
  19349. function maybeMatch(reg, str) {
  19350. var m = str.match(reg);
  19351. return m ? m[0] : null;
  19352. }
  19353. balanced.range = range;
  19354. function range(a, b, str) {
  19355. var begs, beg, left, right, result;
  19356. var ai = str.indexOf(a);
  19357. var bi = str.indexOf(b, ai + 1);
  19358. var i = ai;
  19359. if (ai >= 0 && bi > 0) {
  19360. begs = [];
  19361. left = str.length;
  19362. while (i >= 0 && !result) {
  19363. if (i == ai) {
  19364. begs.push(i);
  19365. ai = str.indexOf(a, i + 1);
  19366. } else if (begs.length == 1) {
  19367. result = [ begs.pop(), bi ];
  19368. } else {
  19369. beg = begs.pop();
  19370. if (beg < left) {
  19371. left = beg;
  19372. right = bi;
  19373. }
  19374. bi = str.indexOf(b, i + 1);
  19375. }
  19376. i = ai < bi && ai >= 0 ? ai : bi;
  19377. }
  19378. if (begs.length) {
  19379. result = [ left, right ];
  19380. }
  19381. }
  19382. return result;
  19383. }
  19384. },{}],118:[function(require,module,exports){
  19385. 'use strict'
  19386. exports.byteLength = byteLength
  19387. exports.toByteArray = toByteArray
  19388. exports.fromByteArray = fromByteArray
  19389. var lookup = []
  19390. var revLookup = []
  19391. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  19392. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  19393. for (var i = 0, len = code.length; i < len; ++i) {
  19394. lookup[i] = code[i]
  19395. revLookup[code.charCodeAt(i)] = i
  19396. }
  19397. revLookup['-'.charCodeAt(0)] = 62
  19398. revLookup['_'.charCodeAt(0)] = 63
  19399. function placeHoldersCount (b64) {
  19400. var len = b64.length
  19401. if (len % 4 > 0) {
  19402. throw new Error('Invalid string. Length must be a multiple of 4')
  19403. }
  19404. // the number of equal signs (place holders)
  19405. // if there are two placeholders, than the two characters before it
  19406. // represent one byte
  19407. // if there is only one, then the three characters before it represent 2 bytes
  19408. // this is just a cheap hack to not do indexOf twice
  19409. return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0
  19410. }
  19411. function byteLength (b64) {
  19412. // base64 is 4/3 + up to two characters of the original data
  19413. return b64.length * 3 / 4 - placeHoldersCount(b64)
  19414. }
  19415. function toByteArray (b64) {
  19416. var i, j, l, tmp, placeHolders, arr
  19417. var len = b64.length
  19418. placeHolders = placeHoldersCount(b64)
  19419. arr = new Arr(len * 3 / 4 - placeHolders)
  19420. // if there are placeholders, only get up to the last complete 4 chars
  19421. l = placeHolders > 0 ? len - 4 : len
  19422. var L = 0
  19423. for (i = 0, j = 0; i < l; i += 4, j += 3) {
  19424. tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]
  19425. arr[L++] = (tmp >> 16) & 0xFF
  19426. arr[L++] = (tmp >> 8) & 0xFF
  19427. arr[L++] = tmp & 0xFF
  19428. }
  19429. if (placeHolders === 2) {
  19430. tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)
  19431. arr[L++] = tmp & 0xFF
  19432. } else if (placeHolders === 1) {
  19433. tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)
  19434. arr[L++] = (tmp >> 8) & 0xFF
  19435. arr[L++] = tmp & 0xFF
  19436. }
  19437. return arr
  19438. }
  19439. function tripletToBase64 (num) {
  19440. return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]
  19441. }
  19442. function encodeChunk (uint8, start, end) {
  19443. var tmp
  19444. var output = []
  19445. for (var i = start; i < end; i += 3) {
  19446. tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
  19447. output.push(tripletToBase64(tmp))
  19448. }
  19449. return output.join('')
  19450. }
  19451. function fromByteArray (uint8) {
  19452. var tmp
  19453. var len = uint8.length
  19454. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  19455. var output = ''
  19456. var parts = []
  19457. var maxChunkLength = 16383 // must be multiple of 3
  19458. // go through the array every three bytes, we'll deal with trailing stuff later
  19459. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  19460. parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
  19461. }
  19462. // pad the end with zeros, but make sure to not forget the extra bytes
  19463. if (extraBytes === 1) {
  19464. tmp = uint8[len - 1]
  19465. output += lookup[tmp >> 2]
  19466. output += lookup[(tmp << 4) & 0x3F]
  19467. output += '=='
  19468. } else if (extraBytes === 2) {
  19469. tmp = (uint8[len - 2] << 8) + (uint8[len - 1])
  19470. output += lookup[tmp >> 10]
  19471. output += lookup[(tmp >> 4) & 0x3F]
  19472. output += lookup[(tmp << 2) & 0x3F]
  19473. output += '='
  19474. }
  19475. parts.push(output)
  19476. return parts.join('')
  19477. }
  19478. },{}],119:[function(require,module,exports){
  19479. var concatMap = require('concat-map');
  19480. var balanced = require('balanced-match');
  19481. module.exports = expandTop;
  19482. var escSlash = '\0SLASH'+Math.random()+'\0';
  19483. var escOpen = '\0OPEN'+Math.random()+'\0';
  19484. var escClose = '\0CLOSE'+Math.random()+'\0';
  19485. var escComma = '\0COMMA'+Math.random()+'\0';
  19486. var escPeriod = '\0PERIOD'+Math.random()+'\0';
  19487. function numeric(str) {
  19488. return parseInt(str, 10) == str
  19489. ? parseInt(str, 10)
  19490. : str.charCodeAt(0);
  19491. }
  19492. function escapeBraces(str) {
  19493. return str.split('\\\\').join(escSlash)
  19494. .split('\\{').join(escOpen)
  19495. .split('\\}').join(escClose)
  19496. .split('\\,').join(escComma)
  19497. .split('\\.').join(escPeriod);
  19498. }
  19499. function unescapeBraces(str) {
  19500. return str.split(escSlash).join('\\')
  19501. .split(escOpen).join('{')
  19502. .split(escClose).join('}')
  19503. .split(escComma).join(',')
  19504. .split(escPeriod).join('.');
  19505. }
  19506. // Basically just str.split(","), but handling cases
  19507. // where we have nested braced sections, which should be
  19508. // treated as individual members, like {a,{b,c},d}
  19509. function parseCommaParts(str) {
  19510. if (!str)
  19511. return [''];
  19512. var parts = [];
  19513. var m = balanced('{', '}', str);
  19514. if (!m)
  19515. return str.split(',');
  19516. var pre = m.pre;
  19517. var body = m.body;
  19518. var post = m.post;
  19519. var p = pre.split(',');
  19520. p[p.length-1] += '{' + body + '}';
  19521. var postParts = parseCommaParts(post);
  19522. if (post.length) {
  19523. p[p.length-1] += postParts.shift();
  19524. p.push.apply(p, postParts);
  19525. }
  19526. parts.push.apply(parts, p);
  19527. return parts;
  19528. }
  19529. function expandTop(str) {
  19530. if (!str)
  19531. return [];
  19532. // I don't know why Bash 4.3 does this, but it does.
  19533. // Anything starting with {} will have the first two bytes preserved
  19534. // but *only* at the top level, so {},a}b will not expand to anything,
  19535. // but a{},b}c will be expanded to [a}c,abc].
  19536. // One could argue that this is a bug in Bash, but since the goal of
  19537. // this module is to match Bash's rules, we escape a leading {}
  19538. if (str.substr(0, 2) === '{}') {
  19539. str = '\\{\\}' + str.substr(2);
  19540. }
  19541. return expand(escapeBraces(str), true).map(unescapeBraces);
  19542. }
  19543. function identity(e) {
  19544. return e;
  19545. }
  19546. function embrace(str) {
  19547. return '{' + str + '}';
  19548. }
  19549. function isPadded(el) {
  19550. return /^-?0\d/.test(el);
  19551. }
  19552. function lte(i, y) {
  19553. return i <= y;
  19554. }
  19555. function gte(i, y) {
  19556. return i >= y;
  19557. }
  19558. function expand(str, isTop) {
  19559. var expansions = [];
  19560. var m = balanced('{', '}', str);
  19561. if (!m || /\$$/.test(m.pre)) return [str];
  19562. var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
  19563. var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
  19564. var isSequence = isNumericSequence || isAlphaSequence;
  19565. var isOptions = /^(.*,)+(.+)?$/.test(m.body);
  19566. if (!isSequence && !isOptions) {
  19567. // {a},b}
  19568. if (m.post.match(/,.*\}/)) {
  19569. str = m.pre + '{' + m.body + escClose + m.post;
  19570. return expand(str);
  19571. }
  19572. return [str];
  19573. }
  19574. var n;
  19575. if (isSequence) {
  19576. n = m.body.split(/\.\./);
  19577. } else {
  19578. n = parseCommaParts(m.body);
  19579. if (n.length === 1) {
  19580. // x{{a,b}}y ==> x{a}y x{b}y
  19581. n = expand(n[0], false).map(embrace);
  19582. if (n.length === 1) {
  19583. var post = m.post.length
  19584. ? expand(m.post, false)
  19585. : [''];
  19586. return post.map(function(p) {
  19587. return m.pre + n[0] + p;
  19588. });
  19589. }
  19590. }
  19591. }
  19592. // at this point, n is the parts, and we know it's not a comma set
  19593. // with a single entry.
  19594. // no need to expand pre, since it is guaranteed to be free of brace-sets
  19595. var pre = m.pre;
  19596. var post = m.post.length
  19597. ? expand(m.post, false)
  19598. : [''];
  19599. var N;
  19600. if (isSequence) {
  19601. var x = numeric(n[0]);
  19602. var y = numeric(n[1]);
  19603. var width = Math.max(n[0].length, n[1].length)
  19604. var incr = n.length == 3
  19605. ? Math.abs(numeric(n[2]))
  19606. : 1;
  19607. var test = lte;
  19608. var reverse = y < x;
  19609. if (reverse) {
  19610. incr *= -1;
  19611. test = gte;
  19612. }
  19613. var pad = n.some(isPadded);
  19614. N = [];
  19615. for (var i = x; test(i, y); i += incr) {
  19616. var c;
  19617. if (isAlphaSequence) {
  19618. c = String.fromCharCode(i);
  19619. if (c === '\\')
  19620. c = '';
  19621. } else {
  19622. c = String(i);
  19623. if (pad) {
  19624. var need = width - c.length;
  19625. if (need > 0) {
  19626. var z = new Array(need + 1).join('0');
  19627. if (i < 0)
  19628. c = '-' + z + c.slice(1);
  19629. else
  19630. c = z + c;
  19631. }
  19632. }
  19633. }
  19634. N.push(c);
  19635. }
  19636. } else {
  19637. N = concatMap(n, function(el) { return expand(el, false) });
  19638. }
  19639. for (var j = 0; j < N.length; j++) {
  19640. for (var k = 0; k < post.length; k++) {
  19641. var expansion = pre + N[j] + post[k];
  19642. if (!isTop || isSequence || expansion)
  19643. expansions.push(expansion);
  19644. }
  19645. }
  19646. return expansions;
  19647. }
  19648. },{"balanced-match":117,"concat-map":123}],120:[function(require,module,exports){
  19649. },{}],121:[function(require,module,exports){
  19650. (function (global){
  19651. /*!
  19652. * The buffer module from node.js, for the browser.
  19653. *
  19654. * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
  19655. * @license MIT
  19656. */
  19657. /* eslint-disable no-proto */
  19658. 'use strict'
  19659. var base64 = require('base64-js')
  19660. var ieee754 = require('ieee754')
  19661. var isArray = require('isarray')
  19662. exports.Buffer = Buffer
  19663. exports.SlowBuffer = SlowBuffer
  19664. exports.INSPECT_MAX_BYTES = 50
  19665. /**
  19666. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  19667. * === true Use Uint8Array implementation (fastest)
  19668. * === false Use Object implementation (most compatible, even IE6)
  19669. *
  19670. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  19671. * Opera 11.6+, iOS 4.2+.
  19672. *
  19673. * Due to various browser bugs, sometimes the Object implementation will be used even
  19674. * when the browser supports typed arrays.
  19675. *
  19676. * Note:
  19677. *
  19678. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  19679. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  19680. *
  19681. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  19682. *
  19683. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  19684. * incorrect length in some situations.
  19685. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  19686. * get the Object implementation, which is slower but behaves correctly.
  19687. */
  19688. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  19689. ? global.TYPED_ARRAY_SUPPORT
  19690. : typedArraySupport()
  19691. /*
  19692. * Export kMaxLength after typed array support is determined.
  19693. */
  19694. exports.kMaxLength = kMaxLength()
  19695. function typedArraySupport () {
  19696. try {
  19697. var arr = new Uint8Array(1)
  19698. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  19699. return arr.foo() === 42 && // typed array instances can be augmented
  19700. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  19701. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  19702. } catch (e) {
  19703. return false
  19704. }
  19705. }
  19706. function kMaxLength () {
  19707. return Buffer.TYPED_ARRAY_SUPPORT
  19708. ? 0x7fffffff
  19709. : 0x3fffffff
  19710. }
  19711. function createBuffer (that, length) {
  19712. if (kMaxLength() < length) {
  19713. throw new RangeError('Invalid typed array length')
  19714. }
  19715. if (Buffer.TYPED_ARRAY_SUPPORT) {
  19716. // Return an augmented `Uint8Array` instance, for best performance
  19717. that = new Uint8Array(length)
  19718. that.__proto__ = Buffer.prototype
  19719. } else {
  19720. // Fallback: Return an object instance of the Buffer class
  19721. if (that === null) {
  19722. that = new Buffer(length)
  19723. }
  19724. that.length = length
  19725. }
  19726. return that
  19727. }
  19728. /**
  19729. * The Buffer constructor returns instances of `Uint8Array` that have their
  19730. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  19731. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  19732. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  19733. * returns a single octet.
  19734. *
  19735. * The `Uint8Array` prototype remains unmodified.
  19736. */
  19737. function Buffer (arg, encodingOrOffset, length) {
  19738. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  19739. return new Buffer(arg, encodingOrOffset, length)
  19740. }
  19741. // Common case.
  19742. if (typeof arg === 'number') {
  19743. if (typeof encodingOrOffset === 'string') {
  19744. throw new Error(
  19745. 'If encoding is specified then the first argument must be a string'
  19746. )
  19747. }
  19748. return allocUnsafe(this, arg)
  19749. }
  19750. return from(this, arg, encodingOrOffset, length)
  19751. }
  19752. Buffer.poolSize = 8192 // not used by this implementation
  19753. // TODO: Legacy, not needed anymore. Remove in next major version.
  19754. Buffer._augment = function (arr) {
  19755. arr.__proto__ = Buffer.prototype
  19756. return arr
  19757. }
  19758. function from (that, value, encodingOrOffset, length) {
  19759. if (typeof value === 'number') {
  19760. throw new TypeError('"value" argument must not be a number')
  19761. }
  19762. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  19763. return fromArrayBuffer(that, value, encodingOrOffset, length)
  19764. }
  19765. if (typeof value === 'string') {
  19766. return fromString(that, value, encodingOrOffset)
  19767. }
  19768. return fromObject(that, value)
  19769. }
  19770. /**
  19771. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  19772. * if value is a number.
  19773. * Buffer.from(str[, encoding])
  19774. * Buffer.from(array)
  19775. * Buffer.from(buffer)
  19776. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  19777. **/
  19778. Buffer.from = function (value, encodingOrOffset, length) {
  19779. return from(null, value, encodingOrOffset, length)
  19780. }
  19781. if (Buffer.TYPED_ARRAY_SUPPORT) {
  19782. Buffer.prototype.__proto__ = Uint8Array.prototype
  19783. Buffer.__proto__ = Uint8Array
  19784. if (typeof Symbol !== 'undefined' && Symbol.species &&
  19785. Buffer[Symbol.species] === Buffer) {
  19786. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  19787. Object.defineProperty(Buffer, Symbol.species, {
  19788. value: null,
  19789. configurable: true
  19790. })
  19791. }
  19792. }
  19793. function assertSize (size) {
  19794. if (typeof size !== 'number') {
  19795. throw new TypeError('"size" argument must be a number')
  19796. } else if (size < 0) {
  19797. throw new RangeError('"size" argument must not be negative')
  19798. }
  19799. }
  19800. function alloc (that, size, fill, encoding) {
  19801. assertSize(size)
  19802. if (size <= 0) {
  19803. return createBuffer(that, size)
  19804. }
  19805. if (fill !== undefined) {
  19806. // Only pay attention to encoding if it's a string. This
  19807. // prevents accidentally sending in a number that would
  19808. // be interpretted as a start offset.
  19809. return typeof encoding === 'string'
  19810. ? createBuffer(that, size).fill(fill, encoding)
  19811. : createBuffer(that, size).fill(fill)
  19812. }
  19813. return createBuffer(that, size)
  19814. }
  19815. /**
  19816. * Creates a new filled Buffer instance.
  19817. * alloc(size[, fill[, encoding]])
  19818. **/
  19819. Buffer.alloc = function (size, fill, encoding) {
  19820. return alloc(null, size, fill, encoding)
  19821. }
  19822. function allocUnsafe (that, size) {
  19823. assertSize(size)
  19824. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  19825. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  19826. for (var i = 0; i < size; ++i) {
  19827. that[i] = 0
  19828. }
  19829. }
  19830. return that
  19831. }
  19832. /**
  19833. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  19834. * */
  19835. Buffer.allocUnsafe = function (size) {
  19836. return allocUnsafe(null, size)
  19837. }
  19838. /**
  19839. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  19840. */
  19841. Buffer.allocUnsafeSlow = function (size) {
  19842. return allocUnsafe(null, size)
  19843. }
  19844. function fromString (that, string, encoding) {
  19845. if (typeof encoding !== 'string' || encoding === '') {
  19846. encoding = 'utf8'
  19847. }
  19848. if (!Buffer.isEncoding(encoding)) {
  19849. throw new TypeError('"encoding" must be a valid string encoding')
  19850. }
  19851. var length = byteLength(string, encoding) | 0
  19852. that = createBuffer(that, length)
  19853. var actual = that.write(string, encoding)
  19854. if (actual !== length) {
  19855. // Writing a hex string, for example, that contains invalid characters will
  19856. // cause everything after the first invalid character to be ignored. (e.g.
  19857. // 'abxxcd' will be treated as 'ab')
  19858. that = that.slice(0, actual)
  19859. }
  19860. return that
  19861. }
  19862. function fromArrayLike (that, array) {
  19863. var length = array.length < 0 ? 0 : checked(array.length) | 0
  19864. that = createBuffer(that, length)
  19865. for (var i = 0; i < length; i += 1) {
  19866. that[i] = array[i] & 255
  19867. }
  19868. return that
  19869. }
  19870. function fromArrayBuffer (that, array, byteOffset, length) {
  19871. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  19872. if (byteOffset < 0 || array.byteLength < byteOffset) {
  19873. throw new RangeError('\'offset\' is out of bounds')
  19874. }
  19875. if (array.byteLength < byteOffset + (length || 0)) {
  19876. throw new RangeError('\'length\' is out of bounds')
  19877. }
  19878. if (byteOffset === undefined && length === undefined) {
  19879. array = new Uint8Array(array)
  19880. } else if (length === undefined) {
  19881. array = new Uint8Array(array, byteOffset)
  19882. } else {
  19883. array = new Uint8Array(array, byteOffset, length)
  19884. }
  19885. if (Buffer.TYPED_ARRAY_SUPPORT) {
  19886. // Return an augmented `Uint8Array` instance, for best performance
  19887. that = array
  19888. that.__proto__ = Buffer.prototype
  19889. } else {
  19890. // Fallback: Return an object instance of the Buffer class
  19891. that = fromArrayLike(that, array)
  19892. }
  19893. return that
  19894. }
  19895. function fromObject (that, obj) {
  19896. if (Buffer.isBuffer(obj)) {
  19897. var len = checked(obj.length) | 0
  19898. that = createBuffer(that, len)
  19899. if (that.length === 0) {
  19900. return that
  19901. }
  19902. obj.copy(that, 0, 0, len)
  19903. return that
  19904. }
  19905. if (obj) {
  19906. if ((typeof ArrayBuffer !== 'undefined' &&
  19907. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  19908. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  19909. return createBuffer(that, 0)
  19910. }
  19911. return fromArrayLike(that, obj)
  19912. }
  19913. if (obj.type === 'Buffer' && isArray(obj.data)) {
  19914. return fromArrayLike(that, obj.data)
  19915. }
  19916. }
  19917. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  19918. }
  19919. function checked (length) {
  19920. // Note: cannot use `length < kMaxLength()` here because that fails when
  19921. // length is NaN (which is otherwise coerced to zero.)
  19922. if (length >= kMaxLength()) {
  19923. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  19924. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  19925. }
  19926. return length | 0
  19927. }
  19928. function SlowBuffer (length) {
  19929. if (+length != length) { // eslint-disable-line eqeqeq
  19930. length = 0
  19931. }
  19932. return Buffer.alloc(+length)
  19933. }
  19934. Buffer.isBuffer = function isBuffer (b) {
  19935. return !!(b != null && b._isBuffer)
  19936. }
  19937. Buffer.compare = function compare (a, b) {
  19938. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  19939. throw new TypeError('Arguments must be Buffers')
  19940. }
  19941. if (a === b) return 0
  19942. var x = a.length
  19943. var y = b.length
  19944. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  19945. if (a[i] !== b[i]) {
  19946. x = a[i]
  19947. y = b[i]
  19948. break
  19949. }
  19950. }
  19951. if (x < y) return -1
  19952. if (y < x) return 1
  19953. return 0
  19954. }
  19955. Buffer.isEncoding = function isEncoding (encoding) {
  19956. switch (String(encoding).toLowerCase()) {
  19957. case 'hex':
  19958. case 'utf8':
  19959. case 'utf-8':
  19960. case 'ascii':
  19961. case 'latin1':
  19962. case 'binary':
  19963. case 'base64':
  19964. case 'ucs2':
  19965. case 'ucs-2':
  19966. case 'utf16le':
  19967. case 'utf-16le':
  19968. return true
  19969. default:
  19970. return false
  19971. }
  19972. }
  19973. Buffer.concat = function concat (list, length) {
  19974. if (!isArray(list)) {
  19975. throw new TypeError('"list" argument must be an Array of Buffers')
  19976. }
  19977. if (list.length === 0) {
  19978. return Buffer.alloc(0)
  19979. }
  19980. var i
  19981. if (length === undefined) {
  19982. length = 0
  19983. for (i = 0; i < list.length; ++i) {
  19984. length += list[i].length
  19985. }
  19986. }
  19987. var buffer = Buffer.allocUnsafe(length)
  19988. var pos = 0
  19989. for (i = 0; i < list.length; ++i) {
  19990. var buf = list[i]
  19991. if (!Buffer.isBuffer(buf)) {
  19992. throw new TypeError('"list" argument must be an Array of Buffers')
  19993. }
  19994. buf.copy(buffer, pos)
  19995. pos += buf.length
  19996. }
  19997. return buffer
  19998. }
  19999. function byteLength (string, encoding) {
  20000. if (Buffer.isBuffer(string)) {
  20001. return string.length
  20002. }
  20003. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  20004. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  20005. return string.byteLength
  20006. }
  20007. if (typeof string !== 'string') {
  20008. string = '' + string
  20009. }
  20010. var len = string.length
  20011. if (len === 0) return 0
  20012. // Use a for loop to avoid recursion
  20013. var loweredCase = false
  20014. for (;;) {
  20015. switch (encoding) {
  20016. case 'ascii':
  20017. case 'latin1':
  20018. case 'binary':
  20019. return len
  20020. case 'utf8':
  20021. case 'utf-8':
  20022. case undefined:
  20023. return utf8ToBytes(string).length
  20024. case 'ucs2':
  20025. case 'ucs-2':
  20026. case 'utf16le':
  20027. case 'utf-16le':
  20028. return len * 2
  20029. case 'hex':
  20030. return len >>> 1
  20031. case 'base64':
  20032. return base64ToBytes(string).length
  20033. default:
  20034. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  20035. encoding = ('' + encoding).toLowerCase()
  20036. loweredCase = true
  20037. }
  20038. }
  20039. }
  20040. Buffer.byteLength = byteLength
  20041. function slowToString (encoding, start, end) {
  20042. var loweredCase = false
  20043. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  20044. // property of a typed array.
  20045. // This behaves neither like String nor Uint8Array in that we set start/end
  20046. // to their upper/lower bounds if the value passed is out of range.
  20047. // undefined is handled specially as per ECMA-262 6th Edition,
  20048. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  20049. if (start === undefined || start < 0) {
  20050. start = 0
  20051. }
  20052. // Return early if start > this.length. Done here to prevent potential uint32
  20053. // coercion fail below.
  20054. if (start > this.length) {
  20055. return ''
  20056. }
  20057. if (end === undefined || end > this.length) {
  20058. end = this.length
  20059. }
  20060. if (end <= 0) {
  20061. return ''
  20062. }
  20063. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  20064. end >>>= 0
  20065. start >>>= 0
  20066. if (end <= start) {
  20067. return ''
  20068. }
  20069. if (!encoding) encoding = 'utf8'
  20070. while (true) {
  20071. switch (encoding) {
  20072. case 'hex':
  20073. return hexSlice(this, start, end)
  20074. case 'utf8':
  20075. case 'utf-8':
  20076. return utf8Slice(this, start, end)
  20077. case 'ascii':
  20078. return asciiSlice(this, start, end)
  20079. case 'latin1':
  20080. case 'binary':
  20081. return latin1Slice(this, start, end)
  20082. case 'base64':
  20083. return base64Slice(this, start, end)
  20084. case 'ucs2':
  20085. case 'ucs-2':
  20086. case 'utf16le':
  20087. case 'utf-16le':
  20088. return utf16leSlice(this, start, end)
  20089. default:
  20090. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  20091. encoding = (encoding + '').toLowerCase()
  20092. loweredCase = true
  20093. }
  20094. }
  20095. }
  20096. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  20097. // Buffer instances.
  20098. Buffer.prototype._isBuffer = true
  20099. function swap (b, n, m) {
  20100. var i = b[n]
  20101. b[n] = b[m]
  20102. b[m] = i
  20103. }
  20104. Buffer.prototype.swap16 = function swap16 () {
  20105. var len = this.length
  20106. if (len % 2 !== 0) {
  20107. throw new RangeError('Buffer size must be a multiple of 16-bits')
  20108. }
  20109. for (var i = 0; i < len; i += 2) {
  20110. swap(this, i, i + 1)
  20111. }
  20112. return this
  20113. }
  20114. Buffer.prototype.swap32 = function swap32 () {
  20115. var len = this.length
  20116. if (len % 4 !== 0) {
  20117. throw new RangeError('Buffer size must be a multiple of 32-bits')
  20118. }
  20119. for (var i = 0; i < len; i += 4) {
  20120. swap(this, i, i + 3)
  20121. swap(this, i + 1, i + 2)
  20122. }
  20123. return this
  20124. }
  20125. Buffer.prototype.swap64 = function swap64 () {
  20126. var len = this.length
  20127. if (len % 8 !== 0) {
  20128. throw new RangeError('Buffer size must be a multiple of 64-bits')
  20129. }
  20130. for (var i = 0; i < len; i += 8) {
  20131. swap(this, i, i + 7)
  20132. swap(this, i + 1, i + 6)
  20133. swap(this, i + 2, i + 5)
  20134. swap(this, i + 3, i + 4)
  20135. }
  20136. return this
  20137. }
  20138. Buffer.prototype.toString = function toString () {
  20139. var length = this.length | 0
  20140. if (length === 0) return ''
  20141. if (arguments.length === 0) return utf8Slice(this, 0, length)
  20142. return slowToString.apply(this, arguments)
  20143. }
  20144. Buffer.prototype.equals = function equals (b) {
  20145. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  20146. if (this === b) return true
  20147. return Buffer.compare(this, b) === 0
  20148. }
  20149. Buffer.prototype.inspect = function inspect () {
  20150. var str = ''
  20151. var max = exports.INSPECT_MAX_BYTES
  20152. if (this.length > 0) {
  20153. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  20154. if (this.length > max) str += ' ... '
  20155. }
  20156. return '<Buffer ' + str + '>'
  20157. }
  20158. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  20159. if (!Buffer.isBuffer(target)) {
  20160. throw new TypeError('Argument must be a Buffer')
  20161. }
  20162. if (start === undefined) {
  20163. start = 0
  20164. }
  20165. if (end === undefined) {
  20166. end = target ? target.length : 0
  20167. }
  20168. if (thisStart === undefined) {
  20169. thisStart = 0
  20170. }
  20171. if (thisEnd === undefined) {
  20172. thisEnd = this.length
  20173. }
  20174. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  20175. throw new RangeError('out of range index')
  20176. }
  20177. if (thisStart >= thisEnd && start >= end) {
  20178. return 0
  20179. }
  20180. if (thisStart >= thisEnd) {
  20181. return -1
  20182. }
  20183. if (start >= end) {
  20184. return 1
  20185. }
  20186. start >>>= 0
  20187. end >>>= 0
  20188. thisStart >>>= 0
  20189. thisEnd >>>= 0
  20190. if (this === target) return 0
  20191. var x = thisEnd - thisStart
  20192. var y = end - start
  20193. var len = Math.min(x, y)
  20194. var thisCopy = this.slice(thisStart, thisEnd)
  20195. var targetCopy = target.slice(start, end)
  20196. for (var i = 0; i < len; ++i) {
  20197. if (thisCopy[i] !== targetCopy[i]) {
  20198. x = thisCopy[i]
  20199. y = targetCopy[i]
  20200. break
  20201. }
  20202. }
  20203. if (x < y) return -1
  20204. if (y < x) return 1
  20205. return 0
  20206. }
  20207. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  20208. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  20209. //
  20210. // Arguments:
  20211. // - buffer - a Buffer to search
  20212. // - val - a string, Buffer, or number
  20213. // - byteOffset - an index into `buffer`; will be clamped to an int32
  20214. // - encoding - an optional encoding, relevant is val is a string
  20215. // - dir - true for indexOf, false for lastIndexOf
  20216. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  20217. // Empty buffer means no match
  20218. if (buffer.length === 0) return -1
  20219. // Normalize byteOffset
  20220. if (typeof byteOffset === 'string') {
  20221. encoding = byteOffset
  20222. byteOffset = 0
  20223. } else if (byteOffset > 0x7fffffff) {
  20224. byteOffset = 0x7fffffff
  20225. } else if (byteOffset < -0x80000000) {
  20226. byteOffset = -0x80000000
  20227. }
  20228. byteOffset = +byteOffset // Coerce to Number.
  20229. if (isNaN(byteOffset)) {
  20230. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  20231. byteOffset = dir ? 0 : (buffer.length - 1)
  20232. }
  20233. // Normalize byteOffset: negative offsets start from the end of the buffer
  20234. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  20235. if (byteOffset >= buffer.length) {
  20236. if (dir) return -1
  20237. else byteOffset = buffer.length - 1
  20238. } else if (byteOffset < 0) {
  20239. if (dir) byteOffset = 0
  20240. else return -1
  20241. }
  20242. // Normalize val
  20243. if (typeof val === 'string') {
  20244. val = Buffer.from(val, encoding)
  20245. }
  20246. // Finally, search either indexOf (if dir is true) or lastIndexOf
  20247. if (Buffer.isBuffer(val)) {
  20248. // Special case: looking for empty string/buffer always fails
  20249. if (val.length === 0) {
  20250. return -1
  20251. }
  20252. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  20253. } else if (typeof val === 'number') {
  20254. val = val & 0xFF // Search for a byte value [0-255]
  20255. if (Buffer.TYPED_ARRAY_SUPPORT &&
  20256. typeof Uint8Array.prototype.indexOf === 'function') {
  20257. if (dir) {
  20258. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  20259. } else {
  20260. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  20261. }
  20262. }
  20263. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  20264. }
  20265. throw new TypeError('val must be string, number or Buffer')
  20266. }
  20267. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  20268. var indexSize = 1
  20269. var arrLength = arr.length
  20270. var valLength = val.length
  20271. if (encoding !== undefined) {
  20272. encoding = String(encoding).toLowerCase()
  20273. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  20274. encoding === 'utf16le' || encoding === 'utf-16le') {
  20275. if (arr.length < 2 || val.length < 2) {
  20276. return -1
  20277. }
  20278. indexSize = 2
  20279. arrLength /= 2
  20280. valLength /= 2
  20281. byteOffset /= 2
  20282. }
  20283. }
  20284. function read (buf, i) {
  20285. if (indexSize === 1) {
  20286. return buf[i]
  20287. } else {
  20288. return buf.readUInt16BE(i * indexSize)
  20289. }
  20290. }
  20291. var i
  20292. if (dir) {
  20293. var foundIndex = -1
  20294. for (i = byteOffset; i < arrLength; i++) {
  20295. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  20296. if (foundIndex === -1) foundIndex = i
  20297. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  20298. } else {
  20299. if (foundIndex !== -1) i -= i - foundIndex
  20300. foundIndex = -1
  20301. }
  20302. }
  20303. } else {
  20304. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  20305. for (i = byteOffset; i >= 0; i--) {
  20306. var found = true
  20307. for (var j = 0; j < valLength; j++) {
  20308. if (read(arr, i + j) !== read(val, j)) {
  20309. found = false
  20310. break
  20311. }
  20312. }
  20313. if (found) return i
  20314. }
  20315. }
  20316. return -1
  20317. }
  20318. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  20319. return this.indexOf(val, byteOffset, encoding) !== -1
  20320. }
  20321. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  20322. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  20323. }
  20324. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  20325. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  20326. }
  20327. function hexWrite (buf, string, offset, length) {
  20328. offset = Number(offset) || 0
  20329. var remaining = buf.length - offset
  20330. if (!length) {
  20331. length = remaining
  20332. } else {
  20333. length = Number(length)
  20334. if (length > remaining) {
  20335. length = remaining
  20336. }
  20337. }
  20338. // must be an even number of digits
  20339. var strLen = string.length
  20340. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  20341. if (length > strLen / 2) {
  20342. length = strLen / 2
  20343. }
  20344. for (var i = 0; i < length; ++i) {
  20345. var parsed = parseInt(string.substr(i * 2, 2), 16)
  20346. if (isNaN(parsed)) return i
  20347. buf[offset + i] = parsed
  20348. }
  20349. return i
  20350. }
  20351. function utf8Write (buf, string, offset, length) {
  20352. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  20353. }
  20354. function asciiWrite (buf, string, offset, length) {
  20355. return blitBuffer(asciiToBytes(string), buf, offset, length)
  20356. }
  20357. function latin1Write (buf, string, offset, length) {
  20358. return asciiWrite(buf, string, offset, length)
  20359. }
  20360. function base64Write (buf, string, offset, length) {
  20361. return blitBuffer(base64ToBytes(string), buf, offset, length)
  20362. }
  20363. function ucs2Write (buf, string, offset, length) {
  20364. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  20365. }
  20366. Buffer.prototype.write = function write (string, offset, length, encoding) {
  20367. // Buffer#write(string)
  20368. if (offset === undefined) {
  20369. encoding = 'utf8'
  20370. length = this.length
  20371. offset = 0
  20372. // Buffer#write(string, encoding)
  20373. } else if (length === undefined && typeof offset === 'string') {
  20374. encoding = offset
  20375. length = this.length
  20376. offset = 0
  20377. // Buffer#write(string, offset[, length][, encoding])
  20378. } else if (isFinite(offset)) {
  20379. offset = offset | 0
  20380. if (isFinite(length)) {
  20381. length = length | 0
  20382. if (encoding === undefined) encoding = 'utf8'
  20383. } else {
  20384. encoding = length
  20385. length = undefined
  20386. }
  20387. // legacy write(string, encoding, offset, length) - remove in v0.13
  20388. } else {
  20389. throw new Error(
  20390. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  20391. )
  20392. }
  20393. var remaining = this.length - offset
  20394. if (length === undefined || length > remaining) length = remaining
  20395. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  20396. throw new RangeError('Attempt to write outside buffer bounds')
  20397. }
  20398. if (!encoding) encoding = 'utf8'
  20399. var loweredCase = false
  20400. for (;;) {
  20401. switch (encoding) {
  20402. case 'hex':
  20403. return hexWrite(this, string, offset, length)
  20404. case 'utf8':
  20405. case 'utf-8':
  20406. return utf8Write(this, string, offset, length)
  20407. case 'ascii':
  20408. return asciiWrite(this, string, offset, length)
  20409. case 'latin1':
  20410. case 'binary':
  20411. return latin1Write(this, string, offset, length)
  20412. case 'base64':
  20413. // Warning: maxLength not taken into account in base64Write
  20414. return base64Write(this, string, offset, length)
  20415. case 'ucs2':
  20416. case 'ucs-2':
  20417. case 'utf16le':
  20418. case 'utf-16le':
  20419. return ucs2Write(this, string, offset, length)
  20420. default:
  20421. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  20422. encoding = ('' + encoding).toLowerCase()
  20423. loweredCase = true
  20424. }
  20425. }
  20426. }
  20427. Buffer.prototype.toJSON = function toJSON () {
  20428. return {
  20429. type: 'Buffer',
  20430. data: Array.prototype.slice.call(this._arr || this, 0)
  20431. }
  20432. }
  20433. function base64Slice (buf, start, end) {
  20434. if (start === 0 && end === buf.length) {
  20435. return base64.fromByteArray(buf)
  20436. } else {
  20437. return base64.fromByteArray(buf.slice(start, end))
  20438. }
  20439. }
  20440. function utf8Slice (buf, start, end) {
  20441. end = Math.min(buf.length, end)
  20442. var res = []
  20443. var i = start
  20444. while (i < end) {
  20445. var firstByte = buf[i]
  20446. var codePoint = null
  20447. var bytesPerSequence = (firstByte > 0xEF) ? 4
  20448. : (firstByte > 0xDF) ? 3
  20449. : (firstByte > 0xBF) ? 2
  20450. : 1
  20451. if (i + bytesPerSequence <= end) {
  20452. var secondByte, thirdByte, fourthByte, tempCodePoint
  20453. switch (bytesPerSequence) {
  20454. case 1:
  20455. if (firstByte < 0x80) {
  20456. codePoint = firstByte
  20457. }
  20458. break
  20459. case 2:
  20460. secondByte = buf[i + 1]
  20461. if ((secondByte & 0xC0) === 0x80) {
  20462. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  20463. if (tempCodePoint > 0x7F) {
  20464. codePoint = tempCodePoint
  20465. }
  20466. }
  20467. break
  20468. case 3:
  20469. secondByte = buf[i + 1]
  20470. thirdByte = buf[i + 2]
  20471. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  20472. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  20473. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  20474. codePoint = tempCodePoint
  20475. }
  20476. }
  20477. break
  20478. case 4:
  20479. secondByte = buf[i + 1]
  20480. thirdByte = buf[i + 2]
  20481. fourthByte = buf[i + 3]
  20482. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  20483. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  20484. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  20485. codePoint = tempCodePoint
  20486. }
  20487. }
  20488. }
  20489. }
  20490. if (codePoint === null) {
  20491. // we did not generate a valid codePoint so insert a
  20492. // replacement char (U+FFFD) and advance only 1 byte
  20493. codePoint = 0xFFFD
  20494. bytesPerSequence = 1
  20495. } else if (codePoint > 0xFFFF) {
  20496. // encode to utf16 (surrogate pair dance)
  20497. codePoint -= 0x10000
  20498. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  20499. codePoint = 0xDC00 | codePoint & 0x3FF
  20500. }
  20501. res.push(codePoint)
  20502. i += bytesPerSequence
  20503. }
  20504. return decodeCodePointsArray(res)
  20505. }
  20506. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  20507. // the lowest limit is Chrome, with 0x10000 args.
  20508. // We go 1 magnitude less, for safety
  20509. var MAX_ARGUMENTS_LENGTH = 0x1000
  20510. function decodeCodePointsArray (codePoints) {
  20511. var len = codePoints.length
  20512. if (len <= MAX_ARGUMENTS_LENGTH) {
  20513. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  20514. }
  20515. // Decode in chunks to avoid "call stack size exceeded".
  20516. var res = ''
  20517. var i = 0
  20518. while (i < len) {
  20519. res += String.fromCharCode.apply(
  20520. String,
  20521. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  20522. )
  20523. }
  20524. return res
  20525. }
  20526. function asciiSlice (buf, start, end) {
  20527. var ret = ''
  20528. end = Math.min(buf.length, end)
  20529. for (var i = start; i < end; ++i) {
  20530. ret += String.fromCharCode(buf[i] & 0x7F)
  20531. }
  20532. return ret
  20533. }
  20534. function latin1Slice (buf, start, end) {
  20535. var ret = ''
  20536. end = Math.min(buf.length, end)
  20537. for (var i = start; i < end; ++i) {
  20538. ret += String.fromCharCode(buf[i])
  20539. }
  20540. return ret
  20541. }
  20542. function hexSlice (buf, start, end) {
  20543. var len = buf.length
  20544. if (!start || start < 0) start = 0
  20545. if (!end || end < 0 || end > len) end = len
  20546. var out = ''
  20547. for (var i = start; i < end; ++i) {
  20548. out += toHex(buf[i])
  20549. }
  20550. return out
  20551. }
  20552. function utf16leSlice (buf, start, end) {
  20553. var bytes = buf.slice(start, end)
  20554. var res = ''
  20555. for (var i = 0; i < bytes.length; i += 2) {
  20556. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  20557. }
  20558. return res
  20559. }
  20560. Buffer.prototype.slice = function slice (start, end) {
  20561. var len = this.length
  20562. start = ~~start
  20563. end = end === undefined ? len : ~~end
  20564. if (start < 0) {
  20565. start += len
  20566. if (start < 0) start = 0
  20567. } else if (start > len) {
  20568. start = len
  20569. }
  20570. if (end < 0) {
  20571. end += len
  20572. if (end < 0) end = 0
  20573. } else if (end > len) {
  20574. end = len
  20575. }
  20576. if (end < start) end = start
  20577. var newBuf
  20578. if (Buffer.TYPED_ARRAY_SUPPORT) {
  20579. newBuf = this.subarray(start, end)
  20580. newBuf.__proto__ = Buffer.prototype
  20581. } else {
  20582. var sliceLen = end - start
  20583. newBuf = new Buffer(sliceLen, undefined)
  20584. for (var i = 0; i < sliceLen; ++i) {
  20585. newBuf[i] = this[i + start]
  20586. }
  20587. }
  20588. return newBuf
  20589. }
  20590. /*
  20591. * Need to make sure that buffer isn't trying to write out of bounds.
  20592. */
  20593. function checkOffset (offset, ext, length) {
  20594. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  20595. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  20596. }
  20597. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  20598. offset = offset | 0
  20599. byteLength = byteLength | 0
  20600. if (!noAssert) checkOffset(offset, byteLength, this.length)
  20601. var val = this[offset]
  20602. var mul = 1
  20603. var i = 0
  20604. while (++i < byteLength && (mul *= 0x100)) {
  20605. val += this[offset + i] * mul
  20606. }
  20607. return val
  20608. }
  20609. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  20610. offset = offset | 0
  20611. byteLength = byteLength | 0
  20612. if (!noAssert) {
  20613. checkOffset(offset, byteLength, this.length)
  20614. }
  20615. var val = this[offset + --byteLength]
  20616. var mul = 1
  20617. while (byteLength > 0 && (mul *= 0x100)) {
  20618. val += this[offset + --byteLength] * mul
  20619. }
  20620. return val
  20621. }
  20622. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  20623. if (!noAssert) checkOffset(offset, 1, this.length)
  20624. return this[offset]
  20625. }
  20626. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  20627. if (!noAssert) checkOffset(offset, 2, this.length)
  20628. return this[offset] | (this[offset + 1] << 8)
  20629. }
  20630. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  20631. if (!noAssert) checkOffset(offset, 2, this.length)
  20632. return (this[offset] << 8) | this[offset + 1]
  20633. }
  20634. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  20635. if (!noAssert) checkOffset(offset, 4, this.length)
  20636. return ((this[offset]) |
  20637. (this[offset + 1] << 8) |
  20638. (this[offset + 2] << 16)) +
  20639. (this[offset + 3] * 0x1000000)
  20640. }
  20641. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  20642. if (!noAssert) checkOffset(offset, 4, this.length)
  20643. return (this[offset] * 0x1000000) +
  20644. ((this[offset + 1] << 16) |
  20645. (this[offset + 2] << 8) |
  20646. this[offset + 3])
  20647. }
  20648. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  20649. offset = offset | 0
  20650. byteLength = byteLength | 0
  20651. if (!noAssert) checkOffset(offset, byteLength, this.length)
  20652. var val = this[offset]
  20653. var mul = 1
  20654. var i = 0
  20655. while (++i < byteLength && (mul *= 0x100)) {
  20656. val += this[offset + i] * mul
  20657. }
  20658. mul *= 0x80
  20659. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  20660. return val
  20661. }
  20662. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  20663. offset = offset | 0
  20664. byteLength = byteLength | 0
  20665. if (!noAssert) checkOffset(offset, byteLength, this.length)
  20666. var i = byteLength
  20667. var mul = 1
  20668. var val = this[offset + --i]
  20669. while (i > 0 && (mul *= 0x100)) {
  20670. val += this[offset + --i] * mul
  20671. }
  20672. mul *= 0x80
  20673. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  20674. return val
  20675. }
  20676. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  20677. if (!noAssert) checkOffset(offset, 1, this.length)
  20678. if (!(this[offset] & 0x80)) return (this[offset])
  20679. return ((0xff - this[offset] + 1) * -1)
  20680. }
  20681. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  20682. if (!noAssert) checkOffset(offset, 2, this.length)
  20683. var val = this[offset] | (this[offset + 1] << 8)
  20684. return (val & 0x8000) ? val | 0xFFFF0000 : val
  20685. }
  20686. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  20687. if (!noAssert) checkOffset(offset, 2, this.length)
  20688. var val = this[offset + 1] | (this[offset] << 8)
  20689. return (val & 0x8000) ? val | 0xFFFF0000 : val
  20690. }
  20691. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  20692. if (!noAssert) checkOffset(offset, 4, this.length)
  20693. return (this[offset]) |
  20694. (this[offset + 1] << 8) |
  20695. (this[offset + 2] << 16) |
  20696. (this[offset + 3] << 24)
  20697. }
  20698. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  20699. if (!noAssert) checkOffset(offset, 4, this.length)
  20700. return (this[offset] << 24) |
  20701. (this[offset + 1] << 16) |
  20702. (this[offset + 2] << 8) |
  20703. (this[offset + 3])
  20704. }
  20705. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  20706. if (!noAssert) checkOffset(offset, 4, this.length)
  20707. return ieee754.read(this, offset, true, 23, 4)
  20708. }
  20709. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  20710. if (!noAssert) checkOffset(offset, 4, this.length)
  20711. return ieee754.read(this, offset, false, 23, 4)
  20712. }
  20713. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  20714. if (!noAssert) checkOffset(offset, 8, this.length)
  20715. return ieee754.read(this, offset, true, 52, 8)
  20716. }
  20717. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  20718. if (!noAssert) checkOffset(offset, 8, this.length)
  20719. return ieee754.read(this, offset, false, 52, 8)
  20720. }
  20721. function checkInt (buf, value, offset, ext, max, min) {
  20722. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  20723. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  20724. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  20725. }
  20726. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  20727. value = +value
  20728. offset = offset | 0
  20729. byteLength = byteLength | 0
  20730. if (!noAssert) {
  20731. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  20732. checkInt(this, value, offset, byteLength, maxBytes, 0)
  20733. }
  20734. var mul = 1
  20735. var i = 0
  20736. this[offset] = value & 0xFF
  20737. while (++i < byteLength && (mul *= 0x100)) {
  20738. this[offset + i] = (value / mul) & 0xFF
  20739. }
  20740. return offset + byteLength
  20741. }
  20742. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  20743. value = +value
  20744. offset = offset | 0
  20745. byteLength = byteLength | 0
  20746. if (!noAssert) {
  20747. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  20748. checkInt(this, value, offset, byteLength, maxBytes, 0)
  20749. }
  20750. var i = byteLength - 1
  20751. var mul = 1
  20752. this[offset + i] = value & 0xFF
  20753. while (--i >= 0 && (mul *= 0x100)) {
  20754. this[offset + i] = (value / mul) & 0xFF
  20755. }
  20756. return offset + byteLength
  20757. }
  20758. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  20759. value = +value
  20760. offset = offset | 0
  20761. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  20762. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  20763. this[offset] = (value & 0xff)
  20764. return offset + 1
  20765. }
  20766. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  20767. if (value < 0) value = 0xffff + value + 1
  20768. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  20769. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  20770. (littleEndian ? i : 1 - i) * 8
  20771. }
  20772. }
  20773. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  20774. value = +value
  20775. offset = offset | 0
  20776. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  20777. if (Buffer.TYPED_ARRAY_SUPPORT) {
  20778. this[offset] = (value & 0xff)
  20779. this[offset + 1] = (value >>> 8)
  20780. } else {
  20781. objectWriteUInt16(this, value, offset, true)
  20782. }
  20783. return offset + 2
  20784. }
  20785. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  20786. value = +value
  20787. offset = offset | 0
  20788. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  20789. if (Buffer.TYPED_ARRAY_SUPPORT) {
  20790. this[offset] = (value >>> 8)
  20791. this[offset + 1] = (value & 0xff)
  20792. } else {
  20793. objectWriteUInt16(this, value, offset, false)
  20794. }
  20795. return offset + 2
  20796. }
  20797. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  20798. if (value < 0) value = 0xffffffff + value + 1
  20799. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  20800. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  20801. }
  20802. }
  20803. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  20804. value = +value
  20805. offset = offset | 0
  20806. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  20807. if (Buffer.TYPED_ARRAY_SUPPORT) {
  20808. this[offset + 3] = (value >>> 24)
  20809. this[offset + 2] = (value >>> 16)
  20810. this[offset + 1] = (value >>> 8)
  20811. this[offset] = (value & 0xff)
  20812. } else {
  20813. objectWriteUInt32(this, value, offset, true)
  20814. }
  20815. return offset + 4
  20816. }
  20817. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  20818. value = +value
  20819. offset = offset | 0
  20820. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  20821. if (Buffer.TYPED_ARRAY_SUPPORT) {
  20822. this[offset] = (value >>> 24)
  20823. this[offset + 1] = (value >>> 16)
  20824. this[offset + 2] = (value >>> 8)
  20825. this[offset + 3] = (value & 0xff)
  20826. } else {
  20827. objectWriteUInt32(this, value, offset, false)
  20828. }
  20829. return offset + 4
  20830. }
  20831. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  20832. value = +value
  20833. offset = offset | 0
  20834. if (!noAssert) {
  20835. var limit = Math.pow(2, 8 * byteLength - 1)
  20836. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  20837. }
  20838. var i = 0
  20839. var mul = 1
  20840. var sub = 0
  20841. this[offset] = value & 0xFF
  20842. while (++i < byteLength && (mul *= 0x100)) {
  20843. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  20844. sub = 1
  20845. }
  20846. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  20847. }
  20848. return offset + byteLength
  20849. }
  20850. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  20851. value = +value
  20852. offset = offset | 0
  20853. if (!noAssert) {
  20854. var limit = Math.pow(2, 8 * byteLength - 1)
  20855. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  20856. }
  20857. var i = byteLength - 1
  20858. var mul = 1
  20859. var sub = 0
  20860. this[offset + i] = value & 0xFF
  20861. while (--i >= 0 && (mul *= 0x100)) {
  20862. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  20863. sub = 1
  20864. }
  20865. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  20866. }
  20867. return offset + byteLength
  20868. }
  20869. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  20870. value = +value
  20871. offset = offset | 0
  20872. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  20873. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  20874. if (value < 0) value = 0xff + value + 1
  20875. this[offset] = (value & 0xff)
  20876. return offset + 1
  20877. }
  20878. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  20879. value = +value
  20880. offset = offset | 0
  20881. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  20882. if (Buffer.TYPED_ARRAY_SUPPORT) {
  20883. this[offset] = (value & 0xff)
  20884. this[offset + 1] = (value >>> 8)
  20885. } else {
  20886. objectWriteUInt16(this, value, offset, true)
  20887. }
  20888. return offset + 2
  20889. }
  20890. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  20891. value = +value
  20892. offset = offset | 0
  20893. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  20894. if (Buffer.TYPED_ARRAY_SUPPORT) {
  20895. this[offset] = (value >>> 8)
  20896. this[offset + 1] = (value & 0xff)
  20897. } else {
  20898. objectWriteUInt16(this, value, offset, false)
  20899. }
  20900. return offset + 2
  20901. }
  20902. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  20903. value = +value
  20904. offset = offset | 0
  20905. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  20906. if (Buffer.TYPED_ARRAY_SUPPORT) {
  20907. this[offset] = (value & 0xff)
  20908. this[offset + 1] = (value >>> 8)
  20909. this[offset + 2] = (value >>> 16)
  20910. this[offset + 3] = (value >>> 24)
  20911. } else {
  20912. objectWriteUInt32(this, value, offset, true)
  20913. }
  20914. return offset + 4
  20915. }
  20916. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  20917. value = +value
  20918. offset = offset | 0
  20919. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  20920. if (value < 0) value = 0xffffffff + value + 1
  20921. if (Buffer.TYPED_ARRAY_SUPPORT) {
  20922. this[offset] = (value >>> 24)
  20923. this[offset + 1] = (value >>> 16)
  20924. this[offset + 2] = (value >>> 8)
  20925. this[offset + 3] = (value & 0xff)
  20926. } else {
  20927. objectWriteUInt32(this, value, offset, false)
  20928. }
  20929. return offset + 4
  20930. }
  20931. function checkIEEE754 (buf, value, offset, ext, max, min) {
  20932. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  20933. if (offset < 0) throw new RangeError('Index out of range')
  20934. }
  20935. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  20936. if (!noAssert) {
  20937. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  20938. }
  20939. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  20940. return offset + 4
  20941. }
  20942. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  20943. return writeFloat(this, value, offset, true, noAssert)
  20944. }
  20945. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  20946. return writeFloat(this, value, offset, false, noAssert)
  20947. }
  20948. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  20949. if (!noAssert) {
  20950. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  20951. }
  20952. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  20953. return offset + 8
  20954. }
  20955. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  20956. return writeDouble(this, value, offset, true, noAssert)
  20957. }
  20958. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  20959. return writeDouble(this, value, offset, false, noAssert)
  20960. }
  20961. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  20962. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  20963. if (!start) start = 0
  20964. if (!end && end !== 0) end = this.length
  20965. if (targetStart >= target.length) targetStart = target.length
  20966. if (!targetStart) targetStart = 0
  20967. if (end > 0 && end < start) end = start
  20968. // Copy 0 bytes; we're done
  20969. if (end === start) return 0
  20970. if (target.length === 0 || this.length === 0) return 0
  20971. // Fatal error conditions
  20972. if (targetStart < 0) {
  20973. throw new RangeError('targetStart out of bounds')
  20974. }
  20975. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  20976. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  20977. // Are we oob?
  20978. if (end > this.length) end = this.length
  20979. if (target.length - targetStart < end - start) {
  20980. end = target.length - targetStart + start
  20981. }
  20982. var len = end - start
  20983. var i
  20984. if (this === target && start < targetStart && targetStart < end) {
  20985. // descending copy from end
  20986. for (i = len - 1; i >= 0; --i) {
  20987. target[i + targetStart] = this[i + start]
  20988. }
  20989. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  20990. // ascending copy from start
  20991. for (i = 0; i < len; ++i) {
  20992. target[i + targetStart] = this[i + start]
  20993. }
  20994. } else {
  20995. Uint8Array.prototype.set.call(
  20996. target,
  20997. this.subarray(start, start + len),
  20998. targetStart
  20999. )
  21000. }
  21001. return len
  21002. }
  21003. // Usage:
  21004. // buffer.fill(number[, offset[, end]])
  21005. // buffer.fill(buffer[, offset[, end]])
  21006. // buffer.fill(string[, offset[, end]][, encoding])
  21007. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  21008. // Handle string cases:
  21009. if (typeof val === 'string') {
  21010. if (typeof start === 'string') {
  21011. encoding = start
  21012. start = 0
  21013. end = this.length
  21014. } else if (typeof end === 'string') {
  21015. encoding = end
  21016. end = this.length
  21017. }
  21018. if (val.length === 1) {
  21019. var code = val.charCodeAt(0)
  21020. if (code < 256) {
  21021. val = code
  21022. }
  21023. }
  21024. if (encoding !== undefined && typeof encoding !== 'string') {
  21025. throw new TypeError('encoding must be a string')
  21026. }
  21027. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  21028. throw new TypeError('Unknown encoding: ' + encoding)
  21029. }
  21030. } else if (typeof val === 'number') {
  21031. val = val & 255
  21032. }
  21033. // Invalid ranges are not set to a default, so can range check early.
  21034. if (start < 0 || this.length < start || this.length < end) {
  21035. throw new RangeError('Out of range index')
  21036. }
  21037. if (end <= start) {
  21038. return this
  21039. }
  21040. start = start >>> 0
  21041. end = end === undefined ? this.length : end >>> 0
  21042. if (!val) val = 0
  21043. var i
  21044. if (typeof val === 'number') {
  21045. for (i = start; i < end; ++i) {
  21046. this[i] = val
  21047. }
  21048. } else {
  21049. var bytes = Buffer.isBuffer(val)
  21050. ? val
  21051. : utf8ToBytes(new Buffer(val, encoding).toString())
  21052. var len = bytes.length
  21053. for (i = 0; i < end - start; ++i) {
  21054. this[i + start] = bytes[i % len]
  21055. }
  21056. }
  21057. return this
  21058. }
  21059. // HELPER FUNCTIONS
  21060. // ================
  21061. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  21062. function base64clean (str) {
  21063. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  21064. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  21065. // Node converts strings with length < 2 to ''
  21066. if (str.length < 2) return ''
  21067. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  21068. while (str.length % 4 !== 0) {
  21069. str = str + '='
  21070. }
  21071. return str
  21072. }
  21073. function stringtrim (str) {
  21074. if (str.trim) return str.trim()
  21075. return str.replace(/^\s+|\s+$/g, '')
  21076. }
  21077. function toHex (n) {
  21078. if (n < 16) return '0' + n.toString(16)
  21079. return n.toString(16)
  21080. }
  21081. function utf8ToBytes (string, units) {
  21082. units = units || Infinity
  21083. var codePoint
  21084. var length = string.length
  21085. var leadSurrogate = null
  21086. var bytes = []
  21087. for (var i = 0; i < length; ++i) {
  21088. codePoint = string.charCodeAt(i)
  21089. // is surrogate component
  21090. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  21091. // last char was a lead
  21092. if (!leadSurrogate) {
  21093. // no lead yet
  21094. if (codePoint > 0xDBFF) {
  21095. // unexpected trail
  21096. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  21097. continue
  21098. } else if (i + 1 === length) {
  21099. // unpaired lead
  21100. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  21101. continue
  21102. }
  21103. // valid lead
  21104. leadSurrogate = codePoint
  21105. continue
  21106. }
  21107. // 2 leads in a row
  21108. if (codePoint < 0xDC00) {
  21109. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  21110. leadSurrogate = codePoint
  21111. continue
  21112. }
  21113. // valid surrogate pair
  21114. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  21115. } else if (leadSurrogate) {
  21116. // valid bmp char, but last char was a lead
  21117. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  21118. }
  21119. leadSurrogate = null
  21120. // encode utf8
  21121. if (codePoint < 0x80) {
  21122. if ((units -= 1) < 0) break
  21123. bytes.push(codePoint)
  21124. } else if (codePoint < 0x800) {
  21125. if ((units -= 2) < 0) break
  21126. bytes.push(
  21127. codePoint >> 0x6 | 0xC0,
  21128. codePoint & 0x3F | 0x80
  21129. )
  21130. } else if (codePoint < 0x10000) {
  21131. if ((units -= 3) < 0) break
  21132. bytes.push(
  21133. codePoint >> 0xC | 0xE0,
  21134. codePoint >> 0x6 & 0x3F | 0x80,
  21135. codePoint & 0x3F | 0x80
  21136. )
  21137. } else if (codePoint < 0x110000) {
  21138. if ((units -= 4) < 0) break
  21139. bytes.push(
  21140. codePoint >> 0x12 | 0xF0,
  21141. codePoint >> 0xC & 0x3F | 0x80,
  21142. codePoint >> 0x6 & 0x3F | 0x80,
  21143. codePoint & 0x3F | 0x80
  21144. )
  21145. } else {
  21146. throw new Error('Invalid code point')
  21147. }
  21148. }
  21149. return bytes
  21150. }
  21151. function asciiToBytes (str) {
  21152. var byteArray = []
  21153. for (var i = 0; i < str.length; ++i) {
  21154. // Node's code seems to be doing this and not & 0x7F..
  21155. byteArray.push(str.charCodeAt(i) & 0xFF)
  21156. }
  21157. return byteArray
  21158. }
  21159. function utf16leToBytes (str, units) {
  21160. var c, hi, lo
  21161. var byteArray = []
  21162. for (var i = 0; i < str.length; ++i) {
  21163. if ((units -= 2) < 0) break
  21164. c = str.charCodeAt(i)
  21165. hi = c >> 8
  21166. lo = c % 256
  21167. byteArray.push(lo)
  21168. byteArray.push(hi)
  21169. }
  21170. return byteArray
  21171. }
  21172. function base64ToBytes (str) {
  21173. return base64.toByteArray(base64clean(str))
  21174. }
  21175. function blitBuffer (src, dst, offset, length) {
  21176. for (var i = 0; i < length; ++i) {
  21177. if ((i + offset >= dst.length) || (i >= src.length)) break
  21178. dst[i + offset] = src[i]
  21179. }
  21180. return i
  21181. }
  21182. function isnan (val) {
  21183. return val !== val // eslint-disable-line no-self-compare
  21184. }
  21185. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  21186. },{"base64-js":118,"ieee754":244,"isarray":247}],122:[function(require,module,exports){
  21187. (function (process){
  21188. 'use strict';
  21189. var escapeStringRegexp = require('escape-string-regexp');
  21190. var ansiStyles = require('ansi-styles');
  21191. var stripAnsi = require('strip-ansi');
  21192. var hasAnsi = require('has-ansi');
  21193. var supportsColor = require('supports-color');
  21194. var defineProps = Object.defineProperties;
  21195. var isSimpleWindowsTerm = process.platform === 'win32' && !/^xterm/i.test(process.env.TERM);
  21196. function Chalk(options) {
  21197. // detect mode if not set manually
  21198. this.enabled = !options || options.enabled === undefined ? supportsColor : options.enabled;
  21199. }
  21200. // use bright blue on Windows as the normal blue color is illegible
  21201. if (isSimpleWindowsTerm) {
  21202. ansiStyles.blue.open = '\u001b[94m';
  21203. }
  21204. var styles = (function () {
  21205. var ret = {};
  21206. Object.keys(ansiStyles).forEach(function (key) {
  21207. ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
  21208. ret[key] = {
  21209. get: function () {
  21210. return build.call(this, this._styles.concat(key));
  21211. }
  21212. };
  21213. });
  21214. return ret;
  21215. })();
  21216. var proto = defineProps(function chalk() {}, styles);
  21217. function build(_styles) {
  21218. var builder = function () {
  21219. return applyStyle.apply(builder, arguments);
  21220. };
  21221. builder._styles = _styles;
  21222. builder.enabled = this.enabled;
  21223. // __proto__ is used because we must return a function, but there is
  21224. // no way to create a function with a different prototype.
  21225. /* eslint-disable no-proto */
  21226. builder.__proto__ = proto;
  21227. return builder;
  21228. }
  21229. function applyStyle() {
  21230. // support varags, but simply cast to string in case there's only one arg
  21231. var args = arguments;
  21232. var argsLen = args.length;
  21233. var str = argsLen !== 0 && String(arguments[0]);
  21234. if (argsLen > 1) {
  21235. // don't slice `arguments`, it prevents v8 optimizations
  21236. for (var a = 1; a < argsLen; a++) {
  21237. str += ' ' + args[a];
  21238. }
  21239. }
  21240. if (!this.enabled || !str) {
  21241. return str;
  21242. }
  21243. var nestedStyles = this._styles;
  21244. var i = nestedStyles.length;
  21245. // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe,
  21246. // see https://github.com/chalk/chalk/issues/58
  21247. // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop.
  21248. var originalDim = ansiStyles.dim.open;
  21249. if (isSimpleWindowsTerm && (nestedStyles.indexOf('gray') !== -1 || nestedStyles.indexOf('grey') !== -1)) {
  21250. ansiStyles.dim.open = '';
  21251. }
  21252. while (i--) {
  21253. var code = ansiStyles[nestedStyles[i]];
  21254. // Replace any instances already present with a re-opening code
  21255. // otherwise only the part of the string until said closing code
  21256. // will be colored, and the rest will simply be 'plain'.
  21257. str = code.open + str.replace(code.closeRe, code.open) + code.close;
  21258. }
  21259. // Reset the original 'dim' if we changed it to work around the Windows dimmed gray issue.
  21260. ansiStyles.dim.open = originalDim;
  21261. return str;
  21262. }
  21263. function init() {
  21264. var ret = {};
  21265. Object.keys(styles).forEach(function (name) {
  21266. ret[name] = {
  21267. get: function () {
  21268. return build.call(this, [name]);
  21269. }
  21270. };
  21271. });
  21272. return ret;
  21273. }
  21274. defineProps(Chalk.prototype, init());
  21275. module.exports = new Chalk();
  21276. module.exports.styles = ansiStyles;
  21277. module.exports.hasColor = hasAnsi;
  21278. module.exports.stripColor = stripAnsi;
  21279. module.exports.supportsColor = supportsColor;
  21280. }).call(this,require('_process'))
  21281. },{"_process":471,"ansi-styles":2,"escape-string-regexp":236,"has-ansi":243,"strip-ansi":485,"supports-color":486}],123:[function(require,module,exports){
  21282. module.exports = function (xs, fn) {
  21283. var res = [];
  21284. for (var i = 0; i < xs.length; i++) {
  21285. var x = fn(xs[i], i);
  21286. if (isArray(x)) res.push.apply(res, x);
  21287. else res.push(x);
  21288. }
  21289. return res;
  21290. };
  21291. var isArray = Array.isArray || function (xs) {
  21292. return Object.prototype.toString.call(xs) === '[object Array]';
  21293. };
  21294. },{}],124:[function(require,module,exports){
  21295. (function (Buffer){
  21296. 'use strict';
  21297. var fs = require('fs');
  21298. var path = require('path');
  21299. var commentRx = /^\s*\/(?:\/|\*)[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+?;)?base64,(?:.*)$/mg;
  21300. var mapFileCommentRx =
  21301. //Example (Extra space between slashes added to solve Safari bug. Exclude space in production):
  21302. // / /# sourceMappingURL=foo.js.map
  21303. /(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/){1}[ \t]*$)/mg
  21304. function decodeBase64(base64) {
  21305. return new Buffer(base64, 'base64').toString();
  21306. }
  21307. function stripComment(sm) {
  21308. return sm.split(',').pop();
  21309. }
  21310. function readFromFileMap(sm, dir) {
  21311. // NOTE: this will only work on the server since it attempts to read the map file
  21312. mapFileCommentRx.lastIndex = 0;
  21313. var r = mapFileCommentRx.exec(sm);
  21314. // for some odd reason //# .. captures in 1 and /* .. */ in 2
  21315. var filename = r[1] || r[2];
  21316. var filepath = path.resolve(dir, filename);
  21317. try {
  21318. return fs.readFileSync(filepath, 'utf8');
  21319. } catch (e) {
  21320. throw new Error('An error occurred while trying to read the map file at ' + filepath + '\n' + e);
  21321. }
  21322. }
  21323. function Converter (sm, opts) {
  21324. opts = opts || {};
  21325. if (opts.isFileComment) sm = readFromFileMap(sm, opts.commentFileDir);
  21326. if (opts.hasComment) sm = stripComment(sm);
  21327. if (opts.isEncoded) sm = decodeBase64(sm);
  21328. if (opts.isJSON || opts.isEncoded) sm = JSON.parse(sm);
  21329. this.sourcemap = sm;
  21330. }
  21331. Converter.prototype.toJSON = function (space) {
  21332. return JSON.stringify(this.sourcemap, null, space);
  21333. };
  21334. Converter.prototype.toBase64 = function () {
  21335. var json = this.toJSON();
  21336. return new Buffer(json).toString('base64');
  21337. };
  21338. Converter.prototype.toComment = function (options) {
  21339. var base64 = this.toBase64();
  21340. var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
  21341. return options && options.multiline ? '/*# ' + data + ' */' : '//# ' + data;
  21342. };
  21343. // returns copy instead of original
  21344. Converter.prototype.toObject = function () {
  21345. return JSON.parse(this.toJSON());
  21346. };
  21347. Converter.prototype.addProperty = function (key, value) {
  21348. if (this.sourcemap.hasOwnProperty(key)) throw new Error('property %s already exists on the sourcemap, use set property instead');
  21349. return this.setProperty(key, value);
  21350. };
  21351. Converter.prototype.setProperty = function (key, value) {
  21352. this.sourcemap[key] = value;
  21353. return this;
  21354. };
  21355. Converter.prototype.getProperty = function (key) {
  21356. return this.sourcemap[key];
  21357. };
  21358. exports.fromObject = function (obj) {
  21359. return new Converter(obj);
  21360. };
  21361. exports.fromJSON = function (json) {
  21362. return new Converter(json, { isJSON: true });
  21363. };
  21364. exports.fromBase64 = function (base64) {
  21365. return new Converter(base64, { isEncoded: true });
  21366. };
  21367. exports.fromComment = function (comment) {
  21368. comment = comment
  21369. .replace(/^\/\*/g, '//')
  21370. .replace(/\*\/$/g, '');
  21371. return new Converter(comment, { isEncoded: true, hasComment: true });
  21372. };
  21373. exports.fromMapFileComment = function (comment, dir) {
  21374. return new Converter(comment, { commentFileDir: dir, isFileComment: true, isJSON: true });
  21375. };
  21376. // Finds last sourcemap comment in file or returns null if none was found
  21377. exports.fromSource = function (content) {
  21378. var m = content.match(commentRx);
  21379. return m ? exports.fromComment(m.pop()) : null;
  21380. };
  21381. // Finds last sourcemap comment in file or returns null if none was found
  21382. exports.fromMapFileSource = function (content, dir) {
  21383. var m = content.match(mapFileCommentRx);
  21384. return m ? exports.fromMapFileComment(m.pop(), dir) : null;
  21385. };
  21386. exports.removeComments = function (src) {
  21387. return src.replace(commentRx, '');
  21388. };
  21389. exports.removeMapFileComments = function (src) {
  21390. return src.replace(mapFileCommentRx, '');
  21391. };
  21392. exports.generateMapFileComment = function (file, options) {
  21393. var data = 'sourceMappingURL=' + file;
  21394. return options && options.multiline ? '/*# ' + data + ' */' : '//# ' + data;
  21395. };
  21396. Object.defineProperty(exports, 'commentRegex', {
  21397. get: function getCommentRegex () {
  21398. return commentRx;
  21399. }
  21400. });
  21401. Object.defineProperty(exports, 'mapFileCommentRegex', {
  21402. get: function getMapFileCommentRegex () {
  21403. return mapFileCommentRx;
  21404. }
  21405. });
  21406. }).call(this,require("buffer").Buffer)
  21407. },{"buffer":121,"fs":120,"path":469}],125:[function(require,module,exports){
  21408. require('../modules/web.dom.iterable');
  21409. require('../modules/es6.string.iterator');
  21410. module.exports = require('../modules/core.get-iterator');
  21411. },{"../modules/core.get-iterator":214,"../modules/es6.string.iterator":223,"../modules/web.dom.iterable":230}],126:[function(require,module,exports){
  21412. var core = require('../../modules/_core')
  21413. , $JSON = core.JSON || (core.JSON = {stringify: JSON.stringify});
  21414. module.exports = function stringify(it){ // eslint-disable-line no-unused-vars
  21415. return $JSON.stringify.apply($JSON, arguments);
  21416. };
  21417. },{"../../modules/_core":154}],127:[function(require,module,exports){
  21418. require('../modules/es6.object.to-string');
  21419. require('../modules/es6.string.iterator');
  21420. require('../modules/web.dom.iterable');
  21421. require('../modules/es6.map');
  21422. require('../modules/es7.map.to-json');
  21423. module.exports = require('../modules/_core').Map;
  21424. },{"../modules/_core":154,"../modules/es6.map":216,"../modules/es6.object.to-string":222,"../modules/es6.string.iterator":223,"../modules/es7.map.to-json":227,"../modules/web.dom.iterable":230}],128:[function(require,module,exports){
  21425. require('../../modules/es6.number.max-safe-integer');
  21426. module.exports = 0x1fffffffffffff;
  21427. },{"../../modules/es6.number.max-safe-integer":217}],129:[function(require,module,exports){
  21428. require('../../modules/es6.object.assign');
  21429. module.exports = require('../../modules/_core').Object.assign;
  21430. },{"../../modules/_core":154,"../../modules/es6.object.assign":218}],130:[function(require,module,exports){
  21431. require('../../modules/es6.object.create');
  21432. var $Object = require('../../modules/_core').Object;
  21433. module.exports = function create(P, D){
  21434. return $Object.create(P, D);
  21435. };
  21436. },{"../../modules/_core":154,"../../modules/es6.object.create":219}],131:[function(require,module,exports){
  21437. require('../../modules/es6.symbol');
  21438. module.exports = require('../../modules/_core').Object.getOwnPropertySymbols;
  21439. },{"../../modules/_core":154,"../../modules/es6.symbol":224}],132:[function(require,module,exports){
  21440. require('../../modules/es6.object.keys');
  21441. module.exports = require('../../modules/_core').Object.keys;
  21442. },{"../../modules/_core":154,"../../modules/es6.object.keys":220}],133:[function(require,module,exports){
  21443. require('../../modules/es6.object.set-prototype-of');
  21444. module.exports = require('../../modules/_core').Object.setPrototypeOf;
  21445. },{"../../modules/_core":154,"../../modules/es6.object.set-prototype-of":221}],134:[function(require,module,exports){
  21446. require('../../modules/es6.symbol');
  21447. module.exports = require('../../modules/_core').Symbol['for'];
  21448. },{"../../modules/_core":154,"../../modules/es6.symbol":224}],135:[function(require,module,exports){
  21449. require('../../modules/es6.symbol');
  21450. require('../../modules/es6.object.to-string');
  21451. require('../../modules/es7.symbol.async-iterator');
  21452. require('../../modules/es7.symbol.observable');
  21453. module.exports = require('../../modules/_core').Symbol;
  21454. },{"../../modules/_core":154,"../../modules/es6.object.to-string":222,"../../modules/es6.symbol":224,"../../modules/es7.symbol.async-iterator":228,"../../modules/es7.symbol.observable":229}],136:[function(require,module,exports){
  21455. require('../../modules/es6.string.iterator');
  21456. require('../../modules/web.dom.iterable');
  21457. module.exports = require('../../modules/_wks-ext').f('iterator');
  21458. },{"../../modules/_wks-ext":211,"../../modules/es6.string.iterator":223,"../../modules/web.dom.iterable":230}],137:[function(require,module,exports){
  21459. require('../modules/es6.object.to-string');
  21460. require('../modules/web.dom.iterable');
  21461. require('../modules/es6.weak-map');
  21462. module.exports = require('../modules/_core').WeakMap;
  21463. },{"../modules/_core":154,"../modules/es6.object.to-string":222,"../modules/es6.weak-map":225,"../modules/web.dom.iterable":230}],138:[function(require,module,exports){
  21464. require('../modules/es6.object.to-string');
  21465. require('../modules/web.dom.iterable');
  21466. require('../modules/es6.weak-set');
  21467. module.exports = require('../modules/_core').WeakSet;
  21468. },{"../modules/_core":154,"../modules/es6.object.to-string":222,"../modules/es6.weak-set":226,"../modules/web.dom.iterable":230}],139:[function(require,module,exports){
  21469. module.exports = function(it){
  21470. if(typeof it != 'function')throw TypeError(it + ' is not a function!');
  21471. return it;
  21472. };
  21473. },{}],140:[function(require,module,exports){
  21474. module.exports = function(){ /* empty */ };
  21475. },{}],141:[function(require,module,exports){
  21476. module.exports = function(it, Constructor, name, forbiddenField){
  21477. if(!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)){
  21478. throw TypeError(name + ': incorrect invocation!');
  21479. } return it;
  21480. };
  21481. },{}],142:[function(require,module,exports){
  21482. var isObject = require('./_is-object');
  21483. module.exports = function(it){
  21484. if(!isObject(it))throw TypeError(it + ' is not an object!');
  21485. return it;
  21486. };
  21487. },{"./_is-object":172}],143:[function(require,module,exports){
  21488. var forOf = require('./_for-of');
  21489. module.exports = function(iter, ITERATOR){
  21490. var result = [];
  21491. forOf(iter, false, result.push, result, ITERATOR);
  21492. return result;
  21493. };
  21494. },{"./_for-of":163}],144:[function(require,module,exports){
  21495. // false -> Array#indexOf
  21496. // true -> Array#includes
  21497. var toIObject = require('./_to-iobject')
  21498. , toLength = require('./_to-length')
  21499. , toIndex = require('./_to-index');
  21500. module.exports = function(IS_INCLUDES){
  21501. return function($this, el, fromIndex){
  21502. var O = toIObject($this)
  21503. , length = toLength(O.length)
  21504. , index = toIndex(fromIndex, length)
  21505. , value;
  21506. // Array#includes uses SameValueZero equality algorithm
  21507. if(IS_INCLUDES && el != el)while(length > index){
  21508. value = O[index++];
  21509. if(value != value)return true;
  21510. // Array#toIndex ignores holes, Array#includes - not
  21511. } else for(;length > index; index++)if(IS_INCLUDES || index in O){
  21512. if(O[index] === el)return IS_INCLUDES || index || 0;
  21513. } return !IS_INCLUDES && -1;
  21514. };
  21515. };
  21516. },{"./_to-index":203,"./_to-iobject":205,"./_to-length":206}],145:[function(require,module,exports){
  21517. // 0 -> Array#forEach
  21518. // 1 -> Array#map
  21519. // 2 -> Array#filter
  21520. // 3 -> Array#some
  21521. // 4 -> Array#every
  21522. // 5 -> Array#find
  21523. // 6 -> Array#findIndex
  21524. var ctx = require('./_ctx')
  21525. , IObject = require('./_iobject')
  21526. , toObject = require('./_to-object')
  21527. , toLength = require('./_to-length')
  21528. , asc = require('./_array-species-create');
  21529. module.exports = function(TYPE, $create){
  21530. var IS_MAP = TYPE == 1
  21531. , IS_FILTER = TYPE == 2
  21532. , IS_SOME = TYPE == 3
  21533. , IS_EVERY = TYPE == 4
  21534. , IS_FIND_INDEX = TYPE == 6
  21535. , NO_HOLES = TYPE == 5 || IS_FIND_INDEX
  21536. , create = $create || asc;
  21537. return function($this, callbackfn, that){
  21538. var O = toObject($this)
  21539. , self = IObject(O)
  21540. , f = ctx(callbackfn, that, 3)
  21541. , length = toLength(self.length)
  21542. , index = 0
  21543. , result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined
  21544. , val, res;
  21545. for(;length > index; index++)if(NO_HOLES || index in self){
  21546. val = self[index];
  21547. res = f(val, index, O);
  21548. if(TYPE){
  21549. if(IS_MAP)result[index] = res; // map
  21550. else if(res)switch(TYPE){
  21551. case 3: return true; // some
  21552. case 5: return val; // find
  21553. case 6: return index; // findIndex
  21554. case 2: result.push(val); // filter
  21555. } else if(IS_EVERY)return false; // every
  21556. }
  21557. }
  21558. return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
  21559. };
  21560. };
  21561. },{"./_array-species-create":147,"./_ctx":155,"./_iobject":169,"./_to-length":206,"./_to-object":207}],146:[function(require,module,exports){
  21562. var isObject = require('./_is-object')
  21563. , isArray = require('./_is-array')
  21564. , SPECIES = require('./_wks')('species');
  21565. module.exports = function(original){
  21566. var C;
  21567. if(isArray(original)){
  21568. C = original.constructor;
  21569. // cross-realm fallback
  21570. if(typeof C == 'function' && (C === Array || isArray(C.prototype)))C = undefined;
  21571. if(isObject(C)){
  21572. C = C[SPECIES];
  21573. if(C === null)C = undefined;
  21574. }
  21575. } return C === undefined ? Array : C;
  21576. };
  21577. },{"./_is-array":171,"./_is-object":172,"./_wks":212}],147:[function(require,module,exports){
  21578. // 9.4.2.3 ArraySpeciesCreate(originalArray, length)
  21579. var speciesConstructor = require('./_array-species-constructor');
  21580. module.exports = function(original, length){
  21581. return new (speciesConstructor(original))(length);
  21582. };
  21583. },{"./_array-species-constructor":146}],148:[function(require,module,exports){
  21584. // getting tag from 19.1.3.6 Object.prototype.toString()
  21585. var cof = require('./_cof')
  21586. , TAG = require('./_wks')('toStringTag')
  21587. // ES3 wrong here
  21588. , ARG = cof(function(){ return arguments; }()) == 'Arguments';
  21589. // fallback for IE11 Script Access Denied error
  21590. var tryGet = function(it, key){
  21591. try {
  21592. return it[key];
  21593. } catch(e){ /* empty */ }
  21594. };
  21595. module.exports = function(it){
  21596. var O, T, B;
  21597. return it === undefined ? 'Undefined' : it === null ? 'Null'
  21598. // @@toStringTag case
  21599. : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
  21600. // builtinTag case
  21601. : ARG ? cof(O)
  21602. // ES3 arguments fallback
  21603. : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
  21604. };
  21605. },{"./_cof":149,"./_wks":212}],149:[function(require,module,exports){
  21606. var toString = {}.toString;
  21607. module.exports = function(it){
  21608. return toString.call(it).slice(8, -1);
  21609. };
  21610. },{}],150:[function(require,module,exports){
  21611. 'use strict';
  21612. var dP = require('./_object-dp').f
  21613. , create = require('./_object-create')
  21614. , redefineAll = require('./_redefine-all')
  21615. , ctx = require('./_ctx')
  21616. , anInstance = require('./_an-instance')
  21617. , defined = require('./_defined')
  21618. , forOf = require('./_for-of')
  21619. , $iterDefine = require('./_iter-define')
  21620. , step = require('./_iter-step')
  21621. , setSpecies = require('./_set-species')
  21622. , DESCRIPTORS = require('./_descriptors')
  21623. , fastKey = require('./_meta').fastKey
  21624. , SIZE = DESCRIPTORS ? '_s' : 'size';
  21625. var getEntry = function(that, key){
  21626. // fast case
  21627. var index = fastKey(key), entry;
  21628. if(index !== 'F')return that._i[index];
  21629. // frozen object case
  21630. for(entry = that._f; entry; entry = entry.n){
  21631. if(entry.k == key)return entry;
  21632. }
  21633. };
  21634. module.exports = {
  21635. getConstructor: function(wrapper, NAME, IS_MAP, ADDER){
  21636. var C = wrapper(function(that, iterable){
  21637. anInstance(that, C, NAME, '_i');
  21638. that._i = create(null); // index
  21639. that._f = undefined; // first entry
  21640. that._l = undefined; // last entry
  21641. that[SIZE] = 0; // size
  21642. if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
  21643. });
  21644. redefineAll(C.prototype, {
  21645. // 23.1.3.1 Map.prototype.clear()
  21646. // 23.2.3.2 Set.prototype.clear()
  21647. clear: function clear(){
  21648. for(var that = this, data = that._i, entry = that._f; entry; entry = entry.n){
  21649. entry.r = true;
  21650. if(entry.p)entry.p = entry.p.n = undefined;
  21651. delete data[entry.i];
  21652. }
  21653. that._f = that._l = undefined;
  21654. that[SIZE] = 0;
  21655. },
  21656. // 23.1.3.3 Map.prototype.delete(key)
  21657. // 23.2.3.4 Set.prototype.delete(value)
  21658. 'delete': function(key){
  21659. var that = this
  21660. , entry = getEntry(that, key);
  21661. if(entry){
  21662. var next = entry.n
  21663. , prev = entry.p;
  21664. delete that._i[entry.i];
  21665. entry.r = true;
  21666. if(prev)prev.n = next;
  21667. if(next)next.p = prev;
  21668. if(that._f == entry)that._f = next;
  21669. if(that._l == entry)that._l = prev;
  21670. that[SIZE]--;
  21671. } return !!entry;
  21672. },
  21673. // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
  21674. // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
  21675. forEach: function forEach(callbackfn /*, that = undefined */){
  21676. anInstance(this, C, 'forEach');
  21677. var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3)
  21678. , entry;
  21679. while(entry = entry ? entry.n : this._f){
  21680. f(entry.v, entry.k, this);
  21681. // revert to the last existing entry
  21682. while(entry && entry.r)entry = entry.p;
  21683. }
  21684. },
  21685. // 23.1.3.7 Map.prototype.has(key)
  21686. // 23.2.3.7 Set.prototype.has(value)
  21687. has: function has(key){
  21688. return !!getEntry(this, key);
  21689. }
  21690. });
  21691. if(DESCRIPTORS)dP(C.prototype, 'size', {
  21692. get: function(){
  21693. return defined(this[SIZE]);
  21694. }
  21695. });
  21696. return C;
  21697. },
  21698. def: function(that, key, value){
  21699. var entry = getEntry(that, key)
  21700. , prev, index;
  21701. // change existing entry
  21702. if(entry){
  21703. entry.v = value;
  21704. // create new entry
  21705. } else {
  21706. that._l = entry = {
  21707. i: index = fastKey(key, true), // <- index
  21708. k: key, // <- key
  21709. v: value, // <- value
  21710. p: prev = that._l, // <- previous entry
  21711. n: undefined, // <- next entry
  21712. r: false // <- removed
  21713. };
  21714. if(!that._f)that._f = entry;
  21715. if(prev)prev.n = entry;
  21716. that[SIZE]++;
  21717. // add to index
  21718. if(index !== 'F')that._i[index] = entry;
  21719. } return that;
  21720. },
  21721. getEntry: getEntry,
  21722. setStrong: function(C, NAME, IS_MAP){
  21723. // add .keys, .values, .entries, [@@iterator]
  21724. // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
  21725. $iterDefine(C, NAME, function(iterated, kind){
  21726. this._t = iterated; // target
  21727. this._k = kind; // kind
  21728. this._l = undefined; // previous
  21729. }, function(){
  21730. var that = this
  21731. , kind = that._k
  21732. , entry = that._l;
  21733. // revert to the last existing entry
  21734. while(entry && entry.r)entry = entry.p;
  21735. // get next entry
  21736. if(!that._t || !(that._l = entry = entry ? entry.n : that._t._f)){
  21737. // or finish the iteration
  21738. that._t = undefined;
  21739. return step(1);
  21740. }
  21741. // return step by kind
  21742. if(kind == 'keys' )return step(0, entry.k);
  21743. if(kind == 'values')return step(0, entry.v);
  21744. return step(0, [entry.k, entry.v]);
  21745. }, IS_MAP ? 'entries' : 'values' , !IS_MAP, true);
  21746. // add [@@species], 23.1.2.2, 23.2.2.2
  21747. setSpecies(NAME);
  21748. }
  21749. };
  21750. },{"./_an-instance":141,"./_ctx":155,"./_defined":156,"./_descriptors":157,"./_for-of":163,"./_iter-define":175,"./_iter-step":176,"./_meta":180,"./_object-create":182,"./_object-dp":183,"./_redefine-all":195,"./_set-species":198}],151:[function(require,module,exports){
  21751. // https://github.com/DavidBruant/Map-Set.prototype.toJSON
  21752. var classof = require('./_classof')
  21753. , from = require('./_array-from-iterable');
  21754. module.exports = function(NAME){
  21755. return function toJSON(){
  21756. if(classof(this) != NAME)throw TypeError(NAME + "#toJSON isn't generic");
  21757. return from(this);
  21758. };
  21759. };
  21760. },{"./_array-from-iterable":143,"./_classof":148}],152:[function(require,module,exports){
  21761. 'use strict';
  21762. var redefineAll = require('./_redefine-all')
  21763. , getWeak = require('./_meta').getWeak
  21764. , anObject = require('./_an-object')
  21765. , isObject = require('./_is-object')
  21766. , anInstance = require('./_an-instance')
  21767. , forOf = require('./_for-of')
  21768. , createArrayMethod = require('./_array-methods')
  21769. , $has = require('./_has')
  21770. , arrayFind = createArrayMethod(5)
  21771. , arrayFindIndex = createArrayMethod(6)
  21772. , id = 0;
  21773. // fallback for uncaught frozen keys
  21774. var uncaughtFrozenStore = function(that){
  21775. return that._l || (that._l = new UncaughtFrozenStore);
  21776. };
  21777. var UncaughtFrozenStore = function(){
  21778. this.a = [];
  21779. };
  21780. var findUncaughtFrozen = function(store, key){
  21781. return arrayFind(store.a, function(it){
  21782. return it[0] === key;
  21783. });
  21784. };
  21785. UncaughtFrozenStore.prototype = {
  21786. get: function(key){
  21787. var entry = findUncaughtFrozen(this, key);
  21788. if(entry)return entry[1];
  21789. },
  21790. has: function(key){
  21791. return !!findUncaughtFrozen(this, key);
  21792. },
  21793. set: function(key, value){
  21794. var entry = findUncaughtFrozen(this, key);
  21795. if(entry)entry[1] = value;
  21796. else this.a.push([key, value]);
  21797. },
  21798. 'delete': function(key){
  21799. var index = arrayFindIndex(this.a, function(it){
  21800. return it[0] === key;
  21801. });
  21802. if(~index)this.a.splice(index, 1);
  21803. return !!~index;
  21804. }
  21805. };
  21806. module.exports = {
  21807. getConstructor: function(wrapper, NAME, IS_MAP, ADDER){
  21808. var C = wrapper(function(that, iterable){
  21809. anInstance(that, C, NAME, '_i');
  21810. that._i = id++; // collection id
  21811. that._l = undefined; // leak store for uncaught frozen objects
  21812. if(iterable != undefined)forOf(iterable, IS_MAP, that[ADDER], that);
  21813. });
  21814. redefineAll(C.prototype, {
  21815. // 23.3.3.2 WeakMap.prototype.delete(key)
  21816. // 23.4.3.3 WeakSet.prototype.delete(value)
  21817. 'delete': function(key){
  21818. if(!isObject(key))return false;
  21819. var data = getWeak(key);
  21820. if(data === true)return uncaughtFrozenStore(this)['delete'](key);
  21821. return data && $has(data, this._i) && delete data[this._i];
  21822. },
  21823. // 23.3.3.4 WeakMap.prototype.has(key)
  21824. // 23.4.3.4 WeakSet.prototype.has(value)
  21825. has: function has(key){
  21826. if(!isObject(key))return false;
  21827. var data = getWeak(key);
  21828. if(data === true)return uncaughtFrozenStore(this).has(key);
  21829. return data && $has(data, this._i);
  21830. }
  21831. });
  21832. return C;
  21833. },
  21834. def: function(that, key, value){
  21835. var data = getWeak(anObject(key), true);
  21836. if(data === true)uncaughtFrozenStore(that).set(key, value);
  21837. else data[that._i] = value;
  21838. return that;
  21839. },
  21840. ufstore: uncaughtFrozenStore
  21841. };
  21842. },{"./_an-instance":141,"./_an-object":142,"./_array-methods":145,"./_for-of":163,"./_has":165,"./_is-object":172,"./_meta":180,"./_redefine-all":195}],153:[function(require,module,exports){
  21843. 'use strict';
  21844. var global = require('./_global')
  21845. , $export = require('./_export')
  21846. , meta = require('./_meta')
  21847. , fails = require('./_fails')
  21848. , hide = require('./_hide')
  21849. , redefineAll = require('./_redefine-all')
  21850. , forOf = require('./_for-of')
  21851. , anInstance = require('./_an-instance')
  21852. , isObject = require('./_is-object')
  21853. , setToStringTag = require('./_set-to-string-tag')
  21854. , dP = require('./_object-dp').f
  21855. , each = require('./_array-methods')(0)
  21856. , DESCRIPTORS = require('./_descriptors');
  21857. module.exports = function(NAME, wrapper, methods, common, IS_MAP, IS_WEAK){
  21858. var Base = global[NAME]
  21859. , C = Base
  21860. , ADDER = IS_MAP ? 'set' : 'add'
  21861. , proto = C && C.prototype
  21862. , O = {};
  21863. if(!DESCRIPTORS || typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function(){
  21864. new C().entries().next();
  21865. }))){
  21866. // create collection constructor
  21867. C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
  21868. redefineAll(C.prototype, methods);
  21869. meta.NEED = true;
  21870. } else {
  21871. C = wrapper(function(target, iterable){
  21872. anInstance(target, C, NAME, '_c');
  21873. target._c = new Base;
  21874. if(iterable != undefined)forOf(iterable, IS_MAP, target[ADDER], target);
  21875. });
  21876. each('add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON'.split(','),function(KEY){
  21877. var IS_ADDER = KEY == 'add' || KEY == 'set';
  21878. if(KEY in proto && !(IS_WEAK && KEY == 'clear'))hide(C.prototype, KEY, function(a, b){
  21879. anInstance(this, C, KEY);
  21880. if(!IS_ADDER && IS_WEAK && !isObject(a))return KEY == 'get' ? undefined : false;
  21881. var result = this._c[KEY](a === 0 ? 0 : a, b);
  21882. return IS_ADDER ? this : result;
  21883. });
  21884. });
  21885. if('size' in proto)dP(C.prototype, 'size', {
  21886. get: function(){
  21887. return this._c.size;
  21888. }
  21889. });
  21890. }
  21891. setToStringTag(C, NAME);
  21892. O[NAME] = C;
  21893. $export($export.G + $export.W + $export.F, O);
  21894. if(!IS_WEAK)common.setStrong(C, NAME, IS_MAP);
  21895. return C;
  21896. };
  21897. },{"./_an-instance":141,"./_array-methods":145,"./_descriptors":157,"./_export":161,"./_fails":162,"./_for-of":163,"./_global":164,"./_hide":166,"./_is-object":172,"./_meta":180,"./_object-dp":183,"./_redefine-all":195,"./_set-to-string-tag":199}],154:[function(require,module,exports){
  21898. var core = module.exports = {version: '2.4.0'};
  21899. if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
  21900. },{}],155:[function(require,module,exports){
  21901. // optional / simple context binding
  21902. var aFunction = require('./_a-function');
  21903. module.exports = function(fn, that, length){
  21904. aFunction(fn);
  21905. if(that === undefined)return fn;
  21906. switch(length){
  21907. case 1: return function(a){
  21908. return fn.call(that, a);
  21909. };
  21910. case 2: return function(a, b){
  21911. return fn.call(that, a, b);
  21912. };
  21913. case 3: return function(a, b, c){
  21914. return fn.call(that, a, b, c);
  21915. };
  21916. }
  21917. return function(/* ...args */){
  21918. return fn.apply(that, arguments);
  21919. };
  21920. };
  21921. },{"./_a-function":139}],156:[function(require,module,exports){
  21922. // 7.2.1 RequireObjectCoercible(argument)
  21923. module.exports = function(it){
  21924. if(it == undefined)throw TypeError("Can't call method on " + it);
  21925. return it;
  21926. };
  21927. },{}],157:[function(require,module,exports){
  21928. // Thank's IE8 for his funny defineProperty
  21929. module.exports = !require('./_fails')(function(){
  21930. return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;
  21931. });
  21932. },{"./_fails":162}],158:[function(require,module,exports){
  21933. var isObject = require('./_is-object')
  21934. , document = require('./_global').document
  21935. // in old IE typeof document.createElement is 'object'
  21936. , is = isObject(document) && isObject(document.createElement);
  21937. module.exports = function(it){
  21938. return is ? document.createElement(it) : {};
  21939. };
  21940. },{"./_global":164,"./_is-object":172}],159:[function(require,module,exports){
  21941. // IE 8- don't enum bug keys
  21942. module.exports = (
  21943. 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
  21944. ).split(',');
  21945. },{}],160:[function(require,module,exports){
  21946. // all enumerable object keys, includes symbols
  21947. var getKeys = require('./_object-keys')
  21948. , gOPS = require('./_object-gops')
  21949. , pIE = require('./_object-pie');
  21950. module.exports = function(it){
  21951. var result = getKeys(it)
  21952. , getSymbols = gOPS.f;
  21953. if(getSymbols){
  21954. var symbols = getSymbols(it)
  21955. , isEnum = pIE.f
  21956. , i = 0
  21957. , key;
  21958. while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))result.push(key);
  21959. } return result;
  21960. };
  21961. },{"./_object-gops":188,"./_object-keys":191,"./_object-pie":192}],161:[function(require,module,exports){
  21962. var global = require('./_global')
  21963. , core = require('./_core')
  21964. , ctx = require('./_ctx')
  21965. , hide = require('./_hide')
  21966. , PROTOTYPE = 'prototype';
  21967. var $export = function(type, name, source){
  21968. var IS_FORCED = type & $export.F
  21969. , IS_GLOBAL = type & $export.G
  21970. , IS_STATIC = type & $export.S
  21971. , IS_PROTO = type & $export.P
  21972. , IS_BIND = type & $export.B
  21973. , IS_WRAP = type & $export.W
  21974. , exports = IS_GLOBAL ? core : core[name] || (core[name] = {})
  21975. , expProto = exports[PROTOTYPE]
  21976. , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]
  21977. , key, own, out;
  21978. if(IS_GLOBAL)source = name;
  21979. for(key in source){
  21980. // contains in native
  21981. own = !IS_FORCED && target && target[key] !== undefined;
  21982. if(own && key in exports)continue;
  21983. // export native or passed
  21984. out = own ? target[key] : source[key];
  21985. // prevent global pollution for namespaces
  21986. exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
  21987. // bind timers to global for call from export context
  21988. : IS_BIND && own ? ctx(out, global)
  21989. // wrap global constructors for prevent change them in library
  21990. : IS_WRAP && target[key] == out ? (function(C){
  21991. var F = function(a, b, c){
  21992. if(this instanceof C){
  21993. switch(arguments.length){
  21994. case 0: return new C;
  21995. case 1: return new C(a);
  21996. case 2: return new C(a, b);
  21997. } return new C(a, b, c);
  21998. } return C.apply(this, arguments);
  21999. };
  22000. F[PROTOTYPE] = C[PROTOTYPE];
  22001. return F;
  22002. // make static versions for prototype methods
  22003. })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
  22004. // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
  22005. if(IS_PROTO){
  22006. (exports.virtual || (exports.virtual = {}))[key] = out;
  22007. // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
  22008. if(type & $export.R && expProto && !expProto[key])hide(expProto, key, out);
  22009. }
  22010. }
  22011. };
  22012. // type bitmap
  22013. $export.F = 1; // forced
  22014. $export.G = 2; // global
  22015. $export.S = 4; // static
  22016. $export.P = 8; // proto
  22017. $export.B = 16; // bind
  22018. $export.W = 32; // wrap
  22019. $export.U = 64; // safe
  22020. $export.R = 128; // real proto method for `library`
  22021. module.exports = $export;
  22022. },{"./_core":154,"./_ctx":155,"./_global":164,"./_hide":166}],162:[function(require,module,exports){
  22023. module.exports = function(exec){
  22024. try {
  22025. return !!exec();
  22026. } catch(e){
  22027. return true;
  22028. }
  22029. };
  22030. },{}],163:[function(require,module,exports){
  22031. var ctx = require('./_ctx')
  22032. , call = require('./_iter-call')
  22033. , isArrayIter = require('./_is-array-iter')
  22034. , anObject = require('./_an-object')
  22035. , toLength = require('./_to-length')
  22036. , getIterFn = require('./core.get-iterator-method')
  22037. , BREAK = {}
  22038. , RETURN = {};
  22039. var exports = module.exports = function(iterable, entries, fn, that, ITERATOR){
  22040. var iterFn = ITERATOR ? function(){ return iterable; } : getIterFn(iterable)
  22041. , f = ctx(fn, that, entries ? 2 : 1)
  22042. , index = 0
  22043. , length, step, iterator, result;
  22044. if(typeof iterFn != 'function')throw TypeError(iterable + ' is not iterable!');
  22045. // fast case for arrays with default iterator
  22046. if(isArrayIter(iterFn))for(length = toLength(iterable.length); length > index; index++){
  22047. result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
  22048. if(result === BREAK || result === RETURN)return result;
  22049. } else for(iterator = iterFn.call(iterable); !(step = iterator.next()).done; ){
  22050. result = call(iterator, f, step.value, entries);
  22051. if(result === BREAK || result === RETURN)return result;
  22052. }
  22053. };
  22054. exports.BREAK = BREAK;
  22055. exports.RETURN = RETURN;
  22056. },{"./_an-object":142,"./_ctx":155,"./_is-array-iter":170,"./_iter-call":173,"./_to-length":206,"./core.get-iterator-method":213}],164:[function(require,module,exports){
  22057. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  22058. var global = module.exports = typeof window != 'undefined' && window.Math == Math
  22059. ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
  22060. if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef
  22061. },{}],165:[function(require,module,exports){
  22062. var hasOwnProperty = {}.hasOwnProperty;
  22063. module.exports = function(it, key){
  22064. return hasOwnProperty.call(it, key);
  22065. };
  22066. },{}],166:[function(require,module,exports){
  22067. var dP = require('./_object-dp')
  22068. , createDesc = require('./_property-desc');
  22069. module.exports = require('./_descriptors') ? function(object, key, value){
  22070. return dP.f(object, key, createDesc(1, value));
  22071. } : function(object, key, value){
  22072. object[key] = value;
  22073. return object;
  22074. };
  22075. },{"./_descriptors":157,"./_object-dp":183,"./_property-desc":194}],167:[function(require,module,exports){
  22076. module.exports = require('./_global').document && document.documentElement;
  22077. },{"./_global":164}],168:[function(require,module,exports){
  22078. module.exports = !require('./_descriptors') && !require('./_fails')(function(){
  22079. return Object.defineProperty(require('./_dom-create')('div'), 'a', {get: function(){ return 7; }}).a != 7;
  22080. });
  22081. },{"./_descriptors":157,"./_dom-create":158,"./_fails":162}],169:[function(require,module,exports){
  22082. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  22083. var cof = require('./_cof');
  22084. module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){
  22085. return cof(it) == 'String' ? it.split('') : Object(it);
  22086. };
  22087. },{"./_cof":149}],170:[function(require,module,exports){
  22088. // check on default Array iterator
  22089. var Iterators = require('./_iterators')
  22090. , ITERATOR = require('./_wks')('iterator')
  22091. , ArrayProto = Array.prototype;
  22092. module.exports = function(it){
  22093. return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
  22094. };
  22095. },{"./_iterators":177,"./_wks":212}],171:[function(require,module,exports){
  22096. // 7.2.2 IsArray(argument)
  22097. var cof = require('./_cof');
  22098. module.exports = Array.isArray || function isArray(arg){
  22099. return cof(arg) == 'Array';
  22100. };
  22101. },{"./_cof":149}],172:[function(require,module,exports){
  22102. module.exports = function(it){
  22103. return typeof it === 'object' ? it !== null : typeof it === 'function';
  22104. };
  22105. },{}],173:[function(require,module,exports){
  22106. // call something on iterator step with safe closing on error
  22107. var anObject = require('./_an-object');
  22108. module.exports = function(iterator, fn, value, entries){
  22109. try {
  22110. return entries ? fn(anObject(value)[0], value[1]) : fn(value);
  22111. // 7.4.6 IteratorClose(iterator, completion)
  22112. } catch(e){
  22113. var ret = iterator['return'];
  22114. if(ret !== undefined)anObject(ret.call(iterator));
  22115. throw e;
  22116. }
  22117. };
  22118. },{"./_an-object":142}],174:[function(require,module,exports){
  22119. 'use strict';
  22120. var create = require('./_object-create')
  22121. , descriptor = require('./_property-desc')
  22122. , setToStringTag = require('./_set-to-string-tag')
  22123. , IteratorPrototype = {};
  22124. // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
  22125. require('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function(){ return this; });
  22126. module.exports = function(Constructor, NAME, next){
  22127. Constructor.prototype = create(IteratorPrototype, {next: descriptor(1, next)});
  22128. setToStringTag(Constructor, NAME + ' Iterator');
  22129. };
  22130. },{"./_hide":166,"./_object-create":182,"./_property-desc":194,"./_set-to-string-tag":199,"./_wks":212}],175:[function(require,module,exports){
  22131. 'use strict';
  22132. var LIBRARY = require('./_library')
  22133. , $export = require('./_export')
  22134. , redefine = require('./_redefine')
  22135. , hide = require('./_hide')
  22136. , has = require('./_has')
  22137. , Iterators = require('./_iterators')
  22138. , $iterCreate = require('./_iter-create')
  22139. , setToStringTag = require('./_set-to-string-tag')
  22140. , getPrototypeOf = require('./_object-gpo')
  22141. , ITERATOR = require('./_wks')('iterator')
  22142. , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next`
  22143. , FF_ITERATOR = '@@iterator'
  22144. , KEYS = 'keys'
  22145. , VALUES = 'values';
  22146. var returnThis = function(){ return this; };
  22147. module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){
  22148. $iterCreate(Constructor, NAME, next);
  22149. var getMethod = function(kind){
  22150. if(!BUGGY && kind in proto)return proto[kind];
  22151. switch(kind){
  22152. case KEYS: return function keys(){ return new Constructor(this, kind); };
  22153. case VALUES: return function values(){ return new Constructor(this, kind); };
  22154. } return function entries(){ return new Constructor(this, kind); };
  22155. };
  22156. var TAG = NAME + ' Iterator'
  22157. , DEF_VALUES = DEFAULT == VALUES
  22158. , VALUES_BUG = false
  22159. , proto = Base.prototype
  22160. , $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]
  22161. , $default = $native || getMethod(DEFAULT)
  22162. , $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined
  22163. , $anyNative = NAME == 'Array' ? proto.entries || $native : $native
  22164. , methods, key, IteratorPrototype;
  22165. // Fix native
  22166. if($anyNative){
  22167. IteratorPrototype = getPrototypeOf($anyNative.call(new Base));
  22168. if(IteratorPrototype !== Object.prototype){
  22169. // Set @@toStringTag to native iterators
  22170. setToStringTag(IteratorPrototype, TAG, true);
  22171. // fix for some old engines
  22172. if(!LIBRARY && !has(IteratorPrototype, ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis);
  22173. }
  22174. }
  22175. // fix Array#{values, @@iterator}.name in V8 / FF
  22176. if(DEF_VALUES && $native && $native.name !== VALUES){
  22177. VALUES_BUG = true;
  22178. $default = function values(){ return $native.call(this); };
  22179. }
  22180. // Define iterator
  22181. if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){
  22182. hide(proto, ITERATOR, $default);
  22183. }
  22184. // Plug for library
  22185. Iterators[NAME] = $default;
  22186. Iterators[TAG] = returnThis;
  22187. if(DEFAULT){
  22188. methods = {
  22189. values: DEF_VALUES ? $default : getMethod(VALUES),
  22190. keys: IS_SET ? $default : getMethod(KEYS),
  22191. entries: $entries
  22192. };
  22193. if(FORCED)for(key in methods){
  22194. if(!(key in proto))redefine(proto, key, methods[key]);
  22195. } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
  22196. }
  22197. return methods;
  22198. };
  22199. },{"./_export":161,"./_has":165,"./_hide":166,"./_iter-create":174,"./_iterators":177,"./_library":179,"./_object-gpo":189,"./_redefine":196,"./_set-to-string-tag":199,"./_wks":212}],176:[function(require,module,exports){
  22200. module.exports = function(done, value){
  22201. return {value: value, done: !!done};
  22202. };
  22203. },{}],177:[function(require,module,exports){
  22204. module.exports = {};
  22205. },{}],178:[function(require,module,exports){
  22206. var getKeys = require('./_object-keys')
  22207. , toIObject = require('./_to-iobject');
  22208. module.exports = function(object, el){
  22209. var O = toIObject(object)
  22210. , keys = getKeys(O)
  22211. , length = keys.length
  22212. , index = 0
  22213. , key;
  22214. while(length > index)if(O[key = keys[index++]] === el)return key;
  22215. };
  22216. },{"./_object-keys":191,"./_to-iobject":205}],179:[function(require,module,exports){
  22217. module.exports = true;
  22218. },{}],180:[function(require,module,exports){
  22219. var META = require('./_uid')('meta')
  22220. , isObject = require('./_is-object')
  22221. , has = require('./_has')
  22222. , setDesc = require('./_object-dp').f
  22223. , id = 0;
  22224. var isExtensible = Object.isExtensible || function(){
  22225. return true;
  22226. };
  22227. var FREEZE = !require('./_fails')(function(){
  22228. return isExtensible(Object.preventExtensions({}));
  22229. });
  22230. var setMeta = function(it){
  22231. setDesc(it, META, {value: {
  22232. i: 'O' + ++id, // object ID
  22233. w: {} // weak collections IDs
  22234. }});
  22235. };
  22236. var fastKey = function(it, create){
  22237. // return primitive with prefix
  22238. if(!isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
  22239. if(!has(it, META)){
  22240. // can't set metadata to uncaught frozen object
  22241. if(!isExtensible(it))return 'F';
  22242. // not necessary to add metadata
  22243. if(!create)return 'E';
  22244. // add missing metadata
  22245. setMeta(it);
  22246. // return object ID
  22247. } return it[META].i;
  22248. };
  22249. var getWeak = function(it, create){
  22250. if(!has(it, META)){
  22251. // can't set metadata to uncaught frozen object
  22252. if(!isExtensible(it))return true;
  22253. // not necessary to add metadata
  22254. if(!create)return false;
  22255. // add missing metadata
  22256. setMeta(it);
  22257. // return hash weak collections IDs
  22258. } return it[META].w;
  22259. };
  22260. // add metadata on freeze-family methods calling
  22261. var onFreeze = function(it){
  22262. if(FREEZE && meta.NEED && isExtensible(it) && !has(it, META))setMeta(it);
  22263. return it;
  22264. };
  22265. var meta = module.exports = {
  22266. KEY: META,
  22267. NEED: false,
  22268. fastKey: fastKey,
  22269. getWeak: getWeak,
  22270. onFreeze: onFreeze
  22271. };
  22272. },{"./_fails":162,"./_has":165,"./_is-object":172,"./_object-dp":183,"./_uid":209}],181:[function(require,module,exports){
  22273. 'use strict';
  22274. // 19.1.2.1 Object.assign(target, source, ...)
  22275. var getKeys = require('./_object-keys')
  22276. , gOPS = require('./_object-gops')
  22277. , pIE = require('./_object-pie')
  22278. , toObject = require('./_to-object')
  22279. , IObject = require('./_iobject')
  22280. , $assign = Object.assign;
  22281. // should work with symbols and should have deterministic property order (V8 bug)
  22282. module.exports = !$assign || require('./_fails')(function(){
  22283. var A = {}
  22284. , B = {}
  22285. , S = Symbol()
  22286. , K = 'abcdefghijklmnopqrst';
  22287. A[S] = 7;
  22288. K.split('').forEach(function(k){ B[k] = k; });
  22289. return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
  22290. }) ? function assign(target, source){ // eslint-disable-line no-unused-vars
  22291. var T = toObject(target)
  22292. , aLen = arguments.length
  22293. , index = 1
  22294. , getSymbols = gOPS.f
  22295. , isEnum = pIE.f;
  22296. while(aLen > index){
  22297. var S = IObject(arguments[index++])
  22298. , keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S)
  22299. , length = keys.length
  22300. , j = 0
  22301. , key;
  22302. while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key];
  22303. } return T;
  22304. } : $assign;
  22305. },{"./_fails":162,"./_iobject":169,"./_object-gops":188,"./_object-keys":191,"./_object-pie":192,"./_to-object":207}],182:[function(require,module,exports){
  22306. // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
  22307. var anObject = require('./_an-object')
  22308. , dPs = require('./_object-dps')
  22309. , enumBugKeys = require('./_enum-bug-keys')
  22310. , IE_PROTO = require('./_shared-key')('IE_PROTO')
  22311. , Empty = function(){ /* empty */ }
  22312. , PROTOTYPE = 'prototype';
  22313. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  22314. var createDict = function(){
  22315. // Thrash, waste and sodomy: IE GC bug
  22316. var iframe = require('./_dom-create')('iframe')
  22317. , i = enumBugKeys.length
  22318. , lt = '<'
  22319. , gt = '>'
  22320. , iframeDocument;
  22321. iframe.style.display = 'none';
  22322. require('./_html').appendChild(iframe);
  22323. iframe.src = 'javascript:'; // eslint-disable-line no-script-url
  22324. // createDict = iframe.contentWindow.Object;
  22325. // html.removeChild(iframe);
  22326. iframeDocument = iframe.contentWindow.document;
  22327. iframeDocument.open();
  22328. iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
  22329. iframeDocument.close();
  22330. createDict = iframeDocument.F;
  22331. while(i--)delete createDict[PROTOTYPE][enumBugKeys[i]];
  22332. return createDict();
  22333. };
  22334. module.exports = Object.create || function create(O, Properties){
  22335. var result;
  22336. if(O !== null){
  22337. Empty[PROTOTYPE] = anObject(O);
  22338. result = new Empty;
  22339. Empty[PROTOTYPE] = null;
  22340. // add "__proto__" for Object.getPrototypeOf polyfill
  22341. result[IE_PROTO] = O;
  22342. } else result = createDict();
  22343. return Properties === undefined ? result : dPs(result, Properties);
  22344. };
  22345. },{"./_an-object":142,"./_dom-create":158,"./_enum-bug-keys":159,"./_html":167,"./_object-dps":184,"./_shared-key":200}],183:[function(require,module,exports){
  22346. var anObject = require('./_an-object')
  22347. , IE8_DOM_DEFINE = require('./_ie8-dom-define')
  22348. , toPrimitive = require('./_to-primitive')
  22349. , dP = Object.defineProperty;
  22350. exports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes){
  22351. anObject(O);
  22352. P = toPrimitive(P, true);
  22353. anObject(Attributes);
  22354. if(IE8_DOM_DEFINE)try {
  22355. return dP(O, P, Attributes);
  22356. } catch(e){ /* empty */ }
  22357. if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');
  22358. if('value' in Attributes)O[P] = Attributes.value;
  22359. return O;
  22360. };
  22361. },{"./_an-object":142,"./_descriptors":157,"./_ie8-dom-define":168,"./_to-primitive":208}],184:[function(require,module,exports){
  22362. var dP = require('./_object-dp')
  22363. , anObject = require('./_an-object')
  22364. , getKeys = require('./_object-keys');
  22365. module.exports = require('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties){
  22366. anObject(O);
  22367. var keys = getKeys(Properties)
  22368. , length = keys.length
  22369. , i = 0
  22370. , P;
  22371. while(length > i)dP.f(O, P = keys[i++], Properties[P]);
  22372. return O;
  22373. };
  22374. },{"./_an-object":142,"./_descriptors":157,"./_object-dp":183,"./_object-keys":191}],185:[function(require,module,exports){
  22375. var pIE = require('./_object-pie')
  22376. , createDesc = require('./_property-desc')
  22377. , toIObject = require('./_to-iobject')
  22378. , toPrimitive = require('./_to-primitive')
  22379. , has = require('./_has')
  22380. , IE8_DOM_DEFINE = require('./_ie8-dom-define')
  22381. , gOPD = Object.getOwnPropertyDescriptor;
  22382. exports.f = require('./_descriptors') ? gOPD : function getOwnPropertyDescriptor(O, P){
  22383. O = toIObject(O);
  22384. P = toPrimitive(P, true);
  22385. if(IE8_DOM_DEFINE)try {
  22386. return gOPD(O, P);
  22387. } catch(e){ /* empty */ }
  22388. if(has(O, P))return createDesc(!pIE.f.call(O, P), O[P]);
  22389. };
  22390. },{"./_descriptors":157,"./_has":165,"./_ie8-dom-define":168,"./_object-pie":192,"./_property-desc":194,"./_to-iobject":205,"./_to-primitive":208}],186:[function(require,module,exports){
  22391. // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
  22392. var toIObject = require('./_to-iobject')
  22393. , gOPN = require('./_object-gopn').f
  22394. , toString = {}.toString;
  22395. var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
  22396. ? Object.getOwnPropertyNames(window) : [];
  22397. var getWindowNames = function(it){
  22398. try {
  22399. return gOPN(it);
  22400. } catch(e){
  22401. return windowNames.slice();
  22402. }
  22403. };
  22404. module.exports.f = function getOwnPropertyNames(it){
  22405. return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
  22406. };
  22407. },{"./_object-gopn":187,"./_to-iobject":205}],187:[function(require,module,exports){
  22408. // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
  22409. var $keys = require('./_object-keys-internal')
  22410. , hiddenKeys = require('./_enum-bug-keys').concat('length', 'prototype');
  22411. exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O){
  22412. return $keys(O, hiddenKeys);
  22413. };
  22414. },{"./_enum-bug-keys":159,"./_object-keys-internal":190}],188:[function(require,module,exports){
  22415. exports.f = Object.getOwnPropertySymbols;
  22416. },{}],189:[function(require,module,exports){
  22417. // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
  22418. var has = require('./_has')
  22419. , toObject = require('./_to-object')
  22420. , IE_PROTO = require('./_shared-key')('IE_PROTO')
  22421. , ObjectProto = Object.prototype;
  22422. module.exports = Object.getPrototypeOf || function(O){
  22423. O = toObject(O);
  22424. if(has(O, IE_PROTO))return O[IE_PROTO];
  22425. if(typeof O.constructor == 'function' && O instanceof O.constructor){
  22426. return O.constructor.prototype;
  22427. } return O instanceof Object ? ObjectProto : null;
  22428. };
  22429. },{"./_has":165,"./_shared-key":200,"./_to-object":207}],190:[function(require,module,exports){
  22430. var has = require('./_has')
  22431. , toIObject = require('./_to-iobject')
  22432. , arrayIndexOf = require('./_array-includes')(false)
  22433. , IE_PROTO = require('./_shared-key')('IE_PROTO');
  22434. module.exports = function(object, names){
  22435. var O = toIObject(object)
  22436. , i = 0
  22437. , result = []
  22438. , key;
  22439. for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key);
  22440. // Don't enum bug & hidden keys
  22441. while(names.length > i)if(has(O, key = names[i++])){
  22442. ~arrayIndexOf(result, key) || result.push(key);
  22443. }
  22444. return result;
  22445. };
  22446. },{"./_array-includes":144,"./_has":165,"./_shared-key":200,"./_to-iobject":205}],191:[function(require,module,exports){
  22447. // 19.1.2.14 / 15.2.3.14 Object.keys(O)
  22448. var $keys = require('./_object-keys-internal')
  22449. , enumBugKeys = require('./_enum-bug-keys');
  22450. module.exports = Object.keys || function keys(O){
  22451. return $keys(O, enumBugKeys);
  22452. };
  22453. },{"./_enum-bug-keys":159,"./_object-keys-internal":190}],192:[function(require,module,exports){
  22454. exports.f = {}.propertyIsEnumerable;
  22455. },{}],193:[function(require,module,exports){
  22456. // most Object methods by ES6 should accept primitives
  22457. var $export = require('./_export')
  22458. , core = require('./_core')
  22459. , fails = require('./_fails');
  22460. module.exports = function(KEY, exec){
  22461. var fn = (core.Object || {})[KEY] || Object[KEY]
  22462. , exp = {};
  22463. exp[KEY] = exec(fn);
  22464. $export($export.S + $export.F * fails(function(){ fn(1); }), 'Object', exp);
  22465. };
  22466. },{"./_core":154,"./_export":161,"./_fails":162}],194:[function(require,module,exports){
  22467. module.exports = function(bitmap, value){
  22468. return {
  22469. enumerable : !(bitmap & 1),
  22470. configurable: !(bitmap & 2),
  22471. writable : !(bitmap & 4),
  22472. value : value
  22473. };
  22474. };
  22475. },{}],195:[function(require,module,exports){
  22476. var hide = require('./_hide');
  22477. module.exports = function(target, src, safe){
  22478. for(var key in src){
  22479. if(safe && target[key])target[key] = src[key];
  22480. else hide(target, key, src[key]);
  22481. } return target;
  22482. };
  22483. },{"./_hide":166}],196:[function(require,module,exports){
  22484. module.exports = require('./_hide');
  22485. },{"./_hide":166}],197:[function(require,module,exports){
  22486. // Works with __proto__ only. Old v8 can't work with null proto objects.
  22487. /* eslint-disable no-proto */
  22488. var isObject = require('./_is-object')
  22489. , anObject = require('./_an-object');
  22490. var check = function(O, proto){
  22491. anObject(O);
  22492. if(!isObject(proto) && proto !== null)throw TypeError(proto + ": can't set as prototype!");
  22493. };
  22494. module.exports = {
  22495. set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line
  22496. function(test, buggy, set){
  22497. try {
  22498. set = require('./_ctx')(Function.call, require('./_object-gopd').f(Object.prototype, '__proto__').set, 2);
  22499. set(test, []);
  22500. buggy = !(test instanceof Array);
  22501. } catch(e){ buggy = true; }
  22502. return function setPrototypeOf(O, proto){
  22503. check(O, proto);
  22504. if(buggy)O.__proto__ = proto;
  22505. else set(O, proto);
  22506. return O;
  22507. };
  22508. }({}, false) : undefined),
  22509. check: check
  22510. };
  22511. },{"./_an-object":142,"./_ctx":155,"./_is-object":172,"./_object-gopd":185}],198:[function(require,module,exports){
  22512. 'use strict';
  22513. var global = require('./_global')
  22514. , core = require('./_core')
  22515. , dP = require('./_object-dp')
  22516. , DESCRIPTORS = require('./_descriptors')
  22517. , SPECIES = require('./_wks')('species');
  22518. module.exports = function(KEY){
  22519. var C = typeof core[KEY] == 'function' ? core[KEY] : global[KEY];
  22520. if(DESCRIPTORS && C && !C[SPECIES])dP.f(C, SPECIES, {
  22521. configurable: true,
  22522. get: function(){ return this; }
  22523. });
  22524. };
  22525. },{"./_core":154,"./_descriptors":157,"./_global":164,"./_object-dp":183,"./_wks":212}],199:[function(require,module,exports){
  22526. var def = require('./_object-dp').f
  22527. , has = require('./_has')
  22528. , TAG = require('./_wks')('toStringTag');
  22529. module.exports = function(it, tag, stat){
  22530. if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag});
  22531. };
  22532. },{"./_has":165,"./_object-dp":183,"./_wks":212}],200:[function(require,module,exports){
  22533. var shared = require('./_shared')('keys')
  22534. , uid = require('./_uid');
  22535. module.exports = function(key){
  22536. return shared[key] || (shared[key] = uid(key));
  22537. };
  22538. },{"./_shared":201,"./_uid":209}],201:[function(require,module,exports){
  22539. var global = require('./_global')
  22540. , SHARED = '__core-js_shared__'
  22541. , store = global[SHARED] || (global[SHARED] = {});
  22542. module.exports = function(key){
  22543. return store[key] || (store[key] = {});
  22544. };
  22545. },{"./_global":164}],202:[function(require,module,exports){
  22546. var toInteger = require('./_to-integer')
  22547. , defined = require('./_defined');
  22548. // true -> String#at
  22549. // false -> String#codePointAt
  22550. module.exports = function(TO_STRING){
  22551. return function(that, pos){
  22552. var s = String(defined(that))
  22553. , i = toInteger(pos)
  22554. , l = s.length
  22555. , a, b;
  22556. if(i < 0 || i >= l)return TO_STRING ? '' : undefined;
  22557. a = s.charCodeAt(i);
  22558. return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
  22559. ? TO_STRING ? s.charAt(i) : a
  22560. : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
  22561. };
  22562. };
  22563. },{"./_defined":156,"./_to-integer":204}],203:[function(require,module,exports){
  22564. var toInteger = require('./_to-integer')
  22565. , max = Math.max
  22566. , min = Math.min;
  22567. module.exports = function(index, length){
  22568. index = toInteger(index);
  22569. return index < 0 ? max(index + length, 0) : min(index, length);
  22570. };
  22571. },{"./_to-integer":204}],204:[function(require,module,exports){
  22572. // 7.1.4 ToInteger
  22573. var ceil = Math.ceil
  22574. , floor = Math.floor;
  22575. module.exports = function(it){
  22576. return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
  22577. };
  22578. },{}],205:[function(require,module,exports){
  22579. // to indexed object, toObject with fallback for non-array-like ES3 strings
  22580. var IObject = require('./_iobject')
  22581. , defined = require('./_defined');
  22582. module.exports = function(it){
  22583. return IObject(defined(it));
  22584. };
  22585. },{"./_defined":156,"./_iobject":169}],206:[function(require,module,exports){
  22586. // 7.1.15 ToLength
  22587. var toInteger = require('./_to-integer')
  22588. , min = Math.min;
  22589. module.exports = function(it){
  22590. return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
  22591. };
  22592. },{"./_to-integer":204}],207:[function(require,module,exports){
  22593. // 7.1.13 ToObject(argument)
  22594. var defined = require('./_defined');
  22595. module.exports = function(it){
  22596. return Object(defined(it));
  22597. };
  22598. },{"./_defined":156}],208:[function(require,module,exports){
  22599. // 7.1.1 ToPrimitive(input [, PreferredType])
  22600. var isObject = require('./_is-object');
  22601. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  22602. // and the second argument - flag - preferred type is a string
  22603. module.exports = function(it, S){
  22604. if(!isObject(it))return it;
  22605. var fn, val;
  22606. if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
  22607. if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val;
  22608. if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
  22609. throw TypeError("Can't convert object to primitive value");
  22610. };
  22611. },{"./_is-object":172}],209:[function(require,module,exports){
  22612. var id = 0
  22613. , px = Math.random();
  22614. module.exports = function(key){
  22615. return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
  22616. };
  22617. },{}],210:[function(require,module,exports){
  22618. var global = require('./_global')
  22619. , core = require('./_core')
  22620. , LIBRARY = require('./_library')
  22621. , wksExt = require('./_wks-ext')
  22622. , defineProperty = require('./_object-dp').f;
  22623. module.exports = function(name){
  22624. var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
  22625. if(name.charAt(0) != '_' && !(name in $Symbol))defineProperty($Symbol, name, {value: wksExt.f(name)});
  22626. };
  22627. },{"./_core":154,"./_global":164,"./_library":179,"./_object-dp":183,"./_wks-ext":211}],211:[function(require,module,exports){
  22628. exports.f = require('./_wks');
  22629. },{"./_wks":212}],212:[function(require,module,exports){
  22630. var store = require('./_shared')('wks')
  22631. , uid = require('./_uid')
  22632. , Symbol = require('./_global').Symbol
  22633. , USE_SYMBOL = typeof Symbol == 'function';
  22634. var $exports = module.exports = function(name){
  22635. return store[name] || (store[name] =
  22636. USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
  22637. };
  22638. $exports.store = store;
  22639. },{"./_global":164,"./_shared":201,"./_uid":209}],213:[function(require,module,exports){
  22640. var classof = require('./_classof')
  22641. , ITERATOR = require('./_wks')('iterator')
  22642. , Iterators = require('./_iterators');
  22643. module.exports = require('./_core').getIteratorMethod = function(it){
  22644. if(it != undefined)return it[ITERATOR]
  22645. || it['@@iterator']
  22646. || Iterators[classof(it)];
  22647. };
  22648. },{"./_classof":148,"./_core":154,"./_iterators":177,"./_wks":212}],214:[function(require,module,exports){
  22649. var anObject = require('./_an-object')
  22650. , get = require('./core.get-iterator-method');
  22651. module.exports = require('./_core').getIterator = function(it){
  22652. var iterFn = get(it);
  22653. if(typeof iterFn != 'function')throw TypeError(it + ' is not iterable!');
  22654. return anObject(iterFn.call(it));
  22655. };
  22656. },{"./_an-object":142,"./_core":154,"./core.get-iterator-method":213}],215:[function(require,module,exports){
  22657. 'use strict';
  22658. var addToUnscopables = require('./_add-to-unscopables')
  22659. , step = require('./_iter-step')
  22660. , Iterators = require('./_iterators')
  22661. , toIObject = require('./_to-iobject');
  22662. // 22.1.3.4 Array.prototype.entries()
  22663. // 22.1.3.13 Array.prototype.keys()
  22664. // 22.1.3.29 Array.prototype.values()
  22665. // 22.1.3.30 Array.prototype[@@iterator]()
  22666. module.exports = require('./_iter-define')(Array, 'Array', function(iterated, kind){
  22667. this._t = toIObject(iterated); // target
  22668. this._i = 0; // next index
  22669. this._k = kind; // kind
  22670. // 22.1.5.2.1 %ArrayIteratorPrototype%.next()
  22671. }, function(){
  22672. var O = this._t
  22673. , kind = this._k
  22674. , index = this._i++;
  22675. if(!O || index >= O.length){
  22676. this._t = undefined;
  22677. return step(1);
  22678. }
  22679. if(kind == 'keys' )return step(0, index);
  22680. if(kind == 'values')return step(0, O[index]);
  22681. return step(0, [index, O[index]]);
  22682. }, 'values');
  22683. // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
  22684. Iterators.Arguments = Iterators.Array;
  22685. addToUnscopables('keys');
  22686. addToUnscopables('values');
  22687. addToUnscopables('entries');
  22688. },{"./_add-to-unscopables":140,"./_iter-define":175,"./_iter-step":176,"./_iterators":177,"./_to-iobject":205}],216:[function(require,module,exports){
  22689. 'use strict';
  22690. var strong = require('./_collection-strong');
  22691. // 23.1 Map Objects
  22692. module.exports = require('./_collection')('Map', function(get){
  22693. return function Map(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); };
  22694. }, {
  22695. // 23.1.3.6 Map.prototype.get(key)
  22696. get: function get(key){
  22697. var entry = strong.getEntry(this, key);
  22698. return entry && entry.v;
  22699. },
  22700. // 23.1.3.9 Map.prototype.set(key, value)
  22701. set: function set(key, value){
  22702. return strong.def(this, key === 0 ? 0 : key, value);
  22703. }
  22704. }, strong, true);
  22705. },{"./_collection":153,"./_collection-strong":150}],217:[function(require,module,exports){
  22706. // 20.1.2.6 Number.MAX_SAFE_INTEGER
  22707. var $export = require('./_export');
  22708. $export($export.S, 'Number', {MAX_SAFE_INTEGER: 0x1fffffffffffff});
  22709. },{"./_export":161}],218:[function(require,module,exports){
  22710. // 19.1.3.1 Object.assign(target, source)
  22711. var $export = require('./_export');
  22712. $export($export.S + $export.F, 'Object', {assign: require('./_object-assign')});
  22713. },{"./_export":161,"./_object-assign":181}],219:[function(require,module,exports){
  22714. var $export = require('./_export')
  22715. // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
  22716. $export($export.S, 'Object', {create: require('./_object-create')});
  22717. },{"./_export":161,"./_object-create":182}],220:[function(require,module,exports){
  22718. // 19.1.2.14 Object.keys(O)
  22719. var toObject = require('./_to-object')
  22720. , $keys = require('./_object-keys');
  22721. require('./_object-sap')('keys', function(){
  22722. return function keys(it){
  22723. return $keys(toObject(it));
  22724. };
  22725. });
  22726. },{"./_object-keys":191,"./_object-sap":193,"./_to-object":207}],221:[function(require,module,exports){
  22727. // 19.1.3.19 Object.setPrototypeOf(O, proto)
  22728. var $export = require('./_export');
  22729. $export($export.S, 'Object', {setPrototypeOf: require('./_set-proto').set});
  22730. },{"./_export":161,"./_set-proto":197}],222:[function(require,module,exports){
  22731. arguments[4][120][0].apply(exports,arguments)
  22732. },{"dup":120}],223:[function(require,module,exports){
  22733. 'use strict';
  22734. var $at = require('./_string-at')(true);
  22735. // 21.1.3.27 String.prototype[@@iterator]()
  22736. require('./_iter-define')(String, 'String', function(iterated){
  22737. this._t = String(iterated); // target
  22738. this._i = 0; // next index
  22739. // 21.1.5.2.1 %StringIteratorPrototype%.next()
  22740. }, function(){
  22741. var O = this._t
  22742. , index = this._i
  22743. , point;
  22744. if(index >= O.length)return {value: undefined, done: true};
  22745. point = $at(O, index);
  22746. this._i += point.length;
  22747. return {value: point, done: false};
  22748. });
  22749. },{"./_iter-define":175,"./_string-at":202}],224:[function(require,module,exports){
  22750. 'use strict';
  22751. // ECMAScript 6 symbols shim
  22752. var global = require('./_global')
  22753. , has = require('./_has')
  22754. , DESCRIPTORS = require('./_descriptors')
  22755. , $export = require('./_export')
  22756. , redefine = require('./_redefine')
  22757. , META = require('./_meta').KEY
  22758. , $fails = require('./_fails')
  22759. , shared = require('./_shared')
  22760. , setToStringTag = require('./_set-to-string-tag')
  22761. , uid = require('./_uid')
  22762. , wks = require('./_wks')
  22763. , wksExt = require('./_wks-ext')
  22764. , wksDefine = require('./_wks-define')
  22765. , keyOf = require('./_keyof')
  22766. , enumKeys = require('./_enum-keys')
  22767. , isArray = require('./_is-array')
  22768. , anObject = require('./_an-object')
  22769. , toIObject = require('./_to-iobject')
  22770. , toPrimitive = require('./_to-primitive')
  22771. , createDesc = require('./_property-desc')
  22772. , _create = require('./_object-create')
  22773. , gOPNExt = require('./_object-gopn-ext')
  22774. , $GOPD = require('./_object-gopd')
  22775. , $DP = require('./_object-dp')
  22776. , $keys = require('./_object-keys')
  22777. , gOPD = $GOPD.f
  22778. , dP = $DP.f
  22779. , gOPN = gOPNExt.f
  22780. , $Symbol = global.Symbol
  22781. , $JSON = global.JSON
  22782. , _stringify = $JSON && $JSON.stringify
  22783. , PROTOTYPE = 'prototype'
  22784. , HIDDEN = wks('_hidden')
  22785. , TO_PRIMITIVE = wks('toPrimitive')
  22786. , isEnum = {}.propertyIsEnumerable
  22787. , SymbolRegistry = shared('symbol-registry')
  22788. , AllSymbols = shared('symbols')
  22789. , OPSymbols = shared('op-symbols')
  22790. , ObjectProto = Object[PROTOTYPE]
  22791. , USE_NATIVE = typeof $Symbol == 'function'
  22792. , QObject = global.QObject;
  22793. // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
  22794. var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
  22795. // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
  22796. var setSymbolDesc = DESCRIPTORS && $fails(function(){
  22797. return _create(dP({}, 'a', {
  22798. get: function(){ return dP(this, 'a', {value: 7}).a; }
  22799. })).a != 7;
  22800. }) ? function(it, key, D){
  22801. var protoDesc = gOPD(ObjectProto, key);
  22802. if(protoDesc)delete ObjectProto[key];
  22803. dP(it, key, D);
  22804. if(protoDesc && it !== ObjectProto)dP(ObjectProto, key, protoDesc);
  22805. } : dP;
  22806. var wrap = function(tag){
  22807. var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
  22808. sym._k = tag;
  22809. return sym;
  22810. };
  22811. var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function(it){
  22812. return typeof it == 'symbol';
  22813. } : function(it){
  22814. return it instanceof $Symbol;
  22815. };
  22816. var $defineProperty = function defineProperty(it, key, D){
  22817. if(it === ObjectProto)$defineProperty(OPSymbols, key, D);
  22818. anObject(it);
  22819. key = toPrimitive(key, true);
  22820. anObject(D);
  22821. if(has(AllSymbols, key)){
  22822. if(!D.enumerable){
  22823. if(!has(it, HIDDEN))dP(it, HIDDEN, createDesc(1, {}));
  22824. it[HIDDEN][key] = true;
  22825. } else {
  22826. if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false;
  22827. D = _create(D, {enumerable: createDesc(0, false)});
  22828. } return setSymbolDesc(it, key, D);
  22829. } return dP(it, key, D);
  22830. };
  22831. var $defineProperties = function defineProperties(it, P){
  22832. anObject(it);
  22833. var keys = enumKeys(P = toIObject(P))
  22834. , i = 0
  22835. , l = keys.length
  22836. , key;
  22837. while(l > i)$defineProperty(it, key = keys[i++], P[key]);
  22838. return it;
  22839. };
  22840. var $create = function create(it, P){
  22841. return P === undefined ? _create(it) : $defineProperties(_create(it), P);
  22842. };
  22843. var $propertyIsEnumerable = function propertyIsEnumerable(key){
  22844. var E = isEnum.call(this, key = toPrimitive(key, true));
  22845. if(this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return false;
  22846. return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
  22847. };
  22848. var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key){
  22849. it = toIObject(it);
  22850. key = toPrimitive(key, true);
  22851. if(it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return;
  22852. var D = gOPD(it, key);
  22853. if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true;
  22854. return D;
  22855. };
  22856. var $getOwnPropertyNames = function getOwnPropertyNames(it){
  22857. var names = gOPN(toIObject(it))
  22858. , result = []
  22859. , i = 0
  22860. , key;
  22861. while(names.length > i){
  22862. if(!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META)result.push(key);
  22863. } return result;
  22864. };
  22865. var $getOwnPropertySymbols = function getOwnPropertySymbols(it){
  22866. var IS_OP = it === ObjectProto
  22867. , names = gOPN(IS_OP ? OPSymbols : toIObject(it))
  22868. , result = []
  22869. , i = 0
  22870. , key;
  22871. while(names.length > i){
  22872. if(has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true))result.push(AllSymbols[key]);
  22873. } return result;
  22874. };
  22875. // 19.4.1.1 Symbol([description])
  22876. if(!USE_NATIVE){
  22877. $Symbol = function Symbol(){
  22878. if(this instanceof $Symbol)throw TypeError('Symbol is not a constructor!');
  22879. var tag = uid(arguments.length > 0 ? arguments[0] : undefined);
  22880. var $set = function(value){
  22881. if(this === ObjectProto)$set.call(OPSymbols, value);
  22882. if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false;
  22883. setSymbolDesc(this, tag, createDesc(1, value));
  22884. };
  22885. if(DESCRIPTORS && setter)setSymbolDesc(ObjectProto, tag, {configurable: true, set: $set});
  22886. return wrap(tag);
  22887. };
  22888. redefine($Symbol[PROTOTYPE], 'toString', function toString(){
  22889. return this._k;
  22890. });
  22891. $GOPD.f = $getOwnPropertyDescriptor;
  22892. $DP.f = $defineProperty;
  22893. require('./_object-gopn').f = gOPNExt.f = $getOwnPropertyNames;
  22894. require('./_object-pie').f = $propertyIsEnumerable;
  22895. require('./_object-gops').f = $getOwnPropertySymbols;
  22896. if(DESCRIPTORS && !require('./_library')){
  22897. redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
  22898. }
  22899. wksExt.f = function(name){
  22900. return wrap(wks(name));
  22901. }
  22902. }
  22903. $export($export.G + $export.W + $export.F * !USE_NATIVE, {Symbol: $Symbol});
  22904. for(var symbols = (
  22905. // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14
  22906. 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'
  22907. ).split(','), i = 0; symbols.length > i; )wks(symbols[i++]);
  22908. for(var symbols = $keys(wks.store), i = 0; symbols.length > i; )wksDefine(symbols[i++]);
  22909. $export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
  22910. // 19.4.2.1 Symbol.for(key)
  22911. 'for': function(key){
  22912. return has(SymbolRegistry, key += '')
  22913. ? SymbolRegistry[key]
  22914. : SymbolRegistry[key] = $Symbol(key);
  22915. },
  22916. // 19.4.2.5 Symbol.keyFor(sym)
  22917. keyFor: function keyFor(key){
  22918. if(isSymbol(key))return keyOf(SymbolRegistry, key);
  22919. throw TypeError(key + ' is not a symbol!');
  22920. },
  22921. useSetter: function(){ setter = true; },
  22922. useSimple: function(){ setter = false; }
  22923. });
  22924. $export($export.S + $export.F * !USE_NATIVE, 'Object', {
  22925. // 19.1.2.2 Object.create(O [, Properties])
  22926. create: $create,
  22927. // 19.1.2.4 Object.defineProperty(O, P, Attributes)
  22928. defineProperty: $defineProperty,
  22929. // 19.1.2.3 Object.defineProperties(O, Properties)
  22930. defineProperties: $defineProperties,
  22931. // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
  22932. getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
  22933. // 19.1.2.7 Object.getOwnPropertyNames(O)
  22934. getOwnPropertyNames: $getOwnPropertyNames,
  22935. // 19.1.2.8 Object.getOwnPropertySymbols(O)
  22936. getOwnPropertySymbols: $getOwnPropertySymbols
  22937. });
  22938. // 24.3.2 JSON.stringify(value [, replacer [, space]])
  22939. $JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function(){
  22940. var S = $Symbol();
  22941. // MS Edge converts symbol values to JSON as {}
  22942. // WebKit converts symbol values to JSON as null
  22943. // V8 throws on boxed symbols
  22944. return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}';
  22945. })), 'JSON', {
  22946. stringify: function stringify(it){
  22947. if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined
  22948. var args = [it]
  22949. , i = 1
  22950. , replacer, $replacer;
  22951. while(arguments.length > i)args.push(arguments[i++]);
  22952. replacer = args[1];
  22953. if(typeof replacer == 'function')$replacer = replacer;
  22954. if($replacer || !isArray(replacer))replacer = function(key, value){
  22955. if($replacer)value = $replacer.call(this, key, value);
  22956. if(!isSymbol(value))return value;
  22957. };
  22958. args[1] = replacer;
  22959. return _stringify.apply($JSON, args);
  22960. }
  22961. });
  22962. // 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
  22963. $Symbol[PROTOTYPE][TO_PRIMITIVE] || require('./_hide')($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
  22964. // 19.4.3.5 Symbol.prototype[@@toStringTag]
  22965. setToStringTag($Symbol, 'Symbol');
  22966. // 20.2.1.9 Math[@@toStringTag]
  22967. setToStringTag(Math, 'Math', true);
  22968. // 24.3.3 JSON[@@toStringTag]
  22969. setToStringTag(global.JSON, 'JSON', true);
  22970. },{"./_an-object":142,"./_descriptors":157,"./_enum-keys":160,"./_export":161,"./_fails":162,"./_global":164,"./_has":165,"./_hide":166,"./_is-array":171,"./_keyof":178,"./_library":179,"./_meta":180,"./_object-create":182,"./_object-dp":183,"./_object-gopd":185,"./_object-gopn":187,"./_object-gopn-ext":186,"./_object-gops":188,"./_object-keys":191,"./_object-pie":192,"./_property-desc":194,"./_redefine":196,"./_set-to-string-tag":199,"./_shared":201,"./_to-iobject":205,"./_to-primitive":208,"./_uid":209,"./_wks":212,"./_wks-define":210,"./_wks-ext":211}],225:[function(require,module,exports){
  22971. 'use strict';
  22972. var each = require('./_array-methods')(0)
  22973. , redefine = require('./_redefine')
  22974. , meta = require('./_meta')
  22975. , assign = require('./_object-assign')
  22976. , weak = require('./_collection-weak')
  22977. , isObject = require('./_is-object')
  22978. , getWeak = meta.getWeak
  22979. , isExtensible = Object.isExtensible
  22980. , uncaughtFrozenStore = weak.ufstore
  22981. , tmp = {}
  22982. , InternalMap;
  22983. var wrapper = function(get){
  22984. return function WeakMap(){
  22985. return get(this, arguments.length > 0 ? arguments[0] : undefined);
  22986. };
  22987. };
  22988. var methods = {
  22989. // 23.3.3.3 WeakMap.prototype.get(key)
  22990. get: function get(key){
  22991. if(isObject(key)){
  22992. var data = getWeak(key);
  22993. if(data === true)return uncaughtFrozenStore(this).get(key);
  22994. return data ? data[this._i] : undefined;
  22995. }
  22996. },
  22997. // 23.3.3.5 WeakMap.prototype.set(key, value)
  22998. set: function set(key, value){
  22999. return weak.def(this, key, value);
  23000. }
  23001. };
  23002. // 23.3 WeakMap Objects
  23003. var $WeakMap = module.exports = require('./_collection')('WeakMap', wrapper, methods, weak, true, true);
  23004. // IE11 WeakMap frozen keys fix
  23005. if(new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7){
  23006. InternalMap = weak.getConstructor(wrapper);
  23007. assign(InternalMap.prototype, methods);
  23008. meta.NEED = true;
  23009. each(['delete', 'has', 'get', 'set'], function(key){
  23010. var proto = $WeakMap.prototype
  23011. , method = proto[key];
  23012. redefine(proto, key, function(a, b){
  23013. // store frozen objects on internal weakmap shim
  23014. if(isObject(a) && !isExtensible(a)){
  23015. if(!this._f)this._f = new InternalMap;
  23016. var result = this._f[key](a, b);
  23017. return key == 'set' ? this : result;
  23018. // store all the rest on native weakmap
  23019. } return method.call(this, a, b);
  23020. });
  23021. });
  23022. }
  23023. },{"./_array-methods":145,"./_collection":153,"./_collection-weak":152,"./_is-object":172,"./_meta":180,"./_object-assign":181,"./_redefine":196}],226:[function(require,module,exports){
  23024. 'use strict';
  23025. var weak = require('./_collection-weak');
  23026. // 23.4 WeakSet Objects
  23027. require('./_collection')('WeakSet', function(get){
  23028. return function WeakSet(){ return get(this, arguments.length > 0 ? arguments[0] : undefined); };
  23029. }, {
  23030. // 23.4.3.1 WeakSet.prototype.add(value)
  23031. add: function add(value){
  23032. return weak.def(this, value, true);
  23033. }
  23034. }, weak, false, true);
  23035. },{"./_collection":153,"./_collection-weak":152}],227:[function(require,module,exports){
  23036. // https://github.com/DavidBruant/Map-Set.prototype.toJSON
  23037. var $export = require('./_export');
  23038. $export($export.P + $export.R, 'Map', {toJSON: require('./_collection-to-json')('Map')});
  23039. },{"./_collection-to-json":151,"./_export":161}],228:[function(require,module,exports){
  23040. require('./_wks-define')('asyncIterator');
  23041. },{"./_wks-define":210}],229:[function(require,module,exports){
  23042. require('./_wks-define')('observable');
  23043. },{"./_wks-define":210}],230:[function(require,module,exports){
  23044. require('./es6.array.iterator');
  23045. var global = require('./_global')
  23046. , hide = require('./_hide')
  23047. , Iterators = require('./_iterators')
  23048. , TO_STRING_TAG = require('./_wks')('toStringTag');
  23049. for(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){
  23050. var NAME = collections[i]
  23051. , Collection = global[NAME]
  23052. , proto = Collection && Collection.prototype;
  23053. if(proto && !proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME);
  23054. Iterators[NAME] = Iterators.Array;
  23055. }
  23056. },{"./_global":164,"./_hide":166,"./_iterators":177,"./_wks":212,"./es6.array.iterator":215}],231:[function(require,module,exports){
  23057. module.exports = require('./src/node');
  23058. },{"./src/node":234}],232:[function(require,module,exports){
  23059. (function (process){
  23060. /**
  23061. * This is the web browser implementation of `debug()`.
  23062. *
  23063. * Expose `debug()` as the module.
  23064. */
  23065. exports = module.exports = require('./debug');
  23066. exports.log = log;
  23067. exports.formatArgs = formatArgs;
  23068. exports.save = save;
  23069. exports.load = load;
  23070. exports.useColors = useColors;
  23071. exports.storage = 'undefined' != typeof chrome
  23072. && 'undefined' != typeof chrome.storage
  23073. ? chrome.storage.local
  23074. : localstorage();
  23075. /**
  23076. * Colors.
  23077. */
  23078. exports.colors = [
  23079. 'lightseagreen',
  23080. 'forestgreen',
  23081. 'goldenrod',
  23082. 'dodgerblue',
  23083. 'darkorchid',
  23084. 'crimson'
  23085. ];
  23086. /**
  23087. * Currently only WebKit-based Web Inspectors, Firefox >= v31,
  23088. * and the Firebug extension (any Firefox version) are known
  23089. * to support "%c" CSS customizations.
  23090. *
  23091. * TODO: add a `localStorage` variable to explicitly enable/disable colors
  23092. */
  23093. function useColors() {
  23094. // NB: In an Electron preload script, document will be defined but not fully
  23095. // initialized. Since we know we're in Chrome, we'll just detect this case
  23096. // explicitly
  23097. if (typeof window !== 'undefined' && window && typeof window.process !== 'undefined' && window.process.type === 'renderer') {
  23098. return true;
  23099. }
  23100. // is webkit? http://stackoverflow.com/a/16459606/376773
  23101. // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
  23102. return (typeof document !== 'undefined' && document && 'WebkitAppearance' in document.documentElement.style) ||
  23103. // is firebug? http://stackoverflow.com/a/398120/376773
  23104. (typeof window !== 'undefined' && window && window.console && (console.firebug || (console.exception && console.table))) ||
  23105. // is firefox >= v31?
  23106. // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
  23107. (typeof navigator !== 'undefined' && navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
  23108. // double check webkit in userAgent just in case we are in a worker
  23109. (typeof navigator !== 'undefined' && navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
  23110. }
  23111. /**
  23112. * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
  23113. */
  23114. exports.formatters.j = function(v) {
  23115. try {
  23116. return JSON.stringify(v);
  23117. } catch (err) {
  23118. return '[UnexpectedJSONParseError]: ' + err.message;
  23119. }
  23120. };
  23121. /**
  23122. * Colorize log arguments if enabled.
  23123. *
  23124. * @api public
  23125. */
  23126. function formatArgs(args) {
  23127. var useColors = this.useColors;
  23128. args[0] = (useColors ? '%c' : '')
  23129. + this.namespace
  23130. + (useColors ? ' %c' : ' ')
  23131. + args[0]
  23132. + (useColors ? '%c ' : ' ')
  23133. + '+' + exports.humanize(this.diff);
  23134. if (!useColors) return;
  23135. var c = 'color: ' + this.color;
  23136. args.splice(1, 0, c, 'color: inherit')
  23137. // the final "%c" is somewhat tricky, because there could be other
  23138. // arguments passed either before or after the %c, so we need to
  23139. // figure out the correct index to insert the CSS into
  23140. var index = 0;
  23141. var lastC = 0;
  23142. args[0].replace(/%[a-zA-Z%]/g, function(match) {
  23143. if ('%%' === match) return;
  23144. index++;
  23145. if ('%c' === match) {
  23146. // we only are interested in the *last* %c
  23147. // (the user may have provided their own)
  23148. lastC = index;
  23149. }
  23150. });
  23151. args.splice(lastC, 0, c);
  23152. }
  23153. /**
  23154. * Invokes `console.log()` when available.
  23155. * No-op when `console.log` is not a "function".
  23156. *
  23157. * @api public
  23158. */
  23159. function log() {
  23160. // this hackery is required for IE8/9, where
  23161. // the `console.log` function doesn't have 'apply'
  23162. return 'object' === typeof console
  23163. && console.log
  23164. && Function.prototype.apply.call(console.log, console, arguments);
  23165. }
  23166. /**
  23167. * Save `namespaces`.
  23168. *
  23169. * @param {String} namespaces
  23170. * @api private
  23171. */
  23172. function save(namespaces) {
  23173. try {
  23174. if (null == namespaces) {
  23175. exports.storage.removeItem('debug');
  23176. } else {
  23177. exports.storage.debug = namespaces;
  23178. }
  23179. } catch(e) {}
  23180. }
  23181. /**
  23182. * Load `namespaces`.
  23183. *
  23184. * @return {String} returns the previously persisted debug modes
  23185. * @api private
  23186. */
  23187. function load() {
  23188. try {
  23189. return exports.storage.debug;
  23190. } catch(e) {}
  23191. // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
  23192. if (typeof process !== 'undefined' && 'env' in process) {
  23193. return process.env.DEBUG;
  23194. }
  23195. }
  23196. /**
  23197. * Enable namespaces listed in `localStorage.debug` initially.
  23198. */
  23199. exports.enable(load());
  23200. /**
  23201. * Localstorage attempts to return the localstorage.
  23202. *
  23203. * This is necessary because safari throws
  23204. * when a user disables cookies/localstorage
  23205. * and you attempt to access it.
  23206. *
  23207. * @return {LocalStorage}
  23208. * @api private
  23209. */
  23210. function localstorage() {
  23211. try {
  23212. return window.localStorage;
  23213. } catch (e) {}
  23214. }
  23215. }).call(this,require('_process'))
  23216. },{"./debug":233,"_process":471}],233:[function(require,module,exports){
  23217. /**
  23218. * This is the common logic for both the Node.js and web browser
  23219. * implementations of `debug()`.
  23220. *
  23221. * Expose `debug()` as the module.
  23222. */
  23223. exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
  23224. exports.coerce = coerce;
  23225. exports.disable = disable;
  23226. exports.enable = enable;
  23227. exports.enabled = enabled;
  23228. exports.humanize = require('ms');
  23229. /**
  23230. * The currently active debug mode names, and names to skip.
  23231. */
  23232. exports.names = [];
  23233. exports.skips = [];
  23234. /**
  23235. * Map of special "%n" handling functions, for the debug "format" argument.
  23236. *
  23237. * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
  23238. */
  23239. exports.formatters = {};
  23240. /**
  23241. * Previous log timestamp.
  23242. */
  23243. var prevTime;
  23244. /**
  23245. * Select a color.
  23246. * @param {String} namespace
  23247. * @return {Number}
  23248. * @api private
  23249. */
  23250. function selectColor(namespace) {
  23251. var hash = 0, i;
  23252. for (i in namespace) {
  23253. hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
  23254. hash |= 0; // Convert to 32bit integer
  23255. }
  23256. return exports.colors[Math.abs(hash) % exports.colors.length];
  23257. }
  23258. /**
  23259. * Create a debugger with the given `namespace`.
  23260. *
  23261. * @param {String} namespace
  23262. * @return {Function}
  23263. * @api public
  23264. */
  23265. function createDebug(namespace) {
  23266. function debug() {
  23267. // disabled?
  23268. if (!debug.enabled) return;
  23269. var self = debug;
  23270. // set `diff` timestamp
  23271. var curr = +new Date();
  23272. var ms = curr - (prevTime || curr);
  23273. self.diff = ms;
  23274. self.prev = prevTime;
  23275. self.curr = curr;
  23276. prevTime = curr;
  23277. // turn the `arguments` into a proper Array
  23278. var args = new Array(arguments.length);
  23279. for (var i = 0; i < args.length; i++) {
  23280. args[i] = arguments[i];
  23281. }
  23282. args[0] = exports.coerce(args[0]);
  23283. if ('string' !== typeof args[0]) {
  23284. // anything else let's inspect with %O
  23285. args.unshift('%O');
  23286. }
  23287. // apply any `formatters` transformations
  23288. var index = 0;
  23289. args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
  23290. // if we encounter an escaped % then don't increase the array index
  23291. if (match === '%%') return match;
  23292. index++;
  23293. var formatter = exports.formatters[format];
  23294. if ('function' === typeof formatter) {
  23295. var val = args[index];
  23296. match = formatter.call(self, val);
  23297. // now we need to remove `args[index]` since it's inlined in the `format`
  23298. args.splice(index, 1);
  23299. index--;
  23300. }
  23301. return match;
  23302. });
  23303. // apply env-specific formatting (colors, etc.)
  23304. exports.formatArgs.call(self, args);
  23305. var logFn = debug.log || exports.log || console.log.bind(console);
  23306. logFn.apply(self, args);
  23307. }
  23308. debug.namespace = namespace;
  23309. debug.enabled = exports.enabled(namespace);
  23310. debug.useColors = exports.useColors();
  23311. debug.color = selectColor(namespace);
  23312. // env-specific initialization logic for debug instances
  23313. if ('function' === typeof exports.init) {
  23314. exports.init(debug);
  23315. }
  23316. return debug;
  23317. }
  23318. /**
  23319. * Enables a debug mode by namespaces. This can include modes
  23320. * separated by a colon and wildcards.
  23321. *
  23322. * @param {String} namespaces
  23323. * @api public
  23324. */
  23325. function enable(namespaces) {
  23326. exports.save(namespaces);
  23327. exports.names = [];
  23328. exports.skips = [];
  23329. var split = (namespaces || '').split(/[\s,]+/);
  23330. var len = split.length;
  23331. for (var i = 0; i < len; i++) {
  23332. if (!split[i]) continue; // ignore empty strings
  23333. namespaces = split[i].replace(/\*/g, '.*?');
  23334. if (namespaces[0] === '-') {
  23335. exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
  23336. } else {
  23337. exports.names.push(new RegExp('^' + namespaces + '$'));
  23338. }
  23339. }
  23340. }
  23341. /**
  23342. * Disable debug output.
  23343. *
  23344. * @api public
  23345. */
  23346. function disable() {
  23347. exports.enable('');
  23348. }
  23349. /**
  23350. * Returns true if the given mode name is enabled, false otherwise.
  23351. *
  23352. * @param {String} name
  23353. * @return {Boolean}
  23354. * @api public
  23355. */
  23356. function enabled(name) {
  23357. var i, len;
  23358. for (i = 0, len = exports.skips.length; i < len; i++) {
  23359. if (exports.skips[i].test(name)) {
  23360. return false;
  23361. }
  23362. }
  23363. for (i = 0, len = exports.names.length; i < len; i++) {
  23364. if (exports.names[i].test(name)) {
  23365. return true;
  23366. }
  23367. }
  23368. return false;
  23369. }
  23370. /**
  23371. * Coerce `val`.
  23372. *
  23373. * @param {Mixed} val
  23374. * @return {Mixed}
  23375. * @api private
  23376. */
  23377. function coerce(val) {
  23378. if (val instanceof Error) return val.stack || val.message;
  23379. return val;
  23380. }
  23381. },{"ms":467}],234:[function(require,module,exports){
  23382. (function (process){
  23383. /**
  23384. * Module dependencies.
  23385. */
  23386. var tty = require('tty');
  23387. var util = require('util');
  23388. /**
  23389. * This is the Node.js implementation of `debug()`.
  23390. *
  23391. * Expose `debug()` as the module.
  23392. */
  23393. exports = module.exports = require('./debug');
  23394. exports.init = init;
  23395. exports.log = log;
  23396. exports.formatArgs = formatArgs;
  23397. exports.save = save;
  23398. exports.load = load;
  23399. exports.useColors = useColors;
  23400. /**
  23401. * Colors.
  23402. */
  23403. exports.colors = [6, 2, 3, 4, 5, 1];
  23404. /**
  23405. * Build up the default `inspectOpts` object from the environment variables.
  23406. *
  23407. * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
  23408. */
  23409. exports.inspectOpts = Object.keys(process.env).filter(function (key) {
  23410. return /^debug_/i.test(key);
  23411. }).reduce(function (obj, key) {
  23412. // camel-case
  23413. var prop = key
  23414. .substring(6)
  23415. .toLowerCase()
  23416. .replace(/_([a-z])/, function (_, k) { return k.toUpperCase() });
  23417. // coerce string value into JS value
  23418. var val = process.env[key];
  23419. if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
  23420. else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
  23421. else if (val === 'null') val = null;
  23422. else val = Number(val);
  23423. obj[prop] = val;
  23424. return obj;
  23425. }, {});
  23426. /**
  23427. * The file descriptor to write the `debug()` calls to.
  23428. * Set the `DEBUG_FD` env variable to override with another value. i.e.:
  23429. *
  23430. * $ DEBUG_FD=3 node script.js 3>debug.log
  23431. */
  23432. var fd = parseInt(process.env.DEBUG_FD, 10) || 2;
  23433. if (1 !== fd && 2 !== fd) {
  23434. util.deprecate(function(){}, 'except for stderr(2) and stdout(1), any other usage of DEBUG_FD is deprecated. Override debug.log if you want to use a different log function (https://git.io/debug_fd)')()
  23435. }
  23436. var stream = 1 === fd ? process.stdout :
  23437. 2 === fd ? process.stderr :
  23438. createWritableStdioStream(fd);
  23439. /**
  23440. * Is stdout a TTY? Colored output is enabled when `true`.
  23441. */
  23442. function useColors() {
  23443. return 'colors' in exports.inspectOpts
  23444. ? Boolean(exports.inspectOpts.colors)
  23445. : tty.isatty(fd);
  23446. }
  23447. /**
  23448. * Map %o to `util.inspect()`, all on a single line.
  23449. */
  23450. exports.formatters.o = function(v) {
  23451. this.inspectOpts.colors = this.useColors;
  23452. return util.inspect(v, this.inspectOpts)
  23453. .replace(/\s*\n\s*/g, ' ');
  23454. };
  23455. /**
  23456. * Map %o to `util.inspect()`, allowing multiple lines if needed.
  23457. */
  23458. exports.formatters.O = function(v) {
  23459. this.inspectOpts.colors = this.useColors;
  23460. return util.inspect(v, this.inspectOpts);
  23461. };
  23462. /**
  23463. * Adds ANSI color escape codes if enabled.
  23464. *
  23465. * @api public
  23466. */
  23467. function formatArgs(args) {
  23468. var name = this.namespace;
  23469. var useColors = this.useColors;
  23470. if (useColors) {
  23471. var c = this.color;
  23472. var prefix = ' \u001b[3' + c + ';1m' + name + ' ' + '\u001b[0m';
  23473. args[0] = prefix + args[0].split('\n').join('\n' + prefix);
  23474. args.push('\u001b[3' + c + 'm+' + exports.humanize(this.diff) + '\u001b[0m');
  23475. } else {
  23476. args[0] = new Date().toUTCString()
  23477. + ' ' + name + ' ' + args[0];
  23478. }
  23479. }
  23480. /**
  23481. * Invokes `util.format()` with the specified arguments and writes to `stream`.
  23482. */
  23483. function log() {
  23484. return stream.write(util.format.apply(util, arguments) + '\n');
  23485. }
  23486. /**
  23487. * Save `namespaces`.
  23488. *
  23489. * @param {String} namespaces
  23490. * @api private
  23491. */
  23492. function save(namespaces) {
  23493. if (null == namespaces) {
  23494. // If you set a process.env field to null or undefined, it gets cast to the
  23495. // string 'null' or 'undefined'. Just delete instead.
  23496. delete process.env.DEBUG;
  23497. } else {
  23498. process.env.DEBUG = namespaces;
  23499. }
  23500. }
  23501. /**
  23502. * Load `namespaces`.
  23503. *
  23504. * @return {String} returns the previously persisted debug modes
  23505. * @api private
  23506. */
  23507. function load() {
  23508. return process.env.DEBUG;
  23509. }
  23510. /**
  23511. * Copied from `node/src/node.js`.
  23512. *
  23513. * XXX: It's lame that node doesn't expose this API out-of-the-box. It also
  23514. * relies on the undocumented `tty_wrap.guessHandleType()` which is also lame.
  23515. */
  23516. function createWritableStdioStream (fd) {
  23517. var stream;
  23518. var tty_wrap = process.binding('tty_wrap');
  23519. // Note stream._type is used for test-module-load-list.js
  23520. switch (tty_wrap.guessHandleType(fd)) {
  23521. case 'TTY':
  23522. stream = new tty.WriteStream(fd);
  23523. stream._type = 'tty';
  23524. // Hack to have stream not keep the event loop alive.
  23525. // See https://github.com/joyent/node/issues/1726
  23526. if (stream._handle && stream._handle.unref) {
  23527. stream._handle.unref();
  23528. }
  23529. break;
  23530. case 'FILE':
  23531. var fs = require('fs');
  23532. stream = new fs.SyncWriteStream(fd, { autoClose: false });
  23533. stream._type = 'fs';
  23534. break;
  23535. case 'PIPE':
  23536. case 'TCP':
  23537. var net = require('net');
  23538. stream = new net.Socket({
  23539. fd: fd,
  23540. readable: false,
  23541. writable: true
  23542. });
  23543. // FIXME Should probably have an option in net.Socket to create a
  23544. // stream from an existing fd which is writable only. But for now
  23545. // we'll just add this hack and set the `readable` member to false.
  23546. // Test: ./node test/fixtures/echo.js < /etc/passwd
  23547. stream.readable = false;
  23548. stream.read = null;
  23549. stream._type = 'pipe';
  23550. // FIXME Hack to have stream not keep the event loop alive.
  23551. // See https://github.com/joyent/node/issues/1726
  23552. if (stream._handle && stream._handle.unref) {
  23553. stream._handle.unref();
  23554. }
  23555. break;
  23556. default:
  23557. // Probably an error on in uv_guess_handle()
  23558. throw new Error('Implement me. Unknown stream file type!');
  23559. }
  23560. // For supporting legacy API we put the FD here.
  23561. stream.fd = fd;
  23562. stream._isStdio = true;
  23563. return stream;
  23564. }
  23565. /**
  23566. * Init logic for `debug` instances.
  23567. *
  23568. * Create a new `inspectOpts` object in case `useColors` is set
  23569. * differently for a particular `debug` instance.
  23570. */
  23571. function init (debug) {
  23572. debug.inspectOpts = util._extend({}, exports.inspectOpts);
  23573. }
  23574. /**
  23575. * Enable namespaces listed in `process.env.DEBUG` initially.
  23576. */
  23577. exports.enable(load());
  23578. }).call(this,require('_process'))
  23579. },{"./debug":233,"_process":471,"fs":120,"net":120,"tty":489,"util":492}],235:[function(require,module,exports){
  23580. /* eslint-disable guard-for-in */
  23581. 'use strict';
  23582. var repeating = require('repeating');
  23583. // detect either spaces or tabs but not both to properly handle tabs
  23584. // for indentation and spaces for alignment
  23585. var INDENT_RE = /^(?:( )+|\t+)/;
  23586. function getMostUsed(indents) {
  23587. var result = 0;
  23588. var maxUsed = 0;
  23589. var maxWeight = 0;
  23590. for (var n in indents) {
  23591. var indent = indents[n];
  23592. var u = indent[0];
  23593. var w = indent[1];
  23594. if (u > maxUsed || u === maxUsed && w > maxWeight) {
  23595. maxUsed = u;
  23596. maxWeight = w;
  23597. result = Number(n);
  23598. }
  23599. }
  23600. return result;
  23601. }
  23602. module.exports = function (str) {
  23603. if (typeof str !== 'string') {
  23604. throw new TypeError('Expected a string');
  23605. }
  23606. // used to see if tabs or spaces are the most used
  23607. var tabs = 0;
  23608. var spaces = 0;
  23609. // remember the size of previous line's indentation
  23610. var prev = 0;
  23611. // remember how many indents/unindents as occurred for a given size
  23612. // and how much lines follow a given indentation
  23613. //
  23614. // indents = {
  23615. // 3: [1, 0],
  23616. // 4: [1, 5],
  23617. // 5: [1, 0],
  23618. // 12: [1, 0],
  23619. // }
  23620. var indents = {};
  23621. // pointer to the array of last used indent
  23622. var current;
  23623. // whether the last action was an indent (opposed to an unindent)
  23624. var isIndent;
  23625. str.split(/\n/g).forEach(function (line) {
  23626. if (!line) {
  23627. // ignore empty lines
  23628. return;
  23629. }
  23630. var indent;
  23631. var matches = line.match(INDENT_RE);
  23632. if (!matches) {
  23633. indent = 0;
  23634. } else {
  23635. indent = matches[0].length;
  23636. if (matches[1]) {
  23637. spaces++;
  23638. } else {
  23639. tabs++;
  23640. }
  23641. }
  23642. var diff = indent - prev;
  23643. prev = indent;
  23644. if (diff) {
  23645. // an indent or unindent has been detected
  23646. isIndent = diff > 0;
  23647. current = indents[isIndent ? diff : -diff];
  23648. if (current) {
  23649. current[0]++;
  23650. } else {
  23651. current = indents[diff] = [1, 0];
  23652. }
  23653. } else if (current) {
  23654. // if the last action was an indent, increment the weight
  23655. current[1] += Number(isIndent);
  23656. }
  23657. });
  23658. var amount = getMostUsed(indents);
  23659. var type;
  23660. var actual;
  23661. if (!amount) {
  23662. type = null;
  23663. actual = '';
  23664. } else if (spaces >= tabs) {
  23665. type = 'space';
  23666. actual = repeating(' ', amount);
  23667. } else {
  23668. type = 'tab';
  23669. actual = repeating('\t', amount);
  23670. }
  23671. return {
  23672. amount: amount,
  23673. type: type,
  23674. indent: actual
  23675. };
  23676. };
  23677. },{"repeating":472}],236:[function(require,module,exports){
  23678. 'use strict';
  23679. var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
  23680. module.exports = function (str) {
  23681. if (typeof str !== 'string') {
  23682. throw new TypeError('Expected a string');
  23683. }
  23684. return str.replace(matchOperatorsRe, '\\$&');
  23685. };
  23686. },{}],237:[function(require,module,exports){
  23687. /*
  23688. Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
  23689. Redistribution and use in source and binary forms, with or without
  23690. modification, are permitted provided that the following conditions are met:
  23691. * Redistributions of source code must retain the above copyright
  23692. notice, this list of conditions and the following disclaimer.
  23693. * Redistributions in binary form must reproduce the above copyright
  23694. notice, this list of conditions and the following disclaimer in the
  23695. documentation and/or other materials provided with the distribution.
  23696. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
  23697. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23698. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  23699. ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  23700. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  23701. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  23702. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23703. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23704. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  23705. THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23706. */
  23707. (function () {
  23708. 'use strict';
  23709. function isExpression(node) {
  23710. if (node == null) { return false; }
  23711. switch (node.type) {
  23712. case 'ArrayExpression':
  23713. case 'AssignmentExpression':
  23714. case 'BinaryExpression':
  23715. case 'CallExpression':
  23716. case 'ConditionalExpression':
  23717. case 'FunctionExpression':
  23718. case 'Identifier':
  23719. case 'Literal':
  23720. case 'LogicalExpression':
  23721. case 'MemberExpression':
  23722. case 'NewExpression':
  23723. case 'ObjectExpression':
  23724. case 'SequenceExpression':
  23725. case 'ThisExpression':
  23726. case 'UnaryExpression':
  23727. case 'UpdateExpression':
  23728. return true;
  23729. }
  23730. return false;
  23731. }
  23732. function isIterationStatement(node) {
  23733. if (node == null) { return false; }
  23734. switch (node.type) {
  23735. case 'DoWhileStatement':
  23736. case 'ForInStatement':
  23737. case 'ForStatement':
  23738. case 'WhileStatement':
  23739. return true;
  23740. }
  23741. return false;
  23742. }
  23743. function isStatement(node) {
  23744. if (node == null) { return false; }
  23745. switch (node.type) {
  23746. case 'BlockStatement':
  23747. case 'BreakStatement':
  23748. case 'ContinueStatement':
  23749. case 'DebuggerStatement':
  23750. case 'DoWhileStatement':
  23751. case 'EmptyStatement':
  23752. case 'ExpressionStatement':
  23753. case 'ForInStatement':
  23754. case 'ForStatement':
  23755. case 'IfStatement':
  23756. case 'LabeledStatement':
  23757. case 'ReturnStatement':
  23758. case 'SwitchStatement':
  23759. case 'ThrowStatement':
  23760. case 'TryStatement':
  23761. case 'VariableDeclaration':
  23762. case 'WhileStatement':
  23763. case 'WithStatement':
  23764. return true;
  23765. }
  23766. return false;
  23767. }
  23768. function isSourceElement(node) {
  23769. return isStatement(node) || node != null && node.type === 'FunctionDeclaration';
  23770. }
  23771. function trailingStatement(node) {
  23772. switch (node.type) {
  23773. case 'IfStatement':
  23774. if (node.alternate != null) {
  23775. return node.alternate;
  23776. }
  23777. return node.consequent;
  23778. case 'LabeledStatement':
  23779. case 'ForStatement':
  23780. case 'ForInStatement':
  23781. case 'WhileStatement':
  23782. case 'WithStatement':
  23783. return node.body;
  23784. }
  23785. return null;
  23786. }
  23787. function isProblematicIfStatement(node) {
  23788. var current;
  23789. if (node.type !== 'IfStatement') {
  23790. return false;
  23791. }
  23792. if (node.alternate == null) {
  23793. return false;
  23794. }
  23795. current = node.consequent;
  23796. do {
  23797. if (current.type === 'IfStatement') {
  23798. if (current.alternate == null) {
  23799. return true;
  23800. }
  23801. }
  23802. current = trailingStatement(current);
  23803. } while (current);
  23804. return false;
  23805. }
  23806. module.exports = {
  23807. isExpression: isExpression,
  23808. isStatement: isStatement,
  23809. isIterationStatement: isIterationStatement,
  23810. isSourceElement: isSourceElement,
  23811. isProblematicIfStatement: isProblematicIfStatement,
  23812. trailingStatement: trailingStatement
  23813. };
  23814. }());
  23815. /* vim: set sw=4 ts=4 et tw=80 : */
  23816. },{}],238:[function(require,module,exports){
  23817. /*
  23818. Copyright (C) 2013-2014 Yusuke Suzuki <utatane.tea@gmail.com>
  23819. Copyright (C) 2014 Ivan Nikulin <ifaaan@gmail.com>
  23820. Redistribution and use in source and binary forms, with or without
  23821. modification, are permitted provided that the following conditions are met:
  23822. * Redistributions of source code must retain the above copyright
  23823. notice, this list of conditions and the following disclaimer.
  23824. * Redistributions in binary form must reproduce the above copyright
  23825. notice, this list of conditions and the following disclaimer in the
  23826. documentation and/or other materials provided with the distribution.
  23827. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  23828. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23829. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  23830. ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  23831. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  23832. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  23833. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23834. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23835. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  23836. THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23837. */
  23838. (function () {
  23839. 'use strict';
  23840. var ES6Regex, ES5Regex, NON_ASCII_WHITESPACES, IDENTIFIER_START, IDENTIFIER_PART, ch;
  23841. // See `tools/generate-identifier-regex.js`.
  23842. ES5Regex = {
  23843. // ECMAScript 5.1/Unicode v7.0.0 NonAsciiIdentifierStart:
  23844. NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,
  23845. // ECMAScript 5.1/Unicode v7.0.0 NonAsciiIdentifierPart:
  23846. NonAsciiIdentifierPart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/
  23847. };
  23848. ES6Regex = {
  23849. // ECMAScript 6/Unicode v7.0.0 NonAsciiIdentifierStart:
  23850. NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDE00-\uDE11\uDE13-\uDE2B\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDE00-\uDE2F\uDE44\uDE80-\uDEAA]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|\uD809[\uDC00-\uDC6E]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]/,
  23851. // ECMAScript 6/Unicode v7.0.0 NonAsciiIdentifierPart:
  23852. NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDD0-\uDDDA\uDE00-\uDE11\uDE13-\uDE37\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF01-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|\uD809[\uDC00-\uDC6E]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/
  23853. };
  23854. function isDecimalDigit(ch) {
  23855. return 0x30 <= ch && ch <= 0x39; // 0..9
  23856. }
  23857. function isHexDigit(ch) {
  23858. return 0x30 <= ch && ch <= 0x39 || // 0..9
  23859. 0x61 <= ch && ch <= 0x66 || // a..f
  23860. 0x41 <= ch && ch <= 0x46; // A..F
  23861. }
  23862. function isOctalDigit(ch) {
  23863. return ch >= 0x30 && ch <= 0x37; // 0..7
  23864. }
  23865. // 7.2 White Space
  23866. NON_ASCII_WHITESPACES = [
  23867. 0x1680, 0x180E,
  23868. 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A,
  23869. 0x202F, 0x205F,
  23870. 0x3000,
  23871. 0xFEFF
  23872. ];
  23873. function isWhiteSpace(ch) {
  23874. return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 ||
  23875. ch >= 0x1680 && NON_ASCII_WHITESPACES.indexOf(ch) >= 0;
  23876. }
  23877. // 7.3 Line Terminators
  23878. function isLineTerminator(ch) {
  23879. return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029;
  23880. }
  23881. // 7.6 Identifier Names and Identifiers
  23882. function fromCodePoint(cp) {
  23883. if (cp <= 0xFFFF) { return String.fromCharCode(cp); }
  23884. var cu1 = String.fromCharCode(Math.floor((cp - 0x10000) / 0x400) + 0xD800);
  23885. var cu2 = String.fromCharCode(((cp - 0x10000) % 0x400) + 0xDC00);
  23886. return cu1 + cu2;
  23887. }
  23888. IDENTIFIER_START = new Array(0x80);
  23889. for(ch = 0; ch < 0x80; ++ch) {
  23890. IDENTIFIER_START[ch] =
  23891. ch >= 0x61 && ch <= 0x7A || // a..z
  23892. ch >= 0x41 && ch <= 0x5A || // A..Z
  23893. ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore)
  23894. }
  23895. IDENTIFIER_PART = new Array(0x80);
  23896. for(ch = 0; ch < 0x80; ++ch) {
  23897. IDENTIFIER_PART[ch] =
  23898. ch >= 0x61 && ch <= 0x7A || // a..z
  23899. ch >= 0x41 && ch <= 0x5A || // A..Z
  23900. ch >= 0x30 && ch <= 0x39 || // 0..9
  23901. ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore)
  23902. }
  23903. function isIdentifierStartES5(ch) {
  23904. return ch < 0x80 ? IDENTIFIER_START[ch] : ES5Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch));
  23905. }
  23906. function isIdentifierPartES5(ch) {
  23907. return ch < 0x80 ? IDENTIFIER_PART[ch] : ES5Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch));
  23908. }
  23909. function isIdentifierStartES6(ch) {
  23910. return ch < 0x80 ? IDENTIFIER_START[ch] : ES6Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch));
  23911. }
  23912. function isIdentifierPartES6(ch) {
  23913. return ch < 0x80 ? IDENTIFIER_PART[ch] : ES6Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch));
  23914. }
  23915. module.exports = {
  23916. isDecimalDigit: isDecimalDigit,
  23917. isHexDigit: isHexDigit,
  23918. isOctalDigit: isOctalDigit,
  23919. isWhiteSpace: isWhiteSpace,
  23920. isLineTerminator: isLineTerminator,
  23921. isIdentifierStartES5: isIdentifierStartES5,
  23922. isIdentifierPartES5: isIdentifierPartES5,
  23923. isIdentifierStartES6: isIdentifierStartES6,
  23924. isIdentifierPartES6: isIdentifierPartES6
  23925. };
  23926. }());
  23927. /* vim: set sw=4 ts=4 et tw=80 : */
  23928. },{}],239:[function(require,module,exports){
  23929. /*
  23930. Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
  23931. Redistribution and use in source and binary forms, with or without
  23932. modification, are permitted provided that the following conditions are met:
  23933. * Redistributions of source code must retain the above copyright
  23934. notice, this list of conditions and the following disclaimer.
  23935. * Redistributions in binary form must reproduce the above copyright
  23936. notice, this list of conditions and the following disclaimer in the
  23937. documentation and/or other materials provided with the distribution.
  23938. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  23939. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23940. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  23941. ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  23942. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  23943. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  23944. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23945. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23946. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  23947. THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23948. */
  23949. (function () {
  23950. 'use strict';
  23951. var code = require('./code');
  23952. function isStrictModeReservedWordES6(id) {
  23953. switch (id) {
  23954. case 'implements':
  23955. case 'interface':
  23956. case 'package':
  23957. case 'private':
  23958. case 'protected':
  23959. case 'public':
  23960. case 'static':
  23961. case 'let':
  23962. return true;
  23963. default:
  23964. return false;
  23965. }
  23966. }
  23967. function isKeywordES5(id, strict) {
  23968. // yield should not be treated as keyword under non-strict mode.
  23969. if (!strict && id === 'yield') {
  23970. return false;
  23971. }
  23972. return isKeywordES6(id, strict);
  23973. }
  23974. function isKeywordES6(id, strict) {
  23975. if (strict && isStrictModeReservedWordES6(id)) {
  23976. return true;
  23977. }
  23978. switch (id.length) {
  23979. case 2:
  23980. return (id === 'if') || (id === 'in') || (id === 'do');
  23981. case 3:
  23982. return (id === 'var') || (id === 'for') || (id === 'new') || (id === 'try');
  23983. case 4:
  23984. return (id === 'this') || (id === 'else') || (id === 'case') ||
  23985. (id === 'void') || (id === 'with') || (id === 'enum');
  23986. case 5:
  23987. return (id === 'while') || (id === 'break') || (id === 'catch') ||
  23988. (id === 'throw') || (id === 'const') || (id === 'yield') ||
  23989. (id === 'class') || (id === 'super');
  23990. case 6:
  23991. return (id === 'return') || (id === 'typeof') || (id === 'delete') ||
  23992. (id === 'switch') || (id === 'export') || (id === 'import');
  23993. case 7:
  23994. return (id === 'default') || (id === 'finally') || (id === 'extends');
  23995. case 8:
  23996. return (id === 'function') || (id === 'continue') || (id === 'debugger');
  23997. case 10:
  23998. return (id === 'instanceof');
  23999. default:
  24000. return false;
  24001. }
  24002. }
  24003. function isReservedWordES5(id, strict) {
  24004. return id === 'null' || id === 'true' || id === 'false' || isKeywordES5(id, strict);
  24005. }
  24006. function isReservedWordES6(id, strict) {
  24007. return id === 'null' || id === 'true' || id === 'false' || isKeywordES6(id, strict);
  24008. }
  24009. function isRestrictedWord(id) {
  24010. return id === 'eval' || id === 'arguments';
  24011. }
  24012. function isIdentifierNameES5(id) {
  24013. var i, iz, ch;
  24014. if (id.length === 0) { return false; }
  24015. ch = id.charCodeAt(0);
  24016. if (!code.isIdentifierStartES5(ch)) {
  24017. return false;
  24018. }
  24019. for (i = 1, iz = id.length; i < iz; ++i) {
  24020. ch = id.charCodeAt(i);
  24021. if (!code.isIdentifierPartES5(ch)) {
  24022. return false;
  24023. }
  24024. }
  24025. return true;
  24026. }
  24027. function decodeUtf16(lead, trail) {
  24028. return (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;
  24029. }
  24030. function isIdentifierNameES6(id) {
  24031. var i, iz, ch, lowCh, check;
  24032. if (id.length === 0) { return false; }
  24033. check = code.isIdentifierStartES6;
  24034. for (i = 0, iz = id.length; i < iz; ++i) {
  24035. ch = id.charCodeAt(i);
  24036. if (0xD800 <= ch && ch <= 0xDBFF) {
  24037. ++i;
  24038. if (i >= iz) { return false; }
  24039. lowCh = id.charCodeAt(i);
  24040. if (!(0xDC00 <= lowCh && lowCh <= 0xDFFF)) {
  24041. return false;
  24042. }
  24043. ch = decodeUtf16(ch, lowCh);
  24044. }
  24045. if (!check(ch)) {
  24046. return false;
  24047. }
  24048. check = code.isIdentifierPartES6;
  24049. }
  24050. return true;
  24051. }
  24052. function isIdentifierES5(id, strict) {
  24053. return isIdentifierNameES5(id) && !isReservedWordES5(id, strict);
  24054. }
  24055. function isIdentifierES6(id, strict) {
  24056. return isIdentifierNameES6(id) && !isReservedWordES6(id, strict);
  24057. }
  24058. module.exports = {
  24059. isKeywordES5: isKeywordES5,
  24060. isKeywordES6: isKeywordES6,
  24061. isReservedWordES5: isReservedWordES5,
  24062. isReservedWordES6: isReservedWordES6,
  24063. isRestrictedWord: isRestrictedWord,
  24064. isIdentifierNameES5: isIdentifierNameES5,
  24065. isIdentifierNameES6: isIdentifierNameES6,
  24066. isIdentifierES5: isIdentifierES5,
  24067. isIdentifierES6: isIdentifierES6
  24068. };
  24069. }());
  24070. /* vim: set sw=4 ts=4 et tw=80 : */
  24071. },{"./code":238}],240:[function(require,module,exports){
  24072. /*
  24073. Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
  24074. Redistribution and use in source and binary forms, with or without
  24075. modification, are permitted provided that the following conditions are met:
  24076. * Redistributions of source code must retain the above copyright
  24077. notice, this list of conditions and the following disclaimer.
  24078. * Redistributions in binary form must reproduce the above copyright
  24079. notice, this list of conditions and the following disclaimer in the
  24080. documentation and/or other materials provided with the distribution.
  24081. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  24082. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24083. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  24084. ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  24085. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  24086. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  24087. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  24088. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24089. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  24090. THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24091. */
  24092. (function () {
  24093. 'use strict';
  24094. exports.ast = require('./ast');
  24095. exports.code = require('./code');
  24096. exports.keyword = require('./keyword');
  24097. }());
  24098. /* vim: set sw=4 ts=4 et tw=80 : */
  24099. },{"./ast":237,"./code":238,"./keyword":239}],241:[function(require,module,exports){
  24100. module.exports={
  24101. "builtin": {
  24102. "Array": false,
  24103. "ArrayBuffer": false,
  24104. "Boolean": false,
  24105. "constructor": false,
  24106. "DataView": false,
  24107. "Date": false,
  24108. "decodeURI": false,
  24109. "decodeURIComponent": false,
  24110. "encodeURI": false,
  24111. "encodeURIComponent": false,
  24112. "Error": false,
  24113. "escape": false,
  24114. "eval": false,
  24115. "EvalError": false,
  24116. "Float32Array": false,
  24117. "Float64Array": false,
  24118. "Function": false,
  24119. "hasOwnProperty": false,
  24120. "Infinity": false,
  24121. "Int16Array": false,
  24122. "Int32Array": false,
  24123. "Int8Array": false,
  24124. "isFinite": false,
  24125. "isNaN": false,
  24126. "isPrototypeOf": false,
  24127. "JSON": false,
  24128. "Map": false,
  24129. "Math": false,
  24130. "NaN": false,
  24131. "Number": false,
  24132. "Object": false,
  24133. "parseFloat": false,
  24134. "parseInt": false,
  24135. "Promise": false,
  24136. "propertyIsEnumerable": false,
  24137. "Proxy": false,
  24138. "RangeError": false,
  24139. "ReferenceError": false,
  24140. "Reflect": false,
  24141. "RegExp": false,
  24142. "Set": false,
  24143. "String": false,
  24144. "Symbol": false,
  24145. "SyntaxError": false,
  24146. "System": false,
  24147. "toLocaleString": false,
  24148. "toString": false,
  24149. "TypeError": false,
  24150. "Uint16Array": false,
  24151. "Uint32Array": false,
  24152. "Uint8Array": false,
  24153. "Uint8ClampedArray": false,
  24154. "undefined": false,
  24155. "unescape": false,
  24156. "URIError": false,
  24157. "valueOf": false,
  24158. "WeakMap": false,
  24159. "WeakSet": false
  24160. },
  24161. "es5": {
  24162. "Array": false,
  24163. "Boolean": false,
  24164. "constructor": false,
  24165. "Date": false,
  24166. "decodeURI": false,
  24167. "decodeURIComponent": false,
  24168. "encodeURI": false,
  24169. "encodeURIComponent": false,
  24170. "Error": false,
  24171. "escape": false,
  24172. "eval": false,
  24173. "EvalError": false,
  24174. "Function": false,
  24175. "hasOwnProperty": false,
  24176. "Infinity": false,
  24177. "isFinite": false,
  24178. "isNaN": false,
  24179. "isPrototypeOf": false,
  24180. "JSON": false,
  24181. "Math": false,
  24182. "NaN": false,
  24183. "Number": false,
  24184. "Object": false,
  24185. "parseFloat": false,
  24186. "parseInt": false,
  24187. "propertyIsEnumerable": false,
  24188. "RangeError": false,
  24189. "ReferenceError": false,
  24190. "RegExp": false,
  24191. "String": false,
  24192. "SyntaxError": false,
  24193. "toLocaleString": false,
  24194. "toString": false,
  24195. "TypeError": false,
  24196. "undefined": false,
  24197. "unescape": false,
  24198. "URIError": false,
  24199. "valueOf": false
  24200. },
  24201. "es6": {
  24202. "Array": false,
  24203. "ArrayBuffer": false,
  24204. "Boolean": false,
  24205. "constructor": false,
  24206. "DataView": false,
  24207. "Date": false,
  24208. "decodeURI": false,
  24209. "decodeURIComponent": false,
  24210. "encodeURI": false,
  24211. "encodeURIComponent": false,
  24212. "Error": false,
  24213. "escape": false,
  24214. "eval": false,
  24215. "EvalError": false,
  24216. "Float32Array": false,
  24217. "Float64Array": false,
  24218. "Function": false,
  24219. "hasOwnProperty": false,
  24220. "Infinity": false,
  24221. "Int16Array": false,
  24222. "Int32Array": false,
  24223. "Int8Array": false,
  24224. "isFinite": false,
  24225. "isNaN": false,
  24226. "isPrototypeOf": false,
  24227. "JSON": false,
  24228. "Map": false,
  24229. "Math": false,
  24230. "NaN": false,
  24231. "Number": false,
  24232. "Object": false,
  24233. "parseFloat": false,
  24234. "parseInt": false,
  24235. "Promise": false,
  24236. "propertyIsEnumerable": false,
  24237. "Proxy": false,
  24238. "RangeError": false,
  24239. "ReferenceError": false,
  24240. "Reflect": false,
  24241. "RegExp": false,
  24242. "Set": false,
  24243. "String": false,
  24244. "Symbol": false,
  24245. "SyntaxError": false,
  24246. "System": false,
  24247. "toLocaleString": false,
  24248. "toString": false,
  24249. "TypeError": false,
  24250. "Uint16Array": false,
  24251. "Uint32Array": false,
  24252. "Uint8Array": false,
  24253. "Uint8ClampedArray": false,
  24254. "undefined": false,
  24255. "unescape": false,
  24256. "URIError": false,
  24257. "valueOf": false,
  24258. "WeakMap": false,
  24259. "WeakSet": false
  24260. },
  24261. "browser": {
  24262. "addEventListener": false,
  24263. "alert": false,
  24264. "AnalyserNode": false,
  24265. "Animation": false,
  24266. "AnimationEffectReadOnly": false,
  24267. "AnimationEffectTiming": false,
  24268. "AnimationEffectTimingReadOnly": false,
  24269. "AnimationEvent": false,
  24270. "AnimationPlaybackEvent": false,
  24271. "AnimationTimeline": false,
  24272. "applicationCache": false,
  24273. "ApplicationCache": false,
  24274. "ApplicationCacheErrorEvent": false,
  24275. "atob": false,
  24276. "Attr": false,
  24277. "Audio": false,
  24278. "AudioBuffer": false,
  24279. "AudioBufferSourceNode": false,
  24280. "AudioContext": false,
  24281. "AudioDestinationNode": false,
  24282. "AudioListener": false,
  24283. "AudioNode": false,
  24284. "AudioParam": false,
  24285. "AudioProcessingEvent": false,
  24286. "AutocompleteErrorEvent": false,
  24287. "BarProp": false,
  24288. "BatteryManager": false,
  24289. "BeforeUnloadEvent": false,
  24290. "BiquadFilterNode": false,
  24291. "Blob": false,
  24292. "blur": false,
  24293. "btoa": false,
  24294. "Cache": false,
  24295. "caches": false,
  24296. "CacheStorage": false,
  24297. "cancelAnimationFrame": false,
  24298. "CanvasGradient": false,
  24299. "CanvasPattern": false,
  24300. "CanvasRenderingContext2D": false,
  24301. "CDATASection": false,
  24302. "ChannelMergerNode": false,
  24303. "ChannelSplitterNode": false,
  24304. "CharacterData": false,
  24305. "clearInterval": false,
  24306. "clearTimeout": false,
  24307. "clientInformation": false,
  24308. "ClientRect": false,
  24309. "ClientRectList": false,
  24310. "ClipboardEvent": false,
  24311. "close": false,
  24312. "closed": false,
  24313. "CloseEvent": false,
  24314. "Comment": false,
  24315. "CompositionEvent": false,
  24316. "confirm": false,
  24317. "console": false,
  24318. "ConvolverNode": false,
  24319. "Credential": false,
  24320. "CredentialsContainer": false,
  24321. "crypto": false,
  24322. "Crypto": false,
  24323. "CryptoKey": false,
  24324. "CSS": false,
  24325. "CSSAnimation": false,
  24326. "CSSFontFaceRule": false,
  24327. "CSSImportRule": false,
  24328. "CSSKeyframeRule": false,
  24329. "CSSKeyframesRule": false,
  24330. "CSSMediaRule": false,
  24331. "CSSPageRule": false,
  24332. "CSSRule": false,
  24333. "CSSRuleList": false,
  24334. "CSSStyleDeclaration": false,
  24335. "CSSStyleRule": false,
  24336. "CSSStyleSheet": false,
  24337. "CSSSupportsRule": false,
  24338. "CSSTransition": false,
  24339. "CSSUnknownRule": false,
  24340. "CSSViewportRule": false,
  24341. "customElements": false,
  24342. "CustomEvent": false,
  24343. "DataTransfer": false,
  24344. "DataTransferItem": false,
  24345. "DataTransferItemList": false,
  24346. "Debug": false,
  24347. "defaultStatus": false,
  24348. "defaultstatus": false,
  24349. "DelayNode": false,
  24350. "DeviceMotionEvent": false,
  24351. "DeviceOrientationEvent": false,
  24352. "devicePixelRatio": false,
  24353. "dispatchEvent": false,
  24354. "document": false,
  24355. "Document": false,
  24356. "DocumentFragment": false,
  24357. "DocumentTimeline": false,
  24358. "DocumentType": false,
  24359. "DOMError": false,
  24360. "DOMException": false,
  24361. "DOMImplementation": false,
  24362. "DOMParser": false,
  24363. "DOMSettableTokenList": false,
  24364. "DOMStringList": false,
  24365. "DOMStringMap": false,
  24366. "DOMTokenList": false,
  24367. "DragEvent": false,
  24368. "DynamicsCompressorNode": false,
  24369. "Element": false,
  24370. "ElementTimeControl": false,
  24371. "ErrorEvent": false,
  24372. "event": false,
  24373. "Event": false,
  24374. "EventSource": false,
  24375. "EventTarget": false,
  24376. "external": false,
  24377. "FederatedCredential": false,
  24378. "fetch": false,
  24379. "File": false,
  24380. "FileError": false,
  24381. "FileList": false,
  24382. "FileReader": false,
  24383. "find": false,
  24384. "focus": false,
  24385. "FocusEvent": false,
  24386. "FontFace": false,
  24387. "FormData": false,
  24388. "frameElement": false,
  24389. "frames": false,
  24390. "GainNode": false,
  24391. "Gamepad": false,
  24392. "GamepadButton": false,
  24393. "GamepadEvent": false,
  24394. "getComputedStyle": false,
  24395. "getSelection": false,
  24396. "HashChangeEvent": false,
  24397. "Headers": false,
  24398. "history": false,
  24399. "History": false,
  24400. "HTMLAllCollection": false,
  24401. "HTMLAnchorElement": false,
  24402. "HTMLAppletElement": false,
  24403. "HTMLAreaElement": false,
  24404. "HTMLAudioElement": false,
  24405. "HTMLBaseElement": false,
  24406. "HTMLBlockquoteElement": false,
  24407. "HTMLBodyElement": false,
  24408. "HTMLBRElement": false,
  24409. "HTMLButtonElement": false,
  24410. "HTMLCanvasElement": false,
  24411. "HTMLCollection": false,
  24412. "HTMLContentElement": false,
  24413. "HTMLDataListElement": false,
  24414. "HTMLDetailsElement": false,
  24415. "HTMLDialogElement": false,
  24416. "HTMLDirectoryElement": false,
  24417. "HTMLDivElement": false,
  24418. "HTMLDListElement": false,
  24419. "HTMLDocument": false,
  24420. "HTMLElement": false,
  24421. "HTMLEmbedElement": false,
  24422. "HTMLFieldSetElement": false,
  24423. "HTMLFontElement": false,
  24424. "HTMLFormControlsCollection": false,
  24425. "HTMLFormElement": false,
  24426. "HTMLFrameElement": false,
  24427. "HTMLFrameSetElement": false,
  24428. "HTMLHeadElement": false,
  24429. "HTMLHeadingElement": false,
  24430. "HTMLHRElement": false,
  24431. "HTMLHtmlElement": false,
  24432. "HTMLIFrameElement": false,
  24433. "HTMLImageElement": false,
  24434. "HTMLInputElement": false,
  24435. "HTMLIsIndexElement": false,
  24436. "HTMLKeygenElement": false,
  24437. "HTMLLabelElement": false,
  24438. "HTMLLayerElement": false,
  24439. "HTMLLegendElement": false,
  24440. "HTMLLIElement": false,
  24441. "HTMLLinkElement": false,
  24442. "HTMLMapElement": false,
  24443. "HTMLMarqueeElement": false,
  24444. "HTMLMediaElement": false,
  24445. "HTMLMenuElement": false,
  24446. "HTMLMetaElement": false,
  24447. "HTMLMeterElement": false,
  24448. "HTMLModElement": false,
  24449. "HTMLObjectElement": false,
  24450. "HTMLOListElement": false,
  24451. "HTMLOptGroupElement": false,
  24452. "HTMLOptionElement": false,
  24453. "HTMLOptionsCollection": false,
  24454. "HTMLOutputElement": false,
  24455. "HTMLParagraphElement": false,
  24456. "HTMLParamElement": false,
  24457. "HTMLPictureElement": false,
  24458. "HTMLPreElement": false,
  24459. "HTMLProgressElement": false,
  24460. "HTMLQuoteElement": false,
  24461. "HTMLScriptElement": false,
  24462. "HTMLSelectElement": false,
  24463. "HTMLShadowElement": false,
  24464. "HTMLSourceElement": false,
  24465. "HTMLSpanElement": false,
  24466. "HTMLStyleElement": false,
  24467. "HTMLTableCaptionElement": false,
  24468. "HTMLTableCellElement": false,
  24469. "HTMLTableColElement": false,
  24470. "HTMLTableElement": false,
  24471. "HTMLTableRowElement": false,
  24472. "HTMLTableSectionElement": false,
  24473. "HTMLTemplateElement": false,
  24474. "HTMLTextAreaElement": false,
  24475. "HTMLTitleElement": false,
  24476. "HTMLTrackElement": false,
  24477. "HTMLUListElement": false,
  24478. "HTMLUnknownElement": false,
  24479. "HTMLVideoElement": false,
  24480. "IDBCursor": false,
  24481. "IDBCursorWithValue": false,
  24482. "IDBDatabase": false,
  24483. "IDBEnvironment": false,
  24484. "IDBFactory": false,
  24485. "IDBIndex": false,
  24486. "IDBKeyRange": false,
  24487. "IDBObjectStore": false,
  24488. "IDBOpenDBRequest": false,
  24489. "IDBRequest": false,
  24490. "IDBTransaction": false,
  24491. "IDBVersionChangeEvent": false,
  24492. "Image": false,
  24493. "ImageBitmap": false,
  24494. "ImageData": false,
  24495. "indexedDB": false,
  24496. "innerHeight": false,
  24497. "innerWidth": false,
  24498. "InputEvent": false,
  24499. "InputMethodContext": false,
  24500. "IntersectionObserver": false,
  24501. "IntersectionObserverEntry": false,
  24502. "Intl": false,
  24503. "KeyboardEvent": false,
  24504. "KeyframeEffect": false,
  24505. "KeyframeEffectReadOnly": false,
  24506. "length": false,
  24507. "localStorage": false,
  24508. "location": false,
  24509. "Location": false,
  24510. "locationbar": false,
  24511. "matchMedia": false,
  24512. "MediaElementAudioSourceNode": false,
  24513. "MediaEncryptedEvent": false,
  24514. "MediaError": false,
  24515. "MediaKeyError": false,
  24516. "MediaKeyEvent": false,
  24517. "MediaKeyMessageEvent": false,
  24518. "MediaKeys": false,
  24519. "MediaKeySession": false,
  24520. "MediaKeyStatusMap": false,
  24521. "MediaKeySystemAccess": false,
  24522. "MediaList": false,
  24523. "MediaQueryList": false,
  24524. "MediaQueryListEvent": false,
  24525. "MediaSource": false,
  24526. "MediaRecorder": false,
  24527. "MediaStream": false,
  24528. "MediaStreamAudioDestinationNode": false,
  24529. "MediaStreamAudioSourceNode": false,
  24530. "MediaStreamEvent": false,
  24531. "MediaStreamTrack": false,
  24532. "menubar": false,
  24533. "MessageChannel": false,
  24534. "MessageEvent": false,
  24535. "MessagePort": false,
  24536. "MIDIAccess": false,
  24537. "MIDIConnectionEvent": false,
  24538. "MIDIInput": false,
  24539. "MIDIInputMap": false,
  24540. "MIDIMessageEvent": false,
  24541. "MIDIOutput": false,
  24542. "MIDIOutputMap": false,
  24543. "MIDIPort": false,
  24544. "MimeType": false,
  24545. "MimeTypeArray": false,
  24546. "MouseEvent": false,
  24547. "moveBy": false,
  24548. "moveTo": false,
  24549. "MutationEvent": false,
  24550. "MutationObserver": false,
  24551. "MutationRecord": false,
  24552. "name": false,
  24553. "NamedNodeMap": false,
  24554. "navigator": false,
  24555. "Navigator": false,
  24556. "Node": false,
  24557. "NodeFilter": false,
  24558. "NodeIterator": false,
  24559. "NodeList": false,
  24560. "Notification": false,
  24561. "OfflineAudioCompletionEvent": false,
  24562. "OfflineAudioContext": false,
  24563. "offscreenBuffering": false,
  24564. "onbeforeunload": true,
  24565. "onblur": true,
  24566. "onerror": true,
  24567. "onfocus": true,
  24568. "onload": true,
  24569. "onresize": true,
  24570. "onunload": true,
  24571. "open": false,
  24572. "openDatabase": false,
  24573. "opener": false,
  24574. "opera": false,
  24575. "Option": false,
  24576. "OscillatorNode": false,
  24577. "outerHeight": false,
  24578. "outerWidth": false,
  24579. "PageTransitionEvent": false,
  24580. "pageXOffset": false,
  24581. "pageYOffset": false,
  24582. "parent": false,
  24583. "PasswordCredential": false,
  24584. "Path2D": false,
  24585. "performance": false,
  24586. "Performance": false,
  24587. "PerformanceEntry": false,
  24588. "PerformanceMark": false,
  24589. "PerformanceMeasure": false,
  24590. "PerformanceNavigation": false,
  24591. "PerformanceResourceTiming": false,
  24592. "PerformanceTiming": false,
  24593. "PeriodicWave": false,
  24594. "Permissions": false,
  24595. "PermissionStatus": false,
  24596. "personalbar": false,
  24597. "Plugin": false,
  24598. "PluginArray": false,
  24599. "PopStateEvent": false,
  24600. "postMessage": false,
  24601. "print": false,
  24602. "ProcessingInstruction": false,
  24603. "ProgressEvent": false,
  24604. "PromiseRejectionEvent": false,
  24605. "prompt": false,
  24606. "PushManager": false,
  24607. "PushSubscription": false,
  24608. "RadioNodeList": false,
  24609. "Range": false,
  24610. "ReadableByteStream": false,
  24611. "ReadableStream": false,
  24612. "removeEventListener": false,
  24613. "Request": false,
  24614. "requestAnimationFrame": false,
  24615. "requestIdleCallback": false,
  24616. "resizeBy": false,
  24617. "resizeTo": false,
  24618. "Response": false,
  24619. "RTCIceCandidate": false,
  24620. "RTCSessionDescription": false,
  24621. "RTCPeerConnection": false,
  24622. "screen": false,
  24623. "Screen": false,
  24624. "screenLeft": false,
  24625. "ScreenOrientation": false,
  24626. "screenTop": false,
  24627. "screenX": false,
  24628. "screenY": false,
  24629. "ScriptProcessorNode": false,
  24630. "scroll": false,
  24631. "scrollbars": false,
  24632. "scrollBy": false,
  24633. "scrollTo": false,
  24634. "scrollX": false,
  24635. "scrollY": false,
  24636. "SecurityPolicyViolationEvent": false,
  24637. "Selection": false,
  24638. "self": false,
  24639. "ServiceWorker": false,
  24640. "ServiceWorkerContainer": false,
  24641. "ServiceWorkerRegistration": false,
  24642. "sessionStorage": false,
  24643. "setInterval": false,
  24644. "setTimeout": false,
  24645. "ShadowRoot": false,
  24646. "SharedKeyframeList": false,
  24647. "SharedWorker": false,
  24648. "showModalDialog": false,
  24649. "SiteBoundCredential": false,
  24650. "speechSynthesis": false,
  24651. "SpeechSynthesisEvent": false,
  24652. "SpeechSynthesisUtterance": false,
  24653. "status": false,
  24654. "statusbar": false,
  24655. "stop": false,
  24656. "Storage": false,
  24657. "StorageEvent": false,
  24658. "styleMedia": false,
  24659. "StyleSheet": false,
  24660. "StyleSheetList": false,
  24661. "SubtleCrypto": false,
  24662. "SVGAElement": false,
  24663. "SVGAltGlyphDefElement": false,
  24664. "SVGAltGlyphElement": false,
  24665. "SVGAltGlyphItemElement": false,
  24666. "SVGAngle": false,
  24667. "SVGAnimateColorElement": false,
  24668. "SVGAnimatedAngle": false,
  24669. "SVGAnimatedBoolean": false,
  24670. "SVGAnimatedEnumeration": false,
  24671. "SVGAnimatedInteger": false,
  24672. "SVGAnimatedLength": false,
  24673. "SVGAnimatedLengthList": false,
  24674. "SVGAnimatedNumber": false,
  24675. "SVGAnimatedNumberList": false,
  24676. "SVGAnimatedPathData": false,
  24677. "SVGAnimatedPoints": false,
  24678. "SVGAnimatedPreserveAspectRatio": false,
  24679. "SVGAnimatedRect": false,
  24680. "SVGAnimatedString": false,
  24681. "SVGAnimatedTransformList": false,
  24682. "SVGAnimateElement": false,
  24683. "SVGAnimateMotionElement": false,
  24684. "SVGAnimateTransformElement": false,
  24685. "SVGAnimationElement": false,
  24686. "SVGCircleElement": false,
  24687. "SVGClipPathElement": false,
  24688. "SVGColor": false,
  24689. "SVGColorProfileElement": false,
  24690. "SVGColorProfileRule": false,
  24691. "SVGComponentTransferFunctionElement": false,
  24692. "SVGCSSRule": false,
  24693. "SVGCursorElement": false,
  24694. "SVGDefsElement": false,
  24695. "SVGDescElement": false,
  24696. "SVGDiscardElement": false,
  24697. "SVGDocument": false,
  24698. "SVGElement": false,
  24699. "SVGElementInstance": false,
  24700. "SVGElementInstanceList": false,
  24701. "SVGEllipseElement": false,
  24702. "SVGEvent": false,
  24703. "SVGExternalResourcesRequired": false,
  24704. "SVGFEBlendElement": false,
  24705. "SVGFEColorMatrixElement": false,
  24706. "SVGFEComponentTransferElement": false,
  24707. "SVGFECompositeElement": false,
  24708. "SVGFEConvolveMatrixElement": false,
  24709. "SVGFEDiffuseLightingElement": false,
  24710. "SVGFEDisplacementMapElement": false,
  24711. "SVGFEDistantLightElement": false,
  24712. "SVGFEDropShadowElement": false,
  24713. "SVGFEFloodElement": false,
  24714. "SVGFEFuncAElement": false,
  24715. "SVGFEFuncBElement": false,
  24716. "SVGFEFuncGElement": false,
  24717. "SVGFEFuncRElement": false,
  24718. "SVGFEGaussianBlurElement": false,
  24719. "SVGFEImageElement": false,
  24720. "SVGFEMergeElement": false,
  24721. "SVGFEMergeNodeElement": false,
  24722. "SVGFEMorphologyElement": false,
  24723. "SVGFEOffsetElement": false,
  24724. "SVGFEPointLightElement": false,
  24725. "SVGFESpecularLightingElement": false,
  24726. "SVGFESpotLightElement": false,
  24727. "SVGFETileElement": false,
  24728. "SVGFETurbulenceElement": false,
  24729. "SVGFilterElement": false,
  24730. "SVGFilterPrimitiveStandardAttributes": false,
  24731. "SVGFitToViewBox": false,
  24732. "SVGFontElement": false,
  24733. "SVGFontFaceElement": false,
  24734. "SVGFontFaceFormatElement": false,
  24735. "SVGFontFaceNameElement": false,
  24736. "SVGFontFaceSrcElement": false,
  24737. "SVGFontFaceUriElement": false,
  24738. "SVGForeignObjectElement": false,
  24739. "SVGGElement": false,
  24740. "SVGGeometryElement": false,
  24741. "SVGGlyphElement": false,
  24742. "SVGGlyphRefElement": false,
  24743. "SVGGradientElement": false,
  24744. "SVGGraphicsElement": false,
  24745. "SVGHKernElement": false,
  24746. "SVGICCColor": false,
  24747. "SVGImageElement": false,
  24748. "SVGLangSpace": false,
  24749. "SVGLength": false,
  24750. "SVGLengthList": false,
  24751. "SVGLinearGradientElement": false,
  24752. "SVGLineElement": false,
  24753. "SVGLocatable": false,
  24754. "SVGMarkerElement": false,
  24755. "SVGMaskElement": false,
  24756. "SVGMatrix": false,
  24757. "SVGMetadataElement": false,
  24758. "SVGMissingGlyphElement": false,
  24759. "SVGMPathElement": false,
  24760. "SVGNumber": false,
  24761. "SVGNumberList": false,
  24762. "SVGPaint": false,
  24763. "SVGPathElement": false,
  24764. "SVGPathSeg": false,
  24765. "SVGPathSegArcAbs": false,
  24766. "SVGPathSegArcRel": false,
  24767. "SVGPathSegClosePath": false,
  24768. "SVGPathSegCurvetoCubicAbs": false,
  24769. "SVGPathSegCurvetoCubicRel": false,
  24770. "SVGPathSegCurvetoCubicSmoothAbs": false,
  24771. "SVGPathSegCurvetoCubicSmoothRel": false,
  24772. "SVGPathSegCurvetoQuadraticAbs": false,
  24773. "SVGPathSegCurvetoQuadraticRel": false,
  24774. "SVGPathSegCurvetoQuadraticSmoothAbs": false,
  24775. "SVGPathSegCurvetoQuadraticSmoothRel": false,
  24776. "SVGPathSegLinetoAbs": false,
  24777. "SVGPathSegLinetoHorizontalAbs": false,
  24778. "SVGPathSegLinetoHorizontalRel": false,
  24779. "SVGPathSegLinetoRel": false,
  24780. "SVGPathSegLinetoVerticalAbs": false,
  24781. "SVGPathSegLinetoVerticalRel": false,
  24782. "SVGPathSegList": false,
  24783. "SVGPathSegMovetoAbs": false,
  24784. "SVGPathSegMovetoRel": false,
  24785. "SVGPatternElement": false,
  24786. "SVGPoint": false,
  24787. "SVGPointList": false,
  24788. "SVGPolygonElement": false,
  24789. "SVGPolylineElement": false,
  24790. "SVGPreserveAspectRatio": false,
  24791. "SVGRadialGradientElement": false,
  24792. "SVGRect": false,
  24793. "SVGRectElement": false,
  24794. "SVGRenderingIntent": false,
  24795. "SVGScriptElement": false,
  24796. "SVGSetElement": false,
  24797. "SVGStopElement": false,
  24798. "SVGStringList": false,
  24799. "SVGStylable": false,
  24800. "SVGStyleElement": false,
  24801. "SVGSVGElement": false,
  24802. "SVGSwitchElement": false,
  24803. "SVGSymbolElement": false,
  24804. "SVGTests": false,
  24805. "SVGTextContentElement": false,
  24806. "SVGTextElement": false,
  24807. "SVGTextPathElement": false,
  24808. "SVGTextPositioningElement": false,
  24809. "SVGTitleElement": false,
  24810. "SVGTransform": false,
  24811. "SVGTransformable": false,
  24812. "SVGTransformList": false,
  24813. "SVGTRefElement": false,
  24814. "SVGTSpanElement": false,
  24815. "SVGUnitTypes": false,
  24816. "SVGURIReference": false,
  24817. "SVGUseElement": false,
  24818. "SVGViewElement": false,
  24819. "SVGViewSpec": false,
  24820. "SVGVKernElement": false,
  24821. "SVGZoomAndPan": false,
  24822. "SVGZoomEvent": false,
  24823. "Text": false,
  24824. "TextDecoder": false,
  24825. "TextEncoder": false,
  24826. "TextEvent": false,
  24827. "TextMetrics": false,
  24828. "TextTrack": false,
  24829. "TextTrackCue": false,
  24830. "TextTrackCueList": false,
  24831. "TextTrackList": false,
  24832. "TimeEvent": false,
  24833. "TimeRanges": false,
  24834. "toolbar": false,
  24835. "top": false,
  24836. "Touch": false,
  24837. "TouchEvent": false,
  24838. "TouchList": false,
  24839. "TrackEvent": false,
  24840. "TransitionEvent": false,
  24841. "TreeWalker": false,
  24842. "UIEvent": false,
  24843. "URL": false,
  24844. "URLSearchParams": false,
  24845. "ValidityState": false,
  24846. "VTTCue": false,
  24847. "WaveShaperNode": false,
  24848. "WebGLActiveInfo": false,
  24849. "WebGLBuffer": false,
  24850. "WebGLContextEvent": false,
  24851. "WebGLFramebuffer": false,
  24852. "WebGLProgram": false,
  24853. "WebGLRenderbuffer": false,
  24854. "WebGLRenderingContext": false,
  24855. "WebGLShader": false,
  24856. "WebGLShaderPrecisionFormat": false,
  24857. "WebGLTexture": false,
  24858. "WebGLUniformLocation": false,
  24859. "WebSocket": false,
  24860. "WheelEvent": false,
  24861. "window": false,
  24862. "Window": false,
  24863. "Worker": false,
  24864. "XDomainRequest": false,
  24865. "XMLDocument": false,
  24866. "XMLHttpRequest": false,
  24867. "XMLHttpRequestEventTarget": false,
  24868. "XMLHttpRequestProgressEvent": false,
  24869. "XMLHttpRequestUpload": false,
  24870. "XMLSerializer": false,
  24871. "XPathEvaluator": false,
  24872. "XPathException": false,
  24873. "XPathExpression": false,
  24874. "XPathNamespace": false,
  24875. "XPathNSResolver": false,
  24876. "XPathResult": false,
  24877. "XSLTProcessor": false
  24878. },
  24879. "worker": {
  24880. "applicationCache": false,
  24881. "atob": false,
  24882. "Blob": false,
  24883. "BroadcastChannel": false,
  24884. "btoa": false,
  24885. "Cache": false,
  24886. "caches": false,
  24887. "clearInterval": false,
  24888. "clearTimeout": false,
  24889. "close": true,
  24890. "console": false,
  24891. "fetch": false,
  24892. "FileReaderSync": false,
  24893. "FormData": false,
  24894. "Headers": false,
  24895. "IDBCursor": false,
  24896. "IDBCursorWithValue": false,
  24897. "IDBDatabase": false,
  24898. "IDBFactory": false,
  24899. "IDBIndex": false,
  24900. "IDBKeyRange": false,
  24901. "IDBObjectStore": false,
  24902. "IDBOpenDBRequest": false,
  24903. "IDBRequest": false,
  24904. "IDBTransaction": false,
  24905. "IDBVersionChangeEvent": false,
  24906. "ImageData": false,
  24907. "importScripts": true,
  24908. "indexedDB": false,
  24909. "location": false,
  24910. "MessageChannel": false,
  24911. "MessagePort": false,
  24912. "name": false,
  24913. "navigator": false,
  24914. "Notification": false,
  24915. "onclose": true,
  24916. "onconnect": true,
  24917. "onerror": true,
  24918. "onlanguagechange": true,
  24919. "onmessage": true,
  24920. "onoffline": true,
  24921. "ononline": true,
  24922. "onrejectionhandled": true,
  24923. "onunhandledrejection": true,
  24924. "performance": false,
  24925. "Performance": false,
  24926. "PerformanceEntry": false,
  24927. "PerformanceMark": false,
  24928. "PerformanceMeasure": false,
  24929. "PerformanceNavigation": false,
  24930. "PerformanceResourceTiming": false,
  24931. "PerformanceTiming": false,
  24932. "postMessage": true,
  24933. "Promise": false,
  24934. "Request": false,
  24935. "Response": false,
  24936. "self": true,
  24937. "ServiceWorkerRegistration": false,
  24938. "setInterval": false,
  24939. "setTimeout": false,
  24940. "TextDecoder": false,
  24941. "TextEncoder": false,
  24942. "URL": false,
  24943. "URLSearchParams": false,
  24944. "WebSocket": false,
  24945. "Worker": false,
  24946. "XMLHttpRequest": false
  24947. },
  24948. "node": {
  24949. "__dirname": false,
  24950. "__filename": false,
  24951. "arguments": false,
  24952. "Buffer": false,
  24953. "clearImmediate": false,
  24954. "clearInterval": false,
  24955. "clearTimeout": false,
  24956. "console": false,
  24957. "exports": true,
  24958. "GLOBAL": false,
  24959. "global": false,
  24960. "Intl": false,
  24961. "module": false,
  24962. "process": false,
  24963. "require": false,
  24964. "root": false,
  24965. "setImmediate": false,
  24966. "setInterval": false,
  24967. "setTimeout": false
  24968. },
  24969. "commonjs": {
  24970. "exports": true,
  24971. "module": false,
  24972. "require": false,
  24973. "global": false
  24974. },
  24975. "amd": {
  24976. "define": false,
  24977. "require": false
  24978. },
  24979. "mocha": {
  24980. "after": false,
  24981. "afterEach": false,
  24982. "before": false,
  24983. "beforeEach": false,
  24984. "context": false,
  24985. "describe": false,
  24986. "it": false,
  24987. "mocha": false,
  24988. "run": false,
  24989. "setup": false,
  24990. "specify": false,
  24991. "suite": false,
  24992. "suiteSetup": false,
  24993. "suiteTeardown": false,
  24994. "teardown": false,
  24995. "test": false,
  24996. "xcontext": false,
  24997. "xdescribe": false,
  24998. "xit": false,
  24999. "xspecify": false
  25000. },
  25001. "jasmine": {
  25002. "afterAll": false,
  25003. "afterEach": false,
  25004. "beforeAll": false,
  25005. "beforeEach": false,
  25006. "describe": false,
  25007. "expect": false,
  25008. "fail": false,
  25009. "fdescribe": false,
  25010. "fit": false,
  25011. "it": false,
  25012. "jasmine": false,
  25013. "pending": false,
  25014. "runs": false,
  25015. "spyOn": false,
  25016. "waits": false,
  25017. "waitsFor": false,
  25018. "xdescribe": false,
  25019. "xit": false
  25020. },
  25021. "jest": {
  25022. "afterAll": false,
  25023. "afterEach": false,
  25024. "beforeAll": false,
  25025. "beforeEach": false,
  25026. "check": false,
  25027. "describe": false,
  25028. "expect": false,
  25029. "gen": false,
  25030. "it": false,
  25031. "fdescribe": false,
  25032. "fit": false,
  25033. "jest": false,
  25034. "pit": false,
  25035. "require": false,
  25036. "test": false,
  25037. "xdescribe": false,
  25038. "xit": false,
  25039. "xtest": false
  25040. },
  25041. "qunit": {
  25042. "asyncTest": false,
  25043. "deepEqual": false,
  25044. "equal": false,
  25045. "expect": false,
  25046. "module": false,
  25047. "notDeepEqual": false,
  25048. "notEqual": false,
  25049. "notOk": false,
  25050. "notPropEqual": false,
  25051. "notStrictEqual": false,
  25052. "ok": false,
  25053. "propEqual": false,
  25054. "QUnit": false,
  25055. "raises": false,
  25056. "start": false,
  25057. "stop": false,
  25058. "strictEqual": false,
  25059. "test": false,
  25060. "throws": false
  25061. },
  25062. "phantomjs": {
  25063. "console": true,
  25064. "exports": true,
  25065. "phantom": true,
  25066. "require": true,
  25067. "WebPage": true
  25068. },
  25069. "couch": {
  25070. "emit": false,
  25071. "exports": false,
  25072. "getRow": false,
  25073. "log": false,
  25074. "module": false,
  25075. "provides": false,
  25076. "require": false,
  25077. "respond": false,
  25078. "send": false,
  25079. "start": false,
  25080. "sum": false
  25081. },
  25082. "rhino": {
  25083. "defineClass": false,
  25084. "deserialize": false,
  25085. "gc": false,
  25086. "help": false,
  25087. "importClass": false,
  25088. "importPackage": false,
  25089. "java": false,
  25090. "load": false,
  25091. "loadClass": false,
  25092. "Packages": false,
  25093. "print": false,
  25094. "quit": false,
  25095. "readFile": false,
  25096. "readUrl": false,
  25097. "runCommand": false,
  25098. "seal": false,
  25099. "serialize": false,
  25100. "spawn": false,
  25101. "sync": false,
  25102. "toint32": false,
  25103. "version": false
  25104. },
  25105. "nashorn": {
  25106. "__DIR__": false,
  25107. "__FILE__": false,
  25108. "__LINE__": false,
  25109. "com": false,
  25110. "edu": false,
  25111. "exit": false,
  25112. "Java": false,
  25113. "java": false,
  25114. "javafx": false,
  25115. "JavaImporter": false,
  25116. "javax": false,
  25117. "JSAdapter": false,
  25118. "load": false,
  25119. "loadWithNewGlobal": false,
  25120. "org": false,
  25121. "Packages": false,
  25122. "print": false,
  25123. "quit": false
  25124. },
  25125. "wsh": {
  25126. "ActiveXObject": true,
  25127. "Enumerator": true,
  25128. "GetObject": true,
  25129. "ScriptEngine": true,
  25130. "ScriptEngineBuildVersion": true,
  25131. "ScriptEngineMajorVersion": true,
  25132. "ScriptEngineMinorVersion": true,
  25133. "VBArray": true,
  25134. "WScript": true,
  25135. "WSH": true,
  25136. "XDomainRequest": true
  25137. },
  25138. "jquery": {
  25139. "$": false,
  25140. "jQuery": false
  25141. },
  25142. "yui": {
  25143. "Y": false,
  25144. "YUI": false,
  25145. "YUI_config": false
  25146. },
  25147. "shelljs": {
  25148. "cat": false,
  25149. "cd": false,
  25150. "chmod": false,
  25151. "config": false,
  25152. "cp": false,
  25153. "dirs": false,
  25154. "echo": false,
  25155. "env": false,
  25156. "error": false,
  25157. "exec": false,
  25158. "exit": false,
  25159. "find": false,
  25160. "grep": false,
  25161. "ls": false,
  25162. "ln": false,
  25163. "mkdir": false,
  25164. "mv": false,
  25165. "popd": false,
  25166. "pushd": false,
  25167. "pwd": false,
  25168. "rm": false,
  25169. "sed": false,
  25170. "set": false,
  25171. "target": false,
  25172. "tempdir": false,
  25173. "test": false,
  25174. "touch": false,
  25175. "which": false
  25176. },
  25177. "prototypejs": {
  25178. "$": false,
  25179. "$$": false,
  25180. "$A": false,
  25181. "$break": false,
  25182. "$continue": false,
  25183. "$F": false,
  25184. "$H": false,
  25185. "$R": false,
  25186. "$w": false,
  25187. "Abstract": false,
  25188. "Ajax": false,
  25189. "Autocompleter": false,
  25190. "Builder": false,
  25191. "Class": false,
  25192. "Control": false,
  25193. "Draggable": false,
  25194. "Draggables": false,
  25195. "Droppables": false,
  25196. "Effect": false,
  25197. "Element": false,
  25198. "Enumerable": false,
  25199. "Event": false,
  25200. "Field": false,
  25201. "Form": false,
  25202. "Hash": false,
  25203. "Insertion": false,
  25204. "ObjectRange": false,
  25205. "PeriodicalExecuter": false,
  25206. "Position": false,
  25207. "Prototype": false,
  25208. "Scriptaculous": false,
  25209. "Selector": false,
  25210. "Sortable": false,
  25211. "SortableObserver": false,
  25212. "Sound": false,
  25213. "Template": false,
  25214. "Toggle": false,
  25215. "Try": false
  25216. },
  25217. "meteor": {
  25218. "$": false,
  25219. "_": false,
  25220. "Accounts": false,
  25221. "AccountsClient": false,
  25222. "AccountsServer": false,
  25223. "AccountsCommon": false,
  25224. "App": false,
  25225. "Assets": false,
  25226. "Blaze": false,
  25227. "check": false,
  25228. "Cordova": false,
  25229. "DDP": false,
  25230. "DDPServer": false,
  25231. "DDPRateLimiter": false,
  25232. "Deps": false,
  25233. "EJSON": false,
  25234. "Email": false,
  25235. "HTTP": false,
  25236. "Log": false,
  25237. "Match": false,
  25238. "Meteor": false,
  25239. "Mongo": false,
  25240. "MongoInternals": false,
  25241. "Npm": false,
  25242. "Package": false,
  25243. "Plugin": false,
  25244. "process": false,
  25245. "Random": false,
  25246. "ReactiveDict": false,
  25247. "ReactiveVar": false,
  25248. "Router": false,
  25249. "ServiceConfiguration": false,
  25250. "Session": false,
  25251. "share": false,
  25252. "Spacebars": false,
  25253. "Template": false,
  25254. "Tinytest": false,
  25255. "Tracker": false,
  25256. "UI": false,
  25257. "Utils": false,
  25258. "WebApp": false,
  25259. "WebAppInternals": false
  25260. },
  25261. "mongo": {
  25262. "_isWindows": false,
  25263. "_rand": false,
  25264. "BulkWriteResult": false,
  25265. "cat": false,
  25266. "cd": false,
  25267. "connect": false,
  25268. "db": false,
  25269. "getHostName": false,
  25270. "getMemInfo": false,
  25271. "hostname": false,
  25272. "ISODate": false,
  25273. "listFiles": false,
  25274. "load": false,
  25275. "ls": false,
  25276. "md5sumFile": false,
  25277. "mkdir": false,
  25278. "Mongo": false,
  25279. "NumberInt": false,
  25280. "NumberLong": false,
  25281. "ObjectId": false,
  25282. "PlanCache": false,
  25283. "print": false,
  25284. "printjson": false,
  25285. "pwd": false,
  25286. "quit": false,
  25287. "removeFile": false,
  25288. "rs": false,
  25289. "sh": false,
  25290. "UUID": false,
  25291. "version": false,
  25292. "WriteResult": false
  25293. },
  25294. "applescript": {
  25295. "$": false,
  25296. "Application": false,
  25297. "Automation": false,
  25298. "console": false,
  25299. "delay": false,
  25300. "Library": false,
  25301. "ObjC": false,
  25302. "ObjectSpecifier": false,
  25303. "Path": false,
  25304. "Progress": false,
  25305. "Ref": false
  25306. },
  25307. "serviceworker": {
  25308. "caches": false,
  25309. "Cache": false,
  25310. "CacheStorage": false,
  25311. "Client": false,
  25312. "clients": false,
  25313. "Clients": false,
  25314. "ExtendableEvent": false,
  25315. "ExtendableMessageEvent": false,
  25316. "FetchEvent": false,
  25317. "importScripts": false,
  25318. "registration": false,
  25319. "self": false,
  25320. "ServiceWorker": false,
  25321. "ServiceWorkerContainer": false,
  25322. "ServiceWorkerGlobalScope": false,
  25323. "ServiceWorkerMessageEvent": false,
  25324. "ServiceWorkerRegistration": false,
  25325. "skipWaiting": false,
  25326. "WindowClient": false
  25327. },
  25328. "atomtest": {
  25329. "advanceClock": false,
  25330. "fakeClearInterval": false,
  25331. "fakeClearTimeout": false,
  25332. "fakeSetInterval": false,
  25333. "fakeSetTimeout": false,
  25334. "resetTimeouts": false,
  25335. "waitsForPromise": false
  25336. },
  25337. "embertest": {
  25338. "andThen": false,
  25339. "click": false,
  25340. "currentPath": false,
  25341. "currentRouteName": false,
  25342. "currentURL": false,
  25343. "fillIn": false,
  25344. "find": false,
  25345. "findWithAssert": false,
  25346. "keyEvent": false,
  25347. "pauseTest": false,
  25348. "triggerEvent": false,
  25349. "visit": false
  25350. },
  25351. "protractor": {
  25352. "$": false,
  25353. "$$": false,
  25354. "browser": false,
  25355. "By": false,
  25356. "by": false,
  25357. "DartObject": false,
  25358. "element": false,
  25359. "protractor": false
  25360. },
  25361. "shared-node-browser": {
  25362. "clearInterval": false,
  25363. "clearTimeout": false,
  25364. "console": false,
  25365. "setInterval": false,
  25366. "setTimeout": false
  25367. },
  25368. "webextensions": {
  25369. "browser": false,
  25370. "chrome": false,
  25371. "opr": false
  25372. },
  25373. "greasemonkey": {
  25374. "GM_addStyle": false,
  25375. "GM_deleteValue": false,
  25376. "GM_getResourceText": false,
  25377. "GM_getResourceURL": false,
  25378. "GM_getValue": false,
  25379. "GM_info": false,
  25380. "GM_listValues": false,
  25381. "GM_log": false,
  25382. "GM_openInTab": false,
  25383. "GM_registerMenuCommand": false,
  25384. "GM_setClipboard": false,
  25385. "GM_setValue": false,
  25386. "GM_xmlhttpRequest": false,
  25387. "unsafeWindow": false
  25388. }
  25389. }
  25390. },{}],242:[function(require,module,exports){
  25391. module.exports = require('./globals.json');
  25392. },{"./globals.json":241}],243:[function(require,module,exports){
  25393. 'use strict';
  25394. var ansiRegex = require('ansi-regex');
  25395. var re = new RegExp(ansiRegex().source); // remove the `g` flag
  25396. module.exports = re.test.bind(re);
  25397. },{"ansi-regex":1}],244:[function(require,module,exports){
  25398. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  25399. var e, m
  25400. var eLen = nBytes * 8 - mLen - 1
  25401. var eMax = (1 << eLen) - 1
  25402. var eBias = eMax >> 1
  25403. var nBits = -7
  25404. var i = isLE ? (nBytes - 1) : 0
  25405. var d = isLE ? -1 : 1
  25406. var s = buffer[offset + i]
  25407. i += d
  25408. e = s & ((1 << (-nBits)) - 1)
  25409. s >>= (-nBits)
  25410. nBits += eLen
  25411. for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
  25412. m = e & ((1 << (-nBits)) - 1)
  25413. e >>= (-nBits)
  25414. nBits += mLen
  25415. for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
  25416. if (e === 0) {
  25417. e = 1 - eBias
  25418. } else if (e === eMax) {
  25419. return m ? NaN : ((s ? -1 : 1) * Infinity)
  25420. } else {
  25421. m = m + Math.pow(2, mLen)
  25422. e = e - eBias
  25423. }
  25424. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  25425. }
  25426. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  25427. var e, m, c
  25428. var eLen = nBytes * 8 - mLen - 1
  25429. var eMax = (1 << eLen) - 1
  25430. var eBias = eMax >> 1
  25431. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  25432. var i = isLE ? 0 : (nBytes - 1)
  25433. var d = isLE ? 1 : -1
  25434. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  25435. value = Math.abs(value)
  25436. if (isNaN(value) || value === Infinity) {
  25437. m = isNaN(value) ? 1 : 0
  25438. e = eMax
  25439. } else {
  25440. e = Math.floor(Math.log(value) / Math.LN2)
  25441. if (value * (c = Math.pow(2, -e)) < 1) {
  25442. e--
  25443. c *= 2
  25444. }
  25445. if (e + eBias >= 1) {
  25446. value += rt / c
  25447. } else {
  25448. value += rt * Math.pow(2, 1 - eBias)
  25449. }
  25450. if (value * c >= 2) {
  25451. e++
  25452. c /= 2
  25453. }
  25454. if (e + eBias >= eMax) {
  25455. m = 0
  25456. e = eMax
  25457. } else if (e + eBias >= 1) {
  25458. m = (value * c - 1) * Math.pow(2, mLen)
  25459. e = e + eBias
  25460. } else {
  25461. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  25462. e = 0
  25463. }
  25464. }
  25465. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  25466. e = (e << mLen) | m
  25467. eLen += mLen
  25468. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  25469. buffer[offset + i - d] |= s * 128
  25470. }
  25471. },{}],245:[function(require,module,exports){
  25472. (function (process){
  25473. /**
  25474. * Copyright 2013-2015, Facebook, Inc.
  25475. * All rights reserved.
  25476. *
  25477. * This source code is licensed under the BSD-style license found in the
  25478. * LICENSE file in the root directory of this source tree. An additional grant
  25479. * of patent rights can be found in the PATENTS file in the same directory.
  25480. */
  25481. 'use strict';
  25482. /**
  25483. * Use invariant() to assert state which your program assumes to be true.
  25484. *
  25485. * Provide sprintf-style format (only %s is supported) and arguments
  25486. * to provide information about what broke and what you were
  25487. * expecting.
  25488. *
  25489. * The invariant message will be stripped in production, but the invariant
  25490. * will remain to ensure logic does not differ in production.
  25491. */
  25492. var invariant = function(condition, format, a, b, c, d, e, f) {
  25493. if (process.env.NODE_ENV !== 'production') {
  25494. if (format === undefined) {
  25495. throw new Error('invariant requires an error message argument');
  25496. }
  25497. }
  25498. if (!condition) {
  25499. var error;
  25500. if (format === undefined) {
  25501. error = new Error(
  25502. 'Minified exception occurred; use the non-minified dev environment ' +
  25503. 'for the full error message and additional helpful warnings.'
  25504. );
  25505. } else {
  25506. var args = [a, b, c, d, e, f];
  25507. var argIndex = 0;
  25508. error = new Error(
  25509. format.replace(/%s/g, function() { return args[argIndex++]; })
  25510. );
  25511. error.name = 'Invariant Violation';
  25512. }
  25513. error.framesToPop = 1; // we don't care about invariant's own frame
  25514. throw error;
  25515. }
  25516. };
  25517. module.exports = invariant;
  25518. }).call(this,require('_process'))
  25519. },{"_process":471}],246:[function(require,module,exports){
  25520. 'use strict';
  25521. var numberIsNan = require('number-is-nan');
  25522. module.exports = Number.isFinite || function (val) {
  25523. return !(typeof val !== 'number' || numberIsNan(val) || val === Infinity || val === -Infinity);
  25524. };
  25525. },{"number-is-nan":468}],247:[function(require,module,exports){
  25526. var toString = {}.toString;
  25527. module.exports = Array.isArray || function (arr) {
  25528. return toString.call(arr) == '[object Array]';
  25529. };
  25530. },{}],248:[function(require,module,exports){
  25531. // Copyright 2014, 2015, 2016, 2017 Simon Lydell
  25532. // License: MIT. (See LICENSE.)
  25533. Object.defineProperty(exports, "__esModule", {
  25534. value: true
  25535. })
  25536. // This regex comes from regex.coffee, and is inserted here by generate-index.js
  25537. // (run `npm run build`).
  25538. exports.default = /((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyu]{1,5}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|(0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?)|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-\/%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2})=?|[?~.,:;[\](){}])|(\s+)|(^$|[\s\S])/g
  25539. exports.matchToToken = function(match) {
  25540. var token = {type: "invalid", value: match[0]}
  25541. if (match[ 1]) token.type = "string" , token.closed = !!(match[3] || match[4])
  25542. else if (match[ 5]) token.type = "comment"
  25543. else if (match[ 6]) token.type = "comment", token.closed = !!match[7]
  25544. else if (match[ 8]) token.type = "regex"
  25545. else if (match[ 9]) token.type = "number"
  25546. else if (match[10]) token.type = "name"
  25547. else if (match[11]) token.type = "punctuator"
  25548. else if (match[12]) token.type = "whitespace"
  25549. return token
  25550. }
  25551. },{}],249:[function(require,module,exports){
  25552. (function (global){
  25553. /*! https://mths.be/jsesc v1.3.0 by @mathias */
  25554. ;(function(root) {
  25555. // Detect free variables `exports`
  25556. var freeExports = typeof exports == 'object' && exports;
  25557. // Detect free variable `module`
  25558. var freeModule = typeof module == 'object' && module &&
  25559. module.exports == freeExports && module;
  25560. // Detect free variable `global`, from Node.js or Browserified code,
  25561. // and use it as `root`
  25562. var freeGlobal = typeof global == 'object' && global;
  25563. if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
  25564. root = freeGlobal;
  25565. }
  25566. /*--------------------------------------------------------------------------*/
  25567. var object = {};
  25568. var hasOwnProperty = object.hasOwnProperty;
  25569. var forOwn = function(object, callback) {
  25570. var key;
  25571. for (key in object) {
  25572. if (hasOwnProperty.call(object, key)) {
  25573. callback(key, object[key]);
  25574. }
  25575. }
  25576. };
  25577. var extend = function(destination, source) {
  25578. if (!source) {
  25579. return destination;
  25580. }
  25581. forOwn(source, function(key, value) {
  25582. destination[key] = value;
  25583. });
  25584. return destination;
  25585. };
  25586. var forEach = function(array, callback) {
  25587. var length = array.length;
  25588. var index = -1;
  25589. while (++index < length) {
  25590. callback(array[index]);
  25591. }
  25592. };
  25593. var toString = object.toString;
  25594. var isArray = function(value) {
  25595. return toString.call(value) == '[object Array]';
  25596. };
  25597. var isObject = function(value) {
  25598. // This is a very simple check, but it’s good enough for what we need.
  25599. return toString.call(value) == '[object Object]';
  25600. };
  25601. var isString = function(value) {
  25602. return typeof value == 'string' ||
  25603. toString.call(value) == '[object String]';
  25604. };
  25605. var isNumber = function(value) {
  25606. return typeof value == 'number' ||
  25607. toString.call(value) == '[object Number]';
  25608. };
  25609. var isFunction = function(value) {
  25610. // In a perfect world, the `typeof` check would be sufficient. However,
  25611. // in Chrome 1–12, `typeof /x/ == 'object'`, and in IE 6–8
  25612. // `typeof alert == 'object'` and similar for other host objects.
  25613. return typeof value == 'function' ||
  25614. toString.call(value) == '[object Function]';
  25615. };
  25616. var isMap = function(value) {
  25617. return toString.call(value) == '[object Map]';
  25618. };
  25619. var isSet = function(value) {
  25620. return toString.call(value) == '[object Set]';
  25621. };
  25622. /*--------------------------------------------------------------------------*/
  25623. // https://mathiasbynens.be/notes/javascript-escapes#single
  25624. var singleEscapes = {
  25625. '"': '\\"',
  25626. '\'': '\\\'',
  25627. '\\': '\\\\',
  25628. '\b': '\\b',
  25629. '\f': '\\f',
  25630. '\n': '\\n',
  25631. '\r': '\\r',
  25632. '\t': '\\t'
  25633. // `\v` is omitted intentionally, because in IE < 9, '\v' == 'v'.
  25634. // '\v': '\\x0B'
  25635. };
  25636. var regexSingleEscape = /["'\\\b\f\n\r\t]/;
  25637. var regexDigit = /[0-9]/;
  25638. var regexWhitelist = /[ !#-&\(-\[\]-~]/;
  25639. var jsesc = function(argument, options) {
  25640. // Handle options
  25641. var defaults = {
  25642. 'escapeEverything': false,
  25643. 'escapeEtago': false,
  25644. 'quotes': 'single',
  25645. 'wrap': false,
  25646. 'es6': false,
  25647. 'json': false,
  25648. 'compact': true,
  25649. 'lowercaseHex': false,
  25650. 'numbers': 'decimal',
  25651. 'indent': '\t',
  25652. '__indent__': '',
  25653. '__inline1__': false,
  25654. '__inline2__': false
  25655. };
  25656. var json = options && options.json;
  25657. if (json) {
  25658. defaults.quotes = 'double';
  25659. defaults.wrap = true;
  25660. }
  25661. options = extend(defaults, options);
  25662. if (options.quotes != 'single' && options.quotes != 'double') {
  25663. options.quotes = 'single';
  25664. }
  25665. var quote = options.quotes == 'double' ? '"' : '\'';
  25666. var compact = options.compact;
  25667. var indent = options.indent;
  25668. var lowercaseHex = options.lowercaseHex;
  25669. var oldIndent = '';
  25670. var inline1 = options.__inline1__;
  25671. var inline2 = options.__inline2__;
  25672. var newLine = compact ? '' : '\n';
  25673. var result;
  25674. var isEmpty = true;
  25675. var useBinNumbers = options.numbers == 'binary';
  25676. var useOctNumbers = options.numbers == 'octal';
  25677. var useDecNumbers = options.numbers == 'decimal';
  25678. var useHexNumbers = options.numbers == 'hexadecimal';
  25679. if (json && argument && isFunction(argument.toJSON)) {
  25680. argument = argument.toJSON();
  25681. }
  25682. if (!isString(argument)) {
  25683. if (isMap(argument)) {
  25684. if (argument.size == 0) {
  25685. return 'new Map()';
  25686. }
  25687. if (!compact) {
  25688. options.__inline1__ = true;
  25689. }
  25690. return 'new Map(' + jsesc(Array.from(argument), options) + ')';
  25691. }
  25692. if (isSet(argument)) {
  25693. if (argument.size == 0) {
  25694. return 'new Set()';
  25695. }
  25696. return 'new Set(' + jsesc(Array.from(argument), options) + ')';
  25697. }
  25698. if (isArray(argument)) {
  25699. result = [];
  25700. options.wrap = true;
  25701. if (inline1) {
  25702. options.__inline1__ = false;
  25703. options.__inline2__ = true;
  25704. } else {
  25705. oldIndent = options.__indent__;
  25706. indent += oldIndent;
  25707. options.__indent__ = indent;
  25708. }
  25709. forEach(argument, function(value) {
  25710. isEmpty = false;
  25711. if (inline2) {
  25712. options.__inline2__ = false;
  25713. }
  25714. result.push(
  25715. (compact || inline2 ? '' : indent) +
  25716. jsesc(value, options)
  25717. );
  25718. });
  25719. if (isEmpty) {
  25720. return '[]';
  25721. }
  25722. if (inline2) {
  25723. return '[' + result.join(', ') + ']';
  25724. }
  25725. return '[' + newLine + result.join(',' + newLine) + newLine +
  25726. (compact ? '' : oldIndent) + ']';
  25727. } else if (isNumber(argument)) {
  25728. if (json) {
  25729. // Some number values (e.g. `Infinity`) cannot be represented in JSON.
  25730. return JSON.stringify(argument);
  25731. }
  25732. if (useDecNumbers) {
  25733. return String(argument);
  25734. }
  25735. if (useHexNumbers) {
  25736. var tmp = argument.toString(16);
  25737. if (!lowercaseHex) {
  25738. tmp = tmp.toUpperCase();
  25739. }
  25740. return '0x' + tmp;
  25741. }
  25742. if (useBinNumbers) {
  25743. return '0b' + argument.toString(2);
  25744. }
  25745. if (useOctNumbers) {
  25746. return '0o' + argument.toString(8);
  25747. }
  25748. } else if (!isObject(argument)) {
  25749. if (json) {
  25750. // For some values (e.g. `undefined`, `function` objects),
  25751. // `JSON.stringify(value)` returns `undefined` (which isn’t valid
  25752. // JSON) instead of `'null'`.
  25753. return JSON.stringify(argument) || 'null';
  25754. }
  25755. return String(argument);
  25756. } else { // it’s an object
  25757. result = [];
  25758. options.wrap = true;
  25759. oldIndent = options.__indent__;
  25760. indent += oldIndent;
  25761. options.__indent__ = indent;
  25762. forOwn(argument, function(key, value) {
  25763. isEmpty = false;
  25764. result.push(
  25765. (compact ? '' : indent) +
  25766. jsesc(key, options) + ':' +
  25767. (compact ? '' : ' ') +
  25768. jsesc(value, options)
  25769. );
  25770. });
  25771. if (isEmpty) {
  25772. return '{}';
  25773. }
  25774. return '{' + newLine + result.join(',' + newLine) + newLine +
  25775. (compact ? '' : oldIndent) + '}';
  25776. }
  25777. }
  25778. var string = argument;
  25779. // Loop over each code unit in the string and escape it
  25780. var index = -1;
  25781. var length = string.length;
  25782. var first;
  25783. var second;
  25784. var codePoint;
  25785. result = '';
  25786. while (++index < length) {
  25787. var character = string.charAt(index);
  25788. if (options.es6) {
  25789. first = string.charCodeAt(index);
  25790. if ( // check if it’s the start of a surrogate pair
  25791. first >= 0xD800 && first <= 0xDBFF && // high surrogate
  25792. length > index + 1 // there is a next code unit
  25793. ) {
  25794. second = string.charCodeAt(index + 1);
  25795. if (second >= 0xDC00 && second <= 0xDFFF) { // low surrogate
  25796. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  25797. codePoint = (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
  25798. var hexadecimal = codePoint.toString(16);
  25799. if (!lowercaseHex) {
  25800. hexadecimal = hexadecimal.toUpperCase();
  25801. }
  25802. result += '\\u{' + hexadecimal + '}';
  25803. index++;
  25804. continue;
  25805. }
  25806. }
  25807. }
  25808. if (!options.escapeEverything) {
  25809. if (regexWhitelist.test(character)) {
  25810. // It’s a printable ASCII character that is not `"`, `'` or `\`,
  25811. // so don’t escape it.
  25812. result += character;
  25813. continue;
  25814. }
  25815. if (character == '"') {
  25816. result += quote == character ? '\\"' : character;
  25817. continue;
  25818. }
  25819. if (character == '\'') {
  25820. result += quote == character ? '\\\'' : character;
  25821. continue;
  25822. }
  25823. }
  25824. if (
  25825. character == '\0' &&
  25826. !json &&
  25827. !regexDigit.test(string.charAt(index + 1))
  25828. ) {
  25829. result += '\\0';
  25830. continue;
  25831. }
  25832. if (regexSingleEscape.test(character)) {
  25833. // no need for a `hasOwnProperty` check here
  25834. result += singleEscapes[character];
  25835. continue;
  25836. }
  25837. var charCode = character.charCodeAt(0);
  25838. var hexadecimal = charCode.toString(16);
  25839. if (!lowercaseHex) {
  25840. hexadecimal = hexadecimal.toUpperCase();
  25841. }
  25842. var longhand = hexadecimal.length > 2 || json;
  25843. var escaped = '\\' + (longhand ? 'u' : 'x') +
  25844. ('0000' + hexadecimal).slice(longhand ? -4 : -2);
  25845. result += escaped;
  25846. continue;
  25847. }
  25848. if (options.wrap) {
  25849. result = quote + result + quote;
  25850. }
  25851. if (options.escapeEtago) {
  25852. // https://mathiasbynens.be/notes/etago
  25853. return result.replace(/<\/(script|style)/gi, '<\\/$1');
  25854. }
  25855. return result;
  25856. };
  25857. jsesc.version = '1.3.0';
  25858. /*--------------------------------------------------------------------------*/
  25859. // Some AMD build optimizers, like r.js, check for specific condition patterns
  25860. // like the following:
  25861. if (
  25862. typeof define == 'function' &&
  25863. typeof define.amd == 'object' &&
  25864. define.amd
  25865. ) {
  25866. define(function() {
  25867. return jsesc;
  25868. });
  25869. } else if (freeExports && !freeExports.nodeType) {
  25870. if (freeModule) { // in Node.js or RingoJS v0.8.0+
  25871. freeModule.exports = jsesc;
  25872. } else { // in Narwhal or RingoJS v0.7.0-
  25873. freeExports.jsesc = jsesc;
  25874. }
  25875. } else { // in Rhino or a web browser
  25876. root.jsesc = jsesc;
  25877. }
  25878. }(this));
  25879. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  25880. },{}],250:[function(require,module,exports){
  25881. // json5.js
  25882. // Modern JSON. See README.md for details.
  25883. //
  25884. // This file is based directly off of Douglas Crockford's json_parse.js:
  25885. // https://github.com/douglascrockford/JSON-js/blob/master/json_parse.js
  25886. var JSON5 = (typeof exports === 'object' ? exports : {});
  25887. JSON5.parse = (function () {
  25888. "use strict";
  25889. // This is a function that can parse a JSON5 text, producing a JavaScript
  25890. // data structure. It is a simple, recursive descent parser. It does not use
  25891. // eval or regular expressions, so it can be used as a model for implementing
  25892. // a JSON5 parser in other languages.
  25893. // We are defining the function inside of another function to avoid creating
  25894. // global variables.
  25895. var at, // The index of the current character
  25896. lineNumber, // The current line number
  25897. columnNumber, // The current column number
  25898. ch, // The current character
  25899. escapee = {
  25900. "'": "'",
  25901. '"': '"',
  25902. '\\': '\\',
  25903. '/': '/',
  25904. '\n': '', // Replace escaped newlines in strings w/ empty string
  25905. b: '\b',
  25906. f: '\f',
  25907. n: '\n',
  25908. r: '\r',
  25909. t: '\t'
  25910. },
  25911. ws = [
  25912. ' ',
  25913. '\t',
  25914. '\r',
  25915. '\n',
  25916. '\v',
  25917. '\f',
  25918. '\xA0',
  25919. '\uFEFF'
  25920. ],
  25921. text,
  25922. renderChar = function (chr) {
  25923. return chr === '' ? 'EOF' : "'" + chr + "'";
  25924. },
  25925. error = function (m) {
  25926. // Call error when something is wrong.
  25927. var error = new SyntaxError();
  25928. // beginning of message suffix to agree with that provided by Gecko - see https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse
  25929. error.message = m + " at line " + lineNumber + " column " + columnNumber + " of the JSON5 data. Still to read: " + JSON.stringify(text.substring(at - 1, at + 19));
  25930. error.at = at;
  25931. // These two property names have been chosen to agree with the ones in Gecko, the only popular
  25932. // environment which seems to supply this info on JSON.parse
  25933. error.lineNumber = lineNumber;
  25934. error.columnNumber = columnNumber;
  25935. throw error;
  25936. },
  25937. next = function (c) {
  25938. // If a c parameter is provided, verify that it matches the current character.
  25939. if (c && c !== ch) {
  25940. error("Expected " + renderChar(c) + " instead of " + renderChar(ch));
  25941. }
  25942. // Get the next character. When there are no more characters,
  25943. // return the empty string.
  25944. ch = text.charAt(at);
  25945. at++;
  25946. columnNumber++;
  25947. if (ch === '\n' || ch === '\r' && peek() !== '\n') {
  25948. lineNumber++;
  25949. columnNumber = 0;
  25950. }
  25951. return ch;
  25952. },
  25953. peek = function () {
  25954. // Get the next character without consuming it or
  25955. // assigning it to the ch varaible.
  25956. return text.charAt(at);
  25957. },
  25958. identifier = function () {
  25959. // Parse an identifier. Normally, reserved words are disallowed here, but we
  25960. // only use this for unquoted object keys, where reserved words are allowed,
  25961. // so we don't check for those here. References:
  25962. // - http://es5.github.com/#x7.6
  25963. // - https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Core_Language_Features#Variables
  25964. // - http://docstore.mik.ua/orelly/webprog/jscript/ch02_07.htm
  25965. // TODO Identifiers can have Unicode "letters" in them; add support for those.
  25966. var key = ch;
  25967. // Identifiers must start with a letter, _ or $.
  25968. if ((ch !== '_' && ch !== '$') &&
  25969. (ch < 'a' || ch > 'z') &&
  25970. (ch < 'A' || ch > 'Z')) {
  25971. error("Bad identifier as unquoted key");
  25972. }
  25973. // Subsequent characters can contain digits.
  25974. while (next() && (
  25975. ch === '_' || ch === '$' ||
  25976. (ch >= 'a' && ch <= 'z') ||
  25977. (ch >= 'A' && ch <= 'Z') ||
  25978. (ch >= '0' && ch <= '9'))) {
  25979. key += ch;
  25980. }
  25981. return key;
  25982. },
  25983. number = function () {
  25984. // Parse a number value.
  25985. var number,
  25986. sign = '',
  25987. string = '',
  25988. base = 10;
  25989. if (ch === '-' || ch === '+') {
  25990. sign = ch;
  25991. next(ch);
  25992. }
  25993. // support for Infinity (could tweak to allow other words):
  25994. if (ch === 'I') {
  25995. number = word();
  25996. if (typeof number !== 'number' || isNaN(number)) {
  25997. error('Unexpected word for number');
  25998. }
  25999. return (sign === '-') ? -number : number;
  26000. }
  26001. // support for NaN
  26002. if (ch === 'N' ) {
  26003. number = word();
  26004. if (!isNaN(number)) {
  26005. error('expected word to be NaN');
  26006. }
  26007. // ignore sign as -NaN also is NaN
  26008. return number;
  26009. }
  26010. if (ch === '0') {
  26011. string += ch;
  26012. next();
  26013. if (ch === 'x' || ch === 'X') {
  26014. string += ch;
  26015. next();
  26016. base = 16;
  26017. } else if (ch >= '0' && ch <= '9') {
  26018. error('Octal literal');
  26019. }
  26020. }
  26021. switch (base) {
  26022. case 10:
  26023. while (ch >= '0' && ch <= '9' ) {
  26024. string += ch;
  26025. next();
  26026. }
  26027. if (ch === '.') {
  26028. string += '.';
  26029. while (next() && ch >= '0' && ch <= '9') {
  26030. string += ch;
  26031. }
  26032. }
  26033. if (ch === 'e' || ch === 'E') {
  26034. string += ch;
  26035. next();
  26036. if (ch === '-' || ch === '+') {
  26037. string += ch;
  26038. next();
  26039. }
  26040. while (ch >= '0' && ch <= '9') {
  26041. string += ch;
  26042. next();
  26043. }
  26044. }
  26045. break;
  26046. case 16:
  26047. while (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {
  26048. string += ch;
  26049. next();
  26050. }
  26051. break;
  26052. }
  26053. if(sign === '-') {
  26054. number = -string;
  26055. } else {
  26056. number = +string;
  26057. }
  26058. if (!isFinite(number)) {
  26059. error("Bad number");
  26060. } else {
  26061. return number;
  26062. }
  26063. },
  26064. string = function () {
  26065. // Parse a string value.
  26066. var hex,
  26067. i,
  26068. string = '',
  26069. delim, // double quote or single quote
  26070. uffff;
  26071. // When parsing for string values, we must look for ' or " and \ characters.
  26072. if (ch === '"' || ch === "'") {
  26073. delim = ch;
  26074. while (next()) {
  26075. if (ch === delim) {
  26076. next();
  26077. return string;
  26078. } else if (ch === '\\') {
  26079. next();
  26080. if (ch === 'u') {
  26081. uffff = 0;
  26082. for (i = 0; i < 4; i += 1) {
  26083. hex = parseInt(next(), 16);
  26084. if (!isFinite(hex)) {
  26085. break;
  26086. }
  26087. uffff = uffff * 16 + hex;
  26088. }
  26089. string += String.fromCharCode(uffff);
  26090. } else if (ch === '\r') {
  26091. if (peek() === '\n') {
  26092. next();
  26093. }
  26094. } else if (typeof escapee[ch] === 'string') {
  26095. string += escapee[ch];
  26096. } else {
  26097. break;
  26098. }
  26099. } else if (ch === '\n') {
  26100. // unescaped newlines are invalid; see:
  26101. // https://github.com/aseemk/json5/issues/24
  26102. // TODO this feels special-cased; are there other
  26103. // invalid unescaped chars?
  26104. break;
  26105. } else {
  26106. string += ch;
  26107. }
  26108. }
  26109. }
  26110. error("Bad string");
  26111. },
  26112. inlineComment = function () {
  26113. // Skip an inline comment, assuming this is one. The current character should
  26114. // be the second / character in the // pair that begins this inline comment.
  26115. // To finish the inline comment, we look for a newline or the end of the text.
  26116. if (ch !== '/') {
  26117. error("Not an inline comment");
  26118. }
  26119. do {
  26120. next();
  26121. if (ch === '\n' || ch === '\r') {
  26122. next();
  26123. return;
  26124. }
  26125. } while (ch);
  26126. },
  26127. blockComment = function () {
  26128. // Skip a block comment, assuming this is one. The current character should be
  26129. // the * character in the /* pair that begins this block comment.
  26130. // To finish the block comment, we look for an ending */ pair of characters,
  26131. // but we also watch for the end of text before the comment is terminated.
  26132. if (ch !== '*') {
  26133. error("Not a block comment");
  26134. }
  26135. do {
  26136. next();
  26137. while (ch === '*') {
  26138. next('*');
  26139. if (ch === '/') {
  26140. next('/');
  26141. return;
  26142. }
  26143. }
  26144. } while (ch);
  26145. error("Unterminated block comment");
  26146. },
  26147. comment = function () {
  26148. // Skip a comment, whether inline or block-level, assuming this is one.
  26149. // Comments always begin with a / character.
  26150. if (ch !== '/') {
  26151. error("Not a comment");
  26152. }
  26153. next('/');
  26154. if (ch === '/') {
  26155. inlineComment();
  26156. } else if (ch === '*') {
  26157. blockComment();
  26158. } else {
  26159. error("Unrecognized comment");
  26160. }
  26161. },
  26162. white = function () {
  26163. // Skip whitespace and comments.
  26164. // Note that we're detecting comments by only a single / character.
  26165. // This works since regular expressions are not valid JSON(5), but this will
  26166. // break if there are other valid values that begin with a / character!
  26167. while (ch) {
  26168. if (ch === '/') {
  26169. comment();
  26170. } else if (ws.indexOf(ch) >= 0) {
  26171. next();
  26172. } else {
  26173. return;
  26174. }
  26175. }
  26176. },
  26177. word = function () {
  26178. // true, false, or null.
  26179. switch (ch) {
  26180. case 't':
  26181. next('t');
  26182. next('r');
  26183. next('u');
  26184. next('e');
  26185. return true;
  26186. case 'f':
  26187. next('f');
  26188. next('a');
  26189. next('l');
  26190. next('s');
  26191. next('e');
  26192. return false;
  26193. case 'n':
  26194. next('n');
  26195. next('u');
  26196. next('l');
  26197. next('l');
  26198. return null;
  26199. case 'I':
  26200. next('I');
  26201. next('n');
  26202. next('f');
  26203. next('i');
  26204. next('n');
  26205. next('i');
  26206. next('t');
  26207. next('y');
  26208. return Infinity;
  26209. case 'N':
  26210. next( 'N' );
  26211. next( 'a' );
  26212. next( 'N' );
  26213. return NaN;
  26214. }
  26215. error("Unexpected " + renderChar(ch));
  26216. },
  26217. value, // Place holder for the value function.
  26218. array = function () {
  26219. // Parse an array value.
  26220. var array = [];
  26221. if (ch === '[') {
  26222. next('[');
  26223. white();
  26224. while (ch) {
  26225. if (ch === ']') {
  26226. next(']');
  26227. return array; // Potentially empty array
  26228. }
  26229. // ES5 allows omitting elements in arrays, e.g. [,] and
  26230. // [,null]. We don't allow this in JSON5.
  26231. if (ch === ',') {
  26232. error("Missing array element");
  26233. } else {
  26234. array.push(value());
  26235. }
  26236. white();
  26237. // If there's no comma after this value, this needs to
  26238. // be the end of the array.
  26239. if (ch !== ',') {
  26240. next(']');
  26241. return array;
  26242. }
  26243. next(',');
  26244. white();
  26245. }
  26246. }
  26247. error("Bad array");
  26248. },
  26249. object = function () {
  26250. // Parse an object value.
  26251. var key,
  26252. object = {};
  26253. if (ch === '{') {
  26254. next('{');
  26255. white();
  26256. while (ch) {
  26257. if (ch === '}') {
  26258. next('}');
  26259. return object; // Potentially empty object
  26260. }
  26261. // Keys can be unquoted. If they are, they need to be
  26262. // valid JS identifiers.
  26263. if (ch === '"' || ch === "'") {
  26264. key = string();
  26265. } else {
  26266. key = identifier();
  26267. }
  26268. white();
  26269. next(':');
  26270. object[key] = value();
  26271. white();
  26272. // If there's no comma after this pair, this needs to be
  26273. // the end of the object.
  26274. if (ch !== ',') {
  26275. next('}');
  26276. return object;
  26277. }
  26278. next(',');
  26279. white();
  26280. }
  26281. }
  26282. error("Bad object");
  26283. };
  26284. value = function () {
  26285. // Parse a JSON value. It could be an object, an array, a string, a number,
  26286. // or a word.
  26287. white();
  26288. switch (ch) {
  26289. case '{':
  26290. return object();
  26291. case '[':
  26292. return array();
  26293. case '"':
  26294. case "'":
  26295. return string();
  26296. case '-':
  26297. case '+':
  26298. case '.':
  26299. return number();
  26300. default:
  26301. return ch >= '0' && ch <= '9' ? number() : word();
  26302. }
  26303. };
  26304. // Return the json_parse function. It will have access to all of the above
  26305. // functions and variables.
  26306. return function (source, reviver) {
  26307. var result;
  26308. text = String(source);
  26309. at = 0;
  26310. lineNumber = 1;
  26311. columnNumber = 1;
  26312. ch = ' ';
  26313. result = value();
  26314. white();
  26315. if (ch) {
  26316. error("Syntax error");
  26317. }
  26318. // If there is a reviver function, we recursively walk the new structure,
  26319. // passing each name/value pair to the reviver function for possible
  26320. // transformation, starting with a temporary root object that holds the result
  26321. // in an empty key. If there is not a reviver function, we simply return the
  26322. // result.
  26323. return typeof reviver === 'function' ? (function walk(holder, key) {
  26324. var k, v, value = holder[key];
  26325. if (value && typeof value === 'object') {
  26326. for (k in value) {
  26327. if (Object.prototype.hasOwnProperty.call(value, k)) {
  26328. v = walk(value, k);
  26329. if (v !== undefined) {
  26330. value[k] = v;
  26331. } else {
  26332. delete value[k];
  26333. }
  26334. }
  26335. }
  26336. }
  26337. return reviver.call(holder, key, value);
  26338. }({'': result}, '')) : result;
  26339. };
  26340. }());
  26341. // JSON5 stringify will not quote keys where appropriate
  26342. JSON5.stringify = function (obj, replacer, space) {
  26343. if (replacer && (typeof(replacer) !== "function" && !isArray(replacer))) {
  26344. throw new Error('Replacer must be a function or an array');
  26345. }
  26346. var getReplacedValueOrUndefined = function(holder, key, isTopLevel) {
  26347. var value = holder[key];
  26348. // Replace the value with its toJSON value first, if possible
  26349. if (value && value.toJSON && typeof value.toJSON === "function") {
  26350. value = value.toJSON();
  26351. }
  26352. // If the user-supplied replacer if a function, call it. If it's an array, check objects' string keys for
  26353. // presence in the array (removing the key/value pair from the resulting JSON if the key is missing).
  26354. if (typeof(replacer) === "function") {
  26355. return replacer.call(holder, key, value);
  26356. } else if(replacer) {
  26357. if (isTopLevel || isArray(holder) || replacer.indexOf(key) >= 0) {
  26358. return value;
  26359. } else {
  26360. return undefined;
  26361. }
  26362. } else {
  26363. return value;
  26364. }
  26365. };
  26366. function isWordChar(c) {
  26367. return (c >= 'a' && c <= 'z') ||
  26368. (c >= 'A' && c <= 'Z') ||
  26369. (c >= '0' && c <= '9') ||
  26370. c === '_' || c === '$';
  26371. }
  26372. function isWordStart(c) {
  26373. return (c >= 'a' && c <= 'z') ||
  26374. (c >= 'A' && c <= 'Z') ||
  26375. c === '_' || c === '$';
  26376. }
  26377. function isWord(key) {
  26378. if (typeof key !== 'string') {
  26379. return false;
  26380. }
  26381. if (!isWordStart(key[0])) {
  26382. return false;
  26383. }
  26384. var i = 1, length = key.length;
  26385. while (i < length) {
  26386. if (!isWordChar(key[i])) {
  26387. return false;
  26388. }
  26389. i++;
  26390. }
  26391. return true;
  26392. }
  26393. // export for use in tests
  26394. JSON5.isWord = isWord;
  26395. // polyfills
  26396. function isArray(obj) {
  26397. if (Array.isArray) {
  26398. return Array.isArray(obj);
  26399. } else {
  26400. return Object.prototype.toString.call(obj) === '[object Array]';
  26401. }
  26402. }
  26403. function isDate(obj) {
  26404. return Object.prototype.toString.call(obj) === '[object Date]';
  26405. }
  26406. var objStack = [];
  26407. function checkForCircular(obj) {
  26408. for (var i = 0; i < objStack.length; i++) {
  26409. if (objStack[i] === obj) {
  26410. throw new TypeError("Converting circular structure to JSON");
  26411. }
  26412. }
  26413. }
  26414. function makeIndent(str, num, noNewLine) {
  26415. if (!str) {
  26416. return "";
  26417. }
  26418. // indentation no more than 10 chars
  26419. if (str.length > 10) {
  26420. str = str.substring(0, 10);
  26421. }
  26422. var indent = noNewLine ? "" : "\n";
  26423. for (var i = 0; i < num; i++) {
  26424. indent += str;
  26425. }
  26426. return indent;
  26427. }
  26428. var indentStr;
  26429. if (space) {
  26430. if (typeof space === "string") {
  26431. indentStr = space;
  26432. } else if (typeof space === "number" && space >= 0) {
  26433. indentStr = makeIndent(" ", space, true);
  26434. } else {
  26435. // ignore space parameter
  26436. }
  26437. }
  26438. // Copied from Crokford's implementation of JSON
  26439. // See https://github.com/douglascrockford/JSON-js/blob/e39db4b7e6249f04a195e7dd0840e610cc9e941e/json2.js#L195
  26440. // Begin
  26441. var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
  26442. escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
  26443. meta = { // table of character substitutions
  26444. '\b': '\\b',
  26445. '\t': '\\t',
  26446. '\n': '\\n',
  26447. '\f': '\\f',
  26448. '\r': '\\r',
  26449. '"' : '\\"',
  26450. '\\': '\\\\'
  26451. };
  26452. function escapeString(string) {
  26453. // If the string contains no control characters, no quote characters, and no
  26454. // backslash characters, then we can safely slap some quotes around it.
  26455. // Otherwise we must also replace the offending characters with safe escape
  26456. // sequences.
  26457. escapable.lastIndex = 0;
  26458. return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
  26459. var c = meta[a];
  26460. return typeof c === 'string' ?
  26461. c :
  26462. '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
  26463. }) + '"' : '"' + string + '"';
  26464. }
  26465. // End
  26466. function internalStringify(holder, key, isTopLevel) {
  26467. var buffer, res;
  26468. // Replace the value, if necessary
  26469. var obj_part = getReplacedValueOrUndefined(holder, key, isTopLevel);
  26470. if (obj_part && !isDate(obj_part)) {
  26471. // unbox objects
  26472. // don't unbox dates, since will turn it into number
  26473. obj_part = obj_part.valueOf();
  26474. }
  26475. switch(typeof obj_part) {
  26476. case "boolean":
  26477. return obj_part.toString();
  26478. case "number":
  26479. if (isNaN(obj_part) || !isFinite(obj_part)) {
  26480. return "null";
  26481. }
  26482. return obj_part.toString();
  26483. case "string":
  26484. return escapeString(obj_part.toString());
  26485. case "object":
  26486. if (obj_part === null) {
  26487. return "null";
  26488. } else if (isArray(obj_part)) {
  26489. checkForCircular(obj_part);
  26490. buffer = "[";
  26491. objStack.push(obj_part);
  26492. for (var i = 0; i < obj_part.length; i++) {
  26493. res = internalStringify(obj_part, i, false);
  26494. buffer += makeIndent(indentStr, objStack.length);
  26495. if (res === null || typeof res === "undefined") {
  26496. buffer += "null";
  26497. } else {
  26498. buffer += res;
  26499. }
  26500. if (i < obj_part.length-1) {
  26501. buffer += ",";
  26502. } else if (indentStr) {
  26503. buffer += "\n";
  26504. }
  26505. }
  26506. objStack.pop();
  26507. if (obj_part.length) {
  26508. buffer += makeIndent(indentStr, objStack.length, true)
  26509. }
  26510. buffer += "]";
  26511. } else {
  26512. checkForCircular(obj_part);
  26513. buffer = "{";
  26514. var nonEmpty = false;
  26515. objStack.push(obj_part);
  26516. for (var prop in obj_part) {
  26517. if (obj_part.hasOwnProperty(prop)) {
  26518. var value = internalStringify(obj_part, prop, false);
  26519. isTopLevel = false;
  26520. if (typeof value !== "undefined" && value !== null) {
  26521. buffer += makeIndent(indentStr, objStack.length);
  26522. nonEmpty = true;
  26523. key = isWord(prop) ? prop : escapeString(prop);
  26524. buffer += key + ":" + (indentStr ? ' ' : '') + value + ",";
  26525. }
  26526. }
  26527. }
  26528. objStack.pop();
  26529. if (nonEmpty) {
  26530. buffer = buffer.substring(0, buffer.length-1) + makeIndent(indentStr, objStack.length) + "}";
  26531. } else {
  26532. buffer = '{}';
  26533. }
  26534. }
  26535. return buffer;
  26536. default:
  26537. // functions and undefined should be ignored
  26538. return undefined;
  26539. }
  26540. }
  26541. // special case...when undefined is used inside of
  26542. // a compound object/array, return null.
  26543. // but when top-level, return undefined
  26544. var topLevelHolder = {"":obj};
  26545. if (obj === undefined) {
  26546. return getReplacedValueOrUndefined(topLevelHolder, '', true);
  26547. }
  26548. return internalStringify(topLevelHolder, '', true);
  26549. };
  26550. },{}],251:[function(require,module,exports){
  26551. var getNative = require('./_getNative'),
  26552. root = require('./_root');
  26553. /* Built-in method references that are verified to be native. */
  26554. var DataView = getNative(root, 'DataView');
  26555. module.exports = DataView;
  26556. },{"./_getNative":355,"./_root":399}],252:[function(require,module,exports){
  26557. var hashClear = require('./_hashClear'),
  26558. hashDelete = require('./_hashDelete'),
  26559. hashGet = require('./_hashGet'),
  26560. hashHas = require('./_hashHas'),
  26561. hashSet = require('./_hashSet');
  26562. /**
  26563. * Creates a hash object.
  26564. *
  26565. * @private
  26566. * @constructor
  26567. * @param {Array} [entries] The key-value pairs to cache.
  26568. */
  26569. function Hash(entries) {
  26570. var index = -1,
  26571. length = entries == null ? 0 : entries.length;
  26572. this.clear();
  26573. while (++index < length) {
  26574. var entry = entries[index];
  26575. this.set(entry[0], entry[1]);
  26576. }
  26577. }
  26578. // Add methods to `Hash`.
  26579. Hash.prototype.clear = hashClear;
  26580. Hash.prototype['delete'] = hashDelete;
  26581. Hash.prototype.get = hashGet;
  26582. Hash.prototype.has = hashHas;
  26583. Hash.prototype.set = hashSet;
  26584. module.exports = Hash;
  26585. },{"./_hashClear":363,"./_hashDelete":364,"./_hashGet":365,"./_hashHas":366,"./_hashSet":367}],253:[function(require,module,exports){
  26586. var listCacheClear = require('./_listCacheClear'),
  26587. listCacheDelete = require('./_listCacheDelete'),
  26588. listCacheGet = require('./_listCacheGet'),
  26589. listCacheHas = require('./_listCacheHas'),
  26590. listCacheSet = require('./_listCacheSet');
  26591. /**
  26592. * Creates an list cache object.
  26593. *
  26594. * @private
  26595. * @constructor
  26596. * @param {Array} [entries] The key-value pairs to cache.
  26597. */
  26598. function ListCache(entries) {
  26599. var index = -1,
  26600. length = entries == null ? 0 : entries.length;
  26601. this.clear();
  26602. while (++index < length) {
  26603. var entry = entries[index];
  26604. this.set(entry[0], entry[1]);
  26605. }
  26606. }
  26607. // Add methods to `ListCache`.
  26608. ListCache.prototype.clear = listCacheClear;
  26609. ListCache.prototype['delete'] = listCacheDelete;
  26610. ListCache.prototype.get = listCacheGet;
  26611. ListCache.prototype.has = listCacheHas;
  26612. ListCache.prototype.set = listCacheSet;
  26613. module.exports = ListCache;
  26614. },{"./_listCacheClear":379,"./_listCacheDelete":380,"./_listCacheGet":381,"./_listCacheHas":382,"./_listCacheSet":383}],254:[function(require,module,exports){
  26615. var getNative = require('./_getNative'),
  26616. root = require('./_root');
  26617. /* Built-in method references that are verified to be native. */
  26618. var Map = getNative(root, 'Map');
  26619. module.exports = Map;
  26620. },{"./_getNative":355,"./_root":399}],255:[function(require,module,exports){
  26621. var mapCacheClear = require('./_mapCacheClear'),
  26622. mapCacheDelete = require('./_mapCacheDelete'),
  26623. mapCacheGet = require('./_mapCacheGet'),
  26624. mapCacheHas = require('./_mapCacheHas'),
  26625. mapCacheSet = require('./_mapCacheSet');
  26626. /**
  26627. * Creates a map cache object to store key-value pairs.
  26628. *
  26629. * @private
  26630. * @constructor
  26631. * @param {Array} [entries] The key-value pairs to cache.
  26632. */
  26633. function MapCache(entries) {
  26634. var index = -1,
  26635. length = entries == null ? 0 : entries.length;
  26636. this.clear();
  26637. while (++index < length) {
  26638. var entry = entries[index];
  26639. this.set(entry[0], entry[1]);
  26640. }
  26641. }
  26642. // Add methods to `MapCache`.
  26643. MapCache.prototype.clear = mapCacheClear;
  26644. MapCache.prototype['delete'] = mapCacheDelete;
  26645. MapCache.prototype.get = mapCacheGet;
  26646. MapCache.prototype.has = mapCacheHas;
  26647. MapCache.prototype.set = mapCacheSet;
  26648. module.exports = MapCache;
  26649. },{"./_mapCacheClear":384,"./_mapCacheDelete":385,"./_mapCacheGet":386,"./_mapCacheHas":387,"./_mapCacheSet":388}],256:[function(require,module,exports){
  26650. var getNative = require('./_getNative'),
  26651. root = require('./_root');
  26652. /* Built-in method references that are verified to be native. */
  26653. var Promise = getNative(root, 'Promise');
  26654. module.exports = Promise;
  26655. },{"./_getNative":355,"./_root":399}],257:[function(require,module,exports){
  26656. var getNative = require('./_getNative'),
  26657. root = require('./_root');
  26658. /* Built-in method references that are verified to be native. */
  26659. var Set = getNative(root, 'Set');
  26660. module.exports = Set;
  26661. },{"./_getNative":355,"./_root":399}],258:[function(require,module,exports){
  26662. var MapCache = require('./_MapCache'),
  26663. setCacheAdd = require('./_setCacheAdd'),
  26664. setCacheHas = require('./_setCacheHas');
  26665. /**
  26666. *
  26667. * Creates an array cache object to store unique values.
  26668. *
  26669. * @private
  26670. * @constructor
  26671. * @param {Array} [values] The values to cache.
  26672. */
  26673. function SetCache(values) {
  26674. var index = -1,
  26675. length = values == null ? 0 : values.length;
  26676. this.__data__ = new MapCache;
  26677. while (++index < length) {
  26678. this.add(values[index]);
  26679. }
  26680. }
  26681. // Add methods to `SetCache`.
  26682. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  26683. SetCache.prototype.has = setCacheHas;
  26684. module.exports = SetCache;
  26685. },{"./_MapCache":255,"./_setCacheAdd":400,"./_setCacheHas":401}],259:[function(require,module,exports){
  26686. var ListCache = require('./_ListCache'),
  26687. stackClear = require('./_stackClear'),
  26688. stackDelete = require('./_stackDelete'),
  26689. stackGet = require('./_stackGet'),
  26690. stackHas = require('./_stackHas'),
  26691. stackSet = require('./_stackSet');
  26692. /**
  26693. * Creates a stack cache object to store key-value pairs.
  26694. *
  26695. * @private
  26696. * @constructor
  26697. * @param {Array} [entries] The key-value pairs to cache.
  26698. */
  26699. function Stack(entries) {
  26700. var data = this.__data__ = new ListCache(entries);
  26701. this.size = data.size;
  26702. }
  26703. // Add methods to `Stack`.
  26704. Stack.prototype.clear = stackClear;
  26705. Stack.prototype['delete'] = stackDelete;
  26706. Stack.prototype.get = stackGet;
  26707. Stack.prototype.has = stackHas;
  26708. Stack.prototype.set = stackSet;
  26709. module.exports = Stack;
  26710. },{"./_ListCache":253,"./_stackClear":405,"./_stackDelete":406,"./_stackGet":407,"./_stackHas":408,"./_stackSet":409}],260:[function(require,module,exports){
  26711. var root = require('./_root');
  26712. /** Built-in value references. */
  26713. var Symbol = root.Symbol;
  26714. module.exports = Symbol;
  26715. },{"./_root":399}],261:[function(require,module,exports){
  26716. var root = require('./_root');
  26717. /** Built-in value references. */
  26718. var Uint8Array = root.Uint8Array;
  26719. module.exports = Uint8Array;
  26720. },{"./_root":399}],262:[function(require,module,exports){
  26721. var getNative = require('./_getNative'),
  26722. root = require('./_root');
  26723. /* Built-in method references that are verified to be native. */
  26724. var WeakMap = getNative(root, 'WeakMap');
  26725. module.exports = WeakMap;
  26726. },{"./_getNative":355,"./_root":399}],263:[function(require,module,exports){
  26727. /**
  26728. * Adds the key-value `pair` to `map`.
  26729. *
  26730. * @private
  26731. * @param {Object} map The map to modify.
  26732. * @param {Array} pair The key-value pair to add.
  26733. * @returns {Object} Returns `map`.
  26734. */
  26735. function addMapEntry(map, pair) {
  26736. // Don't return `map.set` because it's not chainable in IE 11.
  26737. map.set(pair[0], pair[1]);
  26738. return map;
  26739. }
  26740. module.exports = addMapEntry;
  26741. },{}],264:[function(require,module,exports){
  26742. /**
  26743. * Adds `value` to `set`.
  26744. *
  26745. * @private
  26746. * @param {Object} set The set to modify.
  26747. * @param {*} value The value to add.
  26748. * @returns {Object} Returns `set`.
  26749. */
  26750. function addSetEntry(set, value) {
  26751. // Don't return `set.add` because it's not chainable in IE 11.
  26752. set.add(value);
  26753. return set;
  26754. }
  26755. module.exports = addSetEntry;
  26756. },{}],265:[function(require,module,exports){
  26757. /**
  26758. * A faster alternative to `Function#apply`, this function invokes `func`
  26759. * with the `this` binding of `thisArg` and the arguments of `args`.
  26760. *
  26761. * @private
  26762. * @param {Function} func The function to invoke.
  26763. * @param {*} thisArg The `this` binding of `func`.
  26764. * @param {Array} args The arguments to invoke `func` with.
  26765. * @returns {*} Returns the result of `func`.
  26766. */
  26767. function apply(func, thisArg, args) {
  26768. switch (args.length) {
  26769. case 0: return func.call(thisArg);
  26770. case 1: return func.call(thisArg, args[0]);
  26771. case 2: return func.call(thisArg, args[0], args[1]);
  26772. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  26773. }
  26774. return func.apply(thisArg, args);
  26775. }
  26776. module.exports = apply;
  26777. },{}],266:[function(require,module,exports){
  26778. /**
  26779. * A specialized version of `_.forEach` for arrays without support for
  26780. * iteratee shorthands.
  26781. *
  26782. * @private
  26783. * @param {Array} [array] The array to iterate over.
  26784. * @param {Function} iteratee The function invoked per iteration.
  26785. * @returns {Array} Returns `array`.
  26786. */
  26787. function arrayEach(array, iteratee) {
  26788. var index = -1,
  26789. length = array == null ? 0 : array.length;
  26790. while (++index < length) {
  26791. if (iteratee(array[index], index, array) === false) {
  26792. break;
  26793. }
  26794. }
  26795. return array;
  26796. }
  26797. module.exports = arrayEach;
  26798. },{}],267:[function(require,module,exports){
  26799. /**
  26800. * A specialized version of `_.filter` for arrays without support for
  26801. * iteratee shorthands.
  26802. *
  26803. * @private
  26804. * @param {Array} [array] The array to iterate over.
  26805. * @param {Function} predicate The function invoked per iteration.
  26806. * @returns {Array} Returns the new filtered array.
  26807. */
  26808. function arrayFilter(array, predicate) {
  26809. var index = -1,
  26810. length = array == null ? 0 : array.length,
  26811. resIndex = 0,
  26812. result = [];
  26813. while (++index < length) {
  26814. var value = array[index];
  26815. if (predicate(value, index, array)) {
  26816. result[resIndex++] = value;
  26817. }
  26818. }
  26819. return result;
  26820. }
  26821. module.exports = arrayFilter;
  26822. },{}],268:[function(require,module,exports){
  26823. var baseIndexOf = require('./_baseIndexOf');
  26824. /**
  26825. * A specialized version of `_.includes` for arrays without support for
  26826. * specifying an index to search from.
  26827. *
  26828. * @private
  26829. * @param {Array} [array] The array to inspect.
  26830. * @param {*} target The value to search for.
  26831. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  26832. */
  26833. function arrayIncludes(array, value) {
  26834. var length = array == null ? 0 : array.length;
  26835. return !!length && baseIndexOf(array, value, 0) > -1;
  26836. }
  26837. module.exports = arrayIncludes;
  26838. },{"./_baseIndexOf":294}],269:[function(require,module,exports){
  26839. /**
  26840. * This function is like `arrayIncludes` except that it accepts a comparator.
  26841. *
  26842. * @private
  26843. * @param {Array} [array] The array to inspect.
  26844. * @param {*} target The value to search for.
  26845. * @param {Function} comparator The comparator invoked per element.
  26846. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  26847. */
  26848. function arrayIncludesWith(array, value, comparator) {
  26849. var index = -1,
  26850. length = array == null ? 0 : array.length;
  26851. while (++index < length) {
  26852. if (comparator(value, array[index])) {
  26853. return true;
  26854. }
  26855. }
  26856. return false;
  26857. }
  26858. module.exports = arrayIncludesWith;
  26859. },{}],270:[function(require,module,exports){
  26860. var baseTimes = require('./_baseTimes'),
  26861. isArguments = require('./isArguments'),
  26862. isArray = require('./isArray'),
  26863. isBuffer = require('./isBuffer'),
  26864. isIndex = require('./_isIndex'),
  26865. isTypedArray = require('./isTypedArray');
  26866. /** Used for built-in method references. */
  26867. var objectProto = Object.prototype;
  26868. /** Used to check objects for own properties. */
  26869. var hasOwnProperty = objectProto.hasOwnProperty;
  26870. /**
  26871. * Creates an array of the enumerable property names of the array-like `value`.
  26872. *
  26873. * @private
  26874. * @param {*} value The value to query.
  26875. * @param {boolean} inherited Specify returning inherited property names.
  26876. * @returns {Array} Returns the array of property names.
  26877. */
  26878. function arrayLikeKeys(value, inherited) {
  26879. var isArr = isArray(value),
  26880. isArg = !isArr && isArguments(value),
  26881. isBuff = !isArr && !isArg && isBuffer(value),
  26882. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  26883. skipIndexes = isArr || isArg || isBuff || isType,
  26884. result = skipIndexes ? baseTimes(value.length, String) : [],
  26885. length = result.length;
  26886. for (var key in value) {
  26887. if ((inherited || hasOwnProperty.call(value, key)) &&
  26888. !(skipIndexes && (
  26889. // Safari 9 has enumerable `arguments.length` in strict mode.
  26890. key == 'length' ||
  26891. // Node.js 0.10 has enumerable non-index properties on buffers.
  26892. (isBuff && (key == 'offset' || key == 'parent')) ||
  26893. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  26894. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  26895. // Skip index properties.
  26896. isIndex(key, length)
  26897. ))) {
  26898. result.push(key);
  26899. }
  26900. }
  26901. return result;
  26902. }
  26903. module.exports = arrayLikeKeys;
  26904. },{"./_baseTimes":318,"./_isIndex":372,"./isArguments":432,"./isArray":433,"./isBuffer":436,"./isTypedArray":446}],271:[function(require,module,exports){
  26905. /**
  26906. * A specialized version of `_.map` for arrays without support for iteratee
  26907. * shorthands.
  26908. *
  26909. * @private
  26910. * @param {Array} [array] The array to iterate over.
  26911. * @param {Function} iteratee The function invoked per iteration.
  26912. * @returns {Array} Returns the new mapped array.
  26913. */
  26914. function arrayMap(array, iteratee) {
  26915. var index = -1,
  26916. length = array == null ? 0 : array.length,
  26917. result = Array(length);
  26918. while (++index < length) {
  26919. result[index] = iteratee(array[index], index, array);
  26920. }
  26921. return result;
  26922. }
  26923. module.exports = arrayMap;
  26924. },{}],272:[function(require,module,exports){
  26925. /**
  26926. * Appends the elements of `values` to `array`.
  26927. *
  26928. * @private
  26929. * @param {Array} array The array to modify.
  26930. * @param {Array} values The values to append.
  26931. * @returns {Array} Returns `array`.
  26932. */
  26933. function arrayPush(array, values) {
  26934. var index = -1,
  26935. length = values.length,
  26936. offset = array.length;
  26937. while (++index < length) {
  26938. array[offset + index] = values[index];
  26939. }
  26940. return array;
  26941. }
  26942. module.exports = arrayPush;
  26943. },{}],273:[function(require,module,exports){
  26944. /**
  26945. * A specialized version of `_.reduce` for arrays without support for
  26946. * iteratee shorthands.
  26947. *
  26948. * @private
  26949. * @param {Array} [array] The array to iterate over.
  26950. * @param {Function} iteratee The function invoked per iteration.
  26951. * @param {*} [accumulator] The initial value.
  26952. * @param {boolean} [initAccum] Specify using the first element of `array` as
  26953. * the initial value.
  26954. * @returns {*} Returns the accumulated value.
  26955. */
  26956. function arrayReduce(array, iteratee, accumulator, initAccum) {
  26957. var index = -1,
  26958. length = array == null ? 0 : array.length;
  26959. if (initAccum && length) {
  26960. accumulator = array[++index];
  26961. }
  26962. while (++index < length) {
  26963. accumulator = iteratee(accumulator, array[index], index, array);
  26964. }
  26965. return accumulator;
  26966. }
  26967. module.exports = arrayReduce;
  26968. },{}],274:[function(require,module,exports){
  26969. /**
  26970. * A specialized version of `_.some` for arrays without support for iteratee
  26971. * shorthands.
  26972. *
  26973. * @private
  26974. * @param {Array} [array] The array to iterate over.
  26975. * @param {Function} predicate The function invoked per iteration.
  26976. * @returns {boolean} Returns `true` if any element passes the predicate check,
  26977. * else `false`.
  26978. */
  26979. function arraySome(array, predicate) {
  26980. var index = -1,
  26981. length = array == null ? 0 : array.length;
  26982. while (++index < length) {
  26983. if (predicate(array[index], index, array)) {
  26984. return true;
  26985. }
  26986. }
  26987. return false;
  26988. }
  26989. module.exports = arraySome;
  26990. },{}],275:[function(require,module,exports){
  26991. var baseAssignValue = require('./_baseAssignValue'),
  26992. eq = require('./eq');
  26993. /**
  26994. * This function is like `assignValue` except that it doesn't assign
  26995. * `undefined` values.
  26996. *
  26997. * @private
  26998. * @param {Object} object The object to modify.
  26999. * @param {string} key The key of the property to assign.
  27000. * @param {*} value The value to assign.
  27001. */
  27002. function assignMergeValue(object, key, value) {
  27003. if ((value !== undefined && !eq(object[key], value)) ||
  27004. (value === undefined && !(key in object))) {
  27005. baseAssignValue(object, key, value);
  27006. }
  27007. }
  27008. module.exports = assignMergeValue;
  27009. },{"./_baseAssignValue":280,"./eq":421}],276:[function(require,module,exports){
  27010. var baseAssignValue = require('./_baseAssignValue'),
  27011. eq = require('./eq');
  27012. /** Used for built-in method references. */
  27013. var objectProto = Object.prototype;
  27014. /** Used to check objects for own properties. */
  27015. var hasOwnProperty = objectProto.hasOwnProperty;
  27016. /**
  27017. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  27018. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  27019. * for equality comparisons.
  27020. *
  27021. * @private
  27022. * @param {Object} object The object to modify.
  27023. * @param {string} key The key of the property to assign.
  27024. * @param {*} value The value to assign.
  27025. */
  27026. function assignValue(object, key, value) {
  27027. var objValue = object[key];
  27028. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  27029. (value === undefined && !(key in object))) {
  27030. baseAssignValue(object, key, value);
  27031. }
  27032. }
  27033. module.exports = assignValue;
  27034. },{"./_baseAssignValue":280,"./eq":421}],277:[function(require,module,exports){
  27035. var eq = require('./eq');
  27036. /**
  27037. * Gets the index at which the `key` is found in `array` of key-value pairs.
  27038. *
  27039. * @private
  27040. * @param {Array} array The array to inspect.
  27041. * @param {*} key The key to search for.
  27042. * @returns {number} Returns the index of the matched value, else `-1`.
  27043. */
  27044. function assocIndexOf(array, key) {
  27045. var length = array.length;
  27046. while (length--) {
  27047. if (eq(array[length][0], key)) {
  27048. return length;
  27049. }
  27050. }
  27051. return -1;
  27052. }
  27053. module.exports = assocIndexOf;
  27054. },{"./eq":421}],278:[function(require,module,exports){
  27055. var copyObject = require('./_copyObject'),
  27056. keys = require('./keys');
  27057. /**
  27058. * The base implementation of `_.assign` without support for multiple sources
  27059. * or `customizer` functions.
  27060. *
  27061. * @private
  27062. * @param {Object} object The destination object.
  27063. * @param {Object} source The source object.
  27064. * @returns {Object} Returns `object`.
  27065. */
  27066. function baseAssign(object, source) {
  27067. return object && copyObject(source, keys(source), object);
  27068. }
  27069. module.exports = baseAssign;
  27070. },{"./_copyObject":336,"./keys":447}],279:[function(require,module,exports){
  27071. var copyObject = require('./_copyObject'),
  27072. keysIn = require('./keysIn');
  27073. /**
  27074. * The base implementation of `_.assignIn` without support for multiple sources
  27075. * or `customizer` functions.
  27076. *
  27077. * @private
  27078. * @param {Object} object The destination object.
  27079. * @param {Object} source The source object.
  27080. * @returns {Object} Returns `object`.
  27081. */
  27082. function baseAssignIn(object, source) {
  27083. return object && copyObject(source, keysIn(source), object);
  27084. }
  27085. module.exports = baseAssignIn;
  27086. },{"./_copyObject":336,"./keysIn":448}],280:[function(require,module,exports){
  27087. var defineProperty = require('./_defineProperty');
  27088. /**
  27089. * The base implementation of `assignValue` and `assignMergeValue` without
  27090. * value checks.
  27091. *
  27092. * @private
  27093. * @param {Object} object The object to modify.
  27094. * @param {string} key The key of the property to assign.
  27095. * @param {*} value The value to assign.
  27096. */
  27097. function baseAssignValue(object, key, value) {
  27098. if (key == '__proto__' && defineProperty) {
  27099. defineProperty(object, key, {
  27100. 'configurable': true,
  27101. 'enumerable': true,
  27102. 'value': value,
  27103. 'writable': true
  27104. });
  27105. } else {
  27106. object[key] = value;
  27107. }
  27108. }
  27109. module.exports = baseAssignValue;
  27110. },{"./_defineProperty":346}],281:[function(require,module,exports){
  27111. /**
  27112. * The base implementation of `_.clamp` which doesn't coerce arguments.
  27113. *
  27114. * @private
  27115. * @param {number} number The number to clamp.
  27116. * @param {number} [lower] The lower bound.
  27117. * @param {number} upper The upper bound.
  27118. * @returns {number} Returns the clamped number.
  27119. */
  27120. function baseClamp(number, lower, upper) {
  27121. if (number === number) {
  27122. if (upper !== undefined) {
  27123. number = number <= upper ? number : upper;
  27124. }
  27125. if (lower !== undefined) {
  27126. number = number >= lower ? number : lower;
  27127. }
  27128. }
  27129. return number;
  27130. }
  27131. module.exports = baseClamp;
  27132. },{}],282:[function(require,module,exports){
  27133. var Stack = require('./_Stack'),
  27134. arrayEach = require('./_arrayEach'),
  27135. assignValue = require('./_assignValue'),
  27136. baseAssign = require('./_baseAssign'),
  27137. baseAssignIn = require('./_baseAssignIn'),
  27138. cloneBuffer = require('./_cloneBuffer'),
  27139. copyArray = require('./_copyArray'),
  27140. copySymbols = require('./_copySymbols'),
  27141. copySymbolsIn = require('./_copySymbolsIn'),
  27142. getAllKeys = require('./_getAllKeys'),
  27143. getAllKeysIn = require('./_getAllKeysIn'),
  27144. getTag = require('./_getTag'),
  27145. initCloneArray = require('./_initCloneArray'),
  27146. initCloneByTag = require('./_initCloneByTag'),
  27147. initCloneObject = require('./_initCloneObject'),
  27148. isArray = require('./isArray'),
  27149. isBuffer = require('./isBuffer'),
  27150. isObject = require('./isObject'),
  27151. keys = require('./keys');
  27152. /** Used to compose bitmasks for cloning. */
  27153. var CLONE_DEEP_FLAG = 1,
  27154. CLONE_FLAT_FLAG = 2,
  27155. CLONE_SYMBOLS_FLAG = 4;
  27156. /** `Object#toString` result references. */
  27157. var argsTag = '[object Arguments]',
  27158. arrayTag = '[object Array]',
  27159. boolTag = '[object Boolean]',
  27160. dateTag = '[object Date]',
  27161. errorTag = '[object Error]',
  27162. funcTag = '[object Function]',
  27163. genTag = '[object GeneratorFunction]',
  27164. mapTag = '[object Map]',
  27165. numberTag = '[object Number]',
  27166. objectTag = '[object Object]',
  27167. regexpTag = '[object RegExp]',
  27168. setTag = '[object Set]',
  27169. stringTag = '[object String]',
  27170. symbolTag = '[object Symbol]',
  27171. weakMapTag = '[object WeakMap]';
  27172. var arrayBufferTag = '[object ArrayBuffer]',
  27173. dataViewTag = '[object DataView]',
  27174. float32Tag = '[object Float32Array]',
  27175. float64Tag = '[object Float64Array]',
  27176. int8Tag = '[object Int8Array]',
  27177. int16Tag = '[object Int16Array]',
  27178. int32Tag = '[object Int32Array]',
  27179. uint8Tag = '[object Uint8Array]',
  27180. uint8ClampedTag = '[object Uint8ClampedArray]',
  27181. uint16Tag = '[object Uint16Array]',
  27182. uint32Tag = '[object Uint32Array]';
  27183. /** Used to identify `toStringTag` values supported by `_.clone`. */
  27184. var cloneableTags = {};
  27185. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  27186. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  27187. cloneableTags[boolTag] = cloneableTags[dateTag] =
  27188. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  27189. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  27190. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  27191. cloneableTags[numberTag] = cloneableTags[objectTag] =
  27192. cloneableTags[regexpTag] = cloneableTags[setTag] =
  27193. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  27194. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  27195. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  27196. cloneableTags[errorTag] = cloneableTags[funcTag] =
  27197. cloneableTags[weakMapTag] = false;
  27198. /**
  27199. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  27200. * traversed objects.
  27201. *
  27202. * @private
  27203. * @param {*} value The value to clone.
  27204. * @param {boolean} bitmask The bitmask flags.
  27205. * 1 - Deep clone
  27206. * 2 - Flatten inherited properties
  27207. * 4 - Clone symbols
  27208. * @param {Function} [customizer] The function to customize cloning.
  27209. * @param {string} [key] The key of `value`.
  27210. * @param {Object} [object] The parent object of `value`.
  27211. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  27212. * @returns {*} Returns the cloned value.
  27213. */
  27214. function baseClone(value, bitmask, customizer, key, object, stack) {
  27215. var result,
  27216. isDeep = bitmask & CLONE_DEEP_FLAG,
  27217. isFlat = bitmask & CLONE_FLAT_FLAG,
  27218. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  27219. if (customizer) {
  27220. result = object ? customizer(value, key, object, stack) : customizer(value);
  27221. }
  27222. if (result !== undefined) {
  27223. return result;
  27224. }
  27225. if (!isObject(value)) {
  27226. return value;
  27227. }
  27228. var isArr = isArray(value);
  27229. if (isArr) {
  27230. result = initCloneArray(value);
  27231. if (!isDeep) {
  27232. return copyArray(value, result);
  27233. }
  27234. } else {
  27235. var tag = getTag(value),
  27236. isFunc = tag == funcTag || tag == genTag;
  27237. if (isBuffer(value)) {
  27238. return cloneBuffer(value, isDeep);
  27239. }
  27240. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  27241. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  27242. if (!isDeep) {
  27243. return isFlat
  27244. ? copySymbolsIn(value, baseAssignIn(result, value))
  27245. : copySymbols(value, baseAssign(result, value));
  27246. }
  27247. } else {
  27248. if (!cloneableTags[tag]) {
  27249. return object ? value : {};
  27250. }
  27251. result = initCloneByTag(value, tag, baseClone, isDeep);
  27252. }
  27253. }
  27254. // Check for circular references and return its corresponding clone.
  27255. stack || (stack = new Stack);
  27256. var stacked = stack.get(value);
  27257. if (stacked) {
  27258. return stacked;
  27259. }
  27260. stack.set(value, result);
  27261. var keysFunc = isFull
  27262. ? (isFlat ? getAllKeysIn : getAllKeys)
  27263. : (isFlat ? keysIn : keys);
  27264. var props = isArr ? undefined : keysFunc(value);
  27265. arrayEach(props || value, function(subValue, key) {
  27266. if (props) {
  27267. key = subValue;
  27268. subValue = value[key];
  27269. }
  27270. // Recursively populate clone (susceptible to call stack limits).
  27271. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  27272. });
  27273. return result;
  27274. }
  27275. module.exports = baseClone;
  27276. },{"./_Stack":259,"./_arrayEach":266,"./_assignValue":276,"./_baseAssign":278,"./_baseAssignIn":279,"./_cloneBuffer":326,"./_copyArray":335,"./_copySymbols":337,"./_copySymbolsIn":338,"./_getAllKeys":351,"./_getAllKeysIn":352,"./_getTag":360,"./_initCloneArray":368,"./_initCloneByTag":369,"./_initCloneObject":370,"./isArray":433,"./isBuffer":436,"./isObject":440,"./keys":447}],283:[function(require,module,exports){
  27277. var isObject = require('./isObject');
  27278. /** Built-in value references. */
  27279. var objectCreate = Object.create;
  27280. /**
  27281. * The base implementation of `_.create` without support for assigning
  27282. * properties to the created object.
  27283. *
  27284. * @private
  27285. * @param {Object} proto The object to inherit from.
  27286. * @returns {Object} Returns the new object.
  27287. */
  27288. var baseCreate = (function() {
  27289. function object() {}
  27290. return function(proto) {
  27291. if (!isObject(proto)) {
  27292. return {};
  27293. }
  27294. if (objectCreate) {
  27295. return objectCreate(proto);
  27296. }
  27297. object.prototype = proto;
  27298. var result = new object;
  27299. object.prototype = undefined;
  27300. return result;
  27301. };
  27302. }());
  27303. module.exports = baseCreate;
  27304. },{"./isObject":440}],284:[function(require,module,exports){
  27305. var baseForOwn = require('./_baseForOwn'),
  27306. createBaseEach = require('./_createBaseEach');
  27307. /**
  27308. * The base implementation of `_.forEach` without support for iteratee shorthands.
  27309. *
  27310. * @private
  27311. * @param {Array|Object} collection The collection to iterate over.
  27312. * @param {Function} iteratee The function invoked per iteration.
  27313. * @returns {Array|Object} Returns `collection`.
  27314. */
  27315. var baseEach = createBaseEach(baseForOwn);
  27316. module.exports = baseEach;
  27317. },{"./_baseForOwn":288,"./_createBaseEach":341}],285:[function(require,module,exports){
  27318. /**
  27319. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  27320. * support for iteratee shorthands.
  27321. *
  27322. * @private
  27323. * @param {Array} array The array to inspect.
  27324. * @param {Function} predicate The function invoked per iteration.
  27325. * @param {number} fromIndex The index to search from.
  27326. * @param {boolean} [fromRight] Specify iterating from right to left.
  27327. * @returns {number} Returns the index of the matched value, else `-1`.
  27328. */
  27329. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  27330. var length = array.length,
  27331. index = fromIndex + (fromRight ? 1 : -1);
  27332. while ((fromRight ? index-- : ++index < length)) {
  27333. if (predicate(array[index], index, array)) {
  27334. return index;
  27335. }
  27336. }
  27337. return -1;
  27338. }
  27339. module.exports = baseFindIndex;
  27340. },{}],286:[function(require,module,exports){
  27341. var arrayPush = require('./_arrayPush'),
  27342. isFlattenable = require('./_isFlattenable');
  27343. /**
  27344. * The base implementation of `_.flatten` with support for restricting flattening.
  27345. *
  27346. * @private
  27347. * @param {Array} array The array to flatten.
  27348. * @param {number} depth The maximum recursion depth.
  27349. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  27350. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  27351. * @param {Array} [result=[]] The initial result value.
  27352. * @returns {Array} Returns the new flattened array.
  27353. */
  27354. function baseFlatten(array, depth, predicate, isStrict, result) {
  27355. var index = -1,
  27356. length = array.length;
  27357. predicate || (predicate = isFlattenable);
  27358. result || (result = []);
  27359. while (++index < length) {
  27360. var value = array[index];
  27361. if (depth > 0 && predicate(value)) {
  27362. if (depth > 1) {
  27363. // Recursively flatten arrays (susceptible to call stack limits).
  27364. baseFlatten(value, depth - 1, predicate, isStrict, result);
  27365. } else {
  27366. arrayPush(result, value);
  27367. }
  27368. } else if (!isStrict) {
  27369. result[result.length] = value;
  27370. }
  27371. }
  27372. return result;
  27373. }
  27374. module.exports = baseFlatten;
  27375. },{"./_arrayPush":272,"./_isFlattenable":371}],287:[function(require,module,exports){
  27376. var createBaseFor = require('./_createBaseFor');
  27377. /**
  27378. * The base implementation of `baseForOwn` which iterates over `object`
  27379. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  27380. * Iteratee functions may exit iteration early by explicitly returning `false`.
  27381. *
  27382. * @private
  27383. * @param {Object} object The object to iterate over.
  27384. * @param {Function} iteratee The function invoked per iteration.
  27385. * @param {Function} keysFunc The function to get the keys of `object`.
  27386. * @returns {Object} Returns `object`.
  27387. */
  27388. var baseFor = createBaseFor();
  27389. module.exports = baseFor;
  27390. },{"./_createBaseFor":342}],288:[function(require,module,exports){
  27391. var baseFor = require('./_baseFor'),
  27392. keys = require('./keys');
  27393. /**
  27394. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  27395. *
  27396. * @private
  27397. * @param {Object} object The object to iterate over.
  27398. * @param {Function} iteratee The function invoked per iteration.
  27399. * @returns {Object} Returns `object`.
  27400. */
  27401. function baseForOwn(object, iteratee) {
  27402. return object && baseFor(object, iteratee, keys);
  27403. }
  27404. module.exports = baseForOwn;
  27405. },{"./_baseFor":287,"./keys":447}],289:[function(require,module,exports){
  27406. var castPath = require('./_castPath'),
  27407. toKey = require('./_toKey');
  27408. /**
  27409. * The base implementation of `_.get` without support for default values.
  27410. *
  27411. * @private
  27412. * @param {Object} object The object to query.
  27413. * @param {Array|string} path The path of the property to get.
  27414. * @returns {*} Returns the resolved value.
  27415. */
  27416. function baseGet(object, path) {
  27417. path = castPath(path, object);
  27418. var index = 0,
  27419. length = path.length;
  27420. while (object != null && index < length) {
  27421. object = object[toKey(path[index++])];
  27422. }
  27423. return (index && index == length) ? object : undefined;
  27424. }
  27425. module.exports = baseGet;
  27426. },{"./_castPath":324,"./_toKey":412}],290:[function(require,module,exports){
  27427. var arrayPush = require('./_arrayPush'),
  27428. isArray = require('./isArray');
  27429. /**
  27430. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  27431. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  27432. * symbols of `object`.
  27433. *
  27434. * @private
  27435. * @param {Object} object The object to query.
  27436. * @param {Function} keysFunc The function to get the keys of `object`.
  27437. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  27438. * @returns {Array} Returns the array of property names and symbols.
  27439. */
  27440. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  27441. var result = keysFunc(object);
  27442. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  27443. }
  27444. module.exports = baseGetAllKeys;
  27445. },{"./_arrayPush":272,"./isArray":433}],291:[function(require,module,exports){
  27446. var Symbol = require('./_Symbol'),
  27447. getRawTag = require('./_getRawTag'),
  27448. objectToString = require('./_objectToString');
  27449. /** `Object#toString` result references. */
  27450. var nullTag = '[object Null]',
  27451. undefinedTag = '[object Undefined]';
  27452. /** Built-in value references. */
  27453. var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  27454. /**
  27455. * The base implementation of `getTag` without fallbacks for buggy environments.
  27456. *
  27457. * @private
  27458. * @param {*} value The value to query.
  27459. * @returns {string} Returns the `toStringTag`.
  27460. */
  27461. function baseGetTag(value) {
  27462. if (value == null) {
  27463. return value === undefined ? undefinedTag : nullTag;
  27464. }
  27465. return (symToStringTag && symToStringTag in Object(value))
  27466. ? getRawTag(value)
  27467. : objectToString(value);
  27468. }
  27469. module.exports = baseGetTag;
  27470. },{"./_Symbol":260,"./_getRawTag":357,"./_objectToString":396}],292:[function(require,module,exports){
  27471. /** Used for built-in method references. */
  27472. var objectProto = Object.prototype;
  27473. /** Used to check objects for own properties. */
  27474. var hasOwnProperty = objectProto.hasOwnProperty;
  27475. /**
  27476. * The base implementation of `_.has` without support for deep paths.
  27477. *
  27478. * @private
  27479. * @param {Object} [object] The object to query.
  27480. * @param {Array|string} key The key to check.
  27481. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  27482. */
  27483. function baseHas(object, key) {
  27484. return object != null && hasOwnProperty.call(object, key);
  27485. }
  27486. module.exports = baseHas;
  27487. },{}],293:[function(require,module,exports){
  27488. /**
  27489. * The base implementation of `_.hasIn` without support for deep paths.
  27490. *
  27491. * @private
  27492. * @param {Object} [object] The object to query.
  27493. * @param {Array|string} key The key to check.
  27494. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  27495. */
  27496. function baseHasIn(object, key) {
  27497. return object != null && key in Object(object);
  27498. }
  27499. module.exports = baseHasIn;
  27500. },{}],294:[function(require,module,exports){
  27501. var baseFindIndex = require('./_baseFindIndex'),
  27502. baseIsNaN = require('./_baseIsNaN'),
  27503. strictIndexOf = require('./_strictIndexOf');
  27504. /**
  27505. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  27506. *
  27507. * @private
  27508. * @param {Array} array The array to inspect.
  27509. * @param {*} value The value to search for.
  27510. * @param {number} fromIndex The index to search from.
  27511. * @returns {number} Returns the index of the matched value, else `-1`.
  27512. */
  27513. function baseIndexOf(array, value, fromIndex) {
  27514. return value === value
  27515. ? strictIndexOf(array, value, fromIndex)
  27516. : baseFindIndex(array, baseIsNaN, fromIndex);
  27517. }
  27518. module.exports = baseIndexOf;
  27519. },{"./_baseFindIndex":285,"./_baseIsNaN":299,"./_strictIndexOf":410}],295:[function(require,module,exports){
  27520. var baseGetTag = require('./_baseGetTag'),
  27521. isObjectLike = require('./isObjectLike');
  27522. /** `Object#toString` result references. */
  27523. var argsTag = '[object Arguments]';
  27524. /**
  27525. * The base implementation of `_.isArguments`.
  27526. *
  27527. * @private
  27528. * @param {*} value The value to check.
  27529. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  27530. */
  27531. function baseIsArguments(value) {
  27532. return isObjectLike(value) && baseGetTag(value) == argsTag;
  27533. }
  27534. module.exports = baseIsArguments;
  27535. },{"./_baseGetTag":291,"./isObjectLike":441}],296:[function(require,module,exports){
  27536. var baseIsEqualDeep = require('./_baseIsEqualDeep'),
  27537. isObjectLike = require('./isObjectLike');
  27538. /**
  27539. * The base implementation of `_.isEqual` which supports partial comparisons
  27540. * and tracks traversed objects.
  27541. *
  27542. * @private
  27543. * @param {*} value The value to compare.
  27544. * @param {*} other The other value to compare.
  27545. * @param {boolean} bitmask The bitmask flags.
  27546. * 1 - Unordered comparison
  27547. * 2 - Partial comparison
  27548. * @param {Function} [customizer] The function to customize comparisons.
  27549. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  27550. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  27551. */
  27552. function baseIsEqual(value, other, bitmask, customizer, stack) {
  27553. if (value === other) {
  27554. return true;
  27555. }
  27556. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  27557. return value !== value && other !== other;
  27558. }
  27559. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  27560. }
  27561. module.exports = baseIsEqual;
  27562. },{"./_baseIsEqualDeep":297,"./isObjectLike":441}],297:[function(require,module,exports){
  27563. var Stack = require('./_Stack'),
  27564. equalArrays = require('./_equalArrays'),
  27565. equalByTag = require('./_equalByTag'),
  27566. equalObjects = require('./_equalObjects'),
  27567. getTag = require('./_getTag'),
  27568. isArray = require('./isArray'),
  27569. isBuffer = require('./isBuffer'),
  27570. isTypedArray = require('./isTypedArray');
  27571. /** Used to compose bitmasks for value comparisons. */
  27572. var COMPARE_PARTIAL_FLAG = 1;
  27573. /** `Object#toString` result references. */
  27574. var argsTag = '[object Arguments]',
  27575. arrayTag = '[object Array]',
  27576. objectTag = '[object Object]';
  27577. /** Used for built-in method references. */
  27578. var objectProto = Object.prototype;
  27579. /** Used to check objects for own properties. */
  27580. var hasOwnProperty = objectProto.hasOwnProperty;
  27581. /**
  27582. * A specialized version of `baseIsEqual` for arrays and objects which performs
  27583. * deep comparisons and tracks traversed objects enabling objects with circular
  27584. * references to be compared.
  27585. *
  27586. * @private
  27587. * @param {Object} object The object to compare.
  27588. * @param {Object} other The other object to compare.
  27589. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  27590. * @param {Function} customizer The function to customize comparisons.
  27591. * @param {Function} equalFunc The function to determine equivalents of values.
  27592. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  27593. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  27594. */
  27595. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  27596. var objIsArr = isArray(object),
  27597. othIsArr = isArray(other),
  27598. objTag = objIsArr ? arrayTag : getTag(object),
  27599. othTag = othIsArr ? arrayTag : getTag(other);
  27600. objTag = objTag == argsTag ? objectTag : objTag;
  27601. othTag = othTag == argsTag ? objectTag : othTag;
  27602. var objIsObj = objTag == objectTag,
  27603. othIsObj = othTag == objectTag,
  27604. isSameTag = objTag == othTag;
  27605. if (isSameTag && isBuffer(object)) {
  27606. if (!isBuffer(other)) {
  27607. return false;
  27608. }
  27609. objIsArr = true;
  27610. objIsObj = false;
  27611. }
  27612. if (isSameTag && !objIsObj) {
  27613. stack || (stack = new Stack);
  27614. return (objIsArr || isTypedArray(object))
  27615. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  27616. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  27617. }
  27618. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  27619. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  27620. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  27621. if (objIsWrapped || othIsWrapped) {
  27622. var objUnwrapped = objIsWrapped ? object.value() : object,
  27623. othUnwrapped = othIsWrapped ? other.value() : other;
  27624. stack || (stack = new Stack);
  27625. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  27626. }
  27627. }
  27628. if (!isSameTag) {
  27629. return false;
  27630. }
  27631. stack || (stack = new Stack);
  27632. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  27633. }
  27634. module.exports = baseIsEqualDeep;
  27635. },{"./_Stack":259,"./_equalArrays":347,"./_equalByTag":348,"./_equalObjects":349,"./_getTag":360,"./isArray":433,"./isBuffer":436,"./isTypedArray":446}],298:[function(require,module,exports){
  27636. var Stack = require('./_Stack'),
  27637. baseIsEqual = require('./_baseIsEqual');
  27638. /** Used to compose bitmasks for value comparisons. */
  27639. var COMPARE_PARTIAL_FLAG = 1,
  27640. COMPARE_UNORDERED_FLAG = 2;
  27641. /**
  27642. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  27643. *
  27644. * @private
  27645. * @param {Object} object The object to inspect.
  27646. * @param {Object} source The object of property values to match.
  27647. * @param {Array} matchData The property names, values, and compare flags to match.
  27648. * @param {Function} [customizer] The function to customize comparisons.
  27649. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  27650. */
  27651. function baseIsMatch(object, source, matchData, customizer) {
  27652. var index = matchData.length,
  27653. length = index,
  27654. noCustomizer = !customizer;
  27655. if (object == null) {
  27656. return !length;
  27657. }
  27658. object = Object(object);
  27659. while (index--) {
  27660. var data = matchData[index];
  27661. if ((noCustomizer && data[2])
  27662. ? data[1] !== object[data[0]]
  27663. : !(data[0] in object)
  27664. ) {
  27665. return false;
  27666. }
  27667. }
  27668. while (++index < length) {
  27669. data = matchData[index];
  27670. var key = data[0],
  27671. objValue = object[key],
  27672. srcValue = data[1];
  27673. if (noCustomizer && data[2]) {
  27674. if (objValue === undefined && !(key in object)) {
  27675. return false;
  27676. }
  27677. } else {
  27678. var stack = new Stack;
  27679. if (customizer) {
  27680. var result = customizer(objValue, srcValue, key, object, source, stack);
  27681. }
  27682. if (!(result === undefined
  27683. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  27684. : result
  27685. )) {
  27686. return false;
  27687. }
  27688. }
  27689. }
  27690. return true;
  27691. }
  27692. module.exports = baseIsMatch;
  27693. },{"./_Stack":259,"./_baseIsEqual":296}],299:[function(require,module,exports){
  27694. /**
  27695. * The base implementation of `_.isNaN` without support for number objects.
  27696. *
  27697. * @private
  27698. * @param {*} value The value to check.
  27699. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  27700. */
  27701. function baseIsNaN(value) {
  27702. return value !== value;
  27703. }
  27704. module.exports = baseIsNaN;
  27705. },{}],300:[function(require,module,exports){
  27706. var isFunction = require('./isFunction'),
  27707. isMasked = require('./_isMasked'),
  27708. isObject = require('./isObject'),
  27709. toSource = require('./_toSource');
  27710. /**
  27711. * Used to match `RegExp`
  27712. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  27713. */
  27714. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  27715. /** Used to detect host constructors (Safari). */
  27716. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  27717. /** Used for built-in method references. */
  27718. var funcProto = Function.prototype,
  27719. objectProto = Object.prototype;
  27720. /** Used to resolve the decompiled source of functions. */
  27721. var funcToString = funcProto.toString;
  27722. /** Used to check objects for own properties. */
  27723. var hasOwnProperty = objectProto.hasOwnProperty;
  27724. /** Used to detect if a method is native. */
  27725. var reIsNative = RegExp('^' +
  27726. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  27727. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  27728. );
  27729. /**
  27730. * The base implementation of `_.isNative` without bad shim checks.
  27731. *
  27732. * @private
  27733. * @param {*} value The value to check.
  27734. * @returns {boolean} Returns `true` if `value` is a native function,
  27735. * else `false`.
  27736. */
  27737. function baseIsNative(value) {
  27738. if (!isObject(value) || isMasked(value)) {
  27739. return false;
  27740. }
  27741. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  27742. return pattern.test(toSource(value));
  27743. }
  27744. module.exports = baseIsNative;
  27745. },{"./_isMasked":376,"./_toSource":413,"./isFunction":437,"./isObject":440}],301:[function(require,module,exports){
  27746. var baseGetTag = require('./_baseGetTag'),
  27747. isObjectLike = require('./isObjectLike');
  27748. /** `Object#toString` result references. */
  27749. var regexpTag = '[object RegExp]';
  27750. /**
  27751. * The base implementation of `_.isRegExp` without Node.js optimizations.
  27752. *
  27753. * @private
  27754. * @param {*} value The value to check.
  27755. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  27756. */
  27757. function baseIsRegExp(value) {
  27758. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  27759. }
  27760. module.exports = baseIsRegExp;
  27761. },{"./_baseGetTag":291,"./isObjectLike":441}],302:[function(require,module,exports){
  27762. var baseGetTag = require('./_baseGetTag'),
  27763. isLength = require('./isLength'),
  27764. isObjectLike = require('./isObjectLike');
  27765. /** `Object#toString` result references. */
  27766. var argsTag = '[object Arguments]',
  27767. arrayTag = '[object Array]',
  27768. boolTag = '[object Boolean]',
  27769. dateTag = '[object Date]',
  27770. errorTag = '[object Error]',
  27771. funcTag = '[object Function]',
  27772. mapTag = '[object Map]',
  27773. numberTag = '[object Number]',
  27774. objectTag = '[object Object]',
  27775. regexpTag = '[object RegExp]',
  27776. setTag = '[object Set]',
  27777. stringTag = '[object String]',
  27778. weakMapTag = '[object WeakMap]';
  27779. var arrayBufferTag = '[object ArrayBuffer]',
  27780. dataViewTag = '[object DataView]',
  27781. float32Tag = '[object Float32Array]',
  27782. float64Tag = '[object Float64Array]',
  27783. int8Tag = '[object Int8Array]',
  27784. int16Tag = '[object Int16Array]',
  27785. int32Tag = '[object Int32Array]',
  27786. uint8Tag = '[object Uint8Array]',
  27787. uint8ClampedTag = '[object Uint8ClampedArray]',
  27788. uint16Tag = '[object Uint16Array]',
  27789. uint32Tag = '[object Uint32Array]';
  27790. /** Used to identify `toStringTag` values of typed arrays. */
  27791. var typedArrayTags = {};
  27792. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  27793. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  27794. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  27795. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  27796. typedArrayTags[uint32Tag] = true;
  27797. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  27798. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  27799. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  27800. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  27801. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  27802. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  27803. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  27804. typedArrayTags[weakMapTag] = false;
  27805. /**
  27806. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  27807. *
  27808. * @private
  27809. * @param {*} value The value to check.
  27810. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  27811. */
  27812. function baseIsTypedArray(value) {
  27813. return isObjectLike(value) &&
  27814. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  27815. }
  27816. module.exports = baseIsTypedArray;
  27817. },{"./_baseGetTag":291,"./isLength":439,"./isObjectLike":441}],303:[function(require,module,exports){
  27818. var baseMatches = require('./_baseMatches'),
  27819. baseMatchesProperty = require('./_baseMatchesProperty'),
  27820. identity = require('./identity'),
  27821. isArray = require('./isArray'),
  27822. property = require('./property');
  27823. /**
  27824. * The base implementation of `_.iteratee`.
  27825. *
  27826. * @private
  27827. * @param {*} [value=_.identity] The value to convert to an iteratee.
  27828. * @returns {Function} Returns the iteratee.
  27829. */
  27830. function baseIteratee(value) {
  27831. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  27832. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  27833. if (typeof value == 'function') {
  27834. return value;
  27835. }
  27836. if (value == null) {
  27837. return identity;
  27838. }
  27839. if (typeof value == 'object') {
  27840. return isArray(value)
  27841. ? baseMatchesProperty(value[0], value[1])
  27842. : baseMatches(value);
  27843. }
  27844. return property(value);
  27845. }
  27846. module.exports = baseIteratee;
  27847. },{"./_baseMatches":307,"./_baseMatchesProperty":308,"./identity":430,"./isArray":433,"./property":453}],304:[function(require,module,exports){
  27848. var isPrototype = require('./_isPrototype'),
  27849. nativeKeys = require('./_nativeKeys');
  27850. /** Used for built-in method references. */
  27851. var objectProto = Object.prototype;
  27852. /** Used to check objects for own properties. */
  27853. var hasOwnProperty = objectProto.hasOwnProperty;
  27854. /**
  27855. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  27856. *
  27857. * @private
  27858. * @param {Object} object The object to query.
  27859. * @returns {Array} Returns the array of property names.
  27860. */
  27861. function baseKeys(object) {
  27862. if (!isPrototype(object)) {
  27863. return nativeKeys(object);
  27864. }
  27865. var result = [];
  27866. for (var key in Object(object)) {
  27867. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  27868. result.push(key);
  27869. }
  27870. }
  27871. return result;
  27872. }
  27873. module.exports = baseKeys;
  27874. },{"./_isPrototype":377,"./_nativeKeys":393}],305:[function(require,module,exports){
  27875. var isObject = require('./isObject'),
  27876. isPrototype = require('./_isPrototype'),
  27877. nativeKeysIn = require('./_nativeKeysIn');
  27878. /** Used for built-in method references. */
  27879. var objectProto = Object.prototype;
  27880. /** Used to check objects for own properties. */
  27881. var hasOwnProperty = objectProto.hasOwnProperty;
  27882. /**
  27883. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  27884. *
  27885. * @private
  27886. * @param {Object} object The object to query.
  27887. * @returns {Array} Returns the array of property names.
  27888. */
  27889. function baseKeysIn(object) {
  27890. if (!isObject(object)) {
  27891. return nativeKeysIn(object);
  27892. }
  27893. var isProto = isPrototype(object),
  27894. result = [];
  27895. for (var key in object) {
  27896. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  27897. result.push(key);
  27898. }
  27899. }
  27900. return result;
  27901. }
  27902. module.exports = baseKeysIn;
  27903. },{"./_isPrototype":377,"./_nativeKeysIn":394,"./isObject":440}],306:[function(require,module,exports){
  27904. var baseEach = require('./_baseEach'),
  27905. isArrayLike = require('./isArrayLike');
  27906. /**
  27907. * The base implementation of `_.map` without support for iteratee shorthands.
  27908. *
  27909. * @private
  27910. * @param {Array|Object} collection The collection to iterate over.
  27911. * @param {Function} iteratee The function invoked per iteration.
  27912. * @returns {Array} Returns the new mapped array.
  27913. */
  27914. function baseMap(collection, iteratee) {
  27915. var index = -1,
  27916. result = isArrayLike(collection) ? Array(collection.length) : [];
  27917. baseEach(collection, function(value, key, collection) {
  27918. result[++index] = iteratee(value, key, collection);
  27919. });
  27920. return result;
  27921. }
  27922. module.exports = baseMap;
  27923. },{"./_baseEach":284,"./isArrayLike":434}],307:[function(require,module,exports){
  27924. var baseIsMatch = require('./_baseIsMatch'),
  27925. getMatchData = require('./_getMatchData'),
  27926. matchesStrictComparable = require('./_matchesStrictComparable');
  27927. /**
  27928. * The base implementation of `_.matches` which doesn't clone `source`.
  27929. *
  27930. * @private
  27931. * @param {Object} source The object of property values to match.
  27932. * @returns {Function} Returns the new spec function.
  27933. */
  27934. function baseMatches(source) {
  27935. var matchData = getMatchData(source);
  27936. if (matchData.length == 1 && matchData[0][2]) {
  27937. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  27938. }
  27939. return function(object) {
  27940. return object === source || baseIsMatch(object, source, matchData);
  27941. };
  27942. }
  27943. module.exports = baseMatches;
  27944. },{"./_baseIsMatch":298,"./_getMatchData":354,"./_matchesStrictComparable":390}],308:[function(require,module,exports){
  27945. var baseIsEqual = require('./_baseIsEqual'),
  27946. get = require('./get'),
  27947. hasIn = require('./hasIn'),
  27948. isKey = require('./_isKey'),
  27949. isStrictComparable = require('./_isStrictComparable'),
  27950. matchesStrictComparable = require('./_matchesStrictComparable'),
  27951. toKey = require('./_toKey');
  27952. /** Used to compose bitmasks for value comparisons. */
  27953. var COMPARE_PARTIAL_FLAG = 1,
  27954. COMPARE_UNORDERED_FLAG = 2;
  27955. /**
  27956. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  27957. *
  27958. * @private
  27959. * @param {string} path The path of the property to get.
  27960. * @param {*} srcValue The value to match.
  27961. * @returns {Function} Returns the new spec function.
  27962. */
  27963. function baseMatchesProperty(path, srcValue) {
  27964. if (isKey(path) && isStrictComparable(srcValue)) {
  27965. return matchesStrictComparable(toKey(path), srcValue);
  27966. }
  27967. return function(object) {
  27968. var objValue = get(object, path);
  27969. return (objValue === undefined && objValue === srcValue)
  27970. ? hasIn(object, path)
  27971. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  27972. };
  27973. }
  27974. module.exports = baseMatchesProperty;
  27975. },{"./_baseIsEqual":296,"./_isKey":374,"./_isStrictComparable":378,"./_matchesStrictComparable":390,"./_toKey":412,"./get":427,"./hasIn":429}],309:[function(require,module,exports){
  27976. var Stack = require('./_Stack'),
  27977. assignMergeValue = require('./_assignMergeValue'),
  27978. baseFor = require('./_baseFor'),
  27979. baseMergeDeep = require('./_baseMergeDeep'),
  27980. isObject = require('./isObject'),
  27981. keysIn = require('./keysIn');
  27982. /**
  27983. * The base implementation of `_.merge` without support for multiple sources.
  27984. *
  27985. * @private
  27986. * @param {Object} object The destination object.
  27987. * @param {Object} source The source object.
  27988. * @param {number} srcIndex The index of `source`.
  27989. * @param {Function} [customizer] The function to customize merged values.
  27990. * @param {Object} [stack] Tracks traversed source values and their merged
  27991. * counterparts.
  27992. */
  27993. function baseMerge(object, source, srcIndex, customizer, stack) {
  27994. if (object === source) {
  27995. return;
  27996. }
  27997. baseFor(source, function(srcValue, key) {
  27998. if (isObject(srcValue)) {
  27999. stack || (stack = new Stack);
  28000. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  28001. }
  28002. else {
  28003. var newValue = customizer
  28004. ? customizer(object[key], srcValue, (key + ''), object, source, stack)
  28005. : undefined;
  28006. if (newValue === undefined) {
  28007. newValue = srcValue;
  28008. }
  28009. assignMergeValue(object, key, newValue);
  28010. }
  28011. }, keysIn);
  28012. }
  28013. module.exports = baseMerge;
  28014. },{"./_Stack":259,"./_assignMergeValue":275,"./_baseFor":287,"./_baseMergeDeep":310,"./isObject":440,"./keysIn":448}],310:[function(require,module,exports){
  28015. var assignMergeValue = require('./_assignMergeValue'),
  28016. cloneBuffer = require('./_cloneBuffer'),
  28017. cloneTypedArray = require('./_cloneTypedArray'),
  28018. copyArray = require('./_copyArray'),
  28019. initCloneObject = require('./_initCloneObject'),
  28020. isArguments = require('./isArguments'),
  28021. isArray = require('./isArray'),
  28022. isArrayLikeObject = require('./isArrayLikeObject'),
  28023. isBuffer = require('./isBuffer'),
  28024. isFunction = require('./isFunction'),
  28025. isObject = require('./isObject'),
  28026. isPlainObject = require('./isPlainObject'),
  28027. isTypedArray = require('./isTypedArray'),
  28028. toPlainObject = require('./toPlainObject');
  28029. /**
  28030. * A specialized version of `baseMerge` for arrays and objects which performs
  28031. * deep merges and tracks traversed objects enabling objects with circular
  28032. * references to be merged.
  28033. *
  28034. * @private
  28035. * @param {Object} object The destination object.
  28036. * @param {Object} source The source object.
  28037. * @param {string} key The key of the value to merge.
  28038. * @param {number} srcIndex The index of `source`.
  28039. * @param {Function} mergeFunc The function to merge values.
  28040. * @param {Function} [customizer] The function to customize assigned values.
  28041. * @param {Object} [stack] Tracks traversed source values and their merged
  28042. * counterparts.
  28043. */
  28044. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  28045. var objValue = object[key],
  28046. srcValue = source[key],
  28047. stacked = stack.get(srcValue);
  28048. if (stacked) {
  28049. assignMergeValue(object, key, stacked);
  28050. return;
  28051. }
  28052. var newValue = customizer
  28053. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  28054. : undefined;
  28055. var isCommon = newValue === undefined;
  28056. if (isCommon) {
  28057. var isArr = isArray(srcValue),
  28058. isBuff = !isArr && isBuffer(srcValue),
  28059. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  28060. newValue = srcValue;
  28061. if (isArr || isBuff || isTyped) {
  28062. if (isArray(objValue)) {
  28063. newValue = objValue;
  28064. }
  28065. else if (isArrayLikeObject(objValue)) {
  28066. newValue = copyArray(objValue);
  28067. }
  28068. else if (isBuff) {
  28069. isCommon = false;
  28070. newValue = cloneBuffer(srcValue, true);
  28071. }
  28072. else if (isTyped) {
  28073. isCommon = false;
  28074. newValue = cloneTypedArray(srcValue, true);
  28075. }
  28076. else {
  28077. newValue = [];
  28078. }
  28079. }
  28080. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  28081. newValue = objValue;
  28082. if (isArguments(objValue)) {
  28083. newValue = toPlainObject(objValue);
  28084. }
  28085. else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
  28086. newValue = initCloneObject(srcValue);
  28087. }
  28088. }
  28089. else {
  28090. isCommon = false;
  28091. }
  28092. }
  28093. if (isCommon) {
  28094. // Recursively merge objects and arrays (susceptible to call stack limits).
  28095. stack.set(srcValue, newValue);
  28096. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  28097. stack['delete'](srcValue);
  28098. }
  28099. assignMergeValue(object, key, newValue);
  28100. }
  28101. module.exports = baseMergeDeep;
  28102. },{"./_assignMergeValue":275,"./_cloneBuffer":326,"./_cloneTypedArray":332,"./_copyArray":335,"./_initCloneObject":370,"./isArguments":432,"./isArray":433,"./isArrayLikeObject":435,"./isBuffer":436,"./isFunction":437,"./isObject":440,"./isPlainObject":442,"./isTypedArray":446,"./toPlainObject":462}],311:[function(require,module,exports){
  28103. var arrayMap = require('./_arrayMap'),
  28104. baseIteratee = require('./_baseIteratee'),
  28105. baseMap = require('./_baseMap'),
  28106. baseSortBy = require('./_baseSortBy'),
  28107. baseUnary = require('./_baseUnary'),
  28108. compareMultiple = require('./_compareMultiple'),
  28109. identity = require('./identity');
  28110. /**
  28111. * The base implementation of `_.orderBy` without param guards.
  28112. *
  28113. * @private
  28114. * @param {Array|Object} collection The collection to iterate over.
  28115. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  28116. * @param {string[]} orders The sort orders of `iteratees`.
  28117. * @returns {Array} Returns the new sorted array.
  28118. */
  28119. function baseOrderBy(collection, iteratees, orders) {
  28120. var index = -1;
  28121. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(baseIteratee));
  28122. var result = baseMap(collection, function(value, key, collection) {
  28123. var criteria = arrayMap(iteratees, function(iteratee) {
  28124. return iteratee(value);
  28125. });
  28126. return { 'criteria': criteria, 'index': ++index, 'value': value };
  28127. });
  28128. return baseSortBy(result, function(object, other) {
  28129. return compareMultiple(object, other, orders);
  28130. });
  28131. }
  28132. module.exports = baseOrderBy;
  28133. },{"./_arrayMap":271,"./_baseIteratee":303,"./_baseMap":306,"./_baseSortBy":317,"./_baseUnary":320,"./_compareMultiple":334,"./identity":430}],312:[function(require,module,exports){
  28134. /**
  28135. * The base implementation of `_.property` without support for deep paths.
  28136. *
  28137. * @private
  28138. * @param {string} key The key of the property to get.
  28139. * @returns {Function} Returns the new accessor function.
  28140. */
  28141. function baseProperty(key) {
  28142. return function(object) {
  28143. return object == null ? undefined : object[key];
  28144. };
  28145. }
  28146. module.exports = baseProperty;
  28147. },{}],313:[function(require,module,exports){
  28148. var baseGet = require('./_baseGet');
  28149. /**
  28150. * A specialized version of `baseProperty` which supports deep paths.
  28151. *
  28152. * @private
  28153. * @param {Array|string} path The path of the property to get.
  28154. * @returns {Function} Returns the new accessor function.
  28155. */
  28156. function basePropertyDeep(path) {
  28157. return function(object) {
  28158. return baseGet(object, path);
  28159. };
  28160. }
  28161. module.exports = basePropertyDeep;
  28162. },{"./_baseGet":289}],314:[function(require,module,exports){
  28163. /** Used as references for various `Number` constants. */
  28164. var MAX_SAFE_INTEGER = 9007199254740991;
  28165. /* Built-in method references for those with the same name as other `lodash` methods. */
  28166. var nativeFloor = Math.floor;
  28167. /**
  28168. * The base implementation of `_.repeat` which doesn't coerce arguments.
  28169. *
  28170. * @private
  28171. * @param {string} string The string to repeat.
  28172. * @param {number} n The number of times to repeat the string.
  28173. * @returns {string} Returns the repeated string.
  28174. */
  28175. function baseRepeat(string, n) {
  28176. var result = '';
  28177. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  28178. return result;
  28179. }
  28180. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  28181. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  28182. do {
  28183. if (n % 2) {
  28184. result += string;
  28185. }
  28186. n = nativeFloor(n / 2);
  28187. if (n) {
  28188. string += string;
  28189. }
  28190. } while (n);
  28191. return result;
  28192. }
  28193. module.exports = baseRepeat;
  28194. },{}],315:[function(require,module,exports){
  28195. var identity = require('./identity'),
  28196. overRest = require('./_overRest'),
  28197. setToString = require('./_setToString');
  28198. /**
  28199. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  28200. *
  28201. * @private
  28202. * @param {Function} func The function to apply a rest parameter to.
  28203. * @param {number} [start=func.length-1] The start position of the rest parameter.
  28204. * @returns {Function} Returns the new function.
  28205. */
  28206. function baseRest(func, start) {
  28207. return setToString(overRest(func, start, identity), func + '');
  28208. }
  28209. module.exports = baseRest;
  28210. },{"./_overRest":398,"./_setToString":403,"./identity":430}],316:[function(require,module,exports){
  28211. var constant = require('./constant'),
  28212. defineProperty = require('./_defineProperty'),
  28213. identity = require('./identity');
  28214. /**
  28215. * The base implementation of `setToString` without support for hot loop shorting.
  28216. *
  28217. * @private
  28218. * @param {Function} func The function to modify.
  28219. * @param {Function} string The `toString` result.
  28220. * @returns {Function} Returns `func`.
  28221. */
  28222. var baseSetToString = !defineProperty ? identity : function(func, string) {
  28223. return defineProperty(func, 'toString', {
  28224. 'configurable': true,
  28225. 'enumerable': false,
  28226. 'value': constant(string),
  28227. 'writable': true
  28228. });
  28229. };
  28230. module.exports = baseSetToString;
  28231. },{"./_defineProperty":346,"./constant":419,"./identity":430}],317:[function(require,module,exports){
  28232. /**
  28233. * The base implementation of `_.sortBy` which uses `comparer` to define the
  28234. * sort order of `array` and replaces criteria objects with their corresponding
  28235. * values.
  28236. *
  28237. * @private
  28238. * @param {Array} array The array to sort.
  28239. * @param {Function} comparer The function to define sort order.
  28240. * @returns {Array} Returns `array`.
  28241. */
  28242. function baseSortBy(array, comparer) {
  28243. var length = array.length;
  28244. array.sort(comparer);
  28245. while (length--) {
  28246. array[length] = array[length].value;
  28247. }
  28248. return array;
  28249. }
  28250. module.exports = baseSortBy;
  28251. },{}],318:[function(require,module,exports){
  28252. /**
  28253. * The base implementation of `_.times` without support for iteratee shorthands
  28254. * or max array length checks.
  28255. *
  28256. * @private
  28257. * @param {number} n The number of times to invoke `iteratee`.
  28258. * @param {Function} iteratee The function invoked per iteration.
  28259. * @returns {Array} Returns the array of results.
  28260. */
  28261. function baseTimes(n, iteratee) {
  28262. var index = -1,
  28263. result = Array(n);
  28264. while (++index < n) {
  28265. result[index] = iteratee(index);
  28266. }
  28267. return result;
  28268. }
  28269. module.exports = baseTimes;
  28270. },{}],319:[function(require,module,exports){
  28271. var Symbol = require('./_Symbol'),
  28272. arrayMap = require('./_arrayMap'),
  28273. isArray = require('./isArray'),
  28274. isSymbol = require('./isSymbol');
  28275. /** Used as references for various `Number` constants. */
  28276. var INFINITY = 1 / 0;
  28277. /** Used to convert symbols to primitives and strings. */
  28278. var symbolProto = Symbol ? Symbol.prototype : undefined,
  28279. symbolToString = symbolProto ? symbolProto.toString : undefined;
  28280. /**
  28281. * The base implementation of `_.toString` which doesn't convert nullish
  28282. * values to empty strings.
  28283. *
  28284. * @private
  28285. * @param {*} value The value to process.
  28286. * @returns {string} Returns the string.
  28287. */
  28288. function baseToString(value) {
  28289. // Exit early for strings to avoid a performance hit in some environments.
  28290. if (typeof value == 'string') {
  28291. return value;
  28292. }
  28293. if (isArray(value)) {
  28294. // Recursively convert values (susceptible to call stack limits).
  28295. return arrayMap(value, baseToString) + '';
  28296. }
  28297. if (isSymbol(value)) {
  28298. return symbolToString ? symbolToString.call(value) : '';
  28299. }
  28300. var result = (value + '');
  28301. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  28302. }
  28303. module.exports = baseToString;
  28304. },{"./_Symbol":260,"./_arrayMap":271,"./isArray":433,"./isSymbol":445}],320:[function(require,module,exports){
  28305. /**
  28306. * The base implementation of `_.unary` without support for storing metadata.
  28307. *
  28308. * @private
  28309. * @param {Function} func The function to cap arguments for.
  28310. * @returns {Function} Returns the new capped function.
  28311. */
  28312. function baseUnary(func) {
  28313. return function(value) {
  28314. return func(value);
  28315. };
  28316. }
  28317. module.exports = baseUnary;
  28318. },{}],321:[function(require,module,exports){
  28319. var SetCache = require('./_SetCache'),
  28320. arrayIncludes = require('./_arrayIncludes'),
  28321. arrayIncludesWith = require('./_arrayIncludesWith'),
  28322. cacheHas = require('./_cacheHas'),
  28323. createSet = require('./_createSet'),
  28324. setToArray = require('./_setToArray');
  28325. /** Used as the size to enable large array optimizations. */
  28326. var LARGE_ARRAY_SIZE = 200;
  28327. /**
  28328. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  28329. *
  28330. * @private
  28331. * @param {Array} array The array to inspect.
  28332. * @param {Function} [iteratee] The iteratee invoked per element.
  28333. * @param {Function} [comparator] The comparator invoked per element.
  28334. * @returns {Array} Returns the new duplicate free array.
  28335. */
  28336. function baseUniq(array, iteratee, comparator) {
  28337. var index = -1,
  28338. includes = arrayIncludes,
  28339. length = array.length,
  28340. isCommon = true,
  28341. result = [],
  28342. seen = result;
  28343. if (comparator) {
  28344. isCommon = false;
  28345. includes = arrayIncludesWith;
  28346. }
  28347. else if (length >= LARGE_ARRAY_SIZE) {
  28348. var set = iteratee ? null : createSet(array);
  28349. if (set) {
  28350. return setToArray(set);
  28351. }
  28352. isCommon = false;
  28353. includes = cacheHas;
  28354. seen = new SetCache;
  28355. }
  28356. else {
  28357. seen = iteratee ? [] : result;
  28358. }
  28359. outer:
  28360. while (++index < length) {
  28361. var value = array[index],
  28362. computed = iteratee ? iteratee(value) : value;
  28363. value = (comparator || value !== 0) ? value : 0;
  28364. if (isCommon && computed === computed) {
  28365. var seenIndex = seen.length;
  28366. while (seenIndex--) {
  28367. if (seen[seenIndex] === computed) {
  28368. continue outer;
  28369. }
  28370. }
  28371. if (iteratee) {
  28372. seen.push(computed);
  28373. }
  28374. result.push(value);
  28375. }
  28376. else if (!includes(seen, computed, comparator)) {
  28377. if (seen !== result) {
  28378. seen.push(computed);
  28379. }
  28380. result.push(value);
  28381. }
  28382. }
  28383. return result;
  28384. }
  28385. module.exports = baseUniq;
  28386. },{"./_SetCache":258,"./_arrayIncludes":268,"./_arrayIncludesWith":269,"./_cacheHas":323,"./_createSet":344,"./_setToArray":402}],322:[function(require,module,exports){
  28387. var arrayMap = require('./_arrayMap');
  28388. /**
  28389. * The base implementation of `_.values` and `_.valuesIn` which creates an
  28390. * array of `object` property values corresponding to the property names
  28391. * of `props`.
  28392. *
  28393. * @private
  28394. * @param {Object} object The object to query.
  28395. * @param {Array} props The property names to get values for.
  28396. * @returns {Object} Returns the array of property values.
  28397. */
  28398. function baseValues(object, props) {
  28399. return arrayMap(props, function(key) {
  28400. return object[key];
  28401. });
  28402. }
  28403. module.exports = baseValues;
  28404. },{"./_arrayMap":271}],323:[function(require,module,exports){
  28405. /**
  28406. * Checks if a `cache` value for `key` exists.
  28407. *
  28408. * @private
  28409. * @param {Object} cache The cache to query.
  28410. * @param {string} key The key of the entry to check.
  28411. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  28412. */
  28413. function cacheHas(cache, key) {
  28414. return cache.has(key);
  28415. }
  28416. module.exports = cacheHas;
  28417. },{}],324:[function(require,module,exports){
  28418. var isArray = require('./isArray'),
  28419. isKey = require('./_isKey'),
  28420. stringToPath = require('./_stringToPath'),
  28421. toString = require('./toString');
  28422. /**
  28423. * Casts `value` to a path array if it's not one.
  28424. *
  28425. * @private
  28426. * @param {*} value The value to inspect.
  28427. * @param {Object} [object] The object to query keys on.
  28428. * @returns {Array} Returns the cast property path array.
  28429. */
  28430. function castPath(value, object) {
  28431. if (isArray(value)) {
  28432. return value;
  28433. }
  28434. return isKey(value, object) ? [value] : stringToPath(toString(value));
  28435. }
  28436. module.exports = castPath;
  28437. },{"./_isKey":374,"./_stringToPath":411,"./isArray":433,"./toString":463}],325:[function(require,module,exports){
  28438. var Uint8Array = require('./_Uint8Array');
  28439. /**
  28440. * Creates a clone of `arrayBuffer`.
  28441. *
  28442. * @private
  28443. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  28444. * @returns {ArrayBuffer} Returns the cloned array buffer.
  28445. */
  28446. function cloneArrayBuffer(arrayBuffer) {
  28447. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  28448. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  28449. return result;
  28450. }
  28451. module.exports = cloneArrayBuffer;
  28452. },{"./_Uint8Array":261}],326:[function(require,module,exports){
  28453. var root = require('./_root');
  28454. /** Detect free variable `exports`. */
  28455. var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
  28456. /** Detect free variable `module`. */
  28457. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  28458. /** Detect the popular CommonJS extension `module.exports`. */
  28459. var moduleExports = freeModule && freeModule.exports === freeExports;
  28460. /** Built-in value references. */
  28461. var Buffer = moduleExports ? root.Buffer : undefined,
  28462. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
  28463. /**
  28464. * Creates a clone of `buffer`.
  28465. *
  28466. * @private
  28467. * @param {Buffer} buffer The buffer to clone.
  28468. * @param {boolean} [isDeep] Specify a deep clone.
  28469. * @returns {Buffer} Returns the cloned buffer.
  28470. */
  28471. function cloneBuffer(buffer, isDeep) {
  28472. if (isDeep) {
  28473. return buffer.slice();
  28474. }
  28475. var length = buffer.length,
  28476. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  28477. buffer.copy(result);
  28478. return result;
  28479. }
  28480. module.exports = cloneBuffer;
  28481. },{"./_root":399}],327:[function(require,module,exports){
  28482. var cloneArrayBuffer = require('./_cloneArrayBuffer');
  28483. /**
  28484. * Creates a clone of `dataView`.
  28485. *
  28486. * @private
  28487. * @param {Object} dataView The data view to clone.
  28488. * @param {boolean} [isDeep] Specify a deep clone.
  28489. * @returns {Object} Returns the cloned data view.
  28490. */
  28491. function cloneDataView(dataView, isDeep) {
  28492. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  28493. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  28494. }
  28495. module.exports = cloneDataView;
  28496. },{"./_cloneArrayBuffer":325}],328:[function(require,module,exports){
  28497. var addMapEntry = require('./_addMapEntry'),
  28498. arrayReduce = require('./_arrayReduce'),
  28499. mapToArray = require('./_mapToArray');
  28500. /** Used to compose bitmasks for cloning. */
  28501. var CLONE_DEEP_FLAG = 1;
  28502. /**
  28503. * Creates a clone of `map`.
  28504. *
  28505. * @private
  28506. * @param {Object} map The map to clone.
  28507. * @param {Function} cloneFunc The function to clone values.
  28508. * @param {boolean} [isDeep] Specify a deep clone.
  28509. * @returns {Object} Returns the cloned map.
  28510. */
  28511. function cloneMap(map, isDeep, cloneFunc) {
  28512. var array = isDeep ? cloneFunc(mapToArray(map), CLONE_DEEP_FLAG) : mapToArray(map);
  28513. return arrayReduce(array, addMapEntry, new map.constructor);
  28514. }
  28515. module.exports = cloneMap;
  28516. },{"./_addMapEntry":263,"./_arrayReduce":273,"./_mapToArray":389}],329:[function(require,module,exports){
  28517. /** Used to match `RegExp` flags from their coerced string values. */
  28518. var reFlags = /\w*$/;
  28519. /**
  28520. * Creates a clone of `regexp`.
  28521. *
  28522. * @private
  28523. * @param {Object} regexp The regexp to clone.
  28524. * @returns {Object} Returns the cloned regexp.
  28525. */
  28526. function cloneRegExp(regexp) {
  28527. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  28528. result.lastIndex = regexp.lastIndex;
  28529. return result;
  28530. }
  28531. module.exports = cloneRegExp;
  28532. },{}],330:[function(require,module,exports){
  28533. var addSetEntry = require('./_addSetEntry'),
  28534. arrayReduce = require('./_arrayReduce'),
  28535. setToArray = require('./_setToArray');
  28536. /** Used to compose bitmasks for cloning. */
  28537. var CLONE_DEEP_FLAG = 1;
  28538. /**
  28539. * Creates a clone of `set`.
  28540. *
  28541. * @private
  28542. * @param {Object} set The set to clone.
  28543. * @param {Function} cloneFunc The function to clone values.
  28544. * @param {boolean} [isDeep] Specify a deep clone.
  28545. * @returns {Object} Returns the cloned set.
  28546. */
  28547. function cloneSet(set, isDeep, cloneFunc) {
  28548. var array = isDeep ? cloneFunc(setToArray(set), CLONE_DEEP_FLAG) : setToArray(set);
  28549. return arrayReduce(array, addSetEntry, new set.constructor);
  28550. }
  28551. module.exports = cloneSet;
  28552. },{"./_addSetEntry":264,"./_arrayReduce":273,"./_setToArray":402}],331:[function(require,module,exports){
  28553. var Symbol = require('./_Symbol');
  28554. /** Used to convert symbols to primitives and strings. */
  28555. var symbolProto = Symbol ? Symbol.prototype : undefined,
  28556. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
  28557. /**
  28558. * Creates a clone of the `symbol` object.
  28559. *
  28560. * @private
  28561. * @param {Object} symbol The symbol object to clone.
  28562. * @returns {Object} Returns the cloned symbol object.
  28563. */
  28564. function cloneSymbol(symbol) {
  28565. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  28566. }
  28567. module.exports = cloneSymbol;
  28568. },{"./_Symbol":260}],332:[function(require,module,exports){
  28569. var cloneArrayBuffer = require('./_cloneArrayBuffer');
  28570. /**
  28571. * Creates a clone of `typedArray`.
  28572. *
  28573. * @private
  28574. * @param {Object} typedArray The typed array to clone.
  28575. * @param {boolean} [isDeep] Specify a deep clone.
  28576. * @returns {Object} Returns the cloned typed array.
  28577. */
  28578. function cloneTypedArray(typedArray, isDeep) {
  28579. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  28580. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  28581. }
  28582. module.exports = cloneTypedArray;
  28583. },{"./_cloneArrayBuffer":325}],333:[function(require,module,exports){
  28584. var isSymbol = require('./isSymbol');
  28585. /**
  28586. * Compares values to sort them in ascending order.
  28587. *
  28588. * @private
  28589. * @param {*} value The value to compare.
  28590. * @param {*} other The other value to compare.
  28591. * @returns {number} Returns the sort order indicator for `value`.
  28592. */
  28593. function compareAscending(value, other) {
  28594. if (value !== other) {
  28595. var valIsDefined = value !== undefined,
  28596. valIsNull = value === null,
  28597. valIsReflexive = value === value,
  28598. valIsSymbol = isSymbol(value);
  28599. var othIsDefined = other !== undefined,
  28600. othIsNull = other === null,
  28601. othIsReflexive = other === other,
  28602. othIsSymbol = isSymbol(other);
  28603. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  28604. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  28605. (valIsNull && othIsDefined && othIsReflexive) ||
  28606. (!valIsDefined && othIsReflexive) ||
  28607. !valIsReflexive) {
  28608. return 1;
  28609. }
  28610. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  28611. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  28612. (othIsNull && valIsDefined && valIsReflexive) ||
  28613. (!othIsDefined && valIsReflexive) ||
  28614. !othIsReflexive) {
  28615. return -1;
  28616. }
  28617. }
  28618. return 0;
  28619. }
  28620. module.exports = compareAscending;
  28621. },{"./isSymbol":445}],334:[function(require,module,exports){
  28622. var compareAscending = require('./_compareAscending');
  28623. /**
  28624. * Used by `_.orderBy` to compare multiple properties of a value to another
  28625. * and stable sort them.
  28626. *
  28627. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  28628. * specify an order of "desc" for descending or "asc" for ascending sort order
  28629. * of corresponding values.
  28630. *
  28631. * @private
  28632. * @param {Object} object The object to compare.
  28633. * @param {Object} other The other object to compare.
  28634. * @param {boolean[]|string[]} orders The order to sort by for each property.
  28635. * @returns {number} Returns the sort order indicator for `object`.
  28636. */
  28637. function compareMultiple(object, other, orders) {
  28638. var index = -1,
  28639. objCriteria = object.criteria,
  28640. othCriteria = other.criteria,
  28641. length = objCriteria.length,
  28642. ordersLength = orders.length;
  28643. while (++index < length) {
  28644. var result = compareAscending(objCriteria[index], othCriteria[index]);
  28645. if (result) {
  28646. if (index >= ordersLength) {
  28647. return result;
  28648. }
  28649. var order = orders[index];
  28650. return result * (order == 'desc' ? -1 : 1);
  28651. }
  28652. }
  28653. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  28654. // that causes it, under certain circumstances, to provide the same value for
  28655. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  28656. // for more details.
  28657. //
  28658. // This also ensures a stable sort in V8 and other engines.
  28659. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  28660. return object.index - other.index;
  28661. }
  28662. module.exports = compareMultiple;
  28663. },{"./_compareAscending":333}],335:[function(require,module,exports){
  28664. /**
  28665. * Copies the values of `source` to `array`.
  28666. *
  28667. * @private
  28668. * @param {Array} source The array to copy values from.
  28669. * @param {Array} [array=[]] The array to copy values to.
  28670. * @returns {Array} Returns `array`.
  28671. */
  28672. function copyArray(source, array) {
  28673. var index = -1,
  28674. length = source.length;
  28675. array || (array = Array(length));
  28676. while (++index < length) {
  28677. array[index] = source[index];
  28678. }
  28679. return array;
  28680. }
  28681. module.exports = copyArray;
  28682. },{}],336:[function(require,module,exports){
  28683. var assignValue = require('./_assignValue'),
  28684. baseAssignValue = require('./_baseAssignValue');
  28685. /**
  28686. * Copies properties of `source` to `object`.
  28687. *
  28688. * @private
  28689. * @param {Object} source The object to copy properties from.
  28690. * @param {Array} props The property identifiers to copy.
  28691. * @param {Object} [object={}] The object to copy properties to.
  28692. * @param {Function} [customizer] The function to customize copied values.
  28693. * @returns {Object} Returns `object`.
  28694. */
  28695. function copyObject(source, props, object, customizer) {
  28696. var isNew = !object;
  28697. object || (object = {});
  28698. var index = -1,
  28699. length = props.length;
  28700. while (++index < length) {
  28701. var key = props[index];
  28702. var newValue = customizer
  28703. ? customizer(object[key], source[key], key, object, source)
  28704. : undefined;
  28705. if (newValue === undefined) {
  28706. newValue = source[key];
  28707. }
  28708. if (isNew) {
  28709. baseAssignValue(object, key, newValue);
  28710. } else {
  28711. assignValue(object, key, newValue);
  28712. }
  28713. }
  28714. return object;
  28715. }
  28716. module.exports = copyObject;
  28717. },{"./_assignValue":276,"./_baseAssignValue":280}],337:[function(require,module,exports){
  28718. var copyObject = require('./_copyObject'),
  28719. getSymbols = require('./_getSymbols');
  28720. /**
  28721. * Copies own symbols of `source` to `object`.
  28722. *
  28723. * @private
  28724. * @param {Object} source The object to copy symbols from.
  28725. * @param {Object} [object={}] The object to copy symbols to.
  28726. * @returns {Object} Returns `object`.
  28727. */
  28728. function copySymbols(source, object) {
  28729. return copyObject(source, getSymbols(source), object);
  28730. }
  28731. module.exports = copySymbols;
  28732. },{"./_copyObject":336,"./_getSymbols":358}],338:[function(require,module,exports){
  28733. var copyObject = require('./_copyObject'),
  28734. getSymbolsIn = require('./_getSymbolsIn');
  28735. /**
  28736. * Copies own and inherited symbols of `source` to `object`.
  28737. *
  28738. * @private
  28739. * @param {Object} source The object to copy symbols from.
  28740. * @param {Object} [object={}] The object to copy symbols to.
  28741. * @returns {Object} Returns `object`.
  28742. */
  28743. function copySymbolsIn(source, object) {
  28744. return copyObject(source, getSymbolsIn(source), object);
  28745. }
  28746. module.exports = copySymbolsIn;
  28747. },{"./_copyObject":336,"./_getSymbolsIn":359}],339:[function(require,module,exports){
  28748. var root = require('./_root');
  28749. /** Used to detect overreaching core-js shims. */
  28750. var coreJsData = root['__core-js_shared__'];
  28751. module.exports = coreJsData;
  28752. },{"./_root":399}],340:[function(require,module,exports){
  28753. var baseRest = require('./_baseRest'),
  28754. isIterateeCall = require('./_isIterateeCall');
  28755. /**
  28756. * Creates a function like `_.assign`.
  28757. *
  28758. * @private
  28759. * @param {Function} assigner The function to assign values.
  28760. * @returns {Function} Returns the new assigner function.
  28761. */
  28762. function createAssigner(assigner) {
  28763. return baseRest(function(object, sources) {
  28764. var index = -1,
  28765. length = sources.length,
  28766. customizer = length > 1 ? sources[length - 1] : undefined,
  28767. guard = length > 2 ? sources[2] : undefined;
  28768. customizer = (assigner.length > 3 && typeof customizer == 'function')
  28769. ? (length--, customizer)
  28770. : undefined;
  28771. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  28772. customizer = length < 3 ? undefined : customizer;
  28773. length = 1;
  28774. }
  28775. object = Object(object);
  28776. while (++index < length) {
  28777. var source = sources[index];
  28778. if (source) {
  28779. assigner(object, source, index, customizer);
  28780. }
  28781. }
  28782. return object;
  28783. });
  28784. }
  28785. module.exports = createAssigner;
  28786. },{"./_baseRest":315,"./_isIterateeCall":373}],341:[function(require,module,exports){
  28787. var isArrayLike = require('./isArrayLike');
  28788. /**
  28789. * Creates a `baseEach` or `baseEachRight` function.
  28790. *
  28791. * @private
  28792. * @param {Function} eachFunc The function to iterate over a collection.
  28793. * @param {boolean} [fromRight] Specify iterating from right to left.
  28794. * @returns {Function} Returns the new base function.
  28795. */
  28796. function createBaseEach(eachFunc, fromRight) {
  28797. return function(collection, iteratee) {
  28798. if (collection == null) {
  28799. return collection;
  28800. }
  28801. if (!isArrayLike(collection)) {
  28802. return eachFunc(collection, iteratee);
  28803. }
  28804. var length = collection.length,
  28805. index = fromRight ? length : -1,
  28806. iterable = Object(collection);
  28807. while ((fromRight ? index-- : ++index < length)) {
  28808. if (iteratee(iterable[index], index, iterable) === false) {
  28809. break;
  28810. }
  28811. }
  28812. return collection;
  28813. };
  28814. }
  28815. module.exports = createBaseEach;
  28816. },{"./isArrayLike":434}],342:[function(require,module,exports){
  28817. /**
  28818. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  28819. *
  28820. * @private
  28821. * @param {boolean} [fromRight] Specify iterating from right to left.
  28822. * @returns {Function} Returns the new base function.
  28823. */
  28824. function createBaseFor(fromRight) {
  28825. return function(object, iteratee, keysFunc) {
  28826. var index = -1,
  28827. iterable = Object(object),
  28828. props = keysFunc(object),
  28829. length = props.length;
  28830. while (length--) {
  28831. var key = props[fromRight ? length : ++index];
  28832. if (iteratee(iterable[key], key, iterable) === false) {
  28833. break;
  28834. }
  28835. }
  28836. return object;
  28837. };
  28838. }
  28839. module.exports = createBaseFor;
  28840. },{}],343:[function(require,module,exports){
  28841. var baseIteratee = require('./_baseIteratee'),
  28842. isArrayLike = require('./isArrayLike'),
  28843. keys = require('./keys');
  28844. /**
  28845. * Creates a `_.find` or `_.findLast` function.
  28846. *
  28847. * @private
  28848. * @param {Function} findIndexFunc The function to find the collection index.
  28849. * @returns {Function} Returns the new find function.
  28850. */
  28851. function createFind(findIndexFunc) {
  28852. return function(collection, predicate, fromIndex) {
  28853. var iterable = Object(collection);
  28854. if (!isArrayLike(collection)) {
  28855. var iteratee = baseIteratee(predicate, 3);
  28856. collection = keys(collection);
  28857. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  28858. }
  28859. var index = findIndexFunc(collection, predicate, fromIndex);
  28860. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  28861. };
  28862. }
  28863. module.exports = createFind;
  28864. },{"./_baseIteratee":303,"./isArrayLike":434,"./keys":447}],344:[function(require,module,exports){
  28865. var Set = require('./_Set'),
  28866. noop = require('./noop'),
  28867. setToArray = require('./_setToArray');
  28868. /** Used as references for various `Number` constants. */
  28869. var INFINITY = 1 / 0;
  28870. /**
  28871. * Creates a set object of `values`.
  28872. *
  28873. * @private
  28874. * @param {Array} values The values to add to the set.
  28875. * @returns {Object} Returns the new set.
  28876. */
  28877. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  28878. return new Set(values);
  28879. };
  28880. module.exports = createSet;
  28881. },{"./_Set":257,"./_setToArray":402,"./noop":452}],345:[function(require,module,exports){
  28882. var eq = require('./eq');
  28883. /** Used for built-in method references. */
  28884. var objectProto = Object.prototype;
  28885. /** Used to check objects for own properties. */
  28886. var hasOwnProperty = objectProto.hasOwnProperty;
  28887. /**
  28888. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  28889. * of source objects to the destination object for all destination properties
  28890. * that resolve to `undefined`.
  28891. *
  28892. * @private
  28893. * @param {*} objValue The destination value.
  28894. * @param {*} srcValue The source value.
  28895. * @param {string} key The key of the property to assign.
  28896. * @param {Object} object The parent object of `objValue`.
  28897. * @returns {*} Returns the value to assign.
  28898. */
  28899. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  28900. if (objValue === undefined ||
  28901. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  28902. return srcValue;
  28903. }
  28904. return objValue;
  28905. }
  28906. module.exports = customDefaultsAssignIn;
  28907. },{"./eq":421}],346:[function(require,module,exports){
  28908. var getNative = require('./_getNative');
  28909. var defineProperty = (function() {
  28910. try {
  28911. var func = getNative(Object, 'defineProperty');
  28912. func({}, '', {});
  28913. return func;
  28914. } catch (e) {}
  28915. }());
  28916. module.exports = defineProperty;
  28917. },{"./_getNative":355}],347:[function(require,module,exports){
  28918. var SetCache = require('./_SetCache'),
  28919. arraySome = require('./_arraySome'),
  28920. cacheHas = require('./_cacheHas');
  28921. /** Used to compose bitmasks for value comparisons. */
  28922. var COMPARE_PARTIAL_FLAG = 1,
  28923. COMPARE_UNORDERED_FLAG = 2;
  28924. /**
  28925. * A specialized version of `baseIsEqualDeep` for arrays with support for
  28926. * partial deep comparisons.
  28927. *
  28928. * @private
  28929. * @param {Array} array The array to compare.
  28930. * @param {Array} other The other array to compare.
  28931. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  28932. * @param {Function} customizer The function to customize comparisons.
  28933. * @param {Function} equalFunc The function to determine equivalents of values.
  28934. * @param {Object} stack Tracks traversed `array` and `other` objects.
  28935. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  28936. */
  28937. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  28938. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  28939. arrLength = array.length,
  28940. othLength = other.length;
  28941. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  28942. return false;
  28943. }
  28944. // Assume cyclic values are equal.
  28945. var stacked = stack.get(array);
  28946. if (stacked && stack.get(other)) {
  28947. return stacked == other;
  28948. }
  28949. var index = -1,
  28950. result = true,
  28951. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  28952. stack.set(array, other);
  28953. stack.set(other, array);
  28954. // Ignore non-index properties.
  28955. while (++index < arrLength) {
  28956. var arrValue = array[index],
  28957. othValue = other[index];
  28958. if (customizer) {
  28959. var compared = isPartial
  28960. ? customizer(othValue, arrValue, index, other, array, stack)
  28961. : customizer(arrValue, othValue, index, array, other, stack);
  28962. }
  28963. if (compared !== undefined) {
  28964. if (compared) {
  28965. continue;
  28966. }
  28967. result = false;
  28968. break;
  28969. }
  28970. // Recursively compare arrays (susceptible to call stack limits).
  28971. if (seen) {
  28972. if (!arraySome(other, function(othValue, othIndex) {
  28973. if (!cacheHas(seen, othIndex) &&
  28974. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  28975. return seen.push(othIndex);
  28976. }
  28977. })) {
  28978. result = false;
  28979. break;
  28980. }
  28981. } else if (!(
  28982. arrValue === othValue ||
  28983. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  28984. )) {
  28985. result = false;
  28986. break;
  28987. }
  28988. }
  28989. stack['delete'](array);
  28990. stack['delete'](other);
  28991. return result;
  28992. }
  28993. module.exports = equalArrays;
  28994. },{"./_SetCache":258,"./_arraySome":274,"./_cacheHas":323}],348:[function(require,module,exports){
  28995. var Symbol = require('./_Symbol'),
  28996. Uint8Array = require('./_Uint8Array'),
  28997. eq = require('./eq'),
  28998. equalArrays = require('./_equalArrays'),
  28999. mapToArray = require('./_mapToArray'),
  29000. setToArray = require('./_setToArray');
  29001. /** Used to compose bitmasks for value comparisons. */
  29002. var COMPARE_PARTIAL_FLAG = 1,
  29003. COMPARE_UNORDERED_FLAG = 2;
  29004. /** `Object#toString` result references. */
  29005. var boolTag = '[object Boolean]',
  29006. dateTag = '[object Date]',
  29007. errorTag = '[object Error]',
  29008. mapTag = '[object Map]',
  29009. numberTag = '[object Number]',
  29010. regexpTag = '[object RegExp]',
  29011. setTag = '[object Set]',
  29012. stringTag = '[object String]',
  29013. symbolTag = '[object Symbol]';
  29014. var arrayBufferTag = '[object ArrayBuffer]',
  29015. dataViewTag = '[object DataView]';
  29016. /** Used to convert symbols to primitives and strings. */
  29017. var symbolProto = Symbol ? Symbol.prototype : undefined,
  29018. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
  29019. /**
  29020. * A specialized version of `baseIsEqualDeep` for comparing objects of
  29021. * the same `toStringTag`.
  29022. *
  29023. * **Note:** This function only supports comparing values with tags of
  29024. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  29025. *
  29026. * @private
  29027. * @param {Object} object The object to compare.
  29028. * @param {Object} other The other object to compare.
  29029. * @param {string} tag The `toStringTag` of the objects to compare.
  29030. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  29031. * @param {Function} customizer The function to customize comparisons.
  29032. * @param {Function} equalFunc The function to determine equivalents of values.
  29033. * @param {Object} stack Tracks traversed `object` and `other` objects.
  29034. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  29035. */
  29036. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  29037. switch (tag) {
  29038. case dataViewTag:
  29039. if ((object.byteLength != other.byteLength) ||
  29040. (object.byteOffset != other.byteOffset)) {
  29041. return false;
  29042. }
  29043. object = object.buffer;
  29044. other = other.buffer;
  29045. case arrayBufferTag:
  29046. if ((object.byteLength != other.byteLength) ||
  29047. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  29048. return false;
  29049. }
  29050. return true;
  29051. case boolTag:
  29052. case dateTag:
  29053. case numberTag:
  29054. // Coerce booleans to `1` or `0` and dates to milliseconds.
  29055. // Invalid dates are coerced to `NaN`.
  29056. return eq(+object, +other);
  29057. case errorTag:
  29058. return object.name == other.name && object.message == other.message;
  29059. case regexpTag:
  29060. case stringTag:
  29061. // Coerce regexes to strings and treat strings, primitives and objects,
  29062. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  29063. // for more details.
  29064. return object == (other + '');
  29065. case mapTag:
  29066. var convert = mapToArray;
  29067. case setTag:
  29068. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  29069. convert || (convert = setToArray);
  29070. if (object.size != other.size && !isPartial) {
  29071. return false;
  29072. }
  29073. // Assume cyclic values are equal.
  29074. var stacked = stack.get(object);
  29075. if (stacked) {
  29076. return stacked == other;
  29077. }
  29078. bitmask |= COMPARE_UNORDERED_FLAG;
  29079. // Recursively compare objects (susceptible to call stack limits).
  29080. stack.set(object, other);
  29081. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  29082. stack['delete'](object);
  29083. return result;
  29084. case symbolTag:
  29085. if (symbolValueOf) {
  29086. return symbolValueOf.call(object) == symbolValueOf.call(other);
  29087. }
  29088. }
  29089. return false;
  29090. }
  29091. module.exports = equalByTag;
  29092. },{"./_Symbol":260,"./_Uint8Array":261,"./_equalArrays":347,"./_mapToArray":389,"./_setToArray":402,"./eq":421}],349:[function(require,module,exports){
  29093. var getAllKeys = require('./_getAllKeys');
  29094. /** Used to compose bitmasks for value comparisons. */
  29095. var COMPARE_PARTIAL_FLAG = 1;
  29096. /** Used for built-in method references. */
  29097. var objectProto = Object.prototype;
  29098. /** Used to check objects for own properties. */
  29099. var hasOwnProperty = objectProto.hasOwnProperty;
  29100. /**
  29101. * A specialized version of `baseIsEqualDeep` for objects with support for
  29102. * partial deep comparisons.
  29103. *
  29104. * @private
  29105. * @param {Object} object The object to compare.
  29106. * @param {Object} other The other object to compare.
  29107. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  29108. * @param {Function} customizer The function to customize comparisons.
  29109. * @param {Function} equalFunc The function to determine equivalents of values.
  29110. * @param {Object} stack Tracks traversed `object` and `other` objects.
  29111. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  29112. */
  29113. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  29114. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  29115. objProps = getAllKeys(object),
  29116. objLength = objProps.length,
  29117. othProps = getAllKeys(other),
  29118. othLength = othProps.length;
  29119. if (objLength != othLength && !isPartial) {
  29120. return false;
  29121. }
  29122. var index = objLength;
  29123. while (index--) {
  29124. var key = objProps[index];
  29125. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  29126. return false;
  29127. }
  29128. }
  29129. // Assume cyclic values are equal.
  29130. var stacked = stack.get(object);
  29131. if (stacked && stack.get(other)) {
  29132. return stacked == other;
  29133. }
  29134. var result = true;
  29135. stack.set(object, other);
  29136. stack.set(other, object);
  29137. var skipCtor = isPartial;
  29138. while (++index < objLength) {
  29139. key = objProps[index];
  29140. var objValue = object[key],
  29141. othValue = other[key];
  29142. if (customizer) {
  29143. var compared = isPartial
  29144. ? customizer(othValue, objValue, key, other, object, stack)
  29145. : customizer(objValue, othValue, key, object, other, stack);
  29146. }
  29147. // Recursively compare objects (susceptible to call stack limits).
  29148. if (!(compared === undefined
  29149. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  29150. : compared
  29151. )) {
  29152. result = false;
  29153. break;
  29154. }
  29155. skipCtor || (skipCtor = key == 'constructor');
  29156. }
  29157. if (result && !skipCtor) {
  29158. var objCtor = object.constructor,
  29159. othCtor = other.constructor;
  29160. // Non `Object` object instances with different constructors are not equal.
  29161. if (objCtor != othCtor &&
  29162. ('constructor' in object && 'constructor' in other) &&
  29163. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  29164. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  29165. result = false;
  29166. }
  29167. }
  29168. stack['delete'](object);
  29169. stack['delete'](other);
  29170. return result;
  29171. }
  29172. module.exports = equalObjects;
  29173. },{"./_getAllKeys":351}],350:[function(require,module,exports){
  29174. (function (global){
  29175. /** Detect free variable `global` from Node.js. */
  29176. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  29177. module.exports = freeGlobal;
  29178. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  29179. },{}],351:[function(require,module,exports){
  29180. var baseGetAllKeys = require('./_baseGetAllKeys'),
  29181. getSymbols = require('./_getSymbols'),
  29182. keys = require('./keys');
  29183. /**
  29184. * Creates an array of own enumerable property names and symbols of `object`.
  29185. *
  29186. * @private
  29187. * @param {Object} object The object to query.
  29188. * @returns {Array} Returns the array of property names and symbols.
  29189. */
  29190. function getAllKeys(object) {
  29191. return baseGetAllKeys(object, keys, getSymbols);
  29192. }
  29193. module.exports = getAllKeys;
  29194. },{"./_baseGetAllKeys":290,"./_getSymbols":358,"./keys":447}],352:[function(require,module,exports){
  29195. var baseGetAllKeys = require('./_baseGetAllKeys'),
  29196. getSymbolsIn = require('./_getSymbolsIn'),
  29197. keysIn = require('./keysIn');
  29198. /**
  29199. * Creates an array of own and inherited enumerable property names and
  29200. * symbols of `object`.
  29201. *
  29202. * @private
  29203. * @param {Object} object The object to query.
  29204. * @returns {Array} Returns the array of property names and symbols.
  29205. */
  29206. function getAllKeysIn(object) {
  29207. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  29208. }
  29209. module.exports = getAllKeysIn;
  29210. },{"./_baseGetAllKeys":290,"./_getSymbolsIn":359,"./keysIn":448}],353:[function(require,module,exports){
  29211. var isKeyable = require('./_isKeyable');
  29212. /**
  29213. * Gets the data for `map`.
  29214. *
  29215. * @private
  29216. * @param {Object} map The map to query.
  29217. * @param {string} key The reference key.
  29218. * @returns {*} Returns the map data.
  29219. */
  29220. function getMapData(map, key) {
  29221. var data = map.__data__;
  29222. return isKeyable(key)
  29223. ? data[typeof key == 'string' ? 'string' : 'hash']
  29224. : data.map;
  29225. }
  29226. module.exports = getMapData;
  29227. },{"./_isKeyable":375}],354:[function(require,module,exports){
  29228. var isStrictComparable = require('./_isStrictComparable'),
  29229. keys = require('./keys');
  29230. /**
  29231. * Gets the property names, values, and compare flags of `object`.
  29232. *
  29233. * @private
  29234. * @param {Object} object The object to query.
  29235. * @returns {Array} Returns the match data of `object`.
  29236. */
  29237. function getMatchData(object) {
  29238. var result = keys(object),
  29239. length = result.length;
  29240. while (length--) {
  29241. var key = result[length],
  29242. value = object[key];
  29243. result[length] = [key, value, isStrictComparable(value)];
  29244. }
  29245. return result;
  29246. }
  29247. module.exports = getMatchData;
  29248. },{"./_isStrictComparable":378,"./keys":447}],355:[function(require,module,exports){
  29249. var baseIsNative = require('./_baseIsNative'),
  29250. getValue = require('./_getValue');
  29251. /**
  29252. * Gets the native function at `key` of `object`.
  29253. *
  29254. * @private
  29255. * @param {Object} object The object to query.
  29256. * @param {string} key The key of the method to get.
  29257. * @returns {*} Returns the function if it's native, else `undefined`.
  29258. */
  29259. function getNative(object, key) {
  29260. var value = getValue(object, key);
  29261. return baseIsNative(value) ? value : undefined;
  29262. }
  29263. module.exports = getNative;
  29264. },{"./_baseIsNative":300,"./_getValue":361}],356:[function(require,module,exports){
  29265. var overArg = require('./_overArg');
  29266. /** Built-in value references. */
  29267. var getPrototype = overArg(Object.getPrototypeOf, Object);
  29268. module.exports = getPrototype;
  29269. },{"./_overArg":397}],357:[function(require,module,exports){
  29270. var Symbol = require('./_Symbol');
  29271. /** Used for built-in method references. */
  29272. var objectProto = Object.prototype;
  29273. /** Used to check objects for own properties. */
  29274. var hasOwnProperty = objectProto.hasOwnProperty;
  29275. /**
  29276. * Used to resolve the
  29277. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  29278. * of values.
  29279. */
  29280. var nativeObjectToString = objectProto.toString;
  29281. /** Built-in value references. */
  29282. var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  29283. /**
  29284. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  29285. *
  29286. * @private
  29287. * @param {*} value The value to query.
  29288. * @returns {string} Returns the raw `toStringTag`.
  29289. */
  29290. function getRawTag(value) {
  29291. var isOwn = hasOwnProperty.call(value, symToStringTag),
  29292. tag = value[symToStringTag];
  29293. try {
  29294. value[symToStringTag] = undefined;
  29295. var unmasked = true;
  29296. } catch (e) {}
  29297. var result = nativeObjectToString.call(value);
  29298. if (unmasked) {
  29299. if (isOwn) {
  29300. value[symToStringTag] = tag;
  29301. } else {
  29302. delete value[symToStringTag];
  29303. }
  29304. }
  29305. return result;
  29306. }
  29307. module.exports = getRawTag;
  29308. },{"./_Symbol":260}],358:[function(require,module,exports){
  29309. var arrayFilter = require('./_arrayFilter'),
  29310. stubArray = require('./stubArray');
  29311. /** Used for built-in method references. */
  29312. var objectProto = Object.prototype;
  29313. /** Built-in value references. */
  29314. var propertyIsEnumerable = objectProto.propertyIsEnumerable;
  29315. /* Built-in method references for those with the same name as other `lodash` methods. */
  29316. var nativeGetSymbols = Object.getOwnPropertySymbols;
  29317. /**
  29318. * Creates an array of the own enumerable symbols of `object`.
  29319. *
  29320. * @private
  29321. * @param {Object} object The object to query.
  29322. * @returns {Array} Returns the array of symbols.
  29323. */
  29324. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  29325. if (object == null) {
  29326. return [];
  29327. }
  29328. object = Object(object);
  29329. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  29330. return propertyIsEnumerable.call(object, symbol);
  29331. });
  29332. };
  29333. module.exports = getSymbols;
  29334. },{"./_arrayFilter":267,"./stubArray":457}],359:[function(require,module,exports){
  29335. var arrayPush = require('./_arrayPush'),
  29336. getPrototype = require('./_getPrototype'),
  29337. getSymbols = require('./_getSymbols'),
  29338. stubArray = require('./stubArray');
  29339. /* Built-in method references for those with the same name as other `lodash` methods. */
  29340. var nativeGetSymbols = Object.getOwnPropertySymbols;
  29341. /**
  29342. * Creates an array of the own and inherited enumerable symbols of `object`.
  29343. *
  29344. * @private
  29345. * @param {Object} object The object to query.
  29346. * @returns {Array} Returns the array of symbols.
  29347. */
  29348. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  29349. var result = [];
  29350. while (object) {
  29351. arrayPush(result, getSymbols(object));
  29352. object = getPrototype(object);
  29353. }
  29354. return result;
  29355. };
  29356. module.exports = getSymbolsIn;
  29357. },{"./_arrayPush":272,"./_getPrototype":356,"./_getSymbols":358,"./stubArray":457}],360:[function(require,module,exports){
  29358. var DataView = require('./_DataView'),
  29359. Map = require('./_Map'),
  29360. Promise = require('./_Promise'),
  29361. Set = require('./_Set'),
  29362. WeakMap = require('./_WeakMap'),
  29363. baseGetTag = require('./_baseGetTag'),
  29364. toSource = require('./_toSource');
  29365. /** `Object#toString` result references. */
  29366. var mapTag = '[object Map]',
  29367. objectTag = '[object Object]',
  29368. promiseTag = '[object Promise]',
  29369. setTag = '[object Set]',
  29370. weakMapTag = '[object WeakMap]';
  29371. var dataViewTag = '[object DataView]';
  29372. /** Used to detect maps, sets, and weakmaps. */
  29373. var dataViewCtorString = toSource(DataView),
  29374. mapCtorString = toSource(Map),
  29375. promiseCtorString = toSource(Promise),
  29376. setCtorString = toSource(Set),
  29377. weakMapCtorString = toSource(WeakMap);
  29378. /**
  29379. * Gets the `toStringTag` of `value`.
  29380. *
  29381. * @private
  29382. * @param {*} value The value to query.
  29383. * @returns {string} Returns the `toStringTag`.
  29384. */
  29385. var getTag = baseGetTag;
  29386. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  29387. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  29388. (Map && getTag(new Map) != mapTag) ||
  29389. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  29390. (Set && getTag(new Set) != setTag) ||
  29391. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  29392. getTag = function(value) {
  29393. var result = baseGetTag(value),
  29394. Ctor = result == objectTag ? value.constructor : undefined,
  29395. ctorString = Ctor ? toSource(Ctor) : '';
  29396. if (ctorString) {
  29397. switch (ctorString) {
  29398. case dataViewCtorString: return dataViewTag;
  29399. case mapCtorString: return mapTag;
  29400. case promiseCtorString: return promiseTag;
  29401. case setCtorString: return setTag;
  29402. case weakMapCtorString: return weakMapTag;
  29403. }
  29404. }
  29405. return result;
  29406. };
  29407. }
  29408. module.exports = getTag;
  29409. },{"./_DataView":251,"./_Map":254,"./_Promise":256,"./_Set":257,"./_WeakMap":262,"./_baseGetTag":291,"./_toSource":413}],361:[function(require,module,exports){
  29410. /**
  29411. * Gets the value at `key` of `object`.
  29412. *
  29413. * @private
  29414. * @param {Object} [object] The object to query.
  29415. * @param {string} key The key of the property to get.
  29416. * @returns {*} Returns the property value.
  29417. */
  29418. function getValue(object, key) {
  29419. return object == null ? undefined : object[key];
  29420. }
  29421. module.exports = getValue;
  29422. },{}],362:[function(require,module,exports){
  29423. var castPath = require('./_castPath'),
  29424. isArguments = require('./isArguments'),
  29425. isArray = require('./isArray'),
  29426. isIndex = require('./_isIndex'),
  29427. isLength = require('./isLength'),
  29428. toKey = require('./_toKey');
  29429. /**
  29430. * Checks if `path` exists on `object`.
  29431. *
  29432. * @private
  29433. * @param {Object} object The object to query.
  29434. * @param {Array|string} path The path to check.
  29435. * @param {Function} hasFunc The function to check properties.
  29436. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  29437. */
  29438. function hasPath(object, path, hasFunc) {
  29439. path = castPath(path, object);
  29440. var index = -1,
  29441. length = path.length,
  29442. result = false;
  29443. while (++index < length) {
  29444. var key = toKey(path[index]);
  29445. if (!(result = object != null && hasFunc(object, key))) {
  29446. break;
  29447. }
  29448. object = object[key];
  29449. }
  29450. if (result || ++index != length) {
  29451. return result;
  29452. }
  29453. length = object == null ? 0 : object.length;
  29454. return !!length && isLength(length) && isIndex(key, length) &&
  29455. (isArray(object) || isArguments(object));
  29456. }
  29457. module.exports = hasPath;
  29458. },{"./_castPath":324,"./_isIndex":372,"./_toKey":412,"./isArguments":432,"./isArray":433,"./isLength":439}],363:[function(require,module,exports){
  29459. var nativeCreate = require('./_nativeCreate');
  29460. /**
  29461. * Removes all key-value entries from the hash.
  29462. *
  29463. * @private
  29464. * @name clear
  29465. * @memberOf Hash
  29466. */
  29467. function hashClear() {
  29468. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  29469. this.size = 0;
  29470. }
  29471. module.exports = hashClear;
  29472. },{"./_nativeCreate":392}],364:[function(require,module,exports){
  29473. /**
  29474. * Removes `key` and its value from the hash.
  29475. *
  29476. * @private
  29477. * @name delete
  29478. * @memberOf Hash
  29479. * @param {Object} hash The hash to modify.
  29480. * @param {string} key The key of the value to remove.
  29481. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  29482. */
  29483. function hashDelete(key) {
  29484. var result = this.has(key) && delete this.__data__[key];
  29485. this.size -= result ? 1 : 0;
  29486. return result;
  29487. }
  29488. module.exports = hashDelete;
  29489. },{}],365:[function(require,module,exports){
  29490. var nativeCreate = require('./_nativeCreate');
  29491. /** Used to stand-in for `undefined` hash values. */
  29492. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  29493. /** Used for built-in method references. */
  29494. var objectProto = Object.prototype;
  29495. /** Used to check objects for own properties. */
  29496. var hasOwnProperty = objectProto.hasOwnProperty;
  29497. /**
  29498. * Gets the hash value for `key`.
  29499. *
  29500. * @private
  29501. * @name get
  29502. * @memberOf Hash
  29503. * @param {string} key The key of the value to get.
  29504. * @returns {*} Returns the entry value.
  29505. */
  29506. function hashGet(key) {
  29507. var data = this.__data__;
  29508. if (nativeCreate) {
  29509. var result = data[key];
  29510. return result === HASH_UNDEFINED ? undefined : result;
  29511. }
  29512. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  29513. }
  29514. module.exports = hashGet;
  29515. },{"./_nativeCreate":392}],366:[function(require,module,exports){
  29516. var nativeCreate = require('./_nativeCreate');
  29517. /** Used for built-in method references. */
  29518. var objectProto = Object.prototype;
  29519. /** Used to check objects for own properties. */
  29520. var hasOwnProperty = objectProto.hasOwnProperty;
  29521. /**
  29522. * Checks if a hash value for `key` exists.
  29523. *
  29524. * @private
  29525. * @name has
  29526. * @memberOf Hash
  29527. * @param {string} key The key of the entry to check.
  29528. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  29529. */
  29530. function hashHas(key) {
  29531. var data = this.__data__;
  29532. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  29533. }
  29534. module.exports = hashHas;
  29535. },{"./_nativeCreate":392}],367:[function(require,module,exports){
  29536. var nativeCreate = require('./_nativeCreate');
  29537. /** Used to stand-in for `undefined` hash values. */
  29538. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  29539. /**
  29540. * Sets the hash `key` to `value`.
  29541. *
  29542. * @private
  29543. * @name set
  29544. * @memberOf Hash
  29545. * @param {string} key The key of the value to set.
  29546. * @param {*} value The value to set.
  29547. * @returns {Object} Returns the hash instance.
  29548. */
  29549. function hashSet(key, value) {
  29550. var data = this.__data__;
  29551. this.size += this.has(key) ? 0 : 1;
  29552. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  29553. return this;
  29554. }
  29555. module.exports = hashSet;
  29556. },{"./_nativeCreate":392}],368:[function(require,module,exports){
  29557. /** Used for built-in method references. */
  29558. var objectProto = Object.prototype;
  29559. /** Used to check objects for own properties. */
  29560. var hasOwnProperty = objectProto.hasOwnProperty;
  29561. /**
  29562. * Initializes an array clone.
  29563. *
  29564. * @private
  29565. * @param {Array} array The array to clone.
  29566. * @returns {Array} Returns the initialized clone.
  29567. */
  29568. function initCloneArray(array) {
  29569. var length = array.length,
  29570. result = array.constructor(length);
  29571. // Add properties assigned by `RegExp#exec`.
  29572. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  29573. result.index = array.index;
  29574. result.input = array.input;
  29575. }
  29576. return result;
  29577. }
  29578. module.exports = initCloneArray;
  29579. },{}],369:[function(require,module,exports){
  29580. var cloneArrayBuffer = require('./_cloneArrayBuffer'),
  29581. cloneDataView = require('./_cloneDataView'),
  29582. cloneMap = require('./_cloneMap'),
  29583. cloneRegExp = require('./_cloneRegExp'),
  29584. cloneSet = require('./_cloneSet'),
  29585. cloneSymbol = require('./_cloneSymbol'),
  29586. cloneTypedArray = require('./_cloneTypedArray');
  29587. /** `Object#toString` result references. */
  29588. var boolTag = '[object Boolean]',
  29589. dateTag = '[object Date]',
  29590. mapTag = '[object Map]',
  29591. numberTag = '[object Number]',
  29592. regexpTag = '[object RegExp]',
  29593. setTag = '[object Set]',
  29594. stringTag = '[object String]',
  29595. symbolTag = '[object Symbol]';
  29596. var arrayBufferTag = '[object ArrayBuffer]',
  29597. dataViewTag = '[object DataView]',
  29598. float32Tag = '[object Float32Array]',
  29599. float64Tag = '[object Float64Array]',
  29600. int8Tag = '[object Int8Array]',
  29601. int16Tag = '[object Int16Array]',
  29602. int32Tag = '[object Int32Array]',
  29603. uint8Tag = '[object Uint8Array]',
  29604. uint8ClampedTag = '[object Uint8ClampedArray]',
  29605. uint16Tag = '[object Uint16Array]',
  29606. uint32Tag = '[object Uint32Array]';
  29607. /**
  29608. * Initializes an object clone based on its `toStringTag`.
  29609. *
  29610. * **Note:** This function only supports cloning values with tags of
  29611. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  29612. *
  29613. * @private
  29614. * @param {Object} object The object to clone.
  29615. * @param {string} tag The `toStringTag` of the object to clone.
  29616. * @param {Function} cloneFunc The function to clone values.
  29617. * @param {boolean} [isDeep] Specify a deep clone.
  29618. * @returns {Object} Returns the initialized clone.
  29619. */
  29620. function initCloneByTag(object, tag, cloneFunc, isDeep) {
  29621. var Ctor = object.constructor;
  29622. switch (tag) {
  29623. case arrayBufferTag:
  29624. return cloneArrayBuffer(object);
  29625. case boolTag:
  29626. case dateTag:
  29627. return new Ctor(+object);
  29628. case dataViewTag:
  29629. return cloneDataView(object, isDeep);
  29630. case float32Tag: case float64Tag:
  29631. case int8Tag: case int16Tag: case int32Tag:
  29632. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  29633. return cloneTypedArray(object, isDeep);
  29634. case mapTag:
  29635. return cloneMap(object, isDeep, cloneFunc);
  29636. case numberTag:
  29637. case stringTag:
  29638. return new Ctor(object);
  29639. case regexpTag:
  29640. return cloneRegExp(object);
  29641. case setTag:
  29642. return cloneSet(object, isDeep, cloneFunc);
  29643. case symbolTag:
  29644. return cloneSymbol(object);
  29645. }
  29646. }
  29647. module.exports = initCloneByTag;
  29648. },{"./_cloneArrayBuffer":325,"./_cloneDataView":327,"./_cloneMap":328,"./_cloneRegExp":329,"./_cloneSet":330,"./_cloneSymbol":331,"./_cloneTypedArray":332}],370:[function(require,module,exports){
  29649. var baseCreate = require('./_baseCreate'),
  29650. getPrototype = require('./_getPrototype'),
  29651. isPrototype = require('./_isPrototype');
  29652. /**
  29653. * Initializes an object clone.
  29654. *
  29655. * @private
  29656. * @param {Object} object The object to clone.
  29657. * @returns {Object} Returns the initialized clone.
  29658. */
  29659. function initCloneObject(object) {
  29660. return (typeof object.constructor == 'function' && !isPrototype(object))
  29661. ? baseCreate(getPrototype(object))
  29662. : {};
  29663. }
  29664. module.exports = initCloneObject;
  29665. },{"./_baseCreate":283,"./_getPrototype":356,"./_isPrototype":377}],371:[function(require,module,exports){
  29666. var Symbol = require('./_Symbol'),
  29667. isArguments = require('./isArguments'),
  29668. isArray = require('./isArray');
  29669. /** Built-in value references. */
  29670. var spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
  29671. /**
  29672. * Checks if `value` is a flattenable `arguments` object or array.
  29673. *
  29674. * @private
  29675. * @param {*} value The value to check.
  29676. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  29677. */
  29678. function isFlattenable(value) {
  29679. return isArray(value) || isArguments(value) ||
  29680. !!(spreadableSymbol && value && value[spreadableSymbol]);
  29681. }
  29682. module.exports = isFlattenable;
  29683. },{"./_Symbol":260,"./isArguments":432,"./isArray":433}],372:[function(require,module,exports){
  29684. /** Used as references for various `Number` constants. */
  29685. var MAX_SAFE_INTEGER = 9007199254740991;
  29686. /** Used to detect unsigned integer values. */
  29687. var reIsUint = /^(?:0|[1-9]\d*)$/;
  29688. /**
  29689. * Checks if `value` is a valid array-like index.
  29690. *
  29691. * @private
  29692. * @param {*} value The value to check.
  29693. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  29694. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  29695. */
  29696. function isIndex(value, length) {
  29697. length = length == null ? MAX_SAFE_INTEGER : length;
  29698. return !!length &&
  29699. (typeof value == 'number' || reIsUint.test(value)) &&
  29700. (value > -1 && value % 1 == 0 && value < length);
  29701. }
  29702. module.exports = isIndex;
  29703. },{}],373:[function(require,module,exports){
  29704. var eq = require('./eq'),
  29705. isArrayLike = require('./isArrayLike'),
  29706. isIndex = require('./_isIndex'),
  29707. isObject = require('./isObject');
  29708. /**
  29709. * Checks if the given arguments are from an iteratee call.
  29710. *
  29711. * @private
  29712. * @param {*} value The potential iteratee value argument.
  29713. * @param {*} index The potential iteratee index or key argument.
  29714. * @param {*} object The potential iteratee object argument.
  29715. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  29716. * else `false`.
  29717. */
  29718. function isIterateeCall(value, index, object) {
  29719. if (!isObject(object)) {
  29720. return false;
  29721. }
  29722. var type = typeof index;
  29723. if (type == 'number'
  29724. ? (isArrayLike(object) && isIndex(index, object.length))
  29725. : (type == 'string' && index in object)
  29726. ) {
  29727. return eq(object[index], value);
  29728. }
  29729. return false;
  29730. }
  29731. module.exports = isIterateeCall;
  29732. },{"./_isIndex":372,"./eq":421,"./isArrayLike":434,"./isObject":440}],374:[function(require,module,exports){
  29733. var isArray = require('./isArray'),
  29734. isSymbol = require('./isSymbol');
  29735. /** Used to match property names within property paths. */
  29736. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  29737. reIsPlainProp = /^\w*$/;
  29738. /**
  29739. * Checks if `value` is a property name and not a property path.
  29740. *
  29741. * @private
  29742. * @param {*} value The value to check.
  29743. * @param {Object} [object] The object to query keys on.
  29744. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  29745. */
  29746. function isKey(value, object) {
  29747. if (isArray(value)) {
  29748. return false;
  29749. }
  29750. var type = typeof value;
  29751. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  29752. value == null || isSymbol(value)) {
  29753. return true;
  29754. }
  29755. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  29756. (object != null && value in Object(object));
  29757. }
  29758. module.exports = isKey;
  29759. },{"./isArray":433,"./isSymbol":445}],375:[function(require,module,exports){
  29760. /**
  29761. * Checks if `value` is suitable for use as unique object key.
  29762. *
  29763. * @private
  29764. * @param {*} value The value to check.
  29765. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  29766. */
  29767. function isKeyable(value) {
  29768. var type = typeof value;
  29769. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  29770. ? (value !== '__proto__')
  29771. : (value === null);
  29772. }
  29773. module.exports = isKeyable;
  29774. },{}],376:[function(require,module,exports){
  29775. var coreJsData = require('./_coreJsData');
  29776. /** Used to detect methods masquerading as native. */
  29777. var maskSrcKey = (function() {
  29778. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  29779. return uid ? ('Symbol(src)_1.' + uid) : '';
  29780. }());
  29781. /**
  29782. * Checks if `func` has its source masked.
  29783. *
  29784. * @private
  29785. * @param {Function} func The function to check.
  29786. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  29787. */
  29788. function isMasked(func) {
  29789. return !!maskSrcKey && (maskSrcKey in func);
  29790. }
  29791. module.exports = isMasked;
  29792. },{"./_coreJsData":339}],377:[function(require,module,exports){
  29793. /** Used for built-in method references. */
  29794. var objectProto = Object.prototype;
  29795. /**
  29796. * Checks if `value` is likely a prototype object.
  29797. *
  29798. * @private
  29799. * @param {*} value The value to check.
  29800. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  29801. */
  29802. function isPrototype(value) {
  29803. var Ctor = value && value.constructor,
  29804. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  29805. return value === proto;
  29806. }
  29807. module.exports = isPrototype;
  29808. },{}],378:[function(require,module,exports){
  29809. var isObject = require('./isObject');
  29810. /**
  29811. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  29812. *
  29813. * @private
  29814. * @param {*} value The value to check.
  29815. * @returns {boolean} Returns `true` if `value` if suitable for strict
  29816. * equality comparisons, else `false`.
  29817. */
  29818. function isStrictComparable(value) {
  29819. return value === value && !isObject(value);
  29820. }
  29821. module.exports = isStrictComparable;
  29822. },{"./isObject":440}],379:[function(require,module,exports){
  29823. /**
  29824. * Removes all key-value entries from the list cache.
  29825. *
  29826. * @private
  29827. * @name clear
  29828. * @memberOf ListCache
  29829. */
  29830. function listCacheClear() {
  29831. this.__data__ = [];
  29832. this.size = 0;
  29833. }
  29834. module.exports = listCacheClear;
  29835. },{}],380:[function(require,module,exports){
  29836. var assocIndexOf = require('./_assocIndexOf');
  29837. /** Used for built-in method references. */
  29838. var arrayProto = Array.prototype;
  29839. /** Built-in value references. */
  29840. var splice = arrayProto.splice;
  29841. /**
  29842. * Removes `key` and its value from the list cache.
  29843. *
  29844. * @private
  29845. * @name delete
  29846. * @memberOf ListCache
  29847. * @param {string} key The key of the value to remove.
  29848. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  29849. */
  29850. function listCacheDelete(key) {
  29851. var data = this.__data__,
  29852. index = assocIndexOf(data, key);
  29853. if (index < 0) {
  29854. return false;
  29855. }
  29856. var lastIndex = data.length - 1;
  29857. if (index == lastIndex) {
  29858. data.pop();
  29859. } else {
  29860. splice.call(data, index, 1);
  29861. }
  29862. --this.size;
  29863. return true;
  29864. }
  29865. module.exports = listCacheDelete;
  29866. },{"./_assocIndexOf":277}],381:[function(require,module,exports){
  29867. var assocIndexOf = require('./_assocIndexOf');
  29868. /**
  29869. * Gets the list cache value for `key`.
  29870. *
  29871. * @private
  29872. * @name get
  29873. * @memberOf ListCache
  29874. * @param {string} key The key of the value to get.
  29875. * @returns {*} Returns the entry value.
  29876. */
  29877. function listCacheGet(key) {
  29878. var data = this.__data__,
  29879. index = assocIndexOf(data, key);
  29880. return index < 0 ? undefined : data[index][1];
  29881. }
  29882. module.exports = listCacheGet;
  29883. },{"./_assocIndexOf":277}],382:[function(require,module,exports){
  29884. var assocIndexOf = require('./_assocIndexOf');
  29885. /**
  29886. * Checks if a list cache value for `key` exists.
  29887. *
  29888. * @private
  29889. * @name has
  29890. * @memberOf ListCache
  29891. * @param {string} key The key of the entry to check.
  29892. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  29893. */
  29894. function listCacheHas(key) {
  29895. return assocIndexOf(this.__data__, key) > -1;
  29896. }
  29897. module.exports = listCacheHas;
  29898. },{"./_assocIndexOf":277}],383:[function(require,module,exports){
  29899. var assocIndexOf = require('./_assocIndexOf');
  29900. /**
  29901. * Sets the list cache `key` to `value`.
  29902. *
  29903. * @private
  29904. * @name set
  29905. * @memberOf ListCache
  29906. * @param {string} key The key of the value to set.
  29907. * @param {*} value The value to set.
  29908. * @returns {Object} Returns the list cache instance.
  29909. */
  29910. function listCacheSet(key, value) {
  29911. var data = this.__data__,
  29912. index = assocIndexOf(data, key);
  29913. if (index < 0) {
  29914. ++this.size;
  29915. data.push([key, value]);
  29916. } else {
  29917. data[index][1] = value;
  29918. }
  29919. return this;
  29920. }
  29921. module.exports = listCacheSet;
  29922. },{"./_assocIndexOf":277}],384:[function(require,module,exports){
  29923. var Hash = require('./_Hash'),
  29924. ListCache = require('./_ListCache'),
  29925. Map = require('./_Map');
  29926. /**
  29927. * Removes all key-value entries from the map.
  29928. *
  29929. * @private
  29930. * @name clear
  29931. * @memberOf MapCache
  29932. */
  29933. function mapCacheClear() {
  29934. this.size = 0;
  29935. this.__data__ = {
  29936. 'hash': new Hash,
  29937. 'map': new (Map || ListCache),
  29938. 'string': new Hash
  29939. };
  29940. }
  29941. module.exports = mapCacheClear;
  29942. },{"./_Hash":252,"./_ListCache":253,"./_Map":254}],385:[function(require,module,exports){
  29943. var getMapData = require('./_getMapData');
  29944. /**
  29945. * Removes `key` and its value from the map.
  29946. *
  29947. * @private
  29948. * @name delete
  29949. * @memberOf MapCache
  29950. * @param {string} key The key of the value to remove.
  29951. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  29952. */
  29953. function mapCacheDelete(key) {
  29954. var result = getMapData(this, key)['delete'](key);
  29955. this.size -= result ? 1 : 0;
  29956. return result;
  29957. }
  29958. module.exports = mapCacheDelete;
  29959. },{"./_getMapData":353}],386:[function(require,module,exports){
  29960. var getMapData = require('./_getMapData');
  29961. /**
  29962. * Gets the map value for `key`.
  29963. *
  29964. * @private
  29965. * @name get
  29966. * @memberOf MapCache
  29967. * @param {string} key The key of the value to get.
  29968. * @returns {*} Returns the entry value.
  29969. */
  29970. function mapCacheGet(key) {
  29971. return getMapData(this, key).get(key);
  29972. }
  29973. module.exports = mapCacheGet;
  29974. },{"./_getMapData":353}],387:[function(require,module,exports){
  29975. var getMapData = require('./_getMapData');
  29976. /**
  29977. * Checks if a map value for `key` exists.
  29978. *
  29979. * @private
  29980. * @name has
  29981. * @memberOf MapCache
  29982. * @param {string} key The key of the entry to check.
  29983. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  29984. */
  29985. function mapCacheHas(key) {
  29986. return getMapData(this, key).has(key);
  29987. }
  29988. module.exports = mapCacheHas;
  29989. },{"./_getMapData":353}],388:[function(require,module,exports){
  29990. var getMapData = require('./_getMapData');
  29991. /**
  29992. * Sets the map `key` to `value`.
  29993. *
  29994. * @private
  29995. * @name set
  29996. * @memberOf MapCache
  29997. * @param {string} key The key of the value to set.
  29998. * @param {*} value The value to set.
  29999. * @returns {Object} Returns the map cache instance.
  30000. */
  30001. function mapCacheSet(key, value) {
  30002. var data = getMapData(this, key),
  30003. size = data.size;
  30004. data.set(key, value);
  30005. this.size += data.size == size ? 0 : 1;
  30006. return this;
  30007. }
  30008. module.exports = mapCacheSet;
  30009. },{"./_getMapData":353}],389:[function(require,module,exports){
  30010. /**
  30011. * Converts `map` to its key-value pairs.
  30012. *
  30013. * @private
  30014. * @param {Object} map The map to convert.
  30015. * @returns {Array} Returns the key-value pairs.
  30016. */
  30017. function mapToArray(map) {
  30018. var index = -1,
  30019. result = Array(map.size);
  30020. map.forEach(function(value, key) {
  30021. result[++index] = [key, value];
  30022. });
  30023. return result;
  30024. }
  30025. module.exports = mapToArray;
  30026. },{}],390:[function(require,module,exports){
  30027. /**
  30028. * A specialized version of `matchesProperty` for source values suitable
  30029. * for strict equality comparisons, i.e. `===`.
  30030. *
  30031. * @private
  30032. * @param {string} key The key of the property to get.
  30033. * @param {*} srcValue The value to match.
  30034. * @returns {Function} Returns the new spec function.
  30035. */
  30036. function matchesStrictComparable(key, srcValue) {
  30037. return function(object) {
  30038. if (object == null) {
  30039. return false;
  30040. }
  30041. return object[key] === srcValue &&
  30042. (srcValue !== undefined || (key in Object(object)));
  30043. };
  30044. }
  30045. module.exports = matchesStrictComparable;
  30046. },{}],391:[function(require,module,exports){
  30047. var memoize = require('./memoize');
  30048. /** Used as the maximum memoize cache size. */
  30049. var MAX_MEMOIZE_SIZE = 500;
  30050. /**
  30051. * A specialized version of `_.memoize` which clears the memoized function's
  30052. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  30053. *
  30054. * @private
  30055. * @param {Function} func The function to have its output memoized.
  30056. * @returns {Function} Returns the new memoized function.
  30057. */
  30058. function memoizeCapped(func) {
  30059. var result = memoize(func, function(key) {
  30060. if (cache.size === MAX_MEMOIZE_SIZE) {
  30061. cache.clear();
  30062. }
  30063. return key;
  30064. });
  30065. var cache = result.cache;
  30066. return result;
  30067. }
  30068. module.exports = memoizeCapped;
  30069. },{"./memoize":450}],392:[function(require,module,exports){
  30070. var getNative = require('./_getNative');
  30071. /* Built-in method references that are verified to be native. */
  30072. var nativeCreate = getNative(Object, 'create');
  30073. module.exports = nativeCreate;
  30074. },{"./_getNative":355}],393:[function(require,module,exports){
  30075. var overArg = require('./_overArg');
  30076. /* Built-in method references for those with the same name as other `lodash` methods. */
  30077. var nativeKeys = overArg(Object.keys, Object);
  30078. module.exports = nativeKeys;
  30079. },{"./_overArg":397}],394:[function(require,module,exports){
  30080. /**
  30081. * This function is like
  30082. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  30083. * except that it includes inherited enumerable properties.
  30084. *
  30085. * @private
  30086. * @param {Object} object The object to query.
  30087. * @returns {Array} Returns the array of property names.
  30088. */
  30089. function nativeKeysIn(object) {
  30090. var result = [];
  30091. if (object != null) {
  30092. for (var key in Object(object)) {
  30093. result.push(key);
  30094. }
  30095. }
  30096. return result;
  30097. }
  30098. module.exports = nativeKeysIn;
  30099. },{}],395:[function(require,module,exports){
  30100. var freeGlobal = require('./_freeGlobal');
  30101. /** Detect free variable `exports`. */
  30102. var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
  30103. /** Detect free variable `module`. */
  30104. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  30105. /** Detect the popular CommonJS extension `module.exports`. */
  30106. var moduleExports = freeModule && freeModule.exports === freeExports;
  30107. /** Detect free variable `process` from Node.js. */
  30108. var freeProcess = moduleExports && freeGlobal.process;
  30109. /** Used to access faster Node.js helpers. */
  30110. var nodeUtil = (function() {
  30111. try {
  30112. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  30113. } catch (e) {}
  30114. }());
  30115. module.exports = nodeUtil;
  30116. },{"./_freeGlobal":350}],396:[function(require,module,exports){
  30117. /** Used for built-in method references. */
  30118. var objectProto = Object.prototype;
  30119. /**
  30120. * Used to resolve the
  30121. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  30122. * of values.
  30123. */
  30124. var nativeObjectToString = objectProto.toString;
  30125. /**
  30126. * Converts `value` to a string using `Object.prototype.toString`.
  30127. *
  30128. * @private
  30129. * @param {*} value The value to convert.
  30130. * @returns {string} Returns the converted string.
  30131. */
  30132. function objectToString(value) {
  30133. return nativeObjectToString.call(value);
  30134. }
  30135. module.exports = objectToString;
  30136. },{}],397:[function(require,module,exports){
  30137. /**
  30138. * Creates a unary function that invokes `func` with its argument transformed.
  30139. *
  30140. * @private
  30141. * @param {Function} func The function to wrap.
  30142. * @param {Function} transform The argument transform.
  30143. * @returns {Function} Returns the new function.
  30144. */
  30145. function overArg(func, transform) {
  30146. return function(arg) {
  30147. return func(transform(arg));
  30148. };
  30149. }
  30150. module.exports = overArg;
  30151. },{}],398:[function(require,module,exports){
  30152. var apply = require('./_apply');
  30153. /* Built-in method references for those with the same name as other `lodash` methods. */
  30154. var nativeMax = Math.max;
  30155. /**
  30156. * A specialized version of `baseRest` which transforms the rest array.
  30157. *
  30158. * @private
  30159. * @param {Function} func The function to apply a rest parameter to.
  30160. * @param {number} [start=func.length-1] The start position of the rest parameter.
  30161. * @param {Function} transform The rest array transform.
  30162. * @returns {Function} Returns the new function.
  30163. */
  30164. function overRest(func, start, transform) {
  30165. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  30166. return function() {
  30167. var args = arguments,
  30168. index = -1,
  30169. length = nativeMax(args.length - start, 0),
  30170. array = Array(length);
  30171. while (++index < length) {
  30172. array[index] = args[start + index];
  30173. }
  30174. index = -1;
  30175. var otherArgs = Array(start + 1);
  30176. while (++index < start) {
  30177. otherArgs[index] = args[index];
  30178. }
  30179. otherArgs[start] = transform(array);
  30180. return apply(func, this, otherArgs);
  30181. };
  30182. }
  30183. module.exports = overRest;
  30184. },{"./_apply":265}],399:[function(require,module,exports){
  30185. var freeGlobal = require('./_freeGlobal');
  30186. /** Detect free variable `self`. */
  30187. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  30188. /** Used as a reference to the global object. */
  30189. var root = freeGlobal || freeSelf || Function('return this')();
  30190. module.exports = root;
  30191. },{"./_freeGlobal":350}],400:[function(require,module,exports){
  30192. /** Used to stand-in for `undefined` hash values. */
  30193. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  30194. /**
  30195. * Adds `value` to the array cache.
  30196. *
  30197. * @private
  30198. * @name add
  30199. * @memberOf SetCache
  30200. * @alias push
  30201. * @param {*} value The value to cache.
  30202. * @returns {Object} Returns the cache instance.
  30203. */
  30204. function setCacheAdd(value) {
  30205. this.__data__.set(value, HASH_UNDEFINED);
  30206. return this;
  30207. }
  30208. module.exports = setCacheAdd;
  30209. },{}],401:[function(require,module,exports){
  30210. /**
  30211. * Checks if `value` is in the array cache.
  30212. *
  30213. * @private
  30214. * @name has
  30215. * @memberOf SetCache
  30216. * @param {*} value The value to search for.
  30217. * @returns {number} Returns `true` if `value` is found, else `false`.
  30218. */
  30219. function setCacheHas(value) {
  30220. return this.__data__.has(value);
  30221. }
  30222. module.exports = setCacheHas;
  30223. },{}],402:[function(require,module,exports){
  30224. /**
  30225. * Converts `set` to an array of its values.
  30226. *
  30227. * @private
  30228. * @param {Object} set The set to convert.
  30229. * @returns {Array} Returns the values.
  30230. */
  30231. function setToArray(set) {
  30232. var index = -1,
  30233. result = Array(set.size);
  30234. set.forEach(function(value) {
  30235. result[++index] = value;
  30236. });
  30237. return result;
  30238. }
  30239. module.exports = setToArray;
  30240. },{}],403:[function(require,module,exports){
  30241. var baseSetToString = require('./_baseSetToString'),
  30242. shortOut = require('./_shortOut');
  30243. /**
  30244. * Sets the `toString` method of `func` to return `string`.
  30245. *
  30246. * @private
  30247. * @param {Function} func The function to modify.
  30248. * @param {Function} string The `toString` result.
  30249. * @returns {Function} Returns `func`.
  30250. */
  30251. var setToString = shortOut(baseSetToString);
  30252. module.exports = setToString;
  30253. },{"./_baseSetToString":316,"./_shortOut":404}],404:[function(require,module,exports){
  30254. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  30255. var HOT_COUNT = 800,
  30256. HOT_SPAN = 16;
  30257. /* Built-in method references for those with the same name as other `lodash` methods. */
  30258. var nativeNow = Date.now;
  30259. /**
  30260. * Creates a function that'll short out and invoke `identity` instead
  30261. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  30262. * milliseconds.
  30263. *
  30264. * @private
  30265. * @param {Function} func The function to restrict.
  30266. * @returns {Function} Returns the new shortable function.
  30267. */
  30268. function shortOut(func) {
  30269. var count = 0,
  30270. lastCalled = 0;
  30271. return function() {
  30272. var stamp = nativeNow(),
  30273. remaining = HOT_SPAN - (stamp - lastCalled);
  30274. lastCalled = stamp;
  30275. if (remaining > 0) {
  30276. if (++count >= HOT_COUNT) {
  30277. return arguments[0];
  30278. }
  30279. } else {
  30280. count = 0;
  30281. }
  30282. return func.apply(undefined, arguments);
  30283. };
  30284. }
  30285. module.exports = shortOut;
  30286. },{}],405:[function(require,module,exports){
  30287. var ListCache = require('./_ListCache');
  30288. /**
  30289. * Removes all key-value entries from the stack.
  30290. *
  30291. * @private
  30292. * @name clear
  30293. * @memberOf Stack
  30294. */
  30295. function stackClear() {
  30296. this.__data__ = new ListCache;
  30297. this.size = 0;
  30298. }
  30299. module.exports = stackClear;
  30300. },{"./_ListCache":253}],406:[function(require,module,exports){
  30301. /**
  30302. * Removes `key` and its value from the stack.
  30303. *
  30304. * @private
  30305. * @name delete
  30306. * @memberOf Stack
  30307. * @param {string} key The key of the value to remove.
  30308. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  30309. */
  30310. function stackDelete(key) {
  30311. var data = this.__data__,
  30312. result = data['delete'](key);
  30313. this.size = data.size;
  30314. return result;
  30315. }
  30316. module.exports = stackDelete;
  30317. },{}],407:[function(require,module,exports){
  30318. /**
  30319. * Gets the stack value for `key`.
  30320. *
  30321. * @private
  30322. * @name get
  30323. * @memberOf Stack
  30324. * @param {string} key The key of the value to get.
  30325. * @returns {*} Returns the entry value.
  30326. */
  30327. function stackGet(key) {
  30328. return this.__data__.get(key);
  30329. }
  30330. module.exports = stackGet;
  30331. },{}],408:[function(require,module,exports){
  30332. /**
  30333. * Checks if a stack value for `key` exists.
  30334. *
  30335. * @private
  30336. * @name has
  30337. * @memberOf Stack
  30338. * @param {string} key The key of the entry to check.
  30339. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  30340. */
  30341. function stackHas(key) {
  30342. return this.__data__.has(key);
  30343. }
  30344. module.exports = stackHas;
  30345. },{}],409:[function(require,module,exports){
  30346. var ListCache = require('./_ListCache'),
  30347. Map = require('./_Map'),
  30348. MapCache = require('./_MapCache');
  30349. /** Used as the size to enable large array optimizations. */
  30350. var LARGE_ARRAY_SIZE = 200;
  30351. /**
  30352. * Sets the stack `key` to `value`.
  30353. *
  30354. * @private
  30355. * @name set
  30356. * @memberOf Stack
  30357. * @param {string} key The key of the value to set.
  30358. * @param {*} value The value to set.
  30359. * @returns {Object} Returns the stack cache instance.
  30360. */
  30361. function stackSet(key, value) {
  30362. var data = this.__data__;
  30363. if (data instanceof ListCache) {
  30364. var pairs = data.__data__;
  30365. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  30366. pairs.push([key, value]);
  30367. this.size = ++data.size;
  30368. return this;
  30369. }
  30370. data = this.__data__ = new MapCache(pairs);
  30371. }
  30372. data.set(key, value);
  30373. this.size = data.size;
  30374. return this;
  30375. }
  30376. module.exports = stackSet;
  30377. },{"./_ListCache":253,"./_Map":254,"./_MapCache":255}],410:[function(require,module,exports){
  30378. /**
  30379. * A specialized version of `_.indexOf` which performs strict equality
  30380. * comparisons of values, i.e. `===`.
  30381. *
  30382. * @private
  30383. * @param {Array} array The array to inspect.
  30384. * @param {*} value The value to search for.
  30385. * @param {number} fromIndex The index to search from.
  30386. * @returns {number} Returns the index of the matched value, else `-1`.
  30387. */
  30388. function strictIndexOf(array, value, fromIndex) {
  30389. var index = fromIndex - 1,
  30390. length = array.length;
  30391. while (++index < length) {
  30392. if (array[index] === value) {
  30393. return index;
  30394. }
  30395. }
  30396. return -1;
  30397. }
  30398. module.exports = strictIndexOf;
  30399. },{}],411:[function(require,module,exports){
  30400. var memoizeCapped = require('./_memoizeCapped');
  30401. /** Used to match property names within property paths. */
  30402. var reLeadingDot = /^\./,
  30403. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  30404. /** Used to match backslashes in property paths. */
  30405. var reEscapeChar = /\\(\\)?/g;
  30406. /**
  30407. * Converts `string` to a property path array.
  30408. *
  30409. * @private
  30410. * @param {string} string The string to convert.
  30411. * @returns {Array} Returns the property path array.
  30412. */
  30413. var stringToPath = memoizeCapped(function(string) {
  30414. var result = [];
  30415. if (reLeadingDot.test(string)) {
  30416. result.push('');
  30417. }
  30418. string.replace(rePropName, function(match, number, quote, string) {
  30419. result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
  30420. });
  30421. return result;
  30422. });
  30423. module.exports = stringToPath;
  30424. },{"./_memoizeCapped":391}],412:[function(require,module,exports){
  30425. var isSymbol = require('./isSymbol');
  30426. /** Used as references for various `Number` constants. */
  30427. var INFINITY = 1 / 0;
  30428. /**
  30429. * Converts `value` to a string key if it's not a string or symbol.
  30430. *
  30431. * @private
  30432. * @param {*} value The value to inspect.
  30433. * @returns {string|symbol} Returns the key.
  30434. */
  30435. function toKey(value) {
  30436. if (typeof value == 'string' || isSymbol(value)) {
  30437. return value;
  30438. }
  30439. var result = (value + '');
  30440. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  30441. }
  30442. module.exports = toKey;
  30443. },{"./isSymbol":445}],413:[function(require,module,exports){
  30444. /** Used for built-in method references. */
  30445. var funcProto = Function.prototype;
  30446. /** Used to resolve the decompiled source of functions. */
  30447. var funcToString = funcProto.toString;
  30448. /**
  30449. * Converts `func` to its source code.
  30450. *
  30451. * @private
  30452. * @param {Function} func The function to convert.
  30453. * @returns {string} Returns the source code.
  30454. */
  30455. function toSource(func) {
  30456. if (func != null) {
  30457. try {
  30458. return funcToString.call(func);
  30459. } catch (e) {}
  30460. try {
  30461. return (func + '');
  30462. } catch (e) {}
  30463. }
  30464. return '';
  30465. }
  30466. module.exports = toSource;
  30467. },{}],414:[function(require,module,exports){
  30468. var assignValue = require('./_assignValue'),
  30469. copyObject = require('./_copyObject'),
  30470. createAssigner = require('./_createAssigner'),
  30471. isArrayLike = require('./isArrayLike'),
  30472. isPrototype = require('./_isPrototype'),
  30473. keys = require('./keys');
  30474. /** Used for built-in method references. */
  30475. var objectProto = Object.prototype;
  30476. /** Used to check objects for own properties. */
  30477. var hasOwnProperty = objectProto.hasOwnProperty;
  30478. /**
  30479. * Assigns own enumerable string keyed properties of source objects to the
  30480. * destination object. Source objects are applied from left to right.
  30481. * Subsequent sources overwrite property assignments of previous sources.
  30482. *
  30483. * **Note:** This method mutates `object` and is loosely based on
  30484. * [`Object.assign`](https://mdn.io/Object/assign).
  30485. *
  30486. * @static
  30487. * @memberOf _
  30488. * @since 0.10.0
  30489. * @category Object
  30490. * @param {Object} object The destination object.
  30491. * @param {...Object} [sources] The source objects.
  30492. * @returns {Object} Returns `object`.
  30493. * @see _.assignIn
  30494. * @example
  30495. *
  30496. * function Foo() {
  30497. * this.a = 1;
  30498. * }
  30499. *
  30500. * function Bar() {
  30501. * this.c = 3;
  30502. * }
  30503. *
  30504. * Foo.prototype.b = 2;
  30505. * Bar.prototype.d = 4;
  30506. *
  30507. * _.assign({ 'a': 0 }, new Foo, new Bar);
  30508. * // => { 'a': 1, 'c': 3 }
  30509. */
  30510. var assign = createAssigner(function(object, source) {
  30511. if (isPrototype(source) || isArrayLike(source)) {
  30512. copyObject(source, keys(source), object);
  30513. return;
  30514. }
  30515. for (var key in source) {
  30516. if (hasOwnProperty.call(source, key)) {
  30517. assignValue(object, key, source[key]);
  30518. }
  30519. }
  30520. });
  30521. module.exports = assign;
  30522. },{"./_assignValue":276,"./_copyObject":336,"./_createAssigner":340,"./_isPrototype":377,"./isArrayLike":434,"./keys":447}],415:[function(require,module,exports){
  30523. var copyObject = require('./_copyObject'),
  30524. createAssigner = require('./_createAssigner'),
  30525. keysIn = require('./keysIn');
  30526. /**
  30527. * This method is like `_.assignIn` except that it accepts `customizer`
  30528. * which is invoked to produce the assigned values. If `customizer` returns
  30529. * `undefined`, assignment is handled by the method instead. The `customizer`
  30530. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  30531. *
  30532. * **Note:** This method mutates `object`.
  30533. *
  30534. * @static
  30535. * @memberOf _
  30536. * @since 4.0.0
  30537. * @alias extendWith
  30538. * @category Object
  30539. * @param {Object} object The destination object.
  30540. * @param {...Object} sources The source objects.
  30541. * @param {Function} [customizer] The function to customize assigned values.
  30542. * @returns {Object} Returns `object`.
  30543. * @see _.assignWith
  30544. * @example
  30545. *
  30546. * function customizer(objValue, srcValue) {
  30547. * return _.isUndefined(objValue) ? srcValue : objValue;
  30548. * }
  30549. *
  30550. * var defaults = _.partialRight(_.assignInWith, customizer);
  30551. *
  30552. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30553. * // => { 'a': 1, 'b': 2 }
  30554. */
  30555. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  30556. copyObject(source, keysIn(source), object, customizer);
  30557. });
  30558. module.exports = assignInWith;
  30559. },{"./_copyObject":336,"./_createAssigner":340,"./keysIn":448}],416:[function(require,module,exports){
  30560. var baseClone = require('./_baseClone');
  30561. /** Used to compose bitmasks for cloning. */
  30562. var CLONE_SYMBOLS_FLAG = 4;
  30563. /**
  30564. * Creates a shallow clone of `value`.
  30565. *
  30566. * **Note:** This method is loosely based on the
  30567. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  30568. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  30569. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  30570. * arrays. The own enumerable properties of `arguments` objects are cloned
  30571. * as plain objects. An empty object is returned for uncloneable values such
  30572. * as error objects, functions, DOM nodes, and WeakMaps.
  30573. *
  30574. * @static
  30575. * @memberOf _
  30576. * @since 0.1.0
  30577. * @category Lang
  30578. * @param {*} value The value to clone.
  30579. * @returns {*} Returns the cloned value.
  30580. * @see _.cloneDeep
  30581. * @example
  30582. *
  30583. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  30584. *
  30585. * var shallow = _.clone(objects);
  30586. * console.log(shallow[0] === objects[0]);
  30587. * // => true
  30588. */
  30589. function clone(value) {
  30590. return baseClone(value, CLONE_SYMBOLS_FLAG);
  30591. }
  30592. module.exports = clone;
  30593. },{"./_baseClone":282}],417:[function(require,module,exports){
  30594. var baseClone = require('./_baseClone');
  30595. /** Used to compose bitmasks for cloning. */
  30596. var CLONE_DEEP_FLAG = 1,
  30597. CLONE_SYMBOLS_FLAG = 4;
  30598. /**
  30599. * This method is like `_.clone` except that it recursively clones `value`.
  30600. *
  30601. * @static
  30602. * @memberOf _
  30603. * @since 1.0.0
  30604. * @category Lang
  30605. * @param {*} value The value to recursively clone.
  30606. * @returns {*} Returns the deep cloned value.
  30607. * @see _.clone
  30608. * @example
  30609. *
  30610. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  30611. *
  30612. * var deep = _.cloneDeep(objects);
  30613. * console.log(deep[0] === objects[0]);
  30614. * // => false
  30615. */
  30616. function cloneDeep(value) {
  30617. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  30618. }
  30619. module.exports = cloneDeep;
  30620. },{"./_baseClone":282}],418:[function(require,module,exports){
  30621. var baseClone = require('./_baseClone');
  30622. /** Used to compose bitmasks for cloning. */
  30623. var CLONE_DEEP_FLAG = 1,
  30624. CLONE_SYMBOLS_FLAG = 4;
  30625. /**
  30626. * This method is like `_.cloneWith` except that it recursively clones `value`.
  30627. *
  30628. * @static
  30629. * @memberOf _
  30630. * @since 4.0.0
  30631. * @category Lang
  30632. * @param {*} value The value to recursively clone.
  30633. * @param {Function} [customizer] The function to customize cloning.
  30634. * @returns {*} Returns the deep cloned value.
  30635. * @see _.cloneWith
  30636. * @example
  30637. *
  30638. * function customizer(value) {
  30639. * if (_.isElement(value)) {
  30640. * return value.cloneNode(true);
  30641. * }
  30642. * }
  30643. *
  30644. * var el = _.cloneDeepWith(document.body, customizer);
  30645. *
  30646. * console.log(el === document.body);
  30647. * // => false
  30648. * console.log(el.nodeName);
  30649. * // => 'BODY'
  30650. * console.log(el.childNodes.length);
  30651. * // => 20
  30652. */
  30653. function cloneDeepWith(value, customizer) {
  30654. customizer = typeof customizer == 'function' ? customizer : undefined;
  30655. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  30656. }
  30657. module.exports = cloneDeepWith;
  30658. },{"./_baseClone":282}],419:[function(require,module,exports){
  30659. /**
  30660. * Creates a function that returns `value`.
  30661. *
  30662. * @static
  30663. * @memberOf _
  30664. * @since 2.4.0
  30665. * @category Util
  30666. * @param {*} value The value to return from the new function.
  30667. * @returns {Function} Returns the new constant function.
  30668. * @example
  30669. *
  30670. * var objects = _.times(2, _.constant({ 'a': 1 }));
  30671. *
  30672. * console.log(objects);
  30673. * // => [{ 'a': 1 }, { 'a': 1 }]
  30674. *
  30675. * console.log(objects[0] === objects[1]);
  30676. * // => true
  30677. */
  30678. function constant(value) {
  30679. return function() {
  30680. return value;
  30681. };
  30682. }
  30683. module.exports = constant;
  30684. },{}],420:[function(require,module,exports){
  30685. var apply = require('./_apply'),
  30686. assignInWith = require('./assignInWith'),
  30687. baseRest = require('./_baseRest'),
  30688. customDefaultsAssignIn = require('./_customDefaultsAssignIn');
  30689. /**
  30690. * Assigns own and inherited enumerable string keyed properties of source
  30691. * objects to the destination object for all destination properties that
  30692. * resolve to `undefined`. Source objects are applied from left to right.
  30693. * Once a property is set, additional values of the same property are ignored.
  30694. *
  30695. * **Note:** This method mutates `object`.
  30696. *
  30697. * @static
  30698. * @since 0.1.0
  30699. * @memberOf _
  30700. * @category Object
  30701. * @param {Object} object The destination object.
  30702. * @param {...Object} [sources] The source objects.
  30703. * @returns {Object} Returns `object`.
  30704. * @see _.defaultsDeep
  30705. * @example
  30706. *
  30707. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  30708. * // => { 'a': 1, 'b': 2 }
  30709. */
  30710. var defaults = baseRest(function(args) {
  30711. args.push(undefined, customDefaultsAssignIn);
  30712. return apply(assignInWith, undefined, args);
  30713. });
  30714. module.exports = defaults;
  30715. },{"./_apply":265,"./_baseRest":315,"./_customDefaultsAssignIn":345,"./assignInWith":415}],421:[function(require,module,exports){
  30716. /**
  30717. * Performs a
  30718. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  30719. * comparison between two values to determine if they are equivalent.
  30720. *
  30721. * @static
  30722. * @memberOf _
  30723. * @since 4.0.0
  30724. * @category Lang
  30725. * @param {*} value The value to compare.
  30726. * @param {*} other The other value to compare.
  30727. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  30728. * @example
  30729. *
  30730. * var object = { 'a': 1 };
  30731. * var other = { 'a': 1 };
  30732. *
  30733. * _.eq(object, object);
  30734. * // => true
  30735. *
  30736. * _.eq(object, other);
  30737. * // => false
  30738. *
  30739. * _.eq('a', 'a');
  30740. * // => true
  30741. *
  30742. * _.eq('a', Object('a'));
  30743. * // => false
  30744. *
  30745. * _.eq(NaN, NaN);
  30746. * // => true
  30747. */
  30748. function eq(value, other) {
  30749. return value === other || (value !== value && other !== other);
  30750. }
  30751. module.exports = eq;
  30752. },{}],422:[function(require,module,exports){
  30753. var toString = require('./toString');
  30754. /**
  30755. * Used to match `RegExp`
  30756. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  30757. */
  30758. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  30759. reHasRegExpChar = RegExp(reRegExpChar.source);
  30760. /**
  30761. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  30762. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  30763. *
  30764. * @static
  30765. * @memberOf _
  30766. * @since 3.0.0
  30767. * @category String
  30768. * @param {string} [string=''] The string to escape.
  30769. * @returns {string} Returns the escaped string.
  30770. * @example
  30771. *
  30772. * _.escapeRegExp('[lodash](https://lodash.com/)');
  30773. * // => '\[lodash\]\(https://lodash\.com/\)'
  30774. */
  30775. function escapeRegExp(string) {
  30776. string = toString(string);
  30777. return (string && reHasRegExpChar.test(string))
  30778. ? string.replace(reRegExpChar, '\\$&')
  30779. : string;
  30780. }
  30781. module.exports = escapeRegExp;
  30782. },{"./toString":463}],423:[function(require,module,exports){
  30783. var createFind = require('./_createFind'),
  30784. findIndex = require('./findIndex');
  30785. /**
  30786. * Iterates over elements of `collection`, returning the first element
  30787. * `predicate` returns truthy for. The predicate is invoked with three
  30788. * arguments: (value, index|key, collection).
  30789. *
  30790. * @static
  30791. * @memberOf _
  30792. * @since 0.1.0
  30793. * @category Collection
  30794. * @param {Array|Object} collection The collection to inspect.
  30795. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30796. * @param {number} [fromIndex=0] The index to search from.
  30797. * @returns {*} Returns the matched element, else `undefined`.
  30798. * @example
  30799. *
  30800. * var users = [
  30801. * { 'user': 'barney', 'age': 36, 'active': true },
  30802. * { 'user': 'fred', 'age': 40, 'active': false },
  30803. * { 'user': 'pebbles', 'age': 1, 'active': true }
  30804. * ];
  30805. *
  30806. * _.find(users, function(o) { return o.age < 40; });
  30807. * // => object for 'barney'
  30808. *
  30809. * // The `_.matches` iteratee shorthand.
  30810. * _.find(users, { 'age': 1, 'active': true });
  30811. * // => object for 'pebbles'
  30812. *
  30813. * // The `_.matchesProperty` iteratee shorthand.
  30814. * _.find(users, ['active', false]);
  30815. * // => object for 'fred'
  30816. *
  30817. * // The `_.property` iteratee shorthand.
  30818. * _.find(users, 'active');
  30819. * // => object for 'barney'
  30820. */
  30821. var find = createFind(findIndex);
  30822. module.exports = find;
  30823. },{"./_createFind":343,"./findIndex":424}],424:[function(require,module,exports){
  30824. var baseFindIndex = require('./_baseFindIndex'),
  30825. baseIteratee = require('./_baseIteratee'),
  30826. toInteger = require('./toInteger');
  30827. /* Built-in method references for those with the same name as other `lodash` methods. */
  30828. var nativeMax = Math.max;
  30829. /**
  30830. * This method is like `_.find` except that it returns the index of the first
  30831. * element `predicate` returns truthy for instead of the element itself.
  30832. *
  30833. * @static
  30834. * @memberOf _
  30835. * @since 1.1.0
  30836. * @category Array
  30837. * @param {Array} array The array to inspect.
  30838. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30839. * @param {number} [fromIndex=0] The index to search from.
  30840. * @returns {number} Returns the index of the found element, else `-1`.
  30841. * @example
  30842. *
  30843. * var users = [
  30844. * { 'user': 'barney', 'active': false },
  30845. * { 'user': 'fred', 'active': false },
  30846. * { 'user': 'pebbles', 'active': true }
  30847. * ];
  30848. *
  30849. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  30850. * // => 0
  30851. *
  30852. * // The `_.matches` iteratee shorthand.
  30853. * _.findIndex(users, { 'user': 'fred', 'active': false });
  30854. * // => 1
  30855. *
  30856. * // The `_.matchesProperty` iteratee shorthand.
  30857. * _.findIndex(users, ['active', false]);
  30858. * // => 0
  30859. *
  30860. * // The `_.property` iteratee shorthand.
  30861. * _.findIndex(users, 'active');
  30862. * // => 2
  30863. */
  30864. function findIndex(array, predicate, fromIndex) {
  30865. var length = array == null ? 0 : array.length;
  30866. if (!length) {
  30867. return -1;
  30868. }
  30869. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  30870. if (index < 0) {
  30871. index = nativeMax(length + index, 0);
  30872. }
  30873. return baseFindIndex(array, baseIteratee(predicate, 3), index);
  30874. }
  30875. module.exports = findIndex;
  30876. },{"./_baseFindIndex":285,"./_baseIteratee":303,"./toInteger":460}],425:[function(require,module,exports){
  30877. var createFind = require('./_createFind'),
  30878. findLastIndex = require('./findLastIndex');
  30879. /**
  30880. * This method is like `_.find` except that it iterates over elements of
  30881. * `collection` from right to left.
  30882. *
  30883. * @static
  30884. * @memberOf _
  30885. * @since 2.0.0
  30886. * @category Collection
  30887. * @param {Array|Object} collection The collection to inspect.
  30888. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30889. * @param {number} [fromIndex=collection.length-1] The index to search from.
  30890. * @returns {*} Returns the matched element, else `undefined`.
  30891. * @example
  30892. *
  30893. * _.findLast([1, 2, 3, 4], function(n) {
  30894. * return n % 2 == 1;
  30895. * });
  30896. * // => 3
  30897. */
  30898. var findLast = createFind(findLastIndex);
  30899. module.exports = findLast;
  30900. },{"./_createFind":343,"./findLastIndex":426}],426:[function(require,module,exports){
  30901. var baseFindIndex = require('./_baseFindIndex'),
  30902. baseIteratee = require('./_baseIteratee'),
  30903. toInteger = require('./toInteger');
  30904. /* Built-in method references for those with the same name as other `lodash` methods. */
  30905. var nativeMax = Math.max,
  30906. nativeMin = Math.min;
  30907. /**
  30908. * This method is like `_.findIndex` except that it iterates over elements
  30909. * of `collection` from right to left.
  30910. *
  30911. * @static
  30912. * @memberOf _
  30913. * @since 2.0.0
  30914. * @category Array
  30915. * @param {Array} array The array to inspect.
  30916. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  30917. * @param {number} [fromIndex=array.length-1] The index to search from.
  30918. * @returns {number} Returns the index of the found element, else `-1`.
  30919. * @example
  30920. *
  30921. * var users = [
  30922. * { 'user': 'barney', 'active': true },
  30923. * { 'user': 'fred', 'active': false },
  30924. * { 'user': 'pebbles', 'active': false }
  30925. * ];
  30926. *
  30927. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  30928. * // => 2
  30929. *
  30930. * // The `_.matches` iteratee shorthand.
  30931. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  30932. * // => 0
  30933. *
  30934. * // The `_.matchesProperty` iteratee shorthand.
  30935. * _.findLastIndex(users, ['active', false]);
  30936. * // => 2
  30937. *
  30938. * // The `_.property` iteratee shorthand.
  30939. * _.findLastIndex(users, 'active');
  30940. * // => 0
  30941. */
  30942. function findLastIndex(array, predicate, fromIndex) {
  30943. var length = array == null ? 0 : array.length;
  30944. if (!length) {
  30945. return -1;
  30946. }
  30947. var index = length - 1;
  30948. if (fromIndex !== undefined) {
  30949. index = toInteger(fromIndex);
  30950. index = fromIndex < 0
  30951. ? nativeMax(length + index, 0)
  30952. : nativeMin(index, length - 1);
  30953. }
  30954. return baseFindIndex(array, baseIteratee(predicate, 3), index, true);
  30955. }
  30956. module.exports = findLastIndex;
  30957. },{"./_baseFindIndex":285,"./_baseIteratee":303,"./toInteger":460}],427:[function(require,module,exports){
  30958. var baseGet = require('./_baseGet');
  30959. /**
  30960. * Gets the value at `path` of `object`. If the resolved value is
  30961. * `undefined`, the `defaultValue` is returned in its place.
  30962. *
  30963. * @static
  30964. * @memberOf _
  30965. * @since 3.7.0
  30966. * @category Object
  30967. * @param {Object} object The object to query.
  30968. * @param {Array|string} path The path of the property to get.
  30969. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  30970. * @returns {*} Returns the resolved value.
  30971. * @example
  30972. *
  30973. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  30974. *
  30975. * _.get(object, 'a[0].b.c');
  30976. * // => 3
  30977. *
  30978. * _.get(object, ['a', '0', 'b', 'c']);
  30979. * // => 3
  30980. *
  30981. * _.get(object, 'a.b.c', 'default');
  30982. * // => 'default'
  30983. */
  30984. function get(object, path, defaultValue) {
  30985. var result = object == null ? undefined : baseGet(object, path);
  30986. return result === undefined ? defaultValue : result;
  30987. }
  30988. module.exports = get;
  30989. },{"./_baseGet":289}],428:[function(require,module,exports){
  30990. var baseHas = require('./_baseHas'),
  30991. hasPath = require('./_hasPath');
  30992. /**
  30993. * Checks if `path` is a direct property of `object`.
  30994. *
  30995. * @static
  30996. * @since 0.1.0
  30997. * @memberOf _
  30998. * @category Object
  30999. * @param {Object} object The object to query.
  31000. * @param {Array|string} path The path to check.
  31001. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  31002. * @example
  31003. *
  31004. * var object = { 'a': { 'b': 2 } };
  31005. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  31006. *
  31007. * _.has(object, 'a');
  31008. * // => true
  31009. *
  31010. * _.has(object, 'a.b');
  31011. * // => true
  31012. *
  31013. * _.has(object, ['a', 'b']);
  31014. * // => true
  31015. *
  31016. * _.has(other, 'a');
  31017. * // => false
  31018. */
  31019. function has(object, path) {
  31020. return object != null && hasPath(object, path, baseHas);
  31021. }
  31022. module.exports = has;
  31023. },{"./_baseHas":292,"./_hasPath":362}],429:[function(require,module,exports){
  31024. var baseHasIn = require('./_baseHasIn'),
  31025. hasPath = require('./_hasPath');
  31026. /**
  31027. * Checks if `path` is a direct or inherited property of `object`.
  31028. *
  31029. * @static
  31030. * @memberOf _
  31031. * @since 4.0.0
  31032. * @category Object
  31033. * @param {Object} object The object to query.
  31034. * @param {Array|string} path The path to check.
  31035. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  31036. * @example
  31037. *
  31038. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  31039. *
  31040. * _.hasIn(object, 'a');
  31041. * // => true
  31042. *
  31043. * _.hasIn(object, 'a.b');
  31044. * // => true
  31045. *
  31046. * _.hasIn(object, ['a', 'b']);
  31047. * // => true
  31048. *
  31049. * _.hasIn(object, 'b');
  31050. * // => false
  31051. */
  31052. function hasIn(object, path) {
  31053. return object != null && hasPath(object, path, baseHasIn);
  31054. }
  31055. module.exports = hasIn;
  31056. },{"./_baseHasIn":293,"./_hasPath":362}],430:[function(require,module,exports){
  31057. /**
  31058. * This method returns the first argument it receives.
  31059. *
  31060. * @static
  31061. * @since 0.1.0
  31062. * @memberOf _
  31063. * @category Util
  31064. * @param {*} value Any value.
  31065. * @returns {*} Returns `value`.
  31066. * @example
  31067. *
  31068. * var object = { 'a': 1 };
  31069. *
  31070. * console.log(_.identity(object) === object);
  31071. * // => true
  31072. */
  31073. function identity(value) {
  31074. return value;
  31075. }
  31076. module.exports = identity;
  31077. },{}],431:[function(require,module,exports){
  31078. var baseIndexOf = require('./_baseIndexOf'),
  31079. isArrayLike = require('./isArrayLike'),
  31080. isString = require('./isString'),
  31081. toInteger = require('./toInteger'),
  31082. values = require('./values');
  31083. /* Built-in method references for those with the same name as other `lodash` methods. */
  31084. var nativeMax = Math.max;
  31085. /**
  31086. * Checks if `value` is in `collection`. If `collection` is a string, it's
  31087. * checked for a substring of `value`, otherwise
  31088. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  31089. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  31090. * the offset from the end of `collection`.
  31091. *
  31092. * @static
  31093. * @memberOf _
  31094. * @since 0.1.0
  31095. * @category Collection
  31096. * @param {Array|Object|string} collection The collection to inspect.
  31097. * @param {*} value The value to search for.
  31098. * @param {number} [fromIndex=0] The index to search from.
  31099. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  31100. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  31101. * @example
  31102. *
  31103. * _.includes([1, 2, 3], 1);
  31104. * // => true
  31105. *
  31106. * _.includes([1, 2, 3], 1, 2);
  31107. * // => false
  31108. *
  31109. * _.includes({ 'a': 1, 'b': 2 }, 1);
  31110. * // => true
  31111. *
  31112. * _.includes('abcd', 'bc');
  31113. * // => true
  31114. */
  31115. function includes(collection, value, fromIndex, guard) {
  31116. collection = isArrayLike(collection) ? collection : values(collection);
  31117. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  31118. var length = collection.length;
  31119. if (fromIndex < 0) {
  31120. fromIndex = nativeMax(length + fromIndex, 0);
  31121. }
  31122. return isString(collection)
  31123. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  31124. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  31125. }
  31126. module.exports = includes;
  31127. },{"./_baseIndexOf":294,"./isArrayLike":434,"./isString":444,"./toInteger":460,"./values":465}],432:[function(require,module,exports){
  31128. var baseIsArguments = require('./_baseIsArguments'),
  31129. isObjectLike = require('./isObjectLike');
  31130. /** Used for built-in method references. */
  31131. var objectProto = Object.prototype;
  31132. /** Used to check objects for own properties. */
  31133. var hasOwnProperty = objectProto.hasOwnProperty;
  31134. /** Built-in value references. */
  31135. var propertyIsEnumerable = objectProto.propertyIsEnumerable;
  31136. /**
  31137. * Checks if `value` is likely an `arguments` object.
  31138. *
  31139. * @static
  31140. * @memberOf _
  31141. * @since 0.1.0
  31142. * @category Lang
  31143. * @param {*} value The value to check.
  31144. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  31145. * else `false`.
  31146. * @example
  31147. *
  31148. * _.isArguments(function() { return arguments; }());
  31149. * // => true
  31150. *
  31151. * _.isArguments([1, 2, 3]);
  31152. * // => false
  31153. */
  31154. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  31155. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  31156. !propertyIsEnumerable.call(value, 'callee');
  31157. };
  31158. module.exports = isArguments;
  31159. },{"./_baseIsArguments":295,"./isObjectLike":441}],433:[function(require,module,exports){
  31160. /**
  31161. * Checks if `value` is classified as an `Array` object.
  31162. *
  31163. * @static
  31164. * @memberOf _
  31165. * @since 0.1.0
  31166. * @category Lang
  31167. * @param {*} value The value to check.
  31168. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  31169. * @example
  31170. *
  31171. * _.isArray([1, 2, 3]);
  31172. * // => true
  31173. *
  31174. * _.isArray(document.body.children);
  31175. * // => false
  31176. *
  31177. * _.isArray('abc');
  31178. * // => false
  31179. *
  31180. * _.isArray(_.noop);
  31181. * // => false
  31182. */
  31183. var isArray = Array.isArray;
  31184. module.exports = isArray;
  31185. },{}],434:[function(require,module,exports){
  31186. var isFunction = require('./isFunction'),
  31187. isLength = require('./isLength');
  31188. /**
  31189. * Checks if `value` is array-like. A value is considered array-like if it's
  31190. * not a function and has a `value.length` that's an integer greater than or
  31191. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  31192. *
  31193. * @static
  31194. * @memberOf _
  31195. * @since 4.0.0
  31196. * @category Lang
  31197. * @param {*} value The value to check.
  31198. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  31199. * @example
  31200. *
  31201. * _.isArrayLike([1, 2, 3]);
  31202. * // => true
  31203. *
  31204. * _.isArrayLike(document.body.children);
  31205. * // => true
  31206. *
  31207. * _.isArrayLike('abc');
  31208. * // => true
  31209. *
  31210. * _.isArrayLike(_.noop);
  31211. * // => false
  31212. */
  31213. function isArrayLike(value) {
  31214. return value != null && isLength(value.length) && !isFunction(value);
  31215. }
  31216. module.exports = isArrayLike;
  31217. },{"./isFunction":437,"./isLength":439}],435:[function(require,module,exports){
  31218. var isArrayLike = require('./isArrayLike'),
  31219. isObjectLike = require('./isObjectLike');
  31220. /**
  31221. * This method is like `_.isArrayLike` except that it also checks if `value`
  31222. * is an object.
  31223. *
  31224. * @static
  31225. * @memberOf _
  31226. * @since 4.0.0
  31227. * @category Lang
  31228. * @param {*} value The value to check.
  31229. * @returns {boolean} Returns `true` if `value` is an array-like object,
  31230. * else `false`.
  31231. * @example
  31232. *
  31233. * _.isArrayLikeObject([1, 2, 3]);
  31234. * // => true
  31235. *
  31236. * _.isArrayLikeObject(document.body.children);
  31237. * // => true
  31238. *
  31239. * _.isArrayLikeObject('abc');
  31240. * // => false
  31241. *
  31242. * _.isArrayLikeObject(_.noop);
  31243. * // => false
  31244. */
  31245. function isArrayLikeObject(value) {
  31246. return isObjectLike(value) && isArrayLike(value);
  31247. }
  31248. module.exports = isArrayLikeObject;
  31249. },{"./isArrayLike":434,"./isObjectLike":441}],436:[function(require,module,exports){
  31250. var root = require('./_root'),
  31251. stubFalse = require('./stubFalse');
  31252. /** Detect free variable `exports`. */
  31253. var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
  31254. /** Detect free variable `module`. */
  31255. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  31256. /** Detect the popular CommonJS extension `module.exports`. */
  31257. var moduleExports = freeModule && freeModule.exports === freeExports;
  31258. /** Built-in value references. */
  31259. var Buffer = moduleExports ? root.Buffer : undefined;
  31260. /* Built-in method references for those with the same name as other `lodash` methods. */
  31261. var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
  31262. /**
  31263. * Checks if `value` is a buffer.
  31264. *
  31265. * @static
  31266. * @memberOf _
  31267. * @since 4.3.0
  31268. * @category Lang
  31269. * @param {*} value The value to check.
  31270. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  31271. * @example
  31272. *
  31273. * _.isBuffer(new Buffer(2));
  31274. * // => true
  31275. *
  31276. * _.isBuffer(new Uint8Array(2));
  31277. * // => false
  31278. */
  31279. var isBuffer = nativeIsBuffer || stubFalse;
  31280. module.exports = isBuffer;
  31281. },{"./_root":399,"./stubFalse":458}],437:[function(require,module,exports){
  31282. var baseGetTag = require('./_baseGetTag'),
  31283. isObject = require('./isObject');
  31284. /** `Object#toString` result references. */
  31285. var asyncTag = '[object AsyncFunction]',
  31286. funcTag = '[object Function]',
  31287. genTag = '[object GeneratorFunction]',
  31288. proxyTag = '[object Proxy]';
  31289. /**
  31290. * Checks if `value` is classified as a `Function` object.
  31291. *
  31292. * @static
  31293. * @memberOf _
  31294. * @since 0.1.0
  31295. * @category Lang
  31296. * @param {*} value The value to check.
  31297. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  31298. * @example
  31299. *
  31300. * _.isFunction(_);
  31301. * // => true
  31302. *
  31303. * _.isFunction(/abc/);
  31304. * // => false
  31305. */
  31306. function isFunction(value) {
  31307. if (!isObject(value)) {
  31308. return false;
  31309. }
  31310. // The use of `Object#toString` avoids issues with the `typeof` operator
  31311. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  31312. var tag = baseGetTag(value);
  31313. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  31314. }
  31315. module.exports = isFunction;
  31316. },{"./_baseGetTag":291,"./isObject":440}],438:[function(require,module,exports){
  31317. var toInteger = require('./toInteger');
  31318. /**
  31319. * Checks if `value` is an integer.
  31320. *
  31321. * **Note:** This method is based on
  31322. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  31323. *
  31324. * @static
  31325. * @memberOf _
  31326. * @since 4.0.0
  31327. * @category Lang
  31328. * @param {*} value The value to check.
  31329. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  31330. * @example
  31331. *
  31332. * _.isInteger(3);
  31333. * // => true
  31334. *
  31335. * _.isInteger(Number.MIN_VALUE);
  31336. * // => false
  31337. *
  31338. * _.isInteger(Infinity);
  31339. * // => false
  31340. *
  31341. * _.isInteger('3');
  31342. * // => false
  31343. */
  31344. function isInteger(value) {
  31345. return typeof value == 'number' && value == toInteger(value);
  31346. }
  31347. module.exports = isInteger;
  31348. },{"./toInteger":460}],439:[function(require,module,exports){
  31349. /** Used as references for various `Number` constants. */
  31350. var MAX_SAFE_INTEGER = 9007199254740991;
  31351. /**
  31352. * Checks if `value` is a valid array-like length.
  31353. *
  31354. * **Note:** This method is loosely based on
  31355. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  31356. *
  31357. * @static
  31358. * @memberOf _
  31359. * @since 4.0.0
  31360. * @category Lang
  31361. * @param {*} value The value to check.
  31362. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  31363. * @example
  31364. *
  31365. * _.isLength(3);
  31366. * // => true
  31367. *
  31368. * _.isLength(Number.MIN_VALUE);
  31369. * // => false
  31370. *
  31371. * _.isLength(Infinity);
  31372. * // => false
  31373. *
  31374. * _.isLength('3');
  31375. * // => false
  31376. */
  31377. function isLength(value) {
  31378. return typeof value == 'number' &&
  31379. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  31380. }
  31381. module.exports = isLength;
  31382. },{}],440:[function(require,module,exports){
  31383. /**
  31384. * Checks if `value` is the
  31385. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  31386. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  31387. *
  31388. * @static
  31389. * @memberOf _
  31390. * @since 0.1.0
  31391. * @category Lang
  31392. * @param {*} value The value to check.
  31393. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  31394. * @example
  31395. *
  31396. * _.isObject({});
  31397. * // => true
  31398. *
  31399. * _.isObject([1, 2, 3]);
  31400. * // => true
  31401. *
  31402. * _.isObject(_.noop);
  31403. * // => true
  31404. *
  31405. * _.isObject(null);
  31406. * // => false
  31407. */
  31408. function isObject(value) {
  31409. var type = typeof value;
  31410. return value != null && (type == 'object' || type == 'function');
  31411. }
  31412. module.exports = isObject;
  31413. },{}],441:[function(require,module,exports){
  31414. /**
  31415. * Checks if `value` is object-like. A value is object-like if it's not `null`
  31416. * and has a `typeof` result of "object".
  31417. *
  31418. * @static
  31419. * @memberOf _
  31420. * @since 4.0.0
  31421. * @category Lang
  31422. * @param {*} value The value to check.
  31423. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  31424. * @example
  31425. *
  31426. * _.isObjectLike({});
  31427. * // => true
  31428. *
  31429. * _.isObjectLike([1, 2, 3]);
  31430. * // => true
  31431. *
  31432. * _.isObjectLike(_.noop);
  31433. * // => false
  31434. *
  31435. * _.isObjectLike(null);
  31436. * // => false
  31437. */
  31438. function isObjectLike(value) {
  31439. return value != null && typeof value == 'object';
  31440. }
  31441. module.exports = isObjectLike;
  31442. },{}],442:[function(require,module,exports){
  31443. var baseGetTag = require('./_baseGetTag'),
  31444. getPrototype = require('./_getPrototype'),
  31445. isObjectLike = require('./isObjectLike');
  31446. /** `Object#toString` result references. */
  31447. var objectTag = '[object Object]';
  31448. /** Used for built-in method references. */
  31449. var funcProto = Function.prototype,
  31450. objectProto = Object.prototype;
  31451. /** Used to resolve the decompiled source of functions. */
  31452. var funcToString = funcProto.toString;
  31453. /** Used to check objects for own properties. */
  31454. var hasOwnProperty = objectProto.hasOwnProperty;
  31455. /** Used to infer the `Object` constructor. */
  31456. var objectCtorString = funcToString.call(Object);
  31457. /**
  31458. * Checks if `value` is a plain object, that is, an object created by the
  31459. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  31460. *
  31461. * @static
  31462. * @memberOf _
  31463. * @since 0.8.0
  31464. * @category Lang
  31465. * @param {*} value The value to check.
  31466. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  31467. * @example
  31468. *
  31469. * function Foo() {
  31470. * this.a = 1;
  31471. * }
  31472. *
  31473. * _.isPlainObject(new Foo);
  31474. * // => false
  31475. *
  31476. * _.isPlainObject([1, 2, 3]);
  31477. * // => false
  31478. *
  31479. * _.isPlainObject({ 'x': 0, 'y': 0 });
  31480. * // => true
  31481. *
  31482. * _.isPlainObject(Object.create(null));
  31483. * // => true
  31484. */
  31485. function isPlainObject(value) {
  31486. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  31487. return false;
  31488. }
  31489. var proto = getPrototype(value);
  31490. if (proto === null) {
  31491. return true;
  31492. }
  31493. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  31494. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  31495. funcToString.call(Ctor) == objectCtorString;
  31496. }
  31497. module.exports = isPlainObject;
  31498. },{"./_baseGetTag":291,"./_getPrototype":356,"./isObjectLike":441}],443:[function(require,module,exports){
  31499. var baseIsRegExp = require('./_baseIsRegExp'),
  31500. baseUnary = require('./_baseUnary'),
  31501. nodeUtil = require('./_nodeUtil');
  31502. /* Node.js helper references. */
  31503. var nodeIsRegExp = nodeUtil && nodeUtil.isRegExp;
  31504. /**
  31505. * Checks if `value` is classified as a `RegExp` object.
  31506. *
  31507. * @static
  31508. * @memberOf _
  31509. * @since 0.1.0
  31510. * @category Lang
  31511. * @param {*} value The value to check.
  31512. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  31513. * @example
  31514. *
  31515. * _.isRegExp(/abc/);
  31516. * // => true
  31517. *
  31518. * _.isRegExp('/abc/');
  31519. * // => false
  31520. */
  31521. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  31522. module.exports = isRegExp;
  31523. },{"./_baseIsRegExp":301,"./_baseUnary":320,"./_nodeUtil":395}],444:[function(require,module,exports){
  31524. var baseGetTag = require('./_baseGetTag'),
  31525. isArray = require('./isArray'),
  31526. isObjectLike = require('./isObjectLike');
  31527. /** `Object#toString` result references. */
  31528. var stringTag = '[object String]';
  31529. /**
  31530. * Checks if `value` is classified as a `String` primitive or object.
  31531. *
  31532. * @static
  31533. * @since 0.1.0
  31534. * @memberOf _
  31535. * @category Lang
  31536. * @param {*} value The value to check.
  31537. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  31538. * @example
  31539. *
  31540. * _.isString('abc');
  31541. * // => true
  31542. *
  31543. * _.isString(1);
  31544. * // => false
  31545. */
  31546. function isString(value) {
  31547. return typeof value == 'string' ||
  31548. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  31549. }
  31550. module.exports = isString;
  31551. },{"./_baseGetTag":291,"./isArray":433,"./isObjectLike":441}],445:[function(require,module,exports){
  31552. var baseGetTag = require('./_baseGetTag'),
  31553. isObjectLike = require('./isObjectLike');
  31554. /** `Object#toString` result references. */
  31555. var symbolTag = '[object Symbol]';
  31556. /**
  31557. * Checks if `value` is classified as a `Symbol` primitive or object.
  31558. *
  31559. * @static
  31560. * @memberOf _
  31561. * @since 4.0.0
  31562. * @category Lang
  31563. * @param {*} value The value to check.
  31564. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  31565. * @example
  31566. *
  31567. * _.isSymbol(Symbol.iterator);
  31568. * // => true
  31569. *
  31570. * _.isSymbol('abc');
  31571. * // => false
  31572. */
  31573. function isSymbol(value) {
  31574. return typeof value == 'symbol' ||
  31575. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  31576. }
  31577. module.exports = isSymbol;
  31578. },{"./_baseGetTag":291,"./isObjectLike":441}],446:[function(require,module,exports){
  31579. var baseIsTypedArray = require('./_baseIsTypedArray'),
  31580. baseUnary = require('./_baseUnary'),
  31581. nodeUtil = require('./_nodeUtil');
  31582. /* Node.js helper references. */
  31583. var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  31584. /**
  31585. * Checks if `value` is classified as a typed array.
  31586. *
  31587. * @static
  31588. * @memberOf _
  31589. * @since 3.0.0
  31590. * @category Lang
  31591. * @param {*} value The value to check.
  31592. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  31593. * @example
  31594. *
  31595. * _.isTypedArray(new Uint8Array);
  31596. * // => true
  31597. *
  31598. * _.isTypedArray([]);
  31599. * // => false
  31600. */
  31601. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  31602. module.exports = isTypedArray;
  31603. },{"./_baseIsTypedArray":302,"./_baseUnary":320,"./_nodeUtil":395}],447:[function(require,module,exports){
  31604. var arrayLikeKeys = require('./_arrayLikeKeys'),
  31605. baseKeys = require('./_baseKeys'),
  31606. isArrayLike = require('./isArrayLike');
  31607. /**
  31608. * Creates an array of the own enumerable property names of `object`.
  31609. *
  31610. * **Note:** Non-object values are coerced to objects. See the
  31611. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  31612. * for more details.
  31613. *
  31614. * @static
  31615. * @since 0.1.0
  31616. * @memberOf _
  31617. * @category Object
  31618. * @param {Object} object The object to query.
  31619. * @returns {Array} Returns the array of property names.
  31620. * @example
  31621. *
  31622. * function Foo() {
  31623. * this.a = 1;
  31624. * this.b = 2;
  31625. * }
  31626. *
  31627. * Foo.prototype.c = 3;
  31628. *
  31629. * _.keys(new Foo);
  31630. * // => ['a', 'b'] (iteration order is not guaranteed)
  31631. *
  31632. * _.keys('hi');
  31633. * // => ['0', '1']
  31634. */
  31635. function keys(object) {
  31636. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  31637. }
  31638. module.exports = keys;
  31639. },{"./_arrayLikeKeys":270,"./_baseKeys":304,"./isArrayLike":434}],448:[function(require,module,exports){
  31640. var arrayLikeKeys = require('./_arrayLikeKeys'),
  31641. baseKeysIn = require('./_baseKeysIn'),
  31642. isArrayLike = require('./isArrayLike');
  31643. /**
  31644. * Creates an array of the own and inherited enumerable property names of `object`.
  31645. *
  31646. * **Note:** Non-object values are coerced to objects.
  31647. *
  31648. * @static
  31649. * @memberOf _
  31650. * @since 3.0.0
  31651. * @category Object
  31652. * @param {Object} object The object to query.
  31653. * @returns {Array} Returns the array of property names.
  31654. * @example
  31655. *
  31656. * function Foo() {
  31657. * this.a = 1;
  31658. * this.b = 2;
  31659. * }
  31660. *
  31661. * Foo.prototype.c = 3;
  31662. *
  31663. * _.keysIn(new Foo);
  31664. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  31665. */
  31666. function keysIn(object) {
  31667. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  31668. }
  31669. module.exports = keysIn;
  31670. },{"./_arrayLikeKeys":270,"./_baseKeysIn":305,"./isArrayLike":434}],449:[function(require,module,exports){
  31671. var arrayMap = require('./_arrayMap'),
  31672. baseIteratee = require('./_baseIteratee'),
  31673. baseMap = require('./_baseMap'),
  31674. isArray = require('./isArray');
  31675. /**
  31676. * Creates an array of values by running each element in `collection` thru
  31677. * `iteratee`. The iteratee is invoked with three arguments:
  31678. * (value, index|key, collection).
  31679. *
  31680. * Many lodash methods are guarded to work as iteratees for methods like
  31681. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  31682. *
  31683. * The guarded methods are:
  31684. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  31685. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  31686. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  31687. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  31688. *
  31689. * @static
  31690. * @memberOf _
  31691. * @since 0.1.0
  31692. * @category Collection
  31693. * @param {Array|Object} collection The collection to iterate over.
  31694. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  31695. * @returns {Array} Returns the new mapped array.
  31696. * @example
  31697. *
  31698. * function square(n) {
  31699. * return n * n;
  31700. * }
  31701. *
  31702. * _.map([4, 8], square);
  31703. * // => [16, 64]
  31704. *
  31705. * _.map({ 'a': 4, 'b': 8 }, square);
  31706. * // => [16, 64] (iteration order is not guaranteed)
  31707. *
  31708. * var users = [
  31709. * { 'user': 'barney' },
  31710. * { 'user': 'fred' }
  31711. * ];
  31712. *
  31713. * // The `_.property` iteratee shorthand.
  31714. * _.map(users, 'user');
  31715. * // => ['barney', 'fred']
  31716. */
  31717. function map(collection, iteratee) {
  31718. var func = isArray(collection) ? arrayMap : baseMap;
  31719. return func(collection, baseIteratee(iteratee, 3));
  31720. }
  31721. module.exports = map;
  31722. },{"./_arrayMap":271,"./_baseIteratee":303,"./_baseMap":306,"./isArray":433}],450:[function(require,module,exports){
  31723. var MapCache = require('./_MapCache');
  31724. /** Error message constants. */
  31725. var FUNC_ERROR_TEXT = 'Expected a function';
  31726. /**
  31727. * Creates a function that memoizes the result of `func`. If `resolver` is
  31728. * provided, it determines the cache key for storing the result based on the
  31729. * arguments provided to the memoized function. By default, the first argument
  31730. * provided to the memoized function is used as the map cache key. The `func`
  31731. * is invoked with the `this` binding of the memoized function.
  31732. *
  31733. * **Note:** The cache is exposed as the `cache` property on the memoized
  31734. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  31735. * constructor with one whose instances implement the
  31736. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  31737. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  31738. *
  31739. * @static
  31740. * @memberOf _
  31741. * @since 0.1.0
  31742. * @category Function
  31743. * @param {Function} func The function to have its output memoized.
  31744. * @param {Function} [resolver] The function to resolve the cache key.
  31745. * @returns {Function} Returns the new memoized function.
  31746. * @example
  31747. *
  31748. * var object = { 'a': 1, 'b': 2 };
  31749. * var other = { 'c': 3, 'd': 4 };
  31750. *
  31751. * var values = _.memoize(_.values);
  31752. * values(object);
  31753. * // => [1, 2]
  31754. *
  31755. * values(other);
  31756. * // => [3, 4]
  31757. *
  31758. * object.a = 2;
  31759. * values(object);
  31760. * // => [1, 2]
  31761. *
  31762. * // Modify the result cache.
  31763. * values.cache.set(object, ['a', 'b']);
  31764. * values(object);
  31765. * // => ['a', 'b']
  31766. *
  31767. * // Replace `_.memoize.Cache`.
  31768. * _.memoize.Cache = WeakMap;
  31769. */
  31770. function memoize(func, resolver) {
  31771. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  31772. throw new TypeError(FUNC_ERROR_TEXT);
  31773. }
  31774. var memoized = function() {
  31775. var args = arguments,
  31776. key = resolver ? resolver.apply(this, args) : args[0],
  31777. cache = memoized.cache;
  31778. if (cache.has(key)) {
  31779. return cache.get(key);
  31780. }
  31781. var result = func.apply(this, args);
  31782. memoized.cache = cache.set(key, result) || cache;
  31783. return result;
  31784. };
  31785. memoized.cache = new (memoize.Cache || MapCache);
  31786. return memoized;
  31787. }
  31788. // Expose `MapCache`.
  31789. memoize.Cache = MapCache;
  31790. module.exports = memoize;
  31791. },{"./_MapCache":255}],451:[function(require,module,exports){
  31792. var baseMerge = require('./_baseMerge'),
  31793. createAssigner = require('./_createAssigner');
  31794. /**
  31795. * This method is like `_.merge` except that it accepts `customizer` which
  31796. * is invoked to produce the merged values of the destination and source
  31797. * properties. If `customizer` returns `undefined`, merging is handled by the
  31798. * method instead. The `customizer` is invoked with six arguments:
  31799. * (objValue, srcValue, key, object, source, stack).
  31800. *
  31801. * **Note:** This method mutates `object`.
  31802. *
  31803. * @static
  31804. * @memberOf _
  31805. * @since 4.0.0
  31806. * @category Object
  31807. * @param {Object} object The destination object.
  31808. * @param {...Object} sources The source objects.
  31809. * @param {Function} customizer The function to customize assigned values.
  31810. * @returns {Object} Returns `object`.
  31811. * @example
  31812. *
  31813. * function customizer(objValue, srcValue) {
  31814. * if (_.isArray(objValue)) {
  31815. * return objValue.concat(srcValue);
  31816. * }
  31817. * }
  31818. *
  31819. * var object = { 'a': [1], 'b': [2] };
  31820. * var other = { 'a': [3], 'b': [4] };
  31821. *
  31822. * _.mergeWith(object, other, customizer);
  31823. * // => { 'a': [1, 3], 'b': [2, 4] }
  31824. */
  31825. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  31826. baseMerge(object, source, srcIndex, customizer);
  31827. });
  31828. module.exports = mergeWith;
  31829. },{"./_baseMerge":309,"./_createAssigner":340}],452:[function(require,module,exports){
  31830. /**
  31831. * This method returns `undefined`.
  31832. *
  31833. * @static
  31834. * @memberOf _
  31835. * @since 2.3.0
  31836. * @category Util
  31837. * @example
  31838. *
  31839. * _.times(2, _.noop);
  31840. * // => [undefined, undefined]
  31841. */
  31842. function noop() {
  31843. // No operation performed.
  31844. }
  31845. module.exports = noop;
  31846. },{}],453:[function(require,module,exports){
  31847. var baseProperty = require('./_baseProperty'),
  31848. basePropertyDeep = require('./_basePropertyDeep'),
  31849. isKey = require('./_isKey'),
  31850. toKey = require('./_toKey');
  31851. /**
  31852. * Creates a function that returns the value at `path` of a given object.
  31853. *
  31854. * @static
  31855. * @memberOf _
  31856. * @since 2.4.0
  31857. * @category Util
  31858. * @param {Array|string} path The path of the property to get.
  31859. * @returns {Function} Returns the new accessor function.
  31860. * @example
  31861. *
  31862. * var objects = [
  31863. * { 'a': { 'b': 2 } },
  31864. * { 'a': { 'b': 1 } }
  31865. * ];
  31866. *
  31867. * _.map(objects, _.property('a.b'));
  31868. * // => [2, 1]
  31869. *
  31870. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  31871. * // => [1, 2]
  31872. */
  31873. function property(path) {
  31874. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  31875. }
  31876. module.exports = property;
  31877. },{"./_baseProperty":312,"./_basePropertyDeep":313,"./_isKey":374,"./_toKey":412}],454:[function(require,module,exports){
  31878. var baseRepeat = require('./_baseRepeat'),
  31879. isIterateeCall = require('./_isIterateeCall'),
  31880. toInteger = require('./toInteger'),
  31881. toString = require('./toString');
  31882. /**
  31883. * Repeats the given string `n` times.
  31884. *
  31885. * @static
  31886. * @memberOf _
  31887. * @since 3.0.0
  31888. * @category String
  31889. * @param {string} [string=''] The string to repeat.
  31890. * @param {number} [n=1] The number of times to repeat the string.
  31891. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  31892. * @returns {string} Returns the repeated string.
  31893. * @example
  31894. *
  31895. * _.repeat('*', 3);
  31896. * // => '***'
  31897. *
  31898. * _.repeat('abc', 2);
  31899. * // => 'abcabc'
  31900. *
  31901. * _.repeat('abc', 0);
  31902. * // => ''
  31903. */
  31904. function repeat(string, n, guard) {
  31905. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  31906. n = 1;
  31907. } else {
  31908. n = toInteger(n);
  31909. }
  31910. return baseRepeat(toString(string), n);
  31911. }
  31912. module.exports = repeat;
  31913. },{"./_baseRepeat":314,"./_isIterateeCall":373,"./toInteger":460,"./toString":463}],455:[function(require,module,exports){
  31914. var baseFlatten = require('./_baseFlatten'),
  31915. baseOrderBy = require('./_baseOrderBy'),
  31916. baseRest = require('./_baseRest'),
  31917. isIterateeCall = require('./_isIterateeCall');
  31918. /**
  31919. * Creates an array of elements, sorted in ascending order by the results of
  31920. * running each element in a collection thru each iteratee. This method
  31921. * performs a stable sort, that is, it preserves the original sort order of
  31922. * equal elements. The iteratees are invoked with one argument: (value).
  31923. *
  31924. * @static
  31925. * @memberOf _
  31926. * @since 0.1.0
  31927. * @category Collection
  31928. * @param {Array|Object} collection The collection to iterate over.
  31929. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  31930. * The iteratees to sort by.
  31931. * @returns {Array} Returns the new sorted array.
  31932. * @example
  31933. *
  31934. * var users = [
  31935. * { 'user': 'fred', 'age': 48 },
  31936. * { 'user': 'barney', 'age': 36 },
  31937. * { 'user': 'fred', 'age': 40 },
  31938. * { 'user': 'barney', 'age': 34 }
  31939. * ];
  31940. *
  31941. * _.sortBy(users, [function(o) { return o.user; }]);
  31942. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  31943. *
  31944. * _.sortBy(users, ['user', 'age']);
  31945. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  31946. */
  31947. var sortBy = baseRest(function(collection, iteratees) {
  31948. if (collection == null) {
  31949. return [];
  31950. }
  31951. var length = iteratees.length;
  31952. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  31953. iteratees = [];
  31954. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  31955. iteratees = [iteratees[0]];
  31956. }
  31957. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  31958. });
  31959. module.exports = sortBy;
  31960. },{"./_baseFlatten":286,"./_baseOrderBy":311,"./_baseRest":315,"./_isIterateeCall":373}],456:[function(require,module,exports){
  31961. var baseClamp = require('./_baseClamp'),
  31962. baseToString = require('./_baseToString'),
  31963. toInteger = require('./toInteger'),
  31964. toString = require('./toString');
  31965. /**
  31966. * Checks if `string` starts with the given target string.
  31967. *
  31968. * @static
  31969. * @memberOf _
  31970. * @since 3.0.0
  31971. * @category String
  31972. * @param {string} [string=''] The string to inspect.
  31973. * @param {string} [target] The string to search for.
  31974. * @param {number} [position=0] The position to search from.
  31975. * @returns {boolean} Returns `true` if `string` starts with `target`,
  31976. * else `false`.
  31977. * @example
  31978. *
  31979. * _.startsWith('abc', 'a');
  31980. * // => true
  31981. *
  31982. * _.startsWith('abc', 'b');
  31983. * // => false
  31984. *
  31985. * _.startsWith('abc', 'b', 1);
  31986. * // => true
  31987. */
  31988. function startsWith(string, target, position) {
  31989. string = toString(string);
  31990. position = position == null
  31991. ? 0
  31992. : baseClamp(toInteger(position), 0, string.length);
  31993. target = baseToString(target);
  31994. return string.slice(position, position + target.length) == target;
  31995. }
  31996. module.exports = startsWith;
  31997. },{"./_baseClamp":281,"./_baseToString":319,"./toInteger":460,"./toString":463}],457:[function(require,module,exports){
  31998. /**
  31999. * This method returns a new empty array.
  32000. *
  32001. * @static
  32002. * @memberOf _
  32003. * @since 4.13.0
  32004. * @category Util
  32005. * @returns {Array} Returns the new empty array.
  32006. * @example
  32007. *
  32008. * var arrays = _.times(2, _.stubArray);
  32009. *
  32010. * console.log(arrays);
  32011. * // => [[], []]
  32012. *
  32013. * console.log(arrays[0] === arrays[1]);
  32014. * // => false
  32015. */
  32016. function stubArray() {
  32017. return [];
  32018. }
  32019. module.exports = stubArray;
  32020. },{}],458:[function(require,module,exports){
  32021. /**
  32022. * This method returns `false`.
  32023. *
  32024. * @static
  32025. * @memberOf _
  32026. * @since 4.13.0
  32027. * @category Util
  32028. * @returns {boolean} Returns `false`.
  32029. * @example
  32030. *
  32031. * _.times(2, _.stubFalse);
  32032. * // => [false, false]
  32033. */
  32034. function stubFalse() {
  32035. return false;
  32036. }
  32037. module.exports = stubFalse;
  32038. },{}],459:[function(require,module,exports){
  32039. var toNumber = require('./toNumber');
  32040. /** Used as references for various `Number` constants. */
  32041. var INFINITY = 1 / 0,
  32042. MAX_INTEGER = 1.7976931348623157e+308;
  32043. /**
  32044. * Converts `value` to a finite number.
  32045. *
  32046. * @static
  32047. * @memberOf _
  32048. * @since 4.12.0
  32049. * @category Lang
  32050. * @param {*} value The value to convert.
  32051. * @returns {number} Returns the converted number.
  32052. * @example
  32053. *
  32054. * _.toFinite(3.2);
  32055. * // => 3.2
  32056. *
  32057. * _.toFinite(Number.MIN_VALUE);
  32058. * // => 5e-324
  32059. *
  32060. * _.toFinite(Infinity);
  32061. * // => 1.7976931348623157e+308
  32062. *
  32063. * _.toFinite('3.2');
  32064. * // => 3.2
  32065. */
  32066. function toFinite(value) {
  32067. if (!value) {
  32068. return value === 0 ? value : 0;
  32069. }
  32070. value = toNumber(value);
  32071. if (value === INFINITY || value === -INFINITY) {
  32072. var sign = (value < 0 ? -1 : 1);
  32073. return sign * MAX_INTEGER;
  32074. }
  32075. return value === value ? value : 0;
  32076. }
  32077. module.exports = toFinite;
  32078. },{"./toNumber":461}],460:[function(require,module,exports){
  32079. var toFinite = require('./toFinite');
  32080. /**
  32081. * Converts `value` to an integer.
  32082. *
  32083. * **Note:** This method is loosely based on
  32084. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  32085. *
  32086. * @static
  32087. * @memberOf _
  32088. * @since 4.0.0
  32089. * @category Lang
  32090. * @param {*} value The value to convert.
  32091. * @returns {number} Returns the converted integer.
  32092. * @example
  32093. *
  32094. * _.toInteger(3.2);
  32095. * // => 3
  32096. *
  32097. * _.toInteger(Number.MIN_VALUE);
  32098. * // => 0
  32099. *
  32100. * _.toInteger(Infinity);
  32101. * // => 1.7976931348623157e+308
  32102. *
  32103. * _.toInteger('3.2');
  32104. * // => 3
  32105. */
  32106. function toInteger(value) {
  32107. var result = toFinite(value),
  32108. remainder = result % 1;
  32109. return result === result ? (remainder ? result - remainder : result) : 0;
  32110. }
  32111. module.exports = toInteger;
  32112. },{"./toFinite":459}],461:[function(require,module,exports){
  32113. var isObject = require('./isObject'),
  32114. isSymbol = require('./isSymbol');
  32115. /** Used as references for various `Number` constants. */
  32116. var NAN = 0 / 0;
  32117. /** Used to match leading and trailing whitespace. */
  32118. var reTrim = /^\s+|\s+$/g;
  32119. /** Used to detect bad signed hexadecimal string values. */
  32120. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  32121. /** Used to detect binary string values. */
  32122. var reIsBinary = /^0b[01]+$/i;
  32123. /** Used to detect octal string values. */
  32124. var reIsOctal = /^0o[0-7]+$/i;
  32125. /** Built-in method references without a dependency on `root`. */
  32126. var freeParseInt = parseInt;
  32127. /**
  32128. * Converts `value` to a number.
  32129. *
  32130. * @static
  32131. * @memberOf _
  32132. * @since 4.0.0
  32133. * @category Lang
  32134. * @param {*} value The value to process.
  32135. * @returns {number} Returns the number.
  32136. * @example
  32137. *
  32138. * _.toNumber(3.2);
  32139. * // => 3.2
  32140. *
  32141. * _.toNumber(Number.MIN_VALUE);
  32142. * // => 5e-324
  32143. *
  32144. * _.toNumber(Infinity);
  32145. * // => Infinity
  32146. *
  32147. * _.toNumber('3.2');
  32148. * // => 3.2
  32149. */
  32150. function toNumber(value) {
  32151. if (typeof value == 'number') {
  32152. return value;
  32153. }
  32154. if (isSymbol(value)) {
  32155. return NAN;
  32156. }
  32157. if (isObject(value)) {
  32158. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  32159. value = isObject(other) ? (other + '') : other;
  32160. }
  32161. if (typeof value != 'string') {
  32162. return value === 0 ? value : +value;
  32163. }
  32164. value = value.replace(reTrim, '');
  32165. var isBinary = reIsBinary.test(value);
  32166. return (isBinary || reIsOctal.test(value))
  32167. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  32168. : (reIsBadHex.test(value) ? NAN : +value);
  32169. }
  32170. module.exports = toNumber;
  32171. },{"./isObject":440,"./isSymbol":445}],462:[function(require,module,exports){
  32172. var copyObject = require('./_copyObject'),
  32173. keysIn = require('./keysIn');
  32174. /**
  32175. * Converts `value` to a plain object flattening inherited enumerable string
  32176. * keyed properties of `value` to own properties of the plain object.
  32177. *
  32178. * @static
  32179. * @memberOf _
  32180. * @since 3.0.0
  32181. * @category Lang
  32182. * @param {*} value The value to convert.
  32183. * @returns {Object} Returns the converted plain object.
  32184. * @example
  32185. *
  32186. * function Foo() {
  32187. * this.b = 2;
  32188. * }
  32189. *
  32190. * Foo.prototype.c = 3;
  32191. *
  32192. * _.assign({ 'a': 1 }, new Foo);
  32193. * // => { 'a': 1, 'b': 2 }
  32194. *
  32195. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  32196. * // => { 'a': 1, 'b': 2, 'c': 3 }
  32197. */
  32198. function toPlainObject(value) {
  32199. return copyObject(value, keysIn(value));
  32200. }
  32201. module.exports = toPlainObject;
  32202. },{"./_copyObject":336,"./keysIn":448}],463:[function(require,module,exports){
  32203. var baseToString = require('./_baseToString');
  32204. /**
  32205. * Converts `value` to a string. An empty string is returned for `null`
  32206. * and `undefined` values. The sign of `-0` is preserved.
  32207. *
  32208. * @static
  32209. * @memberOf _
  32210. * @since 4.0.0
  32211. * @category Lang
  32212. * @param {*} value The value to convert.
  32213. * @returns {string} Returns the converted string.
  32214. * @example
  32215. *
  32216. * _.toString(null);
  32217. * // => ''
  32218. *
  32219. * _.toString(-0);
  32220. * // => '-0'
  32221. *
  32222. * _.toString([1, 2, 3]);
  32223. * // => '1,2,3'
  32224. */
  32225. function toString(value) {
  32226. return value == null ? '' : baseToString(value);
  32227. }
  32228. module.exports = toString;
  32229. },{"./_baseToString":319}],464:[function(require,module,exports){
  32230. var baseUniq = require('./_baseUniq');
  32231. /**
  32232. * Creates a duplicate-free version of an array, using
  32233. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  32234. * for equality comparisons, in which only the first occurrence of each element
  32235. * is kept. The order of result values is determined by the order they occur
  32236. * in the array.
  32237. *
  32238. * @static
  32239. * @memberOf _
  32240. * @since 0.1.0
  32241. * @category Array
  32242. * @param {Array} array The array to inspect.
  32243. * @returns {Array} Returns the new duplicate free array.
  32244. * @example
  32245. *
  32246. * _.uniq([2, 1, 2]);
  32247. * // => [2, 1]
  32248. */
  32249. function uniq(array) {
  32250. return (array && array.length) ? baseUniq(array) : [];
  32251. }
  32252. module.exports = uniq;
  32253. },{"./_baseUniq":321}],465:[function(require,module,exports){
  32254. var baseValues = require('./_baseValues'),
  32255. keys = require('./keys');
  32256. /**
  32257. * Creates an array of the own enumerable string keyed property values of `object`.
  32258. *
  32259. * **Note:** Non-object values are coerced to objects.
  32260. *
  32261. * @static
  32262. * @since 0.1.0
  32263. * @memberOf _
  32264. * @category Object
  32265. * @param {Object} object The object to query.
  32266. * @returns {Array} Returns the array of property values.
  32267. * @example
  32268. *
  32269. * function Foo() {
  32270. * this.a = 1;
  32271. * this.b = 2;
  32272. * }
  32273. *
  32274. * Foo.prototype.c = 3;
  32275. *
  32276. * _.values(new Foo);
  32277. * // => [1, 2] (iteration order is not guaranteed)
  32278. *
  32279. * _.values('hi');
  32280. * // => ['h', 'i']
  32281. */
  32282. function values(object) {
  32283. return object == null ? [] : baseValues(object, keys(object));
  32284. }
  32285. module.exports = values;
  32286. },{"./_baseValues":322,"./keys":447}],466:[function(require,module,exports){
  32287. module.exports = minimatch
  32288. minimatch.Minimatch = Minimatch
  32289. var path = { sep: '/' }
  32290. try {
  32291. path = require('path')
  32292. } catch (er) {}
  32293. var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}
  32294. var expand = require('brace-expansion')
  32295. var plTypes = {
  32296. '!': { open: '(?:(?!(?:', close: '))[^/]*?)'},
  32297. '?': { open: '(?:', close: ')?' },
  32298. '+': { open: '(?:', close: ')+' },
  32299. '*': { open: '(?:', close: ')*' },
  32300. '@': { open: '(?:', close: ')' }
  32301. }
  32302. // any single thing other than /
  32303. // don't need to escape / when using new RegExp()
  32304. var qmark = '[^/]'
  32305. // * => any number of characters
  32306. var star = qmark + '*?'
  32307. // ** when dots are allowed. Anything goes, except .. and .
  32308. // not (^ or / followed by one or two dots followed by $ or /),
  32309. // followed by anything, any number of times.
  32310. var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?'
  32311. // not a ^ or / followed by a dot,
  32312. // followed by anything, any number of times.
  32313. var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?'
  32314. // characters that need to be escaped in RegExp.
  32315. var reSpecials = charSet('().*{}+?[]^$\\!')
  32316. // "abc" -> { a:true, b:true, c:true }
  32317. function charSet (s) {
  32318. return s.split('').reduce(function (set, c) {
  32319. set[c] = true
  32320. return set
  32321. }, {})
  32322. }
  32323. // normalizes slashes.
  32324. var slashSplit = /\/+/
  32325. minimatch.filter = filter
  32326. function filter (pattern, options) {
  32327. options = options || {}
  32328. return function (p, i, list) {
  32329. return minimatch(p, pattern, options)
  32330. }
  32331. }
  32332. function ext (a, b) {
  32333. a = a || {}
  32334. b = b || {}
  32335. var t = {}
  32336. Object.keys(b).forEach(function (k) {
  32337. t[k] = b[k]
  32338. })
  32339. Object.keys(a).forEach(function (k) {
  32340. t[k] = a[k]
  32341. })
  32342. return t
  32343. }
  32344. minimatch.defaults = function (def) {
  32345. if (!def || !Object.keys(def).length) return minimatch
  32346. var orig = minimatch
  32347. var m = function minimatch (p, pattern, options) {
  32348. return orig.minimatch(p, pattern, ext(def, options))
  32349. }
  32350. m.Minimatch = function Minimatch (pattern, options) {
  32351. return new orig.Minimatch(pattern, ext(def, options))
  32352. }
  32353. return m
  32354. }
  32355. Minimatch.defaults = function (def) {
  32356. if (!def || !Object.keys(def).length) return Minimatch
  32357. return minimatch.defaults(def).Minimatch
  32358. }
  32359. function minimatch (p, pattern, options) {
  32360. if (typeof pattern !== 'string') {
  32361. throw new TypeError('glob pattern string required')
  32362. }
  32363. if (!options) options = {}
  32364. // shortcut: comments match nothing.
  32365. if (!options.nocomment && pattern.charAt(0) === '#') {
  32366. return false
  32367. }
  32368. // "" only matches ""
  32369. if (pattern.trim() === '') return p === ''
  32370. return new Minimatch(pattern, options).match(p)
  32371. }
  32372. function Minimatch (pattern, options) {
  32373. if (!(this instanceof Minimatch)) {
  32374. return new Minimatch(pattern, options)
  32375. }
  32376. if (typeof pattern !== 'string') {
  32377. throw new TypeError('glob pattern string required')
  32378. }
  32379. if (!options) options = {}
  32380. pattern = pattern.trim()
  32381. // windows support: need to use /, not \
  32382. if (path.sep !== '/') {
  32383. pattern = pattern.split(path.sep).join('/')
  32384. }
  32385. this.options = options
  32386. this.set = []
  32387. this.pattern = pattern
  32388. this.regexp = null
  32389. this.negate = false
  32390. this.comment = false
  32391. this.empty = false
  32392. // make the set of regexps etc.
  32393. this.make()
  32394. }
  32395. Minimatch.prototype.debug = function () {}
  32396. Minimatch.prototype.make = make
  32397. function make () {
  32398. // don't do it more than once.
  32399. if (this._made) return
  32400. var pattern = this.pattern
  32401. var options = this.options
  32402. // empty patterns and comments match nothing.
  32403. if (!options.nocomment && pattern.charAt(0) === '#') {
  32404. this.comment = true
  32405. return
  32406. }
  32407. if (!pattern) {
  32408. this.empty = true
  32409. return
  32410. }
  32411. // step 1: figure out negation, etc.
  32412. this.parseNegate()
  32413. // step 2: expand braces
  32414. var set = this.globSet = this.braceExpand()
  32415. if (options.debug) this.debug = console.error
  32416. this.debug(this.pattern, set)
  32417. // step 3: now we have a set, so turn each one into a series of path-portion
  32418. // matching patterns.
  32419. // These will be regexps, except in the case of "**", which is
  32420. // set to the GLOBSTAR object for globstar behavior,
  32421. // and will not contain any / characters
  32422. set = this.globParts = set.map(function (s) {
  32423. return s.split(slashSplit)
  32424. })
  32425. this.debug(this.pattern, set)
  32426. // glob --> regexps
  32427. set = set.map(function (s, si, set) {
  32428. return s.map(this.parse, this)
  32429. }, this)
  32430. this.debug(this.pattern, set)
  32431. // filter out everything that didn't compile properly.
  32432. set = set.filter(function (s) {
  32433. return s.indexOf(false) === -1
  32434. })
  32435. this.debug(this.pattern, set)
  32436. this.set = set
  32437. }
  32438. Minimatch.prototype.parseNegate = parseNegate
  32439. function parseNegate () {
  32440. var pattern = this.pattern
  32441. var negate = false
  32442. var options = this.options
  32443. var negateOffset = 0
  32444. if (options.nonegate) return
  32445. for (var i = 0, l = pattern.length
  32446. ; i < l && pattern.charAt(i) === '!'
  32447. ; i++) {
  32448. negate = !negate
  32449. negateOffset++
  32450. }
  32451. if (negateOffset) this.pattern = pattern.substr(negateOffset)
  32452. this.negate = negate
  32453. }
  32454. // Brace expansion:
  32455. // a{b,c}d -> abd acd
  32456. // a{b,}c -> abc ac
  32457. // a{0..3}d -> a0d a1d a2d a3d
  32458. // a{b,c{d,e}f}g -> abg acdfg acefg
  32459. // a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
  32460. //
  32461. // Invalid sets are not expanded.
  32462. // a{2..}b -> a{2..}b
  32463. // a{b}c -> a{b}c
  32464. minimatch.braceExpand = function (pattern, options) {
  32465. return braceExpand(pattern, options)
  32466. }
  32467. Minimatch.prototype.braceExpand = braceExpand
  32468. function braceExpand (pattern, options) {
  32469. if (!options) {
  32470. if (this instanceof Minimatch) {
  32471. options = this.options
  32472. } else {
  32473. options = {}
  32474. }
  32475. }
  32476. pattern = typeof pattern === 'undefined'
  32477. ? this.pattern : pattern
  32478. if (typeof pattern === 'undefined') {
  32479. throw new TypeError('undefined pattern')
  32480. }
  32481. if (options.nobrace ||
  32482. !pattern.match(/\{.*\}/)) {
  32483. // shortcut. no need to expand.
  32484. return [pattern]
  32485. }
  32486. return expand(pattern)
  32487. }
  32488. // parse a component of the expanded set.
  32489. // At this point, no pattern may contain "/" in it
  32490. // so we're going to return a 2d array, where each entry is the full
  32491. // pattern, split on '/', and then turned into a regular expression.
  32492. // A regexp is made at the end which joins each array with an
  32493. // escaped /, and another full one which joins each regexp with |.
  32494. //
  32495. // Following the lead of Bash 4.1, note that "**" only has special meaning
  32496. // when it is the *only* thing in a path portion. Otherwise, any series
  32497. // of * is equivalent to a single *. Globstar behavior is enabled by
  32498. // default, and can be disabled by setting options.noglobstar.
  32499. Minimatch.prototype.parse = parse
  32500. var SUBPARSE = {}
  32501. function parse (pattern, isSub) {
  32502. if (pattern.length > 1024 * 64) {
  32503. throw new TypeError('pattern is too long')
  32504. }
  32505. var options = this.options
  32506. // shortcuts
  32507. if (!options.noglobstar && pattern === '**') return GLOBSTAR
  32508. if (pattern === '') return ''
  32509. var re = ''
  32510. var hasMagic = !!options.nocase
  32511. var escaping = false
  32512. // ? => one single character
  32513. var patternListStack = []
  32514. var negativeLists = []
  32515. var stateChar
  32516. var inClass = false
  32517. var reClassStart = -1
  32518. var classStart = -1
  32519. // . and .. never match anything that doesn't start with .,
  32520. // even when options.dot is set.
  32521. var patternStart = pattern.charAt(0) === '.' ? '' // anything
  32522. // not (start or / followed by . or .. followed by / or end)
  32523. : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))'
  32524. : '(?!\\.)'
  32525. var self = this
  32526. function clearStateChar () {
  32527. if (stateChar) {
  32528. // we had some state-tracking character
  32529. // that wasn't consumed by this pass.
  32530. switch (stateChar) {
  32531. case '*':
  32532. re += star
  32533. hasMagic = true
  32534. break
  32535. case '?':
  32536. re += qmark
  32537. hasMagic = true
  32538. break
  32539. default:
  32540. re += '\\' + stateChar
  32541. break
  32542. }
  32543. self.debug('clearStateChar %j %j', stateChar, re)
  32544. stateChar = false
  32545. }
  32546. }
  32547. for (var i = 0, len = pattern.length, c
  32548. ; (i < len) && (c = pattern.charAt(i))
  32549. ; i++) {
  32550. this.debug('%s\t%s %s %j', pattern, i, re, c)
  32551. // skip over any that are escaped.
  32552. if (escaping && reSpecials[c]) {
  32553. re += '\\' + c
  32554. escaping = false
  32555. continue
  32556. }
  32557. switch (c) {
  32558. case '/':
  32559. // completely not allowed, even escaped.
  32560. // Should already be path-split by now.
  32561. return false
  32562. case '\\':
  32563. clearStateChar()
  32564. escaping = true
  32565. continue
  32566. // the various stateChar values
  32567. // for the "extglob" stuff.
  32568. case '?':
  32569. case '*':
  32570. case '+':
  32571. case '@':
  32572. case '!':
  32573. this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c)
  32574. // all of those are literals inside a class, except that
  32575. // the glob [!a] means [^a] in regexp
  32576. if (inClass) {
  32577. this.debug(' in class')
  32578. if (c === '!' && i === classStart + 1) c = '^'
  32579. re += c
  32580. continue
  32581. }
  32582. // if we already have a stateChar, then it means
  32583. // that there was something like ** or +? in there.
  32584. // Handle the stateChar, then proceed with this one.
  32585. self.debug('call clearStateChar %j', stateChar)
  32586. clearStateChar()
  32587. stateChar = c
  32588. // if extglob is disabled, then +(asdf|foo) isn't a thing.
  32589. // just clear the statechar *now*, rather than even diving into
  32590. // the patternList stuff.
  32591. if (options.noext) clearStateChar()
  32592. continue
  32593. case '(':
  32594. if (inClass) {
  32595. re += '('
  32596. continue
  32597. }
  32598. if (!stateChar) {
  32599. re += '\\('
  32600. continue
  32601. }
  32602. patternListStack.push({
  32603. type: stateChar,
  32604. start: i - 1,
  32605. reStart: re.length,
  32606. open: plTypes[stateChar].open,
  32607. close: plTypes[stateChar].close
  32608. })
  32609. // negation is (?:(?!js)[^/]*)
  32610. re += stateChar === '!' ? '(?:(?!(?:' : '(?:'
  32611. this.debug('plType %j %j', stateChar, re)
  32612. stateChar = false
  32613. continue
  32614. case ')':
  32615. if (inClass || !patternListStack.length) {
  32616. re += '\\)'
  32617. continue
  32618. }
  32619. clearStateChar()
  32620. hasMagic = true
  32621. var pl = patternListStack.pop()
  32622. // negation is (?:(?!js)[^/]*)
  32623. // The others are (?:<pattern>)<type>
  32624. re += pl.close
  32625. if (pl.type === '!') {
  32626. negativeLists.push(pl)
  32627. }
  32628. pl.reEnd = re.length
  32629. continue
  32630. case '|':
  32631. if (inClass || !patternListStack.length || escaping) {
  32632. re += '\\|'
  32633. escaping = false
  32634. continue
  32635. }
  32636. clearStateChar()
  32637. re += '|'
  32638. continue
  32639. // these are mostly the same in regexp and glob
  32640. case '[':
  32641. // swallow any state-tracking char before the [
  32642. clearStateChar()
  32643. if (inClass) {
  32644. re += '\\' + c
  32645. continue
  32646. }
  32647. inClass = true
  32648. classStart = i
  32649. reClassStart = re.length
  32650. re += c
  32651. continue
  32652. case ']':
  32653. // a right bracket shall lose its special
  32654. // meaning and represent itself in
  32655. // a bracket expression if it occurs
  32656. // first in the list. -- POSIX.2 2.8.3.2
  32657. if (i === classStart + 1 || !inClass) {
  32658. re += '\\' + c
  32659. escaping = false
  32660. continue
  32661. }
  32662. // handle the case where we left a class open.
  32663. // "[z-a]" is valid, equivalent to "\[z-a\]"
  32664. if (inClass) {
  32665. // split where the last [ was, make sure we don't have
  32666. // an invalid re. if so, re-walk the contents of the
  32667. // would-be class to re-translate any characters that
  32668. // were passed through as-is
  32669. // TODO: It would probably be faster to determine this
  32670. // without a try/catch and a new RegExp, but it's tricky
  32671. // to do safely. For now, this is safe and works.
  32672. var cs = pattern.substring(classStart + 1, i)
  32673. try {
  32674. RegExp('[' + cs + ']')
  32675. } catch (er) {
  32676. // not a valid class!
  32677. var sp = this.parse(cs, SUBPARSE)
  32678. re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'
  32679. hasMagic = hasMagic || sp[1]
  32680. inClass = false
  32681. continue
  32682. }
  32683. }
  32684. // finish up the class.
  32685. hasMagic = true
  32686. inClass = false
  32687. re += c
  32688. continue
  32689. default:
  32690. // swallow any state char that wasn't consumed
  32691. clearStateChar()
  32692. if (escaping) {
  32693. // no need
  32694. escaping = false
  32695. } else if (reSpecials[c]
  32696. && !(c === '^' && inClass)) {
  32697. re += '\\'
  32698. }
  32699. re += c
  32700. } // switch
  32701. } // for
  32702. // handle the case where we left a class open.
  32703. // "[abc" is valid, equivalent to "\[abc"
  32704. if (inClass) {
  32705. // split where the last [ was, and escape it
  32706. // this is a huge pita. We now have to re-walk
  32707. // the contents of the would-be class to re-translate
  32708. // any characters that were passed through as-is
  32709. cs = pattern.substr(classStart + 1)
  32710. sp = this.parse(cs, SUBPARSE)
  32711. re = re.substr(0, reClassStart) + '\\[' + sp[0]
  32712. hasMagic = hasMagic || sp[1]
  32713. }
  32714. // handle the case where we had a +( thing at the *end*
  32715. // of the pattern.
  32716. // each pattern list stack adds 3 chars, and we need to go through
  32717. // and escape any | chars that were passed through as-is for the regexp.
  32718. // Go through and escape them, taking care not to double-escape any
  32719. // | chars that were already escaped.
  32720. for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
  32721. var tail = re.slice(pl.reStart + pl.open.length)
  32722. this.debug('setting tail', re, pl)
  32723. // maybe some even number of \, then maybe 1 \, followed by a |
  32724. tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) {
  32725. if (!$2) {
  32726. // the | isn't already escaped, so escape it.
  32727. $2 = '\\'
  32728. }
  32729. // need to escape all those slashes *again*, without escaping the
  32730. // one that we need for escaping the | character. As it works out,
  32731. // escaping an even number of slashes can be done by simply repeating
  32732. // it exactly after itself. That's why this trick works.
  32733. //
  32734. // I am sorry that you have to see this.
  32735. return $1 + $1 + $2 + '|'
  32736. })
  32737. this.debug('tail=%j\n %s', tail, tail, pl, re)
  32738. var t = pl.type === '*' ? star
  32739. : pl.type === '?' ? qmark
  32740. : '\\' + pl.type
  32741. hasMagic = true
  32742. re = re.slice(0, pl.reStart) + t + '\\(' + tail
  32743. }
  32744. // handle trailing things that only matter at the very end.
  32745. clearStateChar()
  32746. if (escaping) {
  32747. // trailing \\
  32748. re += '\\\\'
  32749. }
  32750. // only need to apply the nodot start if the re starts with
  32751. // something that could conceivably capture a dot
  32752. var addPatternStart = false
  32753. switch (re.charAt(0)) {
  32754. case '.':
  32755. case '[':
  32756. case '(': addPatternStart = true
  32757. }
  32758. // Hack to work around lack of negative lookbehind in JS
  32759. // A pattern like: *.!(x).!(y|z) needs to ensure that a name
  32760. // like 'a.xyz.yz' doesn't match. So, the first negative
  32761. // lookahead, has to look ALL the way ahead, to the end of
  32762. // the pattern.
  32763. for (var n = negativeLists.length - 1; n > -1; n--) {
  32764. var nl = negativeLists[n]
  32765. var nlBefore = re.slice(0, nl.reStart)
  32766. var nlFirst = re.slice(nl.reStart, nl.reEnd - 8)
  32767. var nlLast = re.slice(nl.reEnd - 8, nl.reEnd)
  32768. var nlAfter = re.slice(nl.reEnd)
  32769. nlLast += nlAfter
  32770. // Handle nested stuff like *(*.js|!(*.json)), where open parens
  32771. // mean that we should *not* include the ) in the bit that is considered
  32772. // "after" the negated section.
  32773. var openParensBefore = nlBefore.split('(').length - 1
  32774. var cleanAfter = nlAfter
  32775. for (i = 0; i < openParensBefore; i++) {
  32776. cleanAfter = cleanAfter.replace(/\)[+*?]?/, '')
  32777. }
  32778. nlAfter = cleanAfter
  32779. var dollar = ''
  32780. if (nlAfter === '' && isSub !== SUBPARSE) {
  32781. dollar = '$'
  32782. }
  32783. var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast
  32784. re = newRe
  32785. }
  32786. // if the re is not "" at this point, then we need to make sure
  32787. // it doesn't match against an empty path part.
  32788. // Otherwise a/* will match a/, which it should not.
  32789. if (re !== '' && hasMagic) {
  32790. re = '(?=.)' + re
  32791. }
  32792. if (addPatternStart) {
  32793. re = patternStart + re
  32794. }
  32795. // parsing just a piece of a larger pattern.
  32796. if (isSub === SUBPARSE) {
  32797. return [re, hasMagic]
  32798. }
  32799. // skip the regexp for non-magical patterns
  32800. // unescape anything in it, though, so that it'll be
  32801. // an exact match against a file etc.
  32802. if (!hasMagic) {
  32803. return globUnescape(pattern)
  32804. }
  32805. var flags = options.nocase ? 'i' : ''
  32806. try {
  32807. var regExp = new RegExp('^' + re + '$', flags)
  32808. } catch (er) {
  32809. // If it was an invalid regular expression, then it can't match
  32810. // anything. This trick looks for a character after the end of
  32811. // the string, which is of course impossible, except in multi-line
  32812. // mode, but it's not a /m regex.
  32813. return new RegExp('$.')
  32814. }
  32815. regExp._glob = pattern
  32816. regExp._src = re
  32817. return regExp
  32818. }
  32819. minimatch.makeRe = function (pattern, options) {
  32820. return new Minimatch(pattern, options || {}).makeRe()
  32821. }
  32822. Minimatch.prototype.makeRe = makeRe
  32823. function makeRe () {
  32824. if (this.regexp || this.regexp === false) return this.regexp
  32825. // at this point, this.set is a 2d array of partial
  32826. // pattern strings, or "**".
  32827. //
  32828. // It's better to use .match(). This function shouldn't
  32829. // be used, really, but it's pretty convenient sometimes,
  32830. // when you just want to work with a regex.
  32831. var set = this.set
  32832. if (!set.length) {
  32833. this.regexp = false
  32834. return this.regexp
  32835. }
  32836. var options = this.options
  32837. var twoStar = options.noglobstar ? star
  32838. : options.dot ? twoStarDot
  32839. : twoStarNoDot
  32840. var flags = options.nocase ? 'i' : ''
  32841. var re = set.map(function (pattern) {
  32842. return pattern.map(function (p) {
  32843. return (p === GLOBSTAR) ? twoStar
  32844. : (typeof p === 'string') ? regExpEscape(p)
  32845. : p._src
  32846. }).join('\\\/')
  32847. }).join('|')
  32848. // must match entire pattern
  32849. // ending in a * or ** will make it less strict.
  32850. re = '^(?:' + re + ')$'
  32851. // can match anything, as long as it's not this.
  32852. if (this.negate) re = '^(?!' + re + ').*$'
  32853. try {
  32854. this.regexp = new RegExp(re, flags)
  32855. } catch (ex) {
  32856. this.regexp = false
  32857. }
  32858. return this.regexp
  32859. }
  32860. minimatch.match = function (list, pattern, options) {
  32861. options = options || {}
  32862. var mm = new Minimatch(pattern, options)
  32863. list = list.filter(function (f) {
  32864. return mm.match(f)
  32865. })
  32866. if (mm.options.nonull && !list.length) {
  32867. list.push(pattern)
  32868. }
  32869. return list
  32870. }
  32871. Minimatch.prototype.match = match
  32872. function match (f, partial) {
  32873. this.debug('match', f, this.pattern)
  32874. // short-circuit in the case of busted things.
  32875. // comments, etc.
  32876. if (this.comment) return false
  32877. if (this.empty) return f === ''
  32878. if (f === '/' && partial) return true
  32879. var options = this.options
  32880. // windows: need to use /, not \
  32881. if (path.sep !== '/') {
  32882. f = f.split(path.sep).join('/')
  32883. }
  32884. // treat the test path as a set of pathparts.
  32885. f = f.split(slashSplit)
  32886. this.debug(this.pattern, 'split', f)
  32887. // just ONE of the pattern sets in this.set needs to match
  32888. // in order for it to be valid. If negating, then just one
  32889. // match means that we have failed.
  32890. // Either way, return on the first hit.
  32891. var set = this.set
  32892. this.debug(this.pattern, 'set', set)
  32893. // Find the basename of the path by looking for the last non-empty segment
  32894. var filename
  32895. var i
  32896. for (i = f.length - 1; i >= 0; i--) {
  32897. filename = f[i]
  32898. if (filename) break
  32899. }
  32900. for (i = 0; i < set.length; i++) {
  32901. var pattern = set[i]
  32902. var file = f
  32903. if (options.matchBase && pattern.length === 1) {
  32904. file = [filename]
  32905. }
  32906. var hit = this.matchOne(file, pattern, partial)
  32907. if (hit) {
  32908. if (options.flipNegate) return true
  32909. return !this.negate
  32910. }
  32911. }
  32912. // didn't get any hits. this is success if it's a negative
  32913. // pattern, failure otherwise.
  32914. if (options.flipNegate) return false
  32915. return this.negate
  32916. }
  32917. // set partial to true to test if, for example,
  32918. // "/a/b" matches the start of "/*/b/*/d"
  32919. // Partial means, if you run out of file before you run
  32920. // out of pattern, then that's fine, as long as all
  32921. // the parts match.
  32922. Minimatch.prototype.matchOne = function (file, pattern, partial) {
  32923. var options = this.options
  32924. this.debug('matchOne',
  32925. { 'this': this, file: file, pattern: pattern })
  32926. this.debug('matchOne', file.length, pattern.length)
  32927. for (var fi = 0,
  32928. pi = 0,
  32929. fl = file.length,
  32930. pl = pattern.length
  32931. ; (fi < fl) && (pi < pl)
  32932. ; fi++, pi++) {
  32933. this.debug('matchOne loop')
  32934. var p = pattern[pi]
  32935. var f = file[fi]
  32936. this.debug(pattern, p, f)
  32937. // should be impossible.
  32938. // some invalid regexp stuff in the set.
  32939. if (p === false) return false
  32940. if (p === GLOBSTAR) {
  32941. this.debug('GLOBSTAR', [pattern, p, f])
  32942. // "**"
  32943. // a/**/b/**/c would match the following:
  32944. // a/b/x/y/z/c
  32945. // a/x/y/z/b/c
  32946. // a/b/x/b/x/c
  32947. // a/b/c
  32948. // To do this, take the rest of the pattern after
  32949. // the **, and see if it would match the file remainder.
  32950. // If so, return success.
  32951. // If not, the ** "swallows" a segment, and try again.
  32952. // This is recursively awful.
  32953. //
  32954. // a/**/b/**/c matching a/b/x/y/z/c
  32955. // - a matches a
  32956. // - doublestar
  32957. // - matchOne(b/x/y/z/c, b/**/c)
  32958. // - b matches b
  32959. // - doublestar
  32960. // - matchOne(x/y/z/c, c) -> no
  32961. // - matchOne(y/z/c, c) -> no
  32962. // - matchOne(z/c, c) -> no
  32963. // - matchOne(c, c) yes, hit
  32964. var fr = fi
  32965. var pr = pi + 1
  32966. if (pr === pl) {
  32967. this.debug('** at the end')
  32968. // a ** at the end will just swallow the rest.
  32969. // We have found a match.
  32970. // however, it will not swallow /.x, unless
  32971. // options.dot is set.
  32972. // . and .. are *never* matched by **, for explosively
  32973. // exponential reasons.
  32974. for (; fi < fl; fi++) {
  32975. if (file[fi] === '.' || file[fi] === '..' ||
  32976. (!options.dot && file[fi].charAt(0) === '.')) return false
  32977. }
  32978. return true
  32979. }
  32980. // ok, let's see if we can swallow whatever we can.
  32981. while (fr < fl) {
  32982. var swallowee = file[fr]
  32983. this.debug('\nglobstar while', file, fr, pattern, pr, swallowee)
  32984. // XXX remove this slice. Just pass the start index.
  32985. if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
  32986. this.debug('globstar found match!', fr, fl, swallowee)
  32987. // found a match.
  32988. return true
  32989. } else {
  32990. // can't swallow "." or ".." ever.
  32991. // can only swallow ".foo" when explicitly asked.
  32992. if (swallowee === '.' || swallowee === '..' ||
  32993. (!options.dot && swallowee.charAt(0) === '.')) {
  32994. this.debug('dot detected!', file, fr, pattern, pr)
  32995. break
  32996. }
  32997. // ** swallows a segment, and continue.
  32998. this.debug('globstar swallow a segment, and continue')
  32999. fr++
  33000. }
  33001. }
  33002. // no match was found.
  33003. // However, in partial mode, we can't say this is necessarily over.
  33004. // If there's more *pattern* left, then
  33005. if (partial) {
  33006. // ran out of file
  33007. this.debug('\n>>> no match, partial?', file, fr, pattern, pr)
  33008. if (fr === fl) return true
  33009. }
  33010. return false
  33011. }
  33012. // something other than **
  33013. // non-magic patterns just have to match exactly
  33014. // patterns with magic have been turned into regexps.
  33015. var hit
  33016. if (typeof p === 'string') {
  33017. if (options.nocase) {
  33018. hit = f.toLowerCase() === p.toLowerCase()
  33019. } else {
  33020. hit = f === p
  33021. }
  33022. this.debug('string match', p, f, hit)
  33023. } else {
  33024. hit = f.match(p)
  33025. this.debug('pattern match', p, f, hit)
  33026. }
  33027. if (!hit) return false
  33028. }
  33029. // Note: ending in / means that we'll get a final ""
  33030. // at the end of the pattern. This can only match a
  33031. // corresponding "" at the end of the file.
  33032. // If the file ends in /, then it can only match a
  33033. // a pattern that ends in /, unless the pattern just
  33034. // doesn't have any more for it. But, a/b/ should *not*
  33035. // match "a/b/*", even though "" matches against the
  33036. // [^/]*? pattern, except in partial mode, where it might
  33037. // simply not be reached yet.
  33038. // However, a/b/ should still satisfy a/*
  33039. // now either we fell off the end of the pattern, or we're done.
  33040. if (fi === fl && pi === pl) {
  33041. // ran out of pattern and filename at the same time.
  33042. // an exact hit!
  33043. return true
  33044. } else if (fi === fl) {
  33045. // ran out of file, but still had pattern left.
  33046. // this is ok if we're doing the match as part of
  33047. // a glob fs traversal.
  33048. return partial
  33049. } else if (pi === pl) {
  33050. // ran out of pattern, still have file left.
  33051. // this is only acceptable if we're on the very last
  33052. // empty segment of a file with a trailing slash.
  33053. // a/* should match a/b/
  33054. var emptyFileEnd = (fi === fl - 1) && (file[fi] === '')
  33055. return emptyFileEnd
  33056. }
  33057. // should be unreachable.
  33058. throw new Error('wtf?')
  33059. }
  33060. // replace stuff like \* with *
  33061. function globUnescape (s) {
  33062. return s.replace(/\\(.)/g, '$1')
  33063. }
  33064. function regExpEscape (s) {
  33065. return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')
  33066. }
  33067. },{"brace-expansion":119,"path":469}],467:[function(require,module,exports){
  33068. /**
  33069. * Helpers.
  33070. */
  33071. var s = 1000
  33072. var m = s * 60
  33073. var h = m * 60
  33074. var d = h * 24
  33075. var y = d * 365.25
  33076. /**
  33077. * Parse or format the given `val`.
  33078. *
  33079. * Options:
  33080. *
  33081. * - `long` verbose formatting [false]
  33082. *
  33083. * @param {String|Number} val
  33084. * @param {Object} options
  33085. * @throws {Error} throw an error if val is not a non-empty string or a number
  33086. * @return {String|Number}
  33087. * @api public
  33088. */
  33089. module.exports = function (val, options) {
  33090. options = options || {}
  33091. var type = typeof val
  33092. if (type === 'string' && val.length > 0) {
  33093. return parse(val)
  33094. } else if (type === 'number' && isNaN(val) === false) {
  33095. return options.long ?
  33096. fmtLong(val) :
  33097. fmtShort(val)
  33098. }
  33099. throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val))
  33100. }
  33101. /**
  33102. * Parse the given `str` and return milliseconds.
  33103. *
  33104. * @param {String} str
  33105. * @return {Number}
  33106. * @api private
  33107. */
  33108. function parse(str) {
  33109. str = String(str)
  33110. if (str.length > 10000) {
  33111. return
  33112. }
  33113. var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str)
  33114. if (!match) {
  33115. return
  33116. }
  33117. var n = parseFloat(match[1])
  33118. var type = (match[2] || 'ms').toLowerCase()
  33119. switch (type) {
  33120. case 'years':
  33121. case 'year':
  33122. case 'yrs':
  33123. case 'yr':
  33124. case 'y':
  33125. return n * y
  33126. case 'days':
  33127. case 'day':
  33128. case 'd':
  33129. return n * d
  33130. case 'hours':
  33131. case 'hour':
  33132. case 'hrs':
  33133. case 'hr':
  33134. case 'h':
  33135. return n * h
  33136. case 'minutes':
  33137. case 'minute':
  33138. case 'mins':
  33139. case 'min':
  33140. case 'm':
  33141. return n * m
  33142. case 'seconds':
  33143. case 'second':
  33144. case 'secs':
  33145. case 'sec':
  33146. case 's':
  33147. return n * s
  33148. case 'milliseconds':
  33149. case 'millisecond':
  33150. case 'msecs':
  33151. case 'msec':
  33152. case 'ms':
  33153. return n
  33154. default:
  33155. return undefined
  33156. }
  33157. }
  33158. /**
  33159. * Short format for `ms`.
  33160. *
  33161. * @param {Number} ms
  33162. * @return {String}
  33163. * @api private
  33164. */
  33165. function fmtShort(ms) {
  33166. if (ms >= d) {
  33167. return Math.round(ms / d) + 'd'
  33168. }
  33169. if (ms >= h) {
  33170. return Math.round(ms / h) + 'h'
  33171. }
  33172. if (ms >= m) {
  33173. return Math.round(ms / m) + 'm'
  33174. }
  33175. if (ms >= s) {
  33176. return Math.round(ms / s) + 's'
  33177. }
  33178. return ms + 'ms'
  33179. }
  33180. /**
  33181. * Long format for `ms`.
  33182. *
  33183. * @param {Number} ms
  33184. * @return {String}
  33185. * @api private
  33186. */
  33187. function fmtLong(ms) {
  33188. return plural(ms, d, 'day') ||
  33189. plural(ms, h, 'hour') ||
  33190. plural(ms, m, 'minute') ||
  33191. plural(ms, s, 'second') ||
  33192. ms + ' ms'
  33193. }
  33194. /**
  33195. * Pluralization helper.
  33196. */
  33197. function plural(ms, n, name) {
  33198. if (ms < n) {
  33199. return
  33200. }
  33201. if (ms < n * 1.5) {
  33202. return Math.floor(ms / n) + ' ' + name
  33203. }
  33204. return Math.ceil(ms / n) + ' ' + name + 's'
  33205. }
  33206. },{}],468:[function(require,module,exports){
  33207. 'use strict';
  33208. module.exports = Number.isNaN || function (x) {
  33209. return x !== x;
  33210. };
  33211. },{}],469:[function(require,module,exports){
  33212. (function (process){
  33213. // Copyright Joyent, Inc. and other Node contributors.
  33214. //
  33215. // Permission is hereby granted, free of charge, to any person obtaining a
  33216. // copy of this software and associated documentation files (the
  33217. // "Software"), to deal in the Software without restriction, including
  33218. // without limitation the rights to use, copy, modify, merge, publish,
  33219. // distribute, sublicense, and/or sell copies of the Software, and to permit
  33220. // persons to whom the Software is furnished to do so, subject to the
  33221. // following conditions:
  33222. //
  33223. // The above copyright notice and this permission notice shall be included
  33224. // in all copies or substantial portions of the Software.
  33225. //
  33226. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  33227. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  33228. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  33229. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  33230. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  33231. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  33232. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  33233. // resolves . and .. elements in a path array with directory names there
  33234. // must be no slashes, empty elements, or device names (c:\) in the array
  33235. // (so also no leading and trailing slashes - it does not distinguish
  33236. // relative and absolute paths)
  33237. function normalizeArray(parts, allowAboveRoot) {
  33238. // if the path tries to go above the root, `up` ends up > 0
  33239. var up = 0;
  33240. for (var i = parts.length - 1; i >= 0; i--) {
  33241. var last = parts[i];
  33242. if (last === '.') {
  33243. parts.splice(i, 1);
  33244. } else if (last === '..') {
  33245. parts.splice(i, 1);
  33246. up++;
  33247. } else if (up) {
  33248. parts.splice(i, 1);
  33249. up--;
  33250. }
  33251. }
  33252. // if the path is allowed to go above the root, restore leading ..s
  33253. if (allowAboveRoot) {
  33254. for (; up--; up) {
  33255. parts.unshift('..');
  33256. }
  33257. }
  33258. return parts;
  33259. }
  33260. // Split a filename into [root, dir, basename, ext], unix version
  33261. // 'root' is just a slash, or nothing.
  33262. var splitPathRe =
  33263. /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
  33264. var splitPath = function(filename) {
  33265. return splitPathRe.exec(filename).slice(1);
  33266. };
  33267. // path.resolve([from ...], to)
  33268. // posix version
  33269. exports.resolve = function() {
  33270. var resolvedPath = '',
  33271. resolvedAbsolute = false;
  33272. for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
  33273. var path = (i >= 0) ? arguments[i] : process.cwd();
  33274. // Skip empty and invalid entries
  33275. if (typeof path !== 'string') {
  33276. throw new TypeError('Arguments to path.resolve must be strings');
  33277. } else if (!path) {
  33278. continue;
  33279. }
  33280. resolvedPath = path + '/' + resolvedPath;
  33281. resolvedAbsolute = path.charAt(0) === '/';
  33282. }
  33283. // At this point the path should be resolved to a full absolute path, but
  33284. // handle relative paths to be safe (might happen when process.cwd() fails)
  33285. // Normalize the path
  33286. resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
  33287. return !!p;
  33288. }), !resolvedAbsolute).join('/');
  33289. return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
  33290. };
  33291. // path.normalize(path)
  33292. // posix version
  33293. exports.normalize = function(path) {
  33294. var isAbsolute = exports.isAbsolute(path),
  33295. trailingSlash = substr(path, -1) === '/';
  33296. // Normalize the path
  33297. path = normalizeArray(filter(path.split('/'), function(p) {
  33298. return !!p;
  33299. }), !isAbsolute).join('/');
  33300. if (!path && !isAbsolute) {
  33301. path = '.';
  33302. }
  33303. if (path && trailingSlash) {
  33304. path += '/';
  33305. }
  33306. return (isAbsolute ? '/' : '') + path;
  33307. };
  33308. // posix version
  33309. exports.isAbsolute = function(path) {
  33310. return path.charAt(0) === '/';
  33311. };
  33312. // posix version
  33313. exports.join = function() {
  33314. var paths = Array.prototype.slice.call(arguments, 0);
  33315. return exports.normalize(filter(paths, function(p, index) {
  33316. if (typeof p !== 'string') {
  33317. throw new TypeError('Arguments to path.join must be strings');
  33318. }
  33319. return p;
  33320. }).join('/'));
  33321. };
  33322. // path.relative(from, to)
  33323. // posix version
  33324. exports.relative = function(from, to) {
  33325. from = exports.resolve(from).substr(1);
  33326. to = exports.resolve(to).substr(1);
  33327. function trim(arr) {
  33328. var start = 0;
  33329. for (; start < arr.length; start++) {
  33330. if (arr[start] !== '') break;
  33331. }
  33332. var end = arr.length - 1;
  33333. for (; end >= 0; end--) {
  33334. if (arr[end] !== '') break;
  33335. }
  33336. if (start > end) return [];
  33337. return arr.slice(start, end - start + 1);
  33338. }
  33339. var fromParts = trim(from.split('/'));
  33340. var toParts = trim(to.split('/'));
  33341. var length = Math.min(fromParts.length, toParts.length);
  33342. var samePartsLength = length;
  33343. for (var i = 0; i < length; i++) {
  33344. if (fromParts[i] !== toParts[i]) {
  33345. samePartsLength = i;
  33346. break;
  33347. }
  33348. }
  33349. var outputParts = [];
  33350. for (var i = samePartsLength; i < fromParts.length; i++) {
  33351. outputParts.push('..');
  33352. }
  33353. outputParts = outputParts.concat(toParts.slice(samePartsLength));
  33354. return outputParts.join('/');
  33355. };
  33356. exports.sep = '/';
  33357. exports.delimiter = ':';
  33358. exports.dirname = function(path) {
  33359. var result = splitPath(path),
  33360. root = result[0],
  33361. dir = result[1];
  33362. if (!root && !dir) {
  33363. // No dirname whatsoever
  33364. return '.';
  33365. }
  33366. if (dir) {
  33367. // It has a dirname, strip trailing slash
  33368. dir = dir.substr(0, dir.length - 1);
  33369. }
  33370. return root + dir;
  33371. };
  33372. exports.basename = function(path, ext) {
  33373. var f = splitPath(path)[2];
  33374. // TODO: make this comparison case-insensitive on windows?
  33375. if (ext && f.substr(-1 * ext.length) === ext) {
  33376. f = f.substr(0, f.length - ext.length);
  33377. }
  33378. return f;
  33379. };
  33380. exports.extname = function(path) {
  33381. return splitPath(path)[3];
  33382. };
  33383. function filter (xs, f) {
  33384. if (xs.filter) return xs.filter(f);
  33385. var res = [];
  33386. for (var i = 0; i < xs.length; i++) {
  33387. if (f(xs[i], i, xs)) res.push(xs[i]);
  33388. }
  33389. return res;
  33390. }
  33391. // String.prototype.substr - negative index don't work in IE8
  33392. var substr = 'ab'.substr(-1) === 'b'
  33393. ? function (str, start, len) { return str.substr(start, len) }
  33394. : function (str, start, len) {
  33395. if (start < 0) start = str.length + start;
  33396. return str.substr(start, len);
  33397. }
  33398. ;
  33399. }).call(this,require('_process'))
  33400. },{"_process":471}],470:[function(require,module,exports){
  33401. (function (process){
  33402. 'use strict';
  33403. function posix(path) {
  33404. return path.charAt(0) === '/';
  33405. }
  33406. function win32(path) {
  33407. // https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56
  33408. var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
  33409. var result = splitDeviceRe.exec(path);
  33410. var device = result[1] || '';
  33411. var isUnc = Boolean(device && device.charAt(1) !== ':');
  33412. // UNC paths are always absolute
  33413. return Boolean(result[2] || isUnc);
  33414. }
  33415. module.exports = process.platform === 'win32' ? win32 : posix;
  33416. module.exports.posix = posix;
  33417. module.exports.win32 = win32;
  33418. }).call(this,require('_process'))
  33419. },{"_process":471}],471:[function(require,module,exports){
  33420. // shim for using process in browser
  33421. var process = module.exports = {};
  33422. // cached from whatever global is present so that test runners that stub it
  33423. // don't break things. But we need to wrap it in a try catch in case it is
  33424. // wrapped in strict mode code which doesn't define any globals. It's inside a
  33425. // function because try/catches deoptimize in certain engines.
  33426. var cachedSetTimeout;
  33427. var cachedClearTimeout;
  33428. function defaultSetTimout() {
  33429. throw new Error('setTimeout has not been defined');
  33430. }
  33431. function defaultClearTimeout () {
  33432. throw new Error('clearTimeout has not been defined');
  33433. }
  33434. (function () {
  33435. try {
  33436. if (typeof setTimeout === 'function') {
  33437. cachedSetTimeout = setTimeout;
  33438. } else {
  33439. cachedSetTimeout = defaultSetTimout;
  33440. }
  33441. } catch (e) {
  33442. cachedSetTimeout = defaultSetTimout;
  33443. }
  33444. try {
  33445. if (typeof clearTimeout === 'function') {
  33446. cachedClearTimeout = clearTimeout;
  33447. } else {
  33448. cachedClearTimeout = defaultClearTimeout;
  33449. }
  33450. } catch (e) {
  33451. cachedClearTimeout = defaultClearTimeout;
  33452. }
  33453. } ())
  33454. function runTimeout(fun) {
  33455. if (cachedSetTimeout === setTimeout) {
  33456. //normal enviroments in sane situations
  33457. return setTimeout(fun, 0);
  33458. }
  33459. // if setTimeout wasn't available but was latter defined
  33460. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  33461. cachedSetTimeout = setTimeout;
  33462. return setTimeout(fun, 0);
  33463. }
  33464. try {
  33465. // when when somebody has screwed with setTimeout but no I.E. maddness
  33466. return cachedSetTimeout(fun, 0);
  33467. } catch(e){
  33468. try {
  33469. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  33470. return cachedSetTimeout.call(null, fun, 0);
  33471. } catch(e){
  33472. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
  33473. return cachedSetTimeout.call(this, fun, 0);
  33474. }
  33475. }
  33476. }
  33477. function runClearTimeout(marker) {
  33478. if (cachedClearTimeout === clearTimeout) {
  33479. //normal enviroments in sane situations
  33480. return clearTimeout(marker);
  33481. }
  33482. // if clearTimeout wasn't available but was latter defined
  33483. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  33484. cachedClearTimeout = clearTimeout;
  33485. return clearTimeout(marker);
  33486. }
  33487. try {
  33488. // when when somebody has screwed with setTimeout but no I.E. maddness
  33489. return cachedClearTimeout(marker);
  33490. } catch (e){
  33491. try {
  33492. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  33493. return cachedClearTimeout.call(null, marker);
  33494. } catch (e){
  33495. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
  33496. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  33497. return cachedClearTimeout.call(this, marker);
  33498. }
  33499. }
  33500. }
  33501. var queue = [];
  33502. var draining = false;
  33503. var currentQueue;
  33504. var queueIndex = -1;
  33505. function cleanUpNextTick() {
  33506. if (!draining || !currentQueue) {
  33507. return;
  33508. }
  33509. draining = false;
  33510. if (currentQueue.length) {
  33511. queue = currentQueue.concat(queue);
  33512. } else {
  33513. queueIndex = -1;
  33514. }
  33515. if (queue.length) {
  33516. drainQueue();
  33517. }
  33518. }
  33519. function drainQueue() {
  33520. if (draining) {
  33521. return;
  33522. }
  33523. var timeout = runTimeout(cleanUpNextTick);
  33524. draining = true;
  33525. var len = queue.length;
  33526. while(len) {
  33527. currentQueue = queue;
  33528. queue = [];
  33529. while (++queueIndex < len) {
  33530. if (currentQueue) {
  33531. currentQueue[queueIndex].run();
  33532. }
  33533. }
  33534. queueIndex = -1;
  33535. len = queue.length;
  33536. }
  33537. currentQueue = null;
  33538. draining = false;
  33539. runClearTimeout(timeout);
  33540. }
  33541. process.nextTick = function (fun) {
  33542. var args = new Array(arguments.length - 1);
  33543. if (arguments.length > 1) {
  33544. for (var i = 1; i < arguments.length; i++) {
  33545. args[i - 1] = arguments[i];
  33546. }
  33547. }
  33548. queue.push(new Item(fun, args));
  33549. if (queue.length === 1 && !draining) {
  33550. runTimeout(drainQueue);
  33551. }
  33552. };
  33553. // v8 likes predictible objects
  33554. function Item(fun, array) {
  33555. this.fun = fun;
  33556. this.array = array;
  33557. }
  33558. Item.prototype.run = function () {
  33559. this.fun.apply(null, this.array);
  33560. };
  33561. process.title = 'browser';
  33562. process.browser = true;
  33563. process.env = {};
  33564. process.argv = [];
  33565. process.version = ''; // empty string to avoid regexp issues
  33566. process.versions = {};
  33567. function noop() {}
  33568. process.on = noop;
  33569. process.addListener = noop;
  33570. process.once = noop;
  33571. process.off = noop;
  33572. process.removeListener = noop;
  33573. process.removeAllListeners = noop;
  33574. process.emit = noop;
  33575. process.binding = function (name) {
  33576. throw new Error('process.binding is not supported');
  33577. };
  33578. process.cwd = function () { return '/' };
  33579. process.chdir = function (dir) {
  33580. throw new Error('process.chdir is not supported');
  33581. };
  33582. process.umask = function() { return 0; };
  33583. },{}],472:[function(require,module,exports){
  33584. 'use strict';
  33585. var isFinite = require('is-finite');
  33586. module.exports = function (str, n) {
  33587. if (typeof str !== 'string') {
  33588. throw new TypeError('Expected `input` to be a string');
  33589. }
  33590. if (n < 0 || !isFinite(n)) {
  33591. throw new TypeError('Expected `count` to be a positive finite number');
  33592. }
  33593. var ret = '';
  33594. do {
  33595. if (n & 1) {
  33596. ret += str;
  33597. }
  33598. str += str;
  33599. } while ((n >>= 1));
  33600. return ret;
  33601. };
  33602. },{"is-finite":246}],473:[function(require,module,exports){
  33603. 'use strict';
  33604. module.exports = function (str) {
  33605. var isExtendedLengthPath = /^\\\\\?\\/.test(str);
  33606. var hasNonAscii = /[^\x00-\x80]+/.test(str);
  33607. if (isExtendedLengthPath || hasNonAscii) {
  33608. return str;
  33609. }
  33610. return str.replace(/\\/g, '/');
  33611. };
  33612. },{}],474:[function(require,module,exports){
  33613. /* -*- Mode: js; js-indent-level: 2; -*- */
  33614. /*
  33615. * Copyright 2011 Mozilla Foundation and contributors
  33616. * Licensed under the New BSD license. See LICENSE or:
  33617. * http://opensource.org/licenses/BSD-3-Clause
  33618. */
  33619. var util = require('./util');
  33620. var has = Object.prototype.hasOwnProperty;
  33621. /**
  33622. * A data structure which is a combination of an array and a set. Adding a new
  33623. * member is O(1), testing for membership is O(1), and finding the index of an
  33624. * element is O(1). Removing elements from the set is not supported. Only
  33625. * strings are supported for membership.
  33626. */
  33627. function ArraySet() {
  33628. this._array = [];
  33629. this._set = Object.create(null);
  33630. }
  33631. /**
  33632. * Static method for creating ArraySet instances from an existing array.
  33633. */
  33634. ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
  33635. var set = new ArraySet();
  33636. for (var i = 0, len = aArray.length; i < len; i++) {
  33637. set.add(aArray[i], aAllowDuplicates);
  33638. }
  33639. return set;
  33640. };
  33641. /**
  33642. * Return how many unique items are in this ArraySet. If duplicates have been
  33643. * added, than those do not count towards the size.
  33644. *
  33645. * @returns Number
  33646. */
  33647. ArraySet.prototype.size = function ArraySet_size() {
  33648. return Object.getOwnPropertyNames(this._set).length;
  33649. };
  33650. /**
  33651. * Add the given string to this set.
  33652. *
  33653. * @param String aStr
  33654. */
  33655. ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
  33656. var sStr = util.toSetString(aStr);
  33657. var isDuplicate = has.call(this._set, sStr);
  33658. var idx = this._array.length;
  33659. if (!isDuplicate || aAllowDuplicates) {
  33660. this._array.push(aStr);
  33661. }
  33662. if (!isDuplicate) {
  33663. this._set[sStr] = idx;
  33664. }
  33665. };
  33666. /**
  33667. * Is the given string a member of this set?
  33668. *
  33669. * @param String aStr
  33670. */
  33671. ArraySet.prototype.has = function ArraySet_has(aStr) {
  33672. var sStr = util.toSetString(aStr);
  33673. return has.call(this._set, sStr);
  33674. };
  33675. /**
  33676. * What is the index of the given string in the array?
  33677. *
  33678. * @param String aStr
  33679. */
  33680. ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {
  33681. var sStr = util.toSetString(aStr);
  33682. if (has.call(this._set, sStr)) {
  33683. return this._set[sStr];
  33684. }
  33685. throw new Error('"' + aStr + '" is not in the set.');
  33686. };
  33687. /**
  33688. * What is the element at the given index?
  33689. *
  33690. * @param Number aIdx
  33691. */
  33692. ArraySet.prototype.at = function ArraySet_at(aIdx) {
  33693. if (aIdx >= 0 && aIdx < this._array.length) {
  33694. return this._array[aIdx];
  33695. }
  33696. throw new Error('No element indexed by ' + aIdx);
  33697. };
  33698. /**
  33699. * Returns the array representation of this set (which has the proper indices
  33700. * indicated by indexOf). Note that this is a copy of the internal array used
  33701. * for storing the members so that no one can mess with internal state.
  33702. */
  33703. ArraySet.prototype.toArray = function ArraySet_toArray() {
  33704. return this._array.slice();
  33705. };
  33706. exports.ArraySet = ArraySet;
  33707. },{"./util":483}],475:[function(require,module,exports){
  33708. /* -*- Mode: js; js-indent-level: 2; -*- */
  33709. /*
  33710. * Copyright 2011 Mozilla Foundation and contributors
  33711. * Licensed under the New BSD license. See LICENSE or:
  33712. * http://opensource.org/licenses/BSD-3-Clause
  33713. *
  33714. * Based on the Base 64 VLQ implementation in Closure Compiler:
  33715. * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
  33716. *
  33717. * Copyright 2011 The Closure Compiler Authors. All rights reserved.
  33718. * Redistribution and use in source and binary forms, with or without
  33719. * modification, are permitted provided that the following conditions are
  33720. * met:
  33721. *
  33722. * * Redistributions of source code must retain the above copyright
  33723. * notice, this list of conditions and the following disclaimer.
  33724. * * Redistributions in binary form must reproduce the above
  33725. * copyright notice, this list of conditions and the following
  33726. * disclaimer in the documentation and/or other materials provided
  33727. * with the distribution.
  33728. * * Neither the name of Google Inc. nor the names of its
  33729. * contributors may be used to endorse or promote products derived
  33730. * from this software without specific prior written permission.
  33731. *
  33732. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  33733. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  33734. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  33735. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  33736. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  33737. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  33738. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  33739. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  33740. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  33741. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  33742. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  33743. */
  33744. var base64 = require('./base64');
  33745. // A single base 64 digit can contain 6 bits of data. For the base 64 variable
  33746. // length quantities we use in the source map spec, the first bit is the sign,
  33747. // the next four bits are the actual value, and the 6th bit is the
  33748. // continuation bit. The continuation bit tells us whether there are more
  33749. // digits in this value following this digit.
  33750. //
  33751. // Continuation
  33752. // | Sign
  33753. // | |
  33754. // V V
  33755. // 101011
  33756. var VLQ_BASE_SHIFT = 5;
  33757. // binary: 100000
  33758. var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
  33759. // binary: 011111
  33760. var VLQ_BASE_MASK = VLQ_BASE - 1;
  33761. // binary: 100000
  33762. var VLQ_CONTINUATION_BIT = VLQ_BASE;
  33763. /**
  33764. * Converts from a two-complement value to a value where the sign bit is
  33765. * placed in the least significant bit. For example, as decimals:
  33766. * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
  33767. * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
  33768. */
  33769. function toVLQSigned(aValue) {
  33770. return aValue < 0
  33771. ? ((-aValue) << 1) + 1
  33772. : (aValue << 1) + 0;
  33773. }
  33774. /**
  33775. * Converts to a two-complement value from a value where the sign bit is
  33776. * placed in the least significant bit. For example, as decimals:
  33777. * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
  33778. * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
  33779. */
  33780. function fromVLQSigned(aValue) {
  33781. var isNegative = (aValue & 1) === 1;
  33782. var shifted = aValue >> 1;
  33783. return isNegative
  33784. ? -shifted
  33785. : shifted;
  33786. }
  33787. /**
  33788. * Returns the base 64 VLQ encoded value.
  33789. */
  33790. exports.encode = function base64VLQ_encode(aValue) {
  33791. var encoded = "";
  33792. var digit;
  33793. var vlq = toVLQSigned(aValue);
  33794. do {
  33795. digit = vlq & VLQ_BASE_MASK;
  33796. vlq >>>= VLQ_BASE_SHIFT;
  33797. if (vlq > 0) {
  33798. // There are still more digits in this value, so we must make sure the
  33799. // continuation bit is marked.
  33800. digit |= VLQ_CONTINUATION_BIT;
  33801. }
  33802. encoded += base64.encode(digit);
  33803. } while (vlq > 0);
  33804. return encoded;
  33805. };
  33806. /**
  33807. * Decodes the next base 64 VLQ value from the given string and returns the
  33808. * value and the rest of the string via the out parameter.
  33809. */
  33810. exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
  33811. var strLen = aStr.length;
  33812. var result = 0;
  33813. var shift = 0;
  33814. var continuation, digit;
  33815. do {
  33816. if (aIndex >= strLen) {
  33817. throw new Error("Expected more digits in base 64 VLQ value.");
  33818. }
  33819. digit = base64.decode(aStr.charCodeAt(aIndex++));
  33820. if (digit === -1) {
  33821. throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
  33822. }
  33823. continuation = !!(digit & VLQ_CONTINUATION_BIT);
  33824. digit &= VLQ_BASE_MASK;
  33825. result = result + (digit << shift);
  33826. shift += VLQ_BASE_SHIFT;
  33827. } while (continuation);
  33828. aOutParam.value = fromVLQSigned(result);
  33829. aOutParam.rest = aIndex;
  33830. };
  33831. },{"./base64":476}],476:[function(require,module,exports){
  33832. /* -*- Mode: js; js-indent-level: 2; -*- */
  33833. /*
  33834. * Copyright 2011 Mozilla Foundation and contributors
  33835. * Licensed under the New BSD license. See LICENSE or:
  33836. * http://opensource.org/licenses/BSD-3-Clause
  33837. */
  33838. var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
  33839. /**
  33840. * Encode an integer in the range of 0 to 63 to a single base 64 digit.
  33841. */
  33842. exports.encode = function (number) {
  33843. if (0 <= number && number < intToCharMap.length) {
  33844. return intToCharMap[number];
  33845. }
  33846. throw new TypeError("Must be between 0 and 63: " + number);
  33847. };
  33848. /**
  33849. * Decode a single base 64 character code digit to an integer. Returns -1 on
  33850. * failure.
  33851. */
  33852. exports.decode = function (charCode) {
  33853. var bigA = 65; // 'A'
  33854. var bigZ = 90; // 'Z'
  33855. var littleA = 97; // 'a'
  33856. var littleZ = 122; // 'z'
  33857. var zero = 48; // '0'
  33858. var nine = 57; // '9'
  33859. var plus = 43; // '+'
  33860. var slash = 47; // '/'
  33861. var littleOffset = 26;
  33862. var numberOffset = 52;
  33863. // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
  33864. if (bigA <= charCode && charCode <= bigZ) {
  33865. return (charCode - bigA);
  33866. }
  33867. // 26 - 51: abcdefghijklmnopqrstuvwxyz
  33868. if (littleA <= charCode && charCode <= littleZ) {
  33869. return (charCode - littleA + littleOffset);
  33870. }
  33871. // 52 - 61: 0123456789
  33872. if (zero <= charCode && charCode <= nine) {
  33873. return (charCode - zero + numberOffset);
  33874. }
  33875. // 62: +
  33876. if (charCode == plus) {
  33877. return 62;
  33878. }
  33879. // 63: /
  33880. if (charCode == slash) {
  33881. return 63;
  33882. }
  33883. // Invalid base64 digit.
  33884. return -1;
  33885. };
  33886. },{}],477:[function(require,module,exports){
  33887. /* -*- Mode: js; js-indent-level: 2; -*- */
  33888. /*
  33889. * Copyright 2011 Mozilla Foundation and contributors
  33890. * Licensed under the New BSD license. See LICENSE or:
  33891. * http://opensource.org/licenses/BSD-3-Clause
  33892. */
  33893. exports.GREATEST_LOWER_BOUND = 1;
  33894. exports.LEAST_UPPER_BOUND = 2;
  33895. /**
  33896. * Recursive implementation of binary search.
  33897. *
  33898. * @param aLow Indices here and lower do not contain the needle.
  33899. * @param aHigh Indices here and higher do not contain the needle.
  33900. * @param aNeedle The element being searched for.
  33901. * @param aHaystack The non-empty array being searched.
  33902. * @param aCompare Function which takes two elements and returns -1, 0, or 1.
  33903. * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
  33904. * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
  33905. * closest element that is smaller than or greater than the one we are
  33906. * searching for, respectively, if the exact element cannot be found.
  33907. */
  33908. function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
  33909. // This function terminates when one of the following is true:
  33910. //
  33911. // 1. We find the exact element we are looking for.
  33912. //
  33913. // 2. We did not find the exact element, but we can return the index of
  33914. // the next-closest element.
  33915. //
  33916. // 3. We did not find the exact element, and there is no next-closest
  33917. // element than the one we are searching for, so we return -1.
  33918. var mid = Math.floor((aHigh - aLow) / 2) + aLow;
  33919. var cmp = aCompare(aNeedle, aHaystack[mid], true);
  33920. if (cmp === 0) {
  33921. // Found the element we are looking for.
  33922. return mid;
  33923. }
  33924. else if (cmp > 0) {
  33925. // Our needle is greater than aHaystack[mid].
  33926. if (aHigh - mid > 1) {
  33927. // The element is in the upper half.
  33928. return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
  33929. }
  33930. // The exact needle element was not found in this haystack. Determine if
  33931. // we are in termination case (3) or (2) and return the appropriate thing.
  33932. if (aBias == exports.LEAST_UPPER_BOUND) {
  33933. return aHigh < aHaystack.length ? aHigh : -1;
  33934. } else {
  33935. return mid;
  33936. }
  33937. }
  33938. else {
  33939. // Our needle is less than aHaystack[mid].
  33940. if (mid - aLow > 1) {
  33941. // The element is in the lower half.
  33942. return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
  33943. }
  33944. // we are in termination case (3) or (2) and return the appropriate thing.
  33945. if (aBias == exports.LEAST_UPPER_BOUND) {
  33946. return mid;
  33947. } else {
  33948. return aLow < 0 ? -1 : aLow;
  33949. }
  33950. }
  33951. }
  33952. /**
  33953. * This is an implementation of binary search which will always try and return
  33954. * the index of the closest element if there is no exact hit. This is because
  33955. * mappings between original and generated line/col pairs are single points,
  33956. * and there is an implicit region between each of them, so a miss just means
  33957. * that you aren't on the very start of a region.
  33958. *
  33959. * @param aNeedle The element you are looking for.
  33960. * @param aHaystack The array that is being searched.
  33961. * @param aCompare A function which takes the needle and an element in the
  33962. * array and returns -1, 0, or 1 depending on whether the needle is less
  33963. * than, equal to, or greater than the element, respectively.
  33964. * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
  33965. * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
  33966. * closest element that is smaller than or greater than the one we are
  33967. * searching for, respectively, if the exact element cannot be found.
  33968. * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.
  33969. */
  33970. exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {
  33971. if (aHaystack.length === 0) {
  33972. return -1;
  33973. }
  33974. var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,
  33975. aCompare, aBias || exports.GREATEST_LOWER_BOUND);
  33976. if (index < 0) {
  33977. return -1;
  33978. }
  33979. // We have found either the exact element, or the next-closest element than
  33980. // the one we are searching for. However, there may be more than one such
  33981. // element. Make sure we always return the smallest of these.
  33982. while (index - 1 >= 0) {
  33983. if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
  33984. break;
  33985. }
  33986. --index;
  33987. }
  33988. return index;
  33989. };
  33990. },{}],478:[function(require,module,exports){
  33991. /* -*- Mode: js; js-indent-level: 2; -*- */
  33992. /*
  33993. * Copyright 2014 Mozilla Foundation and contributors
  33994. * Licensed under the New BSD license. See LICENSE or:
  33995. * http://opensource.org/licenses/BSD-3-Clause
  33996. */
  33997. var util = require('./util');
  33998. /**
  33999. * Determine whether mappingB is after mappingA with respect to generated
  34000. * position.
  34001. */
  34002. function generatedPositionAfter(mappingA, mappingB) {
  34003. // Optimized for most common case
  34004. var lineA = mappingA.generatedLine;
  34005. var lineB = mappingB.generatedLine;
  34006. var columnA = mappingA.generatedColumn;
  34007. var columnB = mappingB.generatedColumn;
  34008. return lineB > lineA || lineB == lineA && columnB >= columnA ||
  34009. util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
  34010. }
  34011. /**
  34012. * A data structure to provide a sorted view of accumulated mappings in a
  34013. * performance conscious manner. It trades a neglibable overhead in general
  34014. * case for a large speedup in case of mappings being added in order.
  34015. */
  34016. function MappingList() {
  34017. this._array = [];
  34018. this._sorted = true;
  34019. // Serves as infimum
  34020. this._last = {generatedLine: -1, generatedColumn: 0};
  34021. }
  34022. /**
  34023. * Iterate through internal items. This method takes the same arguments that
  34024. * `Array.prototype.forEach` takes.
  34025. *
  34026. * NOTE: The order of the mappings is NOT guaranteed.
  34027. */
  34028. MappingList.prototype.unsortedForEach =
  34029. function MappingList_forEach(aCallback, aThisArg) {
  34030. this._array.forEach(aCallback, aThisArg);
  34031. };
  34032. /**
  34033. * Add the given source mapping.
  34034. *
  34035. * @param Object aMapping
  34036. */
  34037. MappingList.prototype.add = function MappingList_add(aMapping) {
  34038. if (generatedPositionAfter(this._last, aMapping)) {
  34039. this._last = aMapping;
  34040. this._array.push(aMapping);
  34041. } else {
  34042. this._sorted = false;
  34043. this._array.push(aMapping);
  34044. }
  34045. };
  34046. /**
  34047. * Returns the flat, sorted array of mappings. The mappings are sorted by
  34048. * generated position.
  34049. *
  34050. * WARNING: This method returns internal data without copying, for
  34051. * performance. The return value must NOT be mutated, and should be treated as
  34052. * an immutable borrow. If you want to take ownership, you must make your own
  34053. * copy.
  34054. */
  34055. MappingList.prototype.toArray = function MappingList_toArray() {
  34056. if (!this._sorted) {
  34057. this._array.sort(util.compareByGeneratedPositionsInflated);
  34058. this._sorted = true;
  34059. }
  34060. return this._array;
  34061. };
  34062. exports.MappingList = MappingList;
  34063. },{"./util":483}],479:[function(require,module,exports){
  34064. /* -*- Mode: js; js-indent-level: 2; -*- */
  34065. /*
  34066. * Copyright 2011 Mozilla Foundation and contributors
  34067. * Licensed under the New BSD license. See LICENSE or:
  34068. * http://opensource.org/licenses/BSD-3-Clause
  34069. */
  34070. // It turns out that some (most?) JavaScript engines don't self-host
  34071. // `Array.prototype.sort`. This makes sense because C++ will likely remain
  34072. // faster than JS when doing raw CPU-intensive sorting. However, when using a
  34073. // custom comparator function, calling back and forth between the VM's C++ and
  34074. // JIT'd JS is rather slow *and* loses JIT type information, resulting in
  34075. // worse generated code for the comparator function than would be optimal. In
  34076. // fact, when sorting with a comparator, these costs outweigh the benefits of
  34077. // sorting in C++. By using our own JS-implemented Quick Sort (below), we get
  34078. // a ~3500ms mean speed-up in `bench/bench.html`.
  34079. /**
  34080. * Swap the elements indexed by `x` and `y` in the array `ary`.
  34081. *
  34082. * @param {Array} ary
  34083. * The array.
  34084. * @param {Number} x
  34085. * The index of the first item.
  34086. * @param {Number} y
  34087. * The index of the second item.
  34088. */
  34089. function swap(ary, x, y) {
  34090. var temp = ary[x];
  34091. ary[x] = ary[y];
  34092. ary[y] = temp;
  34093. }
  34094. /**
  34095. * Returns a random integer within the range `low .. high` inclusive.
  34096. *
  34097. * @param {Number} low
  34098. * The lower bound on the range.
  34099. * @param {Number} high
  34100. * The upper bound on the range.
  34101. */
  34102. function randomIntInRange(low, high) {
  34103. return Math.round(low + (Math.random() * (high - low)));
  34104. }
  34105. /**
  34106. * The Quick Sort algorithm.
  34107. *
  34108. * @param {Array} ary
  34109. * An array to sort.
  34110. * @param {function} comparator
  34111. * Function to use to compare two items.
  34112. * @param {Number} p
  34113. * Start index of the array
  34114. * @param {Number} r
  34115. * End index of the array
  34116. */
  34117. function doQuickSort(ary, comparator, p, r) {
  34118. // If our lower bound is less than our upper bound, we (1) partition the
  34119. // array into two pieces and (2) recurse on each half. If it is not, this is
  34120. // the empty array and our base case.
  34121. if (p < r) {
  34122. // (1) Partitioning.
  34123. //
  34124. // The partitioning chooses a pivot between `p` and `r` and moves all
  34125. // elements that are less than or equal to the pivot to the before it, and
  34126. // all the elements that are greater than it after it. The effect is that
  34127. // once partition is done, the pivot is in the exact place it will be when
  34128. // the array is put in sorted order, and it will not need to be moved
  34129. // again. This runs in O(n) time.
  34130. // Always choose a random pivot so that an input array which is reverse
  34131. // sorted does not cause O(n^2) running time.
  34132. var pivotIndex = randomIntInRange(p, r);
  34133. var i = p - 1;
  34134. swap(ary, pivotIndex, r);
  34135. var pivot = ary[r];
  34136. // Immediately after `j` is incremented in this loop, the following hold
  34137. // true:
  34138. //
  34139. // * Every element in `ary[p .. i]` is less than or equal to the pivot.
  34140. //
  34141. // * Every element in `ary[i+1 .. j-1]` is greater than the pivot.
  34142. for (var j = p; j < r; j++) {
  34143. if (comparator(ary[j], pivot) <= 0) {
  34144. i += 1;
  34145. swap(ary, i, j);
  34146. }
  34147. }
  34148. swap(ary, i + 1, j);
  34149. var q = i + 1;
  34150. // (2) Recurse on each half.
  34151. doQuickSort(ary, comparator, p, q - 1);
  34152. doQuickSort(ary, comparator, q + 1, r);
  34153. }
  34154. }
  34155. /**
  34156. * Sort the given array in-place with the given comparator function.
  34157. *
  34158. * @param {Array} ary
  34159. * An array to sort.
  34160. * @param {function} comparator
  34161. * Function to use to compare two items.
  34162. */
  34163. exports.quickSort = function (ary, comparator) {
  34164. doQuickSort(ary, comparator, 0, ary.length - 1);
  34165. };
  34166. },{}],480:[function(require,module,exports){
  34167. /* -*- Mode: js; js-indent-level: 2; -*- */
  34168. /*
  34169. * Copyright 2011 Mozilla Foundation and contributors
  34170. * Licensed under the New BSD license. See LICENSE or:
  34171. * http://opensource.org/licenses/BSD-3-Clause
  34172. */
  34173. var util = require('./util');
  34174. var binarySearch = require('./binary-search');
  34175. var ArraySet = require('./array-set').ArraySet;
  34176. var base64VLQ = require('./base64-vlq');
  34177. var quickSort = require('./quick-sort').quickSort;
  34178. function SourceMapConsumer(aSourceMap) {
  34179. var sourceMap = aSourceMap;
  34180. if (typeof aSourceMap === 'string') {
  34181. sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, ''));
  34182. }
  34183. return sourceMap.sections != null
  34184. ? new IndexedSourceMapConsumer(sourceMap)
  34185. : new BasicSourceMapConsumer(sourceMap);
  34186. }
  34187. SourceMapConsumer.fromSourceMap = function(aSourceMap) {
  34188. return BasicSourceMapConsumer.fromSourceMap(aSourceMap);
  34189. }
  34190. /**
  34191. * The version of the source mapping spec that we are consuming.
  34192. */
  34193. SourceMapConsumer.prototype._version = 3;
  34194. // `__generatedMappings` and `__originalMappings` are arrays that hold the
  34195. // parsed mapping coordinates from the source map's "mappings" attribute. They
  34196. // are lazily instantiated, accessed via the `_generatedMappings` and
  34197. // `_originalMappings` getters respectively, and we only parse the mappings
  34198. // and create these arrays once queried for a source location. We jump through
  34199. // these hoops because there can be many thousands of mappings, and parsing
  34200. // them is expensive, so we only want to do it if we must.
  34201. //
  34202. // Each object in the arrays is of the form:
  34203. //
  34204. // {
  34205. // generatedLine: The line number in the generated code,
  34206. // generatedColumn: The column number in the generated code,
  34207. // source: The path to the original source file that generated this
  34208. // chunk of code,
  34209. // originalLine: The line number in the original source that
  34210. // corresponds to this chunk of generated code,
  34211. // originalColumn: The column number in the original source that
  34212. // corresponds to this chunk of generated code,
  34213. // name: The name of the original symbol which generated this chunk of
  34214. // code.
  34215. // }
  34216. //
  34217. // All properties except for `generatedLine` and `generatedColumn` can be
  34218. // `null`.
  34219. //
  34220. // `_generatedMappings` is ordered by the generated positions.
  34221. //
  34222. // `_originalMappings` is ordered by the original positions.
  34223. SourceMapConsumer.prototype.__generatedMappings = null;
  34224. Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {
  34225. get: function () {
  34226. if (!this.__generatedMappings) {
  34227. this._parseMappings(this._mappings, this.sourceRoot);
  34228. }
  34229. return this.__generatedMappings;
  34230. }
  34231. });
  34232. SourceMapConsumer.prototype.__originalMappings = null;
  34233. Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {
  34234. get: function () {
  34235. if (!this.__originalMappings) {
  34236. this._parseMappings(this._mappings, this.sourceRoot);
  34237. }
  34238. return this.__originalMappings;
  34239. }
  34240. });
  34241. SourceMapConsumer.prototype._charIsMappingSeparator =
  34242. function SourceMapConsumer_charIsMappingSeparator(aStr, index) {
  34243. var c = aStr.charAt(index);
  34244. return c === ";" || c === ",";
  34245. };
  34246. /**
  34247. * Parse the mappings in a string in to a data structure which we can easily
  34248. * query (the ordered arrays in the `this.__generatedMappings` and
  34249. * `this.__originalMappings` properties).
  34250. */
  34251. SourceMapConsumer.prototype._parseMappings =
  34252. function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
  34253. throw new Error("Subclasses must implement _parseMappings");
  34254. };
  34255. SourceMapConsumer.GENERATED_ORDER = 1;
  34256. SourceMapConsumer.ORIGINAL_ORDER = 2;
  34257. SourceMapConsumer.GREATEST_LOWER_BOUND = 1;
  34258. SourceMapConsumer.LEAST_UPPER_BOUND = 2;
  34259. /**
  34260. * Iterate over each mapping between an original source/line/column and a
  34261. * generated line/column in this source map.
  34262. *
  34263. * @param Function aCallback
  34264. * The function that is called with each mapping.
  34265. * @param Object aContext
  34266. * Optional. If specified, this object will be the value of `this` every
  34267. * time that `aCallback` is called.
  34268. * @param aOrder
  34269. * Either `SourceMapConsumer.GENERATED_ORDER` or
  34270. * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to
  34271. * iterate over the mappings sorted by the generated file's line/column
  34272. * order or the original's source/line/column order, respectively. Defaults to
  34273. * `SourceMapConsumer.GENERATED_ORDER`.
  34274. */
  34275. SourceMapConsumer.prototype.eachMapping =
  34276. function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
  34277. var context = aContext || null;
  34278. var order = aOrder || SourceMapConsumer.GENERATED_ORDER;
  34279. var mappings;
  34280. switch (order) {
  34281. case SourceMapConsumer.GENERATED_ORDER:
  34282. mappings = this._generatedMappings;
  34283. break;
  34284. case SourceMapConsumer.ORIGINAL_ORDER:
  34285. mappings = this._originalMappings;
  34286. break;
  34287. default:
  34288. throw new Error("Unknown order of iteration.");
  34289. }
  34290. var sourceRoot = this.sourceRoot;
  34291. mappings.map(function (mapping) {
  34292. var source = mapping.source === null ? null : this._sources.at(mapping.source);
  34293. if (source != null && sourceRoot != null) {
  34294. source = util.join(sourceRoot, source);
  34295. }
  34296. return {
  34297. source: source,
  34298. generatedLine: mapping.generatedLine,
  34299. generatedColumn: mapping.generatedColumn,
  34300. originalLine: mapping.originalLine,
  34301. originalColumn: mapping.originalColumn,
  34302. name: mapping.name === null ? null : this._names.at(mapping.name)
  34303. };
  34304. }, this).forEach(aCallback, context);
  34305. };
  34306. /**
  34307. * Returns all generated line and column information for the original source,
  34308. * line, and column provided. If no column is provided, returns all mappings
  34309. * corresponding to a either the line we are searching for or the next
  34310. * closest line that has any mappings. Otherwise, returns all mappings
  34311. * corresponding to the given line and either the column we are searching for
  34312. * or the next closest column that has any offsets.
  34313. *
  34314. * The only argument is an object with the following properties:
  34315. *
  34316. * - source: The filename of the original source.
  34317. * - line: The line number in the original source.
  34318. * - column: Optional. the column number in the original source.
  34319. *
  34320. * and an array of objects is returned, each with the following properties:
  34321. *
  34322. * - line: The line number in the generated source, or null.
  34323. * - column: The column number in the generated source, or null.
  34324. */
  34325. SourceMapConsumer.prototype.allGeneratedPositionsFor =
  34326. function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {
  34327. var line = util.getArg(aArgs, 'line');
  34328. // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping
  34329. // returns the index of the closest mapping less than the needle. By
  34330. // setting needle.originalColumn to 0, we thus find the last mapping for
  34331. // the given line, provided such a mapping exists.
  34332. var needle = {
  34333. source: util.getArg(aArgs, 'source'),
  34334. originalLine: line,
  34335. originalColumn: util.getArg(aArgs, 'column', 0)
  34336. };
  34337. if (this.sourceRoot != null) {
  34338. needle.source = util.relative(this.sourceRoot, needle.source);
  34339. }
  34340. if (!this._sources.has(needle.source)) {
  34341. return [];
  34342. }
  34343. needle.source = this._sources.indexOf(needle.source);
  34344. var mappings = [];
  34345. var index = this._findMapping(needle,
  34346. this._originalMappings,
  34347. "originalLine",
  34348. "originalColumn",
  34349. util.compareByOriginalPositions,
  34350. binarySearch.LEAST_UPPER_BOUND);
  34351. if (index >= 0) {
  34352. var mapping = this._originalMappings[index];
  34353. if (aArgs.column === undefined) {
  34354. var originalLine = mapping.originalLine;
  34355. // Iterate until either we run out of mappings, or we run into
  34356. // a mapping for a different line than the one we found. Since
  34357. // mappings are sorted, this is guaranteed to find all mappings for
  34358. // the line we found.
  34359. while (mapping && mapping.originalLine === originalLine) {
  34360. mappings.push({
  34361. line: util.getArg(mapping, 'generatedLine', null),
  34362. column: util.getArg(mapping, 'generatedColumn', null),
  34363. lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
  34364. });
  34365. mapping = this._originalMappings[++index];
  34366. }
  34367. } else {
  34368. var originalColumn = mapping.originalColumn;
  34369. // Iterate until either we run out of mappings, or we run into
  34370. // a mapping for a different line than the one we were searching for.
  34371. // Since mappings are sorted, this is guaranteed to find all mappings for
  34372. // the line we are searching for.
  34373. while (mapping &&
  34374. mapping.originalLine === line &&
  34375. mapping.originalColumn == originalColumn) {
  34376. mappings.push({
  34377. line: util.getArg(mapping, 'generatedLine', null),
  34378. column: util.getArg(mapping, 'generatedColumn', null),
  34379. lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
  34380. });
  34381. mapping = this._originalMappings[++index];
  34382. }
  34383. }
  34384. }
  34385. return mappings;
  34386. };
  34387. exports.SourceMapConsumer = SourceMapConsumer;
  34388. /**
  34389. * A BasicSourceMapConsumer instance represents a parsed source map which we can
  34390. * query for information about the original file positions by giving it a file
  34391. * position in the generated source.
  34392. *
  34393. * The only parameter is the raw source map (either as a JSON string, or
  34394. * already parsed to an object). According to the spec, source maps have the
  34395. * following attributes:
  34396. *
  34397. * - version: Which version of the source map spec this map is following.
  34398. * - sources: An array of URLs to the original source files.
  34399. * - names: An array of identifiers which can be referrenced by individual mappings.
  34400. * - sourceRoot: Optional. The URL root from which all sources are relative.
  34401. * - sourcesContent: Optional. An array of contents of the original source files.
  34402. * - mappings: A string of base64 VLQs which contain the actual mappings.
  34403. * - file: Optional. The generated file this source map is associated with.
  34404. *
  34405. * Here is an example source map, taken from the source map spec[0]:
  34406. *
  34407. * {
  34408. * version : 3,
  34409. * file: "out.js",
  34410. * sourceRoot : "",
  34411. * sources: ["foo.js", "bar.js"],
  34412. * names: ["src", "maps", "are", "fun"],
  34413. * mappings: "AA,AB;;ABCDE;"
  34414. * }
  34415. *
  34416. * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#
  34417. */
  34418. function BasicSourceMapConsumer(aSourceMap) {
  34419. var sourceMap = aSourceMap;
  34420. if (typeof aSourceMap === 'string') {
  34421. sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, ''));
  34422. }
  34423. var version = util.getArg(sourceMap, 'version');
  34424. var sources = util.getArg(sourceMap, 'sources');
  34425. // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which
  34426. // requires the array) to play nice here.
  34427. var names = util.getArg(sourceMap, 'names', []);
  34428. var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);
  34429. var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);
  34430. var mappings = util.getArg(sourceMap, 'mappings');
  34431. var file = util.getArg(sourceMap, 'file', null);
  34432. // Once again, Sass deviates from the spec and supplies the version as a
  34433. // string rather than a number, so we use loose equality checking here.
  34434. if (version != this._version) {
  34435. throw new Error('Unsupported version: ' + version);
  34436. }
  34437. sources = sources
  34438. .map(String)
  34439. // Some source maps produce relative source paths like "./foo.js" instead of
  34440. // "foo.js". Normalize these first so that future comparisons will succeed.
  34441. // See bugzil.la/1090768.
  34442. .map(util.normalize)
  34443. // Always ensure that absolute sources are internally stored relative to
  34444. // the source root, if the source root is absolute. Not doing this would
  34445. // be particularly problematic when the source root is a prefix of the
  34446. // source (valid, but why??). See github issue #199 and bugzil.la/1188982.
  34447. .map(function (source) {
  34448. return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)
  34449. ? util.relative(sourceRoot, source)
  34450. : source;
  34451. });
  34452. // Pass `true` below to allow duplicate names and sources. While source maps
  34453. // are intended to be compressed and deduplicated, the TypeScript compiler
  34454. // sometimes generates source maps with duplicates in them. See Github issue
  34455. // #72 and bugzil.la/889492.
  34456. this._names = ArraySet.fromArray(names.map(String), true);
  34457. this._sources = ArraySet.fromArray(sources, true);
  34458. this.sourceRoot = sourceRoot;
  34459. this.sourcesContent = sourcesContent;
  34460. this._mappings = mappings;
  34461. this.file = file;
  34462. }
  34463. BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
  34464. BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;
  34465. /**
  34466. * Create a BasicSourceMapConsumer from a SourceMapGenerator.
  34467. *
  34468. * @param SourceMapGenerator aSourceMap
  34469. * The source map that will be consumed.
  34470. * @returns BasicSourceMapConsumer
  34471. */
  34472. BasicSourceMapConsumer.fromSourceMap =
  34473. function SourceMapConsumer_fromSourceMap(aSourceMap) {
  34474. var smc = Object.create(BasicSourceMapConsumer.prototype);
  34475. var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);
  34476. var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);
  34477. smc.sourceRoot = aSourceMap._sourceRoot;
  34478. smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),
  34479. smc.sourceRoot);
  34480. smc.file = aSourceMap._file;
  34481. // Because we are modifying the entries (by converting string sources and
  34482. // names to indices into the sources and names ArraySets), we have to make
  34483. // a copy of the entry or else bad things happen. Shared mutable state
  34484. // strikes again! See github issue #191.
  34485. var generatedMappings = aSourceMap._mappings.toArray().slice();
  34486. var destGeneratedMappings = smc.__generatedMappings = [];
  34487. var destOriginalMappings = smc.__originalMappings = [];
  34488. for (var i = 0, length = generatedMappings.length; i < length; i++) {
  34489. var srcMapping = generatedMappings[i];
  34490. var destMapping = new Mapping;
  34491. destMapping.generatedLine = srcMapping.generatedLine;
  34492. destMapping.generatedColumn = srcMapping.generatedColumn;
  34493. if (srcMapping.source) {
  34494. destMapping.source = sources.indexOf(srcMapping.source);
  34495. destMapping.originalLine = srcMapping.originalLine;
  34496. destMapping.originalColumn = srcMapping.originalColumn;
  34497. if (srcMapping.name) {
  34498. destMapping.name = names.indexOf(srcMapping.name);
  34499. }
  34500. destOriginalMappings.push(destMapping);
  34501. }
  34502. destGeneratedMappings.push(destMapping);
  34503. }
  34504. quickSort(smc.__originalMappings, util.compareByOriginalPositions);
  34505. return smc;
  34506. };
  34507. /**
  34508. * The version of the source mapping spec that we are consuming.
  34509. */
  34510. BasicSourceMapConsumer.prototype._version = 3;
  34511. /**
  34512. * The list of original sources.
  34513. */
  34514. Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {
  34515. get: function () {
  34516. return this._sources.toArray().map(function (s) {
  34517. return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s;
  34518. }, this);
  34519. }
  34520. });
  34521. /**
  34522. * Provide the JIT with a nice shape / hidden class.
  34523. */
  34524. function Mapping() {
  34525. this.generatedLine = 0;
  34526. this.generatedColumn = 0;
  34527. this.source = null;
  34528. this.originalLine = null;
  34529. this.originalColumn = null;
  34530. this.name = null;
  34531. }
  34532. /**
  34533. * Parse the mappings in a string in to a data structure which we can easily
  34534. * query (the ordered arrays in the `this.__generatedMappings` and
  34535. * `this.__originalMappings` properties).
  34536. */
  34537. BasicSourceMapConsumer.prototype._parseMappings =
  34538. function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
  34539. var generatedLine = 1;
  34540. var previousGeneratedColumn = 0;
  34541. var previousOriginalLine = 0;
  34542. var previousOriginalColumn = 0;
  34543. var previousSource = 0;
  34544. var previousName = 0;
  34545. var length = aStr.length;
  34546. var index = 0;
  34547. var cachedSegments = {};
  34548. var temp = {};
  34549. var originalMappings = [];
  34550. var generatedMappings = [];
  34551. var mapping, str, segment, end, value;
  34552. while (index < length) {
  34553. if (aStr.charAt(index) === ';') {
  34554. generatedLine++;
  34555. index++;
  34556. previousGeneratedColumn = 0;
  34557. }
  34558. else if (aStr.charAt(index) === ',') {
  34559. index++;
  34560. }
  34561. else {
  34562. mapping = new Mapping();
  34563. mapping.generatedLine = generatedLine;
  34564. // Because each offset is encoded relative to the previous one,
  34565. // many segments often have the same encoding. We can exploit this
  34566. // fact by caching the parsed variable length fields of each segment,
  34567. // allowing us to avoid a second parse if we encounter the same
  34568. // segment again.
  34569. for (end = index; end < length; end++) {
  34570. if (this._charIsMappingSeparator(aStr, end)) {
  34571. break;
  34572. }
  34573. }
  34574. str = aStr.slice(index, end);
  34575. segment = cachedSegments[str];
  34576. if (segment) {
  34577. index += str.length;
  34578. } else {
  34579. segment = [];
  34580. while (index < end) {
  34581. base64VLQ.decode(aStr, index, temp);
  34582. value = temp.value;
  34583. index = temp.rest;
  34584. segment.push(value);
  34585. }
  34586. if (segment.length === 2) {
  34587. throw new Error('Found a source, but no line and column');
  34588. }
  34589. if (segment.length === 3) {
  34590. throw new Error('Found a source and line, but no column');
  34591. }
  34592. cachedSegments[str] = segment;
  34593. }
  34594. // Generated column.
  34595. mapping.generatedColumn = previousGeneratedColumn + segment[0];
  34596. previousGeneratedColumn = mapping.generatedColumn;
  34597. if (segment.length > 1) {
  34598. // Original source.
  34599. mapping.source = previousSource + segment[1];
  34600. previousSource += segment[1];
  34601. // Original line.
  34602. mapping.originalLine = previousOriginalLine + segment[2];
  34603. previousOriginalLine = mapping.originalLine;
  34604. // Lines are stored 0-based
  34605. mapping.originalLine += 1;
  34606. // Original column.
  34607. mapping.originalColumn = previousOriginalColumn + segment[3];
  34608. previousOriginalColumn = mapping.originalColumn;
  34609. if (segment.length > 4) {
  34610. // Original name.
  34611. mapping.name = previousName + segment[4];
  34612. previousName += segment[4];
  34613. }
  34614. }
  34615. generatedMappings.push(mapping);
  34616. if (typeof mapping.originalLine === 'number') {
  34617. originalMappings.push(mapping);
  34618. }
  34619. }
  34620. }
  34621. quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated);
  34622. this.__generatedMappings = generatedMappings;
  34623. quickSort(originalMappings, util.compareByOriginalPositions);
  34624. this.__originalMappings = originalMappings;
  34625. };
  34626. /**
  34627. * Find the mapping that best matches the hypothetical "needle" mapping that
  34628. * we are searching for in the given "haystack" of mappings.
  34629. */
  34630. BasicSourceMapConsumer.prototype._findMapping =
  34631. function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,
  34632. aColumnName, aComparator, aBias) {
  34633. // To return the position we are searching for, we must first find the
  34634. // mapping for the given position and then return the opposite position it
  34635. // points to. Because the mappings are sorted, we can use binary search to
  34636. // find the best mapping.
  34637. if (aNeedle[aLineName] <= 0) {
  34638. throw new TypeError('Line must be greater than or equal to 1, got '
  34639. + aNeedle[aLineName]);
  34640. }
  34641. if (aNeedle[aColumnName] < 0) {
  34642. throw new TypeError('Column must be greater than or equal to 0, got '
  34643. + aNeedle[aColumnName]);
  34644. }
  34645. return binarySearch.search(aNeedle, aMappings, aComparator, aBias);
  34646. };
  34647. /**
  34648. * Compute the last column for each generated mapping. The last column is
  34649. * inclusive.
  34650. */
  34651. BasicSourceMapConsumer.prototype.computeColumnSpans =
  34652. function SourceMapConsumer_computeColumnSpans() {
  34653. for (var index = 0; index < this._generatedMappings.length; ++index) {
  34654. var mapping = this._generatedMappings[index];
  34655. // Mappings do not contain a field for the last generated columnt. We
  34656. // can come up with an optimistic estimate, however, by assuming that
  34657. // mappings are contiguous (i.e. given two consecutive mappings, the
  34658. // first mapping ends where the second one starts).
  34659. if (index + 1 < this._generatedMappings.length) {
  34660. var nextMapping = this._generatedMappings[index + 1];
  34661. if (mapping.generatedLine === nextMapping.generatedLine) {
  34662. mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;
  34663. continue;
  34664. }
  34665. }
  34666. // The last mapping for each line spans the entire line.
  34667. mapping.lastGeneratedColumn = Infinity;
  34668. }
  34669. };
  34670. /**
  34671. * Returns the original source, line, and column information for the generated
  34672. * source's line and column positions provided. The only argument is an object
  34673. * with the following properties:
  34674. *
  34675. * - line: The line number in the generated source.
  34676. * - column: The column number in the generated source.
  34677. * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
  34678. * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
  34679. * closest element that is smaller than or greater than the one we are
  34680. * searching for, respectively, if the exact element cannot be found.
  34681. * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
  34682. *
  34683. * and an object is returned with the following properties:
  34684. *
  34685. * - source: The original source file, or null.
  34686. * - line: The line number in the original source, or null.
  34687. * - column: The column number in the original source, or null.
  34688. * - name: The original identifier, or null.
  34689. */
  34690. BasicSourceMapConsumer.prototype.originalPositionFor =
  34691. function SourceMapConsumer_originalPositionFor(aArgs) {
  34692. var needle = {
  34693. generatedLine: util.getArg(aArgs, 'line'),
  34694. generatedColumn: util.getArg(aArgs, 'column')
  34695. };
  34696. var index = this._findMapping(
  34697. needle,
  34698. this._generatedMappings,
  34699. "generatedLine",
  34700. "generatedColumn",
  34701. util.compareByGeneratedPositionsDeflated,
  34702. util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)
  34703. );
  34704. if (index >= 0) {
  34705. var mapping = this._generatedMappings[index];
  34706. if (mapping.generatedLine === needle.generatedLine) {
  34707. var source = util.getArg(mapping, 'source', null);
  34708. if (source !== null) {
  34709. source = this._sources.at(source);
  34710. if (this.sourceRoot != null) {
  34711. source = util.join(this.sourceRoot, source);
  34712. }
  34713. }
  34714. var name = util.getArg(mapping, 'name', null);
  34715. if (name !== null) {
  34716. name = this._names.at(name);
  34717. }
  34718. return {
  34719. source: source,
  34720. line: util.getArg(mapping, 'originalLine', null),
  34721. column: util.getArg(mapping, 'originalColumn', null),
  34722. name: name
  34723. };
  34724. }
  34725. }
  34726. return {
  34727. source: null,
  34728. line: null,
  34729. column: null,
  34730. name: null
  34731. };
  34732. };
  34733. /**
  34734. * Return true if we have the source content for every source in the source
  34735. * map, false otherwise.
  34736. */
  34737. BasicSourceMapConsumer.prototype.hasContentsOfAllSources =
  34738. function BasicSourceMapConsumer_hasContentsOfAllSources() {
  34739. if (!this.sourcesContent) {
  34740. return false;
  34741. }
  34742. return this.sourcesContent.length >= this._sources.size() &&
  34743. !this.sourcesContent.some(function (sc) { return sc == null; });
  34744. };
  34745. /**
  34746. * Returns the original source content. The only argument is the url of the
  34747. * original source file. Returns null if no original source content is
  34748. * available.
  34749. */
  34750. BasicSourceMapConsumer.prototype.sourceContentFor =
  34751. function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
  34752. if (!this.sourcesContent) {
  34753. return null;
  34754. }
  34755. if (this.sourceRoot != null) {
  34756. aSource = util.relative(this.sourceRoot, aSource);
  34757. }
  34758. if (this._sources.has(aSource)) {
  34759. return this.sourcesContent[this._sources.indexOf(aSource)];
  34760. }
  34761. var url;
  34762. if (this.sourceRoot != null
  34763. && (url = util.urlParse(this.sourceRoot))) {
  34764. // XXX: file:// URIs and absolute paths lead to unexpected behavior for
  34765. // many users. We can help them out when they expect file:// URIs to
  34766. // behave like it would if they were running a local HTTP server. See
  34767. // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.
  34768. var fileUriAbsPath = aSource.replace(/^file:\/\//, "");
  34769. if (url.scheme == "file"
  34770. && this._sources.has(fileUriAbsPath)) {
  34771. return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]
  34772. }
  34773. if ((!url.path || url.path == "/")
  34774. && this._sources.has("/" + aSource)) {
  34775. return this.sourcesContent[this._sources.indexOf("/" + aSource)];
  34776. }
  34777. }
  34778. // This function is used recursively from
  34779. // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we
  34780. // don't want to throw if we can't find the source - we just want to
  34781. // return null, so we provide a flag to exit gracefully.
  34782. if (nullOnMissing) {
  34783. return null;
  34784. }
  34785. else {
  34786. throw new Error('"' + aSource + '" is not in the SourceMap.');
  34787. }
  34788. };
  34789. /**
  34790. * Returns the generated line and column information for the original source,
  34791. * line, and column positions provided. The only argument is an object with
  34792. * the following properties:
  34793. *
  34794. * - source: The filename of the original source.
  34795. * - line: The line number in the original source.
  34796. * - column: The column number in the original source.
  34797. * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
  34798. * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
  34799. * closest element that is smaller than or greater than the one we are
  34800. * searching for, respectively, if the exact element cannot be found.
  34801. * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
  34802. *
  34803. * and an object is returned with the following properties:
  34804. *
  34805. * - line: The line number in the generated source, or null.
  34806. * - column: The column number in the generated source, or null.
  34807. */
  34808. BasicSourceMapConsumer.prototype.generatedPositionFor =
  34809. function SourceMapConsumer_generatedPositionFor(aArgs) {
  34810. var source = util.getArg(aArgs, 'source');
  34811. if (this.sourceRoot != null) {
  34812. source = util.relative(this.sourceRoot, source);
  34813. }
  34814. if (!this._sources.has(source)) {
  34815. return {
  34816. line: null,
  34817. column: null,
  34818. lastColumn: null
  34819. };
  34820. }
  34821. source = this._sources.indexOf(source);
  34822. var needle = {
  34823. source: source,
  34824. originalLine: util.getArg(aArgs, 'line'),
  34825. originalColumn: util.getArg(aArgs, 'column')
  34826. };
  34827. var index = this._findMapping(
  34828. needle,
  34829. this._originalMappings,
  34830. "originalLine",
  34831. "originalColumn",
  34832. util.compareByOriginalPositions,
  34833. util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)
  34834. );
  34835. if (index >= 0) {
  34836. var mapping = this._originalMappings[index];
  34837. if (mapping.source === needle.source) {
  34838. return {
  34839. line: util.getArg(mapping, 'generatedLine', null),
  34840. column: util.getArg(mapping, 'generatedColumn', null),
  34841. lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
  34842. };
  34843. }
  34844. }
  34845. return {
  34846. line: null,
  34847. column: null,
  34848. lastColumn: null
  34849. };
  34850. };
  34851. exports.BasicSourceMapConsumer = BasicSourceMapConsumer;
  34852. /**
  34853. * An IndexedSourceMapConsumer instance represents a parsed source map which
  34854. * we can query for information. It differs from BasicSourceMapConsumer in
  34855. * that it takes "indexed" source maps (i.e. ones with a "sections" field) as
  34856. * input.
  34857. *
  34858. * The only parameter is a raw source map (either as a JSON string, or already
  34859. * parsed to an object). According to the spec for indexed source maps, they
  34860. * have the following attributes:
  34861. *
  34862. * - version: Which version of the source map spec this map is following.
  34863. * - file: Optional. The generated file this source map is associated with.
  34864. * - sections: A list of section definitions.
  34865. *
  34866. * Each value under the "sections" field has two fields:
  34867. * - offset: The offset into the original specified at which this section
  34868. * begins to apply, defined as an object with a "line" and "column"
  34869. * field.
  34870. * - map: A source map definition. This source map could also be indexed,
  34871. * but doesn't have to be.
  34872. *
  34873. * Instead of the "map" field, it's also possible to have a "url" field
  34874. * specifying a URL to retrieve a source map from, but that's currently
  34875. * unsupported.
  34876. *
  34877. * Here's an example source map, taken from the source map spec[0], but
  34878. * modified to omit a section which uses the "url" field.
  34879. *
  34880. * {
  34881. * version : 3,
  34882. * file: "app.js",
  34883. * sections: [{
  34884. * offset: {line:100, column:10},
  34885. * map: {
  34886. * version : 3,
  34887. * file: "section.js",
  34888. * sources: ["foo.js", "bar.js"],
  34889. * names: ["src", "maps", "are", "fun"],
  34890. * mappings: "AAAA,E;;ABCDE;"
  34891. * }
  34892. * }],
  34893. * }
  34894. *
  34895. * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt
  34896. */
  34897. function IndexedSourceMapConsumer(aSourceMap) {
  34898. var sourceMap = aSourceMap;
  34899. if (typeof aSourceMap === 'string') {
  34900. sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, ''));
  34901. }
  34902. var version = util.getArg(sourceMap, 'version');
  34903. var sections = util.getArg(sourceMap, 'sections');
  34904. if (version != this._version) {
  34905. throw new Error('Unsupported version: ' + version);
  34906. }
  34907. this._sources = new ArraySet();
  34908. this._names = new ArraySet();
  34909. var lastOffset = {
  34910. line: -1,
  34911. column: 0
  34912. };
  34913. this._sections = sections.map(function (s) {
  34914. if (s.url) {
  34915. // The url field will require support for asynchronicity.
  34916. // See https://github.com/mozilla/source-map/issues/16
  34917. throw new Error('Support for url field in sections not implemented.');
  34918. }
  34919. var offset = util.getArg(s, 'offset');
  34920. var offsetLine = util.getArg(offset, 'line');
  34921. var offsetColumn = util.getArg(offset, 'column');
  34922. if (offsetLine < lastOffset.line ||
  34923. (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {
  34924. throw new Error('Section offsets must be ordered and non-overlapping.');
  34925. }
  34926. lastOffset = offset;
  34927. return {
  34928. generatedOffset: {
  34929. // The offset fields are 0-based, but we use 1-based indices when
  34930. // encoding/decoding from VLQ.
  34931. generatedLine: offsetLine + 1,
  34932. generatedColumn: offsetColumn + 1
  34933. },
  34934. consumer: new SourceMapConsumer(util.getArg(s, 'map'))
  34935. }
  34936. });
  34937. }
  34938. IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
  34939. IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;
  34940. /**
  34941. * The version of the source mapping spec that we are consuming.
  34942. */
  34943. IndexedSourceMapConsumer.prototype._version = 3;
  34944. /**
  34945. * The list of original sources.
  34946. */
  34947. Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {
  34948. get: function () {
  34949. var sources = [];
  34950. for (var i = 0; i < this._sections.length; i++) {
  34951. for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {
  34952. sources.push(this._sections[i].consumer.sources[j]);
  34953. }
  34954. }
  34955. return sources;
  34956. }
  34957. });
  34958. /**
  34959. * Returns the original source, line, and column information for the generated
  34960. * source's line and column positions provided. The only argument is an object
  34961. * with the following properties:
  34962. *
  34963. * - line: The line number in the generated source.
  34964. * - column: The column number in the generated source.
  34965. *
  34966. * and an object is returned with the following properties:
  34967. *
  34968. * - source: The original source file, or null.
  34969. * - line: The line number in the original source, or null.
  34970. * - column: The column number in the original source, or null.
  34971. * - name: The original identifier, or null.
  34972. */
  34973. IndexedSourceMapConsumer.prototype.originalPositionFor =
  34974. function IndexedSourceMapConsumer_originalPositionFor(aArgs) {
  34975. var needle = {
  34976. generatedLine: util.getArg(aArgs, 'line'),
  34977. generatedColumn: util.getArg(aArgs, 'column')
  34978. };
  34979. // Find the section containing the generated position we're trying to map
  34980. // to an original position.
  34981. var sectionIndex = binarySearch.search(needle, this._sections,
  34982. function(needle, section) {
  34983. var cmp = needle.generatedLine - section.generatedOffset.generatedLine;
  34984. if (cmp) {
  34985. return cmp;
  34986. }
  34987. return (needle.generatedColumn -
  34988. section.generatedOffset.generatedColumn);
  34989. });
  34990. var section = this._sections[sectionIndex];
  34991. if (!section) {
  34992. return {
  34993. source: null,
  34994. line: null,
  34995. column: null,
  34996. name: null
  34997. };
  34998. }
  34999. return section.consumer.originalPositionFor({
  35000. line: needle.generatedLine -
  35001. (section.generatedOffset.generatedLine - 1),
  35002. column: needle.generatedColumn -
  35003. (section.generatedOffset.generatedLine === needle.generatedLine
  35004. ? section.generatedOffset.generatedColumn - 1
  35005. : 0),
  35006. bias: aArgs.bias
  35007. });
  35008. };
  35009. /**
  35010. * Return true if we have the source content for every source in the source
  35011. * map, false otherwise.
  35012. */
  35013. IndexedSourceMapConsumer.prototype.hasContentsOfAllSources =
  35014. function IndexedSourceMapConsumer_hasContentsOfAllSources() {
  35015. return this._sections.every(function (s) {
  35016. return s.consumer.hasContentsOfAllSources();
  35017. });
  35018. };
  35019. /**
  35020. * Returns the original source content. The only argument is the url of the
  35021. * original source file. Returns null if no original source content is
  35022. * available.
  35023. */
  35024. IndexedSourceMapConsumer.prototype.sourceContentFor =
  35025. function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
  35026. for (var i = 0; i < this._sections.length; i++) {
  35027. var section = this._sections[i];
  35028. var content = section.consumer.sourceContentFor(aSource, true);
  35029. if (content) {
  35030. return content;
  35031. }
  35032. }
  35033. if (nullOnMissing) {
  35034. return null;
  35035. }
  35036. else {
  35037. throw new Error('"' + aSource + '" is not in the SourceMap.');
  35038. }
  35039. };
  35040. /**
  35041. * Returns the generated line and column information for the original source,
  35042. * line, and column positions provided. The only argument is an object with
  35043. * the following properties:
  35044. *
  35045. * - source: The filename of the original source.
  35046. * - line: The line number in the original source.
  35047. * - column: The column number in the original source.
  35048. *
  35049. * and an object is returned with the following properties:
  35050. *
  35051. * - line: The line number in the generated source, or null.
  35052. * - column: The column number in the generated source, or null.
  35053. */
  35054. IndexedSourceMapConsumer.prototype.generatedPositionFor =
  35055. function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {
  35056. for (var i = 0; i < this._sections.length; i++) {
  35057. var section = this._sections[i];
  35058. // Only consider this section if the requested source is in the list of
  35059. // sources of the consumer.
  35060. if (section.consumer.sources.indexOf(util.getArg(aArgs, 'source')) === -1) {
  35061. continue;
  35062. }
  35063. var generatedPosition = section.consumer.generatedPositionFor(aArgs);
  35064. if (generatedPosition) {
  35065. var ret = {
  35066. line: generatedPosition.line +
  35067. (section.generatedOffset.generatedLine - 1),
  35068. column: generatedPosition.column +
  35069. (section.generatedOffset.generatedLine === generatedPosition.line
  35070. ? section.generatedOffset.generatedColumn - 1
  35071. : 0)
  35072. };
  35073. return ret;
  35074. }
  35075. }
  35076. return {
  35077. line: null,
  35078. column: null
  35079. };
  35080. };
  35081. /**
  35082. * Parse the mappings in a string in to a data structure which we can easily
  35083. * query (the ordered arrays in the `this.__generatedMappings` and
  35084. * `this.__originalMappings` properties).
  35085. */
  35086. IndexedSourceMapConsumer.prototype._parseMappings =
  35087. function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {
  35088. this.__generatedMappings = [];
  35089. this.__originalMappings = [];
  35090. for (var i = 0; i < this._sections.length; i++) {
  35091. var section = this._sections[i];
  35092. var sectionMappings = section.consumer._generatedMappings;
  35093. for (var j = 0; j < sectionMappings.length; j++) {
  35094. var mapping = sectionMappings[j];
  35095. var source = section.consumer._sources.at(mapping.source);
  35096. if (section.consumer.sourceRoot !== null) {
  35097. source = util.join(section.consumer.sourceRoot, source);
  35098. }
  35099. this._sources.add(source);
  35100. source = this._sources.indexOf(source);
  35101. var name = section.consumer._names.at(mapping.name);
  35102. this._names.add(name);
  35103. name = this._names.indexOf(name);
  35104. // The mappings coming from the consumer for the section have
  35105. // generated positions relative to the start of the section, so we
  35106. // need to offset them to be relative to the start of the concatenated
  35107. // generated file.
  35108. var adjustedMapping = {
  35109. source: source,
  35110. generatedLine: mapping.generatedLine +
  35111. (section.generatedOffset.generatedLine - 1),
  35112. generatedColumn: mapping.generatedColumn +
  35113. (section.generatedOffset.generatedLine === mapping.generatedLine
  35114. ? section.generatedOffset.generatedColumn - 1
  35115. : 0),
  35116. originalLine: mapping.originalLine,
  35117. originalColumn: mapping.originalColumn,
  35118. name: name
  35119. };
  35120. this.__generatedMappings.push(adjustedMapping);
  35121. if (typeof adjustedMapping.originalLine === 'number') {
  35122. this.__originalMappings.push(adjustedMapping);
  35123. }
  35124. }
  35125. }
  35126. quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);
  35127. quickSort(this.__originalMappings, util.compareByOriginalPositions);
  35128. };
  35129. exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;
  35130. },{"./array-set":474,"./base64-vlq":475,"./binary-search":477,"./quick-sort":479,"./util":483}],481:[function(require,module,exports){
  35131. /* -*- Mode: js; js-indent-level: 2; -*- */
  35132. /*
  35133. * Copyright 2011 Mozilla Foundation and contributors
  35134. * Licensed under the New BSD license. See LICENSE or:
  35135. * http://opensource.org/licenses/BSD-3-Clause
  35136. */
  35137. var base64VLQ = require('./base64-vlq');
  35138. var util = require('./util');
  35139. var ArraySet = require('./array-set').ArraySet;
  35140. var MappingList = require('./mapping-list').MappingList;
  35141. /**
  35142. * An instance of the SourceMapGenerator represents a source map which is
  35143. * being built incrementally. You may pass an object with the following
  35144. * properties:
  35145. *
  35146. * - file: The filename of the generated source.
  35147. * - sourceRoot: A root for all relative URLs in this source map.
  35148. */
  35149. function SourceMapGenerator(aArgs) {
  35150. if (!aArgs) {
  35151. aArgs = {};
  35152. }
  35153. this._file = util.getArg(aArgs, 'file', null);
  35154. this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);
  35155. this._skipValidation = util.getArg(aArgs, 'skipValidation', false);
  35156. this._sources = new ArraySet();
  35157. this._names = new ArraySet();
  35158. this._mappings = new MappingList();
  35159. this._sourcesContents = null;
  35160. }
  35161. SourceMapGenerator.prototype._version = 3;
  35162. /**
  35163. * Creates a new SourceMapGenerator based on a SourceMapConsumer
  35164. *
  35165. * @param aSourceMapConsumer The SourceMap.
  35166. */
  35167. SourceMapGenerator.fromSourceMap =
  35168. function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
  35169. var sourceRoot = aSourceMapConsumer.sourceRoot;
  35170. var generator = new SourceMapGenerator({
  35171. file: aSourceMapConsumer.file,
  35172. sourceRoot: sourceRoot
  35173. });
  35174. aSourceMapConsumer.eachMapping(function (mapping) {
  35175. var newMapping = {
  35176. generated: {
  35177. line: mapping.generatedLine,
  35178. column: mapping.generatedColumn
  35179. }
  35180. };
  35181. if (mapping.source != null) {
  35182. newMapping.source = mapping.source;
  35183. if (sourceRoot != null) {
  35184. newMapping.source = util.relative(sourceRoot, newMapping.source);
  35185. }
  35186. newMapping.original = {
  35187. line: mapping.originalLine,
  35188. column: mapping.originalColumn
  35189. };
  35190. if (mapping.name != null) {
  35191. newMapping.name = mapping.name;
  35192. }
  35193. }
  35194. generator.addMapping(newMapping);
  35195. });
  35196. aSourceMapConsumer.sources.forEach(function (sourceFile) {
  35197. var content = aSourceMapConsumer.sourceContentFor(sourceFile);
  35198. if (content != null) {
  35199. generator.setSourceContent(sourceFile, content);
  35200. }
  35201. });
  35202. return generator;
  35203. };
  35204. /**
  35205. * Add a single mapping from original source line and column to the generated
  35206. * source's line and column for this source map being created. The mapping
  35207. * object should have the following properties:
  35208. *
  35209. * - generated: An object with the generated line and column positions.
  35210. * - original: An object with the original line and column positions.
  35211. * - source: The original source file (relative to the sourceRoot).
  35212. * - name: An optional original token name for this mapping.
  35213. */
  35214. SourceMapGenerator.prototype.addMapping =
  35215. function SourceMapGenerator_addMapping(aArgs) {
  35216. var generated = util.getArg(aArgs, 'generated');
  35217. var original = util.getArg(aArgs, 'original', null);
  35218. var source = util.getArg(aArgs, 'source', null);
  35219. var name = util.getArg(aArgs, 'name', null);
  35220. if (!this._skipValidation) {
  35221. this._validateMapping(generated, original, source, name);
  35222. }
  35223. if (source != null) {
  35224. source = String(source);
  35225. if (!this._sources.has(source)) {
  35226. this._sources.add(source);
  35227. }
  35228. }
  35229. if (name != null) {
  35230. name = String(name);
  35231. if (!this._names.has(name)) {
  35232. this._names.add(name);
  35233. }
  35234. }
  35235. this._mappings.add({
  35236. generatedLine: generated.line,
  35237. generatedColumn: generated.column,
  35238. originalLine: original != null && original.line,
  35239. originalColumn: original != null && original.column,
  35240. source: source,
  35241. name: name
  35242. });
  35243. };
  35244. /**
  35245. * Set the source content for a source file.
  35246. */
  35247. SourceMapGenerator.prototype.setSourceContent =
  35248. function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
  35249. var source = aSourceFile;
  35250. if (this._sourceRoot != null) {
  35251. source = util.relative(this._sourceRoot, source);
  35252. }
  35253. if (aSourceContent != null) {
  35254. // Add the source content to the _sourcesContents map.
  35255. // Create a new _sourcesContents map if the property is null.
  35256. if (!this._sourcesContents) {
  35257. this._sourcesContents = Object.create(null);
  35258. }
  35259. this._sourcesContents[util.toSetString(source)] = aSourceContent;
  35260. } else if (this._sourcesContents) {
  35261. // Remove the source file from the _sourcesContents map.
  35262. // If the _sourcesContents map is empty, set the property to null.
  35263. delete this._sourcesContents[util.toSetString(source)];
  35264. if (Object.keys(this._sourcesContents).length === 0) {
  35265. this._sourcesContents = null;
  35266. }
  35267. }
  35268. };
  35269. /**
  35270. * Applies the mappings of a sub-source-map for a specific source file to the
  35271. * source map being generated. Each mapping to the supplied source file is
  35272. * rewritten using the supplied source map. Note: The resolution for the
  35273. * resulting mappings is the minimium of this map and the supplied map.
  35274. *
  35275. * @param aSourceMapConsumer The source map to be applied.
  35276. * @param aSourceFile Optional. The filename of the source file.
  35277. * If omitted, SourceMapConsumer's file property will be used.
  35278. * @param aSourceMapPath Optional. The dirname of the path to the source map
  35279. * to be applied. If relative, it is relative to the SourceMapConsumer.
  35280. * This parameter is needed when the two source maps aren't in the same
  35281. * directory, and the source map to be applied contains relative source
  35282. * paths. If so, those relative source paths need to be rewritten
  35283. * relative to the SourceMapGenerator.
  35284. */
  35285. SourceMapGenerator.prototype.applySourceMap =
  35286. function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
  35287. var sourceFile = aSourceFile;
  35288. // If aSourceFile is omitted, we will use the file property of the SourceMap
  35289. if (aSourceFile == null) {
  35290. if (aSourceMapConsumer.file == null) {
  35291. throw new Error(
  35292. 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +
  35293. 'or the source map\'s "file" property. Both were omitted.'
  35294. );
  35295. }
  35296. sourceFile = aSourceMapConsumer.file;
  35297. }
  35298. var sourceRoot = this._sourceRoot;
  35299. // Make "sourceFile" relative if an absolute Url is passed.
  35300. if (sourceRoot != null) {
  35301. sourceFile = util.relative(sourceRoot, sourceFile);
  35302. }
  35303. // Applying the SourceMap can add and remove items from the sources and
  35304. // the names array.
  35305. var newSources = new ArraySet();
  35306. var newNames = new ArraySet();
  35307. // Find mappings for the "sourceFile"
  35308. this._mappings.unsortedForEach(function (mapping) {
  35309. if (mapping.source === sourceFile && mapping.originalLine != null) {
  35310. // Check if it can be mapped by the source map, then update the mapping.
  35311. var original = aSourceMapConsumer.originalPositionFor({
  35312. line: mapping.originalLine,
  35313. column: mapping.originalColumn
  35314. });
  35315. if (original.source != null) {
  35316. // Copy mapping
  35317. mapping.source = original.source;
  35318. if (aSourceMapPath != null) {
  35319. mapping.source = util.join(aSourceMapPath, mapping.source)
  35320. }
  35321. if (sourceRoot != null) {
  35322. mapping.source = util.relative(sourceRoot, mapping.source);
  35323. }
  35324. mapping.originalLine = original.line;
  35325. mapping.originalColumn = original.column;
  35326. if (original.name != null) {
  35327. mapping.name = original.name;
  35328. }
  35329. }
  35330. }
  35331. var source = mapping.source;
  35332. if (source != null && !newSources.has(source)) {
  35333. newSources.add(source);
  35334. }
  35335. var name = mapping.name;
  35336. if (name != null && !newNames.has(name)) {
  35337. newNames.add(name);
  35338. }
  35339. }, this);
  35340. this._sources = newSources;
  35341. this._names = newNames;
  35342. // Copy sourcesContents of applied map.
  35343. aSourceMapConsumer.sources.forEach(function (sourceFile) {
  35344. var content = aSourceMapConsumer.sourceContentFor(sourceFile);
  35345. if (content != null) {
  35346. if (aSourceMapPath != null) {
  35347. sourceFile = util.join(aSourceMapPath, sourceFile);
  35348. }
  35349. if (sourceRoot != null) {
  35350. sourceFile = util.relative(sourceRoot, sourceFile);
  35351. }
  35352. this.setSourceContent(sourceFile, content);
  35353. }
  35354. }, this);
  35355. };
  35356. /**
  35357. * A mapping can have one of the three levels of data:
  35358. *
  35359. * 1. Just the generated position.
  35360. * 2. The Generated position, original position, and original source.
  35361. * 3. Generated and original position, original source, as well as a name
  35362. * token.
  35363. *
  35364. * To maintain consistency, we validate that any new mapping being added falls
  35365. * in to one of these categories.
  35366. */
  35367. SourceMapGenerator.prototype._validateMapping =
  35368. function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,
  35369. aName) {
  35370. if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
  35371. && aGenerated.line > 0 && aGenerated.column >= 0
  35372. && !aOriginal && !aSource && !aName) {
  35373. // Case 1.
  35374. return;
  35375. }
  35376. else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
  35377. && aOriginal && 'line' in aOriginal && 'column' in aOriginal
  35378. && aGenerated.line > 0 && aGenerated.column >= 0
  35379. && aOriginal.line > 0 && aOriginal.column >= 0
  35380. && aSource) {
  35381. // Cases 2 and 3.
  35382. return;
  35383. }
  35384. else {
  35385. throw new Error('Invalid mapping: ' + JSON.stringify({
  35386. generated: aGenerated,
  35387. source: aSource,
  35388. original: aOriginal,
  35389. name: aName
  35390. }));
  35391. }
  35392. };
  35393. /**
  35394. * Serialize the accumulated mappings in to the stream of base 64 VLQs
  35395. * specified by the source map format.
  35396. */
  35397. SourceMapGenerator.prototype._serializeMappings =
  35398. function SourceMapGenerator_serializeMappings() {
  35399. var previousGeneratedColumn = 0;
  35400. var previousGeneratedLine = 1;
  35401. var previousOriginalColumn = 0;
  35402. var previousOriginalLine = 0;
  35403. var previousName = 0;
  35404. var previousSource = 0;
  35405. var result = '';
  35406. var next;
  35407. var mapping;
  35408. var nameIdx;
  35409. var sourceIdx;
  35410. var mappings = this._mappings.toArray();
  35411. for (var i = 0, len = mappings.length; i < len; i++) {
  35412. mapping = mappings[i];
  35413. next = ''
  35414. if (mapping.generatedLine !== previousGeneratedLine) {
  35415. previousGeneratedColumn = 0;
  35416. while (mapping.generatedLine !== previousGeneratedLine) {
  35417. next += ';';
  35418. previousGeneratedLine++;
  35419. }
  35420. }
  35421. else {
  35422. if (i > 0) {
  35423. if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
  35424. continue;
  35425. }
  35426. next += ',';
  35427. }
  35428. }
  35429. next += base64VLQ.encode(mapping.generatedColumn
  35430. - previousGeneratedColumn);
  35431. previousGeneratedColumn = mapping.generatedColumn;
  35432. if (mapping.source != null) {
  35433. sourceIdx = this._sources.indexOf(mapping.source);
  35434. next += base64VLQ.encode(sourceIdx - previousSource);
  35435. previousSource = sourceIdx;
  35436. // lines are stored 0-based in SourceMap spec version 3
  35437. next += base64VLQ.encode(mapping.originalLine - 1
  35438. - previousOriginalLine);
  35439. previousOriginalLine = mapping.originalLine - 1;
  35440. next += base64VLQ.encode(mapping.originalColumn
  35441. - previousOriginalColumn);
  35442. previousOriginalColumn = mapping.originalColumn;
  35443. if (mapping.name != null) {
  35444. nameIdx = this._names.indexOf(mapping.name);
  35445. next += base64VLQ.encode(nameIdx - previousName);
  35446. previousName = nameIdx;
  35447. }
  35448. }
  35449. result += next;
  35450. }
  35451. return result;
  35452. };
  35453. SourceMapGenerator.prototype._generateSourcesContent =
  35454. function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
  35455. return aSources.map(function (source) {
  35456. if (!this._sourcesContents) {
  35457. return null;
  35458. }
  35459. if (aSourceRoot != null) {
  35460. source = util.relative(aSourceRoot, source);
  35461. }
  35462. var key = util.toSetString(source);
  35463. return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)
  35464. ? this._sourcesContents[key]
  35465. : null;
  35466. }, this);
  35467. };
  35468. /**
  35469. * Externalize the source map.
  35470. */
  35471. SourceMapGenerator.prototype.toJSON =
  35472. function SourceMapGenerator_toJSON() {
  35473. var map = {
  35474. version: this._version,
  35475. sources: this._sources.toArray(),
  35476. names: this._names.toArray(),
  35477. mappings: this._serializeMappings()
  35478. };
  35479. if (this._file != null) {
  35480. map.file = this._file;
  35481. }
  35482. if (this._sourceRoot != null) {
  35483. map.sourceRoot = this._sourceRoot;
  35484. }
  35485. if (this._sourcesContents) {
  35486. map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
  35487. }
  35488. return map;
  35489. };
  35490. /**
  35491. * Render the source map being generated to a string.
  35492. */
  35493. SourceMapGenerator.prototype.toString =
  35494. function SourceMapGenerator_toString() {
  35495. return JSON.stringify(this.toJSON());
  35496. };
  35497. exports.SourceMapGenerator = SourceMapGenerator;
  35498. },{"./array-set":474,"./base64-vlq":475,"./mapping-list":478,"./util":483}],482:[function(require,module,exports){
  35499. /* -*- Mode: js; js-indent-level: 2; -*- */
  35500. /*
  35501. * Copyright 2011 Mozilla Foundation and contributors
  35502. * Licensed under the New BSD license. See LICENSE or:
  35503. * http://opensource.org/licenses/BSD-3-Clause
  35504. */
  35505. var SourceMapGenerator = require('./source-map-generator').SourceMapGenerator;
  35506. var util = require('./util');
  35507. // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other
  35508. // operating systems these days (capturing the result).
  35509. var REGEX_NEWLINE = /(\r?\n)/;
  35510. // Newline character code for charCodeAt() comparisons
  35511. var NEWLINE_CODE = 10;
  35512. // Private symbol for identifying `SourceNode`s when multiple versions of
  35513. // the source-map library are loaded. This MUST NOT CHANGE across
  35514. // versions!
  35515. var isSourceNode = "$$$isSourceNode$$$";
  35516. /**
  35517. * SourceNodes provide a way to abstract over interpolating/concatenating
  35518. * snippets of generated JavaScript source code while maintaining the line and
  35519. * column information associated with the original source code.
  35520. *
  35521. * @param aLine The original line number.
  35522. * @param aColumn The original column number.
  35523. * @param aSource The original source's filename.
  35524. * @param aChunks Optional. An array of strings which are snippets of
  35525. * generated JS, or other SourceNodes.
  35526. * @param aName The original identifier.
  35527. */
  35528. function SourceNode(aLine, aColumn, aSource, aChunks, aName) {
  35529. this.children = [];
  35530. this.sourceContents = {};
  35531. this.line = aLine == null ? null : aLine;
  35532. this.column = aColumn == null ? null : aColumn;
  35533. this.source = aSource == null ? null : aSource;
  35534. this.name = aName == null ? null : aName;
  35535. this[isSourceNode] = true;
  35536. if (aChunks != null) this.add(aChunks);
  35537. }
  35538. /**
  35539. * Creates a SourceNode from generated code and a SourceMapConsumer.
  35540. *
  35541. * @param aGeneratedCode The generated code
  35542. * @param aSourceMapConsumer The SourceMap for the generated code
  35543. * @param aRelativePath Optional. The path that relative sources in the
  35544. * SourceMapConsumer should be relative to.
  35545. */
  35546. SourceNode.fromStringWithSourceMap =
  35547. function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {
  35548. // The SourceNode we want to fill with the generated code
  35549. // and the SourceMap
  35550. var node = new SourceNode();
  35551. // All even indices of this array are one line of the generated code,
  35552. // while all odd indices are the newlines between two adjacent lines
  35553. // (since `REGEX_NEWLINE` captures its match).
  35554. // Processed fragments are removed from this array, by calling `shiftNextLine`.
  35555. var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
  35556. var shiftNextLine = function() {
  35557. var lineContents = remainingLines.shift();
  35558. // The last line of a file might not have a newline.
  35559. var newLine = remainingLines.shift() || "";
  35560. return lineContents + newLine;
  35561. };
  35562. // We need to remember the position of "remainingLines"
  35563. var lastGeneratedLine = 1, lastGeneratedColumn = 0;
  35564. // The generate SourceNodes we need a code range.
  35565. // To extract it current and last mapping is used.
  35566. // Here we store the last mapping.
  35567. var lastMapping = null;
  35568. aSourceMapConsumer.eachMapping(function (mapping) {
  35569. if (lastMapping !== null) {
  35570. // We add the code from "lastMapping" to "mapping":
  35571. // First check if there is a new line in between.
  35572. if (lastGeneratedLine < mapping.generatedLine) {
  35573. // Associate first line with "lastMapping"
  35574. addMappingWithCode(lastMapping, shiftNextLine());
  35575. lastGeneratedLine++;
  35576. lastGeneratedColumn = 0;
  35577. // The remaining code is added without mapping
  35578. } else {
  35579. // There is no new line in between.
  35580. // Associate the code between "lastGeneratedColumn" and
  35581. // "mapping.generatedColumn" with "lastMapping"
  35582. var nextLine = remainingLines[0];
  35583. var code = nextLine.substr(0, mapping.generatedColumn -
  35584. lastGeneratedColumn);
  35585. remainingLines[0] = nextLine.substr(mapping.generatedColumn -
  35586. lastGeneratedColumn);
  35587. lastGeneratedColumn = mapping.generatedColumn;
  35588. addMappingWithCode(lastMapping, code);
  35589. // No more remaining code, continue
  35590. lastMapping = mapping;
  35591. return;
  35592. }
  35593. }
  35594. // We add the generated code until the first mapping
  35595. // to the SourceNode without any mapping.
  35596. // Each line is added as separate string.
  35597. while (lastGeneratedLine < mapping.generatedLine) {
  35598. node.add(shiftNextLine());
  35599. lastGeneratedLine++;
  35600. }
  35601. if (lastGeneratedColumn < mapping.generatedColumn) {
  35602. var nextLine = remainingLines[0];
  35603. node.add(nextLine.substr(0, mapping.generatedColumn));
  35604. remainingLines[0] = nextLine.substr(mapping.generatedColumn);
  35605. lastGeneratedColumn = mapping.generatedColumn;
  35606. }
  35607. lastMapping = mapping;
  35608. }, this);
  35609. // We have processed all mappings.
  35610. if (remainingLines.length > 0) {
  35611. if (lastMapping) {
  35612. // Associate the remaining code in the current line with "lastMapping"
  35613. addMappingWithCode(lastMapping, shiftNextLine());
  35614. }
  35615. // and add the remaining lines without any mapping
  35616. node.add(remainingLines.join(""));
  35617. }
  35618. // Copy sourcesContent into SourceNode
  35619. aSourceMapConsumer.sources.forEach(function (sourceFile) {
  35620. var content = aSourceMapConsumer.sourceContentFor(sourceFile);
  35621. if (content != null) {
  35622. if (aRelativePath != null) {
  35623. sourceFile = util.join(aRelativePath, sourceFile);
  35624. }
  35625. node.setSourceContent(sourceFile, content);
  35626. }
  35627. });
  35628. return node;
  35629. function addMappingWithCode(mapping, code) {
  35630. if (mapping === null || mapping.source === undefined) {
  35631. node.add(code);
  35632. } else {
  35633. var source = aRelativePath
  35634. ? util.join(aRelativePath, mapping.source)
  35635. : mapping.source;
  35636. node.add(new SourceNode(mapping.originalLine,
  35637. mapping.originalColumn,
  35638. source,
  35639. code,
  35640. mapping.name));
  35641. }
  35642. }
  35643. };
  35644. /**
  35645. * Add a chunk of generated JS to this source node.
  35646. *
  35647. * @param aChunk A string snippet of generated JS code, another instance of
  35648. * SourceNode, or an array where each member is one of those things.
  35649. */
  35650. SourceNode.prototype.add = function SourceNode_add(aChunk) {
  35651. if (Array.isArray(aChunk)) {
  35652. aChunk.forEach(function (chunk) {
  35653. this.add(chunk);
  35654. }, this);
  35655. }
  35656. else if (aChunk[isSourceNode] || typeof aChunk === "string") {
  35657. if (aChunk) {
  35658. this.children.push(aChunk);
  35659. }
  35660. }
  35661. else {
  35662. throw new TypeError(
  35663. "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
  35664. );
  35665. }
  35666. return this;
  35667. };
  35668. /**
  35669. * Add a chunk of generated JS to the beginning of this source node.
  35670. *
  35671. * @param aChunk A string snippet of generated JS code, another instance of
  35672. * SourceNode, or an array where each member is one of those things.
  35673. */
  35674. SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {
  35675. if (Array.isArray(aChunk)) {
  35676. for (var i = aChunk.length-1; i >= 0; i--) {
  35677. this.prepend(aChunk[i]);
  35678. }
  35679. }
  35680. else if (aChunk[isSourceNode] || typeof aChunk === "string") {
  35681. this.children.unshift(aChunk);
  35682. }
  35683. else {
  35684. throw new TypeError(
  35685. "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
  35686. );
  35687. }
  35688. return this;
  35689. };
  35690. /**
  35691. * Walk over the tree of JS snippets in this node and its children. The
  35692. * walking function is called once for each snippet of JS and is passed that
  35693. * snippet and the its original associated source's line/column location.
  35694. *
  35695. * @param aFn The traversal function.
  35696. */
  35697. SourceNode.prototype.walk = function SourceNode_walk(aFn) {
  35698. var chunk;
  35699. for (var i = 0, len = this.children.length; i < len; i++) {
  35700. chunk = this.children[i];
  35701. if (chunk[isSourceNode]) {
  35702. chunk.walk(aFn);
  35703. }
  35704. else {
  35705. if (chunk !== '') {
  35706. aFn(chunk, { source: this.source,
  35707. line: this.line,
  35708. column: this.column,
  35709. name: this.name });
  35710. }
  35711. }
  35712. }
  35713. };
  35714. /**
  35715. * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between
  35716. * each of `this.children`.
  35717. *
  35718. * @param aSep The separator.
  35719. */
  35720. SourceNode.prototype.join = function SourceNode_join(aSep) {
  35721. var newChildren;
  35722. var i;
  35723. var len = this.children.length;
  35724. if (len > 0) {
  35725. newChildren = [];
  35726. for (i = 0; i < len-1; i++) {
  35727. newChildren.push(this.children[i]);
  35728. newChildren.push(aSep);
  35729. }
  35730. newChildren.push(this.children[i]);
  35731. this.children = newChildren;
  35732. }
  35733. return this;
  35734. };
  35735. /**
  35736. * Call String.prototype.replace on the very right-most source snippet. Useful
  35737. * for trimming whitespace from the end of a source node, etc.
  35738. *
  35739. * @param aPattern The pattern to replace.
  35740. * @param aReplacement The thing to replace the pattern with.
  35741. */
  35742. SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {
  35743. var lastChild = this.children[this.children.length - 1];
  35744. if (lastChild[isSourceNode]) {
  35745. lastChild.replaceRight(aPattern, aReplacement);
  35746. }
  35747. else if (typeof lastChild === 'string') {
  35748. this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
  35749. }
  35750. else {
  35751. this.children.push(''.replace(aPattern, aReplacement));
  35752. }
  35753. return this;
  35754. };
  35755. /**
  35756. * Set the source content for a source file. This will be added to the SourceMapGenerator
  35757. * in the sourcesContent field.
  35758. *
  35759. * @param aSourceFile The filename of the source file
  35760. * @param aSourceContent The content of the source file
  35761. */
  35762. SourceNode.prototype.setSourceContent =
  35763. function SourceNode_setSourceContent(aSourceFile, aSourceContent) {
  35764. this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
  35765. };
  35766. /**
  35767. * Walk over the tree of SourceNodes. The walking function is called for each
  35768. * source file content and is passed the filename and source content.
  35769. *
  35770. * @param aFn The traversal function.
  35771. */
  35772. SourceNode.prototype.walkSourceContents =
  35773. function SourceNode_walkSourceContents(aFn) {
  35774. for (var i = 0, len = this.children.length; i < len; i++) {
  35775. if (this.children[i][isSourceNode]) {
  35776. this.children[i].walkSourceContents(aFn);
  35777. }
  35778. }
  35779. var sources = Object.keys(this.sourceContents);
  35780. for (var i = 0, len = sources.length; i < len; i++) {
  35781. aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
  35782. }
  35783. };
  35784. /**
  35785. * Return the string representation of this source node. Walks over the tree
  35786. * and concatenates all the various snippets together to one string.
  35787. */
  35788. SourceNode.prototype.toString = function SourceNode_toString() {
  35789. var str = "";
  35790. this.walk(function (chunk) {
  35791. str += chunk;
  35792. });
  35793. return str;
  35794. };
  35795. /**
  35796. * Returns the string representation of this source node along with a source
  35797. * map.
  35798. */
  35799. SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
  35800. var generated = {
  35801. code: "",
  35802. line: 1,
  35803. column: 0
  35804. };
  35805. var map = new SourceMapGenerator(aArgs);
  35806. var sourceMappingActive = false;
  35807. var lastOriginalSource = null;
  35808. var lastOriginalLine = null;
  35809. var lastOriginalColumn = null;
  35810. var lastOriginalName = null;
  35811. this.walk(function (chunk, original) {
  35812. generated.code += chunk;
  35813. if (original.source !== null
  35814. && original.line !== null
  35815. && original.column !== null) {
  35816. if(lastOriginalSource !== original.source
  35817. || lastOriginalLine !== original.line
  35818. || lastOriginalColumn !== original.column
  35819. || lastOriginalName !== original.name) {
  35820. map.addMapping({
  35821. source: original.source,
  35822. original: {
  35823. line: original.line,
  35824. column: original.column
  35825. },
  35826. generated: {
  35827. line: generated.line,
  35828. column: generated.column
  35829. },
  35830. name: original.name
  35831. });
  35832. }
  35833. lastOriginalSource = original.source;
  35834. lastOriginalLine = original.line;
  35835. lastOriginalColumn = original.column;
  35836. lastOriginalName = original.name;
  35837. sourceMappingActive = true;
  35838. } else if (sourceMappingActive) {
  35839. map.addMapping({
  35840. generated: {
  35841. line: generated.line,
  35842. column: generated.column
  35843. }
  35844. });
  35845. lastOriginalSource = null;
  35846. sourceMappingActive = false;
  35847. }
  35848. for (var idx = 0, length = chunk.length; idx < length; idx++) {
  35849. if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
  35850. generated.line++;
  35851. generated.column = 0;
  35852. // Mappings end at eol
  35853. if (idx + 1 === length) {
  35854. lastOriginalSource = null;
  35855. sourceMappingActive = false;
  35856. } else if (sourceMappingActive) {
  35857. map.addMapping({
  35858. source: original.source,
  35859. original: {
  35860. line: original.line,
  35861. column: original.column
  35862. },
  35863. generated: {
  35864. line: generated.line,
  35865. column: generated.column
  35866. },
  35867. name: original.name
  35868. });
  35869. }
  35870. } else {
  35871. generated.column++;
  35872. }
  35873. }
  35874. });
  35875. this.walkSourceContents(function (sourceFile, sourceContent) {
  35876. map.setSourceContent(sourceFile, sourceContent);
  35877. });
  35878. return { code: generated.code, map: map };
  35879. };
  35880. exports.SourceNode = SourceNode;
  35881. },{"./source-map-generator":481,"./util":483}],483:[function(require,module,exports){
  35882. /* -*- Mode: js; js-indent-level: 2; -*- */
  35883. /*
  35884. * Copyright 2011 Mozilla Foundation and contributors
  35885. * Licensed under the New BSD license. See LICENSE or:
  35886. * http://opensource.org/licenses/BSD-3-Clause
  35887. */
  35888. /**
  35889. * This is a helper function for getting values from parameter/options
  35890. * objects.
  35891. *
  35892. * @param args The object we are extracting values from
  35893. * @param name The name of the property we are getting.
  35894. * @param defaultValue An optional value to return if the property is missing
  35895. * from the object. If this is not specified and the property is missing, an
  35896. * error will be thrown.
  35897. */
  35898. function getArg(aArgs, aName, aDefaultValue) {
  35899. if (aName in aArgs) {
  35900. return aArgs[aName];
  35901. } else if (arguments.length === 3) {
  35902. return aDefaultValue;
  35903. } else {
  35904. throw new Error('"' + aName + '" is a required argument.');
  35905. }
  35906. }
  35907. exports.getArg = getArg;
  35908. var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/;
  35909. var dataUrlRegexp = /^data:.+\,.+$/;
  35910. function urlParse(aUrl) {
  35911. var match = aUrl.match(urlRegexp);
  35912. if (!match) {
  35913. return null;
  35914. }
  35915. return {
  35916. scheme: match[1],
  35917. auth: match[2],
  35918. host: match[3],
  35919. port: match[4],
  35920. path: match[5]
  35921. };
  35922. }
  35923. exports.urlParse = urlParse;
  35924. function urlGenerate(aParsedUrl) {
  35925. var url = '';
  35926. if (aParsedUrl.scheme) {
  35927. url += aParsedUrl.scheme + ':';
  35928. }
  35929. url += '//';
  35930. if (aParsedUrl.auth) {
  35931. url += aParsedUrl.auth + '@';
  35932. }
  35933. if (aParsedUrl.host) {
  35934. url += aParsedUrl.host;
  35935. }
  35936. if (aParsedUrl.port) {
  35937. url += ":" + aParsedUrl.port
  35938. }
  35939. if (aParsedUrl.path) {
  35940. url += aParsedUrl.path;
  35941. }
  35942. return url;
  35943. }
  35944. exports.urlGenerate = urlGenerate;
  35945. /**
  35946. * Normalizes a path, or the path portion of a URL:
  35947. *
  35948. * - Replaces consecutive slashes with one slash.
  35949. * - Removes unnecessary '.' parts.
  35950. * - Removes unnecessary '<dir>/..' parts.
  35951. *
  35952. * Based on code in the Node.js 'path' core module.
  35953. *
  35954. * @param aPath The path or url to normalize.
  35955. */
  35956. function normalize(aPath) {
  35957. var path = aPath;
  35958. var url = urlParse(aPath);
  35959. if (url) {
  35960. if (!url.path) {
  35961. return aPath;
  35962. }
  35963. path = url.path;
  35964. }
  35965. var isAbsolute = exports.isAbsolute(path);
  35966. var parts = path.split(/\/+/);
  35967. for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
  35968. part = parts[i];
  35969. if (part === '.') {
  35970. parts.splice(i, 1);
  35971. } else if (part === '..') {
  35972. up++;
  35973. } else if (up > 0) {
  35974. if (part === '') {
  35975. // The first part is blank if the path is absolute. Trying to go
  35976. // above the root is a no-op. Therefore we can remove all '..' parts
  35977. // directly after the root.
  35978. parts.splice(i + 1, up);
  35979. up = 0;
  35980. } else {
  35981. parts.splice(i, 2);
  35982. up--;
  35983. }
  35984. }
  35985. }
  35986. path = parts.join('/');
  35987. if (path === '') {
  35988. path = isAbsolute ? '/' : '.';
  35989. }
  35990. if (url) {
  35991. url.path = path;
  35992. return urlGenerate(url);
  35993. }
  35994. return path;
  35995. }
  35996. exports.normalize = normalize;
  35997. /**
  35998. * Joins two paths/URLs.
  35999. *
  36000. * @param aRoot The root path or URL.
  36001. * @param aPath The path or URL to be joined with the root.
  36002. *
  36003. * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
  36004. * scheme-relative URL: Then the scheme of aRoot, if any, is prepended
  36005. * first.
  36006. * - Otherwise aPath is a path. If aRoot is a URL, then its path portion
  36007. * is updated with the result and aRoot is returned. Otherwise the result
  36008. * is returned.
  36009. * - If aPath is absolute, the result is aPath.
  36010. * - Otherwise the two paths are joined with a slash.
  36011. * - Joining for example 'http://' and 'www.example.com' is also supported.
  36012. */
  36013. function join(aRoot, aPath) {
  36014. if (aRoot === "") {
  36015. aRoot = ".";
  36016. }
  36017. if (aPath === "") {
  36018. aPath = ".";
  36019. }
  36020. var aPathUrl = urlParse(aPath);
  36021. var aRootUrl = urlParse(aRoot);
  36022. if (aRootUrl) {
  36023. aRoot = aRootUrl.path || '/';
  36024. }
  36025. // `join(foo, '//www.example.org')`
  36026. if (aPathUrl && !aPathUrl.scheme) {
  36027. if (aRootUrl) {
  36028. aPathUrl.scheme = aRootUrl.scheme;
  36029. }
  36030. return urlGenerate(aPathUrl);
  36031. }
  36032. if (aPathUrl || aPath.match(dataUrlRegexp)) {
  36033. return aPath;
  36034. }
  36035. // `join('http://', 'www.example.com')`
  36036. if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
  36037. aRootUrl.host = aPath;
  36038. return urlGenerate(aRootUrl);
  36039. }
  36040. var joined = aPath.charAt(0) === '/'
  36041. ? aPath
  36042. : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
  36043. if (aRootUrl) {
  36044. aRootUrl.path = joined;
  36045. return urlGenerate(aRootUrl);
  36046. }
  36047. return joined;
  36048. }
  36049. exports.join = join;
  36050. exports.isAbsolute = function (aPath) {
  36051. return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp);
  36052. };
  36053. /**
  36054. * Make a path relative to a URL or another path.
  36055. *
  36056. * @param aRoot The root path or URL.
  36057. * @param aPath The path or URL to be made relative to aRoot.
  36058. */
  36059. function relative(aRoot, aPath) {
  36060. if (aRoot === "") {
  36061. aRoot = ".";
  36062. }
  36063. aRoot = aRoot.replace(/\/$/, '');
  36064. // It is possible for the path to be above the root. In this case, simply
  36065. // checking whether the root is a prefix of the path won't work. Instead, we
  36066. // need to remove components from the root one by one, until either we find
  36067. // a prefix that fits, or we run out of components to remove.
  36068. var level = 0;
  36069. while (aPath.indexOf(aRoot + '/') !== 0) {
  36070. var index = aRoot.lastIndexOf("/");
  36071. if (index < 0) {
  36072. return aPath;
  36073. }
  36074. // If the only part of the root that is left is the scheme (i.e. http://,
  36075. // file:///, etc.), one or more slashes (/), or simply nothing at all, we
  36076. // have exhausted all components, so the path is not relative to the root.
  36077. aRoot = aRoot.slice(0, index);
  36078. if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
  36079. return aPath;
  36080. }
  36081. ++level;
  36082. }
  36083. // Make sure we add a "../" for each component we removed from the root.
  36084. return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
  36085. }
  36086. exports.relative = relative;
  36087. var supportsNullProto = (function () {
  36088. var obj = Object.create(null);
  36089. return !('__proto__' in obj);
  36090. }());
  36091. function identity (s) {
  36092. return s;
  36093. }
  36094. /**
  36095. * Because behavior goes wacky when you set `__proto__` on objects, we
  36096. * have to prefix all the strings in our set with an arbitrary character.
  36097. *
  36098. * See https://github.com/mozilla/source-map/pull/31 and
  36099. * https://github.com/mozilla/source-map/issues/30
  36100. *
  36101. * @param String aStr
  36102. */
  36103. function toSetString(aStr) {
  36104. if (isProtoString(aStr)) {
  36105. return '$' + aStr;
  36106. }
  36107. return aStr;
  36108. }
  36109. exports.toSetString = supportsNullProto ? identity : toSetString;
  36110. function fromSetString(aStr) {
  36111. if (isProtoString(aStr)) {
  36112. return aStr.slice(1);
  36113. }
  36114. return aStr;
  36115. }
  36116. exports.fromSetString = supportsNullProto ? identity : fromSetString;
  36117. function isProtoString(s) {
  36118. if (!s) {
  36119. return false;
  36120. }
  36121. var length = s.length;
  36122. if (length < 9 /* "__proto__".length */) {
  36123. return false;
  36124. }
  36125. if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||
  36126. s.charCodeAt(length - 2) !== 95 /* '_' */ ||
  36127. s.charCodeAt(length - 3) !== 111 /* 'o' */ ||
  36128. s.charCodeAt(length - 4) !== 116 /* 't' */ ||
  36129. s.charCodeAt(length - 5) !== 111 /* 'o' */ ||
  36130. s.charCodeAt(length - 6) !== 114 /* 'r' */ ||
  36131. s.charCodeAt(length - 7) !== 112 /* 'p' */ ||
  36132. s.charCodeAt(length - 8) !== 95 /* '_' */ ||
  36133. s.charCodeAt(length - 9) !== 95 /* '_' */) {
  36134. return false;
  36135. }
  36136. for (var i = length - 10; i >= 0; i--) {
  36137. if (s.charCodeAt(i) !== 36 /* '$' */) {
  36138. return false;
  36139. }
  36140. }
  36141. return true;
  36142. }
  36143. /**
  36144. * Comparator between two mappings where the original positions are compared.
  36145. *
  36146. * Optionally pass in `true` as `onlyCompareGenerated` to consider two
  36147. * mappings with the same original source/line/column, but different generated
  36148. * line and column the same. Useful when searching for a mapping with a
  36149. * stubbed out mapping.
  36150. */
  36151. function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
  36152. var cmp = mappingA.source - mappingB.source;
  36153. if (cmp !== 0) {
  36154. return cmp;
  36155. }
  36156. cmp = mappingA.originalLine - mappingB.originalLine;
  36157. if (cmp !== 0) {
  36158. return cmp;
  36159. }
  36160. cmp = mappingA.originalColumn - mappingB.originalColumn;
  36161. if (cmp !== 0 || onlyCompareOriginal) {
  36162. return cmp;
  36163. }
  36164. cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  36165. if (cmp !== 0) {
  36166. return cmp;
  36167. }
  36168. cmp = mappingA.generatedLine - mappingB.generatedLine;
  36169. if (cmp !== 0) {
  36170. return cmp;
  36171. }
  36172. return mappingA.name - mappingB.name;
  36173. }
  36174. exports.compareByOriginalPositions = compareByOriginalPositions;
  36175. /**
  36176. * Comparator between two mappings with deflated source and name indices where
  36177. * the generated positions are compared.
  36178. *
  36179. * Optionally pass in `true` as `onlyCompareGenerated` to consider two
  36180. * mappings with the same generated line and column, but different
  36181. * source/name/original line and column the same. Useful when searching for a
  36182. * mapping with a stubbed out mapping.
  36183. */
  36184. function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
  36185. var cmp = mappingA.generatedLine - mappingB.generatedLine;
  36186. if (cmp !== 0) {
  36187. return cmp;
  36188. }
  36189. cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  36190. if (cmp !== 0 || onlyCompareGenerated) {
  36191. return cmp;
  36192. }
  36193. cmp = mappingA.source - mappingB.source;
  36194. if (cmp !== 0) {
  36195. return cmp;
  36196. }
  36197. cmp = mappingA.originalLine - mappingB.originalLine;
  36198. if (cmp !== 0) {
  36199. return cmp;
  36200. }
  36201. cmp = mappingA.originalColumn - mappingB.originalColumn;
  36202. if (cmp !== 0) {
  36203. return cmp;
  36204. }
  36205. return mappingA.name - mappingB.name;
  36206. }
  36207. exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
  36208. function strcmp(aStr1, aStr2) {
  36209. if (aStr1 === aStr2) {
  36210. return 0;
  36211. }
  36212. if (aStr1 > aStr2) {
  36213. return 1;
  36214. }
  36215. return -1;
  36216. }
  36217. /**
  36218. * Comparator between two mappings with inflated source and name strings where
  36219. * the generated positions are compared.
  36220. */
  36221. function compareByGeneratedPositionsInflated(mappingA, mappingB) {
  36222. var cmp = mappingA.generatedLine - mappingB.generatedLine;
  36223. if (cmp !== 0) {
  36224. return cmp;
  36225. }
  36226. cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  36227. if (cmp !== 0) {
  36228. return cmp;
  36229. }
  36230. cmp = strcmp(mappingA.source, mappingB.source);
  36231. if (cmp !== 0) {
  36232. return cmp;
  36233. }
  36234. cmp = mappingA.originalLine - mappingB.originalLine;
  36235. if (cmp !== 0) {
  36236. return cmp;
  36237. }
  36238. cmp = mappingA.originalColumn - mappingB.originalColumn;
  36239. if (cmp !== 0) {
  36240. return cmp;
  36241. }
  36242. return strcmp(mappingA.name, mappingB.name);
  36243. }
  36244. exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
  36245. },{}],484:[function(require,module,exports){
  36246. /*
  36247. * Copyright 2009-2011 Mozilla Foundation and contributors
  36248. * Licensed under the New BSD license. See LICENSE.txt or:
  36249. * http://opensource.org/licenses/BSD-3-Clause
  36250. */
  36251. exports.SourceMapGenerator = require('./lib/source-map-generator').SourceMapGenerator;
  36252. exports.SourceMapConsumer = require('./lib/source-map-consumer').SourceMapConsumer;
  36253. exports.SourceNode = require('./lib/source-node').SourceNode;
  36254. },{"./lib/source-map-consumer":480,"./lib/source-map-generator":481,"./lib/source-node":482}],485:[function(require,module,exports){
  36255. 'use strict';
  36256. var ansiRegex = require('ansi-regex')();
  36257. module.exports = function (str) {
  36258. return typeof str === 'string' ? str.replace(ansiRegex, '') : str;
  36259. };
  36260. },{"ansi-regex":1}],486:[function(require,module,exports){
  36261. (function (process){
  36262. 'use strict';
  36263. var argv = process.argv;
  36264. var terminator = argv.indexOf('--');
  36265. var hasFlag = function (flag) {
  36266. flag = '--' + flag;
  36267. var pos = argv.indexOf(flag);
  36268. return pos !== -1 && (terminator !== -1 ? pos < terminator : true);
  36269. };
  36270. module.exports = (function () {
  36271. if ('FORCE_COLOR' in process.env) {
  36272. return true;
  36273. }
  36274. if (hasFlag('no-color') ||
  36275. hasFlag('no-colors') ||
  36276. hasFlag('color=false')) {
  36277. return false;
  36278. }
  36279. if (hasFlag('color') ||
  36280. hasFlag('colors') ||
  36281. hasFlag('color=true') ||
  36282. hasFlag('color=always')) {
  36283. return true;
  36284. }
  36285. if (process.stdout && !process.stdout.isTTY) {
  36286. return false;
  36287. }
  36288. if (process.platform === 'win32') {
  36289. return true;
  36290. }
  36291. if ('COLORTERM' in process.env) {
  36292. return true;
  36293. }
  36294. if (process.env.TERM === 'dumb') {
  36295. return false;
  36296. }
  36297. if (/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(process.env.TERM)) {
  36298. return true;
  36299. }
  36300. return false;
  36301. })();
  36302. }).call(this,require('_process'))
  36303. },{"_process":471}],487:[function(require,module,exports){
  36304. 'use strict';
  36305. module.exports = function toFastProperties(obj) {
  36306. function f() {}
  36307. f.prototype = obj;
  36308. new f();
  36309. return;
  36310. eval(obj);
  36311. };
  36312. },{}],488:[function(require,module,exports){
  36313. 'use strict';
  36314. module.exports = function (str) {
  36315. var tail = str.length;
  36316. while (/[\s\uFEFF\u00A0]/.test(str[tail - 1])) {
  36317. tail--;
  36318. }
  36319. return str.slice(0, tail);
  36320. };
  36321. },{}],489:[function(require,module,exports){
  36322. exports.isatty = function () { return false; };
  36323. function ReadStream() {
  36324. throw new Error('tty.ReadStream is not implemented');
  36325. }
  36326. exports.ReadStream = ReadStream;
  36327. function WriteStream() {
  36328. throw new Error('tty.ReadStream is not implemented');
  36329. }
  36330. exports.WriteStream = WriteStream;
  36331. },{}],490:[function(require,module,exports){
  36332. if (typeof Object.create === 'function') {
  36333. // implementation from standard node.js 'util' module
  36334. module.exports = function inherits(ctor, superCtor) {
  36335. ctor.super_ = superCtor
  36336. ctor.prototype = Object.create(superCtor.prototype, {
  36337. constructor: {
  36338. value: ctor,
  36339. enumerable: false,
  36340. writable: true,
  36341. configurable: true
  36342. }
  36343. });
  36344. };
  36345. } else {
  36346. // old school shim for old browsers
  36347. module.exports = function inherits(ctor, superCtor) {
  36348. ctor.super_ = superCtor
  36349. var TempCtor = function () {}
  36350. TempCtor.prototype = superCtor.prototype
  36351. ctor.prototype = new TempCtor()
  36352. ctor.prototype.constructor = ctor
  36353. }
  36354. }
  36355. },{}],491:[function(require,module,exports){
  36356. module.exports = function isBuffer(arg) {
  36357. return arg && typeof arg === 'object'
  36358. && typeof arg.copy === 'function'
  36359. && typeof arg.fill === 'function'
  36360. && typeof arg.readUInt8 === 'function';
  36361. }
  36362. },{}],492:[function(require,module,exports){
  36363. (function (process,global){
  36364. // Copyright Joyent, Inc. and other Node contributors.
  36365. //
  36366. // Permission is hereby granted, free of charge, to any person obtaining a
  36367. // copy of this software and associated documentation files (the
  36368. // "Software"), to deal in the Software without restriction, including
  36369. // without limitation the rights to use, copy, modify, merge, publish,
  36370. // distribute, sublicense, and/or sell copies of the Software, and to permit
  36371. // persons to whom the Software is furnished to do so, subject to the
  36372. // following conditions:
  36373. //
  36374. // The above copyright notice and this permission notice shall be included
  36375. // in all copies or substantial portions of the Software.
  36376. //
  36377. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  36378. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  36379. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  36380. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  36381. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  36382. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  36383. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  36384. var formatRegExp = /%[sdj%]/g;
  36385. exports.format = function(f) {
  36386. if (!isString(f)) {
  36387. var objects = [];
  36388. for (var i = 0; i < arguments.length; i++) {
  36389. objects.push(inspect(arguments[i]));
  36390. }
  36391. return objects.join(' ');
  36392. }
  36393. var i = 1;
  36394. var args = arguments;
  36395. var len = args.length;
  36396. var str = String(f).replace(formatRegExp, function(x) {
  36397. if (x === '%%') return '%';
  36398. if (i >= len) return x;
  36399. switch (x) {
  36400. case '%s': return String(args[i++]);
  36401. case '%d': return Number(args[i++]);
  36402. case '%j':
  36403. try {
  36404. return JSON.stringify(args[i++]);
  36405. } catch (_) {
  36406. return '[Circular]';
  36407. }
  36408. default:
  36409. return x;
  36410. }
  36411. });
  36412. for (var x = args[i]; i < len; x = args[++i]) {
  36413. if (isNull(x) || !isObject(x)) {
  36414. str += ' ' + x;
  36415. } else {
  36416. str += ' ' + inspect(x);
  36417. }
  36418. }
  36419. return str;
  36420. };
  36421. // Mark that a method should not be used.
  36422. // Returns a modified function which warns once by default.
  36423. // If --no-deprecation is set, then it is a no-op.
  36424. exports.deprecate = function(fn, msg) {
  36425. // Allow for deprecating things in the process of starting up.
  36426. if (isUndefined(global.process)) {
  36427. return function() {
  36428. return exports.deprecate(fn, msg).apply(this, arguments);
  36429. };
  36430. }
  36431. if (process.noDeprecation === true) {
  36432. return fn;
  36433. }
  36434. var warned = false;
  36435. function deprecated() {
  36436. if (!warned) {
  36437. if (process.throwDeprecation) {
  36438. throw new Error(msg);
  36439. } else if (process.traceDeprecation) {
  36440. console.trace(msg);
  36441. } else {
  36442. console.error(msg);
  36443. }
  36444. warned = true;
  36445. }
  36446. return fn.apply(this, arguments);
  36447. }
  36448. return deprecated;
  36449. };
  36450. var debugs = {};
  36451. var debugEnviron;
  36452. exports.debuglog = function(set) {
  36453. if (isUndefined(debugEnviron))
  36454. debugEnviron = process.env.NODE_DEBUG || '';
  36455. set = set.toUpperCase();
  36456. if (!debugs[set]) {
  36457. if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
  36458. var pid = process.pid;
  36459. debugs[set] = function() {
  36460. var msg = exports.format.apply(exports, arguments);
  36461. console.error('%s %d: %s', set, pid, msg);
  36462. };
  36463. } else {
  36464. debugs[set] = function() {};
  36465. }
  36466. }
  36467. return debugs[set];
  36468. };
  36469. /**
  36470. * Echos the value of a value. Trys to print the value out
  36471. * in the best way possible given the different types.
  36472. *
  36473. * @param {Object} obj The object to print out.
  36474. * @param {Object} opts Optional options object that alters the output.
  36475. */
  36476. /* legacy: obj, showHidden, depth, colors*/
  36477. function inspect(obj, opts) {
  36478. // default options
  36479. var ctx = {
  36480. seen: [],
  36481. stylize: stylizeNoColor
  36482. };
  36483. // legacy...
  36484. if (arguments.length >= 3) ctx.depth = arguments[2];
  36485. if (arguments.length >= 4) ctx.colors = arguments[3];
  36486. if (isBoolean(opts)) {
  36487. // legacy...
  36488. ctx.showHidden = opts;
  36489. } else if (opts) {
  36490. // got an "options" object
  36491. exports._extend(ctx, opts);
  36492. }
  36493. // set default options
  36494. if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
  36495. if (isUndefined(ctx.depth)) ctx.depth = 2;
  36496. if (isUndefined(ctx.colors)) ctx.colors = false;
  36497. if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
  36498. if (ctx.colors) ctx.stylize = stylizeWithColor;
  36499. return formatValue(ctx, obj, ctx.depth);
  36500. }
  36501. exports.inspect = inspect;
  36502. // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
  36503. inspect.colors = {
  36504. 'bold' : [1, 22],
  36505. 'italic' : [3, 23],
  36506. 'underline' : [4, 24],
  36507. 'inverse' : [7, 27],
  36508. 'white' : [37, 39],
  36509. 'grey' : [90, 39],
  36510. 'black' : [30, 39],
  36511. 'blue' : [34, 39],
  36512. 'cyan' : [36, 39],
  36513. 'green' : [32, 39],
  36514. 'magenta' : [35, 39],
  36515. 'red' : [31, 39],
  36516. 'yellow' : [33, 39]
  36517. };
  36518. // Don't use 'blue' not visible on cmd.exe
  36519. inspect.styles = {
  36520. 'special': 'cyan',
  36521. 'number': 'yellow',
  36522. 'boolean': 'yellow',
  36523. 'undefined': 'grey',
  36524. 'null': 'bold',
  36525. 'string': 'green',
  36526. 'date': 'magenta',
  36527. // "name": intentionally not styling
  36528. 'regexp': 'red'
  36529. };
  36530. function stylizeWithColor(str, styleType) {
  36531. var style = inspect.styles[styleType];
  36532. if (style) {
  36533. return '\u001b[' + inspect.colors[style][0] + 'm' + str +
  36534. '\u001b[' + inspect.colors[style][1] + 'm';
  36535. } else {
  36536. return str;
  36537. }
  36538. }
  36539. function stylizeNoColor(str, styleType) {
  36540. return str;
  36541. }
  36542. function arrayToHash(array) {
  36543. var hash = {};
  36544. array.forEach(function(val, idx) {
  36545. hash[val] = true;
  36546. });
  36547. return hash;
  36548. }
  36549. function formatValue(ctx, value, recurseTimes) {
  36550. // Provide a hook for user-specified inspect functions.
  36551. // Check that value is an object with an inspect function on it
  36552. if (ctx.customInspect &&
  36553. value &&
  36554. isFunction(value.inspect) &&
  36555. // Filter out the util module, it's inspect function is special
  36556. value.inspect !== exports.inspect &&
  36557. // Also filter out any prototype objects using the circular check.
  36558. !(value.constructor && value.constructor.prototype === value)) {
  36559. var ret = value.inspect(recurseTimes, ctx);
  36560. if (!isString(ret)) {
  36561. ret = formatValue(ctx, ret, recurseTimes);
  36562. }
  36563. return ret;
  36564. }
  36565. // Primitive types cannot have properties
  36566. var primitive = formatPrimitive(ctx, value);
  36567. if (primitive) {
  36568. return primitive;
  36569. }
  36570. // Look up the keys of the object.
  36571. var keys = Object.keys(value);
  36572. var visibleKeys = arrayToHash(keys);
  36573. if (ctx.showHidden) {
  36574. keys = Object.getOwnPropertyNames(value);
  36575. }
  36576. // IE doesn't make error fields non-enumerable
  36577. // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
  36578. if (isError(value)
  36579. && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
  36580. return formatError(value);
  36581. }
  36582. // Some type of object without properties can be shortcutted.
  36583. if (keys.length === 0) {
  36584. if (isFunction(value)) {
  36585. var name = value.name ? ': ' + value.name : '';
  36586. return ctx.stylize('[Function' + name + ']', 'special');
  36587. }
  36588. if (isRegExp(value)) {
  36589. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  36590. }
  36591. if (isDate(value)) {
  36592. return ctx.stylize(Date.prototype.toString.call(value), 'date');
  36593. }
  36594. if (isError(value)) {
  36595. return formatError(value);
  36596. }
  36597. }
  36598. var base = '', array = false, braces = ['{', '}'];
  36599. // Make Array say that they are Array
  36600. if (isArray(value)) {
  36601. array = true;
  36602. braces = ['[', ']'];
  36603. }
  36604. // Make functions say that they are functions
  36605. if (isFunction(value)) {
  36606. var n = value.name ? ': ' + value.name : '';
  36607. base = ' [Function' + n + ']';
  36608. }
  36609. // Make RegExps say that they are RegExps
  36610. if (isRegExp(value)) {
  36611. base = ' ' + RegExp.prototype.toString.call(value);
  36612. }
  36613. // Make dates with properties first say the date
  36614. if (isDate(value)) {
  36615. base = ' ' + Date.prototype.toUTCString.call(value);
  36616. }
  36617. // Make error with message first say the error
  36618. if (isError(value)) {
  36619. base = ' ' + formatError(value);
  36620. }
  36621. if (keys.length === 0 && (!array || value.length == 0)) {
  36622. return braces[0] + base + braces[1];
  36623. }
  36624. if (recurseTimes < 0) {
  36625. if (isRegExp(value)) {
  36626. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  36627. } else {
  36628. return ctx.stylize('[Object]', 'special');
  36629. }
  36630. }
  36631. ctx.seen.push(value);
  36632. var output;
  36633. if (array) {
  36634. output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
  36635. } else {
  36636. output = keys.map(function(key) {
  36637. return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
  36638. });
  36639. }
  36640. ctx.seen.pop();
  36641. return reduceToSingleString(output, base, braces);
  36642. }
  36643. function formatPrimitive(ctx, value) {
  36644. if (isUndefined(value))
  36645. return ctx.stylize('undefined', 'undefined');
  36646. if (isString(value)) {
  36647. var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
  36648. .replace(/'/g, "\\'")
  36649. .replace(/\\"/g, '"') + '\'';
  36650. return ctx.stylize(simple, 'string');
  36651. }
  36652. if (isNumber(value))
  36653. return ctx.stylize('' + value, 'number');
  36654. if (isBoolean(value))
  36655. return ctx.stylize('' + value, 'boolean');
  36656. // For some reason typeof null is "object", so special case here.
  36657. if (isNull(value))
  36658. return ctx.stylize('null', 'null');
  36659. }
  36660. function formatError(value) {
  36661. return '[' + Error.prototype.toString.call(value) + ']';
  36662. }
  36663. function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
  36664. var output = [];
  36665. for (var i = 0, l = value.length; i < l; ++i) {
  36666. if (hasOwnProperty(value, String(i))) {
  36667. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  36668. String(i), true));
  36669. } else {
  36670. output.push('');
  36671. }
  36672. }
  36673. keys.forEach(function(key) {
  36674. if (!key.match(/^\d+$/)) {
  36675. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  36676. key, true));
  36677. }
  36678. });
  36679. return output;
  36680. }
  36681. function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
  36682. var name, str, desc;
  36683. desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
  36684. if (desc.get) {
  36685. if (desc.set) {
  36686. str = ctx.stylize('[Getter/Setter]', 'special');
  36687. } else {
  36688. str = ctx.stylize('[Getter]', 'special');
  36689. }
  36690. } else {
  36691. if (desc.set) {
  36692. str = ctx.stylize('[Setter]', 'special');
  36693. }
  36694. }
  36695. if (!hasOwnProperty(visibleKeys, key)) {
  36696. name = '[' + key + ']';
  36697. }
  36698. if (!str) {
  36699. if (ctx.seen.indexOf(desc.value) < 0) {
  36700. if (isNull(recurseTimes)) {
  36701. str = formatValue(ctx, desc.value, null);
  36702. } else {
  36703. str = formatValue(ctx, desc.value, recurseTimes - 1);
  36704. }
  36705. if (str.indexOf('\n') > -1) {
  36706. if (array) {
  36707. str = str.split('\n').map(function(line) {
  36708. return ' ' + line;
  36709. }).join('\n').substr(2);
  36710. } else {
  36711. str = '\n' + str.split('\n').map(function(line) {
  36712. return ' ' + line;
  36713. }).join('\n');
  36714. }
  36715. }
  36716. } else {
  36717. str = ctx.stylize('[Circular]', 'special');
  36718. }
  36719. }
  36720. if (isUndefined(name)) {
  36721. if (array && key.match(/^\d+$/)) {
  36722. return str;
  36723. }
  36724. name = JSON.stringify('' + key);
  36725. if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
  36726. name = name.substr(1, name.length - 2);
  36727. name = ctx.stylize(name, 'name');
  36728. } else {
  36729. name = name.replace(/'/g, "\\'")
  36730. .replace(/\\"/g, '"')
  36731. .replace(/(^"|"$)/g, "'");
  36732. name = ctx.stylize(name, 'string');
  36733. }
  36734. }
  36735. return name + ': ' + str;
  36736. }
  36737. function reduceToSingleString(output, base, braces) {
  36738. var numLinesEst = 0;
  36739. var length = output.reduce(function(prev, cur) {
  36740. numLinesEst++;
  36741. if (cur.indexOf('\n') >= 0) numLinesEst++;
  36742. return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
  36743. }, 0);
  36744. if (length > 60) {
  36745. return braces[0] +
  36746. (base === '' ? '' : base + '\n ') +
  36747. ' ' +
  36748. output.join(',\n ') +
  36749. ' ' +
  36750. braces[1];
  36751. }
  36752. return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
  36753. }
  36754. // NOTE: These type checking functions intentionally don't use `instanceof`
  36755. // because it is fragile and can be easily faked with `Object.create()`.
  36756. function isArray(ar) {
  36757. return Array.isArray(ar);
  36758. }
  36759. exports.isArray = isArray;
  36760. function isBoolean(arg) {
  36761. return typeof arg === 'boolean';
  36762. }
  36763. exports.isBoolean = isBoolean;
  36764. function isNull(arg) {
  36765. return arg === null;
  36766. }
  36767. exports.isNull = isNull;
  36768. function isNullOrUndefined(arg) {
  36769. return arg == null;
  36770. }
  36771. exports.isNullOrUndefined = isNullOrUndefined;
  36772. function isNumber(arg) {
  36773. return typeof arg === 'number';
  36774. }
  36775. exports.isNumber = isNumber;
  36776. function isString(arg) {
  36777. return typeof arg === 'string';
  36778. }
  36779. exports.isString = isString;
  36780. function isSymbol(arg) {
  36781. return typeof arg === 'symbol';
  36782. }
  36783. exports.isSymbol = isSymbol;
  36784. function isUndefined(arg) {
  36785. return arg === void 0;
  36786. }
  36787. exports.isUndefined = isUndefined;
  36788. function isRegExp(re) {
  36789. return isObject(re) && objectToString(re) === '[object RegExp]';
  36790. }
  36791. exports.isRegExp = isRegExp;
  36792. function isObject(arg) {
  36793. return typeof arg === 'object' && arg !== null;
  36794. }
  36795. exports.isObject = isObject;
  36796. function isDate(d) {
  36797. return isObject(d) && objectToString(d) === '[object Date]';
  36798. }
  36799. exports.isDate = isDate;
  36800. function isError(e) {
  36801. return isObject(e) &&
  36802. (objectToString(e) === '[object Error]' || e instanceof Error);
  36803. }
  36804. exports.isError = isError;
  36805. function isFunction(arg) {
  36806. return typeof arg === 'function';
  36807. }
  36808. exports.isFunction = isFunction;
  36809. function isPrimitive(arg) {
  36810. return arg === null ||
  36811. typeof arg === 'boolean' ||
  36812. typeof arg === 'number' ||
  36813. typeof arg === 'string' ||
  36814. typeof arg === 'symbol' || // ES6 symbol
  36815. typeof arg === 'undefined';
  36816. }
  36817. exports.isPrimitive = isPrimitive;
  36818. exports.isBuffer = require('./support/isBuffer');
  36819. function objectToString(o) {
  36820. return Object.prototype.toString.call(o);
  36821. }
  36822. function pad(n) {
  36823. return n < 10 ? '0' + n.toString(10) : n.toString(10);
  36824. }
  36825. var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
  36826. 'Oct', 'Nov', 'Dec'];
  36827. // 26 Feb 16:19:34
  36828. function timestamp() {
  36829. var d = new Date();
  36830. var time = [pad(d.getHours()),
  36831. pad(d.getMinutes()),
  36832. pad(d.getSeconds())].join(':');
  36833. return [d.getDate(), months[d.getMonth()], time].join(' ');
  36834. }
  36835. // log is just a thin wrapper to console.log that prepends a timestamp
  36836. exports.log = function() {
  36837. console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
  36838. };
  36839. /**
  36840. * Inherit the prototype methods from one constructor into another.
  36841. *
  36842. * The Function.prototype.inherits from lang.js rewritten as a standalone
  36843. * function (not on Function.prototype). NOTE: If this file is to be loaded
  36844. * during bootstrapping this function needs to be rewritten using some native
  36845. * functions as prototype setup using normal JavaScript does not work as
  36846. * expected during bootstrapping (see mirror.js in r114903).
  36847. *
  36848. * @param {function} ctor Constructor function which needs to inherit the
  36849. * prototype.
  36850. * @param {function} superCtor Constructor function to inherit prototype from.
  36851. */
  36852. exports.inherits = require('inherits');
  36853. exports._extend = function(origin, add) {
  36854. // Don't do anything if add isn't an object
  36855. if (!add || !isObject(add)) return origin;
  36856. var keys = Object.keys(add);
  36857. var i = keys.length;
  36858. while (i--) {
  36859. origin[keys[i]] = add[keys[i]];
  36860. }
  36861. return origin;
  36862. };
  36863. function hasOwnProperty(obj, prop) {
  36864. return Object.prototype.hasOwnProperty.call(obj, prop);
  36865. }
  36866. }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  36867. },{"./support/isBuffer":491,"_process":471,"inherits":490}],493:[function(require,module,exports){
  36868. /*import { transform as babelTransform } from 'babel-core';
  36869. import babelTransformDynamicImport from 'babel-plugin-syntax-dynamic-import';
  36870. import babelTransformES2015ModulesSystemJS from 'babel-plugin-transform-es2015-modules-systemjs';*/
  36871. // sadly, due to how rollup works, we can't use es6 imports here
  36872. var babelTransform = require('babel-core').transform;
  36873. var babelTransformDynamicImport = require('babel-plugin-syntax-dynamic-import');
  36874. var babelTransformES2015ModulesSystemJS = require('babel-plugin-transform-es2015-modules-systemjs');
  36875. self.onmessage = function (evt) {
  36876. // transform source with Babel
  36877. var output = babelTransform(evt.data.source, {
  36878. compact: false,
  36879. filename: evt.data.key + '!transpiled',
  36880. sourceFileName: evt.data.key,
  36881. moduleIds: false,
  36882. sourceMaps: 'inline',
  36883. babelrc: false,
  36884. plugins: [babelTransformDynamicImport, babelTransformES2015ModulesSystemJS],
  36885. });
  36886. self.postMessage({key: evt.data.key, code: output.code, source: evt.data.source});
  36887. };
  36888. },{"babel-core":4,"babel-plugin-syntax-dynamic-import":54,"babel-plugin-transform-es2015-modules-systemjs":55}]},{},[493]);