babel-worker.js 1.6 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799
  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. (function (global){
  66. 'use strict';
  67. // compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js
  68. // original notice:
  69. /*!
  70. * The buffer module from node.js, for the browser.
  71. *
  72. * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
  73. * @license MIT
  74. */
  75. function compare(a, b) {
  76. if (a === b) {
  77. return 0;
  78. }
  79. var x = a.length;
  80. var y = b.length;
  81. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  82. if (a[i] !== b[i]) {
  83. x = a[i];
  84. y = b[i];
  85. break;
  86. }
  87. }
  88. if (x < y) {
  89. return -1;
  90. }
  91. if (y < x) {
  92. return 1;
  93. }
  94. return 0;
  95. }
  96. function isBuffer(b) {
  97. if (global.Buffer && typeof global.Buffer.isBuffer === 'function') {
  98. return global.Buffer.isBuffer(b);
  99. }
  100. return !!(b != null && b._isBuffer);
  101. }
  102. // based on node assert, original notice:
  103. // http://wiki.commonjs.org/wiki/Unit_Testing/1.0
  104. //
  105. // THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
  106. //
  107. // Originally from narwhal.js (http://narwhaljs.org)
  108. // Copyright (c) 2009 Thomas Robinson <280north.com>
  109. //
  110. // Permission is hereby granted, free of charge, to any person obtaining a copy
  111. // of this software and associated documentation files (the 'Software'), to
  112. // deal in the Software without restriction, including without limitation the
  113. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  114. // sell copies of the Software, and to permit persons to whom the Software is
  115. // furnished to do so, subject to the following conditions:
  116. //
  117. // The above copyright notice and this permission notice shall be included in
  118. // all copies or substantial portions of the Software.
  119. //
  120. // THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  121. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  122. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  123. // AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  124. // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  125. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  126. var util = require('util/');
  127. var hasOwn = Object.prototype.hasOwnProperty;
  128. var pSlice = Array.prototype.slice;
  129. var functionsHaveNames = (function () {
  130. return function foo() {}.name === 'foo';
  131. }());
  132. function pToString (obj) {
  133. return Object.prototype.toString.call(obj);
  134. }
  135. function isView(arrbuf) {
  136. if (isBuffer(arrbuf)) {
  137. return false;
  138. }
  139. if (typeof global.ArrayBuffer !== 'function') {
  140. return false;
  141. }
  142. if (typeof ArrayBuffer.isView === 'function') {
  143. return ArrayBuffer.isView(arrbuf);
  144. }
  145. if (!arrbuf) {
  146. return false;
  147. }
  148. if (arrbuf instanceof DataView) {
  149. return true;
  150. }
  151. if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) {
  152. return true;
  153. }
  154. return false;
  155. }
  156. // 1. The assert module provides functions that throw
  157. // AssertionError's when particular conditions are not met. The
  158. // assert module must conform to the following interface.
  159. var assert = module.exports = ok;
  160. // 2. The AssertionError is defined in assert.
  161. // new assert.AssertionError({ message: message,
  162. // actual: actual,
  163. // expected: expected })
  164. var regex = /\s*function\s+([^\(\s]*)\s*/;
  165. // based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js
  166. function getName(func) {
  167. if (!util.isFunction(func)) {
  168. return;
  169. }
  170. if (functionsHaveNames) {
  171. return func.name;
  172. }
  173. var str = func.toString();
  174. var match = str.match(regex);
  175. return match && match[1];
  176. }
  177. assert.AssertionError = function AssertionError(options) {
  178. this.name = 'AssertionError';
  179. this.actual = options.actual;
  180. this.expected = options.expected;
  181. this.operator = options.operator;
  182. if (options.message) {
  183. this.message = options.message;
  184. this.generatedMessage = false;
  185. } else {
  186. this.message = getMessage(this);
  187. this.generatedMessage = true;
  188. }
  189. var stackStartFunction = options.stackStartFunction || fail;
  190. if (Error.captureStackTrace) {
  191. Error.captureStackTrace(this, stackStartFunction);
  192. } else {
  193. // non v8 browsers so we can have a stacktrace
  194. var err = new Error();
  195. if (err.stack) {
  196. var out = err.stack;
  197. // try to strip useless frames
  198. var fn_name = getName(stackStartFunction);
  199. var idx = out.indexOf('\n' + fn_name);
  200. if (idx >= 0) {
  201. // once we have located the function frame
  202. // we need to strip out everything before it (and its line)
  203. var next_line = out.indexOf('\n', idx + 1);
  204. out = out.substring(next_line + 1);
  205. }
  206. this.stack = out;
  207. }
  208. }
  209. };
  210. // assert.AssertionError instanceof Error
  211. util.inherits(assert.AssertionError, Error);
  212. function truncate(s, n) {
  213. if (typeof s === 'string') {
  214. return s.length < n ? s : s.slice(0, n);
  215. } else {
  216. return s;
  217. }
  218. }
  219. function inspect(something) {
  220. if (functionsHaveNames || !util.isFunction(something)) {
  221. return util.inspect(something);
  222. }
  223. var rawname = getName(something);
  224. var name = rawname ? ': ' + rawname : '';
  225. return '[Function' + name + ']';
  226. }
  227. function getMessage(self) {
  228. return truncate(inspect(self.actual), 128) + ' ' +
  229. self.operator + ' ' +
  230. truncate(inspect(self.expected), 128);
  231. }
  232. // At present only the three keys mentioned above are used and
  233. // understood by the spec. Implementations or sub modules can pass
  234. // other keys to the AssertionError's constructor - they will be
  235. // ignored.
  236. // 3. All of the following functions must throw an AssertionError
  237. // when a corresponding condition is not met, with a message that
  238. // may be undefined if not provided. All assertion methods provide
  239. // both the actual and expected values to the assertion error for
  240. // display purposes.
  241. function fail(actual, expected, message, operator, stackStartFunction) {
  242. throw new assert.AssertionError({
  243. message: message,
  244. actual: actual,
  245. expected: expected,
  246. operator: operator,
  247. stackStartFunction: stackStartFunction
  248. });
  249. }
  250. // EXTENSION! allows for well behaved errors defined elsewhere.
  251. assert.fail = fail;
  252. // 4. Pure assertion tests whether a value is truthy, as determined
  253. // by !!guard.
  254. // assert.ok(guard, message_opt);
  255. // This statement is equivalent to assert.equal(true, !!guard,
  256. // message_opt);. To test strictly for the value true, use
  257. // assert.strictEqual(true, guard, message_opt);.
  258. function ok(value, message) {
  259. if (!value) fail(value, true, message, '==', assert.ok);
  260. }
  261. assert.ok = ok;
  262. // 5. The equality assertion tests shallow, coercive equality with
  263. // ==.
  264. // assert.equal(actual, expected, message_opt);
  265. assert.equal = function equal(actual, expected, message) {
  266. if (actual != expected) fail(actual, expected, message, '==', assert.equal);
  267. };
  268. // 6. The non-equality assertion tests for whether two objects are not equal
  269. // with != assert.notEqual(actual, expected, message_opt);
  270. assert.notEqual = function notEqual(actual, expected, message) {
  271. if (actual == expected) {
  272. fail(actual, expected, message, '!=', assert.notEqual);
  273. }
  274. };
  275. // 7. The equivalence assertion tests a deep equality relation.
  276. // assert.deepEqual(actual, expected, message_opt);
  277. assert.deepEqual = function deepEqual(actual, expected, message) {
  278. if (!_deepEqual(actual, expected, false)) {
  279. fail(actual, expected, message, 'deepEqual', assert.deepEqual);
  280. }
  281. };
  282. assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {
  283. if (!_deepEqual(actual, expected, true)) {
  284. fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual);
  285. }
  286. };
  287. function _deepEqual(actual, expected, strict, memos) {
  288. // 7.1. All identical values are equivalent, as determined by ===.
  289. if (actual === expected) {
  290. return true;
  291. } else if (isBuffer(actual) && isBuffer(expected)) {
  292. return compare(actual, expected) === 0;
  293. // 7.2. If the expected value is a Date object, the actual value is
  294. // equivalent if it is also a Date object that refers to the same time.
  295. } else if (util.isDate(actual) && util.isDate(expected)) {
  296. return actual.getTime() === expected.getTime();
  297. // 7.3 If the expected value is a RegExp object, the actual value is
  298. // equivalent if it is also a RegExp object with the same source and
  299. // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
  300. } else if (util.isRegExp(actual) && util.isRegExp(expected)) {
  301. return actual.source === expected.source &&
  302. actual.global === expected.global &&
  303. actual.multiline === expected.multiline &&
  304. actual.lastIndex === expected.lastIndex &&
  305. actual.ignoreCase === expected.ignoreCase;
  306. // 7.4. Other pairs that do not both pass typeof value == 'object',
  307. // equivalence is determined by ==.
  308. } else if ((actual === null || typeof actual !== 'object') &&
  309. (expected === null || typeof expected !== 'object')) {
  310. return strict ? actual === expected : actual == expected;
  311. // If both values are instances of typed arrays, wrap their underlying
  312. // ArrayBuffers in a Buffer each to increase performance
  313. // This optimization requires the arrays to have the same type as checked by
  314. // Object.prototype.toString (aka pToString). Never perform binary
  315. // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their
  316. // bit patterns are not identical.
  317. } else if (isView(actual) && isView(expected) &&
  318. pToString(actual) === pToString(expected) &&
  319. !(actual instanceof Float32Array ||
  320. actual instanceof Float64Array)) {
  321. return compare(new Uint8Array(actual.buffer),
  322. new Uint8Array(expected.buffer)) === 0;
  323. // 7.5 For all other Object pairs, including Array objects, equivalence is
  324. // determined by having the same number of owned properties (as verified
  325. // with Object.prototype.hasOwnProperty.call), the same set of keys
  326. // (although not necessarily the same order), equivalent values for every
  327. // corresponding key, and an identical 'prototype' property. Note: this
  328. // accounts for both named and indexed properties on Arrays.
  329. } else if (isBuffer(actual) !== isBuffer(expected)) {
  330. return false;
  331. } else {
  332. memos = memos || {actual: [], expected: []};
  333. var actualIndex = memos.actual.indexOf(actual);
  334. if (actualIndex !== -1) {
  335. if (actualIndex === memos.expected.indexOf(expected)) {
  336. return true;
  337. }
  338. }
  339. memos.actual.push(actual);
  340. memos.expected.push(expected);
  341. return objEquiv(actual, expected, strict, memos);
  342. }
  343. }
  344. function isArguments(object) {
  345. return Object.prototype.toString.call(object) == '[object Arguments]';
  346. }
  347. function objEquiv(a, b, strict, actualVisitedObjects) {
  348. if (a === null || a === undefined || b === null || b === undefined)
  349. return false;
  350. // if one is a primitive, the other must be same
  351. if (util.isPrimitive(a) || util.isPrimitive(b))
  352. return a === b;
  353. if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b))
  354. return false;
  355. var aIsArgs = isArguments(a);
  356. var bIsArgs = isArguments(b);
  357. if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))
  358. return false;
  359. if (aIsArgs) {
  360. a = pSlice.call(a);
  361. b = pSlice.call(b);
  362. return _deepEqual(a, b, strict);
  363. }
  364. var ka = objectKeys(a);
  365. var kb = objectKeys(b);
  366. var key, i;
  367. // having the same number of owned properties (keys incorporates
  368. // hasOwnProperty)
  369. if (ka.length !== kb.length)
  370. return false;
  371. //the same set of keys (although not necessarily the same order),
  372. ka.sort();
  373. kb.sort();
  374. //~~~cheap key test
  375. for (i = ka.length - 1; i >= 0; i--) {
  376. if (ka[i] !== kb[i])
  377. return false;
  378. }
  379. //equivalent values for every corresponding key, and
  380. //~~~possibly expensive deep test
  381. for (i = ka.length - 1; i >= 0; i--) {
  382. key = ka[i];
  383. if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects))
  384. return false;
  385. }
  386. return true;
  387. }
  388. // 8. The non-equivalence assertion tests for any deep inequality.
  389. // assert.notDeepEqual(actual, expected, message_opt);
  390. assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
  391. if (_deepEqual(actual, expected, false)) {
  392. fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual);
  393. }
  394. };
  395. assert.notDeepStrictEqual = notDeepStrictEqual;
  396. function notDeepStrictEqual(actual, expected, message) {
  397. if (_deepEqual(actual, expected, true)) {
  398. fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual);
  399. }
  400. }
  401. // 9. The strict equality assertion tests strict equality, as determined by ===.
  402. // assert.strictEqual(actual, expected, message_opt);
  403. assert.strictEqual = function strictEqual(actual, expected, message) {
  404. if (actual !== expected) {
  405. fail(actual, expected, message, '===', assert.strictEqual);
  406. }
  407. };
  408. // 10. The strict non-equality assertion tests for strict inequality, as
  409. // determined by !==. assert.notStrictEqual(actual, expected, message_opt);
  410. assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
  411. if (actual === expected) {
  412. fail(actual, expected, message, '!==', assert.notStrictEqual);
  413. }
  414. };
  415. function expectedException(actual, expected) {
  416. if (!actual || !expected) {
  417. return false;
  418. }
  419. if (Object.prototype.toString.call(expected) == '[object RegExp]') {
  420. return expected.test(actual);
  421. }
  422. try {
  423. if (actual instanceof expected) {
  424. return true;
  425. }
  426. } catch (e) {
  427. // Ignore. The instanceof check doesn't work for arrow functions.
  428. }
  429. if (Error.isPrototypeOf(expected)) {
  430. return false;
  431. }
  432. return expected.call({}, actual) === true;
  433. }
  434. function _tryBlock(block) {
  435. var error;
  436. try {
  437. block();
  438. } catch (e) {
  439. error = e;
  440. }
  441. return error;
  442. }
  443. function _throws(shouldThrow, block, expected, message) {
  444. var actual;
  445. if (typeof block !== 'function') {
  446. throw new TypeError('"block" argument must be a function');
  447. }
  448. if (typeof expected === 'string') {
  449. message = expected;
  450. expected = null;
  451. }
  452. actual = _tryBlock(block);
  453. message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
  454. (message ? ' ' + message : '.');
  455. if (shouldThrow && !actual) {
  456. fail(actual, expected, 'Missing expected exception' + message);
  457. }
  458. var userProvidedMessage = typeof message === 'string';
  459. var isUnwantedException = !shouldThrow && util.isError(actual);
  460. var isUnexpectedException = !shouldThrow && actual && !expected;
  461. if ((isUnwantedException &&
  462. userProvidedMessage &&
  463. expectedException(actual, expected)) ||
  464. isUnexpectedException) {
  465. fail(actual, expected, 'Got unwanted exception' + message);
  466. }
  467. if ((shouldThrow && actual && expected &&
  468. !expectedException(actual, expected)) || (!shouldThrow && actual)) {
  469. throw actual;
  470. }
  471. }
  472. // 11. Expected to throw an error:
  473. // assert.throws(block, Error_opt, message_opt);
  474. assert.throws = function(block, /*optional*/error, /*optional*/message) {
  475. _throws(true, block, error, message);
  476. };
  477. // EXTENSION! This is annoying to write outside this module.
  478. assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) {
  479. _throws(false, block, error, message);
  480. };
  481. assert.ifError = function(err) { if (err) throw err; };
  482. var objectKeys = Object.keys || function (obj) {
  483. var keys = [];
  484. for (var key in obj) {
  485. if (hasOwn.call(obj, key)) keys.push(key);
  486. }
  487. return keys;
  488. };
  489. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  490. },{"util/":560}],4:[function(require,module,exports){
  491. "use strict";
  492. exports.__esModule = true;
  493. exports.default = function (rawLines, lineNumber, colNumber) {
  494. var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
  495. colNumber = Math.max(colNumber, 0);
  496. var highlighted = opts.highlightCode && _chalk2.default.supportsColor || opts.forceColor;
  497. var chalk = _chalk2.default;
  498. if (opts.forceColor) {
  499. chalk = new _chalk2.default.constructor({ enabled: true });
  500. }
  501. var maybeHighlight = function maybeHighlight(chalkFn, string) {
  502. return highlighted ? chalkFn(string) : string;
  503. };
  504. var defs = getDefs(chalk);
  505. if (highlighted) rawLines = highlight(defs, rawLines);
  506. var linesAbove = opts.linesAbove || 2;
  507. var linesBelow = opts.linesBelow || 3;
  508. var lines = rawLines.split(NEWLINE);
  509. var start = Math.max(lineNumber - (linesAbove + 1), 0);
  510. var end = Math.min(lines.length, lineNumber + linesBelow);
  511. if (!lineNumber && !colNumber) {
  512. start = 0;
  513. end = lines.length;
  514. }
  515. var numberMaxWidth = String(end).length;
  516. var frame = lines.slice(start, end).map(function (line, index) {
  517. var number = start + 1 + index;
  518. var paddedNumber = (" " + number).slice(-numberMaxWidth);
  519. var gutter = " " + paddedNumber + " | ";
  520. if (number === lineNumber) {
  521. var markerLine = "";
  522. if (colNumber) {
  523. var markerSpacing = line.slice(0, colNumber - 1).replace(/[^\t]/g, " ");
  524. markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, maybeHighlight(defs.marker, "^")].join("");
  525. }
  526. return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join("");
  527. } else {
  528. return " " + maybeHighlight(defs.gutter, gutter) + line;
  529. }
  530. }).join("\n");
  531. if (highlighted) {
  532. return chalk.reset(frame);
  533. } else {
  534. return frame;
  535. }
  536. };
  537. var _jsTokens = require("js-tokens");
  538. var _jsTokens2 = _interopRequireDefault(_jsTokens);
  539. var _esutils = require("esutils");
  540. var _esutils2 = _interopRequireDefault(_esutils);
  541. var _chalk = require("chalk");
  542. var _chalk2 = _interopRequireDefault(_chalk);
  543. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  544. function getDefs(chalk) {
  545. return {
  546. keyword: chalk.cyan,
  547. capitalized: chalk.yellow,
  548. jsx_tag: chalk.yellow,
  549. punctuator: chalk.yellow,
  550. number: chalk.magenta,
  551. string: chalk.green,
  552. regex: chalk.magenta,
  553. comment: chalk.grey,
  554. invalid: chalk.white.bgRed.bold,
  555. gutter: chalk.grey,
  556. marker: chalk.red.bold
  557. };
  558. }
  559. var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
  560. var JSX_TAG = /^[a-z][\w-]*$/i;
  561. var BRACKET = /^[()\[\]{}]$/;
  562. function getTokenType(match) {
  563. var _match$slice = match.slice(-2),
  564. offset = _match$slice[0],
  565. text = _match$slice[1];
  566. var token = (0, _jsTokens.matchToToken)(match);
  567. if (token.type === "name") {
  568. if (_esutils2.default.keyword.isReservedWordES6(token.value)) {
  569. return "keyword";
  570. }
  571. if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.substr(offset - 2, 2) == "</")) {
  572. return "jsx_tag";
  573. }
  574. if (token.value[0] !== token.value[0].toLowerCase()) {
  575. return "capitalized";
  576. }
  577. }
  578. if (token.type === "punctuator" && BRACKET.test(token.value)) {
  579. return "bracket";
  580. }
  581. return token.type;
  582. }
  583. function highlight(defs, text) {
  584. return text.replace(_jsTokens2.default, function () {
  585. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  586. args[_key] = arguments[_key];
  587. }
  588. var type = getTokenType(args);
  589. var colorize = defs[type];
  590. if (colorize) {
  591. return args[0].split(NEWLINE).map(function (str) {
  592. return colorize(str);
  593. }).join("\n");
  594. } else {
  595. return args[0];
  596. }
  597. });
  598. }
  599. module.exports = exports["default"];
  600. },{"chalk":161,"esutils":287,"js-tokens":295}],5:[function(require,module,exports){
  601. module.exports = require("./lib/api/node.js");
  602. },{"./lib/api/node.js":6}],6:[function(require,module,exports){
  603. "use strict";
  604. exports.__esModule = true;
  605. 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;
  606. var _file = require("../transformation/file");
  607. Object.defineProperty(exports, "File", {
  608. enumerable: true,
  609. get: function get() {
  610. return _interopRequireDefault(_file).default;
  611. }
  612. });
  613. var _config = require("../transformation/file/options/config");
  614. Object.defineProperty(exports, "options", {
  615. enumerable: true,
  616. get: function get() {
  617. return _interopRequireDefault(_config).default;
  618. }
  619. });
  620. var _buildExternalHelpers = require("../tools/build-external-helpers");
  621. Object.defineProperty(exports, "buildExternalHelpers", {
  622. enumerable: true,
  623. get: function get() {
  624. return _interopRequireDefault(_buildExternalHelpers).default;
  625. }
  626. });
  627. var _babelTemplate = require("babel-template");
  628. Object.defineProperty(exports, "template", {
  629. enumerable: true,
  630. get: function get() {
  631. return _interopRequireDefault(_babelTemplate).default;
  632. }
  633. });
  634. var _resolvePlugin = require("../helpers/resolve-plugin");
  635. Object.defineProperty(exports, "resolvePlugin", {
  636. enumerable: true,
  637. get: function get() {
  638. return _interopRequireDefault(_resolvePlugin).default;
  639. }
  640. });
  641. var _resolvePreset = require("../helpers/resolve-preset");
  642. Object.defineProperty(exports, "resolvePreset", {
  643. enumerable: true,
  644. get: function get() {
  645. return _interopRequireDefault(_resolvePreset).default;
  646. }
  647. });
  648. var _package = require("../../package");
  649. Object.defineProperty(exports, "version", {
  650. enumerable: true,
  651. get: function get() {
  652. return _package.version;
  653. }
  654. });
  655. exports.Plugin = Plugin;
  656. exports.transformFile = transformFile;
  657. exports.transformFileSync = transformFileSync;
  658. var _fs = require("fs");
  659. var _fs2 = _interopRequireDefault(_fs);
  660. var _util = require("../util");
  661. var util = _interopRequireWildcard(_util);
  662. var _babelMessages = require("babel-messages");
  663. var messages = _interopRequireWildcard(_babelMessages);
  664. var _babelTypes = require("babel-types");
  665. var t = _interopRequireWildcard(_babelTypes);
  666. var _babelTraverse = require("babel-traverse");
  667. var _babelTraverse2 = _interopRequireDefault(_babelTraverse);
  668. var _optionManager = require("../transformation/file/options/option-manager");
  669. var _optionManager2 = _interopRequireDefault(_optionManager);
  670. var _pipeline = require("../transformation/pipeline");
  671. var _pipeline2 = _interopRequireDefault(_pipeline);
  672. 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; } }
  673. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  674. exports.util = util;
  675. exports.messages = messages;
  676. exports.types = t;
  677. exports.traverse = _babelTraverse2.default;
  678. exports.OptionManager = _optionManager2.default;
  679. function Plugin(alias) {
  680. throw new Error("The (" + alias + ") Babel 5 plugin is being run with Babel 6.");
  681. }
  682. exports.Pipeline = _pipeline2.default;
  683. var pipeline = new _pipeline2.default();
  684. var analyse = exports.analyse = pipeline.analyse.bind(pipeline);
  685. var transform = exports.transform = pipeline.transform.bind(pipeline);
  686. var transformFromAst = exports.transformFromAst = pipeline.transformFromAst.bind(pipeline);
  687. function transformFile(filename, opts, callback) {
  688. if (typeof opts === "function") {
  689. callback = opts;
  690. opts = {};
  691. }
  692. opts.filename = filename;
  693. _fs2.default.readFile(filename, function (err, code) {
  694. var result = void 0;
  695. if (!err) {
  696. try {
  697. result = transform(code, opts);
  698. } catch (_err) {
  699. err = _err;
  700. }
  701. }
  702. if (err) {
  703. callback(err);
  704. } else {
  705. callback(null, result);
  706. }
  707. });
  708. }
  709. function transformFileSync(filename) {
  710. var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  711. opts.filename = filename;
  712. return transform(_fs2.default.readFileSync(filename, "utf8"), opts);
  713. }
  714. },{"../../package":32,"../helpers/resolve-plugin":12,"../helpers/resolve-preset":13,"../tools/build-external-helpers":16,"../transformation/file":17,"../transformation/file/options/config":21,"../transformation/file/options/option-manager":23,"../transformation/pipeline":28,"../util":31,"babel-messages":61,"babel-template":114,"babel-traverse":118,"babel-types":151,"fs":159}],7:[function(require,module,exports){
  715. "use strict";
  716. exports.__esModule = true;
  717. exports.default = getPossiblePluginNames;
  718. function getPossiblePluginNames(pluginName) {
  719. return ["babel-plugin-" + pluginName, pluginName];
  720. }
  721. module.exports = exports["default"];
  722. },{}],8:[function(require,module,exports){
  723. "use strict";
  724. exports.__esModule = true;
  725. exports.default = getPossiblePresetNames;
  726. function getPossiblePresetNames(presetName) {
  727. var possibleNames = ["babel-preset-" + presetName, presetName];
  728. var matches = presetName.match(/^(@[^/]+)\/(.+)$/);
  729. if (matches) {
  730. var orgName = matches[1],
  731. presetPath = matches[2];
  732. possibleNames.push(orgName + "/babel-preset-" + presetPath);
  733. }
  734. return possibleNames;
  735. }
  736. module.exports = exports["default"];
  737. },{}],9:[function(require,module,exports){
  738. "use strict";
  739. exports.__esModule = true;
  740. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  741. var _getIterator3 = _interopRequireDefault(_getIterator2);
  742. exports.default = function (dest, src) {
  743. if (!dest || !src) return;
  744. return (0, _mergeWith2.default)(dest, src, function (a, b) {
  745. if (b && Array.isArray(a)) {
  746. var newArray = b.slice(0);
  747. for (var _iterator = a, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  748. var _ref;
  749. if (_isArray) {
  750. if (_i >= _iterator.length) break;
  751. _ref = _iterator[_i++];
  752. } else {
  753. _i = _iterator.next();
  754. if (_i.done) break;
  755. _ref = _i.value;
  756. }
  757. var item = _ref;
  758. if (newArray.indexOf(item) < 0) {
  759. newArray.push(item);
  760. }
  761. }
  762. return newArray;
  763. }
  764. });
  765. };
  766. var _mergeWith = require("lodash/mergeWith");
  767. var _mergeWith2 = _interopRequireDefault(_mergeWith);
  768. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  769. module.exports = exports["default"];
  770. },{"babel-runtime/core-js/get-iterator":95,"lodash/mergeWith":502}],10:[function(require,module,exports){
  771. "use strict";
  772. exports.__esModule = true;
  773. exports.default = function (ast, comments, tokens) {
  774. if (ast) {
  775. if (ast.type === "Program") {
  776. return t.file(ast, comments || [], tokens || []);
  777. } else if (ast.type === "File") {
  778. return ast;
  779. }
  780. }
  781. throw new Error("Not a valid ast?");
  782. };
  783. var _babelTypes = require("babel-types");
  784. var t = _interopRequireWildcard(_babelTypes);
  785. 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; } }
  786. module.exports = exports["default"];
  787. },{"babel-types":151}],11:[function(require,module,exports){
  788. "use strict";
  789. exports.__esModule = true;
  790. exports.default = resolveFromPossibleNames;
  791. var _resolve = require("./resolve");
  792. var _resolve2 = _interopRequireDefault(_resolve);
  793. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  794. function resolveFromPossibleNames(possibleNames, dirname) {
  795. return possibleNames.reduce(function (accum, curr) {
  796. return accum || (0, _resolve2.default)(curr, dirname);
  797. }, null);
  798. }
  799. module.exports = exports["default"];
  800. },{"./resolve":14}],12:[function(require,module,exports){
  801. (function (process){
  802. "use strict";
  803. exports.__esModule = true;
  804. exports.default = resolvePlugin;
  805. var _resolveFromPossibleNames = require("./resolve-from-possible-names");
  806. var _resolveFromPossibleNames2 = _interopRequireDefault(_resolveFromPossibleNames);
  807. var _getPossiblePluginNames = require("./get-possible-plugin-names");
  808. var _getPossiblePluginNames2 = _interopRequireDefault(_getPossiblePluginNames);
  809. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  810. function resolvePlugin(pluginName) {
  811. var dirname = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : process.cwd();
  812. return (0, _resolveFromPossibleNames2.default)((0, _getPossiblePluginNames2.default)(pluginName), dirname);
  813. }
  814. module.exports = exports["default"];
  815. }).call(this,require('_process'))
  816. },{"./get-possible-plugin-names":7,"./resolve-from-possible-names":11,"_process":525}],13:[function(require,module,exports){
  817. (function (process){
  818. "use strict";
  819. exports.__esModule = true;
  820. exports.default = resolvePreset;
  821. var _resolveFromPossibleNames = require("./resolve-from-possible-names");
  822. var _resolveFromPossibleNames2 = _interopRequireDefault(_resolveFromPossibleNames);
  823. var _getPossiblePresetNames = require("./get-possible-preset-names");
  824. var _getPossiblePresetNames2 = _interopRequireDefault(_getPossiblePresetNames);
  825. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  826. function resolvePreset(presetName) {
  827. var dirname = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : process.cwd();
  828. return (0, _resolveFromPossibleNames2.default)((0, _getPossiblePresetNames2.default)(presetName), dirname);
  829. }
  830. module.exports = exports["default"];
  831. }).call(this,require('_process'))
  832. },{"./get-possible-preset-names":8,"./resolve-from-possible-names":11,"_process":525}],14:[function(require,module,exports){
  833. (function (process){
  834. "use strict";
  835. exports.__esModule = true;
  836. var _typeof2 = require("babel-runtime/helpers/typeof");
  837. var _typeof3 = _interopRequireDefault(_typeof2);
  838. exports.default = function (loc) {
  839. var relative = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : process.cwd();
  840. if ((typeof _module2.default === "undefined" ? "undefined" : (0, _typeof3.default)(_module2.default)) === "object") return null;
  841. var relativeMod = relativeModules[relative];
  842. if (!relativeMod) {
  843. relativeMod = new _module2.default();
  844. var filename = _path2.default.join(relative, ".babelrc");
  845. relativeMod.id = filename;
  846. relativeMod.filename = filename;
  847. relativeMod.paths = _module2.default._nodeModulePaths(relative);
  848. relativeModules[relative] = relativeMod;
  849. }
  850. try {
  851. return _module2.default._resolveFilename(loc, relativeMod);
  852. } catch (err) {
  853. return null;
  854. }
  855. };
  856. var _module = require("module");
  857. var _module2 = _interopRequireDefault(_module);
  858. var _path = require("path");
  859. var _path2 = _interopRequireDefault(_path);
  860. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  861. var relativeModules = {};
  862. module.exports = exports["default"];
  863. }).call(this,require('_process'))
  864. },{"_process":525,"babel-runtime/helpers/typeof":113,"module":159,"path":522}],15:[function(require,module,exports){
  865. "use strict";
  866. exports.__esModule = true;
  867. var _map = require("babel-runtime/core-js/map");
  868. var _map2 = _interopRequireDefault(_map);
  869. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  870. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  871. var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn");
  872. var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
  873. var _inherits2 = require("babel-runtime/helpers/inherits");
  874. var _inherits3 = _interopRequireDefault(_inherits2);
  875. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  876. var Store = function (_Map) {
  877. (0, _inherits3.default)(Store, _Map);
  878. function Store() {
  879. (0, _classCallCheck3.default)(this, Store);
  880. var _this = (0, _possibleConstructorReturn3.default)(this, _Map.call(this));
  881. _this.dynamicData = {};
  882. return _this;
  883. }
  884. Store.prototype.setDynamic = function setDynamic(key, fn) {
  885. this.dynamicData[key] = fn;
  886. };
  887. Store.prototype.get = function get(key) {
  888. if (this.has(key)) {
  889. return _Map.prototype.get.call(this, key);
  890. } else {
  891. if (Object.prototype.hasOwnProperty.call(this.dynamicData, key)) {
  892. var val = this.dynamicData[key]();
  893. this.set(key, val);
  894. return val;
  895. }
  896. }
  897. };
  898. return Store;
  899. }(_map2.default);
  900. exports.default = Store;
  901. module.exports = exports["default"];
  902. },{"babel-runtime/core-js/map":97,"babel-runtime/helpers/classCallCheck":109,"babel-runtime/helpers/inherits":110,"babel-runtime/helpers/possibleConstructorReturn":112}],16:[function(require,module,exports){
  903. "use strict";
  904. exports.__esModule = true;
  905. exports.default = function (whitelist) {
  906. var outputType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "global";
  907. var namespace = t.identifier("babelHelpers");
  908. var builder = function builder(body) {
  909. return buildHelpers(body, namespace, whitelist);
  910. };
  911. var tree = void 0;
  912. var build = {
  913. global: buildGlobal,
  914. umd: buildUmd,
  915. var: buildVar
  916. }[outputType];
  917. if (build) {
  918. tree = build(namespace, builder);
  919. } else {
  920. throw new Error(messages.get("unsupportedOutputType", outputType));
  921. }
  922. return (0, _babelGenerator2.default)(tree).code;
  923. };
  924. var _babelHelpers = require("babel-helpers");
  925. var helpers = _interopRequireWildcard(_babelHelpers);
  926. var _babelGenerator = require("babel-generator");
  927. var _babelGenerator2 = _interopRequireDefault(_babelGenerator);
  928. var _babelMessages = require("babel-messages");
  929. var messages = _interopRequireWildcard(_babelMessages);
  930. var _babelTemplate = require("babel-template");
  931. var _babelTemplate2 = _interopRequireDefault(_babelTemplate);
  932. var _babelTypes = require("babel-types");
  933. var t = _interopRequireWildcard(_babelTypes);
  934. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  935. 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; } }
  936. 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");
  937. function buildGlobal(namespace, builder) {
  938. var body = [];
  939. var container = t.functionExpression(null, [t.identifier("global")], t.blockStatement(body));
  940. var tree = t.program([t.expressionStatement(t.callExpression(container, [helpers.get("selfGlobal")]))]);
  941. body.push(t.variableDeclaration("var", [t.variableDeclarator(namespace, t.assignmentExpression("=", t.memberExpression(t.identifier("global"), namespace), t.objectExpression([])))]));
  942. builder(body);
  943. return tree;
  944. }
  945. function buildUmd(namespace, builder) {
  946. var body = [];
  947. body.push(t.variableDeclaration("var", [t.variableDeclarator(namespace, t.identifier("global"))]));
  948. builder(body);
  949. return t.program([buildUmdWrapper({
  950. FACTORY_PARAMETERS: t.identifier("global"),
  951. BROWSER_ARGUMENTS: t.assignmentExpression("=", t.memberExpression(t.identifier("root"), namespace), t.objectExpression([])),
  952. COMMON_ARGUMENTS: t.identifier("exports"),
  953. AMD_ARGUMENTS: t.arrayExpression([t.stringLiteral("exports")]),
  954. FACTORY_BODY: body,
  955. UMD_ROOT: t.identifier("this")
  956. })]);
  957. }
  958. function buildVar(namespace, builder) {
  959. var body = [];
  960. body.push(t.variableDeclaration("var", [t.variableDeclarator(namespace, t.objectExpression([]))]));
  961. builder(body);
  962. body.push(t.expressionStatement(namespace));
  963. return t.program(body);
  964. }
  965. function buildHelpers(body, namespace, whitelist) {
  966. helpers.list.forEach(function (name) {
  967. if (whitelist && whitelist.indexOf(name) < 0) return;
  968. var key = t.identifier(name);
  969. body.push(t.expressionStatement(t.assignmentExpression("=", t.memberExpression(namespace, key), helpers.get(name))));
  970. });
  971. }
  972. module.exports = exports["default"];
  973. },{"babel-generator":44,"babel-helpers":60,"babel-messages":61,"babel-template":114,"babel-types":151}],17:[function(require,module,exports){
  974. (function (process){
  975. "use strict";
  976. exports.__esModule = true;
  977. exports.File = undefined;
  978. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  979. var _getIterator3 = _interopRequireDefault(_getIterator2);
  980. var _create = require("babel-runtime/core-js/object/create");
  981. var _create2 = _interopRequireDefault(_create);
  982. var _assign = require("babel-runtime/core-js/object/assign");
  983. var _assign2 = _interopRequireDefault(_assign);
  984. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  985. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  986. var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn");
  987. var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
  988. var _inherits2 = require("babel-runtime/helpers/inherits");
  989. var _inherits3 = _interopRequireDefault(_inherits2);
  990. var _babelHelpers = require("babel-helpers");
  991. var _babelHelpers2 = _interopRequireDefault(_babelHelpers);
  992. var _metadata = require("./metadata");
  993. var metadataVisitor = _interopRequireWildcard(_metadata);
  994. var _convertSourceMap = require("convert-source-map");
  995. var _convertSourceMap2 = _interopRequireDefault(_convertSourceMap);
  996. var _optionManager = require("./options/option-manager");
  997. var _optionManager2 = _interopRequireDefault(_optionManager);
  998. var _pluginPass = require("../plugin-pass");
  999. var _pluginPass2 = _interopRequireDefault(_pluginPass);
  1000. var _babelTraverse = require("babel-traverse");
  1001. var _babelTraverse2 = _interopRequireDefault(_babelTraverse);
  1002. var _sourceMap = require("source-map");
  1003. var _sourceMap2 = _interopRequireDefault(_sourceMap);
  1004. var _babelGenerator = require("babel-generator");
  1005. var _babelGenerator2 = _interopRequireDefault(_babelGenerator);
  1006. var _babelCodeFrame = require("babel-code-frame");
  1007. var _babelCodeFrame2 = _interopRequireDefault(_babelCodeFrame);
  1008. var _defaults = require("lodash/defaults");
  1009. var _defaults2 = _interopRequireDefault(_defaults);
  1010. var _logger = require("./logger");
  1011. var _logger2 = _interopRequireDefault(_logger);
  1012. var _store = require("../../store");
  1013. var _store2 = _interopRequireDefault(_store);
  1014. var _babylon = require("babylon");
  1015. var _util = require("../../util");
  1016. var util = _interopRequireWildcard(_util);
  1017. var _path = require("path");
  1018. var _path2 = _interopRequireDefault(_path);
  1019. var _babelTypes = require("babel-types");
  1020. var t = _interopRequireWildcard(_babelTypes);
  1021. var _resolve = require("../../helpers/resolve");
  1022. var _resolve2 = _interopRequireDefault(_resolve);
  1023. var _blockHoist = require("../internal-plugins/block-hoist");
  1024. var _blockHoist2 = _interopRequireDefault(_blockHoist);
  1025. var _shadowFunctions = require("../internal-plugins/shadow-functions");
  1026. var _shadowFunctions2 = _interopRequireDefault(_shadowFunctions);
  1027. 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; } }
  1028. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1029. var shebangRegex = /^#!.*/;
  1030. var INTERNAL_PLUGINS = [[_blockHoist2.default], [_shadowFunctions2.default]];
  1031. var errorVisitor = {
  1032. enter: function enter(path, state) {
  1033. var loc = path.node.loc;
  1034. if (loc) {
  1035. state.loc = loc;
  1036. path.stop();
  1037. }
  1038. }
  1039. };
  1040. var File = function (_Store) {
  1041. (0, _inherits3.default)(File, _Store);
  1042. function File() {
  1043. var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1044. var pipeline = arguments[1];
  1045. (0, _classCallCheck3.default)(this, File);
  1046. var _this = (0, _possibleConstructorReturn3.default)(this, _Store.call(this));
  1047. _this.pipeline = pipeline;
  1048. _this.log = new _logger2.default(_this, opts.filename || "unknown");
  1049. _this.opts = _this.initOptions(opts);
  1050. _this.parserOpts = {
  1051. sourceType: _this.opts.sourceType,
  1052. sourceFileName: _this.opts.filename,
  1053. plugins: []
  1054. };
  1055. _this.pluginVisitors = [];
  1056. _this.pluginPasses = [];
  1057. _this.buildPluginsForOptions(_this.opts);
  1058. if (_this.opts.passPerPreset) {
  1059. _this.perPresetOpts = [];
  1060. _this.opts.presets.forEach(function (presetOpts) {
  1061. var perPresetOpts = (0, _assign2.default)((0, _create2.default)(_this.opts), presetOpts);
  1062. _this.perPresetOpts.push(perPresetOpts);
  1063. _this.buildPluginsForOptions(perPresetOpts);
  1064. });
  1065. }
  1066. _this.metadata = {
  1067. usedHelpers: [],
  1068. marked: [],
  1069. modules: {
  1070. imports: [],
  1071. exports: {
  1072. exported: [],
  1073. specifiers: []
  1074. }
  1075. }
  1076. };
  1077. _this.dynamicImportTypes = {};
  1078. _this.dynamicImportIds = {};
  1079. _this.dynamicImports = [];
  1080. _this.declarations = {};
  1081. _this.usedHelpers = {};
  1082. _this.path = null;
  1083. _this.ast = {};
  1084. _this.code = "";
  1085. _this.shebang = "";
  1086. _this.hub = new _babelTraverse.Hub(_this);
  1087. return _this;
  1088. }
  1089. File.prototype.getMetadata = function getMetadata() {
  1090. var has = false;
  1091. for (var _iterator = this.ast.program.body, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  1092. var _ref;
  1093. if (_isArray) {
  1094. if (_i >= _iterator.length) break;
  1095. _ref = _iterator[_i++];
  1096. } else {
  1097. _i = _iterator.next();
  1098. if (_i.done) break;
  1099. _ref = _i.value;
  1100. }
  1101. var node = _ref;
  1102. if (t.isModuleDeclaration(node)) {
  1103. has = true;
  1104. break;
  1105. }
  1106. }
  1107. if (has) {
  1108. this.path.traverse(metadataVisitor, this);
  1109. }
  1110. };
  1111. File.prototype.initOptions = function initOptions(opts) {
  1112. opts = new _optionManager2.default(this.log, this.pipeline).init(opts);
  1113. if (opts.inputSourceMap) {
  1114. opts.sourceMaps = true;
  1115. }
  1116. if (opts.moduleId) {
  1117. opts.moduleIds = true;
  1118. }
  1119. opts.basename = _path2.default.basename(opts.filename, _path2.default.extname(opts.filename));
  1120. opts.ignore = util.arrayify(opts.ignore, util.regexify);
  1121. if (opts.only) opts.only = util.arrayify(opts.only, util.regexify);
  1122. (0, _defaults2.default)(opts, {
  1123. moduleRoot: opts.sourceRoot
  1124. });
  1125. (0, _defaults2.default)(opts, {
  1126. sourceRoot: opts.moduleRoot
  1127. });
  1128. (0, _defaults2.default)(opts, {
  1129. filenameRelative: opts.filename
  1130. });
  1131. var basenameRelative = _path2.default.basename(opts.filenameRelative);
  1132. (0, _defaults2.default)(opts, {
  1133. sourceFileName: basenameRelative,
  1134. sourceMapTarget: basenameRelative
  1135. });
  1136. return opts;
  1137. };
  1138. File.prototype.buildPluginsForOptions = function buildPluginsForOptions(opts) {
  1139. if (!Array.isArray(opts.plugins)) {
  1140. return;
  1141. }
  1142. var plugins = opts.plugins.concat(INTERNAL_PLUGINS);
  1143. var currentPluginVisitors = [];
  1144. var currentPluginPasses = [];
  1145. for (var _iterator2 = plugins, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  1146. var _ref2;
  1147. if (_isArray2) {
  1148. if (_i2 >= _iterator2.length) break;
  1149. _ref2 = _iterator2[_i2++];
  1150. } else {
  1151. _i2 = _iterator2.next();
  1152. if (_i2.done) break;
  1153. _ref2 = _i2.value;
  1154. }
  1155. var ref = _ref2;
  1156. var plugin = ref[0],
  1157. pluginOpts = ref[1];
  1158. currentPluginVisitors.push(plugin.visitor);
  1159. currentPluginPasses.push(new _pluginPass2.default(this, plugin, pluginOpts));
  1160. if (plugin.manipulateOptions) {
  1161. plugin.manipulateOptions(opts, this.parserOpts, this);
  1162. }
  1163. }
  1164. this.pluginVisitors.push(currentPluginVisitors);
  1165. this.pluginPasses.push(currentPluginPasses);
  1166. };
  1167. File.prototype.getModuleName = function getModuleName() {
  1168. var opts = this.opts;
  1169. if (!opts.moduleIds) {
  1170. return null;
  1171. }
  1172. if (opts.moduleId != null && !opts.getModuleId) {
  1173. return opts.moduleId;
  1174. }
  1175. var filenameRelative = opts.filenameRelative;
  1176. var moduleName = "";
  1177. if (opts.moduleRoot != null) {
  1178. moduleName = opts.moduleRoot + "/";
  1179. }
  1180. if (!opts.filenameRelative) {
  1181. return moduleName + opts.filename.replace(/^\//, "");
  1182. }
  1183. if (opts.sourceRoot != null) {
  1184. var sourceRootRegEx = new RegExp("^" + opts.sourceRoot + "\/?");
  1185. filenameRelative = filenameRelative.replace(sourceRootRegEx, "");
  1186. }
  1187. filenameRelative = filenameRelative.replace(/\.(\w*?)$/, "");
  1188. moduleName += filenameRelative;
  1189. moduleName = moduleName.replace(/\\/g, "/");
  1190. if (opts.getModuleId) {
  1191. return opts.getModuleId(moduleName) || moduleName;
  1192. } else {
  1193. return moduleName;
  1194. }
  1195. };
  1196. File.prototype.resolveModuleSource = function resolveModuleSource(source) {
  1197. var resolveModuleSource = this.opts.resolveModuleSource;
  1198. if (resolveModuleSource) source = resolveModuleSource(source, this.opts.filename);
  1199. return source;
  1200. };
  1201. File.prototype.addImport = function addImport(source, imported) {
  1202. var name = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : imported;
  1203. var alias = source + ":" + imported;
  1204. var id = this.dynamicImportIds[alias];
  1205. if (!id) {
  1206. source = this.resolveModuleSource(source);
  1207. id = this.dynamicImportIds[alias] = this.scope.generateUidIdentifier(name);
  1208. var specifiers = [];
  1209. if (imported === "*") {
  1210. specifiers.push(t.importNamespaceSpecifier(id));
  1211. } else if (imported === "default") {
  1212. specifiers.push(t.importDefaultSpecifier(id));
  1213. } else {
  1214. specifiers.push(t.importSpecifier(id, t.identifier(imported)));
  1215. }
  1216. var declar = t.importDeclaration(specifiers, t.stringLiteral(source));
  1217. declar._blockHoist = 3;
  1218. this.path.unshiftContainer("body", declar);
  1219. }
  1220. return id;
  1221. };
  1222. File.prototype.addHelper = function addHelper(name) {
  1223. var declar = this.declarations[name];
  1224. if (declar) return declar;
  1225. if (!this.usedHelpers[name]) {
  1226. this.metadata.usedHelpers.push(name);
  1227. this.usedHelpers[name] = true;
  1228. }
  1229. var generator = this.get("helperGenerator");
  1230. var runtime = this.get("helpersNamespace");
  1231. if (generator) {
  1232. var res = generator(name);
  1233. if (res) return res;
  1234. } else if (runtime) {
  1235. return t.memberExpression(runtime, t.identifier(name));
  1236. }
  1237. var ref = (0, _babelHelpers2.default)(name);
  1238. var uid = this.declarations[name] = this.scope.generateUidIdentifier(name);
  1239. if (t.isFunctionExpression(ref) && !ref.id) {
  1240. ref.body._compact = true;
  1241. ref._generated = true;
  1242. ref.id = uid;
  1243. ref.type = "FunctionDeclaration";
  1244. this.path.unshiftContainer("body", ref);
  1245. } else {
  1246. ref._compact = true;
  1247. this.scope.push({
  1248. id: uid,
  1249. init: ref,
  1250. unique: true
  1251. });
  1252. }
  1253. return uid;
  1254. };
  1255. File.prototype.addTemplateObject = function addTemplateObject(helperName, strings, raw) {
  1256. var stringIds = raw.elements.map(function (string) {
  1257. return string.value;
  1258. });
  1259. var name = helperName + "_" + raw.elements.length + "_" + stringIds.join(",");
  1260. var declar = this.declarations[name];
  1261. if (declar) return declar;
  1262. var uid = this.declarations[name] = this.scope.generateUidIdentifier("templateObject");
  1263. var helperId = this.addHelper(helperName);
  1264. var init = t.callExpression(helperId, [strings, raw]);
  1265. init._compact = true;
  1266. this.scope.push({
  1267. id: uid,
  1268. init: init,
  1269. _blockHoist: 1.9 });
  1270. return uid;
  1271. };
  1272. File.prototype.buildCodeFrameError = function buildCodeFrameError(node, msg) {
  1273. var Error = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : SyntaxError;
  1274. var loc = node && (node.loc || node._loc);
  1275. var err = new Error(msg);
  1276. if (loc) {
  1277. err.loc = loc.start;
  1278. } else {
  1279. (0, _babelTraverse2.default)(node, errorVisitor, this.scope, err);
  1280. err.message += " (This is an error on an internal node. Probably an internal error";
  1281. if (err.loc) {
  1282. err.message += ". Location has been estimated.";
  1283. }
  1284. err.message += ")";
  1285. }
  1286. return err;
  1287. };
  1288. File.prototype.mergeSourceMap = function mergeSourceMap(map) {
  1289. var inputMap = this.opts.inputSourceMap;
  1290. if (inputMap) {
  1291. var inputMapConsumer = new _sourceMap2.default.SourceMapConsumer(inputMap);
  1292. var outputMapConsumer = new _sourceMap2.default.SourceMapConsumer(map);
  1293. var mergedGenerator = new _sourceMap2.default.SourceMapGenerator({
  1294. file: inputMapConsumer.file,
  1295. sourceRoot: inputMapConsumer.sourceRoot
  1296. });
  1297. var source = outputMapConsumer.sources[0];
  1298. inputMapConsumer.eachMapping(function (mapping) {
  1299. var generatedPosition = outputMapConsumer.generatedPositionFor({
  1300. line: mapping.generatedLine,
  1301. column: mapping.generatedColumn,
  1302. source: source
  1303. });
  1304. if (generatedPosition.column != null) {
  1305. mergedGenerator.addMapping({
  1306. source: mapping.source,
  1307. original: mapping.source == null ? null : {
  1308. line: mapping.originalLine,
  1309. column: mapping.originalColumn
  1310. },
  1311. generated: generatedPosition
  1312. });
  1313. }
  1314. });
  1315. var mergedMap = mergedGenerator.toJSON();
  1316. inputMap.mappings = mergedMap.mappings;
  1317. return inputMap;
  1318. } else {
  1319. return map;
  1320. }
  1321. };
  1322. File.prototype.parse = function parse(code) {
  1323. var parseCode = _babylon.parse;
  1324. var parserOpts = this.opts.parserOpts;
  1325. if (parserOpts) {
  1326. parserOpts = (0, _assign2.default)({}, this.parserOpts, parserOpts);
  1327. if (parserOpts.parser) {
  1328. if (typeof parserOpts.parser === "string") {
  1329. var dirname = _path2.default.dirname(this.opts.filename) || process.cwd();
  1330. var parser = (0, _resolve2.default)(parserOpts.parser, dirname);
  1331. if (parser) {
  1332. parseCode = require(parser).parse;
  1333. } else {
  1334. throw new Error("Couldn't find parser " + parserOpts.parser + " with \"parse\" method " + ("relative to directory " + dirname));
  1335. }
  1336. } else {
  1337. parseCode = parserOpts.parser;
  1338. }
  1339. parserOpts.parser = {
  1340. parse: function parse(source) {
  1341. return (0, _babylon.parse)(source, parserOpts);
  1342. }
  1343. };
  1344. }
  1345. }
  1346. this.log.debug("Parse start");
  1347. var ast = parseCode(code, parserOpts || this.parserOpts);
  1348. this.log.debug("Parse stop");
  1349. return ast;
  1350. };
  1351. File.prototype._addAst = function _addAst(ast) {
  1352. this.path = _babelTraverse.NodePath.get({
  1353. hub: this.hub,
  1354. parentPath: null,
  1355. parent: ast,
  1356. container: ast,
  1357. key: "program"
  1358. }).setContext();
  1359. this.scope = this.path.scope;
  1360. this.ast = ast;
  1361. this.getMetadata();
  1362. };
  1363. File.prototype.addAst = function addAst(ast) {
  1364. this.log.debug("Start set AST");
  1365. this._addAst(ast);
  1366. this.log.debug("End set AST");
  1367. };
  1368. File.prototype.transform = function transform() {
  1369. for (var i = 0; i < this.pluginPasses.length; i++) {
  1370. var pluginPasses = this.pluginPasses[i];
  1371. this.call("pre", pluginPasses);
  1372. this.log.debug("Start transform traverse");
  1373. var visitor = _babelTraverse2.default.visitors.merge(this.pluginVisitors[i], pluginPasses, this.opts.wrapPluginVisitorMethod);
  1374. (0, _babelTraverse2.default)(this.ast, visitor, this.scope);
  1375. this.log.debug("End transform traverse");
  1376. this.call("post", pluginPasses);
  1377. }
  1378. return this.generate();
  1379. };
  1380. File.prototype.wrap = function wrap(code, callback) {
  1381. code = code + "";
  1382. try {
  1383. if (this.shouldIgnore()) {
  1384. return this.makeResult({ code: code, ignored: true });
  1385. } else {
  1386. return callback();
  1387. }
  1388. } catch (err) {
  1389. if (err._babel) {
  1390. throw err;
  1391. } else {
  1392. err._babel = true;
  1393. }
  1394. var message = err.message = this.opts.filename + ": " + err.message;
  1395. var loc = err.loc;
  1396. if (loc) {
  1397. err.codeFrame = (0, _babelCodeFrame2.default)(code, loc.line, loc.column + 1, this.opts);
  1398. message += "\n" + err.codeFrame;
  1399. }
  1400. if (process.browser) {
  1401. err.message = message;
  1402. }
  1403. if (err.stack) {
  1404. var newStack = err.stack.replace(err.message, message);
  1405. err.stack = newStack;
  1406. }
  1407. throw err;
  1408. }
  1409. };
  1410. File.prototype.addCode = function addCode(code) {
  1411. code = (code || "") + "";
  1412. code = this.parseInputSourceMap(code);
  1413. this.code = code;
  1414. };
  1415. File.prototype.parseCode = function parseCode() {
  1416. this.parseShebang();
  1417. var ast = this.parse(this.code);
  1418. this.addAst(ast);
  1419. };
  1420. File.prototype.shouldIgnore = function shouldIgnore() {
  1421. var opts = this.opts;
  1422. return util.shouldIgnore(opts.filename, opts.ignore, opts.only);
  1423. };
  1424. File.prototype.call = function call(key, pluginPasses) {
  1425. for (var _iterator3 = pluginPasses, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) {
  1426. var _ref3;
  1427. if (_isArray3) {
  1428. if (_i3 >= _iterator3.length) break;
  1429. _ref3 = _iterator3[_i3++];
  1430. } else {
  1431. _i3 = _iterator3.next();
  1432. if (_i3.done) break;
  1433. _ref3 = _i3.value;
  1434. }
  1435. var pass = _ref3;
  1436. var plugin = pass.plugin;
  1437. var fn = plugin[key];
  1438. if (fn) fn.call(pass, this);
  1439. }
  1440. };
  1441. File.prototype.parseInputSourceMap = function parseInputSourceMap(code) {
  1442. var opts = this.opts;
  1443. if (opts.inputSourceMap !== false) {
  1444. var inputMap = _convertSourceMap2.default.fromSource(code);
  1445. if (inputMap) {
  1446. opts.inputSourceMap = inputMap.toObject();
  1447. code = _convertSourceMap2.default.removeComments(code);
  1448. }
  1449. }
  1450. return code;
  1451. };
  1452. File.prototype.parseShebang = function parseShebang() {
  1453. var shebangMatch = shebangRegex.exec(this.code);
  1454. if (shebangMatch) {
  1455. this.shebang = shebangMatch[0];
  1456. this.code = this.code.replace(shebangRegex, "");
  1457. }
  1458. };
  1459. File.prototype.makeResult = function makeResult(_ref4) {
  1460. var code = _ref4.code,
  1461. map = _ref4.map,
  1462. ast = _ref4.ast,
  1463. ignored = _ref4.ignored;
  1464. var result = {
  1465. metadata: null,
  1466. options: this.opts,
  1467. ignored: !!ignored,
  1468. code: null,
  1469. ast: null,
  1470. map: map || null
  1471. };
  1472. if (this.opts.code) {
  1473. result.code = code;
  1474. }
  1475. if (this.opts.ast) {
  1476. result.ast = ast;
  1477. }
  1478. if (this.opts.metadata) {
  1479. result.metadata = this.metadata;
  1480. }
  1481. return result;
  1482. };
  1483. File.prototype.generate = function generate() {
  1484. var opts = this.opts;
  1485. var ast = this.ast;
  1486. var result = { ast: ast };
  1487. if (!opts.code) return this.makeResult(result);
  1488. var gen = _babelGenerator2.default;
  1489. if (opts.generatorOpts.generator) {
  1490. gen = opts.generatorOpts.generator;
  1491. if (typeof gen === "string") {
  1492. var dirname = _path2.default.dirname(this.opts.filename) || process.cwd();
  1493. var generator = (0, _resolve2.default)(gen, dirname);
  1494. if (generator) {
  1495. gen = require(generator).print;
  1496. } else {
  1497. throw new Error("Couldn't find generator " + gen + " with \"print\" method relative " + ("to directory " + dirname));
  1498. }
  1499. }
  1500. }
  1501. this.log.debug("Generation start");
  1502. var _result = gen(ast, opts.generatorOpts ? (0, _assign2.default)(opts, opts.generatorOpts) : opts, this.code);
  1503. result.code = _result.code;
  1504. result.map = _result.map;
  1505. this.log.debug("Generation end");
  1506. if (this.shebang) {
  1507. result.code = this.shebang + "\n" + result.code;
  1508. }
  1509. if (result.map) {
  1510. result.map = this.mergeSourceMap(result.map);
  1511. }
  1512. if (opts.sourceMaps === "inline" || opts.sourceMaps === "both") {
  1513. result.code += "\n" + _convertSourceMap2.default.fromObject(result.map).toComment();
  1514. }
  1515. if (opts.sourceMaps === "inline") {
  1516. result.map = null;
  1517. }
  1518. return this.makeResult(result);
  1519. };
  1520. return File;
  1521. }(_store2.default);
  1522. exports.default = File;
  1523. exports.File = File;
  1524. }).call(this,require('_process'))
  1525. },{"../../helpers/resolve":14,"../../store":15,"../../util":31,"../internal-plugins/block-hoist":26,"../internal-plugins/shadow-functions":27,"../plugin-pass":29,"./logger":18,"./metadata":19,"./options/option-manager":23,"_process":525,"babel-code-frame":4,"babel-generator":44,"babel-helpers":60,"babel-runtime/core-js/get-iterator":95,"babel-runtime/core-js/object/assign":99,"babel-runtime/core-js/object/create":100,"babel-runtime/helpers/classCallCheck":109,"babel-runtime/helpers/inherits":110,"babel-runtime/helpers/possibleConstructorReturn":112,"babel-traverse":118,"babel-types":151,"babylon":155,"convert-source-map":163,"lodash/defaults":470,"path":522,"source-map":552}],18:[function(require,module,exports){
  1526. "use strict";
  1527. exports.__esModule = true;
  1528. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  1529. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  1530. var _node = require("debug/node");
  1531. var _node2 = _interopRequireDefault(_node);
  1532. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1533. var verboseDebug = (0, _node2.default)("babel:verbose");
  1534. var generalDebug = (0, _node2.default)("babel");
  1535. var seenDeprecatedMessages = [];
  1536. var Logger = function () {
  1537. function Logger(file, filename) {
  1538. (0, _classCallCheck3.default)(this, Logger);
  1539. this.filename = filename;
  1540. this.file = file;
  1541. }
  1542. Logger.prototype._buildMessage = function _buildMessage(msg) {
  1543. var parts = "[BABEL] " + this.filename;
  1544. if (msg) parts += ": " + msg;
  1545. return parts;
  1546. };
  1547. Logger.prototype.warn = function warn(msg) {
  1548. console.warn(this._buildMessage(msg));
  1549. };
  1550. Logger.prototype.error = function error(msg) {
  1551. var Constructor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Error;
  1552. throw new Constructor(this._buildMessage(msg));
  1553. };
  1554. Logger.prototype.deprecate = function deprecate(msg) {
  1555. if (this.file.opts && this.file.opts.suppressDeprecationMessages) return;
  1556. msg = this._buildMessage(msg);
  1557. if (seenDeprecatedMessages.indexOf(msg) >= 0) return;
  1558. seenDeprecatedMessages.push(msg);
  1559. console.error(msg);
  1560. };
  1561. Logger.prototype.verbose = function verbose(msg) {
  1562. if (verboseDebug.enabled) verboseDebug(this._buildMessage(msg));
  1563. };
  1564. Logger.prototype.debug = function debug(msg) {
  1565. if (generalDebug.enabled) generalDebug(this._buildMessage(msg));
  1566. };
  1567. Logger.prototype.deopt = function deopt(node, msg) {
  1568. this.debug(msg);
  1569. };
  1570. return Logger;
  1571. }();
  1572. exports.default = Logger;
  1573. module.exports = exports["default"];
  1574. },{"babel-runtime/helpers/classCallCheck":109,"debug/node":278}],19:[function(require,module,exports){
  1575. "use strict";
  1576. exports.__esModule = true;
  1577. exports.ImportDeclaration = exports.ModuleDeclaration = undefined;
  1578. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  1579. var _getIterator3 = _interopRequireDefault(_getIterator2);
  1580. exports.ExportDeclaration = ExportDeclaration;
  1581. exports.Scope = Scope;
  1582. var _babelTypes = require("babel-types");
  1583. var t = _interopRequireWildcard(_babelTypes);
  1584. 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; } }
  1585. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1586. var ModuleDeclaration = exports.ModuleDeclaration = {
  1587. enter: function enter(path, file) {
  1588. var node = path.node;
  1589. if (node.source) {
  1590. node.source.value = file.resolveModuleSource(node.source.value);
  1591. }
  1592. }
  1593. };
  1594. var ImportDeclaration = exports.ImportDeclaration = {
  1595. exit: function exit(path, file) {
  1596. var node = path.node;
  1597. var specifiers = [];
  1598. var imported = [];
  1599. file.metadata.modules.imports.push({
  1600. source: node.source.value,
  1601. imported: imported,
  1602. specifiers: specifiers
  1603. });
  1604. for (var _iterator = path.get("specifiers"), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  1605. var _ref;
  1606. if (_isArray) {
  1607. if (_i >= _iterator.length) break;
  1608. _ref = _iterator[_i++];
  1609. } else {
  1610. _i = _iterator.next();
  1611. if (_i.done) break;
  1612. _ref = _i.value;
  1613. }
  1614. var specifier = _ref;
  1615. var local = specifier.node.local.name;
  1616. if (specifier.isImportDefaultSpecifier()) {
  1617. imported.push("default");
  1618. specifiers.push({
  1619. kind: "named",
  1620. imported: "default",
  1621. local: local
  1622. });
  1623. }
  1624. if (specifier.isImportSpecifier()) {
  1625. var importedName = specifier.node.imported.name;
  1626. imported.push(importedName);
  1627. specifiers.push({
  1628. kind: "named",
  1629. imported: importedName,
  1630. local: local
  1631. });
  1632. }
  1633. if (specifier.isImportNamespaceSpecifier()) {
  1634. imported.push("*");
  1635. specifiers.push({
  1636. kind: "namespace",
  1637. local: local
  1638. });
  1639. }
  1640. }
  1641. }
  1642. };
  1643. function ExportDeclaration(path, file) {
  1644. var node = path.node;
  1645. var source = node.source ? node.source.value : null;
  1646. var exports = file.metadata.modules.exports;
  1647. var declar = path.get("declaration");
  1648. if (declar.isStatement()) {
  1649. var bindings = declar.getBindingIdentifiers();
  1650. for (var name in bindings) {
  1651. exports.exported.push(name);
  1652. exports.specifiers.push({
  1653. kind: "local",
  1654. local: name,
  1655. exported: path.isExportDefaultDeclaration() ? "default" : name
  1656. });
  1657. }
  1658. }
  1659. if (path.isExportNamedDeclaration() && node.specifiers) {
  1660. for (var _iterator2 = node.specifiers, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  1661. var _ref2;
  1662. if (_isArray2) {
  1663. if (_i2 >= _iterator2.length) break;
  1664. _ref2 = _iterator2[_i2++];
  1665. } else {
  1666. _i2 = _iterator2.next();
  1667. if (_i2.done) break;
  1668. _ref2 = _i2.value;
  1669. }
  1670. var specifier = _ref2;
  1671. var exported = specifier.exported.name;
  1672. exports.exported.push(exported);
  1673. if (t.isExportDefaultSpecifier(specifier)) {
  1674. exports.specifiers.push({
  1675. kind: "external",
  1676. local: exported,
  1677. exported: exported,
  1678. source: source
  1679. });
  1680. }
  1681. if (t.isExportNamespaceSpecifier(specifier)) {
  1682. exports.specifiers.push({
  1683. kind: "external-namespace",
  1684. exported: exported,
  1685. source: source
  1686. });
  1687. }
  1688. var local = specifier.local;
  1689. if (!local) continue;
  1690. if (source) {
  1691. exports.specifiers.push({
  1692. kind: "external",
  1693. local: local.name,
  1694. exported: exported,
  1695. source: source
  1696. });
  1697. }
  1698. if (!source) {
  1699. exports.specifiers.push({
  1700. kind: "local",
  1701. local: local.name,
  1702. exported: exported
  1703. });
  1704. }
  1705. }
  1706. }
  1707. if (path.isExportAllDeclaration()) {
  1708. exports.specifiers.push({
  1709. kind: "external-all",
  1710. source: source
  1711. });
  1712. }
  1713. }
  1714. function Scope(path) {
  1715. path.skip();
  1716. }
  1717. },{"babel-runtime/core-js/get-iterator":95,"babel-types":151}],20:[function(require,module,exports){
  1718. (function (process){
  1719. "use strict";
  1720. exports.__esModule = true;
  1721. var _assign = require("babel-runtime/core-js/object/assign");
  1722. var _assign2 = _interopRequireDefault(_assign);
  1723. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  1724. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  1725. exports.default = buildConfigChain;
  1726. var _resolve = require("../../../helpers/resolve");
  1727. var _resolve2 = _interopRequireDefault(_resolve);
  1728. var _json = require("json5");
  1729. var _json2 = _interopRequireDefault(_json);
  1730. var _pathIsAbsolute = require("path-is-absolute");
  1731. var _pathIsAbsolute2 = _interopRequireDefault(_pathIsAbsolute);
  1732. var _path = require("path");
  1733. var _path2 = _interopRequireDefault(_path);
  1734. var _fs = require("fs");
  1735. var _fs2 = _interopRequireDefault(_fs);
  1736. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1737. var existsCache = {};
  1738. var jsonCache = {};
  1739. var BABELIGNORE_FILENAME = ".babelignore";
  1740. var BABELRC_FILENAME = ".babelrc";
  1741. var PACKAGE_FILENAME = "package.json";
  1742. function exists(filename) {
  1743. var cached = existsCache[filename];
  1744. if (cached == null) {
  1745. return existsCache[filename] = _fs2.default.existsSync(filename);
  1746. } else {
  1747. return cached;
  1748. }
  1749. }
  1750. function buildConfigChain() {
  1751. var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1752. var log = arguments[1];
  1753. var filename = opts.filename;
  1754. var builder = new ConfigChainBuilder(log);
  1755. if (opts.babelrc !== false) {
  1756. builder.findConfigs(filename);
  1757. }
  1758. builder.mergeConfig({
  1759. options: opts,
  1760. alias: "base",
  1761. dirname: filename && _path2.default.dirname(filename)
  1762. });
  1763. return builder.configs;
  1764. }
  1765. var ConfigChainBuilder = function () {
  1766. function ConfigChainBuilder(log) {
  1767. (0, _classCallCheck3.default)(this, ConfigChainBuilder);
  1768. this.resolvedConfigs = [];
  1769. this.configs = [];
  1770. this.log = log;
  1771. }
  1772. ConfigChainBuilder.prototype.findConfigs = function findConfigs(loc) {
  1773. if (!loc) return;
  1774. if (!(0, _pathIsAbsolute2.default)(loc)) {
  1775. loc = _path2.default.join(process.cwd(), loc);
  1776. }
  1777. var foundConfig = false;
  1778. var foundIgnore = false;
  1779. while (loc !== (loc = _path2.default.dirname(loc))) {
  1780. if (!foundConfig) {
  1781. var configLoc = _path2.default.join(loc, BABELRC_FILENAME);
  1782. if (exists(configLoc)) {
  1783. this.addConfig(configLoc);
  1784. foundConfig = true;
  1785. }
  1786. var pkgLoc = _path2.default.join(loc, PACKAGE_FILENAME);
  1787. if (!foundConfig && exists(pkgLoc)) {
  1788. foundConfig = this.addConfig(pkgLoc, "babel", JSON);
  1789. }
  1790. }
  1791. if (!foundIgnore) {
  1792. var ignoreLoc = _path2.default.join(loc, BABELIGNORE_FILENAME);
  1793. if (exists(ignoreLoc)) {
  1794. this.addIgnoreConfig(ignoreLoc);
  1795. foundIgnore = true;
  1796. }
  1797. }
  1798. if (foundIgnore && foundConfig) return;
  1799. }
  1800. };
  1801. ConfigChainBuilder.prototype.addIgnoreConfig = function addIgnoreConfig(loc) {
  1802. var file = _fs2.default.readFileSync(loc, "utf8");
  1803. var lines = file.split("\n");
  1804. lines = lines.map(function (line) {
  1805. return line.replace(/#(.*?)$/, "").trim();
  1806. }).filter(function (line) {
  1807. return !!line;
  1808. });
  1809. if (lines.length) {
  1810. this.mergeConfig({
  1811. options: { ignore: lines },
  1812. alias: loc,
  1813. dirname: _path2.default.dirname(loc)
  1814. });
  1815. }
  1816. };
  1817. ConfigChainBuilder.prototype.addConfig = function addConfig(loc, key) {
  1818. var json = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _json2.default;
  1819. if (this.resolvedConfigs.indexOf(loc) >= 0) {
  1820. return false;
  1821. }
  1822. this.resolvedConfigs.push(loc);
  1823. var content = _fs2.default.readFileSync(loc, "utf8");
  1824. var options = void 0;
  1825. try {
  1826. options = jsonCache[content] = jsonCache[content] || json.parse(content);
  1827. if (key) options = options[key];
  1828. } catch (err) {
  1829. err.message = loc + ": Error while parsing JSON - " + err.message;
  1830. throw err;
  1831. }
  1832. this.mergeConfig({
  1833. options: options,
  1834. alias: loc,
  1835. dirname: _path2.default.dirname(loc)
  1836. });
  1837. return !!options;
  1838. };
  1839. ConfigChainBuilder.prototype.mergeConfig = function mergeConfig(_ref) {
  1840. var options = _ref.options,
  1841. alias = _ref.alias,
  1842. loc = _ref.loc,
  1843. dirname = _ref.dirname;
  1844. if (!options) {
  1845. return false;
  1846. }
  1847. options = (0, _assign2.default)({}, options);
  1848. dirname = dirname || process.cwd();
  1849. loc = loc || alias;
  1850. if (options.extends) {
  1851. var extendsLoc = (0, _resolve2.default)(options.extends, dirname);
  1852. if (extendsLoc) {
  1853. this.addConfig(extendsLoc);
  1854. } else {
  1855. if (this.log) this.log.error("Couldn't resolve extends clause of " + options.extends + " in " + alias);
  1856. }
  1857. delete options.extends;
  1858. }
  1859. this.configs.push({
  1860. options: options,
  1861. alias: alias,
  1862. loc: loc,
  1863. dirname: dirname
  1864. });
  1865. var envOpts = void 0;
  1866. var envKey = process.env.BABEL_ENV || process.env.NODE_ENV || "development";
  1867. if (options.env) {
  1868. envOpts = options.env[envKey];
  1869. delete options.env;
  1870. }
  1871. this.mergeConfig({
  1872. options: envOpts,
  1873. alias: alias + ".env." + envKey,
  1874. dirname: dirname
  1875. });
  1876. };
  1877. return ConfigChainBuilder;
  1878. }();
  1879. module.exports = exports["default"];
  1880. }).call(this,require('_process'))
  1881. },{"../../../helpers/resolve":14,"_process":525,"babel-runtime/core-js/object/assign":99,"babel-runtime/helpers/classCallCheck":109,"fs":159,"json5":297,"path":522,"path-is-absolute":523}],21:[function(require,module,exports){
  1882. "use strict";
  1883. module.exports = {
  1884. filename: {
  1885. type: "filename",
  1886. description: "filename to use when reading from stdin - this will be used in source-maps, errors etc",
  1887. default: "unknown",
  1888. shorthand: "f"
  1889. },
  1890. filenameRelative: {
  1891. hidden: true,
  1892. type: "string"
  1893. },
  1894. inputSourceMap: {
  1895. hidden: true
  1896. },
  1897. env: {
  1898. hidden: true,
  1899. default: {}
  1900. },
  1901. mode: {
  1902. description: "",
  1903. hidden: true
  1904. },
  1905. retainLines: {
  1906. type: "boolean",
  1907. default: false,
  1908. description: "retain line numbers - will result in really ugly code"
  1909. },
  1910. highlightCode: {
  1911. description: "enable/disable ANSI syntax highlighting of code frames (on by default)",
  1912. type: "boolean",
  1913. default: true
  1914. },
  1915. suppressDeprecationMessages: {
  1916. type: "boolean",
  1917. default: false,
  1918. hidden: true
  1919. },
  1920. presets: {
  1921. type: "list",
  1922. description: "",
  1923. default: []
  1924. },
  1925. plugins: {
  1926. type: "list",
  1927. default: [],
  1928. description: ""
  1929. },
  1930. ignore: {
  1931. type: "list",
  1932. description: "list of glob paths to **not** compile",
  1933. default: []
  1934. },
  1935. only: {
  1936. type: "list",
  1937. description: "list of glob paths to **only** compile"
  1938. },
  1939. code: {
  1940. hidden: true,
  1941. default: true,
  1942. type: "boolean"
  1943. },
  1944. metadata: {
  1945. hidden: true,
  1946. default: true,
  1947. type: "boolean"
  1948. },
  1949. ast: {
  1950. hidden: true,
  1951. default: true,
  1952. type: "boolean"
  1953. },
  1954. extends: {
  1955. type: "string",
  1956. hidden: true
  1957. },
  1958. comments: {
  1959. type: "boolean",
  1960. default: true,
  1961. description: "write comments to generated output (true by default)"
  1962. },
  1963. shouldPrintComment: {
  1964. hidden: true,
  1965. description: "optional callback to control whether a comment should be inserted, when this is used the comments option is ignored"
  1966. },
  1967. wrapPluginVisitorMethod: {
  1968. hidden: true,
  1969. description: "optional callback to wrap all visitor methods"
  1970. },
  1971. compact: {
  1972. type: "booleanString",
  1973. default: "auto",
  1974. description: "do not include superfluous whitespace characters and line terminators [true|false|auto]"
  1975. },
  1976. minified: {
  1977. type: "boolean",
  1978. default: false,
  1979. description: "save as much bytes when printing [true|false]"
  1980. },
  1981. sourceMap: {
  1982. alias: "sourceMaps",
  1983. hidden: true
  1984. },
  1985. sourceMaps: {
  1986. type: "booleanString",
  1987. description: "[true|false|inline]",
  1988. default: false,
  1989. shorthand: "s"
  1990. },
  1991. sourceMapTarget: {
  1992. type: "string",
  1993. description: "set `file` on returned source map"
  1994. },
  1995. sourceFileName: {
  1996. type: "string",
  1997. description: "set `sources[0]` on returned source map"
  1998. },
  1999. sourceRoot: {
  2000. type: "filename",
  2001. description: "the root from which all sources are relative"
  2002. },
  2003. babelrc: {
  2004. description: "Whether or not to look up .babelrc and .babelignore files",
  2005. type: "boolean",
  2006. default: true
  2007. },
  2008. sourceType: {
  2009. description: "",
  2010. default: "module"
  2011. },
  2012. auxiliaryCommentBefore: {
  2013. type: "string",
  2014. description: "print a comment before any injected non-user code"
  2015. },
  2016. auxiliaryCommentAfter: {
  2017. type: "string",
  2018. description: "print a comment after any injected non-user code"
  2019. },
  2020. resolveModuleSource: {
  2021. hidden: true
  2022. },
  2023. getModuleId: {
  2024. hidden: true
  2025. },
  2026. moduleRoot: {
  2027. type: "filename",
  2028. description: "optional prefix for the AMD module formatter that will be prepend to the filename on module definitions"
  2029. },
  2030. moduleIds: {
  2031. type: "boolean",
  2032. default: false,
  2033. shorthand: "M",
  2034. description: "insert an explicit id for modules"
  2035. },
  2036. moduleId: {
  2037. description: "specify a custom name for module ids",
  2038. type: "string"
  2039. },
  2040. passPerPreset: {
  2041. description: "Whether to spawn a traversal pass per a preset. By default all presets are merged.",
  2042. type: "boolean",
  2043. default: false,
  2044. hidden: true
  2045. },
  2046. parserOpts: {
  2047. description: "Options to pass into the parser, or to change parsers (parserOpts.parser)",
  2048. default: false
  2049. },
  2050. generatorOpts: {
  2051. description: "Options to pass into the generator, or to change generators (generatorOpts.generator)",
  2052. default: false
  2053. }
  2054. };
  2055. },{}],22:[function(require,module,exports){
  2056. "use strict";
  2057. exports.__esModule = true;
  2058. exports.config = undefined;
  2059. exports.normaliseOptions = normaliseOptions;
  2060. var _parsers = require("./parsers");
  2061. var parsers = _interopRequireWildcard(_parsers);
  2062. var _config = require("./config");
  2063. var _config2 = _interopRequireDefault(_config);
  2064. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2065. 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; } }
  2066. exports.config = _config2.default;
  2067. function normaliseOptions() {
  2068. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  2069. for (var key in options) {
  2070. var val = options[key];
  2071. if (val == null) continue;
  2072. var opt = _config2.default[key];
  2073. if (opt && opt.alias) opt = _config2.default[opt.alias];
  2074. if (!opt) continue;
  2075. var parser = parsers[opt.type];
  2076. if (parser) val = parser(val);
  2077. options[key] = val;
  2078. }
  2079. return options;
  2080. }
  2081. },{"./config":21,"./parsers":24}],23:[function(require,module,exports){
  2082. (function (process){
  2083. "use strict";
  2084. exports.__esModule = true;
  2085. var _objectWithoutProperties2 = require("babel-runtime/helpers/objectWithoutProperties");
  2086. var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
  2087. var _stringify = require("babel-runtime/core-js/json/stringify");
  2088. var _stringify2 = _interopRequireDefault(_stringify);
  2089. var _assign = require("babel-runtime/core-js/object/assign");
  2090. var _assign2 = _interopRequireDefault(_assign);
  2091. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  2092. var _getIterator3 = _interopRequireDefault(_getIterator2);
  2093. var _typeof2 = require("babel-runtime/helpers/typeof");
  2094. var _typeof3 = _interopRequireDefault(_typeof2);
  2095. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  2096. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  2097. var _node = require("../../../api/node");
  2098. var context = _interopRequireWildcard(_node);
  2099. var _plugin2 = require("../../plugin");
  2100. var _plugin3 = _interopRequireDefault(_plugin2);
  2101. var _babelMessages = require("babel-messages");
  2102. var messages = _interopRequireWildcard(_babelMessages);
  2103. var _index = require("./index");
  2104. var _resolvePlugin = require("../../../helpers/resolve-plugin");
  2105. var _resolvePlugin2 = _interopRequireDefault(_resolvePlugin);
  2106. var _resolvePreset = require("../../../helpers/resolve-preset");
  2107. var _resolvePreset2 = _interopRequireDefault(_resolvePreset);
  2108. var _cloneDeepWith = require("lodash/cloneDeepWith");
  2109. var _cloneDeepWith2 = _interopRequireDefault(_cloneDeepWith);
  2110. var _clone = require("lodash/clone");
  2111. var _clone2 = _interopRequireDefault(_clone);
  2112. var _merge = require("../../../helpers/merge");
  2113. var _merge2 = _interopRequireDefault(_merge);
  2114. var _config2 = require("./config");
  2115. var _config3 = _interopRequireDefault(_config2);
  2116. var _removed = require("./removed");
  2117. var _removed2 = _interopRequireDefault(_removed);
  2118. var _buildConfigChain = require("./build-config-chain");
  2119. var _buildConfigChain2 = _interopRequireDefault(_buildConfigChain);
  2120. var _path = require("path");
  2121. var _path2 = _interopRequireDefault(_path);
  2122. 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; } }
  2123. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2124. var OptionManager = function () {
  2125. function OptionManager(log) {
  2126. (0, _classCallCheck3.default)(this, OptionManager);
  2127. this.resolvedConfigs = [];
  2128. this.options = OptionManager.createBareOptions();
  2129. this.log = log;
  2130. }
  2131. OptionManager.memoisePluginContainer = function memoisePluginContainer(fn, loc, i, alias) {
  2132. for (var _iterator = OptionManager.memoisedPlugins, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  2133. var _ref;
  2134. if (_isArray) {
  2135. if (_i >= _iterator.length) break;
  2136. _ref = _iterator[_i++];
  2137. } else {
  2138. _i = _iterator.next();
  2139. if (_i.done) break;
  2140. _ref = _i.value;
  2141. }
  2142. var cache = _ref;
  2143. if (cache.container === fn) return cache.plugin;
  2144. }
  2145. var obj = void 0;
  2146. if (typeof fn === "function") {
  2147. obj = fn(context);
  2148. } else {
  2149. obj = fn;
  2150. }
  2151. if ((typeof obj === "undefined" ? "undefined" : (0, _typeof3.default)(obj)) === "object") {
  2152. var _plugin = new _plugin3.default(obj, alias);
  2153. OptionManager.memoisedPlugins.push({
  2154. container: fn,
  2155. plugin: _plugin
  2156. });
  2157. return _plugin;
  2158. } else {
  2159. throw new TypeError(messages.get("pluginNotObject", loc, i, typeof obj === "undefined" ? "undefined" : (0, _typeof3.default)(obj)) + loc + i);
  2160. }
  2161. };
  2162. OptionManager.createBareOptions = function createBareOptions() {
  2163. var opts = {};
  2164. for (var _key in _config3.default) {
  2165. var opt = _config3.default[_key];
  2166. opts[_key] = (0, _clone2.default)(opt.default);
  2167. }
  2168. return opts;
  2169. };
  2170. OptionManager.normalisePlugin = function normalisePlugin(plugin, loc, i, alias) {
  2171. plugin = plugin.__esModule ? plugin.default : plugin;
  2172. if (!(plugin instanceof _plugin3.default)) {
  2173. if (typeof plugin === "function" || (typeof plugin === "undefined" ? "undefined" : (0, _typeof3.default)(plugin)) === "object") {
  2174. plugin = OptionManager.memoisePluginContainer(plugin, loc, i, alias);
  2175. } else {
  2176. throw new TypeError(messages.get("pluginNotFunction", loc, i, typeof plugin === "undefined" ? "undefined" : (0, _typeof3.default)(plugin)));
  2177. }
  2178. }
  2179. plugin.init(loc, i);
  2180. return plugin;
  2181. };
  2182. OptionManager.normalisePlugins = function normalisePlugins(loc, dirname, plugins) {
  2183. return plugins.map(function (val, i) {
  2184. var plugin = void 0,
  2185. options = void 0;
  2186. if (!val) {
  2187. throw new TypeError("Falsy value found in plugins");
  2188. }
  2189. if (Array.isArray(val)) {
  2190. plugin = val[0];
  2191. options = val[1];
  2192. } else {
  2193. plugin = val;
  2194. }
  2195. var alias = typeof plugin === "string" ? plugin : loc + "$" + i;
  2196. if (typeof plugin === "string") {
  2197. var pluginLoc = (0, _resolvePlugin2.default)(plugin, dirname);
  2198. if (pluginLoc) {
  2199. plugin = require(pluginLoc);
  2200. } else {
  2201. throw new ReferenceError(messages.get("pluginUnknown", plugin, loc, i, dirname));
  2202. }
  2203. }
  2204. plugin = OptionManager.normalisePlugin(plugin, loc, i, alias);
  2205. return [plugin, options];
  2206. });
  2207. };
  2208. OptionManager.prototype.mergeOptions = function mergeOptions(_ref2) {
  2209. var _this = this;
  2210. var rawOpts = _ref2.options,
  2211. extendingOpts = _ref2.extending,
  2212. alias = _ref2.alias,
  2213. loc = _ref2.loc,
  2214. dirname = _ref2.dirname;
  2215. alias = alias || "foreign";
  2216. if (!rawOpts) return;
  2217. if ((typeof rawOpts === "undefined" ? "undefined" : (0, _typeof3.default)(rawOpts)) !== "object" || Array.isArray(rawOpts)) {
  2218. this.log.error("Invalid options type for " + alias, TypeError);
  2219. }
  2220. var opts = (0, _cloneDeepWith2.default)(rawOpts, function (val) {
  2221. if (val instanceof _plugin3.default) {
  2222. return val;
  2223. }
  2224. });
  2225. dirname = dirname || process.cwd();
  2226. loc = loc || alias;
  2227. for (var _key2 in opts) {
  2228. var option = _config3.default[_key2];
  2229. if (!option && this.log) {
  2230. if (_removed2.default[_key2]) {
  2231. this.log.error("Using removed Babel 5 option: " + alias + "." + _key2 + " - " + _removed2.default[_key2].message, ReferenceError);
  2232. } else {
  2233. var unknownOptErr = "Unknown option: " + alias + "." + _key2 + ". Check out http://babeljs.io/docs/usage/options/ for more information about options.";
  2234. 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.";
  2235. this.log.error(unknownOptErr + "\n\n" + presetConfigErr, ReferenceError);
  2236. }
  2237. }
  2238. }
  2239. (0, _index.normaliseOptions)(opts);
  2240. if (opts.plugins) {
  2241. opts.plugins = OptionManager.normalisePlugins(loc, dirname, opts.plugins);
  2242. }
  2243. if (opts.presets) {
  2244. if (opts.passPerPreset) {
  2245. opts.presets = this.resolvePresets(opts.presets, dirname, function (preset, presetLoc) {
  2246. _this.mergeOptions({
  2247. options: preset,
  2248. extending: preset,
  2249. alias: presetLoc,
  2250. loc: presetLoc,
  2251. dirname: dirname
  2252. });
  2253. });
  2254. } else {
  2255. this.mergePresets(opts.presets, dirname);
  2256. delete opts.presets;
  2257. }
  2258. }
  2259. if (rawOpts === extendingOpts) {
  2260. (0, _assign2.default)(extendingOpts, opts);
  2261. } else {
  2262. (0, _merge2.default)(extendingOpts || this.options, opts);
  2263. }
  2264. };
  2265. OptionManager.prototype.mergePresets = function mergePresets(presets, dirname) {
  2266. var _this2 = this;
  2267. this.resolvePresets(presets, dirname, function (presetOpts, presetLoc) {
  2268. _this2.mergeOptions({
  2269. options: presetOpts,
  2270. alias: presetLoc,
  2271. loc: presetLoc,
  2272. dirname: _path2.default.dirname(presetLoc || "")
  2273. });
  2274. });
  2275. };
  2276. OptionManager.prototype.resolvePresets = function resolvePresets(presets, dirname, onResolve) {
  2277. return presets.map(function (val) {
  2278. var options = void 0;
  2279. if (Array.isArray(val)) {
  2280. if (val.length > 2) {
  2281. throw new Error("Unexpected extra options " + (0, _stringify2.default)(val.slice(2)) + " passed to preset.");
  2282. }
  2283. var _val = val;
  2284. val = _val[0];
  2285. options = _val[1];
  2286. }
  2287. var presetLoc = void 0;
  2288. try {
  2289. if (typeof val === "string") {
  2290. presetLoc = (0, _resolvePreset2.default)(val, dirname);
  2291. if (!presetLoc) {
  2292. throw new Error("Couldn't find preset " + (0, _stringify2.default)(val) + " relative to directory " + (0, _stringify2.default)(dirname));
  2293. }
  2294. val = require(presetLoc);
  2295. }
  2296. if ((typeof val === "undefined" ? "undefined" : (0, _typeof3.default)(val)) === "object" && val.__esModule) {
  2297. if (val.default) {
  2298. val = val.default;
  2299. } else {
  2300. var _val2 = val,
  2301. __esModule = _val2.__esModule,
  2302. rest = (0, _objectWithoutProperties3.default)(_val2, ["__esModule"]);
  2303. val = rest;
  2304. }
  2305. }
  2306. if ((typeof val === "undefined" ? "undefined" : (0, _typeof3.default)(val)) === "object" && val.buildPreset) val = val.buildPreset;
  2307. if (typeof val !== "function" && options !== undefined) {
  2308. throw new Error("Options " + (0, _stringify2.default)(options) + " passed to " + (presetLoc || "a preset") + " which does not accept options.");
  2309. }
  2310. if (typeof val === "function") val = val(context, options, { dirname: dirname });
  2311. if ((typeof val === "undefined" ? "undefined" : (0, _typeof3.default)(val)) !== "object") {
  2312. throw new Error("Unsupported preset format: " + val + ".");
  2313. }
  2314. onResolve && onResolve(val, presetLoc);
  2315. } catch (e) {
  2316. if (presetLoc) {
  2317. e.message += " (While processing preset: " + (0, _stringify2.default)(presetLoc) + ")";
  2318. }
  2319. throw e;
  2320. }
  2321. return val;
  2322. });
  2323. };
  2324. OptionManager.prototype.normaliseOptions = function normaliseOptions() {
  2325. var opts = this.options;
  2326. for (var _key3 in _config3.default) {
  2327. var option = _config3.default[_key3];
  2328. var val = opts[_key3];
  2329. if (!val && option.optional) continue;
  2330. if (option.alias) {
  2331. opts[option.alias] = opts[option.alias] || val;
  2332. } else {
  2333. opts[_key3] = val;
  2334. }
  2335. }
  2336. };
  2337. OptionManager.prototype.init = function init() {
  2338. var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  2339. for (var _iterator2 = (0, _buildConfigChain2.default)(opts, this.log), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  2340. var _ref3;
  2341. if (_isArray2) {
  2342. if (_i2 >= _iterator2.length) break;
  2343. _ref3 = _iterator2[_i2++];
  2344. } else {
  2345. _i2 = _iterator2.next();
  2346. if (_i2.done) break;
  2347. _ref3 = _i2.value;
  2348. }
  2349. var _config = _ref3;
  2350. this.mergeOptions(_config);
  2351. }
  2352. this.normaliseOptions(opts);
  2353. return this.options;
  2354. };
  2355. return OptionManager;
  2356. }();
  2357. exports.default = OptionManager;
  2358. OptionManager.memoisedPlugins = [];
  2359. module.exports = exports["default"];
  2360. }).call(this,require('_process'))
  2361. },{"../../../api/node":6,"../../../helpers/merge":9,"../../../helpers/resolve-plugin":12,"../../../helpers/resolve-preset":13,"../../plugin":30,"./build-config-chain":20,"./config":21,"./index":22,"./removed":25,"_process":525,"babel-messages":61,"babel-runtime/core-js/get-iterator":95,"babel-runtime/core-js/json/stringify":96,"babel-runtime/core-js/object/assign":99,"babel-runtime/helpers/classCallCheck":109,"babel-runtime/helpers/objectWithoutProperties":111,"babel-runtime/helpers/typeof":113,"lodash/clone":466,"lodash/cloneDeepWith":468,"path":522}],24:[function(require,module,exports){
  2362. "use strict";
  2363. exports.__esModule = true;
  2364. exports.filename = undefined;
  2365. exports.boolean = boolean;
  2366. exports.booleanString = booleanString;
  2367. exports.list = list;
  2368. var _slash = require("slash");
  2369. var _slash2 = _interopRequireDefault(_slash);
  2370. var _util = require("../../../util");
  2371. var util = _interopRequireWildcard(_util);
  2372. 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; } }
  2373. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2374. var filename = exports.filename = _slash2.default;
  2375. function boolean(val) {
  2376. return !!val;
  2377. }
  2378. function booleanString(val) {
  2379. return util.booleanify(val);
  2380. }
  2381. function list(val) {
  2382. return util.list(val);
  2383. }
  2384. },{"../../../util":31,"slash":541}],25:[function(require,module,exports){
  2385. "use strict";
  2386. module.exports = {
  2387. "auxiliaryComment": {
  2388. "message": "Use `auxiliaryCommentBefore` or `auxiliaryCommentAfter`"
  2389. },
  2390. "blacklist": {
  2391. "message": "Put the specific transforms you want in the `plugins` option"
  2392. },
  2393. "breakConfig": {
  2394. "message": "This is not a necessary option in Babel 6"
  2395. },
  2396. "experimental": {
  2397. "message": "Put the specific transforms you want in the `plugins` option"
  2398. },
  2399. "externalHelpers": {
  2400. "message": "Use the `external-helpers` plugin instead. Check out http://babeljs.io/docs/plugins/external-helpers/"
  2401. },
  2402. "extra": {
  2403. "message": ""
  2404. },
  2405. "jsxPragma": {
  2406. "message": "use the `pragma` option in the `react-jsx` plugin . Check out http://babeljs.io/docs/plugins/transform-react-jsx/"
  2407. },
  2408. "loose": {
  2409. "message": "Specify the `loose` option for the relevant plugin you are using or use a preset that sets the option."
  2410. },
  2411. "metadataUsedHelpers": {
  2412. "message": "Not required anymore as this is enabled by default"
  2413. },
  2414. "modules": {
  2415. "message": "Use the corresponding module transform plugin in the `plugins` option. Check out http://babeljs.io/docs/plugins/#modules"
  2416. },
  2417. "nonStandard": {
  2418. "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/"
  2419. },
  2420. "optional": {
  2421. "message": "Put the specific transforms you want in the `plugins` option"
  2422. },
  2423. "sourceMapName": {
  2424. "message": "Use the `sourceMapTarget` option"
  2425. },
  2426. "stage": {
  2427. "message": "Check out the corresponding stage-x presets http://babeljs.io/docs/plugins/#presets"
  2428. },
  2429. "whitelist": {
  2430. "message": "Put the specific transforms you want in the `plugins` option"
  2431. }
  2432. };
  2433. },{}],26:[function(require,module,exports){
  2434. "use strict";
  2435. exports.__esModule = true;
  2436. var _plugin = require("../plugin");
  2437. var _plugin2 = _interopRequireDefault(_plugin);
  2438. var _sortBy = require("lodash/sortBy");
  2439. var _sortBy2 = _interopRequireDefault(_sortBy);
  2440. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2441. exports.default = new _plugin2.default({
  2442. name: "internal.blockHoist",
  2443. visitor: {
  2444. Block: {
  2445. exit: function exit(_ref) {
  2446. var node = _ref.node;
  2447. var hasChange = false;
  2448. for (var i = 0; i < node.body.length; i++) {
  2449. var bodyNode = node.body[i];
  2450. if (bodyNode && bodyNode._blockHoist != null) {
  2451. hasChange = true;
  2452. break;
  2453. }
  2454. }
  2455. if (!hasChange) return;
  2456. node.body = (0, _sortBy2.default)(node.body, function (bodyNode) {
  2457. var priority = bodyNode && bodyNode._blockHoist;
  2458. if (priority == null) priority = 1;
  2459. if (priority === true) priority = 2;
  2460. return -1 * priority;
  2461. });
  2462. }
  2463. }
  2464. }
  2465. });
  2466. module.exports = exports["default"];
  2467. },{"../plugin":30,"lodash/sortBy":508}],27:[function(require,module,exports){
  2468. "use strict";
  2469. exports.__esModule = true;
  2470. var _symbol = require("babel-runtime/core-js/symbol");
  2471. var _symbol2 = _interopRequireDefault(_symbol);
  2472. var _plugin = require("../plugin");
  2473. var _plugin2 = _interopRequireDefault(_plugin);
  2474. var _babelTypes = require("babel-types");
  2475. var t = _interopRequireWildcard(_babelTypes);
  2476. 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; } }
  2477. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2478. var SUPER_THIS_BOUND = (0, _symbol2.default)("super this bound");
  2479. var superVisitor = {
  2480. CallExpression: function CallExpression(path) {
  2481. if (!path.get("callee").isSuper()) return;
  2482. var node = path.node;
  2483. if (node[SUPER_THIS_BOUND]) return;
  2484. node[SUPER_THIS_BOUND] = true;
  2485. path.replaceWith(t.assignmentExpression("=", this.id, node));
  2486. }
  2487. };
  2488. exports.default = new _plugin2.default({
  2489. name: "internal.shadowFunctions",
  2490. visitor: {
  2491. ThisExpression: function ThisExpression(path) {
  2492. remap(path, "this");
  2493. },
  2494. ReferencedIdentifier: function ReferencedIdentifier(path) {
  2495. if (path.node.name === "arguments") {
  2496. remap(path, "arguments");
  2497. }
  2498. }
  2499. }
  2500. });
  2501. function shouldShadow(path, shadowPath) {
  2502. if (path.is("_forceShadow")) {
  2503. return true;
  2504. } else {
  2505. return shadowPath;
  2506. }
  2507. }
  2508. function remap(path, key) {
  2509. var shadowPath = path.inShadow(key);
  2510. if (!shouldShadow(path, shadowPath)) return;
  2511. var shadowFunction = path.node._shadowedFunctionLiteral;
  2512. var currentFunction = void 0;
  2513. var passedShadowFunction = false;
  2514. var fnPath = path.find(function (innerPath) {
  2515. if (innerPath.parentPath && innerPath.parentPath.isClassProperty() && innerPath.key === "value") {
  2516. return true;
  2517. }
  2518. if (path === innerPath) return false;
  2519. if (innerPath.isProgram() || innerPath.isFunction()) {
  2520. currentFunction = currentFunction || innerPath;
  2521. }
  2522. if (innerPath.isProgram()) {
  2523. passedShadowFunction = true;
  2524. return true;
  2525. } else if (innerPath.isFunction() && !innerPath.isArrowFunctionExpression()) {
  2526. if (shadowFunction) {
  2527. if (innerPath === shadowFunction || innerPath.node === shadowFunction.node) return true;
  2528. } else {
  2529. if (!innerPath.is("shadow")) return true;
  2530. }
  2531. passedShadowFunction = true;
  2532. return false;
  2533. }
  2534. return false;
  2535. });
  2536. if (shadowFunction && fnPath.isProgram() && !shadowFunction.isProgram()) {
  2537. fnPath = path.findParent(function (p) {
  2538. return p.isProgram() || p.isFunction();
  2539. });
  2540. }
  2541. if (fnPath === currentFunction) return;
  2542. if (!passedShadowFunction) return;
  2543. var cached = fnPath.getData(key);
  2544. if (cached) return path.replaceWith(cached);
  2545. var id = path.scope.generateUidIdentifier(key);
  2546. fnPath.setData(key, id);
  2547. var classPath = fnPath.findParent(function (p) {
  2548. return p.isClass();
  2549. });
  2550. var hasSuperClass = !!(classPath && classPath.node && classPath.node.superClass);
  2551. if (key === "this" && fnPath.isMethod({ kind: "constructor" }) && hasSuperClass) {
  2552. fnPath.scope.push({ id: id });
  2553. fnPath.traverse(superVisitor, { id: id });
  2554. } else {
  2555. var init = key === "this" ? t.thisExpression() : t.identifier(key);
  2556. if (shadowFunction) init._shadowedFunctionLiteral = shadowFunction;
  2557. fnPath.scope.push({ id: id, init: init });
  2558. }
  2559. return path.replaceWith(id);
  2560. }
  2561. module.exports = exports["default"];
  2562. },{"../plugin":30,"babel-runtime/core-js/symbol":104,"babel-types":151}],28:[function(require,module,exports){
  2563. "use strict";
  2564. exports.__esModule = true;
  2565. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  2566. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  2567. var _normalizeAst = require("../helpers/normalize-ast");
  2568. var _normalizeAst2 = _interopRequireDefault(_normalizeAst);
  2569. var _plugin = require("./plugin");
  2570. var _plugin2 = _interopRequireDefault(_plugin);
  2571. var _file = require("./file");
  2572. var _file2 = _interopRequireDefault(_file);
  2573. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2574. var Pipeline = function () {
  2575. function Pipeline() {
  2576. (0, _classCallCheck3.default)(this, Pipeline);
  2577. }
  2578. Pipeline.prototype.lint = function lint(code) {
  2579. var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  2580. opts.code = false;
  2581. opts.mode = "lint";
  2582. return this.transform(code, opts);
  2583. };
  2584. Pipeline.prototype.pretransform = function pretransform(code, opts) {
  2585. var file = new _file2.default(opts, this);
  2586. return file.wrap(code, function () {
  2587. file.addCode(code);
  2588. file.parseCode(code);
  2589. return file;
  2590. });
  2591. };
  2592. Pipeline.prototype.transform = function transform(code, opts) {
  2593. var file = new _file2.default(opts, this);
  2594. return file.wrap(code, function () {
  2595. file.addCode(code);
  2596. file.parseCode(code);
  2597. return file.transform();
  2598. });
  2599. };
  2600. Pipeline.prototype.analyse = function analyse(code) {
  2601. var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  2602. var visitor = arguments[2];
  2603. opts.code = false;
  2604. if (visitor) {
  2605. opts.plugins = opts.plugins || [];
  2606. opts.plugins.push(new _plugin2.default({ visitor: visitor }));
  2607. }
  2608. return this.transform(code, opts).metadata;
  2609. };
  2610. Pipeline.prototype.transformFromAst = function transformFromAst(ast, code, opts) {
  2611. ast = (0, _normalizeAst2.default)(ast);
  2612. var file = new _file2.default(opts, this);
  2613. return file.wrap(code, function () {
  2614. file.addCode(code);
  2615. file.addAst(ast);
  2616. return file.transform();
  2617. });
  2618. };
  2619. return Pipeline;
  2620. }();
  2621. exports.default = Pipeline;
  2622. module.exports = exports["default"];
  2623. },{"../helpers/normalize-ast":10,"./file":17,"./plugin":30,"babel-runtime/helpers/classCallCheck":109}],29:[function(require,module,exports){
  2624. "use strict";
  2625. exports.__esModule = true;
  2626. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  2627. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  2628. var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn");
  2629. var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
  2630. var _inherits2 = require("babel-runtime/helpers/inherits");
  2631. var _inherits3 = _interopRequireDefault(_inherits2);
  2632. var _store = require("../store");
  2633. var _store2 = _interopRequireDefault(_store);
  2634. var _file5 = require("./file");
  2635. var _file6 = _interopRequireDefault(_file5);
  2636. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2637. var PluginPass = function (_Store) {
  2638. (0, _inherits3.default)(PluginPass, _Store);
  2639. function PluginPass(file, plugin) {
  2640. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  2641. (0, _classCallCheck3.default)(this, PluginPass);
  2642. var _this = (0, _possibleConstructorReturn3.default)(this, _Store.call(this));
  2643. _this.plugin = plugin;
  2644. _this.key = plugin.key;
  2645. _this.file = file;
  2646. _this.opts = options;
  2647. return _this;
  2648. }
  2649. PluginPass.prototype.addHelper = function addHelper() {
  2650. var _file;
  2651. return (_file = this.file).addHelper.apply(_file, arguments);
  2652. };
  2653. PluginPass.prototype.addImport = function addImport() {
  2654. var _file2;
  2655. return (_file2 = this.file).addImport.apply(_file2, arguments);
  2656. };
  2657. PluginPass.prototype.getModuleName = function getModuleName() {
  2658. var _file3;
  2659. return (_file3 = this.file).getModuleName.apply(_file3, arguments);
  2660. };
  2661. PluginPass.prototype.buildCodeFrameError = function buildCodeFrameError() {
  2662. var _file4;
  2663. return (_file4 = this.file).buildCodeFrameError.apply(_file4, arguments);
  2664. };
  2665. return PluginPass;
  2666. }(_store2.default);
  2667. exports.default = PluginPass;
  2668. module.exports = exports["default"];
  2669. },{"../store":15,"./file":17,"babel-runtime/helpers/classCallCheck":109,"babel-runtime/helpers/inherits":110,"babel-runtime/helpers/possibleConstructorReturn":112}],30:[function(require,module,exports){
  2670. "use strict";
  2671. exports.__esModule = true;
  2672. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  2673. var _getIterator3 = _interopRequireDefault(_getIterator2);
  2674. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  2675. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  2676. var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn");
  2677. var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
  2678. var _inherits2 = require("babel-runtime/helpers/inherits");
  2679. var _inherits3 = _interopRequireDefault(_inherits2);
  2680. var _optionManager = require("./file/options/option-manager");
  2681. var _optionManager2 = _interopRequireDefault(_optionManager);
  2682. var _babelMessages = require("babel-messages");
  2683. var messages = _interopRequireWildcard(_babelMessages);
  2684. var _store = require("../store");
  2685. var _store2 = _interopRequireDefault(_store);
  2686. var _babelTraverse = require("babel-traverse");
  2687. var _babelTraverse2 = _interopRequireDefault(_babelTraverse);
  2688. var _assign = require("lodash/assign");
  2689. var _assign2 = _interopRequireDefault(_assign);
  2690. var _clone = require("lodash/clone");
  2691. var _clone2 = _interopRequireDefault(_clone);
  2692. 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; } }
  2693. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2694. var GLOBAL_VISITOR_PROPS = ["enter", "exit"];
  2695. var Plugin = function (_Store) {
  2696. (0, _inherits3.default)(Plugin, _Store);
  2697. function Plugin(plugin, key) {
  2698. (0, _classCallCheck3.default)(this, Plugin);
  2699. var _this = (0, _possibleConstructorReturn3.default)(this, _Store.call(this));
  2700. _this.initialized = false;
  2701. _this.raw = (0, _assign2.default)({}, plugin);
  2702. _this.key = _this.take("name") || key;
  2703. _this.manipulateOptions = _this.take("manipulateOptions");
  2704. _this.post = _this.take("post");
  2705. _this.pre = _this.take("pre");
  2706. _this.visitor = _this.normaliseVisitor((0, _clone2.default)(_this.take("visitor")) || {});
  2707. return _this;
  2708. }
  2709. Plugin.prototype.take = function take(key) {
  2710. var val = this.raw[key];
  2711. delete this.raw[key];
  2712. return val;
  2713. };
  2714. Plugin.prototype.chain = function chain(target, key) {
  2715. if (!target[key]) return this[key];
  2716. if (!this[key]) return target[key];
  2717. var fns = [target[key], this[key]];
  2718. return function () {
  2719. var val = void 0;
  2720. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  2721. args[_key] = arguments[_key];
  2722. }
  2723. for (var _iterator = fns, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  2724. var _ref;
  2725. if (_isArray) {
  2726. if (_i >= _iterator.length) break;
  2727. _ref = _iterator[_i++];
  2728. } else {
  2729. _i = _iterator.next();
  2730. if (_i.done) break;
  2731. _ref = _i.value;
  2732. }
  2733. var fn = _ref;
  2734. if (fn) {
  2735. var ret = fn.apply(this, args);
  2736. if (ret != null) val = ret;
  2737. }
  2738. }
  2739. return val;
  2740. };
  2741. };
  2742. Plugin.prototype.maybeInherit = function maybeInherit(loc) {
  2743. var inherits = this.take("inherits");
  2744. if (!inherits) return;
  2745. inherits = _optionManager2.default.normalisePlugin(inherits, loc, "inherits");
  2746. this.manipulateOptions = this.chain(inherits, "manipulateOptions");
  2747. this.post = this.chain(inherits, "post");
  2748. this.pre = this.chain(inherits, "pre");
  2749. this.visitor = _babelTraverse2.default.visitors.merge([inherits.visitor, this.visitor]);
  2750. };
  2751. Plugin.prototype.init = function init(loc, i) {
  2752. if (this.initialized) return;
  2753. this.initialized = true;
  2754. this.maybeInherit(loc);
  2755. for (var key in this.raw) {
  2756. throw new Error(messages.get("pluginInvalidProperty", loc, i, key));
  2757. }
  2758. };
  2759. Plugin.prototype.normaliseVisitor = function normaliseVisitor(visitor) {
  2760. for (var _iterator2 = GLOBAL_VISITOR_PROPS, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  2761. var _ref2;
  2762. if (_isArray2) {
  2763. if (_i2 >= _iterator2.length) break;
  2764. _ref2 = _iterator2[_i2++];
  2765. } else {
  2766. _i2 = _iterator2.next();
  2767. if (_i2.done) break;
  2768. _ref2 = _i2.value;
  2769. }
  2770. var key = _ref2;
  2771. if (visitor[key]) {
  2772. throw new Error("Plugins aren't allowed to specify catch-all enter/exit handlers. " + "Please target individual nodes.");
  2773. }
  2774. }
  2775. _babelTraverse2.default.explode(visitor);
  2776. return visitor;
  2777. };
  2778. return Plugin;
  2779. }(_store2.default);
  2780. exports.default = Plugin;
  2781. module.exports = exports["default"];
  2782. },{"../store":15,"./file/options/option-manager":23,"babel-messages":61,"babel-runtime/core-js/get-iterator":95,"babel-runtime/helpers/classCallCheck":109,"babel-runtime/helpers/inherits":110,"babel-runtime/helpers/possibleConstructorReturn":112,"babel-traverse":118,"lodash/assign":463,"lodash/clone":466}],31:[function(require,module,exports){
  2783. "use strict";
  2784. exports.__esModule = true;
  2785. exports.inspect = exports.inherits = undefined;
  2786. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  2787. var _getIterator3 = _interopRequireDefault(_getIterator2);
  2788. var _util = require("util");
  2789. Object.defineProperty(exports, "inherits", {
  2790. enumerable: true,
  2791. get: function get() {
  2792. return _util.inherits;
  2793. }
  2794. });
  2795. Object.defineProperty(exports, "inspect", {
  2796. enumerable: true,
  2797. get: function get() {
  2798. return _util.inspect;
  2799. }
  2800. });
  2801. exports.canCompile = canCompile;
  2802. exports.list = list;
  2803. exports.regexify = regexify;
  2804. exports.arrayify = arrayify;
  2805. exports.booleanify = booleanify;
  2806. exports.shouldIgnore = shouldIgnore;
  2807. var _escapeRegExp = require("lodash/escapeRegExp");
  2808. var _escapeRegExp2 = _interopRequireDefault(_escapeRegExp);
  2809. var _startsWith = require("lodash/startsWith");
  2810. var _startsWith2 = _interopRequireDefault(_startsWith);
  2811. var _minimatch = require("minimatch");
  2812. var _minimatch2 = _interopRequireDefault(_minimatch);
  2813. var _includes = require("lodash/includes");
  2814. var _includes2 = _interopRequireDefault(_includes);
  2815. var _isRegExp = require("lodash/isRegExp");
  2816. var _isRegExp2 = _interopRequireDefault(_isRegExp);
  2817. var _path = require("path");
  2818. var _path2 = _interopRequireDefault(_path);
  2819. var _slash = require("slash");
  2820. var _slash2 = _interopRequireDefault(_slash);
  2821. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2822. function canCompile(filename, altExts) {
  2823. var exts = altExts || canCompile.EXTENSIONS;
  2824. var ext = _path2.default.extname(filename);
  2825. return (0, _includes2.default)(exts, ext);
  2826. }
  2827. canCompile.EXTENSIONS = [".js", ".jsx", ".es6", ".es"];
  2828. function list(val) {
  2829. if (!val) {
  2830. return [];
  2831. } else if (Array.isArray(val)) {
  2832. return val;
  2833. } else if (typeof val === "string") {
  2834. return val.split(",");
  2835. } else {
  2836. return [val];
  2837. }
  2838. }
  2839. function regexify(val) {
  2840. if (!val) {
  2841. return new RegExp(/.^/);
  2842. }
  2843. if (Array.isArray(val)) {
  2844. val = new RegExp(val.map(_escapeRegExp2.default).join("|"), "i");
  2845. }
  2846. if (typeof val === "string") {
  2847. val = (0, _slash2.default)(val);
  2848. if ((0, _startsWith2.default)(val, "./") || (0, _startsWith2.default)(val, "*/")) val = val.slice(2);
  2849. if ((0, _startsWith2.default)(val, "**/")) val = val.slice(3);
  2850. var regex = _minimatch2.default.makeRe(val, { nocase: true });
  2851. return new RegExp(regex.source.slice(1, -1), "i");
  2852. }
  2853. if ((0, _isRegExp2.default)(val)) {
  2854. return val;
  2855. }
  2856. throw new TypeError("illegal type for regexify");
  2857. }
  2858. function arrayify(val, mapFn) {
  2859. if (!val) return [];
  2860. if (typeof val === "boolean") return arrayify([val], mapFn);
  2861. if (typeof val === "string") return arrayify(list(val), mapFn);
  2862. if (Array.isArray(val)) {
  2863. if (mapFn) val = val.map(mapFn);
  2864. return val;
  2865. }
  2866. return [val];
  2867. }
  2868. function booleanify(val) {
  2869. if (val === "true" || val == 1) {
  2870. return true;
  2871. }
  2872. if (val === "false" || val == 0 || !val) {
  2873. return false;
  2874. }
  2875. return val;
  2876. }
  2877. function shouldIgnore(filename) {
  2878. var ignore = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  2879. var only = arguments[2];
  2880. filename = filename.replace(/\\/g, "/");
  2881. if (only) {
  2882. for (var _iterator = only, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  2883. var _ref;
  2884. if (_isArray) {
  2885. if (_i >= _iterator.length) break;
  2886. _ref = _iterator[_i++];
  2887. } else {
  2888. _i = _iterator.next();
  2889. if (_i.done) break;
  2890. _ref = _i.value;
  2891. }
  2892. var pattern = _ref;
  2893. if (_shouldIgnore(pattern, filename)) return false;
  2894. }
  2895. return true;
  2896. } else if (ignore.length) {
  2897. for (var _iterator2 = ignore, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  2898. var _ref2;
  2899. if (_isArray2) {
  2900. if (_i2 >= _iterator2.length) break;
  2901. _ref2 = _iterator2[_i2++];
  2902. } else {
  2903. _i2 = _iterator2.next();
  2904. if (_i2.done) break;
  2905. _ref2 = _i2.value;
  2906. }
  2907. var _pattern = _ref2;
  2908. if (_shouldIgnore(_pattern, filename)) return true;
  2909. }
  2910. }
  2911. return false;
  2912. }
  2913. function _shouldIgnore(pattern, filename) {
  2914. if (typeof pattern === "function") {
  2915. return pattern(filename);
  2916. } else {
  2917. return pattern.test(filename);
  2918. }
  2919. }
  2920. },{"babel-runtime/core-js/get-iterator":95,"lodash/escapeRegExp":472,"lodash/includes":482,"lodash/isRegExp":494,"lodash/startsWith":509,"minimatch":519,"path":522,"slash":541,"util":560}],32:[function(require,module,exports){
  2921. module.exports={
  2922. "_from": "babel-core@^6.22.1",
  2923. "_id": "babel-core@6.26.0",
  2924. "_inBundle": false,
  2925. "_integrity": "sha1-rzL3izGm/O8RnIew/Y2XU/A6C7g=",
  2926. "_location": "/babel-core",
  2927. "_phantomChildren": {},
  2928. "_requested": {
  2929. "type": "range",
  2930. "registry": true,
  2931. "raw": "babel-core@^6.22.1",
  2932. "name": "babel-core",
  2933. "escapedName": "babel-core",
  2934. "rawSpec": "^6.22.1",
  2935. "saveSpec": null,
  2936. "fetchSpec": "^6.22.1"
  2937. },
  2938. "_requiredBy": [
  2939. "#DEV:/",
  2940. "/babel-register",
  2941. "/babelify",
  2942. "/karma-babel-preprocessor"
  2943. ],
  2944. "_resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.0.tgz",
  2945. "_shasum": "af32f78b31a6fcef119c87b0fd8d9753f03a0bb8",
  2946. "_spec": "babel-core@^6.22.1",
  2947. "_where": "/Users/juanjodiaz/Documents/code/OSS libs/noVNC",
  2948. "author": {
  2949. "name": "Sebastian McKenzie",
  2950. "email": "sebmck@gmail.com"
  2951. },
  2952. "bundleDependencies": false,
  2953. "dependencies": {
  2954. "babel-code-frame": "^6.26.0",
  2955. "babel-generator": "^6.26.0",
  2956. "babel-helpers": "^6.24.1",
  2957. "babel-messages": "^6.23.0",
  2958. "babel-register": "^6.26.0",
  2959. "babel-runtime": "^6.26.0",
  2960. "babel-template": "^6.26.0",
  2961. "babel-traverse": "^6.26.0",
  2962. "babel-types": "^6.26.0",
  2963. "babylon": "^6.18.0",
  2964. "convert-source-map": "^1.5.0",
  2965. "debug": "^2.6.8",
  2966. "json5": "^0.5.1",
  2967. "lodash": "^4.17.4",
  2968. "minimatch": "^3.0.4",
  2969. "path-is-absolute": "^1.0.1",
  2970. "private": "^0.1.7",
  2971. "slash": "^1.0.0",
  2972. "source-map": "^0.5.6"
  2973. },
  2974. "deprecated": false,
  2975. "description": "Babel compiler core.",
  2976. "devDependencies": {
  2977. "babel-helper-fixtures": "^6.26.0",
  2978. "babel-helper-transform-fixture-test-runner": "^6.26.0",
  2979. "babel-polyfill": "^6.26.0"
  2980. },
  2981. "homepage": "https://babeljs.io/",
  2982. "keywords": [
  2983. "6to5",
  2984. "babel",
  2985. "classes",
  2986. "const",
  2987. "es6",
  2988. "harmony",
  2989. "let",
  2990. "modules",
  2991. "transpile",
  2992. "transpiler",
  2993. "var",
  2994. "babel-core",
  2995. "compiler"
  2996. ],
  2997. "license": "MIT",
  2998. "name": "babel-core",
  2999. "repository": {
  3000. "type": "git",
  3001. "url": "https://github.com/babel/babel/tree/master/packages/babel-core"
  3002. },
  3003. "scripts": {
  3004. "bench": "make bench",
  3005. "test": "make test"
  3006. },
  3007. "version": "6.26.0"
  3008. }
  3009. },{}],33:[function(require,module,exports){
  3010. "use strict";
  3011. exports.__esModule = true;
  3012. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  3013. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  3014. var _trimRight = require("trim-right");
  3015. var _trimRight2 = _interopRequireDefault(_trimRight);
  3016. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3017. var SPACES_RE = /^[ \t]+$/;
  3018. var Buffer = function () {
  3019. function Buffer(map) {
  3020. (0, _classCallCheck3.default)(this, Buffer);
  3021. this._map = null;
  3022. this._buf = [];
  3023. this._last = "";
  3024. this._queue = [];
  3025. this._position = {
  3026. line: 1,
  3027. column: 0
  3028. };
  3029. this._sourcePosition = {
  3030. identifierName: null,
  3031. line: null,
  3032. column: null,
  3033. filename: null
  3034. };
  3035. this._map = map;
  3036. }
  3037. Buffer.prototype.get = function get() {
  3038. this._flush();
  3039. var map = this._map;
  3040. var result = {
  3041. code: (0, _trimRight2.default)(this._buf.join("")),
  3042. map: null,
  3043. rawMappings: map && map.getRawMappings()
  3044. };
  3045. if (map) {
  3046. Object.defineProperty(result, "map", {
  3047. configurable: true,
  3048. enumerable: true,
  3049. get: function get() {
  3050. return this.map = map.get();
  3051. },
  3052. set: function set(value) {
  3053. Object.defineProperty(this, "map", { value: value, writable: true });
  3054. }
  3055. });
  3056. }
  3057. return result;
  3058. };
  3059. Buffer.prototype.append = function append(str) {
  3060. this._flush();
  3061. var _sourcePosition = this._sourcePosition,
  3062. line = _sourcePosition.line,
  3063. column = _sourcePosition.column,
  3064. filename = _sourcePosition.filename,
  3065. identifierName = _sourcePosition.identifierName;
  3066. this._append(str, line, column, identifierName, filename);
  3067. };
  3068. Buffer.prototype.queue = function queue(str) {
  3069. if (str === "\n") while (this._queue.length > 0 && SPACES_RE.test(this._queue[0][0])) {
  3070. this._queue.shift();
  3071. }var _sourcePosition2 = this._sourcePosition,
  3072. line = _sourcePosition2.line,
  3073. column = _sourcePosition2.column,
  3074. filename = _sourcePosition2.filename,
  3075. identifierName = _sourcePosition2.identifierName;
  3076. this._queue.unshift([str, line, column, identifierName, filename]);
  3077. };
  3078. Buffer.prototype._flush = function _flush() {
  3079. var item = void 0;
  3080. while (item = this._queue.pop()) {
  3081. this._append.apply(this, item);
  3082. }
  3083. };
  3084. Buffer.prototype._append = function _append(str, line, column, identifierName, filename) {
  3085. if (this._map && str[0] !== "\n") {
  3086. this._map.mark(this._position.line, this._position.column, line, column, identifierName, filename);
  3087. }
  3088. this._buf.push(str);
  3089. this._last = str[str.length - 1];
  3090. for (var i = 0; i < str.length; i++) {
  3091. if (str[i] === "\n") {
  3092. this._position.line++;
  3093. this._position.column = 0;
  3094. } else {
  3095. this._position.column++;
  3096. }
  3097. }
  3098. };
  3099. Buffer.prototype.removeTrailingNewline = function removeTrailingNewline() {
  3100. if (this._queue.length > 0 && this._queue[0][0] === "\n") this._queue.shift();
  3101. };
  3102. Buffer.prototype.removeLastSemicolon = function removeLastSemicolon() {
  3103. if (this._queue.length > 0 && this._queue[0][0] === ";") this._queue.shift();
  3104. };
  3105. Buffer.prototype.endsWith = function endsWith(suffix) {
  3106. if (suffix.length === 1) {
  3107. var last = void 0;
  3108. if (this._queue.length > 0) {
  3109. var str = this._queue[0][0];
  3110. last = str[str.length - 1];
  3111. } else {
  3112. last = this._last;
  3113. }
  3114. return last === suffix;
  3115. }
  3116. var end = this._last + this._queue.reduce(function (acc, item) {
  3117. return item[0] + acc;
  3118. }, "");
  3119. if (suffix.length <= end.length) {
  3120. return end.slice(-suffix.length) === suffix;
  3121. }
  3122. return false;
  3123. };
  3124. Buffer.prototype.hasContent = function hasContent() {
  3125. return this._queue.length > 0 || !!this._last;
  3126. };
  3127. Buffer.prototype.source = function source(prop, loc) {
  3128. if (prop && !loc) return;
  3129. var pos = loc ? loc[prop] : null;
  3130. this._sourcePosition.identifierName = loc && loc.identifierName || null;
  3131. this._sourcePosition.line = pos ? pos.line : null;
  3132. this._sourcePosition.column = pos ? pos.column : null;
  3133. this._sourcePosition.filename = loc && loc.filename || null;
  3134. };
  3135. Buffer.prototype.withSource = function withSource(prop, loc, cb) {
  3136. if (!this._map) return cb();
  3137. var originalLine = this._sourcePosition.line;
  3138. var originalColumn = this._sourcePosition.column;
  3139. var originalFilename = this._sourcePosition.filename;
  3140. var originalIdentifierName = this._sourcePosition.identifierName;
  3141. this.source(prop, loc);
  3142. cb();
  3143. this._sourcePosition.line = originalLine;
  3144. this._sourcePosition.column = originalColumn;
  3145. this._sourcePosition.filename = originalFilename;
  3146. this._sourcePosition.identifierName = originalIdentifierName;
  3147. };
  3148. Buffer.prototype.getCurrentColumn = function getCurrentColumn() {
  3149. var extra = this._queue.reduce(function (acc, item) {
  3150. return item[0] + acc;
  3151. }, "");
  3152. var lastIndex = extra.lastIndexOf("\n");
  3153. return lastIndex === -1 ? this._position.column + extra.length : extra.length - 1 - lastIndex;
  3154. };
  3155. Buffer.prototype.getCurrentLine = function getCurrentLine() {
  3156. var extra = this._queue.reduce(function (acc, item) {
  3157. return item[0] + acc;
  3158. }, "");
  3159. var count = 0;
  3160. for (var i = 0; i < extra.length; i++) {
  3161. if (extra[i] === "\n") count++;
  3162. }
  3163. return this._position.line + count;
  3164. };
  3165. return Buffer;
  3166. }();
  3167. exports.default = Buffer;
  3168. module.exports = exports["default"];
  3169. },{"babel-runtime/helpers/classCallCheck":109,"trim-right":556}],34:[function(require,module,exports){
  3170. "use strict";
  3171. exports.__esModule = true;
  3172. exports.File = File;
  3173. exports.Program = Program;
  3174. exports.BlockStatement = BlockStatement;
  3175. exports.Noop = Noop;
  3176. exports.Directive = Directive;
  3177. var _types = require("./types");
  3178. Object.defineProperty(exports, "DirectiveLiteral", {
  3179. enumerable: true,
  3180. get: function get() {
  3181. return _types.StringLiteral;
  3182. }
  3183. });
  3184. function File(node) {
  3185. this.print(node.program, node);
  3186. }
  3187. function Program(node) {
  3188. this.printInnerComments(node, false);
  3189. this.printSequence(node.directives, node);
  3190. if (node.directives && node.directives.length) this.newline();
  3191. this.printSequence(node.body, node);
  3192. }
  3193. function BlockStatement(node) {
  3194. this.token("{");
  3195. this.printInnerComments(node);
  3196. var hasDirectives = node.directives && node.directives.length;
  3197. if (node.body.length || hasDirectives) {
  3198. this.newline();
  3199. this.printSequence(node.directives, node, { indent: true });
  3200. if (hasDirectives) this.newline();
  3201. this.printSequence(node.body, node, { indent: true });
  3202. this.removeTrailingNewline();
  3203. this.source("end", node.loc);
  3204. if (!this.endsWith("\n")) this.newline();
  3205. this.rightBrace();
  3206. } else {
  3207. this.source("end", node.loc);
  3208. this.token("}");
  3209. }
  3210. }
  3211. function Noop() {}
  3212. function Directive(node) {
  3213. this.print(node.value, node);
  3214. this.semicolon();
  3215. }
  3216. },{"./types":43}],35:[function(require,module,exports){
  3217. "use strict";
  3218. exports.__esModule = true;
  3219. exports.ClassDeclaration = ClassDeclaration;
  3220. exports.ClassBody = ClassBody;
  3221. exports.ClassProperty = ClassProperty;
  3222. exports.ClassMethod = ClassMethod;
  3223. function ClassDeclaration(node) {
  3224. this.printJoin(node.decorators, node);
  3225. this.word("class");
  3226. if (node.id) {
  3227. this.space();
  3228. this.print(node.id, node);
  3229. }
  3230. this.print(node.typeParameters, node);
  3231. if (node.superClass) {
  3232. this.space();
  3233. this.word("extends");
  3234. this.space();
  3235. this.print(node.superClass, node);
  3236. this.print(node.superTypeParameters, node);
  3237. }
  3238. if (node.implements) {
  3239. this.space();
  3240. this.word("implements");
  3241. this.space();
  3242. this.printList(node.implements, node);
  3243. }
  3244. this.space();
  3245. this.print(node.body, node);
  3246. }
  3247. exports.ClassExpression = ClassDeclaration;
  3248. function ClassBody(node) {
  3249. this.token("{");
  3250. this.printInnerComments(node);
  3251. if (node.body.length === 0) {
  3252. this.token("}");
  3253. } else {
  3254. this.newline();
  3255. this.indent();
  3256. this.printSequence(node.body, node);
  3257. this.dedent();
  3258. if (!this.endsWith("\n")) this.newline();
  3259. this.rightBrace();
  3260. }
  3261. }
  3262. function ClassProperty(node) {
  3263. this.printJoin(node.decorators, node);
  3264. if (node.static) {
  3265. this.word("static");
  3266. this.space();
  3267. }
  3268. if (node.computed) {
  3269. this.token("[");
  3270. this.print(node.key, node);
  3271. this.token("]");
  3272. } else {
  3273. this._variance(node);
  3274. this.print(node.key, node);
  3275. }
  3276. this.print(node.typeAnnotation, node);
  3277. if (node.value) {
  3278. this.space();
  3279. this.token("=");
  3280. this.space();
  3281. this.print(node.value, node);
  3282. }
  3283. this.semicolon();
  3284. }
  3285. function ClassMethod(node) {
  3286. this.printJoin(node.decorators, node);
  3287. if (node.static) {
  3288. this.word("static");
  3289. this.space();
  3290. }
  3291. if (node.kind === "constructorCall") {
  3292. this.word("call");
  3293. this.space();
  3294. }
  3295. this._method(node);
  3296. }
  3297. },{}],36:[function(require,module,exports){
  3298. "use strict";
  3299. exports.__esModule = true;
  3300. exports.LogicalExpression = exports.BinaryExpression = exports.AwaitExpression = exports.YieldExpression = undefined;
  3301. exports.UnaryExpression = UnaryExpression;
  3302. exports.DoExpression = DoExpression;
  3303. exports.ParenthesizedExpression = ParenthesizedExpression;
  3304. exports.UpdateExpression = UpdateExpression;
  3305. exports.ConditionalExpression = ConditionalExpression;
  3306. exports.NewExpression = NewExpression;
  3307. exports.SequenceExpression = SequenceExpression;
  3308. exports.ThisExpression = ThisExpression;
  3309. exports.Super = Super;
  3310. exports.Decorator = Decorator;
  3311. exports.CallExpression = CallExpression;
  3312. exports.Import = Import;
  3313. exports.EmptyStatement = EmptyStatement;
  3314. exports.ExpressionStatement = ExpressionStatement;
  3315. exports.AssignmentPattern = AssignmentPattern;
  3316. exports.AssignmentExpression = AssignmentExpression;
  3317. exports.BindExpression = BindExpression;
  3318. exports.MemberExpression = MemberExpression;
  3319. exports.MetaProperty = MetaProperty;
  3320. var _babelTypes = require("babel-types");
  3321. var t = _interopRequireWildcard(_babelTypes);
  3322. var _node = require("../node");
  3323. var n = _interopRequireWildcard(_node);
  3324. 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; } }
  3325. function UnaryExpression(node) {
  3326. if (node.operator === "void" || node.operator === "delete" || node.operator === "typeof") {
  3327. this.word(node.operator);
  3328. this.space();
  3329. } else {
  3330. this.token(node.operator);
  3331. }
  3332. this.print(node.argument, node);
  3333. }
  3334. function DoExpression(node) {
  3335. this.word("do");
  3336. this.space();
  3337. this.print(node.body, node);
  3338. }
  3339. function ParenthesizedExpression(node) {
  3340. this.token("(");
  3341. this.print(node.expression, node);
  3342. this.token(")");
  3343. }
  3344. function UpdateExpression(node) {
  3345. if (node.prefix) {
  3346. this.token(node.operator);
  3347. this.print(node.argument, node);
  3348. } else {
  3349. this.print(node.argument, node);
  3350. this.token(node.operator);
  3351. }
  3352. }
  3353. function ConditionalExpression(node) {
  3354. this.print(node.test, node);
  3355. this.space();
  3356. this.token("?");
  3357. this.space();
  3358. this.print(node.consequent, node);
  3359. this.space();
  3360. this.token(":");
  3361. this.space();
  3362. this.print(node.alternate, node);
  3363. }
  3364. function NewExpression(node, parent) {
  3365. this.word("new");
  3366. this.space();
  3367. this.print(node.callee, node);
  3368. if (node.arguments.length === 0 && this.format.minified && !t.isCallExpression(parent, { callee: node }) && !t.isMemberExpression(parent) && !t.isNewExpression(parent)) return;
  3369. this.token("(");
  3370. this.printList(node.arguments, node);
  3371. this.token(")");
  3372. }
  3373. function SequenceExpression(node) {
  3374. this.printList(node.expressions, node);
  3375. }
  3376. function ThisExpression() {
  3377. this.word("this");
  3378. }
  3379. function Super() {
  3380. this.word("super");
  3381. }
  3382. function Decorator(node) {
  3383. this.token("@");
  3384. this.print(node.expression, node);
  3385. this.newline();
  3386. }
  3387. function commaSeparatorNewline() {
  3388. this.token(",");
  3389. this.newline();
  3390. if (!this.endsWith("\n")) this.space();
  3391. }
  3392. function CallExpression(node) {
  3393. this.print(node.callee, node);
  3394. this.token("(");
  3395. var isPrettyCall = node._prettyCall;
  3396. var separator = void 0;
  3397. if (isPrettyCall) {
  3398. separator = commaSeparatorNewline;
  3399. this.newline();
  3400. this.indent();
  3401. }
  3402. this.printList(node.arguments, node, { separator: separator });
  3403. if (isPrettyCall) {
  3404. this.newline();
  3405. this.dedent();
  3406. }
  3407. this.token(")");
  3408. }
  3409. function Import() {
  3410. this.word("import");
  3411. }
  3412. function buildYieldAwait(keyword) {
  3413. return function (node) {
  3414. this.word(keyword);
  3415. if (node.delegate) {
  3416. this.token("*");
  3417. }
  3418. if (node.argument) {
  3419. this.space();
  3420. var terminatorState = this.startTerminatorless();
  3421. this.print(node.argument, node);
  3422. this.endTerminatorless(terminatorState);
  3423. }
  3424. };
  3425. }
  3426. var YieldExpression = exports.YieldExpression = buildYieldAwait("yield");
  3427. var AwaitExpression = exports.AwaitExpression = buildYieldAwait("await");
  3428. function EmptyStatement() {
  3429. this.semicolon(true);
  3430. }
  3431. function ExpressionStatement(node) {
  3432. this.print(node.expression, node);
  3433. this.semicolon();
  3434. }
  3435. function AssignmentPattern(node) {
  3436. this.print(node.left, node);
  3437. if (node.left.optional) this.token("?");
  3438. this.print(node.left.typeAnnotation, node);
  3439. this.space();
  3440. this.token("=");
  3441. this.space();
  3442. this.print(node.right, node);
  3443. }
  3444. function AssignmentExpression(node, parent) {
  3445. var parens = this.inForStatementInitCounter && node.operator === "in" && !n.needsParens(node, parent);
  3446. if (parens) {
  3447. this.token("(");
  3448. }
  3449. this.print(node.left, node);
  3450. this.space();
  3451. if (node.operator === "in" || node.operator === "instanceof") {
  3452. this.word(node.operator);
  3453. } else {
  3454. this.token(node.operator);
  3455. }
  3456. this.space();
  3457. this.print(node.right, node);
  3458. if (parens) {
  3459. this.token(")");
  3460. }
  3461. }
  3462. function BindExpression(node) {
  3463. this.print(node.object, node);
  3464. this.token("::");
  3465. this.print(node.callee, node);
  3466. }
  3467. exports.BinaryExpression = AssignmentExpression;
  3468. exports.LogicalExpression = AssignmentExpression;
  3469. function MemberExpression(node) {
  3470. this.print(node.object, node);
  3471. if (!node.computed && t.isMemberExpression(node.property)) {
  3472. throw new TypeError("Got a MemberExpression for MemberExpression property");
  3473. }
  3474. var computed = node.computed;
  3475. if (t.isLiteral(node.property) && typeof node.property.value === "number") {
  3476. computed = true;
  3477. }
  3478. if (computed) {
  3479. this.token("[");
  3480. this.print(node.property, node);
  3481. this.token("]");
  3482. } else {
  3483. this.token(".");
  3484. this.print(node.property, node);
  3485. }
  3486. }
  3487. function MetaProperty(node) {
  3488. this.print(node.meta, node);
  3489. this.token(".");
  3490. this.print(node.property, node);
  3491. }
  3492. },{"../node":45,"babel-types":151}],37:[function(require,module,exports){
  3493. "use strict";
  3494. exports.__esModule = true;
  3495. exports.TypeParameterDeclaration = exports.StringLiteralTypeAnnotation = exports.NumericLiteralTypeAnnotation = exports.GenericTypeAnnotation = exports.ClassImplements = undefined;
  3496. exports.AnyTypeAnnotation = AnyTypeAnnotation;
  3497. exports.ArrayTypeAnnotation = ArrayTypeAnnotation;
  3498. exports.BooleanTypeAnnotation = BooleanTypeAnnotation;
  3499. exports.BooleanLiteralTypeAnnotation = BooleanLiteralTypeAnnotation;
  3500. exports.NullLiteralTypeAnnotation = NullLiteralTypeAnnotation;
  3501. exports.DeclareClass = DeclareClass;
  3502. exports.DeclareFunction = DeclareFunction;
  3503. exports.DeclareInterface = DeclareInterface;
  3504. exports.DeclareModule = DeclareModule;
  3505. exports.DeclareModuleExports = DeclareModuleExports;
  3506. exports.DeclareTypeAlias = DeclareTypeAlias;
  3507. exports.DeclareOpaqueType = DeclareOpaqueType;
  3508. exports.DeclareVariable = DeclareVariable;
  3509. exports.DeclareExportDeclaration = DeclareExportDeclaration;
  3510. exports.ExistentialTypeParam = ExistentialTypeParam;
  3511. exports.FunctionTypeAnnotation = FunctionTypeAnnotation;
  3512. exports.FunctionTypeParam = FunctionTypeParam;
  3513. exports.InterfaceExtends = InterfaceExtends;
  3514. exports._interfaceish = _interfaceish;
  3515. exports._variance = _variance;
  3516. exports.InterfaceDeclaration = InterfaceDeclaration;
  3517. exports.IntersectionTypeAnnotation = IntersectionTypeAnnotation;
  3518. exports.MixedTypeAnnotation = MixedTypeAnnotation;
  3519. exports.EmptyTypeAnnotation = EmptyTypeAnnotation;
  3520. exports.NullableTypeAnnotation = NullableTypeAnnotation;
  3521. var _types = require("./types");
  3522. Object.defineProperty(exports, "NumericLiteralTypeAnnotation", {
  3523. enumerable: true,
  3524. get: function get() {
  3525. return _types.NumericLiteral;
  3526. }
  3527. });
  3528. Object.defineProperty(exports, "StringLiteralTypeAnnotation", {
  3529. enumerable: true,
  3530. get: function get() {
  3531. return _types.StringLiteral;
  3532. }
  3533. });
  3534. exports.NumberTypeAnnotation = NumberTypeAnnotation;
  3535. exports.StringTypeAnnotation = StringTypeAnnotation;
  3536. exports.ThisTypeAnnotation = ThisTypeAnnotation;
  3537. exports.TupleTypeAnnotation = TupleTypeAnnotation;
  3538. exports.TypeofTypeAnnotation = TypeofTypeAnnotation;
  3539. exports.TypeAlias = TypeAlias;
  3540. exports.OpaqueType = OpaqueType;
  3541. exports.TypeAnnotation = TypeAnnotation;
  3542. exports.TypeParameter = TypeParameter;
  3543. exports.TypeParameterInstantiation = TypeParameterInstantiation;
  3544. exports.ObjectTypeAnnotation = ObjectTypeAnnotation;
  3545. exports.ObjectTypeCallProperty = ObjectTypeCallProperty;
  3546. exports.ObjectTypeIndexer = ObjectTypeIndexer;
  3547. exports.ObjectTypeProperty = ObjectTypeProperty;
  3548. exports.ObjectTypeSpreadProperty = ObjectTypeSpreadProperty;
  3549. exports.QualifiedTypeIdentifier = QualifiedTypeIdentifier;
  3550. exports.UnionTypeAnnotation = UnionTypeAnnotation;
  3551. exports.TypeCastExpression = TypeCastExpression;
  3552. exports.VoidTypeAnnotation = VoidTypeAnnotation;
  3553. var _babelTypes = require("babel-types");
  3554. var t = _interopRequireWildcard(_babelTypes);
  3555. 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; } }
  3556. function AnyTypeAnnotation() {
  3557. this.word("any");
  3558. }
  3559. function ArrayTypeAnnotation(node) {
  3560. this.print(node.elementType, node);
  3561. this.token("[");
  3562. this.token("]");
  3563. }
  3564. function BooleanTypeAnnotation() {
  3565. this.word("boolean");
  3566. }
  3567. function BooleanLiteralTypeAnnotation(node) {
  3568. this.word(node.value ? "true" : "false");
  3569. }
  3570. function NullLiteralTypeAnnotation() {
  3571. this.word("null");
  3572. }
  3573. function DeclareClass(node, parent) {
  3574. if (!t.isDeclareExportDeclaration(parent)) {
  3575. this.word("declare");
  3576. this.space();
  3577. }
  3578. this.word("class");
  3579. this.space();
  3580. this._interfaceish(node);
  3581. }
  3582. function DeclareFunction(node, parent) {
  3583. if (!t.isDeclareExportDeclaration(parent)) {
  3584. this.word("declare");
  3585. this.space();
  3586. }
  3587. this.word("function");
  3588. this.space();
  3589. this.print(node.id, node);
  3590. this.print(node.id.typeAnnotation.typeAnnotation, node);
  3591. this.semicolon();
  3592. }
  3593. function DeclareInterface(node) {
  3594. this.word("declare");
  3595. this.space();
  3596. this.InterfaceDeclaration(node);
  3597. }
  3598. function DeclareModule(node) {
  3599. this.word("declare");
  3600. this.space();
  3601. this.word("module");
  3602. this.space();
  3603. this.print(node.id, node);
  3604. this.space();
  3605. this.print(node.body, node);
  3606. }
  3607. function DeclareModuleExports(node) {
  3608. this.word("declare");
  3609. this.space();
  3610. this.word("module");
  3611. this.token(".");
  3612. this.word("exports");
  3613. this.print(node.typeAnnotation, node);
  3614. }
  3615. function DeclareTypeAlias(node) {
  3616. this.word("declare");
  3617. this.space();
  3618. this.TypeAlias(node);
  3619. }
  3620. function DeclareOpaqueType(node, parent) {
  3621. if (!t.isDeclareExportDeclaration(parent)) {
  3622. this.word("declare");
  3623. this.space();
  3624. }
  3625. this.OpaqueType(node);
  3626. }
  3627. function DeclareVariable(node, parent) {
  3628. if (!t.isDeclareExportDeclaration(parent)) {
  3629. this.word("declare");
  3630. this.space();
  3631. }
  3632. this.word("var");
  3633. this.space();
  3634. this.print(node.id, node);
  3635. this.print(node.id.typeAnnotation, node);
  3636. this.semicolon();
  3637. }
  3638. function DeclareExportDeclaration(node) {
  3639. this.word("declare");
  3640. this.space();
  3641. this.word("export");
  3642. this.space();
  3643. if (node.default) {
  3644. this.word("default");
  3645. this.space();
  3646. }
  3647. FlowExportDeclaration.apply(this, arguments);
  3648. }
  3649. function FlowExportDeclaration(node) {
  3650. if (node.declaration) {
  3651. var declar = node.declaration;
  3652. this.print(declar, node);
  3653. if (!t.isStatement(declar)) this.semicolon();
  3654. } else {
  3655. this.token("{");
  3656. if (node.specifiers.length) {
  3657. this.space();
  3658. this.printList(node.specifiers, node);
  3659. this.space();
  3660. }
  3661. this.token("}");
  3662. if (node.source) {
  3663. this.space();
  3664. this.word("from");
  3665. this.space();
  3666. this.print(node.source, node);
  3667. }
  3668. this.semicolon();
  3669. }
  3670. }
  3671. function ExistentialTypeParam() {
  3672. this.token("*");
  3673. }
  3674. function FunctionTypeAnnotation(node, parent) {
  3675. this.print(node.typeParameters, node);
  3676. this.token("(");
  3677. this.printList(node.params, node);
  3678. if (node.rest) {
  3679. if (node.params.length) {
  3680. this.token(",");
  3681. this.space();
  3682. }
  3683. this.token("...");
  3684. this.print(node.rest, node);
  3685. }
  3686. this.token(")");
  3687. if (parent.type === "ObjectTypeCallProperty" || parent.type === "DeclareFunction") {
  3688. this.token(":");
  3689. } else {
  3690. this.space();
  3691. this.token("=>");
  3692. }
  3693. this.space();
  3694. this.print(node.returnType, node);
  3695. }
  3696. function FunctionTypeParam(node) {
  3697. this.print(node.name, node);
  3698. if (node.optional) this.token("?");
  3699. this.token(":");
  3700. this.space();
  3701. this.print(node.typeAnnotation, node);
  3702. }
  3703. function InterfaceExtends(node) {
  3704. this.print(node.id, node);
  3705. this.print(node.typeParameters, node);
  3706. }
  3707. exports.ClassImplements = InterfaceExtends;
  3708. exports.GenericTypeAnnotation = InterfaceExtends;
  3709. function _interfaceish(node) {
  3710. this.print(node.id, node);
  3711. this.print(node.typeParameters, node);
  3712. if (node.extends.length) {
  3713. this.space();
  3714. this.word("extends");
  3715. this.space();
  3716. this.printList(node.extends, node);
  3717. }
  3718. if (node.mixins && node.mixins.length) {
  3719. this.space();
  3720. this.word("mixins");
  3721. this.space();
  3722. this.printList(node.mixins, node);
  3723. }
  3724. this.space();
  3725. this.print(node.body, node);
  3726. }
  3727. function _variance(node) {
  3728. if (node.variance === "plus") {
  3729. this.token("+");
  3730. } else if (node.variance === "minus") {
  3731. this.token("-");
  3732. }
  3733. }
  3734. function InterfaceDeclaration(node) {
  3735. this.word("interface");
  3736. this.space();
  3737. this._interfaceish(node);
  3738. }
  3739. function andSeparator() {
  3740. this.space();
  3741. this.token("&");
  3742. this.space();
  3743. }
  3744. function IntersectionTypeAnnotation(node) {
  3745. this.printJoin(node.types, node, { separator: andSeparator });
  3746. }
  3747. function MixedTypeAnnotation() {
  3748. this.word("mixed");
  3749. }
  3750. function EmptyTypeAnnotation() {
  3751. this.word("empty");
  3752. }
  3753. function NullableTypeAnnotation(node) {
  3754. this.token("?");
  3755. this.print(node.typeAnnotation, node);
  3756. }
  3757. function NumberTypeAnnotation() {
  3758. this.word("number");
  3759. }
  3760. function StringTypeAnnotation() {
  3761. this.word("string");
  3762. }
  3763. function ThisTypeAnnotation() {
  3764. this.word("this");
  3765. }
  3766. function TupleTypeAnnotation(node) {
  3767. this.token("[");
  3768. this.printList(node.types, node);
  3769. this.token("]");
  3770. }
  3771. function TypeofTypeAnnotation(node) {
  3772. this.word("typeof");
  3773. this.space();
  3774. this.print(node.argument, node);
  3775. }
  3776. function TypeAlias(node) {
  3777. this.word("type");
  3778. this.space();
  3779. this.print(node.id, node);
  3780. this.print(node.typeParameters, node);
  3781. this.space();
  3782. this.token("=");
  3783. this.space();
  3784. this.print(node.right, node);
  3785. this.semicolon();
  3786. }
  3787. function OpaqueType(node) {
  3788. this.word("opaque");
  3789. this.space();
  3790. this.word("type");
  3791. this.space();
  3792. this.print(node.id, node);
  3793. this.print(node.typeParameters, node);
  3794. if (node.supertype) {
  3795. this.token(":");
  3796. this.space();
  3797. this.print(node.supertype, node);
  3798. }
  3799. if (node.impltype) {
  3800. this.space();
  3801. this.token("=");
  3802. this.space();
  3803. this.print(node.impltype, node);
  3804. }
  3805. this.semicolon();
  3806. }
  3807. function TypeAnnotation(node) {
  3808. this.token(":");
  3809. this.space();
  3810. if (node.optional) this.token("?");
  3811. this.print(node.typeAnnotation, node);
  3812. }
  3813. function TypeParameter(node) {
  3814. this._variance(node);
  3815. this.word(node.name);
  3816. if (node.bound) {
  3817. this.print(node.bound, node);
  3818. }
  3819. if (node.default) {
  3820. this.space();
  3821. this.token("=");
  3822. this.space();
  3823. this.print(node.default, node);
  3824. }
  3825. }
  3826. function TypeParameterInstantiation(node) {
  3827. this.token("<");
  3828. this.printList(node.params, node, {});
  3829. this.token(">");
  3830. }
  3831. exports.TypeParameterDeclaration = TypeParameterInstantiation;
  3832. function ObjectTypeAnnotation(node) {
  3833. var _this = this;
  3834. if (node.exact) {
  3835. this.token("{|");
  3836. } else {
  3837. this.token("{");
  3838. }
  3839. var props = node.properties.concat(node.callProperties, node.indexers);
  3840. if (props.length) {
  3841. this.space();
  3842. this.printJoin(props, node, {
  3843. addNewlines: function addNewlines(leading) {
  3844. if (leading && !props[0]) return 1;
  3845. },
  3846. indent: true,
  3847. statement: true,
  3848. iterator: function iterator() {
  3849. if (props.length !== 1) {
  3850. if (_this.format.flowCommaSeparator) {
  3851. _this.token(",");
  3852. } else {
  3853. _this.semicolon();
  3854. }
  3855. _this.space();
  3856. }
  3857. }
  3858. });
  3859. this.space();
  3860. }
  3861. if (node.exact) {
  3862. this.token("|}");
  3863. } else {
  3864. this.token("}");
  3865. }
  3866. }
  3867. function ObjectTypeCallProperty(node) {
  3868. if (node.static) {
  3869. this.word("static");
  3870. this.space();
  3871. }
  3872. this.print(node.value, node);
  3873. }
  3874. function ObjectTypeIndexer(node) {
  3875. if (node.static) {
  3876. this.word("static");
  3877. this.space();
  3878. }
  3879. this._variance(node);
  3880. this.token("[");
  3881. this.print(node.id, node);
  3882. this.token(":");
  3883. this.space();
  3884. this.print(node.key, node);
  3885. this.token("]");
  3886. this.token(":");
  3887. this.space();
  3888. this.print(node.value, node);
  3889. }
  3890. function ObjectTypeProperty(node) {
  3891. if (node.static) {
  3892. this.word("static");
  3893. this.space();
  3894. }
  3895. this._variance(node);
  3896. this.print(node.key, node);
  3897. if (node.optional) this.token("?");
  3898. this.token(":");
  3899. this.space();
  3900. this.print(node.value, node);
  3901. }
  3902. function ObjectTypeSpreadProperty(node) {
  3903. this.token("...");
  3904. this.print(node.argument, node);
  3905. }
  3906. function QualifiedTypeIdentifier(node) {
  3907. this.print(node.qualification, node);
  3908. this.token(".");
  3909. this.print(node.id, node);
  3910. }
  3911. function orSeparator() {
  3912. this.space();
  3913. this.token("|");
  3914. this.space();
  3915. }
  3916. function UnionTypeAnnotation(node) {
  3917. this.printJoin(node.types, node, { separator: orSeparator });
  3918. }
  3919. function TypeCastExpression(node) {
  3920. this.token("(");
  3921. this.print(node.expression, node);
  3922. this.print(node.typeAnnotation, node);
  3923. this.token(")");
  3924. }
  3925. function VoidTypeAnnotation() {
  3926. this.word("void");
  3927. }
  3928. },{"./types":43,"babel-types":151}],38:[function(require,module,exports){
  3929. "use strict";
  3930. exports.__esModule = true;
  3931. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  3932. var _getIterator3 = _interopRequireDefault(_getIterator2);
  3933. exports.JSXAttribute = JSXAttribute;
  3934. exports.JSXIdentifier = JSXIdentifier;
  3935. exports.JSXNamespacedName = JSXNamespacedName;
  3936. exports.JSXMemberExpression = JSXMemberExpression;
  3937. exports.JSXSpreadAttribute = JSXSpreadAttribute;
  3938. exports.JSXExpressionContainer = JSXExpressionContainer;
  3939. exports.JSXSpreadChild = JSXSpreadChild;
  3940. exports.JSXText = JSXText;
  3941. exports.JSXElement = JSXElement;
  3942. exports.JSXOpeningElement = JSXOpeningElement;
  3943. exports.JSXClosingElement = JSXClosingElement;
  3944. exports.JSXEmptyExpression = JSXEmptyExpression;
  3945. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3946. function JSXAttribute(node) {
  3947. this.print(node.name, node);
  3948. if (node.value) {
  3949. this.token("=");
  3950. this.print(node.value, node);
  3951. }
  3952. }
  3953. function JSXIdentifier(node) {
  3954. this.word(node.name);
  3955. }
  3956. function JSXNamespacedName(node) {
  3957. this.print(node.namespace, node);
  3958. this.token(":");
  3959. this.print(node.name, node);
  3960. }
  3961. function JSXMemberExpression(node) {
  3962. this.print(node.object, node);
  3963. this.token(".");
  3964. this.print(node.property, node);
  3965. }
  3966. function JSXSpreadAttribute(node) {
  3967. this.token("{");
  3968. this.token("...");
  3969. this.print(node.argument, node);
  3970. this.token("}");
  3971. }
  3972. function JSXExpressionContainer(node) {
  3973. this.token("{");
  3974. this.print(node.expression, node);
  3975. this.token("}");
  3976. }
  3977. function JSXSpreadChild(node) {
  3978. this.token("{");
  3979. this.token("...");
  3980. this.print(node.expression, node);
  3981. this.token("}");
  3982. }
  3983. function JSXText(node) {
  3984. this.token(node.value);
  3985. }
  3986. function JSXElement(node) {
  3987. var open = node.openingElement;
  3988. this.print(open, node);
  3989. if (open.selfClosing) return;
  3990. this.indent();
  3991. for (var _iterator = node.children, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  3992. var _ref;
  3993. if (_isArray) {
  3994. if (_i >= _iterator.length) break;
  3995. _ref = _iterator[_i++];
  3996. } else {
  3997. _i = _iterator.next();
  3998. if (_i.done) break;
  3999. _ref = _i.value;
  4000. }
  4001. var child = _ref;
  4002. this.print(child, node);
  4003. }
  4004. this.dedent();
  4005. this.print(node.closingElement, node);
  4006. }
  4007. function spaceSeparator() {
  4008. this.space();
  4009. }
  4010. function JSXOpeningElement(node) {
  4011. this.token("<");
  4012. this.print(node.name, node);
  4013. if (node.attributes.length > 0) {
  4014. this.space();
  4015. this.printJoin(node.attributes, node, { separator: spaceSeparator });
  4016. }
  4017. if (node.selfClosing) {
  4018. this.space();
  4019. this.token("/>");
  4020. } else {
  4021. this.token(">");
  4022. }
  4023. }
  4024. function JSXClosingElement(node) {
  4025. this.token("</");
  4026. this.print(node.name, node);
  4027. this.token(">");
  4028. }
  4029. function JSXEmptyExpression() {}
  4030. },{"babel-runtime/core-js/get-iterator":95}],39:[function(require,module,exports){
  4031. "use strict";
  4032. exports.__esModule = true;
  4033. exports.FunctionDeclaration = undefined;
  4034. exports._params = _params;
  4035. exports._method = _method;
  4036. exports.FunctionExpression = FunctionExpression;
  4037. exports.ArrowFunctionExpression = ArrowFunctionExpression;
  4038. var _babelTypes = require("babel-types");
  4039. var t = _interopRequireWildcard(_babelTypes);
  4040. 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; } }
  4041. function _params(node) {
  4042. var _this = this;
  4043. this.print(node.typeParameters, node);
  4044. this.token("(");
  4045. this.printList(node.params, node, {
  4046. iterator: function iterator(node) {
  4047. if (node.optional) _this.token("?");
  4048. _this.print(node.typeAnnotation, node);
  4049. }
  4050. });
  4051. this.token(")");
  4052. if (node.returnType) {
  4053. this.print(node.returnType, node);
  4054. }
  4055. }
  4056. function _method(node) {
  4057. var kind = node.kind;
  4058. var key = node.key;
  4059. if (kind === "method" || kind === "init") {
  4060. if (node.generator) {
  4061. this.token("*");
  4062. }
  4063. }
  4064. if (kind === "get" || kind === "set") {
  4065. this.word(kind);
  4066. this.space();
  4067. }
  4068. if (node.async) {
  4069. this.word("async");
  4070. this.space();
  4071. }
  4072. if (node.computed) {
  4073. this.token("[");
  4074. this.print(key, node);
  4075. this.token("]");
  4076. } else {
  4077. this.print(key, node);
  4078. }
  4079. this._params(node);
  4080. this.space();
  4081. this.print(node.body, node);
  4082. }
  4083. function FunctionExpression(node) {
  4084. if (node.async) {
  4085. this.word("async");
  4086. this.space();
  4087. }
  4088. this.word("function");
  4089. if (node.generator) this.token("*");
  4090. if (node.id) {
  4091. this.space();
  4092. this.print(node.id, node);
  4093. } else {
  4094. this.space();
  4095. }
  4096. this._params(node);
  4097. this.space();
  4098. this.print(node.body, node);
  4099. }
  4100. exports.FunctionDeclaration = FunctionExpression;
  4101. function ArrowFunctionExpression(node) {
  4102. if (node.async) {
  4103. this.word("async");
  4104. this.space();
  4105. }
  4106. var firstParam = node.params[0];
  4107. if (node.params.length === 1 && t.isIdentifier(firstParam) && !hasTypes(node, firstParam)) {
  4108. this.print(firstParam, node);
  4109. } else {
  4110. this._params(node);
  4111. }
  4112. this.space();
  4113. this.token("=>");
  4114. this.space();
  4115. this.print(node.body, node);
  4116. }
  4117. function hasTypes(node, param) {
  4118. return node.typeParameters || node.returnType || param.typeAnnotation || param.optional || param.trailingComments;
  4119. }
  4120. },{"babel-types":151}],40:[function(require,module,exports){
  4121. "use strict";
  4122. exports.__esModule = true;
  4123. exports.ImportSpecifier = ImportSpecifier;
  4124. exports.ImportDefaultSpecifier = ImportDefaultSpecifier;
  4125. exports.ExportDefaultSpecifier = ExportDefaultSpecifier;
  4126. exports.ExportSpecifier = ExportSpecifier;
  4127. exports.ExportNamespaceSpecifier = ExportNamespaceSpecifier;
  4128. exports.ExportAllDeclaration = ExportAllDeclaration;
  4129. exports.ExportNamedDeclaration = ExportNamedDeclaration;
  4130. exports.ExportDefaultDeclaration = ExportDefaultDeclaration;
  4131. exports.ImportDeclaration = ImportDeclaration;
  4132. exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier;
  4133. var _babelTypes = require("babel-types");
  4134. var t = _interopRequireWildcard(_babelTypes);
  4135. 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; } }
  4136. function ImportSpecifier(node) {
  4137. if (node.importKind === "type" || node.importKind === "typeof") {
  4138. this.word(node.importKind);
  4139. this.space();
  4140. }
  4141. this.print(node.imported, node);
  4142. if (node.local && node.local.name !== node.imported.name) {
  4143. this.space();
  4144. this.word("as");
  4145. this.space();
  4146. this.print(node.local, node);
  4147. }
  4148. }
  4149. function ImportDefaultSpecifier(node) {
  4150. this.print(node.local, node);
  4151. }
  4152. function ExportDefaultSpecifier(node) {
  4153. this.print(node.exported, node);
  4154. }
  4155. function ExportSpecifier(node) {
  4156. this.print(node.local, node);
  4157. if (node.exported && node.local.name !== node.exported.name) {
  4158. this.space();
  4159. this.word("as");
  4160. this.space();
  4161. this.print(node.exported, node);
  4162. }
  4163. }
  4164. function ExportNamespaceSpecifier(node) {
  4165. this.token("*");
  4166. this.space();
  4167. this.word("as");
  4168. this.space();
  4169. this.print(node.exported, node);
  4170. }
  4171. function ExportAllDeclaration(node) {
  4172. this.word("export");
  4173. this.space();
  4174. this.token("*");
  4175. this.space();
  4176. this.word("from");
  4177. this.space();
  4178. this.print(node.source, node);
  4179. this.semicolon();
  4180. }
  4181. function ExportNamedDeclaration() {
  4182. this.word("export");
  4183. this.space();
  4184. ExportDeclaration.apply(this, arguments);
  4185. }
  4186. function ExportDefaultDeclaration() {
  4187. this.word("export");
  4188. this.space();
  4189. this.word("default");
  4190. this.space();
  4191. ExportDeclaration.apply(this, arguments);
  4192. }
  4193. function ExportDeclaration(node) {
  4194. if (node.declaration) {
  4195. var declar = node.declaration;
  4196. this.print(declar, node);
  4197. if (!t.isStatement(declar)) this.semicolon();
  4198. } else {
  4199. if (node.exportKind === "type") {
  4200. this.word("type");
  4201. this.space();
  4202. }
  4203. var specifiers = node.specifiers.slice(0);
  4204. var hasSpecial = false;
  4205. while (true) {
  4206. var first = specifiers[0];
  4207. if (t.isExportDefaultSpecifier(first) || t.isExportNamespaceSpecifier(first)) {
  4208. hasSpecial = true;
  4209. this.print(specifiers.shift(), node);
  4210. if (specifiers.length) {
  4211. this.token(",");
  4212. this.space();
  4213. }
  4214. } else {
  4215. break;
  4216. }
  4217. }
  4218. if (specifiers.length || !specifiers.length && !hasSpecial) {
  4219. this.token("{");
  4220. if (specifiers.length) {
  4221. this.space();
  4222. this.printList(specifiers, node);
  4223. this.space();
  4224. }
  4225. this.token("}");
  4226. }
  4227. if (node.source) {
  4228. this.space();
  4229. this.word("from");
  4230. this.space();
  4231. this.print(node.source, node);
  4232. }
  4233. this.semicolon();
  4234. }
  4235. }
  4236. function ImportDeclaration(node) {
  4237. this.word("import");
  4238. this.space();
  4239. if (node.importKind === "type" || node.importKind === "typeof") {
  4240. this.word(node.importKind);
  4241. this.space();
  4242. }
  4243. var specifiers = node.specifiers.slice(0);
  4244. if (specifiers && specifiers.length) {
  4245. while (true) {
  4246. var first = specifiers[0];
  4247. if (t.isImportDefaultSpecifier(first) || t.isImportNamespaceSpecifier(first)) {
  4248. this.print(specifiers.shift(), node);
  4249. if (specifiers.length) {
  4250. this.token(",");
  4251. this.space();
  4252. }
  4253. } else {
  4254. break;
  4255. }
  4256. }
  4257. if (specifiers.length) {
  4258. this.token("{");
  4259. this.space();
  4260. this.printList(specifiers, node);
  4261. this.space();
  4262. this.token("}");
  4263. }
  4264. this.space();
  4265. this.word("from");
  4266. this.space();
  4267. }
  4268. this.print(node.source, node);
  4269. this.semicolon();
  4270. }
  4271. function ImportNamespaceSpecifier(node) {
  4272. this.token("*");
  4273. this.space();
  4274. this.word("as");
  4275. this.space();
  4276. this.print(node.local, node);
  4277. }
  4278. },{"babel-types":151}],41:[function(require,module,exports){
  4279. "use strict";
  4280. exports.__esModule = true;
  4281. exports.ThrowStatement = exports.BreakStatement = exports.ReturnStatement = exports.ContinueStatement = exports.ForAwaitStatement = exports.ForOfStatement = exports.ForInStatement = undefined;
  4282. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  4283. var _getIterator3 = _interopRequireDefault(_getIterator2);
  4284. exports.WithStatement = WithStatement;
  4285. exports.IfStatement = IfStatement;
  4286. exports.ForStatement = ForStatement;
  4287. exports.WhileStatement = WhileStatement;
  4288. exports.DoWhileStatement = DoWhileStatement;
  4289. exports.LabeledStatement = LabeledStatement;
  4290. exports.TryStatement = TryStatement;
  4291. exports.CatchClause = CatchClause;
  4292. exports.SwitchStatement = SwitchStatement;
  4293. exports.SwitchCase = SwitchCase;
  4294. exports.DebuggerStatement = DebuggerStatement;
  4295. exports.VariableDeclaration = VariableDeclaration;
  4296. exports.VariableDeclarator = VariableDeclarator;
  4297. var _babelTypes = require("babel-types");
  4298. var t = _interopRequireWildcard(_babelTypes);
  4299. 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; } }
  4300. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4301. function WithStatement(node) {
  4302. this.word("with");
  4303. this.space();
  4304. this.token("(");
  4305. this.print(node.object, node);
  4306. this.token(")");
  4307. this.printBlock(node);
  4308. }
  4309. function IfStatement(node) {
  4310. this.word("if");
  4311. this.space();
  4312. this.token("(");
  4313. this.print(node.test, node);
  4314. this.token(")");
  4315. this.space();
  4316. var needsBlock = node.alternate && t.isIfStatement(getLastStatement(node.consequent));
  4317. if (needsBlock) {
  4318. this.token("{");
  4319. this.newline();
  4320. this.indent();
  4321. }
  4322. this.printAndIndentOnComments(node.consequent, node);
  4323. if (needsBlock) {
  4324. this.dedent();
  4325. this.newline();
  4326. this.token("}");
  4327. }
  4328. if (node.alternate) {
  4329. if (this.endsWith("}")) this.space();
  4330. this.word("else");
  4331. this.space();
  4332. this.printAndIndentOnComments(node.alternate, node);
  4333. }
  4334. }
  4335. function getLastStatement(statement) {
  4336. if (!t.isStatement(statement.body)) return statement;
  4337. return getLastStatement(statement.body);
  4338. }
  4339. function ForStatement(node) {
  4340. this.word("for");
  4341. this.space();
  4342. this.token("(");
  4343. this.inForStatementInitCounter++;
  4344. this.print(node.init, node);
  4345. this.inForStatementInitCounter--;
  4346. this.token(";");
  4347. if (node.test) {
  4348. this.space();
  4349. this.print(node.test, node);
  4350. }
  4351. this.token(";");
  4352. if (node.update) {
  4353. this.space();
  4354. this.print(node.update, node);
  4355. }
  4356. this.token(")");
  4357. this.printBlock(node);
  4358. }
  4359. function WhileStatement(node) {
  4360. this.word("while");
  4361. this.space();
  4362. this.token("(");
  4363. this.print(node.test, node);
  4364. this.token(")");
  4365. this.printBlock(node);
  4366. }
  4367. var buildForXStatement = function buildForXStatement(op) {
  4368. return function (node) {
  4369. this.word("for");
  4370. this.space();
  4371. if (op === "await") {
  4372. this.word("await");
  4373. this.space();
  4374. }
  4375. this.token("(");
  4376. this.print(node.left, node);
  4377. this.space();
  4378. this.word(op === "await" ? "of" : op);
  4379. this.space();
  4380. this.print(node.right, node);
  4381. this.token(")");
  4382. this.printBlock(node);
  4383. };
  4384. };
  4385. var ForInStatement = exports.ForInStatement = buildForXStatement("in");
  4386. var ForOfStatement = exports.ForOfStatement = buildForXStatement("of");
  4387. var ForAwaitStatement = exports.ForAwaitStatement = buildForXStatement("await");
  4388. function DoWhileStatement(node) {
  4389. this.word("do");
  4390. this.space();
  4391. this.print(node.body, node);
  4392. this.space();
  4393. this.word("while");
  4394. this.space();
  4395. this.token("(");
  4396. this.print(node.test, node);
  4397. this.token(")");
  4398. this.semicolon();
  4399. }
  4400. function buildLabelStatement(prefix) {
  4401. var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "label";
  4402. return function (node) {
  4403. this.word(prefix);
  4404. var label = node[key];
  4405. if (label) {
  4406. this.space();
  4407. var terminatorState = this.startTerminatorless();
  4408. this.print(label, node);
  4409. this.endTerminatorless(terminatorState);
  4410. }
  4411. this.semicolon();
  4412. };
  4413. }
  4414. var ContinueStatement = exports.ContinueStatement = buildLabelStatement("continue");
  4415. var ReturnStatement = exports.ReturnStatement = buildLabelStatement("return", "argument");
  4416. var BreakStatement = exports.BreakStatement = buildLabelStatement("break");
  4417. var ThrowStatement = exports.ThrowStatement = buildLabelStatement("throw", "argument");
  4418. function LabeledStatement(node) {
  4419. this.print(node.label, node);
  4420. this.token(":");
  4421. this.space();
  4422. this.print(node.body, node);
  4423. }
  4424. function TryStatement(node) {
  4425. this.word("try");
  4426. this.space();
  4427. this.print(node.block, node);
  4428. this.space();
  4429. if (node.handlers) {
  4430. this.print(node.handlers[0], node);
  4431. } else {
  4432. this.print(node.handler, node);
  4433. }
  4434. if (node.finalizer) {
  4435. this.space();
  4436. this.word("finally");
  4437. this.space();
  4438. this.print(node.finalizer, node);
  4439. }
  4440. }
  4441. function CatchClause(node) {
  4442. this.word("catch");
  4443. this.space();
  4444. this.token("(");
  4445. this.print(node.param, node);
  4446. this.token(")");
  4447. this.space();
  4448. this.print(node.body, node);
  4449. }
  4450. function SwitchStatement(node) {
  4451. this.word("switch");
  4452. this.space();
  4453. this.token("(");
  4454. this.print(node.discriminant, node);
  4455. this.token(")");
  4456. this.space();
  4457. this.token("{");
  4458. this.printSequence(node.cases, node, {
  4459. indent: true,
  4460. addNewlines: function addNewlines(leading, cas) {
  4461. if (!leading && node.cases[node.cases.length - 1] === cas) return -1;
  4462. }
  4463. });
  4464. this.token("}");
  4465. }
  4466. function SwitchCase(node) {
  4467. if (node.test) {
  4468. this.word("case");
  4469. this.space();
  4470. this.print(node.test, node);
  4471. this.token(":");
  4472. } else {
  4473. this.word("default");
  4474. this.token(":");
  4475. }
  4476. if (node.consequent.length) {
  4477. this.newline();
  4478. this.printSequence(node.consequent, node, { indent: true });
  4479. }
  4480. }
  4481. function DebuggerStatement() {
  4482. this.word("debugger");
  4483. this.semicolon();
  4484. }
  4485. function variableDeclarationIdent() {
  4486. this.token(",");
  4487. this.newline();
  4488. if (this.endsWith("\n")) for (var i = 0; i < 4; i++) {
  4489. this.space(true);
  4490. }
  4491. }
  4492. function constDeclarationIdent() {
  4493. this.token(",");
  4494. this.newline();
  4495. if (this.endsWith("\n")) for (var i = 0; i < 6; i++) {
  4496. this.space(true);
  4497. }
  4498. }
  4499. function VariableDeclaration(node, parent) {
  4500. this.word(node.kind);
  4501. this.space();
  4502. var hasInits = false;
  4503. if (!t.isFor(parent)) {
  4504. for (var _iterator = node.declarations, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  4505. var _ref;
  4506. if (_isArray) {
  4507. if (_i >= _iterator.length) break;
  4508. _ref = _iterator[_i++];
  4509. } else {
  4510. _i = _iterator.next();
  4511. if (_i.done) break;
  4512. _ref = _i.value;
  4513. }
  4514. var declar = _ref;
  4515. if (declar.init) {
  4516. hasInits = true;
  4517. }
  4518. }
  4519. }
  4520. var separator = void 0;
  4521. if (hasInits) {
  4522. separator = node.kind === "const" ? constDeclarationIdent : variableDeclarationIdent;
  4523. }
  4524. this.printList(node.declarations, node, { separator: separator });
  4525. if (t.isFor(parent)) {
  4526. if (parent.left === node || parent.init === node) return;
  4527. }
  4528. this.semicolon();
  4529. }
  4530. function VariableDeclarator(node) {
  4531. this.print(node.id, node);
  4532. this.print(node.id.typeAnnotation, node);
  4533. if (node.init) {
  4534. this.space();
  4535. this.token("=");
  4536. this.space();
  4537. this.print(node.init, node);
  4538. }
  4539. }
  4540. },{"babel-runtime/core-js/get-iterator":95,"babel-types":151}],42:[function(require,module,exports){
  4541. "use strict";
  4542. exports.__esModule = true;
  4543. exports.TaggedTemplateExpression = TaggedTemplateExpression;
  4544. exports.TemplateElement = TemplateElement;
  4545. exports.TemplateLiteral = TemplateLiteral;
  4546. function TaggedTemplateExpression(node) {
  4547. this.print(node.tag, node);
  4548. this.print(node.quasi, node);
  4549. }
  4550. function TemplateElement(node, parent) {
  4551. var isFirst = parent.quasis[0] === node;
  4552. var isLast = parent.quasis[parent.quasis.length - 1] === node;
  4553. var value = (isFirst ? "`" : "}") + node.value.raw + (isLast ? "`" : "${");
  4554. this.token(value);
  4555. }
  4556. function TemplateLiteral(node) {
  4557. var quasis = node.quasis;
  4558. for (var i = 0; i < quasis.length; i++) {
  4559. this.print(quasis[i], node);
  4560. if (i + 1 < quasis.length) {
  4561. this.print(node.expressions[i], node);
  4562. }
  4563. }
  4564. }
  4565. },{}],43:[function(require,module,exports){
  4566. "use strict";
  4567. exports.__esModule = true;
  4568. exports.ArrayPattern = exports.ObjectPattern = exports.RestProperty = exports.SpreadProperty = exports.SpreadElement = undefined;
  4569. exports.Identifier = Identifier;
  4570. exports.RestElement = RestElement;
  4571. exports.ObjectExpression = ObjectExpression;
  4572. exports.ObjectMethod = ObjectMethod;
  4573. exports.ObjectProperty = ObjectProperty;
  4574. exports.ArrayExpression = ArrayExpression;
  4575. exports.RegExpLiteral = RegExpLiteral;
  4576. exports.BooleanLiteral = BooleanLiteral;
  4577. exports.NullLiteral = NullLiteral;
  4578. exports.NumericLiteral = NumericLiteral;
  4579. exports.StringLiteral = StringLiteral;
  4580. var _babelTypes = require("babel-types");
  4581. var t = _interopRequireWildcard(_babelTypes);
  4582. var _jsesc = require("jsesc");
  4583. var _jsesc2 = _interopRequireDefault(_jsesc);
  4584. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4585. 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; } }
  4586. function Identifier(node) {
  4587. if (node.variance) {
  4588. if (node.variance === "plus") {
  4589. this.token("+");
  4590. } else if (node.variance === "minus") {
  4591. this.token("-");
  4592. }
  4593. }
  4594. this.word(node.name);
  4595. }
  4596. function RestElement(node) {
  4597. this.token("...");
  4598. this.print(node.argument, node);
  4599. }
  4600. exports.SpreadElement = RestElement;
  4601. exports.SpreadProperty = RestElement;
  4602. exports.RestProperty = RestElement;
  4603. function ObjectExpression(node) {
  4604. var props = node.properties;
  4605. this.token("{");
  4606. this.printInnerComments(node);
  4607. if (props.length) {
  4608. this.space();
  4609. this.printList(props, node, { indent: true, statement: true });
  4610. this.space();
  4611. }
  4612. this.token("}");
  4613. }
  4614. exports.ObjectPattern = ObjectExpression;
  4615. function ObjectMethod(node) {
  4616. this.printJoin(node.decorators, node);
  4617. this._method(node);
  4618. }
  4619. function ObjectProperty(node) {
  4620. this.printJoin(node.decorators, node);
  4621. if (node.computed) {
  4622. this.token("[");
  4623. this.print(node.key, node);
  4624. this.token("]");
  4625. } else {
  4626. if (t.isAssignmentPattern(node.value) && t.isIdentifier(node.key) && node.key.name === node.value.left.name) {
  4627. this.print(node.value, node);
  4628. return;
  4629. }
  4630. this.print(node.key, node);
  4631. if (node.shorthand && t.isIdentifier(node.key) && t.isIdentifier(node.value) && node.key.name === node.value.name) {
  4632. return;
  4633. }
  4634. }
  4635. this.token(":");
  4636. this.space();
  4637. this.print(node.value, node);
  4638. }
  4639. function ArrayExpression(node) {
  4640. var elems = node.elements;
  4641. var len = elems.length;
  4642. this.token("[");
  4643. this.printInnerComments(node);
  4644. for (var i = 0; i < elems.length; i++) {
  4645. var elem = elems[i];
  4646. if (elem) {
  4647. if (i > 0) this.space();
  4648. this.print(elem, node);
  4649. if (i < len - 1) this.token(",");
  4650. } else {
  4651. this.token(",");
  4652. }
  4653. }
  4654. this.token("]");
  4655. }
  4656. exports.ArrayPattern = ArrayExpression;
  4657. function RegExpLiteral(node) {
  4658. this.word("/" + node.pattern + "/" + node.flags);
  4659. }
  4660. function BooleanLiteral(node) {
  4661. this.word(node.value ? "true" : "false");
  4662. }
  4663. function NullLiteral() {
  4664. this.word("null");
  4665. }
  4666. function NumericLiteral(node) {
  4667. var raw = this.getPossibleRaw(node);
  4668. var value = node.value + "";
  4669. if (raw == null) {
  4670. this.number(value);
  4671. } else if (this.format.minified) {
  4672. this.number(raw.length < value.length ? raw : value);
  4673. } else {
  4674. this.number(raw);
  4675. }
  4676. }
  4677. function StringLiteral(node, parent) {
  4678. var raw = this.getPossibleRaw(node);
  4679. if (!this.format.minified && raw != null) {
  4680. this.token(raw);
  4681. return;
  4682. }
  4683. var opts = {
  4684. quotes: t.isJSX(parent) ? "double" : this.format.quotes,
  4685. wrap: true
  4686. };
  4687. if (this.format.jsonCompatibleStrings) {
  4688. opts.json = true;
  4689. }
  4690. var val = (0, _jsesc2.default)(node.value, opts);
  4691. return this.token(val);
  4692. }
  4693. },{"babel-types":151,"jsesc":296}],44:[function(require,module,exports){
  4694. "use strict";
  4695. exports.__esModule = true;
  4696. exports.CodeGenerator = undefined;
  4697. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  4698. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  4699. var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn");
  4700. var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
  4701. var _inherits2 = require("babel-runtime/helpers/inherits");
  4702. var _inherits3 = _interopRequireDefault(_inherits2);
  4703. exports.default = function (ast, opts, code) {
  4704. var gen = new Generator(ast, opts, code);
  4705. return gen.generate();
  4706. };
  4707. var _detectIndent = require("detect-indent");
  4708. var _detectIndent2 = _interopRequireDefault(_detectIndent);
  4709. var _sourceMap = require("./source-map");
  4710. var _sourceMap2 = _interopRequireDefault(_sourceMap);
  4711. var _babelMessages = require("babel-messages");
  4712. var messages = _interopRequireWildcard(_babelMessages);
  4713. var _printer = require("./printer");
  4714. var _printer2 = _interopRequireDefault(_printer);
  4715. 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; } }
  4716. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4717. var Generator = function (_Printer) {
  4718. (0, _inherits3.default)(Generator, _Printer);
  4719. function Generator(ast) {
  4720. var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  4721. var code = arguments[2];
  4722. (0, _classCallCheck3.default)(this, Generator);
  4723. var tokens = ast.tokens || [];
  4724. var format = normalizeOptions(code, opts, tokens);
  4725. var map = opts.sourceMaps ? new _sourceMap2.default(opts, code) : null;
  4726. var _this = (0, _possibleConstructorReturn3.default)(this, _Printer.call(this, format, map, tokens));
  4727. _this.ast = ast;
  4728. return _this;
  4729. }
  4730. Generator.prototype.generate = function generate() {
  4731. return _Printer.prototype.generate.call(this, this.ast);
  4732. };
  4733. return Generator;
  4734. }(_printer2.default);
  4735. function normalizeOptions(code, opts, tokens) {
  4736. var style = " ";
  4737. if (code && typeof code === "string") {
  4738. var indent = (0, _detectIndent2.default)(code).indent;
  4739. if (indent && indent !== " ") style = indent;
  4740. }
  4741. var format = {
  4742. auxiliaryCommentBefore: opts.auxiliaryCommentBefore,
  4743. auxiliaryCommentAfter: opts.auxiliaryCommentAfter,
  4744. shouldPrintComment: opts.shouldPrintComment,
  4745. retainLines: opts.retainLines,
  4746. retainFunctionParens: opts.retainFunctionParens,
  4747. comments: opts.comments == null || opts.comments,
  4748. compact: opts.compact,
  4749. minified: opts.minified,
  4750. concise: opts.concise,
  4751. quotes: opts.quotes || findCommonStringDelimiter(code, tokens),
  4752. jsonCompatibleStrings: opts.jsonCompatibleStrings,
  4753. indent: {
  4754. adjustMultilineComment: true,
  4755. style: style,
  4756. base: 0
  4757. },
  4758. flowCommaSeparator: opts.flowCommaSeparator
  4759. };
  4760. if (format.minified) {
  4761. format.compact = true;
  4762. format.shouldPrintComment = format.shouldPrintComment || function () {
  4763. return format.comments;
  4764. };
  4765. } else {
  4766. format.shouldPrintComment = format.shouldPrintComment || function (value) {
  4767. return format.comments || value.indexOf("@license") >= 0 || value.indexOf("@preserve") >= 0;
  4768. };
  4769. }
  4770. if (format.compact === "auto") {
  4771. format.compact = code.length > 500000;
  4772. if (format.compact) {
  4773. console.error("[BABEL] " + messages.get("codeGeneratorDeopt", opts.filename, "500KB"));
  4774. }
  4775. }
  4776. if (format.compact) {
  4777. format.indent.adjustMultilineComment = false;
  4778. }
  4779. return format;
  4780. }
  4781. function findCommonStringDelimiter(code, tokens) {
  4782. var DEFAULT_STRING_DELIMITER = "double";
  4783. if (!code) {
  4784. return DEFAULT_STRING_DELIMITER;
  4785. }
  4786. var occurrences = {
  4787. single: 0,
  4788. double: 0
  4789. };
  4790. var checked = 0;
  4791. for (var i = 0; i < tokens.length; i++) {
  4792. var token = tokens[i];
  4793. if (token.type.label !== "string") continue;
  4794. var raw = code.slice(token.start, token.end);
  4795. if (raw[0] === "'") {
  4796. occurrences.single++;
  4797. } else {
  4798. occurrences.double++;
  4799. }
  4800. checked++;
  4801. if (checked >= 3) break;
  4802. }
  4803. if (occurrences.single > occurrences.double) {
  4804. return "single";
  4805. } else {
  4806. return "double";
  4807. }
  4808. }
  4809. var CodeGenerator = exports.CodeGenerator = function () {
  4810. function CodeGenerator(ast, opts, code) {
  4811. (0, _classCallCheck3.default)(this, CodeGenerator);
  4812. this._generator = new Generator(ast, opts, code);
  4813. }
  4814. CodeGenerator.prototype.generate = function generate() {
  4815. return this._generator.generate();
  4816. };
  4817. return CodeGenerator;
  4818. }();
  4819. },{"./printer":48,"./source-map":49,"babel-messages":61,"babel-runtime/helpers/classCallCheck":109,"babel-runtime/helpers/inherits":110,"babel-runtime/helpers/possibleConstructorReturn":112,"detect-indent":282}],45:[function(require,module,exports){
  4820. "use strict";
  4821. exports.__esModule = true;
  4822. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  4823. var _getIterator3 = _interopRequireDefault(_getIterator2);
  4824. var _keys = require("babel-runtime/core-js/object/keys");
  4825. var _keys2 = _interopRequireDefault(_keys);
  4826. exports.needsWhitespace = needsWhitespace;
  4827. exports.needsWhitespaceBefore = needsWhitespaceBefore;
  4828. exports.needsWhitespaceAfter = needsWhitespaceAfter;
  4829. exports.needsParens = needsParens;
  4830. var _whitespace = require("./whitespace");
  4831. var _whitespace2 = _interopRequireDefault(_whitespace);
  4832. var _parentheses = require("./parentheses");
  4833. var parens = _interopRequireWildcard(_parentheses);
  4834. var _babelTypes = require("babel-types");
  4835. var t = _interopRequireWildcard(_babelTypes);
  4836. 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; } }
  4837. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4838. function expandAliases(obj) {
  4839. var newObj = {};
  4840. function add(type, func) {
  4841. var fn = newObj[type];
  4842. newObj[type] = fn ? function (node, parent, stack) {
  4843. var result = fn(node, parent, stack);
  4844. return result == null ? func(node, parent, stack) : result;
  4845. } : func;
  4846. }
  4847. for (var _iterator = (0, _keys2.default)(obj), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  4848. var _ref;
  4849. if (_isArray) {
  4850. if (_i >= _iterator.length) break;
  4851. _ref = _iterator[_i++];
  4852. } else {
  4853. _i = _iterator.next();
  4854. if (_i.done) break;
  4855. _ref = _i.value;
  4856. }
  4857. var type = _ref;
  4858. var aliases = t.FLIPPED_ALIAS_KEYS[type];
  4859. if (aliases) {
  4860. for (var _iterator2 = aliases, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  4861. var _ref2;
  4862. if (_isArray2) {
  4863. if (_i2 >= _iterator2.length) break;
  4864. _ref2 = _iterator2[_i2++];
  4865. } else {
  4866. _i2 = _iterator2.next();
  4867. if (_i2.done) break;
  4868. _ref2 = _i2.value;
  4869. }
  4870. var alias = _ref2;
  4871. add(alias, obj[type]);
  4872. }
  4873. } else {
  4874. add(type, obj[type]);
  4875. }
  4876. }
  4877. return newObj;
  4878. }
  4879. var expandedParens = expandAliases(parens);
  4880. var expandedWhitespaceNodes = expandAliases(_whitespace2.default.nodes);
  4881. var expandedWhitespaceList = expandAliases(_whitespace2.default.list);
  4882. function find(obj, node, parent, printStack) {
  4883. var fn = obj[node.type];
  4884. return fn ? fn(node, parent, printStack) : null;
  4885. }
  4886. function isOrHasCallExpression(node) {
  4887. if (t.isCallExpression(node)) {
  4888. return true;
  4889. }
  4890. if (t.isMemberExpression(node)) {
  4891. return isOrHasCallExpression(node.object) || !node.computed && isOrHasCallExpression(node.property);
  4892. } else {
  4893. return false;
  4894. }
  4895. }
  4896. function needsWhitespace(node, parent, type) {
  4897. if (!node) return 0;
  4898. if (t.isExpressionStatement(node)) {
  4899. node = node.expression;
  4900. }
  4901. var linesInfo = find(expandedWhitespaceNodes, node, parent);
  4902. if (!linesInfo) {
  4903. var items = find(expandedWhitespaceList, node, parent);
  4904. if (items) {
  4905. for (var i = 0; i < items.length; i++) {
  4906. linesInfo = needsWhitespace(items[i], node, type);
  4907. if (linesInfo) break;
  4908. }
  4909. }
  4910. }
  4911. return linesInfo && linesInfo[type] || 0;
  4912. }
  4913. function needsWhitespaceBefore(node, parent) {
  4914. return needsWhitespace(node, parent, "before");
  4915. }
  4916. function needsWhitespaceAfter(node, parent) {
  4917. return needsWhitespace(node, parent, "after");
  4918. }
  4919. function needsParens(node, parent, printStack) {
  4920. if (!parent) return false;
  4921. if (t.isNewExpression(parent) && parent.callee === node) {
  4922. if (isOrHasCallExpression(node)) return true;
  4923. }
  4924. return find(expandedParens, node, parent, printStack);
  4925. }
  4926. },{"./parentheses":46,"./whitespace":47,"babel-runtime/core-js/get-iterator":95,"babel-runtime/core-js/object/keys":102,"babel-types":151}],46:[function(require,module,exports){
  4927. "use strict";
  4928. exports.__esModule = true;
  4929. exports.AwaitExpression = exports.FunctionTypeAnnotation = undefined;
  4930. exports.NullableTypeAnnotation = NullableTypeAnnotation;
  4931. exports.UpdateExpression = UpdateExpression;
  4932. exports.ObjectExpression = ObjectExpression;
  4933. exports.DoExpression = DoExpression;
  4934. exports.Binary = Binary;
  4935. exports.BinaryExpression = BinaryExpression;
  4936. exports.SequenceExpression = SequenceExpression;
  4937. exports.YieldExpression = YieldExpression;
  4938. exports.ClassExpression = ClassExpression;
  4939. exports.UnaryLike = UnaryLike;
  4940. exports.FunctionExpression = FunctionExpression;
  4941. exports.ArrowFunctionExpression = ArrowFunctionExpression;
  4942. exports.ConditionalExpression = ConditionalExpression;
  4943. exports.AssignmentExpression = AssignmentExpression;
  4944. var _babelTypes = require("babel-types");
  4945. var t = _interopRequireWildcard(_babelTypes);
  4946. 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; } }
  4947. var PRECEDENCE = {
  4948. "||": 0,
  4949. "&&": 1,
  4950. "|": 2,
  4951. "^": 3,
  4952. "&": 4,
  4953. "==": 5,
  4954. "===": 5,
  4955. "!=": 5,
  4956. "!==": 5,
  4957. "<": 6,
  4958. ">": 6,
  4959. "<=": 6,
  4960. ">=": 6,
  4961. in: 6,
  4962. instanceof: 6,
  4963. ">>": 7,
  4964. "<<": 7,
  4965. ">>>": 7,
  4966. "+": 8,
  4967. "-": 8,
  4968. "*": 9,
  4969. "/": 9,
  4970. "%": 9,
  4971. "**": 10
  4972. };
  4973. function NullableTypeAnnotation(node, parent) {
  4974. return t.isArrayTypeAnnotation(parent);
  4975. }
  4976. exports.FunctionTypeAnnotation = NullableTypeAnnotation;
  4977. function UpdateExpression(node, parent) {
  4978. return t.isMemberExpression(parent) && parent.object === node;
  4979. }
  4980. function ObjectExpression(node, parent, printStack) {
  4981. return isFirstInStatement(printStack, { considerArrow: true });
  4982. }
  4983. function DoExpression(node, parent, printStack) {
  4984. return isFirstInStatement(printStack);
  4985. }
  4986. function Binary(node, parent) {
  4987. if ((t.isCallExpression(parent) || t.isNewExpression(parent)) && parent.callee === node || t.isUnaryLike(parent) || t.isMemberExpression(parent) && parent.object === node || t.isAwaitExpression(parent)) {
  4988. return true;
  4989. }
  4990. if (t.isBinary(parent)) {
  4991. var parentOp = parent.operator;
  4992. var parentPos = PRECEDENCE[parentOp];
  4993. var nodeOp = node.operator;
  4994. var nodePos = PRECEDENCE[nodeOp];
  4995. if (parentPos === nodePos && parent.right === node && !t.isLogicalExpression(parent) || parentPos > nodePos) {
  4996. return true;
  4997. }
  4998. }
  4999. return false;
  5000. }
  5001. function BinaryExpression(node, parent) {
  5002. return node.operator === "in" && (t.isVariableDeclarator(parent) || t.isFor(parent));
  5003. }
  5004. function SequenceExpression(node, parent) {
  5005. if (t.isForStatement(parent) || t.isThrowStatement(parent) || t.isReturnStatement(parent) || t.isIfStatement(parent) && parent.test === node || t.isWhileStatement(parent) && parent.test === node || t.isForInStatement(parent) && parent.right === node || t.isSwitchStatement(parent) && parent.discriminant === node || t.isExpressionStatement(parent) && parent.expression === node) {
  5006. return false;
  5007. }
  5008. return true;
  5009. }
  5010. function YieldExpression(node, parent) {
  5011. return t.isBinary(parent) || t.isUnaryLike(parent) || t.isCallExpression(parent) || t.isMemberExpression(parent) || t.isNewExpression(parent) || t.isConditionalExpression(parent) && node === parent.test;
  5012. }
  5013. exports.AwaitExpression = YieldExpression;
  5014. function ClassExpression(node, parent, printStack) {
  5015. return isFirstInStatement(printStack, { considerDefaultExports: true });
  5016. }
  5017. function UnaryLike(node, parent) {
  5018. return t.isMemberExpression(parent, { object: node }) || t.isCallExpression(parent, { callee: node }) || t.isNewExpression(parent, { callee: node });
  5019. }
  5020. function FunctionExpression(node, parent, printStack) {
  5021. return isFirstInStatement(printStack, { considerDefaultExports: true });
  5022. }
  5023. function ArrowFunctionExpression(node, parent) {
  5024. if (t.isExportDeclaration(parent) || t.isBinaryExpression(parent) || t.isLogicalExpression(parent) || t.isUnaryExpression(parent) || t.isTaggedTemplateExpression(parent)) {
  5025. return true;
  5026. }
  5027. return UnaryLike(node, parent);
  5028. }
  5029. function ConditionalExpression(node, parent) {
  5030. if (t.isUnaryLike(parent) || t.isBinary(parent) || t.isConditionalExpression(parent, { test: node }) || t.isAwaitExpression(parent)) {
  5031. return true;
  5032. }
  5033. return UnaryLike(node, parent);
  5034. }
  5035. function AssignmentExpression(node) {
  5036. if (t.isObjectPattern(node.left)) {
  5037. return true;
  5038. } else {
  5039. return ConditionalExpression.apply(undefined, arguments);
  5040. }
  5041. }
  5042. function isFirstInStatement(printStack) {
  5043. var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  5044. _ref$considerArrow = _ref.considerArrow,
  5045. considerArrow = _ref$considerArrow === undefined ? false : _ref$considerArrow,
  5046. _ref$considerDefaultE = _ref.considerDefaultExports,
  5047. considerDefaultExports = _ref$considerDefaultE === undefined ? false : _ref$considerDefaultE;
  5048. var i = printStack.length - 1;
  5049. var node = printStack[i];
  5050. i--;
  5051. var parent = printStack[i];
  5052. while (i > 0) {
  5053. if (t.isExpressionStatement(parent, { expression: node }) || t.isTaggedTemplateExpression(parent) || considerDefaultExports && t.isExportDefaultDeclaration(parent, { declaration: node }) || considerArrow && t.isArrowFunctionExpression(parent, { body: node })) {
  5054. return true;
  5055. }
  5056. 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 })) {
  5057. node = parent;
  5058. i--;
  5059. parent = printStack[i];
  5060. } else {
  5061. return false;
  5062. }
  5063. }
  5064. return false;
  5065. }
  5066. },{"babel-types":151}],47:[function(require,module,exports){
  5067. "use strict";
  5068. var _map = require("lodash/map");
  5069. var _map2 = _interopRequireDefault(_map);
  5070. var _babelTypes = require("babel-types");
  5071. var t = _interopRequireWildcard(_babelTypes);
  5072. 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; } }
  5073. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5074. function crawl(node) {
  5075. var state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  5076. if (t.isMemberExpression(node)) {
  5077. crawl(node.object, state);
  5078. if (node.computed) crawl(node.property, state);
  5079. } else if (t.isBinary(node) || t.isAssignmentExpression(node)) {
  5080. crawl(node.left, state);
  5081. crawl(node.right, state);
  5082. } else if (t.isCallExpression(node)) {
  5083. state.hasCall = true;
  5084. crawl(node.callee, state);
  5085. } else if (t.isFunction(node)) {
  5086. state.hasFunction = true;
  5087. } else if (t.isIdentifier(node)) {
  5088. state.hasHelper = state.hasHelper || isHelper(node.callee);
  5089. }
  5090. return state;
  5091. }
  5092. function isHelper(node) {
  5093. if (t.isMemberExpression(node)) {
  5094. return isHelper(node.object) || isHelper(node.property);
  5095. } else if (t.isIdentifier(node)) {
  5096. return node.name === "require" || node.name[0] === "_";
  5097. } else if (t.isCallExpression(node)) {
  5098. return isHelper(node.callee);
  5099. } else if (t.isBinary(node) || t.isAssignmentExpression(node)) {
  5100. return t.isIdentifier(node.left) && isHelper(node.left) || isHelper(node.right);
  5101. } else {
  5102. return false;
  5103. }
  5104. }
  5105. function isType(node) {
  5106. return t.isLiteral(node) || t.isObjectExpression(node) || t.isArrayExpression(node) || t.isIdentifier(node) || t.isMemberExpression(node);
  5107. }
  5108. exports.nodes = {
  5109. AssignmentExpression: function AssignmentExpression(node) {
  5110. var state = crawl(node.right);
  5111. if (state.hasCall && state.hasHelper || state.hasFunction) {
  5112. return {
  5113. before: state.hasFunction,
  5114. after: true
  5115. };
  5116. }
  5117. },
  5118. SwitchCase: function SwitchCase(node, parent) {
  5119. return {
  5120. before: node.consequent.length || parent.cases[0] === node
  5121. };
  5122. },
  5123. LogicalExpression: function LogicalExpression(node) {
  5124. if (t.isFunction(node.left) || t.isFunction(node.right)) {
  5125. return {
  5126. after: true
  5127. };
  5128. }
  5129. },
  5130. Literal: function Literal(node) {
  5131. if (node.value === "use strict") {
  5132. return {
  5133. after: true
  5134. };
  5135. }
  5136. },
  5137. CallExpression: function CallExpression(node) {
  5138. if (t.isFunction(node.callee) || isHelper(node)) {
  5139. return {
  5140. before: true,
  5141. after: true
  5142. };
  5143. }
  5144. },
  5145. VariableDeclaration: function VariableDeclaration(node) {
  5146. for (var i = 0; i < node.declarations.length; i++) {
  5147. var declar = node.declarations[i];
  5148. var enabled = isHelper(declar.id) && !isType(declar.init);
  5149. if (!enabled) {
  5150. var state = crawl(declar.init);
  5151. enabled = isHelper(declar.init) && state.hasCall || state.hasFunction;
  5152. }
  5153. if (enabled) {
  5154. return {
  5155. before: true,
  5156. after: true
  5157. };
  5158. }
  5159. }
  5160. },
  5161. IfStatement: function IfStatement(node) {
  5162. if (t.isBlockStatement(node.consequent)) {
  5163. return {
  5164. before: true,
  5165. after: true
  5166. };
  5167. }
  5168. }
  5169. };
  5170. exports.nodes.ObjectProperty = exports.nodes.ObjectTypeProperty = exports.nodes.ObjectMethod = exports.nodes.SpreadProperty = function (node, parent) {
  5171. if (parent.properties[0] === node) {
  5172. return {
  5173. before: true
  5174. };
  5175. }
  5176. };
  5177. exports.list = {
  5178. VariableDeclaration: function VariableDeclaration(node) {
  5179. return (0, _map2.default)(node.declarations, "init");
  5180. },
  5181. ArrayExpression: function ArrayExpression(node) {
  5182. return node.elements;
  5183. },
  5184. ObjectExpression: function ObjectExpression(node) {
  5185. return node.properties;
  5186. }
  5187. };
  5188. [["Function", true], ["Class", true], ["Loop", true], ["LabeledStatement", true], ["SwitchStatement", true], ["TryStatement", true]].forEach(function (_ref) {
  5189. var type = _ref[0],
  5190. amounts = _ref[1];
  5191. if (typeof amounts === "boolean") {
  5192. amounts = { after: amounts, before: amounts };
  5193. }
  5194. [type].concat(t.FLIPPED_ALIAS_KEYS[type] || []).forEach(function (type) {
  5195. exports.nodes[type] = function () {
  5196. return amounts;
  5197. };
  5198. });
  5199. });
  5200. },{"babel-types":151,"lodash/map":500}],48:[function(require,module,exports){
  5201. "use strict";
  5202. exports.__esModule = true;
  5203. var _assign = require("babel-runtime/core-js/object/assign");
  5204. var _assign2 = _interopRequireDefault(_assign);
  5205. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  5206. var _getIterator3 = _interopRequireDefault(_getIterator2);
  5207. var _stringify = require("babel-runtime/core-js/json/stringify");
  5208. var _stringify2 = _interopRequireDefault(_stringify);
  5209. var _weakSet = require("babel-runtime/core-js/weak-set");
  5210. var _weakSet2 = _interopRequireDefault(_weakSet);
  5211. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  5212. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  5213. var _find = require("lodash/find");
  5214. var _find2 = _interopRequireDefault(_find);
  5215. var _findLast = require("lodash/findLast");
  5216. var _findLast2 = _interopRequireDefault(_findLast);
  5217. var _isInteger = require("lodash/isInteger");
  5218. var _isInteger2 = _interopRequireDefault(_isInteger);
  5219. var _repeat = require("lodash/repeat");
  5220. var _repeat2 = _interopRequireDefault(_repeat);
  5221. var _buffer = require("./buffer");
  5222. var _buffer2 = _interopRequireDefault(_buffer);
  5223. var _node = require("./node");
  5224. var n = _interopRequireWildcard(_node);
  5225. var _whitespace = require("./whitespace");
  5226. var _whitespace2 = _interopRequireDefault(_whitespace);
  5227. var _babelTypes = require("babel-types");
  5228. var t = _interopRequireWildcard(_babelTypes);
  5229. 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; } }
  5230. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5231. var SCIENTIFIC_NOTATION = /e/i;
  5232. var ZERO_DECIMAL_INTEGER = /\.0+$/;
  5233. var NON_DECIMAL_LITERAL = /^0[box]/;
  5234. var Printer = function () {
  5235. function Printer(format, map, tokens) {
  5236. (0, _classCallCheck3.default)(this, Printer);
  5237. this.inForStatementInitCounter = 0;
  5238. this._printStack = [];
  5239. this._indent = 0;
  5240. this._insideAux = false;
  5241. this._printedCommentStarts = {};
  5242. this._parenPushNewlineState = null;
  5243. this._printAuxAfterOnNextUserNode = false;
  5244. this._printedComments = new _weakSet2.default();
  5245. this._endsWithInteger = false;
  5246. this._endsWithWord = false;
  5247. this.format = format || {};
  5248. this._buf = new _buffer2.default(map);
  5249. this._whitespace = tokens.length > 0 ? new _whitespace2.default(tokens) : null;
  5250. }
  5251. Printer.prototype.generate = function generate(ast) {
  5252. this.print(ast);
  5253. this._maybeAddAuxComment();
  5254. return this._buf.get();
  5255. };
  5256. Printer.prototype.indent = function indent() {
  5257. if (this.format.compact || this.format.concise) return;
  5258. this._indent++;
  5259. };
  5260. Printer.prototype.dedent = function dedent() {
  5261. if (this.format.compact || this.format.concise) return;
  5262. this._indent--;
  5263. };
  5264. Printer.prototype.semicolon = function semicolon() {
  5265. var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5266. this._maybeAddAuxComment();
  5267. this._append(";", !force);
  5268. };
  5269. Printer.prototype.rightBrace = function rightBrace() {
  5270. if (this.format.minified) {
  5271. this._buf.removeLastSemicolon();
  5272. }
  5273. this.token("}");
  5274. };
  5275. Printer.prototype.space = function space() {
  5276. var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5277. if (this.format.compact) return;
  5278. if (this._buf.hasContent() && !this.endsWith(" ") && !this.endsWith("\n") || force) {
  5279. this._space();
  5280. }
  5281. };
  5282. Printer.prototype.word = function word(str) {
  5283. if (this._endsWithWord) this._space();
  5284. this._maybeAddAuxComment();
  5285. this._append(str);
  5286. this._endsWithWord = true;
  5287. };
  5288. Printer.prototype.number = function number(str) {
  5289. this.word(str);
  5290. this._endsWithInteger = (0, _isInteger2.default)(+str) && !NON_DECIMAL_LITERAL.test(str) && !SCIENTIFIC_NOTATION.test(str) && !ZERO_DECIMAL_INTEGER.test(str) && str[str.length - 1] !== ".";
  5291. };
  5292. Printer.prototype.token = function token(str) {
  5293. if (str === "--" && this.endsWith("!") || str[0] === "+" && this.endsWith("+") || str[0] === "-" && this.endsWith("-") || str[0] === "." && this._endsWithInteger) {
  5294. this._space();
  5295. }
  5296. this._maybeAddAuxComment();
  5297. this._append(str);
  5298. };
  5299. Printer.prototype.newline = function newline(i) {
  5300. if (this.format.retainLines || this.format.compact) return;
  5301. if (this.format.concise) {
  5302. this.space();
  5303. return;
  5304. }
  5305. if (this.endsWith("\n\n")) return;
  5306. if (typeof i !== "number") i = 1;
  5307. i = Math.min(2, i);
  5308. if (this.endsWith("{\n") || this.endsWith(":\n")) i--;
  5309. if (i <= 0) return;
  5310. for (var j = 0; j < i; j++) {
  5311. this._newline();
  5312. }
  5313. };
  5314. Printer.prototype.endsWith = function endsWith(str) {
  5315. return this._buf.endsWith(str);
  5316. };
  5317. Printer.prototype.removeTrailingNewline = function removeTrailingNewline() {
  5318. this._buf.removeTrailingNewline();
  5319. };
  5320. Printer.prototype.source = function source(prop, loc) {
  5321. this._catchUp(prop, loc);
  5322. this._buf.source(prop, loc);
  5323. };
  5324. Printer.prototype.withSource = function withSource(prop, loc, cb) {
  5325. this._catchUp(prop, loc);
  5326. this._buf.withSource(prop, loc, cb);
  5327. };
  5328. Printer.prototype._space = function _space() {
  5329. this._append(" ", true);
  5330. };
  5331. Printer.prototype._newline = function _newline() {
  5332. this._append("\n", true);
  5333. };
  5334. Printer.prototype._append = function _append(str) {
  5335. var queue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  5336. this._maybeAddParen(str);
  5337. this._maybeIndent(str);
  5338. if (queue) this._buf.queue(str);else this._buf.append(str);
  5339. this._endsWithWord = false;
  5340. this._endsWithInteger = false;
  5341. };
  5342. Printer.prototype._maybeIndent = function _maybeIndent(str) {
  5343. if (this._indent && this.endsWith("\n") && str[0] !== "\n") {
  5344. this._buf.queue(this._getIndent());
  5345. }
  5346. };
  5347. Printer.prototype._maybeAddParen = function _maybeAddParen(str) {
  5348. var parenPushNewlineState = this._parenPushNewlineState;
  5349. if (!parenPushNewlineState) return;
  5350. this._parenPushNewlineState = null;
  5351. var i = void 0;
  5352. for (i = 0; i < str.length && str[i] === " "; i++) {
  5353. continue;
  5354. }if (i === str.length) return;
  5355. var cha = str[i];
  5356. if (cha === "\n" || cha === "/") {
  5357. this.token("(");
  5358. this.indent();
  5359. parenPushNewlineState.printed = true;
  5360. }
  5361. };
  5362. Printer.prototype._catchUp = function _catchUp(prop, loc) {
  5363. if (!this.format.retainLines) return;
  5364. var pos = loc ? loc[prop] : null;
  5365. if (pos && pos.line !== null) {
  5366. var count = pos.line - this._buf.getCurrentLine();
  5367. for (var i = 0; i < count; i++) {
  5368. this._newline();
  5369. }
  5370. }
  5371. };
  5372. Printer.prototype._getIndent = function _getIndent() {
  5373. return (0, _repeat2.default)(this.format.indent.style, this._indent);
  5374. };
  5375. Printer.prototype.startTerminatorless = function startTerminatorless() {
  5376. return this._parenPushNewlineState = {
  5377. printed: false
  5378. };
  5379. };
  5380. Printer.prototype.endTerminatorless = function endTerminatorless(state) {
  5381. if (state.printed) {
  5382. this.dedent();
  5383. this.newline();
  5384. this.token(")");
  5385. }
  5386. };
  5387. Printer.prototype.print = function print(node, parent) {
  5388. var _this = this;
  5389. if (!node) return;
  5390. var oldConcise = this.format.concise;
  5391. if (node._compact) {
  5392. this.format.concise = true;
  5393. }
  5394. var printMethod = this[node.type];
  5395. if (!printMethod) {
  5396. throw new ReferenceError("unknown node of type " + (0, _stringify2.default)(node.type) + " with constructor " + (0, _stringify2.default)(node && node.constructor.name));
  5397. }
  5398. this._printStack.push(node);
  5399. var oldInAux = this._insideAux;
  5400. this._insideAux = !node.loc;
  5401. this._maybeAddAuxComment(this._insideAux && !oldInAux);
  5402. var needsParens = n.needsParens(node, parent, this._printStack);
  5403. if (this.format.retainFunctionParens && node.type === "FunctionExpression" && node.extra && node.extra.parenthesized) {
  5404. needsParens = true;
  5405. }
  5406. if (needsParens) this.token("(");
  5407. this._printLeadingComments(node, parent);
  5408. var loc = t.isProgram(node) || t.isFile(node) ? null : node.loc;
  5409. this.withSource("start", loc, function () {
  5410. _this[node.type](node, parent);
  5411. });
  5412. this._printTrailingComments(node, parent);
  5413. if (needsParens) this.token(")");
  5414. this._printStack.pop();
  5415. this.format.concise = oldConcise;
  5416. this._insideAux = oldInAux;
  5417. };
  5418. Printer.prototype._maybeAddAuxComment = function _maybeAddAuxComment(enteredPositionlessNode) {
  5419. if (enteredPositionlessNode) this._printAuxBeforeComment();
  5420. if (!this._insideAux) this._printAuxAfterComment();
  5421. };
  5422. Printer.prototype._printAuxBeforeComment = function _printAuxBeforeComment() {
  5423. if (this._printAuxAfterOnNextUserNode) return;
  5424. this._printAuxAfterOnNextUserNode = true;
  5425. var comment = this.format.auxiliaryCommentBefore;
  5426. if (comment) {
  5427. this._printComment({
  5428. type: "CommentBlock",
  5429. value: comment
  5430. });
  5431. }
  5432. };
  5433. Printer.prototype._printAuxAfterComment = function _printAuxAfterComment() {
  5434. if (!this._printAuxAfterOnNextUserNode) return;
  5435. this._printAuxAfterOnNextUserNode = false;
  5436. var comment = this.format.auxiliaryCommentAfter;
  5437. if (comment) {
  5438. this._printComment({
  5439. type: "CommentBlock",
  5440. value: comment
  5441. });
  5442. }
  5443. };
  5444. Printer.prototype.getPossibleRaw = function getPossibleRaw(node) {
  5445. var extra = node.extra;
  5446. if (extra && extra.raw != null && extra.rawValue != null && node.value === extra.rawValue) {
  5447. return extra.raw;
  5448. }
  5449. };
  5450. Printer.prototype.printJoin = function printJoin(nodes, parent) {
  5451. var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  5452. if (!nodes || !nodes.length) return;
  5453. if (opts.indent) this.indent();
  5454. var newlineOpts = {
  5455. addNewlines: opts.addNewlines
  5456. };
  5457. for (var i = 0; i < nodes.length; i++) {
  5458. var node = nodes[i];
  5459. if (!node) continue;
  5460. if (opts.statement) this._printNewline(true, node, parent, newlineOpts);
  5461. this.print(node, parent);
  5462. if (opts.iterator) {
  5463. opts.iterator(node, i);
  5464. }
  5465. if (opts.separator && i < nodes.length - 1) {
  5466. opts.separator.call(this);
  5467. }
  5468. if (opts.statement) this._printNewline(false, node, parent, newlineOpts);
  5469. }
  5470. if (opts.indent) this.dedent();
  5471. };
  5472. Printer.prototype.printAndIndentOnComments = function printAndIndentOnComments(node, parent) {
  5473. var indent = !!node.leadingComments;
  5474. if (indent) this.indent();
  5475. this.print(node, parent);
  5476. if (indent) this.dedent();
  5477. };
  5478. Printer.prototype.printBlock = function printBlock(parent) {
  5479. var node = parent.body;
  5480. if (!t.isEmptyStatement(node)) {
  5481. this.space();
  5482. }
  5483. this.print(node, parent);
  5484. };
  5485. Printer.prototype._printTrailingComments = function _printTrailingComments(node, parent) {
  5486. this._printComments(this._getComments(false, node, parent));
  5487. };
  5488. Printer.prototype._printLeadingComments = function _printLeadingComments(node, parent) {
  5489. this._printComments(this._getComments(true, node, parent));
  5490. };
  5491. Printer.prototype.printInnerComments = function printInnerComments(node) {
  5492. var indent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
  5493. if (!node.innerComments) return;
  5494. if (indent) this.indent();
  5495. this._printComments(node.innerComments);
  5496. if (indent) this.dedent();
  5497. };
  5498. Printer.prototype.printSequence = function printSequence(nodes, parent) {
  5499. var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  5500. opts.statement = true;
  5501. return this.printJoin(nodes, parent, opts);
  5502. };
  5503. Printer.prototype.printList = function printList(items, parent) {
  5504. var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  5505. if (opts.separator == null) {
  5506. opts.separator = commaSeparator;
  5507. }
  5508. return this.printJoin(items, parent, opts);
  5509. };
  5510. Printer.prototype._printNewline = function _printNewline(leading, node, parent, opts) {
  5511. var _this2 = this;
  5512. if (this.format.retainLines || this.format.compact) return;
  5513. if (this.format.concise) {
  5514. this.space();
  5515. return;
  5516. }
  5517. var lines = 0;
  5518. if (node.start != null && !node._ignoreUserWhitespace && this._whitespace) {
  5519. if (leading) {
  5520. var _comments = node.leadingComments;
  5521. var _comment = _comments && (0, _find2.default)(_comments, function (comment) {
  5522. return !!comment.loc && _this2.format.shouldPrintComment(comment.value);
  5523. });
  5524. lines = this._whitespace.getNewlinesBefore(_comment || node);
  5525. } else {
  5526. var _comments2 = node.trailingComments;
  5527. var _comment2 = _comments2 && (0, _findLast2.default)(_comments2, function (comment) {
  5528. return !!comment.loc && _this2.format.shouldPrintComment(comment.value);
  5529. });
  5530. lines = this._whitespace.getNewlinesAfter(_comment2 || node);
  5531. }
  5532. } else {
  5533. if (!leading) lines++;
  5534. if (opts.addNewlines) lines += opts.addNewlines(leading, node) || 0;
  5535. var needs = n.needsWhitespaceAfter;
  5536. if (leading) needs = n.needsWhitespaceBefore;
  5537. if (needs(node, parent)) lines++;
  5538. if (!this._buf.hasContent()) lines = 0;
  5539. }
  5540. this.newline(lines);
  5541. };
  5542. Printer.prototype._getComments = function _getComments(leading, node) {
  5543. return node && (leading ? node.leadingComments : node.trailingComments) || [];
  5544. };
  5545. Printer.prototype._printComment = function _printComment(comment) {
  5546. var _this3 = this;
  5547. if (!this.format.shouldPrintComment(comment.value)) return;
  5548. if (comment.ignore) return;
  5549. if (this._printedComments.has(comment)) return;
  5550. this._printedComments.add(comment);
  5551. if (comment.start != null) {
  5552. if (this._printedCommentStarts[comment.start]) return;
  5553. this._printedCommentStarts[comment.start] = true;
  5554. }
  5555. this.newline(this._whitespace ? this._whitespace.getNewlinesBefore(comment) : 0);
  5556. if (!this.endsWith("[") && !this.endsWith("{")) this.space();
  5557. var val = comment.type === "CommentLine" ? "//" + comment.value + "\n" : "/*" + comment.value + "*/";
  5558. if (comment.type === "CommentBlock" && this.format.indent.adjustMultilineComment) {
  5559. var offset = comment.loc && comment.loc.start.column;
  5560. if (offset) {
  5561. var newlineRegex = new RegExp("\\n\\s{1," + offset + "}", "g");
  5562. val = val.replace(newlineRegex, "\n");
  5563. }
  5564. var indentSize = Math.max(this._getIndent().length, this._buf.getCurrentColumn());
  5565. val = val.replace(/\n(?!$)/g, "\n" + (0, _repeat2.default)(" ", indentSize));
  5566. }
  5567. this.withSource("start", comment.loc, function () {
  5568. _this3._append(val);
  5569. });
  5570. this.newline((this._whitespace ? this._whitespace.getNewlinesAfter(comment) : 0) + (comment.type === "CommentLine" ? -1 : 0));
  5571. };
  5572. Printer.prototype._printComments = function _printComments(comments) {
  5573. if (!comments || !comments.length) return;
  5574. for (var _iterator = comments, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  5575. var _ref;
  5576. if (_isArray) {
  5577. if (_i >= _iterator.length) break;
  5578. _ref = _iterator[_i++];
  5579. } else {
  5580. _i = _iterator.next();
  5581. if (_i.done) break;
  5582. _ref = _i.value;
  5583. }
  5584. var _comment3 = _ref;
  5585. this._printComment(_comment3);
  5586. }
  5587. };
  5588. return Printer;
  5589. }();
  5590. exports.default = Printer;
  5591. function commaSeparator() {
  5592. this.token(",");
  5593. this.space();
  5594. }
  5595. 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")];
  5596. for (var _i2 = 0; _i2 < _arr.length; _i2++) {
  5597. var generator = _arr[_i2];
  5598. (0, _assign2.default)(Printer.prototype, generator);
  5599. }
  5600. module.exports = exports["default"];
  5601. },{"./buffer":33,"./generators/base":34,"./generators/classes":35,"./generators/expressions":36,"./generators/flow":37,"./generators/jsx":38,"./generators/methods":39,"./generators/modules":40,"./generators/statements":41,"./generators/template-literals":42,"./generators/types":43,"./node":45,"./whitespace":50,"babel-runtime/core-js/get-iterator":95,"babel-runtime/core-js/json/stringify":96,"babel-runtime/core-js/object/assign":99,"babel-runtime/core-js/weak-set":108,"babel-runtime/helpers/classCallCheck":109,"babel-types":151,"lodash/find":474,"lodash/findLast":476,"lodash/isInteger":489,"lodash/repeat":507}],49:[function(require,module,exports){
  5602. "use strict";
  5603. exports.__esModule = true;
  5604. var _keys = require("babel-runtime/core-js/object/keys");
  5605. var _keys2 = _interopRequireDefault(_keys);
  5606. var _typeof2 = require("babel-runtime/helpers/typeof");
  5607. var _typeof3 = _interopRequireDefault(_typeof2);
  5608. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  5609. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  5610. var _sourceMap = require("source-map");
  5611. var _sourceMap2 = _interopRequireDefault(_sourceMap);
  5612. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5613. var SourceMap = function () {
  5614. function SourceMap(opts, code) {
  5615. (0, _classCallCheck3.default)(this, SourceMap);
  5616. this._cachedMap = null;
  5617. this._code = code;
  5618. this._opts = opts;
  5619. this._rawMappings = [];
  5620. }
  5621. SourceMap.prototype.get = function get() {
  5622. if (!this._cachedMap) {
  5623. var map = this._cachedMap = new _sourceMap2.default.SourceMapGenerator({
  5624. file: this._opts.sourceMapTarget,
  5625. sourceRoot: this._opts.sourceRoot
  5626. });
  5627. var code = this._code;
  5628. if (typeof code === "string") {
  5629. map.setSourceContent(this._opts.sourceFileName, code);
  5630. } else if ((typeof code === "undefined" ? "undefined" : (0, _typeof3.default)(code)) === "object") {
  5631. (0, _keys2.default)(code).forEach(function (sourceFileName) {
  5632. map.setSourceContent(sourceFileName, code[sourceFileName]);
  5633. });
  5634. }
  5635. this._rawMappings.forEach(map.addMapping, map);
  5636. }
  5637. return this._cachedMap.toJSON();
  5638. };
  5639. SourceMap.prototype.getRawMappings = function getRawMappings() {
  5640. return this._rawMappings.slice();
  5641. };
  5642. SourceMap.prototype.mark = function mark(generatedLine, generatedColumn, line, column, identifierName, filename) {
  5643. if (this._lastGenLine !== generatedLine && line === null) return;
  5644. if (this._lastGenLine === generatedLine && this._lastSourceLine === line && this._lastSourceColumn === column) {
  5645. return;
  5646. }
  5647. this._cachedMap = null;
  5648. this._lastGenLine = generatedLine;
  5649. this._lastSourceLine = line;
  5650. this._lastSourceColumn = column;
  5651. this._rawMappings.push({
  5652. name: identifierName || undefined,
  5653. generated: {
  5654. line: generatedLine,
  5655. column: generatedColumn
  5656. },
  5657. source: line == null ? undefined : filename || this._opts.sourceFileName,
  5658. original: line == null ? undefined : {
  5659. line: line,
  5660. column: column
  5661. }
  5662. });
  5663. };
  5664. return SourceMap;
  5665. }();
  5666. exports.default = SourceMap;
  5667. module.exports = exports["default"];
  5668. },{"babel-runtime/core-js/object/keys":102,"babel-runtime/helpers/classCallCheck":109,"babel-runtime/helpers/typeof":113,"source-map":552}],50:[function(require,module,exports){
  5669. "use strict";
  5670. exports.__esModule = true;
  5671. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  5672. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  5673. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5674. var Whitespace = function () {
  5675. function Whitespace(tokens) {
  5676. (0, _classCallCheck3.default)(this, Whitespace);
  5677. this.tokens = tokens;
  5678. this.used = {};
  5679. }
  5680. Whitespace.prototype.getNewlinesBefore = function getNewlinesBefore(node) {
  5681. var startToken = void 0;
  5682. var endToken = void 0;
  5683. var tokens = this.tokens;
  5684. var index = this._findToken(function (token) {
  5685. return token.start - node.start;
  5686. }, 0, tokens.length);
  5687. if (index >= 0) {
  5688. while (index && node.start === tokens[index - 1].start) {
  5689. --index;
  5690. }startToken = tokens[index - 1];
  5691. endToken = tokens[index];
  5692. }
  5693. return this._getNewlinesBetween(startToken, endToken);
  5694. };
  5695. Whitespace.prototype.getNewlinesAfter = function getNewlinesAfter(node) {
  5696. var startToken = void 0;
  5697. var endToken = void 0;
  5698. var tokens = this.tokens;
  5699. var index = this._findToken(function (token) {
  5700. return token.end - node.end;
  5701. }, 0, tokens.length);
  5702. if (index >= 0) {
  5703. while (index && node.end === tokens[index - 1].end) {
  5704. --index;
  5705. }startToken = tokens[index];
  5706. endToken = tokens[index + 1];
  5707. if (endToken.type.label === ",") endToken = tokens[index + 2];
  5708. }
  5709. if (endToken && endToken.type.label === "eof") {
  5710. return 1;
  5711. } else {
  5712. return this._getNewlinesBetween(startToken, endToken);
  5713. }
  5714. };
  5715. Whitespace.prototype._getNewlinesBetween = function _getNewlinesBetween(startToken, endToken) {
  5716. if (!endToken || !endToken.loc) return 0;
  5717. var start = startToken ? startToken.loc.end.line : 1;
  5718. var end = endToken.loc.start.line;
  5719. var lines = 0;
  5720. for (var line = start; line < end; line++) {
  5721. if (typeof this.used[line] === "undefined") {
  5722. this.used[line] = true;
  5723. lines++;
  5724. }
  5725. }
  5726. return lines;
  5727. };
  5728. Whitespace.prototype._findToken = function _findToken(test, start, end) {
  5729. if (start >= end) return -1;
  5730. var middle = start + end >>> 1;
  5731. var match = test(this.tokens[middle]);
  5732. if (match < 0) {
  5733. return this._findToken(test, middle + 1, end);
  5734. } else if (match > 0) {
  5735. return this._findToken(test, start, middle);
  5736. } else if (match === 0) {
  5737. return middle;
  5738. }
  5739. return -1;
  5740. };
  5741. return Whitespace;
  5742. }();
  5743. exports.default = Whitespace;
  5744. module.exports = exports["default"];
  5745. },{"babel-runtime/helpers/classCallCheck":109}],51:[function(require,module,exports){
  5746. "use strict";
  5747. exports.__esModule = true;
  5748. exports.default = function (path) {
  5749. var scope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : path.scope;
  5750. var node = path.node;
  5751. var container = t.functionExpression(null, [], node.body, node.generator, node.async);
  5752. var callee = container;
  5753. var args = [];
  5754. (0, _babelHelperHoistVariables2.default)(path, function (id) {
  5755. return scope.push({ id: id });
  5756. });
  5757. var state = {
  5758. foundThis: false,
  5759. foundArguments: false
  5760. };
  5761. path.traverse(visitor, state);
  5762. if (state.foundArguments) {
  5763. callee = t.memberExpression(container, t.identifier("apply"));
  5764. args = [];
  5765. if (state.foundThis) {
  5766. args.push(t.thisExpression());
  5767. }
  5768. if (state.foundArguments) {
  5769. if (!state.foundThis) args.push(t.nullLiteral());
  5770. args.push(t.identifier("arguments"));
  5771. }
  5772. }
  5773. var call = t.callExpression(callee, args);
  5774. if (node.generator) call = t.yieldExpression(call, true);
  5775. return t.returnStatement(call);
  5776. };
  5777. var _babelHelperHoistVariables = require("babel-helper-hoist-variables");
  5778. var _babelHelperHoistVariables2 = _interopRequireDefault(_babelHelperHoistVariables);
  5779. var _babelTypes = require("babel-types");
  5780. var t = _interopRequireWildcard(_babelTypes);
  5781. 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; } }
  5782. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5783. var visitor = {
  5784. enter: function enter(path, state) {
  5785. if (path.isThisExpression()) {
  5786. state.foundThis = true;
  5787. }
  5788. if (path.isReferencedIdentifier({ name: "arguments" })) {
  5789. state.foundArguments = true;
  5790. }
  5791. },
  5792. Function: function Function(path) {
  5793. path.skip();
  5794. }
  5795. };
  5796. module.exports = exports["default"];
  5797. },{"babel-helper-hoist-variables":55,"babel-types":151}],52:[function(require,module,exports){
  5798. "use strict";
  5799. exports.__esModule = true;
  5800. var _keys = require("babel-runtime/core-js/object/keys");
  5801. var _keys2 = _interopRequireDefault(_keys);
  5802. exports.push = push;
  5803. exports.hasComputed = hasComputed;
  5804. exports.toComputedObjectFromClass = toComputedObjectFromClass;
  5805. exports.toClassObject = toClassObject;
  5806. exports.toDefineObject = toDefineObject;
  5807. var _babelHelperFunctionName = require("babel-helper-function-name");
  5808. var _babelHelperFunctionName2 = _interopRequireDefault(_babelHelperFunctionName);
  5809. var _has = require("lodash/has");
  5810. var _has2 = _interopRequireDefault(_has);
  5811. var _babelTypes = require("babel-types");
  5812. var t = _interopRequireWildcard(_babelTypes);
  5813. 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; } }
  5814. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5815. function toKind(node) {
  5816. if (t.isClassMethod(node) || t.isObjectMethod(node)) {
  5817. if (node.kind === "get" || node.kind === "set") {
  5818. return node.kind;
  5819. }
  5820. }
  5821. return "value";
  5822. }
  5823. function push(mutatorMap, node, kind, file, scope) {
  5824. var alias = t.toKeyAlias(node);
  5825. var map = {};
  5826. if ((0, _has2.default)(mutatorMap, alias)) map = mutatorMap[alias];
  5827. mutatorMap[alias] = map;
  5828. map._inherits = map._inherits || [];
  5829. map._inherits.push(node);
  5830. map._key = node.key;
  5831. if (node.computed) {
  5832. map._computed = true;
  5833. }
  5834. if (node.decorators) {
  5835. var decorators = map.decorators = map.decorators || t.arrayExpression([]);
  5836. decorators.elements = decorators.elements.concat(node.decorators.map(function (dec) {
  5837. return dec.expression;
  5838. }).reverse());
  5839. }
  5840. if (map.value || map.initializer) {
  5841. throw file.buildCodeFrameError(node, "Key conflict with sibling node");
  5842. }
  5843. var key = void 0,
  5844. value = void 0;
  5845. if (t.isObjectProperty(node) || t.isObjectMethod(node) || t.isClassMethod(node)) {
  5846. key = t.toComputedKey(node, node.key);
  5847. }
  5848. if (t.isObjectProperty(node) || t.isClassProperty(node)) {
  5849. value = node.value;
  5850. } else if (t.isObjectMethod(node) || t.isClassMethod(node)) {
  5851. value = t.functionExpression(null, node.params, node.body, node.generator, node.async);
  5852. value.returnType = node.returnType;
  5853. }
  5854. var inheritedKind = toKind(node);
  5855. if (!kind || inheritedKind !== "value") {
  5856. kind = inheritedKind;
  5857. }
  5858. if (scope && t.isStringLiteral(key) && (kind === "value" || kind === "initializer") && t.isFunctionExpression(value)) {
  5859. value = (0, _babelHelperFunctionName2.default)({ id: key, node: value, scope: scope });
  5860. }
  5861. if (value) {
  5862. t.inheritsComments(value, node);
  5863. map[kind] = value;
  5864. }
  5865. return map;
  5866. }
  5867. function hasComputed(mutatorMap) {
  5868. for (var key in mutatorMap) {
  5869. if (mutatorMap[key]._computed) {
  5870. return true;
  5871. }
  5872. }
  5873. return false;
  5874. }
  5875. function toComputedObjectFromClass(obj) {
  5876. var objExpr = t.arrayExpression([]);
  5877. for (var i = 0; i < obj.properties.length; i++) {
  5878. var prop = obj.properties[i];
  5879. var val = prop.value;
  5880. val.properties.unshift(t.objectProperty(t.identifier("key"), t.toComputedKey(prop)));
  5881. objExpr.elements.push(val);
  5882. }
  5883. return objExpr;
  5884. }
  5885. function toClassObject(mutatorMap) {
  5886. var objExpr = t.objectExpression([]);
  5887. (0, _keys2.default)(mutatorMap).forEach(function (mutatorMapKey) {
  5888. var map = mutatorMap[mutatorMapKey];
  5889. var mapNode = t.objectExpression([]);
  5890. var propNode = t.objectProperty(map._key, mapNode, map._computed);
  5891. (0, _keys2.default)(map).forEach(function (key) {
  5892. var node = map[key];
  5893. if (key[0] === "_") return;
  5894. var inheritNode = node;
  5895. if (t.isClassMethod(node) || t.isClassProperty(node)) node = node.value;
  5896. var prop = t.objectProperty(t.identifier(key), node);
  5897. t.inheritsComments(prop, inheritNode);
  5898. t.removeComments(inheritNode);
  5899. mapNode.properties.push(prop);
  5900. });
  5901. objExpr.properties.push(propNode);
  5902. });
  5903. return objExpr;
  5904. }
  5905. function toDefineObject(mutatorMap) {
  5906. (0, _keys2.default)(mutatorMap).forEach(function (key) {
  5907. var map = mutatorMap[key];
  5908. if (map.value) map.writable = t.booleanLiteral(true);
  5909. map.configurable = t.booleanLiteral(true);
  5910. map.enumerable = t.booleanLiteral(true);
  5911. });
  5912. return toClassObject(mutatorMap);
  5913. }
  5914. },{"babel-helper-function-name":53,"babel-runtime/core-js/object/keys":102,"babel-types":151,"lodash/has":479}],53:[function(require,module,exports){
  5915. "use strict";
  5916. exports.__esModule = true;
  5917. exports.default = function (_ref) {
  5918. var node = _ref.node,
  5919. parent = _ref.parent,
  5920. scope = _ref.scope,
  5921. id = _ref.id;
  5922. if (node.id) return;
  5923. if ((t.isObjectProperty(parent) || t.isObjectMethod(parent, { kind: "method" })) && (!parent.computed || t.isLiteral(parent.key))) {
  5924. id = parent.key;
  5925. } else if (t.isVariableDeclarator(parent)) {
  5926. id = parent.id;
  5927. if (t.isIdentifier(id)) {
  5928. var binding = scope.parent.getBinding(id.name);
  5929. if (binding && binding.constant && scope.getBinding(id.name) === binding) {
  5930. node.id = id;
  5931. node.id[t.NOT_LOCAL_BINDING] = true;
  5932. return;
  5933. }
  5934. }
  5935. } else if (t.isAssignmentExpression(parent)) {
  5936. id = parent.left;
  5937. } else if (!id) {
  5938. return;
  5939. }
  5940. var name = void 0;
  5941. if (id && t.isLiteral(id)) {
  5942. name = id.value;
  5943. } else if (id && t.isIdentifier(id)) {
  5944. name = id.name;
  5945. } else {
  5946. return;
  5947. }
  5948. name = t.toBindingIdentifierName(name);
  5949. id = t.identifier(name);
  5950. id[t.NOT_LOCAL_BINDING] = true;
  5951. var state = visit(node, name, scope);
  5952. return wrap(state, node, id, scope) || node;
  5953. };
  5954. var _babelHelperGetFunctionArity = require("babel-helper-get-function-arity");
  5955. var _babelHelperGetFunctionArity2 = _interopRequireDefault(_babelHelperGetFunctionArity);
  5956. var _babelTemplate = require("babel-template");
  5957. var _babelTemplate2 = _interopRequireDefault(_babelTemplate);
  5958. var _babelTypes = require("babel-types");
  5959. var t = _interopRequireWildcard(_babelTypes);
  5960. 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; } }
  5961. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5962. var buildPropertyMethodAssignmentWrapper = (0, _babelTemplate2.default)("\n (function (FUNCTION_KEY) {\n function FUNCTION_ID() {\n return FUNCTION_KEY.apply(this, arguments);\n }\n\n FUNCTION_ID.toString = function () {\n return FUNCTION_KEY.toString();\n }\n\n return FUNCTION_ID;\n })(FUNCTION)\n");
  5963. var buildGeneratorPropertyMethodAssignmentWrapper = (0, _babelTemplate2.default)("\n (function (FUNCTION_KEY) {\n function* FUNCTION_ID() {\n return yield* FUNCTION_KEY.apply(this, arguments);\n }\n\n FUNCTION_ID.toString = function () {\n return FUNCTION_KEY.toString();\n };\n\n return FUNCTION_ID;\n })(FUNCTION)\n");
  5964. var visitor = {
  5965. "ReferencedIdentifier|BindingIdentifier": function ReferencedIdentifierBindingIdentifier(path, state) {
  5966. if (path.node.name !== state.name) return;
  5967. var localDeclar = path.scope.getBindingIdentifier(state.name);
  5968. if (localDeclar !== state.outerDeclar) return;
  5969. state.selfReference = true;
  5970. path.stop();
  5971. }
  5972. };
  5973. function wrap(state, method, id, scope) {
  5974. if (state.selfReference) {
  5975. if (scope.hasBinding(id.name) && !scope.hasGlobal(id.name)) {
  5976. scope.rename(id.name);
  5977. } else {
  5978. if (!t.isFunction(method)) return;
  5979. var build = buildPropertyMethodAssignmentWrapper;
  5980. if (method.generator) build = buildGeneratorPropertyMethodAssignmentWrapper;
  5981. var _template = build({
  5982. FUNCTION: method,
  5983. FUNCTION_ID: id,
  5984. FUNCTION_KEY: scope.generateUidIdentifier(id.name)
  5985. }).expression;
  5986. _template.callee._skipModulesRemap = true;
  5987. var params = _template.callee.body.body[0].params;
  5988. for (var i = 0, len = (0, _babelHelperGetFunctionArity2.default)(method); i < len; i++) {
  5989. params.push(scope.generateUidIdentifier("x"));
  5990. }
  5991. return _template;
  5992. }
  5993. }
  5994. method.id = id;
  5995. scope.getProgramParent().references[id.name] = true;
  5996. }
  5997. function visit(node, name, scope) {
  5998. var state = {
  5999. selfAssignment: false,
  6000. selfReference: false,
  6001. outerDeclar: scope.getBindingIdentifier(name),
  6002. references: [],
  6003. name: name
  6004. };
  6005. var binding = scope.getOwnBinding(name);
  6006. if (binding) {
  6007. if (binding.kind === "param") {
  6008. state.selfReference = true;
  6009. } else {}
  6010. } else if (state.outerDeclar || scope.hasGlobal(name)) {
  6011. scope.traverse(node, visitor, state);
  6012. }
  6013. return state;
  6014. }
  6015. module.exports = exports["default"];
  6016. },{"babel-helper-get-function-arity":54,"babel-template":114,"babel-types":151}],54:[function(require,module,exports){
  6017. "use strict";
  6018. exports.__esModule = true;
  6019. exports.default = function (node) {
  6020. var params = node.params;
  6021. for (var i = 0; i < params.length; i++) {
  6022. var param = params[i];
  6023. if (t.isAssignmentPattern(param) || t.isRestElement(param)) {
  6024. return i;
  6025. }
  6026. }
  6027. return params.length;
  6028. };
  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. module.exports = exports["default"];
  6033. },{"babel-types":151}],55:[function(require,module,exports){
  6034. "use strict";
  6035. exports.__esModule = true;
  6036. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  6037. var _getIterator3 = _interopRequireDefault(_getIterator2);
  6038. exports.default = function (path, emit) {
  6039. var kind = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "var";
  6040. path.traverse(visitor, { kind: kind, emit: emit });
  6041. };
  6042. var _babelTypes = require("babel-types");
  6043. var t = _interopRequireWildcard(_babelTypes);
  6044. 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; } }
  6045. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6046. var visitor = {
  6047. Scope: function Scope(path, state) {
  6048. if (state.kind === "let") path.skip();
  6049. },
  6050. Function: function Function(path) {
  6051. path.skip();
  6052. },
  6053. VariableDeclaration: function VariableDeclaration(path, state) {
  6054. if (state.kind && path.node.kind !== state.kind) return;
  6055. var nodes = [];
  6056. var declarations = path.get("declarations");
  6057. var firstId = void 0;
  6058. for (var _iterator = declarations, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  6059. var _ref;
  6060. if (_isArray) {
  6061. if (_i >= _iterator.length) break;
  6062. _ref = _iterator[_i++];
  6063. } else {
  6064. _i = _iterator.next();
  6065. if (_i.done) break;
  6066. _ref = _i.value;
  6067. }
  6068. var declar = _ref;
  6069. firstId = declar.node.id;
  6070. if (declar.node.init) {
  6071. nodes.push(t.expressionStatement(t.assignmentExpression("=", declar.node.id, declar.node.init)));
  6072. }
  6073. for (var name in declar.getBindingIdentifiers()) {
  6074. state.emit(t.identifier(name), name);
  6075. }
  6076. }
  6077. if (path.parentPath.isFor({ left: path.node })) {
  6078. path.replaceWith(firstId);
  6079. } else {
  6080. path.replaceWithMultiple(nodes);
  6081. }
  6082. }
  6083. };
  6084. module.exports = exports["default"];
  6085. },{"babel-runtime/core-js/get-iterator":95,"babel-types":151}],56:[function(require,module,exports){
  6086. "use strict";
  6087. exports.__esModule = true;
  6088. exports.default = function (callee, thisNode, args) {
  6089. if (args.length === 1 && t.isSpreadElement(args[0]) && t.isIdentifier(args[0].argument, { name: "arguments" })) {
  6090. return t.callExpression(t.memberExpression(callee, t.identifier("apply")), [thisNode, args[0].argument]);
  6091. } else {
  6092. return t.callExpression(t.memberExpression(callee, t.identifier("call")), [thisNode].concat(args));
  6093. }
  6094. };
  6095. var _babelTypes = require("babel-types");
  6096. var t = _interopRequireWildcard(_babelTypes);
  6097. 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; } }
  6098. module.exports = exports["default"];
  6099. },{"babel-types":151}],57:[function(require,module,exports){
  6100. "use strict";
  6101. exports.__esModule = true;
  6102. exports.is = is;
  6103. exports.pullFlag = pullFlag;
  6104. var _pull = require("lodash/pull");
  6105. var _pull2 = _interopRequireDefault(_pull);
  6106. var _babelTypes = require("babel-types");
  6107. var t = _interopRequireWildcard(_babelTypes);
  6108. 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; } }
  6109. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6110. function is(node, flag) {
  6111. return t.isRegExpLiteral(node) && node.flags.indexOf(flag) >= 0;
  6112. }
  6113. function pullFlag(node, flag) {
  6114. var flags = node.flags.split("");
  6115. if (node.flags.indexOf(flag) < 0) return;
  6116. (0, _pull2.default)(flags, flag);
  6117. node.flags = flags.join("");
  6118. }
  6119. },{"babel-types":151,"lodash/pull":505}],58:[function(require,module,exports){
  6120. "use strict";
  6121. exports.__esModule = true;
  6122. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  6123. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  6124. var _symbol = require("babel-runtime/core-js/symbol");
  6125. var _symbol2 = _interopRequireDefault(_symbol);
  6126. var _babelHelperOptimiseCallExpression = require("babel-helper-optimise-call-expression");
  6127. var _babelHelperOptimiseCallExpression2 = _interopRequireDefault(_babelHelperOptimiseCallExpression);
  6128. var _babelMessages = require("babel-messages");
  6129. var messages = _interopRequireWildcard(_babelMessages);
  6130. var _babelTypes = require("babel-types");
  6131. var t = _interopRequireWildcard(_babelTypes);
  6132. 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; } }
  6133. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6134. var HARDCORE_THIS_REF = (0, _symbol2.default)();
  6135. function isIllegalBareSuper(node, parent) {
  6136. if (!t.isSuper(node)) return false;
  6137. if (t.isMemberExpression(parent, { computed: false })) return false;
  6138. if (t.isCallExpression(parent, { callee: node })) return false;
  6139. return true;
  6140. }
  6141. function isMemberExpressionSuper(node) {
  6142. return t.isMemberExpression(node) && t.isSuper(node.object);
  6143. }
  6144. function getPrototypeOfExpression(objectRef, isStatic) {
  6145. var targetRef = isStatic ? objectRef : t.memberExpression(objectRef, t.identifier("prototype"));
  6146. return t.logicalExpression("||", t.memberExpression(targetRef, t.identifier("__proto__")), t.callExpression(t.memberExpression(t.identifier("Object"), t.identifier("getPrototypeOf")), [targetRef]));
  6147. }
  6148. var visitor = {
  6149. Function: function Function(path) {
  6150. if (!path.inShadow("this")) {
  6151. path.skip();
  6152. }
  6153. },
  6154. ReturnStatement: function ReturnStatement(path, state) {
  6155. if (!path.inShadow("this")) {
  6156. state.returns.push(path);
  6157. }
  6158. },
  6159. ThisExpression: function ThisExpression(path, state) {
  6160. if (!path.node[HARDCORE_THIS_REF]) {
  6161. state.thises.push(path);
  6162. }
  6163. },
  6164. enter: function enter(path, state) {
  6165. var callback = state.specHandle;
  6166. if (state.isLoose) callback = state.looseHandle;
  6167. var isBareSuper = path.isCallExpression() && path.get("callee").isSuper();
  6168. var result = callback.call(state, path);
  6169. if (result) {
  6170. state.hasSuper = true;
  6171. }
  6172. if (isBareSuper) {
  6173. state.bareSupers.push(path);
  6174. }
  6175. if (result === true) {
  6176. path.requeue();
  6177. }
  6178. if (result !== true && result) {
  6179. if (Array.isArray(result)) {
  6180. path.replaceWithMultiple(result);
  6181. } else {
  6182. path.replaceWith(result);
  6183. }
  6184. }
  6185. }
  6186. };
  6187. var ReplaceSupers = function () {
  6188. function ReplaceSupers(opts) {
  6189. var inClass = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  6190. (0, _classCallCheck3.default)(this, ReplaceSupers);
  6191. this.forceSuperMemoisation = opts.forceSuperMemoisation;
  6192. this.methodPath = opts.methodPath;
  6193. this.methodNode = opts.methodNode;
  6194. this.superRef = opts.superRef;
  6195. this.isStatic = opts.isStatic;
  6196. this.hasSuper = false;
  6197. this.inClass = inClass;
  6198. this.isLoose = opts.isLoose;
  6199. this.scope = this.methodPath.scope;
  6200. this.file = opts.file;
  6201. this.opts = opts;
  6202. this.bareSupers = [];
  6203. this.returns = [];
  6204. this.thises = [];
  6205. }
  6206. ReplaceSupers.prototype.getObjectRef = function getObjectRef() {
  6207. return this.opts.objectRef || this.opts.getObjectRef();
  6208. };
  6209. ReplaceSupers.prototype.setSuperProperty = function setSuperProperty(property, value, isComputed) {
  6210. return t.callExpression(this.file.addHelper("set"), [getPrototypeOfExpression(this.getObjectRef(), this.isStatic), isComputed ? property : t.stringLiteral(property.name), value, t.thisExpression()]);
  6211. };
  6212. ReplaceSupers.prototype.getSuperProperty = function getSuperProperty(property, isComputed) {
  6213. return t.callExpression(this.file.addHelper("get"), [getPrototypeOfExpression(this.getObjectRef(), this.isStatic), isComputed ? property : t.stringLiteral(property.name), t.thisExpression()]);
  6214. };
  6215. ReplaceSupers.prototype.replace = function replace() {
  6216. this.methodPath.traverse(visitor, this);
  6217. };
  6218. ReplaceSupers.prototype.getLooseSuperProperty = function getLooseSuperProperty(id, parent) {
  6219. var methodNode = this.methodNode;
  6220. var superRef = this.superRef || t.identifier("Function");
  6221. if (parent.property === id) {
  6222. return;
  6223. } else if (t.isCallExpression(parent, { callee: id })) {
  6224. return;
  6225. } else if (t.isMemberExpression(parent) && !methodNode.static) {
  6226. return t.memberExpression(superRef, t.identifier("prototype"));
  6227. } else {
  6228. return superRef;
  6229. }
  6230. };
  6231. ReplaceSupers.prototype.looseHandle = function looseHandle(path) {
  6232. var node = path.node;
  6233. if (path.isSuper()) {
  6234. return this.getLooseSuperProperty(node, path.parent);
  6235. } else if (path.isCallExpression()) {
  6236. var callee = node.callee;
  6237. if (!t.isMemberExpression(callee)) return;
  6238. if (!t.isSuper(callee.object)) return;
  6239. t.appendToMemberExpression(callee, t.identifier("call"));
  6240. node.arguments.unshift(t.thisExpression());
  6241. return true;
  6242. }
  6243. };
  6244. ReplaceSupers.prototype.specHandleAssignmentExpression = function specHandleAssignmentExpression(ref, path, node) {
  6245. if (node.operator === "=") {
  6246. return this.setSuperProperty(node.left.property, node.right, node.left.computed);
  6247. } else {
  6248. ref = ref || path.scope.generateUidIdentifier("ref");
  6249. return [t.variableDeclaration("var", [t.variableDeclarator(ref, node.left)]), t.expressionStatement(t.assignmentExpression("=", node.left, t.binaryExpression(node.operator[0], ref, node.right)))];
  6250. }
  6251. };
  6252. ReplaceSupers.prototype.specHandle = function specHandle(path) {
  6253. var property = void 0;
  6254. var computed = void 0;
  6255. var args = void 0;
  6256. var parent = path.parent;
  6257. var node = path.node;
  6258. if (isIllegalBareSuper(node, parent)) {
  6259. throw path.buildCodeFrameError(messages.get("classesIllegalBareSuper"));
  6260. }
  6261. if (t.isCallExpression(node)) {
  6262. var callee = node.callee;
  6263. if (t.isSuper(callee)) {
  6264. return;
  6265. } else if (isMemberExpressionSuper(callee)) {
  6266. property = callee.property;
  6267. computed = callee.computed;
  6268. args = node.arguments;
  6269. }
  6270. } else if (t.isMemberExpression(node) && t.isSuper(node.object)) {
  6271. property = node.property;
  6272. computed = node.computed;
  6273. } else if (t.isUpdateExpression(node) && isMemberExpressionSuper(node.argument)) {
  6274. var binary = t.binaryExpression(node.operator[0], node.argument, t.numericLiteral(1));
  6275. if (node.prefix) {
  6276. return this.specHandleAssignmentExpression(null, path, binary);
  6277. } else {
  6278. var ref = path.scope.generateUidIdentifier("ref");
  6279. return this.specHandleAssignmentExpression(ref, path, binary).concat(t.expressionStatement(ref));
  6280. }
  6281. } else if (t.isAssignmentExpression(node) && isMemberExpressionSuper(node.left)) {
  6282. return this.specHandleAssignmentExpression(null, path, node);
  6283. }
  6284. if (!property) return;
  6285. var superProperty = this.getSuperProperty(property, computed);
  6286. if (args) {
  6287. return this.optimiseCall(superProperty, args);
  6288. } else {
  6289. return superProperty;
  6290. }
  6291. };
  6292. ReplaceSupers.prototype.optimiseCall = function optimiseCall(callee, args) {
  6293. var thisNode = t.thisExpression();
  6294. thisNode[HARDCORE_THIS_REF] = true;
  6295. return (0, _babelHelperOptimiseCallExpression2.default)(callee, thisNode, args);
  6296. };
  6297. return ReplaceSupers;
  6298. }();
  6299. exports.default = ReplaceSupers;
  6300. module.exports = exports["default"];
  6301. },{"babel-helper-optimise-call-expression":56,"babel-messages":61,"babel-runtime/core-js/symbol":104,"babel-runtime/helpers/classCallCheck":109,"babel-types":151}],59:[function(require,module,exports){
  6302. "use strict";
  6303. exports.__esModule = true;
  6304. var _babelTemplate = require("babel-template");
  6305. var _babelTemplate2 = _interopRequireDefault(_babelTemplate);
  6306. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6307. var helpers = {};
  6308. exports.default = helpers;
  6309. 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");
  6310. 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");
  6311. 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");
  6312. 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");
  6313. 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");
  6314. 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");
  6315. 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");
  6316. 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");
  6317. 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");
  6318. 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");
  6319. 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");
  6320. 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");
  6321. 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");
  6322. 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");
  6323. 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");
  6324. helpers.interopRequireDefault = (0, _babelTemplate2.default)("\n (function (obj) {\n return obj && obj.__esModule ? obj : { default: obj };\n })\n");
  6325. 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");
  6326. 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");
  6327. helpers.objectDestructuringEmpty = (0, _babelTemplate2.default)("\n (function (obj) {\n if (obj == null) throw new TypeError(\"Cannot destructure undefined\");\n });\n");
  6328. 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");
  6329. 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");
  6330. helpers.selfGlobal = (0, _babelTemplate2.default)("\n typeof global === \"undefined\" ? self : global\n");
  6331. 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");
  6332. 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");
  6333. 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");
  6334. 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");
  6335. helpers.taggedTemplateLiteralLoose = (0, _babelTemplate2.default)("\n (function (strings, raw) {\n strings.raw = raw;\n return strings;\n });\n");
  6336. 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");
  6337. helpers.temporalUndefined = (0, _babelTemplate2.default)("\n ({})\n");
  6338. helpers.toArray = (0, _babelTemplate2.default)("\n (function (arr) {\n return Array.isArray(arr) ? arr : Array.from(arr);\n });\n");
  6339. 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");
  6340. module.exports = exports["default"];
  6341. },{"babel-template":114}],60:[function(require,module,exports){
  6342. "use strict";
  6343. exports.__esModule = true;
  6344. exports.list = undefined;
  6345. var _keys = require("babel-runtime/core-js/object/keys");
  6346. var _keys2 = _interopRequireDefault(_keys);
  6347. exports.get = get;
  6348. var _helpers = require("./helpers");
  6349. var _helpers2 = _interopRequireDefault(_helpers);
  6350. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6351. function get(name) {
  6352. var fn = _helpers2.default[name];
  6353. if (!fn) throw new ReferenceError("Unknown helper " + name);
  6354. return fn().expression;
  6355. }
  6356. var list = exports.list = (0, _keys2.default)(_helpers2.default).map(function (name) {
  6357. return name.replace(/^_/, "");
  6358. }).filter(function (name) {
  6359. return name !== "__esModule";
  6360. });
  6361. exports.default = get;
  6362. },{"./helpers":59,"babel-runtime/core-js/object/keys":102}],61:[function(require,module,exports){
  6363. "use strict";
  6364. exports.__esModule = true;
  6365. exports.MESSAGES = undefined;
  6366. var _stringify = require("babel-runtime/core-js/json/stringify");
  6367. var _stringify2 = _interopRequireDefault(_stringify);
  6368. exports.get = get;
  6369. exports.parseArgs = parseArgs;
  6370. var _util = require("util");
  6371. var util = _interopRequireWildcard(_util);
  6372. 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; } }
  6373. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6374. var MESSAGES = exports.MESSAGES = {
  6375. tailCallReassignmentDeopt: "Function reference has been reassigned, so it will probably be dereferenced, therefore we can't optimise this with confidence",
  6376. classesIllegalBareSuper: "Illegal use of bare super",
  6377. classesIllegalSuperCall: "Direct super call is illegal in non-constructor, use super.$1() instead",
  6378. scopeDuplicateDeclaration: "Duplicate declaration $1",
  6379. settersNoRest: "Setters aren't allowed to have a rest",
  6380. noAssignmentsInForHead: "No assignments allowed in for-in/of head",
  6381. expectedMemberExpressionOrIdentifier: "Expected type MemberExpression or Identifier",
  6382. invalidParentForThisNode: "We don't know how to handle this node within the current parent - please open an issue",
  6383. readOnly: "$1 is read-only",
  6384. unknownForHead: "Unknown node type $1 in ForStatement",
  6385. didYouMean: "Did you mean $1?",
  6386. codeGeneratorDeopt: "Note: The code generator has deoptimised the styling of $1 as it exceeds the max of $2.",
  6387. missingTemplatesDirectory: "no templates directory - this is most likely the result of a broken `npm publish`. Please report to https://github.com/babel/babel/issues",
  6388. unsupportedOutputType: "Unsupported output type $1",
  6389. illegalMethodName: "Illegal method name $1",
  6390. lostTrackNodePath: "We lost track of this node's position, likely because the AST was directly manipulated",
  6391. modulesIllegalExportName: "Illegal export $1",
  6392. modulesDuplicateDeclarations: "Duplicate module declarations with the same source but in different scopes",
  6393. undeclaredVariable: "Reference to undeclared variable $1",
  6394. undeclaredVariableType: "Referencing a type alias outside of a type annotation",
  6395. undeclaredVariableSuggestion: "Reference to undeclared variable $1 - did you mean $2?",
  6396. 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.",
  6397. traverseVerifyRootFunction: "You passed `traverse()` a function when it expected a visitor object, are you sure you didn't mean `{ enter: Function }`?",
  6398. traverseVerifyVisitorProperty: "You passed `traverse()` a visitor object with the property $1 that has the invalid property $2",
  6399. traverseVerifyNodeType: "You gave us a visitor for the node type $1 but it's not a valid type",
  6400. pluginNotObject: "Plugin $2 specified in $1 was expected to return an object when invoked but returned $3",
  6401. pluginNotFunction: "Plugin $2 specified in $1 was expected to return a function but returned $3",
  6402. pluginUnknown: "Unknown plugin $1 specified in $2 at $3, attempted to resolve relative to $4",
  6403. pluginInvalidProperty: "Plugin $2 specified in $1 provided an invalid property of $3"
  6404. };
  6405. function get(key) {
  6406. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  6407. args[_key - 1] = arguments[_key];
  6408. }
  6409. var msg = MESSAGES[key];
  6410. if (!msg) throw new ReferenceError("Unknown message " + (0, _stringify2.default)(key));
  6411. args = parseArgs(args);
  6412. return msg.replace(/\$(\d+)/g, function (str, i) {
  6413. return args[i - 1];
  6414. });
  6415. }
  6416. function parseArgs(args) {
  6417. return args.map(function (val) {
  6418. if (val != null && val.inspect) {
  6419. return val.inspect();
  6420. } else {
  6421. try {
  6422. return (0, _stringify2.default)(val) || val + "";
  6423. } catch (e) {
  6424. return util.inspect(val);
  6425. }
  6426. }
  6427. });
  6428. }
  6429. },{"babel-runtime/core-js/json/stringify":96,"util":560}],62:[function(require,module,exports){
  6430. "use strict";
  6431. exports.__esModule = true;
  6432. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  6433. var _getIterator3 = _interopRequireDefault(_getIterator2);
  6434. exports.default = function (_ref) {
  6435. var messages = _ref.messages;
  6436. return {
  6437. visitor: {
  6438. Scope: function Scope(_ref2) {
  6439. var scope = _ref2.scope;
  6440. for (var name in scope.bindings) {
  6441. var binding = scope.bindings[name];
  6442. if (binding.kind !== "const" && binding.kind !== "module") continue;
  6443. for (var _iterator = binding.constantViolations, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  6444. var _ref3;
  6445. if (_isArray) {
  6446. if (_i >= _iterator.length) break;
  6447. _ref3 = _iterator[_i++];
  6448. } else {
  6449. _i = _iterator.next();
  6450. if (_i.done) break;
  6451. _ref3 = _i.value;
  6452. }
  6453. var violation = _ref3;
  6454. throw violation.buildCodeFrameError(messages.get("readOnly", name));
  6455. }
  6456. }
  6457. }
  6458. }
  6459. };
  6460. };
  6461. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6462. module.exports = exports["default"];
  6463. },{"babel-runtime/core-js/get-iterator":95}],63:[function(require,module,exports){
  6464. "use strict";
  6465. exports.__esModule = true;
  6466. exports.default = function () {
  6467. return {
  6468. manipulateOptions: function manipulateOptions(opts, parserOpts) {
  6469. parserOpts.plugins.push("dynamicImport");
  6470. }
  6471. };
  6472. };
  6473. module.exports = exports["default"];
  6474. },{}],64:[function(require,module,exports){
  6475. "use strict";
  6476. exports.__esModule = true;
  6477. exports.default = function (_ref) {
  6478. var t = _ref.types;
  6479. return {
  6480. visitor: {
  6481. ArrowFunctionExpression: function ArrowFunctionExpression(path, state) {
  6482. if (state.opts.spec) {
  6483. var node = path.node;
  6484. if (node.shadow) return;
  6485. node.shadow = { this: false };
  6486. node.type = "FunctionExpression";
  6487. var boundThis = t.thisExpression();
  6488. boundThis._forceShadow = path;
  6489. path.ensureBlock();
  6490. path.get("body").unshiftContainer("body", t.expressionStatement(t.callExpression(state.addHelper("newArrowCheck"), [t.thisExpression(), boundThis])));
  6491. path.replaceWith(t.callExpression(t.memberExpression(node, t.identifier("bind")), [t.thisExpression()]));
  6492. } else {
  6493. path.arrowFunctionToShadowed();
  6494. }
  6495. }
  6496. }
  6497. };
  6498. };
  6499. module.exports = exports["default"];
  6500. },{}],65:[function(require,module,exports){
  6501. "use strict";
  6502. exports.__esModule = true;
  6503. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  6504. var _getIterator3 = _interopRequireDefault(_getIterator2);
  6505. exports.default = function (_ref) {
  6506. var t = _ref.types;
  6507. function statementList(key, path) {
  6508. var paths = path.get(key);
  6509. for (var _iterator = paths, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  6510. var _ref2;
  6511. if (_isArray) {
  6512. if (_i >= _iterator.length) break;
  6513. _ref2 = _iterator[_i++];
  6514. } else {
  6515. _i = _iterator.next();
  6516. if (_i.done) break;
  6517. _ref2 = _i.value;
  6518. }
  6519. var _path = _ref2;
  6520. var func = _path.node;
  6521. if (!_path.isFunctionDeclaration()) continue;
  6522. var declar = t.variableDeclaration("let", [t.variableDeclarator(func.id, t.toExpression(func))]);
  6523. declar._blockHoist = 2;
  6524. func.id = null;
  6525. _path.replaceWith(declar);
  6526. }
  6527. }
  6528. return {
  6529. visitor: {
  6530. BlockStatement: function BlockStatement(path) {
  6531. var node = path.node,
  6532. parent = path.parent;
  6533. if (t.isFunction(parent, { body: node }) || t.isExportDeclaration(parent)) {
  6534. return;
  6535. }
  6536. statementList("body", path);
  6537. },
  6538. SwitchCase: function SwitchCase(path) {
  6539. statementList("consequent", path);
  6540. }
  6541. }
  6542. };
  6543. };
  6544. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6545. module.exports = exports["default"];
  6546. },{"babel-runtime/core-js/get-iterator":95}],66:[function(require,module,exports){
  6547. "use strict";
  6548. exports.__esModule = true;
  6549. var _symbol = require("babel-runtime/core-js/symbol");
  6550. var _symbol2 = _interopRequireDefault(_symbol);
  6551. var _create = require("babel-runtime/core-js/object/create");
  6552. var _create2 = _interopRequireDefault(_create);
  6553. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  6554. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  6555. exports.default = function () {
  6556. return {
  6557. visitor: {
  6558. VariableDeclaration: function VariableDeclaration(path, file) {
  6559. var node = path.node,
  6560. parent = path.parent,
  6561. scope = path.scope;
  6562. if (!isBlockScoped(node)) return;
  6563. convertBlockScopedToVar(path, null, parent, scope, true);
  6564. if (node._tdzThis) {
  6565. var nodes = [node];
  6566. for (var i = 0; i < node.declarations.length; i++) {
  6567. var decl = node.declarations[i];
  6568. if (decl.init) {
  6569. var assign = t.assignmentExpression("=", decl.id, decl.init);
  6570. assign._ignoreBlockScopingTDZ = true;
  6571. nodes.push(t.expressionStatement(assign));
  6572. }
  6573. decl.init = file.addHelper("temporalUndefined");
  6574. }
  6575. node._blockHoist = 2;
  6576. if (path.isCompletionRecord()) {
  6577. nodes.push(t.expressionStatement(scope.buildUndefinedNode()));
  6578. }
  6579. path.replaceWithMultiple(nodes);
  6580. }
  6581. },
  6582. Loop: function Loop(path, file) {
  6583. var node = path.node,
  6584. parent = path.parent,
  6585. scope = path.scope;
  6586. t.ensureBlock(node);
  6587. var blockScoping = new BlockScoping(path, path.get("body"), parent, scope, file);
  6588. var replace = blockScoping.run();
  6589. if (replace) path.replaceWith(replace);
  6590. },
  6591. CatchClause: function CatchClause(path, file) {
  6592. var parent = path.parent,
  6593. scope = path.scope;
  6594. var blockScoping = new BlockScoping(null, path.get("body"), parent, scope, file);
  6595. blockScoping.run();
  6596. },
  6597. "BlockStatement|SwitchStatement|Program": function BlockStatementSwitchStatementProgram(path, file) {
  6598. if (!ignoreBlock(path)) {
  6599. var blockScoping = new BlockScoping(null, path, path.parent, path.scope, file);
  6600. blockScoping.run();
  6601. }
  6602. }
  6603. }
  6604. };
  6605. };
  6606. var _babelTraverse = require("babel-traverse");
  6607. var _babelTraverse2 = _interopRequireDefault(_babelTraverse);
  6608. var _tdz = require("./tdz");
  6609. var _babelTypes = require("babel-types");
  6610. var t = _interopRequireWildcard(_babelTypes);
  6611. var _values = require("lodash/values");
  6612. var _values2 = _interopRequireDefault(_values);
  6613. var _extend = require("lodash/extend");
  6614. var _extend2 = _interopRequireDefault(_extend);
  6615. var _babelTemplate = require("babel-template");
  6616. var _babelTemplate2 = _interopRequireDefault(_babelTemplate);
  6617. 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; } }
  6618. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6619. function ignoreBlock(path) {
  6620. return t.isLoop(path.parent) || t.isCatchClause(path.parent);
  6621. }
  6622. var buildRetCheck = (0, _babelTemplate2.default)("\n if (typeof RETURN === \"object\") return RETURN.v;\n");
  6623. function isBlockScoped(node) {
  6624. if (!t.isVariableDeclaration(node)) return false;
  6625. if (node[t.BLOCK_SCOPED_SYMBOL]) return true;
  6626. if (node.kind !== "let" && node.kind !== "const") return false;
  6627. return true;
  6628. }
  6629. function convertBlockScopedToVar(path, node, parent, scope) {
  6630. var moveBindingsToParent = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  6631. if (!node) {
  6632. node = path.node;
  6633. }
  6634. if (!t.isFor(parent)) {
  6635. for (var i = 0; i < node.declarations.length; i++) {
  6636. var declar = node.declarations[i];
  6637. declar.init = declar.init || scope.buildUndefinedNode();
  6638. }
  6639. }
  6640. node[t.BLOCK_SCOPED_SYMBOL] = true;
  6641. node.kind = "var";
  6642. if (moveBindingsToParent) {
  6643. var parentScope = scope.getFunctionParent();
  6644. var ids = path.getBindingIdentifiers();
  6645. for (var name in ids) {
  6646. var binding = scope.getOwnBinding(name);
  6647. if (binding) binding.kind = "var";
  6648. scope.moveBindingTo(name, parentScope);
  6649. }
  6650. }
  6651. }
  6652. function isVar(node) {
  6653. return t.isVariableDeclaration(node, { kind: "var" }) && !isBlockScoped(node);
  6654. }
  6655. var letReferenceBlockVisitor = _babelTraverse2.default.visitors.merge([{
  6656. Loop: {
  6657. enter: function enter(path, state) {
  6658. state.loopDepth++;
  6659. },
  6660. exit: function exit(path, state) {
  6661. state.loopDepth--;
  6662. }
  6663. },
  6664. Function: function Function(path, state) {
  6665. if (state.loopDepth > 0) {
  6666. path.traverse(letReferenceFunctionVisitor, state);
  6667. }
  6668. return path.skip();
  6669. }
  6670. }, _tdz.visitor]);
  6671. var letReferenceFunctionVisitor = _babelTraverse2.default.visitors.merge([{
  6672. ReferencedIdentifier: function ReferencedIdentifier(path, state) {
  6673. var ref = state.letReferences[path.node.name];
  6674. if (!ref) return;
  6675. var localBinding = path.scope.getBindingIdentifier(path.node.name);
  6676. if (localBinding && localBinding !== ref) return;
  6677. state.closurify = true;
  6678. }
  6679. }, _tdz.visitor]);
  6680. var hoistVarDeclarationsVisitor = {
  6681. enter: function enter(path, self) {
  6682. var node = path.node,
  6683. parent = path.parent;
  6684. if (path.isForStatement()) {
  6685. if (isVar(node.init, node)) {
  6686. var nodes = self.pushDeclar(node.init);
  6687. if (nodes.length === 1) {
  6688. node.init = nodes[0];
  6689. } else {
  6690. node.init = t.sequenceExpression(nodes);
  6691. }
  6692. }
  6693. } else if (path.isFor()) {
  6694. if (isVar(node.left, node)) {
  6695. self.pushDeclar(node.left);
  6696. node.left = node.left.declarations[0].id;
  6697. }
  6698. } else if (isVar(node, parent)) {
  6699. path.replaceWithMultiple(self.pushDeclar(node).map(function (expr) {
  6700. return t.expressionStatement(expr);
  6701. }));
  6702. } else if (path.isFunction()) {
  6703. return path.skip();
  6704. }
  6705. }
  6706. };
  6707. var loopLabelVisitor = {
  6708. LabeledStatement: function LabeledStatement(_ref, state) {
  6709. var node = _ref.node;
  6710. state.innerLabels.push(node.label.name);
  6711. }
  6712. };
  6713. var continuationVisitor = {
  6714. enter: function enter(path, state) {
  6715. if (path.isAssignmentExpression() || path.isUpdateExpression()) {
  6716. var bindings = path.getBindingIdentifiers();
  6717. for (var name in bindings) {
  6718. if (state.outsideReferences[name] !== path.scope.getBindingIdentifier(name)) continue;
  6719. state.reassignments[name] = true;
  6720. }
  6721. }
  6722. }
  6723. };
  6724. function loopNodeTo(node) {
  6725. if (t.isBreakStatement(node)) {
  6726. return "break";
  6727. } else if (t.isContinueStatement(node)) {
  6728. return "continue";
  6729. }
  6730. }
  6731. var loopVisitor = {
  6732. Loop: function Loop(path, state) {
  6733. var oldIgnoreLabeless = state.ignoreLabeless;
  6734. state.ignoreLabeless = true;
  6735. path.traverse(loopVisitor, state);
  6736. state.ignoreLabeless = oldIgnoreLabeless;
  6737. path.skip();
  6738. },
  6739. Function: function Function(path) {
  6740. path.skip();
  6741. },
  6742. SwitchCase: function SwitchCase(path, state) {
  6743. var oldInSwitchCase = state.inSwitchCase;
  6744. state.inSwitchCase = true;
  6745. path.traverse(loopVisitor, state);
  6746. state.inSwitchCase = oldInSwitchCase;
  6747. path.skip();
  6748. },
  6749. "BreakStatement|ContinueStatement|ReturnStatement": function BreakStatementContinueStatementReturnStatement(path, state) {
  6750. var node = path.node,
  6751. parent = path.parent,
  6752. scope = path.scope;
  6753. if (node[this.LOOP_IGNORE]) return;
  6754. var replace = void 0;
  6755. var loopText = loopNodeTo(node);
  6756. if (loopText) {
  6757. if (node.label) {
  6758. if (state.innerLabels.indexOf(node.label.name) >= 0) {
  6759. return;
  6760. }
  6761. loopText = loopText + "|" + node.label.name;
  6762. } else {
  6763. if (state.ignoreLabeless) return;
  6764. if (state.inSwitchCase) return;
  6765. if (t.isBreakStatement(node) && t.isSwitchCase(parent)) return;
  6766. }
  6767. state.hasBreakContinue = true;
  6768. state.map[loopText] = node;
  6769. replace = t.stringLiteral(loopText);
  6770. }
  6771. if (path.isReturnStatement()) {
  6772. state.hasReturn = true;
  6773. replace = t.objectExpression([t.objectProperty(t.identifier("v"), node.argument || scope.buildUndefinedNode())]);
  6774. }
  6775. if (replace) {
  6776. replace = t.returnStatement(replace);
  6777. replace[this.LOOP_IGNORE] = true;
  6778. path.skip();
  6779. path.replaceWith(t.inherits(replace, node));
  6780. }
  6781. }
  6782. };
  6783. var BlockScoping = function () {
  6784. function BlockScoping(loopPath, blockPath, parent, scope, file) {
  6785. (0, _classCallCheck3.default)(this, BlockScoping);
  6786. this.parent = parent;
  6787. this.scope = scope;
  6788. this.file = file;
  6789. this.blockPath = blockPath;
  6790. this.block = blockPath.node;
  6791. this.outsideLetReferences = (0, _create2.default)(null);
  6792. this.hasLetReferences = false;
  6793. this.letReferences = (0, _create2.default)(null);
  6794. this.body = [];
  6795. if (loopPath) {
  6796. this.loopParent = loopPath.parent;
  6797. this.loopLabel = t.isLabeledStatement(this.loopParent) && this.loopParent.label;
  6798. this.loopPath = loopPath;
  6799. this.loop = loopPath.node;
  6800. }
  6801. }
  6802. BlockScoping.prototype.run = function run() {
  6803. var block = this.block;
  6804. if (block._letDone) return;
  6805. block._letDone = true;
  6806. var needsClosure = this.getLetReferences();
  6807. if (t.isFunction(this.parent) || t.isProgram(this.block)) {
  6808. this.updateScopeInfo();
  6809. return;
  6810. }
  6811. if (!this.hasLetReferences) return;
  6812. if (needsClosure) {
  6813. this.wrapClosure();
  6814. } else {
  6815. this.remap();
  6816. }
  6817. this.updateScopeInfo(needsClosure);
  6818. if (this.loopLabel && !t.isLabeledStatement(this.loopParent)) {
  6819. return t.labeledStatement(this.loopLabel, this.loop);
  6820. }
  6821. };
  6822. BlockScoping.prototype.updateScopeInfo = function updateScopeInfo(wrappedInClosure) {
  6823. var scope = this.scope;
  6824. var parentScope = scope.getFunctionParent();
  6825. var letRefs = this.letReferences;
  6826. for (var key in letRefs) {
  6827. var ref = letRefs[key];
  6828. var binding = scope.getBinding(ref.name);
  6829. if (!binding) continue;
  6830. if (binding.kind === "let" || binding.kind === "const") {
  6831. binding.kind = "var";
  6832. if (wrappedInClosure) {
  6833. scope.removeBinding(ref.name);
  6834. } else {
  6835. scope.moveBindingTo(ref.name, parentScope);
  6836. }
  6837. }
  6838. }
  6839. };
  6840. BlockScoping.prototype.remap = function remap() {
  6841. var letRefs = this.letReferences;
  6842. var scope = this.scope;
  6843. for (var key in letRefs) {
  6844. var ref = letRefs[key];
  6845. if (scope.parentHasBinding(key) || scope.hasGlobal(key)) {
  6846. if (scope.hasOwnBinding(key)) scope.rename(ref.name);
  6847. if (this.blockPath.scope.hasOwnBinding(key)) this.blockPath.scope.rename(ref.name);
  6848. }
  6849. }
  6850. };
  6851. BlockScoping.prototype.wrapClosure = function wrapClosure() {
  6852. if (this.file.opts.throwIfClosureRequired) {
  6853. throw this.blockPath.buildCodeFrameError("Compiling let/const in this block would add a closure " + "(throwIfClosureRequired).");
  6854. }
  6855. var block = this.block;
  6856. var outsideRefs = this.outsideLetReferences;
  6857. if (this.loop) {
  6858. for (var name in outsideRefs) {
  6859. var id = outsideRefs[name];
  6860. if (this.scope.hasGlobal(id.name) || this.scope.parentHasBinding(id.name)) {
  6861. delete outsideRefs[id.name];
  6862. delete this.letReferences[id.name];
  6863. this.scope.rename(id.name);
  6864. this.letReferences[id.name] = id;
  6865. outsideRefs[id.name] = id;
  6866. }
  6867. }
  6868. }
  6869. this.has = this.checkLoop();
  6870. this.hoistVarDeclarations();
  6871. var params = (0, _values2.default)(outsideRefs);
  6872. var args = (0, _values2.default)(outsideRefs);
  6873. var isSwitch = this.blockPath.isSwitchStatement();
  6874. var fn = t.functionExpression(null, params, t.blockStatement(isSwitch ? [block] : block.body));
  6875. fn.shadow = true;
  6876. this.addContinuations(fn);
  6877. var ref = fn;
  6878. if (this.loop) {
  6879. ref = this.scope.generateUidIdentifier("loop");
  6880. this.loopPath.insertBefore(t.variableDeclaration("var", [t.variableDeclarator(ref, fn)]));
  6881. }
  6882. var call = t.callExpression(ref, args);
  6883. var ret = this.scope.generateUidIdentifier("ret");
  6884. var hasYield = _babelTraverse2.default.hasType(fn.body, this.scope, "YieldExpression", t.FUNCTION_TYPES);
  6885. if (hasYield) {
  6886. fn.generator = true;
  6887. call = t.yieldExpression(call, true);
  6888. }
  6889. var hasAsync = _babelTraverse2.default.hasType(fn.body, this.scope, "AwaitExpression", t.FUNCTION_TYPES);
  6890. if (hasAsync) {
  6891. fn.async = true;
  6892. call = t.awaitExpression(call);
  6893. }
  6894. this.buildClosure(ret, call);
  6895. if (isSwitch) this.blockPath.replaceWithMultiple(this.body);else block.body = this.body;
  6896. };
  6897. BlockScoping.prototype.buildClosure = function buildClosure(ret, call) {
  6898. var has = this.has;
  6899. if (has.hasReturn || has.hasBreakContinue) {
  6900. this.buildHas(ret, call);
  6901. } else {
  6902. this.body.push(t.expressionStatement(call));
  6903. }
  6904. };
  6905. BlockScoping.prototype.addContinuations = function addContinuations(fn) {
  6906. var state = {
  6907. reassignments: {},
  6908. outsideReferences: this.outsideLetReferences
  6909. };
  6910. this.scope.traverse(fn, continuationVisitor, state);
  6911. for (var i = 0; i < fn.params.length; i++) {
  6912. var param = fn.params[i];
  6913. if (!state.reassignments[param.name]) continue;
  6914. var newParam = this.scope.generateUidIdentifier(param.name);
  6915. fn.params[i] = newParam;
  6916. this.scope.rename(param.name, newParam.name, fn);
  6917. fn.body.body.push(t.expressionStatement(t.assignmentExpression("=", param, newParam)));
  6918. }
  6919. };
  6920. BlockScoping.prototype.getLetReferences = function getLetReferences() {
  6921. var _this = this;
  6922. var block = this.block;
  6923. var declarators = [];
  6924. if (this.loop) {
  6925. var init = this.loop.left || this.loop.init;
  6926. if (isBlockScoped(init)) {
  6927. declarators.push(init);
  6928. (0, _extend2.default)(this.outsideLetReferences, t.getBindingIdentifiers(init));
  6929. }
  6930. }
  6931. var addDeclarationsFromChild = function addDeclarationsFromChild(path, node) {
  6932. node = node || path.node;
  6933. if (t.isClassDeclaration(node) || t.isFunctionDeclaration(node) || isBlockScoped(node)) {
  6934. if (isBlockScoped(node)) {
  6935. convertBlockScopedToVar(path, node, block, _this.scope);
  6936. }
  6937. declarators = declarators.concat(node.declarations || node);
  6938. }
  6939. if (t.isLabeledStatement(node)) {
  6940. addDeclarationsFromChild(path.get("body"), node.body);
  6941. }
  6942. };
  6943. if (block.body) {
  6944. for (var i = 0; i < block.body.length; i++) {
  6945. var declarPath = this.blockPath.get("body")[i];
  6946. addDeclarationsFromChild(declarPath);
  6947. }
  6948. }
  6949. if (block.cases) {
  6950. for (var _i = 0; _i < block.cases.length; _i++) {
  6951. var consequents = block.cases[_i].consequent;
  6952. for (var j = 0; j < consequents.length; j++) {
  6953. var _declarPath = this.blockPath.get("cases")[_i];
  6954. var declar = consequents[j];
  6955. addDeclarationsFromChild(_declarPath, declar);
  6956. }
  6957. }
  6958. }
  6959. for (var _i2 = 0; _i2 < declarators.length; _i2++) {
  6960. var _declar = declarators[_i2];
  6961. var keys = t.getBindingIdentifiers(_declar, false, true);
  6962. (0, _extend2.default)(this.letReferences, keys);
  6963. this.hasLetReferences = true;
  6964. }
  6965. if (!this.hasLetReferences) return;
  6966. var state = {
  6967. letReferences: this.letReferences,
  6968. closurify: false,
  6969. file: this.file,
  6970. loopDepth: 0
  6971. };
  6972. var loopOrFunctionParent = this.blockPath.find(function (path) {
  6973. return path.isLoop() || path.isFunction();
  6974. });
  6975. if (loopOrFunctionParent && loopOrFunctionParent.isLoop()) {
  6976. state.loopDepth++;
  6977. }
  6978. this.blockPath.traverse(letReferenceBlockVisitor, state);
  6979. return state.closurify;
  6980. };
  6981. BlockScoping.prototype.checkLoop = function checkLoop() {
  6982. var state = {
  6983. hasBreakContinue: false,
  6984. ignoreLabeless: false,
  6985. inSwitchCase: false,
  6986. innerLabels: [],
  6987. hasReturn: false,
  6988. isLoop: !!this.loop,
  6989. map: {},
  6990. LOOP_IGNORE: (0, _symbol2.default)()
  6991. };
  6992. this.blockPath.traverse(loopLabelVisitor, state);
  6993. this.blockPath.traverse(loopVisitor, state);
  6994. return state;
  6995. };
  6996. BlockScoping.prototype.hoistVarDeclarations = function hoistVarDeclarations() {
  6997. this.blockPath.traverse(hoistVarDeclarationsVisitor, this);
  6998. };
  6999. BlockScoping.prototype.pushDeclar = function pushDeclar(node) {
  7000. var declars = [];
  7001. var names = t.getBindingIdentifiers(node);
  7002. for (var name in names) {
  7003. declars.push(t.variableDeclarator(names[name]));
  7004. }
  7005. this.body.push(t.variableDeclaration(node.kind, declars));
  7006. var replace = [];
  7007. for (var i = 0; i < node.declarations.length; i++) {
  7008. var declar = node.declarations[i];
  7009. if (!declar.init) continue;
  7010. var expr = t.assignmentExpression("=", declar.id, declar.init);
  7011. replace.push(t.inherits(expr, declar));
  7012. }
  7013. return replace;
  7014. };
  7015. BlockScoping.prototype.buildHas = function buildHas(ret, call) {
  7016. var body = this.body;
  7017. body.push(t.variableDeclaration("var", [t.variableDeclarator(ret, call)]));
  7018. var retCheck = void 0;
  7019. var has = this.has;
  7020. var cases = [];
  7021. if (has.hasReturn) {
  7022. retCheck = buildRetCheck({
  7023. RETURN: ret
  7024. });
  7025. }
  7026. if (has.hasBreakContinue) {
  7027. for (var key in has.map) {
  7028. cases.push(t.switchCase(t.stringLiteral(key), [has.map[key]]));
  7029. }
  7030. if (has.hasReturn) {
  7031. cases.push(t.switchCase(null, [retCheck]));
  7032. }
  7033. if (cases.length === 1) {
  7034. var single = cases[0];
  7035. body.push(t.ifStatement(t.binaryExpression("===", ret, single.test), single.consequent[0]));
  7036. } else {
  7037. if (this.loop) {
  7038. for (var i = 0; i < cases.length; i++) {
  7039. var caseConsequent = cases[i].consequent[0];
  7040. if (t.isBreakStatement(caseConsequent) && !caseConsequent.label) {
  7041. caseConsequent.label = this.loopLabel = this.loopLabel || this.scope.generateUidIdentifier("loop");
  7042. }
  7043. }
  7044. }
  7045. body.push(t.switchStatement(ret, cases));
  7046. }
  7047. } else {
  7048. if (has.hasReturn) {
  7049. body.push(retCheck);
  7050. }
  7051. }
  7052. };
  7053. return BlockScoping;
  7054. }();
  7055. module.exports = exports["default"];
  7056. },{"./tdz":67,"babel-runtime/core-js/object/create":100,"babel-runtime/core-js/symbol":104,"babel-runtime/helpers/classCallCheck":109,"babel-template":114,"babel-traverse":118,"babel-types":151,"lodash/extend":473,"lodash/values":518}],67:[function(require,module,exports){
  7057. "use strict";
  7058. exports.__esModule = true;
  7059. exports.visitor = undefined;
  7060. var _babelTypes = require("babel-types");
  7061. var t = _interopRequireWildcard(_babelTypes);
  7062. 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; } }
  7063. function getTDZStatus(refPath, bindingPath) {
  7064. var executionStatus = bindingPath._guessExecutionStatusRelativeTo(refPath);
  7065. if (executionStatus === "before") {
  7066. return "inside";
  7067. } else if (executionStatus === "after") {
  7068. return "outside";
  7069. } else {
  7070. return "maybe";
  7071. }
  7072. }
  7073. function buildTDZAssert(node, file) {
  7074. return t.callExpression(file.addHelper("temporalRef"), [node, t.stringLiteral(node.name), file.addHelper("temporalUndefined")]);
  7075. }
  7076. function isReference(node, scope, state) {
  7077. var declared = state.letReferences[node.name];
  7078. if (!declared) return false;
  7079. return scope.getBindingIdentifier(node.name) === declared;
  7080. }
  7081. var visitor = exports.visitor = {
  7082. ReferencedIdentifier: function ReferencedIdentifier(path, state) {
  7083. if (!this.file.opts.tdz) return;
  7084. var node = path.node,
  7085. parent = path.parent,
  7086. scope = path.scope;
  7087. if (path.parentPath.isFor({ left: node })) return;
  7088. if (!isReference(node, scope, state)) return;
  7089. var bindingPath = scope.getBinding(node.name).path;
  7090. var status = getTDZStatus(path, bindingPath);
  7091. if (status === "inside") return;
  7092. if (status === "maybe") {
  7093. var assert = buildTDZAssert(node, state.file);
  7094. bindingPath.parent._tdzThis = true;
  7095. path.skip();
  7096. if (path.parentPath.isUpdateExpression()) {
  7097. if (parent._ignoreBlockScopingTDZ) return;
  7098. path.parentPath.replaceWith(t.sequenceExpression([assert, parent]));
  7099. } else {
  7100. path.replaceWith(assert);
  7101. }
  7102. } else if (status === "outside") {
  7103. path.replaceWith(t.throwStatement(t.inherits(t.newExpression(t.identifier("ReferenceError"), [t.stringLiteral(node.name + " is not defined - temporal dead zone")]), node)));
  7104. }
  7105. },
  7106. AssignmentExpression: {
  7107. exit: function exit(path, state) {
  7108. if (!this.file.opts.tdz) return;
  7109. var node = path.node;
  7110. if (node._ignoreBlockScopingTDZ) return;
  7111. var nodes = [];
  7112. var ids = path.getBindingIdentifiers();
  7113. for (var name in ids) {
  7114. var id = ids[name];
  7115. if (isReference(id, path.scope, state)) {
  7116. nodes.push(buildTDZAssert(id, state.file));
  7117. }
  7118. }
  7119. if (nodes.length) {
  7120. node._ignoreBlockScopingTDZ = true;
  7121. nodes.push(node);
  7122. path.replaceWithMultiple(nodes.map(t.expressionStatement));
  7123. }
  7124. }
  7125. }
  7126. };
  7127. },{"babel-types":151}],68:[function(require,module,exports){
  7128. "use strict";
  7129. exports.__esModule = true;
  7130. var _symbol = require("babel-runtime/core-js/symbol");
  7131. var _symbol2 = _interopRequireDefault(_symbol);
  7132. exports.default = function (_ref) {
  7133. var t = _ref.types;
  7134. var VISITED = (0, _symbol2.default)();
  7135. return {
  7136. visitor: {
  7137. ExportDefaultDeclaration: function ExportDefaultDeclaration(path) {
  7138. if (!path.get("declaration").isClassDeclaration()) return;
  7139. var node = path.node;
  7140. var ref = node.declaration.id || path.scope.generateUidIdentifier("class");
  7141. node.declaration.id = ref;
  7142. path.replaceWith(node.declaration);
  7143. path.insertAfter(t.exportDefaultDeclaration(ref));
  7144. },
  7145. ClassDeclaration: function ClassDeclaration(path) {
  7146. var node = path.node;
  7147. var ref = node.id || path.scope.generateUidIdentifier("class");
  7148. path.replaceWith(t.variableDeclaration("let", [t.variableDeclarator(ref, t.toExpression(node))]));
  7149. },
  7150. ClassExpression: function ClassExpression(path, state) {
  7151. var node = path.node;
  7152. if (node[VISITED]) return;
  7153. var inferred = (0, _babelHelperFunctionName2.default)(path);
  7154. if (inferred && inferred !== node) return path.replaceWith(inferred);
  7155. node[VISITED] = true;
  7156. var Constructor = _vanilla2.default;
  7157. if (state.opts.loose) Constructor = _loose2.default;
  7158. path.replaceWith(new Constructor(path, state.file).run());
  7159. }
  7160. }
  7161. };
  7162. };
  7163. var _loose = require("./loose");
  7164. var _loose2 = _interopRequireDefault(_loose);
  7165. var _vanilla = require("./vanilla");
  7166. var _vanilla2 = _interopRequireDefault(_vanilla);
  7167. var _babelHelperFunctionName = require("babel-helper-function-name");
  7168. var _babelHelperFunctionName2 = _interopRequireDefault(_babelHelperFunctionName);
  7169. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7170. module.exports = exports["default"];
  7171. },{"./loose":69,"./vanilla":70,"babel-helper-function-name":53,"babel-runtime/core-js/symbol":104}],69:[function(require,module,exports){
  7172. "use strict";
  7173. exports.__esModule = true;
  7174. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  7175. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  7176. var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn");
  7177. var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
  7178. var _inherits2 = require("babel-runtime/helpers/inherits");
  7179. var _inherits3 = _interopRequireDefault(_inherits2);
  7180. var _babelHelperFunctionName = require("babel-helper-function-name");
  7181. var _babelHelperFunctionName2 = _interopRequireDefault(_babelHelperFunctionName);
  7182. var _vanilla = require("./vanilla");
  7183. var _vanilla2 = _interopRequireDefault(_vanilla);
  7184. var _babelTypes = require("babel-types");
  7185. var t = _interopRequireWildcard(_babelTypes);
  7186. 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; } }
  7187. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7188. var LooseClassTransformer = function (_VanillaTransformer) {
  7189. (0, _inherits3.default)(LooseClassTransformer, _VanillaTransformer);
  7190. function LooseClassTransformer() {
  7191. (0, _classCallCheck3.default)(this, LooseClassTransformer);
  7192. var _this = (0, _possibleConstructorReturn3.default)(this, _VanillaTransformer.apply(this, arguments));
  7193. _this.isLoose = true;
  7194. return _this;
  7195. }
  7196. LooseClassTransformer.prototype._processMethod = function _processMethod(node, scope) {
  7197. if (!node.decorators) {
  7198. var classRef = this.classRef;
  7199. if (!node.static) classRef = t.memberExpression(classRef, t.identifier("prototype"));
  7200. var methodName = t.memberExpression(classRef, node.key, node.computed || t.isLiteral(node.key));
  7201. var func = t.functionExpression(null, node.params, node.body, node.generator, node.async);
  7202. func.returnType = node.returnType;
  7203. var key = t.toComputedKey(node, node.key);
  7204. if (t.isStringLiteral(key)) {
  7205. func = (0, _babelHelperFunctionName2.default)({
  7206. node: func,
  7207. id: key,
  7208. scope: scope
  7209. });
  7210. }
  7211. var expr = t.expressionStatement(t.assignmentExpression("=", methodName, func));
  7212. t.inheritsComments(expr, node);
  7213. this.body.push(expr);
  7214. return true;
  7215. }
  7216. };
  7217. return LooseClassTransformer;
  7218. }(_vanilla2.default);
  7219. exports.default = LooseClassTransformer;
  7220. module.exports = exports["default"];
  7221. },{"./vanilla":70,"babel-helper-function-name":53,"babel-runtime/helpers/classCallCheck":109,"babel-runtime/helpers/inherits":110,"babel-runtime/helpers/possibleConstructorReturn":112,"babel-types":151}],70:[function(require,module,exports){
  7222. "use strict";
  7223. exports.__esModule = true;
  7224. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  7225. var _getIterator3 = _interopRequireDefault(_getIterator2);
  7226. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  7227. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  7228. var _babelTraverse = require("babel-traverse");
  7229. var _babelHelperReplaceSupers = require("babel-helper-replace-supers");
  7230. var _babelHelperReplaceSupers2 = _interopRequireDefault(_babelHelperReplaceSupers);
  7231. var _babelHelperOptimiseCallExpression = require("babel-helper-optimise-call-expression");
  7232. var _babelHelperOptimiseCallExpression2 = _interopRequireDefault(_babelHelperOptimiseCallExpression);
  7233. var _babelHelperDefineMap = require("babel-helper-define-map");
  7234. var defineMap = _interopRequireWildcard(_babelHelperDefineMap);
  7235. var _babelTemplate = require("babel-template");
  7236. var _babelTemplate2 = _interopRequireDefault(_babelTemplate);
  7237. var _babelTypes = require("babel-types");
  7238. var t = _interopRequireWildcard(_babelTypes);
  7239. 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; } }
  7240. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7241. var buildDerivedConstructor = (0, _babelTemplate2.default)("\n (function () {\n super(...arguments);\n })\n");
  7242. var noMethodVisitor = {
  7243. "FunctionExpression|FunctionDeclaration": function FunctionExpressionFunctionDeclaration(path) {
  7244. if (!path.is("shadow")) {
  7245. path.skip();
  7246. }
  7247. },
  7248. Method: function Method(path) {
  7249. path.skip();
  7250. }
  7251. };
  7252. var verifyConstructorVisitor = _babelTraverse.visitors.merge([noMethodVisitor, {
  7253. Super: function Super(path) {
  7254. if (this.isDerived && !this.hasBareSuper && !path.parentPath.isCallExpression({ callee: path.node })) {
  7255. throw path.buildCodeFrameError("'super.*' is not allowed before super()");
  7256. }
  7257. },
  7258. CallExpression: {
  7259. exit: function exit(path) {
  7260. if (path.get("callee").isSuper()) {
  7261. this.hasBareSuper = true;
  7262. if (!this.isDerived) {
  7263. throw path.buildCodeFrameError("super() is only allowed in a derived constructor");
  7264. }
  7265. }
  7266. }
  7267. },
  7268. ThisExpression: function ThisExpression(path) {
  7269. if (this.isDerived && !this.hasBareSuper) {
  7270. if (!path.inShadow("this")) {
  7271. throw path.buildCodeFrameError("'this' is not allowed before super()");
  7272. }
  7273. }
  7274. }
  7275. }]);
  7276. var findThisesVisitor = _babelTraverse.visitors.merge([noMethodVisitor, {
  7277. ThisExpression: function ThisExpression(path) {
  7278. this.superThises.push(path);
  7279. }
  7280. }]);
  7281. var ClassTransformer = function () {
  7282. function ClassTransformer(path, file) {
  7283. (0, _classCallCheck3.default)(this, ClassTransformer);
  7284. this.parent = path.parent;
  7285. this.scope = path.scope;
  7286. this.node = path.node;
  7287. this.path = path;
  7288. this.file = file;
  7289. this.clearDescriptors();
  7290. this.instancePropBody = [];
  7291. this.instancePropRefs = {};
  7292. this.staticPropBody = [];
  7293. this.body = [];
  7294. this.bareSuperAfter = [];
  7295. this.bareSupers = [];
  7296. this.pushedConstructor = false;
  7297. this.pushedInherits = false;
  7298. this.isLoose = false;
  7299. this.superThises = [];
  7300. this.classId = this.node.id;
  7301. this.classRef = this.node.id ? t.identifier(this.node.id.name) : this.scope.generateUidIdentifier("class");
  7302. this.superName = this.node.superClass || t.identifier("Function");
  7303. this.isDerived = !!this.node.superClass;
  7304. }
  7305. ClassTransformer.prototype.run = function run() {
  7306. var _this = this;
  7307. var superName = this.superName;
  7308. var file = this.file;
  7309. var body = this.body;
  7310. var constructorBody = this.constructorBody = t.blockStatement([]);
  7311. this.constructor = this.buildConstructor();
  7312. var closureParams = [];
  7313. var closureArgs = [];
  7314. if (this.isDerived) {
  7315. closureArgs.push(superName);
  7316. superName = this.scope.generateUidIdentifierBasedOnNode(superName);
  7317. closureParams.push(superName);
  7318. this.superName = superName;
  7319. }
  7320. this.buildBody();
  7321. constructorBody.body.unshift(t.expressionStatement(t.callExpression(file.addHelper("classCallCheck"), [t.thisExpression(), this.classRef])));
  7322. body = body.concat(this.staticPropBody.map(function (fn) {
  7323. return fn(_this.classRef);
  7324. }));
  7325. if (this.classId) {
  7326. if (body.length === 1) return t.toExpression(body[0]);
  7327. }
  7328. body.push(t.returnStatement(this.classRef));
  7329. var container = t.functionExpression(null, closureParams, t.blockStatement(body));
  7330. container.shadow = true;
  7331. return t.callExpression(container, closureArgs);
  7332. };
  7333. ClassTransformer.prototype.buildConstructor = function buildConstructor() {
  7334. var func = t.functionDeclaration(this.classRef, [], this.constructorBody);
  7335. t.inherits(func, this.node);
  7336. return func;
  7337. };
  7338. ClassTransformer.prototype.pushToMap = function pushToMap(node, enumerable) {
  7339. var kind = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "value";
  7340. var scope = arguments[3];
  7341. var mutatorMap = void 0;
  7342. if (node.static) {
  7343. this.hasStaticDescriptors = true;
  7344. mutatorMap = this.staticMutatorMap;
  7345. } else {
  7346. this.hasInstanceDescriptors = true;
  7347. mutatorMap = this.instanceMutatorMap;
  7348. }
  7349. var map = defineMap.push(mutatorMap, node, kind, this.file, scope);
  7350. if (enumerable) {
  7351. map.enumerable = t.booleanLiteral(true);
  7352. }
  7353. return map;
  7354. };
  7355. ClassTransformer.prototype.constructorMeMaybe = function constructorMeMaybe() {
  7356. var hasConstructor = false;
  7357. var paths = this.path.get("body.body");
  7358. for (var _iterator = paths, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  7359. var _ref;
  7360. if (_isArray) {
  7361. if (_i >= _iterator.length) break;
  7362. _ref = _iterator[_i++];
  7363. } else {
  7364. _i = _iterator.next();
  7365. if (_i.done) break;
  7366. _ref = _i.value;
  7367. }
  7368. var path = _ref;
  7369. hasConstructor = path.equals("kind", "constructor");
  7370. if (hasConstructor) break;
  7371. }
  7372. if (hasConstructor) return;
  7373. var params = void 0,
  7374. body = void 0;
  7375. if (this.isDerived) {
  7376. var _constructor = buildDerivedConstructor().expression;
  7377. params = _constructor.params;
  7378. body = _constructor.body;
  7379. } else {
  7380. params = [];
  7381. body = t.blockStatement([]);
  7382. }
  7383. this.path.get("body").unshiftContainer("body", t.classMethod("constructor", t.identifier("constructor"), params, body));
  7384. };
  7385. ClassTransformer.prototype.buildBody = function buildBody() {
  7386. this.constructorMeMaybe();
  7387. this.pushBody();
  7388. this.verifyConstructor();
  7389. if (this.userConstructor) {
  7390. var constructorBody = this.constructorBody;
  7391. constructorBody.body = constructorBody.body.concat(this.userConstructor.body.body);
  7392. t.inherits(this.constructor, this.userConstructor);
  7393. t.inherits(constructorBody, this.userConstructor.body);
  7394. }
  7395. this.pushDescriptors();
  7396. };
  7397. ClassTransformer.prototype.pushBody = function pushBody() {
  7398. var classBodyPaths = this.path.get("body.body");
  7399. for (var _iterator2 = classBodyPaths, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  7400. var _ref2;
  7401. if (_isArray2) {
  7402. if (_i2 >= _iterator2.length) break;
  7403. _ref2 = _iterator2[_i2++];
  7404. } else {
  7405. _i2 = _iterator2.next();
  7406. if (_i2.done) break;
  7407. _ref2 = _i2.value;
  7408. }
  7409. var path = _ref2;
  7410. var node = path.node;
  7411. if (path.isClassProperty()) {
  7412. throw path.buildCodeFrameError("Missing class properties transform.");
  7413. }
  7414. if (node.decorators) {
  7415. throw path.buildCodeFrameError("Method has decorators, put the decorator plugin before the classes one.");
  7416. }
  7417. if (t.isClassMethod(node)) {
  7418. var isConstructor = node.kind === "constructor";
  7419. if (isConstructor) {
  7420. path.traverse(verifyConstructorVisitor, this);
  7421. if (!this.hasBareSuper && this.isDerived) {
  7422. throw path.buildCodeFrameError("missing super() call in constructor");
  7423. }
  7424. }
  7425. var replaceSupers = new _babelHelperReplaceSupers2.default({
  7426. forceSuperMemoisation: isConstructor,
  7427. methodPath: path,
  7428. methodNode: node,
  7429. objectRef: this.classRef,
  7430. superRef: this.superName,
  7431. isStatic: node.static,
  7432. isLoose: this.isLoose,
  7433. scope: this.scope,
  7434. file: this.file
  7435. }, true);
  7436. replaceSupers.replace();
  7437. if (isConstructor) {
  7438. this.pushConstructor(replaceSupers, node, path);
  7439. } else {
  7440. this.pushMethod(node, path);
  7441. }
  7442. }
  7443. }
  7444. };
  7445. ClassTransformer.prototype.clearDescriptors = function clearDescriptors() {
  7446. this.hasInstanceDescriptors = false;
  7447. this.hasStaticDescriptors = false;
  7448. this.instanceMutatorMap = {};
  7449. this.staticMutatorMap = {};
  7450. };
  7451. ClassTransformer.prototype.pushDescriptors = function pushDescriptors() {
  7452. this.pushInherits();
  7453. var body = this.body;
  7454. var instanceProps = void 0;
  7455. var staticProps = void 0;
  7456. if (this.hasInstanceDescriptors) {
  7457. instanceProps = defineMap.toClassObject(this.instanceMutatorMap);
  7458. }
  7459. if (this.hasStaticDescriptors) {
  7460. staticProps = defineMap.toClassObject(this.staticMutatorMap);
  7461. }
  7462. if (instanceProps || staticProps) {
  7463. if (instanceProps) instanceProps = defineMap.toComputedObjectFromClass(instanceProps);
  7464. if (staticProps) staticProps = defineMap.toComputedObjectFromClass(staticProps);
  7465. var nullNode = t.nullLiteral();
  7466. var args = [this.classRef, nullNode, nullNode, nullNode, nullNode];
  7467. if (instanceProps) args[1] = instanceProps;
  7468. if (staticProps) args[2] = staticProps;
  7469. if (this.instanceInitializersId) {
  7470. args[3] = this.instanceInitializersId;
  7471. body.unshift(this.buildObjectAssignment(this.instanceInitializersId));
  7472. }
  7473. if (this.staticInitializersId) {
  7474. args[4] = this.staticInitializersId;
  7475. body.unshift(this.buildObjectAssignment(this.staticInitializersId));
  7476. }
  7477. var lastNonNullIndex = 0;
  7478. for (var i = 0; i < args.length; i++) {
  7479. if (args[i] !== nullNode) lastNonNullIndex = i;
  7480. }
  7481. args = args.slice(0, lastNonNullIndex + 1);
  7482. body.push(t.expressionStatement(t.callExpression(this.file.addHelper("createClass"), args)));
  7483. }
  7484. this.clearDescriptors();
  7485. };
  7486. ClassTransformer.prototype.buildObjectAssignment = function buildObjectAssignment(id) {
  7487. return t.variableDeclaration("var", [t.variableDeclarator(id, t.objectExpression([]))]);
  7488. };
  7489. ClassTransformer.prototype.wrapSuperCall = function wrapSuperCall(bareSuper, superRef, thisRef, body) {
  7490. var bareSuperNode = bareSuper.node;
  7491. if (this.isLoose) {
  7492. bareSuperNode.arguments.unshift(t.thisExpression());
  7493. if (bareSuperNode.arguments.length === 2 && t.isSpreadElement(bareSuperNode.arguments[1]) && t.isIdentifier(bareSuperNode.arguments[1].argument, { name: "arguments" })) {
  7494. bareSuperNode.arguments[1] = bareSuperNode.arguments[1].argument;
  7495. bareSuperNode.callee = t.memberExpression(superRef, t.identifier("apply"));
  7496. } else {
  7497. bareSuperNode.callee = t.memberExpression(superRef, t.identifier("call"));
  7498. }
  7499. } else {
  7500. bareSuperNode = (0, _babelHelperOptimiseCallExpression2.default)(t.logicalExpression("||", t.memberExpression(this.classRef, t.identifier("__proto__")), t.callExpression(t.memberExpression(t.identifier("Object"), t.identifier("getPrototypeOf")), [this.classRef])), t.thisExpression(), bareSuperNode.arguments);
  7501. }
  7502. var call = t.callExpression(this.file.addHelper("possibleConstructorReturn"), [t.thisExpression(), bareSuperNode]);
  7503. var bareSuperAfter = this.bareSuperAfter.map(function (fn) {
  7504. return fn(thisRef);
  7505. });
  7506. if (bareSuper.parentPath.isExpressionStatement() && bareSuper.parentPath.container === body.node.body && body.node.body.length - 1 === bareSuper.parentPath.key) {
  7507. if (this.superThises.length || bareSuperAfter.length) {
  7508. bareSuper.scope.push({ id: thisRef });
  7509. call = t.assignmentExpression("=", thisRef, call);
  7510. }
  7511. if (bareSuperAfter.length) {
  7512. call = t.toSequenceExpression([call].concat(bareSuperAfter, [thisRef]));
  7513. }
  7514. bareSuper.parentPath.replaceWith(t.returnStatement(call));
  7515. } else {
  7516. bareSuper.replaceWithMultiple([t.variableDeclaration("var", [t.variableDeclarator(thisRef, call)])].concat(bareSuperAfter, [t.expressionStatement(thisRef)]));
  7517. }
  7518. };
  7519. ClassTransformer.prototype.verifyConstructor = function verifyConstructor() {
  7520. var _this2 = this;
  7521. if (!this.isDerived) return;
  7522. var path = this.userConstructorPath;
  7523. var body = path.get("body");
  7524. path.traverse(findThisesVisitor, this);
  7525. var guaranteedSuperBeforeFinish = !!this.bareSupers.length;
  7526. var superRef = this.superName || t.identifier("Function");
  7527. var thisRef = path.scope.generateUidIdentifier("this");
  7528. for (var _iterator3 = this.bareSupers, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) {
  7529. var _ref3;
  7530. if (_isArray3) {
  7531. if (_i3 >= _iterator3.length) break;
  7532. _ref3 = _iterator3[_i3++];
  7533. } else {
  7534. _i3 = _iterator3.next();
  7535. if (_i3.done) break;
  7536. _ref3 = _i3.value;
  7537. }
  7538. var bareSuper = _ref3;
  7539. this.wrapSuperCall(bareSuper, superRef, thisRef, body);
  7540. if (guaranteedSuperBeforeFinish) {
  7541. bareSuper.find(function (parentPath) {
  7542. if (parentPath === path) {
  7543. return true;
  7544. }
  7545. if (parentPath.isLoop() || parentPath.isConditional()) {
  7546. guaranteedSuperBeforeFinish = false;
  7547. return true;
  7548. }
  7549. });
  7550. }
  7551. }
  7552. for (var _iterator4 = this.superThises, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) {
  7553. var _ref4;
  7554. if (_isArray4) {
  7555. if (_i4 >= _iterator4.length) break;
  7556. _ref4 = _iterator4[_i4++];
  7557. } else {
  7558. _i4 = _iterator4.next();
  7559. if (_i4.done) break;
  7560. _ref4 = _i4.value;
  7561. }
  7562. var thisPath = _ref4;
  7563. thisPath.replaceWith(thisRef);
  7564. }
  7565. var wrapReturn = function wrapReturn(returnArg) {
  7566. return t.callExpression(_this2.file.addHelper("possibleConstructorReturn"), [thisRef].concat(returnArg || []));
  7567. };
  7568. var bodyPaths = body.get("body");
  7569. if (bodyPaths.length && !bodyPaths.pop().isReturnStatement()) {
  7570. body.pushContainer("body", t.returnStatement(guaranteedSuperBeforeFinish ? thisRef : wrapReturn()));
  7571. }
  7572. for (var _iterator5 = this.superReturns, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : (0, _getIterator3.default)(_iterator5);;) {
  7573. var _ref5;
  7574. if (_isArray5) {
  7575. if (_i5 >= _iterator5.length) break;
  7576. _ref5 = _iterator5[_i5++];
  7577. } else {
  7578. _i5 = _iterator5.next();
  7579. if (_i5.done) break;
  7580. _ref5 = _i5.value;
  7581. }
  7582. var returnPath = _ref5;
  7583. if (returnPath.node.argument) {
  7584. var ref = returnPath.scope.generateDeclaredUidIdentifier("ret");
  7585. returnPath.get("argument").replaceWithMultiple([t.assignmentExpression("=", ref, returnPath.node.argument), wrapReturn(ref)]);
  7586. } else {
  7587. returnPath.get("argument").replaceWith(wrapReturn());
  7588. }
  7589. }
  7590. };
  7591. ClassTransformer.prototype.pushMethod = function pushMethod(node, path) {
  7592. var scope = path ? path.scope : this.scope;
  7593. if (node.kind === "method") {
  7594. if (this._processMethod(node, scope)) return;
  7595. }
  7596. this.pushToMap(node, false, null, scope);
  7597. };
  7598. ClassTransformer.prototype._processMethod = function _processMethod() {
  7599. return false;
  7600. };
  7601. ClassTransformer.prototype.pushConstructor = function pushConstructor(replaceSupers, method, path) {
  7602. this.bareSupers = replaceSupers.bareSupers;
  7603. this.superReturns = replaceSupers.returns;
  7604. if (path.scope.hasOwnBinding(this.classRef.name)) {
  7605. path.scope.rename(this.classRef.name);
  7606. }
  7607. var construct = this.constructor;
  7608. this.userConstructorPath = path;
  7609. this.userConstructor = method;
  7610. this.hasConstructor = true;
  7611. t.inheritsComments(construct, method);
  7612. construct._ignoreUserWhitespace = true;
  7613. construct.params = method.params;
  7614. t.inherits(construct.body, method.body);
  7615. construct.body.directives = method.body.directives;
  7616. this._pushConstructor();
  7617. };
  7618. ClassTransformer.prototype._pushConstructor = function _pushConstructor() {
  7619. if (this.pushedConstructor) return;
  7620. this.pushedConstructor = true;
  7621. if (this.hasInstanceDescriptors || this.hasStaticDescriptors) {
  7622. this.pushDescriptors();
  7623. }
  7624. this.body.push(this.constructor);
  7625. this.pushInherits();
  7626. };
  7627. ClassTransformer.prototype.pushInherits = function pushInherits() {
  7628. if (!this.isDerived || this.pushedInherits) return;
  7629. this.pushedInherits = true;
  7630. this.body.unshift(t.expressionStatement(t.callExpression(this.file.addHelper("inherits"), [this.classRef, this.superName])));
  7631. };
  7632. return ClassTransformer;
  7633. }();
  7634. exports.default = ClassTransformer;
  7635. module.exports = exports["default"];
  7636. },{"babel-helper-define-map":52,"babel-helper-optimise-call-expression":56,"babel-helper-replace-supers":58,"babel-runtime/core-js/get-iterator":95,"babel-runtime/helpers/classCallCheck":109,"babel-template":114,"babel-traverse":118,"babel-types":151}],71:[function(require,module,exports){
  7637. "use strict";
  7638. exports.__esModule = true;
  7639. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  7640. var _getIterator3 = _interopRequireDefault(_getIterator2);
  7641. exports.default = function (_ref) {
  7642. var t = _ref.types,
  7643. template = _ref.template;
  7644. var buildMutatorMapAssign = template("\n MUTATOR_MAP_REF[KEY] = MUTATOR_MAP_REF[KEY] || {};\n MUTATOR_MAP_REF[KEY].KIND = VALUE;\n ");
  7645. function getValue(prop) {
  7646. if (t.isObjectProperty(prop)) {
  7647. return prop.value;
  7648. } else if (t.isObjectMethod(prop)) {
  7649. return t.functionExpression(null, prop.params, prop.body, prop.generator, prop.async);
  7650. }
  7651. }
  7652. function pushAssign(objId, prop, body) {
  7653. if (prop.kind === "get" && prop.kind === "set") {
  7654. pushMutatorDefine(objId, prop, body);
  7655. } else {
  7656. body.push(t.expressionStatement(t.assignmentExpression("=", t.memberExpression(objId, prop.key, prop.computed || t.isLiteral(prop.key)), getValue(prop))));
  7657. }
  7658. }
  7659. function pushMutatorDefine(_ref2, prop) {
  7660. var objId = _ref2.objId,
  7661. body = _ref2.body,
  7662. getMutatorId = _ref2.getMutatorId,
  7663. scope = _ref2.scope;
  7664. var key = !prop.computed && t.isIdentifier(prop.key) ? t.stringLiteral(prop.key.name) : prop.key;
  7665. var maybeMemoise = scope.maybeGenerateMemoised(key);
  7666. if (maybeMemoise) {
  7667. body.push(t.expressionStatement(t.assignmentExpression("=", maybeMemoise, key)));
  7668. key = maybeMemoise;
  7669. }
  7670. body.push.apply(body, buildMutatorMapAssign({
  7671. MUTATOR_MAP_REF: getMutatorId(),
  7672. KEY: key,
  7673. VALUE: getValue(prop),
  7674. KIND: t.identifier(prop.kind)
  7675. }));
  7676. }
  7677. function loose(info) {
  7678. for (var _iterator = info.computedProps, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  7679. var _ref3;
  7680. if (_isArray) {
  7681. if (_i >= _iterator.length) break;
  7682. _ref3 = _iterator[_i++];
  7683. } else {
  7684. _i = _iterator.next();
  7685. if (_i.done) break;
  7686. _ref3 = _i.value;
  7687. }
  7688. var prop = _ref3;
  7689. if (prop.kind === "get" || prop.kind === "set") {
  7690. pushMutatorDefine(info, prop);
  7691. } else {
  7692. pushAssign(info.objId, prop, info.body);
  7693. }
  7694. }
  7695. }
  7696. function spec(info) {
  7697. var objId = info.objId,
  7698. body = info.body,
  7699. computedProps = info.computedProps,
  7700. state = info.state;
  7701. for (var _iterator2 = computedProps, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  7702. var _ref4;
  7703. if (_isArray2) {
  7704. if (_i2 >= _iterator2.length) break;
  7705. _ref4 = _iterator2[_i2++];
  7706. } else {
  7707. _i2 = _iterator2.next();
  7708. if (_i2.done) break;
  7709. _ref4 = _i2.value;
  7710. }
  7711. var prop = _ref4;
  7712. var key = t.toComputedKey(prop);
  7713. if (prop.kind === "get" || prop.kind === "set") {
  7714. pushMutatorDefine(info, prop);
  7715. } else if (t.isStringLiteral(key, { value: "__proto__" })) {
  7716. pushAssign(objId, prop, body);
  7717. } else {
  7718. if (computedProps.length === 1) {
  7719. return t.callExpression(state.addHelper("defineProperty"), [info.initPropExpression, key, getValue(prop)]);
  7720. } else {
  7721. body.push(t.expressionStatement(t.callExpression(state.addHelper("defineProperty"), [objId, key, getValue(prop)])));
  7722. }
  7723. }
  7724. }
  7725. }
  7726. return {
  7727. visitor: {
  7728. ObjectExpression: {
  7729. exit: function exit(path, state) {
  7730. var node = path.node,
  7731. parent = path.parent,
  7732. scope = path.scope;
  7733. var hasComputed = false;
  7734. for (var _iterator3 = node.properties, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) {
  7735. var _ref5;
  7736. if (_isArray3) {
  7737. if (_i3 >= _iterator3.length) break;
  7738. _ref5 = _iterator3[_i3++];
  7739. } else {
  7740. _i3 = _iterator3.next();
  7741. if (_i3.done) break;
  7742. _ref5 = _i3.value;
  7743. }
  7744. var prop = _ref5;
  7745. hasComputed = prop.computed === true;
  7746. if (hasComputed) break;
  7747. }
  7748. if (!hasComputed) return;
  7749. var initProps = [];
  7750. var computedProps = [];
  7751. var foundComputed = false;
  7752. for (var _iterator4 = node.properties, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) {
  7753. var _ref6;
  7754. if (_isArray4) {
  7755. if (_i4 >= _iterator4.length) break;
  7756. _ref6 = _iterator4[_i4++];
  7757. } else {
  7758. _i4 = _iterator4.next();
  7759. if (_i4.done) break;
  7760. _ref6 = _i4.value;
  7761. }
  7762. var _prop = _ref6;
  7763. if (_prop.computed) {
  7764. foundComputed = true;
  7765. }
  7766. if (foundComputed) {
  7767. computedProps.push(_prop);
  7768. } else {
  7769. initProps.push(_prop);
  7770. }
  7771. }
  7772. var objId = scope.generateUidIdentifierBasedOnNode(parent);
  7773. var initPropExpression = t.objectExpression(initProps);
  7774. var body = [];
  7775. body.push(t.variableDeclaration("var", [t.variableDeclarator(objId, initPropExpression)]));
  7776. var callback = spec;
  7777. if (state.opts.loose) callback = loose;
  7778. var mutatorRef = void 0;
  7779. var getMutatorId = function getMutatorId() {
  7780. if (!mutatorRef) {
  7781. mutatorRef = scope.generateUidIdentifier("mutatorMap");
  7782. body.push(t.variableDeclaration("var", [t.variableDeclarator(mutatorRef, t.objectExpression([]))]));
  7783. }
  7784. return mutatorRef;
  7785. };
  7786. var single = callback({
  7787. scope: scope,
  7788. objId: objId,
  7789. body: body,
  7790. computedProps: computedProps,
  7791. initPropExpression: initPropExpression,
  7792. getMutatorId: getMutatorId,
  7793. state: state
  7794. });
  7795. if (mutatorRef) {
  7796. body.push(t.expressionStatement(t.callExpression(state.addHelper("defineEnumerableProperties"), [objId, mutatorRef])));
  7797. }
  7798. if (single) {
  7799. path.replaceWith(single);
  7800. } else {
  7801. body.push(t.expressionStatement(objId));
  7802. path.replaceWithMultiple(body);
  7803. }
  7804. }
  7805. }
  7806. }
  7807. };
  7808. };
  7809. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7810. module.exports = exports["default"];
  7811. },{"babel-runtime/core-js/get-iterator":95}],72:[function(require,module,exports){
  7812. "use strict";
  7813. exports.__esModule = true;
  7814. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  7815. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  7816. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  7817. var _getIterator3 = _interopRequireDefault(_getIterator2);
  7818. exports.default = function (_ref) {
  7819. var t = _ref.types;
  7820. function variableDeclarationHasPattern(node) {
  7821. for (var _iterator = node.declarations, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  7822. var _ref2;
  7823. if (_isArray) {
  7824. if (_i >= _iterator.length) break;
  7825. _ref2 = _iterator[_i++];
  7826. } else {
  7827. _i = _iterator.next();
  7828. if (_i.done) break;
  7829. _ref2 = _i.value;
  7830. }
  7831. var declar = _ref2;
  7832. if (t.isPattern(declar.id)) {
  7833. return true;
  7834. }
  7835. }
  7836. return false;
  7837. }
  7838. function hasRest(pattern) {
  7839. for (var _iterator2 = pattern.elements, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  7840. var _ref3;
  7841. if (_isArray2) {
  7842. if (_i2 >= _iterator2.length) break;
  7843. _ref3 = _iterator2[_i2++];
  7844. } else {
  7845. _i2 = _iterator2.next();
  7846. if (_i2.done) break;
  7847. _ref3 = _i2.value;
  7848. }
  7849. var elem = _ref3;
  7850. if (t.isRestElement(elem)) {
  7851. return true;
  7852. }
  7853. }
  7854. return false;
  7855. }
  7856. var arrayUnpackVisitor = {
  7857. ReferencedIdentifier: function ReferencedIdentifier(path, state) {
  7858. if (state.bindings[path.node.name]) {
  7859. state.deopt = true;
  7860. path.stop();
  7861. }
  7862. }
  7863. };
  7864. var DestructuringTransformer = function () {
  7865. function DestructuringTransformer(opts) {
  7866. (0, _classCallCheck3.default)(this, DestructuringTransformer);
  7867. this.blockHoist = opts.blockHoist;
  7868. this.operator = opts.operator;
  7869. this.arrays = {};
  7870. this.nodes = opts.nodes || [];
  7871. this.scope = opts.scope;
  7872. this.file = opts.file;
  7873. this.kind = opts.kind;
  7874. }
  7875. DestructuringTransformer.prototype.buildVariableAssignment = function buildVariableAssignment(id, init) {
  7876. var op = this.operator;
  7877. if (t.isMemberExpression(id)) op = "=";
  7878. var node = void 0;
  7879. if (op) {
  7880. node = t.expressionStatement(t.assignmentExpression(op, id, init));
  7881. } else {
  7882. node = t.variableDeclaration(this.kind, [t.variableDeclarator(id, init)]);
  7883. }
  7884. node._blockHoist = this.blockHoist;
  7885. return node;
  7886. };
  7887. DestructuringTransformer.prototype.buildVariableDeclaration = function buildVariableDeclaration(id, init) {
  7888. var declar = t.variableDeclaration("var", [t.variableDeclarator(id, init)]);
  7889. declar._blockHoist = this.blockHoist;
  7890. return declar;
  7891. };
  7892. DestructuringTransformer.prototype.push = function push(id, init) {
  7893. if (t.isObjectPattern(id)) {
  7894. this.pushObjectPattern(id, init);
  7895. } else if (t.isArrayPattern(id)) {
  7896. this.pushArrayPattern(id, init);
  7897. } else if (t.isAssignmentPattern(id)) {
  7898. this.pushAssignmentPattern(id, init);
  7899. } else {
  7900. this.nodes.push(this.buildVariableAssignment(id, init));
  7901. }
  7902. };
  7903. DestructuringTransformer.prototype.toArray = function toArray(node, count) {
  7904. if (this.file.opts.loose || t.isIdentifier(node) && this.arrays[node.name]) {
  7905. return node;
  7906. } else {
  7907. return this.scope.toArray(node, count);
  7908. }
  7909. };
  7910. DestructuringTransformer.prototype.pushAssignmentPattern = function pushAssignmentPattern(pattern, valueRef) {
  7911. var tempValueRef = this.scope.generateUidIdentifierBasedOnNode(valueRef);
  7912. var declar = t.variableDeclaration("var", [t.variableDeclarator(tempValueRef, valueRef)]);
  7913. declar._blockHoist = this.blockHoist;
  7914. this.nodes.push(declar);
  7915. var tempConditional = t.conditionalExpression(t.binaryExpression("===", tempValueRef, t.identifier("undefined")), pattern.right, tempValueRef);
  7916. var left = pattern.left;
  7917. if (t.isPattern(left)) {
  7918. var tempValueDefault = t.expressionStatement(t.assignmentExpression("=", tempValueRef, tempConditional));
  7919. tempValueDefault._blockHoist = this.blockHoist;
  7920. this.nodes.push(tempValueDefault);
  7921. this.push(left, tempValueRef);
  7922. } else {
  7923. this.nodes.push(this.buildVariableAssignment(left, tempConditional));
  7924. }
  7925. };
  7926. DestructuringTransformer.prototype.pushObjectRest = function pushObjectRest(pattern, objRef, spreadProp, spreadPropIndex) {
  7927. var keys = [];
  7928. for (var i = 0; i < pattern.properties.length; i++) {
  7929. var prop = pattern.properties[i];
  7930. if (i >= spreadPropIndex) break;
  7931. if (t.isRestProperty(prop)) continue;
  7932. var key = prop.key;
  7933. if (t.isIdentifier(key) && !prop.computed) key = t.stringLiteral(prop.key.name);
  7934. keys.push(key);
  7935. }
  7936. keys = t.arrayExpression(keys);
  7937. var value = t.callExpression(this.file.addHelper("objectWithoutProperties"), [objRef, keys]);
  7938. this.nodes.push(this.buildVariableAssignment(spreadProp.argument, value));
  7939. };
  7940. DestructuringTransformer.prototype.pushObjectProperty = function pushObjectProperty(prop, propRef) {
  7941. if (t.isLiteral(prop.key)) prop.computed = true;
  7942. var pattern = prop.value;
  7943. var objRef = t.memberExpression(propRef, prop.key, prop.computed);
  7944. if (t.isPattern(pattern)) {
  7945. this.push(pattern, objRef);
  7946. } else {
  7947. this.nodes.push(this.buildVariableAssignment(pattern, objRef));
  7948. }
  7949. };
  7950. DestructuringTransformer.prototype.pushObjectPattern = function pushObjectPattern(pattern, objRef) {
  7951. if (!pattern.properties.length) {
  7952. this.nodes.push(t.expressionStatement(t.callExpression(this.file.addHelper("objectDestructuringEmpty"), [objRef])));
  7953. }
  7954. if (pattern.properties.length > 1 && !this.scope.isStatic(objRef)) {
  7955. var temp = this.scope.generateUidIdentifierBasedOnNode(objRef);
  7956. this.nodes.push(this.buildVariableDeclaration(temp, objRef));
  7957. objRef = temp;
  7958. }
  7959. for (var i = 0; i < pattern.properties.length; i++) {
  7960. var prop = pattern.properties[i];
  7961. if (t.isRestProperty(prop)) {
  7962. this.pushObjectRest(pattern, objRef, prop, i);
  7963. } else {
  7964. this.pushObjectProperty(prop, objRef);
  7965. }
  7966. }
  7967. };
  7968. DestructuringTransformer.prototype.canUnpackArrayPattern = function canUnpackArrayPattern(pattern, arr) {
  7969. if (!t.isArrayExpression(arr)) return false;
  7970. if (pattern.elements.length > arr.elements.length) return;
  7971. if (pattern.elements.length < arr.elements.length && !hasRest(pattern)) return false;
  7972. for (var _iterator3 = pattern.elements, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) {
  7973. var _ref4;
  7974. if (_isArray3) {
  7975. if (_i3 >= _iterator3.length) break;
  7976. _ref4 = _iterator3[_i3++];
  7977. } else {
  7978. _i3 = _iterator3.next();
  7979. if (_i3.done) break;
  7980. _ref4 = _i3.value;
  7981. }
  7982. var elem = _ref4;
  7983. if (!elem) return false;
  7984. if (t.isMemberExpression(elem)) return false;
  7985. }
  7986. for (var _iterator4 = arr.elements, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) {
  7987. var _ref5;
  7988. if (_isArray4) {
  7989. if (_i4 >= _iterator4.length) break;
  7990. _ref5 = _iterator4[_i4++];
  7991. } else {
  7992. _i4 = _iterator4.next();
  7993. if (_i4.done) break;
  7994. _ref5 = _i4.value;
  7995. }
  7996. var _elem = _ref5;
  7997. if (t.isSpreadElement(_elem)) return false;
  7998. if (t.isCallExpression(_elem)) return false;
  7999. if (t.isMemberExpression(_elem)) return false;
  8000. }
  8001. var bindings = t.getBindingIdentifiers(pattern);
  8002. var state = { deopt: false, bindings: bindings };
  8003. this.scope.traverse(arr, arrayUnpackVisitor, state);
  8004. return !state.deopt;
  8005. };
  8006. DestructuringTransformer.prototype.pushUnpackedArrayPattern = function pushUnpackedArrayPattern(pattern, arr) {
  8007. for (var i = 0; i < pattern.elements.length; i++) {
  8008. var elem = pattern.elements[i];
  8009. if (t.isRestElement(elem)) {
  8010. this.push(elem.argument, t.arrayExpression(arr.elements.slice(i)));
  8011. } else {
  8012. this.push(elem, arr.elements[i]);
  8013. }
  8014. }
  8015. };
  8016. DestructuringTransformer.prototype.pushArrayPattern = function pushArrayPattern(pattern, arrayRef) {
  8017. if (!pattern.elements) return;
  8018. if (this.canUnpackArrayPattern(pattern, arrayRef)) {
  8019. return this.pushUnpackedArrayPattern(pattern, arrayRef);
  8020. }
  8021. var count = !hasRest(pattern) && pattern.elements.length;
  8022. var toArray = this.toArray(arrayRef, count);
  8023. if (t.isIdentifier(toArray)) {
  8024. arrayRef = toArray;
  8025. } else {
  8026. arrayRef = this.scope.generateUidIdentifierBasedOnNode(arrayRef);
  8027. this.arrays[arrayRef.name] = true;
  8028. this.nodes.push(this.buildVariableDeclaration(arrayRef, toArray));
  8029. }
  8030. for (var i = 0; i < pattern.elements.length; i++) {
  8031. var elem = pattern.elements[i];
  8032. if (!elem) continue;
  8033. var elemRef = void 0;
  8034. if (t.isRestElement(elem)) {
  8035. elemRef = this.toArray(arrayRef);
  8036. elemRef = t.callExpression(t.memberExpression(elemRef, t.identifier("slice")), [t.numericLiteral(i)]);
  8037. elem = elem.argument;
  8038. } else {
  8039. elemRef = t.memberExpression(arrayRef, t.numericLiteral(i), true);
  8040. }
  8041. this.push(elem, elemRef);
  8042. }
  8043. };
  8044. DestructuringTransformer.prototype.init = function init(pattern, ref) {
  8045. if (!t.isArrayExpression(ref) && !t.isMemberExpression(ref)) {
  8046. var memo = this.scope.maybeGenerateMemoised(ref, true);
  8047. if (memo) {
  8048. this.nodes.push(this.buildVariableDeclaration(memo, ref));
  8049. ref = memo;
  8050. }
  8051. }
  8052. this.push(pattern, ref);
  8053. return this.nodes;
  8054. };
  8055. return DestructuringTransformer;
  8056. }();
  8057. return {
  8058. visitor: {
  8059. ExportNamedDeclaration: function ExportNamedDeclaration(path) {
  8060. var declaration = path.get("declaration");
  8061. if (!declaration.isVariableDeclaration()) return;
  8062. if (!variableDeclarationHasPattern(declaration.node)) return;
  8063. var specifiers = [];
  8064. for (var name in path.getOuterBindingIdentifiers(path)) {
  8065. var id = t.identifier(name);
  8066. specifiers.push(t.exportSpecifier(id, id));
  8067. }
  8068. path.replaceWith(declaration.node);
  8069. path.insertAfter(t.exportNamedDeclaration(null, specifiers));
  8070. },
  8071. ForXStatement: function ForXStatement(path, file) {
  8072. var node = path.node,
  8073. scope = path.scope;
  8074. var left = node.left;
  8075. if (t.isPattern(left)) {
  8076. var temp = scope.generateUidIdentifier("ref");
  8077. node.left = t.variableDeclaration("var", [t.variableDeclarator(temp)]);
  8078. path.ensureBlock();
  8079. node.body.body.unshift(t.variableDeclaration("var", [t.variableDeclarator(left, temp)]));
  8080. return;
  8081. }
  8082. if (!t.isVariableDeclaration(left)) return;
  8083. var pattern = left.declarations[0].id;
  8084. if (!t.isPattern(pattern)) return;
  8085. var key = scope.generateUidIdentifier("ref");
  8086. node.left = t.variableDeclaration(left.kind, [t.variableDeclarator(key, null)]);
  8087. var nodes = [];
  8088. var destructuring = new DestructuringTransformer({
  8089. kind: left.kind,
  8090. file: file,
  8091. scope: scope,
  8092. nodes: nodes
  8093. });
  8094. destructuring.init(pattern, key);
  8095. path.ensureBlock();
  8096. var block = node.body;
  8097. block.body = nodes.concat(block.body);
  8098. },
  8099. CatchClause: function CatchClause(_ref6, file) {
  8100. var node = _ref6.node,
  8101. scope = _ref6.scope;
  8102. var pattern = node.param;
  8103. if (!t.isPattern(pattern)) return;
  8104. var ref = scope.generateUidIdentifier("ref");
  8105. node.param = ref;
  8106. var nodes = [];
  8107. var destructuring = new DestructuringTransformer({
  8108. kind: "let",
  8109. file: file,
  8110. scope: scope,
  8111. nodes: nodes
  8112. });
  8113. destructuring.init(pattern, ref);
  8114. node.body.body = nodes.concat(node.body.body);
  8115. },
  8116. AssignmentExpression: function AssignmentExpression(path, file) {
  8117. var node = path.node,
  8118. scope = path.scope;
  8119. if (!t.isPattern(node.left)) return;
  8120. var nodes = [];
  8121. var destructuring = new DestructuringTransformer({
  8122. operator: node.operator,
  8123. file: file,
  8124. scope: scope,
  8125. nodes: nodes
  8126. });
  8127. var ref = void 0;
  8128. if (path.isCompletionRecord() || !path.parentPath.isExpressionStatement()) {
  8129. ref = scope.generateUidIdentifierBasedOnNode(node.right, "ref");
  8130. nodes.push(t.variableDeclaration("var", [t.variableDeclarator(ref, node.right)]));
  8131. if (t.isArrayExpression(node.right)) {
  8132. destructuring.arrays[ref.name] = true;
  8133. }
  8134. }
  8135. destructuring.init(node.left, ref || node.right);
  8136. if (ref) {
  8137. nodes.push(t.expressionStatement(ref));
  8138. }
  8139. path.replaceWithMultiple(nodes);
  8140. },
  8141. VariableDeclaration: function VariableDeclaration(path, file) {
  8142. var node = path.node,
  8143. scope = path.scope,
  8144. parent = path.parent;
  8145. if (t.isForXStatement(parent)) return;
  8146. if (!parent || !path.container) return;
  8147. if (!variableDeclarationHasPattern(node)) return;
  8148. var nodes = [];
  8149. var declar = void 0;
  8150. for (var i = 0; i < node.declarations.length; i++) {
  8151. declar = node.declarations[i];
  8152. var patternId = declar.init;
  8153. var pattern = declar.id;
  8154. var destructuring = new DestructuringTransformer({
  8155. blockHoist: node._blockHoist,
  8156. nodes: nodes,
  8157. scope: scope,
  8158. kind: node.kind,
  8159. file: file
  8160. });
  8161. if (t.isPattern(pattern)) {
  8162. destructuring.init(pattern, patternId);
  8163. if (+i !== node.declarations.length - 1) {
  8164. t.inherits(nodes[nodes.length - 1], declar);
  8165. }
  8166. } else {
  8167. nodes.push(t.inherits(destructuring.buildVariableAssignment(declar.id, declar.init), declar));
  8168. }
  8169. }
  8170. var nodesOut = [];
  8171. for (var _iterator5 = nodes, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : (0, _getIterator3.default)(_iterator5);;) {
  8172. var _ref7;
  8173. if (_isArray5) {
  8174. if (_i5 >= _iterator5.length) break;
  8175. _ref7 = _iterator5[_i5++];
  8176. } else {
  8177. _i5 = _iterator5.next();
  8178. if (_i5.done) break;
  8179. _ref7 = _i5.value;
  8180. }
  8181. var _node = _ref7;
  8182. var tail = nodesOut[nodesOut.length - 1];
  8183. if (tail && t.isVariableDeclaration(tail) && t.isVariableDeclaration(_node) && tail.kind === _node.kind) {
  8184. var _tail$declarations;
  8185. (_tail$declarations = tail.declarations).push.apply(_tail$declarations, _node.declarations);
  8186. } else {
  8187. nodesOut.push(_node);
  8188. }
  8189. }
  8190. for (var _iterator6 = nodesOut, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : (0, _getIterator3.default)(_iterator6);;) {
  8191. var _ref8;
  8192. if (_isArray6) {
  8193. if (_i6 >= _iterator6.length) break;
  8194. _ref8 = _iterator6[_i6++];
  8195. } else {
  8196. _i6 = _iterator6.next();
  8197. if (_i6.done) break;
  8198. _ref8 = _i6.value;
  8199. }
  8200. var nodeOut = _ref8;
  8201. if (!nodeOut.declarations) continue;
  8202. for (var _iterator7 = nodeOut.declarations, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : (0, _getIterator3.default)(_iterator7);;) {
  8203. var _ref9;
  8204. if (_isArray7) {
  8205. if (_i7 >= _iterator7.length) break;
  8206. _ref9 = _iterator7[_i7++];
  8207. } else {
  8208. _i7 = _iterator7.next();
  8209. if (_i7.done) break;
  8210. _ref9 = _i7.value;
  8211. }
  8212. var declaration = _ref9;
  8213. var name = declaration.id.name;
  8214. if (scope.bindings[name]) {
  8215. scope.bindings[name].kind = nodeOut.kind;
  8216. }
  8217. }
  8218. }
  8219. if (nodesOut.length === 1) {
  8220. path.replaceWith(nodesOut[0]);
  8221. } else {
  8222. path.replaceWithMultiple(nodesOut);
  8223. }
  8224. }
  8225. }
  8226. };
  8227. };
  8228. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8229. module.exports = exports["default"];
  8230. },{"babel-runtime/core-js/get-iterator":95,"babel-runtime/helpers/classCallCheck":109}],73:[function(require,module,exports){
  8231. "use strict";
  8232. exports.__esModule = true;
  8233. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  8234. var _getIterator3 = _interopRequireDefault(_getIterator2);
  8235. var _create = require("babel-runtime/core-js/object/create");
  8236. var _create2 = _interopRequireDefault(_create);
  8237. exports.default = function () {
  8238. return {
  8239. visitor: {
  8240. ObjectExpression: function ObjectExpression(path) {
  8241. var node = path.node;
  8242. var plainProps = node.properties.filter(function (prop) {
  8243. return !t.isSpreadProperty(prop) && !prop.computed;
  8244. });
  8245. var alreadySeenData = (0, _create2.default)(null);
  8246. var alreadySeenGetters = (0, _create2.default)(null);
  8247. var alreadySeenSetters = (0, _create2.default)(null);
  8248. for (var _iterator = plainProps, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  8249. var _ref;
  8250. if (_isArray) {
  8251. if (_i >= _iterator.length) break;
  8252. _ref = _iterator[_i++];
  8253. } else {
  8254. _i = _iterator.next();
  8255. if (_i.done) break;
  8256. _ref = _i.value;
  8257. }
  8258. var prop = _ref;
  8259. var name = getName(prop.key);
  8260. var isDuplicate = false;
  8261. switch (prop.kind) {
  8262. case "get":
  8263. if (alreadySeenData[name] || alreadySeenGetters[name]) {
  8264. isDuplicate = true;
  8265. }
  8266. alreadySeenGetters[name] = true;
  8267. break;
  8268. case "set":
  8269. if (alreadySeenData[name] || alreadySeenSetters[name]) {
  8270. isDuplicate = true;
  8271. }
  8272. alreadySeenSetters[name] = true;
  8273. break;
  8274. default:
  8275. if (alreadySeenData[name] || alreadySeenGetters[name] || alreadySeenSetters[name]) {
  8276. isDuplicate = true;
  8277. }
  8278. alreadySeenData[name] = true;
  8279. }
  8280. if (isDuplicate) {
  8281. prop.computed = true;
  8282. prop.key = t.stringLiteral(name);
  8283. }
  8284. }
  8285. }
  8286. }
  8287. };
  8288. };
  8289. var _babelTypes = require("babel-types");
  8290. var t = _interopRequireWildcard(_babelTypes);
  8291. 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; } }
  8292. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8293. function getName(key) {
  8294. if (t.isIdentifier(key)) {
  8295. return key.name;
  8296. }
  8297. return key.value.toString();
  8298. }
  8299. module.exports = exports["default"];
  8300. },{"babel-runtime/core-js/get-iterator":95,"babel-runtime/core-js/object/create":100,"babel-types":151}],74:[function(require,module,exports){
  8301. "use strict";
  8302. exports.__esModule = true;
  8303. exports.default = function (_ref) {
  8304. var messages = _ref.messages,
  8305. template = _ref.template,
  8306. t = _ref.types;
  8307. var buildForOfArray = template("\n for (var KEY = 0; KEY < ARR.length; KEY++) BODY;\n ");
  8308. var buildForOfLoose = template("\n for (var LOOP_OBJECT = OBJECT,\n IS_ARRAY = Array.isArray(LOOP_OBJECT),\n INDEX = 0,\n LOOP_OBJECT = IS_ARRAY ? LOOP_OBJECT : LOOP_OBJECT[Symbol.iterator]();;) {\n var ID;\n if (IS_ARRAY) {\n if (INDEX >= LOOP_OBJECT.length) break;\n ID = LOOP_OBJECT[INDEX++];\n } else {\n INDEX = LOOP_OBJECT.next();\n if (INDEX.done) break;\n ID = INDEX.value;\n }\n }\n ");
  8309. var buildForOf = template("\n var ITERATOR_COMPLETION = true;\n var ITERATOR_HAD_ERROR_KEY = false;\n var ITERATOR_ERROR_KEY = undefined;\n try {\n for (var ITERATOR_KEY = OBJECT[Symbol.iterator](), STEP_KEY; !(ITERATOR_COMPLETION = (STEP_KEY = ITERATOR_KEY.next()).done); ITERATOR_COMPLETION = true) {\n }\n } catch (err) {\n ITERATOR_HAD_ERROR_KEY = true;\n ITERATOR_ERROR_KEY = err;\n } finally {\n try {\n if (!ITERATOR_COMPLETION && ITERATOR_KEY.return) {\n ITERATOR_KEY.return();\n }\n } finally {\n if (ITERATOR_HAD_ERROR_KEY) {\n throw ITERATOR_ERROR_KEY;\n }\n }\n }\n ");
  8310. function _ForOfStatementArray(path) {
  8311. var node = path.node,
  8312. scope = path.scope;
  8313. var nodes = [];
  8314. var right = node.right;
  8315. if (!t.isIdentifier(right) || !scope.hasBinding(right.name)) {
  8316. var uid = scope.generateUidIdentifier("arr");
  8317. nodes.push(t.variableDeclaration("var", [t.variableDeclarator(uid, right)]));
  8318. right = uid;
  8319. }
  8320. var iterationKey = scope.generateUidIdentifier("i");
  8321. var loop = buildForOfArray({
  8322. BODY: node.body,
  8323. KEY: iterationKey,
  8324. ARR: right
  8325. });
  8326. t.inherits(loop, node);
  8327. t.ensureBlock(loop);
  8328. var iterationValue = t.memberExpression(right, iterationKey, true);
  8329. var left = node.left;
  8330. if (t.isVariableDeclaration(left)) {
  8331. left.declarations[0].init = iterationValue;
  8332. loop.body.body.unshift(left);
  8333. } else {
  8334. loop.body.body.unshift(t.expressionStatement(t.assignmentExpression("=", left, iterationValue)));
  8335. }
  8336. if (path.parentPath.isLabeledStatement()) {
  8337. loop = t.labeledStatement(path.parentPath.node.label, loop);
  8338. }
  8339. nodes.push(loop);
  8340. return nodes;
  8341. }
  8342. return {
  8343. visitor: {
  8344. ForOfStatement: function ForOfStatement(path, state) {
  8345. if (path.get("right").isArrayExpression()) {
  8346. if (path.parentPath.isLabeledStatement()) {
  8347. return path.parentPath.replaceWithMultiple(_ForOfStatementArray(path));
  8348. } else {
  8349. return path.replaceWithMultiple(_ForOfStatementArray(path));
  8350. }
  8351. }
  8352. var callback = spec;
  8353. if (state.opts.loose) callback = loose;
  8354. var node = path.node;
  8355. var build = callback(path, state);
  8356. var declar = build.declar;
  8357. var loop = build.loop;
  8358. var block = loop.body;
  8359. path.ensureBlock();
  8360. if (declar) {
  8361. block.body.push(declar);
  8362. }
  8363. block.body = block.body.concat(node.body.body);
  8364. t.inherits(loop, node);
  8365. t.inherits(loop.body, node.body);
  8366. if (build.replaceParent) {
  8367. path.parentPath.replaceWithMultiple(build.node);
  8368. path.remove();
  8369. } else {
  8370. path.replaceWithMultiple(build.node);
  8371. }
  8372. }
  8373. }
  8374. };
  8375. function loose(path, file) {
  8376. var node = path.node,
  8377. scope = path.scope,
  8378. parent = path.parent;
  8379. var left = node.left;
  8380. var declar = void 0,
  8381. id = void 0;
  8382. if (t.isIdentifier(left) || t.isPattern(left) || t.isMemberExpression(left)) {
  8383. id = left;
  8384. } else if (t.isVariableDeclaration(left)) {
  8385. id = scope.generateUidIdentifier("ref");
  8386. declar = t.variableDeclaration(left.kind, [t.variableDeclarator(left.declarations[0].id, id)]);
  8387. } else {
  8388. throw file.buildCodeFrameError(left, messages.get("unknownForHead", left.type));
  8389. }
  8390. var iteratorKey = scope.generateUidIdentifier("iterator");
  8391. var isArrayKey = scope.generateUidIdentifier("isArray");
  8392. var loop = buildForOfLoose({
  8393. LOOP_OBJECT: iteratorKey,
  8394. IS_ARRAY: isArrayKey,
  8395. OBJECT: node.right,
  8396. INDEX: scope.generateUidIdentifier("i"),
  8397. ID: id
  8398. });
  8399. if (!declar) {
  8400. loop.body.body.shift();
  8401. }
  8402. var isLabeledParent = t.isLabeledStatement(parent);
  8403. var labeled = void 0;
  8404. if (isLabeledParent) {
  8405. labeled = t.labeledStatement(parent.label, loop);
  8406. }
  8407. return {
  8408. replaceParent: isLabeledParent,
  8409. declar: declar,
  8410. node: labeled || loop,
  8411. loop: loop
  8412. };
  8413. }
  8414. function spec(path, file) {
  8415. var node = path.node,
  8416. scope = path.scope,
  8417. parent = path.parent;
  8418. var left = node.left;
  8419. var declar = void 0;
  8420. var stepKey = scope.generateUidIdentifier("step");
  8421. var stepValue = t.memberExpression(stepKey, t.identifier("value"));
  8422. if (t.isIdentifier(left) || t.isPattern(left) || t.isMemberExpression(left)) {
  8423. declar = t.expressionStatement(t.assignmentExpression("=", left, stepValue));
  8424. } else if (t.isVariableDeclaration(left)) {
  8425. declar = t.variableDeclaration(left.kind, [t.variableDeclarator(left.declarations[0].id, stepValue)]);
  8426. } else {
  8427. throw file.buildCodeFrameError(left, messages.get("unknownForHead", left.type));
  8428. }
  8429. var iteratorKey = scope.generateUidIdentifier("iterator");
  8430. var template = buildForOf({
  8431. ITERATOR_HAD_ERROR_KEY: scope.generateUidIdentifier("didIteratorError"),
  8432. ITERATOR_COMPLETION: scope.generateUidIdentifier("iteratorNormalCompletion"),
  8433. ITERATOR_ERROR_KEY: scope.generateUidIdentifier("iteratorError"),
  8434. ITERATOR_KEY: iteratorKey,
  8435. STEP_KEY: stepKey,
  8436. OBJECT: node.right,
  8437. BODY: null
  8438. });
  8439. var isLabeledParent = t.isLabeledStatement(parent);
  8440. var tryBody = template[3].block.body;
  8441. var loop = tryBody[0];
  8442. if (isLabeledParent) {
  8443. tryBody[0] = t.labeledStatement(parent.label, loop);
  8444. }
  8445. return {
  8446. replaceParent: isLabeledParent,
  8447. declar: declar,
  8448. loop: loop,
  8449. node: template
  8450. };
  8451. }
  8452. };
  8453. module.exports = exports["default"];
  8454. },{}],75:[function(require,module,exports){
  8455. "use strict";
  8456. exports.__esModule = true;
  8457. exports.default = function () {
  8458. return {
  8459. visitor: {
  8460. FunctionExpression: {
  8461. exit: function exit(path) {
  8462. if (path.key !== "value" && !path.parentPath.isObjectProperty()) {
  8463. var replacement = (0, _babelHelperFunctionName2.default)(path);
  8464. if (replacement) path.replaceWith(replacement);
  8465. }
  8466. }
  8467. },
  8468. ObjectProperty: function ObjectProperty(path) {
  8469. var value = path.get("value");
  8470. if (value.isFunction()) {
  8471. var newNode = (0, _babelHelperFunctionName2.default)(value);
  8472. if (newNode) value.replaceWith(newNode);
  8473. }
  8474. }
  8475. }
  8476. };
  8477. };
  8478. var _babelHelperFunctionName = require("babel-helper-function-name");
  8479. var _babelHelperFunctionName2 = _interopRequireDefault(_babelHelperFunctionName);
  8480. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8481. module.exports = exports["default"];
  8482. },{"babel-helper-function-name":53}],76:[function(require,module,exports){
  8483. "use strict";
  8484. exports.__esModule = true;
  8485. exports.default = function () {
  8486. return {
  8487. visitor: {
  8488. NumericLiteral: function NumericLiteral(_ref) {
  8489. var node = _ref.node;
  8490. if (node.extra && /^0[ob]/i.test(node.extra.raw)) {
  8491. node.extra = undefined;
  8492. }
  8493. },
  8494. StringLiteral: function StringLiteral(_ref2) {
  8495. var node = _ref2.node;
  8496. if (node.extra && /\\[u]/gi.test(node.extra.raw)) {
  8497. node.extra = undefined;
  8498. }
  8499. }
  8500. }
  8501. };
  8502. };
  8503. module.exports = exports["default"];
  8504. },{}],77:[function(require,module,exports){
  8505. "use strict";
  8506. exports.__esModule = true;
  8507. var _create = require("babel-runtime/core-js/object/create");
  8508. var _create2 = _interopRequireDefault(_create);
  8509. exports.default = function (_ref) {
  8510. var t = _ref.types;
  8511. function isValidRequireCall(path) {
  8512. if (!path.isCallExpression()) return false;
  8513. if (!path.get("callee").isIdentifier({ name: "require" })) return false;
  8514. if (path.scope.getBinding("require")) return false;
  8515. var args = path.get("arguments");
  8516. if (args.length !== 1) return false;
  8517. var arg = args[0];
  8518. if (!arg.isStringLiteral()) return false;
  8519. return true;
  8520. }
  8521. var amdVisitor = {
  8522. ReferencedIdentifier: function ReferencedIdentifier(_ref2) {
  8523. var node = _ref2.node,
  8524. scope = _ref2.scope;
  8525. if (node.name === "exports" && !scope.getBinding("exports")) {
  8526. this.hasExports = true;
  8527. }
  8528. if (node.name === "module" && !scope.getBinding("module")) {
  8529. this.hasModule = true;
  8530. }
  8531. },
  8532. CallExpression: function CallExpression(path) {
  8533. if (!isValidRequireCall(path)) return;
  8534. this.bareSources.push(path.node.arguments[0]);
  8535. path.remove();
  8536. },
  8537. VariableDeclarator: function VariableDeclarator(path) {
  8538. var id = path.get("id");
  8539. if (!id.isIdentifier()) return;
  8540. var init = path.get("init");
  8541. if (!isValidRequireCall(init)) return;
  8542. var source = init.node.arguments[0];
  8543. this.sourceNames[source.value] = true;
  8544. this.sources.push([id.node, source]);
  8545. path.remove();
  8546. }
  8547. };
  8548. return {
  8549. inherits: require("babel-plugin-transform-es2015-modules-commonjs"),
  8550. pre: function pre() {
  8551. this.sources = [];
  8552. this.sourceNames = (0, _create2.default)(null);
  8553. this.bareSources = [];
  8554. this.hasExports = false;
  8555. this.hasModule = false;
  8556. },
  8557. visitor: {
  8558. Program: {
  8559. exit: function exit(path) {
  8560. var _this = this;
  8561. if (this.ran) return;
  8562. this.ran = true;
  8563. path.traverse(amdVisitor, this);
  8564. var params = this.sources.map(function (source) {
  8565. return source[0];
  8566. });
  8567. var sources = this.sources.map(function (source) {
  8568. return source[1];
  8569. });
  8570. sources = sources.concat(this.bareSources.filter(function (str) {
  8571. return !_this.sourceNames[str.value];
  8572. }));
  8573. var moduleName = this.getModuleName();
  8574. if (moduleName) moduleName = t.stringLiteral(moduleName);
  8575. if (this.hasExports) {
  8576. sources.unshift(t.stringLiteral("exports"));
  8577. params.unshift(t.identifier("exports"));
  8578. }
  8579. if (this.hasModule) {
  8580. sources.unshift(t.stringLiteral("module"));
  8581. params.unshift(t.identifier("module"));
  8582. }
  8583. var node = path.node;
  8584. var factory = buildFactory({
  8585. PARAMS: params,
  8586. BODY: node.body
  8587. });
  8588. factory.expression.body.directives = node.directives;
  8589. node.directives = [];
  8590. node.body = [buildDefine({
  8591. MODULE_NAME: moduleName,
  8592. SOURCES: sources,
  8593. FACTORY: factory
  8594. })];
  8595. }
  8596. }
  8597. }
  8598. };
  8599. };
  8600. var _babelTemplate = require("babel-template");
  8601. var _babelTemplate2 = _interopRequireDefault(_babelTemplate);
  8602. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8603. var buildDefine = (0, _babelTemplate2.default)("\n define(MODULE_NAME, [SOURCES], FACTORY);\n");
  8604. var buildFactory = (0, _babelTemplate2.default)("\n (function (PARAMS) {\n BODY;\n })\n");
  8605. module.exports = exports["default"];
  8606. },{"babel-plugin-transform-es2015-modules-commonjs":78,"babel-runtime/core-js/object/create":100,"babel-template":114}],78:[function(require,module,exports){
  8607. "use strict";
  8608. exports.__esModule = true;
  8609. var _keys = require("babel-runtime/core-js/object/keys");
  8610. var _keys2 = _interopRequireDefault(_keys);
  8611. var _create = require("babel-runtime/core-js/object/create");
  8612. var _create2 = _interopRequireDefault(_create);
  8613. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  8614. var _getIterator3 = _interopRequireDefault(_getIterator2);
  8615. var _symbol = require("babel-runtime/core-js/symbol");
  8616. var _symbol2 = _interopRequireDefault(_symbol);
  8617. exports.default = function () {
  8618. var REASSIGN_REMAP_SKIP = (0, _symbol2.default)();
  8619. var reassignmentVisitor = {
  8620. ReferencedIdentifier: function ReferencedIdentifier(path) {
  8621. var name = path.node.name;
  8622. var remap = this.remaps[name];
  8623. if (!remap) return;
  8624. if (this.scope.getBinding(name) !== path.scope.getBinding(name)) return;
  8625. if (path.parentPath.isCallExpression({ callee: path.node })) {
  8626. path.replaceWith(t.sequenceExpression([t.numericLiteral(0), remap]));
  8627. } else if (path.isJSXIdentifier() && t.isMemberExpression(remap)) {
  8628. var object = remap.object,
  8629. property = remap.property;
  8630. path.replaceWith(t.JSXMemberExpression(t.JSXIdentifier(object.name), t.JSXIdentifier(property.name)));
  8631. } else {
  8632. path.replaceWith(remap);
  8633. }
  8634. this.requeueInParent(path);
  8635. },
  8636. AssignmentExpression: function AssignmentExpression(path) {
  8637. var node = path.node;
  8638. if (node[REASSIGN_REMAP_SKIP]) return;
  8639. var left = path.get("left");
  8640. if (left.isIdentifier()) {
  8641. var name = left.node.name;
  8642. var exports = this.exports[name];
  8643. if (!exports) return;
  8644. if (this.scope.getBinding(name) !== path.scope.getBinding(name)) return;
  8645. node[REASSIGN_REMAP_SKIP] = true;
  8646. for (var _iterator = exports, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  8647. var _ref;
  8648. if (_isArray) {
  8649. if (_i >= _iterator.length) break;
  8650. _ref = _iterator[_i++];
  8651. } else {
  8652. _i = _iterator.next();
  8653. if (_i.done) break;
  8654. _ref = _i.value;
  8655. }
  8656. var reid = _ref;
  8657. node = buildExportsAssignment(reid, node).expression;
  8658. }
  8659. path.replaceWith(node);
  8660. this.requeueInParent(path);
  8661. } else if (left.isObjectPattern()) {
  8662. for (var _iterator2 = left.node.properties, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  8663. var _ref2;
  8664. if (_isArray2) {
  8665. if (_i2 >= _iterator2.length) break;
  8666. _ref2 = _iterator2[_i2++];
  8667. } else {
  8668. _i2 = _iterator2.next();
  8669. if (_i2.done) break;
  8670. _ref2 = _i2.value;
  8671. }
  8672. var property = _ref2;
  8673. var _name = property.value.name;
  8674. var _exports = this.exports[_name];
  8675. if (!_exports) continue;
  8676. if (this.scope.getBinding(_name) !== path.scope.getBinding(_name)) return;
  8677. node[REASSIGN_REMAP_SKIP] = true;
  8678. path.insertAfter(buildExportsAssignment(t.identifier(_name), t.identifier(_name)));
  8679. }
  8680. } else if (left.isArrayPattern()) {
  8681. for (var _iterator3 = left.node.elements, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) {
  8682. var _ref3;
  8683. if (_isArray3) {
  8684. if (_i3 >= _iterator3.length) break;
  8685. _ref3 = _iterator3[_i3++];
  8686. } else {
  8687. _i3 = _iterator3.next();
  8688. if (_i3.done) break;
  8689. _ref3 = _i3.value;
  8690. }
  8691. var element = _ref3;
  8692. if (!element) continue;
  8693. var _name2 = element.name;
  8694. var _exports2 = this.exports[_name2];
  8695. if (!_exports2) continue;
  8696. if (this.scope.getBinding(_name2) !== path.scope.getBinding(_name2)) return;
  8697. node[REASSIGN_REMAP_SKIP] = true;
  8698. path.insertAfter(buildExportsAssignment(t.identifier(_name2), t.identifier(_name2)));
  8699. }
  8700. }
  8701. },
  8702. UpdateExpression: function UpdateExpression(path) {
  8703. var arg = path.get("argument");
  8704. if (!arg.isIdentifier()) return;
  8705. var name = arg.node.name;
  8706. var exports = this.exports[name];
  8707. if (!exports) return;
  8708. if (this.scope.getBinding(name) !== path.scope.getBinding(name)) return;
  8709. var node = t.assignmentExpression(path.node.operator[0] + "=", arg.node, t.numericLiteral(1));
  8710. if (path.parentPath.isExpressionStatement() && !path.isCompletionRecord() || path.node.prefix) {
  8711. path.replaceWith(node);
  8712. this.requeueInParent(path);
  8713. return;
  8714. }
  8715. var nodes = [];
  8716. nodes.push(node);
  8717. var operator = void 0;
  8718. if (path.node.operator === "--") {
  8719. operator = "+";
  8720. } else {
  8721. operator = "-";
  8722. }
  8723. nodes.push(t.binaryExpression(operator, arg.node, t.numericLiteral(1)));
  8724. path.replaceWithMultiple(t.sequenceExpression(nodes));
  8725. }
  8726. };
  8727. return {
  8728. inherits: _babelPluginTransformStrictMode2.default,
  8729. visitor: {
  8730. ThisExpression: function ThisExpression(path, state) {
  8731. if (this.ranCommonJS) return;
  8732. if (state.opts.allowTopLevelThis !== true && !path.findParent(function (path) {
  8733. return !path.is("shadow") && THIS_BREAK_KEYS.indexOf(path.type) >= 0;
  8734. })) {
  8735. path.replaceWith(t.identifier("undefined"));
  8736. }
  8737. },
  8738. Program: {
  8739. exit: function exit(path) {
  8740. this.ranCommonJS = true;
  8741. var strict = !!this.opts.strict;
  8742. var noInterop = !!this.opts.noInterop;
  8743. var scope = path.scope;
  8744. scope.rename("module");
  8745. scope.rename("exports");
  8746. scope.rename("require");
  8747. var hasExports = false;
  8748. var hasImports = false;
  8749. var body = path.get("body");
  8750. var imports = (0, _create2.default)(null);
  8751. var exports = (0, _create2.default)(null);
  8752. var nonHoistedExportNames = (0, _create2.default)(null);
  8753. var topNodes = [];
  8754. var remaps = (0, _create2.default)(null);
  8755. var requires = (0, _create2.default)(null);
  8756. function addRequire(source, blockHoist) {
  8757. var cached = requires[source];
  8758. if (cached) return cached;
  8759. var ref = path.scope.generateUidIdentifier((0, _path2.basename)(source, (0, _path2.extname)(source)));
  8760. var varDecl = t.variableDeclaration("var", [t.variableDeclarator(ref, buildRequire(t.stringLiteral(source)).expression)]);
  8761. if (imports[source]) {
  8762. varDecl.loc = imports[source].loc;
  8763. }
  8764. if (typeof blockHoist === "number" && blockHoist > 0) {
  8765. varDecl._blockHoist = blockHoist;
  8766. }
  8767. topNodes.push(varDecl);
  8768. return requires[source] = ref;
  8769. }
  8770. function addTo(obj, key, arr) {
  8771. var existing = obj[key] || [];
  8772. obj[key] = existing.concat(arr);
  8773. }
  8774. for (var _iterator4 = body, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) {
  8775. var _ref4;
  8776. if (_isArray4) {
  8777. if (_i4 >= _iterator4.length) break;
  8778. _ref4 = _iterator4[_i4++];
  8779. } else {
  8780. _i4 = _iterator4.next();
  8781. if (_i4.done) break;
  8782. _ref4 = _i4.value;
  8783. }
  8784. var _path = _ref4;
  8785. if (_path.isExportDeclaration()) {
  8786. hasExports = true;
  8787. var specifiers = [].concat(_path.get("declaration"), _path.get("specifiers"));
  8788. for (var _iterator6 = specifiers, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : (0, _getIterator3.default)(_iterator6);;) {
  8789. var _ref6;
  8790. if (_isArray6) {
  8791. if (_i6 >= _iterator6.length) break;
  8792. _ref6 = _iterator6[_i6++];
  8793. } else {
  8794. _i6 = _iterator6.next();
  8795. if (_i6.done) break;
  8796. _ref6 = _i6.value;
  8797. }
  8798. var _specifier2 = _ref6;
  8799. var ids = _specifier2.getBindingIdentifiers();
  8800. if (ids.__esModule) {
  8801. throw _specifier2.buildCodeFrameError("Illegal export \"__esModule\"");
  8802. }
  8803. }
  8804. }
  8805. if (_path.isImportDeclaration()) {
  8806. var _importsEntry$specifi;
  8807. hasImports = true;
  8808. var key = _path.node.source.value;
  8809. var importsEntry = imports[key] || {
  8810. specifiers: [],
  8811. maxBlockHoist: 0,
  8812. loc: _path.node.loc
  8813. };
  8814. (_importsEntry$specifi = importsEntry.specifiers).push.apply(_importsEntry$specifi, _path.node.specifiers);
  8815. if (typeof _path.node._blockHoist === "number") {
  8816. importsEntry.maxBlockHoist = Math.max(_path.node._blockHoist, importsEntry.maxBlockHoist);
  8817. }
  8818. imports[key] = importsEntry;
  8819. _path.remove();
  8820. } else if (_path.isExportDefaultDeclaration()) {
  8821. var declaration = _path.get("declaration");
  8822. if (declaration.isFunctionDeclaration()) {
  8823. var id = declaration.node.id;
  8824. var defNode = t.identifier("default");
  8825. if (id) {
  8826. addTo(exports, id.name, defNode);
  8827. topNodes.push(buildExportsAssignment(defNode, id));
  8828. _path.replaceWith(declaration.node);
  8829. } else {
  8830. topNodes.push(buildExportsAssignment(defNode, t.toExpression(declaration.node)));
  8831. _path.remove();
  8832. }
  8833. } else if (declaration.isClassDeclaration()) {
  8834. var _id = declaration.node.id;
  8835. var _defNode = t.identifier("default");
  8836. if (_id) {
  8837. addTo(exports, _id.name, _defNode);
  8838. _path.replaceWithMultiple([declaration.node, buildExportsAssignment(_defNode, _id)]);
  8839. } else {
  8840. _path.replaceWith(buildExportsAssignment(_defNode, t.toExpression(declaration.node)));
  8841. _path.parentPath.requeue(_path.get("expression.left"));
  8842. }
  8843. } else {
  8844. _path.replaceWith(buildExportsAssignment(t.identifier("default"), declaration.node));
  8845. _path.parentPath.requeue(_path.get("expression.left"));
  8846. }
  8847. } else if (_path.isExportNamedDeclaration()) {
  8848. var _declaration = _path.get("declaration");
  8849. if (_declaration.node) {
  8850. if (_declaration.isFunctionDeclaration()) {
  8851. var _id2 = _declaration.node.id;
  8852. addTo(exports, _id2.name, _id2);
  8853. topNodes.push(buildExportsAssignment(_id2, _id2));
  8854. _path.replaceWith(_declaration.node);
  8855. } else if (_declaration.isClassDeclaration()) {
  8856. var _id3 = _declaration.node.id;
  8857. addTo(exports, _id3.name, _id3);
  8858. _path.replaceWithMultiple([_declaration.node, buildExportsAssignment(_id3, _id3)]);
  8859. nonHoistedExportNames[_id3.name] = true;
  8860. } else if (_declaration.isVariableDeclaration()) {
  8861. var declarators = _declaration.get("declarations");
  8862. for (var _iterator7 = declarators, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : (0, _getIterator3.default)(_iterator7);;) {
  8863. var _ref7;
  8864. if (_isArray7) {
  8865. if (_i7 >= _iterator7.length) break;
  8866. _ref7 = _iterator7[_i7++];
  8867. } else {
  8868. _i7 = _iterator7.next();
  8869. if (_i7.done) break;
  8870. _ref7 = _i7.value;
  8871. }
  8872. var decl = _ref7;
  8873. var _id4 = decl.get("id");
  8874. var init = decl.get("init");
  8875. var exportsToInsert = [];
  8876. if (!init.node) init.replaceWith(t.identifier("undefined"));
  8877. if (_id4.isIdentifier()) {
  8878. addTo(exports, _id4.node.name, _id4.node);
  8879. init.replaceWith(buildExportsAssignment(_id4.node, init.node).expression);
  8880. nonHoistedExportNames[_id4.node.name] = true;
  8881. } else if (_id4.isObjectPattern()) {
  8882. for (var _i8 = 0; _i8 < _id4.node.properties.length; _i8++) {
  8883. var prop = _id4.node.properties[_i8];
  8884. var propValue = prop.value;
  8885. if (t.isAssignmentPattern(propValue)) {
  8886. propValue = propValue.left;
  8887. } else if (t.isRestProperty(prop)) {
  8888. propValue = prop.argument;
  8889. }
  8890. addTo(exports, propValue.name, propValue);
  8891. exportsToInsert.push(buildExportsAssignment(propValue, propValue));
  8892. nonHoistedExportNames[propValue.name] = true;
  8893. }
  8894. } else if (_id4.isArrayPattern() && _id4.node.elements) {
  8895. for (var _i9 = 0; _i9 < _id4.node.elements.length; _i9++) {
  8896. var elem = _id4.node.elements[_i9];
  8897. if (!elem) continue;
  8898. if (t.isAssignmentPattern(elem)) {
  8899. elem = elem.left;
  8900. } else if (t.isRestElement(elem)) {
  8901. elem = elem.argument;
  8902. }
  8903. var name = elem.name;
  8904. addTo(exports, name, elem);
  8905. exportsToInsert.push(buildExportsAssignment(elem, elem));
  8906. nonHoistedExportNames[name] = true;
  8907. }
  8908. }
  8909. _path.insertAfter(exportsToInsert);
  8910. }
  8911. _path.replaceWith(_declaration.node);
  8912. }
  8913. continue;
  8914. }
  8915. var _specifiers = _path.get("specifiers");
  8916. var nodes = [];
  8917. var _source = _path.node.source;
  8918. if (_source) {
  8919. var ref = addRequire(_source.value, _path.node._blockHoist);
  8920. for (var _iterator8 = _specifiers, _isArray8 = Array.isArray(_iterator8), _i10 = 0, _iterator8 = _isArray8 ? _iterator8 : (0, _getIterator3.default)(_iterator8);;) {
  8921. var _ref8;
  8922. if (_isArray8) {
  8923. if (_i10 >= _iterator8.length) break;
  8924. _ref8 = _iterator8[_i10++];
  8925. } else {
  8926. _i10 = _iterator8.next();
  8927. if (_i10.done) break;
  8928. _ref8 = _i10.value;
  8929. }
  8930. var _specifier3 = _ref8;
  8931. if (_specifier3.isExportNamespaceSpecifier()) {} else if (_specifier3.isExportDefaultSpecifier()) {} else if (_specifier3.isExportSpecifier()) {
  8932. if (!noInterop && _specifier3.node.local.name === "default") {
  8933. topNodes.push(buildExportsFrom(t.stringLiteral(_specifier3.node.exported.name), t.memberExpression(t.callExpression(this.addHelper("interopRequireDefault"), [ref]), _specifier3.node.local)));
  8934. } else {
  8935. topNodes.push(buildExportsFrom(t.stringLiteral(_specifier3.node.exported.name), t.memberExpression(ref, _specifier3.node.local)));
  8936. }
  8937. nonHoistedExportNames[_specifier3.node.exported.name] = true;
  8938. }
  8939. }
  8940. } else {
  8941. for (var _iterator9 = _specifiers, _isArray9 = Array.isArray(_iterator9), _i11 = 0, _iterator9 = _isArray9 ? _iterator9 : (0, _getIterator3.default)(_iterator9);;) {
  8942. var _ref9;
  8943. if (_isArray9) {
  8944. if (_i11 >= _iterator9.length) break;
  8945. _ref9 = _iterator9[_i11++];
  8946. } else {
  8947. _i11 = _iterator9.next();
  8948. if (_i11.done) break;
  8949. _ref9 = _i11.value;
  8950. }
  8951. var _specifier4 = _ref9;
  8952. if (_specifier4.isExportSpecifier()) {
  8953. addTo(exports, _specifier4.node.local.name, _specifier4.node.exported);
  8954. nonHoistedExportNames[_specifier4.node.exported.name] = true;
  8955. nodes.push(buildExportsAssignment(_specifier4.node.exported, _specifier4.node.local));
  8956. }
  8957. }
  8958. }
  8959. _path.replaceWithMultiple(nodes);
  8960. } else if (_path.isExportAllDeclaration()) {
  8961. var exportNode = buildExportAll({
  8962. OBJECT: addRequire(_path.node.source.value, _path.node._blockHoist)
  8963. });
  8964. exportNode.loc = _path.node.loc;
  8965. topNodes.push(exportNode);
  8966. _path.remove();
  8967. }
  8968. }
  8969. for (var source in imports) {
  8970. var _imports$source = imports[source],
  8971. specifiers = _imports$source.specifiers,
  8972. maxBlockHoist = _imports$source.maxBlockHoist;
  8973. if (specifiers.length) {
  8974. var uid = addRequire(source, maxBlockHoist);
  8975. var wildcard = void 0;
  8976. for (var i = 0; i < specifiers.length; i++) {
  8977. var specifier = specifiers[i];
  8978. if (t.isImportNamespaceSpecifier(specifier)) {
  8979. if (strict || noInterop) {
  8980. remaps[specifier.local.name] = uid;
  8981. } else {
  8982. var varDecl = t.variableDeclaration("var", [t.variableDeclarator(specifier.local, t.callExpression(this.addHelper("interopRequireWildcard"), [uid]))]);
  8983. if (maxBlockHoist > 0) {
  8984. varDecl._blockHoist = maxBlockHoist;
  8985. }
  8986. topNodes.push(varDecl);
  8987. }
  8988. wildcard = specifier.local;
  8989. } else if (t.isImportDefaultSpecifier(specifier)) {
  8990. specifiers[i] = t.importSpecifier(specifier.local, t.identifier("default"));
  8991. }
  8992. }
  8993. for (var _iterator5 = specifiers, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : (0, _getIterator3.default)(_iterator5);;) {
  8994. var _ref5;
  8995. if (_isArray5) {
  8996. if (_i5 >= _iterator5.length) break;
  8997. _ref5 = _iterator5[_i5++];
  8998. } else {
  8999. _i5 = _iterator5.next();
  9000. if (_i5.done) break;
  9001. _ref5 = _i5.value;
  9002. }
  9003. var _specifier = _ref5;
  9004. if (t.isImportSpecifier(_specifier)) {
  9005. var target = uid;
  9006. if (_specifier.imported.name === "default") {
  9007. if (wildcard) {
  9008. target = wildcard;
  9009. } else if (!noInterop) {
  9010. target = wildcard = path.scope.generateUidIdentifier(uid.name);
  9011. var _varDecl = t.variableDeclaration("var", [t.variableDeclarator(target, t.callExpression(this.addHelper("interopRequireDefault"), [uid]))]);
  9012. if (maxBlockHoist > 0) {
  9013. _varDecl._blockHoist = maxBlockHoist;
  9014. }
  9015. topNodes.push(_varDecl);
  9016. }
  9017. }
  9018. remaps[_specifier.local.name] = t.memberExpression(target, t.cloneWithoutLoc(_specifier.imported));
  9019. }
  9020. }
  9021. } else {
  9022. var requireNode = buildRequire(t.stringLiteral(source));
  9023. requireNode.loc = imports[source].loc;
  9024. topNodes.push(requireNode);
  9025. }
  9026. }
  9027. if (hasImports && (0, _keys2.default)(nonHoistedExportNames).length) {
  9028. var maxHoistedExportsNodeAssignmentLength = 100;
  9029. var nonHoistedExportNamesArr = (0, _keys2.default)(nonHoistedExportNames);
  9030. var _loop = function _loop(currentExportsNodeAssignmentLength) {
  9031. var nonHoistedExportNamesChunk = nonHoistedExportNamesArr.slice(currentExportsNodeAssignmentLength, currentExportsNodeAssignmentLength + maxHoistedExportsNodeAssignmentLength);
  9032. var hoistedExportsNode = t.identifier("undefined");
  9033. nonHoistedExportNamesChunk.forEach(function (name) {
  9034. hoistedExportsNode = buildExportsAssignment(t.identifier(name), hoistedExportsNode).expression;
  9035. });
  9036. var node = t.expressionStatement(hoistedExportsNode);
  9037. node._blockHoist = 3;
  9038. topNodes.unshift(node);
  9039. };
  9040. for (var currentExportsNodeAssignmentLength = 0; currentExportsNodeAssignmentLength < nonHoistedExportNamesArr.length; currentExportsNodeAssignmentLength += maxHoistedExportsNodeAssignmentLength) {
  9041. _loop(currentExportsNodeAssignmentLength);
  9042. }
  9043. }
  9044. if (hasExports && !strict) {
  9045. var buildTemplate = buildExportsModuleDeclaration;
  9046. if (this.opts.loose) buildTemplate = buildLooseExportsModuleDeclaration;
  9047. var declar = buildTemplate();
  9048. declar._blockHoist = 3;
  9049. topNodes.unshift(declar);
  9050. }
  9051. path.unshiftContainer("body", topNodes);
  9052. path.traverse(reassignmentVisitor, {
  9053. remaps: remaps,
  9054. scope: scope,
  9055. exports: exports,
  9056. requeueInParent: function requeueInParent(newPath) {
  9057. return path.requeue(newPath);
  9058. }
  9059. });
  9060. }
  9061. }
  9062. }
  9063. };
  9064. };
  9065. var _path2 = require("path");
  9066. var _babelTemplate = require("babel-template");
  9067. var _babelTemplate2 = _interopRequireDefault(_babelTemplate);
  9068. var _babelPluginTransformStrictMode = require("babel-plugin-transform-strict-mode");
  9069. var _babelPluginTransformStrictMode2 = _interopRequireDefault(_babelPluginTransformStrictMode);
  9070. var _babelTypes = require("babel-types");
  9071. var t = _interopRequireWildcard(_babelTypes);
  9072. 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; } }
  9073. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9074. var buildRequire = (0, _babelTemplate2.default)("\n require($0);\n");
  9075. var buildExportsModuleDeclaration = (0, _babelTemplate2.default)("\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n");
  9076. var buildExportsFrom = (0, _babelTemplate2.default)("\n Object.defineProperty(exports, $0, {\n enumerable: true,\n get: function () {\n return $1;\n }\n });\n");
  9077. var buildLooseExportsModuleDeclaration = (0, _babelTemplate2.default)("\n exports.__esModule = true;\n");
  9078. var buildExportsAssignment = (0, _babelTemplate2.default)("\n exports.$0 = $1;\n");
  9079. var buildExportAll = (0, _babelTemplate2.default)("\n Object.keys(OBJECT).forEach(function (key) {\n if (key === \"default\" || key === \"__esModule\") return;\n Object.defineProperty(exports, key, {\n enumerable: true,\n get: function () {\n return OBJECT[key];\n }\n });\n });\n");
  9080. var THIS_BREAK_KEYS = ["FunctionExpression", "FunctionDeclaration", "ClassProperty", "ClassMethod", "ObjectMethod"];
  9081. module.exports = exports["default"];
  9082. },{"babel-plugin-transform-strict-mode":93,"babel-runtime/core-js/get-iterator":95,"babel-runtime/core-js/object/create":100,"babel-runtime/core-js/object/keys":102,"babel-runtime/core-js/symbol":104,"babel-template":114,"babel-types":151,"path":522}],79:[function(require,module,exports){
  9083. "use strict";
  9084. exports.__esModule = true;
  9085. var _create = require("babel-runtime/core-js/object/create");
  9086. var _create2 = _interopRequireDefault(_create);
  9087. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  9088. var _getIterator3 = _interopRequireDefault(_getIterator2);
  9089. var _symbol = require("babel-runtime/core-js/symbol");
  9090. var _symbol2 = _interopRequireDefault(_symbol);
  9091. exports.default = function (_ref) {
  9092. var t = _ref.types;
  9093. var IGNORE_REASSIGNMENT_SYMBOL = (0, _symbol2.default)();
  9094. var reassignmentVisitor = {
  9095. "AssignmentExpression|UpdateExpression": function AssignmentExpressionUpdateExpression(path) {
  9096. if (path.node[IGNORE_REASSIGNMENT_SYMBOL]) return;
  9097. path.node[IGNORE_REASSIGNMENT_SYMBOL] = true;
  9098. var arg = path.get(path.isAssignmentExpression() ? "left" : "argument");
  9099. if (!arg.isIdentifier()) return;
  9100. var name = arg.node.name;
  9101. if (this.scope.getBinding(name) !== path.scope.getBinding(name)) return;
  9102. var exportedNames = this.exports[name];
  9103. if (!exportedNames) return;
  9104. var node = path.node;
  9105. var isPostUpdateExpression = path.isUpdateExpression() && !node.prefix;
  9106. if (isPostUpdateExpression) {
  9107. 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;
  9108. }
  9109. for (var _iterator = exportedNames, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  9110. var _ref2;
  9111. if (_isArray) {
  9112. if (_i >= _iterator.length) break;
  9113. _ref2 = _iterator[_i++];
  9114. } else {
  9115. _i = _iterator.next();
  9116. if (_i.done) break;
  9117. _ref2 = _i.value;
  9118. }
  9119. var exportedName = _ref2;
  9120. node = this.buildCall(exportedName, node).expression;
  9121. }
  9122. if (isPostUpdateExpression) node = t.sequenceExpression([node, path.node]);
  9123. path.replaceWith(node);
  9124. }
  9125. };
  9126. return {
  9127. visitor: {
  9128. CallExpression: function CallExpression(path, state) {
  9129. if (path.node.callee.type === TYPE_IMPORT) {
  9130. var contextIdent = state.contextIdent;
  9131. path.replaceWith(t.callExpression(t.memberExpression(contextIdent, t.identifier("import")), path.node.arguments));
  9132. }
  9133. },
  9134. ReferencedIdentifier: function ReferencedIdentifier(path, state) {
  9135. if (path.node.name == "__moduleName" && !path.scope.hasBinding("__moduleName")) {
  9136. path.replaceWith(t.memberExpression(state.contextIdent, t.identifier("id")));
  9137. }
  9138. },
  9139. Program: {
  9140. enter: function enter(path, state) {
  9141. state.contextIdent = path.scope.generateUidIdentifier("context");
  9142. },
  9143. exit: function exit(path, state) {
  9144. var exportIdent = path.scope.generateUidIdentifier("export");
  9145. var contextIdent = state.contextIdent;
  9146. var exportNames = (0, _create2.default)(null);
  9147. var modules = [];
  9148. var beforeBody = [];
  9149. var setters = [];
  9150. var sources = [];
  9151. var variableIds = [];
  9152. var removedPaths = [];
  9153. function addExportName(key, val) {
  9154. exportNames[key] = exportNames[key] || [];
  9155. exportNames[key].push(val);
  9156. }
  9157. function pushModule(source, key, specifiers) {
  9158. var module = void 0;
  9159. modules.forEach(function (m) {
  9160. if (m.key === source) {
  9161. module = m;
  9162. }
  9163. });
  9164. if (!module) {
  9165. modules.push(module = { key: source, imports: [], exports: [] });
  9166. }
  9167. module[key] = module[key].concat(specifiers);
  9168. }
  9169. function buildExportCall(name, val) {
  9170. return t.expressionStatement(t.callExpression(exportIdent, [t.stringLiteral(name), val]));
  9171. }
  9172. var body = path.get("body");
  9173. var canHoist = true;
  9174. for (var _iterator2 = body, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  9175. var _ref3;
  9176. if (_isArray2) {
  9177. if (_i2 >= _iterator2.length) break;
  9178. _ref3 = _iterator2[_i2++];
  9179. } else {
  9180. _i2 = _iterator2.next();
  9181. if (_i2.done) break;
  9182. _ref3 = _i2.value;
  9183. }
  9184. var _path = _ref3;
  9185. if (_path.isExportDeclaration()) _path = _path.get("declaration");
  9186. if (_path.isVariableDeclaration() && _path.node.kind !== "var") {
  9187. canHoist = false;
  9188. break;
  9189. }
  9190. }
  9191. for (var _iterator3 = body, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) {
  9192. var _ref4;
  9193. if (_isArray3) {
  9194. if (_i3 >= _iterator3.length) break;
  9195. _ref4 = _iterator3[_i3++];
  9196. } else {
  9197. _i3 = _iterator3.next();
  9198. if (_i3.done) break;
  9199. _ref4 = _i3.value;
  9200. }
  9201. var _path2 = _ref4;
  9202. if (canHoist && _path2.isFunctionDeclaration()) {
  9203. beforeBody.push(_path2.node);
  9204. removedPaths.push(_path2);
  9205. } else if (_path2.isImportDeclaration()) {
  9206. var source = _path2.node.source.value;
  9207. pushModule(source, "imports", _path2.node.specifiers);
  9208. for (var name in _path2.getBindingIdentifiers()) {
  9209. _path2.scope.removeBinding(name);
  9210. variableIds.push(t.identifier(name));
  9211. }
  9212. _path2.remove();
  9213. } else if (_path2.isExportAllDeclaration()) {
  9214. pushModule(_path2.node.source.value, "exports", _path2.node);
  9215. _path2.remove();
  9216. } else if (_path2.isExportDefaultDeclaration()) {
  9217. var declar = _path2.get("declaration");
  9218. if (declar.isClassDeclaration() || declar.isFunctionDeclaration()) {
  9219. var id = declar.node.id;
  9220. var nodes = [];
  9221. if (id) {
  9222. nodes.push(declar.node);
  9223. nodes.push(buildExportCall("default", id));
  9224. addExportName(id.name, "default");
  9225. } else {
  9226. nodes.push(buildExportCall("default", t.toExpression(declar.node)));
  9227. }
  9228. if (!canHoist || declar.isClassDeclaration()) {
  9229. _path2.replaceWithMultiple(nodes);
  9230. } else {
  9231. beforeBody = beforeBody.concat(nodes);
  9232. removedPaths.push(_path2);
  9233. }
  9234. } else {
  9235. _path2.replaceWith(buildExportCall("default", declar.node));
  9236. }
  9237. } else if (_path2.isExportNamedDeclaration()) {
  9238. var _declar = _path2.get("declaration");
  9239. if (_declar.node) {
  9240. _path2.replaceWith(_declar);
  9241. var _nodes = [];
  9242. var bindingIdentifiers = void 0;
  9243. if (_path2.isFunction()) {
  9244. var node = _declar.node;
  9245. var _name = node.id.name;
  9246. if (canHoist) {
  9247. addExportName(_name, _name);
  9248. beforeBody.push(node);
  9249. beforeBody.push(buildExportCall(_name, node.id));
  9250. removedPaths.push(_path2);
  9251. } else {
  9252. var _bindingIdentifiers;
  9253. bindingIdentifiers = (_bindingIdentifiers = {}, _bindingIdentifiers[_name] = node.id, _bindingIdentifiers);
  9254. }
  9255. } else {
  9256. bindingIdentifiers = _declar.getBindingIdentifiers();
  9257. }
  9258. for (var _name2 in bindingIdentifiers) {
  9259. addExportName(_name2, _name2);
  9260. _nodes.push(buildExportCall(_name2, t.identifier(_name2)));
  9261. }
  9262. _path2.insertAfter(_nodes);
  9263. } else {
  9264. var specifiers = _path2.node.specifiers;
  9265. if (specifiers && specifiers.length) {
  9266. if (_path2.node.source) {
  9267. pushModule(_path2.node.source.value, "exports", specifiers);
  9268. _path2.remove();
  9269. } else {
  9270. var _nodes2 = [];
  9271. for (var _iterator7 = specifiers, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : (0, _getIterator3.default)(_iterator7);;) {
  9272. var _ref8;
  9273. if (_isArray7) {
  9274. if (_i7 >= _iterator7.length) break;
  9275. _ref8 = _iterator7[_i7++];
  9276. } else {
  9277. _i7 = _iterator7.next();
  9278. if (_i7.done) break;
  9279. _ref8 = _i7.value;
  9280. }
  9281. var specifier = _ref8;
  9282. _nodes2.push(buildExportCall(specifier.exported.name, specifier.local));
  9283. addExportName(specifier.local.name, specifier.exported.name);
  9284. }
  9285. _path2.replaceWithMultiple(_nodes2);
  9286. }
  9287. }
  9288. }
  9289. }
  9290. }
  9291. modules.forEach(function (specifiers) {
  9292. var setterBody = [];
  9293. var target = path.scope.generateUidIdentifier(specifiers.key);
  9294. for (var _iterator4 = specifiers.imports, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) {
  9295. var _ref5;
  9296. if (_isArray4) {
  9297. if (_i4 >= _iterator4.length) break;
  9298. _ref5 = _iterator4[_i4++];
  9299. } else {
  9300. _i4 = _iterator4.next();
  9301. if (_i4.done) break;
  9302. _ref5 = _i4.value;
  9303. }
  9304. var specifier = _ref5;
  9305. if (t.isImportNamespaceSpecifier(specifier)) {
  9306. setterBody.push(t.expressionStatement(t.assignmentExpression("=", specifier.local, target)));
  9307. } else if (t.isImportDefaultSpecifier(specifier)) {
  9308. specifier = t.importSpecifier(specifier.local, t.identifier("default"));
  9309. }
  9310. if (t.isImportSpecifier(specifier)) {
  9311. setterBody.push(t.expressionStatement(t.assignmentExpression("=", specifier.local, t.memberExpression(target, specifier.imported))));
  9312. }
  9313. }
  9314. if (specifiers.exports.length) {
  9315. var exportObjRef = path.scope.generateUidIdentifier("exportObj");
  9316. setterBody.push(t.variableDeclaration("var", [t.variableDeclarator(exportObjRef, t.objectExpression([]))]));
  9317. for (var _iterator5 = specifiers.exports, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : (0, _getIterator3.default)(_iterator5);;) {
  9318. var _ref6;
  9319. if (_isArray5) {
  9320. if (_i5 >= _iterator5.length) break;
  9321. _ref6 = _iterator5[_i5++];
  9322. } else {
  9323. _i5 = _iterator5.next();
  9324. if (_i5.done) break;
  9325. _ref6 = _i5.value;
  9326. }
  9327. var node = _ref6;
  9328. if (t.isExportAllDeclaration(node)) {
  9329. setterBody.push(buildExportAll({
  9330. KEY: path.scope.generateUidIdentifier("key"),
  9331. EXPORT_OBJ: exportObjRef,
  9332. TARGET: target
  9333. }));
  9334. } else if (t.isExportSpecifier(node)) {
  9335. setterBody.push(t.expressionStatement(t.assignmentExpression("=", t.memberExpression(exportObjRef, node.exported), t.memberExpression(target, node.local))));
  9336. } else {}
  9337. }
  9338. setterBody.push(t.expressionStatement(t.callExpression(exportIdent, [exportObjRef])));
  9339. }
  9340. sources.push(t.stringLiteral(specifiers.key));
  9341. setters.push(t.functionExpression(null, [target], t.blockStatement(setterBody)));
  9342. });
  9343. var moduleName = this.getModuleName();
  9344. if (moduleName) moduleName = t.stringLiteral(moduleName);
  9345. if (canHoist) {
  9346. (0, _babelHelperHoistVariables2.default)(path, function (id) {
  9347. return variableIds.push(id);
  9348. });
  9349. }
  9350. if (variableIds.length) {
  9351. beforeBody.unshift(t.variableDeclaration("var", variableIds.map(function (id) {
  9352. return t.variableDeclarator(id);
  9353. })));
  9354. }
  9355. path.traverse(reassignmentVisitor, {
  9356. exports: exportNames,
  9357. buildCall: buildExportCall,
  9358. scope: path.scope
  9359. });
  9360. for (var _iterator6 = removedPaths, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : (0, _getIterator3.default)(_iterator6);;) {
  9361. var _ref7;
  9362. if (_isArray6) {
  9363. if (_i6 >= _iterator6.length) break;
  9364. _ref7 = _iterator6[_i6++];
  9365. } else {
  9366. _i6 = _iterator6.next();
  9367. if (_i6.done) break;
  9368. _ref7 = _i6.value;
  9369. }
  9370. var _path3 = _ref7;
  9371. _path3.remove();
  9372. }
  9373. path.node.body = [buildTemplate({
  9374. SYSTEM_REGISTER: t.memberExpression(t.identifier(state.opts.systemGlobal || "System"), t.identifier("register")),
  9375. BEFORE_BODY: beforeBody,
  9376. MODULE_NAME: moduleName,
  9377. SETTERS: setters,
  9378. SOURCES: sources,
  9379. BODY: path.node.body,
  9380. EXPORT_IDENTIFIER: exportIdent,
  9381. CONTEXT_IDENTIFIER: contextIdent
  9382. })];
  9383. }
  9384. }
  9385. }
  9386. };
  9387. };
  9388. var _babelHelperHoistVariables = require("babel-helper-hoist-variables");
  9389. var _babelHelperHoistVariables2 = _interopRequireDefault(_babelHelperHoistVariables);
  9390. var _babelTemplate = require("babel-template");
  9391. var _babelTemplate2 = _interopRequireDefault(_babelTemplate);
  9392. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9393. 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");
  9394. var buildExportAll = (0, _babelTemplate2.default)("\n for (var KEY in TARGET) {\n if (KEY !== \"default\" && KEY !== \"__esModule\") EXPORT_OBJ[KEY] = TARGET[KEY];\n }\n");
  9395. var TYPE_IMPORT = "Import";
  9396. module.exports = exports["default"];
  9397. },{"babel-helper-hoist-variables":55,"babel-runtime/core-js/get-iterator":95,"babel-runtime/core-js/object/create":100,"babel-runtime/core-js/symbol":104,"babel-template":114}],80:[function(require,module,exports){
  9398. "use strict";
  9399. exports.__esModule = true;
  9400. exports.default = function (_ref) {
  9401. var t = _ref.types;
  9402. function isValidDefine(path) {
  9403. if (!path.isExpressionStatement()) return;
  9404. var expr = path.get("expression");
  9405. if (!expr.isCallExpression()) return false;
  9406. if (!expr.get("callee").isIdentifier({ name: "define" })) return false;
  9407. var args = expr.get("arguments");
  9408. if (args.length === 3 && !args.shift().isStringLiteral()) return false;
  9409. if (args.length !== 2) return false;
  9410. if (!args.shift().isArrayExpression()) return false;
  9411. if (!args.shift().isFunctionExpression()) return false;
  9412. return true;
  9413. }
  9414. return {
  9415. inherits: require("babel-plugin-transform-es2015-modules-amd"),
  9416. visitor: {
  9417. Program: {
  9418. exit: function exit(path, state) {
  9419. var last = path.get("body").pop();
  9420. if (!isValidDefine(last)) return;
  9421. var call = last.node.expression;
  9422. var args = call.arguments;
  9423. var moduleName = args.length === 3 ? args.shift() : null;
  9424. var amdArgs = call.arguments[0];
  9425. var func = call.arguments[1];
  9426. var browserGlobals = state.opts.globals || {};
  9427. var commonArgs = amdArgs.elements.map(function (arg) {
  9428. if (arg.value === "module" || arg.value === "exports") {
  9429. return t.identifier(arg.value);
  9430. } else {
  9431. return t.callExpression(t.identifier("require"), [arg]);
  9432. }
  9433. });
  9434. var browserArgs = amdArgs.elements.map(function (arg) {
  9435. if (arg.value === "module") {
  9436. return t.identifier("mod");
  9437. } else if (arg.value === "exports") {
  9438. return t.memberExpression(t.identifier("mod"), t.identifier("exports"));
  9439. } else {
  9440. var memberExpression = void 0;
  9441. if (state.opts.exactGlobals) {
  9442. var globalRef = browserGlobals[arg.value];
  9443. if (globalRef) {
  9444. memberExpression = globalRef.split(".").reduce(function (accum, curr) {
  9445. return t.memberExpression(accum, t.identifier(curr));
  9446. }, t.identifier("global"));
  9447. } else {
  9448. memberExpression = t.memberExpression(t.identifier("global"), t.identifier(t.toIdentifier(arg.value)));
  9449. }
  9450. } else {
  9451. var requireName = (0, _path.basename)(arg.value, (0, _path.extname)(arg.value));
  9452. var globalName = browserGlobals[requireName] || requireName;
  9453. memberExpression = t.memberExpression(t.identifier("global"), t.identifier(t.toIdentifier(globalName)));
  9454. }
  9455. return memberExpression;
  9456. }
  9457. });
  9458. var moduleNameOrBasename = moduleName ? moduleName.value : this.file.opts.basename;
  9459. var globalToAssign = t.memberExpression(t.identifier("global"), t.identifier(t.toIdentifier(moduleNameOrBasename)));
  9460. var prerequisiteAssignments = null;
  9461. if (state.opts.exactGlobals) {
  9462. var globalName = browserGlobals[moduleNameOrBasename];
  9463. if (globalName) {
  9464. prerequisiteAssignments = [];
  9465. var members = globalName.split(".");
  9466. globalToAssign = members.slice(1).reduce(function (accum, curr) {
  9467. prerequisiteAssignments.push(buildPrerequisiteAssignment({ GLOBAL_REFERENCE: accum }));
  9468. return t.memberExpression(accum, t.identifier(curr));
  9469. }, t.memberExpression(t.identifier("global"), t.identifier(members[0])));
  9470. }
  9471. }
  9472. var globalExport = buildGlobalExport({
  9473. BROWSER_ARGUMENTS: browserArgs,
  9474. PREREQUISITE_ASSIGNMENTS: prerequisiteAssignments,
  9475. GLOBAL_TO_ASSIGN: globalToAssign
  9476. });
  9477. last.replaceWith(buildWrapper({
  9478. MODULE_NAME: moduleName,
  9479. AMD_ARGUMENTS: amdArgs,
  9480. COMMON_ARGUMENTS: commonArgs,
  9481. GLOBAL_EXPORT: globalExport,
  9482. FUNC: func
  9483. }));
  9484. }
  9485. }
  9486. }
  9487. };
  9488. };
  9489. var _path = require("path");
  9490. var _babelTemplate = require("babel-template");
  9491. var _babelTemplate2 = _interopRequireDefault(_babelTemplate);
  9492. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9493. var buildPrerequisiteAssignment = (0, _babelTemplate2.default)("\n GLOBAL_REFERENCE = GLOBAL_REFERENCE || {}\n");
  9494. var buildGlobalExport = (0, _babelTemplate2.default)("\n var mod = { exports: {} };\n factory(BROWSER_ARGUMENTS);\n PREREQUISITE_ASSIGNMENTS\n GLOBAL_TO_ASSIGN = mod.exports;\n");
  9495. var buildWrapper = (0, _babelTemplate2.default)("\n (function (global, factory) {\n if (typeof define === \"function\" && define.amd) {\n define(MODULE_NAME, AMD_ARGUMENTS, factory);\n } else if (typeof exports !== \"undefined\") {\n factory(COMMON_ARGUMENTS);\n } else {\n GLOBAL_EXPORT\n }\n })(this, FUNC);\n");
  9496. module.exports = exports["default"];
  9497. },{"babel-plugin-transform-es2015-modules-amd":77,"babel-template":114,"path":522}],81:[function(require,module,exports){
  9498. "use strict";
  9499. exports.__esModule = true;
  9500. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  9501. var _getIterator3 = _interopRequireDefault(_getIterator2);
  9502. var _symbol = require("babel-runtime/core-js/symbol");
  9503. var _symbol2 = _interopRequireDefault(_symbol);
  9504. exports.default = function (_ref) {
  9505. var t = _ref.types;
  9506. function Property(path, node, scope, getObjectRef, file) {
  9507. var replaceSupers = new _babelHelperReplaceSupers2.default({
  9508. getObjectRef: getObjectRef,
  9509. methodNode: node,
  9510. methodPath: path,
  9511. isStatic: true,
  9512. scope: scope,
  9513. file: file
  9514. });
  9515. replaceSupers.replace();
  9516. }
  9517. var CONTAINS_SUPER = (0, _symbol2.default)();
  9518. return {
  9519. visitor: {
  9520. Super: function Super(path) {
  9521. var parentObj = path.findParent(function (path) {
  9522. return path.isObjectExpression();
  9523. });
  9524. if (parentObj) parentObj.node[CONTAINS_SUPER] = true;
  9525. },
  9526. ObjectExpression: {
  9527. exit: function exit(path, file) {
  9528. if (!path.node[CONTAINS_SUPER]) return;
  9529. var objectRef = void 0;
  9530. var getObjectRef = function getObjectRef() {
  9531. return objectRef = objectRef || path.scope.generateUidIdentifier("obj");
  9532. };
  9533. var propPaths = path.get("properties");
  9534. for (var _iterator = propPaths, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  9535. var _ref2;
  9536. if (_isArray) {
  9537. if (_i >= _iterator.length) break;
  9538. _ref2 = _iterator[_i++];
  9539. } else {
  9540. _i = _iterator.next();
  9541. if (_i.done) break;
  9542. _ref2 = _i.value;
  9543. }
  9544. var propPath = _ref2;
  9545. if (propPath.isObjectProperty()) propPath = propPath.get("value");
  9546. Property(propPath, propPath.node, path.scope, getObjectRef, file);
  9547. }
  9548. if (objectRef) {
  9549. path.scope.push({ id: objectRef });
  9550. path.replaceWith(t.assignmentExpression("=", objectRef, path.node));
  9551. }
  9552. }
  9553. }
  9554. }
  9555. };
  9556. };
  9557. var _babelHelperReplaceSupers = require("babel-helper-replace-supers");
  9558. var _babelHelperReplaceSupers2 = _interopRequireDefault(_babelHelperReplaceSupers);
  9559. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9560. module.exports = exports["default"];
  9561. },{"babel-helper-replace-supers":58,"babel-runtime/core-js/get-iterator":95,"babel-runtime/core-js/symbol":104}],82:[function(require,module,exports){
  9562. "use strict";
  9563. exports.__esModule = true;
  9564. exports.visitor = undefined;
  9565. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  9566. var _getIterator3 = _interopRequireDefault(_getIterator2);
  9567. var _babelHelperGetFunctionArity = require("babel-helper-get-function-arity");
  9568. var _babelHelperGetFunctionArity2 = _interopRequireDefault(_babelHelperGetFunctionArity);
  9569. var _babelHelperCallDelegate = require("babel-helper-call-delegate");
  9570. var _babelHelperCallDelegate2 = _interopRequireDefault(_babelHelperCallDelegate);
  9571. var _babelTemplate = require("babel-template");
  9572. var _babelTemplate2 = _interopRequireDefault(_babelTemplate);
  9573. var _babelTypes = require("babel-types");
  9574. var t = _interopRequireWildcard(_babelTypes);
  9575. 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; } }
  9576. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9577. var buildDefaultParam = (0, _babelTemplate2.default)("\n let VARIABLE_NAME =\n ARGUMENTS.length > ARGUMENT_KEY && ARGUMENTS[ARGUMENT_KEY] !== undefined ?\n ARGUMENTS[ARGUMENT_KEY]\n :\n DEFAULT_VALUE;\n");
  9578. var buildCutOff = (0, _babelTemplate2.default)("\n let $0 = $1[$2];\n");
  9579. function hasDefaults(node) {
  9580. for (var _iterator = node.params, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  9581. var _ref;
  9582. if (_isArray) {
  9583. if (_i >= _iterator.length) break;
  9584. _ref = _iterator[_i++];
  9585. } else {
  9586. _i = _iterator.next();
  9587. if (_i.done) break;
  9588. _ref = _i.value;
  9589. }
  9590. var param = _ref;
  9591. if (!t.isIdentifier(param)) return true;
  9592. }
  9593. return false;
  9594. }
  9595. function isSafeBinding(scope, node) {
  9596. if (!scope.hasOwnBinding(node.name)) return true;
  9597. var _scope$getOwnBinding = scope.getOwnBinding(node.name),
  9598. kind = _scope$getOwnBinding.kind;
  9599. return kind === "param" || kind === "local";
  9600. }
  9601. var iifeVisitor = {
  9602. ReferencedIdentifier: function ReferencedIdentifier(path, state) {
  9603. var scope = path.scope,
  9604. node = path.node;
  9605. if (node.name === "eval" || !isSafeBinding(scope, node)) {
  9606. state.iife = true;
  9607. path.stop();
  9608. }
  9609. },
  9610. Scope: function Scope(path) {
  9611. path.skip();
  9612. }
  9613. };
  9614. var visitor = exports.visitor = {
  9615. Function: function Function(path) {
  9616. var node = path.node,
  9617. scope = path.scope;
  9618. if (!hasDefaults(node)) return;
  9619. path.ensureBlock();
  9620. var state = {
  9621. iife: false,
  9622. scope: scope
  9623. };
  9624. var body = [];
  9625. var argsIdentifier = t.identifier("arguments");
  9626. argsIdentifier._shadowedFunctionLiteral = path;
  9627. function pushDefNode(left, right, i) {
  9628. var defNode = buildDefaultParam({
  9629. VARIABLE_NAME: left,
  9630. DEFAULT_VALUE: right,
  9631. ARGUMENT_KEY: t.numericLiteral(i),
  9632. ARGUMENTS: argsIdentifier
  9633. });
  9634. defNode._blockHoist = node.params.length - i;
  9635. body.push(defNode);
  9636. }
  9637. var lastNonDefaultParam = (0, _babelHelperGetFunctionArity2.default)(node);
  9638. var params = path.get("params");
  9639. for (var i = 0; i < params.length; i++) {
  9640. var param = params[i];
  9641. if (!param.isAssignmentPattern()) {
  9642. if (!state.iife && !param.isIdentifier()) {
  9643. param.traverse(iifeVisitor, state);
  9644. }
  9645. continue;
  9646. }
  9647. var left = param.get("left");
  9648. var right = param.get("right");
  9649. if (i >= lastNonDefaultParam || left.isPattern()) {
  9650. var placeholder = scope.generateUidIdentifier("x");
  9651. placeholder._isDefaultPlaceholder = true;
  9652. node.params[i] = placeholder;
  9653. } else {
  9654. node.params[i] = left.node;
  9655. }
  9656. if (!state.iife) {
  9657. if (right.isIdentifier() && !isSafeBinding(scope, right.node)) {
  9658. state.iife = true;
  9659. } else {
  9660. right.traverse(iifeVisitor, state);
  9661. }
  9662. }
  9663. pushDefNode(left.node, right.node, i);
  9664. }
  9665. for (var _i2 = lastNonDefaultParam + 1; _i2 < node.params.length; _i2++) {
  9666. var _param = node.params[_i2];
  9667. if (_param._isDefaultPlaceholder) continue;
  9668. var declar = buildCutOff(_param, argsIdentifier, t.numericLiteral(_i2));
  9669. declar._blockHoist = node.params.length - _i2;
  9670. body.push(declar);
  9671. }
  9672. node.params = node.params.slice(0, lastNonDefaultParam);
  9673. if (state.iife) {
  9674. body.push((0, _babelHelperCallDelegate2.default)(path, scope));
  9675. path.set("body", t.blockStatement(body));
  9676. } else {
  9677. path.get("body").unshiftContainer("body", body);
  9678. }
  9679. }
  9680. };
  9681. },{"babel-helper-call-delegate":51,"babel-helper-get-function-arity":54,"babel-runtime/core-js/get-iterator":95,"babel-template":114,"babel-types":151}],83:[function(require,module,exports){
  9682. "use strict";
  9683. exports.__esModule = true;
  9684. exports.visitor = undefined;
  9685. var _babelTypes = require("babel-types");
  9686. var t = _interopRequireWildcard(_babelTypes);
  9687. 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; } }
  9688. var visitor = exports.visitor = {
  9689. Function: function Function(path) {
  9690. var params = path.get("params");
  9691. var hoistTweak = t.isRestElement(params[params.length - 1]) ? 1 : 0;
  9692. var outputParamsLength = params.length - hoistTweak;
  9693. for (var i = 0; i < outputParamsLength; i++) {
  9694. var param = params[i];
  9695. if (param.isArrayPattern() || param.isObjectPattern()) {
  9696. var uid = path.scope.generateUidIdentifier("ref");
  9697. var declar = t.variableDeclaration("let", [t.variableDeclarator(param.node, uid)]);
  9698. declar._blockHoist = outputParamsLength - i;
  9699. path.ensureBlock();
  9700. path.get("body").unshiftContainer("body", declar);
  9701. param.replaceWith(uid);
  9702. }
  9703. }
  9704. }
  9705. };
  9706. },{"babel-types":151}],84:[function(require,module,exports){
  9707. "use strict";
  9708. exports.__esModule = true;
  9709. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  9710. var _getIterator3 = _interopRequireDefault(_getIterator2);
  9711. exports.default = function () {
  9712. return {
  9713. visitor: _babelTraverse.visitors.merge([{
  9714. ArrowFunctionExpression: function ArrowFunctionExpression(path) {
  9715. var params = path.get("params");
  9716. for (var _iterator = params, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  9717. var _ref;
  9718. if (_isArray) {
  9719. if (_i >= _iterator.length) break;
  9720. _ref = _iterator[_i++];
  9721. } else {
  9722. _i = _iterator.next();
  9723. if (_i.done) break;
  9724. _ref = _i.value;
  9725. }
  9726. var param = _ref;
  9727. if (param.isRestElement() || param.isAssignmentPattern()) {
  9728. path.arrowFunctionToShadowed();
  9729. break;
  9730. }
  9731. }
  9732. }
  9733. }, destructuring.visitor, rest.visitor, def.visitor])
  9734. };
  9735. };
  9736. var _babelTraverse = require("babel-traverse");
  9737. var _destructuring = require("./destructuring");
  9738. var destructuring = _interopRequireWildcard(_destructuring);
  9739. var _default = require("./default");
  9740. var def = _interopRequireWildcard(_default);
  9741. var _rest = require("./rest");
  9742. var rest = _interopRequireWildcard(_rest);
  9743. 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; } }
  9744. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9745. module.exports = exports["default"];
  9746. },{"./default":82,"./destructuring":83,"./rest":85,"babel-runtime/core-js/get-iterator":95,"babel-traverse":118}],85:[function(require,module,exports){
  9747. "use strict";
  9748. exports.__esModule = true;
  9749. exports.visitor = undefined;
  9750. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  9751. var _getIterator3 = _interopRequireDefault(_getIterator2);
  9752. var _babelTemplate = require("babel-template");
  9753. var _babelTemplate2 = _interopRequireDefault(_babelTemplate);
  9754. var _babelTypes = require("babel-types");
  9755. var t = _interopRequireWildcard(_babelTypes);
  9756. 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; } }
  9757. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9758. var buildRest = (0, _babelTemplate2.default)("\n for (var LEN = ARGUMENTS.length,\n ARRAY = Array(ARRAY_LEN),\n KEY = START;\n KEY < LEN;\n KEY++) {\n ARRAY[ARRAY_KEY] = ARGUMENTS[KEY];\n }\n");
  9759. var restIndex = (0, _babelTemplate2.default)("\n ARGUMENTS.length <= INDEX ? undefined : ARGUMENTS[INDEX]\n");
  9760. var restIndexImpure = (0, _babelTemplate2.default)("\n REF = INDEX, ARGUMENTS.length <= REF ? undefined : ARGUMENTS[REF]\n");
  9761. var restLength = (0, _babelTemplate2.default)("\n ARGUMENTS.length <= OFFSET ? 0 : ARGUMENTS.length - OFFSET\n");
  9762. var memberExpressionOptimisationVisitor = {
  9763. Scope: function Scope(path, state) {
  9764. if (!path.scope.bindingIdentifierEquals(state.name, state.outerBinding)) {
  9765. path.skip();
  9766. }
  9767. },
  9768. Flow: function Flow(path) {
  9769. if (path.isTypeCastExpression()) return;
  9770. path.skip();
  9771. },
  9772. "Function|ClassProperty": function FunctionClassProperty(path, state) {
  9773. var oldNoOptimise = state.noOptimise;
  9774. state.noOptimise = true;
  9775. path.traverse(memberExpressionOptimisationVisitor, state);
  9776. state.noOptimise = oldNoOptimise;
  9777. path.skip();
  9778. },
  9779. ReferencedIdentifier: function ReferencedIdentifier(path, state) {
  9780. var node = path.node;
  9781. if (node.name === "arguments") {
  9782. state.deopted = true;
  9783. }
  9784. if (node.name !== state.name) return;
  9785. if (state.noOptimise) {
  9786. state.deopted = true;
  9787. } else {
  9788. var parentPath = path.parentPath;
  9789. if (parentPath.listKey === "params" && parentPath.key < state.offset) {
  9790. return;
  9791. }
  9792. if (parentPath.isMemberExpression({ object: node })) {
  9793. var grandparentPath = parentPath.parentPath;
  9794. var argsOptEligible = !state.deopted && !(grandparentPath.isAssignmentExpression() && parentPath.node === grandparentPath.node.left || grandparentPath.isLVal() || grandparentPath.isForXStatement() || grandparentPath.isUpdateExpression() || grandparentPath.isUnaryExpression({ operator: "delete" }) || (grandparentPath.isCallExpression() || grandparentPath.isNewExpression()) && parentPath.node === grandparentPath.node.callee);
  9795. if (argsOptEligible) {
  9796. if (parentPath.node.computed) {
  9797. if (parentPath.get("property").isBaseType("number")) {
  9798. state.candidates.push({ cause: "indexGetter", path: path });
  9799. return;
  9800. }
  9801. } else if (parentPath.node.property.name === "length") {
  9802. state.candidates.push({ cause: "lengthGetter", path: path });
  9803. return;
  9804. }
  9805. }
  9806. }
  9807. if (state.offset === 0 && parentPath.isSpreadElement()) {
  9808. var call = parentPath.parentPath;
  9809. if (call.isCallExpression() && call.node.arguments.length === 1) {
  9810. state.candidates.push({ cause: "argSpread", path: path });
  9811. return;
  9812. }
  9813. }
  9814. state.references.push(path);
  9815. }
  9816. },
  9817. BindingIdentifier: function BindingIdentifier(_ref, state) {
  9818. var node = _ref.node;
  9819. if (node.name === state.name) {
  9820. state.deopted = true;
  9821. }
  9822. }
  9823. };
  9824. function hasRest(node) {
  9825. return t.isRestElement(node.params[node.params.length - 1]);
  9826. }
  9827. function optimiseIndexGetter(path, argsId, offset) {
  9828. var index = void 0;
  9829. if (t.isNumericLiteral(path.parent.property)) {
  9830. index = t.numericLiteral(path.parent.property.value + offset);
  9831. } else if (offset === 0) {
  9832. index = path.parent.property;
  9833. } else {
  9834. index = t.binaryExpression("+", path.parent.property, t.numericLiteral(offset));
  9835. }
  9836. var scope = path.scope;
  9837. if (!scope.isPure(index)) {
  9838. var temp = scope.generateUidIdentifierBasedOnNode(index);
  9839. scope.push({ id: temp, kind: "var" });
  9840. path.parentPath.replaceWith(restIndexImpure({
  9841. ARGUMENTS: argsId,
  9842. INDEX: index,
  9843. REF: temp
  9844. }));
  9845. } else {
  9846. path.parentPath.replaceWith(restIndex({
  9847. ARGUMENTS: argsId,
  9848. INDEX: index
  9849. }));
  9850. }
  9851. }
  9852. function optimiseLengthGetter(path, argsId, offset) {
  9853. if (offset) {
  9854. path.parentPath.replaceWith(restLength({
  9855. ARGUMENTS: argsId,
  9856. OFFSET: t.numericLiteral(offset)
  9857. }));
  9858. } else {
  9859. path.replaceWith(argsId);
  9860. }
  9861. }
  9862. var visitor = exports.visitor = {
  9863. Function: function Function(path) {
  9864. var node = path.node,
  9865. scope = path.scope;
  9866. if (!hasRest(node)) return;
  9867. var rest = node.params.pop().argument;
  9868. var argsId = t.identifier("arguments");
  9869. argsId._shadowedFunctionLiteral = path;
  9870. var state = {
  9871. references: [],
  9872. offset: node.params.length,
  9873. argumentsNode: argsId,
  9874. outerBinding: scope.getBindingIdentifier(rest.name),
  9875. candidates: [],
  9876. name: rest.name,
  9877. deopted: false
  9878. };
  9879. path.traverse(memberExpressionOptimisationVisitor, state);
  9880. if (!state.deopted && !state.references.length) {
  9881. for (var _iterator = state.candidates, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  9882. var _ref3;
  9883. if (_isArray) {
  9884. if (_i >= _iterator.length) break;
  9885. _ref3 = _iterator[_i++];
  9886. } else {
  9887. _i = _iterator.next();
  9888. if (_i.done) break;
  9889. _ref3 = _i.value;
  9890. }
  9891. var _ref4 = _ref3;
  9892. var _path = _ref4.path,
  9893. cause = _ref4.cause;
  9894. switch (cause) {
  9895. case "indexGetter":
  9896. optimiseIndexGetter(_path, argsId, state.offset);
  9897. break;
  9898. case "lengthGetter":
  9899. optimiseLengthGetter(_path, argsId, state.offset);
  9900. break;
  9901. default:
  9902. _path.replaceWith(argsId);
  9903. }
  9904. }
  9905. return;
  9906. }
  9907. state.references = state.references.concat(state.candidates.map(function (_ref5) {
  9908. var path = _ref5.path;
  9909. return path;
  9910. }));
  9911. state.deopted = state.deopted || !!node.shadow;
  9912. var start = t.numericLiteral(node.params.length);
  9913. var key = scope.generateUidIdentifier("key");
  9914. var len = scope.generateUidIdentifier("len");
  9915. var arrKey = key;
  9916. var arrLen = len;
  9917. if (node.params.length) {
  9918. arrKey = t.binaryExpression("-", key, start);
  9919. arrLen = t.conditionalExpression(t.binaryExpression(">", len, start), t.binaryExpression("-", len, start), t.numericLiteral(0));
  9920. }
  9921. var loop = buildRest({
  9922. ARGUMENTS: argsId,
  9923. ARRAY_KEY: arrKey,
  9924. ARRAY_LEN: arrLen,
  9925. START: start,
  9926. ARRAY: rest,
  9927. KEY: key,
  9928. LEN: len
  9929. });
  9930. if (state.deopted) {
  9931. loop._blockHoist = node.params.length + 1;
  9932. node.body.body.unshift(loop);
  9933. } else {
  9934. loop._blockHoist = 1;
  9935. var target = path.getEarliestCommonAncestorFrom(state.references).getStatementParent();
  9936. target.findParent(function (path) {
  9937. if (path.isLoop()) {
  9938. target = path;
  9939. } else {
  9940. return path.isFunction();
  9941. }
  9942. });
  9943. target.insertBefore(loop);
  9944. }
  9945. }
  9946. };
  9947. },{"babel-runtime/core-js/get-iterator":95,"babel-template":114,"babel-types":151}],86:[function(require,module,exports){
  9948. "use strict";
  9949. exports.__esModule = true;
  9950. exports.default = function () {
  9951. return {
  9952. visitor: {
  9953. ObjectMethod: function ObjectMethod(path) {
  9954. var node = path.node;
  9955. if (node.kind === "method") {
  9956. var func = t.functionExpression(null, node.params, node.body, node.generator, node.async);
  9957. func.returnType = node.returnType;
  9958. path.replaceWith(t.objectProperty(node.key, func, node.computed));
  9959. }
  9960. },
  9961. ObjectProperty: function ObjectProperty(_ref) {
  9962. var node = _ref.node;
  9963. if (node.shorthand) {
  9964. node.shorthand = false;
  9965. }
  9966. }
  9967. }
  9968. };
  9969. };
  9970. var _babelTypes = require("babel-types");
  9971. var t = _interopRequireWildcard(_babelTypes);
  9972. 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; } }
  9973. module.exports = exports["default"];
  9974. },{"babel-types":151}],87:[function(require,module,exports){
  9975. "use strict";
  9976. exports.__esModule = true;
  9977. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  9978. var _getIterator3 = _interopRequireDefault(_getIterator2);
  9979. exports.default = function (_ref) {
  9980. var t = _ref.types;
  9981. function getSpreadLiteral(spread, scope, state) {
  9982. if (state.opts.loose && !t.isIdentifier(spread.argument, { name: "arguments" })) {
  9983. return spread.argument;
  9984. } else {
  9985. return scope.toArray(spread.argument, true);
  9986. }
  9987. }
  9988. function hasSpread(nodes) {
  9989. for (var i = 0; i < nodes.length; i++) {
  9990. if (t.isSpreadElement(nodes[i])) {
  9991. return true;
  9992. }
  9993. }
  9994. return false;
  9995. }
  9996. function build(props, scope, state) {
  9997. var nodes = [];
  9998. var _props = [];
  9999. function push() {
  10000. if (!_props.length) return;
  10001. nodes.push(t.arrayExpression(_props));
  10002. _props = [];
  10003. }
  10004. for (var _iterator = props, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  10005. var _ref2;
  10006. if (_isArray) {
  10007. if (_i >= _iterator.length) break;
  10008. _ref2 = _iterator[_i++];
  10009. } else {
  10010. _i = _iterator.next();
  10011. if (_i.done) break;
  10012. _ref2 = _i.value;
  10013. }
  10014. var prop = _ref2;
  10015. if (t.isSpreadElement(prop)) {
  10016. push();
  10017. nodes.push(getSpreadLiteral(prop, scope, state));
  10018. } else {
  10019. _props.push(prop);
  10020. }
  10021. }
  10022. push();
  10023. return nodes;
  10024. }
  10025. return {
  10026. visitor: {
  10027. ArrayExpression: function ArrayExpression(path, state) {
  10028. var node = path.node,
  10029. scope = path.scope;
  10030. var elements = node.elements;
  10031. if (!hasSpread(elements)) return;
  10032. var nodes = build(elements, scope, state);
  10033. var first = nodes.shift();
  10034. if (!t.isArrayExpression(first)) {
  10035. nodes.unshift(first);
  10036. first = t.arrayExpression([]);
  10037. }
  10038. path.replaceWith(t.callExpression(t.memberExpression(first, t.identifier("concat")), nodes));
  10039. },
  10040. CallExpression: function CallExpression(path, state) {
  10041. var node = path.node,
  10042. scope = path.scope;
  10043. var args = node.arguments;
  10044. if (!hasSpread(args)) return;
  10045. var calleePath = path.get("callee");
  10046. if (calleePath.isSuper()) return;
  10047. var contextLiteral = t.identifier("undefined");
  10048. node.arguments = [];
  10049. var nodes = void 0;
  10050. if (args.length === 1 && args[0].argument.name === "arguments") {
  10051. nodes = [args[0].argument];
  10052. } else {
  10053. nodes = build(args, scope, state);
  10054. }
  10055. var first = nodes.shift();
  10056. if (nodes.length) {
  10057. node.arguments.push(t.callExpression(t.memberExpression(first, t.identifier("concat")), nodes));
  10058. } else {
  10059. node.arguments.push(first);
  10060. }
  10061. var callee = node.callee;
  10062. if (calleePath.isMemberExpression()) {
  10063. var temp = scope.maybeGenerateMemoised(callee.object);
  10064. if (temp) {
  10065. callee.object = t.assignmentExpression("=", temp, callee.object);
  10066. contextLiteral = temp;
  10067. } else {
  10068. contextLiteral = callee.object;
  10069. }
  10070. t.appendToMemberExpression(callee, t.identifier("apply"));
  10071. } else {
  10072. node.callee = t.memberExpression(node.callee, t.identifier("apply"));
  10073. }
  10074. if (t.isSuper(contextLiteral)) {
  10075. contextLiteral = t.thisExpression();
  10076. }
  10077. node.arguments.unshift(contextLiteral);
  10078. },
  10079. NewExpression: function NewExpression(path, state) {
  10080. var node = path.node,
  10081. scope = path.scope;
  10082. var args = node.arguments;
  10083. if (!hasSpread(args)) return;
  10084. var nodes = build(args, scope, state);
  10085. var context = t.arrayExpression([t.nullLiteral()]);
  10086. args = t.callExpression(t.memberExpression(context, t.identifier("concat")), nodes);
  10087. path.replaceWith(t.newExpression(t.callExpression(t.memberExpression(t.memberExpression(t.memberExpression(t.identifier("Function"), t.identifier("prototype")), t.identifier("bind")), t.identifier("apply")), [node.callee, args]), []));
  10088. }
  10089. }
  10090. };
  10091. };
  10092. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10093. module.exports = exports["default"];
  10094. },{"babel-runtime/core-js/get-iterator":95}],88:[function(require,module,exports){
  10095. "use strict";
  10096. exports.__esModule = true;
  10097. exports.default = function () {
  10098. return {
  10099. visitor: {
  10100. RegExpLiteral: function RegExpLiteral(path) {
  10101. var node = path.node;
  10102. if (!regex.is(node, "y")) return;
  10103. path.replaceWith(t.newExpression(t.identifier("RegExp"), [t.stringLiteral(node.pattern), t.stringLiteral(node.flags)]));
  10104. }
  10105. }
  10106. };
  10107. };
  10108. var _babelHelperRegex = require("babel-helper-regex");
  10109. var regex = _interopRequireWildcard(_babelHelperRegex);
  10110. var _babelTypes = require("babel-types");
  10111. var t = _interopRequireWildcard(_babelTypes);
  10112. 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; } }
  10113. module.exports = exports["default"];
  10114. },{"babel-helper-regex":57,"babel-types":151}],89:[function(require,module,exports){
  10115. "use strict";
  10116. exports.__esModule = true;
  10117. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  10118. var _getIterator3 = _interopRequireDefault(_getIterator2);
  10119. exports.default = function (_ref) {
  10120. var t = _ref.types;
  10121. function isString(node) {
  10122. return t.isLiteral(node) && typeof node.value === "string";
  10123. }
  10124. function buildBinaryExpression(left, right) {
  10125. return t.binaryExpression("+", left, right);
  10126. }
  10127. return {
  10128. visitor: {
  10129. TaggedTemplateExpression: function TaggedTemplateExpression(path, state) {
  10130. var node = path.node;
  10131. var quasi = node.quasi;
  10132. var args = [];
  10133. var strings = [];
  10134. var raw = [];
  10135. for (var _iterator = quasi.quasis, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  10136. var _ref2;
  10137. if (_isArray) {
  10138. if (_i >= _iterator.length) break;
  10139. _ref2 = _iterator[_i++];
  10140. } else {
  10141. _i = _iterator.next();
  10142. if (_i.done) break;
  10143. _ref2 = _i.value;
  10144. }
  10145. var elem = _ref2;
  10146. strings.push(t.stringLiteral(elem.value.cooked));
  10147. raw.push(t.stringLiteral(elem.value.raw));
  10148. }
  10149. strings = t.arrayExpression(strings);
  10150. raw = t.arrayExpression(raw);
  10151. var templateName = "taggedTemplateLiteral";
  10152. if (state.opts.loose) templateName += "Loose";
  10153. var templateObject = state.file.addTemplateObject(templateName, strings, raw);
  10154. args.push(templateObject);
  10155. args = args.concat(quasi.expressions);
  10156. path.replaceWith(t.callExpression(node.tag, args));
  10157. },
  10158. TemplateLiteral: function TemplateLiteral(path, state) {
  10159. var nodes = [];
  10160. var expressions = path.get("expressions");
  10161. for (var _iterator2 = path.node.quasis, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  10162. var _ref3;
  10163. if (_isArray2) {
  10164. if (_i2 >= _iterator2.length) break;
  10165. _ref3 = _iterator2[_i2++];
  10166. } else {
  10167. _i2 = _iterator2.next();
  10168. if (_i2.done) break;
  10169. _ref3 = _i2.value;
  10170. }
  10171. var elem = _ref3;
  10172. nodes.push(t.stringLiteral(elem.value.cooked));
  10173. var expr = expressions.shift();
  10174. if (expr) {
  10175. if (state.opts.spec && !expr.isBaseType("string") && !expr.isBaseType("number")) {
  10176. nodes.push(t.callExpression(t.identifier("String"), [expr.node]));
  10177. } else {
  10178. nodes.push(expr.node);
  10179. }
  10180. }
  10181. }
  10182. nodes = nodes.filter(function (n) {
  10183. return !t.isLiteral(n, { value: "" });
  10184. });
  10185. if (!isString(nodes[0]) && !isString(nodes[1])) {
  10186. nodes.unshift(t.stringLiteral(""));
  10187. }
  10188. if (nodes.length > 1) {
  10189. var root = buildBinaryExpression(nodes.shift(), nodes.shift());
  10190. for (var _iterator3 = nodes, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) {
  10191. var _ref4;
  10192. if (_isArray3) {
  10193. if (_i3 >= _iterator3.length) break;
  10194. _ref4 = _iterator3[_i3++];
  10195. } else {
  10196. _i3 = _iterator3.next();
  10197. if (_i3.done) break;
  10198. _ref4 = _i3.value;
  10199. }
  10200. var node = _ref4;
  10201. root = buildBinaryExpression(root, node);
  10202. }
  10203. path.replaceWith(root);
  10204. } else {
  10205. path.replaceWith(nodes[0]);
  10206. }
  10207. }
  10208. }
  10209. };
  10210. };
  10211. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10212. module.exports = exports["default"];
  10213. },{"babel-runtime/core-js/get-iterator":95}],90:[function(require,module,exports){
  10214. "use strict";
  10215. exports.__esModule = true;
  10216. var _symbol = require("babel-runtime/core-js/symbol");
  10217. var _symbol2 = _interopRequireDefault(_symbol);
  10218. exports.default = function (_ref) {
  10219. var t = _ref.types;
  10220. var IGNORE = (0, _symbol2.default)();
  10221. return {
  10222. visitor: {
  10223. Scope: function Scope(_ref2) {
  10224. var scope = _ref2.scope;
  10225. if (!scope.getBinding("Symbol")) {
  10226. return;
  10227. }
  10228. scope.rename("Symbol");
  10229. },
  10230. UnaryExpression: function UnaryExpression(path) {
  10231. var node = path.node,
  10232. parent = path.parent;
  10233. if (node[IGNORE]) return;
  10234. if (path.find(function (path) {
  10235. return path.node && !!path.node._generated;
  10236. })) return;
  10237. if (path.parentPath.isBinaryExpression() && t.EQUALITY_BINARY_OPERATORS.indexOf(parent.operator) >= 0) {
  10238. var opposite = path.getOpposite();
  10239. if (opposite.isLiteral() && opposite.node.value !== "symbol" && opposite.node.value !== "object") {
  10240. return;
  10241. }
  10242. }
  10243. if (node.operator === "typeof") {
  10244. var call = t.callExpression(this.addHelper("typeof"), [node.argument]);
  10245. if (path.get("argument").isIdentifier()) {
  10246. var undefLiteral = t.stringLiteral("undefined");
  10247. var unary = t.unaryExpression("typeof", node.argument);
  10248. unary[IGNORE] = true;
  10249. path.replaceWith(t.conditionalExpression(t.binaryExpression("===", unary, undefLiteral), undefLiteral, call));
  10250. } else {
  10251. path.replaceWith(call);
  10252. }
  10253. }
  10254. }
  10255. }
  10256. };
  10257. };
  10258. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10259. module.exports = exports["default"];
  10260. },{"babel-runtime/core-js/symbol":104}],91:[function(require,module,exports){
  10261. "use strict";
  10262. exports.__esModule = true;
  10263. exports.default = function () {
  10264. return {
  10265. visitor: {
  10266. RegExpLiteral: function RegExpLiteral(_ref) {
  10267. var node = _ref.node;
  10268. if (!regex.is(node, "u")) return;
  10269. node.pattern = (0, _regexpuCore2.default)(node.pattern, node.flags);
  10270. regex.pullFlag(node, "u");
  10271. }
  10272. }
  10273. };
  10274. };
  10275. var _regexpuCore = require("regexpu-core");
  10276. var _regexpuCore2 = _interopRequireDefault(_regexpuCore);
  10277. var _babelHelperRegex = require("babel-helper-regex");
  10278. var regex = _interopRequireWildcard(_babelHelperRegex);
  10279. 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; } }
  10280. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10281. module.exports = exports["default"];
  10282. },{"babel-helper-regex":57,"regexpu-core":537}],92:[function(require,module,exports){
  10283. "use strict";
  10284. module.exports = require("regenerator-transform");
  10285. },{"regenerator-transform":529}],93:[function(require,module,exports){
  10286. "use strict";
  10287. exports.__esModule = true;
  10288. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  10289. var _getIterator3 = _interopRequireDefault(_getIterator2);
  10290. exports.default = function () {
  10291. return {
  10292. visitor: {
  10293. Program: function Program(path, state) {
  10294. if (state.opts.strict === false || state.opts.strictMode === false) return;
  10295. var node = path.node;
  10296. for (var _iterator = node.directives, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  10297. var _ref;
  10298. if (_isArray) {
  10299. if (_i >= _iterator.length) break;
  10300. _ref = _iterator[_i++];
  10301. } else {
  10302. _i = _iterator.next();
  10303. if (_i.done) break;
  10304. _ref = _i.value;
  10305. }
  10306. var directive = _ref;
  10307. if (directive.value.value === "use strict") return;
  10308. }
  10309. path.unshiftContainer("directives", t.directive(t.directiveLiteral("use strict")));
  10310. }
  10311. }
  10312. };
  10313. };
  10314. var _babelTypes = require("babel-types");
  10315. var t = _interopRequireWildcard(_babelTypes);
  10316. 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; } }
  10317. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10318. module.exports = exports["default"];
  10319. },{"babel-runtime/core-js/get-iterator":95,"babel-types":151}],94:[function(require,module,exports){
  10320. "use strict";
  10321. exports.__esModule = true;
  10322. var _babelPluginTransformEs2015TemplateLiterals = require("babel-plugin-transform-es2015-template-literals");
  10323. var _babelPluginTransformEs2015TemplateLiterals2 = _interopRequireDefault(_babelPluginTransformEs2015TemplateLiterals);
  10324. var _babelPluginTransformEs2015Literals = require("babel-plugin-transform-es2015-literals");
  10325. var _babelPluginTransformEs2015Literals2 = _interopRequireDefault(_babelPluginTransformEs2015Literals);
  10326. var _babelPluginTransformEs2015FunctionName = require("babel-plugin-transform-es2015-function-name");
  10327. var _babelPluginTransformEs2015FunctionName2 = _interopRequireDefault(_babelPluginTransformEs2015FunctionName);
  10328. var _babelPluginTransformEs2015ArrowFunctions = require("babel-plugin-transform-es2015-arrow-functions");
  10329. var _babelPluginTransformEs2015ArrowFunctions2 = _interopRequireDefault(_babelPluginTransformEs2015ArrowFunctions);
  10330. var _babelPluginTransformEs2015BlockScopedFunctions = require("babel-plugin-transform-es2015-block-scoped-functions");
  10331. var _babelPluginTransformEs2015BlockScopedFunctions2 = _interopRequireDefault(_babelPluginTransformEs2015BlockScopedFunctions);
  10332. var _babelPluginTransformEs2015Classes = require("babel-plugin-transform-es2015-classes");
  10333. var _babelPluginTransformEs2015Classes2 = _interopRequireDefault(_babelPluginTransformEs2015Classes);
  10334. var _babelPluginTransformEs2015ObjectSuper = require("babel-plugin-transform-es2015-object-super");
  10335. var _babelPluginTransformEs2015ObjectSuper2 = _interopRequireDefault(_babelPluginTransformEs2015ObjectSuper);
  10336. var _babelPluginTransformEs2015ShorthandProperties = require("babel-plugin-transform-es2015-shorthand-properties");
  10337. var _babelPluginTransformEs2015ShorthandProperties2 = _interopRequireDefault(_babelPluginTransformEs2015ShorthandProperties);
  10338. var _babelPluginTransformEs2015DuplicateKeys = require("babel-plugin-transform-es2015-duplicate-keys");
  10339. var _babelPluginTransformEs2015DuplicateKeys2 = _interopRequireDefault(_babelPluginTransformEs2015DuplicateKeys);
  10340. var _babelPluginTransformEs2015ComputedProperties = require("babel-plugin-transform-es2015-computed-properties");
  10341. var _babelPluginTransformEs2015ComputedProperties2 = _interopRequireDefault(_babelPluginTransformEs2015ComputedProperties);
  10342. var _babelPluginTransformEs2015ForOf = require("babel-plugin-transform-es2015-for-of");
  10343. var _babelPluginTransformEs2015ForOf2 = _interopRequireDefault(_babelPluginTransformEs2015ForOf);
  10344. var _babelPluginTransformEs2015StickyRegex = require("babel-plugin-transform-es2015-sticky-regex");
  10345. var _babelPluginTransformEs2015StickyRegex2 = _interopRequireDefault(_babelPluginTransformEs2015StickyRegex);
  10346. var _babelPluginTransformEs2015UnicodeRegex = require("babel-plugin-transform-es2015-unicode-regex");
  10347. var _babelPluginTransformEs2015UnicodeRegex2 = _interopRequireDefault(_babelPluginTransformEs2015UnicodeRegex);
  10348. var _babelPluginCheckEs2015Constants = require("babel-plugin-check-es2015-constants");
  10349. var _babelPluginCheckEs2015Constants2 = _interopRequireDefault(_babelPluginCheckEs2015Constants);
  10350. var _babelPluginTransformEs2015Spread = require("babel-plugin-transform-es2015-spread");
  10351. var _babelPluginTransformEs2015Spread2 = _interopRequireDefault(_babelPluginTransformEs2015Spread);
  10352. var _babelPluginTransformEs2015Parameters = require("babel-plugin-transform-es2015-parameters");
  10353. var _babelPluginTransformEs2015Parameters2 = _interopRequireDefault(_babelPluginTransformEs2015Parameters);
  10354. var _babelPluginTransformEs2015Destructuring = require("babel-plugin-transform-es2015-destructuring");
  10355. var _babelPluginTransformEs2015Destructuring2 = _interopRequireDefault(_babelPluginTransformEs2015Destructuring);
  10356. var _babelPluginTransformEs2015BlockScoping = require("babel-plugin-transform-es2015-block-scoping");
  10357. var _babelPluginTransformEs2015BlockScoping2 = _interopRequireDefault(_babelPluginTransformEs2015BlockScoping);
  10358. var _babelPluginTransformEs2015TypeofSymbol = require("babel-plugin-transform-es2015-typeof-symbol");
  10359. var _babelPluginTransformEs2015TypeofSymbol2 = _interopRequireDefault(_babelPluginTransformEs2015TypeofSymbol);
  10360. var _babelPluginTransformEs2015ModulesCommonjs = require("babel-plugin-transform-es2015-modules-commonjs");
  10361. var _babelPluginTransformEs2015ModulesCommonjs2 = _interopRequireDefault(_babelPluginTransformEs2015ModulesCommonjs);
  10362. var _babelPluginTransformEs2015ModulesSystemjs = require("babel-plugin-transform-es2015-modules-systemjs");
  10363. var _babelPluginTransformEs2015ModulesSystemjs2 = _interopRequireDefault(_babelPluginTransformEs2015ModulesSystemjs);
  10364. var _babelPluginTransformEs2015ModulesAmd = require("babel-plugin-transform-es2015-modules-amd");
  10365. var _babelPluginTransformEs2015ModulesAmd2 = _interopRequireDefault(_babelPluginTransformEs2015ModulesAmd);
  10366. var _babelPluginTransformEs2015ModulesUmd = require("babel-plugin-transform-es2015-modules-umd");
  10367. var _babelPluginTransformEs2015ModulesUmd2 = _interopRequireDefault(_babelPluginTransformEs2015ModulesUmd);
  10368. var _babelPluginTransformRegenerator = require("babel-plugin-transform-regenerator");
  10369. var _babelPluginTransformRegenerator2 = _interopRequireDefault(_babelPluginTransformRegenerator);
  10370. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10371. function preset(context) {
  10372. var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  10373. var moduleTypes = ["commonjs", "amd", "umd", "systemjs"];
  10374. var loose = false;
  10375. var modules = "commonjs";
  10376. var spec = false;
  10377. if (opts !== undefined) {
  10378. if (opts.loose !== undefined) loose = opts.loose;
  10379. if (opts.modules !== undefined) modules = opts.modules;
  10380. if (opts.spec !== undefined) spec = opts.spec;
  10381. }
  10382. if (typeof loose !== "boolean") throw new Error("Preset es2015 'loose' option must be a boolean.");
  10383. if (typeof spec !== "boolean") throw new Error("Preset es2015 'spec' option must be a boolean.");
  10384. if (modules !== false && moduleTypes.indexOf(modules) === -1) {
  10385. throw new Error("Preset es2015 'modules' option must be 'false' to indicate no modules\n" + "or a module type which be be one of: 'commonjs' (default), 'amd', 'umd', 'systemjs'");
  10386. }
  10387. var optsLoose = { loose: loose };
  10388. return {
  10389. plugins: [[_babelPluginTransformEs2015TemplateLiterals2.default, { loose: loose, spec: spec }], _babelPluginTransformEs2015Literals2.default, _babelPluginTransformEs2015FunctionName2.default, [_babelPluginTransformEs2015ArrowFunctions2.default, { spec: spec }], _babelPluginTransformEs2015BlockScopedFunctions2.default, [_babelPluginTransformEs2015Classes2.default, optsLoose], _babelPluginTransformEs2015ObjectSuper2.default, _babelPluginTransformEs2015ShorthandProperties2.default, _babelPluginTransformEs2015DuplicateKeys2.default, [_babelPluginTransformEs2015ComputedProperties2.default, optsLoose], [_babelPluginTransformEs2015ForOf2.default, optsLoose], _babelPluginTransformEs2015StickyRegex2.default, _babelPluginTransformEs2015UnicodeRegex2.default, _babelPluginCheckEs2015Constants2.default, [_babelPluginTransformEs2015Spread2.default, optsLoose], _babelPluginTransformEs2015Parameters2.default, [_babelPluginTransformEs2015Destructuring2.default, optsLoose], _babelPluginTransformEs2015BlockScoping2.default, _babelPluginTransformEs2015TypeofSymbol2.default, modules === "commonjs" && [_babelPluginTransformEs2015ModulesCommonjs2.default, optsLoose], modules === "systemjs" && [_babelPluginTransformEs2015ModulesSystemjs2.default, optsLoose], modules === "amd" && [_babelPluginTransformEs2015ModulesAmd2.default, optsLoose], modules === "umd" && [_babelPluginTransformEs2015ModulesUmd2.default, optsLoose], [_babelPluginTransformRegenerator2.default, { async: false, asyncGenerators: false }]].filter(Boolean) };
  10390. }
  10391. var oldConfig = preset({});
  10392. exports.default = oldConfig;
  10393. Object.defineProperty(oldConfig, "buildPreset", {
  10394. configurable: true,
  10395. writable: true,
  10396. enumerable: false,
  10397. value: preset
  10398. });
  10399. module.exports = exports["default"];
  10400. },{"babel-plugin-check-es2015-constants":62,"babel-plugin-transform-es2015-arrow-functions":64,"babel-plugin-transform-es2015-block-scoped-functions":65,"babel-plugin-transform-es2015-block-scoping":66,"babel-plugin-transform-es2015-classes":68,"babel-plugin-transform-es2015-computed-properties":71,"babel-plugin-transform-es2015-destructuring":72,"babel-plugin-transform-es2015-duplicate-keys":73,"babel-plugin-transform-es2015-for-of":74,"babel-plugin-transform-es2015-function-name":75,"babel-plugin-transform-es2015-literals":76,"babel-plugin-transform-es2015-modules-amd":77,"babel-plugin-transform-es2015-modules-commonjs":78,"babel-plugin-transform-es2015-modules-systemjs":79,"babel-plugin-transform-es2015-modules-umd":80,"babel-plugin-transform-es2015-object-super":81,"babel-plugin-transform-es2015-parameters":84,"babel-plugin-transform-es2015-shorthand-properties":86,"babel-plugin-transform-es2015-spread":87,"babel-plugin-transform-es2015-sticky-regex":88,"babel-plugin-transform-es2015-template-literals":89,"babel-plugin-transform-es2015-typeof-symbol":90,"babel-plugin-transform-es2015-unicode-regex":91,"babel-plugin-transform-regenerator":92}],95:[function(require,module,exports){
  10401. module.exports = { "default": require("core-js/library/fn/get-iterator"), __esModule: true };
  10402. },{"core-js/library/fn/get-iterator":164}],96:[function(require,module,exports){
  10403. module.exports = { "default": require("core-js/library/fn/json/stringify"), __esModule: true };
  10404. },{"core-js/library/fn/json/stringify":165}],97:[function(require,module,exports){
  10405. module.exports = { "default": require("core-js/library/fn/map"), __esModule: true };
  10406. },{"core-js/library/fn/map":166}],98:[function(require,module,exports){
  10407. module.exports = { "default": require("core-js/library/fn/number/max-safe-integer"), __esModule: true };
  10408. },{"core-js/library/fn/number/max-safe-integer":167}],99:[function(require,module,exports){
  10409. module.exports = { "default": require("core-js/library/fn/object/assign"), __esModule: true };
  10410. },{"core-js/library/fn/object/assign":168}],100:[function(require,module,exports){
  10411. module.exports = { "default": require("core-js/library/fn/object/create"), __esModule: true };
  10412. },{"core-js/library/fn/object/create":169}],101:[function(require,module,exports){
  10413. module.exports = { "default": require("core-js/library/fn/object/get-own-property-symbols"), __esModule: true };
  10414. },{"core-js/library/fn/object/get-own-property-symbols":170}],102:[function(require,module,exports){
  10415. module.exports = { "default": require("core-js/library/fn/object/keys"), __esModule: true };
  10416. },{"core-js/library/fn/object/keys":171}],103:[function(require,module,exports){
  10417. module.exports = { "default": require("core-js/library/fn/object/set-prototype-of"), __esModule: true };
  10418. },{"core-js/library/fn/object/set-prototype-of":172}],104:[function(require,module,exports){
  10419. module.exports = { "default": require("core-js/library/fn/symbol"), __esModule: true };
  10420. },{"core-js/library/fn/symbol":174}],105:[function(require,module,exports){
  10421. module.exports = { "default": require("core-js/library/fn/symbol/for"), __esModule: true };
  10422. },{"core-js/library/fn/symbol/for":173}],106:[function(require,module,exports){
  10423. module.exports = { "default": require("core-js/library/fn/symbol/iterator"), __esModule: true };
  10424. },{"core-js/library/fn/symbol/iterator":175}],107:[function(require,module,exports){
  10425. module.exports = { "default": require("core-js/library/fn/weak-map"), __esModule: true };
  10426. },{"core-js/library/fn/weak-map":176}],108:[function(require,module,exports){
  10427. module.exports = { "default": require("core-js/library/fn/weak-set"), __esModule: true };
  10428. },{"core-js/library/fn/weak-set":177}],109:[function(require,module,exports){
  10429. "use strict";
  10430. exports.__esModule = true;
  10431. exports.default = function (instance, Constructor) {
  10432. if (!(instance instanceof Constructor)) {
  10433. throw new TypeError("Cannot call a class as a function");
  10434. }
  10435. };
  10436. },{}],110:[function(require,module,exports){
  10437. "use strict";
  10438. exports.__esModule = true;
  10439. var _setPrototypeOf = require("../core-js/object/set-prototype-of");
  10440. var _setPrototypeOf2 = _interopRequireDefault(_setPrototypeOf);
  10441. var _create = require("../core-js/object/create");
  10442. var _create2 = _interopRequireDefault(_create);
  10443. var _typeof2 = require("../helpers/typeof");
  10444. var _typeof3 = _interopRequireDefault(_typeof2);
  10445. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10446. exports.default = function (subClass, superClass) {
  10447. if (typeof superClass !== "function" && superClass !== null) {
  10448. throw new TypeError("Super expression must either be null or a function, not " + (typeof superClass === "undefined" ? "undefined" : (0, _typeof3.default)(superClass)));
  10449. }
  10450. subClass.prototype = (0, _create2.default)(superClass && superClass.prototype, {
  10451. constructor: {
  10452. value: subClass,
  10453. enumerable: false,
  10454. writable: true,
  10455. configurable: true
  10456. }
  10457. });
  10458. if (superClass) _setPrototypeOf2.default ? (0, _setPrototypeOf2.default)(subClass, superClass) : subClass.__proto__ = superClass;
  10459. };
  10460. },{"../core-js/object/create":100,"../core-js/object/set-prototype-of":103,"../helpers/typeof":113}],111:[function(require,module,exports){
  10461. "use strict";
  10462. exports.__esModule = true;
  10463. exports.default = function (obj, keys) {
  10464. var target = {};
  10465. for (var i in obj) {
  10466. if (keys.indexOf(i) >= 0) continue;
  10467. if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
  10468. target[i] = obj[i];
  10469. }
  10470. return target;
  10471. };
  10472. },{}],112:[function(require,module,exports){
  10473. "use strict";
  10474. exports.__esModule = true;
  10475. var _typeof2 = require("../helpers/typeof");
  10476. var _typeof3 = _interopRequireDefault(_typeof2);
  10477. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10478. exports.default = function (self, call) {
  10479. if (!self) {
  10480. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  10481. }
  10482. return call && ((typeof call === "undefined" ? "undefined" : (0, _typeof3.default)(call)) === "object" || typeof call === "function") ? call : self;
  10483. };
  10484. },{"../helpers/typeof":113}],113:[function(require,module,exports){
  10485. "use strict";
  10486. exports.__esModule = true;
  10487. var _iterator = require("../core-js/symbol/iterator");
  10488. var _iterator2 = _interopRequireDefault(_iterator);
  10489. var _symbol = require("../core-js/symbol");
  10490. var _symbol2 = _interopRequireDefault(_symbol);
  10491. 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; };
  10492. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10493. exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) {
  10494. return typeof obj === "undefined" ? "undefined" : _typeof(obj);
  10495. } : function (obj) {
  10496. return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
  10497. };
  10498. },{"../core-js/symbol":104,"../core-js/symbol/iterator":106}],114:[function(require,module,exports){
  10499. "use strict";
  10500. exports.__esModule = true;
  10501. var _symbol = require("babel-runtime/core-js/symbol");
  10502. var _symbol2 = _interopRequireDefault(_symbol);
  10503. exports.default = function (code, opts) {
  10504. var stack = void 0;
  10505. try {
  10506. throw new Error();
  10507. } catch (error) {
  10508. if (error.stack) {
  10509. stack = error.stack.split("\n").slice(1).join("\n");
  10510. }
  10511. }
  10512. opts = (0, _assign2.default)({
  10513. allowReturnOutsideFunction: true,
  10514. allowSuperOutsideMethod: true,
  10515. preserveComments: false
  10516. }, opts);
  10517. var _getAst = function getAst() {
  10518. var ast = void 0;
  10519. try {
  10520. ast = babylon.parse(code, opts);
  10521. ast = _babelTraverse2.default.removeProperties(ast, { preserveComments: opts.preserveComments });
  10522. _babelTraverse2.default.cheap(ast, function (node) {
  10523. node[FROM_TEMPLATE] = true;
  10524. });
  10525. } catch (err) {
  10526. err.stack = err.stack + "from\n" + stack;
  10527. throw err;
  10528. }
  10529. _getAst = function getAst() {
  10530. return ast;
  10531. };
  10532. return ast;
  10533. };
  10534. return function () {
  10535. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  10536. args[_key] = arguments[_key];
  10537. }
  10538. return useTemplate(_getAst(), args);
  10539. };
  10540. };
  10541. var _cloneDeep = require("lodash/cloneDeep");
  10542. var _cloneDeep2 = _interopRequireDefault(_cloneDeep);
  10543. var _assign = require("lodash/assign");
  10544. var _assign2 = _interopRequireDefault(_assign);
  10545. var _has = require("lodash/has");
  10546. var _has2 = _interopRequireDefault(_has);
  10547. var _babelTraverse = require("babel-traverse");
  10548. var _babelTraverse2 = _interopRequireDefault(_babelTraverse);
  10549. var _babylon = require("babylon");
  10550. var babylon = _interopRequireWildcard(_babylon);
  10551. var _babelTypes = require("babel-types");
  10552. var t = _interopRequireWildcard(_babelTypes);
  10553. 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; } }
  10554. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10555. var FROM_TEMPLATE = "_fromTemplate";
  10556. var TEMPLATE_SKIP = (0, _symbol2.default)();
  10557. function useTemplate(ast, nodes) {
  10558. ast = (0, _cloneDeep2.default)(ast);
  10559. var _ast = ast,
  10560. program = _ast.program;
  10561. if (nodes.length) {
  10562. (0, _babelTraverse2.default)(ast, templateVisitor, null, nodes);
  10563. }
  10564. if (program.body.length > 1) {
  10565. return program.body;
  10566. } else {
  10567. return program.body[0];
  10568. }
  10569. }
  10570. var templateVisitor = {
  10571. noScope: true,
  10572. enter: function enter(path, args) {
  10573. var node = path.node;
  10574. if (node[TEMPLATE_SKIP]) return path.skip();
  10575. if (t.isExpressionStatement(node)) {
  10576. node = node.expression;
  10577. }
  10578. var replacement = void 0;
  10579. if (t.isIdentifier(node) && node[FROM_TEMPLATE]) {
  10580. if ((0, _has2.default)(args[0], node.name)) {
  10581. replacement = args[0][node.name];
  10582. } else if (node.name[0] === "$") {
  10583. var i = +node.name.slice(1);
  10584. if (args[i]) replacement = args[i];
  10585. }
  10586. }
  10587. if (replacement === null) {
  10588. path.remove();
  10589. }
  10590. if (replacement) {
  10591. replacement[TEMPLATE_SKIP] = true;
  10592. path.replaceInline(replacement);
  10593. }
  10594. },
  10595. exit: function exit(_ref) {
  10596. var node = _ref.node;
  10597. if (!node.loc) _babelTraverse2.default.clearNode(node);
  10598. }
  10599. };
  10600. module.exports = exports["default"];
  10601. },{"babel-runtime/core-js/symbol":104,"babel-traverse":118,"babel-types":151,"babylon":155,"lodash/assign":463,"lodash/cloneDeep":467,"lodash/has":479}],115:[function(require,module,exports){
  10602. "use strict";
  10603. exports.__esModule = true;
  10604. exports.scope = exports.path = undefined;
  10605. var _weakMap = require("babel-runtime/core-js/weak-map");
  10606. var _weakMap2 = _interopRequireDefault(_weakMap);
  10607. exports.clear = clear;
  10608. exports.clearPath = clearPath;
  10609. exports.clearScope = clearScope;
  10610. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10611. var path = exports.path = new _weakMap2.default();
  10612. var scope = exports.scope = new _weakMap2.default();
  10613. function clear() {
  10614. clearPath();
  10615. clearScope();
  10616. }
  10617. function clearPath() {
  10618. exports.path = path = new _weakMap2.default();
  10619. }
  10620. function clearScope() {
  10621. exports.scope = scope = new _weakMap2.default();
  10622. }
  10623. },{"babel-runtime/core-js/weak-map":107}],116:[function(require,module,exports){
  10624. (function (process){
  10625. "use strict";
  10626. exports.__esModule = true;
  10627. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  10628. var _getIterator3 = _interopRequireDefault(_getIterator2);
  10629. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  10630. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  10631. var _path2 = require("./path");
  10632. var _path3 = _interopRequireDefault(_path2);
  10633. var _babelTypes = require("babel-types");
  10634. var t = _interopRequireWildcard(_babelTypes);
  10635. 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; } }
  10636. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10637. var testing = process.env.NODE_ENV === "test";
  10638. var TraversalContext = function () {
  10639. function TraversalContext(scope, opts, state, parentPath) {
  10640. (0, _classCallCheck3.default)(this, TraversalContext);
  10641. this.queue = null;
  10642. this.parentPath = parentPath;
  10643. this.scope = scope;
  10644. this.state = state;
  10645. this.opts = opts;
  10646. }
  10647. TraversalContext.prototype.shouldVisit = function shouldVisit(node) {
  10648. var opts = this.opts;
  10649. if (opts.enter || opts.exit) return true;
  10650. if (opts[node.type]) return true;
  10651. var keys = t.VISITOR_KEYS[node.type];
  10652. if (!keys || !keys.length) return false;
  10653. for (var _iterator = keys, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  10654. var _ref;
  10655. if (_isArray) {
  10656. if (_i >= _iterator.length) break;
  10657. _ref = _iterator[_i++];
  10658. } else {
  10659. _i = _iterator.next();
  10660. if (_i.done) break;
  10661. _ref = _i.value;
  10662. }
  10663. var key = _ref;
  10664. if (node[key]) return true;
  10665. }
  10666. return false;
  10667. };
  10668. TraversalContext.prototype.create = function create(node, obj, key, listKey) {
  10669. return _path3.default.get({
  10670. parentPath: this.parentPath,
  10671. parent: node,
  10672. container: obj,
  10673. key: key,
  10674. listKey: listKey
  10675. });
  10676. };
  10677. TraversalContext.prototype.maybeQueue = function maybeQueue(path, notPriority) {
  10678. if (this.trap) {
  10679. throw new Error("Infinite cycle detected");
  10680. }
  10681. if (this.queue) {
  10682. if (notPriority) {
  10683. this.queue.push(path);
  10684. } else {
  10685. this.priorityQueue.push(path);
  10686. }
  10687. }
  10688. };
  10689. TraversalContext.prototype.visitMultiple = function visitMultiple(container, parent, listKey) {
  10690. if (container.length === 0) return false;
  10691. var queue = [];
  10692. for (var key = 0; key < container.length; key++) {
  10693. var node = container[key];
  10694. if (node && this.shouldVisit(node)) {
  10695. queue.push(this.create(parent, container, key, listKey));
  10696. }
  10697. }
  10698. return this.visitQueue(queue);
  10699. };
  10700. TraversalContext.prototype.visitSingle = function visitSingle(node, key) {
  10701. if (this.shouldVisit(node[key])) {
  10702. return this.visitQueue([this.create(node, node, key)]);
  10703. } else {
  10704. return false;
  10705. }
  10706. };
  10707. TraversalContext.prototype.visitQueue = function visitQueue(queue) {
  10708. this.queue = queue;
  10709. this.priorityQueue = [];
  10710. var visited = [];
  10711. var stop = false;
  10712. for (var _iterator2 = queue, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  10713. var _ref2;
  10714. if (_isArray2) {
  10715. if (_i2 >= _iterator2.length) break;
  10716. _ref2 = _iterator2[_i2++];
  10717. } else {
  10718. _i2 = _iterator2.next();
  10719. if (_i2.done) break;
  10720. _ref2 = _i2.value;
  10721. }
  10722. var path = _ref2;
  10723. path.resync();
  10724. if (path.contexts.length === 0 || path.contexts[path.contexts.length - 1] !== this) {
  10725. path.pushContext(this);
  10726. }
  10727. if (path.key === null) continue;
  10728. if (testing && queue.length >= 10000) {
  10729. this.trap = true;
  10730. }
  10731. if (visited.indexOf(path.node) >= 0) continue;
  10732. visited.push(path.node);
  10733. if (path.visit()) {
  10734. stop = true;
  10735. break;
  10736. }
  10737. if (this.priorityQueue.length) {
  10738. stop = this.visitQueue(this.priorityQueue);
  10739. this.priorityQueue = [];
  10740. this.queue = queue;
  10741. if (stop) break;
  10742. }
  10743. }
  10744. for (var _iterator3 = queue, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) {
  10745. var _ref3;
  10746. if (_isArray3) {
  10747. if (_i3 >= _iterator3.length) break;
  10748. _ref3 = _iterator3[_i3++];
  10749. } else {
  10750. _i3 = _iterator3.next();
  10751. if (_i3.done) break;
  10752. _ref3 = _i3.value;
  10753. }
  10754. var _path = _ref3;
  10755. _path.popContext();
  10756. }
  10757. this.queue = null;
  10758. return stop;
  10759. };
  10760. TraversalContext.prototype.visit = function visit(node, key) {
  10761. var nodes = node[key];
  10762. if (!nodes) return false;
  10763. if (Array.isArray(nodes)) {
  10764. return this.visitMultiple(nodes, node, key);
  10765. } else {
  10766. return this.visitSingle(node, key);
  10767. }
  10768. };
  10769. return TraversalContext;
  10770. }();
  10771. exports.default = TraversalContext;
  10772. module.exports = exports["default"];
  10773. }).call(this,require('_process'))
  10774. },{"./path":125,"_process":525,"babel-runtime/core-js/get-iterator":95,"babel-runtime/helpers/classCallCheck":109,"babel-types":151}],117:[function(require,module,exports){
  10775. "use strict";
  10776. exports.__esModule = true;
  10777. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  10778. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  10779. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10780. var Hub = function Hub(file, options) {
  10781. (0, _classCallCheck3.default)(this, Hub);
  10782. this.file = file;
  10783. this.options = options;
  10784. };
  10785. exports.default = Hub;
  10786. module.exports = exports["default"];
  10787. },{"babel-runtime/helpers/classCallCheck":109}],118:[function(require,module,exports){
  10788. "use strict";
  10789. exports.__esModule = true;
  10790. exports.visitors = exports.Hub = exports.Scope = exports.NodePath = undefined;
  10791. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  10792. var _getIterator3 = _interopRequireDefault(_getIterator2);
  10793. var _path = require("./path");
  10794. Object.defineProperty(exports, "NodePath", {
  10795. enumerable: true,
  10796. get: function get() {
  10797. return _interopRequireDefault(_path).default;
  10798. }
  10799. });
  10800. var _scope = require("./scope");
  10801. Object.defineProperty(exports, "Scope", {
  10802. enumerable: true,
  10803. get: function get() {
  10804. return _interopRequireDefault(_scope).default;
  10805. }
  10806. });
  10807. var _hub = require("./hub");
  10808. Object.defineProperty(exports, "Hub", {
  10809. enumerable: true,
  10810. get: function get() {
  10811. return _interopRequireDefault(_hub).default;
  10812. }
  10813. });
  10814. exports.default = traverse;
  10815. var _context = require("./context");
  10816. var _context2 = _interopRequireDefault(_context);
  10817. var _visitors = require("./visitors");
  10818. var visitors = _interopRequireWildcard(_visitors);
  10819. var _babelMessages = require("babel-messages");
  10820. var messages = _interopRequireWildcard(_babelMessages);
  10821. var _includes = require("lodash/includes");
  10822. var _includes2 = _interopRequireDefault(_includes);
  10823. var _babelTypes = require("babel-types");
  10824. var t = _interopRequireWildcard(_babelTypes);
  10825. var _cache = require("./cache");
  10826. var cache = _interopRequireWildcard(_cache);
  10827. 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; } }
  10828. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10829. exports.visitors = visitors;
  10830. function traverse(parent, opts, scope, state, parentPath) {
  10831. if (!parent) return;
  10832. if (!opts) opts = {};
  10833. if (!opts.noScope && !scope) {
  10834. if (parent.type !== "Program" && parent.type !== "File") {
  10835. throw new Error(messages.get("traverseNeedsParent", parent.type));
  10836. }
  10837. }
  10838. visitors.explode(opts);
  10839. traverse.node(parent, opts, scope, state, parentPath);
  10840. }
  10841. traverse.visitors = visitors;
  10842. traverse.verify = visitors.verify;
  10843. traverse.explode = visitors.explode;
  10844. traverse.NodePath = require("./path");
  10845. traverse.Scope = require("./scope");
  10846. traverse.Hub = require("./hub");
  10847. traverse.cheap = function (node, enter) {
  10848. return t.traverseFast(node, enter);
  10849. };
  10850. traverse.node = function (node, opts, scope, state, parentPath, skipKeys) {
  10851. var keys = t.VISITOR_KEYS[node.type];
  10852. if (!keys) return;
  10853. var context = new _context2.default(scope, opts, state, parentPath);
  10854. for (var _iterator = keys, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  10855. var _ref;
  10856. if (_isArray) {
  10857. if (_i >= _iterator.length) break;
  10858. _ref = _iterator[_i++];
  10859. } else {
  10860. _i = _iterator.next();
  10861. if (_i.done) break;
  10862. _ref = _i.value;
  10863. }
  10864. var key = _ref;
  10865. if (skipKeys && skipKeys[key]) continue;
  10866. if (context.visit(node, key)) return;
  10867. }
  10868. };
  10869. traverse.clearNode = function (node, opts) {
  10870. t.removeProperties(node, opts);
  10871. cache.path.delete(node);
  10872. };
  10873. traverse.removeProperties = function (tree, opts) {
  10874. t.traverseFast(tree, traverse.clearNode, opts);
  10875. return tree;
  10876. };
  10877. function hasBlacklistedType(path, state) {
  10878. if (path.node.type === state.type) {
  10879. state.has = true;
  10880. path.stop();
  10881. }
  10882. }
  10883. traverse.hasType = function (tree, scope, type, blacklistTypes) {
  10884. if ((0, _includes2.default)(blacklistTypes, tree.type)) return false;
  10885. if (tree.type === type) return true;
  10886. var state = {
  10887. has: false,
  10888. type: type
  10889. };
  10890. traverse(tree, {
  10891. blacklist: blacklistTypes,
  10892. enter: hasBlacklistedType
  10893. }, scope, state);
  10894. return state.has;
  10895. };
  10896. traverse.clearCache = function () {
  10897. cache.clear();
  10898. };
  10899. traverse.clearCache.clearPath = cache.clearPath;
  10900. traverse.clearCache.clearScope = cache.clearScope;
  10901. traverse.copyCache = function (source, destination) {
  10902. if (cache.path.has(source)) {
  10903. cache.path.set(destination, cache.path.get(source));
  10904. }
  10905. };
  10906. },{"./cache":115,"./context":116,"./hub":117,"./path":125,"./scope":137,"./visitors":139,"babel-messages":61,"babel-runtime/core-js/get-iterator":95,"babel-types":151,"lodash/includes":482}],119:[function(require,module,exports){
  10907. "use strict";
  10908. exports.__esModule = true;
  10909. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  10910. var _getIterator3 = _interopRequireDefault(_getIterator2);
  10911. exports.findParent = findParent;
  10912. exports.find = find;
  10913. exports.getFunctionParent = getFunctionParent;
  10914. exports.getStatementParent = getStatementParent;
  10915. exports.getEarliestCommonAncestorFrom = getEarliestCommonAncestorFrom;
  10916. exports.getDeepestCommonAncestorFrom = getDeepestCommonAncestorFrom;
  10917. exports.getAncestry = getAncestry;
  10918. exports.isAncestor = isAncestor;
  10919. exports.isDescendant = isDescendant;
  10920. exports.inType = inType;
  10921. exports.inShadow = inShadow;
  10922. var _babelTypes = require("babel-types");
  10923. var t = _interopRequireWildcard(_babelTypes);
  10924. var _index = require("./index");
  10925. var _index2 = _interopRequireDefault(_index);
  10926. 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; } }
  10927. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10928. function findParent(callback) {
  10929. var path = this;
  10930. while (path = path.parentPath) {
  10931. if (callback(path)) return path;
  10932. }
  10933. return null;
  10934. }
  10935. function find(callback) {
  10936. var path = this;
  10937. do {
  10938. if (callback(path)) return path;
  10939. } while (path = path.parentPath);
  10940. return null;
  10941. }
  10942. function getFunctionParent() {
  10943. return this.findParent(function (path) {
  10944. return path.isFunction() || path.isProgram();
  10945. });
  10946. }
  10947. function getStatementParent() {
  10948. var path = this;
  10949. do {
  10950. if (Array.isArray(path.container)) {
  10951. return path;
  10952. }
  10953. } while (path = path.parentPath);
  10954. }
  10955. function getEarliestCommonAncestorFrom(paths) {
  10956. return this.getDeepestCommonAncestorFrom(paths, function (deepest, i, ancestries) {
  10957. var earliest = void 0;
  10958. var keys = t.VISITOR_KEYS[deepest.type];
  10959. for (var _iterator = ancestries, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  10960. var _ref;
  10961. if (_isArray) {
  10962. if (_i >= _iterator.length) break;
  10963. _ref = _iterator[_i++];
  10964. } else {
  10965. _i = _iterator.next();
  10966. if (_i.done) break;
  10967. _ref = _i.value;
  10968. }
  10969. var ancestry = _ref;
  10970. var path = ancestry[i + 1];
  10971. if (!earliest) {
  10972. earliest = path;
  10973. continue;
  10974. }
  10975. if (path.listKey && earliest.listKey === path.listKey) {
  10976. if (path.key < earliest.key) {
  10977. earliest = path;
  10978. continue;
  10979. }
  10980. }
  10981. var earliestKeyIndex = keys.indexOf(earliest.parentKey);
  10982. var currentKeyIndex = keys.indexOf(path.parentKey);
  10983. if (earliestKeyIndex > currentKeyIndex) {
  10984. earliest = path;
  10985. }
  10986. }
  10987. return earliest;
  10988. });
  10989. }
  10990. function getDeepestCommonAncestorFrom(paths, filter) {
  10991. var _this = this;
  10992. if (!paths.length) {
  10993. return this;
  10994. }
  10995. if (paths.length === 1) {
  10996. return paths[0];
  10997. }
  10998. var minDepth = Infinity;
  10999. var lastCommonIndex = void 0,
  11000. lastCommon = void 0;
  11001. var ancestries = paths.map(function (path) {
  11002. var ancestry = [];
  11003. do {
  11004. ancestry.unshift(path);
  11005. } while ((path = path.parentPath) && path !== _this);
  11006. if (ancestry.length < minDepth) {
  11007. minDepth = ancestry.length;
  11008. }
  11009. return ancestry;
  11010. });
  11011. var first = ancestries[0];
  11012. depthLoop: for (var i = 0; i < minDepth; i++) {
  11013. var shouldMatch = first[i];
  11014. for (var _iterator2 = ancestries, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  11015. var _ref2;
  11016. if (_isArray2) {
  11017. if (_i2 >= _iterator2.length) break;
  11018. _ref2 = _iterator2[_i2++];
  11019. } else {
  11020. _i2 = _iterator2.next();
  11021. if (_i2.done) break;
  11022. _ref2 = _i2.value;
  11023. }
  11024. var ancestry = _ref2;
  11025. if (ancestry[i] !== shouldMatch) {
  11026. break depthLoop;
  11027. }
  11028. }
  11029. lastCommonIndex = i;
  11030. lastCommon = shouldMatch;
  11031. }
  11032. if (lastCommon) {
  11033. if (filter) {
  11034. return filter(lastCommon, lastCommonIndex, ancestries);
  11035. } else {
  11036. return lastCommon;
  11037. }
  11038. } else {
  11039. throw new Error("Couldn't find intersection");
  11040. }
  11041. }
  11042. function getAncestry() {
  11043. var path = this;
  11044. var paths = [];
  11045. do {
  11046. paths.push(path);
  11047. } while (path = path.parentPath);
  11048. return paths;
  11049. }
  11050. function isAncestor(maybeDescendant) {
  11051. return maybeDescendant.isDescendant(this);
  11052. }
  11053. function isDescendant(maybeAncestor) {
  11054. return !!this.findParent(function (parent) {
  11055. return parent === maybeAncestor;
  11056. });
  11057. }
  11058. function inType() {
  11059. var path = this;
  11060. while (path) {
  11061. for (var _iterator3 = arguments, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) {
  11062. var _ref3;
  11063. if (_isArray3) {
  11064. if (_i3 >= _iterator3.length) break;
  11065. _ref3 = _iterator3[_i3++];
  11066. } else {
  11067. _i3 = _iterator3.next();
  11068. if (_i3.done) break;
  11069. _ref3 = _i3.value;
  11070. }
  11071. var type = _ref3;
  11072. if (path.node.type === type) return true;
  11073. }
  11074. path = path.parentPath;
  11075. }
  11076. return false;
  11077. }
  11078. function inShadow(key) {
  11079. var parentFn = this.isFunction() ? this : this.findParent(function (p) {
  11080. return p.isFunction();
  11081. });
  11082. if (!parentFn) return;
  11083. if (parentFn.isFunctionExpression() || parentFn.isFunctionDeclaration()) {
  11084. var shadow = parentFn.node.shadow;
  11085. if (shadow && (!key || shadow[key] !== false)) {
  11086. return parentFn;
  11087. }
  11088. } else if (parentFn.isArrowFunctionExpression()) {
  11089. return parentFn;
  11090. }
  11091. return null;
  11092. }
  11093. },{"./index":125,"babel-runtime/core-js/get-iterator":95,"babel-types":151}],120:[function(require,module,exports){
  11094. "use strict";
  11095. exports.__esModule = true;
  11096. exports.shareCommentsWithSiblings = shareCommentsWithSiblings;
  11097. exports.addComment = addComment;
  11098. exports.addComments = addComments;
  11099. function shareCommentsWithSiblings() {
  11100. if (typeof this.key === "string") return;
  11101. var node = this.node;
  11102. if (!node) return;
  11103. var trailing = node.trailingComments;
  11104. var leading = node.leadingComments;
  11105. if (!trailing && !leading) return;
  11106. var prev = this.getSibling(this.key - 1);
  11107. var next = this.getSibling(this.key + 1);
  11108. if (!prev.node) prev = next;
  11109. if (!next.node) next = prev;
  11110. prev.addComments("trailing", leading);
  11111. next.addComments("leading", trailing);
  11112. }
  11113. function addComment(type, content, line) {
  11114. this.addComments(type, [{
  11115. type: line ? "CommentLine" : "CommentBlock",
  11116. value: content
  11117. }]);
  11118. }
  11119. function addComments(type, comments) {
  11120. if (!comments) return;
  11121. var node = this.node;
  11122. if (!node) return;
  11123. var key = type + "Comments";
  11124. if (node[key]) {
  11125. node[key] = node[key].concat(comments);
  11126. } else {
  11127. node[key] = comments;
  11128. }
  11129. }
  11130. },{}],121:[function(require,module,exports){
  11131. "use strict";
  11132. exports.__esModule = true;
  11133. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  11134. var _getIterator3 = _interopRequireDefault(_getIterator2);
  11135. exports.call = call;
  11136. exports._call = _call;
  11137. exports.isBlacklisted = isBlacklisted;
  11138. exports.visit = visit;
  11139. exports.skip = skip;
  11140. exports.skipKey = skipKey;
  11141. exports.stop = stop;
  11142. exports.setScope = setScope;
  11143. exports.setContext = setContext;
  11144. exports.resync = resync;
  11145. exports._resyncParent = _resyncParent;
  11146. exports._resyncKey = _resyncKey;
  11147. exports._resyncList = _resyncList;
  11148. exports._resyncRemoved = _resyncRemoved;
  11149. exports.popContext = popContext;
  11150. exports.pushContext = pushContext;
  11151. exports.setup = setup;
  11152. exports.setKey = setKey;
  11153. exports.requeue = requeue;
  11154. exports._getQueueContexts = _getQueueContexts;
  11155. var _index = require("../index");
  11156. var _index2 = _interopRequireDefault(_index);
  11157. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  11158. function call(key) {
  11159. var opts = this.opts;
  11160. this.debug(function () {
  11161. return key;
  11162. });
  11163. if (this.node) {
  11164. if (this._call(opts[key])) return true;
  11165. }
  11166. if (this.node) {
  11167. return this._call(opts[this.node.type] && opts[this.node.type][key]);
  11168. }
  11169. return false;
  11170. }
  11171. function _call(fns) {
  11172. if (!fns) return false;
  11173. for (var _iterator = fns, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  11174. var _ref;
  11175. if (_isArray) {
  11176. if (_i >= _iterator.length) break;
  11177. _ref = _iterator[_i++];
  11178. } else {
  11179. _i = _iterator.next();
  11180. if (_i.done) break;
  11181. _ref = _i.value;
  11182. }
  11183. var fn = _ref;
  11184. if (!fn) continue;
  11185. var node = this.node;
  11186. if (!node) return true;
  11187. var ret = fn.call(this.state, this, this.state);
  11188. if (ret) throw new Error("Unexpected return value from visitor method " + fn);
  11189. if (this.node !== node) return true;
  11190. if (this.shouldStop || this.shouldSkip || this.removed) return true;
  11191. }
  11192. return false;
  11193. }
  11194. function isBlacklisted() {
  11195. var blacklist = this.opts.blacklist;
  11196. return blacklist && blacklist.indexOf(this.node.type) > -1;
  11197. }
  11198. function visit() {
  11199. if (!this.node) {
  11200. return false;
  11201. }
  11202. if (this.isBlacklisted()) {
  11203. return false;
  11204. }
  11205. if (this.opts.shouldSkip && this.opts.shouldSkip(this)) {
  11206. return false;
  11207. }
  11208. if (this.call("enter") || this.shouldSkip) {
  11209. this.debug(function () {
  11210. return "Skip...";
  11211. });
  11212. return this.shouldStop;
  11213. }
  11214. this.debug(function () {
  11215. return "Recursing into...";
  11216. });
  11217. _index2.default.node(this.node, this.opts, this.scope, this.state, this, this.skipKeys);
  11218. this.call("exit");
  11219. return this.shouldStop;
  11220. }
  11221. function skip() {
  11222. this.shouldSkip = true;
  11223. }
  11224. function skipKey(key) {
  11225. this.skipKeys[key] = true;
  11226. }
  11227. function stop() {
  11228. this.shouldStop = true;
  11229. this.shouldSkip = true;
  11230. }
  11231. function setScope() {
  11232. if (this.opts && this.opts.noScope) return;
  11233. var target = this.context && this.context.scope;
  11234. if (!target) {
  11235. var path = this.parentPath;
  11236. while (path && !target) {
  11237. if (path.opts && path.opts.noScope) return;
  11238. target = path.scope;
  11239. path = path.parentPath;
  11240. }
  11241. }
  11242. this.scope = this.getScope(target);
  11243. if (this.scope) this.scope.init();
  11244. }
  11245. function setContext(context) {
  11246. this.shouldSkip = false;
  11247. this.shouldStop = false;
  11248. this.removed = false;
  11249. this.skipKeys = {};
  11250. if (context) {
  11251. this.context = context;
  11252. this.state = context.state;
  11253. this.opts = context.opts;
  11254. }
  11255. this.setScope();
  11256. return this;
  11257. }
  11258. function resync() {
  11259. if (this.removed) return;
  11260. this._resyncParent();
  11261. this._resyncList();
  11262. this._resyncKey();
  11263. }
  11264. function _resyncParent() {
  11265. if (this.parentPath) {
  11266. this.parent = this.parentPath.node;
  11267. }
  11268. }
  11269. function _resyncKey() {
  11270. if (!this.container) return;
  11271. if (this.node === this.container[this.key]) return;
  11272. if (Array.isArray(this.container)) {
  11273. for (var i = 0; i < this.container.length; i++) {
  11274. if (this.container[i] === this.node) {
  11275. return this.setKey(i);
  11276. }
  11277. }
  11278. } else {
  11279. for (var key in this.container) {
  11280. if (this.container[key] === this.node) {
  11281. return this.setKey(key);
  11282. }
  11283. }
  11284. }
  11285. this.key = null;
  11286. }
  11287. function _resyncList() {
  11288. if (!this.parent || !this.inList) return;
  11289. var newContainer = this.parent[this.listKey];
  11290. if (this.container === newContainer) return;
  11291. this.container = newContainer || null;
  11292. }
  11293. function _resyncRemoved() {
  11294. if (this.key == null || !this.container || this.container[this.key] !== this.node) {
  11295. this._markRemoved();
  11296. }
  11297. }
  11298. function popContext() {
  11299. this.contexts.pop();
  11300. this.setContext(this.contexts[this.contexts.length - 1]);
  11301. }
  11302. function pushContext(context) {
  11303. this.contexts.push(context);
  11304. this.setContext(context);
  11305. }
  11306. function setup(parentPath, container, listKey, key) {
  11307. this.inList = !!listKey;
  11308. this.listKey = listKey;
  11309. this.parentKey = listKey || key;
  11310. this.container = container;
  11311. this.parentPath = parentPath || this.parentPath;
  11312. this.setKey(key);
  11313. }
  11314. function setKey(key) {
  11315. this.key = key;
  11316. this.node = this.container[this.key];
  11317. this.type = this.node && this.node.type;
  11318. }
  11319. function requeue() {
  11320. var pathToQueue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this;
  11321. if (pathToQueue.removed) return;
  11322. var contexts = this.contexts;
  11323. for (var _iterator2 = contexts, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  11324. var _ref2;
  11325. if (_isArray2) {
  11326. if (_i2 >= _iterator2.length) break;
  11327. _ref2 = _iterator2[_i2++];
  11328. } else {
  11329. _i2 = _iterator2.next();
  11330. if (_i2.done) break;
  11331. _ref2 = _i2.value;
  11332. }
  11333. var context = _ref2;
  11334. context.maybeQueue(pathToQueue);
  11335. }
  11336. }
  11337. function _getQueueContexts() {
  11338. var path = this;
  11339. var contexts = this.contexts;
  11340. while (!contexts.length) {
  11341. path = path.parentPath;
  11342. contexts = path.contexts;
  11343. }
  11344. return contexts;
  11345. }
  11346. },{"../index":118,"babel-runtime/core-js/get-iterator":95}],122:[function(require,module,exports){
  11347. "use strict";
  11348. exports.__esModule = true;
  11349. exports.toComputedKey = toComputedKey;
  11350. exports.ensureBlock = ensureBlock;
  11351. exports.arrowFunctionToShadowed = arrowFunctionToShadowed;
  11352. var _babelTypes = require("babel-types");
  11353. var t = _interopRequireWildcard(_babelTypes);
  11354. 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; } }
  11355. function toComputedKey() {
  11356. var node = this.node;
  11357. var key = void 0;
  11358. if (this.isMemberExpression()) {
  11359. key = node.property;
  11360. } else if (this.isProperty() || this.isMethod()) {
  11361. key = node.key;
  11362. } else {
  11363. throw new ReferenceError("todo");
  11364. }
  11365. if (!node.computed) {
  11366. if (t.isIdentifier(key)) key = t.stringLiteral(key.name);
  11367. }
  11368. return key;
  11369. }
  11370. function ensureBlock() {
  11371. return t.ensureBlock(this.node);
  11372. }
  11373. function arrowFunctionToShadowed() {
  11374. if (!this.isArrowFunctionExpression()) return;
  11375. this.ensureBlock();
  11376. var node = this.node;
  11377. node.expression = false;
  11378. node.type = "FunctionExpression";
  11379. node.shadow = node.shadow || true;
  11380. }
  11381. },{"babel-types":151}],123:[function(require,module,exports){
  11382. (function (global){
  11383. "use strict";
  11384. exports.__esModule = true;
  11385. var _typeof2 = require("babel-runtime/helpers/typeof");
  11386. var _typeof3 = _interopRequireDefault(_typeof2);
  11387. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  11388. var _getIterator3 = _interopRequireDefault(_getIterator2);
  11389. var _map = require("babel-runtime/core-js/map");
  11390. var _map2 = _interopRequireDefault(_map);
  11391. exports.evaluateTruthy = evaluateTruthy;
  11392. exports.evaluate = evaluate;
  11393. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  11394. var VALID_CALLEES = ["String", "Number", "Math"];
  11395. var INVALID_METHODS = ["random"];
  11396. function evaluateTruthy() {
  11397. var res = this.evaluate();
  11398. if (res.confident) return !!res.value;
  11399. }
  11400. function evaluate() {
  11401. var confident = true;
  11402. var deoptPath = void 0;
  11403. var seen = new _map2.default();
  11404. function deopt(path) {
  11405. if (!confident) return;
  11406. deoptPath = path;
  11407. confident = false;
  11408. }
  11409. var value = evaluate(this);
  11410. if (!confident) value = undefined;
  11411. return {
  11412. confident: confident,
  11413. deopt: deoptPath,
  11414. value: value
  11415. };
  11416. function evaluate(path) {
  11417. var node = path.node;
  11418. if (seen.has(node)) {
  11419. var existing = seen.get(node);
  11420. if (existing.resolved) {
  11421. return existing.value;
  11422. } else {
  11423. deopt(path);
  11424. return;
  11425. }
  11426. } else {
  11427. var item = { resolved: false };
  11428. seen.set(node, item);
  11429. var val = _evaluate(path);
  11430. if (confident) {
  11431. item.resolved = true;
  11432. item.value = val;
  11433. }
  11434. return val;
  11435. }
  11436. }
  11437. function _evaluate(path) {
  11438. if (!confident) return;
  11439. var node = path.node;
  11440. if (path.isSequenceExpression()) {
  11441. var exprs = path.get("expressions");
  11442. return evaluate(exprs[exprs.length - 1]);
  11443. }
  11444. if (path.isStringLiteral() || path.isNumericLiteral() || path.isBooleanLiteral()) {
  11445. return node.value;
  11446. }
  11447. if (path.isNullLiteral()) {
  11448. return null;
  11449. }
  11450. if (path.isTemplateLiteral()) {
  11451. var str = "";
  11452. var i = 0;
  11453. var _exprs = path.get("expressions");
  11454. for (var _iterator = node.quasis, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  11455. var _ref;
  11456. if (_isArray) {
  11457. if (_i >= _iterator.length) break;
  11458. _ref = _iterator[_i++];
  11459. } else {
  11460. _i = _iterator.next();
  11461. if (_i.done) break;
  11462. _ref = _i.value;
  11463. }
  11464. var elem = _ref;
  11465. if (!confident) break;
  11466. str += elem.value.cooked;
  11467. var expr = _exprs[i++];
  11468. if (expr) str += String(evaluate(expr));
  11469. }
  11470. if (!confident) return;
  11471. return str;
  11472. }
  11473. if (path.isConditionalExpression()) {
  11474. var testResult = evaluate(path.get("test"));
  11475. if (!confident) return;
  11476. if (testResult) {
  11477. return evaluate(path.get("consequent"));
  11478. } else {
  11479. return evaluate(path.get("alternate"));
  11480. }
  11481. }
  11482. if (path.isExpressionWrapper()) {
  11483. return evaluate(path.get("expression"));
  11484. }
  11485. if (path.isMemberExpression() && !path.parentPath.isCallExpression({ callee: node })) {
  11486. var property = path.get("property");
  11487. var object = path.get("object");
  11488. if (object.isLiteral() && property.isIdentifier()) {
  11489. var _value = object.node.value;
  11490. var type = typeof _value === "undefined" ? "undefined" : (0, _typeof3.default)(_value);
  11491. if (type === "number" || type === "string") {
  11492. return _value[property.node.name];
  11493. }
  11494. }
  11495. }
  11496. if (path.isReferencedIdentifier()) {
  11497. var binding = path.scope.getBinding(node.name);
  11498. if (binding && binding.constantViolations.length > 0) {
  11499. return deopt(binding.path);
  11500. }
  11501. if (binding && path.node.start < binding.path.node.end) {
  11502. return deopt(binding.path);
  11503. }
  11504. if (binding && binding.hasValue) {
  11505. return binding.value;
  11506. } else {
  11507. if (node.name === "undefined") {
  11508. return binding ? deopt(binding.path) : undefined;
  11509. } else if (node.name === "Infinity") {
  11510. return binding ? deopt(binding.path) : Infinity;
  11511. } else if (node.name === "NaN") {
  11512. return binding ? deopt(binding.path) : NaN;
  11513. }
  11514. var resolved = path.resolve();
  11515. if (resolved === path) {
  11516. return deopt(path);
  11517. } else {
  11518. return evaluate(resolved);
  11519. }
  11520. }
  11521. }
  11522. if (path.isUnaryExpression({ prefix: true })) {
  11523. if (node.operator === "void") {
  11524. return undefined;
  11525. }
  11526. var argument = path.get("argument");
  11527. if (node.operator === "typeof" && (argument.isFunction() || argument.isClass())) {
  11528. return "function";
  11529. }
  11530. var arg = evaluate(argument);
  11531. if (!confident) return;
  11532. switch (node.operator) {
  11533. case "!":
  11534. return !arg;
  11535. case "+":
  11536. return +arg;
  11537. case "-":
  11538. return -arg;
  11539. case "~":
  11540. return ~arg;
  11541. case "typeof":
  11542. return typeof arg === "undefined" ? "undefined" : (0, _typeof3.default)(arg);
  11543. }
  11544. }
  11545. if (path.isArrayExpression()) {
  11546. var arr = [];
  11547. var elems = path.get("elements");
  11548. for (var _iterator2 = elems, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  11549. var _ref2;
  11550. if (_isArray2) {
  11551. if (_i2 >= _iterator2.length) break;
  11552. _ref2 = _iterator2[_i2++];
  11553. } else {
  11554. _i2 = _iterator2.next();
  11555. if (_i2.done) break;
  11556. _ref2 = _i2.value;
  11557. }
  11558. var _elem = _ref2;
  11559. _elem = _elem.evaluate();
  11560. if (_elem.confident) {
  11561. arr.push(_elem.value);
  11562. } else {
  11563. return deopt(_elem);
  11564. }
  11565. }
  11566. return arr;
  11567. }
  11568. if (path.isObjectExpression()) {
  11569. var obj = {};
  11570. var props = path.get("properties");
  11571. for (var _iterator3 = props, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) {
  11572. var _ref3;
  11573. if (_isArray3) {
  11574. if (_i3 >= _iterator3.length) break;
  11575. _ref3 = _iterator3[_i3++];
  11576. } else {
  11577. _i3 = _iterator3.next();
  11578. if (_i3.done) break;
  11579. _ref3 = _i3.value;
  11580. }
  11581. var prop = _ref3;
  11582. if (prop.isObjectMethod() || prop.isSpreadProperty()) {
  11583. return deopt(prop);
  11584. }
  11585. var keyPath = prop.get("key");
  11586. var key = keyPath;
  11587. if (prop.node.computed) {
  11588. key = key.evaluate();
  11589. if (!key.confident) {
  11590. return deopt(keyPath);
  11591. }
  11592. key = key.value;
  11593. } else if (key.isIdentifier()) {
  11594. key = key.node.name;
  11595. } else {
  11596. key = key.node.value;
  11597. }
  11598. var valuePath = prop.get("value");
  11599. var _value2 = valuePath.evaluate();
  11600. if (!_value2.confident) {
  11601. return deopt(valuePath);
  11602. }
  11603. _value2 = _value2.value;
  11604. obj[key] = _value2;
  11605. }
  11606. return obj;
  11607. }
  11608. if (path.isLogicalExpression()) {
  11609. var wasConfident = confident;
  11610. var left = evaluate(path.get("left"));
  11611. var leftConfident = confident;
  11612. confident = wasConfident;
  11613. var right = evaluate(path.get("right"));
  11614. var rightConfident = confident;
  11615. confident = leftConfident && rightConfident;
  11616. switch (node.operator) {
  11617. case "||":
  11618. if (left && leftConfident) {
  11619. confident = true;
  11620. return left;
  11621. }
  11622. if (!confident) return;
  11623. return left || right;
  11624. case "&&":
  11625. if (!left && leftConfident || !right && rightConfident) {
  11626. confident = true;
  11627. }
  11628. if (!confident) return;
  11629. return left && right;
  11630. }
  11631. }
  11632. if (path.isBinaryExpression()) {
  11633. var _left = evaluate(path.get("left"));
  11634. if (!confident) return;
  11635. var _right = evaluate(path.get("right"));
  11636. if (!confident) return;
  11637. switch (node.operator) {
  11638. case "-":
  11639. return _left - _right;
  11640. case "+":
  11641. return _left + _right;
  11642. case "/":
  11643. return _left / _right;
  11644. case "*":
  11645. return _left * _right;
  11646. case "%":
  11647. return _left % _right;
  11648. case "**":
  11649. return Math.pow(_left, _right);
  11650. case "<":
  11651. return _left < _right;
  11652. case ">":
  11653. return _left > _right;
  11654. case "<=":
  11655. return _left <= _right;
  11656. case ">=":
  11657. return _left >= _right;
  11658. case "==":
  11659. return _left == _right;
  11660. case "!=":
  11661. return _left != _right;
  11662. case "===":
  11663. return _left === _right;
  11664. case "!==":
  11665. return _left !== _right;
  11666. case "|":
  11667. return _left | _right;
  11668. case "&":
  11669. return _left & _right;
  11670. case "^":
  11671. return _left ^ _right;
  11672. case "<<":
  11673. return _left << _right;
  11674. case ">>":
  11675. return _left >> _right;
  11676. case ">>>":
  11677. return _left >>> _right;
  11678. }
  11679. }
  11680. if (path.isCallExpression()) {
  11681. var callee = path.get("callee");
  11682. var context = void 0;
  11683. var func = void 0;
  11684. if (callee.isIdentifier() && !path.scope.getBinding(callee.node.name, true) && VALID_CALLEES.indexOf(callee.node.name) >= 0) {
  11685. func = global[node.callee.name];
  11686. }
  11687. if (callee.isMemberExpression()) {
  11688. var _object = callee.get("object");
  11689. var _property = callee.get("property");
  11690. if (_object.isIdentifier() && _property.isIdentifier() && VALID_CALLEES.indexOf(_object.node.name) >= 0 && INVALID_METHODS.indexOf(_property.node.name) < 0) {
  11691. context = global[_object.node.name];
  11692. func = context[_property.node.name];
  11693. }
  11694. if (_object.isLiteral() && _property.isIdentifier()) {
  11695. var _type = (0, _typeof3.default)(_object.node.value);
  11696. if (_type === "string" || _type === "number") {
  11697. context = _object.node.value;
  11698. func = context[_property.node.name];
  11699. }
  11700. }
  11701. }
  11702. if (func) {
  11703. var args = path.get("arguments").map(evaluate);
  11704. if (!confident) return;
  11705. return func.apply(context, args);
  11706. }
  11707. }
  11708. deopt(path);
  11709. }
  11710. }
  11711. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  11712. },{"babel-runtime/core-js/get-iterator":95,"babel-runtime/core-js/map":97,"babel-runtime/helpers/typeof":113}],124:[function(require,module,exports){
  11713. "use strict";
  11714. exports.__esModule = true;
  11715. var _create = require("babel-runtime/core-js/object/create");
  11716. var _create2 = _interopRequireDefault(_create);
  11717. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  11718. var _getIterator3 = _interopRequireDefault(_getIterator2);
  11719. exports.getStatementParent = getStatementParent;
  11720. exports.getOpposite = getOpposite;
  11721. exports.getCompletionRecords = getCompletionRecords;
  11722. exports.getSibling = getSibling;
  11723. exports.getPrevSibling = getPrevSibling;
  11724. exports.getNextSibling = getNextSibling;
  11725. exports.getAllNextSiblings = getAllNextSiblings;
  11726. exports.getAllPrevSiblings = getAllPrevSiblings;
  11727. exports.get = get;
  11728. exports._getKey = _getKey;
  11729. exports._getPattern = _getPattern;
  11730. exports.getBindingIdentifiers = getBindingIdentifiers;
  11731. exports.getOuterBindingIdentifiers = getOuterBindingIdentifiers;
  11732. exports.getBindingIdentifierPaths = getBindingIdentifierPaths;
  11733. exports.getOuterBindingIdentifierPaths = getOuterBindingIdentifierPaths;
  11734. var _index = require("./index");
  11735. var _index2 = _interopRequireDefault(_index);
  11736. var _babelTypes = require("babel-types");
  11737. var t = _interopRequireWildcard(_babelTypes);
  11738. 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; } }
  11739. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  11740. function getStatementParent() {
  11741. var path = this;
  11742. do {
  11743. if (!path.parentPath || Array.isArray(path.container) && path.isStatement()) {
  11744. break;
  11745. } else {
  11746. path = path.parentPath;
  11747. }
  11748. } while (path);
  11749. if (path && (path.isProgram() || path.isFile())) {
  11750. throw new Error("File/Program node, we can't possibly find a statement parent to this");
  11751. }
  11752. return path;
  11753. }
  11754. function getOpposite() {
  11755. if (this.key === "left") {
  11756. return this.getSibling("right");
  11757. } else if (this.key === "right") {
  11758. return this.getSibling("left");
  11759. }
  11760. }
  11761. function getCompletionRecords() {
  11762. var paths = [];
  11763. var add = function add(path) {
  11764. if (path) paths = paths.concat(path.getCompletionRecords());
  11765. };
  11766. if (this.isIfStatement()) {
  11767. add(this.get("consequent"));
  11768. add(this.get("alternate"));
  11769. } else if (this.isDoExpression() || this.isFor() || this.isWhile()) {
  11770. add(this.get("body"));
  11771. } else if (this.isProgram() || this.isBlockStatement()) {
  11772. add(this.get("body").pop());
  11773. } else if (this.isFunction()) {
  11774. return this.get("body").getCompletionRecords();
  11775. } else if (this.isTryStatement()) {
  11776. add(this.get("block"));
  11777. add(this.get("handler"));
  11778. add(this.get("finalizer"));
  11779. } else {
  11780. paths.push(this);
  11781. }
  11782. return paths;
  11783. }
  11784. function getSibling(key) {
  11785. return _index2.default.get({
  11786. parentPath: this.parentPath,
  11787. parent: this.parent,
  11788. container: this.container,
  11789. listKey: this.listKey,
  11790. key: key
  11791. });
  11792. }
  11793. function getPrevSibling() {
  11794. return this.getSibling(this.key - 1);
  11795. }
  11796. function getNextSibling() {
  11797. return this.getSibling(this.key + 1);
  11798. }
  11799. function getAllNextSiblings() {
  11800. var _key = this.key;
  11801. var sibling = this.getSibling(++_key);
  11802. var siblings = [];
  11803. while (sibling.node) {
  11804. siblings.push(sibling);
  11805. sibling = this.getSibling(++_key);
  11806. }
  11807. return siblings;
  11808. }
  11809. function getAllPrevSiblings() {
  11810. var _key = this.key;
  11811. var sibling = this.getSibling(--_key);
  11812. var siblings = [];
  11813. while (sibling.node) {
  11814. siblings.push(sibling);
  11815. sibling = this.getSibling(--_key);
  11816. }
  11817. return siblings;
  11818. }
  11819. function get(key, context) {
  11820. if (context === true) context = this.context;
  11821. var parts = key.split(".");
  11822. if (parts.length === 1) {
  11823. return this._getKey(key, context);
  11824. } else {
  11825. return this._getPattern(parts, context);
  11826. }
  11827. }
  11828. function _getKey(key, context) {
  11829. var _this = this;
  11830. var node = this.node;
  11831. var container = node[key];
  11832. if (Array.isArray(container)) {
  11833. return container.map(function (_, i) {
  11834. return _index2.default.get({
  11835. listKey: key,
  11836. parentPath: _this,
  11837. parent: node,
  11838. container: container,
  11839. key: i
  11840. }).setContext(context);
  11841. });
  11842. } else {
  11843. return _index2.default.get({
  11844. parentPath: this,
  11845. parent: node,
  11846. container: node,
  11847. key: key
  11848. }).setContext(context);
  11849. }
  11850. }
  11851. function _getPattern(parts, context) {
  11852. var path = this;
  11853. for (var _iterator = parts, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  11854. var _ref;
  11855. if (_isArray) {
  11856. if (_i >= _iterator.length) break;
  11857. _ref = _iterator[_i++];
  11858. } else {
  11859. _i = _iterator.next();
  11860. if (_i.done) break;
  11861. _ref = _i.value;
  11862. }
  11863. var part = _ref;
  11864. if (part === ".") {
  11865. path = path.parentPath;
  11866. } else {
  11867. if (Array.isArray(path)) {
  11868. path = path[part];
  11869. } else {
  11870. path = path.get(part, context);
  11871. }
  11872. }
  11873. }
  11874. return path;
  11875. }
  11876. function getBindingIdentifiers(duplicates) {
  11877. return t.getBindingIdentifiers(this.node, duplicates);
  11878. }
  11879. function getOuterBindingIdentifiers(duplicates) {
  11880. return t.getOuterBindingIdentifiers(this.node, duplicates);
  11881. }
  11882. function getBindingIdentifierPaths() {
  11883. var duplicates = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  11884. var outerOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  11885. var path = this;
  11886. var search = [].concat(path);
  11887. var ids = (0, _create2.default)(null);
  11888. while (search.length) {
  11889. var id = search.shift();
  11890. if (!id) continue;
  11891. if (!id.node) continue;
  11892. var keys = t.getBindingIdentifiers.keys[id.node.type];
  11893. if (id.isIdentifier()) {
  11894. if (duplicates) {
  11895. var _ids = ids[id.node.name] = ids[id.node.name] || [];
  11896. _ids.push(id);
  11897. } else {
  11898. ids[id.node.name] = id;
  11899. }
  11900. continue;
  11901. }
  11902. if (id.isExportDeclaration()) {
  11903. var declaration = id.get("declaration");
  11904. if (declaration.isDeclaration()) {
  11905. search.push(declaration);
  11906. }
  11907. continue;
  11908. }
  11909. if (outerOnly) {
  11910. if (id.isFunctionDeclaration()) {
  11911. search.push(id.get("id"));
  11912. continue;
  11913. }
  11914. if (id.isFunctionExpression()) {
  11915. continue;
  11916. }
  11917. }
  11918. if (keys) {
  11919. for (var i = 0; i < keys.length; i++) {
  11920. var key = keys[i];
  11921. var child = id.get(key);
  11922. if (Array.isArray(child) || child.node) {
  11923. search = search.concat(child);
  11924. }
  11925. }
  11926. }
  11927. }
  11928. return ids;
  11929. }
  11930. function getOuterBindingIdentifierPaths(duplicates) {
  11931. return this.getBindingIdentifierPaths(duplicates, true);
  11932. }
  11933. },{"./index":125,"babel-runtime/core-js/get-iterator":95,"babel-runtime/core-js/object/create":100,"babel-types":151}],125:[function(require,module,exports){
  11934. "use strict";
  11935. exports.__esModule = true;
  11936. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  11937. var _getIterator3 = _interopRequireDefault(_getIterator2);
  11938. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  11939. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  11940. var _virtualTypes = require("./lib/virtual-types");
  11941. var virtualTypes = _interopRequireWildcard(_virtualTypes);
  11942. var _debug2 = require("debug");
  11943. var _debug3 = _interopRequireDefault(_debug2);
  11944. var _invariant = require("invariant");
  11945. var _invariant2 = _interopRequireDefault(_invariant);
  11946. var _index = require("../index");
  11947. var _index2 = _interopRequireDefault(_index);
  11948. var _assign = require("lodash/assign");
  11949. var _assign2 = _interopRequireDefault(_assign);
  11950. var _scope = require("../scope");
  11951. var _scope2 = _interopRequireDefault(_scope);
  11952. var _babelTypes = require("babel-types");
  11953. var t = _interopRequireWildcard(_babelTypes);
  11954. var _cache = require("../cache");
  11955. 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; } }
  11956. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  11957. var _debug = (0, _debug3.default)("babel");
  11958. var NodePath = function () {
  11959. function NodePath(hub, parent) {
  11960. (0, _classCallCheck3.default)(this, NodePath);
  11961. this.parent = parent;
  11962. this.hub = hub;
  11963. this.contexts = [];
  11964. this.data = {};
  11965. this.shouldSkip = false;
  11966. this.shouldStop = false;
  11967. this.removed = false;
  11968. this.state = null;
  11969. this.opts = null;
  11970. this.skipKeys = null;
  11971. this.parentPath = null;
  11972. this.context = null;
  11973. this.container = null;
  11974. this.listKey = null;
  11975. this.inList = false;
  11976. this.parentKey = null;
  11977. this.key = null;
  11978. this.node = null;
  11979. this.scope = null;
  11980. this.type = null;
  11981. this.typeAnnotation = null;
  11982. }
  11983. NodePath.get = function get(_ref) {
  11984. var hub = _ref.hub,
  11985. parentPath = _ref.parentPath,
  11986. parent = _ref.parent,
  11987. container = _ref.container,
  11988. listKey = _ref.listKey,
  11989. key = _ref.key;
  11990. if (!hub && parentPath) {
  11991. hub = parentPath.hub;
  11992. }
  11993. (0, _invariant2.default)(parent, "To get a node path the parent needs to exist");
  11994. var targetNode = container[key];
  11995. var paths = _cache.path.get(parent) || [];
  11996. if (!_cache.path.has(parent)) {
  11997. _cache.path.set(parent, paths);
  11998. }
  11999. var path = void 0;
  12000. for (var i = 0; i < paths.length; i++) {
  12001. var pathCheck = paths[i];
  12002. if (pathCheck.node === targetNode) {
  12003. path = pathCheck;
  12004. break;
  12005. }
  12006. }
  12007. if (!path) {
  12008. path = new NodePath(hub, parent);
  12009. paths.push(path);
  12010. }
  12011. path.setup(parentPath, container, listKey, key);
  12012. return path;
  12013. };
  12014. NodePath.prototype.getScope = function getScope(scope) {
  12015. var ourScope = scope;
  12016. if (this.isScope()) {
  12017. ourScope = new _scope2.default(this, scope);
  12018. }
  12019. return ourScope;
  12020. };
  12021. NodePath.prototype.setData = function setData(key, val) {
  12022. return this.data[key] = val;
  12023. };
  12024. NodePath.prototype.getData = function getData(key, def) {
  12025. var val = this.data[key];
  12026. if (!val && def) val = this.data[key] = def;
  12027. return val;
  12028. };
  12029. NodePath.prototype.buildCodeFrameError = function buildCodeFrameError(msg) {
  12030. var Error = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : SyntaxError;
  12031. return this.hub.file.buildCodeFrameError(this.node, msg, Error);
  12032. };
  12033. NodePath.prototype.traverse = function traverse(visitor, state) {
  12034. (0, _index2.default)(this.node, visitor, this.scope, state, this);
  12035. };
  12036. NodePath.prototype.mark = function mark(type, message) {
  12037. this.hub.file.metadata.marked.push({
  12038. type: type,
  12039. message: message,
  12040. loc: this.node.loc
  12041. });
  12042. };
  12043. NodePath.prototype.set = function set(key, node) {
  12044. t.validate(this.node, key, node);
  12045. this.node[key] = node;
  12046. };
  12047. NodePath.prototype.getPathLocation = function getPathLocation() {
  12048. var parts = [];
  12049. var path = this;
  12050. do {
  12051. var key = path.key;
  12052. if (path.inList) key = path.listKey + "[" + key + "]";
  12053. parts.unshift(key);
  12054. } while (path = path.parentPath);
  12055. return parts.join(".");
  12056. };
  12057. NodePath.prototype.debug = function debug(buildMessage) {
  12058. if (!_debug.enabled) return;
  12059. _debug(this.getPathLocation() + " " + this.type + ": " + buildMessage());
  12060. };
  12061. return NodePath;
  12062. }();
  12063. exports.default = NodePath;
  12064. (0, _assign2.default)(NodePath.prototype, require("./ancestry"));
  12065. (0, _assign2.default)(NodePath.prototype, require("./inference"));
  12066. (0, _assign2.default)(NodePath.prototype, require("./replacement"));
  12067. (0, _assign2.default)(NodePath.prototype, require("./evaluation"));
  12068. (0, _assign2.default)(NodePath.prototype, require("./conversion"));
  12069. (0, _assign2.default)(NodePath.prototype, require("./introspection"));
  12070. (0, _assign2.default)(NodePath.prototype, require("./context"));
  12071. (0, _assign2.default)(NodePath.prototype, require("./removal"));
  12072. (0, _assign2.default)(NodePath.prototype, require("./modification"));
  12073. (0, _assign2.default)(NodePath.prototype, require("./family"));
  12074. (0, _assign2.default)(NodePath.prototype, require("./comments"));
  12075. var _loop2 = function _loop2() {
  12076. if (_isArray) {
  12077. if (_i >= _iterator.length) return "break";
  12078. _ref2 = _iterator[_i++];
  12079. } else {
  12080. _i = _iterator.next();
  12081. if (_i.done) return "break";
  12082. _ref2 = _i.value;
  12083. }
  12084. var type = _ref2;
  12085. var typeKey = "is" + type;
  12086. NodePath.prototype[typeKey] = function (opts) {
  12087. return t[typeKey](this.node, opts);
  12088. };
  12089. NodePath.prototype["assert" + type] = function (opts) {
  12090. if (!this[typeKey](opts)) {
  12091. throw new TypeError("Expected node path of type " + type);
  12092. }
  12093. };
  12094. };
  12095. for (var _iterator = t.TYPES, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  12096. var _ref2;
  12097. var _ret2 = _loop2();
  12098. if (_ret2 === "break") break;
  12099. }
  12100. var _loop = function _loop(type) {
  12101. if (type[0] === "_") return "continue";
  12102. if (t.TYPES.indexOf(type) < 0) t.TYPES.push(type);
  12103. var virtualType = virtualTypes[type];
  12104. NodePath.prototype["is" + type] = function (opts) {
  12105. return virtualType.checkPath(this, opts);
  12106. };
  12107. };
  12108. for (var type in virtualTypes) {
  12109. var _ret = _loop(type);
  12110. if (_ret === "continue") continue;
  12111. }
  12112. module.exports = exports["default"];
  12113. },{"../cache":115,"../index":118,"../scope":137,"./ancestry":119,"./comments":120,"./context":121,"./conversion":122,"./evaluation":123,"./family":124,"./inference":126,"./introspection":129,"./lib/virtual-types":132,"./modification":133,"./removal":134,"./replacement":135,"babel-runtime/core-js/get-iterator":95,"babel-runtime/helpers/classCallCheck":109,"babel-types":151,"debug":279,"invariant":292,"lodash/assign":463}],126:[function(require,module,exports){
  12114. "use strict";
  12115. exports.__esModule = true;
  12116. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  12117. var _getIterator3 = _interopRequireDefault(_getIterator2);
  12118. exports.getTypeAnnotation = getTypeAnnotation;
  12119. exports._getTypeAnnotation = _getTypeAnnotation;
  12120. exports.isBaseType = isBaseType;
  12121. exports.couldBeBaseType = couldBeBaseType;
  12122. exports.baseTypeStrictlyMatches = baseTypeStrictlyMatches;
  12123. exports.isGenericType = isGenericType;
  12124. var _inferers = require("./inferers");
  12125. var inferers = _interopRequireWildcard(_inferers);
  12126. var _babelTypes = require("babel-types");
  12127. var t = _interopRequireWildcard(_babelTypes);
  12128. 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; } }
  12129. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  12130. function getTypeAnnotation() {
  12131. if (this.typeAnnotation) return this.typeAnnotation;
  12132. var type = this._getTypeAnnotation() || t.anyTypeAnnotation();
  12133. if (t.isTypeAnnotation(type)) type = type.typeAnnotation;
  12134. return this.typeAnnotation = type;
  12135. }
  12136. function _getTypeAnnotation() {
  12137. var node = this.node;
  12138. if (!node) {
  12139. if (this.key === "init" && this.parentPath.isVariableDeclarator()) {
  12140. var declar = this.parentPath.parentPath;
  12141. var declarParent = declar.parentPath;
  12142. if (declar.key === "left" && declarParent.isForInStatement()) {
  12143. return t.stringTypeAnnotation();
  12144. }
  12145. if (declar.key === "left" && declarParent.isForOfStatement()) {
  12146. return t.anyTypeAnnotation();
  12147. }
  12148. return t.voidTypeAnnotation();
  12149. } else {
  12150. return;
  12151. }
  12152. }
  12153. if (node.typeAnnotation) {
  12154. return node.typeAnnotation;
  12155. }
  12156. var inferer = inferers[node.type];
  12157. if (inferer) {
  12158. return inferer.call(this, node);
  12159. }
  12160. inferer = inferers[this.parentPath.type];
  12161. if (inferer && inferer.validParent) {
  12162. return this.parentPath.getTypeAnnotation();
  12163. }
  12164. }
  12165. function isBaseType(baseName, soft) {
  12166. return _isBaseType(baseName, this.getTypeAnnotation(), soft);
  12167. }
  12168. function _isBaseType(baseName, type, soft) {
  12169. if (baseName === "string") {
  12170. return t.isStringTypeAnnotation(type);
  12171. } else if (baseName === "number") {
  12172. return t.isNumberTypeAnnotation(type);
  12173. } else if (baseName === "boolean") {
  12174. return t.isBooleanTypeAnnotation(type);
  12175. } else if (baseName === "any") {
  12176. return t.isAnyTypeAnnotation(type);
  12177. } else if (baseName === "mixed") {
  12178. return t.isMixedTypeAnnotation(type);
  12179. } else if (baseName === "empty") {
  12180. return t.isEmptyTypeAnnotation(type);
  12181. } else if (baseName === "void") {
  12182. return t.isVoidTypeAnnotation(type);
  12183. } else {
  12184. if (soft) {
  12185. return false;
  12186. } else {
  12187. throw new Error("Unknown base type " + baseName);
  12188. }
  12189. }
  12190. }
  12191. function couldBeBaseType(name) {
  12192. var type = this.getTypeAnnotation();
  12193. if (t.isAnyTypeAnnotation(type)) return true;
  12194. if (t.isUnionTypeAnnotation(type)) {
  12195. for (var _iterator = type.types, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  12196. var _ref;
  12197. if (_isArray) {
  12198. if (_i >= _iterator.length) break;
  12199. _ref = _iterator[_i++];
  12200. } else {
  12201. _i = _iterator.next();
  12202. if (_i.done) break;
  12203. _ref = _i.value;
  12204. }
  12205. var type2 = _ref;
  12206. if (t.isAnyTypeAnnotation(type2) || _isBaseType(name, type2, true)) {
  12207. return true;
  12208. }
  12209. }
  12210. return false;
  12211. } else {
  12212. return _isBaseType(name, type, true);
  12213. }
  12214. }
  12215. function baseTypeStrictlyMatches(right) {
  12216. var left = this.getTypeAnnotation();
  12217. right = right.getTypeAnnotation();
  12218. if (!t.isAnyTypeAnnotation(left) && t.isFlowBaseAnnotation(left)) {
  12219. return right.type === left.type;
  12220. }
  12221. }
  12222. function isGenericType(genericName) {
  12223. var type = this.getTypeAnnotation();
  12224. return t.isGenericTypeAnnotation(type) && t.isIdentifier(type.id, { name: genericName });
  12225. }
  12226. },{"./inferers":128,"babel-runtime/core-js/get-iterator":95,"babel-types":151}],127:[function(require,module,exports){
  12227. "use strict";
  12228. exports.__esModule = true;
  12229. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  12230. var _getIterator3 = _interopRequireDefault(_getIterator2);
  12231. exports.default = function (node) {
  12232. if (!this.isReferenced()) return;
  12233. var binding = this.scope.getBinding(node.name);
  12234. if (binding) {
  12235. if (binding.identifier.typeAnnotation) {
  12236. return binding.identifier.typeAnnotation;
  12237. } else {
  12238. return getTypeAnnotationBindingConstantViolations(this, node.name);
  12239. }
  12240. }
  12241. if (node.name === "undefined") {
  12242. return t.voidTypeAnnotation();
  12243. } else if (node.name === "NaN" || node.name === "Infinity") {
  12244. return t.numberTypeAnnotation();
  12245. } else if (node.name === "arguments") {}
  12246. };
  12247. var _babelTypes = require("babel-types");
  12248. var t = _interopRequireWildcard(_babelTypes);
  12249. 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; } }
  12250. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  12251. function getTypeAnnotationBindingConstantViolations(path, name) {
  12252. var binding = path.scope.getBinding(name);
  12253. var types = [];
  12254. path.typeAnnotation = t.unionTypeAnnotation(types);
  12255. var functionConstantViolations = [];
  12256. var constantViolations = getConstantViolationsBefore(binding, path, functionConstantViolations);
  12257. var testType = getConditionalAnnotation(path, name);
  12258. if (testType) {
  12259. var testConstantViolations = getConstantViolationsBefore(binding, testType.ifStatement);
  12260. constantViolations = constantViolations.filter(function (path) {
  12261. return testConstantViolations.indexOf(path) < 0;
  12262. });
  12263. types.push(testType.typeAnnotation);
  12264. }
  12265. if (constantViolations.length) {
  12266. constantViolations = constantViolations.concat(functionConstantViolations);
  12267. for (var _iterator = constantViolations, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  12268. var _ref;
  12269. if (_isArray) {
  12270. if (_i >= _iterator.length) break;
  12271. _ref = _iterator[_i++];
  12272. } else {
  12273. _i = _iterator.next();
  12274. if (_i.done) break;
  12275. _ref = _i.value;
  12276. }
  12277. var violation = _ref;
  12278. types.push(violation.getTypeAnnotation());
  12279. }
  12280. }
  12281. if (types.length) {
  12282. return t.createUnionTypeAnnotation(types);
  12283. }
  12284. }
  12285. function getConstantViolationsBefore(binding, path, functions) {
  12286. var violations = binding.constantViolations.slice();
  12287. violations.unshift(binding.path);
  12288. return violations.filter(function (violation) {
  12289. violation = violation.resolve();
  12290. var status = violation._guessExecutionStatusRelativeTo(path);
  12291. if (functions && status === "function") functions.push(violation);
  12292. return status === "before";
  12293. });
  12294. }
  12295. function inferAnnotationFromBinaryExpression(name, path) {
  12296. var operator = path.node.operator;
  12297. var right = path.get("right").resolve();
  12298. var left = path.get("left").resolve();
  12299. var target = void 0;
  12300. if (left.isIdentifier({ name: name })) {
  12301. target = right;
  12302. } else if (right.isIdentifier({ name: name })) {
  12303. target = left;
  12304. }
  12305. if (target) {
  12306. if (operator === "===") {
  12307. return target.getTypeAnnotation();
  12308. } else if (t.BOOLEAN_NUMBER_BINARY_OPERATORS.indexOf(operator) >= 0) {
  12309. return t.numberTypeAnnotation();
  12310. } else {
  12311. return;
  12312. }
  12313. } else {
  12314. if (operator !== "===") return;
  12315. }
  12316. var typeofPath = void 0;
  12317. var typePath = void 0;
  12318. if (left.isUnaryExpression({ operator: "typeof" })) {
  12319. typeofPath = left;
  12320. typePath = right;
  12321. } else if (right.isUnaryExpression({ operator: "typeof" })) {
  12322. typeofPath = right;
  12323. typePath = left;
  12324. }
  12325. if (!typePath && !typeofPath) return;
  12326. typePath = typePath.resolve();
  12327. if (!typePath.isLiteral()) return;
  12328. var typeValue = typePath.node.value;
  12329. if (typeof typeValue !== "string") return;
  12330. if (!typeofPath.get("argument").isIdentifier({ name: name })) return;
  12331. return t.createTypeAnnotationBasedOnTypeof(typePath.node.value);
  12332. }
  12333. function getParentConditionalPath(path) {
  12334. var parentPath = void 0;
  12335. while (parentPath = path.parentPath) {
  12336. if (parentPath.isIfStatement() || parentPath.isConditionalExpression()) {
  12337. if (path.key === "test") {
  12338. return;
  12339. } else {
  12340. return parentPath;
  12341. }
  12342. } else {
  12343. path = parentPath;
  12344. }
  12345. }
  12346. }
  12347. function getConditionalAnnotation(path, name) {
  12348. var ifStatement = getParentConditionalPath(path);
  12349. if (!ifStatement) return;
  12350. var test = ifStatement.get("test");
  12351. var paths = [test];
  12352. var types = [];
  12353. do {
  12354. var _path = paths.shift().resolve();
  12355. if (_path.isLogicalExpression()) {
  12356. paths.push(_path.get("left"));
  12357. paths.push(_path.get("right"));
  12358. }
  12359. if (_path.isBinaryExpression()) {
  12360. var type = inferAnnotationFromBinaryExpression(name, _path);
  12361. if (type) types.push(type);
  12362. }
  12363. } while (paths.length);
  12364. if (types.length) {
  12365. return {
  12366. typeAnnotation: t.createUnionTypeAnnotation(types),
  12367. ifStatement: ifStatement
  12368. };
  12369. } else {
  12370. return getConditionalAnnotation(ifStatement, name);
  12371. }
  12372. }
  12373. module.exports = exports["default"];
  12374. },{"babel-runtime/core-js/get-iterator":95,"babel-types":151}],128:[function(require,module,exports){
  12375. "use strict";
  12376. exports.__esModule = true;
  12377. exports.ClassDeclaration = exports.ClassExpression = exports.FunctionDeclaration = exports.ArrowFunctionExpression = exports.FunctionExpression = exports.Identifier = undefined;
  12378. var _infererReference = require("./inferer-reference");
  12379. Object.defineProperty(exports, "Identifier", {
  12380. enumerable: true,
  12381. get: function get() {
  12382. return _interopRequireDefault(_infererReference).default;
  12383. }
  12384. });
  12385. exports.VariableDeclarator = VariableDeclarator;
  12386. exports.TypeCastExpression = TypeCastExpression;
  12387. exports.NewExpression = NewExpression;
  12388. exports.TemplateLiteral = TemplateLiteral;
  12389. exports.UnaryExpression = UnaryExpression;
  12390. exports.BinaryExpression = BinaryExpression;
  12391. exports.LogicalExpression = LogicalExpression;
  12392. exports.ConditionalExpression = ConditionalExpression;
  12393. exports.SequenceExpression = SequenceExpression;
  12394. exports.AssignmentExpression = AssignmentExpression;
  12395. exports.UpdateExpression = UpdateExpression;
  12396. exports.StringLiteral = StringLiteral;
  12397. exports.NumericLiteral = NumericLiteral;
  12398. exports.BooleanLiteral = BooleanLiteral;
  12399. exports.NullLiteral = NullLiteral;
  12400. exports.RegExpLiteral = RegExpLiteral;
  12401. exports.ObjectExpression = ObjectExpression;
  12402. exports.ArrayExpression = ArrayExpression;
  12403. exports.RestElement = RestElement;
  12404. exports.CallExpression = CallExpression;
  12405. exports.TaggedTemplateExpression = TaggedTemplateExpression;
  12406. var _babelTypes = require("babel-types");
  12407. var t = _interopRequireWildcard(_babelTypes);
  12408. 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; } }
  12409. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  12410. function VariableDeclarator() {
  12411. var id = this.get("id");
  12412. if (id.isIdentifier()) {
  12413. return this.get("init").getTypeAnnotation();
  12414. } else {
  12415. return;
  12416. }
  12417. }
  12418. function TypeCastExpression(node) {
  12419. return node.typeAnnotation;
  12420. }
  12421. TypeCastExpression.validParent = true;
  12422. function NewExpression(node) {
  12423. if (this.get("callee").isIdentifier()) {
  12424. return t.genericTypeAnnotation(node.callee);
  12425. }
  12426. }
  12427. function TemplateLiteral() {
  12428. return t.stringTypeAnnotation();
  12429. }
  12430. function UnaryExpression(node) {
  12431. var operator = node.operator;
  12432. if (operator === "void") {
  12433. return t.voidTypeAnnotation();
  12434. } else if (t.NUMBER_UNARY_OPERATORS.indexOf(operator) >= 0) {
  12435. return t.numberTypeAnnotation();
  12436. } else if (t.STRING_UNARY_OPERATORS.indexOf(operator) >= 0) {
  12437. return t.stringTypeAnnotation();
  12438. } else if (t.BOOLEAN_UNARY_OPERATORS.indexOf(operator) >= 0) {
  12439. return t.booleanTypeAnnotation();
  12440. }
  12441. }
  12442. function BinaryExpression(node) {
  12443. var operator = node.operator;
  12444. if (t.NUMBER_BINARY_OPERATORS.indexOf(operator) >= 0) {
  12445. return t.numberTypeAnnotation();
  12446. } else if (t.BOOLEAN_BINARY_OPERATORS.indexOf(operator) >= 0) {
  12447. return t.booleanTypeAnnotation();
  12448. } else if (operator === "+") {
  12449. var right = this.get("right");
  12450. var left = this.get("left");
  12451. if (left.isBaseType("number") && right.isBaseType("number")) {
  12452. return t.numberTypeAnnotation();
  12453. } else if (left.isBaseType("string") || right.isBaseType("string")) {
  12454. return t.stringTypeAnnotation();
  12455. }
  12456. return t.unionTypeAnnotation([t.stringTypeAnnotation(), t.numberTypeAnnotation()]);
  12457. }
  12458. }
  12459. function LogicalExpression() {
  12460. return t.createUnionTypeAnnotation([this.get("left").getTypeAnnotation(), this.get("right").getTypeAnnotation()]);
  12461. }
  12462. function ConditionalExpression() {
  12463. return t.createUnionTypeAnnotation([this.get("consequent").getTypeAnnotation(), this.get("alternate").getTypeAnnotation()]);
  12464. }
  12465. function SequenceExpression() {
  12466. return this.get("expressions").pop().getTypeAnnotation();
  12467. }
  12468. function AssignmentExpression() {
  12469. return this.get("right").getTypeAnnotation();
  12470. }
  12471. function UpdateExpression(node) {
  12472. var operator = node.operator;
  12473. if (operator === "++" || operator === "--") {
  12474. return t.numberTypeAnnotation();
  12475. }
  12476. }
  12477. function StringLiteral() {
  12478. return t.stringTypeAnnotation();
  12479. }
  12480. function NumericLiteral() {
  12481. return t.numberTypeAnnotation();
  12482. }
  12483. function BooleanLiteral() {
  12484. return t.booleanTypeAnnotation();
  12485. }
  12486. function NullLiteral() {
  12487. return t.nullLiteralTypeAnnotation();
  12488. }
  12489. function RegExpLiteral() {
  12490. return t.genericTypeAnnotation(t.identifier("RegExp"));
  12491. }
  12492. function ObjectExpression() {
  12493. return t.genericTypeAnnotation(t.identifier("Object"));
  12494. }
  12495. function ArrayExpression() {
  12496. return t.genericTypeAnnotation(t.identifier("Array"));
  12497. }
  12498. function RestElement() {
  12499. return ArrayExpression();
  12500. }
  12501. RestElement.validParent = true;
  12502. function Func() {
  12503. return t.genericTypeAnnotation(t.identifier("Function"));
  12504. }
  12505. exports.FunctionExpression = Func;
  12506. exports.ArrowFunctionExpression = Func;
  12507. exports.FunctionDeclaration = Func;
  12508. exports.ClassExpression = Func;
  12509. exports.ClassDeclaration = Func;
  12510. function CallExpression() {
  12511. return resolveCall(this.get("callee"));
  12512. }
  12513. function TaggedTemplateExpression() {
  12514. return resolveCall(this.get("tag"));
  12515. }
  12516. function resolveCall(callee) {
  12517. callee = callee.resolve();
  12518. if (callee.isFunction()) {
  12519. if (callee.is("async")) {
  12520. if (callee.is("generator")) {
  12521. return t.genericTypeAnnotation(t.identifier("AsyncIterator"));
  12522. } else {
  12523. return t.genericTypeAnnotation(t.identifier("Promise"));
  12524. }
  12525. } else {
  12526. if (callee.node.returnType) {
  12527. return callee.node.returnType;
  12528. } else {}
  12529. }
  12530. }
  12531. }
  12532. },{"./inferer-reference":127,"babel-types":151}],129:[function(require,module,exports){
  12533. "use strict";
  12534. exports.__esModule = true;
  12535. exports.is = undefined;
  12536. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  12537. var _getIterator3 = _interopRequireDefault(_getIterator2);
  12538. exports.matchesPattern = matchesPattern;
  12539. exports.has = has;
  12540. exports.isStatic = isStatic;
  12541. exports.isnt = isnt;
  12542. exports.equals = equals;
  12543. exports.isNodeType = isNodeType;
  12544. exports.canHaveVariableDeclarationOrExpression = canHaveVariableDeclarationOrExpression;
  12545. exports.canSwapBetweenExpressionAndStatement = canSwapBetweenExpressionAndStatement;
  12546. exports.isCompletionRecord = isCompletionRecord;
  12547. exports.isStatementOrBlock = isStatementOrBlock;
  12548. exports.referencesImport = referencesImport;
  12549. exports.getSource = getSource;
  12550. exports.willIMaybeExecuteBefore = willIMaybeExecuteBefore;
  12551. exports._guessExecutionStatusRelativeTo = _guessExecutionStatusRelativeTo;
  12552. exports._guessExecutionStatusRelativeToDifferentFunctions = _guessExecutionStatusRelativeToDifferentFunctions;
  12553. exports.resolve = resolve;
  12554. exports._resolve = _resolve;
  12555. var _includes = require("lodash/includes");
  12556. var _includes2 = _interopRequireDefault(_includes);
  12557. var _babelTypes = require("babel-types");
  12558. var t = _interopRequireWildcard(_babelTypes);
  12559. 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; } }
  12560. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  12561. function matchesPattern(pattern, allowPartial) {
  12562. if (!this.isMemberExpression()) return false;
  12563. var parts = pattern.split(".");
  12564. var search = [this.node];
  12565. var i = 0;
  12566. function matches(name) {
  12567. var part = parts[i];
  12568. return part === "*" || name === part;
  12569. }
  12570. while (search.length) {
  12571. var node = search.shift();
  12572. if (allowPartial && i === parts.length) {
  12573. return true;
  12574. }
  12575. if (t.isIdentifier(node)) {
  12576. if (!matches(node.name)) return false;
  12577. } else if (t.isLiteral(node)) {
  12578. if (!matches(node.value)) return false;
  12579. } else if (t.isMemberExpression(node)) {
  12580. if (node.computed && !t.isLiteral(node.property)) {
  12581. return false;
  12582. } else {
  12583. search.unshift(node.property);
  12584. search.unshift(node.object);
  12585. continue;
  12586. }
  12587. } else if (t.isThisExpression(node)) {
  12588. if (!matches("this")) return false;
  12589. } else {
  12590. return false;
  12591. }
  12592. if (++i > parts.length) {
  12593. return false;
  12594. }
  12595. }
  12596. return i === parts.length;
  12597. }
  12598. function has(key) {
  12599. var val = this.node && this.node[key];
  12600. if (val && Array.isArray(val)) {
  12601. return !!val.length;
  12602. } else {
  12603. return !!val;
  12604. }
  12605. }
  12606. function isStatic() {
  12607. return this.scope.isStatic(this.node);
  12608. }
  12609. var is = exports.is = has;
  12610. function isnt(key) {
  12611. return !this.has(key);
  12612. }
  12613. function equals(key, value) {
  12614. return this.node[key] === value;
  12615. }
  12616. function isNodeType(type) {
  12617. return t.isType(this.type, type);
  12618. }
  12619. function canHaveVariableDeclarationOrExpression() {
  12620. return (this.key === "init" || this.key === "left") && this.parentPath.isFor();
  12621. }
  12622. function canSwapBetweenExpressionAndStatement(replacement) {
  12623. if (this.key !== "body" || !this.parentPath.isArrowFunctionExpression()) {
  12624. return false;
  12625. }
  12626. if (this.isExpression()) {
  12627. return t.isBlockStatement(replacement);
  12628. } else if (this.isBlockStatement()) {
  12629. return t.isExpression(replacement);
  12630. }
  12631. return false;
  12632. }
  12633. function isCompletionRecord(allowInsideFunction) {
  12634. var path = this;
  12635. var first = true;
  12636. do {
  12637. var container = path.container;
  12638. if (path.isFunction() && !first) {
  12639. return !!allowInsideFunction;
  12640. }
  12641. first = false;
  12642. if (Array.isArray(container) && path.key !== container.length - 1) {
  12643. return false;
  12644. }
  12645. } while ((path = path.parentPath) && !path.isProgram());
  12646. return true;
  12647. }
  12648. function isStatementOrBlock() {
  12649. if (this.parentPath.isLabeledStatement() || t.isBlockStatement(this.container)) {
  12650. return false;
  12651. } else {
  12652. return (0, _includes2.default)(t.STATEMENT_OR_BLOCK_KEYS, this.key);
  12653. }
  12654. }
  12655. function referencesImport(moduleSource, importName) {
  12656. if (!this.isReferencedIdentifier()) return false;
  12657. var binding = this.scope.getBinding(this.node.name);
  12658. if (!binding || binding.kind !== "module") return false;
  12659. var path = binding.path;
  12660. var parent = path.parentPath;
  12661. if (!parent.isImportDeclaration()) return false;
  12662. if (parent.node.source.value === moduleSource) {
  12663. if (!importName) return true;
  12664. } else {
  12665. return false;
  12666. }
  12667. if (path.isImportDefaultSpecifier() && importName === "default") {
  12668. return true;
  12669. }
  12670. if (path.isImportNamespaceSpecifier() && importName === "*") {
  12671. return true;
  12672. }
  12673. if (path.isImportSpecifier() && path.node.imported.name === importName) {
  12674. return true;
  12675. }
  12676. return false;
  12677. }
  12678. function getSource() {
  12679. var node = this.node;
  12680. if (node.end) {
  12681. return this.hub.file.code.slice(node.start, node.end);
  12682. } else {
  12683. return "";
  12684. }
  12685. }
  12686. function willIMaybeExecuteBefore(target) {
  12687. return this._guessExecutionStatusRelativeTo(target) !== "after";
  12688. }
  12689. function _guessExecutionStatusRelativeTo(target) {
  12690. var targetFuncParent = target.scope.getFunctionParent();
  12691. var selfFuncParent = this.scope.getFunctionParent();
  12692. if (targetFuncParent.node !== selfFuncParent.node) {
  12693. var status = this._guessExecutionStatusRelativeToDifferentFunctions(targetFuncParent);
  12694. if (status) {
  12695. return status;
  12696. } else {
  12697. target = targetFuncParent.path;
  12698. }
  12699. }
  12700. var targetPaths = target.getAncestry();
  12701. if (targetPaths.indexOf(this) >= 0) return "after";
  12702. var selfPaths = this.getAncestry();
  12703. var commonPath = void 0;
  12704. var targetIndex = void 0;
  12705. var selfIndex = void 0;
  12706. for (selfIndex = 0; selfIndex < selfPaths.length; selfIndex++) {
  12707. var selfPath = selfPaths[selfIndex];
  12708. targetIndex = targetPaths.indexOf(selfPath);
  12709. if (targetIndex >= 0) {
  12710. commonPath = selfPath;
  12711. break;
  12712. }
  12713. }
  12714. if (!commonPath) {
  12715. return "before";
  12716. }
  12717. var targetRelationship = targetPaths[targetIndex - 1];
  12718. var selfRelationship = selfPaths[selfIndex - 1];
  12719. if (!targetRelationship || !selfRelationship) {
  12720. return "before";
  12721. }
  12722. if (targetRelationship.listKey && targetRelationship.container === selfRelationship.container) {
  12723. return targetRelationship.key > selfRelationship.key ? "before" : "after";
  12724. }
  12725. var targetKeyPosition = t.VISITOR_KEYS[targetRelationship.type].indexOf(targetRelationship.key);
  12726. var selfKeyPosition = t.VISITOR_KEYS[selfRelationship.type].indexOf(selfRelationship.key);
  12727. return targetKeyPosition > selfKeyPosition ? "before" : "after";
  12728. }
  12729. function _guessExecutionStatusRelativeToDifferentFunctions(targetFuncParent) {
  12730. var targetFuncPath = targetFuncParent.path;
  12731. if (!targetFuncPath.isFunctionDeclaration()) return;
  12732. var binding = targetFuncPath.scope.getBinding(targetFuncPath.node.id.name);
  12733. if (!binding.references) return "before";
  12734. var referencePaths = binding.referencePaths;
  12735. for (var _iterator = referencePaths, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  12736. var _ref;
  12737. if (_isArray) {
  12738. if (_i >= _iterator.length) break;
  12739. _ref = _iterator[_i++];
  12740. } else {
  12741. _i = _iterator.next();
  12742. if (_i.done) break;
  12743. _ref = _i.value;
  12744. }
  12745. var path = _ref;
  12746. if (path.key !== "callee" || !path.parentPath.isCallExpression()) {
  12747. return;
  12748. }
  12749. }
  12750. var allStatus = void 0;
  12751. for (var _iterator2 = referencePaths, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  12752. var _ref2;
  12753. if (_isArray2) {
  12754. if (_i2 >= _iterator2.length) break;
  12755. _ref2 = _iterator2[_i2++];
  12756. } else {
  12757. _i2 = _iterator2.next();
  12758. if (_i2.done) break;
  12759. _ref2 = _i2.value;
  12760. }
  12761. var _path = _ref2;
  12762. var childOfFunction = !!_path.find(function (path) {
  12763. return path.node === targetFuncPath.node;
  12764. });
  12765. if (childOfFunction) continue;
  12766. var status = this._guessExecutionStatusRelativeTo(_path);
  12767. if (allStatus) {
  12768. if (allStatus !== status) return;
  12769. } else {
  12770. allStatus = status;
  12771. }
  12772. }
  12773. return allStatus;
  12774. }
  12775. function resolve(dangerous, resolved) {
  12776. return this._resolve(dangerous, resolved) || this;
  12777. }
  12778. function _resolve(dangerous, resolved) {
  12779. if (resolved && resolved.indexOf(this) >= 0) return;
  12780. resolved = resolved || [];
  12781. resolved.push(this);
  12782. if (this.isVariableDeclarator()) {
  12783. if (this.get("id").isIdentifier()) {
  12784. return this.get("init").resolve(dangerous, resolved);
  12785. } else {}
  12786. } else if (this.isReferencedIdentifier()) {
  12787. var binding = this.scope.getBinding(this.node.name);
  12788. if (!binding) return;
  12789. if (!binding.constant) return;
  12790. if (binding.kind === "module") return;
  12791. if (binding.path !== this) {
  12792. var ret = binding.path.resolve(dangerous, resolved);
  12793. if (this.find(function (parent) {
  12794. return parent.node === ret.node;
  12795. })) return;
  12796. return ret;
  12797. }
  12798. } else if (this.isTypeCastExpression()) {
  12799. return this.get("expression").resolve(dangerous, resolved);
  12800. } else if (dangerous && this.isMemberExpression()) {
  12801. var targetKey = this.toComputedKey();
  12802. if (!t.isLiteral(targetKey)) return;
  12803. var targetName = targetKey.value;
  12804. var target = this.get("object").resolve(dangerous, resolved);
  12805. if (target.isObjectExpression()) {
  12806. var props = target.get("properties");
  12807. for (var _iterator3 = props, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) {
  12808. var _ref3;
  12809. if (_isArray3) {
  12810. if (_i3 >= _iterator3.length) break;
  12811. _ref3 = _iterator3[_i3++];
  12812. } else {
  12813. _i3 = _iterator3.next();
  12814. if (_i3.done) break;
  12815. _ref3 = _i3.value;
  12816. }
  12817. var prop = _ref3;
  12818. if (!prop.isProperty()) continue;
  12819. var key = prop.get("key");
  12820. var match = prop.isnt("computed") && key.isIdentifier({ name: targetName });
  12821. match = match || key.isLiteral({ value: targetName });
  12822. if (match) return prop.get("value").resolve(dangerous, resolved);
  12823. }
  12824. } else if (target.isArrayExpression() && !isNaN(+targetName)) {
  12825. var elems = target.get("elements");
  12826. var elem = elems[targetName];
  12827. if (elem) return elem.resolve(dangerous, resolved);
  12828. }
  12829. }
  12830. }
  12831. },{"babel-runtime/core-js/get-iterator":95,"babel-types":151,"lodash/includes":482}],130:[function(require,module,exports){
  12832. "use strict";
  12833. exports.__esModule = true;
  12834. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  12835. var _getIterator3 = _interopRequireDefault(_getIterator2);
  12836. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  12837. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  12838. var _babelTypes = require("babel-types");
  12839. var t = _interopRequireWildcard(_babelTypes);
  12840. 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; } }
  12841. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  12842. var referenceVisitor = {
  12843. ReferencedIdentifier: function ReferencedIdentifier(path, state) {
  12844. if (path.isJSXIdentifier() && _babelTypes.react.isCompatTag(path.node.name) && !path.parentPath.isJSXMemberExpression()) {
  12845. return;
  12846. }
  12847. if (path.node.name === "this") {
  12848. var scope = path.scope;
  12849. do {
  12850. if (scope.path.isFunction() && !scope.path.isArrowFunctionExpression()) break;
  12851. } while (scope = scope.parent);
  12852. if (scope) state.breakOnScopePaths.push(scope.path);
  12853. }
  12854. var binding = path.scope.getBinding(path.node.name);
  12855. if (!binding) return;
  12856. if (binding !== state.scope.getBinding(path.node.name)) return;
  12857. state.bindings[path.node.name] = binding;
  12858. }
  12859. };
  12860. var PathHoister = function () {
  12861. function PathHoister(path, scope) {
  12862. (0, _classCallCheck3.default)(this, PathHoister);
  12863. this.breakOnScopePaths = [];
  12864. this.bindings = {};
  12865. this.scopes = [];
  12866. this.scope = scope;
  12867. this.path = path;
  12868. this.attachAfter = false;
  12869. }
  12870. PathHoister.prototype.isCompatibleScope = function isCompatibleScope(scope) {
  12871. for (var key in this.bindings) {
  12872. var binding = this.bindings[key];
  12873. if (!scope.bindingIdentifierEquals(key, binding.identifier)) {
  12874. return false;
  12875. }
  12876. }
  12877. return true;
  12878. };
  12879. PathHoister.prototype.getCompatibleScopes = function getCompatibleScopes() {
  12880. var scope = this.path.scope;
  12881. do {
  12882. if (this.isCompatibleScope(scope)) {
  12883. this.scopes.push(scope);
  12884. } else {
  12885. break;
  12886. }
  12887. if (this.breakOnScopePaths.indexOf(scope.path) >= 0) {
  12888. break;
  12889. }
  12890. } while (scope = scope.parent);
  12891. };
  12892. PathHoister.prototype.getAttachmentPath = function getAttachmentPath() {
  12893. var path = this._getAttachmentPath();
  12894. if (!path) return;
  12895. var targetScope = path.scope;
  12896. if (targetScope.path === path) {
  12897. targetScope = path.scope.parent;
  12898. }
  12899. if (targetScope.path.isProgram() || targetScope.path.isFunction()) {
  12900. for (var name in this.bindings) {
  12901. if (!targetScope.hasOwnBinding(name)) continue;
  12902. var binding = this.bindings[name];
  12903. if (binding.kind === "param") continue;
  12904. if (this.getAttachmentParentForPath(binding.path).key > path.key) {
  12905. this.attachAfter = true;
  12906. path = binding.path;
  12907. for (var _iterator = binding.constantViolations, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  12908. var _ref;
  12909. if (_isArray) {
  12910. if (_i >= _iterator.length) break;
  12911. _ref = _iterator[_i++];
  12912. } else {
  12913. _i = _iterator.next();
  12914. if (_i.done) break;
  12915. _ref = _i.value;
  12916. }
  12917. var violationPath = _ref;
  12918. if (this.getAttachmentParentForPath(violationPath).key > path.key) {
  12919. path = violationPath;
  12920. }
  12921. }
  12922. }
  12923. }
  12924. }
  12925. if (path.parentPath.isExportDeclaration()) {
  12926. path = path.parentPath;
  12927. }
  12928. return path;
  12929. };
  12930. PathHoister.prototype._getAttachmentPath = function _getAttachmentPath() {
  12931. var scopes = this.scopes;
  12932. var scope = scopes.pop();
  12933. if (!scope) return;
  12934. if (scope.path.isFunction()) {
  12935. if (this.hasOwnParamBindings(scope)) {
  12936. if (this.scope === scope) return;
  12937. return scope.path.get("body").get("body")[0];
  12938. } else {
  12939. return this.getNextScopeAttachmentParent();
  12940. }
  12941. } else if (scope.path.isProgram()) {
  12942. return this.getNextScopeAttachmentParent();
  12943. }
  12944. };
  12945. PathHoister.prototype.getNextScopeAttachmentParent = function getNextScopeAttachmentParent() {
  12946. var scope = this.scopes.pop();
  12947. if (scope) return this.getAttachmentParentForPath(scope.path);
  12948. };
  12949. PathHoister.prototype.getAttachmentParentForPath = function getAttachmentParentForPath(path) {
  12950. do {
  12951. if (!path.parentPath || Array.isArray(path.container) && path.isStatement() || path.isVariableDeclarator() && path.parentPath.node !== null && path.parentPath.node.declarations.length > 1) return path;
  12952. } while (path = path.parentPath);
  12953. };
  12954. PathHoister.prototype.hasOwnParamBindings = function hasOwnParamBindings(scope) {
  12955. for (var name in this.bindings) {
  12956. if (!scope.hasOwnBinding(name)) continue;
  12957. var binding = this.bindings[name];
  12958. if (binding.kind === "param" && binding.constant) return true;
  12959. }
  12960. return false;
  12961. };
  12962. PathHoister.prototype.run = function run() {
  12963. var node = this.path.node;
  12964. if (node._hoisted) return;
  12965. node._hoisted = true;
  12966. this.path.traverse(referenceVisitor, this);
  12967. this.getCompatibleScopes();
  12968. var attachTo = this.getAttachmentPath();
  12969. if (!attachTo) return;
  12970. if (attachTo.getFunctionParent() === this.path.getFunctionParent()) return;
  12971. var uid = attachTo.scope.generateUidIdentifier("ref");
  12972. var declarator = t.variableDeclarator(uid, this.path.node);
  12973. var insertFn = this.attachAfter ? "insertAfter" : "insertBefore";
  12974. attachTo[insertFn]([attachTo.isVariableDeclarator() ? declarator : t.variableDeclaration("var", [declarator])]);
  12975. var parent = this.path.parentPath;
  12976. if (parent.isJSXElement() && this.path.container === parent.node.children) {
  12977. uid = t.JSXExpressionContainer(uid);
  12978. }
  12979. this.path.replaceWith(uid);
  12980. };
  12981. return PathHoister;
  12982. }();
  12983. exports.default = PathHoister;
  12984. module.exports = exports["default"];
  12985. },{"babel-runtime/core-js/get-iterator":95,"babel-runtime/helpers/classCallCheck":109,"babel-types":151}],131:[function(require,module,exports){
  12986. "use strict";
  12987. exports.__esModule = true;
  12988. var hooks = exports.hooks = [function (self, parent) {
  12989. 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();
  12990. if (removeParent) {
  12991. parent.remove();
  12992. return true;
  12993. }
  12994. }, function (self, parent) {
  12995. if (parent.isSequenceExpression() && parent.node.expressions.length === 1) {
  12996. parent.replaceWith(parent.node.expressions[0]);
  12997. return true;
  12998. }
  12999. }, function (self, parent) {
  13000. if (parent.isBinary()) {
  13001. if (self.key === "left") {
  13002. parent.replaceWith(parent.node.right);
  13003. } else {
  13004. parent.replaceWith(parent.node.left);
  13005. }
  13006. return true;
  13007. }
  13008. }, function (self, parent) {
  13009. if (parent.isIfStatement() && (self.key === "consequent" || self.key === "alternate") || self.key === "body" && (parent.isLoop() || parent.isArrowFunctionExpression())) {
  13010. self.replaceWith({
  13011. type: "BlockStatement",
  13012. body: []
  13013. });
  13014. return true;
  13015. }
  13016. }];
  13017. },{}],132:[function(require,module,exports){
  13018. "use strict";
  13019. exports.__esModule = true;
  13020. 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;
  13021. var _babelTypes = require("babel-types");
  13022. var t = _interopRequireWildcard(_babelTypes);
  13023. 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; } }
  13024. var ReferencedIdentifier = exports.ReferencedIdentifier = {
  13025. types: ["Identifier", "JSXIdentifier"],
  13026. checkPath: function checkPath(_ref, opts) {
  13027. var node = _ref.node,
  13028. parent = _ref.parent;
  13029. if (!t.isIdentifier(node, opts) && !t.isJSXMemberExpression(parent, opts)) {
  13030. if (t.isJSXIdentifier(node, opts)) {
  13031. if (_babelTypes.react.isCompatTag(node.name)) return false;
  13032. } else {
  13033. return false;
  13034. }
  13035. }
  13036. return t.isReferenced(node, parent);
  13037. }
  13038. };
  13039. var ReferencedMemberExpression = exports.ReferencedMemberExpression = {
  13040. types: ["MemberExpression"],
  13041. checkPath: function checkPath(_ref2) {
  13042. var node = _ref2.node,
  13043. parent = _ref2.parent;
  13044. return t.isMemberExpression(node) && t.isReferenced(node, parent);
  13045. }
  13046. };
  13047. var BindingIdentifier = exports.BindingIdentifier = {
  13048. types: ["Identifier"],
  13049. checkPath: function checkPath(_ref3) {
  13050. var node = _ref3.node,
  13051. parent = _ref3.parent;
  13052. return t.isIdentifier(node) && t.isBinding(node, parent);
  13053. }
  13054. };
  13055. var Statement = exports.Statement = {
  13056. types: ["Statement"],
  13057. checkPath: function checkPath(_ref4) {
  13058. var node = _ref4.node,
  13059. parent = _ref4.parent;
  13060. if (t.isStatement(node)) {
  13061. if (t.isVariableDeclaration(node)) {
  13062. if (t.isForXStatement(parent, { left: node })) return false;
  13063. if (t.isForStatement(parent, { init: node })) return false;
  13064. }
  13065. return true;
  13066. } else {
  13067. return false;
  13068. }
  13069. }
  13070. };
  13071. var Expression = exports.Expression = {
  13072. types: ["Expression"],
  13073. checkPath: function checkPath(path) {
  13074. if (path.isIdentifier()) {
  13075. return path.isReferencedIdentifier();
  13076. } else {
  13077. return t.isExpression(path.node);
  13078. }
  13079. }
  13080. };
  13081. var Scope = exports.Scope = {
  13082. types: ["Scopable"],
  13083. checkPath: function checkPath(path) {
  13084. return t.isScope(path.node, path.parent);
  13085. }
  13086. };
  13087. var Referenced = exports.Referenced = {
  13088. checkPath: function checkPath(path) {
  13089. return t.isReferenced(path.node, path.parent);
  13090. }
  13091. };
  13092. var BlockScoped = exports.BlockScoped = {
  13093. checkPath: function checkPath(path) {
  13094. return t.isBlockScoped(path.node);
  13095. }
  13096. };
  13097. var Var = exports.Var = {
  13098. types: ["VariableDeclaration"],
  13099. checkPath: function checkPath(path) {
  13100. return t.isVar(path.node);
  13101. }
  13102. };
  13103. var User = exports.User = {
  13104. checkPath: function checkPath(path) {
  13105. return path.node && !!path.node.loc;
  13106. }
  13107. };
  13108. var Generated = exports.Generated = {
  13109. checkPath: function checkPath(path) {
  13110. return !path.isUser();
  13111. }
  13112. };
  13113. var Pure = exports.Pure = {
  13114. checkPath: function checkPath(path, opts) {
  13115. return path.scope.isPure(path.node, opts);
  13116. }
  13117. };
  13118. var Flow = exports.Flow = {
  13119. types: ["Flow", "ImportDeclaration", "ExportDeclaration", "ImportSpecifier"],
  13120. checkPath: function checkPath(_ref5) {
  13121. var node = _ref5.node;
  13122. if (t.isFlow(node)) {
  13123. return true;
  13124. } else if (t.isImportDeclaration(node)) {
  13125. return node.importKind === "type" || node.importKind === "typeof";
  13126. } else if (t.isExportDeclaration(node)) {
  13127. return node.exportKind === "type";
  13128. } else if (t.isImportSpecifier(node)) {
  13129. return node.importKind === "type" || node.importKind === "typeof";
  13130. } else {
  13131. return false;
  13132. }
  13133. }
  13134. };
  13135. },{"babel-types":151}],133:[function(require,module,exports){
  13136. "use strict";
  13137. exports.__esModule = true;
  13138. var _typeof2 = require("babel-runtime/helpers/typeof");
  13139. var _typeof3 = _interopRequireDefault(_typeof2);
  13140. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  13141. var _getIterator3 = _interopRequireDefault(_getIterator2);
  13142. exports.insertBefore = insertBefore;
  13143. exports._containerInsert = _containerInsert;
  13144. exports._containerInsertBefore = _containerInsertBefore;
  13145. exports._containerInsertAfter = _containerInsertAfter;
  13146. exports._maybePopFromStatements = _maybePopFromStatements;
  13147. exports.insertAfter = insertAfter;
  13148. exports.updateSiblingKeys = updateSiblingKeys;
  13149. exports._verifyNodeList = _verifyNodeList;
  13150. exports.unshiftContainer = unshiftContainer;
  13151. exports.pushContainer = pushContainer;
  13152. exports.hoist = hoist;
  13153. var _cache = require("../cache");
  13154. var _hoister = require("./lib/hoister");
  13155. var _hoister2 = _interopRequireDefault(_hoister);
  13156. var _index = require("./index");
  13157. var _index2 = _interopRequireDefault(_index);
  13158. var _babelTypes = require("babel-types");
  13159. var t = _interopRequireWildcard(_babelTypes);
  13160. 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; } }
  13161. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  13162. function insertBefore(nodes) {
  13163. this._assertUnremoved();
  13164. nodes = this._verifyNodeList(nodes);
  13165. if (this.parentPath.isExpressionStatement() || this.parentPath.isLabeledStatement()) {
  13166. return this.parentPath.insertBefore(nodes);
  13167. } else if (this.isNodeType("Expression") || this.parentPath.isForStatement() && this.key === "init") {
  13168. if (this.node) nodes.push(this.node);
  13169. this.replaceExpressionWithStatements(nodes);
  13170. } else {
  13171. this._maybePopFromStatements(nodes);
  13172. if (Array.isArray(this.container)) {
  13173. return this._containerInsertBefore(nodes);
  13174. } else if (this.isStatementOrBlock()) {
  13175. if (this.node) nodes.push(this.node);
  13176. this._replaceWith(t.blockStatement(nodes));
  13177. } else {
  13178. 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?");
  13179. }
  13180. }
  13181. return [this];
  13182. }
  13183. function _containerInsert(from, nodes) {
  13184. this.updateSiblingKeys(from, nodes.length);
  13185. var paths = [];
  13186. for (var i = 0; i < nodes.length; i++) {
  13187. var to = from + i;
  13188. var node = nodes[i];
  13189. this.container.splice(to, 0, node);
  13190. if (this.context) {
  13191. var path = this.context.create(this.parent, this.container, to, this.listKey);
  13192. if (this.context.queue) path.pushContext(this.context);
  13193. paths.push(path);
  13194. } else {
  13195. paths.push(_index2.default.get({
  13196. parentPath: this.parentPath,
  13197. parent: this.parent,
  13198. container: this.container,
  13199. listKey: this.listKey,
  13200. key: to
  13201. }));
  13202. }
  13203. }
  13204. var contexts = this._getQueueContexts();
  13205. for (var _iterator = paths, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  13206. var _ref;
  13207. if (_isArray) {
  13208. if (_i >= _iterator.length) break;
  13209. _ref = _iterator[_i++];
  13210. } else {
  13211. _i = _iterator.next();
  13212. if (_i.done) break;
  13213. _ref = _i.value;
  13214. }
  13215. var _path = _ref;
  13216. _path.setScope();
  13217. _path.debug(function () {
  13218. return "Inserted.";
  13219. });
  13220. for (var _iterator2 = contexts, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  13221. var _ref2;
  13222. if (_isArray2) {
  13223. if (_i2 >= _iterator2.length) break;
  13224. _ref2 = _iterator2[_i2++];
  13225. } else {
  13226. _i2 = _iterator2.next();
  13227. if (_i2.done) break;
  13228. _ref2 = _i2.value;
  13229. }
  13230. var context = _ref2;
  13231. context.maybeQueue(_path, true);
  13232. }
  13233. }
  13234. return paths;
  13235. }
  13236. function _containerInsertBefore(nodes) {
  13237. return this._containerInsert(this.key, nodes);
  13238. }
  13239. function _containerInsertAfter(nodes) {
  13240. return this._containerInsert(this.key + 1, nodes);
  13241. }
  13242. function _maybePopFromStatements(nodes) {
  13243. var last = nodes[nodes.length - 1];
  13244. var isIdentifier = t.isIdentifier(last) || t.isExpressionStatement(last) && t.isIdentifier(last.expression);
  13245. if (isIdentifier && !this.isCompletionRecord()) {
  13246. nodes.pop();
  13247. }
  13248. }
  13249. function insertAfter(nodes) {
  13250. this._assertUnremoved();
  13251. nodes = this._verifyNodeList(nodes);
  13252. if (this.parentPath.isExpressionStatement() || this.parentPath.isLabeledStatement()) {
  13253. return this.parentPath.insertAfter(nodes);
  13254. } else if (this.isNodeType("Expression") || this.parentPath.isForStatement() && this.key === "init") {
  13255. if (this.node) {
  13256. var temp = this.scope.generateDeclaredUidIdentifier();
  13257. nodes.unshift(t.expressionStatement(t.assignmentExpression("=", temp, this.node)));
  13258. nodes.push(t.expressionStatement(temp));
  13259. }
  13260. this.replaceExpressionWithStatements(nodes);
  13261. } else {
  13262. this._maybePopFromStatements(nodes);
  13263. if (Array.isArray(this.container)) {
  13264. return this._containerInsertAfter(nodes);
  13265. } else if (this.isStatementOrBlock()) {
  13266. if (this.node) nodes.unshift(this.node);
  13267. this._replaceWith(t.blockStatement(nodes));
  13268. } else {
  13269. 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?");
  13270. }
  13271. }
  13272. return [this];
  13273. }
  13274. function updateSiblingKeys(fromIndex, incrementBy) {
  13275. if (!this.parent) return;
  13276. var paths = _cache.path.get(this.parent);
  13277. for (var i = 0; i < paths.length; i++) {
  13278. var path = paths[i];
  13279. if (path.key >= fromIndex) {
  13280. path.key += incrementBy;
  13281. }
  13282. }
  13283. }
  13284. function _verifyNodeList(nodes) {
  13285. if (!nodes) {
  13286. return [];
  13287. }
  13288. if (nodes.constructor !== Array) {
  13289. nodes = [nodes];
  13290. }
  13291. for (var i = 0; i < nodes.length; i++) {
  13292. var node = nodes[i];
  13293. var msg = void 0;
  13294. if (!node) {
  13295. msg = "has falsy node";
  13296. } else if ((typeof node === "undefined" ? "undefined" : (0, _typeof3.default)(node)) !== "object") {
  13297. msg = "contains a non-object node";
  13298. } else if (!node.type) {
  13299. msg = "without a type";
  13300. } else if (node instanceof _index2.default) {
  13301. msg = "has a NodePath when it expected a raw object";
  13302. }
  13303. if (msg) {
  13304. var type = Array.isArray(node) ? "array" : typeof node === "undefined" ? "undefined" : (0, _typeof3.default)(node);
  13305. throw new Error("Node list " + msg + " with the index of " + i + " and type of " + type);
  13306. }
  13307. }
  13308. return nodes;
  13309. }
  13310. function unshiftContainer(listKey, nodes) {
  13311. this._assertUnremoved();
  13312. nodes = this._verifyNodeList(nodes);
  13313. var path = _index2.default.get({
  13314. parentPath: this,
  13315. parent: this.node,
  13316. container: this.node[listKey],
  13317. listKey: listKey,
  13318. key: 0
  13319. });
  13320. return path.insertBefore(nodes);
  13321. }
  13322. function pushContainer(listKey, nodes) {
  13323. this._assertUnremoved();
  13324. nodes = this._verifyNodeList(nodes);
  13325. var container = this.node[listKey];
  13326. var path = _index2.default.get({
  13327. parentPath: this,
  13328. parent: this.node,
  13329. container: container,
  13330. listKey: listKey,
  13331. key: container.length
  13332. });
  13333. return path.replaceWithMultiple(nodes);
  13334. }
  13335. function hoist() {
  13336. var scope = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.scope;
  13337. var hoister = new _hoister2.default(this, scope);
  13338. return hoister.run();
  13339. }
  13340. },{"../cache":115,"./index":125,"./lib/hoister":130,"babel-runtime/core-js/get-iterator":95,"babel-runtime/helpers/typeof":113,"babel-types":151}],134:[function(require,module,exports){
  13341. "use strict";
  13342. exports.__esModule = true;
  13343. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  13344. var _getIterator3 = _interopRequireDefault(_getIterator2);
  13345. exports.remove = remove;
  13346. exports._callRemovalHooks = _callRemovalHooks;
  13347. exports._remove = _remove;
  13348. exports._markRemoved = _markRemoved;
  13349. exports._assertUnremoved = _assertUnremoved;
  13350. var _removalHooks = require("./lib/removal-hooks");
  13351. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  13352. function remove() {
  13353. this._assertUnremoved();
  13354. this.resync();
  13355. if (this._callRemovalHooks()) {
  13356. this._markRemoved();
  13357. return;
  13358. }
  13359. this.shareCommentsWithSiblings();
  13360. this._remove();
  13361. this._markRemoved();
  13362. }
  13363. function _callRemovalHooks() {
  13364. for (var _iterator = _removalHooks.hooks, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  13365. var _ref;
  13366. if (_isArray) {
  13367. if (_i >= _iterator.length) break;
  13368. _ref = _iterator[_i++];
  13369. } else {
  13370. _i = _iterator.next();
  13371. if (_i.done) break;
  13372. _ref = _i.value;
  13373. }
  13374. var fn = _ref;
  13375. if (fn(this, this.parentPath)) return true;
  13376. }
  13377. }
  13378. function _remove() {
  13379. if (Array.isArray(this.container)) {
  13380. this.container.splice(this.key, 1);
  13381. this.updateSiblingKeys(this.key, -1);
  13382. } else {
  13383. this._replaceWith(null);
  13384. }
  13385. }
  13386. function _markRemoved() {
  13387. this.shouldSkip = true;
  13388. this.removed = true;
  13389. this.node = null;
  13390. }
  13391. function _assertUnremoved() {
  13392. if (this.removed) {
  13393. throw this.buildCodeFrameError("NodePath has been removed so is read-only.");
  13394. }
  13395. }
  13396. },{"./lib/removal-hooks":131,"babel-runtime/core-js/get-iterator":95}],135:[function(require,module,exports){
  13397. "use strict";
  13398. exports.__esModule = true;
  13399. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  13400. var _getIterator3 = _interopRequireDefault(_getIterator2);
  13401. exports.replaceWithMultiple = replaceWithMultiple;
  13402. exports.replaceWithSourceString = replaceWithSourceString;
  13403. exports.replaceWith = replaceWith;
  13404. exports._replaceWith = _replaceWith;
  13405. exports.replaceExpressionWithStatements = replaceExpressionWithStatements;
  13406. exports.replaceInline = replaceInline;
  13407. var _babelCodeFrame = require("babel-code-frame");
  13408. var _babelCodeFrame2 = _interopRequireDefault(_babelCodeFrame);
  13409. var _index = require("../index");
  13410. var _index2 = _interopRequireDefault(_index);
  13411. var _index3 = require("./index");
  13412. var _index4 = _interopRequireDefault(_index3);
  13413. var _babylon = require("babylon");
  13414. var _babelTypes = require("babel-types");
  13415. var t = _interopRequireWildcard(_babelTypes);
  13416. 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; } }
  13417. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  13418. var hoistVariablesVisitor = {
  13419. Function: function Function(path) {
  13420. path.skip();
  13421. },
  13422. VariableDeclaration: function VariableDeclaration(path) {
  13423. if (path.node.kind !== "var") return;
  13424. var bindings = path.getBindingIdentifiers();
  13425. for (var key in bindings) {
  13426. path.scope.push({ id: bindings[key] });
  13427. }
  13428. var exprs = [];
  13429. for (var _iterator = path.node.declarations, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  13430. var _ref;
  13431. if (_isArray) {
  13432. if (_i >= _iterator.length) break;
  13433. _ref = _iterator[_i++];
  13434. } else {
  13435. _i = _iterator.next();
  13436. if (_i.done) break;
  13437. _ref = _i.value;
  13438. }
  13439. var declar = _ref;
  13440. if (declar.init) {
  13441. exprs.push(t.expressionStatement(t.assignmentExpression("=", declar.id, declar.init)));
  13442. }
  13443. }
  13444. path.replaceWithMultiple(exprs);
  13445. }
  13446. };
  13447. function replaceWithMultiple(nodes) {
  13448. this.resync();
  13449. nodes = this._verifyNodeList(nodes);
  13450. t.inheritLeadingComments(nodes[0], this.node);
  13451. t.inheritTrailingComments(nodes[nodes.length - 1], this.node);
  13452. this.node = this.container[this.key] = null;
  13453. this.insertAfter(nodes);
  13454. if (this.node) {
  13455. this.requeue();
  13456. } else {
  13457. this.remove();
  13458. }
  13459. }
  13460. function replaceWithSourceString(replacement) {
  13461. this.resync();
  13462. try {
  13463. replacement = "(" + replacement + ")";
  13464. replacement = (0, _babylon.parse)(replacement);
  13465. } catch (err) {
  13466. var loc = err.loc;
  13467. if (loc) {
  13468. err.message += " - make sure this is an expression.";
  13469. err.message += "\n" + (0, _babelCodeFrame2.default)(replacement, loc.line, loc.column + 1);
  13470. }
  13471. throw err;
  13472. }
  13473. replacement = replacement.program.body[0].expression;
  13474. _index2.default.removeProperties(replacement);
  13475. return this.replaceWith(replacement);
  13476. }
  13477. function replaceWith(replacement) {
  13478. this.resync();
  13479. if (this.removed) {
  13480. throw new Error("You can't replace this node, we've already removed it");
  13481. }
  13482. if (replacement instanceof _index4.default) {
  13483. replacement = replacement.node;
  13484. }
  13485. if (!replacement) {
  13486. throw new Error("You passed `path.replaceWith()` a falsy node, use `path.remove()` instead");
  13487. }
  13488. if (this.node === replacement) {
  13489. return;
  13490. }
  13491. if (this.isProgram() && !t.isProgram(replacement)) {
  13492. throw new Error("You can only replace a Program root node with another Program node");
  13493. }
  13494. if (Array.isArray(replacement)) {
  13495. throw new Error("Don't use `path.replaceWith()` with an array of nodes, use `path.replaceWithMultiple()`");
  13496. }
  13497. if (typeof replacement === "string") {
  13498. throw new Error("Don't use `path.replaceWith()` with a source string, use `path.replaceWithSourceString()`");
  13499. }
  13500. if (this.isNodeType("Statement") && t.isExpression(replacement)) {
  13501. if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement) && !this.parentPath.isExportDefaultDeclaration()) {
  13502. replacement = t.expressionStatement(replacement);
  13503. }
  13504. }
  13505. if (this.isNodeType("Expression") && t.isStatement(replacement)) {
  13506. if (!this.canHaveVariableDeclarationOrExpression() && !this.canSwapBetweenExpressionAndStatement(replacement)) {
  13507. return this.replaceExpressionWithStatements([replacement]);
  13508. }
  13509. }
  13510. var oldNode = this.node;
  13511. if (oldNode) {
  13512. t.inheritsComments(replacement, oldNode);
  13513. t.removeComments(oldNode);
  13514. }
  13515. this._replaceWith(replacement);
  13516. this.type = replacement.type;
  13517. this.setScope();
  13518. this.requeue();
  13519. }
  13520. function _replaceWith(node) {
  13521. if (!this.container) {
  13522. throw new ReferenceError("Container is falsy");
  13523. }
  13524. if (this.inList) {
  13525. t.validate(this.parent, this.key, [node]);
  13526. } else {
  13527. t.validate(this.parent, this.key, node);
  13528. }
  13529. this.debug(function () {
  13530. return "Replace with " + (node && node.type);
  13531. });
  13532. this.node = this.container[this.key] = node;
  13533. }
  13534. function replaceExpressionWithStatements(nodes) {
  13535. this.resync();
  13536. var toSequenceExpression = t.toSequenceExpression(nodes, this.scope);
  13537. if (t.isSequenceExpression(toSequenceExpression)) {
  13538. var exprs = toSequenceExpression.expressions;
  13539. if (exprs.length >= 2 && this.parentPath.isExpressionStatement()) {
  13540. this._maybePopFromStatements(exprs);
  13541. }
  13542. if (exprs.length === 1) {
  13543. this.replaceWith(exprs[0]);
  13544. } else {
  13545. this.replaceWith(toSequenceExpression);
  13546. }
  13547. } else if (toSequenceExpression) {
  13548. this.replaceWith(toSequenceExpression);
  13549. } else {
  13550. var container = t.functionExpression(null, [], t.blockStatement(nodes));
  13551. container.shadow = true;
  13552. this.replaceWith(t.callExpression(container, []));
  13553. this.traverse(hoistVariablesVisitor);
  13554. var completionRecords = this.get("callee").getCompletionRecords();
  13555. for (var _iterator2 = completionRecords, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  13556. var _ref2;
  13557. if (_isArray2) {
  13558. if (_i2 >= _iterator2.length) break;
  13559. _ref2 = _iterator2[_i2++];
  13560. } else {
  13561. _i2 = _iterator2.next();
  13562. if (_i2.done) break;
  13563. _ref2 = _i2.value;
  13564. }
  13565. var path = _ref2;
  13566. if (!path.isExpressionStatement()) continue;
  13567. var loop = path.findParent(function (path) {
  13568. return path.isLoop();
  13569. });
  13570. if (loop) {
  13571. var uid = loop.getData("expressionReplacementReturnUid");
  13572. if (!uid) {
  13573. var callee = this.get("callee");
  13574. uid = callee.scope.generateDeclaredUidIdentifier("ret");
  13575. callee.get("body").pushContainer("body", t.returnStatement(uid));
  13576. loop.setData("expressionReplacementReturnUid", uid);
  13577. } else {
  13578. uid = t.identifier(uid.name);
  13579. }
  13580. path.get("expression").replaceWith(t.assignmentExpression("=", uid, path.node.expression));
  13581. } else {
  13582. path.replaceWith(t.returnStatement(path.node.expression));
  13583. }
  13584. }
  13585. return this.node;
  13586. }
  13587. }
  13588. function replaceInline(nodes) {
  13589. this.resync();
  13590. if (Array.isArray(nodes)) {
  13591. if (Array.isArray(this.container)) {
  13592. nodes = this._verifyNodeList(nodes);
  13593. this._containerInsertAfter(nodes);
  13594. return this.remove();
  13595. } else {
  13596. return this.replaceWithMultiple(nodes);
  13597. }
  13598. } else {
  13599. return this.replaceWith(nodes);
  13600. }
  13601. }
  13602. },{"../index":118,"./index":125,"babel-code-frame":4,"babel-runtime/core-js/get-iterator":95,"babel-types":151,"babylon":155}],136:[function(require,module,exports){
  13603. "use strict";
  13604. exports.__esModule = true;
  13605. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  13606. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  13607. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  13608. var Binding = function () {
  13609. function Binding(_ref) {
  13610. var existing = _ref.existing,
  13611. identifier = _ref.identifier,
  13612. scope = _ref.scope,
  13613. path = _ref.path,
  13614. kind = _ref.kind;
  13615. (0, _classCallCheck3.default)(this, Binding);
  13616. this.identifier = identifier;
  13617. this.scope = scope;
  13618. this.path = path;
  13619. this.kind = kind;
  13620. this.constantViolations = [];
  13621. this.constant = true;
  13622. this.referencePaths = [];
  13623. this.referenced = false;
  13624. this.references = 0;
  13625. this.clearValue();
  13626. if (existing) {
  13627. this.constantViolations = [].concat(existing.path, existing.constantViolations, this.constantViolations);
  13628. }
  13629. }
  13630. Binding.prototype.deoptValue = function deoptValue() {
  13631. this.clearValue();
  13632. this.hasDeoptedValue = true;
  13633. };
  13634. Binding.prototype.setValue = function setValue(value) {
  13635. if (this.hasDeoptedValue) return;
  13636. this.hasValue = true;
  13637. this.value = value;
  13638. };
  13639. Binding.prototype.clearValue = function clearValue() {
  13640. this.hasDeoptedValue = false;
  13641. this.hasValue = false;
  13642. this.value = null;
  13643. };
  13644. Binding.prototype.reassign = function reassign(path) {
  13645. this.constant = false;
  13646. if (this.constantViolations.indexOf(path) !== -1) {
  13647. return;
  13648. }
  13649. this.constantViolations.push(path);
  13650. };
  13651. Binding.prototype.reference = function reference(path) {
  13652. if (this.referencePaths.indexOf(path) !== -1) {
  13653. return;
  13654. }
  13655. this.referenced = true;
  13656. this.references++;
  13657. this.referencePaths.push(path);
  13658. };
  13659. Binding.prototype.dereference = function dereference() {
  13660. this.references--;
  13661. this.referenced = !!this.references;
  13662. };
  13663. return Binding;
  13664. }();
  13665. exports.default = Binding;
  13666. module.exports = exports["default"];
  13667. },{"babel-runtime/helpers/classCallCheck":109}],137:[function(require,module,exports){
  13668. "use strict";
  13669. exports.__esModule = true;
  13670. var _keys = require("babel-runtime/core-js/object/keys");
  13671. var _keys2 = _interopRequireDefault(_keys);
  13672. var _create = require("babel-runtime/core-js/object/create");
  13673. var _create2 = _interopRequireDefault(_create);
  13674. var _map = require("babel-runtime/core-js/map");
  13675. var _map2 = _interopRequireDefault(_map);
  13676. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  13677. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  13678. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  13679. var _getIterator3 = _interopRequireDefault(_getIterator2);
  13680. var _includes = require("lodash/includes");
  13681. var _includes2 = _interopRequireDefault(_includes);
  13682. var _repeat = require("lodash/repeat");
  13683. var _repeat2 = _interopRequireDefault(_repeat);
  13684. var _renamer = require("./lib/renamer");
  13685. var _renamer2 = _interopRequireDefault(_renamer);
  13686. var _index = require("../index");
  13687. var _index2 = _interopRequireDefault(_index);
  13688. var _defaults = require("lodash/defaults");
  13689. var _defaults2 = _interopRequireDefault(_defaults);
  13690. var _babelMessages = require("babel-messages");
  13691. var messages = _interopRequireWildcard(_babelMessages);
  13692. var _binding2 = require("./binding");
  13693. var _binding3 = _interopRequireDefault(_binding2);
  13694. var _globals = require("globals");
  13695. var _globals2 = _interopRequireDefault(_globals);
  13696. var _babelTypes = require("babel-types");
  13697. var t = _interopRequireWildcard(_babelTypes);
  13698. var _cache = require("../cache");
  13699. 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; } }
  13700. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  13701. var _crawlCallsCount = 0;
  13702. function getCache(path, parentScope, self) {
  13703. var scopes = _cache.scope.get(path.node) || [];
  13704. for (var _iterator = scopes, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  13705. var _ref;
  13706. if (_isArray) {
  13707. if (_i >= _iterator.length) break;
  13708. _ref = _iterator[_i++];
  13709. } else {
  13710. _i = _iterator.next();
  13711. if (_i.done) break;
  13712. _ref = _i.value;
  13713. }
  13714. var scope = _ref;
  13715. if (scope.parent === parentScope && scope.path === path) return scope;
  13716. }
  13717. scopes.push(self);
  13718. if (!_cache.scope.has(path.node)) {
  13719. _cache.scope.set(path.node, scopes);
  13720. }
  13721. }
  13722. function gatherNodeParts(node, parts) {
  13723. if (t.isModuleDeclaration(node)) {
  13724. if (node.source) {
  13725. gatherNodeParts(node.source, parts);
  13726. } else if (node.specifiers && node.specifiers.length) {
  13727. for (var _iterator2 = node.specifiers, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  13728. var _ref2;
  13729. if (_isArray2) {
  13730. if (_i2 >= _iterator2.length) break;
  13731. _ref2 = _iterator2[_i2++];
  13732. } else {
  13733. _i2 = _iterator2.next();
  13734. if (_i2.done) break;
  13735. _ref2 = _i2.value;
  13736. }
  13737. var specifier = _ref2;
  13738. gatherNodeParts(specifier, parts);
  13739. }
  13740. } else if (node.declaration) {
  13741. gatherNodeParts(node.declaration, parts);
  13742. }
  13743. } else if (t.isModuleSpecifier(node)) {
  13744. gatherNodeParts(node.local, parts);
  13745. } else if (t.isMemberExpression(node)) {
  13746. gatherNodeParts(node.object, parts);
  13747. gatherNodeParts(node.property, parts);
  13748. } else if (t.isIdentifier(node)) {
  13749. parts.push(node.name);
  13750. } else if (t.isLiteral(node)) {
  13751. parts.push(node.value);
  13752. } else if (t.isCallExpression(node)) {
  13753. gatherNodeParts(node.callee, parts);
  13754. } else if (t.isObjectExpression(node) || t.isObjectPattern(node)) {
  13755. for (var _iterator3 = node.properties, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) {
  13756. var _ref3;
  13757. if (_isArray3) {
  13758. if (_i3 >= _iterator3.length) break;
  13759. _ref3 = _iterator3[_i3++];
  13760. } else {
  13761. _i3 = _iterator3.next();
  13762. if (_i3.done) break;
  13763. _ref3 = _i3.value;
  13764. }
  13765. var prop = _ref3;
  13766. gatherNodeParts(prop.key || prop.argument, parts);
  13767. }
  13768. }
  13769. }
  13770. var collectorVisitor = {
  13771. For: function For(path) {
  13772. for (var _iterator4 = t.FOR_INIT_KEYS, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) {
  13773. var _ref4;
  13774. if (_isArray4) {
  13775. if (_i4 >= _iterator4.length) break;
  13776. _ref4 = _iterator4[_i4++];
  13777. } else {
  13778. _i4 = _iterator4.next();
  13779. if (_i4.done) break;
  13780. _ref4 = _i4.value;
  13781. }
  13782. var key = _ref4;
  13783. var declar = path.get(key);
  13784. if (declar.isVar()) path.scope.getFunctionParent().registerBinding("var", declar);
  13785. }
  13786. },
  13787. Declaration: function Declaration(path) {
  13788. if (path.isBlockScoped()) return;
  13789. if (path.isExportDeclaration() && path.get("declaration").isDeclaration()) return;
  13790. path.scope.getFunctionParent().registerDeclaration(path);
  13791. },
  13792. ReferencedIdentifier: function ReferencedIdentifier(path, state) {
  13793. state.references.push(path);
  13794. },
  13795. ForXStatement: function ForXStatement(path, state) {
  13796. var left = path.get("left");
  13797. if (left.isPattern() || left.isIdentifier()) {
  13798. state.constantViolations.push(left);
  13799. }
  13800. },
  13801. ExportDeclaration: {
  13802. exit: function exit(path) {
  13803. var node = path.node,
  13804. scope = path.scope;
  13805. var declar = node.declaration;
  13806. if (t.isClassDeclaration(declar) || t.isFunctionDeclaration(declar)) {
  13807. var _id = declar.id;
  13808. if (!_id) return;
  13809. var binding = scope.getBinding(_id.name);
  13810. if (binding) binding.reference(path);
  13811. } else if (t.isVariableDeclaration(declar)) {
  13812. for (var _iterator5 = declar.declarations, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : (0, _getIterator3.default)(_iterator5);;) {
  13813. var _ref5;
  13814. if (_isArray5) {
  13815. if (_i5 >= _iterator5.length) break;
  13816. _ref5 = _iterator5[_i5++];
  13817. } else {
  13818. _i5 = _iterator5.next();
  13819. if (_i5.done) break;
  13820. _ref5 = _i5.value;
  13821. }
  13822. var decl = _ref5;
  13823. var ids = t.getBindingIdentifiers(decl);
  13824. for (var name in ids) {
  13825. var _binding = scope.getBinding(name);
  13826. if (_binding) _binding.reference(path);
  13827. }
  13828. }
  13829. }
  13830. }
  13831. },
  13832. LabeledStatement: function LabeledStatement(path) {
  13833. path.scope.getProgramParent().addGlobal(path.node);
  13834. path.scope.getBlockParent().registerDeclaration(path);
  13835. },
  13836. AssignmentExpression: function AssignmentExpression(path, state) {
  13837. state.assignments.push(path);
  13838. },
  13839. UpdateExpression: function UpdateExpression(path, state) {
  13840. state.constantViolations.push(path.get("argument"));
  13841. },
  13842. UnaryExpression: function UnaryExpression(path, state) {
  13843. if (path.node.operator === "delete") {
  13844. state.constantViolations.push(path.get("argument"));
  13845. }
  13846. },
  13847. BlockScoped: function BlockScoped(path) {
  13848. var scope = path.scope;
  13849. if (scope.path === path) scope = scope.parent;
  13850. scope.getBlockParent().registerDeclaration(path);
  13851. },
  13852. ClassDeclaration: function ClassDeclaration(path) {
  13853. var id = path.node.id;
  13854. if (!id) return;
  13855. var name = id.name;
  13856. path.scope.bindings[name] = path.scope.getBinding(name);
  13857. },
  13858. Block: function Block(path) {
  13859. var paths = path.get("body");
  13860. for (var _iterator6 = paths, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : (0, _getIterator3.default)(_iterator6);;) {
  13861. var _ref6;
  13862. if (_isArray6) {
  13863. if (_i6 >= _iterator6.length) break;
  13864. _ref6 = _iterator6[_i6++];
  13865. } else {
  13866. _i6 = _iterator6.next();
  13867. if (_i6.done) break;
  13868. _ref6 = _i6.value;
  13869. }
  13870. var bodyPath = _ref6;
  13871. if (bodyPath.isFunctionDeclaration()) {
  13872. path.scope.getBlockParent().registerDeclaration(bodyPath);
  13873. }
  13874. }
  13875. }
  13876. };
  13877. var uid = 0;
  13878. var Scope = function () {
  13879. function Scope(path, parentScope) {
  13880. (0, _classCallCheck3.default)(this, Scope);
  13881. if (parentScope && parentScope.block === path.node) {
  13882. return parentScope;
  13883. }
  13884. var cached = getCache(path, parentScope, this);
  13885. if (cached) return cached;
  13886. this.uid = uid++;
  13887. this.parent = parentScope;
  13888. this.hub = path.hub;
  13889. this.parentBlock = path.parent;
  13890. this.block = path.node;
  13891. this.path = path;
  13892. this.labels = new _map2.default();
  13893. }
  13894. Scope.prototype.traverse = function traverse(node, opts, state) {
  13895. (0, _index2.default)(node, opts, this, state, this.path);
  13896. };
  13897. Scope.prototype.generateDeclaredUidIdentifier = function generateDeclaredUidIdentifier() {
  13898. var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "temp";
  13899. var id = this.generateUidIdentifier(name);
  13900. this.push({ id: id });
  13901. return id;
  13902. };
  13903. Scope.prototype.generateUidIdentifier = function generateUidIdentifier() {
  13904. var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "temp";
  13905. return t.identifier(this.generateUid(name));
  13906. };
  13907. Scope.prototype.generateUid = function generateUid() {
  13908. var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "temp";
  13909. name = t.toIdentifier(name).replace(/^_+/, "").replace(/[0-9]+$/g, "");
  13910. var uid = void 0;
  13911. var i = 0;
  13912. do {
  13913. uid = this._generateUid(name, i);
  13914. i++;
  13915. } while (this.hasLabel(uid) || this.hasBinding(uid) || this.hasGlobal(uid) || this.hasReference(uid));
  13916. var program = this.getProgramParent();
  13917. program.references[uid] = true;
  13918. program.uids[uid] = true;
  13919. return uid;
  13920. };
  13921. Scope.prototype._generateUid = function _generateUid(name, i) {
  13922. var id = name;
  13923. if (i > 1) id += i;
  13924. return "_" + id;
  13925. };
  13926. Scope.prototype.generateUidIdentifierBasedOnNode = function generateUidIdentifierBasedOnNode(parent, defaultName) {
  13927. var node = parent;
  13928. if (t.isAssignmentExpression(parent)) {
  13929. node = parent.left;
  13930. } else if (t.isVariableDeclarator(parent)) {
  13931. node = parent.id;
  13932. } else if (t.isObjectProperty(node) || t.isObjectMethod(node)) {
  13933. node = node.key;
  13934. }
  13935. var parts = [];
  13936. gatherNodeParts(node, parts);
  13937. var id = parts.join("$");
  13938. id = id.replace(/^_/, "") || defaultName || "ref";
  13939. return this.generateUidIdentifier(id.slice(0, 20));
  13940. };
  13941. Scope.prototype.isStatic = function isStatic(node) {
  13942. if (t.isThisExpression(node) || t.isSuper(node)) {
  13943. return true;
  13944. }
  13945. if (t.isIdentifier(node)) {
  13946. var binding = this.getBinding(node.name);
  13947. if (binding) {
  13948. return binding.constant;
  13949. } else {
  13950. return this.hasBinding(node.name);
  13951. }
  13952. }
  13953. return false;
  13954. };
  13955. Scope.prototype.maybeGenerateMemoised = function maybeGenerateMemoised(node, dontPush) {
  13956. if (this.isStatic(node)) {
  13957. return null;
  13958. } else {
  13959. var _id2 = this.generateUidIdentifierBasedOnNode(node);
  13960. if (!dontPush) this.push({ id: _id2 });
  13961. return _id2;
  13962. }
  13963. };
  13964. Scope.prototype.checkBlockScopedCollisions = function checkBlockScopedCollisions(local, kind, name, id) {
  13965. if (kind === "param") return;
  13966. if (kind === "hoisted" && local.kind === "let") return;
  13967. var duplicate = kind === "let" || local.kind === "let" || local.kind === "const" || local.kind === "module" || local.kind === "param" && (kind === "let" || kind === "const");
  13968. if (duplicate) {
  13969. throw this.hub.file.buildCodeFrameError(id, messages.get("scopeDuplicateDeclaration", name), TypeError);
  13970. }
  13971. };
  13972. Scope.prototype.rename = function rename(oldName, newName, block) {
  13973. var binding = this.getBinding(oldName);
  13974. if (binding) {
  13975. newName = newName || this.generateUidIdentifier(oldName).name;
  13976. return new _renamer2.default(binding, oldName, newName).rename(block);
  13977. }
  13978. };
  13979. Scope.prototype._renameFromMap = function _renameFromMap(map, oldName, newName, value) {
  13980. if (map[oldName]) {
  13981. map[newName] = value;
  13982. map[oldName] = null;
  13983. }
  13984. };
  13985. Scope.prototype.dump = function dump() {
  13986. var sep = (0, _repeat2.default)("-", 60);
  13987. console.log(sep);
  13988. var scope = this;
  13989. do {
  13990. console.log("#", scope.block.type);
  13991. for (var name in scope.bindings) {
  13992. var binding = scope.bindings[name];
  13993. console.log(" -", name, {
  13994. constant: binding.constant,
  13995. references: binding.references,
  13996. violations: binding.constantViolations.length,
  13997. kind: binding.kind
  13998. });
  13999. }
  14000. } while (scope = scope.parent);
  14001. console.log(sep);
  14002. };
  14003. Scope.prototype.toArray = function toArray(node, i) {
  14004. var file = this.hub.file;
  14005. if (t.isIdentifier(node)) {
  14006. var binding = this.getBinding(node.name);
  14007. if (binding && binding.constant && binding.path.isGenericType("Array")) return node;
  14008. }
  14009. if (t.isArrayExpression(node)) {
  14010. return node;
  14011. }
  14012. if (t.isIdentifier(node, { name: "arguments" })) {
  14013. return t.callExpression(t.memberExpression(t.memberExpression(t.memberExpression(t.identifier("Array"), t.identifier("prototype")), t.identifier("slice")), t.identifier("call")), [node]);
  14014. }
  14015. var helperName = "toArray";
  14016. var args = [node];
  14017. if (i === true) {
  14018. helperName = "toConsumableArray";
  14019. } else if (i) {
  14020. args.push(t.numericLiteral(i));
  14021. helperName = "slicedToArray";
  14022. }
  14023. return t.callExpression(file.addHelper(helperName), args);
  14024. };
  14025. Scope.prototype.hasLabel = function hasLabel(name) {
  14026. return !!this.getLabel(name);
  14027. };
  14028. Scope.prototype.getLabel = function getLabel(name) {
  14029. return this.labels.get(name);
  14030. };
  14031. Scope.prototype.registerLabel = function registerLabel(path) {
  14032. this.labels.set(path.node.label.name, path);
  14033. };
  14034. Scope.prototype.registerDeclaration = function registerDeclaration(path) {
  14035. if (path.isLabeledStatement()) {
  14036. this.registerLabel(path);
  14037. } else if (path.isFunctionDeclaration()) {
  14038. this.registerBinding("hoisted", path.get("id"), path);
  14039. } else if (path.isVariableDeclaration()) {
  14040. var declarations = path.get("declarations");
  14041. for (var _iterator7 = declarations, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : (0, _getIterator3.default)(_iterator7);;) {
  14042. var _ref7;
  14043. if (_isArray7) {
  14044. if (_i7 >= _iterator7.length) break;
  14045. _ref7 = _iterator7[_i7++];
  14046. } else {
  14047. _i7 = _iterator7.next();
  14048. if (_i7.done) break;
  14049. _ref7 = _i7.value;
  14050. }
  14051. var declar = _ref7;
  14052. this.registerBinding(path.node.kind, declar);
  14053. }
  14054. } else if (path.isClassDeclaration()) {
  14055. this.registerBinding("let", path);
  14056. } else if (path.isImportDeclaration()) {
  14057. var specifiers = path.get("specifiers");
  14058. for (var _iterator8 = specifiers, _isArray8 = Array.isArray(_iterator8), _i8 = 0, _iterator8 = _isArray8 ? _iterator8 : (0, _getIterator3.default)(_iterator8);;) {
  14059. var _ref8;
  14060. if (_isArray8) {
  14061. if (_i8 >= _iterator8.length) break;
  14062. _ref8 = _iterator8[_i8++];
  14063. } else {
  14064. _i8 = _iterator8.next();
  14065. if (_i8.done) break;
  14066. _ref8 = _i8.value;
  14067. }
  14068. var specifier = _ref8;
  14069. this.registerBinding("module", specifier);
  14070. }
  14071. } else if (path.isExportDeclaration()) {
  14072. var _declar = path.get("declaration");
  14073. if (_declar.isClassDeclaration() || _declar.isFunctionDeclaration() || _declar.isVariableDeclaration()) {
  14074. this.registerDeclaration(_declar);
  14075. }
  14076. } else {
  14077. this.registerBinding("unknown", path);
  14078. }
  14079. };
  14080. Scope.prototype.buildUndefinedNode = function buildUndefinedNode() {
  14081. if (this.hasBinding("undefined")) {
  14082. return t.unaryExpression("void", t.numericLiteral(0), true);
  14083. } else {
  14084. return t.identifier("undefined");
  14085. }
  14086. };
  14087. Scope.prototype.registerConstantViolation = function registerConstantViolation(path) {
  14088. var ids = path.getBindingIdentifiers();
  14089. for (var name in ids) {
  14090. var binding = this.getBinding(name);
  14091. if (binding) binding.reassign(path);
  14092. }
  14093. };
  14094. Scope.prototype.registerBinding = function registerBinding(kind, path) {
  14095. var bindingPath = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : path;
  14096. if (!kind) throw new ReferenceError("no `kind`");
  14097. if (path.isVariableDeclaration()) {
  14098. var declarators = path.get("declarations");
  14099. for (var _iterator9 = declarators, _isArray9 = Array.isArray(_iterator9), _i9 = 0, _iterator9 = _isArray9 ? _iterator9 : (0, _getIterator3.default)(_iterator9);;) {
  14100. var _ref9;
  14101. if (_isArray9) {
  14102. if (_i9 >= _iterator9.length) break;
  14103. _ref9 = _iterator9[_i9++];
  14104. } else {
  14105. _i9 = _iterator9.next();
  14106. if (_i9.done) break;
  14107. _ref9 = _i9.value;
  14108. }
  14109. var declar = _ref9;
  14110. this.registerBinding(kind, declar);
  14111. }
  14112. return;
  14113. }
  14114. var parent = this.getProgramParent();
  14115. var ids = path.getBindingIdentifiers(true);
  14116. for (var name in ids) {
  14117. for (var _iterator10 = ids[name], _isArray10 = Array.isArray(_iterator10), _i10 = 0, _iterator10 = _isArray10 ? _iterator10 : (0, _getIterator3.default)(_iterator10);;) {
  14118. var _ref10;
  14119. if (_isArray10) {
  14120. if (_i10 >= _iterator10.length) break;
  14121. _ref10 = _iterator10[_i10++];
  14122. } else {
  14123. _i10 = _iterator10.next();
  14124. if (_i10.done) break;
  14125. _ref10 = _i10.value;
  14126. }
  14127. var _id3 = _ref10;
  14128. var local = this.getOwnBinding(name);
  14129. if (local) {
  14130. if (local.identifier === _id3) continue;
  14131. this.checkBlockScopedCollisions(local, kind, name, _id3);
  14132. }
  14133. if (local && local.path.isFlow()) local = null;
  14134. parent.references[name] = true;
  14135. this.bindings[name] = new _binding3.default({
  14136. identifier: _id3,
  14137. existing: local,
  14138. scope: this,
  14139. path: bindingPath,
  14140. kind: kind
  14141. });
  14142. }
  14143. }
  14144. };
  14145. Scope.prototype.addGlobal = function addGlobal(node) {
  14146. this.globals[node.name] = node;
  14147. };
  14148. Scope.prototype.hasUid = function hasUid(name) {
  14149. var scope = this;
  14150. do {
  14151. if (scope.uids[name]) return true;
  14152. } while (scope = scope.parent);
  14153. return false;
  14154. };
  14155. Scope.prototype.hasGlobal = function hasGlobal(name) {
  14156. var scope = this;
  14157. do {
  14158. if (scope.globals[name]) return true;
  14159. } while (scope = scope.parent);
  14160. return false;
  14161. };
  14162. Scope.prototype.hasReference = function hasReference(name) {
  14163. var scope = this;
  14164. do {
  14165. if (scope.references[name]) return true;
  14166. } while (scope = scope.parent);
  14167. return false;
  14168. };
  14169. Scope.prototype.isPure = function isPure(node, constantsOnly) {
  14170. if (t.isIdentifier(node)) {
  14171. var binding = this.getBinding(node.name);
  14172. if (!binding) return false;
  14173. if (constantsOnly) return binding.constant;
  14174. return true;
  14175. } else if (t.isClass(node)) {
  14176. if (node.superClass && !this.isPure(node.superClass, constantsOnly)) return false;
  14177. return this.isPure(node.body, constantsOnly);
  14178. } else if (t.isClassBody(node)) {
  14179. for (var _iterator11 = node.body, _isArray11 = Array.isArray(_iterator11), _i11 = 0, _iterator11 = _isArray11 ? _iterator11 : (0, _getIterator3.default)(_iterator11);;) {
  14180. var _ref11;
  14181. if (_isArray11) {
  14182. if (_i11 >= _iterator11.length) break;
  14183. _ref11 = _iterator11[_i11++];
  14184. } else {
  14185. _i11 = _iterator11.next();
  14186. if (_i11.done) break;
  14187. _ref11 = _i11.value;
  14188. }
  14189. var method = _ref11;
  14190. if (!this.isPure(method, constantsOnly)) return false;
  14191. }
  14192. return true;
  14193. } else if (t.isBinary(node)) {
  14194. return this.isPure(node.left, constantsOnly) && this.isPure(node.right, constantsOnly);
  14195. } else if (t.isArrayExpression(node)) {
  14196. for (var _iterator12 = node.elements, _isArray12 = Array.isArray(_iterator12), _i12 = 0, _iterator12 = _isArray12 ? _iterator12 : (0, _getIterator3.default)(_iterator12);;) {
  14197. var _ref12;
  14198. if (_isArray12) {
  14199. if (_i12 >= _iterator12.length) break;
  14200. _ref12 = _iterator12[_i12++];
  14201. } else {
  14202. _i12 = _iterator12.next();
  14203. if (_i12.done) break;
  14204. _ref12 = _i12.value;
  14205. }
  14206. var elem = _ref12;
  14207. if (!this.isPure(elem, constantsOnly)) return false;
  14208. }
  14209. return true;
  14210. } else if (t.isObjectExpression(node)) {
  14211. for (var _iterator13 = node.properties, _isArray13 = Array.isArray(_iterator13), _i13 = 0, _iterator13 = _isArray13 ? _iterator13 : (0, _getIterator3.default)(_iterator13);;) {
  14212. var _ref13;
  14213. if (_isArray13) {
  14214. if (_i13 >= _iterator13.length) break;
  14215. _ref13 = _iterator13[_i13++];
  14216. } else {
  14217. _i13 = _iterator13.next();
  14218. if (_i13.done) break;
  14219. _ref13 = _i13.value;
  14220. }
  14221. var prop = _ref13;
  14222. if (!this.isPure(prop, constantsOnly)) return false;
  14223. }
  14224. return true;
  14225. } else if (t.isClassMethod(node)) {
  14226. if (node.computed && !this.isPure(node.key, constantsOnly)) return false;
  14227. if (node.kind === "get" || node.kind === "set") return false;
  14228. return true;
  14229. } else if (t.isClassProperty(node) || t.isObjectProperty(node)) {
  14230. if (node.computed && !this.isPure(node.key, constantsOnly)) return false;
  14231. return this.isPure(node.value, constantsOnly);
  14232. } else if (t.isUnaryExpression(node)) {
  14233. return this.isPure(node.argument, constantsOnly);
  14234. } else {
  14235. return t.isPureish(node);
  14236. }
  14237. };
  14238. Scope.prototype.setData = function setData(key, val) {
  14239. return this.data[key] = val;
  14240. };
  14241. Scope.prototype.getData = function getData(key) {
  14242. var scope = this;
  14243. do {
  14244. var data = scope.data[key];
  14245. if (data != null) return data;
  14246. } while (scope = scope.parent);
  14247. };
  14248. Scope.prototype.removeData = function removeData(key) {
  14249. var scope = this;
  14250. do {
  14251. var data = scope.data[key];
  14252. if (data != null) scope.data[key] = null;
  14253. } while (scope = scope.parent);
  14254. };
  14255. Scope.prototype.init = function init() {
  14256. if (!this.references) this.crawl();
  14257. };
  14258. Scope.prototype.crawl = function crawl() {
  14259. _crawlCallsCount++;
  14260. this._crawl();
  14261. _crawlCallsCount--;
  14262. };
  14263. Scope.prototype._crawl = function _crawl() {
  14264. var path = this.path;
  14265. this.references = (0, _create2.default)(null);
  14266. this.bindings = (0, _create2.default)(null);
  14267. this.globals = (0, _create2.default)(null);
  14268. this.uids = (0, _create2.default)(null);
  14269. this.data = (0, _create2.default)(null);
  14270. if (path.isLoop()) {
  14271. for (var _iterator14 = t.FOR_INIT_KEYS, _isArray14 = Array.isArray(_iterator14), _i14 = 0, _iterator14 = _isArray14 ? _iterator14 : (0, _getIterator3.default)(_iterator14);;) {
  14272. var _ref14;
  14273. if (_isArray14) {
  14274. if (_i14 >= _iterator14.length) break;
  14275. _ref14 = _iterator14[_i14++];
  14276. } else {
  14277. _i14 = _iterator14.next();
  14278. if (_i14.done) break;
  14279. _ref14 = _i14.value;
  14280. }
  14281. var key = _ref14;
  14282. var node = path.get(key);
  14283. if (node.isBlockScoped()) this.registerBinding(node.node.kind, node);
  14284. }
  14285. }
  14286. if (path.isFunctionExpression() && path.has("id")) {
  14287. if (!path.get("id").node[t.NOT_LOCAL_BINDING]) {
  14288. this.registerBinding("local", path.get("id"), path);
  14289. }
  14290. }
  14291. if (path.isClassExpression() && path.has("id")) {
  14292. if (!path.get("id").node[t.NOT_LOCAL_BINDING]) {
  14293. this.registerBinding("local", path);
  14294. }
  14295. }
  14296. if (path.isFunction()) {
  14297. var params = path.get("params");
  14298. for (var _iterator15 = params, _isArray15 = Array.isArray(_iterator15), _i15 = 0, _iterator15 = _isArray15 ? _iterator15 : (0, _getIterator3.default)(_iterator15);;) {
  14299. var _ref15;
  14300. if (_isArray15) {
  14301. if (_i15 >= _iterator15.length) break;
  14302. _ref15 = _iterator15[_i15++];
  14303. } else {
  14304. _i15 = _iterator15.next();
  14305. if (_i15.done) break;
  14306. _ref15 = _i15.value;
  14307. }
  14308. var param = _ref15;
  14309. this.registerBinding("param", param);
  14310. }
  14311. }
  14312. if (path.isCatchClause()) {
  14313. this.registerBinding("let", path);
  14314. }
  14315. var parent = this.getProgramParent();
  14316. if (parent.crawling) return;
  14317. var state = {
  14318. references: [],
  14319. constantViolations: [],
  14320. assignments: []
  14321. };
  14322. this.crawling = true;
  14323. path.traverse(collectorVisitor, state);
  14324. this.crawling = false;
  14325. for (var _iterator16 = state.assignments, _isArray16 = Array.isArray(_iterator16), _i16 = 0, _iterator16 = _isArray16 ? _iterator16 : (0, _getIterator3.default)(_iterator16);;) {
  14326. var _ref16;
  14327. if (_isArray16) {
  14328. if (_i16 >= _iterator16.length) break;
  14329. _ref16 = _iterator16[_i16++];
  14330. } else {
  14331. _i16 = _iterator16.next();
  14332. if (_i16.done) break;
  14333. _ref16 = _i16.value;
  14334. }
  14335. var _path = _ref16;
  14336. var ids = _path.getBindingIdentifiers();
  14337. var programParent = void 0;
  14338. for (var name in ids) {
  14339. if (_path.scope.getBinding(name)) continue;
  14340. programParent = programParent || _path.scope.getProgramParent();
  14341. programParent.addGlobal(ids[name]);
  14342. }
  14343. _path.scope.registerConstantViolation(_path);
  14344. }
  14345. for (var _iterator17 = state.references, _isArray17 = Array.isArray(_iterator17), _i17 = 0, _iterator17 = _isArray17 ? _iterator17 : (0, _getIterator3.default)(_iterator17);;) {
  14346. var _ref17;
  14347. if (_isArray17) {
  14348. if (_i17 >= _iterator17.length) break;
  14349. _ref17 = _iterator17[_i17++];
  14350. } else {
  14351. _i17 = _iterator17.next();
  14352. if (_i17.done) break;
  14353. _ref17 = _i17.value;
  14354. }
  14355. var ref = _ref17;
  14356. var binding = ref.scope.getBinding(ref.node.name);
  14357. if (binding) {
  14358. binding.reference(ref);
  14359. } else {
  14360. ref.scope.getProgramParent().addGlobal(ref.node);
  14361. }
  14362. }
  14363. for (var _iterator18 = state.constantViolations, _isArray18 = Array.isArray(_iterator18), _i18 = 0, _iterator18 = _isArray18 ? _iterator18 : (0, _getIterator3.default)(_iterator18);;) {
  14364. var _ref18;
  14365. if (_isArray18) {
  14366. if (_i18 >= _iterator18.length) break;
  14367. _ref18 = _iterator18[_i18++];
  14368. } else {
  14369. _i18 = _iterator18.next();
  14370. if (_i18.done) break;
  14371. _ref18 = _i18.value;
  14372. }
  14373. var _path2 = _ref18;
  14374. _path2.scope.registerConstantViolation(_path2);
  14375. }
  14376. };
  14377. Scope.prototype.push = function push(opts) {
  14378. var path = this.path;
  14379. if (!path.isBlockStatement() && !path.isProgram()) {
  14380. path = this.getBlockParent().path;
  14381. }
  14382. if (path.isSwitchStatement()) {
  14383. path = this.getFunctionParent().path;
  14384. }
  14385. if (path.isLoop() || path.isCatchClause() || path.isFunction()) {
  14386. t.ensureBlock(path.node);
  14387. path = path.get("body");
  14388. }
  14389. var unique = opts.unique;
  14390. var kind = opts.kind || "var";
  14391. var blockHoist = opts._blockHoist == null ? 2 : opts._blockHoist;
  14392. var dataKey = "declaration:" + kind + ":" + blockHoist;
  14393. var declarPath = !unique && path.getData(dataKey);
  14394. if (!declarPath) {
  14395. var declar = t.variableDeclaration(kind, []);
  14396. declar._generated = true;
  14397. declar._blockHoist = blockHoist;
  14398. var _path$unshiftContaine = path.unshiftContainer("body", [declar]);
  14399. declarPath = _path$unshiftContaine[0];
  14400. if (!unique) path.setData(dataKey, declarPath);
  14401. }
  14402. var declarator = t.variableDeclarator(opts.id, opts.init);
  14403. declarPath.node.declarations.push(declarator);
  14404. this.registerBinding(kind, declarPath.get("declarations").pop());
  14405. };
  14406. Scope.prototype.getProgramParent = function getProgramParent() {
  14407. var scope = this;
  14408. do {
  14409. if (scope.path.isProgram()) {
  14410. return scope;
  14411. }
  14412. } while (scope = scope.parent);
  14413. throw new Error("We couldn't find a Function or Program...");
  14414. };
  14415. Scope.prototype.getFunctionParent = function getFunctionParent() {
  14416. var scope = this;
  14417. do {
  14418. if (scope.path.isFunctionParent()) {
  14419. return scope;
  14420. }
  14421. } while (scope = scope.parent);
  14422. throw new Error("We couldn't find a Function or Program...");
  14423. };
  14424. Scope.prototype.getBlockParent = function getBlockParent() {
  14425. var scope = this;
  14426. do {
  14427. if (scope.path.isBlockParent()) {
  14428. return scope;
  14429. }
  14430. } while (scope = scope.parent);
  14431. throw new Error("We couldn't find a BlockStatement, For, Switch, Function, Loop or Program...");
  14432. };
  14433. Scope.prototype.getAllBindings = function getAllBindings() {
  14434. var ids = (0, _create2.default)(null);
  14435. var scope = this;
  14436. do {
  14437. (0, _defaults2.default)(ids, scope.bindings);
  14438. scope = scope.parent;
  14439. } while (scope);
  14440. return ids;
  14441. };
  14442. Scope.prototype.getAllBindingsOfKind = function getAllBindingsOfKind() {
  14443. var ids = (0, _create2.default)(null);
  14444. for (var _iterator19 = arguments, _isArray19 = Array.isArray(_iterator19), _i19 = 0, _iterator19 = _isArray19 ? _iterator19 : (0, _getIterator3.default)(_iterator19);;) {
  14445. var _ref19;
  14446. if (_isArray19) {
  14447. if (_i19 >= _iterator19.length) break;
  14448. _ref19 = _iterator19[_i19++];
  14449. } else {
  14450. _i19 = _iterator19.next();
  14451. if (_i19.done) break;
  14452. _ref19 = _i19.value;
  14453. }
  14454. var kind = _ref19;
  14455. var scope = this;
  14456. do {
  14457. for (var name in scope.bindings) {
  14458. var binding = scope.bindings[name];
  14459. if (binding.kind === kind) ids[name] = binding;
  14460. }
  14461. scope = scope.parent;
  14462. } while (scope);
  14463. }
  14464. return ids;
  14465. };
  14466. Scope.prototype.bindingIdentifierEquals = function bindingIdentifierEquals(name, node) {
  14467. return this.getBindingIdentifier(name) === node;
  14468. };
  14469. Scope.prototype.warnOnFlowBinding = function warnOnFlowBinding(binding) {
  14470. if (_crawlCallsCount === 0 && binding && binding.path.isFlow()) {
  14471. 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 7. To find out the caller, grep for this\n message and change it to a `console.trace()`.\n ");
  14472. }
  14473. return binding;
  14474. };
  14475. Scope.prototype.getBinding = function getBinding(name) {
  14476. var scope = this;
  14477. do {
  14478. var binding = scope.getOwnBinding(name);
  14479. if (binding) return this.warnOnFlowBinding(binding);
  14480. } while (scope = scope.parent);
  14481. };
  14482. Scope.prototype.getOwnBinding = function getOwnBinding(name) {
  14483. return this.warnOnFlowBinding(this.bindings[name]);
  14484. };
  14485. Scope.prototype.getBindingIdentifier = function getBindingIdentifier(name) {
  14486. var info = this.getBinding(name);
  14487. return info && info.identifier;
  14488. };
  14489. Scope.prototype.getOwnBindingIdentifier = function getOwnBindingIdentifier(name) {
  14490. var binding = this.bindings[name];
  14491. return binding && binding.identifier;
  14492. };
  14493. Scope.prototype.hasOwnBinding = function hasOwnBinding(name) {
  14494. return !!this.getOwnBinding(name);
  14495. };
  14496. Scope.prototype.hasBinding = function hasBinding(name, noGlobals) {
  14497. if (!name) return false;
  14498. if (this.hasOwnBinding(name)) return true;
  14499. if (this.parentHasBinding(name, noGlobals)) return true;
  14500. if (this.hasUid(name)) return true;
  14501. if (!noGlobals && (0, _includes2.default)(Scope.globals, name)) return true;
  14502. if (!noGlobals && (0, _includes2.default)(Scope.contextVariables, name)) return true;
  14503. return false;
  14504. };
  14505. Scope.prototype.parentHasBinding = function parentHasBinding(name, noGlobals) {
  14506. return this.parent && this.parent.hasBinding(name, noGlobals);
  14507. };
  14508. Scope.prototype.moveBindingTo = function moveBindingTo(name, scope) {
  14509. var info = this.getBinding(name);
  14510. if (info) {
  14511. info.scope.removeOwnBinding(name);
  14512. info.scope = scope;
  14513. scope.bindings[name] = info;
  14514. }
  14515. };
  14516. Scope.prototype.removeOwnBinding = function removeOwnBinding(name) {
  14517. delete this.bindings[name];
  14518. };
  14519. Scope.prototype.removeBinding = function removeBinding(name) {
  14520. var info = this.getBinding(name);
  14521. if (info) {
  14522. info.scope.removeOwnBinding(name);
  14523. }
  14524. var scope = this;
  14525. do {
  14526. if (scope.uids[name]) {
  14527. scope.uids[name] = false;
  14528. }
  14529. } while (scope = scope.parent);
  14530. };
  14531. return Scope;
  14532. }();
  14533. Scope.globals = (0, _keys2.default)(_globals2.default.builtin);
  14534. Scope.contextVariables = ["arguments", "undefined", "Infinity", "NaN"];
  14535. exports.default = Scope;
  14536. module.exports = exports["default"];
  14537. },{"../cache":115,"../index":118,"./binding":136,"./lib/renamer":138,"babel-messages":61,"babel-runtime/core-js/get-iterator":95,"babel-runtime/core-js/map":97,"babel-runtime/core-js/object/create":100,"babel-runtime/core-js/object/keys":102,"babel-runtime/helpers/classCallCheck":109,"babel-types":151,"globals":289,"lodash/defaults":470,"lodash/includes":482,"lodash/repeat":507}],138:[function(require,module,exports){
  14538. "use strict";
  14539. exports.__esModule = true;
  14540. var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
  14541. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  14542. var _binding = require("../binding");
  14543. var _binding2 = _interopRequireDefault(_binding);
  14544. var _babelTypes = require("babel-types");
  14545. var t = _interopRequireWildcard(_babelTypes);
  14546. 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; } }
  14547. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14548. var renameVisitor = {
  14549. ReferencedIdentifier: function ReferencedIdentifier(_ref, state) {
  14550. var node = _ref.node;
  14551. if (node.name === state.oldName) {
  14552. node.name = state.newName;
  14553. }
  14554. },
  14555. Scope: function Scope(path, state) {
  14556. if (!path.scope.bindingIdentifierEquals(state.oldName, state.binding.identifier)) {
  14557. path.skip();
  14558. }
  14559. },
  14560. "AssignmentExpression|Declaration": function AssignmentExpressionDeclaration(path, state) {
  14561. var ids = path.getOuterBindingIdentifiers();
  14562. for (var name in ids) {
  14563. if (name === state.oldName) ids[name].name = state.newName;
  14564. }
  14565. }
  14566. };
  14567. var Renamer = function () {
  14568. function Renamer(binding, oldName, newName) {
  14569. (0, _classCallCheck3.default)(this, Renamer);
  14570. this.newName = newName;
  14571. this.oldName = oldName;
  14572. this.binding = binding;
  14573. }
  14574. Renamer.prototype.maybeConvertFromExportDeclaration = function maybeConvertFromExportDeclaration(parentDeclar) {
  14575. var exportDeclar = parentDeclar.parentPath.isExportDeclaration() && parentDeclar.parentPath;
  14576. if (!exportDeclar) return;
  14577. var isDefault = exportDeclar.isExportDefaultDeclaration();
  14578. if (isDefault && (parentDeclar.isFunctionDeclaration() || parentDeclar.isClassDeclaration()) && !parentDeclar.node.id) {
  14579. parentDeclar.node.id = parentDeclar.scope.generateUidIdentifier("default");
  14580. }
  14581. var bindingIdentifiers = parentDeclar.getOuterBindingIdentifiers();
  14582. var specifiers = [];
  14583. for (var name in bindingIdentifiers) {
  14584. var localName = name === this.oldName ? this.newName : name;
  14585. var exportedName = isDefault ? "default" : name;
  14586. specifiers.push(t.exportSpecifier(t.identifier(localName), t.identifier(exportedName)));
  14587. }
  14588. if (specifiers.length) {
  14589. var aliasDeclar = t.exportNamedDeclaration(null, specifiers);
  14590. if (parentDeclar.isFunctionDeclaration()) {
  14591. aliasDeclar._blockHoist = 3;
  14592. }
  14593. exportDeclar.insertAfter(aliasDeclar);
  14594. exportDeclar.replaceWith(parentDeclar.node);
  14595. }
  14596. };
  14597. Renamer.prototype.rename = function rename(block) {
  14598. var binding = this.binding,
  14599. oldName = this.oldName,
  14600. newName = this.newName;
  14601. var scope = binding.scope,
  14602. path = binding.path;
  14603. var parentDeclar = path.find(function (path) {
  14604. return path.isDeclaration() || path.isFunctionExpression();
  14605. });
  14606. if (parentDeclar) {
  14607. this.maybeConvertFromExportDeclaration(parentDeclar);
  14608. }
  14609. scope.traverse(block || scope.block, renameVisitor, this);
  14610. if (!block) {
  14611. scope.removeOwnBinding(oldName);
  14612. scope.bindings[newName] = binding;
  14613. this.binding.identifier.name = newName;
  14614. }
  14615. if (binding.type === "hoisted") {}
  14616. };
  14617. return Renamer;
  14618. }();
  14619. exports.default = Renamer;
  14620. module.exports = exports["default"];
  14621. },{"../binding":136,"babel-runtime/helpers/classCallCheck":109,"babel-types":151}],139:[function(require,module,exports){
  14622. "use strict";
  14623. exports.__esModule = true;
  14624. var _typeof2 = require("babel-runtime/helpers/typeof");
  14625. var _typeof3 = _interopRequireDefault(_typeof2);
  14626. var _keys = require("babel-runtime/core-js/object/keys");
  14627. var _keys2 = _interopRequireDefault(_keys);
  14628. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  14629. var _getIterator3 = _interopRequireDefault(_getIterator2);
  14630. exports.explode = explode;
  14631. exports.verify = verify;
  14632. exports.merge = merge;
  14633. var _virtualTypes = require("./path/lib/virtual-types");
  14634. var virtualTypes = _interopRequireWildcard(_virtualTypes);
  14635. var _babelMessages = require("babel-messages");
  14636. var messages = _interopRequireWildcard(_babelMessages);
  14637. var _babelTypes = require("babel-types");
  14638. var t = _interopRequireWildcard(_babelTypes);
  14639. var _clone = require("lodash/clone");
  14640. var _clone2 = _interopRequireDefault(_clone);
  14641. 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; } }
  14642. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14643. function explode(visitor) {
  14644. if (visitor._exploded) return visitor;
  14645. visitor._exploded = true;
  14646. for (var nodeType in visitor) {
  14647. if (shouldIgnoreKey(nodeType)) continue;
  14648. var parts = nodeType.split("|");
  14649. if (parts.length === 1) continue;
  14650. var fns = visitor[nodeType];
  14651. delete visitor[nodeType];
  14652. for (var _iterator = parts, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  14653. var _ref;
  14654. if (_isArray) {
  14655. if (_i >= _iterator.length) break;
  14656. _ref = _iterator[_i++];
  14657. } else {
  14658. _i = _iterator.next();
  14659. if (_i.done) break;
  14660. _ref = _i.value;
  14661. }
  14662. var part = _ref;
  14663. visitor[part] = fns;
  14664. }
  14665. }
  14666. verify(visitor);
  14667. delete visitor.__esModule;
  14668. ensureEntranceObjects(visitor);
  14669. ensureCallbackArrays(visitor);
  14670. for (var _iterator2 = (0, _keys2.default)(visitor), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  14671. var _ref2;
  14672. if (_isArray2) {
  14673. if (_i2 >= _iterator2.length) break;
  14674. _ref2 = _iterator2[_i2++];
  14675. } else {
  14676. _i2 = _iterator2.next();
  14677. if (_i2.done) break;
  14678. _ref2 = _i2.value;
  14679. }
  14680. var _nodeType3 = _ref2;
  14681. if (shouldIgnoreKey(_nodeType3)) continue;
  14682. var wrapper = virtualTypes[_nodeType3];
  14683. if (!wrapper) continue;
  14684. var _fns2 = visitor[_nodeType3];
  14685. for (var type in _fns2) {
  14686. _fns2[type] = wrapCheck(wrapper, _fns2[type]);
  14687. }
  14688. delete visitor[_nodeType3];
  14689. if (wrapper.types) {
  14690. for (var _iterator4 = wrapper.types, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) {
  14691. var _ref4;
  14692. if (_isArray4) {
  14693. if (_i4 >= _iterator4.length) break;
  14694. _ref4 = _iterator4[_i4++];
  14695. } else {
  14696. _i4 = _iterator4.next();
  14697. if (_i4.done) break;
  14698. _ref4 = _i4.value;
  14699. }
  14700. var _type = _ref4;
  14701. if (visitor[_type]) {
  14702. mergePair(visitor[_type], _fns2);
  14703. } else {
  14704. visitor[_type] = _fns2;
  14705. }
  14706. }
  14707. } else {
  14708. mergePair(visitor, _fns2);
  14709. }
  14710. }
  14711. for (var _nodeType in visitor) {
  14712. if (shouldIgnoreKey(_nodeType)) continue;
  14713. var _fns = visitor[_nodeType];
  14714. var aliases = t.FLIPPED_ALIAS_KEYS[_nodeType];
  14715. var deprecratedKey = t.DEPRECATED_KEYS[_nodeType];
  14716. if (deprecratedKey) {
  14717. console.trace("Visitor defined for " + _nodeType + " but it has been renamed to " + deprecratedKey);
  14718. aliases = [deprecratedKey];
  14719. }
  14720. if (!aliases) continue;
  14721. delete visitor[_nodeType];
  14722. for (var _iterator3 = aliases, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) {
  14723. var _ref3;
  14724. if (_isArray3) {
  14725. if (_i3 >= _iterator3.length) break;
  14726. _ref3 = _iterator3[_i3++];
  14727. } else {
  14728. _i3 = _iterator3.next();
  14729. if (_i3.done) break;
  14730. _ref3 = _i3.value;
  14731. }
  14732. var alias = _ref3;
  14733. var existing = visitor[alias];
  14734. if (existing) {
  14735. mergePair(existing, _fns);
  14736. } else {
  14737. visitor[alias] = (0, _clone2.default)(_fns);
  14738. }
  14739. }
  14740. }
  14741. for (var _nodeType2 in visitor) {
  14742. if (shouldIgnoreKey(_nodeType2)) continue;
  14743. ensureCallbackArrays(visitor[_nodeType2]);
  14744. }
  14745. return visitor;
  14746. }
  14747. function verify(visitor) {
  14748. if (visitor._verified) return;
  14749. if (typeof visitor === "function") {
  14750. throw new Error(messages.get("traverseVerifyRootFunction"));
  14751. }
  14752. for (var nodeType in visitor) {
  14753. if (nodeType === "enter" || nodeType === "exit") {
  14754. validateVisitorMethods(nodeType, visitor[nodeType]);
  14755. }
  14756. if (shouldIgnoreKey(nodeType)) continue;
  14757. if (t.TYPES.indexOf(nodeType) < 0) {
  14758. throw new Error(messages.get("traverseVerifyNodeType", nodeType));
  14759. }
  14760. var visitors = visitor[nodeType];
  14761. if ((typeof visitors === "undefined" ? "undefined" : (0, _typeof3.default)(visitors)) === "object") {
  14762. for (var visitorKey in visitors) {
  14763. if (visitorKey === "enter" || visitorKey === "exit") {
  14764. validateVisitorMethods(nodeType + "." + visitorKey, visitors[visitorKey]);
  14765. } else {
  14766. throw new Error(messages.get("traverseVerifyVisitorProperty", nodeType, visitorKey));
  14767. }
  14768. }
  14769. }
  14770. }
  14771. visitor._verified = true;
  14772. }
  14773. function validateVisitorMethods(path, val) {
  14774. var fns = [].concat(val);
  14775. for (var _iterator5 = fns, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : (0, _getIterator3.default)(_iterator5);;) {
  14776. var _ref5;
  14777. if (_isArray5) {
  14778. if (_i5 >= _iterator5.length) break;
  14779. _ref5 = _iterator5[_i5++];
  14780. } else {
  14781. _i5 = _iterator5.next();
  14782. if (_i5.done) break;
  14783. _ref5 = _i5.value;
  14784. }
  14785. var fn = _ref5;
  14786. if (typeof fn !== "function") {
  14787. throw new TypeError("Non-function found defined in " + path + " with type " + (typeof fn === "undefined" ? "undefined" : (0, _typeof3.default)(fn)));
  14788. }
  14789. }
  14790. }
  14791. function merge(visitors) {
  14792. var states = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  14793. var wrapper = arguments[2];
  14794. var rootVisitor = {};
  14795. for (var i = 0; i < visitors.length; i++) {
  14796. var visitor = visitors[i];
  14797. var state = states[i];
  14798. explode(visitor);
  14799. for (var type in visitor) {
  14800. var visitorType = visitor[type];
  14801. if (state || wrapper) {
  14802. visitorType = wrapWithStateOrWrapper(visitorType, state, wrapper);
  14803. }
  14804. var nodeVisitor = rootVisitor[type] = rootVisitor[type] || {};
  14805. mergePair(nodeVisitor, visitorType);
  14806. }
  14807. }
  14808. return rootVisitor;
  14809. }
  14810. function wrapWithStateOrWrapper(oldVisitor, state, wrapper) {
  14811. var newVisitor = {};
  14812. var _loop = function _loop(key) {
  14813. var fns = oldVisitor[key];
  14814. if (!Array.isArray(fns)) return "continue";
  14815. fns = fns.map(function (fn) {
  14816. var newFn = fn;
  14817. if (state) {
  14818. newFn = function newFn(path) {
  14819. return fn.call(state, path, state);
  14820. };
  14821. }
  14822. if (wrapper) {
  14823. newFn = wrapper(state.key, key, newFn);
  14824. }
  14825. return newFn;
  14826. });
  14827. newVisitor[key] = fns;
  14828. };
  14829. for (var key in oldVisitor) {
  14830. var _ret = _loop(key);
  14831. if (_ret === "continue") continue;
  14832. }
  14833. return newVisitor;
  14834. }
  14835. function ensureEntranceObjects(obj) {
  14836. for (var key in obj) {
  14837. if (shouldIgnoreKey(key)) continue;
  14838. var fns = obj[key];
  14839. if (typeof fns === "function") {
  14840. obj[key] = { enter: fns };
  14841. }
  14842. }
  14843. }
  14844. function ensureCallbackArrays(obj) {
  14845. if (obj.enter && !Array.isArray(obj.enter)) obj.enter = [obj.enter];
  14846. if (obj.exit && !Array.isArray(obj.exit)) obj.exit = [obj.exit];
  14847. }
  14848. function wrapCheck(wrapper, fn) {
  14849. var newFn = function newFn(path) {
  14850. if (wrapper.checkPath(path)) {
  14851. return fn.apply(this, arguments);
  14852. }
  14853. };
  14854. newFn.toString = function () {
  14855. return fn.toString();
  14856. };
  14857. return newFn;
  14858. }
  14859. function shouldIgnoreKey(key) {
  14860. if (key[0] === "_") return true;
  14861. if (key === "enter" || key === "exit" || key === "shouldSkip") return true;
  14862. if (key === "blacklist" || key === "noScope" || key === "skipKeys") return true;
  14863. return false;
  14864. }
  14865. function mergePair(dest, src) {
  14866. for (var key in src) {
  14867. dest[key] = [].concat(dest[key] || [], src[key]);
  14868. }
  14869. }
  14870. },{"./path/lib/virtual-types":132,"babel-messages":61,"babel-runtime/core-js/get-iterator":95,"babel-runtime/core-js/object/keys":102,"babel-runtime/helpers/typeof":113,"babel-types":151,"lodash/clone":466}],140:[function(require,module,exports){
  14871. "use strict";
  14872. exports.__esModule = true;
  14873. 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;
  14874. var _for = require("babel-runtime/core-js/symbol/for");
  14875. var _for2 = _interopRequireDefault(_for);
  14876. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14877. var STATEMENT_OR_BLOCK_KEYS = exports.STATEMENT_OR_BLOCK_KEYS = ["consequent", "body", "alternate"];
  14878. var FLATTENABLE_KEYS = exports.FLATTENABLE_KEYS = ["body", "expressions"];
  14879. var FOR_INIT_KEYS = exports.FOR_INIT_KEYS = ["left", "init"];
  14880. var COMMENT_KEYS = exports.COMMENT_KEYS = ["leadingComments", "trailingComments", "innerComments"];
  14881. var LOGICAL_OPERATORS = exports.LOGICAL_OPERATORS = ["||", "&&"];
  14882. var UPDATE_OPERATORS = exports.UPDATE_OPERATORS = ["++", "--"];
  14883. var BOOLEAN_NUMBER_BINARY_OPERATORS = exports.BOOLEAN_NUMBER_BINARY_OPERATORS = [">", "<", ">=", "<="];
  14884. var EQUALITY_BINARY_OPERATORS = exports.EQUALITY_BINARY_OPERATORS = ["==", "===", "!=", "!=="];
  14885. var COMPARISON_BINARY_OPERATORS = exports.COMPARISON_BINARY_OPERATORS = [].concat(EQUALITY_BINARY_OPERATORS, ["in", "instanceof"]);
  14886. var BOOLEAN_BINARY_OPERATORS = exports.BOOLEAN_BINARY_OPERATORS = [].concat(COMPARISON_BINARY_OPERATORS, BOOLEAN_NUMBER_BINARY_OPERATORS);
  14887. var NUMBER_BINARY_OPERATORS = exports.NUMBER_BINARY_OPERATORS = ["-", "/", "%", "*", "**", "&", "|", ">>", ">>>", "<<", "^"];
  14888. var BINARY_OPERATORS = exports.BINARY_OPERATORS = ["+"].concat(NUMBER_BINARY_OPERATORS, BOOLEAN_BINARY_OPERATORS);
  14889. var BOOLEAN_UNARY_OPERATORS = exports.BOOLEAN_UNARY_OPERATORS = ["delete", "!"];
  14890. var NUMBER_UNARY_OPERATORS = exports.NUMBER_UNARY_OPERATORS = ["+", "-", "++", "--", "~"];
  14891. var STRING_UNARY_OPERATORS = exports.STRING_UNARY_OPERATORS = ["typeof"];
  14892. var UNARY_OPERATORS = exports.UNARY_OPERATORS = ["void"].concat(BOOLEAN_UNARY_OPERATORS, NUMBER_UNARY_OPERATORS, STRING_UNARY_OPERATORS);
  14893. var INHERIT_KEYS = exports.INHERIT_KEYS = {
  14894. optional: ["typeAnnotation", "typeParameters", "returnType"],
  14895. force: ["start", "loc", "end"]
  14896. };
  14897. var BLOCK_SCOPED_SYMBOL = exports.BLOCK_SCOPED_SYMBOL = (0, _for2.default)("var used to be block scoped");
  14898. var NOT_LOCAL_BINDING = exports.NOT_LOCAL_BINDING = (0, _for2.default)("should not be considered a local binding");
  14899. },{"babel-runtime/core-js/symbol/for":105}],141:[function(require,module,exports){
  14900. "use strict";
  14901. exports.__esModule = true;
  14902. var _maxSafeInteger = require("babel-runtime/core-js/number/max-safe-integer");
  14903. var _maxSafeInteger2 = _interopRequireDefault(_maxSafeInteger);
  14904. var _stringify = require("babel-runtime/core-js/json/stringify");
  14905. var _stringify2 = _interopRequireDefault(_stringify);
  14906. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  14907. var _getIterator3 = _interopRequireDefault(_getIterator2);
  14908. exports.toComputedKey = toComputedKey;
  14909. exports.toSequenceExpression = toSequenceExpression;
  14910. exports.toKeyAlias = toKeyAlias;
  14911. exports.toIdentifier = toIdentifier;
  14912. exports.toBindingIdentifierName = toBindingIdentifierName;
  14913. exports.toStatement = toStatement;
  14914. exports.toExpression = toExpression;
  14915. exports.toBlock = toBlock;
  14916. exports.valueToNode = valueToNode;
  14917. var _isPlainObject = require("lodash/isPlainObject");
  14918. var _isPlainObject2 = _interopRequireDefault(_isPlainObject);
  14919. var _isRegExp = require("lodash/isRegExp");
  14920. var _isRegExp2 = _interopRequireDefault(_isRegExp);
  14921. var _index = require("./index");
  14922. var t = _interopRequireWildcard(_index);
  14923. 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; } }
  14924. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14925. function toComputedKey(node) {
  14926. var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : node.key || node.property;
  14927. if (!node.computed) {
  14928. if (t.isIdentifier(key)) key = t.stringLiteral(key.name);
  14929. }
  14930. return key;
  14931. }
  14932. function gatherSequenceExpressions(nodes, scope, declars) {
  14933. var exprs = [];
  14934. var ensureLastUndefined = true;
  14935. for (var _iterator = nodes, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  14936. var _ref;
  14937. if (_isArray) {
  14938. if (_i >= _iterator.length) break;
  14939. _ref = _iterator[_i++];
  14940. } else {
  14941. _i = _iterator.next();
  14942. if (_i.done) break;
  14943. _ref = _i.value;
  14944. }
  14945. var node = _ref;
  14946. ensureLastUndefined = false;
  14947. if (t.isExpression(node)) {
  14948. exprs.push(node);
  14949. } else if (t.isExpressionStatement(node)) {
  14950. exprs.push(node.expression);
  14951. } else if (t.isVariableDeclaration(node)) {
  14952. if (node.kind !== "var") return;
  14953. for (var _iterator2 = node.declarations, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  14954. var _ref2;
  14955. if (_isArray2) {
  14956. if (_i2 >= _iterator2.length) break;
  14957. _ref2 = _iterator2[_i2++];
  14958. } else {
  14959. _i2 = _iterator2.next();
  14960. if (_i2.done) break;
  14961. _ref2 = _i2.value;
  14962. }
  14963. var declar = _ref2;
  14964. var bindings = t.getBindingIdentifiers(declar);
  14965. for (var key in bindings) {
  14966. declars.push({
  14967. kind: node.kind,
  14968. id: bindings[key]
  14969. });
  14970. }
  14971. if (declar.init) {
  14972. exprs.push(t.assignmentExpression("=", declar.id, declar.init));
  14973. }
  14974. }
  14975. ensureLastUndefined = true;
  14976. } else if (t.isIfStatement(node)) {
  14977. var consequent = node.consequent ? gatherSequenceExpressions([node.consequent], scope, declars) : scope.buildUndefinedNode();
  14978. var alternate = node.alternate ? gatherSequenceExpressions([node.alternate], scope, declars) : scope.buildUndefinedNode();
  14979. if (!consequent || !alternate) return;
  14980. exprs.push(t.conditionalExpression(node.test, consequent, alternate));
  14981. } else if (t.isBlockStatement(node)) {
  14982. var body = gatherSequenceExpressions(node.body, scope, declars);
  14983. if (!body) return;
  14984. exprs.push(body);
  14985. } else if (t.isEmptyStatement(node)) {
  14986. ensureLastUndefined = true;
  14987. } else {
  14988. return;
  14989. }
  14990. }
  14991. if (ensureLastUndefined) {
  14992. exprs.push(scope.buildUndefinedNode());
  14993. }
  14994. if (exprs.length === 1) {
  14995. return exprs[0];
  14996. } else {
  14997. return t.sequenceExpression(exprs);
  14998. }
  14999. }
  15000. function toSequenceExpression(nodes, scope) {
  15001. if (!nodes || !nodes.length) return;
  15002. var declars = [];
  15003. var result = gatherSequenceExpressions(nodes, scope, declars);
  15004. if (!result) return;
  15005. for (var _iterator3 = declars, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) {
  15006. var _ref3;
  15007. if (_isArray3) {
  15008. if (_i3 >= _iterator3.length) break;
  15009. _ref3 = _iterator3[_i3++];
  15010. } else {
  15011. _i3 = _iterator3.next();
  15012. if (_i3.done) break;
  15013. _ref3 = _i3.value;
  15014. }
  15015. var declar = _ref3;
  15016. scope.push(declar);
  15017. }
  15018. return result;
  15019. }
  15020. function toKeyAlias(node) {
  15021. var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : node.key;
  15022. var alias = void 0;
  15023. if (node.kind === "method") {
  15024. return toKeyAlias.increment() + "";
  15025. } else if (t.isIdentifier(key)) {
  15026. alias = key.name;
  15027. } else if (t.isStringLiteral(key)) {
  15028. alias = (0, _stringify2.default)(key.value);
  15029. } else {
  15030. alias = (0, _stringify2.default)(t.removePropertiesDeep(t.cloneDeep(key)));
  15031. }
  15032. if (node.computed) {
  15033. alias = "[" + alias + "]";
  15034. }
  15035. if (node.static) {
  15036. alias = "static:" + alias;
  15037. }
  15038. return alias;
  15039. }
  15040. toKeyAlias.uid = 0;
  15041. toKeyAlias.increment = function () {
  15042. if (toKeyAlias.uid >= _maxSafeInteger2.default) {
  15043. return toKeyAlias.uid = 0;
  15044. } else {
  15045. return toKeyAlias.uid++;
  15046. }
  15047. };
  15048. function toIdentifier(name) {
  15049. name = name + "";
  15050. name = name.replace(/[^a-zA-Z0-9$_]/g, "-");
  15051. name = name.replace(/^[-0-9]+/, "");
  15052. name = name.replace(/[-\s]+(.)?/g, function (match, c) {
  15053. return c ? c.toUpperCase() : "";
  15054. });
  15055. if (!t.isValidIdentifier(name)) {
  15056. name = "_" + name;
  15057. }
  15058. return name || "_";
  15059. }
  15060. function toBindingIdentifierName(name) {
  15061. name = toIdentifier(name);
  15062. if (name === "eval" || name === "arguments") name = "_" + name;
  15063. return name;
  15064. }
  15065. function toStatement(node, ignore) {
  15066. if (t.isStatement(node)) {
  15067. return node;
  15068. }
  15069. var mustHaveId = false;
  15070. var newType = void 0;
  15071. if (t.isClass(node)) {
  15072. mustHaveId = true;
  15073. newType = "ClassDeclaration";
  15074. } else if (t.isFunction(node)) {
  15075. mustHaveId = true;
  15076. newType = "FunctionDeclaration";
  15077. } else if (t.isAssignmentExpression(node)) {
  15078. return t.expressionStatement(node);
  15079. }
  15080. if (mustHaveId && !node.id) {
  15081. newType = false;
  15082. }
  15083. if (!newType) {
  15084. if (ignore) {
  15085. return false;
  15086. } else {
  15087. throw new Error("cannot turn " + node.type + " to a statement");
  15088. }
  15089. }
  15090. node.type = newType;
  15091. return node;
  15092. }
  15093. function toExpression(node) {
  15094. if (t.isExpressionStatement(node)) {
  15095. node = node.expression;
  15096. }
  15097. if (t.isExpression(node)) {
  15098. return node;
  15099. }
  15100. if (t.isClass(node)) {
  15101. node.type = "ClassExpression";
  15102. } else if (t.isFunction(node)) {
  15103. node.type = "FunctionExpression";
  15104. }
  15105. if (!t.isExpression(node)) {
  15106. throw new Error("cannot turn " + node.type + " to an expression");
  15107. }
  15108. return node;
  15109. }
  15110. function toBlock(node, parent) {
  15111. if (t.isBlockStatement(node)) {
  15112. return node;
  15113. }
  15114. if (t.isEmptyStatement(node)) {
  15115. node = [];
  15116. }
  15117. if (!Array.isArray(node)) {
  15118. if (!t.isStatement(node)) {
  15119. if (t.isFunction(parent)) {
  15120. node = t.returnStatement(node);
  15121. } else {
  15122. node = t.expressionStatement(node);
  15123. }
  15124. }
  15125. node = [node];
  15126. }
  15127. return t.blockStatement(node);
  15128. }
  15129. function valueToNode(value) {
  15130. if (value === undefined) {
  15131. return t.identifier("undefined");
  15132. }
  15133. if (value === true || value === false) {
  15134. return t.booleanLiteral(value);
  15135. }
  15136. if (value === null) {
  15137. return t.nullLiteral();
  15138. }
  15139. if (typeof value === "string") {
  15140. return t.stringLiteral(value);
  15141. }
  15142. if (typeof value === "number") {
  15143. return t.numericLiteral(value);
  15144. }
  15145. if ((0, _isRegExp2.default)(value)) {
  15146. var pattern = value.source;
  15147. var flags = value.toString().match(/\/([a-z]+|)$/)[1];
  15148. return t.regExpLiteral(pattern, flags);
  15149. }
  15150. if (Array.isArray(value)) {
  15151. return t.arrayExpression(value.map(t.valueToNode));
  15152. }
  15153. if ((0, _isPlainObject2.default)(value)) {
  15154. var props = [];
  15155. for (var key in value) {
  15156. var nodeKey = void 0;
  15157. if (t.isValidIdentifier(key)) {
  15158. nodeKey = t.identifier(key);
  15159. } else {
  15160. nodeKey = t.stringLiteral(key);
  15161. }
  15162. props.push(t.objectProperty(nodeKey, t.valueToNode(value[key])));
  15163. }
  15164. return t.objectExpression(props);
  15165. }
  15166. throw new Error("don't know how to turn this value into a node");
  15167. }
  15168. },{"./index":151,"babel-runtime/core-js/get-iterator":95,"babel-runtime/core-js/json/stringify":96,"babel-runtime/core-js/number/max-safe-integer":98,"lodash/isPlainObject":493,"lodash/isRegExp":494}],142:[function(require,module,exports){
  15169. "use strict";
  15170. var _index = require("../index");
  15171. var t = _interopRequireWildcard(_index);
  15172. var _constants = require("../constants");
  15173. var _index2 = require("./index");
  15174. var _index3 = _interopRequireDefault(_index2);
  15175. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15176. 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; } }
  15177. (0, _index3.default)("ArrayExpression", {
  15178. fields: {
  15179. elements: {
  15180. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeOrValueType)("null", "Expression", "SpreadElement"))),
  15181. default: []
  15182. }
  15183. },
  15184. visitor: ["elements"],
  15185. aliases: ["Expression"]
  15186. });
  15187. (0, _index3.default)("AssignmentExpression", {
  15188. fields: {
  15189. operator: {
  15190. validate: (0, _index2.assertValueType)("string")
  15191. },
  15192. left: {
  15193. validate: (0, _index2.assertNodeType)("LVal")
  15194. },
  15195. right: {
  15196. validate: (0, _index2.assertNodeType)("Expression")
  15197. }
  15198. },
  15199. builder: ["operator", "left", "right"],
  15200. visitor: ["left", "right"],
  15201. aliases: ["Expression"]
  15202. });
  15203. (0, _index3.default)("BinaryExpression", {
  15204. builder: ["operator", "left", "right"],
  15205. fields: {
  15206. operator: {
  15207. validate: _index2.assertOneOf.apply(undefined, _constants.BINARY_OPERATORS)
  15208. },
  15209. left: {
  15210. validate: (0, _index2.assertNodeType)("Expression")
  15211. },
  15212. right: {
  15213. validate: (0, _index2.assertNodeType)("Expression")
  15214. }
  15215. },
  15216. visitor: ["left", "right"],
  15217. aliases: ["Binary", "Expression"]
  15218. });
  15219. (0, _index3.default)("Directive", {
  15220. visitor: ["value"],
  15221. fields: {
  15222. value: {
  15223. validate: (0, _index2.assertNodeType)("DirectiveLiteral")
  15224. }
  15225. }
  15226. });
  15227. (0, _index3.default)("DirectiveLiteral", {
  15228. builder: ["value"],
  15229. fields: {
  15230. value: {
  15231. validate: (0, _index2.assertValueType)("string")
  15232. }
  15233. }
  15234. });
  15235. (0, _index3.default)("BlockStatement", {
  15236. builder: ["body", "directives"],
  15237. visitor: ["directives", "body"],
  15238. fields: {
  15239. directives: {
  15240. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Directive"))),
  15241. default: []
  15242. },
  15243. body: {
  15244. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Statement")))
  15245. }
  15246. },
  15247. aliases: ["Scopable", "BlockParent", "Block", "Statement"]
  15248. });
  15249. (0, _index3.default)("BreakStatement", {
  15250. visitor: ["label"],
  15251. fields: {
  15252. label: {
  15253. validate: (0, _index2.assertNodeType)("Identifier"),
  15254. optional: true
  15255. }
  15256. },
  15257. aliases: ["Statement", "Terminatorless", "CompletionStatement"]
  15258. });
  15259. (0, _index3.default)("CallExpression", {
  15260. visitor: ["callee", "arguments"],
  15261. fields: {
  15262. callee: {
  15263. validate: (0, _index2.assertNodeType)("Expression")
  15264. },
  15265. arguments: {
  15266. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Expression", "SpreadElement")))
  15267. }
  15268. },
  15269. aliases: ["Expression"]
  15270. });
  15271. (0, _index3.default)("CatchClause", {
  15272. visitor: ["param", "body"],
  15273. fields: {
  15274. param: {
  15275. validate: (0, _index2.assertNodeType)("Identifier")
  15276. },
  15277. body: {
  15278. validate: (0, _index2.assertNodeType)("BlockStatement")
  15279. }
  15280. },
  15281. aliases: ["Scopable"]
  15282. });
  15283. (0, _index3.default)("ConditionalExpression", {
  15284. visitor: ["test", "consequent", "alternate"],
  15285. fields: {
  15286. test: {
  15287. validate: (0, _index2.assertNodeType)("Expression")
  15288. },
  15289. consequent: {
  15290. validate: (0, _index2.assertNodeType)("Expression")
  15291. },
  15292. alternate: {
  15293. validate: (0, _index2.assertNodeType)("Expression")
  15294. }
  15295. },
  15296. aliases: ["Expression", "Conditional"]
  15297. });
  15298. (0, _index3.default)("ContinueStatement", {
  15299. visitor: ["label"],
  15300. fields: {
  15301. label: {
  15302. validate: (0, _index2.assertNodeType)("Identifier"),
  15303. optional: true
  15304. }
  15305. },
  15306. aliases: ["Statement", "Terminatorless", "CompletionStatement"]
  15307. });
  15308. (0, _index3.default)("DebuggerStatement", {
  15309. aliases: ["Statement"]
  15310. });
  15311. (0, _index3.default)("DoWhileStatement", {
  15312. visitor: ["test", "body"],
  15313. fields: {
  15314. test: {
  15315. validate: (0, _index2.assertNodeType)("Expression")
  15316. },
  15317. body: {
  15318. validate: (0, _index2.assertNodeType)("Statement")
  15319. }
  15320. },
  15321. aliases: ["Statement", "BlockParent", "Loop", "While", "Scopable"]
  15322. });
  15323. (0, _index3.default)("EmptyStatement", {
  15324. aliases: ["Statement"]
  15325. });
  15326. (0, _index3.default)("ExpressionStatement", {
  15327. visitor: ["expression"],
  15328. fields: {
  15329. expression: {
  15330. validate: (0, _index2.assertNodeType)("Expression")
  15331. }
  15332. },
  15333. aliases: ["Statement", "ExpressionWrapper"]
  15334. });
  15335. (0, _index3.default)("File", {
  15336. builder: ["program", "comments", "tokens"],
  15337. visitor: ["program"],
  15338. fields: {
  15339. program: {
  15340. validate: (0, _index2.assertNodeType)("Program")
  15341. }
  15342. }
  15343. });
  15344. (0, _index3.default)("ForInStatement", {
  15345. visitor: ["left", "right", "body"],
  15346. aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"],
  15347. fields: {
  15348. left: {
  15349. validate: (0, _index2.assertNodeType)("VariableDeclaration", "LVal")
  15350. },
  15351. right: {
  15352. validate: (0, _index2.assertNodeType)("Expression")
  15353. },
  15354. body: {
  15355. validate: (0, _index2.assertNodeType)("Statement")
  15356. }
  15357. }
  15358. });
  15359. (0, _index3.default)("ForStatement", {
  15360. visitor: ["init", "test", "update", "body"],
  15361. aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop"],
  15362. fields: {
  15363. init: {
  15364. validate: (0, _index2.assertNodeType)("VariableDeclaration", "Expression"),
  15365. optional: true
  15366. },
  15367. test: {
  15368. validate: (0, _index2.assertNodeType)("Expression"),
  15369. optional: true
  15370. },
  15371. update: {
  15372. validate: (0, _index2.assertNodeType)("Expression"),
  15373. optional: true
  15374. },
  15375. body: {
  15376. validate: (0, _index2.assertNodeType)("Statement")
  15377. }
  15378. }
  15379. });
  15380. (0, _index3.default)("FunctionDeclaration", {
  15381. builder: ["id", "params", "body", "generator", "async"],
  15382. visitor: ["id", "params", "body", "returnType", "typeParameters"],
  15383. fields: {
  15384. id: {
  15385. validate: (0, _index2.assertNodeType)("Identifier")
  15386. },
  15387. params: {
  15388. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("LVal")))
  15389. },
  15390. body: {
  15391. validate: (0, _index2.assertNodeType)("BlockStatement")
  15392. },
  15393. generator: {
  15394. default: false,
  15395. validate: (0, _index2.assertValueType)("boolean")
  15396. },
  15397. async: {
  15398. default: false,
  15399. validate: (0, _index2.assertValueType)("boolean")
  15400. }
  15401. },
  15402. aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Statement", "Pureish", "Declaration"]
  15403. });
  15404. (0, _index3.default)("FunctionExpression", {
  15405. inherits: "FunctionDeclaration",
  15406. aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"],
  15407. fields: {
  15408. id: {
  15409. validate: (0, _index2.assertNodeType)("Identifier"),
  15410. optional: true
  15411. },
  15412. params: {
  15413. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("LVal")))
  15414. },
  15415. body: {
  15416. validate: (0, _index2.assertNodeType)("BlockStatement")
  15417. },
  15418. generator: {
  15419. default: false,
  15420. validate: (0, _index2.assertValueType)("boolean")
  15421. },
  15422. async: {
  15423. default: false,
  15424. validate: (0, _index2.assertValueType)("boolean")
  15425. }
  15426. }
  15427. });
  15428. (0, _index3.default)("Identifier", {
  15429. builder: ["name"],
  15430. visitor: ["typeAnnotation"],
  15431. aliases: ["Expression", "LVal"],
  15432. fields: {
  15433. name: {
  15434. validate: function validate(node, key, val) {
  15435. if (!t.isValidIdentifier(val)) {}
  15436. }
  15437. },
  15438. decorators: {
  15439. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Decorator")))
  15440. }
  15441. }
  15442. });
  15443. (0, _index3.default)("IfStatement", {
  15444. visitor: ["test", "consequent", "alternate"],
  15445. aliases: ["Statement", "Conditional"],
  15446. fields: {
  15447. test: {
  15448. validate: (0, _index2.assertNodeType)("Expression")
  15449. },
  15450. consequent: {
  15451. validate: (0, _index2.assertNodeType)("Statement")
  15452. },
  15453. alternate: {
  15454. optional: true,
  15455. validate: (0, _index2.assertNodeType)("Statement")
  15456. }
  15457. }
  15458. });
  15459. (0, _index3.default)("LabeledStatement", {
  15460. visitor: ["label", "body"],
  15461. aliases: ["Statement"],
  15462. fields: {
  15463. label: {
  15464. validate: (0, _index2.assertNodeType)("Identifier")
  15465. },
  15466. body: {
  15467. validate: (0, _index2.assertNodeType)("Statement")
  15468. }
  15469. }
  15470. });
  15471. (0, _index3.default)("StringLiteral", {
  15472. builder: ["value"],
  15473. fields: {
  15474. value: {
  15475. validate: (0, _index2.assertValueType)("string")
  15476. }
  15477. },
  15478. aliases: ["Expression", "Pureish", "Literal", "Immutable"]
  15479. });
  15480. (0, _index3.default)("NumericLiteral", {
  15481. builder: ["value"],
  15482. deprecatedAlias: "NumberLiteral",
  15483. fields: {
  15484. value: {
  15485. validate: (0, _index2.assertValueType)("number")
  15486. }
  15487. },
  15488. aliases: ["Expression", "Pureish", "Literal", "Immutable"]
  15489. });
  15490. (0, _index3.default)("NullLiteral", {
  15491. aliases: ["Expression", "Pureish", "Literal", "Immutable"]
  15492. });
  15493. (0, _index3.default)("BooleanLiteral", {
  15494. builder: ["value"],
  15495. fields: {
  15496. value: {
  15497. validate: (0, _index2.assertValueType)("boolean")
  15498. }
  15499. },
  15500. aliases: ["Expression", "Pureish", "Literal", "Immutable"]
  15501. });
  15502. (0, _index3.default)("RegExpLiteral", {
  15503. builder: ["pattern", "flags"],
  15504. deprecatedAlias: "RegexLiteral",
  15505. aliases: ["Expression", "Literal"],
  15506. fields: {
  15507. pattern: {
  15508. validate: (0, _index2.assertValueType)("string")
  15509. },
  15510. flags: {
  15511. validate: (0, _index2.assertValueType)("string"),
  15512. default: ""
  15513. }
  15514. }
  15515. });
  15516. (0, _index3.default)("LogicalExpression", {
  15517. builder: ["operator", "left", "right"],
  15518. visitor: ["left", "right"],
  15519. aliases: ["Binary", "Expression"],
  15520. fields: {
  15521. operator: {
  15522. validate: _index2.assertOneOf.apply(undefined, _constants.LOGICAL_OPERATORS)
  15523. },
  15524. left: {
  15525. validate: (0, _index2.assertNodeType)("Expression")
  15526. },
  15527. right: {
  15528. validate: (0, _index2.assertNodeType)("Expression")
  15529. }
  15530. }
  15531. });
  15532. (0, _index3.default)("MemberExpression", {
  15533. builder: ["object", "property", "computed"],
  15534. visitor: ["object", "property"],
  15535. aliases: ["Expression", "LVal"],
  15536. fields: {
  15537. object: {
  15538. validate: (0, _index2.assertNodeType)("Expression")
  15539. },
  15540. property: {
  15541. validate: function validate(node, key, val) {
  15542. var expectedType = node.computed ? "Expression" : "Identifier";
  15543. (0, _index2.assertNodeType)(expectedType)(node, key, val);
  15544. }
  15545. },
  15546. computed: {
  15547. default: false
  15548. }
  15549. }
  15550. });
  15551. (0, _index3.default)("NewExpression", {
  15552. visitor: ["callee", "arguments"],
  15553. aliases: ["Expression"],
  15554. fields: {
  15555. callee: {
  15556. validate: (0, _index2.assertNodeType)("Expression")
  15557. },
  15558. arguments: {
  15559. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Expression", "SpreadElement")))
  15560. }
  15561. }
  15562. });
  15563. (0, _index3.default)("Program", {
  15564. visitor: ["directives", "body"],
  15565. builder: ["body", "directives"],
  15566. fields: {
  15567. directives: {
  15568. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Directive"))),
  15569. default: []
  15570. },
  15571. body: {
  15572. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Statement")))
  15573. }
  15574. },
  15575. aliases: ["Scopable", "BlockParent", "Block", "FunctionParent"]
  15576. });
  15577. (0, _index3.default)("ObjectExpression", {
  15578. visitor: ["properties"],
  15579. aliases: ["Expression"],
  15580. fields: {
  15581. properties: {
  15582. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("ObjectMethod", "ObjectProperty", "SpreadProperty")))
  15583. }
  15584. }
  15585. });
  15586. (0, _index3.default)("ObjectMethod", {
  15587. builder: ["kind", "key", "params", "body", "computed"],
  15588. fields: {
  15589. kind: {
  15590. validate: (0, _index2.chain)((0, _index2.assertValueType)("string"), (0, _index2.assertOneOf)("method", "get", "set")),
  15591. default: "method"
  15592. },
  15593. computed: {
  15594. validate: (0, _index2.assertValueType)("boolean"),
  15595. default: false
  15596. },
  15597. key: {
  15598. validate: function validate(node, key, val) {
  15599. var expectedTypes = node.computed ? ["Expression"] : ["Identifier", "StringLiteral", "NumericLiteral"];
  15600. _index2.assertNodeType.apply(undefined, expectedTypes)(node, key, val);
  15601. }
  15602. },
  15603. decorators: {
  15604. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Decorator")))
  15605. },
  15606. body: {
  15607. validate: (0, _index2.assertNodeType)("BlockStatement")
  15608. },
  15609. generator: {
  15610. default: false,
  15611. validate: (0, _index2.assertValueType)("boolean")
  15612. },
  15613. async: {
  15614. default: false,
  15615. validate: (0, _index2.assertValueType)("boolean")
  15616. }
  15617. },
  15618. visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"],
  15619. aliases: ["UserWhitespacable", "Function", "Scopable", "BlockParent", "FunctionParent", "Method", "ObjectMember"]
  15620. });
  15621. (0, _index3.default)("ObjectProperty", {
  15622. builder: ["key", "value", "computed", "shorthand", "decorators"],
  15623. fields: {
  15624. computed: {
  15625. validate: (0, _index2.assertValueType)("boolean"),
  15626. default: false
  15627. },
  15628. key: {
  15629. validate: function validate(node, key, val) {
  15630. var expectedTypes = node.computed ? ["Expression"] : ["Identifier", "StringLiteral", "NumericLiteral"];
  15631. _index2.assertNodeType.apply(undefined, expectedTypes)(node, key, val);
  15632. }
  15633. },
  15634. value: {
  15635. validate: (0, _index2.assertNodeType)("Expression", "Pattern", "RestElement")
  15636. },
  15637. shorthand: {
  15638. validate: (0, _index2.assertValueType)("boolean"),
  15639. default: false
  15640. },
  15641. decorators: {
  15642. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Decorator"))),
  15643. optional: true
  15644. }
  15645. },
  15646. visitor: ["key", "value", "decorators"],
  15647. aliases: ["UserWhitespacable", "Property", "ObjectMember"]
  15648. });
  15649. (0, _index3.default)("RestElement", {
  15650. visitor: ["argument", "typeAnnotation"],
  15651. aliases: ["LVal"],
  15652. fields: {
  15653. argument: {
  15654. validate: (0, _index2.assertNodeType)("LVal")
  15655. },
  15656. decorators: {
  15657. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Decorator")))
  15658. }
  15659. }
  15660. });
  15661. (0, _index3.default)("ReturnStatement", {
  15662. visitor: ["argument"],
  15663. aliases: ["Statement", "Terminatorless", "CompletionStatement"],
  15664. fields: {
  15665. argument: {
  15666. validate: (0, _index2.assertNodeType)("Expression"),
  15667. optional: true
  15668. }
  15669. }
  15670. });
  15671. (0, _index3.default)("SequenceExpression", {
  15672. visitor: ["expressions"],
  15673. fields: {
  15674. expressions: {
  15675. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Expression")))
  15676. }
  15677. },
  15678. aliases: ["Expression"]
  15679. });
  15680. (0, _index3.default)("SwitchCase", {
  15681. visitor: ["test", "consequent"],
  15682. fields: {
  15683. test: {
  15684. validate: (0, _index2.assertNodeType)("Expression"),
  15685. optional: true
  15686. },
  15687. consequent: {
  15688. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("Statement")))
  15689. }
  15690. }
  15691. });
  15692. (0, _index3.default)("SwitchStatement", {
  15693. visitor: ["discriminant", "cases"],
  15694. aliases: ["Statement", "BlockParent", "Scopable"],
  15695. fields: {
  15696. discriminant: {
  15697. validate: (0, _index2.assertNodeType)("Expression")
  15698. },
  15699. cases: {
  15700. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("SwitchCase")))
  15701. }
  15702. }
  15703. });
  15704. (0, _index3.default)("ThisExpression", {
  15705. aliases: ["Expression"]
  15706. });
  15707. (0, _index3.default)("ThrowStatement", {
  15708. visitor: ["argument"],
  15709. aliases: ["Statement", "Terminatorless", "CompletionStatement"],
  15710. fields: {
  15711. argument: {
  15712. validate: (0, _index2.assertNodeType)("Expression")
  15713. }
  15714. }
  15715. });
  15716. (0, _index3.default)("TryStatement", {
  15717. visitor: ["block", "handler", "finalizer"],
  15718. aliases: ["Statement"],
  15719. fields: {
  15720. body: {
  15721. validate: (0, _index2.assertNodeType)("BlockStatement")
  15722. },
  15723. handler: {
  15724. optional: true,
  15725. handler: (0, _index2.assertNodeType)("BlockStatement")
  15726. },
  15727. finalizer: {
  15728. optional: true,
  15729. validate: (0, _index2.assertNodeType)("BlockStatement")
  15730. }
  15731. }
  15732. });
  15733. (0, _index3.default)("UnaryExpression", {
  15734. builder: ["operator", "argument", "prefix"],
  15735. fields: {
  15736. prefix: {
  15737. default: true
  15738. },
  15739. argument: {
  15740. validate: (0, _index2.assertNodeType)("Expression")
  15741. },
  15742. operator: {
  15743. validate: _index2.assertOneOf.apply(undefined, _constants.UNARY_OPERATORS)
  15744. }
  15745. },
  15746. visitor: ["argument"],
  15747. aliases: ["UnaryLike", "Expression"]
  15748. });
  15749. (0, _index3.default)("UpdateExpression", {
  15750. builder: ["operator", "argument", "prefix"],
  15751. fields: {
  15752. prefix: {
  15753. default: false
  15754. },
  15755. argument: {
  15756. validate: (0, _index2.assertNodeType)("Expression")
  15757. },
  15758. operator: {
  15759. validate: _index2.assertOneOf.apply(undefined, _constants.UPDATE_OPERATORS)
  15760. }
  15761. },
  15762. visitor: ["argument"],
  15763. aliases: ["Expression"]
  15764. });
  15765. (0, _index3.default)("VariableDeclaration", {
  15766. builder: ["kind", "declarations"],
  15767. visitor: ["declarations"],
  15768. aliases: ["Statement", "Declaration"],
  15769. fields: {
  15770. kind: {
  15771. validate: (0, _index2.chain)((0, _index2.assertValueType)("string"), (0, _index2.assertOneOf)("var", "let", "const"))
  15772. },
  15773. declarations: {
  15774. validate: (0, _index2.chain)((0, _index2.assertValueType)("array"), (0, _index2.assertEach)((0, _index2.assertNodeType)("VariableDeclarator")))
  15775. }
  15776. }
  15777. });
  15778. (0, _index3.default)("VariableDeclarator", {
  15779. visitor: ["id", "init"],
  15780. fields: {
  15781. id: {
  15782. validate: (0, _index2.assertNodeType)("LVal")
  15783. },
  15784. init: {
  15785. optional: true,
  15786. validate: (0, _index2.assertNodeType)("Expression")
  15787. }
  15788. }
  15789. });
  15790. (0, _index3.default)("WhileStatement", {
  15791. visitor: ["test", "body"],
  15792. aliases: ["Statement", "BlockParent", "Loop", "While", "Scopable"],
  15793. fields: {
  15794. test: {
  15795. validate: (0, _index2.assertNodeType)("Expression")
  15796. },
  15797. body: {
  15798. validate: (0, _index2.assertNodeType)("BlockStatement", "Statement")
  15799. }
  15800. }
  15801. });
  15802. (0, _index3.default)("WithStatement", {
  15803. visitor: ["object", "body"],
  15804. aliases: ["Statement"],
  15805. fields: {
  15806. object: {
  15807. object: (0, _index2.assertNodeType)("Expression")
  15808. },
  15809. body: {
  15810. validate: (0, _index2.assertNodeType)("BlockStatement", "Statement")
  15811. }
  15812. }
  15813. });
  15814. },{"../constants":140,"../index":151,"./index":146}],143:[function(require,module,exports){
  15815. "use strict";
  15816. var _index = require("./index");
  15817. var _index2 = _interopRequireDefault(_index);
  15818. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15819. (0, _index2.default)("AssignmentPattern", {
  15820. visitor: ["left", "right"],
  15821. aliases: ["Pattern", "LVal"],
  15822. fields: {
  15823. left: {
  15824. validate: (0, _index.assertNodeType)("Identifier")
  15825. },
  15826. right: {
  15827. validate: (0, _index.assertNodeType)("Expression")
  15828. },
  15829. decorators: {
  15830. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Decorator")))
  15831. }
  15832. }
  15833. });
  15834. (0, _index2.default)("ArrayPattern", {
  15835. visitor: ["elements", "typeAnnotation"],
  15836. aliases: ["Pattern", "LVal"],
  15837. fields: {
  15838. elements: {
  15839. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Identifier", "Pattern", "RestElement")))
  15840. },
  15841. decorators: {
  15842. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Decorator")))
  15843. }
  15844. }
  15845. });
  15846. (0, _index2.default)("ArrowFunctionExpression", {
  15847. builder: ["params", "body", "async"],
  15848. visitor: ["params", "body", "returnType", "typeParameters"],
  15849. aliases: ["Scopable", "Function", "BlockParent", "FunctionParent", "Expression", "Pureish"],
  15850. fields: {
  15851. params: {
  15852. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("LVal")))
  15853. },
  15854. body: {
  15855. validate: (0, _index.assertNodeType)("BlockStatement", "Expression")
  15856. },
  15857. async: {
  15858. validate: (0, _index.assertValueType)("boolean"),
  15859. default: false
  15860. }
  15861. }
  15862. });
  15863. (0, _index2.default)("ClassBody", {
  15864. visitor: ["body"],
  15865. fields: {
  15866. body: {
  15867. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("ClassMethod", "ClassProperty")))
  15868. }
  15869. }
  15870. });
  15871. (0, _index2.default)("ClassDeclaration", {
  15872. builder: ["id", "superClass", "body", "decorators"],
  15873. visitor: ["id", "body", "superClass", "mixins", "typeParameters", "superTypeParameters", "implements", "decorators"],
  15874. aliases: ["Scopable", "Class", "Statement", "Declaration", "Pureish"],
  15875. fields: {
  15876. id: {
  15877. validate: (0, _index.assertNodeType)("Identifier")
  15878. },
  15879. body: {
  15880. validate: (0, _index.assertNodeType)("ClassBody")
  15881. },
  15882. superClass: {
  15883. optional: true,
  15884. validate: (0, _index.assertNodeType)("Expression")
  15885. },
  15886. decorators: {
  15887. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Decorator")))
  15888. }
  15889. }
  15890. });
  15891. (0, _index2.default)("ClassExpression", {
  15892. inherits: "ClassDeclaration",
  15893. aliases: ["Scopable", "Class", "Expression", "Pureish"],
  15894. fields: {
  15895. id: {
  15896. optional: true,
  15897. validate: (0, _index.assertNodeType)("Identifier")
  15898. },
  15899. body: {
  15900. validate: (0, _index.assertNodeType)("ClassBody")
  15901. },
  15902. superClass: {
  15903. optional: true,
  15904. validate: (0, _index.assertNodeType)("Expression")
  15905. },
  15906. decorators: {
  15907. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Decorator")))
  15908. }
  15909. }
  15910. });
  15911. (0, _index2.default)("ExportAllDeclaration", {
  15912. visitor: ["source"],
  15913. aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"],
  15914. fields: {
  15915. source: {
  15916. validate: (0, _index.assertNodeType)("StringLiteral")
  15917. }
  15918. }
  15919. });
  15920. (0, _index2.default)("ExportDefaultDeclaration", {
  15921. visitor: ["declaration"],
  15922. aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"],
  15923. fields: {
  15924. declaration: {
  15925. validate: (0, _index.assertNodeType)("FunctionDeclaration", "ClassDeclaration", "Expression")
  15926. }
  15927. }
  15928. });
  15929. (0, _index2.default)("ExportNamedDeclaration", {
  15930. visitor: ["declaration", "specifiers", "source"],
  15931. aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"],
  15932. fields: {
  15933. declaration: {
  15934. validate: (0, _index.assertNodeType)("Declaration"),
  15935. optional: true
  15936. },
  15937. specifiers: {
  15938. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("ExportSpecifier")))
  15939. },
  15940. source: {
  15941. validate: (0, _index.assertNodeType)("StringLiteral"),
  15942. optional: true
  15943. }
  15944. }
  15945. });
  15946. (0, _index2.default)("ExportSpecifier", {
  15947. visitor: ["local", "exported"],
  15948. aliases: ["ModuleSpecifier"],
  15949. fields: {
  15950. local: {
  15951. validate: (0, _index.assertNodeType)("Identifier")
  15952. },
  15953. exported: {
  15954. validate: (0, _index.assertNodeType)("Identifier")
  15955. }
  15956. }
  15957. });
  15958. (0, _index2.default)("ForOfStatement", {
  15959. visitor: ["left", "right", "body"],
  15960. aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"],
  15961. fields: {
  15962. left: {
  15963. validate: (0, _index.assertNodeType)("VariableDeclaration", "LVal")
  15964. },
  15965. right: {
  15966. validate: (0, _index.assertNodeType)("Expression")
  15967. },
  15968. body: {
  15969. validate: (0, _index.assertNodeType)("Statement")
  15970. }
  15971. }
  15972. });
  15973. (0, _index2.default)("ImportDeclaration", {
  15974. visitor: ["specifiers", "source"],
  15975. aliases: ["Statement", "Declaration", "ModuleDeclaration"],
  15976. fields: {
  15977. specifiers: {
  15978. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("ImportSpecifier", "ImportDefaultSpecifier", "ImportNamespaceSpecifier")))
  15979. },
  15980. source: {
  15981. validate: (0, _index.assertNodeType)("StringLiteral")
  15982. }
  15983. }
  15984. });
  15985. (0, _index2.default)("ImportDefaultSpecifier", {
  15986. visitor: ["local"],
  15987. aliases: ["ModuleSpecifier"],
  15988. fields: {
  15989. local: {
  15990. validate: (0, _index.assertNodeType)("Identifier")
  15991. }
  15992. }
  15993. });
  15994. (0, _index2.default)("ImportNamespaceSpecifier", {
  15995. visitor: ["local"],
  15996. aliases: ["ModuleSpecifier"],
  15997. fields: {
  15998. local: {
  15999. validate: (0, _index.assertNodeType)("Identifier")
  16000. }
  16001. }
  16002. });
  16003. (0, _index2.default)("ImportSpecifier", {
  16004. visitor: ["local", "imported"],
  16005. aliases: ["ModuleSpecifier"],
  16006. fields: {
  16007. local: {
  16008. validate: (0, _index.assertNodeType)("Identifier")
  16009. },
  16010. imported: {
  16011. validate: (0, _index.assertNodeType)("Identifier")
  16012. },
  16013. importKind: {
  16014. validate: (0, _index.assertOneOf)(null, "type", "typeof")
  16015. }
  16016. }
  16017. });
  16018. (0, _index2.default)("MetaProperty", {
  16019. visitor: ["meta", "property"],
  16020. aliases: ["Expression"],
  16021. fields: {
  16022. meta: {
  16023. validate: (0, _index.assertValueType)("string")
  16024. },
  16025. property: {
  16026. validate: (0, _index.assertValueType)("string")
  16027. }
  16028. }
  16029. });
  16030. (0, _index2.default)("ClassMethod", {
  16031. aliases: ["Function", "Scopable", "BlockParent", "FunctionParent", "Method"],
  16032. builder: ["kind", "key", "params", "body", "computed", "static"],
  16033. visitor: ["key", "params", "body", "decorators", "returnType", "typeParameters"],
  16034. fields: {
  16035. kind: {
  16036. validate: (0, _index.chain)((0, _index.assertValueType)("string"), (0, _index.assertOneOf)("get", "set", "method", "constructor")),
  16037. default: "method"
  16038. },
  16039. computed: {
  16040. default: false,
  16041. validate: (0, _index.assertValueType)("boolean")
  16042. },
  16043. static: {
  16044. default: false,
  16045. validate: (0, _index.assertValueType)("boolean")
  16046. },
  16047. key: {
  16048. validate: function validate(node, key, val) {
  16049. var expectedTypes = node.computed ? ["Expression"] : ["Identifier", "StringLiteral", "NumericLiteral"];
  16050. _index.assertNodeType.apply(undefined, expectedTypes)(node, key, val);
  16051. }
  16052. },
  16053. params: {
  16054. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("LVal")))
  16055. },
  16056. body: {
  16057. validate: (0, _index.assertNodeType)("BlockStatement")
  16058. },
  16059. generator: {
  16060. default: false,
  16061. validate: (0, _index.assertValueType)("boolean")
  16062. },
  16063. async: {
  16064. default: false,
  16065. validate: (0, _index.assertValueType)("boolean")
  16066. }
  16067. }
  16068. });
  16069. (0, _index2.default)("ObjectPattern", {
  16070. visitor: ["properties", "typeAnnotation"],
  16071. aliases: ["Pattern", "LVal"],
  16072. fields: {
  16073. properties: {
  16074. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("RestProperty", "Property")))
  16075. },
  16076. decorators: {
  16077. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Decorator")))
  16078. }
  16079. }
  16080. });
  16081. (0, _index2.default)("SpreadElement", {
  16082. visitor: ["argument"],
  16083. aliases: ["UnaryLike"],
  16084. fields: {
  16085. argument: {
  16086. validate: (0, _index.assertNodeType)("Expression")
  16087. }
  16088. }
  16089. });
  16090. (0, _index2.default)("Super", {
  16091. aliases: ["Expression"]
  16092. });
  16093. (0, _index2.default)("TaggedTemplateExpression", {
  16094. visitor: ["tag", "quasi"],
  16095. aliases: ["Expression"],
  16096. fields: {
  16097. tag: {
  16098. validate: (0, _index.assertNodeType)("Expression")
  16099. },
  16100. quasi: {
  16101. validate: (0, _index.assertNodeType)("TemplateLiteral")
  16102. }
  16103. }
  16104. });
  16105. (0, _index2.default)("TemplateElement", {
  16106. builder: ["value", "tail"],
  16107. fields: {
  16108. value: {},
  16109. tail: {
  16110. validate: (0, _index.assertValueType)("boolean"),
  16111. default: false
  16112. }
  16113. }
  16114. });
  16115. (0, _index2.default)("TemplateLiteral", {
  16116. visitor: ["quasis", "expressions"],
  16117. aliases: ["Expression", "Literal"],
  16118. fields: {
  16119. quasis: {
  16120. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("TemplateElement")))
  16121. },
  16122. expressions: {
  16123. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("Expression")))
  16124. }
  16125. }
  16126. });
  16127. (0, _index2.default)("YieldExpression", {
  16128. builder: ["argument", "delegate"],
  16129. visitor: ["argument"],
  16130. aliases: ["Expression", "Terminatorless"],
  16131. fields: {
  16132. delegate: {
  16133. validate: (0, _index.assertValueType)("boolean"),
  16134. default: false
  16135. },
  16136. argument: {
  16137. optional: true,
  16138. validate: (0, _index.assertNodeType)("Expression")
  16139. }
  16140. }
  16141. });
  16142. },{"./index":146}],144:[function(require,module,exports){
  16143. "use strict";
  16144. var _index = require("./index");
  16145. var _index2 = _interopRequireDefault(_index);
  16146. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16147. (0, _index2.default)("AwaitExpression", {
  16148. builder: ["argument"],
  16149. visitor: ["argument"],
  16150. aliases: ["Expression", "Terminatorless"],
  16151. fields: {
  16152. argument: {
  16153. validate: (0, _index.assertNodeType)("Expression")
  16154. }
  16155. }
  16156. });
  16157. (0, _index2.default)("ForAwaitStatement", {
  16158. visitor: ["left", "right", "body"],
  16159. aliases: ["Scopable", "Statement", "For", "BlockParent", "Loop", "ForXStatement"],
  16160. fields: {
  16161. left: {
  16162. validate: (0, _index.assertNodeType)("VariableDeclaration", "LVal")
  16163. },
  16164. right: {
  16165. validate: (0, _index.assertNodeType)("Expression")
  16166. },
  16167. body: {
  16168. validate: (0, _index.assertNodeType)("Statement")
  16169. }
  16170. }
  16171. });
  16172. (0, _index2.default)("BindExpression", {
  16173. visitor: ["object", "callee"],
  16174. aliases: ["Expression"],
  16175. fields: {}
  16176. });
  16177. (0, _index2.default)("Import", {
  16178. aliases: ["Expression"]
  16179. });
  16180. (0, _index2.default)("Decorator", {
  16181. visitor: ["expression"],
  16182. fields: {
  16183. expression: {
  16184. validate: (0, _index.assertNodeType)("Expression")
  16185. }
  16186. }
  16187. });
  16188. (0, _index2.default)("DoExpression", {
  16189. visitor: ["body"],
  16190. aliases: ["Expression"],
  16191. fields: {
  16192. body: {
  16193. validate: (0, _index.assertNodeType)("BlockStatement")
  16194. }
  16195. }
  16196. });
  16197. (0, _index2.default)("ExportDefaultSpecifier", {
  16198. visitor: ["exported"],
  16199. aliases: ["ModuleSpecifier"],
  16200. fields: {
  16201. exported: {
  16202. validate: (0, _index.assertNodeType)("Identifier")
  16203. }
  16204. }
  16205. });
  16206. (0, _index2.default)("ExportNamespaceSpecifier", {
  16207. visitor: ["exported"],
  16208. aliases: ["ModuleSpecifier"],
  16209. fields: {
  16210. exported: {
  16211. validate: (0, _index.assertNodeType)("Identifier")
  16212. }
  16213. }
  16214. });
  16215. (0, _index2.default)("RestProperty", {
  16216. visitor: ["argument"],
  16217. aliases: ["UnaryLike"],
  16218. fields: {
  16219. argument: {
  16220. validate: (0, _index.assertNodeType)("LVal")
  16221. }
  16222. }
  16223. });
  16224. (0, _index2.default)("SpreadProperty", {
  16225. visitor: ["argument"],
  16226. aliases: ["UnaryLike"],
  16227. fields: {
  16228. argument: {
  16229. validate: (0, _index.assertNodeType)("Expression")
  16230. }
  16231. }
  16232. });
  16233. },{"./index":146}],145:[function(require,module,exports){
  16234. "use strict";
  16235. var _index = require("./index");
  16236. var _index2 = _interopRequireDefault(_index);
  16237. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16238. (0, _index2.default)("AnyTypeAnnotation", {
  16239. aliases: ["Flow", "FlowBaseAnnotation"],
  16240. fields: {}
  16241. });
  16242. (0, _index2.default)("ArrayTypeAnnotation", {
  16243. visitor: ["elementType"],
  16244. aliases: ["Flow"],
  16245. fields: {}
  16246. });
  16247. (0, _index2.default)("BooleanTypeAnnotation", {
  16248. aliases: ["Flow", "FlowBaseAnnotation"],
  16249. fields: {}
  16250. });
  16251. (0, _index2.default)("BooleanLiteralTypeAnnotation", {
  16252. aliases: ["Flow"],
  16253. fields: {}
  16254. });
  16255. (0, _index2.default)("NullLiteralTypeAnnotation", {
  16256. aliases: ["Flow", "FlowBaseAnnotation"],
  16257. fields: {}
  16258. });
  16259. (0, _index2.default)("ClassImplements", {
  16260. visitor: ["id", "typeParameters"],
  16261. aliases: ["Flow"],
  16262. fields: {}
  16263. });
  16264. (0, _index2.default)("ClassProperty", {
  16265. visitor: ["key", "value", "typeAnnotation", "decorators"],
  16266. builder: ["key", "value", "typeAnnotation", "decorators", "computed"],
  16267. aliases: ["Property"],
  16268. fields: {
  16269. computed: {
  16270. validate: (0, _index.assertValueType)("boolean"),
  16271. default: false
  16272. }
  16273. }
  16274. });
  16275. (0, _index2.default)("DeclareClass", {
  16276. visitor: ["id", "typeParameters", "extends", "body"],
  16277. aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
  16278. fields: {}
  16279. });
  16280. (0, _index2.default)("DeclareFunction", {
  16281. visitor: ["id"],
  16282. aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
  16283. fields: {}
  16284. });
  16285. (0, _index2.default)("DeclareInterface", {
  16286. visitor: ["id", "typeParameters", "extends", "body"],
  16287. aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
  16288. fields: {}
  16289. });
  16290. (0, _index2.default)("DeclareModule", {
  16291. visitor: ["id", "body"],
  16292. aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
  16293. fields: {}
  16294. });
  16295. (0, _index2.default)("DeclareModuleExports", {
  16296. visitor: ["typeAnnotation"],
  16297. aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
  16298. fields: {}
  16299. });
  16300. (0, _index2.default)("DeclareTypeAlias", {
  16301. visitor: ["id", "typeParameters", "right"],
  16302. aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
  16303. fields: {}
  16304. });
  16305. (0, _index2.default)("DeclareOpaqueType", {
  16306. visitor: ["id", "typeParameters", "supertype"],
  16307. aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
  16308. fields: {}
  16309. });
  16310. (0, _index2.default)("DeclareVariable", {
  16311. visitor: ["id"],
  16312. aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
  16313. fields: {}
  16314. });
  16315. (0, _index2.default)("DeclareExportDeclaration", {
  16316. visitor: ["declaration", "specifiers", "source"],
  16317. aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
  16318. fields: {}
  16319. });
  16320. (0, _index2.default)("ExistentialTypeParam", {
  16321. aliases: ["Flow"]
  16322. });
  16323. (0, _index2.default)("FunctionTypeAnnotation", {
  16324. visitor: ["typeParameters", "params", "rest", "returnType"],
  16325. aliases: ["Flow"],
  16326. fields: {}
  16327. });
  16328. (0, _index2.default)("FunctionTypeParam", {
  16329. visitor: ["name", "typeAnnotation"],
  16330. aliases: ["Flow"],
  16331. fields: {}
  16332. });
  16333. (0, _index2.default)("GenericTypeAnnotation", {
  16334. visitor: ["id", "typeParameters"],
  16335. aliases: ["Flow"],
  16336. fields: {}
  16337. });
  16338. (0, _index2.default)("InterfaceExtends", {
  16339. visitor: ["id", "typeParameters"],
  16340. aliases: ["Flow"],
  16341. fields: {}
  16342. });
  16343. (0, _index2.default)("InterfaceDeclaration", {
  16344. visitor: ["id", "typeParameters", "extends", "body"],
  16345. aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
  16346. fields: {}
  16347. });
  16348. (0, _index2.default)("IntersectionTypeAnnotation", {
  16349. visitor: ["types"],
  16350. aliases: ["Flow"],
  16351. fields: {}
  16352. });
  16353. (0, _index2.default)("MixedTypeAnnotation", {
  16354. aliases: ["Flow", "FlowBaseAnnotation"]
  16355. });
  16356. (0, _index2.default)("EmptyTypeAnnotation", {
  16357. aliases: ["Flow", "FlowBaseAnnotation"]
  16358. });
  16359. (0, _index2.default)("NullableTypeAnnotation", {
  16360. visitor: ["typeAnnotation"],
  16361. aliases: ["Flow"],
  16362. fields: {}
  16363. });
  16364. (0, _index2.default)("NumericLiteralTypeAnnotation", {
  16365. aliases: ["Flow"],
  16366. fields: {}
  16367. });
  16368. (0, _index2.default)("NumberTypeAnnotation", {
  16369. aliases: ["Flow", "FlowBaseAnnotation"],
  16370. fields: {}
  16371. });
  16372. (0, _index2.default)("StringLiteralTypeAnnotation", {
  16373. aliases: ["Flow"],
  16374. fields: {}
  16375. });
  16376. (0, _index2.default)("StringTypeAnnotation", {
  16377. aliases: ["Flow", "FlowBaseAnnotation"],
  16378. fields: {}
  16379. });
  16380. (0, _index2.default)("ThisTypeAnnotation", {
  16381. aliases: ["Flow", "FlowBaseAnnotation"],
  16382. fields: {}
  16383. });
  16384. (0, _index2.default)("TupleTypeAnnotation", {
  16385. visitor: ["types"],
  16386. aliases: ["Flow"],
  16387. fields: {}
  16388. });
  16389. (0, _index2.default)("TypeofTypeAnnotation", {
  16390. visitor: ["argument"],
  16391. aliases: ["Flow"],
  16392. fields: {}
  16393. });
  16394. (0, _index2.default)("TypeAlias", {
  16395. visitor: ["id", "typeParameters", "right"],
  16396. aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
  16397. fields: {}
  16398. });
  16399. (0, _index2.default)("OpaqueType", {
  16400. visitor: ["id", "typeParameters", "impltype", "supertype"],
  16401. aliases: ["Flow", "FlowDeclaration", "Statement", "Declaration"],
  16402. fields: {}
  16403. });
  16404. (0, _index2.default)("TypeAnnotation", {
  16405. visitor: ["typeAnnotation"],
  16406. aliases: ["Flow"],
  16407. fields: {}
  16408. });
  16409. (0, _index2.default)("TypeCastExpression", {
  16410. visitor: ["expression", "typeAnnotation"],
  16411. aliases: ["Flow", "ExpressionWrapper", "Expression"],
  16412. fields: {}
  16413. });
  16414. (0, _index2.default)("TypeParameter", {
  16415. visitor: ["bound"],
  16416. aliases: ["Flow"],
  16417. fields: {}
  16418. });
  16419. (0, _index2.default)("TypeParameterDeclaration", {
  16420. visitor: ["params"],
  16421. aliases: ["Flow"],
  16422. fields: {}
  16423. });
  16424. (0, _index2.default)("TypeParameterInstantiation", {
  16425. visitor: ["params"],
  16426. aliases: ["Flow"],
  16427. fields: {}
  16428. });
  16429. (0, _index2.default)("ObjectTypeAnnotation", {
  16430. visitor: ["properties", "indexers", "callProperties"],
  16431. aliases: ["Flow"],
  16432. fields: {}
  16433. });
  16434. (0, _index2.default)("ObjectTypeCallProperty", {
  16435. visitor: ["value"],
  16436. aliases: ["Flow", "UserWhitespacable"],
  16437. fields: {}
  16438. });
  16439. (0, _index2.default)("ObjectTypeIndexer", {
  16440. visitor: ["id", "key", "value"],
  16441. aliases: ["Flow", "UserWhitespacable"],
  16442. fields: {}
  16443. });
  16444. (0, _index2.default)("ObjectTypeProperty", {
  16445. visitor: ["key", "value"],
  16446. aliases: ["Flow", "UserWhitespacable"],
  16447. fields: {}
  16448. });
  16449. (0, _index2.default)("ObjectTypeSpreadProperty", {
  16450. visitor: ["argument"],
  16451. aliases: ["Flow", "UserWhitespacable"],
  16452. fields: {}
  16453. });
  16454. (0, _index2.default)("QualifiedTypeIdentifier", {
  16455. visitor: ["id", "qualification"],
  16456. aliases: ["Flow"],
  16457. fields: {}
  16458. });
  16459. (0, _index2.default)("UnionTypeAnnotation", {
  16460. visitor: ["types"],
  16461. aliases: ["Flow"],
  16462. fields: {}
  16463. });
  16464. (0, _index2.default)("VoidTypeAnnotation", {
  16465. aliases: ["Flow", "FlowBaseAnnotation"],
  16466. fields: {}
  16467. });
  16468. },{"./index":146}],146:[function(require,module,exports){
  16469. "use strict";
  16470. exports.__esModule = true;
  16471. exports.DEPRECATED_KEYS = exports.BUILDER_KEYS = exports.NODE_FIELDS = exports.ALIAS_KEYS = exports.VISITOR_KEYS = undefined;
  16472. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  16473. var _getIterator3 = _interopRequireDefault(_getIterator2);
  16474. var _stringify = require("babel-runtime/core-js/json/stringify");
  16475. var _stringify2 = _interopRequireDefault(_stringify);
  16476. var _typeof2 = require("babel-runtime/helpers/typeof");
  16477. var _typeof3 = _interopRequireDefault(_typeof2);
  16478. exports.assertEach = assertEach;
  16479. exports.assertOneOf = assertOneOf;
  16480. exports.assertNodeType = assertNodeType;
  16481. exports.assertNodeOrValueType = assertNodeOrValueType;
  16482. exports.assertValueType = assertValueType;
  16483. exports.chain = chain;
  16484. exports.default = defineType;
  16485. var _index = require("../index");
  16486. var t = _interopRequireWildcard(_index);
  16487. 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; } }
  16488. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16489. var VISITOR_KEYS = exports.VISITOR_KEYS = {};
  16490. var ALIAS_KEYS = exports.ALIAS_KEYS = {};
  16491. var NODE_FIELDS = exports.NODE_FIELDS = {};
  16492. var BUILDER_KEYS = exports.BUILDER_KEYS = {};
  16493. var DEPRECATED_KEYS = exports.DEPRECATED_KEYS = {};
  16494. function getType(val) {
  16495. if (Array.isArray(val)) {
  16496. return "array";
  16497. } else if (val === null) {
  16498. return "null";
  16499. } else if (val === undefined) {
  16500. return "undefined";
  16501. } else {
  16502. return typeof val === "undefined" ? "undefined" : (0, _typeof3.default)(val);
  16503. }
  16504. }
  16505. function assertEach(callback) {
  16506. function validator(node, key, val) {
  16507. if (!Array.isArray(val)) return;
  16508. for (var i = 0; i < val.length; i++) {
  16509. callback(node, key + "[" + i + "]", val[i]);
  16510. }
  16511. }
  16512. validator.each = callback;
  16513. return validator;
  16514. }
  16515. function assertOneOf() {
  16516. for (var _len = arguments.length, vals = Array(_len), _key = 0; _key < _len; _key++) {
  16517. vals[_key] = arguments[_key];
  16518. }
  16519. function validate(node, key, val) {
  16520. if (vals.indexOf(val) < 0) {
  16521. throw new TypeError("Property " + key + " expected value to be one of " + (0, _stringify2.default)(vals) + " but got " + (0, _stringify2.default)(val));
  16522. }
  16523. }
  16524. validate.oneOf = vals;
  16525. return validate;
  16526. }
  16527. function assertNodeType() {
  16528. for (var _len2 = arguments.length, types = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  16529. types[_key2] = arguments[_key2];
  16530. }
  16531. function validate(node, key, val) {
  16532. var valid = false;
  16533. for (var _iterator = types, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  16534. var _ref;
  16535. if (_isArray) {
  16536. if (_i >= _iterator.length) break;
  16537. _ref = _iterator[_i++];
  16538. } else {
  16539. _i = _iterator.next();
  16540. if (_i.done) break;
  16541. _ref = _i.value;
  16542. }
  16543. var type = _ref;
  16544. if (t.is(type, val)) {
  16545. valid = true;
  16546. break;
  16547. }
  16548. }
  16549. if (!valid) {
  16550. 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)));
  16551. }
  16552. }
  16553. validate.oneOfNodeTypes = types;
  16554. return validate;
  16555. }
  16556. function assertNodeOrValueType() {
  16557. for (var _len3 = arguments.length, types = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  16558. types[_key3] = arguments[_key3];
  16559. }
  16560. function validate(node, key, val) {
  16561. var valid = false;
  16562. for (var _iterator2 = types, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  16563. var _ref2;
  16564. if (_isArray2) {
  16565. if (_i2 >= _iterator2.length) break;
  16566. _ref2 = _iterator2[_i2++];
  16567. } else {
  16568. _i2 = _iterator2.next();
  16569. if (_i2.done) break;
  16570. _ref2 = _i2.value;
  16571. }
  16572. var type = _ref2;
  16573. if (getType(val) === type || t.is(type, val)) {
  16574. valid = true;
  16575. break;
  16576. }
  16577. }
  16578. if (!valid) {
  16579. 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)));
  16580. }
  16581. }
  16582. validate.oneOfNodeOrValueTypes = types;
  16583. return validate;
  16584. }
  16585. function assertValueType(type) {
  16586. function validate(node, key, val) {
  16587. var valid = getType(val) === type;
  16588. if (!valid) {
  16589. throw new TypeError("Property " + key + " expected type of " + type + " but got " + getType(val));
  16590. }
  16591. }
  16592. validate.type = type;
  16593. return validate;
  16594. }
  16595. function chain() {
  16596. for (var _len4 = arguments.length, fns = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  16597. fns[_key4] = arguments[_key4];
  16598. }
  16599. function validate() {
  16600. for (var _iterator3 = fns, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) {
  16601. var _ref3;
  16602. if (_isArray3) {
  16603. if (_i3 >= _iterator3.length) break;
  16604. _ref3 = _iterator3[_i3++];
  16605. } else {
  16606. _i3 = _iterator3.next();
  16607. if (_i3.done) break;
  16608. _ref3 = _i3.value;
  16609. }
  16610. var fn = _ref3;
  16611. fn.apply(undefined, arguments);
  16612. }
  16613. }
  16614. validate.chainOf = fns;
  16615. return validate;
  16616. }
  16617. function defineType(type) {
  16618. var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  16619. var inherits = opts.inherits && store[opts.inherits] || {};
  16620. opts.fields = opts.fields || inherits.fields || {};
  16621. opts.visitor = opts.visitor || inherits.visitor || [];
  16622. opts.aliases = opts.aliases || inherits.aliases || [];
  16623. opts.builder = opts.builder || inherits.builder || opts.visitor || [];
  16624. if (opts.deprecatedAlias) {
  16625. DEPRECATED_KEYS[opts.deprecatedAlias] = type;
  16626. }
  16627. for (var _iterator4 = opts.visitor.concat(opts.builder), _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) {
  16628. var _ref4;
  16629. if (_isArray4) {
  16630. if (_i4 >= _iterator4.length) break;
  16631. _ref4 = _iterator4[_i4++];
  16632. } else {
  16633. _i4 = _iterator4.next();
  16634. if (_i4.done) break;
  16635. _ref4 = _i4.value;
  16636. }
  16637. var _key5 = _ref4;
  16638. opts.fields[_key5] = opts.fields[_key5] || {};
  16639. }
  16640. for (var key in opts.fields) {
  16641. var field = opts.fields[key];
  16642. if (opts.builder.indexOf(key) === -1) {
  16643. field.optional = true;
  16644. }
  16645. if (field.default === undefined) {
  16646. field.default = null;
  16647. } else if (!field.validate) {
  16648. field.validate = assertValueType(getType(field.default));
  16649. }
  16650. }
  16651. VISITOR_KEYS[type] = opts.visitor;
  16652. BUILDER_KEYS[type] = opts.builder;
  16653. NODE_FIELDS[type] = opts.fields;
  16654. ALIAS_KEYS[type] = opts.aliases;
  16655. store[type] = opts;
  16656. }
  16657. var store = {};
  16658. },{"../index":151,"babel-runtime/core-js/get-iterator":95,"babel-runtime/core-js/json/stringify":96,"babel-runtime/helpers/typeof":113}],147:[function(require,module,exports){
  16659. "use strict";
  16660. require("./index");
  16661. require("./core");
  16662. require("./es2015");
  16663. require("./flow");
  16664. require("./jsx");
  16665. require("./misc");
  16666. require("./experimental");
  16667. },{"./core":142,"./es2015":143,"./experimental":144,"./flow":145,"./index":146,"./jsx":148,"./misc":149}],148:[function(require,module,exports){
  16668. "use strict";
  16669. var _index = require("./index");
  16670. var _index2 = _interopRequireDefault(_index);
  16671. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16672. (0, _index2.default)("JSXAttribute", {
  16673. visitor: ["name", "value"],
  16674. aliases: ["JSX", "Immutable"],
  16675. fields: {
  16676. name: {
  16677. validate: (0, _index.assertNodeType)("JSXIdentifier", "JSXNamespacedName")
  16678. },
  16679. value: {
  16680. optional: true,
  16681. validate: (0, _index.assertNodeType)("JSXElement", "StringLiteral", "JSXExpressionContainer")
  16682. }
  16683. }
  16684. });
  16685. (0, _index2.default)("JSXClosingElement", {
  16686. visitor: ["name"],
  16687. aliases: ["JSX", "Immutable"],
  16688. fields: {
  16689. name: {
  16690. validate: (0, _index.assertNodeType)("JSXIdentifier", "JSXMemberExpression")
  16691. }
  16692. }
  16693. });
  16694. (0, _index2.default)("JSXElement", {
  16695. builder: ["openingElement", "closingElement", "children", "selfClosing"],
  16696. visitor: ["openingElement", "children", "closingElement"],
  16697. aliases: ["JSX", "Immutable", "Expression"],
  16698. fields: {
  16699. openingElement: {
  16700. validate: (0, _index.assertNodeType)("JSXOpeningElement")
  16701. },
  16702. closingElement: {
  16703. optional: true,
  16704. validate: (0, _index.assertNodeType)("JSXClosingElement")
  16705. },
  16706. children: {
  16707. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("JSXText", "JSXExpressionContainer", "JSXSpreadChild", "JSXElement")))
  16708. }
  16709. }
  16710. });
  16711. (0, _index2.default)("JSXEmptyExpression", {
  16712. aliases: ["JSX", "Expression"]
  16713. });
  16714. (0, _index2.default)("JSXExpressionContainer", {
  16715. visitor: ["expression"],
  16716. aliases: ["JSX", "Immutable"],
  16717. fields: {
  16718. expression: {
  16719. validate: (0, _index.assertNodeType)("Expression")
  16720. }
  16721. }
  16722. });
  16723. (0, _index2.default)("JSXSpreadChild", {
  16724. visitor: ["expression"],
  16725. aliases: ["JSX", "Immutable"],
  16726. fields: {
  16727. expression: {
  16728. validate: (0, _index.assertNodeType)("Expression")
  16729. }
  16730. }
  16731. });
  16732. (0, _index2.default)("JSXIdentifier", {
  16733. builder: ["name"],
  16734. aliases: ["JSX", "Expression"],
  16735. fields: {
  16736. name: {
  16737. validate: (0, _index.assertValueType)("string")
  16738. }
  16739. }
  16740. });
  16741. (0, _index2.default)("JSXMemberExpression", {
  16742. visitor: ["object", "property"],
  16743. aliases: ["JSX", "Expression"],
  16744. fields: {
  16745. object: {
  16746. validate: (0, _index.assertNodeType)("JSXMemberExpression", "JSXIdentifier")
  16747. },
  16748. property: {
  16749. validate: (0, _index.assertNodeType)("JSXIdentifier")
  16750. }
  16751. }
  16752. });
  16753. (0, _index2.default)("JSXNamespacedName", {
  16754. visitor: ["namespace", "name"],
  16755. aliases: ["JSX"],
  16756. fields: {
  16757. namespace: {
  16758. validate: (0, _index.assertNodeType)("JSXIdentifier")
  16759. },
  16760. name: {
  16761. validate: (0, _index.assertNodeType)("JSXIdentifier")
  16762. }
  16763. }
  16764. });
  16765. (0, _index2.default)("JSXOpeningElement", {
  16766. builder: ["name", "attributes", "selfClosing"],
  16767. visitor: ["name", "attributes"],
  16768. aliases: ["JSX", "Immutable"],
  16769. fields: {
  16770. name: {
  16771. validate: (0, _index.assertNodeType)("JSXIdentifier", "JSXMemberExpression")
  16772. },
  16773. selfClosing: {
  16774. default: false,
  16775. validate: (0, _index.assertValueType)("boolean")
  16776. },
  16777. attributes: {
  16778. validate: (0, _index.chain)((0, _index.assertValueType)("array"), (0, _index.assertEach)((0, _index.assertNodeType)("JSXAttribute", "JSXSpreadAttribute")))
  16779. }
  16780. }
  16781. });
  16782. (0, _index2.default)("JSXSpreadAttribute", {
  16783. visitor: ["argument"],
  16784. aliases: ["JSX"],
  16785. fields: {
  16786. argument: {
  16787. validate: (0, _index.assertNodeType)("Expression")
  16788. }
  16789. }
  16790. });
  16791. (0, _index2.default)("JSXText", {
  16792. aliases: ["JSX", "Immutable"],
  16793. builder: ["value"],
  16794. fields: {
  16795. value: {
  16796. validate: (0, _index.assertValueType)("string")
  16797. }
  16798. }
  16799. });
  16800. },{"./index":146}],149:[function(require,module,exports){
  16801. "use strict";
  16802. var _index = require("./index");
  16803. var _index2 = _interopRequireDefault(_index);
  16804. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16805. (0, _index2.default)("Noop", {
  16806. visitor: []
  16807. });
  16808. (0, _index2.default)("ParenthesizedExpression", {
  16809. visitor: ["expression"],
  16810. aliases: ["Expression", "ExpressionWrapper"],
  16811. fields: {
  16812. expression: {
  16813. validate: (0, _index.assertNodeType)("Expression")
  16814. }
  16815. }
  16816. });
  16817. },{"./index":146}],150:[function(require,module,exports){
  16818. "use strict";
  16819. exports.__esModule = true;
  16820. exports.createUnionTypeAnnotation = createUnionTypeAnnotation;
  16821. exports.removeTypeDuplicates = removeTypeDuplicates;
  16822. exports.createTypeAnnotationBasedOnTypeof = createTypeAnnotationBasedOnTypeof;
  16823. var _index = require("./index");
  16824. var t = _interopRequireWildcard(_index);
  16825. 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; } }
  16826. function createUnionTypeAnnotation(types) {
  16827. var flattened = removeTypeDuplicates(types);
  16828. if (flattened.length === 1) {
  16829. return flattened[0];
  16830. } else {
  16831. return t.unionTypeAnnotation(flattened);
  16832. }
  16833. }
  16834. function removeTypeDuplicates(nodes) {
  16835. var generics = {};
  16836. var bases = {};
  16837. var typeGroups = [];
  16838. var types = [];
  16839. for (var i = 0; i < nodes.length; i++) {
  16840. var node = nodes[i];
  16841. if (!node) continue;
  16842. if (types.indexOf(node) >= 0) {
  16843. continue;
  16844. }
  16845. if (t.isAnyTypeAnnotation(node)) {
  16846. return [node];
  16847. }
  16848. if (t.isFlowBaseAnnotation(node)) {
  16849. bases[node.type] = node;
  16850. continue;
  16851. }
  16852. if (t.isUnionTypeAnnotation(node)) {
  16853. if (typeGroups.indexOf(node.types) < 0) {
  16854. nodes = nodes.concat(node.types);
  16855. typeGroups.push(node.types);
  16856. }
  16857. continue;
  16858. }
  16859. if (t.isGenericTypeAnnotation(node)) {
  16860. var name = node.id.name;
  16861. if (generics[name]) {
  16862. var existing = generics[name];
  16863. if (existing.typeParameters) {
  16864. if (node.typeParameters) {
  16865. existing.typeParameters.params = removeTypeDuplicates(existing.typeParameters.params.concat(node.typeParameters.params));
  16866. }
  16867. } else {
  16868. existing = node.typeParameters;
  16869. }
  16870. } else {
  16871. generics[name] = node;
  16872. }
  16873. continue;
  16874. }
  16875. types.push(node);
  16876. }
  16877. for (var type in bases) {
  16878. types.push(bases[type]);
  16879. }
  16880. for (var _name in generics) {
  16881. types.push(generics[_name]);
  16882. }
  16883. return types;
  16884. }
  16885. function createTypeAnnotationBasedOnTypeof(type) {
  16886. if (type === "string") {
  16887. return t.stringTypeAnnotation();
  16888. } else if (type === "number") {
  16889. return t.numberTypeAnnotation();
  16890. } else if (type === "undefined") {
  16891. return t.voidTypeAnnotation();
  16892. } else if (type === "boolean") {
  16893. return t.booleanTypeAnnotation();
  16894. } else if (type === "function") {
  16895. return t.genericTypeAnnotation(t.identifier("Function"));
  16896. } else if (type === "object") {
  16897. return t.genericTypeAnnotation(t.identifier("Object"));
  16898. } else if (type === "symbol") {
  16899. return t.genericTypeAnnotation(t.identifier("Symbol"));
  16900. } else {
  16901. throw new Error("Invalid typeof value");
  16902. }
  16903. }
  16904. },{"./index":151}],151:[function(require,module,exports){
  16905. "use strict";
  16906. exports.__esModule = true;
  16907. 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;
  16908. var _getOwnPropertySymbols = require("babel-runtime/core-js/object/get-own-property-symbols");
  16909. var _getOwnPropertySymbols2 = _interopRequireDefault(_getOwnPropertySymbols);
  16910. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  16911. var _getIterator3 = _interopRequireDefault(_getIterator2);
  16912. var _keys = require("babel-runtime/core-js/object/keys");
  16913. var _keys2 = _interopRequireDefault(_keys);
  16914. var _stringify = require("babel-runtime/core-js/json/stringify");
  16915. var _stringify2 = _interopRequireDefault(_stringify);
  16916. var _constants = require("./constants");
  16917. Object.defineProperty(exports, "STATEMENT_OR_BLOCK_KEYS", {
  16918. enumerable: true,
  16919. get: function get() {
  16920. return _constants.STATEMENT_OR_BLOCK_KEYS;
  16921. }
  16922. });
  16923. Object.defineProperty(exports, "FLATTENABLE_KEYS", {
  16924. enumerable: true,
  16925. get: function get() {
  16926. return _constants.FLATTENABLE_KEYS;
  16927. }
  16928. });
  16929. Object.defineProperty(exports, "FOR_INIT_KEYS", {
  16930. enumerable: true,
  16931. get: function get() {
  16932. return _constants.FOR_INIT_KEYS;
  16933. }
  16934. });
  16935. Object.defineProperty(exports, "COMMENT_KEYS", {
  16936. enumerable: true,
  16937. get: function get() {
  16938. return _constants.COMMENT_KEYS;
  16939. }
  16940. });
  16941. Object.defineProperty(exports, "LOGICAL_OPERATORS", {
  16942. enumerable: true,
  16943. get: function get() {
  16944. return _constants.LOGICAL_OPERATORS;
  16945. }
  16946. });
  16947. Object.defineProperty(exports, "UPDATE_OPERATORS", {
  16948. enumerable: true,
  16949. get: function get() {
  16950. return _constants.UPDATE_OPERATORS;
  16951. }
  16952. });
  16953. Object.defineProperty(exports, "BOOLEAN_NUMBER_BINARY_OPERATORS", {
  16954. enumerable: true,
  16955. get: function get() {
  16956. return _constants.BOOLEAN_NUMBER_BINARY_OPERATORS;
  16957. }
  16958. });
  16959. Object.defineProperty(exports, "EQUALITY_BINARY_OPERATORS", {
  16960. enumerable: true,
  16961. get: function get() {
  16962. return _constants.EQUALITY_BINARY_OPERATORS;
  16963. }
  16964. });
  16965. Object.defineProperty(exports, "COMPARISON_BINARY_OPERATORS", {
  16966. enumerable: true,
  16967. get: function get() {
  16968. return _constants.COMPARISON_BINARY_OPERATORS;
  16969. }
  16970. });
  16971. Object.defineProperty(exports, "BOOLEAN_BINARY_OPERATORS", {
  16972. enumerable: true,
  16973. get: function get() {
  16974. return _constants.BOOLEAN_BINARY_OPERATORS;
  16975. }
  16976. });
  16977. Object.defineProperty(exports, "NUMBER_BINARY_OPERATORS", {
  16978. enumerable: true,
  16979. get: function get() {
  16980. return _constants.NUMBER_BINARY_OPERATORS;
  16981. }
  16982. });
  16983. Object.defineProperty(exports, "BINARY_OPERATORS", {
  16984. enumerable: true,
  16985. get: function get() {
  16986. return _constants.BINARY_OPERATORS;
  16987. }
  16988. });
  16989. Object.defineProperty(exports, "BOOLEAN_UNARY_OPERATORS", {
  16990. enumerable: true,
  16991. get: function get() {
  16992. return _constants.BOOLEAN_UNARY_OPERATORS;
  16993. }
  16994. });
  16995. Object.defineProperty(exports, "NUMBER_UNARY_OPERATORS", {
  16996. enumerable: true,
  16997. get: function get() {
  16998. return _constants.NUMBER_UNARY_OPERATORS;
  16999. }
  17000. });
  17001. Object.defineProperty(exports, "STRING_UNARY_OPERATORS", {
  17002. enumerable: true,
  17003. get: function get() {
  17004. return _constants.STRING_UNARY_OPERATORS;
  17005. }
  17006. });
  17007. Object.defineProperty(exports, "UNARY_OPERATORS", {
  17008. enumerable: true,
  17009. get: function get() {
  17010. return _constants.UNARY_OPERATORS;
  17011. }
  17012. });
  17013. Object.defineProperty(exports, "INHERIT_KEYS", {
  17014. enumerable: true,
  17015. get: function get() {
  17016. return _constants.INHERIT_KEYS;
  17017. }
  17018. });
  17019. Object.defineProperty(exports, "BLOCK_SCOPED_SYMBOL", {
  17020. enumerable: true,
  17021. get: function get() {
  17022. return _constants.BLOCK_SCOPED_SYMBOL;
  17023. }
  17024. });
  17025. Object.defineProperty(exports, "NOT_LOCAL_BINDING", {
  17026. enumerable: true,
  17027. get: function get() {
  17028. return _constants.NOT_LOCAL_BINDING;
  17029. }
  17030. });
  17031. exports.is = is;
  17032. exports.isType = isType;
  17033. exports.validate = validate;
  17034. exports.shallowEqual = shallowEqual;
  17035. exports.appendToMemberExpression = appendToMemberExpression;
  17036. exports.prependToMemberExpression = prependToMemberExpression;
  17037. exports.ensureBlock = ensureBlock;
  17038. exports.clone = clone;
  17039. exports.cloneWithoutLoc = cloneWithoutLoc;
  17040. exports.cloneDeep = cloneDeep;
  17041. exports.buildMatchMemberExpression = buildMatchMemberExpression;
  17042. exports.removeComments = removeComments;
  17043. exports.inheritsComments = inheritsComments;
  17044. exports.inheritTrailingComments = inheritTrailingComments;
  17045. exports.inheritLeadingComments = inheritLeadingComments;
  17046. exports.inheritInnerComments = inheritInnerComments;
  17047. exports.inherits = inherits;
  17048. exports.assertNode = assertNode;
  17049. exports.isNode = isNode;
  17050. exports.traverseFast = traverseFast;
  17051. exports.removeProperties = removeProperties;
  17052. exports.removePropertiesDeep = removePropertiesDeep;
  17053. var _retrievers = require("./retrievers");
  17054. Object.defineProperty(exports, "getBindingIdentifiers", {
  17055. enumerable: true,
  17056. get: function get() {
  17057. return _retrievers.getBindingIdentifiers;
  17058. }
  17059. });
  17060. Object.defineProperty(exports, "getOuterBindingIdentifiers", {
  17061. enumerable: true,
  17062. get: function get() {
  17063. return _retrievers.getOuterBindingIdentifiers;
  17064. }
  17065. });
  17066. var _validators = require("./validators");
  17067. Object.defineProperty(exports, "isBinding", {
  17068. enumerable: true,
  17069. get: function get() {
  17070. return _validators.isBinding;
  17071. }
  17072. });
  17073. Object.defineProperty(exports, "isReferenced", {
  17074. enumerable: true,
  17075. get: function get() {
  17076. return _validators.isReferenced;
  17077. }
  17078. });
  17079. Object.defineProperty(exports, "isValidIdentifier", {
  17080. enumerable: true,
  17081. get: function get() {
  17082. return _validators.isValidIdentifier;
  17083. }
  17084. });
  17085. Object.defineProperty(exports, "isLet", {
  17086. enumerable: true,
  17087. get: function get() {
  17088. return _validators.isLet;
  17089. }
  17090. });
  17091. Object.defineProperty(exports, "isBlockScoped", {
  17092. enumerable: true,
  17093. get: function get() {
  17094. return _validators.isBlockScoped;
  17095. }
  17096. });
  17097. Object.defineProperty(exports, "isVar", {
  17098. enumerable: true,
  17099. get: function get() {
  17100. return _validators.isVar;
  17101. }
  17102. });
  17103. Object.defineProperty(exports, "isSpecifierDefault", {
  17104. enumerable: true,
  17105. get: function get() {
  17106. return _validators.isSpecifierDefault;
  17107. }
  17108. });
  17109. Object.defineProperty(exports, "isScope", {
  17110. enumerable: true,
  17111. get: function get() {
  17112. return _validators.isScope;
  17113. }
  17114. });
  17115. Object.defineProperty(exports, "isImmutable", {
  17116. enumerable: true,
  17117. get: function get() {
  17118. return _validators.isImmutable;
  17119. }
  17120. });
  17121. Object.defineProperty(exports, "isNodesEquivalent", {
  17122. enumerable: true,
  17123. get: function get() {
  17124. return _validators.isNodesEquivalent;
  17125. }
  17126. });
  17127. var _converters = require("./converters");
  17128. Object.defineProperty(exports, "toComputedKey", {
  17129. enumerable: true,
  17130. get: function get() {
  17131. return _converters.toComputedKey;
  17132. }
  17133. });
  17134. Object.defineProperty(exports, "toSequenceExpression", {
  17135. enumerable: true,
  17136. get: function get() {
  17137. return _converters.toSequenceExpression;
  17138. }
  17139. });
  17140. Object.defineProperty(exports, "toKeyAlias", {
  17141. enumerable: true,
  17142. get: function get() {
  17143. return _converters.toKeyAlias;
  17144. }
  17145. });
  17146. Object.defineProperty(exports, "toIdentifier", {
  17147. enumerable: true,
  17148. get: function get() {
  17149. return _converters.toIdentifier;
  17150. }
  17151. });
  17152. Object.defineProperty(exports, "toBindingIdentifierName", {
  17153. enumerable: true,
  17154. get: function get() {
  17155. return _converters.toBindingIdentifierName;
  17156. }
  17157. });
  17158. Object.defineProperty(exports, "toStatement", {
  17159. enumerable: true,
  17160. get: function get() {
  17161. return _converters.toStatement;
  17162. }
  17163. });
  17164. Object.defineProperty(exports, "toExpression", {
  17165. enumerable: true,
  17166. get: function get() {
  17167. return _converters.toExpression;
  17168. }
  17169. });
  17170. Object.defineProperty(exports, "toBlock", {
  17171. enumerable: true,
  17172. get: function get() {
  17173. return _converters.toBlock;
  17174. }
  17175. });
  17176. Object.defineProperty(exports, "valueToNode", {
  17177. enumerable: true,
  17178. get: function get() {
  17179. return _converters.valueToNode;
  17180. }
  17181. });
  17182. var _flow = require("./flow");
  17183. Object.defineProperty(exports, "createUnionTypeAnnotation", {
  17184. enumerable: true,
  17185. get: function get() {
  17186. return _flow.createUnionTypeAnnotation;
  17187. }
  17188. });
  17189. Object.defineProperty(exports, "removeTypeDuplicates", {
  17190. enumerable: true,
  17191. get: function get() {
  17192. return _flow.removeTypeDuplicates;
  17193. }
  17194. });
  17195. Object.defineProperty(exports, "createTypeAnnotationBasedOnTypeof", {
  17196. enumerable: true,
  17197. get: function get() {
  17198. return _flow.createTypeAnnotationBasedOnTypeof;
  17199. }
  17200. });
  17201. var _toFastProperties = require("to-fast-properties");
  17202. var _toFastProperties2 = _interopRequireDefault(_toFastProperties);
  17203. var _clone = require("lodash/clone");
  17204. var _clone2 = _interopRequireDefault(_clone);
  17205. var _uniq = require("lodash/uniq");
  17206. var _uniq2 = _interopRequireDefault(_uniq);
  17207. require("./definitions/init");
  17208. var _definitions = require("./definitions");
  17209. var _react2 = require("./react");
  17210. var _react = _interopRequireWildcard(_react2);
  17211. 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; } }
  17212. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17213. var t = exports;
  17214. function registerType(type) {
  17215. var is = t["is" + type];
  17216. if (!is) {
  17217. is = t["is" + type] = function (node, opts) {
  17218. return t.is(type, node, opts);
  17219. };
  17220. }
  17221. t["assert" + type] = function (node, opts) {
  17222. opts = opts || {};
  17223. if (!is(node, opts)) {
  17224. throw new Error("Expected type " + (0, _stringify2.default)(type) + " with option " + (0, _stringify2.default)(opts));
  17225. }
  17226. };
  17227. }
  17228. exports.VISITOR_KEYS = _definitions.VISITOR_KEYS;
  17229. exports.ALIAS_KEYS = _definitions.ALIAS_KEYS;
  17230. exports.NODE_FIELDS = _definitions.NODE_FIELDS;
  17231. exports.BUILDER_KEYS = _definitions.BUILDER_KEYS;
  17232. exports.DEPRECATED_KEYS = _definitions.DEPRECATED_KEYS;
  17233. exports.react = _react;
  17234. for (var type in t.VISITOR_KEYS) {
  17235. registerType(type);
  17236. }
  17237. t.FLIPPED_ALIAS_KEYS = {};
  17238. (0, _keys2.default)(t.ALIAS_KEYS).forEach(function (type) {
  17239. t.ALIAS_KEYS[type].forEach(function (alias) {
  17240. var types = t.FLIPPED_ALIAS_KEYS[alias] = t.FLIPPED_ALIAS_KEYS[alias] || [];
  17241. types.push(type);
  17242. });
  17243. });
  17244. (0, _keys2.default)(t.FLIPPED_ALIAS_KEYS).forEach(function (type) {
  17245. t[type.toUpperCase() + "_TYPES"] = t.FLIPPED_ALIAS_KEYS[type];
  17246. registerType(type);
  17247. });
  17248. 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));
  17249. function is(type, node, opts) {
  17250. if (!node) return false;
  17251. var matches = isType(node.type, type);
  17252. if (!matches) return false;
  17253. if (typeof opts === "undefined") {
  17254. return true;
  17255. } else {
  17256. return t.shallowEqual(node, opts);
  17257. }
  17258. }
  17259. function isType(nodeType, targetType) {
  17260. if (nodeType === targetType) return true;
  17261. if (t.ALIAS_KEYS[targetType]) return false;
  17262. var aliases = t.FLIPPED_ALIAS_KEYS[targetType];
  17263. if (aliases) {
  17264. if (aliases[0] === nodeType) return true;
  17265. for (var _iterator = aliases, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  17266. var _ref;
  17267. if (_isArray) {
  17268. if (_i >= _iterator.length) break;
  17269. _ref = _iterator[_i++];
  17270. } else {
  17271. _i = _iterator.next();
  17272. if (_i.done) break;
  17273. _ref = _i.value;
  17274. }
  17275. var alias = _ref;
  17276. if (nodeType === alias) return true;
  17277. }
  17278. }
  17279. return false;
  17280. }
  17281. (0, _keys2.default)(t.BUILDER_KEYS).forEach(function (type) {
  17282. var keys = t.BUILDER_KEYS[type];
  17283. function builder() {
  17284. if (arguments.length > keys.length) {
  17285. throw new Error("t." + type + ": Too many arguments passed. Received " + arguments.length + " but can receive " + ("no more than " + keys.length));
  17286. }
  17287. var node = {};
  17288. node.type = type;
  17289. var i = 0;
  17290. for (var _iterator2 = keys, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  17291. var _ref2;
  17292. if (_isArray2) {
  17293. if (_i2 >= _iterator2.length) break;
  17294. _ref2 = _iterator2[_i2++];
  17295. } else {
  17296. _i2 = _iterator2.next();
  17297. if (_i2.done) break;
  17298. _ref2 = _i2.value;
  17299. }
  17300. var _key = _ref2;
  17301. var field = t.NODE_FIELDS[type][_key];
  17302. var arg = arguments[i++];
  17303. if (arg === undefined) arg = (0, _clone2.default)(field.default);
  17304. node[_key] = arg;
  17305. }
  17306. for (var key in node) {
  17307. validate(node, key, node[key]);
  17308. }
  17309. return node;
  17310. }
  17311. t[type] = builder;
  17312. t[type[0].toLowerCase() + type.slice(1)] = builder;
  17313. });
  17314. var _loop = function _loop(_type) {
  17315. var newType = t.DEPRECATED_KEYS[_type];
  17316. function proxy(fn) {
  17317. return function () {
  17318. console.trace("The node type " + _type + " has been renamed to " + newType);
  17319. return fn.apply(this, arguments);
  17320. };
  17321. }
  17322. t[_type] = t[_type[0].toLowerCase() + _type.slice(1)] = proxy(t[newType]);
  17323. t["is" + _type] = proxy(t["is" + newType]);
  17324. t["assert" + _type] = proxy(t["assert" + newType]);
  17325. };
  17326. for (var _type in t.DEPRECATED_KEYS) {
  17327. _loop(_type);
  17328. }
  17329. function validate(node, key, val) {
  17330. if (!node) return;
  17331. var fields = t.NODE_FIELDS[node.type];
  17332. if (!fields) return;
  17333. var field = fields[key];
  17334. if (!field || !field.validate) return;
  17335. if (field.optional && val == null) return;
  17336. field.validate(node, key, val);
  17337. }
  17338. function shallowEqual(actual, expected) {
  17339. var keys = (0, _keys2.default)(expected);
  17340. for (var _iterator3 = keys, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : (0, _getIterator3.default)(_iterator3);;) {
  17341. var _ref3;
  17342. if (_isArray3) {
  17343. if (_i3 >= _iterator3.length) break;
  17344. _ref3 = _iterator3[_i3++];
  17345. } else {
  17346. _i3 = _iterator3.next();
  17347. if (_i3.done) break;
  17348. _ref3 = _i3.value;
  17349. }
  17350. var key = _ref3;
  17351. if (actual[key] !== expected[key]) {
  17352. return false;
  17353. }
  17354. }
  17355. return true;
  17356. }
  17357. function appendToMemberExpression(member, append, computed) {
  17358. member.object = t.memberExpression(member.object, member.property, member.computed);
  17359. member.property = append;
  17360. member.computed = !!computed;
  17361. return member;
  17362. }
  17363. function prependToMemberExpression(member, prepend) {
  17364. member.object = t.memberExpression(prepend, member.object);
  17365. return member;
  17366. }
  17367. function ensureBlock(node) {
  17368. var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "body";
  17369. return node[key] = t.toBlock(node[key], node);
  17370. }
  17371. function clone(node) {
  17372. if (!node) return node;
  17373. var newNode = {};
  17374. for (var key in node) {
  17375. if (key[0] === "_") continue;
  17376. newNode[key] = node[key];
  17377. }
  17378. return newNode;
  17379. }
  17380. function cloneWithoutLoc(node) {
  17381. var newNode = clone(node);
  17382. delete newNode.loc;
  17383. return newNode;
  17384. }
  17385. function cloneDeep(node) {
  17386. if (!node) return node;
  17387. var newNode = {};
  17388. for (var key in node) {
  17389. if (key[0] === "_") continue;
  17390. var val = node[key];
  17391. if (val) {
  17392. if (val.type) {
  17393. val = t.cloneDeep(val);
  17394. } else if (Array.isArray(val)) {
  17395. val = val.map(t.cloneDeep);
  17396. }
  17397. }
  17398. newNode[key] = val;
  17399. }
  17400. return newNode;
  17401. }
  17402. function buildMatchMemberExpression(match, allowPartial) {
  17403. var parts = match.split(".");
  17404. return function (member) {
  17405. if (!t.isMemberExpression(member)) return false;
  17406. var search = [member];
  17407. var i = 0;
  17408. while (search.length) {
  17409. var node = search.shift();
  17410. if (allowPartial && i === parts.length) {
  17411. return true;
  17412. }
  17413. if (t.isIdentifier(node)) {
  17414. if (parts[i] !== node.name) return false;
  17415. } else if (t.isStringLiteral(node)) {
  17416. if (parts[i] !== node.value) return false;
  17417. } else if (t.isMemberExpression(node)) {
  17418. if (node.computed && !t.isStringLiteral(node.property)) {
  17419. return false;
  17420. } else {
  17421. search.push(node.object);
  17422. search.push(node.property);
  17423. continue;
  17424. }
  17425. } else {
  17426. return false;
  17427. }
  17428. if (++i > parts.length) {
  17429. return false;
  17430. }
  17431. }
  17432. return true;
  17433. };
  17434. }
  17435. function removeComments(node) {
  17436. for (var _iterator4 = t.COMMENT_KEYS, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : (0, _getIterator3.default)(_iterator4);;) {
  17437. var _ref4;
  17438. if (_isArray4) {
  17439. if (_i4 >= _iterator4.length) break;
  17440. _ref4 = _iterator4[_i4++];
  17441. } else {
  17442. _i4 = _iterator4.next();
  17443. if (_i4.done) break;
  17444. _ref4 = _i4.value;
  17445. }
  17446. var key = _ref4;
  17447. delete node[key];
  17448. }
  17449. return node;
  17450. }
  17451. function inheritsComments(child, parent) {
  17452. inheritTrailingComments(child, parent);
  17453. inheritLeadingComments(child, parent);
  17454. inheritInnerComments(child, parent);
  17455. return child;
  17456. }
  17457. function inheritTrailingComments(child, parent) {
  17458. _inheritComments("trailingComments", child, parent);
  17459. }
  17460. function inheritLeadingComments(child, parent) {
  17461. _inheritComments("leadingComments", child, parent);
  17462. }
  17463. function inheritInnerComments(child, parent) {
  17464. _inheritComments("innerComments", child, parent);
  17465. }
  17466. function _inheritComments(key, child, parent) {
  17467. if (child && parent) {
  17468. child[key] = (0, _uniq2.default)([].concat(child[key], parent[key]).filter(Boolean));
  17469. }
  17470. }
  17471. function inherits(child, parent) {
  17472. if (!child || !parent) return child;
  17473. for (var _iterator5 = t.INHERIT_KEYS.optional, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : (0, _getIterator3.default)(_iterator5);;) {
  17474. var _ref5;
  17475. if (_isArray5) {
  17476. if (_i5 >= _iterator5.length) break;
  17477. _ref5 = _iterator5[_i5++];
  17478. } else {
  17479. _i5 = _iterator5.next();
  17480. if (_i5.done) break;
  17481. _ref5 = _i5.value;
  17482. }
  17483. var _key2 = _ref5;
  17484. if (child[_key2] == null) {
  17485. child[_key2] = parent[_key2];
  17486. }
  17487. }
  17488. for (var key in parent) {
  17489. if (key[0] === "_") child[key] = parent[key];
  17490. }
  17491. for (var _iterator6 = t.INHERIT_KEYS.force, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : (0, _getIterator3.default)(_iterator6);;) {
  17492. var _ref6;
  17493. if (_isArray6) {
  17494. if (_i6 >= _iterator6.length) break;
  17495. _ref6 = _iterator6[_i6++];
  17496. } else {
  17497. _i6 = _iterator6.next();
  17498. if (_i6.done) break;
  17499. _ref6 = _i6.value;
  17500. }
  17501. var _key3 = _ref6;
  17502. child[_key3] = parent[_key3];
  17503. }
  17504. t.inheritsComments(child, parent);
  17505. return child;
  17506. }
  17507. function assertNode(node) {
  17508. if (!isNode(node)) {
  17509. throw new TypeError("Not a valid node " + (node && node.type));
  17510. }
  17511. }
  17512. function isNode(node) {
  17513. return !!(node && _definitions.VISITOR_KEYS[node.type]);
  17514. }
  17515. (0, _toFastProperties2.default)(t);
  17516. (0, _toFastProperties2.default)(t.VISITOR_KEYS);
  17517. function traverseFast(node, enter, opts) {
  17518. if (!node) return;
  17519. var keys = t.VISITOR_KEYS[node.type];
  17520. if (!keys) return;
  17521. opts = opts || {};
  17522. enter(node, opts);
  17523. for (var _iterator7 = keys, _isArray7 = Array.isArray(_iterator7), _i7 = 0, _iterator7 = _isArray7 ? _iterator7 : (0, _getIterator3.default)(_iterator7);;) {
  17524. var _ref7;
  17525. if (_isArray7) {
  17526. if (_i7 >= _iterator7.length) break;
  17527. _ref7 = _iterator7[_i7++];
  17528. } else {
  17529. _i7 = _iterator7.next();
  17530. if (_i7.done) break;
  17531. _ref7 = _i7.value;
  17532. }
  17533. var key = _ref7;
  17534. var subNode = node[key];
  17535. if (Array.isArray(subNode)) {
  17536. for (var _iterator8 = subNode, _isArray8 = Array.isArray(_iterator8), _i8 = 0, _iterator8 = _isArray8 ? _iterator8 : (0, _getIterator3.default)(_iterator8);;) {
  17537. var _ref8;
  17538. if (_isArray8) {
  17539. if (_i8 >= _iterator8.length) break;
  17540. _ref8 = _iterator8[_i8++];
  17541. } else {
  17542. _i8 = _iterator8.next();
  17543. if (_i8.done) break;
  17544. _ref8 = _i8.value;
  17545. }
  17546. var _node = _ref8;
  17547. traverseFast(_node, enter, opts);
  17548. }
  17549. } else {
  17550. traverseFast(subNode, enter, opts);
  17551. }
  17552. }
  17553. }
  17554. var CLEAR_KEYS = ["tokens", "start", "end", "loc", "raw", "rawValue"];
  17555. var CLEAR_KEYS_PLUS_COMMENTS = t.COMMENT_KEYS.concat(["comments"]).concat(CLEAR_KEYS);
  17556. function removeProperties(node, opts) {
  17557. opts = opts || {};
  17558. var map = opts.preserveComments ? CLEAR_KEYS : CLEAR_KEYS_PLUS_COMMENTS;
  17559. for (var _iterator9 = map, _isArray9 = Array.isArray(_iterator9), _i9 = 0, _iterator9 = _isArray9 ? _iterator9 : (0, _getIterator3.default)(_iterator9);;) {
  17560. var _ref9;
  17561. if (_isArray9) {
  17562. if (_i9 >= _iterator9.length) break;
  17563. _ref9 = _iterator9[_i9++];
  17564. } else {
  17565. _i9 = _iterator9.next();
  17566. if (_i9.done) break;
  17567. _ref9 = _i9.value;
  17568. }
  17569. var _key4 = _ref9;
  17570. if (node[_key4] != null) node[_key4] = undefined;
  17571. }
  17572. for (var key in node) {
  17573. if (key[0] === "_" && node[key] != null) node[key] = undefined;
  17574. }
  17575. var syms = (0, _getOwnPropertySymbols2.default)(node);
  17576. for (var _iterator10 = syms, _isArray10 = Array.isArray(_iterator10), _i10 = 0, _iterator10 = _isArray10 ? _iterator10 : (0, _getIterator3.default)(_iterator10);;) {
  17577. var _ref10;
  17578. if (_isArray10) {
  17579. if (_i10 >= _iterator10.length) break;
  17580. _ref10 = _iterator10[_i10++];
  17581. } else {
  17582. _i10 = _iterator10.next();
  17583. if (_i10.done) break;
  17584. _ref10 = _i10.value;
  17585. }
  17586. var sym = _ref10;
  17587. node[sym] = null;
  17588. }
  17589. }
  17590. function removePropertiesDeep(tree, opts) {
  17591. traverseFast(tree, removeProperties, opts);
  17592. return tree;
  17593. }
  17594. },{"./constants":140,"./converters":141,"./definitions":146,"./definitions/init":147,"./flow":150,"./react":152,"./retrievers":153,"./validators":154,"babel-runtime/core-js/get-iterator":95,"babel-runtime/core-js/json/stringify":96,"babel-runtime/core-js/object/get-own-property-symbols":101,"babel-runtime/core-js/object/keys":102,"lodash/clone":466,"lodash/uniq":517,"to-fast-properties":555}],152:[function(require,module,exports){
  17595. "use strict";
  17596. exports.__esModule = true;
  17597. exports.isReactComponent = undefined;
  17598. exports.isCompatTag = isCompatTag;
  17599. exports.buildChildren = buildChildren;
  17600. var _index = require("./index");
  17601. var t = _interopRequireWildcard(_index);
  17602. 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; } }
  17603. var isReactComponent = exports.isReactComponent = t.buildMatchMemberExpression("React.Component");
  17604. function isCompatTag(tagName) {
  17605. return !!tagName && /^[a-z]|\-/.test(tagName);
  17606. }
  17607. function cleanJSXElementLiteralChild(child, args) {
  17608. var lines = child.value.split(/\r\n|\n|\r/);
  17609. var lastNonEmptyLine = 0;
  17610. for (var i = 0; i < lines.length; i++) {
  17611. if (lines[i].match(/[^ \t]/)) {
  17612. lastNonEmptyLine = i;
  17613. }
  17614. }
  17615. var str = "";
  17616. for (var _i = 0; _i < lines.length; _i++) {
  17617. var line = lines[_i];
  17618. var isFirstLine = _i === 0;
  17619. var isLastLine = _i === lines.length - 1;
  17620. var isLastNonEmptyLine = _i === lastNonEmptyLine;
  17621. var trimmedLine = line.replace(/\t/g, " ");
  17622. if (!isFirstLine) {
  17623. trimmedLine = trimmedLine.replace(/^[ ]+/, "");
  17624. }
  17625. if (!isLastLine) {
  17626. trimmedLine = trimmedLine.replace(/[ ]+$/, "");
  17627. }
  17628. if (trimmedLine) {
  17629. if (!isLastNonEmptyLine) {
  17630. trimmedLine += " ";
  17631. }
  17632. str += trimmedLine;
  17633. }
  17634. }
  17635. if (str) args.push(t.stringLiteral(str));
  17636. }
  17637. function buildChildren(node) {
  17638. var elems = [];
  17639. for (var i = 0; i < node.children.length; i++) {
  17640. var child = node.children[i];
  17641. if (t.isJSXText(child)) {
  17642. cleanJSXElementLiteralChild(child, elems);
  17643. continue;
  17644. }
  17645. if (t.isJSXExpressionContainer(child)) child = child.expression;
  17646. if (t.isJSXEmptyExpression(child)) continue;
  17647. elems.push(child);
  17648. }
  17649. return elems;
  17650. }
  17651. },{"./index":151}],153:[function(require,module,exports){
  17652. "use strict";
  17653. exports.__esModule = true;
  17654. var _create = require("babel-runtime/core-js/object/create");
  17655. var _create2 = _interopRequireDefault(_create);
  17656. exports.getBindingIdentifiers = getBindingIdentifiers;
  17657. exports.getOuterBindingIdentifiers = getOuterBindingIdentifiers;
  17658. var _index = require("./index");
  17659. var t = _interopRequireWildcard(_index);
  17660. 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; } }
  17661. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17662. function getBindingIdentifiers(node, duplicates, outerOnly) {
  17663. var search = [].concat(node);
  17664. var ids = (0, _create2.default)(null);
  17665. while (search.length) {
  17666. var id = search.shift();
  17667. if (!id) continue;
  17668. var keys = t.getBindingIdentifiers.keys[id.type];
  17669. if (t.isIdentifier(id)) {
  17670. if (duplicates) {
  17671. var _ids = ids[id.name] = ids[id.name] || [];
  17672. _ids.push(id);
  17673. } else {
  17674. ids[id.name] = id;
  17675. }
  17676. continue;
  17677. }
  17678. if (t.isExportDeclaration(id)) {
  17679. if (t.isDeclaration(id.declaration)) {
  17680. search.push(id.declaration);
  17681. }
  17682. continue;
  17683. }
  17684. if (outerOnly) {
  17685. if (t.isFunctionDeclaration(id)) {
  17686. search.push(id.id);
  17687. continue;
  17688. }
  17689. if (t.isFunctionExpression(id)) {
  17690. continue;
  17691. }
  17692. }
  17693. if (keys) {
  17694. for (var i = 0; i < keys.length; i++) {
  17695. var key = keys[i];
  17696. if (id[key]) {
  17697. search = search.concat(id[key]);
  17698. }
  17699. }
  17700. }
  17701. }
  17702. return ids;
  17703. }
  17704. getBindingIdentifiers.keys = {
  17705. DeclareClass: ["id"],
  17706. DeclareFunction: ["id"],
  17707. DeclareModule: ["id"],
  17708. DeclareVariable: ["id"],
  17709. InterfaceDeclaration: ["id"],
  17710. TypeAlias: ["id"],
  17711. OpaqueType: ["id"],
  17712. CatchClause: ["param"],
  17713. LabeledStatement: ["label"],
  17714. UnaryExpression: ["argument"],
  17715. AssignmentExpression: ["left"],
  17716. ImportSpecifier: ["local"],
  17717. ImportNamespaceSpecifier: ["local"],
  17718. ImportDefaultSpecifier: ["local"],
  17719. ImportDeclaration: ["specifiers"],
  17720. ExportSpecifier: ["exported"],
  17721. ExportNamespaceSpecifier: ["exported"],
  17722. ExportDefaultSpecifier: ["exported"],
  17723. FunctionDeclaration: ["id", "params"],
  17724. FunctionExpression: ["id", "params"],
  17725. ClassDeclaration: ["id"],
  17726. ClassExpression: ["id"],
  17727. RestElement: ["argument"],
  17728. UpdateExpression: ["argument"],
  17729. RestProperty: ["argument"],
  17730. ObjectProperty: ["value"],
  17731. AssignmentPattern: ["left"],
  17732. ArrayPattern: ["elements"],
  17733. ObjectPattern: ["properties"],
  17734. VariableDeclaration: ["declarations"],
  17735. VariableDeclarator: ["id"]
  17736. };
  17737. function getOuterBindingIdentifiers(node, duplicates) {
  17738. return getBindingIdentifiers(node, duplicates, true);
  17739. }
  17740. },{"./index":151,"babel-runtime/core-js/object/create":100}],154:[function(require,module,exports){
  17741. "use strict";
  17742. exports.__esModule = true;
  17743. var _keys = require("babel-runtime/core-js/object/keys");
  17744. var _keys2 = _interopRequireDefault(_keys);
  17745. var _typeof2 = require("babel-runtime/helpers/typeof");
  17746. var _typeof3 = _interopRequireDefault(_typeof2);
  17747. var _getIterator2 = require("babel-runtime/core-js/get-iterator");
  17748. var _getIterator3 = _interopRequireDefault(_getIterator2);
  17749. exports.isBinding = isBinding;
  17750. exports.isReferenced = isReferenced;
  17751. exports.isValidIdentifier = isValidIdentifier;
  17752. exports.isLet = isLet;
  17753. exports.isBlockScoped = isBlockScoped;
  17754. exports.isVar = isVar;
  17755. exports.isSpecifierDefault = isSpecifierDefault;
  17756. exports.isScope = isScope;
  17757. exports.isImmutable = isImmutable;
  17758. exports.isNodesEquivalent = isNodesEquivalent;
  17759. var _retrievers = require("./retrievers");
  17760. var _esutils = require("esutils");
  17761. var _esutils2 = _interopRequireDefault(_esutils);
  17762. var _index = require("./index");
  17763. var t = _interopRequireWildcard(_index);
  17764. var _constants = require("./constants");
  17765. 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; } }
  17766. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17767. function isBinding(node, parent) {
  17768. var keys = _retrievers.getBindingIdentifiers.keys[parent.type];
  17769. if (keys) {
  17770. for (var i = 0; i < keys.length; i++) {
  17771. var key = keys[i];
  17772. var val = parent[key];
  17773. if (Array.isArray(val)) {
  17774. if (val.indexOf(node) >= 0) return true;
  17775. } else {
  17776. if (val === node) return true;
  17777. }
  17778. }
  17779. }
  17780. return false;
  17781. }
  17782. function isReferenced(node, parent) {
  17783. switch (parent.type) {
  17784. case "BindExpression":
  17785. return parent.object === node || parent.callee === node;
  17786. case "MemberExpression":
  17787. case "JSXMemberExpression":
  17788. if (parent.property === node && parent.computed) {
  17789. return true;
  17790. } else if (parent.object === node) {
  17791. return true;
  17792. } else {
  17793. return false;
  17794. }
  17795. case "MetaProperty":
  17796. return false;
  17797. case "ObjectProperty":
  17798. if (parent.key === node) {
  17799. return parent.computed;
  17800. }
  17801. case "VariableDeclarator":
  17802. return parent.id !== node;
  17803. case "ArrowFunctionExpression":
  17804. case "FunctionDeclaration":
  17805. case "FunctionExpression":
  17806. for (var _iterator = parent.params, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : (0, _getIterator3.default)(_iterator);;) {
  17807. var _ref;
  17808. if (_isArray) {
  17809. if (_i >= _iterator.length) break;
  17810. _ref = _iterator[_i++];
  17811. } else {
  17812. _i = _iterator.next();
  17813. if (_i.done) break;
  17814. _ref = _i.value;
  17815. }
  17816. var param = _ref;
  17817. if (param === node) return false;
  17818. }
  17819. return parent.id !== node;
  17820. case "ExportSpecifier":
  17821. if (parent.source) {
  17822. return false;
  17823. } else {
  17824. return parent.local === node;
  17825. }
  17826. case "ExportNamespaceSpecifier":
  17827. case "ExportDefaultSpecifier":
  17828. return false;
  17829. case "JSXAttribute":
  17830. return parent.name !== node;
  17831. case "ClassProperty":
  17832. if (parent.key === node) {
  17833. return parent.computed;
  17834. } else {
  17835. return parent.value === node;
  17836. }
  17837. case "ImportDefaultSpecifier":
  17838. case "ImportNamespaceSpecifier":
  17839. case "ImportSpecifier":
  17840. return false;
  17841. case "ClassDeclaration":
  17842. case "ClassExpression":
  17843. return parent.id !== node;
  17844. case "ClassMethod":
  17845. case "ObjectMethod":
  17846. return parent.key === node && parent.computed;
  17847. case "LabeledStatement":
  17848. return false;
  17849. case "CatchClause":
  17850. return parent.param !== node;
  17851. case "RestElement":
  17852. return false;
  17853. case "AssignmentExpression":
  17854. return parent.right === node;
  17855. case "AssignmentPattern":
  17856. return parent.right === node;
  17857. case "ObjectPattern":
  17858. case "ArrayPattern":
  17859. return false;
  17860. }
  17861. return true;
  17862. }
  17863. function isValidIdentifier(name) {
  17864. if (typeof name !== "string" || _esutils2.default.keyword.isReservedWordES6(name, true)) {
  17865. return false;
  17866. } else if (name === "await") {
  17867. return false;
  17868. } else {
  17869. return _esutils2.default.keyword.isIdentifierNameES6(name);
  17870. }
  17871. }
  17872. function isLet(node) {
  17873. return t.isVariableDeclaration(node) && (node.kind !== "var" || node[_constants.BLOCK_SCOPED_SYMBOL]);
  17874. }
  17875. function isBlockScoped(node) {
  17876. return t.isFunctionDeclaration(node) || t.isClassDeclaration(node) || t.isLet(node);
  17877. }
  17878. function isVar(node) {
  17879. return t.isVariableDeclaration(node, { kind: "var" }) && !node[_constants.BLOCK_SCOPED_SYMBOL];
  17880. }
  17881. function isSpecifierDefault(specifier) {
  17882. return t.isImportDefaultSpecifier(specifier) || t.isIdentifier(specifier.imported || specifier.exported, { name: "default" });
  17883. }
  17884. function isScope(node, parent) {
  17885. if (t.isBlockStatement(node) && t.isFunction(parent, { body: node })) {
  17886. return false;
  17887. }
  17888. return t.isScopable(node);
  17889. }
  17890. function isImmutable(node) {
  17891. if (t.isType(node.type, "Immutable")) return true;
  17892. if (t.isIdentifier(node)) {
  17893. if (node.name === "undefined") {
  17894. return true;
  17895. } else {
  17896. return false;
  17897. }
  17898. }
  17899. return false;
  17900. }
  17901. function isNodesEquivalent(a, b) {
  17902. if ((typeof a === "undefined" ? "undefined" : (0, _typeof3.default)(a)) !== "object" || (typeof a === "undefined" ? "undefined" : (0, _typeof3.default)(a)) !== "object" || a == null || b == null) {
  17903. return a === b;
  17904. }
  17905. if (a.type !== b.type) {
  17906. return false;
  17907. }
  17908. var fields = (0, _keys2.default)(t.NODE_FIELDS[a.type] || a.type);
  17909. for (var _iterator2 = fields, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : (0, _getIterator3.default)(_iterator2);;) {
  17910. var _ref2;
  17911. if (_isArray2) {
  17912. if (_i2 >= _iterator2.length) break;
  17913. _ref2 = _iterator2[_i2++];
  17914. } else {
  17915. _i2 = _iterator2.next();
  17916. if (_i2.done) break;
  17917. _ref2 = _i2.value;
  17918. }
  17919. var field = _ref2;
  17920. if ((0, _typeof3.default)(a[field]) !== (0, _typeof3.default)(b[field])) {
  17921. return false;
  17922. }
  17923. if (Array.isArray(a[field])) {
  17924. if (!Array.isArray(b[field])) {
  17925. return false;
  17926. }
  17927. if (a[field].length !== b[field].length) {
  17928. return false;
  17929. }
  17930. for (var i = 0; i < a[field].length; i++) {
  17931. if (!isNodesEquivalent(a[field][i], b[field][i])) {
  17932. return false;
  17933. }
  17934. }
  17935. continue;
  17936. }
  17937. if (!isNodesEquivalent(a[field], b[field])) {
  17938. return false;
  17939. }
  17940. }
  17941. return true;
  17942. }
  17943. },{"./constants":140,"./index":151,"./retrievers":153,"babel-runtime/core-js/get-iterator":95,"babel-runtime/core-js/object/keys":102,"babel-runtime/helpers/typeof":113,"esutils":287}],155:[function(require,module,exports){
  17944. 'use strict';
  17945. Object.defineProperty(exports, '__esModule', { value: true });
  17946. /* eslint max-len: 0 */
  17947. // This is a trick taken from Esprima. It turns out that, on
  17948. // non-Chrome browsers, to check whether a string is in a set, a
  17949. // predicate containing a big ugly `switch` statement is faster than
  17950. // a regular expression, and on Chrome the two are about on par.
  17951. // This function uses `eval` (non-lexical) to produce such a
  17952. // predicate from a space-separated string of words.
  17953. //
  17954. // It starts by sorting the words by length.
  17955. function makePredicate(words) {
  17956. words = words.split(" ");
  17957. return function (str) {
  17958. return words.indexOf(str) >= 0;
  17959. };
  17960. }
  17961. // Reserved word lists for various dialects of the language
  17962. var reservedWords = {
  17963. 6: makePredicate("enum await"),
  17964. strict: makePredicate("implements interface let package private protected public static yield"),
  17965. strictBind: makePredicate("eval arguments")
  17966. };
  17967. // And the keywords
  17968. 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");
  17969. // ## Character categories
  17970. // Big ugly regular expressions that match characters in the
  17971. // whitespace, identifier, and identifier-start categories. These
  17972. // are only applied when a character is found to actually have a
  17973. // code point above 128.
  17974. // Generated by `bin/generate-identifier-regex.js`.
  17975. 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";
  17976. 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";
  17977. var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
  17978. var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
  17979. nonASCIIidentifierStartChars = nonASCIIidentifierChars = null;
  17980. // These are a run-length and offset encoded representation of the
  17981. // >0xffff code points that are a valid part of identifiers. The
  17982. // offset starts at 0x10000, and each pair of numbers represents an
  17983. // offset to the next range, and then a size of the range. They were
  17984. // generated by `bin/generate-identifier-regex.js`.
  17985. // eslint-disable-next-line comma-spacing
  17986. 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];
  17987. // eslint-disable-next-line comma-spacing
  17988. 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];
  17989. // This has a complexity linear to the value of the code. The
  17990. // assumption is that looking up astral identifier characters is
  17991. // rare.
  17992. function isInAstralSet(code, set) {
  17993. var pos = 0x10000;
  17994. for (var i = 0; i < set.length; i += 2) {
  17995. pos += set[i];
  17996. if (pos > code) return false;
  17997. pos += set[i + 1];
  17998. if (pos >= code) return true;
  17999. }
  18000. }
  18001. // Test whether a given character code starts an identifier.
  18002. function isIdentifierStart(code) {
  18003. if (code < 65) return code === 36;
  18004. if (code < 91) return true;
  18005. if (code < 97) return code === 95;
  18006. if (code < 123) return true;
  18007. if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code));
  18008. return isInAstralSet(code, astralIdentifierStartCodes);
  18009. }
  18010. // Test whether a given character is part of an identifier.
  18011. function isIdentifierChar(code) {
  18012. if (code < 48) return code === 36;
  18013. if (code < 58) return true;
  18014. if (code < 65) return false;
  18015. if (code < 91) return true;
  18016. if (code < 97) return code === 95;
  18017. if (code < 123) return true;
  18018. if (code <= 0xffff) return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));
  18019. return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
  18020. }
  18021. // A second optional argument can be given to further configure
  18022. var defaultOptions = {
  18023. // Source type ("script" or "module") for different semantics
  18024. sourceType: "script",
  18025. // Source filename.
  18026. sourceFilename: undefined,
  18027. // Line from which to start counting source. Useful for
  18028. // integration with other tools.
  18029. startLine: 1,
  18030. // When enabled, a return at the top level is not considered an
  18031. // error.
  18032. allowReturnOutsideFunction: false,
  18033. // When enabled, import/export statements are not constrained to
  18034. // appearing at the top of the program.
  18035. allowImportExportEverywhere: false,
  18036. // TODO
  18037. allowSuperOutsideMethod: false,
  18038. // An array of plugins to enable
  18039. plugins: [],
  18040. // TODO
  18041. strictMode: null
  18042. };
  18043. // Interpret and default an options object
  18044. function getOptions(opts) {
  18045. var options = {};
  18046. for (var key in defaultOptions) {
  18047. options[key] = opts && key in opts ? opts[key] : defaultOptions[key];
  18048. }
  18049. return options;
  18050. }
  18051. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
  18052. return typeof obj;
  18053. } : function (obj) {
  18054. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  18055. };
  18056. var classCallCheck = function (instance, Constructor) {
  18057. if (!(instance instanceof Constructor)) {
  18058. throw new TypeError("Cannot call a class as a function");
  18059. }
  18060. };
  18061. var inherits = function (subClass, superClass) {
  18062. if (typeof superClass !== "function" && superClass !== null) {
  18063. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  18064. }
  18065. subClass.prototype = Object.create(superClass && superClass.prototype, {
  18066. constructor: {
  18067. value: subClass,
  18068. enumerable: false,
  18069. writable: true,
  18070. configurable: true
  18071. }
  18072. });
  18073. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  18074. };
  18075. var possibleConstructorReturn = function (self, call) {
  18076. if (!self) {
  18077. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  18078. }
  18079. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  18080. };
  18081. // ## Token types
  18082. // The assignment of fine-grained, information-carrying type objects
  18083. // allows the tokenizer to store the information it has about a
  18084. // token in a way that is very cheap for the parser to look up.
  18085. // All token type variables start with an underscore, to make them
  18086. // easy to recognize.
  18087. // The `beforeExpr` property is used to disambiguate between regular
  18088. // expressions and divisions. It is set on all token types that can
  18089. // be followed by an expression (thus, a slash after them would be a
  18090. // regular expression).
  18091. //
  18092. // `isLoop` marks a keyword as starting a loop, which is important
  18093. // to know when parsing a label, in order to allow or disallow
  18094. // continue jumps to that label.
  18095. var beforeExpr = true;
  18096. var startsExpr = true;
  18097. var isLoop = true;
  18098. var isAssign = true;
  18099. var prefix = true;
  18100. var postfix = true;
  18101. var TokenType = function TokenType(label) {
  18102. var conf = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  18103. classCallCheck(this, TokenType);
  18104. this.label = label;
  18105. this.keyword = conf.keyword;
  18106. this.beforeExpr = !!conf.beforeExpr;
  18107. this.startsExpr = !!conf.startsExpr;
  18108. this.rightAssociative = !!conf.rightAssociative;
  18109. this.isLoop = !!conf.isLoop;
  18110. this.isAssign = !!conf.isAssign;
  18111. this.prefix = !!conf.prefix;
  18112. this.postfix = !!conf.postfix;
  18113. this.binop = conf.binop || null;
  18114. this.updateContext = null;
  18115. };
  18116. var KeywordTokenType = function (_TokenType) {
  18117. inherits(KeywordTokenType, _TokenType);
  18118. function KeywordTokenType(name) {
  18119. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  18120. classCallCheck(this, KeywordTokenType);
  18121. options.keyword = name;
  18122. return possibleConstructorReturn(this, _TokenType.call(this, name, options));
  18123. }
  18124. return KeywordTokenType;
  18125. }(TokenType);
  18126. var BinopTokenType = function (_TokenType2) {
  18127. inherits(BinopTokenType, _TokenType2);
  18128. function BinopTokenType(name, prec) {
  18129. classCallCheck(this, BinopTokenType);
  18130. return possibleConstructorReturn(this, _TokenType2.call(this, name, { beforeExpr: beforeExpr, binop: prec }));
  18131. }
  18132. return BinopTokenType;
  18133. }(TokenType);
  18134. var types = {
  18135. num: new TokenType("num", { startsExpr: startsExpr }),
  18136. regexp: new TokenType("regexp", { startsExpr: startsExpr }),
  18137. string: new TokenType("string", { startsExpr: startsExpr }),
  18138. name: new TokenType("name", { startsExpr: startsExpr }),
  18139. eof: new TokenType("eof"),
  18140. // Punctuation token types.
  18141. bracketL: new TokenType("[", { beforeExpr: beforeExpr, startsExpr: startsExpr }),
  18142. bracketR: new TokenType("]"),
  18143. braceL: new TokenType("{", { beforeExpr: beforeExpr, startsExpr: startsExpr }),
  18144. braceBarL: new TokenType("{|", { beforeExpr: beforeExpr, startsExpr: startsExpr }),
  18145. braceR: new TokenType("}"),
  18146. braceBarR: new TokenType("|}"),
  18147. parenL: new TokenType("(", { beforeExpr: beforeExpr, startsExpr: startsExpr }),
  18148. parenR: new TokenType(")"),
  18149. comma: new TokenType(",", { beforeExpr: beforeExpr }),
  18150. semi: new TokenType(";", { beforeExpr: beforeExpr }),
  18151. colon: new TokenType(":", { beforeExpr: beforeExpr }),
  18152. doubleColon: new TokenType("::", { beforeExpr: beforeExpr }),
  18153. dot: new TokenType("."),
  18154. question: new TokenType("?", { beforeExpr: beforeExpr }),
  18155. arrow: new TokenType("=>", { beforeExpr: beforeExpr }),
  18156. template: new TokenType("template"),
  18157. ellipsis: new TokenType("...", { beforeExpr: beforeExpr }),
  18158. backQuote: new TokenType("`", { startsExpr: startsExpr }),
  18159. dollarBraceL: new TokenType("${", { beforeExpr: beforeExpr, startsExpr: startsExpr }),
  18160. at: new TokenType("@"),
  18161. // Operators. These carry several kinds of properties to help the
  18162. // parser use them properly (the presence of these properties is
  18163. // what categorizes them as operators).
  18164. //
  18165. // `binop`, when present, specifies that this operator is a binary
  18166. // operator, and will refer to its precedence.
  18167. //
  18168. // `prefix` and `postfix` mark the operator as a prefix or postfix
  18169. // unary operator.
  18170. //
  18171. // `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as
  18172. // binary operators with a very low precedence, that should result
  18173. // in AssignmentExpression nodes.
  18174. eq: new TokenType("=", { beforeExpr: beforeExpr, isAssign: isAssign }),
  18175. assign: new TokenType("_=", { beforeExpr: beforeExpr, isAssign: isAssign }),
  18176. incDec: new TokenType("++/--", { prefix: prefix, postfix: postfix, startsExpr: startsExpr }),
  18177. prefix: new TokenType("prefix", { beforeExpr: beforeExpr, prefix: prefix, startsExpr: startsExpr }),
  18178. logicalOR: new BinopTokenType("||", 1),
  18179. logicalAND: new BinopTokenType("&&", 2),
  18180. bitwiseOR: new BinopTokenType("|", 3),
  18181. bitwiseXOR: new BinopTokenType("^", 4),
  18182. bitwiseAND: new BinopTokenType("&", 5),
  18183. equality: new BinopTokenType("==/!=", 6),
  18184. relational: new BinopTokenType("</>", 7),
  18185. bitShift: new BinopTokenType("<</>>", 8),
  18186. plusMin: new TokenType("+/-", { beforeExpr: beforeExpr, binop: 9, prefix: prefix, startsExpr: startsExpr }),
  18187. modulo: new BinopTokenType("%", 10),
  18188. star: new BinopTokenType("*", 10),
  18189. slash: new BinopTokenType("/", 10),
  18190. exponent: new TokenType("**", { beforeExpr: beforeExpr, binop: 11, rightAssociative: true })
  18191. };
  18192. var keywords = {
  18193. "break": new KeywordTokenType("break"),
  18194. "case": new KeywordTokenType("case", { beforeExpr: beforeExpr }),
  18195. "catch": new KeywordTokenType("catch"),
  18196. "continue": new KeywordTokenType("continue"),
  18197. "debugger": new KeywordTokenType("debugger"),
  18198. "default": new KeywordTokenType("default", { beforeExpr: beforeExpr }),
  18199. "do": new KeywordTokenType("do", { isLoop: isLoop, beforeExpr: beforeExpr }),
  18200. "else": new KeywordTokenType("else", { beforeExpr: beforeExpr }),
  18201. "finally": new KeywordTokenType("finally"),
  18202. "for": new KeywordTokenType("for", { isLoop: isLoop }),
  18203. "function": new KeywordTokenType("function", { startsExpr: startsExpr }),
  18204. "if": new KeywordTokenType("if"),
  18205. "return": new KeywordTokenType("return", { beforeExpr: beforeExpr }),
  18206. "switch": new KeywordTokenType("switch"),
  18207. "throw": new KeywordTokenType("throw", { beforeExpr: beforeExpr }),
  18208. "try": new KeywordTokenType("try"),
  18209. "var": new KeywordTokenType("var"),
  18210. "let": new KeywordTokenType("let"),
  18211. "const": new KeywordTokenType("const"),
  18212. "while": new KeywordTokenType("while", { isLoop: isLoop }),
  18213. "with": new KeywordTokenType("with"),
  18214. "new": new KeywordTokenType("new", { beforeExpr: beforeExpr, startsExpr: startsExpr }),
  18215. "this": new KeywordTokenType("this", { startsExpr: startsExpr }),
  18216. "super": new KeywordTokenType("super", { startsExpr: startsExpr }),
  18217. "class": new KeywordTokenType("class"),
  18218. "extends": new KeywordTokenType("extends", { beforeExpr: beforeExpr }),
  18219. "export": new KeywordTokenType("export"),
  18220. "import": new KeywordTokenType("import", { startsExpr: startsExpr }),
  18221. "yield": new KeywordTokenType("yield", { beforeExpr: beforeExpr, startsExpr: startsExpr }),
  18222. "null": new KeywordTokenType("null", { startsExpr: startsExpr }),
  18223. "true": new KeywordTokenType("true", { startsExpr: startsExpr }),
  18224. "false": new KeywordTokenType("false", { startsExpr: startsExpr }),
  18225. "in": new KeywordTokenType("in", { beforeExpr: beforeExpr, binop: 7 }),
  18226. "instanceof": new KeywordTokenType("instanceof", { beforeExpr: beforeExpr, binop: 7 }),
  18227. "typeof": new KeywordTokenType("typeof", { beforeExpr: beforeExpr, prefix: prefix, startsExpr: startsExpr }),
  18228. "void": new KeywordTokenType("void", { beforeExpr: beforeExpr, prefix: prefix, startsExpr: startsExpr }),
  18229. "delete": new KeywordTokenType("delete", { beforeExpr: beforeExpr, prefix: prefix, startsExpr: startsExpr })
  18230. };
  18231. // Map keyword names to token types.
  18232. Object.keys(keywords).forEach(function (name) {
  18233. types["_" + name] = keywords[name];
  18234. });
  18235. // Matches a whole line break (where CRLF is considered a single
  18236. // line break). Used to count lines.
  18237. var lineBreak = /\r\n?|\n|\u2028|\u2029/;
  18238. var lineBreakG = new RegExp(lineBreak.source, "g");
  18239. function isNewLine(code) {
  18240. return code === 10 || code === 13 || code === 0x2028 || code === 0x2029;
  18241. }
  18242. var nonASCIIwhitespace = /[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;
  18243. // The algorithm used to determine whether a regexp can appear at a
  18244. // given point in the program is loosely based on sweet.js' approach.
  18245. // See https://github.com/mozilla/sweet.js/wiki/design
  18246. var TokContext = function TokContext(token, isExpr, preserveSpace, override) {
  18247. classCallCheck(this, TokContext);
  18248. this.token = token;
  18249. this.isExpr = !!isExpr;
  18250. this.preserveSpace = !!preserveSpace;
  18251. this.override = override;
  18252. };
  18253. var types$1 = {
  18254. braceStatement: new TokContext("{", false),
  18255. braceExpression: new TokContext("{", true),
  18256. templateQuasi: new TokContext("${", true),
  18257. parenStatement: new TokContext("(", false),
  18258. parenExpression: new TokContext("(", true),
  18259. template: new TokContext("`", true, true, function (p) {
  18260. return p.readTmplToken();
  18261. }),
  18262. functionExpression: new TokContext("function", true)
  18263. };
  18264. // Token-specific context update code
  18265. types.parenR.updateContext = types.braceR.updateContext = function () {
  18266. if (this.state.context.length === 1) {
  18267. this.state.exprAllowed = true;
  18268. return;
  18269. }
  18270. var out = this.state.context.pop();
  18271. if (out === types$1.braceStatement && this.curContext() === types$1.functionExpression) {
  18272. this.state.context.pop();
  18273. this.state.exprAllowed = false;
  18274. } else if (out === types$1.templateQuasi) {
  18275. this.state.exprAllowed = true;
  18276. } else {
  18277. this.state.exprAllowed = !out.isExpr;
  18278. }
  18279. };
  18280. types.name.updateContext = function (prevType) {
  18281. this.state.exprAllowed = false;
  18282. if (prevType === types._let || prevType === types._const || prevType === types._var) {
  18283. if (lineBreak.test(this.input.slice(this.state.end))) {
  18284. this.state.exprAllowed = true;
  18285. }
  18286. }
  18287. };
  18288. types.braceL.updateContext = function (prevType) {
  18289. this.state.context.push(this.braceIsBlock(prevType) ? types$1.braceStatement : types$1.braceExpression);
  18290. this.state.exprAllowed = true;
  18291. };
  18292. types.dollarBraceL.updateContext = function () {
  18293. this.state.context.push(types$1.templateQuasi);
  18294. this.state.exprAllowed = true;
  18295. };
  18296. types.parenL.updateContext = function (prevType) {
  18297. var statementParens = prevType === types._if || prevType === types._for || prevType === types._with || prevType === types._while;
  18298. this.state.context.push(statementParens ? types$1.parenStatement : types$1.parenExpression);
  18299. this.state.exprAllowed = true;
  18300. };
  18301. types.incDec.updateContext = function () {
  18302. // tokExprAllowed stays unchanged
  18303. };
  18304. types._function.updateContext = function () {
  18305. if (this.curContext() !== types$1.braceStatement) {
  18306. this.state.context.push(types$1.functionExpression);
  18307. }
  18308. this.state.exprAllowed = false;
  18309. };
  18310. types.backQuote.updateContext = function () {
  18311. if (this.curContext() === types$1.template) {
  18312. this.state.context.pop();
  18313. } else {
  18314. this.state.context.push(types$1.template);
  18315. }
  18316. this.state.exprAllowed = false;
  18317. };
  18318. // These are used when `options.locations` is on, for the
  18319. // `startLoc` and `endLoc` properties.
  18320. var Position = function Position(line, col) {
  18321. classCallCheck(this, Position);
  18322. this.line = line;
  18323. this.column = col;
  18324. };
  18325. var SourceLocation = function SourceLocation(start, end) {
  18326. classCallCheck(this, SourceLocation);
  18327. this.start = start;
  18328. this.end = end;
  18329. };
  18330. // The `getLineInfo` function is mostly useful when the
  18331. // `locations` option is off (for performance reasons) and you
  18332. // want to find the line/column position for a given character
  18333. // offset. `input` should be the code string that the offset refers
  18334. // into.
  18335. function getLineInfo(input, offset) {
  18336. for (var line = 1, cur = 0;;) {
  18337. lineBreakG.lastIndex = cur;
  18338. var match = lineBreakG.exec(input);
  18339. if (match && match.index < offset) {
  18340. ++line;
  18341. cur = match.index + match[0].length;
  18342. } else {
  18343. return new Position(line, offset - cur);
  18344. }
  18345. }
  18346. }
  18347. var State = function () {
  18348. function State() {
  18349. classCallCheck(this, State);
  18350. }
  18351. State.prototype.init = function init(options, input) {
  18352. this.strict = options.strictMode === false ? false : options.sourceType === "module";
  18353. this.input = input;
  18354. this.potentialArrowAt = -1;
  18355. this.inMethod = this.inFunction = this.inGenerator = this.inAsync = this.inPropertyName = this.inType = this.inClassProperty = this.noAnonFunctionType = false;
  18356. this.labels = [];
  18357. this.decorators = [];
  18358. this.tokens = [];
  18359. this.comments = [];
  18360. this.trailingComments = [];
  18361. this.leadingComments = [];
  18362. this.commentStack = [];
  18363. this.pos = this.lineStart = 0;
  18364. this.curLine = options.startLine;
  18365. this.type = types.eof;
  18366. this.value = null;
  18367. this.start = this.end = this.pos;
  18368. this.startLoc = this.endLoc = this.curPosition();
  18369. this.lastTokEndLoc = this.lastTokStartLoc = null;
  18370. this.lastTokStart = this.lastTokEnd = this.pos;
  18371. this.context = [types$1.braceStatement];
  18372. this.exprAllowed = true;
  18373. this.containsEsc = this.containsOctal = false;
  18374. this.octalPosition = null;
  18375. this.invalidTemplateEscapePosition = null;
  18376. this.exportedIdentifiers = [];
  18377. return this;
  18378. };
  18379. // TODO
  18380. // TODO
  18381. // Used to signify the start of a potential arrow function
  18382. // Flags to track whether we are in a function, a generator.
  18383. // Labels in scope.
  18384. // Leading decorators.
  18385. // Token store.
  18386. // Comment store.
  18387. // Comment attachment store
  18388. // The current position of the tokenizer in the input.
  18389. // Properties of the current token:
  18390. // Its type
  18391. // For tokens that include more information than their type, the value
  18392. // Its start and end offset
  18393. // And, if locations are used, the {line, column} object
  18394. // corresponding to those offsets
  18395. // Position information for the previous token
  18396. // The context stack is used to superficially track syntactic
  18397. // context to predict whether a regular expression is allowed in a
  18398. // given position.
  18399. // Used to signal to callers of `readWord1` whether the word
  18400. // contained any escape sequences. This is needed because words with
  18401. // escape sequences must not be interpreted as keywords.
  18402. // TODO
  18403. // Names of exports store. `default` is stored as a name for both
  18404. // `export default foo;` and `export { foo as default };`.
  18405. State.prototype.curPosition = function curPosition() {
  18406. return new Position(this.curLine, this.pos - this.lineStart);
  18407. };
  18408. State.prototype.clone = function clone(skipArrays) {
  18409. var state = new State();
  18410. for (var key in this) {
  18411. var val = this[key];
  18412. if ((!skipArrays || key === "context") && Array.isArray(val)) {
  18413. val = val.slice();
  18414. }
  18415. state[key] = val;
  18416. }
  18417. return state;
  18418. };
  18419. return State;
  18420. }();
  18421. // Object type used to represent tokens. Note that normally, tokens
  18422. // simply exist as properties on the parser object. This is only
  18423. // used for the onToken callback and the external tokenizer.
  18424. var Token = function Token(state) {
  18425. classCallCheck(this, Token);
  18426. this.type = state.type;
  18427. this.value = state.value;
  18428. this.start = state.start;
  18429. this.end = state.end;
  18430. this.loc = new SourceLocation(state.startLoc, state.endLoc);
  18431. };
  18432. // ## Tokenizer
  18433. function codePointToString(code) {
  18434. // UTF-16 Decoding
  18435. if (code <= 0xFFFF) {
  18436. return String.fromCharCode(code);
  18437. } else {
  18438. return String.fromCharCode((code - 0x10000 >> 10) + 0xD800, (code - 0x10000 & 1023) + 0xDC00);
  18439. }
  18440. }
  18441. var Tokenizer = function () {
  18442. function Tokenizer(options, input) {
  18443. classCallCheck(this, Tokenizer);
  18444. this.state = new State();
  18445. this.state.init(options, input);
  18446. }
  18447. // Move to the next token
  18448. Tokenizer.prototype.next = function next() {
  18449. if (!this.isLookahead) {
  18450. this.state.tokens.push(new Token(this.state));
  18451. }
  18452. this.state.lastTokEnd = this.state.end;
  18453. this.state.lastTokStart = this.state.start;
  18454. this.state.lastTokEndLoc = this.state.endLoc;
  18455. this.state.lastTokStartLoc = this.state.startLoc;
  18456. this.nextToken();
  18457. };
  18458. // TODO
  18459. Tokenizer.prototype.eat = function eat(type) {
  18460. if (this.match(type)) {
  18461. this.next();
  18462. return true;
  18463. } else {
  18464. return false;
  18465. }
  18466. };
  18467. // TODO
  18468. Tokenizer.prototype.match = function match(type) {
  18469. return this.state.type === type;
  18470. };
  18471. // TODO
  18472. Tokenizer.prototype.isKeyword = function isKeyword$$1(word) {
  18473. return isKeyword(word);
  18474. };
  18475. // TODO
  18476. Tokenizer.prototype.lookahead = function lookahead() {
  18477. var old = this.state;
  18478. this.state = old.clone(true);
  18479. this.isLookahead = true;
  18480. this.next();
  18481. this.isLookahead = false;
  18482. var curr = this.state.clone(true);
  18483. this.state = old;
  18484. return curr;
  18485. };
  18486. // Toggle strict mode. Re-reads the next number or string to please
  18487. // pedantic tests (`"use strict"; 010;` should fail).
  18488. Tokenizer.prototype.setStrict = function setStrict(strict) {
  18489. this.state.strict = strict;
  18490. if (!this.match(types.num) && !this.match(types.string)) return;
  18491. this.state.pos = this.state.start;
  18492. while (this.state.pos < this.state.lineStart) {
  18493. this.state.lineStart = this.input.lastIndexOf("\n", this.state.lineStart - 2) + 1;
  18494. --this.state.curLine;
  18495. }
  18496. this.nextToken();
  18497. };
  18498. Tokenizer.prototype.curContext = function curContext() {
  18499. return this.state.context[this.state.context.length - 1];
  18500. };
  18501. // Read a single token, updating the parser object's token-related
  18502. // properties.
  18503. Tokenizer.prototype.nextToken = function nextToken() {
  18504. var curContext = this.curContext();
  18505. if (!curContext || !curContext.preserveSpace) this.skipSpace();
  18506. this.state.containsOctal = false;
  18507. this.state.octalPosition = null;
  18508. this.state.start = this.state.pos;
  18509. this.state.startLoc = this.state.curPosition();
  18510. if (this.state.pos >= this.input.length) return this.finishToken(types.eof);
  18511. if (curContext.override) {
  18512. return curContext.override(this);
  18513. } else {
  18514. return this.readToken(this.fullCharCodeAtPos());
  18515. }
  18516. };
  18517. Tokenizer.prototype.readToken = function readToken(code) {
  18518. // Identifier or keyword. '\uXXXX' sequences are allowed in
  18519. // identifiers, so '\' also dispatches to that.
  18520. if (isIdentifierStart(code) || code === 92 /* '\' */) {
  18521. return this.readWord();
  18522. } else {
  18523. return this.getTokenFromCode(code);
  18524. }
  18525. };
  18526. Tokenizer.prototype.fullCharCodeAtPos = function fullCharCodeAtPos() {
  18527. var code = this.input.charCodeAt(this.state.pos);
  18528. if (code <= 0xd7ff || code >= 0xe000) return code;
  18529. var next = this.input.charCodeAt(this.state.pos + 1);
  18530. return (code << 10) + next - 0x35fdc00;
  18531. };
  18532. Tokenizer.prototype.pushComment = function pushComment(block, text, start, end, startLoc, endLoc) {
  18533. var comment = {
  18534. type: block ? "CommentBlock" : "CommentLine",
  18535. value: text,
  18536. start: start,
  18537. end: end,
  18538. loc: new SourceLocation(startLoc, endLoc)
  18539. };
  18540. if (!this.isLookahead) {
  18541. this.state.tokens.push(comment);
  18542. this.state.comments.push(comment);
  18543. this.addComment(comment);
  18544. }
  18545. };
  18546. Tokenizer.prototype.skipBlockComment = function skipBlockComment() {
  18547. var startLoc = this.state.curPosition();
  18548. var start = this.state.pos;
  18549. var end = this.input.indexOf("*/", this.state.pos += 2);
  18550. if (end === -1) this.raise(this.state.pos - 2, "Unterminated comment");
  18551. this.state.pos = end + 2;
  18552. lineBreakG.lastIndex = start;
  18553. var match = void 0;
  18554. while ((match = lineBreakG.exec(this.input)) && match.index < this.state.pos) {
  18555. ++this.state.curLine;
  18556. this.state.lineStart = match.index + match[0].length;
  18557. }
  18558. this.pushComment(true, this.input.slice(start + 2, end), start, this.state.pos, startLoc, this.state.curPosition());
  18559. };
  18560. Tokenizer.prototype.skipLineComment = function skipLineComment(startSkip) {
  18561. var start = this.state.pos;
  18562. var startLoc = this.state.curPosition();
  18563. var ch = this.input.charCodeAt(this.state.pos += startSkip);
  18564. while (this.state.pos < this.input.length && ch !== 10 && ch !== 13 && ch !== 8232 && ch !== 8233) {
  18565. ++this.state.pos;
  18566. ch = this.input.charCodeAt(this.state.pos);
  18567. }
  18568. this.pushComment(false, this.input.slice(start + startSkip, this.state.pos), start, this.state.pos, startLoc, this.state.curPosition());
  18569. };
  18570. // Called at the start of the parse and after every token. Skips
  18571. // whitespace and comments, and.
  18572. Tokenizer.prototype.skipSpace = function skipSpace() {
  18573. loop: while (this.state.pos < this.input.length) {
  18574. var ch = this.input.charCodeAt(this.state.pos);
  18575. switch (ch) {
  18576. case 32:case 160:
  18577. // ' '
  18578. ++this.state.pos;
  18579. break;
  18580. case 13:
  18581. if (this.input.charCodeAt(this.state.pos + 1) === 10) {
  18582. ++this.state.pos;
  18583. }
  18584. case 10:case 8232:case 8233:
  18585. ++this.state.pos;
  18586. ++this.state.curLine;
  18587. this.state.lineStart = this.state.pos;
  18588. break;
  18589. case 47:
  18590. // '/'
  18591. switch (this.input.charCodeAt(this.state.pos + 1)) {
  18592. case 42:
  18593. // '*'
  18594. this.skipBlockComment();
  18595. break;
  18596. case 47:
  18597. this.skipLineComment(2);
  18598. break;
  18599. default:
  18600. break loop;
  18601. }
  18602. break;
  18603. default:
  18604. if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) {
  18605. ++this.state.pos;
  18606. } else {
  18607. break loop;
  18608. }
  18609. }
  18610. }
  18611. };
  18612. // Called at the end of every token. Sets `end`, `val`, and
  18613. // maintains `context` and `exprAllowed`, and skips the space after
  18614. // the token, so that the next one's `start` will point at the
  18615. // right position.
  18616. Tokenizer.prototype.finishToken = function finishToken(type, val) {
  18617. this.state.end = this.state.pos;
  18618. this.state.endLoc = this.state.curPosition();
  18619. var prevType = this.state.type;
  18620. this.state.type = type;
  18621. this.state.value = val;
  18622. this.updateContext(prevType);
  18623. };
  18624. // ### Token reading
  18625. // This is the function that is called to fetch the next token. It
  18626. // is somewhat obscure, because it works in character codes rather
  18627. // than characters, and because operator parsing has been inlined
  18628. // into it.
  18629. //
  18630. // All in the name of speed.
  18631. //
  18632. Tokenizer.prototype.readToken_dot = function readToken_dot() {
  18633. var next = this.input.charCodeAt(this.state.pos + 1);
  18634. if (next >= 48 && next <= 57) {
  18635. return this.readNumber(true);
  18636. }
  18637. var next2 = this.input.charCodeAt(this.state.pos + 2);
  18638. if (next === 46 && next2 === 46) {
  18639. // 46 = dot '.'
  18640. this.state.pos += 3;
  18641. return this.finishToken(types.ellipsis);
  18642. } else {
  18643. ++this.state.pos;
  18644. return this.finishToken(types.dot);
  18645. }
  18646. };
  18647. Tokenizer.prototype.readToken_slash = function readToken_slash() {
  18648. // '/'
  18649. if (this.state.exprAllowed) {
  18650. ++this.state.pos;
  18651. return this.readRegexp();
  18652. }
  18653. var next = this.input.charCodeAt(this.state.pos + 1);
  18654. if (next === 61) {
  18655. return this.finishOp(types.assign, 2);
  18656. } else {
  18657. return this.finishOp(types.slash, 1);
  18658. }
  18659. };
  18660. Tokenizer.prototype.readToken_mult_modulo = function readToken_mult_modulo(code) {
  18661. // '%*'
  18662. var type = code === 42 ? types.star : types.modulo;
  18663. var width = 1;
  18664. var next = this.input.charCodeAt(this.state.pos + 1);
  18665. if (next === 42) {
  18666. // '*'
  18667. width++;
  18668. next = this.input.charCodeAt(this.state.pos + 2);
  18669. type = types.exponent;
  18670. }
  18671. if (next === 61) {
  18672. width++;
  18673. type = types.assign;
  18674. }
  18675. return this.finishOp(type, width);
  18676. };
  18677. Tokenizer.prototype.readToken_pipe_amp = function readToken_pipe_amp(code) {
  18678. // '|&'
  18679. var next = this.input.charCodeAt(this.state.pos + 1);
  18680. if (next === code) return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2);
  18681. if (next === 61) return this.finishOp(types.assign, 2);
  18682. if (code === 124 && next === 125 && this.hasPlugin("flow")) return this.finishOp(types.braceBarR, 2);
  18683. return this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1);
  18684. };
  18685. Tokenizer.prototype.readToken_caret = function readToken_caret() {
  18686. // '^'
  18687. var next = this.input.charCodeAt(this.state.pos + 1);
  18688. if (next === 61) {
  18689. return this.finishOp(types.assign, 2);
  18690. } else {
  18691. return this.finishOp(types.bitwiseXOR, 1);
  18692. }
  18693. };
  18694. Tokenizer.prototype.readToken_plus_min = function readToken_plus_min(code) {
  18695. // '+-'
  18696. var next = this.input.charCodeAt(this.state.pos + 1);
  18697. if (next === code) {
  18698. if (next === 45 && this.input.charCodeAt(this.state.pos + 2) === 62 && lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.pos))) {
  18699. // A `-->` line comment
  18700. this.skipLineComment(3);
  18701. this.skipSpace();
  18702. return this.nextToken();
  18703. }
  18704. return this.finishOp(types.incDec, 2);
  18705. }
  18706. if (next === 61) {
  18707. return this.finishOp(types.assign, 2);
  18708. } else {
  18709. return this.finishOp(types.plusMin, 1);
  18710. }
  18711. };
  18712. Tokenizer.prototype.readToken_lt_gt = function readToken_lt_gt(code) {
  18713. // '<>'
  18714. var next = this.input.charCodeAt(this.state.pos + 1);
  18715. var size = 1;
  18716. if (next === code) {
  18717. size = code === 62 && this.input.charCodeAt(this.state.pos + 2) === 62 ? 3 : 2;
  18718. if (this.input.charCodeAt(this.state.pos + size) === 61) return this.finishOp(types.assign, size + 1);
  18719. return this.finishOp(types.bitShift, size);
  18720. }
  18721. if (next === 33 && code === 60 && this.input.charCodeAt(this.state.pos + 2) === 45 && this.input.charCodeAt(this.state.pos + 3) === 45) {
  18722. if (this.inModule) this.unexpected();
  18723. // `<!--`, an XML-style comment that should be interpreted as a line comment
  18724. this.skipLineComment(4);
  18725. this.skipSpace();
  18726. return this.nextToken();
  18727. }
  18728. if (next === 61) {
  18729. // <= | >=
  18730. size = 2;
  18731. }
  18732. return this.finishOp(types.relational, size);
  18733. };
  18734. Tokenizer.prototype.readToken_eq_excl = function readToken_eq_excl(code) {
  18735. // '=!'
  18736. var next = this.input.charCodeAt(this.state.pos + 1);
  18737. if (next === 61) return this.finishOp(types.equality, this.input.charCodeAt(this.state.pos + 2) === 61 ? 3 : 2);
  18738. if (code === 61 && next === 62) {
  18739. // '=>'
  18740. this.state.pos += 2;
  18741. return this.finishToken(types.arrow);
  18742. }
  18743. return this.finishOp(code === 61 ? types.eq : types.prefix, 1);
  18744. };
  18745. Tokenizer.prototype.getTokenFromCode = function getTokenFromCode(code) {
  18746. switch (code) {
  18747. // The interpretation of a dot depends on whether it is followed
  18748. // by a digit or another two dots.
  18749. case 46:
  18750. // '.'
  18751. return this.readToken_dot();
  18752. // Punctuation tokens.
  18753. case 40:
  18754. ++this.state.pos;return this.finishToken(types.parenL);
  18755. case 41:
  18756. ++this.state.pos;return this.finishToken(types.parenR);
  18757. case 59:
  18758. ++this.state.pos;return this.finishToken(types.semi);
  18759. case 44:
  18760. ++this.state.pos;return this.finishToken(types.comma);
  18761. case 91:
  18762. ++this.state.pos;return this.finishToken(types.bracketL);
  18763. case 93:
  18764. ++this.state.pos;return this.finishToken(types.bracketR);
  18765. case 123:
  18766. if (this.hasPlugin("flow") && this.input.charCodeAt(this.state.pos + 1) === 124) {
  18767. return this.finishOp(types.braceBarL, 2);
  18768. } else {
  18769. ++this.state.pos;
  18770. return this.finishToken(types.braceL);
  18771. }
  18772. case 125:
  18773. ++this.state.pos;return this.finishToken(types.braceR);
  18774. case 58:
  18775. if (this.hasPlugin("functionBind") && this.input.charCodeAt(this.state.pos + 1) === 58) {
  18776. return this.finishOp(types.doubleColon, 2);
  18777. } else {
  18778. ++this.state.pos;
  18779. return this.finishToken(types.colon);
  18780. }
  18781. case 63:
  18782. ++this.state.pos;return this.finishToken(types.question);
  18783. case 64:
  18784. ++this.state.pos;return this.finishToken(types.at);
  18785. case 96:
  18786. // '`'
  18787. ++this.state.pos;
  18788. return this.finishToken(types.backQuote);
  18789. case 48:
  18790. // '0'
  18791. var next = this.input.charCodeAt(this.state.pos + 1);
  18792. if (next === 120 || next === 88) return this.readRadixNumber(16); // '0x', '0X' - hex number
  18793. if (next === 111 || next === 79) return this.readRadixNumber(8); // '0o', '0O' - octal number
  18794. if (next === 98 || next === 66) return this.readRadixNumber(2); // '0b', '0B' - binary number
  18795. // Anything else beginning with a digit is an integer, octal
  18796. // number, or float.
  18797. case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:
  18798. // 1-9
  18799. return this.readNumber(false);
  18800. // Quotes produce strings.
  18801. case 34:case 39:
  18802. // '"', "'"
  18803. return this.readString(code);
  18804. // Operators are parsed inline in tiny state machines. '=' (61) is
  18805. // often referred to. `finishOp` simply skips the amount of
  18806. // characters it is given as second argument, and returns a token
  18807. // of the type given by its first argument.
  18808. case 47:
  18809. // '/'
  18810. return this.readToken_slash();
  18811. case 37:case 42:
  18812. // '%*'
  18813. return this.readToken_mult_modulo(code);
  18814. case 124:case 38:
  18815. // '|&'
  18816. return this.readToken_pipe_amp(code);
  18817. case 94:
  18818. // '^'
  18819. return this.readToken_caret();
  18820. case 43:case 45:
  18821. // '+-'
  18822. return this.readToken_plus_min(code);
  18823. case 60:case 62:
  18824. // '<>'
  18825. return this.readToken_lt_gt(code);
  18826. case 61:case 33:
  18827. // '=!'
  18828. return this.readToken_eq_excl(code);
  18829. case 126:
  18830. // '~'
  18831. return this.finishOp(types.prefix, 1);
  18832. }
  18833. this.raise(this.state.pos, "Unexpected character '" + codePointToString(code) + "'");
  18834. };
  18835. Tokenizer.prototype.finishOp = function finishOp(type, size) {
  18836. var str = this.input.slice(this.state.pos, this.state.pos + size);
  18837. this.state.pos += size;
  18838. return this.finishToken(type, str);
  18839. };
  18840. Tokenizer.prototype.readRegexp = function readRegexp() {
  18841. var start = this.state.pos;
  18842. var escaped = void 0,
  18843. inClass = void 0;
  18844. for (;;) {
  18845. if (this.state.pos >= this.input.length) this.raise(start, "Unterminated regular expression");
  18846. var ch = this.input.charAt(this.state.pos);
  18847. if (lineBreak.test(ch)) {
  18848. this.raise(start, "Unterminated regular expression");
  18849. }
  18850. if (escaped) {
  18851. escaped = false;
  18852. } else {
  18853. if (ch === "[") {
  18854. inClass = true;
  18855. } else if (ch === "]" && inClass) {
  18856. inClass = false;
  18857. } else if (ch === "/" && !inClass) {
  18858. break;
  18859. }
  18860. escaped = ch === "\\";
  18861. }
  18862. ++this.state.pos;
  18863. }
  18864. var content = this.input.slice(start, this.state.pos);
  18865. ++this.state.pos;
  18866. // Need to use `readWord1` because '\uXXXX' sequences are allowed
  18867. // here (don't ask).
  18868. var mods = this.readWord1();
  18869. if (mods) {
  18870. var validFlags = /^[gmsiyu]*$/;
  18871. if (!validFlags.test(mods)) this.raise(start, "Invalid regular expression flag");
  18872. }
  18873. return this.finishToken(types.regexp, {
  18874. pattern: content,
  18875. flags: mods
  18876. });
  18877. };
  18878. // Read an integer in the given radix. Return null if zero digits
  18879. // were read, the integer value otherwise. When `len` is given, this
  18880. // will return `null` unless the integer has exactly `len` digits.
  18881. Tokenizer.prototype.readInt = function readInt(radix, len) {
  18882. var start = this.state.pos;
  18883. var total = 0;
  18884. for (var i = 0, e = len == null ? Infinity : len; i < e; ++i) {
  18885. var code = this.input.charCodeAt(this.state.pos);
  18886. var val = void 0;
  18887. if (code >= 97) {
  18888. val = code - 97 + 10; // a
  18889. } else if (code >= 65) {
  18890. val = code - 65 + 10; // A
  18891. } else if (code >= 48 && code <= 57) {
  18892. val = code - 48; // 0-9
  18893. } else {
  18894. val = Infinity;
  18895. }
  18896. if (val >= radix) break;
  18897. ++this.state.pos;
  18898. total = total * radix + val;
  18899. }
  18900. if (this.state.pos === start || len != null && this.state.pos - start !== len) return null;
  18901. return total;
  18902. };
  18903. Tokenizer.prototype.readRadixNumber = function readRadixNumber(radix) {
  18904. this.state.pos += 2; // 0x
  18905. var val = this.readInt(radix);
  18906. if (val == null) this.raise(this.state.start + 2, "Expected number in radix " + radix);
  18907. if (isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.state.pos, "Identifier directly after number");
  18908. return this.finishToken(types.num, val);
  18909. };
  18910. // Read an integer, octal integer, or floating-point number.
  18911. Tokenizer.prototype.readNumber = function readNumber(startsWithDot) {
  18912. var start = this.state.pos;
  18913. var octal = this.input.charCodeAt(start) === 48; // '0'
  18914. var isFloat = false;
  18915. if (!startsWithDot && this.readInt(10) === null) this.raise(start, "Invalid number");
  18916. if (octal && this.state.pos == start + 1) octal = false; // number === 0
  18917. var next = this.input.charCodeAt(this.state.pos);
  18918. if (next === 46 && !octal) {
  18919. // '.'
  18920. ++this.state.pos;
  18921. this.readInt(10);
  18922. isFloat = true;
  18923. next = this.input.charCodeAt(this.state.pos);
  18924. }
  18925. if ((next === 69 || next === 101) && !octal) {
  18926. // 'eE'
  18927. next = this.input.charCodeAt(++this.state.pos);
  18928. if (next === 43 || next === 45) ++this.state.pos; // '+-'
  18929. if (this.readInt(10) === null) this.raise(start, "Invalid number");
  18930. isFloat = true;
  18931. }
  18932. if (isIdentifierStart(this.fullCharCodeAtPos())) this.raise(this.state.pos, "Identifier directly after number");
  18933. var str = this.input.slice(start, this.state.pos);
  18934. var val = void 0;
  18935. if (isFloat) {
  18936. val = parseFloat(str);
  18937. } else if (!octal || str.length === 1) {
  18938. val = parseInt(str, 10);
  18939. } else if (this.state.strict) {
  18940. this.raise(start, "Invalid number");
  18941. } else if (/[89]/.test(str)) {
  18942. val = parseInt(str, 10);
  18943. } else {
  18944. val = parseInt(str, 8);
  18945. }
  18946. return this.finishToken(types.num, val);
  18947. };
  18948. // Read a string value, interpreting backslash-escapes.
  18949. Tokenizer.prototype.readCodePoint = function readCodePoint(throwOnInvalid) {
  18950. var ch = this.input.charCodeAt(this.state.pos);
  18951. var code = void 0;
  18952. if (ch === 123) {
  18953. // '{'
  18954. var codePos = ++this.state.pos;
  18955. code = this.readHexChar(this.input.indexOf("}", this.state.pos) - this.state.pos, throwOnInvalid);
  18956. ++this.state.pos;
  18957. if (code === null) {
  18958. --this.state.invalidTemplateEscapePosition; // to point to the '\'' instead of the 'u'
  18959. } else if (code > 0x10FFFF) {
  18960. if (throwOnInvalid) {
  18961. this.raise(codePos, "Code point out of bounds");
  18962. } else {
  18963. this.state.invalidTemplateEscapePosition = codePos - 2;
  18964. return null;
  18965. }
  18966. }
  18967. } else {
  18968. code = this.readHexChar(4, throwOnInvalid);
  18969. }
  18970. return code;
  18971. };
  18972. Tokenizer.prototype.readString = function readString(quote) {
  18973. var out = "",
  18974. chunkStart = ++this.state.pos;
  18975. for (;;) {
  18976. if (this.state.pos >= this.input.length) this.raise(this.state.start, "Unterminated string constant");
  18977. var ch = this.input.charCodeAt(this.state.pos);
  18978. if (ch === quote) break;
  18979. if (ch === 92) {
  18980. // '\'
  18981. out += this.input.slice(chunkStart, this.state.pos);
  18982. out += this.readEscapedChar(false);
  18983. chunkStart = this.state.pos;
  18984. } else {
  18985. if (isNewLine(ch)) this.raise(this.state.start, "Unterminated string constant");
  18986. ++this.state.pos;
  18987. }
  18988. }
  18989. out += this.input.slice(chunkStart, this.state.pos++);
  18990. return this.finishToken(types.string, out);
  18991. };
  18992. // Reads template string tokens.
  18993. Tokenizer.prototype.readTmplToken = function readTmplToken() {
  18994. var out = "",
  18995. chunkStart = this.state.pos,
  18996. containsInvalid = false;
  18997. for (;;) {
  18998. if (this.state.pos >= this.input.length) this.raise(this.state.start, "Unterminated template");
  18999. var ch = this.input.charCodeAt(this.state.pos);
  19000. if (ch === 96 || ch === 36 && this.input.charCodeAt(this.state.pos + 1) === 123) {
  19001. // '`', '${'
  19002. if (this.state.pos === this.state.start && this.match(types.template)) {
  19003. if (ch === 36) {
  19004. this.state.pos += 2;
  19005. return this.finishToken(types.dollarBraceL);
  19006. } else {
  19007. ++this.state.pos;
  19008. return this.finishToken(types.backQuote);
  19009. }
  19010. }
  19011. out += this.input.slice(chunkStart, this.state.pos);
  19012. return this.finishToken(types.template, containsInvalid ? null : out);
  19013. }
  19014. if (ch === 92) {
  19015. // '\'
  19016. out += this.input.slice(chunkStart, this.state.pos);
  19017. var escaped = this.readEscapedChar(true);
  19018. if (escaped === null) {
  19019. containsInvalid = true;
  19020. } else {
  19021. out += escaped;
  19022. }
  19023. chunkStart = this.state.pos;
  19024. } else if (isNewLine(ch)) {
  19025. out += this.input.slice(chunkStart, this.state.pos);
  19026. ++this.state.pos;
  19027. switch (ch) {
  19028. case 13:
  19029. if (this.input.charCodeAt(this.state.pos) === 10) ++this.state.pos;
  19030. case 10:
  19031. out += "\n";
  19032. break;
  19033. default:
  19034. out += String.fromCharCode(ch);
  19035. break;
  19036. }
  19037. ++this.state.curLine;
  19038. this.state.lineStart = this.state.pos;
  19039. chunkStart = this.state.pos;
  19040. } else {
  19041. ++this.state.pos;
  19042. }
  19043. }
  19044. };
  19045. // Used to read escaped characters
  19046. Tokenizer.prototype.readEscapedChar = function readEscapedChar(inTemplate) {
  19047. var throwOnInvalid = !inTemplate;
  19048. var ch = this.input.charCodeAt(++this.state.pos);
  19049. ++this.state.pos;
  19050. switch (ch) {
  19051. case 110:
  19052. return "\n"; // 'n' -> '\n'
  19053. case 114:
  19054. return "\r"; // 'r' -> '\r'
  19055. case 120:
  19056. {
  19057. // 'x'
  19058. var code = this.readHexChar(2, throwOnInvalid);
  19059. return code === null ? null : String.fromCharCode(code);
  19060. }
  19061. case 117:
  19062. {
  19063. // 'u'
  19064. var _code = this.readCodePoint(throwOnInvalid);
  19065. return _code === null ? null : codePointToString(_code);
  19066. }
  19067. case 116:
  19068. return "\t"; // 't' -> '\t'
  19069. case 98:
  19070. return "\b"; // 'b' -> '\b'
  19071. case 118:
  19072. return "\x0B"; // 'v' -> '\u000b'
  19073. case 102:
  19074. return "\f"; // 'f' -> '\f'
  19075. case 13:
  19076. if (this.input.charCodeAt(this.state.pos) === 10) ++this.state.pos; // '\r\n'
  19077. case 10:
  19078. // ' \n'
  19079. this.state.lineStart = this.state.pos;
  19080. ++this.state.curLine;
  19081. return "";
  19082. default:
  19083. if (ch >= 48 && ch <= 55) {
  19084. var codePos = this.state.pos - 1;
  19085. var octalStr = this.input.substr(this.state.pos - 1, 3).match(/^[0-7]+/)[0];
  19086. var octal = parseInt(octalStr, 8);
  19087. if (octal > 255) {
  19088. octalStr = octalStr.slice(0, -1);
  19089. octal = parseInt(octalStr, 8);
  19090. }
  19091. if (octal > 0) {
  19092. if (inTemplate) {
  19093. this.state.invalidTemplateEscapePosition = codePos;
  19094. return null;
  19095. } else if (this.state.strict) {
  19096. this.raise(codePos, "Octal literal in strict mode");
  19097. } else if (!this.state.containsOctal) {
  19098. // These properties are only used to throw an error for an octal which occurs
  19099. // in a directive which occurs prior to a "use strict" directive.
  19100. this.state.containsOctal = true;
  19101. this.state.octalPosition = codePos;
  19102. }
  19103. }
  19104. this.state.pos += octalStr.length - 1;
  19105. return String.fromCharCode(octal);
  19106. }
  19107. return String.fromCharCode(ch);
  19108. }
  19109. };
  19110. // Used to read character escape sequences ('\x', '\u').
  19111. Tokenizer.prototype.readHexChar = function readHexChar(len, throwOnInvalid) {
  19112. var codePos = this.state.pos;
  19113. var n = this.readInt(16, len);
  19114. if (n === null) {
  19115. if (throwOnInvalid) {
  19116. this.raise(codePos, "Bad character escape sequence");
  19117. } else {
  19118. this.state.pos = codePos - 1;
  19119. this.state.invalidTemplateEscapePosition = codePos - 1;
  19120. }
  19121. }
  19122. return n;
  19123. };
  19124. // Read an identifier, and return it as a string. Sets `this.state.containsEsc`
  19125. // to whether the word contained a '\u' escape.
  19126. //
  19127. // Incrementally adds only escaped chars, adding other chunks as-is
  19128. // as a micro-optimization.
  19129. Tokenizer.prototype.readWord1 = function readWord1() {
  19130. this.state.containsEsc = false;
  19131. var word = "",
  19132. first = true,
  19133. chunkStart = this.state.pos;
  19134. while (this.state.pos < this.input.length) {
  19135. var ch = this.fullCharCodeAtPos();
  19136. if (isIdentifierChar(ch)) {
  19137. this.state.pos += ch <= 0xffff ? 1 : 2;
  19138. } else if (ch === 92) {
  19139. // "\"
  19140. this.state.containsEsc = true;
  19141. word += this.input.slice(chunkStart, this.state.pos);
  19142. var escStart = this.state.pos;
  19143. if (this.input.charCodeAt(++this.state.pos) !== 117) {
  19144. // "u"
  19145. this.raise(this.state.pos, "Expecting Unicode escape sequence \\uXXXX");
  19146. }
  19147. ++this.state.pos;
  19148. var esc = this.readCodePoint(true);
  19149. if (!(first ? isIdentifierStart : isIdentifierChar)(esc, true)) {
  19150. this.raise(escStart, "Invalid Unicode escape");
  19151. }
  19152. word += codePointToString(esc);
  19153. chunkStart = this.state.pos;
  19154. } else {
  19155. break;
  19156. }
  19157. first = false;
  19158. }
  19159. return word + this.input.slice(chunkStart, this.state.pos);
  19160. };
  19161. // Read an identifier or keyword token. Will check for reserved
  19162. // words when necessary.
  19163. Tokenizer.prototype.readWord = function readWord() {
  19164. var word = this.readWord1();
  19165. var type = types.name;
  19166. if (!this.state.containsEsc && this.isKeyword(word)) {
  19167. type = keywords[word];
  19168. }
  19169. return this.finishToken(type, word);
  19170. };
  19171. Tokenizer.prototype.braceIsBlock = function braceIsBlock(prevType) {
  19172. if (prevType === types.colon) {
  19173. var parent = this.curContext();
  19174. if (parent === types$1.braceStatement || parent === types$1.braceExpression) {
  19175. return !parent.isExpr;
  19176. }
  19177. }
  19178. if (prevType === types._return) {
  19179. return lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start));
  19180. }
  19181. if (prevType === types._else || prevType === types.semi || prevType === types.eof || prevType === types.parenR) {
  19182. return true;
  19183. }
  19184. if (prevType === types.braceL) {
  19185. return this.curContext() === types$1.braceStatement;
  19186. }
  19187. return !this.state.exprAllowed;
  19188. };
  19189. Tokenizer.prototype.updateContext = function updateContext(prevType) {
  19190. var type = this.state.type;
  19191. var update = void 0;
  19192. if (type.keyword && prevType === types.dot) {
  19193. this.state.exprAllowed = false;
  19194. } else if (update = type.updateContext) {
  19195. update.call(this, prevType);
  19196. } else {
  19197. this.state.exprAllowed = type.beforeExpr;
  19198. }
  19199. };
  19200. return Tokenizer;
  19201. }();
  19202. var plugins = {};
  19203. var frozenDeprecatedWildcardPluginList = ["jsx", "doExpressions", "objectRestSpread", "decorators", "classProperties", "exportExtensions", "asyncGenerators", "functionBind", "functionSent", "dynamicImport", "flow"];
  19204. var Parser = function (_Tokenizer) {
  19205. inherits(Parser, _Tokenizer);
  19206. function Parser(options, input) {
  19207. classCallCheck(this, Parser);
  19208. options = getOptions(options);
  19209. var _this = possibleConstructorReturn(this, _Tokenizer.call(this, options, input));
  19210. _this.options = options;
  19211. _this.inModule = _this.options.sourceType === "module";
  19212. _this.input = input;
  19213. _this.plugins = _this.loadPlugins(_this.options.plugins);
  19214. _this.filename = options.sourceFilename;
  19215. // If enabled, skip leading hashbang line.
  19216. if (_this.state.pos === 0 && _this.input[0] === "#" && _this.input[1] === "!") {
  19217. _this.skipLineComment(2);
  19218. }
  19219. return _this;
  19220. }
  19221. Parser.prototype.isReservedWord = function isReservedWord(word) {
  19222. if (word === "await") {
  19223. return this.inModule;
  19224. } else {
  19225. return reservedWords[6](word);
  19226. }
  19227. };
  19228. Parser.prototype.hasPlugin = function hasPlugin(name) {
  19229. if (this.plugins["*"] && frozenDeprecatedWildcardPluginList.indexOf(name) > -1) {
  19230. return true;
  19231. }
  19232. return !!this.plugins[name];
  19233. };
  19234. Parser.prototype.extend = function extend(name, f) {
  19235. this[name] = f(this[name]);
  19236. };
  19237. Parser.prototype.loadAllPlugins = function loadAllPlugins() {
  19238. var _this2 = this;
  19239. // ensure flow plugin loads last, also ensure estree is not loaded with *
  19240. var pluginNames = Object.keys(plugins).filter(function (name) {
  19241. return name !== "flow" && name !== "estree";
  19242. });
  19243. pluginNames.push("flow");
  19244. pluginNames.forEach(function (name) {
  19245. var plugin = plugins[name];
  19246. if (plugin) plugin(_this2);
  19247. });
  19248. };
  19249. Parser.prototype.loadPlugins = function loadPlugins(pluginList) {
  19250. // TODO: Deprecate "*" option in next major version of Babylon
  19251. if (pluginList.indexOf("*") >= 0) {
  19252. this.loadAllPlugins();
  19253. return { "*": true };
  19254. }
  19255. var pluginMap = {};
  19256. if (pluginList.indexOf("flow") >= 0) {
  19257. // ensure flow plugin loads last
  19258. pluginList = pluginList.filter(function (plugin) {
  19259. return plugin !== "flow";
  19260. });
  19261. pluginList.push("flow");
  19262. }
  19263. if (pluginList.indexOf("estree") >= 0) {
  19264. // ensure estree plugin loads first
  19265. pluginList = pluginList.filter(function (plugin) {
  19266. return plugin !== "estree";
  19267. });
  19268. pluginList.unshift("estree");
  19269. }
  19270. for (var _iterator = pluginList, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
  19271. var _ref;
  19272. if (_isArray) {
  19273. if (_i >= _iterator.length) break;
  19274. _ref = _iterator[_i++];
  19275. } else {
  19276. _i = _iterator.next();
  19277. if (_i.done) break;
  19278. _ref = _i.value;
  19279. }
  19280. var name = _ref;
  19281. if (!pluginMap[name]) {
  19282. pluginMap[name] = true;
  19283. var plugin = plugins[name];
  19284. if (plugin) plugin(this);
  19285. }
  19286. }
  19287. return pluginMap;
  19288. };
  19289. Parser.prototype.parse = function parse() {
  19290. var file = this.startNode();
  19291. var program = this.startNode();
  19292. this.nextToken();
  19293. return this.parseTopLevel(file, program);
  19294. };
  19295. return Parser;
  19296. }(Tokenizer);
  19297. var pp = Parser.prototype;
  19298. // ## Parser utilities
  19299. // TODO
  19300. pp.addExtra = function (node, key, val) {
  19301. if (!node) return;
  19302. var extra = node.extra = node.extra || {};
  19303. extra[key] = val;
  19304. };
  19305. // TODO
  19306. pp.isRelational = function (op) {
  19307. return this.match(types.relational) && this.state.value === op;
  19308. };
  19309. // TODO
  19310. pp.expectRelational = function (op) {
  19311. if (this.isRelational(op)) {
  19312. this.next();
  19313. } else {
  19314. this.unexpected(null, types.relational);
  19315. }
  19316. };
  19317. // Tests whether parsed token is a contextual keyword.
  19318. pp.isContextual = function (name) {
  19319. return this.match(types.name) && this.state.value === name;
  19320. };
  19321. // Consumes contextual keyword if possible.
  19322. pp.eatContextual = function (name) {
  19323. return this.state.value === name && this.eat(types.name);
  19324. };
  19325. // Asserts that following token is given contextual keyword.
  19326. pp.expectContextual = function (name, message) {
  19327. if (!this.eatContextual(name)) this.unexpected(null, message);
  19328. };
  19329. // Test whether a semicolon can be inserted at the current position.
  19330. pp.canInsertSemicolon = function () {
  19331. return this.match(types.eof) || this.match(types.braceR) || lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start));
  19332. };
  19333. // TODO
  19334. pp.isLineTerminator = function () {
  19335. return this.eat(types.semi) || this.canInsertSemicolon();
  19336. };
  19337. // Consume a semicolon, or, failing that, see if we are allowed to
  19338. // pretend that there is a semicolon at this position.
  19339. pp.semicolon = function () {
  19340. if (!this.isLineTerminator()) this.unexpected(null, types.semi);
  19341. };
  19342. // Expect a token of a given type. If found, consume it, otherwise,
  19343. // raise an unexpected token error at given pos.
  19344. pp.expect = function (type, pos) {
  19345. return this.eat(type) || this.unexpected(pos, type);
  19346. };
  19347. // Raise an unexpected token error. Can take the expected token type
  19348. // instead of a message string.
  19349. pp.unexpected = function (pos) {
  19350. var messageOrType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "Unexpected token";
  19351. if (messageOrType && (typeof messageOrType === "undefined" ? "undefined" : _typeof(messageOrType)) === "object" && messageOrType.label) {
  19352. messageOrType = "Unexpected token, expected " + messageOrType.label;
  19353. }
  19354. this.raise(pos != null ? pos : this.state.start, messageOrType);
  19355. };
  19356. /* eslint max-len: 0 */
  19357. var pp$1 = Parser.prototype;
  19358. // ### Statement parsing
  19359. // Parse a program. Initializes the parser, reads any number of
  19360. // statements, and wraps them in a Program node. Optionally takes a
  19361. // `program` argument. If present, the statements will be appended
  19362. // to its body instead of creating a new node.
  19363. pp$1.parseTopLevel = function (file, program) {
  19364. program.sourceType = this.options.sourceType;
  19365. this.parseBlockBody(program, true, true, types.eof);
  19366. file.program = this.finishNode(program, "Program");
  19367. file.comments = this.state.comments;
  19368. file.tokens = this.state.tokens;
  19369. return this.finishNode(file, "File");
  19370. };
  19371. var loopLabel = { kind: "loop" };
  19372. var switchLabel = { kind: "switch" };
  19373. // TODO
  19374. pp$1.stmtToDirective = function (stmt) {
  19375. var expr = stmt.expression;
  19376. var directiveLiteral = this.startNodeAt(expr.start, expr.loc.start);
  19377. var directive = this.startNodeAt(stmt.start, stmt.loc.start);
  19378. var raw = this.input.slice(expr.start, expr.end);
  19379. var val = directiveLiteral.value = raw.slice(1, -1); // remove quotes
  19380. this.addExtra(directiveLiteral, "raw", raw);
  19381. this.addExtra(directiveLiteral, "rawValue", val);
  19382. directive.value = this.finishNodeAt(directiveLiteral, "DirectiveLiteral", expr.end, expr.loc.end);
  19383. return this.finishNodeAt(directive, "Directive", stmt.end, stmt.loc.end);
  19384. };
  19385. // Parse a single statement.
  19386. //
  19387. // If expecting a statement and finding a slash operator, parse a
  19388. // regular expression literal. This is to handle cases like
  19389. // `if (foo) /blah/.exec(foo)`, where looking at the previous token
  19390. // does not help.
  19391. pp$1.parseStatement = function (declaration, topLevel) {
  19392. if (this.match(types.at)) {
  19393. this.parseDecorators(true);
  19394. }
  19395. var starttype = this.state.type;
  19396. var node = this.startNode();
  19397. // Most types of statements are recognized by the keyword they
  19398. // start with. Many are trivial to parse, some require a bit of
  19399. // complexity.
  19400. switch (starttype) {
  19401. case types._break:case types._continue:
  19402. return this.parseBreakContinueStatement(node, starttype.keyword);
  19403. case types._debugger:
  19404. return this.parseDebuggerStatement(node);
  19405. case types._do:
  19406. return this.parseDoStatement(node);
  19407. case types._for:
  19408. return this.parseForStatement(node);
  19409. case types._function:
  19410. if (!declaration) this.unexpected();
  19411. return this.parseFunctionStatement(node);
  19412. case types._class:
  19413. if (!declaration) this.unexpected();
  19414. return this.parseClass(node, true);
  19415. case types._if:
  19416. return this.parseIfStatement(node);
  19417. case types._return:
  19418. return this.parseReturnStatement(node);
  19419. case types._switch:
  19420. return this.parseSwitchStatement(node);
  19421. case types._throw:
  19422. return this.parseThrowStatement(node);
  19423. case types._try:
  19424. return this.parseTryStatement(node);
  19425. case types._let:
  19426. case types._const:
  19427. if (!declaration) this.unexpected(); // NOTE: falls through to _var
  19428. case types._var:
  19429. return this.parseVarStatement(node, starttype);
  19430. case types._while:
  19431. return this.parseWhileStatement(node);
  19432. case types._with:
  19433. return this.parseWithStatement(node);
  19434. case types.braceL:
  19435. return this.parseBlock();
  19436. case types.semi:
  19437. return this.parseEmptyStatement(node);
  19438. case types._export:
  19439. case types._import:
  19440. if (this.hasPlugin("dynamicImport") && this.lookahead().type === types.parenL) break;
  19441. if (!this.options.allowImportExportEverywhere) {
  19442. if (!topLevel) {
  19443. this.raise(this.state.start, "'import' and 'export' may only appear at the top level");
  19444. }
  19445. if (!this.inModule) {
  19446. this.raise(this.state.start, "'import' and 'export' may appear only with 'sourceType: \"module\"'");
  19447. }
  19448. }
  19449. return starttype === types._import ? this.parseImport(node) : this.parseExport(node);
  19450. case types.name:
  19451. if (this.state.value === "async") {
  19452. // peek ahead and see if next token is a function
  19453. var state = this.state.clone();
  19454. this.next();
  19455. if (this.match(types._function) && !this.canInsertSemicolon()) {
  19456. this.expect(types._function);
  19457. return this.parseFunction(node, true, false, true);
  19458. } else {
  19459. this.state = state;
  19460. }
  19461. }
  19462. }
  19463. // If the statement does not start with a statement keyword or a
  19464. // brace, it's an ExpressionStatement or LabeledStatement. We
  19465. // simply start parsing an expression, and afterwards, if the
  19466. // next token is a colon and the expression was a simple
  19467. // Identifier node, we switch to interpreting it as a label.
  19468. var maybeName = this.state.value;
  19469. var expr = this.parseExpression();
  19470. if (starttype === types.name && expr.type === "Identifier" && this.eat(types.colon)) {
  19471. return this.parseLabeledStatement(node, maybeName, expr);
  19472. } else {
  19473. return this.parseExpressionStatement(node, expr);
  19474. }
  19475. };
  19476. pp$1.takeDecorators = function (node) {
  19477. if (this.state.decorators.length) {
  19478. node.decorators = this.state.decorators;
  19479. this.state.decorators = [];
  19480. }
  19481. };
  19482. pp$1.parseDecorators = function (allowExport) {
  19483. while (this.match(types.at)) {
  19484. var decorator = this.parseDecorator();
  19485. this.state.decorators.push(decorator);
  19486. }
  19487. if (allowExport && this.match(types._export)) {
  19488. return;
  19489. }
  19490. if (!this.match(types._class)) {
  19491. this.raise(this.state.start, "Leading decorators must be attached to a class declaration");
  19492. }
  19493. };
  19494. pp$1.parseDecorator = function () {
  19495. if (!this.hasPlugin("decorators")) {
  19496. this.unexpected();
  19497. }
  19498. var node = this.startNode();
  19499. this.next();
  19500. node.expression = this.parseMaybeAssign();
  19501. return this.finishNode(node, "Decorator");
  19502. };
  19503. pp$1.parseBreakContinueStatement = function (node, keyword) {
  19504. var isBreak = keyword === "break";
  19505. this.next();
  19506. if (this.isLineTerminator()) {
  19507. node.label = null;
  19508. } else if (!this.match(types.name)) {
  19509. this.unexpected();
  19510. } else {
  19511. node.label = this.parseIdentifier();
  19512. this.semicolon();
  19513. }
  19514. // Verify that there is an actual destination to break or
  19515. // continue to.
  19516. var i = void 0;
  19517. for (i = 0; i < this.state.labels.length; ++i) {
  19518. var lab = this.state.labels[i];
  19519. if (node.label == null || lab.name === node.label.name) {
  19520. if (lab.kind != null && (isBreak || lab.kind === "loop")) break;
  19521. if (node.label && isBreak) break;
  19522. }
  19523. }
  19524. if (i === this.state.labels.length) this.raise(node.start, "Unsyntactic " + keyword);
  19525. return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement");
  19526. };
  19527. pp$1.parseDebuggerStatement = function (node) {
  19528. this.next();
  19529. this.semicolon();
  19530. return this.finishNode(node, "DebuggerStatement");
  19531. };
  19532. pp$1.parseDoStatement = function (node) {
  19533. this.next();
  19534. this.state.labels.push(loopLabel);
  19535. node.body = this.parseStatement(false);
  19536. this.state.labels.pop();
  19537. this.expect(types._while);
  19538. node.test = this.parseParenExpression();
  19539. this.eat(types.semi);
  19540. return this.finishNode(node, "DoWhileStatement");
  19541. };
  19542. // Disambiguating between a `for` and a `for`/`in` or `for`/`of`
  19543. // loop is non-trivial. Basically, we have to parse the init `var`
  19544. // statement or expression, disallowing the `in` operator (see
  19545. // the second parameter to `parseExpression`), and then check
  19546. // whether the next token is `in` or `of`. When there is no init
  19547. // part (semicolon immediately after the opening parenthesis), it
  19548. // is a regular `for` loop.
  19549. pp$1.parseForStatement = function (node) {
  19550. this.next();
  19551. this.state.labels.push(loopLabel);
  19552. var forAwait = false;
  19553. if (this.hasPlugin("asyncGenerators") && this.state.inAsync && this.isContextual("await")) {
  19554. forAwait = true;
  19555. this.next();
  19556. }
  19557. this.expect(types.parenL);
  19558. if (this.match(types.semi)) {
  19559. if (forAwait) {
  19560. this.unexpected();
  19561. }
  19562. return this.parseFor(node, null);
  19563. }
  19564. if (this.match(types._var) || this.match(types._let) || this.match(types._const)) {
  19565. var _init = this.startNode();
  19566. var varKind = this.state.type;
  19567. this.next();
  19568. this.parseVar(_init, true, varKind);
  19569. this.finishNode(_init, "VariableDeclaration");
  19570. if (this.match(types._in) || this.isContextual("of")) {
  19571. if (_init.declarations.length === 1 && !_init.declarations[0].init) {
  19572. return this.parseForIn(node, _init, forAwait);
  19573. }
  19574. }
  19575. if (forAwait) {
  19576. this.unexpected();
  19577. }
  19578. return this.parseFor(node, _init);
  19579. }
  19580. var refShorthandDefaultPos = { start: 0 };
  19581. var init = this.parseExpression(true, refShorthandDefaultPos);
  19582. if (this.match(types._in) || this.isContextual("of")) {
  19583. var description = this.isContextual("of") ? "for-of statement" : "for-in statement";
  19584. this.toAssignable(init, undefined, description);
  19585. this.checkLVal(init, undefined, undefined, description);
  19586. return this.parseForIn(node, init, forAwait);
  19587. } else if (refShorthandDefaultPos.start) {
  19588. this.unexpected(refShorthandDefaultPos.start);
  19589. }
  19590. if (forAwait) {
  19591. this.unexpected();
  19592. }
  19593. return this.parseFor(node, init);
  19594. };
  19595. pp$1.parseFunctionStatement = function (node) {
  19596. this.next();
  19597. return this.parseFunction(node, true);
  19598. };
  19599. pp$1.parseIfStatement = function (node) {
  19600. this.next();
  19601. node.test = this.parseParenExpression();
  19602. node.consequent = this.parseStatement(false);
  19603. node.alternate = this.eat(types._else) ? this.parseStatement(false) : null;
  19604. return this.finishNode(node, "IfStatement");
  19605. };
  19606. pp$1.parseReturnStatement = function (node) {
  19607. if (!this.state.inFunction && !this.options.allowReturnOutsideFunction) {
  19608. this.raise(this.state.start, "'return' outside of function");
  19609. }
  19610. this.next();
  19611. // In `return` (and `break`/`continue`), the keywords with
  19612. // optional arguments, we eagerly look for a semicolon or the
  19613. // possibility to insert one.
  19614. if (this.isLineTerminator()) {
  19615. node.argument = null;
  19616. } else {
  19617. node.argument = this.parseExpression();
  19618. this.semicolon();
  19619. }
  19620. return this.finishNode(node, "ReturnStatement");
  19621. };
  19622. pp$1.parseSwitchStatement = function (node) {
  19623. this.next();
  19624. node.discriminant = this.parseParenExpression();
  19625. node.cases = [];
  19626. this.expect(types.braceL);
  19627. this.state.labels.push(switchLabel);
  19628. // Statements under must be grouped (by label) in SwitchCase
  19629. // nodes. `cur` is used to keep the node that we are currently
  19630. // adding statements to.
  19631. var cur = void 0;
  19632. for (var sawDefault; !this.match(types.braceR);) {
  19633. if (this.match(types._case) || this.match(types._default)) {
  19634. var isCase = this.match(types._case);
  19635. if (cur) this.finishNode(cur, "SwitchCase");
  19636. node.cases.push(cur = this.startNode());
  19637. cur.consequent = [];
  19638. this.next();
  19639. if (isCase) {
  19640. cur.test = this.parseExpression();
  19641. } else {
  19642. if (sawDefault) this.raise(this.state.lastTokStart, "Multiple default clauses");
  19643. sawDefault = true;
  19644. cur.test = null;
  19645. }
  19646. this.expect(types.colon);
  19647. } else {
  19648. if (cur) {
  19649. cur.consequent.push(this.parseStatement(true));
  19650. } else {
  19651. this.unexpected();
  19652. }
  19653. }
  19654. }
  19655. if (cur) this.finishNode(cur, "SwitchCase");
  19656. this.next(); // Closing brace
  19657. this.state.labels.pop();
  19658. return this.finishNode(node, "SwitchStatement");
  19659. };
  19660. pp$1.parseThrowStatement = function (node) {
  19661. this.next();
  19662. if (lineBreak.test(this.input.slice(this.state.lastTokEnd, this.state.start))) this.raise(this.state.lastTokEnd, "Illegal newline after throw");
  19663. node.argument = this.parseExpression();
  19664. this.semicolon();
  19665. return this.finishNode(node, "ThrowStatement");
  19666. };
  19667. // Reused empty array added for node fields that are always empty.
  19668. var empty = [];
  19669. pp$1.parseTryStatement = function (node) {
  19670. this.next();
  19671. node.block = this.parseBlock();
  19672. node.handler = null;
  19673. if (this.match(types._catch)) {
  19674. var clause = this.startNode();
  19675. this.next();
  19676. this.expect(types.parenL);
  19677. clause.param = this.parseBindingAtom();
  19678. this.checkLVal(clause.param, true, Object.create(null), "catch clause");
  19679. this.expect(types.parenR);
  19680. clause.body = this.parseBlock();
  19681. node.handler = this.finishNode(clause, "CatchClause");
  19682. }
  19683. node.guardedHandlers = empty;
  19684. node.finalizer = this.eat(types._finally) ? this.parseBlock() : null;
  19685. if (!node.handler && !node.finalizer) {
  19686. this.raise(node.start, "Missing catch or finally clause");
  19687. }
  19688. return this.finishNode(node, "TryStatement");
  19689. };
  19690. pp$1.parseVarStatement = function (node, kind) {
  19691. this.next();
  19692. this.parseVar(node, false, kind);
  19693. this.semicolon();
  19694. return this.finishNode(node, "VariableDeclaration");
  19695. };
  19696. pp$1.parseWhileStatement = function (node) {
  19697. this.next();
  19698. node.test = this.parseParenExpression();
  19699. this.state.labels.push(loopLabel);
  19700. node.body = this.parseStatement(false);
  19701. this.state.labels.pop();
  19702. return this.finishNode(node, "WhileStatement");
  19703. };
  19704. pp$1.parseWithStatement = function (node) {
  19705. if (this.state.strict) this.raise(this.state.start, "'with' in strict mode");
  19706. this.next();
  19707. node.object = this.parseParenExpression();
  19708. node.body = this.parseStatement(false);
  19709. return this.finishNode(node, "WithStatement");
  19710. };
  19711. pp$1.parseEmptyStatement = function (node) {
  19712. this.next();
  19713. return this.finishNode(node, "EmptyStatement");
  19714. };
  19715. pp$1.parseLabeledStatement = function (node, maybeName, expr) {
  19716. for (var _iterator = this.state.labels, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
  19717. var _ref;
  19718. if (_isArray) {
  19719. if (_i >= _iterator.length) break;
  19720. _ref = _iterator[_i++];
  19721. } else {
  19722. _i = _iterator.next();
  19723. if (_i.done) break;
  19724. _ref = _i.value;
  19725. }
  19726. var _label = _ref;
  19727. if (_label.name === maybeName) {
  19728. this.raise(expr.start, "Label '" + maybeName + "' is already declared");
  19729. }
  19730. }
  19731. var kind = this.state.type.isLoop ? "loop" : this.match(types._switch) ? "switch" : null;
  19732. for (var i = this.state.labels.length - 1; i >= 0; i--) {
  19733. var label = this.state.labels[i];
  19734. if (label.statementStart === node.start) {
  19735. label.statementStart = this.state.start;
  19736. label.kind = kind;
  19737. } else {
  19738. break;
  19739. }
  19740. }
  19741. this.state.labels.push({ name: maybeName, kind: kind, statementStart: this.state.start });
  19742. node.body = this.parseStatement(true);
  19743. this.state.labels.pop();
  19744. node.label = expr;
  19745. return this.finishNode(node, "LabeledStatement");
  19746. };
  19747. pp$1.parseExpressionStatement = function (node, expr) {
  19748. node.expression = expr;
  19749. this.semicolon();
  19750. return this.finishNode(node, "ExpressionStatement");
  19751. };
  19752. // Parse a semicolon-enclosed block of statements, handling `"use
  19753. // strict"` declarations when `allowStrict` is true (used for
  19754. // function bodies).
  19755. pp$1.parseBlock = function (allowDirectives) {
  19756. var node = this.startNode();
  19757. this.expect(types.braceL);
  19758. this.parseBlockBody(node, allowDirectives, false, types.braceR);
  19759. return this.finishNode(node, "BlockStatement");
  19760. };
  19761. pp$1.isValidDirective = function (stmt) {
  19762. return stmt.type === "ExpressionStatement" && stmt.expression.type === "StringLiteral" && !stmt.expression.extra.parenthesized;
  19763. };
  19764. pp$1.parseBlockBody = function (node, allowDirectives, topLevel, end) {
  19765. node.body = [];
  19766. node.directives = [];
  19767. var parsedNonDirective = false;
  19768. var oldStrict = void 0;
  19769. var octalPosition = void 0;
  19770. while (!this.eat(end)) {
  19771. if (!parsedNonDirective && this.state.containsOctal && !octalPosition) {
  19772. octalPosition = this.state.octalPosition;
  19773. }
  19774. var stmt = this.parseStatement(true, topLevel);
  19775. if (allowDirectives && !parsedNonDirective && this.isValidDirective(stmt)) {
  19776. var directive = this.stmtToDirective(stmt);
  19777. node.directives.push(directive);
  19778. if (oldStrict === undefined && directive.value.value === "use strict") {
  19779. oldStrict = this.state.strict;
  19780. this.setStrict(true);
  19781. if (octalPosition) {
  19782. this.raise(octalPosition, "Octal literal in strict mode");
  19783. }
  19784. }
  19785. continue;
  19786. }
  19787. parsedNonDirective = true;
  19788. node.body.push(stmt);
  19789. }
  19790. if (oldStrict === false) {
  19791. this.setStrict(false);
  19792. }
  19793. };
  19794. // Parse a regular `for` loop. The disambiguation code in
  19795. // `parseStatement` will already have parsed the init statement or
  19796. // expression.
  19797. pp$1.parseFor = function (node, init) {
  19798. node.init = init;
  19799. this.expect(types.semi);
  19800. node.test = this.match(types.semi) ? null : this.parseExpression();
  19801. this.expect(types.semi);
  19802. node.update = this.match(types.parenR) ? null : this.parseExpression();
  19803. this.expect(types.parenR);
  19804. node.body = this.parseStatement(false);
  19805. this.state.labels.pop();
  19806. return this.finishNode(node, "ForStatement");
  19807. };
  19808. // Parse a `for`/`in` and `for`/`of` loop, which are almost
  19809. // same from parser's perspective.
  19810. pp$1.parseForIn = function (node, init, forAwait) {
  19811. var type = void 0;
  19812. if (forAwait) {
  19813. this.eatContextual("of");
  19814. type = "ForAwaitStatement";
  19815. } else {
  19816. type = this.match(types._in) ? "ForInStatement" : "ForOfStatement";
  19817. this.next();
  19818. }
  19819. node.left = init;
  19820. node.right = this.parseExpression();
  19821. this.expect(types.parenR);
  19822. node.body = this.parseStatement(false);
  19823. this.state.labels.pop();
  19824. return this.finishNode(node, type);
  19825. };
  19826. // Parse a list of variable declarations.
  19827. pp$1.parseVar = function (node, isFor, kind) {
  19828. node.declarations = [];
  19829. node.kind = kind.keyword;
  19830. for (;;) {
  19831. var decl = this.startNode();
  19832. this.parseVarHead(decl);
  19833. if (this.eat(types.eq)) {
  19834. decl.init = this.parseMaybeAssign(isFor);
  19835. } else if (kind === types._const && !(this.match(types._in) || this.isContextual("of"))) {
  19836. this.unexpected();
  19837. } else if (decl.id.type !== "Identifier" && !(isFor && (this.match(types._in) || this.isContextual("of")))) {
  19838. this.raise(this.state.lastTokEnd, "Complex binding patterns require an initialization value");
  19839. } else {
  19840. decl.init = null;
  19841. }
  19842. node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
  19843. if (!this.eat(types.comma)) break;
  19844. }
  19845. return node;
  19846. };
  19847. pp$1.parseVarHead = function (decl) {
  19848. decl.id = this.parseBindingAtom();
  19849. this.checkLVal(decl.id, true, undefined, "variable declaration");
  19850. };
  19851. // Parse a function declaration or literal (depending on the
  19852. // `isStatement` parameter).
  19853. pp$1.parseFunction = function (node, isStatement, allowExpressionBody, isAsync, optionalId) {
  19854. var oldInMethod = this.state.inMethod;
  19855. this.state.inMethod = false;
  19856. this.initFunction(node, isAsync);
  19857. if (this.match(types.star)) {
  19858. if (node.async && !this.hasPlugin("asyncGenerators")) {
  19859. this.unexpected();
  19860. } else {
  19861. node.generator = true;
  19862. this.next();
  19863. }
  19864. }
  19865. if (isStatement && !optionalId && !this.match(types.name) && !this.match(types._yield)) {
  19866. this.unexpected();
  19867. }
  19868. if (this.match(types.name) || this.match(types._yield)) {
  19869. node.id = this.parseBindingIdentifier();
  19870. }
  19871. this.parseFunctionParams(node);
  19872. this.parseFunctionBody(node, allowExpressionBody);
  19873. this.state.inMethod = oldInMethod;
  19874. return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression");
  19875. };
  19876. pp$1.parseFunctionParams = function (node) {
  19877. this.expect(types.parenL);
  19878. node.params = this.parseBindingList(types.parenR);
  19879. };
  19880. // Parse a class declaration or literal (depending on the
  19881. // `isStatement` parameter).
  19882. pp$1.parseClass = function (node, isStatement, optionalId) {
  19883. this.next();
  19884. this.takeDecorators(node);
  19885. this.parseClassId(node, isStatement, optionalId);
  19886. this.parseClassSuper(node);
  19887. this.parseClassBody(node);
  19888. return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression");
  19889. };
  19890. pp$1.isClassProperty = function () {
  19891. return this.match(types.eq) || this.match(types.semi) || this.match(types.braceR);
  19892. };
  19893. pp$1.isClassMethod = function () {
  19894. return this.match(types.parenL);
  19895. };
  19896. pp$1.isNonstaticConstructor = function (method) {
  19897. return !method.computed && !method.static && (method.key.name === "constructor" || // Identifier
  19898. method.key.value === "constructor" // Literal
  19899. );
  19900. };
  19901. pp$1.parseClassBody = function (node) {
  19902. // class bodies are implicitly strict
  19903. var oldStrict = this.state.strict;
  19904. this.state.strict = true;
  19905. var hadConstructorCall = false;
  19906. var hadConstructor = false;
  19907. var decorators = [];
  19908. var classBody = this.startNode();
  19909. classBody.body = [];
  19910. this.expect(types.braceL);
  19911. while (!this.eat(types.braceR)) {
  19912. if (this.eat(types.semi)) {
  19913. if (decorators.length > 0) {
  19914. this.raise(this.state.lastTokEnd, "Decorators must not be followed by a semicolon");
  19915. }
  19916. continue;
  19917. }
  19918. if (this.match(types.at)) {
  19919. decorators.push(this.parseDecorator());
  19920. continue;
  19921. }
  19922. var method = this.startNode();
  19923. // steal the decorators if there are any
  19924. if (decorators.length) {
  19925. method.decorators = decorators;
  19926. decorators = [];
  19927. }
  19928. method.static = false;
  19929. if (this.match(types.name) && this.state.value === "static") {
  19930. var key = this.parseIdentifier(true); // eats 'static'
  19931. if (this.isClassMethod()) {
  19932. // a method named 'static'
  19933. method.kind = "method";
  19934. method.computed = false;
  19935. method.key = key;
  19936. this.parseClassMethod(classBody, method, false, false);
  19937. continue;
  19938. } else if (this.isClassProperty()) {
  19939. // a property named 'static'
  19940. method.computed = false;
  19941. method.key = key;
  19942. classBody.body.push(this.parseClassProperty(method));
  19943. continue;
  19944. }
  19945. // otherwise something static
  19946. method.static = true;
  19947. }
  19948. if (this.eat(types.star)) {
  19949. // a generator
  19950. method.kind = "method";
  19951. this.parsePropertyName(method);
  19952. if (this.isNonstaticConstructor(method)) {
  19953. this.raise(method.key.start, "Constructor can't be a generator");
  19954. }
  19955. if (!method.computed && method.static && (method.key.name === "prototype" || method.key.value === "prototype")) {
  19956. this.raise(method.key.start, "Classes may not have static property named prototype");
  19957. }
  19958. this.parseClassMethod(classBody, method, true, false);
  19959. } else {
  19960. var isSimple = this.match(types.name);
  19961. var _key = this.parsePropertyName(method);
  19962. if (!method.computed && method.static && (method.key.name === "prototype" || method.key.value === "prototype")) {
  19963. this.raise(method.key.start, "Classes may not have static property named prototype");
  19964. }
  19965. if (this.isClassMethod()) {
  19966. // a normal method
  19967. if (this.isNonstaticConstructor(method)) {
  19968. if (hadConstructor) {
  19969. this.raise(_key.start, "Duplicate constructor in the same class");
  19970. } else if (method.decorators) {
  19971. this.raise(method.start, "You can't attach decorators to a class constructor");
  19972. }
  19973. hadConstructor = true;
  19974. method.kind = "constructor";
  19975. } else {
  19976. method.kind = "method";
  19977. }
  19978. this.parseClassMethod(classBody, method, false, false);
  19979. } else if (this.isClassProperty()) {
  19980. // a normal property
  19981. if (this.isNonstaticConstructor(method)) {
  19982. this.raise(method.key.start, "Classes may not have a non-static field named 'constructor'");
  19983. }
  19984. classBody.body.push(this.parseClassProperty(method));
  19985. } else if (isSimple && _key.name === "async" && !this.isLineTerminator()) {
  19986. // an async method
  19987. var isGenerator = this.hasPlugin("asyncGenerators") && this.eat(types.star);
  19988. method.kind = "method";
  19989. this.parsePropertyName(method);
  19990. if (this.isNonstaticConstructor(method)) {
  19991. this.raise(method.key.start, "Constructor can't be an async function");
  19992. }
  19993. this.parseClassMethod(classBody, method, isGenerator, true);
  19994. } else if (isSimple && (_key.name === "get" || _key.name === "set") && !(this.isLineTerminator() && this.match(types.star))) {
  19995. // `get\n*` is an uninitialized property named 'get' followed by a generator.
  19996. // a getter or setter
  19997. method.kind = _key.name;
  19998. this.parsePropertyName(method);
  19999. if (this.isNonstaticConstructor(method)) {
  20000. this.raise(method.key.start, "Constructor can't have get/set modifier");
  20001. }
  20002. this.parseClassMethod(classBody, method, false, false);
  20003. this.checkGetterSetterParamCount(method);
  20004. } else if (this.hasPlugin("classConstructorCall") && isSimple && _key.name === "call" && this.match(types.name) && this.state.value === "constructor") {
  20005. // a (deprecated) call constructor
  20006. if (hadConstructorCall) {
  20007. this.raise(method.start, "Duplicate constructor call in the same class");
  20008. } else if (method.decorators) {
  20009. this.raise(method.start, "You can't attach decorators to a class constructor");
  20010. }
  20011. hadConstructorCall = true;
  20012. method.kind = "constructorCall";
  20013. this.parsePropertyName(method); // consume "constructor" and make it the method's name
  20014. this.parseClassMethod(classBody, method, false, false);
  20015. } else if (this.isLineTerminator()) {
  20016. // an uninitialized class property (due to ASI, since we don't otherwise recognize the next token)
  20017. if (this.isNonstaticConstructor(method)) {
  20018. this.raise(method.key.start, "Classes may not have a non-static field named 'constructor'");
  20019. }
  20020. classBody.body.push(this.parseClassProperty(method));
  20021. } else {
  20022. this.unexpected();
  20023. }
  20024. }
  20025. }
  20026. if (decorators.length) {
  20027. this.raise(this.state.start, "You have trailing decorators with no method");
  20028. }
  20029. node.body = this.finishNode(classBody, "ClassBody");
  20030. this.state.strict = oldStrict;
  20031. };
  20032. pp$1.parseClassProperty = function (node) {
  20033. this.state.inClassProperty = true;
  20034. if (this.match(types.eq)) {
  20035. if (!this.hasPlugin("classProperties")) this.unexpected();
  20036. this.next();
  20037. node.value = this.parseMaybeAssign();
  20038. } else {
  20039. node.value = null;
  20040. }
  20041. this.semicolon();
  20042. this.state.inClassProperty = false;
  20043. return this.finishNode(node, "ClassProperty");
  20044. };
  20045. pp$1.parseClassMethod = function (classBody, method, isGenerator, isAsync) {
  20046. this.parseMethod(method, isGenerator, isAsync);
  20047. classBody.body.push(this.finishNode(method, "ClassMethod"));
  20048. };
  20049. pp$1.parseClassId = function (node, isStatement, optionalId) {
  20050. if (this.match(types.name)) {
  20051. node.id = this.parseIdentifier();
  20052. } else {
  20053. if (optionalId || !isStatement) {
  20054. node.id = null;
  20055. } else {
  20056. this.unexpected();
  20057. }
  20058. }
  20059. };
  20060. pp$1.parseClassSuper = function (node) {
  20061. node.superClass = this.eat(types._extends) ? this.parseExprSubscripts() : null;
  20062. };
  20063. // Parses module export declaration.
  20064. pp$1.parseExport = function (node) {
  20065. this.next();
  20066. // export * from '...'
  20067. if (this.match(types.star)) {
  20068. var specifier = this.startNode();
  20069. this.next();
  20070. if (this.hasPlugin("exportExtensions") && this.eatContextual("as")) {
  20071. specifier.exported = this.parseIdentifier();
  20072. node.specifiers = [this.finishNode(specifier, "ExportNamespaceSpecifier")];
  20073. this.parseExportSpecifiersMaybe(node);
  20074. this.parseExportFrom(node, true);
  20075. } else {
  20076. this.parseExportFrom(node, true);
  20077. return this.finishNode(node, "ExportAllDeclaration");
  20078. }
  20079. } else if (this.hasPlugin("exportExtensions") && this.isExportDefaultSpecifier()) {
  20080. var _specifier = this.startNode();
  20081. _specifier.exported = this.parseIdentifier(true);
  20082. node.specifiers = [this.finishNode(_specifier, "ExportDefaultSpecifier")];
  20083. if (this.match(types.comma) && this.lookahead().type === types.star) {
  20084. this.expect(types.comma);
  20085. var _specifier2 = this.startNode();
  20086. this.expect(types.star);
  20087. this.expectContextual("as");
  20088. _specifier2.exported = this.parseIdentifier();
  20089. node.specifiers.push(this.finishNode(_specifier2, "ExportNamespaceSpecifier"));
  20090. } else {
  20091. this.parseExportSpecifiersMaybe(node);
  20092. }
  20093. this.parseExportFrom(node, true);
  20094. } else if (this.eat(types._default)) {
  20095. // export default ...
  20096. var expr = this.startNode();
  20097. var needsSemi = false;
  20098. if (this.eat(types._function)) {
  20099. expr = this.parseFunction(expr, true, false, false, true);
  20100. } else if (this.match(types._class)) {
  20101. expr = this.parseClass(expr, true, true);
  20102. } else {
  20103. needsSemi = true;
  20104. expr = this.parseMaybeAssign();
  20105. }
  20106. node.declaration = expr;
  20107. if (needsSemi) this.semicolon();
  20108. this.checkExport(node, true, true);
  20109. return this.finishNode(node, "ExportDefaultDeclaration");
  20110. } else if (this.shouldParseExportDeclaration()) {
  20111. node.specifiers = [];
  20112. node.source = null;
  20113. node.declaration = this.parseExportDeclaration(node);
  20114. } else {
  20115. // export { x, y as z } [from '...']
  20116. node.declaration = null;
  20117. node.specifiers = this.parseExportSpecifiers();
  20118. this.parseExportFrom(node);
  20119. }
  20120. this.checkExport(node, true);
  20121. return this.finishNode(node, "ExportNamedDeclaration");
  20122. };
  20123. pp$1.parseExportDeclaration = function () {
  20124. return this.parseStatement(true);
  20125. };
  20126. pp$1.isExportDefaultSpecifier = function () {
  20127. if (this.match(types.name)) {
  20128. return this.state.value !== "async";
  20129. }
  20130. if (!this.match(types._default)) {
  20131. return false;
  20132. }
  20133. var lookahead = this.lookahead();
  20134. return lookahead.type === types.comma || lookahead.type === types.name && lookahead.value === "from";
  20135. };
  20136. pp$1.parseExportSpecifiersMaybe = function (node) {
  20137. if (this.eat(types.comma)) {
  20138. node.specifiers = node.specifiers.concat(this.parseExportSpecifiers());
  20139. }
  20140. };
  20141. pp$1.parseExportFrom = function (node, expect) {
  20142. if (this.eatContextual("from")) {
  20143. node.source = this.match(types.string) ? this.parseExprAtom() : this.unexpected();
  20144. this.checkExport(node);
  20145. } else {
  20146. if (expect) {
  20147. this.unexpected();
  20148. } else {
  20149. node.source = null;
  20150. }
  20151. }
  20152. this.semicolon();
  20153. };
  20154. pp$1.shouldParseExportDeclaration = function () {
  20155. 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");
  20156. };
  20157. pp$1.checkExport = function (node, checkNames, isDefault) {
  20158. if (checkNames) {
  20159. // Check for duplicate exports
  20160. if (isDefault) {
  20161. // Default exports
  20162. this.checkDuplicateExports(node, "default");
  20163. } else if (node.specifiers && node.specifiers.length) {
  20164. // Named exports
  20165. for (var _iterator2 = node.specifiers, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
  20166. var _ref2;
  20167. if (_isArray2) {
  20168. if (_i2 >= _iterator2.length) break;
  20169. _ref2 = _iterator2[_i2++];
  20170. } else {
  20171. _i2 = _iterator2.next();
  20172. if (_i2.done) break;
  20173. _ref2 = _i2.value;
  20174. }
  20175. var specifier = _ref2;
  20176. this.checkDuplicateExports(specifier, specifier.exported.name);
  20177. }
  20178. } else if (node.declaration) {
  20179. // Exported declarations
  20180. if (node.declaration.type === "FunctionDeclaration" || node.declaration.type === "ClassDeclaration") {
  20181. this.checkDuplicateExports(node, node.declaration.id.name);
  20182. } else if (node.declaration.type === "VariableDeclaration") {
  20183. for (var _iterator3 = node.declaration.declarations, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
  20184. var _ref3;
  20185. if (_isArray3) {
  20186. if (_i3 >= _iterator3.length) break;
  20187. _ref3 = _iterator3[_i3++];
  20188. } else {
  20189. _i3 = _iterator3.next();
  20190. if (_i3.done) break;
  20191. _ref3 = _i3.value;
  20192. }
  20193. var declaration = _ref3;
  20194. this.checkDeclaration(declaration.id);
  20195. }
  20196. }
  20197. }
  20198. }
  20199. if (this.state.decorators.length) {
  20200. var isClass = node.declaration && (node.declaration.type === "ClassDeclaration" || node.declaration.type === "ClassExpression");
  20201. if (!node.declaration || !isClass) {
  20202. this.raise(node.start, "You can only use decorators on an export when exporting a class");
  20203. }
  20204. this.takeDecorators(node.declaration);
  20205. }
  20206. };
  20207. pp$1.checkDeclaration = function (node) {
  20208. if (node.type === "ObjectPattern") {
  20209. for (var _iterator4 = node.properties, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) {
  20210. var _ref4;
  20211. if (_isArray4) {
  20212. if (_i4 >= _iterator4.length) break;
  20213. _ref4 = _iterator4[_i4++];
  20214. } else {
  20215. _i4 = _iterator4.next();
  20216. if (_i4.done) break;
  20217. _ref4 = _i4.value;
  20218. }
  20219. var prop = _ref4;
  20220. this.checkDeclaration(prop);
  20221. }
  20222. } else if (node.type === "ArrayPattern") {
  20223. for (var _iterator5 = node.elements, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) {
  20224. var _ref5;
  20225. if (_isArray5) {
  20226. if (_i5 >= _iterator5.length) break;
  20227. _ref5 = _iterator5[_i5++];
  20228. } else {
  20229. _i5 = _iterator5.next();
  20230. if (_i5.done) break;
  20231. _ref5 = _i5.value;
  20232. }
  20233. var elem = _ref5;
  20234. if (elem) {
  20235. this.checkDeclaration(elem);
  20236. }
  20237. }
  20238. } else if (node.type === "ObjectProperty") {
  20239. this.checkDeclaration(node.value);
  20240. } else if (node.type === "RestElement" || node.type === "RestProperty") {
  20241. this.checkDeclaration(node.argument);
  20242. } else if (node.type === "Identifier") {
  20243. this.checkDuplicateExports(node, node.name);
  20244. }
  20245. };
  20246. pp$1.checkDuplicateExports = function (node, name) {
  20247. if (this.state.exportedIdentifiers.indexOf(name) > -1) {
  20248. this.raiseDuplicateExportError(node, name);
  20249. }
  20250. this.state.exportedIdentifiers.push(name);
  20251. };
  20252. pp$1.raiseDuplicateExportError = function (node, name) {
  20253. this.raise(node.start, name === "default" ? "Only one default export allowed per module." : "`" + name + "` has already been exported. Exported identifiers must be unique.");
  20254. };
  20255. // Parses a comma-separated list of module exports.
  20256. pp$1.parseExportSpecifiers = function () {
  20257. var nodes = [];
  20258. var first = true;
  20259. var needsFrom = void 0;
  20260. // export { x, y as z } [from '...']
  20261. this.expect(types.braceL);
  20262. while (!this.eat(types.braceR)) {
  20263. if (first) {
  20264. first = false;
  20265. } else {
  20266. this.expect(types.comma);
  20267. if (this.eat(types.braceR)) break;
  20268. }
  20269. var isDefault = this.match(types._default);
  20270. if (isDefault && !needsFrom) needsFrom = true;
  20271. var node = this.startNode();
  20272. node.local = this.parseIdentifier(isDefault);
  20273. node.exported = this.eatContextual("as") ? this.parseIdentifier(true) : node.local.__clone();
  20274. nodes.push(this.finishNode(node, "ExportSpecifier"));
  20275. }
  20276. // https://github.com/ember-cli/ember-cli/pull/3739
  20277. if (needsFrom && !this.isContextual("from")) {
  20278. this.unexpected();
  20279. }
  20280. return nodes;
  20281. };
  20282. // Parses import declaration.
  20283. pp$1.parseImport = function (node) {
  20284. this.eat(types._import);
  20285. // import '...'
  20286. if (this.match(types.string)) {
  20287. node.specifiers = [];
  20288. node.source = this.parseExprAtom();
  20289. } else {
  20290. node.specifiers = [];
  20291. this.parseImportSpecifiers(node);
  20292. this.expectContextual("from");
  20293. node.source = this.match(types.string) ? this.parseExprAtom() : this.unexpected();
  20294. }
  20295. this.semicolon();
  20296. return this.finishNode(node, "ImportDeclaration");
  20297. };
  20298. // Parses a comma-separated list of module imports.
  20299. pp$1.parseImportSpecifiers = function (node) {
  20300. var first = true;
  20301. if (this.match(types.name)) {
  20302. // import defaultObj, { x, y as z } from '...'
  20303. var startPos = this.state.start;
  20304. var startLoc = this.state.startLoc;
  20305. node.specifiers.push(this.parseImportSpecifierDefault(this.parseIdentifier(), startPos, startLoc));
  20306. if (!this.eat(types.comma)) return;
  20307. }
  20308. if (this.match(types.star)) {
  20309. var specifier = this.startNode();
  20310. this.next();
  20311. this.expectContextual("as");
  20312. specifier.local = this.parseIdentifier();
  20313. this.checkLVal(specifier.local, true, undefined, "import namespace specifier");
  20314. node.specifiers.push(this.finishNode(specifier, "ImportNamespaceSpecifier"));
  20315. return;
  20316. }
  20317. this.expect(types.braceL);
  20318. while (!this.eat(types.braceR)) {
  20319. if (first) {
  20320. first = false;
  20321. } else {
  20322. // Detect an attempt to deep destructure
  20323. if (this.eat(types.colon)) {
  20324. this.unexpected(null, "ES2015 named imports do not destructure. Use another statement for destructuring after the import.");
  20325. }
  20326. this.expect(types.comma);
  20327. if (this.eat(types.braceR)) break;
  20328. }
  20329. this.parseImportSpecifier(node);
  20330. }
  20331. };
  20332. pp$1.parseImportSpecifier = function (node) {
  20333. var specifier = this.startNode();
  20334. specifier.imported = this.parseIdentifier(true);
  20335. if (this.eatContextual("as")) {
  20336. specifier.local = this.parseIdentifier();
  20337. } else {
  20338. this.checkReservedWord(specifier.imported.name, specifier.start, true, true);
  20339. specifier.local = specifier.imported.__clone();
  20340. }
  20341. this.checkLVal(specifier.local, true, undefined, "import specifier");
  20342. node.specifiers.push(this.finishNode(specifier, "ImportSpecifier"));
  20343. };
  20344. pp$1.parseImportSpecifierDefault = function (id, startPos, startLoc) {
  20345. var node = this.startNodeAt(startPos, startLoc);
  20346. node.local = id;
  20347. this.checkLVal(node.local, true, undefined, "default import specifier");
  20348. return this.finishNode(node, "ImportDefaultSpecifier");
  20349. };
  20350. var pp$2 = Parser.prototype;
  20351. // Convert existing expression atom to assignable pattern
  20352. // if possible.
  20353. pp$2.toAssignable = function (node, isBinding, contextDescription) {
  20354. if (node) {
  20355. switch (node.type) {
  20356. case "Identifier":
  20357. case "ObjectPattern":
  20358. case "ArrayPattern":
  20359. case "AssignmentPattern":
  20360. break;
  20361. case "ObjectExpression":
  20362. node.type = "ObjectPattern";
  20363. for (var _iterator = node.properties, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
  20364. var _ref;
  20365. if (_isArray) {
  20366. if (_i >= _iterator.length) break;
  20367. _ref = _iterator[_i++];
  20368. } else {
  20369. _i = _iterator.next();
  20370. if (_i.done) break;
  20371. _ref = _i.value;
  20372. }
  20373. var prop = _ref;
  20374. if (prop.type === "ObjectMethod") {
  20375. if (prop.kind === "get" || prop.kind === "set") {
  20376. this.raise(prop.key.start, "Object pattern can't contain getter or setter");
  20377. } else {
  20378. this.raise(prop.key.start, "Object pattern can't contain methods");
  20379. }
  20380. } else {
  20381. this.toAssignable(prop, isBinding, "object destructuring pattern");
  20382. }
  20383. }
  20384. break;
  20385. case "ObjectProperty":
  20386. this.toAssignable(node.value, isBinding, contextDescription);
  20387. break;
  20388. case "SpreadProperty":
  20389. node.type = "RestProperty";
  20390. var arg = node.argument;
  20391. this.toAssignable(arg, isBinding, contextDescription);
  20392. break;
  20393. case "ArrayExpression":
  20394. node.type = "ArrayPattern";
  20395. this.toAssignableList(node.elements, isBinding, contextDescription);
  20396. break;
  20397. case "AssignmentExpression":
  20398. if (node.operator === "=") {
  20399. node.type = "AssignmentPattern";
  20400. delete node.operator;
  20401. } else {
  20402. this.raise(node.left.end, "Only '=' operator can be used for specifying default value.");
  20403. }
  20404. break;
  20405. case "MemberExpression":
  20406. if (!isBinding) break;
  20407. default:
  20408. {
  20409. var message = "Invalid left-hand side" + (contextDescription ? " in " + contextDescription : /* istanbul ignore next */"expression");
  20410. this.raise(node.start, message);
  20411. }
  20412. }
  20413. }
  20414. return node;
  20415. };
  20416. // Convert list of expression atoms to binding list.
  20417. pp$2.toAssignableList = function (exprList, isBinding, contextDescription) {
  20418. var end = exprList.length;
  20419. if (end) {
  20420. var last = exprList[end - 1];
  20421. if (last && last.type === "RestElement") {
  20422. --end;
  20423. } else if (last && last.type === "SpreadElement") {
  20424. last.type = "RestElement";
  20425. var arg = last.argument;
  20426. this.toAssignable(arg, isBinding, contextDescription);
  20427. if (arg.type !== "Identifier" && arg.type !== "MemberExpression" && arg.type !== "ArrayPattern") {
  20428. this.unexpected(arg.start);
  20429. }
  20430. --end;
  20431. }
  20432. }
  20433. for (var i = 0; i < end; i++) {
  20434. var elt = exprList[i];
  20435. if (elt) this.toAssignable(elt, isBinding, contextDescription);
  20436. }
  20437. return exprList;
  20438. };
  20439. // Convert list of expression atoms to a list of
  20440. pp$2.toReferencedList = function (exprList) {
  20441. return exprList;
  20442. };
  20443. // Parses spread element.
  20444. pp$2.parseSpread = function (refShorthandDefaultPos) {
  20445. var node = this.startNode();
  20446. this.next();
  20447. node.argument = this.parseMaybeAssign(false, refShorthandDefaultPos);
  20448. return this.finishNode(node, "SpreadElement");
  20449. };
  20450. pp$2.parseRest = function () {
  20451. var node = this.startNode();
  20452. this.next();
  20453. node.argument = this.parseBindingIdentifier();
  20454. return this.finishNode(node, "RestElement");
  20455. };
  20456. pp$2.shouldAllowYieldIdentifier = function () {
  20457. return this.match(types._yield) && !this.state.strict && !this.state.inGenerator;
  20458. };
  20459. pp$2.parseBindingIdentifier = function () {
  20460. return this.parseIdentifier(this.shouldAllowYieldIdentifier());
  20461. };
  20462. // Parses lvalue (assignable) atom.
  20463. pp$2.parseBindingAtom = function () {
  20464. switch (this.state.type) {
  20465. case types._yield:
  20466. if (this.state.strict || this.state.inGenerator) this.unexpected();
  20467. // fall-through
  20468. case types.name:
  20469. return this.parseIdentifier(true);
  20470. case types.bracketL:
  20471. var node = this.startNode();
  20472. this.next();
  20473. node.elements = this.parseBindingList(types.bracketR, true);
  20474. return this.finishNode(node, "ArrayPattern");
  20475. case types.braceL:
  20476. return this.parseObj(true);
  20477. default:
  20478. this.unexpected();
  20479. }
  20480. };
  20481. pp$2.parseBindingList = function (close, allowEmpty) {
  20482. var elts = [];
  20483. var first = true;
  20484. while (!this.eat(close)) {
  20485. if (first) {
  20486. first = false;
  20487. } else {
  20488. this.expect(types.comma);
  20489. }
  20490. if (allowEmpty && this.match(types.comma)) {
  20491. elts.push(null);
  20492. } else if (this.eat(close)) {
  20493. break;
  20494. } else if (this.match(types.ellipsis)) {
  20495. elts.push(this.parseAssignableListItemTypes(this.parseRest()));
  20496. this.expect(close);
  20497. break;
  20498. } else {
  20499. var decorators = [];
  20500. while (this.match(types.at)) {
  20501. decorators.push(this.parseDecorator());
  20502. }
  20503. var left = this.parseMaybeDefault();
  20504. if (decorators.length) {
  20505. left.decorators = decorators;
  20506. }
  20507. this.parseAssignableListItemTypes(left);
  20508. elts.push(this.parseMaybeDefault(left.start, left.loc.start, left));
  20509. }
  20510. }
  20511. return elts;
  20512. };
  20513. pp$2.parseAssignableListItemTypes = function (param) {
  20514. return param;
  20515. };
  20516. // Parses assignment pattern around given atom if possible.
  20517. pp$2.parseMaybeDefault = function (startPos, startLoc, left) {
  20518. startLoc = startLoc || this.state.startLoc;
  20519. startPos = startPos || this.state.start;
  20520. left = left || this.parseBindingAtom();
  20521. if (!this.eat(types.eq)) return left;
  20522. var node = this.startNodeAt(startPos, startLoc);
  20523. node.left = left;
  20524. node.right = this.parseMaybeAssign();
  20525. return this.finishNode(node, "AssignmentPattern");
  20526. };
  20527. // Verify that a node is an lval — something that can be assigned
  20528. // to.
  20529. pp$2.checkLVal = function (expr, isBinding, checkClashes, contextDescription) {
  20530. switch (expr.type) {
  20531. case "Identifier":
  20532. this.checkReservedWord(expr.name, expr.start, false, true);
  20533. if (checkClashes) {
  20534. // we need to prefix this with an underscore for the cases where we have a key of
  20535. // `__proto__`. there's a bug in old V8 where the following wouldn't work:
  20536. //
  20537. // > var obj = Object.create(null);
  20538. // undefined
  20539. // > obj.__proto__
  20540. // null
  20541. // > obj.__proto__ = true;
  20542. // true
  20543. // > obj.__proto__
  20544. // null
  20545. var key = "_" + expr.name;
  20546. if (checkClashes[key]) {
  20547. this.raise(expr.start, "Argument name clash in strict mode");
  20548. } else {
  20549. checkClashes[key] = true;
  20550. }
  20551. }
  20552. break;
  20553. case "MemberExpression":
  20554. if (isBinding) this.raise(expr.start, (isBinding ? "Binding" : "Assigning to") + " member expression");
  20555. break;
  20556. case "ObjectPattern":
  20557. for (var _iterator2 = expr.properties, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
  20558. var _ref2;
  20559. if (_isArray2) {
  20560. if (_i2 >= _iterator2.length) break;
  20561. _ref2 = _iterator2[_i2++];
  20562. } else {
  20563. _i2 = _iterator2.next();
  20564. if (_i2.done) break;
  20565. _ref2 = _i2.value;
  20566. }
  20567. var prop = _ref2;
  20568. if (prop.type === "ObjectProperty") prop = prop.value;
  20569. this.checkLVal(prop, isBinding, checkClashes, "object destructuring pattern");
  20570. }
  20571. break;
  20572. case "ArrayPattern":
  20573. for (var _iterator3 = expr.elements, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
  20574. var _ref3;
  20575. if (_isArray3) {
  20576. if (_i3 >= _iterator3.length) break;
  20577. _ref3 = _iterator3[_i3++];
  20578. } else {
  20579. _i3 = _iterator3.next();
  20580. if (_i3.done) break;
  20581. _ref3 = _i3.value;
  20582. }
  20583. var elem = _ref3;
  20584. if (elem) this.checkLVal(elem, isBinding, checkClashes, "array destructuring pattern");
  20585. }
  20586. break;
  20587. case "AssignmentPattern":
  20588. this.checkLVal(expr.left, isBinding, checkClashes, "assignment pattern");
  20589. break;
  20590. case "RestProperty":
  20591. this.checkLVal(expr.argument, isBinding, checkClashes, "rest property");
  20592. break;
  20593. case "RestElement":
  20594. this.checkLVal(expr.argument, isBinding, checkClashes, "rest element");
  20595. break;
  20596. default:
  20597. {
  20598. var message = (isBinding ? /* istanbul ignore next */"Binding invalid" : "Invalid") + " left-hand side" + (contextDescription ? " in " + contextDescription : /* istanbul ignore next */"expression");
  20599. this.raise(expr.start, message);
  20600. }
  20601. }
  20602. };
  20603. /* eslint max-len: 0 */
  20604. // A recursive descent parser operates by defining functions for all
  20605. // syntactic elements, and recursively calling those, each function
  20606. // advancing the input stream and returning an AST node. Precedence
  20607. // of constructs (for example, the fact that `!x[1]` means `!(x[1])`
  20608. // instead of `(!x)[1]` is handled by the fact that the parser
  20609. // function that parses unary prefix operators is called first, and
  20610. // in turn calls the function that parses `[]` subscripts — that
  20611. // way, it'll receive the node for `x[1]` already parsed, and wraps
  20612. // *that* in the unary operator node.
  20613. //
  20614. // Acorn uses an [operator precedence parser][opp] to handle binary
  20615. // operator precedence, because it is much more compact than using
  20616. // the technique outlined above, which uses different, nesting
  20617. // functions to specify precedence, for all of the ten binary
  20618. // precedence levels that JavaScript defines.
  20619. //
  20620. // [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser
  20621. var pp$3 = Parser.prototype;
  20622. // Check if property name clashes with already added.
  20623. // Object/class getters and setters are not allowed to clash —
  20624. // either with each other or with an init property — and in
  20625. // strict mode, init properties are also not allowed to be repeated.
  20626. pp$3.checkPropClash = function (prop, propHash) {
  20627. if (prop.computed || prop.kind) return;
  20628. var key = prop.key;
  20629. // It is either an Identifier or a String/NumericLiteral
  20630. var name = key.type === "Identifier" ? key.name : String(key.value);
  20631. if (name === "__proto__") {
  20632. if (propHash.proto) this.raise(key.start, "Redefinition of __proto__ property");
  20633. propHash.proto = true;
  20634. }
  20635. };
  20636. // Convenience method to parse an Expression only
  20637. pp$3.getExpression = function () {
  20638. this.nextToken();
  20639. var expr = this.parseExpression();
  20640. if (!this.match(types.eof)) {
  20641. this.unexpected();
  20642. }
  20643. return expr;
  20644. };
  20645. // ### Expression parsing
  20646. // These nest, from the most general expression type at the top to
  20647. // 'atomic', nondivisible expression types at the bottom. Most of
  20648. // the functions will simply let the function (s) below them parse,
  20649. // and, *if* the syntactic construct they handle is present, wrap
  20650. // the AST node that the inner parser gave them in another node.
  20651. // Parse a full expression. The optional arguments are used to
  20652. // forbid the `in` operator (in for loops initialization expressions)
  20653. // and provide reference for storing '=' operator inside shorthand
  20654. // property assignment in contexts where both object expression
  20655. // and object pattern might appear (so it's possible to raise
  20656. // delayed syntax error at correct position).
  20657. pp$3.parseExpression = function (noIn, refShorthandDefaultPos) {
  20658. var startPos = this.state.start;
  20659. var startLoc = this.state.startLoc;
  20660. var expr = this.parseMaybeAssign(noIn, refShorthandDefaultPos);
  20661. if (this.match(types.comma)) {
  20662. var node = this.startNodeAt(startPos, startLoc);
  20663. node.expressions = [expr];
  20664. while (this.eat(types.comma)) {
  20665. node.expressions.push(this.parseMaybeAssign(noIn, refShorthandDefaultPos));
  20666. }
  20667. this.toReferencedList(node.expressions);
  20668. return this.finishNode(node, "SequenceExpression");
  20669. }
  20670. return expr;
  20671. };
  20672. // Parse an assignment expression. This includes applications of
  20673. // operators like `+=`.
  20674. pp$3.parseMaybeAssign = function (noIn, refShorthandDefaultPos, afterLeftParse, refNeedsArrowPos) {
  20675. var startPos = this.state.start;
  20676. var startLoc = this.state.startLoc;
  20677. if (this.match(types._yield) && this.state.inGenerator) {
  20678. var _left = this.parseYield();
  20679. if (afterLeftParse) _left = afterLeftParse.call(this, _left, startPos, startLoc);
  20680. return _left;
  20681. }
  20682. var failOnShorthandAssign = void 0;
  20683. if (refShorthandDefaultPos) {
  20684. failOnShorthandAssign = false;
  20685. } else {
  20686. refShorthandDefaultPos = { start: 0 };
  20687. failOnShorthandAssign = true;
  20688. }
  20689. if (this.match(types.parenL) || this.match(types.name)) {
  20690. this.state.potentialArrowAt = this.state.start;
  20691. }
  20692. var left = this.parseMaybeConditional(noIn, refShorthandDefaultPos, refNeedsArrowPos);
  20693. if (afterLeftParse) left = afterLeftParse.call(this, left, startPos, startLoc);
  20694. if (this.state.type.isAssign) {
  20695. var node = this.startNodeAt(startPos, startLoc);
  20696. node.operator = this.state.value;
  20697. node.left = this.match(types.eq) ? this.toAssignable(left, undefined, "assignment expression") : left;
  20698. refShorthandDefaultPos.start = 0; // reset because shorthand default was used correctly
  20699. this.checkLVal(left, undefined, undefined, "assignment expression");
  20700. if (left.extra && left.extra.parenthesized) {
  20701. var errorMsg = void 0;
  20702. if (left.type === "ObjectPattern") {
  20703. errorMsg = "`({a}) = 0` use `({a} = 0)`";
  20704. } else if (left.type === "ArrayPattern") {
  20705. errorMsg = "`([a]) = 0` use `([a] = 0)`";
  20706. }
  20707. if (errorMsg) {
  20708. this.raise(left.start, "You're trying to assign to a parenthesized expression, eg. instead of " + errorMsg);
  20709. }
  20710. }
  20711. this.next();
  20712. node.right = this.parseMaybeAssign(noIn);
  20713. return this.finishNode(node, "AssignmentExpression");
  20714. } else if (failOnShorthandAssign && refShorthandDefaultPos.start) {
  20715. this.unexpected(refShorthandDefaultPos.start);
  20716. }
  20717. return left;
  20718. };
  20719. // Parse a ternary conditional (`?:`) operator.
  20720. pp$3.parseMaybeConditional = function (noIn, refShorthandDefaultPos, refNeedsArrowPos) {
  20721. var startPos = this.state.start;
  20722. var startLoc = this.state.startLoc;
  20723. var expr = this.parseExprOps(noIn, refShorthandDefaultPos);
  20724. if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr;
  20725. return this.parseConditional(expr, noIn, startPos, startLoc, refNeedsArrowPos);
  20726. };
  20727. pp$3.parseConditional = function (expr, noIn, startPos, startLoc) {
  20728. if (this.eat(types.question)) {
  20729. var node = this.startNodeAt(startPos, startLoc);
  20730. node.test = expr;
  20731. node.consequent = this.parseMaybeAssign();
  20732. this.expect(types.colon);
  20733. node.alternate = this.parseMaybeAssign(noIn);
  20734. return this.finishNode(node, "ConditionalExpression");
  20735. }
  20736. return expr;
  20737. };
  20738. // Start the precedence parser.
  20739. pp$3.parseExprOps = function (noIn, refShorthandDefaultPos) {
  20740. var startPos = this.state.start;
  20741. var startLoc = this.state.startLoc;
  20742. var expr = this.parseMaybeUnary(refShorthandDefaultPos);
  20743. if (refShorthandDefaultPos && refShorthandDefaultPos.start) {
  20744. return expr;
  20745. } else {
  20746. return this.parseExprOp(expr, startPos, startLoc, -1, noIn);
  20747. }
  20748. };
  20749. // Parse binary operators with the operator precedence parsing
  20750. // algorithm. `left` is the left-hand side of the operator.
  20751. // `minPrec` provides context that allows the function to stop and
  20752. // defer further parser to one of its callers when it encounters an
  20753. // operator that has a lower precedence than the set it is parsing.
  20754. pp$3.parseExprOp = function (left, leftStartPos, leftStartLoc, minPrec, noIn) {
  20755. var prec = this.state.type.binop;
  20756. if (prec != null && (!noIn || !this.match(types._in))) {
  20757. if (prec > minPrec) {
  20758. var node = this.startNodeAt(leftStartPos, leftStartLoc);
  20759. node.left = left;
  20760. node.operator = this.state.value;
  20761. if (node.operator === "**" && left.type === "UnaryExpression" && left.extra && !left.extra.parenthesizedArgument && !left.extra.parenthesized) {
  20762. this.raise(left.argument.start, "Illegal expression. Wrap left hand side or entire exponentiation in parentheses.");
  20763. }
  20764. var op = this.state.type;
  20765. this.next();
  20766. var startPos = this.state.start;
  20767. var startLoc = this.state.startLoc;
  20768. node.right = this.parseExprOp(this.parseMaybeUnary(), startPos, startLoc, op.rightAssociative ? prec - 1 : prec, noIn);
  20769. this.finishNode(node, op === types.logicalOR || op === types.logicalAND ? "LogicalExpression" : "BinaryExpression");
  20770. return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn);
  20771. }
  20772. }
  20773. return left;
  20774. };
  20775. // Parse unary operators, both prefix and postfix.
  20776. pp$3.parseMaybeUnary = function (refShorthandDefaultPos) {
  20777. if (this.state.type.prefix) {
  20778. var node = this.startNode();
  20779. var update = this.match(types.incDec);
  20780. node.operator = this.state.value;
  20781. node.prefix = true;
  20782. this.next();
  20783. var argType = this.state.type;
  20784. node.argument = this.parseMaybeUnary();
  20785. this.addExtra(node, "parenthesizedArgument", argType === types.parenL && (!node.argument.extra || !node.argument.extra.parenthesized));
  20786. if (refShorthandDefaultPos && refShorthandDefaultPos.start) {
  20787. this.unexpected(refShorthandDefaultPos.start);
  20788. }
  20789. if (update) {
  20790. this.checkLVal(node.argument, undefined, undefined, "prefix operation");
  20791. } else if (this.state.strict && node.operator === "delete" && node.argument.type === "Identifier") {
  20792. this.raise(node.start, "Deleting local variable in strict mode");
  20793. }
  20794. return this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression");
  20795. }
  20796. var startPos = this.state.start;
  20797. var startLoc = this.state.startLoc;
  20798. var expr = this.parseExprSubscripts(refShorthandDefaultPos);
  20799. if (refShorthandDefaultPos && refShorthandDefaultPos.start) return expr;
  20800. while (this.state.type.postfix && !this.canInsertSemicolon()) {
  20801. var _node = this.startNodeAt(startPos, startLoc);
  20802. _node.operator = this.state.value;
  20803. _node.prefix = false;
  20804. _node.argument = expr;
  20805. this.checkLVal(expr, undefined, undefined, "postfix operation");
  20806. this.next();
  20807. expr = this.finishNode(_node, "UpdateExpression");
  20808. }
  20809. return expr;
  20810. };
  20811. // Parse call, dot, and `[]`-subscript expressions.
  20812. pp$3.parseExprSubscripts = function (refShorthandDefaultPos) {
  20813. var startPos = this.state.start;
  20814. var startLoc = this.state.startLoc;
  20815. var potentialArrowAt = this.state.potentialArrowAt;
  20816. var expr = this.parseExprAtom(refShorthandDefaultPos);
  20817. if (expr.type === "ArrowFunctionExpression" && expr.start === potentialArrowAt) {
  20818. return expr;
  20819. }
  20820. if (refShorthandDefaultPos && refShorthandDefaultPos.start) {
  20821. return expr;
  20822. }
  20823. return this.parseSubscripts(expr, startPos, startLoc);
  20824. };
  20825. pp$3.parseSubscripts = function (base, startPos, startLoc, noCalls) {
  20826. for (;;) {
  20827. if (!noCalls && this.eat(types.doubleColon)) {
  20828. var node = this.startNodeAt(startPos, startLoc);
  20829. node.object = base;
  20830. node.callee = this.parseNoCallExpr();
  20831. return this.parseSubscripts(this.finishNode(node, "BindExpression"), startPos, startLoc, noCalls);
  20832. } else if (this.eat(types.dot)) {
  20833. var _node2 = this.startNodeAt(startPos, startLoc);
  20834. _node2.object = base;
  20835. _node2.property = this.parseIdentifier(true);
  20836. _node2.computed = false;
  20837. base = this.finishNode(_node2, "MemberExpression");
  20838. } else if (this.eat(types.bracketL)) {
  20839. var _node3 = this.startNodeAt(startPos, startLoc);
  20840. _node3.object = base;
  20841. _node3.property = this.parseExpression();
  20842. _node3.computed = true;
  20843. this.expect(types.bracketR);
  20844. base = this.finishNode(_node3, "MemberExpression");
  20845. } else if (!noCalls && this.match(types.parenL)) {
  20846. var possibleAsync = this.state.potentialArrowAt === base.start && base.type === "Identifier" && base.name === "async" && !this.canInsertSemicolon();
  20847. this.next();
  20848. var _node4 = this.startNodeAt(startPos, startLoc);
  20849. _node4.callee = base;
  20850. _node4.arguments = this.parseCallExpressionArguments(types.parenR, possibleAsync);
  20851. if (_node4.callee.type === "Import" && _node4.arguments.length !== 1) {
  20852. this.raise(_node4.start, "import() requires exactly one argument");
  20853. }
  20854. base = this.finishNode(_node4, "CallExpression");
  20855. if (possibleAsync && this.shouldParseAsyncArrow()) {
  20856. return this.parseAsyncArrowFromCallExpression(this.startNodeAt(startPos, startLoc), _node4);
  20857. } else {
  20858. this.toReferencedList(_node4.arguments);
  20859. }
  20860. } else if (this.match(types.backQuote)) {
  20861. var _node5 = this.startNodeAt(startPos, startLoc);
  20862. _node5.tag = base;
  20863. _node5.quasi = this.parseTemplate(true);
  20864. base = this.finishNode(_node5, "TaggedTemplateExpression");
  20865. } else {
  20866. return base;
  20867. }
  20868. }
  20869. };
  20870. pp$3.parseCallExpressionArguments = function (close, possibleAsyncArrow) {
  20871. var elts = [];
  20872. var innerParenStart = void 0;
  20873. var first = true;
  20874. while (!this.eat(close)) {
  20875. if (first) {
  20876. first = false;
  20877. } else {
  20878. this.expect(types.comma);
  20879. if (this.eat(close)) break;
  20880. }
  20881. // we need to make sure that if this is an async arrow functions, that we don't allow inner parens inside the params
  20882. if (this.match(types.parenL) && !innerParenStart) {
  20883. innerParenStart = this.state.start;
  20884. }
  20885. elts.push(this.parseExprListItem(false, possibleAsyncArrow ? { start: 0 } : undefined, possibleAsyncArrow ? { start: 0 } : undefined));
  20886. }
  20887. // we found an async arrow function so let's not allow any inner parens
  20888. if (possibleAsyncArrow && innerParenStart && this.shouldParseAsyncArrow()) {
  20889. this.unexpected();
  20890. }
  20891. return elts;
  20892. };
  20893. pp$3.shouldParseAsyncArrow = function () {
  20894. return this.match(types.arrow);
  20895. };
  20896. pp$3.parseAsyncArrowFromCallExpression = function (node, call) {
  20897. this.expect(types.arrow);
  20898. return this.parseArrowExpression(node, call.arguments, true);
  20899. };
  20900. // Parse a no-call expression (like argument of `new` or `::` operators).
  20901. pp$3.parseNoCallExpr = function () {
  20902. var startPos = this.state.start;
  20903. var startLoc = this.state.startLoc;
  20904. return this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true);
  20905. };
  20906. // Parse an atomic expression — either a single token that is an
  20907. // expression, an expression started by a keyword like `function` or
  20908. // `new`, or an expression wrapped in punctuation like `()`, `[]`,
  20909. // or `{}`.
  20910. pp$3.parseExprAtom = function (refShorthandDefaultPos) {
  20911. var canBeArrow = this.state.potentialArrowAt === this.state.start;
  20912. var node = void 0;
  20913. switch (this.state.type) {
  20914. case types._super:
  20915. if (!this.state.inMethod && !this.state.inClassProperty && !this.options.allowSuperOutsideMethod) {
  20916. this.raise(this.state.start, "'super' outside of function or class");
  20917. }
  20918. node = this.startNode();
  20919. this.next();
  20920. if (!this.match(types.parenL) && !this.match(types.bracketL) && !this.match(types.dot)) {
  20921. this.unexpected();
  20922. }
  20923. if (this.match(types.parenL) && this.state.inMethod !== "constructor" && !this.options.allowSuperOutsideMethod) {
  20924. this.raise(node.start, "super() outside of class constructor");
  20925. }
  20926. return this.finishNode(node, "Super");
  20927. case types._import:
  20928. if (!this.hasPlugin("dynamicImport")) this.unexpected();
  20929. node = this.startNode();
  20930. this.next();
  20931. if (!this.match(types.parenL)) {
  20932. this.unexpected(null, types.parenL);
  20933. }
  20934. return this.finishNode(node, "Import");
  20935. case types._this:
  20936. node = this.startNode();
  20937. this.next();
  20938. return this.finishNode(node, "ThisExpression");
  20939. case types._yield:
  20940. if (this.state.inGenerator) this.unexpected();
  20941. case types.name:
  20942. node = this.startNode();
  20943. var allowAwait = this.state.value === "await" && this.state.inAsync;
  20944. var allowYield = this.shouldAllowYieldIdentifier();
  20945. var id = this.parseIdentifier(allowAwait || allowYield);
  20946. if (id.name === "await") {
  20947. if (this.state.inAsync || this.inModule) {
  20948. return this.parseAwait(node);
  20949. }
  20950. } else if (id.name === "async" && this.match(types._function) && !this.canInsertSemicolon()) {
  20951. this.next();
  20952. return this.parseFunction(node, false, false, true);
  20953. } else if (canBeArrow && id.name === "async" && this.match(types.name)) {
  20954. var params = [this.parseIdentifier()];
  20955. this.expect(types.arrow);
  20956. // let foo = bar => {};
  20957. return this.parseArrowExpression(node, params, true);
  20958. }
  20959. if (canBeArrow && !this.canInsertSemicolon() && this.eat(types.arrow)) {
  20960. return this.parseArrowExpression(node, [id]);
  20961. }
  20962. return id;
  20963. case types._do:
  20964. if (this.hasPlugin("doExpressions")) {
  20965. var _node6 = this.startNode();
  20966. this.next();
  20967. var oldInFunction = this.state.inFunction;
  20968. var oldLabels = this.state.labels;
  20969. this.state.labels = [];
  20970. this.state.inFunction = false;
  20971. _node6.body = this.parseBlock(false, true);
  20972. this.state.inFunction = oldInFunction;
  20973. this.state.labels = oldLabels;
  20974. return this.finishNode(_node6, "DoExpression");
  20975. }
  20976. case types.regexp:
  20977. var value = this.state.value;
  20978. node = this.parseLiteral(value.value, "RegExpLiteral");
  20979. node.pattern = value.pattern;
  20980. node.flags = value.flags;
  20981. return node;
  20982. case types.num:
  20983. return this.parseLiteral(this.state.value, "NumericLiteral");
  20984. case types.string:
  20985. return this.parseLiteral(this.state.value, "StringLiteral");
  20986. case types._null:
  20987. node = this.startNode();
  20988. this.next();
  20989. return this.finishNode(node, "NullLiteral");
  20990. case types._true:case types._false:
  20991. node = this.startNode();
  20992. node.value = this.match(types._true);
  20993. this.next();
  20994. return this.finishNode(node, "BooleanLiteral");
  20995. case types.parenL:
  20996. return this.parseParenAndDistinguishExpression(null, null, canBeArrow);
  20997. case types.bracketL:
  20998. node = this.startNode();
  20999. this.next();
  21000. node.elements = this.parseExprList(types.bracketR, true, refShorthandDefaultPos);
  21001. this.toReferencedList(node.elements);
  21002. return this.finishNode(node, "ArrayExpression");
  21003. case types.braceL:
  21004. return this.parseObj(false, refShorthandDefaultPos);
  21005. case types._function:
  21006. return this.parseFunctionExpression();
  21007. case types.at:
  21008. this.parseDecorators();
  21009. case types._class:
  21010. node = this.startNode();
  21011. this.takeDecorators(node);
  21012. return this.parseClass(node, false);
  21013. case types._new:
  21014. return this.parseNew();
  21015. case types.backQuote:
  21016. return this.parseTemplate(false);
  21017. case types.doubleColon:
  21018. node = this.startNode();
  21019. this.next();
  21020. node.object = null;
  21021. var callee = node.callee = this.parseNoCallExpr();
  21022. if (callee.type === "MemberExpression") {
  21023. return this.finishNode(node, "BindExpression");
  21024. } else {
  21025. this.raise(callee.start, "Binding should be performed on object property.");
  21026. }
  21027. default:
  21028. this.unexpected();
  21029. }
  21030. };
  21031. pp$3.parseFunctionExpression = function () {
  21032. var node = this.startNode();
  21033. var meta = this.parseIdentifier(true);
  21034. if (this.state.inGenerator && this.eat(types.dot) && this.hasPlugin("functionSent")) {
  21035. return this.parseMetaProperty(node, meta, "sent");
  21036. } else {
  21037. return this.parseFunction(node, false);
  21038. }
  21039. };
  21040. pp$3.parseMetaProperty = function (node, meta, propertyName) {
  21041. node.meta = meta;
  21042. node.property = this.parseIdentifier(true);
  21043. if (node.property.name !== propertyName) {
  21044. this.raise(node.property.start, "The only valid meta property for new is " + meta.name + "." + propertyName);
  21045. }
  21046. return this.finishNode(node, "MetaProperty");
  21047. };
  21048. pp$3.parseLiteral = function (value, type, startPos, startLoc) {
  21049. startPos = startPos || this.state.start;
  21050. startLoc = startLoc || this.state.startLoc;
  21051. var node = this.startNodeAt(startPos, startLoc);
  21052. this.addExtra(node, "rawValue", value);
  21053. this.addExtra(node, "raw", this.input.slice(startPos, this.state.end));
  21054. node.value = value;
  21055. this.next();
  21056. return this.finishNode(node, type);
  21057. };
  21058. pp$3.parseParenExpression = function () {
  21059. this.expect(types.parenL);
  21060. var val = this.parseExpression();
  21061. this.expect(types.parenR);
  21062. return val;
  21063. };
  21064. pp$3.parseParenAndDistinguishExpression = function (startPos, startLoc, canBeArrow) {
  21065. startPos = startPos || this.state.start;
  21066. startLoc = startLoc || this.state.startLoc;
  21067. var val = void 0;
  21068. this.expect(types.parenL);
  21069. var innerStartPos = this.state.start;
  21070. var innerStartLoc = this.state.startLoc;
  21071. var exprList = [];
  21072. var refShorthandDefaultPos = { start: 0 };
  21073. var refNeedsArrowPos = { start: 0 };
  21074. var first = true;
  21075. var spreadStart = void 0;
  21076. var optionalCommaStart = void 0;
  21077. while (!this.match(types.parenR)) {
  21078. if (first) {
  21079. first = false;
  21080. } else {
  21081. this.expect(types.comma, refNeedsArrowPos.start || null);
  21082. if (this.match(types.parenR)) {
  21083. optionalCommaStart = this.state.start;
  21084. break;
  21085. }
  21086. }
  21087. if (this.match(types.ellipsis)) {
  21088. var spreadNodeStartPos = this.state.start;
  21089. var spreadNodeStartLoc = this.state.startLoc;
  21090. spreadStart = this.state.start;
  21091. exprList.push(this.parseParenItem(this.parseRest(), spreadNodeStartPos, spreadNodeStartLoc));
  21092. break;
  21093. } else {
  21094. exprList.push(this.parseMaybeAssign(false, refShorthandDefaultPos, this.parseParenItem, refNeedsArrowPos));
  21095. }
  21096. }
  21097. var innerEndPos = this.state.start;
  21098. var innerEndLoc = this.state.startLoc;
  21099. this.expect(types.parenR);
  21100. var arrowNode = this.startNodeAt(startPos, startLoc);
  21101. if (canBeArrow && this.shouldParseArrow() && (arrowNode = this.parseArrow(arrowNode))) {
  21102. for (var _iterator = exprList, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
  21103. var _ref;
  21104. if (_isArray) {
  21105. if (_i >= _iterator.length) break;
  21106. _ref = _iterator[_i++];
  21107. } else {
  21108. _i = _iterator.next();
  21109. if (_i.done) break;
  21110. _ref = _i.value;
  21111. }
  21112. var param = _ref;
  21113. if (param.extra && param.extra.parenthesized) this.unexpected(param.extra.parenStart);
  21114. }
  21115. return this.parseArrowExpression(arrowNode, exprList);
  21116. }
  21117. if (!exprList.length) {
  21118. this.unexpected(this.state.lastTokStart);
  21119. }
  21120. if (optionalCommaStart) this.unexpected(optionalCommaStart);
  21121. if (spreadStart) this.unexpected(spreadStart);
  21122. if (refShorthandDefaultPos.start) this.unexpected(refShorthandDefaultPos.start);
  21123. if (refNeedsArrowPos.start) this.unexpected(refNeedsArrowPos.start);
  21124. if (exprList.length > 1) {
  21125. val = this.startNodeAt(innerStartPos, innerStartLoc);
  21126. val.expressions = exprList;
  21127. this.toReferencedList(val.expressions);
  21128. this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc);
  21129. } else {
  21130. val = exprList[0];
  21131. }
  21132. this.addExtra(val, "parenthesized", true);
  21133. this.addExtra(val, "parenStart", startPos);
  21134. return val;
  21135. };
  21136. pp$3.shouldParseArrow = function () {
  21137. return !this.canInsertSemicolon();
  21138. };
  21139. pp$3.parseArrow = function (node) {
  21140. if (this.eat(types.arrow)) {
  21141. return node;
  21142. }
  21143. };
  21144. pp$3.parseParenItem = function (node) {
  21145. return node;
  21146. };
  21147. // New's precedence is slightly tricky. It must allow its argument
  21148. // to be a `[]` or dot subscript expression, but not a call — at
  21149. // least, not without wrapping it in parentheses. Thus, it uses the
  21150. pp$3.parseNew = function () {
  21151. var node = this.startNode();
  21152. var meta = this.parseIdentifier(true);
  21153. if (this.eat(types.dot)) {
  21154. var metaProp = this.parseMetaProperty(node, meta, "target");
  21155. if (!this.state.inFunction) {
  21156. this.raise(metaProp.property.start, "new.target can only be used in functions");
  21157. }
  21158. return metaProp;
  21159. }
  21160. node.callee = this.parseNoCallExpr();
  21161. if (this.eat(types.parenL)) {
  21162. node.arguments = this.parseExprList(types.parenR);
  21163. this.toReferencedList(node.arguments);
  21164. } else {
  21165. node.arguments = [];
  21166. }
  21167. return this.finishNode(node, "NewExpression");
  21168. };
  21169. // Parse template expression.
  21170. pp$3.parseTemplateElement = function (isTagged) {
  21171. var elem = this.startNode();
  21172. if (this.state.value === null) {
  21173. if (!isTagged || !this.hasPlugin("templateInvalidEscapes")) {
  21174. this.raise(this.state.invalidTemplateEscapePosition, "Invalid escape sequence in template");
  21175. } else {
  21176. this.state.invalidTemplateEscapePosition = null;
  21177. }
  21178. }
  21179. elem.value = {
  21180. raw: this.input.slice(this.state.start, this.state.end).replace(/\r\n?/g, "\n"),
  21181. cooked: this.state.value
  21182. };
  21183. this.next();
  21184. elem.tail = this.match(types.backQuote);
  21185. return this.finishNode(elem, "TemplateElement");
  21186. };
  21187. pp$3.parseTemplate = function (isTagged) {
  21188. var node = this.startNode();
  21189. this.next();
  21190. node.expressions = [];
  21191. var curElt = this.parseTemplateElement(isTagged);
  21192. node.quasis = [curElt];
  21193. while (!curElt.tail) {
  21194. this.expect(types.dollarBraceL);
  21195. node.expressions.push(this.parseExpression());
  21196. this.expect(types.braceR);
  21197. node.quasis.push(curElt = this.parseTemplateElement(isTagged));
  21198. }
  21199. this.next();
  21200. return this.finishNode(node, "TemplateLiteral");
  21201. };
  21202. // Parse an object literal or binding pattern.
  21203. pp$3.parseObj = function (isPattern, refShorthandDefaultPos) {
  21204. var decorators = [];
  21205. var propHash = Object.create(null);
  21206. var first = true;
  21207. var node = this.startNode();
  21208. node.properties = [];
  21209. this.next();
  21210. var firstRestLocation = null;
  21211. while (!this.eat(types.braceR)) {
  21212. if (first) {
  21213. first = false;
  21214. } else {
  21215. this.expect(types.comma);
  21216. if (this.eat(types.braceR)) break;
  21217. }
  21218. while (this.match(types.at)) {
  21219. decorators.push(this.parseDecorator());
  21220. }
  21221. var prop = this.startNode(),
  21222. isGenerator = false,
  21223. isAsync = false,
  21224. startPos = void 0,
  21225. startLoc = void 0;
  21226. if (decorators.length) {
  21227. prop.decorators = decorators;
  21228. decorators = [];
  21229. }
  21230. if (this.hasPlugin("objectRestSpread") && this.match(types.ellipsis)) {
  21231. prop = this.parseSpread(isPattern ? { start: 0 } : undefined);
  21232. prop.type = isPattern ? "RestProperty" : "SpreadProperty";
  21233. if (isPattern) this.toAssignable(prop.argument, true, "object pattern");
  21234. node.properties.push(prop);
  21235. if (isPattern) {
  21236. var position = this.state.start;
  21237. if (firstRestLocation !== null) {
  21238. this.unexpected(firstRestLocation, "Cannot have multiple rest elements when destructuring");
  21239. } else if (this.eat(types.braceR)) {
  21240. break;
  21241. } else if (this.match(types.comma) && this.lookahead().type === types.braceR) {
  21242. // TODO: temporary rollback
  21243. // this.unexpected(position, "A trailing comma is not permitted after the rest element");
  21244. continue;
  21245. } else {
  21246. firstRestLocation = position;
  21247. continue;
  21248. }
  21249. } else {
  21250. continue;
  21251. }
  21252. }
  21253. prop.method = false;
  21254. prop.shorthand = false;
  21255. if (isPattern || refShorthandDefaultPos) {
  21256. startPos = this.state.start;
  21257. startLoc = this.state.startLoc;
  21258. }
  21259. if (!isPattern) {
  21260. isGenerator = this.eat(types.star);
  21261. }
  21262. if (!isPattern && this.isContextual("async")) {
  21263. if (isGenerator) this.unexpected();
  21264. var asyncId = this.parseIdentifier();
  21265. if (this.match(types.colon) || this.match(types.parenL) || this.match(types.braceR) || this.match(types.eq) || this.match(types.comma)) {
  21266. prop.key = asyncId;
  21267. prop.computed = false;
  21268. } else {
  21269. isAsync = true;
  21270. if (this.hasPlugin("asyncGenerators")) isGenerator = this.eat(types.star);
  21271. this.parsePropertyName(prop);
  21272. }
  21273. } else {
  21274. this.parsePropertyName(prop);
  21275. }
  21276. this.parseObjPropValue(prop, startPos, startLoc, isGenerator, isAsync, isPattern, refShorthandDefaultPos);
  21277. this.checkPropClash(prop, propHash);
  21278. if (prop.shorthand) {
  21279. this.addExtra(prop, "shorthand", true);
  21280. }
  21281. node.properties.push(prop);
  21282. }
  21283. if (firstRestLocation !== null) {
  21284. this.unexpected(firstRestLocation, "The rest element has to be the last element when destructuring");
  21285. }
  21286. if (decorators.length) {
  21287. this.raise(this.state.start, "You have trailing decorators with no property");
  21288. }
  21289. return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression");
  21290. };
  21291. pp$3.isGetterOrSetterMethod = function (prop, isPattern) {
  21292. return !isPattern && !prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && (this.match(types.string) || // get "string"() {}
  21293. this.match(types.num) || // get 1() {}
  21294. this.match(types.bracketL) || // get ["string"]() {}
  21295. this.match(types.name) || // get foo() {}
  21296. this.state.type.keyword // get debugger() {}
  21297. );
  21298. };
  21299. // get methods aren't allowed to have any parameters
  21300. // set methods must have exactly 1 parameter
  21301. pp$3.checkGetterSetterParamCount = function (method) {
  21302. var paramCount = method.kind === "get" ? 0 : 1;
  21303. if (method.params.length !== paramCount) {
  21304. var start = method.start;
  21305. if (method.kind === "get") {
  21306. this.raise(start, "getter should have no params");
  21307. } else {
  21308. this.raise(start, "setter should have exactly one param");
  21309. }
  21310. }
  21311. };
  21312. pp$3.parseObjectMethod = function (prop, isGenerator, isAsync, isPattern) {
  21313. if (isAsync || isGenerator || this.match(types.parenL)) {
  21314. if (isPattern) this.unexpected();
  21315. prop.kind = "method";
  21316. prop.method = true;
  21317. this.parseMethod(prop, isGenerator, isAsync);
  21318. return this.finishNode(prop, "ObjectMethod");
  21319. }
  21320. if (this.isGetterOrSetterMethod(prop, isPattern)) {
  21321. if (isGenerator || isAsync) this.unexpected();
  21322. prop.kind = prop.key.name;
  21323. this.parsePropertyName(prop);
  21324. this.parseMethod(prop);
  21325. this.checkGetterSetterParamCount(prop);
  21326. return this.finishNode(prop, "ObjectMethod");
  21327. }
  21328. };
  21329. pp$3.parseObjectProperty = function (prop, startPos, startLoc, isPattern, refShorthandDefaultPos) {
  21330. if (this.eat(types.colon)) {
  21331. prop.value = isPattern ? this.parseMaybeDefault(this.state.start, this.state.startLoc) : this.parseMaybeAssign(false, refShorthandDefaultPos);
  21332. return this.finishNode(prop, "ObjectProperty");
  21333. }
  21334. if (!prop.computed && prop.key.type === "Identifier") {
  21335. this.checkReservedWord(prop.key.name, prop.key.start, true, true);
  21336. if (isPattern) {
  21337. prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key.__clone());
  21338. } else if (this.match(types.eq) && refShorthandDefaultPos) {
  21339. if (!refShorthandDefaultPos.start) {
  21340. refShorthandDefaultPos.start = this.state.start;
  21341. }
  21342. prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key.__clone());
  21343. } else {
  21344. prop.value = prop.key.__clone();
  21345. }
  21346. prop.shorthand = true;
  21347. return this.finishNode(prop, "ObjectProperty");
  21348. }
  21349. };
  21350. pp$3.parseObjPropValue = function (prop, startPos, startLoc, isGenerator, isAsync, isPattern, refShorthandDefaultPos) {
  21351. var node = this.parseObjectMethod(prop, isGenerator, isAsync, isPattern) || this.parseObjectProperty(prop, startPos, startLoc, isPattern, refShorthandDefaultPos);
  21352. if (!node) this.unexpected();
  21353. return node;
  21354. };
  21355. pp$3.parsePropertyName = function (prop) {
  21356. if (this.eat(types.bracketL)) {
  21357. prop.computed = true;
  21358. prop.key = this.parseMaybeAssign();
  21359. this.expect(types.bracketR);
  21360. } else {
  21361. prop.computed = false;
  21362. var oldInPropertyName = this.state.inPropertyName;
  21363. this.state.inPropertyName = true;
  21364. prop.key = this.match(types.num) || this.match(types.string) ? this.parseExprAtom() : this.parseIdentifier(true);
  21365. this.state.inPropertyName = oldInPropertyName;
  21366. }
  21367. return prop.key;
  21368. };
  21369. // Initialize empty function node.
  21370. pp$3.initFunction = function (node, isAsync) {
  21371. node.id = null;
  21372. node.generator = false;
  21373. node.expression = false;
  21374. node.async = !!isAsync;
  21375. };
  21376. // Parse object or class method.
  21377. pp$3.parseMethod = function (node, isGenerator, isAsync) {
  21378. var oldInMethod = this.state.inMethod;
  21379. this.state.inMethod = node.kind || true;
  21380. this.initFunction(node, isAsync);
  21381. this.expect(types.parenL);
  21382. node.params = this.parseBindingList(types.parenR);
  21383. node.generator = !!isGenerator;
  21384. this.parseFunctionBody(node);
  21385. this.state.inMethod = oldInMethod;
  21386. return node;
  21387. };
  21388. // Parse arrow function expression with given parameters.
  21389. pp$3.parseArrowExpression = function (node, params, isAsync) {
  21390. this.initFunction(node, isAsync);
  21391. node.params = this.toAssignableList(params, true, "arrow function parameters");
  21392. this.parseFunctionBody(node, true);
  21393. return this.finishNode(node, "ArrowFunctionExpression");
  21394. };
  21395. pp$3.isStrictBody = function (node, isExpression) {
  21396. if (!isExpression && node.body.directives.length) {
  21397. for (var _iterator2 = node.body.directives, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
  21398. var _ref2;
  21399. if (_isArray2) {
  21400. if (_i2 >= _iterator2.length) break;
  21401. _ref2 = _iterator2[_i2++];
  21402. } else {
  21403. _i2 = _iterator2.next();
  21404. if (_i2.done) break;
  21405. _ref2 = _i2.value;
  21406. }
  21407. var directive = _ref2;
  21408. if (directive.value.value === "use strict") {
  21409. return true;
  21410. }
  21411. }
  21412. }
  21413. return false;
  21414. };
  21415. // Parse function body and check parameters.
  21416. pp$3.parseFunctionBody = function (node, allowExpression) {
  21417. var isExpression = allowExpression && !this.match(types.braceL);
  21418. var oldInAsync = this.state.inAsync;
  21419. this.state.inAsync = node.async;
  21420. if (isExpression) {
  21421. node.body = this.parseMaybeAssign();
  21422. node.expression = true;
  21423. } else {
  21424. // Start a new scope with regard to labels and the `inFunction`
  21425. // flag (restore them to their old value afterwards).
  21426. var oldInFunc = this.state.inFunction;
  21427. var oldInGen = this.state.inGenerator;
  21428. var oldLabels = this.state.labels;
  21429. this.state.inFunction = true;this.state.inGenerator = node.generator;this.state.labels = [];
  21430. node.body = this.parseBlock(true);
  21431. node.expression = false;
  21432. this.state.inFunction = oldInFunc;this.state.inGenerator = oldInGen;this.state.labels = oldLabels;
  21433. }
  21434. this.state.inAsync = oldInAsync;
  21435. // If this is a strict mode function, verify that argument names
  21436. // are not repeated, and it does not try to bind the words `eval`
  21437. // or `arguments`.
  21438. var isStrict = this.isStrictBody(node, isExpression);
  21439. // Also check when allowExpression === true for arrow functions
  21440. var checkLVal = this.state.strict || allowExpression || isStrict;
  21441. if (isStrict && node.id && node.id.type === "Identifier" && node.id.name === "yield") {
  21442. this.raise(node.id.start, "Binding yield in strict mode");
  21443. }
  21444. if (checkLVal) {
  21445. var nameHash = Object.create(null);
  21446. var oldStrict = this.state.strict;
  21447. if (isStrict) this.state.strict = true;
  21448. if (node.id) {
  21449. this.checkLVal(node.id, true, undefined, "function name");
  21450. }
  21451. for (var _iterator3 = node.params, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {
  21452. var _ref3;
  21453. if (_isArray3) {
  21454. if (_i3 >= _iterator3.length) break;
  21455. _ref3 = _iterator3[_i3++];
  21456. } else {
  21457. _i3 = _iterator3.next();
  21458. if (_i3.done) break;
  21459. _ref3 = _i3.value;
  21460. }
  21461. var param = _ref3;
  21462. if (isStrict && param.type !== "Identifier") {
  21463. this.raise(param.start, "Non-simple parameter in strict mode");
  21464. }
  21465. this.checkLVal(param, true, nameHash, "function parameter list");
  21466. }
  21467. this.state.strict = oldStrict;
  21468. }
  21469. };
  21470. // Parses a comma-separated list of expressions, and returns them as
  21471. // an array. `close` is the token type that ends the list, and
  21472. // `allowEmpty` can be turned on to allow subsequent commas with
  21473. // nothing in between them to be parsed as `null` (which is needed
  21474. // for array literals).
  21475. pp$3.parseExprList = function (close, allowEmpty, refShorthandDefaultPos) {
  21476. var elts = [];
  21477. var first = true;
  21478. while (!this.eat(close)) {
  21479. if (first) {
  21480. first = false;
  21481. } else {
  21482. this.expect(types.comma);
  21483. if (this.eat(close)) break;
  21484. }
  21485. elts.push(this.parseExprListItem(allowEmpty, refShorthandDefaultPos));
  21486. }
  21487. return elts;
  21488. };
  21489. pp$3.parseExprListItem = function (allowEmpty, refShorthandDefaultPos, refNeedsArrowPos) {
  21490. var elt = void 0;
  21491. if (allowEmpty && this.match(types.comma)) {
  21492. elt = null;
  21493. } else if (this.match(types.ellipsis)) {
  21494. elt = this.parseSpread(refShorthandDefaultPos);
  21495. } else {
  21496. elt = this.parseMaybeAssign(false, refShorthandDefaultPos, this.parseParenItem, refNeedsArrowPos);
  21497. }
  21498. return elt;
  21499. };
  21500. // Parse the next token as an identifier. If `liberal` is true (used
  21501. // when parsing properties), it will also convert keywords into
  21502. // identifiers.
  21503. pp$3.parseIdentifier = function (liberal) {
  21504. var node = this.startNode();
  21505. if (!liberal) {
  21506. this.checkReservedWord(this.state.value, this.state.start, !!this.state.type.keyword, false);
  21507. }
  21508. if (this.match(types.name)) {
  21509. node.name = this.state.value;
  21510. } else if (this.state.type.keyword) {
  21511. node.name = this.state.type.keyword;
  21512. } else {
  21513. this.unexpected();
  21514. }
  21515. if (!liberal && node.name === "await" && this.state.inAsync) {
  21516. this.raise(node.start, "invalid use of await inside of an async function");
  21517. }
  21518. node.loc.identifierName = node.name;
  21519. this.next();
  21520. return this.finishNode(node, "Identifier");
  21521. };
  21522. pp$3.checkReservedWord = function (word, startLoc, checkKeywords, isBinding) {
  21523. if (this.isReservedWord(word) || checkKeywords && this.isKeyword(word)) {
  21524. this.raise(startLoc, word + " is a reserved word");
  21525. }
  21526. if (this.state.strict && (reservedWords.strict(word) || isBinding && reservedWords.strictBind(word))) {
  21527. this.raise(startLoc, word + " is a reserved word in strict mode");
  21528. }
  21529. };
  21530. // Parses await expression inside async function.
  21531. pp$3.parseAwait = function (node) {
  21532. // istanbul ignore next: this condition is checked at the call site so won't be hit here
  21533. if (!this.state.inAsync) {
  21534. this.unexpected();
  21535. }
  21536. if (this.match(types.star)) {
  21537. this.raise(node.start, "await* has been removed from the async functions proposal. Use Promise.all() instead.");
  21538. }
  21539. node.argument = this.parseMaybeUnary();
  21540. return this.finishNode(node, "AwaitExpression");
  21541. };
  21542. // Parses yield expression inside generator.
  21543. pp$3.parseYield = function () {
  21544. var node = this.startNode();
  21545. this.next();
  21546. if (this.match(types.semi) || this.canInsertSemicolon() || !this.match(types.star) && !this.state.type.startsExpr) {
  21547. node.delegate = false;
  21548. node.argument = null;
  21549. } else {
  21550. node.delegate = this.eat(types.star);
  21551. node.argument = this.parseMaybeAssign();
  21552. }
  21553. return this.finishNode(node, "YieldExpression");
  21554. };
  21555. // Start an AST node, attaching a start offset.
  21556. var pp$4 = Parser.prototype;
  21557. var commentKeys = ["leadingComments", "trailingComments", "innerComments"];
  21558. var Node = function () {
  21559. function Node(pos, loc, filename) {
  21560. classCallCheck(this, Node);
  21561. this.type = "";
  21562. this.start = pos;
  21563. this.end = 0;
  21564. this.loc = new SourceLocation(loc);
  21565. if (filename) this.loc.filename = filename;
  21566. }
  21567. Node.prototype.__clone = function __clone() {
  21568. var node2 = new Node();
  21569. for (var key in this) {
  21570. // Do not clone comments that are already attached to the node
  21571. if (commentKeys.indexOf(key) < 0) {
  21572. node2[key] = this[key];
  21573. }
  21574. }
  21575. return node2;
  21576. };
  21577. return Node;
  21578. }();
  21579. pp$4.startNode = function () {
  21580. return new Node(this.state.start, this.state.startLoc, this.filename);
  21581. };
  21582. pp$4.startNodeAt = function (pos, loc) {
  21583. return new Node(pos, loc, this.filename);
  21584. };
  21585. function finishNodeAt(node, type, pos, loc) {
  21586. node.type = type;
  21587. node.end = pos;
  21588. node.loc.end = loc;
  21589. this.processComment(node);
  21590. return node;
  21591. }
  21592. // Finish an AST node, adding `type` and `end` properties.
  21593. pp$4.finishNode = function (node, type) {
  21594. return finishNodeAt.call(this, node, type, this.state.lastTokEnd, this.state.lastTokEndLoc);
  21595. };
  21596. // Finish node at given position
  21597. pp$4.finishNodeAt = function (node, type, pos, loc) {
  21598. return finishNodeAt.call(this, node, type, pos, loc);
  21599. };
  21600. var pp$5 = Parser.prototype;
  21601. // This function is used to raise exceptions on parse errors. It
  21602. // takes an offset integer (into the current `input`) to indicate
  21603. // the location of the error, attaches the position to the end
  21604. // of the error message, and then raises a `SyntaxError` with that
  21605. // message.
  21606. pp$5.raise = function (pos, message) {
  21607. var loc = getLineInfo(this.input, pos);
  21608. message += " (" + loc.line + ":" + loc.column + ")";
  21609. var err = new SyntaxError(message);
  21610. err.pos = pos;
  21611. err.loc = loc;
  21612. throw err;
  21613. };
  21614. /* eslint max-len: 0 */
  21615. /**
  21616. * Based on the comment attachment algorithm used in espree and estraverse.
  21617. *
  21618. * Redistribution and use in source and binary forms, with or without
  21619. * modification, are permitted provided that the following conditions are met:
  21620. *
  21621. * * Redistributions of source code must retain the above copyright
  21622. * notice, this list of conditions and the following disclaimer.
  21623. * * Redistributions in binary form must reproduce the above copyright
  21624. * notice, this list of conditions and the following disclaimer in the
  21625. * documentation and/or other materials provided with the distribution.
  21626. *
  21627. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  21628. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  21629. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  21630. * ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  21631. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21632. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  21633. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  21634. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  21635. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  21636. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  21637. */
  21638. function last(stack) {
  21639. return stack[stack.length - 1];
  21640. }
  21641. var pp$6 = Parser.prototype;
  21642. pp$6.addComment = function (comment) {
  21643. if (this.filename) comment.loc.filename = this.filename;
  21644. this.state.trailingComments.push(comment);
  21645. this.state.leadingComments.push(comment);
  21646. };
  21647. pp$6.processComment = function (node) {
  21648. if (node.type === "Program" && node.body.length > 0) return;
  21649. var stack = this.state.commentStack;
  21650. var firstChild = void 0,
  21651. lastChild = void 0,
  21652. trailingComments = void 0,
  21653. i = void 0,
  21654. j = void 0;
  21655. if (this.state.trailingComments.length > 0) {
  21656. // If the first comment in trailingComments comes after the
  21657. // current node, then we're good - all comments in the array will
  21658. // come after the node and so it's safe to add them as official
  21659. // trailingComments.
  21660. if (this.state.trailingComments[0].start >= node.end) {
  21661. trailingComments = this.state.trailingComments;
  21662. this.state.trailingComments = [];
  21663. } else {
  21664. // Otherwise, if the first comment doesn't come after the
  21665. // current node, that means we have a mix of leading and trailing
  21666. // comments in the array and that leadingComments contains the
  21667. // same items as trailingComments. Reset trailingComments to
  21668. // zero items and we'll handle this by evaluating leadingComments
  21669. // later.
  21670. this.state.trailingComments.length = 0;
  21671. }
  21672. } else {
  21673. var lastInStack = last(stack);
  21674. if (stack.length > 0 && lastInStack.trailingComments && lastInStack.trailingComments[0].start >= node.end) {
  21675. trailingComments = lastInStack.trailingComments;
  21676. lastInStack.trailingComments = null;
  21677. }
  21678. }
  21679. // Eating the stack.
  21680. if (stack.length > 0 && last(stack).start >= node.start) {
  21681. firstChild = stack.pop();
  21682. }
  21683. while (stack.length > 0 && last(stack).start >= node.start) {
  21684. lastChild = stack.pop();
  21685. }
  21686. if (!lastChild && firstChild) lastChild = firstChild;
  21687. // Attach comments that follow a trailing comma on the last
  21688. // property in an object literal or a trailing comma in function arguments
  21689. // as trailing comments
  21690. if (firstChild && this.state.leadingComments.length > 0) {
  21691. var lastComment = last(this.state.leadingComments);
  21692. if (firstChild.type === "ObjectProperty") {
  21693. if (lastComment.start >= node.start) {
  21694. if (this.state.commentPreviousNode) {
  21695. for (j = 0; j < this.state.leadingComments.length; j++) {
  21696. if (this.state.leadingComments[j].end < this.state.commentPreviousNode.end) {
  21697. this.state.leadingComments.splice(j, 1);
  21698. j--;
  21699. }
  21700. }
  21701. if (this.state.leadingComments.length > 0) {
  21702. firstChild.trailingComments = this.state.leadingComments;
  21703. this.state.leadingComments = [];
  21704. }
  21705. }
  21706. }
  21707. } else if (node.type === "CallExpression" && node.arguments && node.arguments.length) {
  21708. var lastArg = last(node.arguments);
  21709. if (lastArg && lastComment.start >= lastArg.start && lastComment.end <= node.end) {
  21710. if (this.state.commentPreviousNode) {
  21711. if (this.state.leadingComments.length > 0) {
  21712. lastArg.trailingComments = this.state.leadingComments;
  21713. this.state.leadingComments = [];
  21714. }
  21715. }
  21716. }
  21717. }
  21718. }
  21719. if (lastChild) {
  21720. if (lastChild.leadingComments) {
  21721. if (lastChild !== node && last(lastChild.leadingComments).end <= node.start) {
  21722. node.leadingComments = lastChild.leadingComments;
  21723. lastChild.leadingComments = null;
  21724. } else {
  21725. // A leading comment for an anonymous class had been stolen by its first ClassMethod,
  21726. // so this takes back the leading comment.
  21727. // See also: https://github.com/eslint/espree/issues/158
  21728. for (i = lastChild.leadingComments.length - 2; i >= 0; --i) {
  21729. if (lastChild.leadingComments[i].end <= node.start) {
  21730. node.leadingComments = lastChild.leadingComments.splice(0, i + 1);
  21731. break;
  21732. }
  21733. }
  21734. }
  21735. }
  21736. } else if (this.state.leadingComments.length > 0) {
  21737. if (last(this.state.leadingComments).end <= node.start) {
  21738. if (this.state.commentPreviousNode) {
  21739. for (j = 0; j < this.state.leadingComments.length; j++) {
  21740. if (this.state.leadingComments[j].end < this.state.commentPreviousNode.end) {
  21741. this.state.leadingComments.splice(j, 1);
  21742. j--;
  21743. }
  21744. }
  21745. }
  21746. if (this.state.leadingComments.length > 0) {
  21747. node.leadingComments = this.state.leadingComments;
  21748. this.state.leadingComments = [];
  21749. }
  21750. } else {
  21751. // https://github.com/eslint/espree/issues/2
  21752. //
  21753. // In special cases, such as return (without a value) and
  21754. // debugger, all comments will end up as leadingComments and
  21755. // will otherwise be eliminated. This step runs when the
  21756. // commentStack is empty and there are comments left
  21757. // in leadingComments.
  21758. //
  21759. // This loop figures out the stopping point between the actual
  21760. // leading and trailing comments by finding the location of the
  21761. // first comment that comes after the given node.
  21762. for (i = 0; i < this.state.leadingComments.length; i++) {
  21763. if (this.state.leadingComments[i].end > node.start) {
  21764. break;
  21765. }
  21766. }
  21767. // Split the array based on the location of the first comment
  21768. // that comes after the node. Keep in mind that this could
  21769. // result in an empty array, and if so, the array must be
  21770. // deleted.
  21771. node.leadingComments = this.state.leadingComments.slice(0, i);
  21772. if (node.leadingComments.length === 0) {
  21773. node.leadingComments = null;
  21774. }
  21775. // Similarly, trailing comments are attached later. The variable
  21776. // must be reset to null if there are no trailing comments.
  21777. trailingComments = this.state.leadingComments.slice(i);
  21778. if (trailingComments.length === 0) {
  21779. trailingComments = null;
  21780. }
  21781. }
  21782. }
  21783. this.state.commentPreviousNode = node;
  21784. if (trailingComments) {
  21785. if (trailingComments.length && trailingComments[0].start >= node.start && last(trailingComments).end <= node.end) {
  21786. node.innerComments = trailingComments;
  21787. } else {
  21788. node.trailingComments = trailingComments;
  21789. }
  21790. }
  21791. stack.push(node);
  21792. };
  21793. var pp$7 = Parser.prototype;
  21794. pp$7.estreeParseRegExpLiteral = function (_ref) {
  21795. var pattern = _ref.pattern,
  21796. flags = _ref.flags;
  21797. var regex = null;
  21798. try {
  21799. regex = new RegExp(pattern, flags);
  21800. } catch (e) {
  21801. // In environments that don't support these flags value will
  21802. // be null as the regex can't be represented natively.
  21803. }
  21804. var node = this.estreeParseLiteral(regex);
  21805. node.regex = { pattern: pattern, flags: flags };
  21806. return node;
  21807. };
  21808. pp$7.estreeParseLiteral = function (value) {
  21809. return this.parseLiteral(value, "Literal");
  21810. };
  21811. pp$7.directiveToStmt = function (directive) {
  21812. var directiveLiteral = directive.value;
  21813. var stmt = this.startNodeAt(directive.start, directive.loc.start);
  21814. var expression = this.startNodeAt(directiveLiteral.start, directiveLiteral.loc.start);
  21815. expression.value = directiveLiteral.value;
  21816. expression.raw = directiveLiteral.extra.raw;
  21817. stmt.expression = this.finishNodeAt(expression, "Literal", directiveLiteral.end, directiveLiteral.loc.end);
  21818. stmt.directive = directiveLiteral.extra.raw.slice(1, -1);
  21819. return this.finishNodeAt(stmt, "ExpressionStatement", directive.end, directive.loc.end);
  21820. };
  21821. function isSimpleProperty(node) {
  21822. return node && node.type === "Property" && node.kind === "init" && node.method === false;
  21823. }
  21824. var estreePlugin = function (instance) {
  21825. instance.extend("checkDeclaration", function (inner) {
  21826. return function (node) {
  21827. if (isSimpleProperty(node)) {
  21828. this.checkDeclaration(node.value);
  21829. } else {
  21830. inner.call(this, node);
  21831. }
  21832. };
  21833. });
  21834. instance.extend("checkGetterSetterParamCount", function () {
  21835. return function (prop) {
  21836. var paramCount = prop.kind === "get" ? 0 : 1;
  21837. if (prop.value.params.length !== paramCount) {
  21838. var start = prop.start;
  21839. if (prop.kind === "get") {
  21840. this.raise(start, "getter should have no params");
  21841. } else {
  21842. this.raise(start, "setter should have exactly one param");
  21843. }
  21844. }
  21845. };
  21846. });
  21847. instance.extend("checkLVal", function (inner) {
  21848. return function (expr, isBinding, checkClashes) {
  21849. var _this = this;
  21850. switch (expr.type) {
  21851. case "ObjectPattern":
  21852. expr.properties.forEach(function (prop) {
  21853. _this.checkLVal(prop.type === "Property" ? prop.value : prop, isBinding, checkClashes, "object destructuring pattern");
  21854. });
  21855. break;
  21856. default:
  21857. for (var _len = arguments.length, args = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
  21858. args[_key - 3] = arguments[_key];
  21859. }
  21860. inner.call.apply(inner, [this, expr, isBinding, checkClashes].concat(args));
  21861. }
  21862. };
  21863. });
  21864. instance.extend("checkPropClash", function () {
  21865. return function (prop, propHash) {
  21866. if (prop.computed || !isSimpleProperty(prop)) return;
  21867. var key = prop.key;
  21868. // It is either an Identifier or a String/NumericLiteral
  21869. var name = key.type === "Identifier" ? key.name : String(key.value);
  21870. if (name === "__proto__") {
  21871. if (propHash.proto) this.raise(key.start, "Redefinition of __proto__ property");
  21872. propHash.proto = true;
  21873. }
  21874. };
  21875. });
  21876. instance.extend("isStrictBody", function () {
  21877. return function (node, isExpression) {
  21878. if (!isExpression && node.body.body.length > 0) {
  21879. for (var _iterator = node.body.body, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
  21880. var _ref2;
  21881. if (_isArray) {
  21882. if (_i >= _iterator.length) break;
  21883. _ref2 = _iterator[_i++];
  21884. } else {
  21885. _i = _iterator.next();
  21886. if (_i.done) break;
  21887. _ref2 = _i.value;
  21888. }
  21889. var directive = _ref2;
  21890. if (directive.type === "ExpressionStatement" && directive.expression.type === "Literal") {
  21891. if (directive.expression.value === "use strict") return true;
  21892. } else {
  21893. // Break for the first non literal expression
  21894. break;
  21895. }
  21896. }
  21897. }
  21898. return false;
  21899. };
  21900. });
  21901. instance.extend("isValidDirective", function () {
  21902. return function (stmt) {
  21903. return stmt.type === "ExpressionStatement" && stmt.expression.type === "Literal" && typeof stmt.expression.value === "string" && (!stmt.expression.extra || !stmt.expression.extra.parenthesized);
  21904. };
  21905. });
  21906. instance.extend("stmtToDirective", function (inner) {
  21907. return function (stmt) {
  21908. var directive = inner.call(this, stmt);
  21909. var value = stmt.expression.value;
  21910. // Reset value to the actual value as in estree mode we want
  21911. // the stmt to have the real value and not the raw value
  21912. directive.value.value = value;
  21913. return directive;
  21914. };
  21915. });
  21916. instance.extend("parseBlockBody", function (inner) {
  21917. return function (node) {
  21918. var _this2 = this;
  21919. for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  21920. args[_key2 - 1] = arguments[_key2];
  21921. }
  21922. inner.call.apply(inner, [this, node].concat(args));
  21923. node.directives.reverse().forEach(function (directive) {
  21924. node.body.unshift(_this2.directiveToStmt(directive));
  21925. });
  21926. delete node.directives;
  21927. };
  21928. });
  21929. instance.extend("parseClassMethod", function () {
  21930. return function (classBody, method, isGenerator, isAsync) {
  21931. this.parseMethod(method, isGenerator, isAsync);
  21932. if (method.typeParameters) {
  21933. method.value.typeParameters = method.typeParameters;
  21934. delete method.typeParameters;
  21935. }
  21936. classBody.body.push(this.finishNode(method, "MethodDefinition"));
  21937. };
  21938. });
  21939. instance.extend("parseExprAtom", function (inner) {
  21940. return function () {
  21941. switch (this.state.type) {
  21942. case types.regexp:
  21943. return this.estreeParseRegExpLiteral(this.state.value);
  21944. case types.num:
  21945. case types.string:
  21946. return this.estreeParseLiteral(this.state.value);
  21947. case types._null:
  21948. return this.estreeParseLiteral(null);
  21949. case types._true:
  21950. return this.estreeParseLiteral(true);
  21951. case types._false:
  21952. return this.estreeParseLiteral(false);
  21953. default:
  21954. for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  21955. args[_key3] = arguments[_key3];
  21956. }
  21957. return inner.call.apply(inner, [this].concat(args));
  21958. }
  21959. };
  21960. });
  21961. instance.extend("parseLiteral", function (inner) {
  21962. return function () {
  21963. for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  21964. args[_key4] = arguments[_key4];
  21965. }
  21966. var node = inner.call.apply(inner, [this].concat(args));
  21967. node.raw = node.extra.raw;
  21968. delete node.extra;
  21969. return node;
  21970. };
  21971. });
  21972. instance.extend("parseMethod", function (inner) {
  21973. return function (node) {
  21974. var funcNode = this.startNode();
  21975. funcNode.kind = node.kind; // provide kind, so inner method correctly sets state
  21976. for (var _len5 = arguments.length, args = Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
  21977. args[_key5 - 1] = arguments[_key5];
  21978. }
  21979. funcNode = inner.call.apply(inner, [this, funcNode].concat(args));
  21980. delete funcNode.kind;
  21981. node.value = this.finishNode(funcNode, "FunctionExpression");
  21982. return node;
  21983. };
  21984. });
  21985. instance.extend("parseObjectMethod", function (inner) {
  21986. return function () {
  21987. for (var _len6 = arguments.length, args = Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
  21988. args[_key6] = arguments[_key6];
  21989. }
  21990. var node = inner.call.apply(inner, [this].concat(args));
  21991. if (node) {
  21992. if (node.kind === "method") node.kind = "init";
  21993. node.type = "Property";
  21994. }
  21995. return node;
  21996. };
  21997. });
  21998. instance.extend("parseObjectProperty", function (inner) {
  21999. return function () {
  22000. for (var _len7 = arguments.length, args = Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
  22001. args[_key7] = arguments[_key7];
  22002. }
  22003. var node = inner.call.apply(inner, [this].concat(args));
  22004. if (node) {
  22005. node.kind = "init";
  22006. node.type = "Property";
  22007. }
  22008. return node;
  22009. };
  22010. });
  22011. instance.extend("toAssignable", function (inner) {
  22012. return function (node, isBinding) {
  22013. for (var _len8 = arguments.length, args = Array(_len8 > 2 ? _len8 - 2 : 0), _key8 = 2; _key8 < _len8; _key8++) {
  22014. args[_key8 - 2] = arguments[_key8];
  22015. }
  22016. if (isSimpleProperty(node)) {
  22017. this.toAssignable.apply(this, [node.value, isBinding].concat(args));
  22018. return node;
  22019. } else if (node.type === "ObjectExpression") {
  22020. node.type = "ObjectPattern";
  22021. for (var _iterator2 = node.properties, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
  22022. var _ref3;
  22023. if (_isArray2) {
  22024. if (_i2 >= _iterator2.length) break;
  22025. _ref3 = _iterator2[_i2++];
  22026. } else {
  22027. _i2 = _iterator2.next();
  22028. if (_i2.done) break;
  22029. _ref3 = _i2.value;
  22030. }
  22031. var prop = _ref3;
  22032. if (prop.kind === "get" || prop.kind === "set") {
  22033. this.raise(prop.key.start, "Object pattern can't contain getter or setter");
  22034. } else if (prop.method) {
  22035. this.raise(prop.key.start, "Object pattern can't contain methods");
  22036. } else {
  22037. this.toAssignable(prop, isBinding, "object destructuring pattern");
  22038. }
  22039. }
  22040. return node;
  22041. }
  22042. return inner.call.apply(inner, [this, node, isBinding].concat(args));
  22043. };
  22044. });
  22045. };
  22046. /* eslint max-len: 0 */
  22047. var primitiveTypes = ["any", "mixed", "empty", "bool", "boolean", "number", "string", "void", "null"];
  22048. var pp$8 = Parser.prototype;
  22049. pp$8.flowParseTypeInitialiser = function (tok) {
  22050. var oldInType = this.state.inType;
  22051. this.state.inType = true;
  22052. this.expect(tok || types.colon);
  22053. var type = this.flowParseType();
  22054. this.state.inType = oldInType;
  22055. return type;
  22056. };
  22057. pp$8.flowParsePredicate = function () {
  22058. var node = this.startNode();
  22059. var moduloLoc = this.state.startLoc;
  22060. var moduloPos = this.state.start;
  22061. this.expect(types.modulo);
  22062. var checksLoc = this.state.startLoc;
  22063. this.expectContextual("checks");
  22064. // Force '%' and 'checks' to be adjacent
  22065. if (moduloLoc.line !== checksLoc.line || moduloLoc.column !== checksLoc.column - 1) {
  22066. this.raise(moduloPos, "Spaces between ´%´ and ´checks´ are not allowed here.");
  22067. }
  22068. if (this.eat(types.parenL)) {
  22069. node.expression = this.parseExpression();
  22070. this.expect(types.parenR);
  22071. return this.finishNode(node, "DeclaredPredicate");
  22072. } else {
  22073. return this.finishNode(node, "InferredPredicate");
  22074. }
  22075. };
  22076. pp$8.flowParseTypeAndPredicateInitialiser = function () {
  22077. var oldInType = this.state.inType;
  22078. this.state.inType = true;
  22079. this.expect(types.colon);
  22080. var type = null;
  22081. var predicate = null;
  22082. if (this.match(types.modulo)) {
  22083. this.state.inType = oldInType;
  22084. predicate = this.flowParsePredicate();
  22085. } else {
  22086. type = this.flowParseType();
  22087. this.state.inType = oldInType;
  22088. if (this.match(types.modulo)) {
  22089. predicate = this.flowParsePredicate();
  22090. }
  22091. }
  22092. return [type, predicate];
  22093. };
  22094. pp$8.flowParseDeclareClass = function (node) {
  22095. this.next();
  22096. this.flowParseInterfaceish(node, true);
  22097. return this.finishNode(node, "DeclareClass");
  22098. };
  22099. pp$8.flowParseDeclareFunction = function (node) {
  22100. this.next();
  22101. var id = node.id = this.parseIdentifier();
  22102. var typeNode = this.startNode();
  22103. var typeContainer = this.startNode();
  22104. if (this.isRelational("<")) {
  22105. typeNode.typeParameters = this.flowParseTypeParameterDeclaration();
  22106. } else {
  22107. typeNode.typeParameters = null;
  22108. }
  22109. this.expect(types.parenL);
  22110. var tmp = this.flowParseFunctionTypeParams();
  22111. typeNode.params = tmp.params;
  22112. typeNode.rest = tmp.rest;
  22113. this.expect(types.parenR);
  22114. var predicate = null;
  22115. var _flowParseTypeAndPred = this.flowParseTypeAndPredicateInitialiser();
  22116. typeNode.returnType = _flowParseTypeAndPred[0];
  22117. predicate = _flowParseTypeAndPred[1];
  22118. typeContainer.typeAnnotation = this.finishNode(typeNode, "FunctionTypeAnnotation");
  22119. typeContainer.predicate = predicate;
  22120. id.typeAnnotation = this.finishNode(typeContainer, "TypeAnnotation");
  22121. this.finishNode(id, id.type);
  22122. this.semicolon();
  22123. return this.finishNode(node, "DeclareFunction");
  22124. };
  22125. pp$8.flowParseDeclare = function (node) {
  22126. if (this.match(types._class)) {
  22127. return this.flowParseDeclareClass(node);
  22128. } else if (this.match(types._function)) {
  22129. return this.flowParseDeclareFunction(node);
  22130. } else if (this.match(types._var)) {
  22131. return this.flowParseDeclareVariable(node);
  22132. } else if (this.isContextual("module")) {
  22133. if (this.lookahead().type === types.dot) {
  22134. return this.flowParseDeclareModuleExports(node);
  22135. } else {
  22136. return this.flowParseDeclareModule(node);
  22137. }
  22138. } else if (this.isContextual("type")) {
  22139. return this.flowParseDeclareTypeAlias(node);
  22140. } else if (this.isContextual("opaque")) {
  22141. return this.flowParseDeclareOpaqueType(node);
  22142. } else if (this.isContextual("interface")) {
  22143. return this.flowParseDeclareInterface(node);
  22144. } else if (this.match(types._export)) {
  22145. return this.flowParseDeclareExportDeclaration(node);
  22146. } else {
  22147. this.unexpected();
  22148. }
  22149. };
  22150. pp$8.flowParseDeclareExportDeclaration = function (node) {
  22151. this.expect(types._export);
  22152. if (this.isContextual("opaque") // declare export opaque ...
  22153. ) {
  22154. node.declaration = this.flowParseDeclare(this.startNode());
  22155. node.default = false;
  22156. return this.finishNode(node, "DeclareExportDeclaration");
  22157. }
  22158. throw this.unexpected();
  22159. };
  22160. pp$8.flowParseDeclareVariable = function (node) {
  22161. this.next();
  22162. node.id = this.flowParseTypeAnnotatableIdentifier();
  22163. this.semicolon();
  22164. return this.finishNode(node, "DeclareVariable");
  22165. };
  22166. pp$8.flowParseDeclareModule = function (node) {
  22167. this.next();
  22168. if (this.match(types.string)) {
  22169. node.id = this.parseExprAtom();
  22170. } else {
  22171. node.id = this.parseIdentifier();
  22172. }
  22173. var bodyNode = node.body = this.startNode();
  22174. var body = bodyNode.body = [];
  22175. this.expect(types.braceL);
  22176. while (!this.match(types.braceR)) {
  22177. var _bodyNode = this.startNode();
  22178. if (this.match(types._import)) {
  22179. var lookahead = this.lookahead();
  22180. if (lookahead.value !== "type" && lookahead.value !== "typeof") {
  22181. this.unexpected(null, "Imports within a `declare module` body must always be `import type` or `import typeof`");
  22182. }
  22183. this.parseImport(_bodyNode);
  22184. } else {
  22185. this.expectContextual("declare", "Only declares and type imports are allowed inside declare module");
  22186. _bodyNode = this.flowParseDeclare(_bodyNode, true);
  22187. }
  22188. body.push(_bodyNode);
  22189. }
  22190. this.expect(types.braceR);
  22191. this.finishNode(bodyNode, "BlockStatement");
  22192. return this.finishNode(node, "DeclareModule");
  22193. };
  22194. pp$8.flowParseDeclareModuleExports = function (node) {
  22195. this.expectContextual("module");
  22196. this.expect(types.dot);
  22197. this.expectContextual("exports");
  22198. node.typeAnnotation = this.flowParseTypeAnnotation();
  22199. this.semicolon();
  22200. return this.finishNode(node, "DeclareModuleExports");
  22201. };
  22202. pp$8.flowParseDeclareTypeAlias = function (node) {
  22203. this.next();
  22204. this.flowParseTypeAlias(node);
  22205. return this.finishNode(node, "DeclareTypeAlias");
  22206. };
  22207. pp$8.flowParseDeclareOpaqueType = function (node) {
  22208. this.next();
  22209. this.flowParseOpaqueType(node, true);
  22210. return this.finishNode(node, "DeclareOpaqueType");
  22211. };
  22212. pp$8.flowParseDeclareInterface = function (node) {
  22213. this.next();
  22214. this.flowParseInterfaceish(node);
  22215. return this.finishNode(node, "DeclareInterface");
  22216. };
  22217. // Interfaces
  22218. pp$8.flowParseInterfaceish = function (node) {
  22219. node.id = this.parseIdentifier();
  22220. if (this.isRelational("<")) {
  22221. node.typeParameters = this.flowParseTypeParameterDeclaration();
  22222. } else {
  22223. node.typeParameters = null;
  22224. }
  22225. node.extends = [];
  22226. node.mixins = [];
  22227. if (this.eat(types._extends)) {
  22228. do {
  22229. node.extends.push(this.flowParseInterfaceExtends());
  22230. } while (this.eat(types.comma));
  22231. }
  22232. if (this.isContextual("mixins")) {
  22233. this.next();
  22234. do {
  22235. node.mixins.push(this.flowParseInterfaceExtends());
  22236. } while (this.eat(types.comma));
  22237. }
  22238. node.body = this.flowParseObjectType(true, false, false);
  22239. };
  22240. pp$8.flowParseInterfaceExtends = function () {
  22241. var node = this.startNode();
  22242. node.id = this.flowParseQualifiedTypeIdentifier();
  22243. if (this.isRelational("<")) {
  22244. node.typeParameters = this.flowParseTypeParameterInstantiation();
  22245. } else {
  22246. node.typeParameters = null;
  22247. }
  22248. return this.finishNode(node, "InterfaceExtends");
  22249. };
  22250. pp$8.flowParseInterface = function (node) {
  22251. this.flowParseInterfaceish(node, false);
  22252. return this.finishNode(node, "InterfaceDeclaration");
  22253. };
  22254. pp$8.flowParseRestrictedIdentifier = function (liberal) {
  22255. if (primitiveTypes.indexOf(this.state.value) > -1) {
  22256. this.raise(this.state.start, "Cannot overwrite primitive type " + this.state.value);
  22257. }
  22258. return this.parseIdentifier(liberal);
  22259. };
  22260. // Type aliases
  22261. pp$8.flowParseTypeAlias = function (node) {
  22262. node.id = this.flowParseRestrictedIdentifier();
  22263. if (this.isRelational("<")) {
  22264. node.typeParameters = this.flowParseTypeParameterDeclaration();
  22265. } else {
  22266. node.typeParameters = null;
  22267. }
  22268. node.right = this.flowParseTypeInitialiser(types.eq);
  22269. this.semicolon();
  22270. return this.finishNode(node, "TypeAlias");
  22271. };
  22272. // Opaque type aliases
  22273. pp$8.flowParseOpaqueType = function (node, declare) {
  22274. this.expectContextual("type");
  22275. node.id = this.flowParseRestrictedIdentifier();
  22276. if (this.isRelational("<")) {
  22277. node.typeParameters = this.flowParseTypeParameterDeclaration();
  22278. } else {
  22279. node.typeParameters = null;
  22280. }
  22281. // Parse the supertype
  22282. node.supertype = null;
  22283. if (this.match(types.colon)) {
  22284. node.supertype = this.flowParseTypeInitialiser(types.colon);
  22285. }
  22286. node.impltype = null;
  22287. if (!declare) {
  22288. node.impltype = this.flowParseTypeInitialiser(types.eq);
  22289. }
  22290. this.semicolon();
  22291. return this.finishNode(node, "OpaqueType");
  22292. };
  22293. // Type annotations
  22294. pp$8.flowParseTypeParameter = function () {
  22295. var node = this.startNode();
  22296. var variance = this.flowParseVariance();
  22297. var ident = this.flowParseTypeAnnotatableIdentifier();
  22298. node.name = ident.name;
  22299. node.variance = variance;
  22300. node.bound = ident.typeAnnotation;
  22301. if (this.match(types.eq)) {
  22302. this.eat(types.eq);
  22303. node.default = this.flowParseType();
  22304. }
  22305. return this.finishNode(node, "TypeParameter");
  22306. };
  22307. pp$8.flowParseTypeParameterDeclaration = function () {
  22308. var oldInType = this.state.inType;
  22309. var node = this.startNode();
  22310. node.params = [];
  22311. this.state.inType = true;
  22312. // istanbul ignore else: this condition is already checked at all call sites
  22313. if (this.isRelational("<") || this.match(types.jsxTagStart)) {
  22314. this.next();
  22315. } else {
  22316. this.unexpected();
  22317. }
  22318. do {
  22319. node.params.push(this.flowParseTypeParameter());
  22320. if (!this.isRelational(">")) {
  22321. this.expect(types.comma);
  22322. }
  22323. } while (!this.isRelational(">"));
  22324. this.expectRelational(">");
  22325. this.state.inType = oldInType;
  22326. return this.finishNode(node, "TypeParameterDeclaration");
  22327. };
  22328. pp$8.flowParseTypeParameterInstantiation = function () {
  22329. var node = this.startNode();
  22330. var oldInType = this.state.inType;
  22331. node.params = [];
  22332. this.state.inType = true;
  22333. this.expectRelational("<");
  22334. while (!this.isRelational(">")) {
  22335. node.params.push(this.flowParseType());
  22336. if (!this.isRelational(">")) {
  22337. this.expect(types.comma);
  22338. }
  22339. }
  22340. this.expectRelational(">");
  22341. this.state.inType = oldInType;
  22342. return this.finishNode(node, "TypeParameterInstantiation");
  22343. };
  22344. pp$8.flowParseObjectPropertyKey = function () {
  22345. return this.match(types.num) || this.match(types.string) ? this.parseExprAtom() : this.parseIdentifier(true);
  22346. };
  22347. pp$8.flowParseObjectTypeIndexer = function (node, isStatic, variance) {
  22348. node.static = isStatic;
  22349. this.expect(types.bracketL);
  22350. if (this.lookahead().type === types.colon) {
  22351. node.id = this.flowParseObjectPropertyKey();
  22352. node.key = this.flowParseTypeInitialiser();
  22353. } else {
  22354. node.id = null;
  22355. node.key = this.flowParseType();
  22356. }
  22357. this.expect(types.bracketR);
  22358. node.value = this.flowParseTypeInitialiser();
  22359. node.variance = variance;
  22360. this.flowObjectTypeSemicolon();
  22361. return this.finishNode(node, "ObjectTypeIndexer");
  22362. };
  22363. pp$8.flowParseObjectTypeMethodish = function (node) {
  22364. node.params = [];
  22365. node.rest = null;
  22366. node.typeParameters = null;
  22367. if (this.isRelational("<")) {
  22368. node.typeParameters = this.flowParseTypeParameterDeclaration();
  22369. }
  22370. this.expect(types.parenL);
  22371. while (!this.match(types.parenR) && !this.match(types.ellipsis)) {
  22372. node.params.push(this.flowParseFunctionTypeParam());
  22373. if (!this.match(types.parenR)) {
  22374. this.expect(types.comma);
  22375. }
  22376. }
  22377. if (this.eat(types.ellipsis)) {
  22378. node.rest = this.flowParseFunctionTypeParam();
  22379. }
  22380. this.expect(types.parenR);
  22381. node.returnType = this.flowParseTypeInitialiser();
  22382. return this.finishNode(node, "FunctionTypeAnnotation");
  22383. };
  22384. pp$8.flowParseObjectTypeMethod = function (startPos, startLoc, isStatic, key) {
  22385. var node = this.startNodeAt(startPos, startLoc);
  22386. node.value = this.flowParseObjectTypeMethodish(this.startNodeAt(startPos, startLoc));
  22387. node.static = isStatic;
  22388. node.key = key;
  22389. node.optional = false;
  22390. this.flowObjectTypeSemicolon();
  22391. return this.finishNode(node, "ObjectTypeProperty");
  22392. };
  22393. pp$8.flowParseObjectTypeCallProperty = function (node, isStatic) {
  22394. var valueNode = this.startNode();
  22395. node.static = isStatic;
  22396. node.value = this.flowParseObjectTypeMethodish(valueNode);
  22397. this.flowObjectTypeSemicolon();
  22398. return this.finishNode(node, "ObjectTypeCallProperty");
  22399. };
  22400. pp$8.flowParseObjectType = function (allowStatic, allowExact, allowSpread) {
  22401. var oldInType = this.state.inType;
  22402. this.state.inType = true;
  22403. var nodeStart = this.startNode();
  22404. var node = void 0;
  22405. var propertyKey = void 0;
  22406. var isStatic = false;
  22407. nodeStart.callProperties = [];
  22408. nodeStart.properties = [];
  22409. nodeStart.indexers = [];
  22410. var endDelim = void 0;
  22411. var exact = void 0;
  22412. if (allowExact && this.match(types.braceBarL)) {
  22413. this.expect(types.braceBarL);
  22414. endDelim = types.braceBarR;
  22415. exact = true;
  22416. } else {
  22417. this.expect(types.braceL);
  22418. endDelim = types.braceR;
  22419. exact = false;
  22420. }
  22421. nodeStart.exact = exact;
  22422. while (!this.match(endDelim)) {
  22423. var optional = false;
  22424. var startPos = this.state.start;
  22425. var startLoc = this.state.startLoc;
  22426. node = this.startNode();
  22427. if (allowStatic && this.isContextual("static") && this.lookahead().type !== types.colon) {
  22428. this.next();
  22429. isStatic = true;
  22430. }
  22431. var variancePos = this.state.start;
  22432. var variance = this.flowParseVariance();
  22433. if (this.match(types.bracketL)) {
  22434. nodeStart.indexers.push(this.flowParseObjectTypeIndexer(node, isStatic, variance));
  22435. } else if (this.match(types.parenL) || this.isRelational("<")) {
  22436. if (variance) {
  22437. this.unexpected(variancePos);
  22438. }
  22439. nodeStart.callProperties.push(this.flowParseObjectTypeCallProperty(node, isStatic));
  22440. } else {
  22441. if (this.match(types.ellipsis)) {
  22442. if (!allowSpread) {
  22443. this.unexpected(null, "Spread operator cannot appear in class or interface definitions");
  22444. }
  22445. if (variance) {
  22446. this.unexpected(variance.start, "Spread properties cannot have variance");
  22447. }
  22448. this.expect(types.ellipsis);
  22449. node.argument = this.flowParseType();
  22450. this.flowObjectTypeSemicolon();
  22451. nodeStart.properties.push(this.finishNode(node, "ObjectTypeSpreadProperty"));
  22452. } else {
  22453. propertyKey = this.flowParseObjectPropertyKey();
  22454. if (this.isRelational("<") || this.match(types.parenL)) {
  22455. // This is a method property
  22456. if (variance) {
  22457. this.unexpected(variance.start);
  22458. }
  22459. nodeStart.properties.push(this.flowParseObjectTypeMethod(startPos, startLoc, isStatic, propertyKey));
  22460. } else {
  22461. if (this.eat(types.question)) {
  22462. optional = true;
  22463. }
  22464. node.key = propertyKey;
  22465. node.value = this.flowParseTypeInitialiser();
  22466. node.optional = optional;
  22467. node.static = isStatic;
  22468. node.variance = variance;
  22469. this.flowObjectTypeSemicolon();
  22470. nodeStart.properties.push(this.finishNode(node, "ObjectTypeProperty"));
  22471. }
  22472. }
  22473. }
  22474. isStatic = false;
  22475. }
  22476. this.expect(endDelim);
  22477. var out = this.finishNode(nodeStart, "ObjectTypeAnnotation");
  22478. this.state.inType = oldInType;
  22479. return out;
  22480. };
  22481. pp$8.flowObjectTypeSemicolon = function () {
  22482. if (!this.eat(types.semi) && !this.eat(types.comma) && !this.match(types.braceR) && !this.match(types.braceBarR)) {
  22483. this.unexpected();
  22484. }
  22485. };
  22486. pp$8.flowParseQualifiedTypeIdentifier = function (startPos, startLoc, id) {
  22487. startPos = startPos || this.state.start;
  22488. startLoc = startLoc || this.state.startLoc;
  22489. var node = id || this.parseIdentifier();
  22490. while (this.eat(types.dot)) {
  22491. var node2 = this.startNodeAt(startPos, startLoc);
  22492. node2.qualification = node;
  22493. node2.id = this.parseIdentifier();
  22494. node = this.finishNode(node2, "QualifiedTypeIdentifier");
  22495. }
  22496. return node;
  22497. };
  22498. pp$8.flowParseGenericType = function (startPos, startLoc, id) {
  22499. var node = this.startNodeAt(startPos, startLoc);
  22500. node.typeParameters = null;
  22501. node.id = this.flowParseQualifiedTypeIdentifier(startPos, startLoc, id);
  22502. if (this.isRelational("<")) {
  22503. node.typeParameters = this.flowParseTypeParameterInstantiation();
  22504. }
  22505. return this.finishNode(node, "GenericTypeAnnotation");
  22506. };
  22507. pp$8.flowParseTypeofType = function () {
  22508. var node = this.startNode();
  22509. this.expect(types._typeof);
  22510. node.argument = this.flowParsePrimaryType();
  22511. return this.finishNode(node, "TypeofTypeAnnotation");
  22512. };
  22513. pp$8.flowParseTupleType = function () {
  22514. var node = this.startNode();
  22515. node.types = [];
  22516. this.expect(types.bracketL);
  22517. // We allow trailing commas
  22518. while (this.state.pos < this.input.length && !this.match(types.bracketR)) {
  22519. node.types.push(this.flowParseType());
  22520. if (this.match(types.bracketR)) break;
  22521. this.expect(types.comma);
  22522. }
  22523. this.expect(types.bracketR);
  22524. return this.finishNode(node, "TupleTypeAnnotation");
  22525. };
  22526. pp$8.flowParseFunctionTypeParam = function () {
  22527. var name = null;
  22528. var optional = false;
  22529. var typeAnnotation = null;
  22530. var node = this.startNode();
  22531. var lh = this.lookahead();
  22532. if (lh.type === types.colon || lh.type === types.question) {
  22533. name = this.parseIdentifier();
  22534. if (this.eat(types.question)) {
  22535. optional = true;
  22536. }
  22537. typeAnnotation = this.flowParseTypeInitialiser();
  22538. } else {
  22539. typeAnnotation = this.flowParseType();
  22540. }
  22541. node.name = name;
  22542. node.optional = optional;
  22543. node.typeAnnotation = typeAnnotation;
  22544. return this.finishNode(node, "FunctionTypeParam");
  22545. };
  22546. pp$8.reinterpretTypeAsFunctionTypeParam = function (type) {
  22547. var node = this.startNodeAt(type.start, type.loc.start);
  22548. node.name = null;
  22549. node.optional = false;
  22550. node.typeAnnotation = type;
  22551. return this.finishNode(node, "FunctionTypeParam");
  22552. };
  22553. pp$8.flowParseFunctionTypeParams = function () {
  22554. var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  22555. var ret = { params: params, rest: null };
  22556. while (!this.match(types.parenR) && !this.match(types.ellipsis)) {
  22557. ret.params.push(this.flowParseFunctionTypeParam());
  22558. if (!this.match(types.parenR)) {
  22559. this.expect(types.comma);
  22560. }
  22561. }
  22562. if (this.eat(types.ellipsis)) {
  22563. ret.rest = this.flowParseFunctionTypeParam();
  22564. }
  22565. return ret;
  22566. };
  22567. pp$8.flowIdentToTypeAnnotation = function (startPos, startLoc, node, id) {
  22568. switch (id.name) {
  22569. case "any":
  22570. return this.finishNode(node, "AnyTypeAnnotation");
  22571. case "void":
  22572. return this.finishNode(node, "VoidTypeAnnotation");
  22573. case "bool":
  22574. case "boolean":
  22575. return this.finishNode(node, "BooleanTypeAnnotation");
  22576. case "mixed":
  22577. return this.finishNode(node, "MixedTypeAnnotation");
  22578. case "empty":
  22579. return this.finishNode(node, "EmptyTypeAnnotation");
  22580. case "number":
  22581. return this.finishNode(node, "NumberTypeAnnotation");
  22582. case "string":
  22583. return this.finishNode(node, "StringTypeAnnotation");
  22584. default:
  22585. return this.flowParseGenericType(startPos, startLoc, id);
  22586. }
  22587. };
  22588. // The parsing of types roughly parallels the parsing of expressions, and
  22589. // primary types are kind of like primary expressions...they're the
  22590. // primitives with which other types are constructed.
  22591. pp$8.flowParsePrimaryType = function () {
  22592. var startPos = this.state.start;
  22593. var startLoc = this.state.startLoc;
  22594. var node = this.startNode();
  22595. var tmp = void 0;
  22596. var type = void 0;
  22597. var isGroupedType = false;
  22598. var oldNoAnonFunctionType = this.state.noAnonFunctionType;
  22599. switch (this.state.type) {
  22600. case types.name:
  22601. return this.flowIdentToTypeAnnotation(startPos, startLoc, node, this.parseIdentifier());
  22602. case types.braceL:
  22603. return this.flowParseObjectType(false, false, true);
  22604. case types.braceBarL:
  22605. return this.flowParseObjectType(false, true, true);
  22606. case types.bracketL:
  22607. return this.flowParseTupleType();
  22608. case types.relational:
  22609. if (this.state.value === "<") {
  22610. node.typeParameters = this.flowParseTypeParameterDeclaration();
  22611. this.expect(types.parenL);
  22612. tmp = this.flowParseFunctionTypeParams();
  22613. node.params = tmp.params;
  22614. node.rest = tmp.rest;
  22615. this.expect(types.parenR);
  22616. this.expect(types.arrow);
  22617. node.returnType = this.flowParseType();
  22618. return this.finishNode(node, "FunctionTypeAnnotation");
  22619. }
  22620. break;
  22621. case types.parenL:
  22622. this.next();
  22623. // Check to see if this is actually a grouped type
  22624. if (!this.match(types.parenR) && !this.match(types.ellipsis)) {
  22625. if (this.match(types.name)) {
  22626. var token = this.lookahead().type;
  22627. isGroupedType = token !== types.question && token !== types.colon;
  22628. } else {
  22629. isGroupedType = true;
  22630. }
  22631. }
  22632. if (isGroupedType) {
  22633. this.state.noAnonFunctionType = false;
  22634. type = this.flowParseType();
  22635. this.state.noAnonFunctionType = oldNoAnonFunctionType;
  22636. // A `,` or a `) =>` means this is an anonymous function type
  22637. if (this.state.noAnonFunctionType || !(this.match(types.comma) || this.match(types.parenR) && this.lookahead().type === types.arrow)) {
  22638. this.expect(types.parenR);
  22639. return type;
  22640. } else {
  22641. // Eat a comma if there is one
  22642. this.eat(types.comma);
  22643. }
  22644. }
  22645. if (type) {
  22646. tmp = this.flowParseFunctionTypeParams([this.reinterpretTypeAsFunctionTypeParam(type)]);
  22647. } else {
  22648. tmp = this.flowParseFunctionTypeParams();
  22649. }
  22650. node.params = tmp.params;
  22651. node.rest = tmp.rest;
  22652. this.expect(types.parenR);
  22653. this.expect(types.arrow);
  22654. node.returnType = this.flowParseType();
  22655. node.typeParameters = null;
  22656. return this.finishNode(node, "FunctionTypeAnnotation");
  22657. case types.string:
  22658. return this.parseLiteral(this.state.value, "StringLiteralTypeAnnotation");
  22659. case types._true:case types._false:
  22660. node.value = this.match(types._true);
  22661. this.next();
  22662. return this.finishNode(node, "BooleanLiteralTypeAnnotation");
  22663. case types.plusMin:
  22664. if (this.state.value === "-") {
  22665. this.next();
  22666. if (!this.match(types.num)) this.unexpected(null, "Unexpected token, expected number");
  22667. return this.parseLiteral(-this.state.value, "NumericLiteralTypeAnnotation", node.start, node.loc.start);
  22668. }
  22669. this.unexpected();
  22670. case types.num:
  22671. return this.parseLiteral(this.state.value, "NumericLiteralTypeAnnotation");
  22672. case types._null:
  22673. node.value = this.match(types._null);
  22674. this.next();
  22675. return this.finishNode(node, "NullLiteralTypeAnnotation");
  22676. case types._this:
  22677. node.value = this.match(types._this);
  22678. this.next();
  22679. return this.finishNode(node, "ThisTypeAnnotation");
  22680. case types.star:
  22681. this.next();
  22682. return this.finishNode(node, "ExistentialTypeParam");
  22683. default:
  22684. if (this.state.type.keyword === "typeof") {
  22685. return this.flowParseTypeofType();
  22686. }
  22687. }
  22688. this.unexpected();
  22689. };
  22690. pp$8.flowParsePostfixType = function () {
  22691. var startPos = this.state.start,
  22692. startLoc = this.state.startLoc;
  22693. var type = this.flowParsePrimaryType();
  22694. while (!this.canInsertSemicolon() && this.match(types.bracketL)) {
  22695. var node = this.startNodeAt(startPos, startLoc);
  22696. node.elementType = type;
  22697. this.expect(types.bracketL);
  22698. this.expect(types.bracketR);
  22699. type = this.finishNode(node, "ArrayTypeAnnotation");
  22700. }
  22701. return type;
  22702. };
  22703. pp$8.flowParsePrefixType = function () {
  22704. var node = this.startNode();
  22705. if (this.eat(types.question)) {
  22706. node.typeAnnotation = this.flowParsePrefixType();
  22707. return this.finishNode(node, "NullableTypeAnnotation");
  22708. } else {
  22709. return this.flowParsePostfixType();
  22710. }
  22711. };
  22712. pp$8.flowParseAnonFunctionWithoutParens = function () {
  22713. var param = this.flowParsePrefixType();
  22714. if (!this.state.noAnonFunctionType && this.eat(types.arrow)) {
  22715. var node = this.startNodeAt(param.start, param.loc.start);
  22716. node.params = [this.reinterpretTypeAsFunctionTypeParam(param)];
  22717. node.rest = null;
  22718. node.returnType = this.flowParseType();
  22719. node.typeParameters = null;
  22720. return this.finishNode(node, "FunctionTypeAnnotation");
  22721. }
  22722. return param;
  22723. };
  22724. pp$8.flowParseIntersectionType = function () {
  22725. var node = this.startNode();
  22726. this.eat(types.bitwiseAND);
  22727. var type = this.flowParseAnonFunctionWithoutParens();
  22728. node.types = [type];
  22729. while (this.eat(types.bitwiseAND)) {
  22730. node.types.push(this.flowParseAnonFunctionWithoutParens());
  22731. }
  22732. return node.types.length === 1 ? type : this.finishNode(node, "IntersectionTypeAnnotation");
  22733. };
  22734. pp$8.flowParseUnionType = function () {
  22735. var node = this.startNode();
  22736. this.eat(types.bitwiseOR);
  22737. var type = this.flowParseIntersectionType();
  22738. node.types = [type];
  22739. while (this.eat(types.bitwiseOR)) {
  22740. node.types.push(this.flowParseIntersectionType());
  22741. }
  22742. return node.types.length === 1 ? type : this.finishNode(node, "UnionTypeAnnotation");
  22743. };
  22744. pp$8.flowParseType = function () {
  22745. var oldInType = this.state.inType;
  22746. this.state.inType = true;
  22747. var type = this.flowParseUnionType();
  22748. this.state.inType = oldInType;
  22749. return type;
  22750. };
  22751. pp$8.flowParseTypeAnnotation = function () {
  22752. var node = this.startNode();
  22753. node.typeAnnotation = this.flowParseTypeInitialiser();
  22754. return this.finishNode(node, "TypeAnnotation");
  22755. };
  22756. pp$8.flowParseTypeAndPredicateAnnotation = function () {
  22757. var node = this.startNode();
  22758. var _flowParseTypeAndPred2 = this.flowParseTypeAndPredicateInitialiser();
  22759. node.typeAnnotation = _flowParseTypeAndPred2[0];
  22760. node.predicate = _flowParseTypeAndPred2[1];
  22761. return this.finishNode(node, "TypeAnnotation");
  22762. };
  22763. pp$8.flowParseTypeAnnotatableIdentifier = function () {
  22764. var ident = this.flowParseRestrictedIdentifier();
  22765. if (this.match(types.colon)) {
  22766. ident.typeAnnotation = this.flowParseTypeAnnotation();
  22767. this.finishNode(ident, ident.type);
  22768. }
  22769. return ident;
  22770. };
  22771. pp$8.typeCastToParameter = function (node) {
  22772. node.expression.typeAnnotation = node.typeAnnotation;
  22773. return this.finishNodeAt(node.expression, node.expression.type, node.typeAnnotation.end, node.typeAnnotation.loc.end);
  22774. };
  22775. pp$8.flowParseVariance = function () {
  22776. var variance = null;
  22777. if (this.match(types.plusMin)) {
  22778. if (this.state.value === "+") {
  22779. variance = "plus";
  22780. } else if (this.state.value === "-") {
  22781. variance = "minus";
  22782. }
  22783. this.next();
  22784. }
  22785. return variance;
  22786. };
  22787. var flowPlugin = function (instance) {
  22788. // plain function return types: function name(): string {}
  22789. instance.extend("parseFunctionBody", function (inner) {
  22790. return function (node, allowExpression) {
  22791. if (this.match(types.colon) && !allowExpression) {
  22792. // if allowExpression is true then we're parsing an arrow function and if
  22793. // there's a return type then it's been handled elsewhere
  22794. node.returnType = this.flowParseTypeAndPredicateAnnotation();
  22795. }
  22796. return inner.call(this, node, allowExpression);
  22797. };
  22798. });
  22799. // interfaces
  22800. instance.extend("parseStatement", function (inner) {
  22801. return function (declaration, topLevel) {
  22802. // strict mode handling of `interface` since it's a reserved word
  22803. if (this.state.strict && this.match(types.name) && this.state.value === "interface") {
  22804. var node = this.startNode();
  22805. this.next();
  22806. return this.flowParseInterface(node);
  22807. } else {
  22808. return inner.call(this, declaration, topLevel);
  22809. }
  22810. };
  22811. });
  22812. // declares, interfaces and type aliases
  22813. instance.extend("parseExpressionStatement", function (inner) {
  22814. return function (node, expr) {
  22815. if (expr.type === "Identifier") {
  22816. if (expr.name === "declare") {
  22817. if (this.match(types._class) || this.match(types.name) || this.match(types._function) || this.match(types._var) || this.match(types._export)) {
  22818. return this.flowParseDeclare(node);
  22819. }
  22820. } else if (this.match(types.name)) {
  22821. if (expr.name === "interface") {
  22822. return this.flowParseInterface(node);
  22823. } else if (expr.name === "type") {
  22824. return this.flowParseTypeAlias(node);
  22825. } else if (expr.name === "opaque") {
  22826. return this.flowParseOpaqueType(node, false);
  22827. }
  22828. }
  22829. }
  22830. return inner.call(this, node, expr);
  22831. };
  22832. });
  22833. // export type
  22834. instance.extend("shouldParseExportDeclaration", function (inner) {
  22835. return function () {
  22836. return this.isContextual("type") || this.isContextual("interface") || this.isContextual("opaque") || inner.call(this);
  22837. };
  22838. });
  22839. instance.extend("isExportDefaultSpecifier", function (inner) {
  22840. return function () {
  22841. if (this.match(types.name) && (this.state.value === "type" || this.state.value === "interface" || this.state.value === "opaque")) {
  22842. return false;
  22843. }
  22844. return inner.call(this);
  22845. };
  22846. });
  22847. instance.extend("parseConditional", function (inner) {
  22848. return function (expr, noIn, startPos, startLoc, refNeedsArrowPos) {
  22849. // only do the expensive clone if there is a question mark
  22850. // and if we come from inside parens
  22851. if (refNeedsArrowPos && this.match(types.question)) {
  22852. var state = this.state.clone();
  22853. try {
  22854. return inner.call(this, expr, noIn, startPos, startLoc);
  22855. } catch (err) {
  22856. if (err instanceof SyntaxError) {
  22857. this.state = state;
  22858. refNeedsArrowPos.start = err.pos || this.state.start;
  22859. return expr;
  22860. } else {
  22861. // istanbul ignore next: no such error is expected
  22862. throw err;
  22863. }
  22864. }
  22865. }
  22866. return inner.call(this, expr, noIn, startPos, startLoc);
  22867. };
  22868. });
  22869. instance.extend("parseParenItem", function (inner) {
  22870. return function (node, startPos, startLoc) {
  22871. node = inner.call(this, node, startPos, startLoc);
  22872. if (this.eat(types.question)) {
  22873. node.optional = true;
  22874. }
  22875. if (this.match(types.colon)) {
  22876. var typeCastNode = this.startNodeAt(startPos, startLoc);
  22877. typeCastNode.expression = node;
  22878. typeCastNode.typeAnnotation = this.flowParseTypeAnnotation();
  22879. return this.finishNode(typeCastNode, "TypeCastExpression");
  22880. }
  22881. return node;
  22882. };
  22883. });
  22884. instance.extend("parseExport", function (inner) {
  22885. return function (node) {
  22886. node = inner.call(this, node);
  22887. if (node.type === "ExportNamedDeclaration") {
  22888. node.exportKind = node.exportKind || "value";
  22889. }
  22890. return node;
  22891. };
  22892. });
  22893. instance.extend("parseExportDeclaration", function (inner) {
  22894. return function (node) {
  22895. if (this.isContextual("type")) {
  22896. node.exportKind = "type";
  22897. var declarationNode = this.startNode();
  22898. this.next();
  22899. if (this.match(types.braceL)) {
  22900. // export type { foo, bar };
  22901. node.specifiers = this.parseExportSpecifiers();
  22902. this.parseExportFrom(node);
  22903. return null;
  22904. } else {
  22905. // export type Foo = Bar;
  22906. return this.flowParseTypeAlias(declarationNode);
  22907. }
  22908. } else if (this.isContextual("opaque")) {
  22909. node.exportKind = "type";
  22910. var _declarationNode = this.startNode();
  22911. this.next();
  22912. // export opaque type Foo = Bar;
  22913. return this.flowParseOpaqueType(_declarationNode, false);
  22914. } else if (this.isContextual("interface")) {
  22915. node.exportKind = "type";
  22916. var _declarationNode2 = this.startNode();
  22917. this.next();
  22918. return this.flowParseInterface(_declarationNode2);
  22919. } else {
  22920. return inner.call(this, node);
  22921. }
  22922. };
  22923. });
  22924. instance.extend("parseClassId", function (inner) {
  22925. return function (node) {
  22926. inner.apply(this, arguments);
  22927. if (this.isRelational("<")) {
  22928. node.typeParameters = this.flowParseTypeParameterDeclaration();
  22929. }
  22930. };
  22931. });
  22932. // don't consider `void` to be a keyword as then it'll use the void token type
  22933. // and set startExpr
  22934. instance.extend("isKeyword", function (inner) {
  22935. return function (name) {
  22936. if (this.state.inType && name === "void") {
  22937. return false;
  22938. } else {
  22939. return inner.call(this, name);
  22940. }
  22941. };
  22942. });
  22943. // ensure that inside flow types, we bypass the jsx parser plugin
  22944. instance.extend("readToken", function (inner) {
  22945. return function (code) {
  22946. if (this.state.inType && (code === 62 || code === 60)) {
  22947. return this.finishOp(types.relational, 1);
  22948. } else {
  22949. return inner.call(this, code);
  22950. }
  22951. };
  22952. });
  22953. // don't lex any token as a jsx one inside a flow type
  22954. instance.extend("jsx_readToken", function (inner) {
  22955. return function () {
  22956. if (!this.state.inType) return inner.call(this);
  22957. };
  22958. });
  22959. instance.extend("toAssignable", function (inner) {
  22960. return function (node, isBinding, contextDescription) {
  22961. if (node.type === "TypeCastExpression") {
  22962. return inner.call(this, this.typeCastToParameter(node), isBinding, contextDescription);
  22963. } else {
  22964. return inner.call(this, node, isBinding, contextDescription);
  22965. }
  22966. };
  22967. });
  22968. // turn type casts that we found in function parameter head into type annotated params
  22969. instance.extend("toAssignableList", function (inner) {
  22970. return function (exprList, isBinding, contextDescription) {
  22971. for (var i = 0; i < exprList.length; i++) {
  22972. var expr = exprList[i];
  22973. if (expr && expr.type === "TypeCastExpression") {
  22974. exprList[i] = this.typeCastToParameter(expr);
  22975. }
  22976. }
  22977. return inner.call(this, exprList, isBinding, contextDescription);
  22978. };
  22979. });
  22980. // this is a list of nodes, from something like a call expression, we need to filter the
  22981. // type casts that we've found that are illegal in this context
  22982. instance.extend("toReferencedList", function () {
  22983. return function (exprList) {
  22984. for (var i = 0; i < exprList.length; i++) {
  22985. var expr = exprList[i];
  22986. if (expr && expr._exprListItem && expr.type === "TypeCastExpression") {
  22987. this.raise(expr.start, "Unexpected type cast");
  22988. }
  22989. }
  22990. return exprList;
  22991. };
  22992. });
  22993. // parse an item inside a expression list eg. `(NODE, NODE)` where NODE represents
  22994. // the position where this function is called
  22995. instance.extend("parseExprListItem", function (inner) {
  22996. return function () {
  22997. var container = this.startNode();
  22998. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  22999. args[_key] = arguments[_key];
  23000. }
  23001. var node = inner.call.apply(inner, [this].concat(args));
  23002. if (this.match(types.colon)) {
  23003. container._exprListItem = true;
  23004. container.expression = node;
  23005. container.typeAnnotation = this.flowParseTypeAnnotation();
  23006. return this.finishNode(container, "TypeCastExpression");
  23007. } else {
  23008. return node;
  23009. }
  23010. };
  23011. });
  23012. instance.extend("checkLVal", function (inner) {
  23013. return function (node) {
  23014. if (node.type !== "TypeCastExpression") {
  23015. return inner.apply(this, arguments);
  23016. }
  23017. };
  23018. });
  23019. // parse class property type annotations
  23020. instance.extend("parseClassProperty", function (inner) {
  23021. return function (node) {
  23022. delete node.variancePos;
  23023. if (this.match(types.colon)) {
  23024. node.typeAnnotation = this.flowParseTypeAnnotation();
  23025. }
  23026. return inner.call(this, node);
  23027. };
  23028. });
  23029. // determine whether or not we're currently in the position where a class method would appear
  23030. instance.extend("isClassMethod", function (inner) {
  23031. return function () {
  23032. return this.isRelational("<") || inner.call(this);
  23033. };
  23034. });
  23035. // determine whether or not we're currently in the position where a class property would appear
  23036. instance.extend("isClassProperty", function (inner) {
  23037. return function () {
  23038. return this.match(types.colon) || inner.call(this);
  23039. };
  23040. });
  23041. instance.extend("isNonstaticConstructor", function (inner) {
  23042. return function (method) {
  23043. return !this.match(types.colon) && inner.call(this, method);
  23044. };
  23045. });
  23046. // parse type parameters for class methods
  23047. instance.extend("parseClassMethod", function (inner) {
  23048. return function (classBody, method) {
  23049. if (method.variance) {
  23050. this.unexpected(method.variancePos);
  23051. }
  23052. delete method.variance;
  23053. delete method.variancePos;
  23054. if (this.isRelational("<")) {
  23055. method.typeParameters = this.flowParseTypeParameterDeclaration();
  23056. }
  23057. for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
  23058. args[_key2 - 2] = arguments[_key2];
  23059. }
  23060. inner.call.apply(inner, [this, classBody, method].concat(args));
  23061. };
  23062. });
  23063. // parse a the super class type parameters and implements
  23064. instance.extend("parseClassSuper", function (inner) {
  23065. return function (node, isStatement) {
  23066. inner.call(this, node, isStatement);
  23067. if (node.superClass && this.isRelational("<")) {
  23068. node.superTypeParameters = this.flowParseTypeParameterInstantiation();
  23069. }
  23070. if (this.isContextual("implements")) {
  23071. this.next();
  23072. var implemented = node.implements = [];
  23073. do {
  23074. var _node = this.startNode();
  23075. _node.id = this.parseIdentifier();
  23076. if (this.isRelational("<")) {
  23077. _node.typeParameters = this.flowParseTypeParameterInstantiation();
  23078. } else {
  23079. _node.typeParameters = null;
  23080. }
  23081. implemented.push(this.finishNode(_node, "ClassImplements"));
  23082. } while (this.eat(types.comma));
  23083. }
  23084. };
  23085. });
  23086. instance.extend("parsePropertyName", function (inner) {
  23087. return function (node) {
  23088. var variancePos = this.state.start;
  23089. var variance = this.flowParseVariance();
  23090. var key = inner.call(this, node);
  23091. node.variance = variance;
  23092. node.variancePos = variancePos;
  23093. return key;
  23094. };
  23095. });
  23096. // parse type parameters for object method shorthand
  23097. instance.extend("parseObjPropValue", function (inner) {
  23098. return function (prop) {
  23099. if (prop.variance) {
  23100. this.unexpected(prop.variancePos);
  23101. }
  23102. delete prop.variance;
  23103. delete prop.variancePos;
  23104. var typeParameters = void 0;
  23105. // method shorthand
  23106. if (this.isRelational("<")) {
  23107. typeParameters = this.flowParseTypeParameterDeclaration();
  23108. if (!this.match(types.parenL)) this.unexpected();
  23109. }
  23110. inner.apply(this, arguments);
  23111. // add typeParameters if we found them
  23112. if (typeParameters) {
  23113. (prop.value || prop).typeParameters = typeParameters;
  23114. }
  23115. };
  23116. });
  23117. instance.extend("parseAssignableListItemTypes", function () {
  23118. return function (param) {
  23119. if (this.eat(types.question)) {
  23120. param.optional = true;
  23121. }
  23122. if (this.match(types.colon)) {
  23123. param.typeAnnotation = this.flowParseTypeAnnotation();
  23124. }
  23125. this.finishNode(param, param.type);
  23126. return param;
  23127. };
  23128. });
  23129. instance.extend("parseMaybeDefault", function (inner) {
  23130. return function () {
  23131. for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  23132. args[_key3] = arguments[_key3];
  23133. }
  23134. var node = inner.apply(this, args);
  23135. if (node.type === "AssignmentPattern" && node.typeAnnotation && node.right.start < node.typeAnnotation.start) {
  23136. this.raise(node.typeAnnotation.start, "Type annotations must come before default assignments, e.g. instead of `age = 25: number` use `age: number = 25`");
  23137. }
  23138. return node;
  23139. };
  23140. });
  23141. // parse typeof and type imports
  23142. instance.extend("parseImportSpecifiers", function (inner) {
  23143. return function (node) {
  23144. node.importKind = "value";
  23145. var kind = null;
  23146. if (this.match(types._typeof)) {
  23147. kind = "typeof";
  23148. } else if (this.isContextual("type")) {
  23149. kind = "type";
  23150. }
  23151. if (kind) {
  23152. var lh = this.lookahead();
  23153. if (lh.type === types.name && lh.value !== "from" || lh.type === types.braceL || lh.type === types.star) {
  23154. this.next();
  23155. node.importKind = kind;
  23156. }
  23157. }
  23158. inner.call(this, node);
  23159. };
  23160. });
  23161. // parse import-type/typeof shorthand
  23162. instance.extend("parseImportSpecifier", function () {
  23163. return function (node) {
  23164. var specifier = this.startNode();
  23165. var firstIdentLoc = this.state.start;
  23166. var firstIdent = this.parseIdentifier(true);
  23167. var specifierTypeKind = null;
  23168. if (firstIdent.name === "type") {
  23169. specifierTypeKind = "type";
  23170. } else if (firstIdent.name === "typeof") {
  23171. specifierTypeKind = "typeof";
  23172. }
  23173. var isBinding = false;
  23174. if (this.isContextual("as")) {
  23175. var as_ident = this.parseIdentifier(true);
  23176. if (specifierTypeKind !== null && !this.match(types.name) && !this.state.type.keyword) {
  23177. // `import {type as ,` or `import {type as }`
  23178. specifier.imported = as_ident;
  23179. specifier.importKind = specifierTypeKind;
  23180. specifier.local = as_ident.__clone();
  23181. } else {
  23182. // `import {type as foo`
  23183. specifier.imported = firstIdent;
  23184. specifier.importKind = null;
  23185. specifier.local = this.parseIdentifier();
  23186. }
  23187. } else if (specifierTypeKind !== null && (this.match(types.name) || this.state.type.keyword)) {
  23188. // `import {type foo`
  23189. specifier.imported = this.parseIdentifier(true);
  23190. specifier.importKind = specifierTypeKind;
  23191. if (this.eatContextual("as")) {
  23192. specifier.local = this.parseIdentifier();
  23193. } else {
  23194. isBinding = true;
  23195. specifier.local = specifier.imported.__clone();
  23196. }
  23197. } else {
  23198. isBinding = true;
  23199. specifier.imported = firstIdent;
  23200. specifier.importKind = null;
  23201. specifier.local = specifier.imported.__clone();
  23202. }
  23203. if ((node.importKind === "type" || node.importKind === "typeof") && (specifier.importKind === "type" || specifier.importKind === "typeof")) {
  23204. 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`");
  23205. }
  23206. if (isBinding) this.checkReservedWord(specifier.local.name, specifier.start, true, true);
  23207. this.checkLVal(specifier.local, true, undefined, "import specifier");
  23208. node.specifiers.push(this.finishNode(specifier, "ImportSpecifier"));
  23209. };
  23210. });
  23211. // parse function type parameters - function foo<T>() {}
  23212. instance.extend("parseFunctionParams", function (inner) {
  23213. return function (node) {
  23214. if (this.isRelational("<")) {
  23215. node.typeParameters = this.flowParseTypeParameterDeclaration();
  23216. }
  23217. inner.call(this, node);
  23218. };
  23219. });
  23220. // parse flow type annotations on variable declarator heads - let foo: string = bar
  23221. instance.extend("parseVarHead", function (inner) {
  23222. return function (decl) {
  23223. inner.call(this, decl);
  23224. if (this.match(types.colon)) {
  23225. decl.id.typeAnnotation = this.flowParseTypeAnnotation();
  23226. this.finishNode(decl.id, decl.id.type);
  23227. }
  23228. };
  23229. });
  23230. // parse the return type of an async arrow function - let foo = (async (): number => {});
  23231. instance.extend("parseAsyncArrowFromCallExpression", function (inner) {
  23232. return function (node, call) {
  23233. if (this.match(types.colon)) {
  23234. var oldNoAnonFunctionType = this.state.noAnonFunctionType;
  23235. this.state.noAnonFunctionType = true;
  23236. node.returnType = this.flowParseTypeAnnotation();
  23237. this.state.noAnonFunctionType = oldNoAnonFunctionType;
  23238. }
  23239. return inner.call(this, node, call);
  23240. };
  23241. });
  23242. // todo description
  23243. instance.extend("shouldParseAsyncArrow", function (inner) {
  23244. return function () {
  23245. return this.match(types.colon) || inner.call(this);
  23246. };
  23247. });
  23248. // We need to support type parameter declarations for arrow functions. This
  23249. // is tricky. There are three situations we need to handle
  23250. //
  23251. // 1. This is either JSX or an arrow function. We'll try JSX first. If that
  23252. // fails, we'll try an arrow function. If that fails, we'll throw the JSX
  23253. // error.
  23254. // 2. This is an arrow function. We'll parse the type parameter declaration,
  23255. // parse the rest, make sure the rest is an arrow function, and go from
  23256. // there
  23257. // 3. This is neither. Just call the inner function
  23258. instance.extend("parseMaybeAssign", function (inner) {
  23259. return function () {
  23260. var jsxError = null;
  23261. for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  23262. args[_key4] = arguments[_key4];
  23263. }
  23264. if (types.jsxTagStart && this.match(types.jsxTagStart)) {
  23265. var state = this.state.clone();
  23266. try {
  23267. return inner.apply(this, args);
  23268. } catch (err) {
  23269. if (err instanceof SyntaxError) {
  23270. this.state = state;
  23271. // Remove `tc.j_expr` and `tc.j_oTag` from context added
  23272. // by parsing `jsxTagStart` to stop the JSX plugin from
  23273. // messing with the tokens
  23274. this.state.context.length -= 2;
  23275. jsxError = err;
  23276. } else {
  23277. // istanbul ignore next: no such error is expected
  23278. throw err;
  23279. }
  23280. }
  23281. }
  23282. if (jsxError != null || this.isRelational("<")) {
  23283. var arrowExpression = void 0;
  23284. var typeParameters = void 0;
  23285. try {
  23286. typeParameters = this.flowParseTypeParameterDeclaration();
  23287. arrowExpression = inner.apply(this, args);
  23288. arrowExpression.typeParameters = typeParameters;
  23289. arrowExpression.start = typeParameters.start;
  23290. arrowExpression.loc.start = typeParameters.loc.start;
  23291. } catch (err) {
  23292. throw jsxError || err;
  23293. }
  23294. if (arrowExpression.type === "ArrowFunctionExpression") {
  23295. return arrowExpression;
  23296. } else if (jsxError != null) {
  23297. throw jsxError;
  23298. } else {
  23299. this.raise(typeParameters.start, "Expected an arrow function after this type parameter declaration");
  23300. }
  23301. }
  23302. return inner.apply(this, args);
  23303. };
  23304. });
  23305. // handle return types for arrow functions
  23306. instance.extend("parseArrow", function (inner) {
  23307. return function (node) {
  23308. if (this.match(types.colon)) {
  23309. var state = this.state.clone();
  23310. try {
  23311. var oldNoAnonFunctionType = this.state.noAnonFunctionType;
  23312. this.state.noAnonFunctionType = true;
  23313. var returnType = this.flowParseTypeAndPredicateAnnotation();
  23314. this.state.noAnonFunctionType = oldNoAnonFunctionType;
  23315. if (this.canInsertSemicolon()) this.unexpected();
  23316. if (!this.match(types.arrow)) this.unexpected();
  23317. // assign after it is clear it is an arrow
  23318. node.returnType = returnType;
  23319. } catch (err) {
  23320. if (err instanceof SyntaxError) {
  23321. this.state = state;
  23322. } else {
  23323. // istanbul ignore next: no such error is expected
  23324. throw err;
  23325. }
  23326. }
  23327. }
  23328. return inner.call(this, node);
  23329. };
  23330. });
  23331. instance.extend("shouldParseArrow", function (inner) {
  23332. return function () {
  23333. return this.match(types.colon) || inner.call(this);
  23334. };
  23335. });
  23336. };
  23337. // Adapted from String.fromcodepoint to export the function without modifying String
  23338. /*! https://mths.be/fromcodepoint v0.2.1 by @mathias */
  23339. // The MIT License (MIT)
  23340. // Copyright (c) Mathias Bynens
  23341. //
  23342. // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
  23343. // associated documentation files (the "Software"), to deal in the Software without restriction,
  23344. // including without limitation the rights to use, copy, modify, merge, publish, distribute,
  23345. // sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
  23346. // furnished to do so, subject to the following conditions:
  23347. //
  23348. // The above copyright notice and this permission notice shall be included in all copies or
  23349. // substantial portions of the Software.
  23350. //
  23351. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
  23352. // NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  23353. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  23354. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  23355. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23356. var fromCodePoint = String.fromCodePoint;
  23357. if (!fromCodePoint) {
  23358. var stringFromCharCode = String.fromCharCode;
  23359. var floor = Math.floor;
  23360. fromCodePoint = function fromCodePoint() {
  23361. var MAX_SIZE = 0x4000;
  23362. var codeUnits = [];
  23363. var highSurrogate = void 0;
  23364. var lowSurrogate = void 0;
  23365. var index = -1;
  23366. var length = arguments.length;
  23367. if (!length) {
  23368. return "";
  23369. }
  23370. var result = "";
  23371. while (++index < length) {
  23372. var codePoint = Number(arguments[index]);
  23373. if (!isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`
  23374. codePoint < 0 || // not a valid Unicode code point
  23375. codePoint > 0x10FFFF || // not a valid Unicode code point
  23376. floor(codePoint) != codePoint // not an integer
  23377. ) {
  23378. throw RangeError("Invalid code point: " + codePoint);
  23379. }
  23380. if (codePoint <= 0xFFFF) {
  23381. // BMP code point
  23382. codeUnits.push(codePoint);
  23383. } else {
  23384. // Astral code point; split in surrogate halves
  23385. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  23386. codePoint -= 0x10000;
  23387. highSurrogate = (codePoint >> 10) + 0xD800;
  23388. lowSurrogate = codePoint % 0x400 + 0xDC00;
  23389. codeUnits.push(highSurrogate, lowSurrogate);
  23390. }
  23391. if (index + 1 == length || codeUnits.length > MAX_SIZE) {
  23392. result += stringFromCharCode.apply(null, codeUnits);
  23393. codeUnits.length = 0;
  23394. }
  23395. }
  23396. return result;
  23397. };
  23398. }
  23399. var fromCodePoint$1 = fromCodePoint;
  23400. var XHTMLEntities = {
  23401. quot: "\"",
  23402. amp: "&",
  23403. apos: "'",
  23404. lt: "<",
  23405. gt: ">",
  23406. nbsp: "\xA0",
  23407. iexcl: "\xA1",
  23408. cent: "\xA2",
  23409. pound: "\xA3",
  23410. curren: "\xA4",
  23411. yen: "\xA5",
  23412. brvbar: "\xA6",
  23413. sect: "\xA7",
  23414. uml: "\xA8",
  23415. copy: "\xA9",
  23416. ordf: "\xAA",
  23417. laquo: "\xAB",
  23418. not: "\xAC",
  23419. shy: "\xAD",
  23420. reg: "\xAE",
  23421. macr: "\xAF",
  23422. deg: "\xB0",
  23423. plusmn: "\xB1",
  23424. sup2: "\xB2",
  23425. sup3: "\xB3",
  23426. acute: "\xB4",
  23427. micro: "\xB5",
  23428. para: "\xB6",
  23429. middot: "\xB7",
  23430. cedil: "\xB8",
  23431. sup1: "\xB9",
  23432. ordm: "\xBA",
  23433. raquo: "\xBB",
  23434. frac14: "\xBC",
  23435. frac12: "\xBD",
  23436. frac34: "\xBE",
  23437. iquest: "\xBF",
  23438. Agrave: "\xC0",
  23439. Aacute: "\xC1",
  23440. Acirc: "\xC2",
  23441. Atilde: "\xC3",
  23442. Auml: "\xC4",
  23443. Aring: "\xC5",
  23444. AElig: "\xC6",
  23445. Ccedil: "\xC7",
  23446. Egrave: "\xC8",
  23447. Eacute: "\xC9",
  23448. Ecirc: "\xCA",
  23449. Euml: "\xCB",
  23450. Igrave: "\xCC",
  23451. Iacute: "\xCD",
  23452. Icirc: "\xCE",
  23453. Iuml: "\xCF",
  23454. ETH: "\xD0",
  23455. Ntilde: "\xD1",
  23456. Ograve: "\xD2",
  23457. Oacute: "\xD3",
  23458. Ocirc: "\xD4",
  23459. Otilde: "\xD5",
  23460. Ouml: "\xD6",
  23461. times: "\xD7",
  23462. Oslash: "\xD8",
  23463. Ugrave: "\xD9",
  23464. Uacute: "\xDA",
  23465. Ucirc: "\xDB",
  23466. Uuml: "\xDC",
  23467. Yacute: "\xDD",
  23468. THORN: "\xDE",
  23469. szlig: "\xDF",
  23470. agrave: "\xE0",
  23471. aacute: "\xE1",
  23472. acirc: "\xE2",
  23473. atilde: "\xE3",
  23474. auml: "\xE4",
  23475. aring: "\xE5",
  23476. aelig: "\xE6",
  23477. ccedil: "\xE7",
  23478. egrave: "\xE8",
  23479. eacute: "\xE9",
  23480. ecirc: "\xEA",
  23481. euml: "\xEB",
  23482. igrave: "\xEC",
  23483. iacute: "\xED",
  23484. icirc: "\xEE",
  23485. iuml: "\xEF",
  23486. eth: "\xF0",
  23487. ntilde: "\xF1",
  23488. ograve: "\xF2",
  23489. oacute: "\xF3",
  23490. ocirc: "\xF4",
  23491. otilde: "\xF5",
  23492. ouml: "\xF6",
  23493. divide: "\xF7",
  23494. oslash: "\xF8",
  23495. ugrave: "\xF9",
  23496. uacute: "\xFA",
  23497. ucirc: "\xFB",
  23498. uuml: "\xFC",
  23499. yacute: "\xFD",
  23500. thorn: "\xFE",
  23501. yuml: "\xFF",
  23502. OElig: "\u0152",
  23503. oelig: "\u0153",
  23504. Scaron: "\u0160",
  23505. scaron: "\u0161",
  23506. Yuml: "\u0178",
  23507. fnof: "\u0192",
  23508. circ: "\u02C6",
  23509. tilde: "\u02DC",
  23510. Alpha: "\u0391",
  23511. Beta: "\u0392",
  23512. Gamma: "\u0393",
  23513. Delta: "\u0394",
  23514. Epsilon: "\u0395",
  23515. Zeta: "\u0396",
  23516. Eta: "\u0397",
  23517. Theta: "\u0398",
  23518. Iota: "\u0399",
  23519. Kappa: "\u039A",
  23520. Lambda: "\u039B",
  23521. Mu: "\u039C",
  23522. Nu: "\u039D",
  23523. Xi: "\u039E",
  23524. Omicron: "\u039F",
  23525. Pi: "\u03A0",
  23526. Rho: "\u03A1",
  23527. Sigma: "\u03A3",
  23528. Tau: "\u03A4",
  23529. Upsilon: "\u03A5",
  23530. Phi: "\u03A6",
  23531. Chi: "\u03A7",
  23532. Psi: "\u03A8",
  23533. Omega: "\u03A9",
  23534. alpha: "\u03B1",
  23535. beta: "\u03B2",
  23536. gamma: "\u03B3",
  23537. delta: "\u03B4",
  23538. epsilon: "\u03B5",
  23539. zeta: "\u03B6",
  23540. eta: "\u03B7",
  23541. theta: "\u03B8",
  23542. iota: "\u03B9",
  23543. kappa: "\u03BA",
  23544. lambda: "\u03BB",
  23545. mu: "\u03BC",
  23546. nu: "\u03BD",
  23547. xi: "\u03BE",
  23548. omicron: "\u03BF",
  23549. pi: "\u03C0",
  23550. rho: "\u03C1",
  23551. sigmaf: "\u03C2",
  23552. sigma: "\u03C3",
  23553. tau: "\u03C4",
  23554. upsilon: "\u03C5",
  23555. phi: "\u03C6",
  23556. chi: "\u03C7",
  23557. psi: "\u03C8",
  23558. omega: "\u03C9",
  23559. thetasym: "\u03D1",
  23560. upsih: "\u03D2",
  23561. piv: "\u03D6",
  23562. ensp: "\u2002",
  23563. emsp: "\u2003",
  23564. thinsp: "\u2009",
  23565. zwnj: "\u200C",
  23566. zwj: "\u200D",
  23567. lrm: "\u200E",
  23568. rlm: "\u200F",
  23569. ndash: "\u2013",
  23570. mdash: "\u2014",
  23571. lsquo: "\u2018",
  23572. rsquo: "\u2019",
  23573. sbquo: "\u201A",
  23574. ldquo: "\u201C",
  23575. rdquo: "\u201D",
  23576. bdquo: "\u201E",
  23577. dagger: "\u2020",
  23578. Dagger: "\u2021",
  23579. bull: "\u2022",
  23580. hellip: "\u2026",
  23581. permil: "\u2030",
  23582. prime: "\u2032",
  23583. Prime: "\u2033",
  23584. lsaquo: "\u2039",
  23585. rsaquo: "\u203A",
  23586. oline: "\u203E",
  23587. frasl: "\u2044",
  23588. euro: "\u20AC",
  23589. image: "\u2111",
  23590. weierp: "\u2118",
  23591. real: "\u211C",
  23592. trade: "\u2122",
  23593. alefsym: "\u2135",
  23594. larr: "\u2190",
  23595. uarr: "\u2191",
  23596. rarr: "\u2192",
  23597. darr: "\u2193",
  23598. harr: "\u2194",
  23599. crarr: "\u21B5",
  23600. lArr: "\u21D0",
  23601. uArr: "\u21D1",
  23602. rArr: "\u21D2",
  23603. dArr: "\u21D3",
  23604. hArr: "\u21D4",
  23605. forall: "\u2200",
  23606. part: "\u2202",
  23607. exist: "\u2203",
  23608. empty: "\u2205",
  23609. nabla: "\u2207",
  23610. isin: "\u2208",
  23611. notin: "\u2209",
  23612. ni: "\u220B",
  23613. prod: "\u220F",
  23614. sum: "\u2211",
  23615. minus: "\u2212",
  23616. lowast: "\u2217",
  23617. radic: "\u221A",
  23618. prop: "\u221D",
  23619. infin: "\u221E",
  23620. ang: "\u2220",
  23621. and: "\u2227",
  23622. or: "\u2228",
  23623. cap: "\u2229",
  23624. cup: "\u222A",
  23625. "int": "\u222B",
  23626. there4: "\u2234",
  23627. sim: "\u223C",
  23628. cong: "\u2245",
  23629. asymp: "\u2248",
  23630. ne: "\u2260",
  23631. equiv: "\u2261",
  23632. le: "\u2264",
  23633. ge: "\u2265",
  23634. sub: "\u2282",
  23635. sup: "\u2283",
  23636. nsub: "\u2284",
  23637. sube: "\u2286",
  23638. supe: "\u2287",
  23639. oplus: "\u2295",
  23640. otimes: "\u2297",
  23641. perp: "\u22A5",
  23642. sdot: "\u22C5",
  23643. lceil: "\u2308",
  23644. rceil: "\u2309",
  23645. lfloor: "\u230A",
  23646. rfloor: "\u230B",
  23647. lang: "\u2329",
  23648. rang: "\u232A",
  23649. loz: "\u25CA",
  23650. spades: "\u2660",
  23651. clubs: "\u2663",
  23652. hearts: "\u2665",
  23653. diams: "\u2666"
  23654. };
  23655. var HEX_NUMBER = /^[\da-fA-F]+$/;
  23656. var DECIMAL_NUMBER = /^\d+$/;
  23657. types$1.j_oTag = new TokContext("<tag", false);
  23658. types$1.j_cTag = new TokContext("</tag", false);
  23659. types$1.j_expr = new TokContext("<tag>...</tag>", true, true);
  23660. types.jsxName = new TokenType("jsxName");
  23661. types.jsxText = new TokenType("jsxText", { beforeExpr: true });
  23662. types.jsxTagStart = new TokenType("jsxTagStart", { startsExpr: true });
  23663. types.jsxTagEnd = new TokenType("jsxTagEnd");
  23664. types.jsxTagStart.updateContext = function () {
  23665. this.state.context.push(types$1.j_expr); // treat as beginning of JSX expression
  23666. this.state.context.push(types$1.j_oTag); // start opening tag context
  23667. this.state.exprAllowed = false;
  23668. };
  23669. types.jsxTagEnd.updateContext = function (prevType) {
  23670. var out = this.state.context.pop();
  23671. if (out === types$1.j_oTag && prevType === types.slash || out === types$1.j_cTag) {
  23672. this.state.context.pop();
  23673. this.state.exprAllowed = this.curContext() === types$1.j_expr;
  23674. } else {
  23675. this.state.exprAllowed = true;
  23676. }
  23677. };
  23678. var pp$9 = Parser.prototype;
  23679. // Reads inline JSX contents token.
  23680. pp$9.jsxReadToken = function () {
  23681. var out = "";
  23682. var chunkStart = this.state.pos;
  23683. for (;;) {
  23684. if (this.state.pos >= this.input.length) {
  23685. this.raise(this.state.start, "Unterminated JSX contents");
  23686. }
  23687. var ch = this.input.charCodeAt(this.state.pos);
  23688. switch (ch) {
  23689. case 60: // "<"
  23690. case 123:
  23691. // "{"
  23692. if (this.state.pos === this.state.start) {
  23693. if (ch === 60 && this.state.exprAllowed) {
  23694. ++this.state.pos;
  23695. return this.finishToken(types.jsxTagStart);
  23696. }
  23697. return this.getTokenFromCode(ch);
  23698. }
  23699. out += this.input.slice(chunkStart, this.state.pos);
  23700. return this.finishToken(types.jsxText, out);
  23701. case 38:
  23702. // "&"
  23703. out += this.input.slice(chunkStart, this.state.pos);
  23704. out += this.jsxReadEntity();
  23705. chunkStart = this.state.pos;
  23706. break;
  23707. default:
  23708. if (isNewLine(ch)) {
  23709. out += this.input.slice(chunkStart, this.state.pos);
  23710. out += this.jsxReadNewLine(true);
  23711. chunkStart = this.state.pos;
  23712. } else {
  23713. ++this.state.pos;
  23714. }
  23715. }
  23716. }
  23717. };
  23718. pp$9.jsxReadNewLine = function (normalizeCRLF) {
  23719. var ch = this.input.charCodeAt(this.state.pos);
  23720. var out = void 0;
  23721. ++this.state.pos;
  23722. if (ch === 13 && this.input.charCodeAt(this.state.pos) === 10) {
  23723. ++this.state.pos;
  23724. out = normalizeCRLF ? "\n" : "\r\n";
  23725. } else {
  23726. out = String.fromCharCode(ch);
  23727. }
  23728. ++this.state.curLine;
  23729. this.state.lineStart = this.state.pos;
  23730. return out;
  23731. };
  23732. pp$9.jsxReadString = function (quote) {
  23733. var out = "";
  23734. var chunkStart = ++this.state.pos;
  23735. for (;;) {
  23736. if (this.state.pos >= this.input.length) {
  23737. this.raise(this.state.start, "Unterminated string constant");
  23738. }
  23739. var ch = this.input.charCodeAt(this.state.pos);
  23740. if (ch === quote) break;
  23741. if (ch === 38) {
  23742. // "&"
  23743. out += this.input.slice(chunkStart, this.state.pos);
  23744. out += this.jsxReadEntity();
  23745. chunkStart = this.state.pos;
  23746. } else if (isNewLine(ch)) {
  23747. out += this.input.slice(chunkStart, this.state.pos);
  23748. out += this.jsxReadNewLine(false);
  23749. chunkStart = this.state.pos;
  23750. } else {
  23751. ++this.state.pos;
  23752. }
  23753. }
  23754. out += this.input.slice(chunkStart, this.state.pos++);
  23755. return this.finishToken(types.string, out);
  23756. };
  23757. pp$9.jsxReadEntity = function () {
  23758. var str = "";
  23759. var count = 0;
  23760. var entity = void 0;
  23761. var ch = this.input[this.state.pos];
  23762. var startPos = ++this.state.pos;
  23763. while (this.state.pos < this.input.length && count++ < 10) {
  23764. ch = this.input[this.state.pos++];
  23765. if (ch === ";") {
  23766. if (str[0] === "#") {
  23767. if (str[1] === "x") {
  23768. str = str.substr(2);
  23769. if (HEX_NUMBER.test(str)) entity = fromCodePoint$1(parseInt(str, 16));
  23770. } else {
  23771. str = str.substr(1);
  23772. if (DECIMAL_NUMBER.test(str)) entity = fromCodePoint$1(parseInt(str, 10));
  23773. }
  23774. } else {
  23775. entity = XHTMLEntities[str];
  23776. }
  23777. break;
  23778. }
  23779. str += ch;
  23780. }
  23781. if (!entity) {
  23782. this.state.pos = startPos;
  23783. return "&";
  23784. }
  23785. return entity;
  23786. };
  23787. // Read a JSX identifier (valid tag or attribute name).
  23788. //
  23789. // Optimized version since JSX identifiers can"t contain
  23790. // escape characters and so can be read as single slice.
  23791. // Also assumes that first character was already checked
  23792. // by isIdentifierStart in readToken.
  23793. pp$9.jsxReadWord = function () {
  23794. var ch = void 0;
  23795. var start = this.state.pos;
  23796. do {
  23797. ch = this.input.charCodeAt(++this.state.pos);
  23798. } while (isIdentifierChar(ch) || ch === 45); // "-"
  23799. return this.finishToken(types.jsxName, this.input.slice(start, this.state.pos));
  23800. };
  23801. // Transforms JSX element name to string.
  23802. function getQualifiedJSXName(object) {
  23803. if (object.type === "JSXIdentifier") {
  23804. return object.name;
  23805. }
  23806. if (object.type === "JSXNamespacedName") {
  23807. return object.namespace.name + ":" + object.name.name;
  23808. }
  23809. if (object.type === "JSXMemberExpression") {
  23810. return getQualifiedJSXName(object.object) + "." + getQualifiedJSXName(object.property);
  23811. }
  23812. }
  23813. // Parse next token as JSX identifier
  23814. pp$9.jsxParseIdentifier = function () {
  23815. var node = this.startNode();
  23816. if (this.match(types.jsxName)) {
  23817. node.name = this.state.value;
  23818. } else if (this.state.type.keyword) {
  23819. node.name = this.state.type.keyword;
  23820. } else {
  23821. this.unexpected();
  23822. }
  23823. this.next();
  23824. return this.finishNode(node, "JSXIdentifier");
  23825. };
  23826. // Parse namespaced identifier.
  23827. pp$9.jsxParseNamespacedName = function () {
  23828. var startPos = this.state.start;
  23829. var startLoc = this.state.startLoc;
  23830. var name = this.jsxParseIdentifier();
  23831. if (!this.eat(types.colon)) return name;
  23832. var node = this.startNodeAt(startPos, startLoc);
  23833. node.namespace = name;
  23834. node.name = this.jsxParseIdentifier();
  23835. return this.finishNode(node, "JSXNamespacedName");
  23836. };
  23837. // Parses element name in any form - namespaced, member
  23838. // or single identifier.
  23839. pp$9.jsxParseElementName = function () {
  23840. var startPos = this.state.start;
  23841. var startLoc = this.state.startLoc;
  23842. var node = this.jsxParseNamespacedName();
  23843. while (this.eat(types.dot)) {
  23844. var newNode = this.startNodeAt(startPos, startLoc);
  23845. newNode.object = node;
  23846. newNode.property = this.jsxParseIdentifier();
  23847. node = this.finishNode(newNode, "JSXMemberExpression");
  23848. }
  23849. return node;
  23850. };
  23851. // Parses any type of JSX attribute value.
  23852. pp$9.jsxParseAttributeValue = function () {
  23853. var node = void 0;
  23854. switch (this.state.type) {
  23855. case types.braceL:
  23856. node = this.jsxParseExpressionContainer();
  23857. if (node.expression.type === "JSXEmptyExpression") {
  23858. this.raise(node.start, "JSX attributes must only be assigned a non-empty expression");
  23859. } else {
  23860. return node;
  23861. }
  23862. case types.jsxTagStart:
  23863. case types.string:
  23864. node = this.parseExprAtom();
  23865. node.extra = null;
  23866. return node;
  23867. default:
  23868. this.raise(this.state.start, "JSX value should be either an expression or a quoted JSX text");
  23869. }
  23870. };
  23871. // JSXEmptyExpression is unique type since it doesn't actually parse anything,
  23872. // and so it should start at the end of last read token (left brace) and finish
  23873. // at the beginning of the next one (right brace).
  23874. pp$9.jsxParseEmptyExpression = function () {
  23875. var node = this.startNodeAt(this.state.lastTokEnd, this.state.lastTokEndLoc);
  23876. return this.finishNodeAt(node, "JSXEmptyExpression", this.state.start, this.state.startLoc);
  23877. };
  23878. // Parse JSX spread child
  23879. pp$9.jsxParseSpreadChild = function () {
  23880. var node = this.startNode();
  23881. this.expect(types.braceL);
  23882. this.expect(types.ellipsis);
  23883. node.expression = this.parseExpression();
  23884. this.expect(types.braceR);
  23885. return this.finishNode(node, "JSXSpreadChild");
  23886. };
  23887. // Parses JSX expression enclosed into curly brackets.
  23888. pp$9.jsxParseExpressionContainer = function () {
  23889. var node = this.startNode();
  23890. this.next();
  23891. if (this.match(types.braceR)) {
  23892. node.expression = this.jsxParseEmptyExpression();
  23893. } else {
  23894. node.expression = this.parseExpression();
  23895. }
  23896. this.expect(types.braceR);
  23897. return this.finishNode(node, "JSXExpressionContainer");
  23898. };
  23899. // Parses following JSX attribute name-value pair.
  23900. pp$9.jsxParseAttribute = function () {
  23901. var node = this.startNode();
  23902. if (this.eat(types.braceL)) {
  23903. this.expect(types.ellipsis);
  23904. node.argument = this.parseMaybeAssign();
  23905. this.expect(types.braceR);
  23906. return this.finishNode(node, "JSXSpreadAttribute");
  23907. }
  23908. node.name = this.jsxParseNamespacedName();
  23909. node.value = this.eat(types.eq) ? this.jsxParseAttributeValue() : null;
  23910. return this.finishNode(node, "JSXAttribute");
  23911. };
  23912. // Parses JSX opening tag starting after "<".
  23913. pp$9.jsxParseOpeningElementAt = function (startPos, startLoc) {
  23914. var node = this.startNodeAt(startPos, startLoc);
  23915. node.attributes = [];
  23916. node.name = this.jsxParseElementName();
  23917. while (!this.match(types.slash) && !this.match(types.jsxTagEnd)) {
  23918. node.attributes.push(this.jsxParseAttribute());
  23919. }
  23920. node.selfClosing = this.eat(types.slash);
  23921. this.expect(types.jsxTagEnd);
  23922. return this.finishNode(node, "JSXOpeningElement");
  23923. };
  23924. // Parses JSX closing tag starting after "</".
  23925. pp$9.jsxParseClosingElementAt = function (startPos, startLoc) {
  23926. var node = this.startNodeAt(startPos, startLoc);
  23927. node.name = this.jsxParseElementName();
  23928. this.expect(types.jsxTagEnd);
  23929. return this.finishNode(node, "JSXClosingElement");
  23930. };
  23931. // Parses entire JSX element, including it"s opening tag
  23932. // (starting after "<"), attributes, contents and closing tag.
  23933. pp$9.jsxParseElementAt = function (startPos, startLoc) {
  23934. var node = this.startNodeAt(startPos, startLoc);
  23935. var children = [];
  23936. var openingElement = this.jsxParseOpeningElementAt(startPos, startLoc);
  23937. var closingElement = null;
  23938. if (!openingElement.selfClosing) {
  23939. contents: for (;;) {
  23940. switch (this.state.type) {
  23941. case types.jsxTagStart:
  23942. startPos = this.state.start;startLoc = this.state.startLoc;
  23943. this.next();
  23944. if (this.eat(types.slash)) {
  23945. closingElement = this.jsxParseClosingElementAt(startPos, startLoc);
  23946. break contents;
  23947. }
  23948. children.push(this.jsxParseElementAt(startPos, startLoc));
  23949. break;
  23950. case types.jsxText:
  23951. children.push(this.parseExprAtom());
  23952. break;
  23953. case types.braceL:
  23954. if (this.lookahead().type === types.ellipsis) {
  23955. children.push(this.jsxParseSpreadChild());
  23956. } else {
  23957. children.push(this.jsxParseExpressionContainer());
  23958. }
  23959. break;
  23960. // istanbul ignore next - should never happen
  23961. default:
  23962. this.unexpected();
  23963. }
  23964. }
  23965. if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) {
  23966. this.raise(closingElement.start, "Expected corresponding JSX closing tag for <" + getQualifiedJSXName(openingElement.name) + ">");
  23967. }
  23968. }
  23969. node.openingElement = openingElement;
  23970. node.closingElement = closingElement;
  23971. node.children = children;
  23972. if (this.match(types.relational) && this.state.value === "<") {
  23973. this.raise(this.state.start, "Adjacent JSX elements must be wrapped in an enclosing tag");
  23974. }
  23975. return this.finishNode(node, "JSXElement");
  23976. };
  23977. // Parses entire JSX element from current position.
  23978. pp$9.jsxParseElement = function () {
  23979. var startPos = this.state.start;
  23980. var startLoc = this.state.startLoc;
  23981. this.next();
  23982. return this.jsxParseElementAt(startPos, startLoc);
  23983. };
  23984. var jsxPlugin = function (instance) {
  23985. instance.extend("parseExprAtom", function (inner) {
  23986. return function (refShortHandDefaultPos) {
  23987. if (this.match(types.jsxText)) {
  23988. var node = this.parseLiteral(this.state.value, "JSXText");
  23989. // https://github.com/babel/babel/issues/2078
  23990. node.extra = null;
  23991. return node;
  23992. } else if (this.match(types.jsxTagStart)) {
  23993. return this.jsxParseElement();
  23994. } else {
  23995. return inner.call(this, refShortHandDefaultPos);
  23996. }
  23997. };
  23998. });
  23999. instance.extend("readToken", function (inner) {
  24000. return function (code) {
  24001. if (this.state.inPropertyName) return inner.call(this, code);
  24002. var context = this.curContext();
  24003. if (context === types$1.j_expr) {
  24004. return this.jsxReadToken();
  24005. }
  24006. if (context === types$1.j_oTag || context === types$1.j_cTag) {
  24007. if (isIdentifierStart(code)) {
  24008. return this.jsxReadWord();
  24009. }
  24010. if (code === 62) {
  24011. ++this.state.pos;
  24012. return this.finishToken(types.jsxTagEnd);
  24013. }
  24014. if ((code === 34 || code === 39) && context === types$1.j_oTag) {
  24015. return this.jsxReadString(code);
  24016. }
  24017. }
  24018. if (code === 60 && this.state.exprAllowed) {
  24019. ++this.state.pos;
  24020. return this.finishToken(types.jsxTagStart);
  24021. }
  24022. return inner.call(this, code);
  24023. };
  24024. });
  24025. instance.extend("updateContext", function (inner) {
  24026. return function (prevType) {
  24027. if (this.match(types.braceL)) {
  24028. var curContext = this.curContext();
  24029. if (curContext === types$1.j_oTag) {
  24030. this.state.context.push(types$1.braceExpression);
  24031. } else if (curContext === types$1.j_expr) {
  24032. this.state.context.push(types$1.templateQuasi);
  24033. } else {
  24034. inner.call(this, prevType);
  24035. }
  24036. this.state.exprAllowed = true;
  24037. } else if (this.match(types.slash) && prevType === types.jsxTagStart) {
  24038. this.state.context.length -= 2; // do not consider JSX expr -> JSX open tag -> ... anymore
  24039. this.state.context.push(types$1.j_cTag); // reconsider as closing tag context
  24040. this.state.exprAllowed = false;
  24041. } else {
  24042. return inner.call(this, prevType);
  24043. }
  24044. };
  24045. });
  24046. };
  24047. plugins.estree = estreePlugin;
  24048. plugins.flow = flowPlugin;
  24049. plugins.jsx = jsxPlugin;
  24050. function parse(input, options) {
  24051. return new Parser(options, input).parse();
  24052. }
  24053. function parseExpression(input, options) {
  24054. var parser = new Parser(options, input);
  24055. if (parser.options.strictMode) {
  24056. parser.state.strict = true;
  24057. }
  24058. return parser.getExpression();
  24059. }
  24060. exports.parse = parse;
  24061. exports.parseExpression = parseExpression;
  24062. exports.tokTypes = types;
  24063. },{}],156:[function(require,module,exports){
  24064. 'use strict';
  24065. module.exports = balanced;
  24066. function balanced(a, b, str) {
  24067. if (a instanceof RegExp) a = maybeMatch(a, str);
  24068. if (b instanceof RegExp) b = maybeMatch(b, str);
  24069. var r = range(a, b, str);
  24070. return r && {
  24071. start: r[0],
  24072. end: r[1],
  24073. pre: str.slice(0, r[0]),
  24074. body: str.slice(r[0] + a.length, r[1]),
  24075. post: str.slice(r[1] + b.length)
  24076. };
  24077. }
  24078. function maybeMatch(reg, str) {
  24079. var m = str.match(reg);
  24080. return m ? m[0] : null;
  24081. }
  24082. balanced.range = range;
  24083. function range(a, b, str) {
  24084. var begs, beg, left, right, result;
  24085. var ai = str.indexOf(a);
  24086. var bi = str.indexOf(b, ai + 1);
  24087. var i = ai;
  24088. if (ai >= 0 && bi > 0) {
  24089. begs = [];
  24090. left = str.length;
  24091. while (i >= 0 && !result) {
  24092. if (i == ai) {
  24093. begs.push(i);
  24094. ai = str.indexOf(a, i + 1);
  24095. } else if (begs.length == 1) {
  24096. result = [ begs.pop(), bi ];
  24097. } else {
  24098. beg = begs.pop();
  24099. if (beg < left) {
  24100. left = beg;
  24101. right = bi;
  24102. }
  24103. bi = str.indexOf(b, i + 1);
  24104. }
  24105. i = ai < bi && ai >= 0 ? ai : bi;
  24106. }
  24107. if (begs.length) {
  24108. result = [ left, right ];
  24109. }
  24110. }
  24111. return result;
  24112. }
  24113. },{}],157:[function(require,module,exports){
  24114. 'use strict'
  24115. exports.byteLength = byteLength
  24116. exports.toByteArray = toByteArray
  24117. exports.fromByteArray = fromByteArray
  24118. var lookup = []
  24119. var revLookup = []
  24120. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  24121. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  24122. for (var i = 0, len = code.length; i < len; ++i) {
  24123. lookup[i] = code[i]
  24124. revLookup[code.charCodeAt(i)] = i
  24125. }
  24126. revLookup['-'.charCodeAt(0)] = 62
  24127. revLookup['_'.charCodeAt(0)] = 63
  24128. function placeHoldersCount (b64) {
  24129. var len = b64.length
  24130. if (len % 4 > 0) {
  24131. throw new Error('Invalid string. Length must be a multiple of 4')
  24132. }
  24133. // the number of equal signs (place holders)
  24134. // if there are two placeholders, than the two characters before it
  24135. // represent one byte
  24136. // if there is only one, then the three characters before it represent 2 bytes
  24137. // this is just a cheap hack to not do indexOf twice
  24138. return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0
  24139. }
  24140. function byteLength (b64) {
  24141. // base64 is 4/3 + up to two characters of the original data
  24142. return (b64.length * 3 / 4) - placeHoldersCount(b64)
  24143. }
  24144. function toByteArray (b64) {
  24145. var i, l, tmp, placeHolders, arr
  24146. var len = b64.length
  24147. placeHolders = placeHoldersCount(b64)
  24148. arr = new Arr((len * 3 / 4) - placeHolders)
  24149. // if there are placeholders, only get up to the last complete 4 chars
  24150. l = placeHolders > 0 ? len - 4 : len
  24151. var L = 0
  24152. for (i = 0; i < l; i += 4) {
  24153. tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]
  24154. arr[L++] = (tmp >> 16) & 0xFF
  24155. arr[L++] = (tmp >> 8) & 0xFF
  24156. arr[L++] = tmp & 0xFF
  24157. }
  24158. if (placeHolders === 2) {
  24159. tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)
  24160. arr[L++] = tmp & 0xFF
  24161. } else if (placeHolders === 1) {
  24162. tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)
  24163. arr[L++] = (tmp >> 8) & 0xFF
  24164. arr[L++] = tmp & 0xFF
  24165. }
  24166. return arr
  24167. }
  24168. function tripletToBase64 (num) {
  24169. return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]
  24170. }
  24171. function encodeChunk (uint8, start, end) {
  24172. var tmp
  24173. var output = []
  24174. for (var i = start; i < end; i += 3) {
  24175. tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
  24176. output.push(tripletToBase64(tmp))
  24177. }
  24178. return output.join('')
  24179. }
  24180. function fromByteArray (uint8) {
  24181. var tmp
  24182. var len = uint8.length
  24183. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  24184. var output = ''
  24185. var parts = []
  24186. var maxChunkLength = 16383 // must be multiple of 3
  24187. // go through the array every three bytes, we'll deal with trailing stuff later
  24188. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  24189. parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
  24190. }
  24191. // pad the end with zeros, but make sure to not forget the extra bytes
  24192. if (extraBytes === 1) {
  24193. tmp = uint8[len - 1]
  24194. output += lookup[tmp >> 2]
  24195. output += lookup[(tmp << 4) & 0x3F]
  24196. output += '=='
  24197. } else if (extraBytes === 2) {
  24198. tmp = (uint8[len - 2] << 8) + (uint8[len - 1])
  24199. output += lookup[tmp >> 10]
  24200. output += lookup[(tmp >> 4) & 0x3F]
  24201. output += lookup[(tmp << 2) & 0x3F]
  24202. output += '='
  24203. }
  24204. parts.push(output)
  24205. return parts.join('')
  24206. }
  24207. },{}],158:[function(require,module,exports){
  24208. var concatMap = require('concat-map');
  24209. var balanced = require('balanced-match');
  24210. module.exports = expandTop;
  24211. var escSlash = '\0SLASH'+Math.random()+'\0';
  24212. var escOpen = '\0OPEN'+Math.random()+'\0';
  24213. var escClose = '\0CLOSE'+Math.random()+'\0';
  24214. var escComma = '\0COMMA'+Math.random()+'\0';
  24215. var escPeriod = '\0PERIOD'+Math.random()+'\0';
  24216. function numeric(str) {
  24217. return parseInt(str, 10) == str
  24218. ? parseInt(str, 10)
  24219. : str.charCodeAt(0);
  24220. }
  24221. function escapeBraces(str) {
  24222. return str.split('\\\\').join(escSlash)
  24223. .split('\\{').join(escOpen)
  24224. .split('\\}').join(escClose)
  24225. .split('\\,').join(escComma)
  24226. .split('\\.').join(escPeriod);
  24227. }
  24228. function unescapeBraces(str) {
  24229. return str.split(escSlash).join('\\')
  24230. .split(escOpen).join('{')
  24231. .split(escClose).join('}')
  24232. .split(escComma).join(',')
  24233. .split(escPeriod).join('.');
  24234. }
  24235. // Basically just str.split(","), but handling cases
  24236. // where we have nested braced sections, which should be
  24237. // treated as individual members, like {a,{b,c},d}
  24238. function parseCommaParts(str) {
  24239. if (!str)
  24240. return [''];
  24241. var parts = [];
  24242. var m = balanced('{', '}', str);
  24243. if (!m)
  24244. return str.split(',');
  24245. var pre = m.pre;
  24246. var body = m.body;
  24247. var post = m.post;
  24248. var p = pre.split(',');
  24249. p[p.length-1] += '{' + body + '}';
  24250. var postParts = parseCommaParts(post);
  24251. if (post.length) {
  24252. p[p.length-1] += postParts.shift();
  24253. p.push.apply(p, postParts);
  24254. }
  24255. parts.push.apply(parts, p);
  24256. return parts;
  24257. }
  24258. function expandTop(str) {
  24259. if (!str)
  24260. return [];
  24261. // I don't know why Bash 4.3 does this, but it does.
  24262. // Anything starting with {} will have the first two bytes preserved
  24263. // but *only* at the top level, so {},a}b will not expand to anything,
  24264. // but a{},b}c will be expanded to [a}c,abc].
  24265. // One could argue that this is a bug in Bash, but since the goal of
  24266. // this module is to match Bash's rules, we escape a leading {}
  24267. if (str.substr(0, 2) === '{}') {
  24268. str = '\\{\\}' + str.substr(2);
  24269. }
  24270. return expand(escapeBraces(str), true).map(unescapeBraces);
  24271. }
  24272. function identity(e) {
  24273. return e;
  24274. }
  24275. function embrace(str) {
  24276. return '{' + str + '}';
  24277. }
  24278. function isPadded(el) {
  24279. return /^-?0\d/.test(el);
  24280. }
  24281. function lte(i, y) {
  24282. return i <= y;
  24283. }
  24284. function gte(i, y) {
  24285. return i >= y;
  24286. }
  24287. function expand(str, isTop) {
  24288. var expansions = [];
  24289. var m = balanced('{', '}', str);
  24290. if (!m || /\$$/.test(m.pre)) return [str];
  24291. var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
  24292. var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
  24293. var isSequence = isNumericSequence || isAlphaSequence;
  24294. var isOptions = m.body.indexOf(',') >= 0;
  24295. if (!isSequence && !isOptions) {
  24296. // {a},b}
  24297. if (m.post.match(/,.*\}/)) {
  24298. str = m.pre + '{' + m.body + escClose + m.post;
  24299. return expand(str);
  24300. }
  24301. return [str];
  24302. }
  24303. var n;
  24304. if (isSequence) {
  24305. n = m.body.split(/\.\./);
  24306. } else {
  24307. n = parseCommaParts(m.body);
  24308. if (n.length === 1) {
  24309. // x{{a,b}}y ==> x{a}y x{b}y
  24310. n = expand(n[0], false).map(embrace);
  24311. if (n.length === 1) {
  24312. var post = m.post.length
  24313. ? expand(m.post, false)
  24314. : [''];
  24315. return post.map(function(p) {
  24316. return m.pre + n[0] + p;
  24317. });
  24318. }
  24319. }
  24320. }
  24321. // at this point, n is the parts, and we know it's not a comma set
  24322. // with a single entry.
  24323. // no need to expand pre, since it is guaranteed to be free of brace-sets
  24324. var pre = m.pre;
  24325. var post = m.post.length
  24326. ? expand(m.post, false)
  24327. : [''];
  24328. var N;
  24329. if (isSequence) {
  24330. var x = numeric(n[0]);
  24331. var y = numeric(n[1]);
  24332. var width = Math.max(n[0].length, n[1].length)
  24333. var incr = n.length == 3
  24334. ? Math.abs(numeric(n[2]))
  24335. : 1;
  24336. var test = lte;
  24337. var reverse = y < x;
  24338. if (reverse) {
  24339. incr *= -1;
  24340. test = gte;
  24341. }
  24342. var pad = n.some(isPadded);
  24343. N = [];
  24344. for (var i = x; test(i, y); i += incr) {
  24345. var c;
  24346. if (isAlphaSequence) {
  24347. c = String.fromCharCode(i);
  24348. if (c === '\\')
  24349. c = '';
  24350. } else {
  24351. c = String(i);
  24352. if (pad) {
  24353. var need = width - c.length;
  24354. if (need > 0) {
  24355. var z = new Array(need + 1).join('0');
  24356. if (i < 0)
  24357. c = '-' + z + c.slice(1);
  24358. else
  24359. c = z + c;
  24360. }
  24361. }
  24362. }
  24363. N.push(c);
  24364. }
  24365. } else {
  24366. N = concatMap(n, function(el) { return expand(el, false) });
  24367. }
  24368. for (var j = 0; j < N.length; j++) {
  24369. for (var k = 0; k < post.length; k++) {
  24370. var expansion = pre + N[j] + post[k];
  24371. if (!isTop || isSequence || expansion)
  24372. expansions.push(expansion);
  24373. }
  24374. }
  24375. return expansions;
  24376. }
  24377. },{"balanced-match":156,"concat-map":162}],159:[function(require,module,exports){
  24378. },{}],160:[function(require,module,exports){
  24379. (function (global){
  24380. /*!
  24381. * The buffer module from node.js, for the browser.
  24382. *
  24383. * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
  24384. * @license MIT
  24385. */
  24386. /* eslint-disable no-proto */
  24387. 'use strict'
  24388. var base64 = require('base64-js')
  24389. var ieee754 = require('ieee754')
  24390. var isArray = require('isarray')
  24391. exports.Buffer = Buffer
  24392. exports.SlowBuffer = SlowBuffer
  24393. exports.INSPECT_MAX_BYTES = 50
  24394. /**
  24395. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  24396. * === true Use Uint8Array implementation (fastest)
  24397. * === false Use Object implementation (most compatible, even IE6)
  24398. *
  24399. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  24400. * Opera 11.6+, iOS 4.2+.
  24401. *
  24402. * Due to various browser bugs, sometimes the Object implementation will be used even
  24403. * when the browser supports typed arrays.
  24404. *
  24405. * Note:
  24406. *
  24407. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  24408. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  24409. *
  24410. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  24411. *
  24412. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  24413. * incorrect length in some situations.
  24414. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  24415. * get the Object implementation, which is slower but behaves correctly.
  24416. */
  24417. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  24418. ? global.TYPED_ARRAY_SUPPORT
  24419. : typedArraySupport()
  24420. /*
  24421. * Export kMaxLength after typed array support is determined.
  24422. */
  24423. exports.kMaxLength = kMaxLength()
  24424. function typedArraySupport () {
  24425. try {
  24426. var arr = new Uint8Array(1)
  24427. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  24428. return arr.foo() === 42 && // typed array instances can be augmented
  24429. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  24430. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  24431. } catch (e) {
  24432. return false
  24433. }
  24434. }
  24435. function kMaxLength () {
  24436. return Buffer.TYPED_ARRAY_SUPPORT
  24437. ? 0x7fffffff
  24438. : 0x3fffffff
  24439. }
  24440. function createBuffer (that, length) {
  24441. if (kMaxLength() < length) {
  24442. throw new RangeError('Invalid typed array length')
  24443. }
  24444. if (Buffer.TYPED_ARRAY_SUPPORT) {
  24445. // Return an augmented `Uint8Array` instance, for best performance
  24446. that = new Uint8Array(length)
  24447. that.__proto__ = Buffer.prototype
  24448. } else {
  24449. // Fallback: Return an object instance of the Buffer class
  24450. if (that === null) {
  24451. that = new Buffer(length)
  24452. }
  24453. that.length = length
  24454. }
  24455. return that
  24456. }
  24457. /**
  24458. * The Buffer constructor returns instances of `Uint8Array` that have their
  24459. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  24460. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  24461. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  24462. * returns a single octet.
  24463. *
  24464. * The `Uint8Array` prototype remains unmodified.
  24465. */
  24466. function Buffer (arg, encodingOrOffset, length) {
  24467. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  24468. return new Buffer(arg, encodingOrOffset, length)
  24469. }
  24470. // Common case.
  24471. if (typeof arg === 'number') {
  24472. if (typeof encodingOrOffset === 'string') {
  24473. throw new Error(
  24474. 'If encoding is specified then the first argument must be a string'
  24475. )
  24476. }
  24477. return allocUnsafe(this, arg)
  24478. }
  24479. return from(this, arg, encodingOrOffset, length)
  24480. }
  24481. Buffer.poolSize = 8192 // not used by this implementation
  24482. // TODO: Legacy, not needed anymore. Remove in next major version.
  24483. Buffer._augment = function (arr) {
  24484. arr.__proto__ = Buffer.prototype
  24485. return arr
  24486. }
  24487. function from (that, value, encodingOrOffset, length) {
  24488. if (typeof value === 'number') {
  24489. throw new TypeError('"value" argument must not be a number')
  24490. }
  24491. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  24492. return fromArrayBuffer(that, value, encodingOrOffset, length)
  24493. }
  24494. if (typeof value === 'string') {
  24495. return fromString(that, value, encodingOrOffset)
  24496. }
  24497. return fromObject(that, value)
  24498. }
  24499. /**
  24500. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  24501. * if value is a number.
  24502. * Buffer.from(str[, encoding])
  24503. * Buffer.from(array)
  24504. * Buffer.from(buffer)
  24505. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  24506. **/
  24507. Buffer.from = function (value, encodingOrOffset, length) {
  24508. return from(null, value, encodingOrOffset, length)
  24509. }
  24510. if (Buffer.TYPED_ARRAY_SUPPORT) {
  24511. Buffer.prototype.__proto__ = Uint8Array.prototype
  24512. Buffer.__proto__ = Uint8Array
  24513. if (typeof Symbol !== 'undefined' && Symbol.species &&
  24514. Buffer[Symbol.species] === Buffer) {
  24515. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  24516. Object.defineProperty(Buffer, Symbol.species, {
  24517. value: null,
  24518. configurable: true
  24519. })
  24520. }
  24521. }
  24522. function assertSize (size) {
  24523. if (typeof size !== 'number') {
  24524. throw new TypeError('"size" argument must be a number')
  24525. } else if (size < 0) {
  24526. throw new RangeError('"size" argument must not be negative')
  24527. }
  24528. }
  24529. function alloc (that, size, fill, encoding) {
  24530. assertSize(size)
  24531. if (size <= 0) {
  24532. return createBuffer(that, size)
  24533. }
  24534. if (fill !== undefined) {
  24535. // Only pay attention to encoding if it's a string. This
  24536. // prevents accidentally sending in a number that would
  24537. // be interpretted as a start offset.
  24538. return typeof encoding === 'string'
  24539. ? createBuffer(that, size).fill(fill, encoding)
  24540. : createBuffer(that, size).fill(fill)
  24541. }
  24542. return createBuffer(that, size)
  24543. }
  24544. /**
  24545. * Creates a new filled Buffer instance.
  24546. * alloc(size[, fill[, encoding]])
  24547. **/
  24548. Buffer.alloc = function (size, fill, encoding) {
  24549. return alloc(null, size, fill, encoding)
  24550. }
  24551. function allocUnsafe (that, size) {
  24552. assertSize(size)
  24553. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  24554. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  24555. for (var i = 0; i < size; ++i) {
  24556. that[i] = 0
  24557. }
  24558. }
  24559. return that
  24560. }
  24561. /**
  24562. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  24563. * */
  24564. Buffer.allocUnsafe = function (size) {
  24565. return allocUnsafe(null, size)
  24566. }
  24567. /**
  24568. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  24569. */
  24570. Buffer.allocUnsafeSlow = function (size) {
  24571. return allocUnsafe(null, size)
  24572. }
  24573. function fromString (that, string, encoding) {
  24574. if (typeof encoding !== 'string' || encoding === '') {
  24575. encoding = 'utf8'
  24576. }
  24577. if (!Buffer.isEncoding(encoding)) {
  24578. throw new TypeError('"encoding" must be a valid string encoding')
  24579. }
  24580. var length = byteLength(string, encoding) | 0
  24581. that = createBuffer(that, length)
  24582. var actual = that.write(string, encoding)
  24583. if (actual !== length) {
  24584. // Writing a hex string, for example, that contains invalid characters will
  24585. // cause everything after the first invalid character to be ignored. (e.g.
  24586. // 'abxxcd' will be treated as 'ab')
  24587. that = that.slice(0, actual)
  24588. }
  24589. return that
  24590. }
  24591. function fromArrayLike (that, array) {
  24592. var length = array.length < 0 ? 0 : checked(array.length) | 0
  24593. that = createBuffer(that, length)
  24594. for (var i = 0; i < length; i += 1) {
  24595. that[i] = array[i] & 255
  24596. }
  24597. return that
  24598. }
  24599. function fromArrayBuffer (that, array, byteOffset, length) {
  24600. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  24601. if (byteOffset < 0 || array.byteLength < byteOffset) {
  24602. throw new RangeError('\'offset\' is out of bounds')
  24603. }
  24604. if (array.byteLength < byteOffset + (length || 0)) {
  24605. throw new RangeError('\'length\' is out of bounds')
  24606. }
  24607. if (byteOffset === undefined && length === undefined) {
  24608. array = new Uint8Array(array)
  24609. } else if (length === undefined) {
  24610. array = new Uint8Array(array, byteOffset)
  24611. } else {
  24612. array = new Uint8Array(array, byteOffset, length)
  24613. }
  24614. if (Buffer.TYPED_ARRAY_SUPPORT) {
  24615. // Return an augmented `Uint8Array` instance, for best performance
  24616. that = array
  24617. that.__proto__ = Buffer.prototype
  24618. } else {
  24619. // Fallback: Return an object instance of the Buffer class
  24620. that = fromArrayLike(that, array)
  24621. }
  24622. return that
  24623. }
  24624. function fromObject (that, obj) {
  24625. if (Buffer.isBuffer(obj)) {
  24626. var len = checked(obj.length) | 0
  24627. that = createBuffer(that, len)
  24628. if (that.length === 0) {
  24629. return that
  24630. }
  24631. obj.copy(that, 0, 0, len)
  24632. return that
  24633. }
  24634. if (obj) {
  24635. if ((typeof ArrayBuffer !== 'undefined' &&
  24636. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  24637. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  24638. return createBuffer(that, 0)
  24639. }
  24640. return fromArrayLike(that, obj)
  24641. }
  24642. if (obj.type === 'Buffer' && isArray(obj.data)) {
  24643. return fromArrayLike(that, obj.data)
  24644. }
  24645. }
  24646. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  24647. }
  24648. function checked (length) {
  24649. // Note: cannot use `length < kMaxLength()` here because that fails when
  24650. // length is NaN (which is otherwise coerced to zero.)
  24651. if (length >= kMaxLength()) {
  24652. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  24653. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  24654. }
  24655. return length | 0
  24656. }
  24657. function SlowBuffer (length) {
  24658. if (+length != length) { // eslint-disable-line eqeqeq
  24659. length = 0
  24660. }
  24661. return Buffer.alloc(+length)
  24662. }
  24663. Buffer.isBuffer = function isBuffer (b) {
  24664. return !!(b != null && b._isBuffer)
  24665. }
  24666. Buffer.compare = function compare (a, b) {
  24667. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  24668. throw new TypeError('Arguments must be Buffers')
  24669. }
  24670. if (a === b) return 0
  24671. var x = a.length
  24672. var y = b.length
  24673. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  24674. if (a[i] !== b[i]) {
  24675. x = a[i]
  24676. y = b[i]
  24677. break
  24678. }
  24679. }
  24680. if (x < y) return -1
  24681. if (y < x) return 1
  24682. return 0
  24683. }
  24684. Buffer.isEncoding = function isEncoding (encoding) {
  24685. switch (String(encoding).toLowerCase()) {
  24686. case 'hex':
  24687. case 'utf8':
  24688. case 'utf-8':
  24689. case 'ascii':
  24690. case 'latin1':
  24691. case 'binary':
  24692. case 'base64':
  24693. case 'ucs2':
  24694. case 'ucs-2':
  24695. case 'utf16le':
  24696. case 'utf-16le':
  24697. return true
  24698. default:
  24699. return false
  24700. }
  24701. }
  24702. Buffer.concat = function concat (list, length) {
  24703. if (!isArray(list)) {
  24704. throw new TypeError('"list" argument must be an Array of Buffers')
  24705. }
  24706. if (list.length === 0) {
  24707. return Buffer.alloc(0)
  24708. }
  24709. var i
  24710. if (length === undefined) {
  24711. length = 0
  24712. for (i = 0; i < list.length; ++i) {
  24713. length += list[i].length
  24714. }
  24715. }
  24716. var buffer = Buffer.allocUnsafe(length)
  24717. var pos = 0
  24718. for (i = 0; i < list.length; ++i) {
  24719. var buf = list[i]
  24720. if (!Buffer.isBuffer(buf)) {
  24721. throw new TypeError('"list" argument must be an Array of Buffers')
  24722. }
  24723. buf.copy(buffer, pos)
  24724. pos += buf.length
  24725. }
  24726. return buffer
  24727. }
  24728. function byteLength (string, encoding) {
  24729. if (Buffer.isBuffer(string)) {
  24730. return string.length
  24731. }
  24732. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  24733. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  24734. return string.byteLength
  24735. }
  24736. if (typeof string !== 'string') {
  24737. string = '' + string
  24738. }
  24739. var len = string.length
  24740. if (len === 0) return 0
  24741. // Use a for loop to avoid recursion
  24742. var loweredCase = false
  24743. for (;;) {
  24744. switch (encoding) {
  24745. case 'ascii':
  24746. case 'latin1':
  24747. case 'binary':
  24748. return len
  24749. case 'utf8':
  24750. case 'utf-8':
  24751. case undefined:
  24752. return utf8ToBytes(string).length
  24753. case 'ucs2':
  24754. case 'ucs-2':
  24755. case 'utf16le':
  24756. case 'utf-16le':
  24757. return len * 2
  24758. case 'hex':
  24759. return len >>> 1
  24760. case 'base64':
  24761. return base64ToBytes(string).length
  24762. default:
  24763. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  24764. encoding = ('' + encoding).toLowerCase()
  24765. loweredCase = true
  24766. }
  24767. }
  24768. }
  24769. Buffer.byteLength = byteLength
  24770. function slowToString (encoding, start, end) {
  24771. var loweredCase = false
  24772. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  24773. // property of a typed array.
  24774. // This behaves neither like String nor Uint8Array in that we set start/end
  24775. // to their upper/lower bounds if the value passed is out of range.
  24776. // undefined is handled specially as per ECMA-262 6th Edition,
  24777. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  24778. if (start === undefined || start < 0) {
  24779. start = 0
  24780. }
  24781. // Return early if start > this.length. Done here to prevent potential uint32
  24782. // coercion fail below.
  24783. if (start > this.length) {
  24784. return ''
  24785. }
  24786. if (end === undefined || end > this.length) {
  24787. end = this.length
  24788. }
  24789. if (end <= 0) {
  24790. return ''
  24791. }
  24792. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  24793. end >>>= 0
  24794. start >>>= 0
  24795. if (end <= start) {
  24796. return ''
  24797. }
  24798. if (!encoding) encoding = 'utf8'
  24799. while (true) {
  24800. switch (encoding) {
  24801. case 'hex':
  24802. return hexSlice(this, start, end)
  24803. case 'utf8':
  24804. case 'utf-8':
  24805. return utf8Slice(this, start, end)
  24806. case 'ascii':
  24807. return asciiSlice(this, start, end)
  24808. case 'latin1':
  24809. case 'binary':
  24810. return latin1Slice(this, start, end)
  24811. case 'base64':
  24812. return base64Slice(this, start, end)
  24813. case 'ucs2':
  24814. case 'ucs-2':
  24815. case 'utf16le':
  24816. case 'utf-16le':
  24817. return utf16leSlice(this, start, end)
  24818. default:
  24819. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  24820. encoding = (encoding + '').toLowerCase()
  24821. loweredCase = true
  24822. }
  24823. }
  24824. }
  24825. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  24826. // Buffer instances.
  24827. Buffer.prototype._isBuffer = true
  24828. function swap (b, n, m) {
  24829. var i = b[n]
  24830. b[n] = b[m]
  24831. b[m] = i
  24832. }
  24833. Buffer.prototype.swap16 = function swap16 () {
  24834. var len = this.length
  24835. if (len % 2 !== 0) {
  24836. throw new RangeError('Buffer size must be a multiple of 16-bits')
  24837. }
  24838. for (var i = 0; i < len; i += 2) {
  24839. swap(this, i, i + 1)
  24840. }
  24841. return this
  24842. }
  24843. Buffer.prototype.swap32 = function swap32 () {
  24844. var len = this.length
  24845. if (len % 4 !== 0) {
  24846. throw new RangeError('Buffer size must be a multiple of 32-bits')
  24847. }
  24848. for (var i = 0; i < len; i += 4) {
  24849. swap(this, i, i + 3)
  24850. swap(this, i + 1, i + 2)
  24851. }
  24852. return this
  24853. }
  24854. Buffer.prototype.swap64 = function swap64 () {
  24855. var len = this.length
  24856. if (len % 8 !== 0) {
  24857. throw new RangeError('Buffer size must be a multiple of 64-bits')
  24858. }
  24859. for (var i = 0; i < len; i += 8) {
  24860. swap(this, i, i + 7)
  24861. swap(this, i + 1, i + 6)
  24862. swap(this, i + 2, i + 5)
  24863. swap(this, i + 3, i + 4)
  24864. }
  24865. return this
  24866. }
  24867. Buffer.prototype.toString = function toString () {
  24868. var length = this.length | 0
  24869. if (length === 0) return ''
  24870. if (arguments.length === 0) return utf8Slice(this, 0, length)
  24871. return slowToString.apply(this, arguments)
  24872. }
  24873. Buffer.prototype.equals = function equals (b) {
  24874. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  24875. if (this === b) return true
  24876. return Buffer.compare(this, b) === 0
  24877. }
  24878. Buffer.prototype.inspect = function inspect () {
  24879. var str = ''
  24880. var max = exports.INSPECT_MAX_BYTES
  24881. if (this.length > 0) {
  24882. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  24883. if (this.length > max) str += ' ... '
  24884. }
  24885. return '<Buffer ' + str + '>'
  24886. }
  24887. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  24888. if (!Buffer.isBuffer(target)) {
  24889. throw new TypeError('Argument must be a Buffer')
  24890. }
  24891. if (start === undefined) {
  24892. start = 0
  24893. }
  24894. if (end === undefined) {
  24895. end = target ? target.length : 0
  24896. }
  24897. if (thisStart === undefined) {
  24898. thisStart = 0
  24899. }
  24900. if (thisEnd === undefined) {
  24901. thisEnd = this.length
  24902. }
  24903. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  24904. throw new RangeError('out of range index')
  24905. }
  24906. if (thisStart >= thisEnd && start >= end) {
  24907. return 0
  24908. }
  24909. if (thisStart >= thisEnd) {
  24910. return -1
  24911. }
  24912. if (start >= end) {
  24913. return 1
  24914. }
  24915. start >>>= 0
  24916. end >>>= 0
  24917. thisStart >>>= 0
  24918. thisEnd >>>= 0
  24919. if (this === target) return 0
  24920. var x = thisEnd - thisStart
  24921. var y = end - start
  24922. var len = Math.min(x, y)
  24923. var thisCopy = this.slice(thisStart, thisEnd)
  24924. var targetCopy = target.slice(start, end)
  24925. for (var i = 0; i < len; ++i) {
  24926. if (thisCopy[i] !== targetCopy[i]) {
  24927. x = thisCopy[i]
  24928. y = targetCopy[i]
  24929. break
  24930. }
  24931. }
  24932. if (x < y) return -1
  24933. if (y < x) return 1
  24934. return 0
  24935. }
  24936. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  24937. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  24938. //
  24939. // Arguments:
  24940. // - buffer - a Buffer to search
  24941. // - val - a string, Buffer, or number
  24942. // - byteOffset - an index into `buffer`; will be clamped to an int32
  24943. // - encoding - an optional encoding, relevant is val is a string
  24944. // - dir - true for indexOf, false for lastIndexOf
  24945. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  24946. // Empty buffer means no match
  24947. if (buffer.length === 0) return -1
  24948. // Normalize byteOffset
  24949. if (typeof byteOffset === 'string') {
  24950. encoding = byteOffset
  24951. byteOffset = 0
  24952. } else if (byteOffset > 0x7fffffff) {
  24953. byteOffset = 0x7fffffff
  24954. } else if (byteOffset < -0x80000000) {
  24955. byteOffset = -0x80000000
  24956. }
  24957. byteOffset = +byteOffset // Coerce to Number.
  24958. if (isNaN(byteOffset)) {
  24959. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  24960. byteOffset = dir ? 0 : (buffer.length - 1)
  24961. }
  24962. // Normalize byteOffset: negative offsets start from the end of the buffer
  24963. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  24964. if (byteOffset >= buffer.length) {
  24965. if (dir) return -1
  24966. else byteOffset = buffer.length - 1
  24967. } else if (byteOffset < 0) {
  24968. if (dir) byteOffset = 0
  24969. else return -1
  24970. }
  24971. // Normalize val
  24972. if (typeof val === 'string') {
  24973. val = Buffer.from(val, encoding)
  24974. }
  24975. // Finally, search either indexOf (if dir is true) or lastIndexOf
  24976. if (Buffer.isBuffer(val)) {
  24977. // Special case: looking for empty string/buffer always fails
  24978. if (val.length === 0) {
  24979. return -1
  24980. }
  24981. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  24982. } else if (typeof val === 'number') {
  24983. val = val & 0xFF // Search for a byte value [0-255]
  24984. if (Buffer.TYPED_ARRAY_SUPPORT &&
  24985. typeof Uint8Array.prototype.indexOf === 'function') {
  24986. if (dir) {
  24987. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  24988. } else {
  24989. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  24990. }
  24991. }
  24992. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  24993. }
  24994. throw new TypeError('val must be string, number or Buffer')
  24995. }
  24996. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  24997. var indexSize = 1
  24998. var arrLength = arr.length
  24999. var valLength = val.length
  25000. if (encoding !== undefined) {
  25001. encoding = String(encoding).toLowerCase()
  25002. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  25003. encoding === 'utf16le' || encoding === 'utf-16le') {
  25004. if (arr.length < 2 || val.length < 2) {
  25005. return -1
  25006. }
  25007. indexSize = 2
  25008. arrLength /= 2
  25009. valLength /= 2
  25010. byteOffset /= 2
  25011. }
  25012. }
  25013. function read (buf, i) {
  25014. if (indexSize === 1) {
  25015. return buf[i]
  25016. } else {
  25017. return buf.readUInt16BE(i * indexSize)
  25018. }
  25019. }
  25020. var i
  25021. if (dir) {
  25022. var foundIndex = -1
  25023. for (i = byteOffset; i < arrLength; i++) {
  25024. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  25025. if (foundIndex === -1) foundIndex = i
  25026. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  25027. } else {
  25028. if (foundIndex !== -1) i -= i - foundIndex
  25029. foundIndex = -1
  25030. }
  25031. }
  25032. } else {
  25033. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  25034. for (i = byteOffset; i >= 0; i--) {
  25035. var found = true
  25036. for (var j = 0; j < valLength; j++) {
  25037. if (read(arr, i + j) !== read(val, j)) {
  25038. found = false
  25039. break
  25040. }
  25041. }
  25042. if (found) return i
  25043. }
  25044. }
  25045. return -1
  25046. }
  25047. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  25048. return this.indexOf(val, byteOffset, encoding) !== -1
  25049. }
  25050. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  25051. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  25052. }
  25053. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  25054. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  25055. }
  25056. function hexWrite (buf, string, offset, length) {
  25057. offset = Number(offset) || 0
  25058. var remaining = buf.length - offset
  25059. if (!length) {
  25060. length = remaining
  25061. } else {
  25062. length = Number(length)
  25063. if (length > remaining) {
  25064. length = remaining
  25065. }
  25066. }
  25067. // must be an even number of digits
  25068. var strLen = string.length
  25069. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  25070. if (length > strLen / 2) {
  25071. length = strLen / 2
  25072. }
  25073. for (var i = 0; i < length; ++i) {
  25074. var parsed = parseInt(string.substr(i * 2, 2), 16)
  25075. if (isNaN(parsed)) return i
  25076. buf[offset + i] = parsed
  25077. }
  25078. return i
  25079. }
  25080. function utf8Write (buf, string, offset, length) {
  25081. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  25082. }
  25083. function asciiWrite (buf, string, offset, length) {
  25084. return blitBuffer(asciiToBytes(string), buf, offset, length)
  25085. }
  25086. function latin1Write (buf, string, offset, length) {
  25087. return asciiWrite(buf, string, offset, length)
  25088. }
  25089. function base64Write (buf, string, offset, length) {
  25090. return blitBuffer(base64ToBytes(string), buf, offset, length)
  25091. }
  25092. function ucs2Write (buf, string, offset, length) {
  25093. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  25094. }
  25095. Buffer.prototype.write = function write (string, offset, length, encoding) {
  25096. // Buffer#write(string)
  25097. if (offset === undefined) {
  25098. encoding = 'utf8'
  25099. length = this.length
  25100. offset = 0
  25101. // Buffer#write(string, encoding)
  25102. } else if (length === undefined && typeof offset === 'string') {
  25103. encoding = offset
  25104. length = this.length
  25105. offset = 0
  25106. // Buffer#write(string, offset[, length][, encoding])
  25107. } else if (isFinite(offset)) {
  25108. offset = offset | 0
  25109. if (isFinite(length)) {
  25110. length = length | 0
  25111. if (encoding === undefined) encoding = 'utf8'
  25112. } else {
  25113. encoding = length
  25114. length = undefined
  25115. }
  25116. // legacy write(string, encoding, offset, length) - remove in v0.13
  25117. } else {
  25118. throw new Error(
  25119. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  25120. )
  25121. }
  25122. var remaining = this.length - offset
  25123. if (length === undefined || length > remaining) length = remaining
  25124. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  25125. throw new RangeError('Attempt to write outside buffer bounds')
  25126. }
  25127. if (!encoding) encoding = 'utf8'
  25128. var loweredCase = false
  25129. for (;;) {
  25130. switch (encoding) {
  25131. case 'hex':
  25132. return hexWrite(this, string, offset, length)
  25133. case 'utf8':
  25134. case 'utf-8':
  25135. return utf8Write(this, string, offset, length)
  25136. case 'ascii':
  25137. return asciiWrite(this, string, offset, length)
  25138. case 'latin1':
  25139. case 'binary':
  25140. return latin1Write(this, string, offset, length)
  25141. case 'base64':
  25142. // Warning: maxLength not taken into account in base64Write
  25143. return base64Write(this, string, offset, length)
  25144. case 'ucs2':
  25145. case 'ucs-2':
  25146. case 'utf16le':
  25147. case 'utf-16le':
  25148. return ucs2Write(this, string, offset, length)
  25149. default:
  25150. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  25151. encoding = ('' + encoding).toLowerCase()
  25152. loweredCase = true
  25153. }
  25154. }
  25155. }
  25156. Buffer.prototype.toJSON = function toJSON () {
  25157. return {
  25158. type: 'Buffer',
  25159. data: Array.prototype.slice.call(this._arr || this, 0)
  25160. }
  25161. }
  25162. function base64Slice (buf, start, end) {
  25163. if (start === 0 && end === buf.length) {
  25164. return base64.fromByteArray(buf)
  25165. } else {
  25166. return base64.fromByteArray(buf.slice(start, end))
  25167. }
  25168. }
  25169. function utf8Slice (buf, start, end) {
  25170. end = Math.min(buf.length, end)
  25171. var res = []
  25172. var i = start
  25173. while (i < end) {
  25174. var firstByte = buf[i]
  25175. var codePoint = null
  25176. var bytesPerSequence = (firstByte > 0xEF) ? 4
  25177. : (firstByte > 0xDF) ? 3
  25178. : (firstByte > 0xBF) ? 2
  25179. : 1
  25180. if (i + bytesPerSequence <= end) {
  25181. var secondByte, thirdByte, fourthByte, tempCodePoint
  25182. switch (bytesPerSequence) {
  25183. case 1:
  25184. if (firstByte < 0x80) {
  25185. codePoint = firstByte
  25186. }
  25187. break
  25188. case 2:
  25189. secondByte = buf[i + 1]
  25190. if ((secondByte & 0xC0) === 0x80) {
  25191. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  25192. if (tempCodePoint > 0x7F) {
  25193. codePoint = tempCodePoint
  25194. }
  25195. }
  25196. break
  25197. case 3:
  25198. secondByte = buf[i + 1]
  25199. thirdByte = buf[i + 2]
  25200. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  25201. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  25202. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  25203. codePoint = tempCodePoint
  25204. }
  25205. }
  25206. break
  25207. case 4:
  25208. secondByte = buf[i + 1]
  25209. thirdByte = buf[i + 2]
  25210. fourthByte = buf[i + 3]
  25211. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  25212. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  25213. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  25214. codePoint = tempCodePoint
  25215. }
  25216. }
  25217. }
  25218. }
  25219. if (codePoint === null) {
  25220. // we did not generate a valid codePoint so insert a
  25221. // replacement char (U+FFFD) and advance only 1 byte
  25222. codePoint = 0xFFFD
  25223. bytesPerSequence = 1
  25224. } else if (codePoint > 0xFFFF) {
  25225. // encode to utf16 (surrogate pair dance)
  25226. codePoint -= 0x10000
  25227. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  25228. codePoint = 0xDC00 | codePoint & 0x3FF
  25229. }
  25230. res.push(codePoint)
  25231. i += bytesPerSequence
  25232. }
  25233. return decodeCodePointsArray(res)
  25234. }
  25235. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  25236. // the lowest limit is Chrome, with 0x10000 args.
  25237. // We go 1 magnitude less, for safety
  25238. var MAX_ARGUMENTS_LENGTH = 0x1000
  25239. function decodeCodePointsArray (codePoints) {
  25240. var len = codePoints.length
  25241. if (len <= MAX_ARGUMENTS_LENGTH) {
  25242. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  25243. }
  25244. // Decode in chunks to avoid "call stack size exceeded".
  25245. var res = ''
  25246. var i = 0
  25247. while (i < len) {
  25248. res += String.fromCharCode.apply(
  25249. String,
  25250. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  25251. )
  25252. }
  25253. return res
  25254. }
  25255. function asciiSlice (buf, start, end) {
  25256. var ret = ''
  25257. end = Math.min(buf.length, end)
  25258. for (var i = start; i < end; ++i) {
  25259. ret += String.fromCharCode(buf[i] & 0x7F)
  25260. }
  25261. return ret
  25262. }
  25263. function latin1Slice (buf, start, end) {
  25264. var ret = ''
  25265. end = Math.min(buf.length, end)
  25266. for (var i = start; i < end; ++i) {
  25267. ret += String.fromCharCode(buf[i])
  25268. }
  25269. return ret
  25270. }
  25271. function hexSlice (buf, start, end) {
  25272. var len = buf.length
  25273. if (!start || start < 0) start = 0
  25274. if (!end || end < 0 || end > len) end = len
  25275. var out = ''
  25276. for (var i = start; i < end; ++i) {
  25277. out += toHex(buf[i])
  25278. }
  25279. return out
  25280. }
  25281. function utf16leSlice (buf, start, end) {
  25282. var bytes = buf.slice(start, end)
  25283. var res = ''
  25284. for (var i = 0; i < bytes.length; i += 2) {
  25285. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  25286. }
  25287. return res
  25288. }
  25289. Buffer.prototype.slice = function slice (start, end) {
  25290. var len = this.length
  25291. start = ~~start
  25292. end = end === undefined ? len : ~~end
  25293. if (start < 0) {
  25294. start += len
  25295. if (start < 0) start = 0
  25296. } else if (start > len) {
  25297. start = len
  25298. }
  25299. if (end < 0) {
  25300. end += len
  25301. if (end < 0) end = 0
  25302. } else if (end > len) {
  25303. end = len
  25304. }
  25305. if (end < start) end = start
  25306. var newBuf
  25307. if (Buffer.TYPED_ARRAY_SUPPORT) {
  25308. newBuf = this.subarray(start, end)
  25309. newBuf.__proto__ = Buffer.prototype
  25310. } else {
  25311. var sliceLen = end - start
  25312. newBuf = new Buffer(sliceLen, undefined)
  25313. for (var i = 0; i < sliceLen; ++i) {
  25314. newBuf[i] = this[i + start]
  25315. }
  25316. }
  25317. return newBuf
  25318. }
  25319. /*
  25320. * Need to make sure that buffer isn't trying to write out of bounds.
  25321. */
  25322. function checkOffset (offset, ext, length) {
  25323. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  25324. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  25325. }
  25326. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  25327. offset = offset | 0
  25328. byteLength = byteLength | 0
  25329. if (!noAssert) checkOffset(offset, byteLength, this.length)
  25330. var val = this[offset]
  25331. var mul = 1
  25332. var i = 0
  25333. while (++i < byteLength && (mul *= 0x100)) {
  25334. val += this[offset + i] * mul
  25335. }
  25336. return val
  25337. }
  25338. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  25339. offset = offset | 0
  25340. byteLength = byteLength | 0
  25341. if (!noAssert) {
  25342. checkOffset(offset, byteLength, this.length)
  25343. }
  25344. var val = this[offset + --byteLength]
  25345. var mul = 1
  25346. while (byteLength > 0 && (mul *= 0x100)) {
  25347. val += this[offset + --byteLength] * mul
  25348. }
  25349. return val
  25350. }
  25351. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  25352. if (!noAssert) checkOffset(offset, 1, this.length)
  25353. return this[offset]
  25354. }
  25355. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  25356. if (!noAssert) checkOffset(offset, 2, this.length)
  25357. return this[offset] | (this[offset + 1] << 8)
  25358. }
  25359. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  25360. if (!noAssert) checkOffset(offset, 2, this.length)
  25361. return (this[offset] << 8) | this[offset + 1]
  25362. }
  25363. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  25364. if (!noAssert) checkOffset(offset, 4, this.length)
  25365. return ((this[offset]) |
  25366. (this[offset + 1] << 8) |
  25367. (this[offset + 2] << 16)) +
  25368. (this[offset + 3] * 0x1000000)
  25369. }
  25370. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  25371. if (!noAssert) checkOffset(offset, 4, this.length)
  25372. return (this[offset] * 0x1000000) +
  25373. ((this[offset + 1] << 16) |
  25374. (this[offset + 2] << 8) |
  25375. this[offset + 3])
  25376. }
  25377. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  25378. offset = offset | 0
  25379. byteLength = byteLength | 0
  25380. if (!noAssert) checkOffset(offset, byteLength, this.length)
  25381. var val = this[offset]
  25382. var mul = 1
  25383. var i = 0
  25384. while (++i < byteLength && (mul *= 0x100)) {
  25385. val += this[offset + i] * mul
  25386. }
  25387. mul *= 0x80
  25388. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  25389. return val
  25390. }
  25391. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  25392. offset = offset | 0
  25393. byteLength = byteLength | 0
  25394. if (!noAssert) checkOffset(offset, byteLength, this.length)
  25395. var i = byteLength
  25396. var mul = 1
  25397. var val = this[offset + --i]
  25398. while (i > 0 && (mul *= 0x100)) {
  25399. val += this[offset + --i] * mul
  25400. }
  25401. mul *= 0x80
  25402. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  25403. return val
  25404. }
  25405. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  25406. if (!noAssert) checkOffset(offset, 1, this.length)
  25407. if (!(this[offset] & 0x80)) return (this[offset])
  25408. return ((0xff - this[offset] + 1) * -1)
  25409. }
  25410. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  25411. if (!noAssert) checkOffset(offset, 2, this.length)
  25412. var val = this[offset] | (this[offset + 1] << 8)
  25413. return (val & 0x8000) ? val | 0xFFFF0000 : val
  25414. }
  25415. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  25416. if (!noAssert) checkOffset(offset, 2, this.length)
  25417. var val = this[offset + 1] | (this[offset] << 8)
  25418. return (val & 0x8000) ? val | 0xFFFF0000 : val
  25419. }
  25420. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  25421. if (!noAssert) checkOffset(offset, 4, this.length)
  25422. return (this[offset]) |
  25423. (this[offset + 1] << 8) |
  25424. (this[offset + 2] << 16) |
  25425. (this[offset + 3] << 24)
  25426. }
  25427. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  25428. if (!noAssert) checkOffset(offset, 4, this.length)
  25429. return (this[offset] << 24) |
  25430. (this[offset + 1] << 16) |
  25431. (this[offset + 2] << 8) |
  25432. (this[offset + 3])
  25433. }
  25434. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  25435. if (!noAssert) checkOffset(offset, 4, this.length)
  25436. return ieee754.read(this, offset, true, 23, 4)
  25437. }
  25438. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  25439. if (!noAssert) checkOffset(offset, 4, this.length)
  25440. return ieee754.read(this, offset, false, 23, 4)
  25441. }
  25442. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  25443. if (!noAssert) checkOffset(offset, 8, this.length)
  25444. return ieee754.read(this, offset, true, 52, 8)
  25445. }
  25446. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  25447. if (!noAssert) checkOffset(offset, 8, this.length)
  25448. return ieee754.read(this, offset, false, 52, 8)
  25449. }
  25450. function checkInt (buf, value, offset, ext, max, min) {
  25451. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  25452. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  25453. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  25454. }
  25455. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  25456. value = +value
  25457. offset = offset | 0
  25458. byteLength = byteLength | 0
  25459. if (!noAssert) {
  25460. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  25461. checkInt(this, value, offset, byteLength, maxBytes, 0)
  25462. }
  25463. var mul = 1
  25464. var i = 0
  25465. this[offset] = value & 0xFF
  25466. while (++i < byteLength && (mul *= 0x100)) {
  25467. this[offset + i] = (value / mul) & 0xFF
  25468. }
  25469. return offset + byteLength
  25470. }
  25471. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  25472. value = +value
  25473. offset = offset | 0
  25474. byteLength = byteLength | 0
  25475. if (!noAssert) {
  25476. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  25477. checkInt(this, value, offset, byteLength, maxBytes, 0)
  25478. }
  25479. var i = byteLength - 1
  25480. var mul = 1
  25481. this[offset + i] = value & 0xFF
  25482. while (--i >= 0 && (mul *= 0x100)) {
  25483. this[offset + i] = (value / mul) & 0xFF
  25484. }
  25485. return offset + byteLength
  25486. }
  25487. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  25488. value = +value
  25489. offset = offset | 0
  25490. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  25491. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  25492. this[offset] = (value & 0xff)
  25493. return offset + 1
  25494. }
  25495. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  25496. if (value < 0) value = 0xffff + value + 1
  25497. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  25498. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  25499. (littleEndian ? i : 1 - i) * 8
  25500. }
  25501. }
  25502. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  25503. value = +value
  25504. offset = offset | 0
  25505. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  25506. if (Buffer.TYPED_ARRAY_SUPPORT) {
  25507. this[offset] = (value & 0xff)
  25508. this[offset + 1] = (value >>> 8)
  25509. } else {
  25510. objectWriteUInt16(this, value, offset, true)
  25511. }
  25512. return offset + 2
  25513. }
  25514. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  25515. value = +value
  25516. offset = offset | 0
  25517. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  25518. if (Buffer.TYPED_ARRAY_SUPPORT) {
  25519. this[offset] = (value >>> 8)
  25520. this[offset + 1] = (value & 0xff)
  25521. } else {
  25522. objectWriteUInt16(this, value, offset, false)
  25523. }
  25524. return offset + 2
  25525. }
  25526. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  25527. if (value < 0) value = 0xffffffff + value + 1
  25528. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  25529. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  25530. }
  25531. }
  25532. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  25533. value = +value
  25534. offset = offset | 0
  25535. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  25536. if (Buffer.TYPED_ARRAY_SUPPORT) {
  25537. this[offset + 3] = (value >>> 24)
  25538. this[offset + 2] = (value >>> 16)
  25539. this[offset + 1] = (value >>> 8)
  25540. this[offset] = (value & 0xff)
  25541. } else {
  25542. objectWriteUInt32(this, value, offset, true)
  25543. }
  25544. return offset + 4
  25545. }
  25546. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  25547. value = +value
  25548. offset = offset | 0
  25549. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  25550. if (Buffer.TYPED_ARRAY_SUPPORT) {
  25551. this[offset] = (value >>> 24)
  25552. this[offset + 1] = (value >>> 16)
  25553. this[offset + 2] = (value >>> 8)
  25554. this[offset + 3] = (value & 0xff)
  25555. } else {
  25556. objectWriteUInt32(this, value, offset, false)
  25557. }
  25558. return offset + 4
  25559. }
  25560. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  25561. value = +value
  25562. offset = offset | 0
  25563. if (!noAssert) {
  25564. var limit = Math.pow(2, 8 * byteLength - 1)
  25565. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  25566. }
  25567. var i = 0
  25568. var mul = 1
  25569. var sub = 0
  25570. this[offset] = value & 0xFF
  25571. while (++i < byteLength && (mul *= 0x100)) {
  25572. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  25573. sub = 1
  25574. }
  25575. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  25576. }
  25577. return offset + byteLength
  25578. }
  25579. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  25580. value = +value
  25581. offset = offset | 0
  25582. if (!noAssert) {
  25583. var limit = Math.pow(2, 8 * byteLength - 1)
  25584. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  25585. }
  25586. var i = byteLength - 1
  25587. var mul = 1
  25588. var sub = 0
  25589. this[offset + i] = value & 0xFF
  25590. while (--i >= 0 && (mul *= 0x100)) {
  25591. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  25592. sub = 1
  25593. }
  25594. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  25595. }
  25596. return offset + byteLength
  25597. }
  25598. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  25599. value = +value
  25600. offset = offset | 0
  25601. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  25602. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  25603. if (value < 0) value = 0xff + value + 1
  25604. this[offset] = (value & 0xff)
  25605. return offset + 1
  25606. }
  25607. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  25608. value = +value
  25609. offset = offset | 0
  25610. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  25611. if (Buffer.TYPED_ARRAY_SUPPORT) {
  25612. this[offset] = (value & 0xff)
  25613. this[offset + 1] = (value >>> 8)
  25614. } else {
  25615. objectWriteUInt16(this, value, offset, true)
  25616. }
  25617. return offset + 2
  25618. }
  25619. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  25620. value = +value
  25621. offset = offset | 0
  25622. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  25623. if (Buffer.TYPED_ARRAY_SUPPORT) {
  25624. this[offset] = (value >>> 8)
  25625. this[offset + 1] = (value & 0xff)
  25626. } else {
  25627. objectWriteUInt16(this, value, offset, false)
  25628. }
  25629. return offset + 2
  25630. }
  25631. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  25632. value = +value
  25633. offset = offset | 0
  25634. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  25635. if (Buffer.TYPED_ARRAY_SUPPORT) {
  25636. this[offset] = (value & 0xff)
  25637. this[offset + 1] = (value >>> 8)
  25638. this[offset + 2] = (value >>> 16)
  25639. this[offset + 3] = (value >>> 24)
  25640. } else {
  25641. objectWriteUInt32(this, value, offset, true)
  25642. }
  25643. return offset + 4
  25644. }
  25645. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  25646. value = +value
  25647. offset = offset | 0
  25648. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  25649. if (value < 0) value = 0xffffffff + value + 1
  25650. if (Buffer.TYPED_ARRAY_SUPPORT) {
  25651. this[offset] = (value >>> 24)
  25652. this[offset + 1] = (value >>> 16)
  25653. this[offset + 2] = (value >>> 8)
  25654. this[offset + 3] = (value & 0xff)
  25655. } else {
  25656. objectWriteUInt32(this, value, offset, false)
  25657. }
  25658. return offset + 4
  25659. }
  25660. function checkIEEE754 (buf, value, offset, ext, max, min) {
  25661. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  25662. if (offset < 0) throw new RangeError('Index out of range')
  25663. }
  25664. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  25665. if (!noAssert) {
  25666. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  25667. }
  25668. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  25669. return offset + 4
  25670. }
  25671. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  25672. return writeFloat(this, value, offset, true, noAssert)
  25673. }
  25674. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  25675. return writeFloat(this, value, offset, false, noAssert)
  25676. }
  25677. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  25678. if (!noAssert) {
  25679. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  25680. }
  25681. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  25682. return offset + 8
  25683. }
  25684. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  25685. return writeDouble(this, value, offset, true, noAssert)
  25686. }
  25687. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  25688. return writeDouble(this, value, offset, false, noAssert)
  25689. }
  25690. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  25691. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  25692. if (!start) start = 0
  25693. if (!end && end !== 0) end = this.length
  25694. if (targetStart >= target.length) targetStart = target.length
  25695. if (!targetStart) targetStart = 0
  25696. if (end > 0 && end < start) end = start
  25697. // Copy 0 bytes; we're done
  25698. if (end === start) return 0
  25699. if (target.length === 0 || this.length === 0) return 0
  25700. // Fatal error conditions
  25701. if (targetStart < 0) {
  25702. throw new RangeError('targetStart out of bounds')
  25703. }
  25704. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  25705. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  25706. // Are we oob?
  25707. if (end > this.length) end = this.length
  25708. if (target.length - targetStart < end - start) {
  25709. end = target.length - targetStart + start
  25710. }
  25711. var len = end - start
  25712. var i
  25713. if (this === target && start < targetStart && targetStart < end) {
  25714. // descending copy from end
  25715. for (i = len - 1; i >= 0; --i) {
  25716. target[i + targetStart] = this[i + start]
  25717. }
  25718. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  25719. // ascending copy from start
  25720. for (i = 0; i < len; ++i) {
  25721. target[i + targetStart] = this[i + start]
  25722. }
  25723. } else {
  25724. Uint8Array.prototype.set.call(
  25725. target,
  25726. this.subarray(start, start + len),
  25727. targetStart
  25728. )
  25729. }
  25730. return len
  25731. }
  25732. // Usage:
  25733. // buffer.fill(number[, offset[, end]])
  25734. // buffer.fill(buffer[, offset[, end]])
  25735. // buffer.fill(string[, offset[, end]][, encoding])
  25736. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  25737. // Handle string cases:
  25738. if (typeof val === 'string') {
  25739. if (typeof start === 'string') {
  25740. encoding = start
  25741. start = 0
  25742. end = this.length
  25743. } else if (typeof end === 'string') {
  25744. encoding = end
  25745. end = this.length
  25746. }
  25747. if (val.length === 1) {
  25748. var code = val.charCodeAt(0)
  25749. if (code < 256) {
  25750. val = code
  25751. }
  25752. }
  25753. if (encoding !== undefined && typeof encoding !== 'string') {
  25754. throw new TypeError('encoding must be a string')
  25755. }
  25756. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  25757. throw new TypeError('Unknown encoding: ' + encoding)
  25758. }
  25759. } else if (typeof val === 'number') {
  25760. val = val & 255
  25761. }
  25762. // Invalid ranges are not set to a default, so can range check early.
  25763. if (start < 0 || this.length < start || this.length < end) {
  25764. throw new RangeError('Out of range index')
  25765. }
  25766. if (end <= start) {
  25767. return this
  25768. }
  25769. start = start >>> 0
  25770. end = end === undefined ? this.length : end >>> 0
  25771. if (!val) val = 0
  25772. var i
  25773. if (typeof val === 'number') {
  25774. for (i = start; i < end; ++i) {
  25775. this[i] = val
  25776. }
  25777. } else {
  25778. var bytes = Buffer.isBuffer(val)
  25779. ? val
  25780. : utf8ToBytes(new Buffer(val, encoding).toString())
  25781. var len = bytes.length
  25782. for (i = 0; i < end - start; ++i) {
  25783. this[i + start] = bytes[i % len]
  25784. }
  25785. }
  25786. return this
  25787. }
  25788. // HELPER FUNCTIONS
  25789. // ================
  25790. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  25791. function base64clean (str) {
  25792. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  25793. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  25794. // Node converts strings with length < 2 to ''
  25795. if (str.length < 2) return ''
  25796. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  25797. while (str.length % 4 !== 0) {
  25798. str = str + '='
  25799. }
  25800. return str
  25801. }
  25802. function stringtrim (str) {
  25803. if (str.trim) return str.trim()
  25804. return str.replace(/^\s+|\s+$/g, '')
  25805. }
  25806. function toHex (n) {
  25807. if (n < 16) return '0' + n.toString(16)
  25808. return n.toString(16)
  25809. }
  25810. function utf8ToBytes (string, units) {
  25811. units = units || Infinity
  25812. var codePoint
  25813. var length = string.length
  25814. var leadSurrogate = null
  25815. var bytes = []
  25816. for (var i = 0; i < length; ++i) {
  25817. codePoint = string.charCodeAt(i)
  25818. // is surrogate component
  25819. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  25820. // last char was a lead
  25821. if (!leadSurrogate) {
  25822. // no lead yet
  25823. if (codePoint > 0xDBFF) {
  25824. // unexpected trail
  25825. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  25826. continue
  25827. } else if (i + 1 === length) {
  25828. // unpaired lead
  25829. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  25830. continue
  25831. }
  25832. // valid lead
  25833. leadSurrogate = codePoint
  25834. continue
  25835. }
  25836. // 2 leads in a row
  25837. if (codePoint < 0xDC00) {
  25838. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  25839. leadSurrogate = codePoint
  25840. continue
  25841. }
  25842. // valid surrogate pair
  25843. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  25844. } else if (leadSurrogate) {
  25845. // valid bmp char, but last char was a lead
  25846. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  25847. }
  25848. leadSurrogate = null
  25849. // encode utf8
  25850. if (codePoint < 0x80) {
  25851. if ((units -= 1) < 0) break
  25852. bytes.push(codePoint)
  25853. } else if (codePoint < 0x800) {
  25854. if ((units -= 2) < 0) break
  25855. bytes.push(
  25856. codePoint >> 0x6 | 0xC0,
  25857. codePoint & 0x3F | 0x80
  25858. )
  25859. } else if (codePoint < 0x10000) {
  25860. if ((units -= 3) < 0) break
  25861. bytes.push(
  25862. codePoint >> 0xC | 0xE0,
  25863. codePoint >> 0x6 & 0x3F | 0x80,
  25864. codePoint & 0x3F | 0x80
  25865. )
  25866. } else if (codePoint < 0x110000) {
  25867. if ((units -= 4) < 0) break
  25868. bytes.push(
  25869. codePoint >> 0x12 | 0xF0,
  25870. codePoint >> 0xC & 0x3F | 0x80,
  25871. codePoint >> 0x6 & 0x3F | 0x80,
  25872. codePoint & 0x3F | 0x80
  25873. )
  25874. } else {
  25875. throw new Error('Invalid code point')
  25876. }
  25877. }
  25878. return bytes
  25879. }
  25880. function asciiToBytes (str) {
  25881. var byteArray = []
  25882. for (var i = 0; i < str.length; ++i) {
  25883. // Node's code seems to be doing this and not & 0x7F..
  25884. byteArray.push(str.charCodeAt(i) & 0xFF)
  25885. }
  25886. return byteArray
  25887. }
  25888. function utf16leToBytes (str, units) {
  25889. var c, hi, lo
  25890. var byteArray = []
  25891. for (var i = 0; i < str.length; ++i) {
  25892. if ((units -= 2) < 0) break
  25893. c = str.charCodeAt(i)
  25894. hi = c >> 8
  25895. lo = c % 256
  25896. byteArray.push(lo)
  25897. byteArray.push(hi)
  25898. }
  25899. return byteArray
  25900. }
  25901. function base64ToBytes (str) {
  25902. return base64.toByteArray(base64clean(str))
  25903. }
  25904. function blitBuffer (src, dst, offset, length) {
  25905. for (var i = 0; i < length; ++i) {
  25906. if ((i + offset >= dst.length) || (i >= src.length)) break
  25907. dst[i + offset] = src[i]
  25908. }
  25909. return i
  25910. }
  25911. function isnan (val) {
  25912. return val !== val // eslint-disable-line no-self-compare
  25913. }
  25914. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  25915. },{"base64-js":157,"ieee754":291,"isarray":294}],161:[function(require,module,exports){
  25916. (function (process){
  25917. 'use strict';
  25918. var escapeStringRegexp = require('escape-string-regexp');
  25919. var ansiStyles = require('ansi-styles');
  25920. var stripAnsi = require('strip-ansi');
  25921. var hasAnsi = require('has-ansi');
  25922. var supportsColor = require('supports-color');
  25923. var defineProps = Object.defineProperties;
  25924. var isSimpleWindowsTerm = process.platform === 'win32' && !/^xterm/i.test(process.env.TERM);
  25925. function Chalk(options) {
  25926. // detect mode if not set manually
  25927. this.enabled = !options || options.enabled === undefined ? supportsColor : options.enabled;
  25928. }
  25929. // use bright blue on Windows as the normal blue color is illegible
  25930. if (isSimpleWindowsTerm) {
  25931. ansiStyles.blue.open = '\u001b[94m';
  25932. }
  25933. var styles = (function () {
  25934. var ret = {};
  25935. Object.keys(ansiStyles).forEach(function (key) {
  25936. ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
  25937. ret[key] = {
  25938. get: function () {
  25939. return build.call(this, this._styles.concat(key));
  25940. }
  25941. };
  25942. });
  25943. return ret;
  25944. })();
  25945. var proto = defineProps(function chalk() {}, styles);
  25946. function build(_styles) {
  25947. var builder = function () {
  25948. return applyStyle.apply(builder, arguments);
  25949. };
  25950. builder._styles = _styles;
  25951. builder.enabled = this.enabled;
  25952. // __proto__ is used because we must return a function, but there is
  25953. // no way to create a function with a different prototype.
  25954. /* eslint-disable no-proto */
  25955. builder.__proto__ = proto;
  25956. return builder;
  25957. }
  25958. function applyStyle() {
  25959. // support varags, but simply cast to string in case there's only one arg
  25960. var args = arguments;
  25961. var argsLen = args.length;
  25962. var str = argsLen !== 0 && String(arguments[0]);
  25963. if (argsLen > 1) {
  25964. // don't slice `arguments`, it prevents v8 optimizations
  25965. for (var a = 1; a < argsLen; a++) {
  25966. str += ' ' + args[a];
  25967. }
  25968. }
  25969. if (!this.enabled || !str) {
  25970. return str;
  25971. }
  25972. var nestedStyles = this._styles;
  25973. var i = nestedStyles.length;
  25974. // Turns out that on Windows dimmed gray text becomes invisible in cmd.exe,
  25975. // see https://github.com/chalk/chalk/issues/58
  25976. // If we're on Windows and we're dealing with a gray color, temporarily make 'dim' a noop.
  25977. var originalDim = ansiStyles.dim.open;
  25978. if (isSimpleWindowsTerm && (nestedStyles.indexOf('gray') !== -1 || nestedStyles.indexOf('grey') !== -1)) {
  25979. ansiStyles.dim.open = '';
  25980. }
  25981. while (i--) {
  25982. var code = ansiStyles[nestedStyles[i]];
  25983. // Replace any instances already present with a re-opening code
  25984. // otherwise only the part of the string until said closing code
  25985. // will be colored, and the rest will simply be 'plain'.
  25986. str = code.open + str.replace(code.closeRe, code.open) + code.close;
  25987. }
  25988. // Reset the original 'dim' if we changed it to work around the Windows dimmed gray issue.
  25989. ansiStyles.dim.open = originalDim;
  25990. return str;
  25991. }
  25992. function init() {
  25993. var ret = {};
  25994. Object.keys(styles).forEach(function (name) {
  25995. ret[name] = {
  25996. get: function () {
  25997. return build.call(this, [name]);
  25998. }
  25999. };
  26000. });
  26001. return ret;
  26002. }
  26003. defineProps(Chalk.prototype, init());
  26004. module.exports = new Chalk();
  26005. module.exports.styles = ansiStyles;
  26006. module.exports.hasColor = hasAnsi;
  26007. module.exports.stripColor = stripAnsi;
  26008. module.exports.supportsColor = supportsColor;
  26009. }).call(this,require('_process'))
  26010. },{"_process":525,"ansi-styles":2,"escape-string-regexp":283,"has-ansi":290,"strip-ansi":553,"supports-color":554}],162:[function(require,module,exports){
  26011. module.exports = function (xs, fn) {
  26012. var res = [];
  26013. for (var i = 0; i < xs.length; i++) {
  26014. var x = fn(xs[i], i);
  26015. if (isArray(x)) res.push.apply(res, x);
  26016. else res.push(x);
  26017. }
  26018. return res;
  26019. };
  26020. var isArray = Array.isArray || function (xs) {
  26021. return Object.prototype.toString.call(xs) === '[object Array]';
  26022. };
  26023. },{}],163:[function(require,module,exports){
  26024. (function (Buffer){
  26025. 'use strict';
  26026. var fs = require('fs');
  26027. var path = require('path');
  26028. Object.defineProperty(exports, 'commentRegex', {
  26029. get: function getCommentRegex () {
  26030. return /^\s*\/(?:\/|\*)[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+?;)?base64,(?:.*)$/mg;
  26031. }
  26032. });
  26033. Object.defineProperty(exports, 'mapFileCommentRegex', {
  26034. get: function getMapFileCommentRegex () {
  26035. // Matches sourceMappingURL in either // or /* comment styles.
  26036. return /(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"`]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/){1}[ \t]*$)/mg;
  26037. }
  26038. });
  26039. function decodeBase64(base64) {
  26040. return new Buffer(base64, 'base64').toString();
  26041. }
  26042. function stripComment(sm) {
  26043. return sm.split(',').pop();
  26044. }
  26045. function readFromFileMap(sm, dir) {
  26046. // NOTE: this will only work on the server since it attempts to read the map file
  26047. var r = exports.mapFileCommentRegex.exec(sm);
  26048. // for some odd reason //# .. captures in 1 and /* .. */ in 2
  26049. var filename = r[1] || r[2];
  26050. var filepath = path.resolve(dir, filename);
  26051. try {
  26052. return fs.readFileSync(filepath, 'utf8');
  26053. } catch (e) {
  26054. throw new Error('An error occurred while trying to read the map file at ' + filepath + '\n' + e);
  26055. }
  26056. }
  26057. function Converter (sm, opts) {
  26058. opts = opts || {};
  26059. if (opts.isFileComment) sm = readFromFileMap(sm, opts.commentFileDir);
  26060. if (opts.hasComment) sm = stripComment(sm);
  26061. if (opts.isEncoded) sm = decodeBase64(sm);
  26062. if (opts.isJSON || opts.isEncoded) sm = JSON.parse(sm);
  26063. this.sourcemap = sm;
  26064. }
  26065. Converter.prototype.toJSON = function (space) {
  26066. return JSON.stringify(this.sourcemap, null, space);
  26067. };
  26068. Converter.prototype.toBase64 = function () {
  26069. var json = this.toJSON();
  26070. return new Buffer(json).toString('base64');
  26071. };
  26072. Converter.prototype.toComment = function (options) {
  26073. var base64 = this.toBase64();
  26074. var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
  26075. return options && options.multiline ? '/*# ' + data + ' */' : '//# ' + data;
  26076. };
  26077. // returns copy instead of original
  26078. Converter.prototype.toObject = function () {
  26079. return JSON.parse(this.toJSON());
  26080. };
  26081. Converter.prototype.addProperty = function (key, value) {
  26082. if (this.sourcemap.hasOwnProperty(key)) throw new Error('property "' + key + '" already exists on the sourcemap, use set property instead');
  26083. return this.setProperty(key, value);
  26084. };
  26085. Converter.prototype.setProperty = function (key, value) {
  26086. this.sourcemap[key] = value;
  26087. return this;
  26088. };
  26089. Converter.prototype.getProperty = function (key) {
  26090. return this.sourcemap[key];
  26091. };
  26092. exports.fromObject = function (obj) {
  26093. return new Converter(obj);
  26094. };
  26095. exports.fromJSON = function (json) {
  26096. return new Converter(json, { isJSON: true });
  26097. };
  26098. exports.fromBase64 = function (base64) {
  26099. return new Converter(base64, { isEncoded: true });
  26100. };
  26101. exports.fromComment = function (comment) {
  26102. comment = comment
  26103. .replace(/^\/\*/g, '//')
  26104. .replace(/\*\/$/g, '');
  26105. return new Converter(comment, { isEncoded: true, hasComment: true });
  26106. };
  26107. exports.fromMapFileComment = function (comment, dir) {
  26108. return new Converter(comment, { commentFileDir: dir, isFileComment: true, isJSON: true });
  26109. };
  26110. // Finds last sourcemap comment in file or returns null if none was found
  26111. exports.fromSource = function (content) {
  26112. var m = content.match(exports.commentRegex);
  26113. return m ? exports.fromComment(m.pop()) : null;
  26114. };
  26115. // Finds last sourcemap comment in file or returns null if none was found
  26116. exports.fromMapFileSource = function (content, dir) {
  26117. var m = content.match(exports.mapFileCommentRegex);
  26118. return m ? exports.fromMapFileComment(m.pop(), dir) : null;
  26119. };
  26120. exports.removeComments = function (src) {
  26121. return src.replace(exports.commentRegex, '');
  26122. };
  26123. exports.removeMapFileComments = function (src) {
  26124. return src.replace(exports.mapFileCommentRegex, '');
  26125. };
  26126. exports.generateMapFileComment = function (file, options) {
  26127. var data = 'sourceMappingURL=' + file;
  26128. return options && options.multiline ? '/*# ' + data + ' */' : '//# ' + data;
  26129. };
  26130. }).call(this,require("buffer").Buffer)
  26131. },{"buffer":160,"fs":159,"path":522}],164:[function(require,module,exports){
  26132. require('../modules/web.dom.iterable');
  26133. require('../modules/es6.string.iterator');
  26134. module.exports = require('../modules/core.get-iterator');
  26135. },{"../modules/core.get-iterator":255,"../modules/es6.string.iterator":264,"../modules/web.dom.iterable":277}],165:[function(require,module,exports){
  26136. var core = require('../../modules/_core');
  26137. var $JSON = core.JSON || (core.JSON = { stringify: JSON.stringify });
  26138. module.exports = function stringify(it) { // eslint-disable-line no-unused-vars
  26139. return $JSON.stringify.apply($JSON, arguments);
  26140. };
  26141. },{"../../modules/_core":193}],166:[function(require,module,exports){
  26142. require('../modules/es6.object.to-string');
  26143. require('../modules/es6.string.iterator');
  26144. require('../modules/web.dom.iterable');
  26145. require('../modules/es6.map');
  26146. require('../modules/es7.map.to-json');
  26147. require('../modules/es7.map.of');
  26148. require('../modules/es7.map.from');
  26149. module.exports = require('../modules/_core').Map;
  26150. },{"../modules/_core":193,"../modules/es6.map":257,"../modules/es6.object.to-string":263,"../modules/es6.string.iterator":264,"../modules/es7.map.from":268,"../modules/es7.map.of":269,"../modules/es7.map.to-json":270,"../modules/web.dom.iterable":277}],167:[function(require,module,exports){
  26151. require('../../modules/es6.number.max-safe-integer');
  26152. module.exports = 0x1fffffffffffff;
  26153. },{"../../modules/es6.number.max-safe-integer":258}],168:[function(require,module,exports){
  26154. require('../../modules/es6.object.assign');
  26155. module.exports = require('../../modules/_core').Object.assign;
  26156. },{"../../modules/_core":193,"../../modules/es6.object.assign":259}],169:[function(require,module,exports){
  26157. require('../../modules/es6.object.create');
  26158. var $Object = require('../../modules/_core').Object;
  26159. module.exports = function create(P, D) {
  26160. return $Object.create(P, D);
  26161. };
  26162. },{"../../modules/_core":193,"../../modules/es6.object.create":260}],170:[function(require,module,exports){
  26163. require('../../modules/es6.symbol');
  26164. module.exports = require('../../modules/_core').Object.getOwnPropertySymbols;
  26165. },{"../../modules/_core":193,"../../modules/es6.symbol":265}],171:[function(require,module,exports){
  26166. require('../../modules/es6.object.keys');
  26167. module.exports = require('../../modules/_core').Object.keys;
  26168. },{"../../modules/_core":193,"../../modules/es6.object.keys":261}],172:[function(require,module,exports){
  26169. require('../../modules/es6.object.set-prototype-of');
  26170. module.exports = require('../../modules/_core').Object.setPrototypeOf;
  26171. },{"../../modules/_core":193,"../../modules/es6.object.set-prototype-of":262}],173:[function(require,module,exports){
  26172. require('../../modules/es6.symbol');
  26173. module.exports = require('../../modules/_core').Symbol['for'];
  26174. },{"../../modules/_core":193,"../../modules/es6.symbol":265}],174:[function(require,module,exports){
  26175. require('../../modules/es6.symbol');
  26176. require('../../modules/es6.object.to-string');
  26177. require('../../modules/es7.symbol.async-iterator');
  26178. require('../../modules/es7.symbol.observable');
  26179. module.exports = require('../../modules/_core').Symbol;
  26180. },{"../../modules/_core":193,"../../modules/es6.object.to-string":263,"../../modules/es6.symbol":265,"../../modules/es7.symbol.async-iterator":271,"../../modules/es7.symbol.observable":272}],175:[function(require,module,exports){
  26181. require('../../modules/es6.string.iterator');
  26182. require('../../modules/web.dom.iterable');
  26183. module.exports = require('../../modules/_wks-ext').f('iterator');
  26184. },{"../../modules/_wks-ext":252,"../../modules/es6.string.iterator":264,"../../modules/web.dom.iterable":277}],176:[function(require,module,exports){
  26185. require('../modules/es6.object.to-string');
  26186. require('../modules/web.dom.iterable');
  26187. require('../modules/es6.weak-map');
  26188. require('../modules/es7.weak-map.of');
  26189. require('../modules/es7.weak-map.from');
  26190. module.exports = require('../modules/_core').WeakMap;
  26191. },{"../modules/_core":193,"../modules/es6.object.to-string":263,"../modules/es6.weak-map":266,"../modules/es7.weak-map.from":273,"../modules/es7.weak-map.of":274,"../modules/web.dom.iterable":277}],177:[function(require,module,exports){
  26192. require('../modules/es6.object.to-string');
  26193. require('../modules/web.dom.iterable');
  26194. require('../modules/es6.weak-set');
  26195. require('../modules/es7.weak-set.of');
  26196. require('../modules/es7.weak-set.from');
  26197. module.exports = require('../modules/_core').WeakSet;
  26198. },{"../modules/_core":193,"../modules/es6.object.to-string":263,"../modules/es6.weak-set":267,"../modules/es7.weak-set.from":275,"../modules/es7.weak-set.of":276,"../modules/web.dom.iterable":277}],178:[function(require,module,exports){
  26199. module.exports = function (it) {
  26200. if (typeof it != 'function') throw TypeError(it + ' is not a function!');
  26201. return it;
  26202. };
  26203. },{}],179:[function(require,module,exports){
  26204. module.exports = function () { /* empty */ };
  26205. },{}],180:[function(require,module,exports){
  26206. module.exports = function (it, Constructor, name, forbiddenField) {
  26207. if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {
  26208. throw TypeError(name + ': incorrect invocation!');
  26209. } return it;
  26210. };
  26211. },{}],181:[function(require,module,exports){
  26212. var isObject = require('./_is-object');
  26213. module.exports = function (it) {
  26214. if (!isObject(it)) throw TypeError(it + ' is not an object!');
  26215. return it;
  26216. };
  26217. },{"./_is-object":211}],182:[function(require,module,exports){
  26218. var forOf = require('./_for-of');
  26219. module.exports = function (iter, ITERATOR) {
  26220. var result = [];
  26221. forOf(iter, false, result.push, result, ITERATOR);
  26222. return result;
  26223. };
  26224. },{"./_for-of":202}],183:[function(require,module,exports){
  26225. // false -> Array#indexOf
  26226. // true -> Array#includes
  26227. var toIObject = require('./_to-iobject');
  26228. var toLength = require('./_to-length');
  26229. var toAbsoluteIndex = require('./_to-absolute-index');
  26230. module.exports = function (IS_INCLUDES) {
  26231. return function ($this, el, fromIndex) {
  26232. var O = toIObject($this);
  26233. var length = toLength(O.length);
  26234. var index = toAbsoluteIndex(fromIndex, length);
  26235. var value;
  26236. // Array#includes uses SameValueZero equality algorithm
  26237. // eslint-disable-next-line no-self-compare
  26238. if (IS_INCLUDES && el != el) while (length > index) {
  26239. value = O[index++];
  26240. // eslint-disable-next-line no-self-compare
  26241. if (value != value) return true;
  26242. // Array#indexOf ignores holes, Array#includes - not
  26243. } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
  26244. if (O[index] === el) return IS_INCLUDES || index || 0;
  26245. } return !IS_INCLUDES && -1;
  26246. };
  26247. };
  26248. },{"./_to-absolute-index":243,"./_to-iobject":245,"./_to-length":246}],184:[function(require,module,exports){
  26249. // 0 -> Array#forEach
  26250. // 1 -> Array#map
  26251. // 2 -> Array#filter
  26252. // 3 -> Array#some
  26253. // 4 -> Array#every
  26254. // 5 -> Array#find
  26255. // 6 -> Array#findIndex
  26256. var ctx = require('./_ctx');
  26257. var IObject = require('./_iobject');
  26258. var toObject = require('./_to-object');
  26259. var toLength = require('./_to-length');
  26260. var asc = require('./_array-species-create');
  26261. module.exports = function (TYPE, $create) {
  26262. var IS_MAP = TYPE == 1;
  26263. var IS_FILTER = TYPE == 2;
  26264. var IS_SOME = TYPE == 3;
  26265. var IS_EVERY = TYPE == 4;
  26266. var IS_FIND_INDEX = TYPE == 6;
  26267. var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
  26268. var create = $create || asc;
  26269. return function ($this, callbackfn, that) {
  26270. var O = toObject($this);
  26271. var self = IObject(O);
  26272. var f = ctx(callbackfn, that, 3);
  26273. var length = toLength(self.length);
  26274. var index = 0;
  26275. var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
  26276. var val, res;
  26277. for (;length > index; index++) if (NO_HOLES || index in self) {
  26278. val = self[index];
  26279. res = f(val, index, O);
  26280. if (TYPE) {
  26281. if (IS_MAP) result[index] = res; // map
  26282. else if (res) switch (TYPE) {
  26283. case 3: return true; // some
  26284. case 5: return val; // find
  26285. case 6: return index; // findIndex
  26286. case 2: result.push(val); // filter
  26287. } else if (IS_EVERY) return false; // every
  26288. }
  26289. }
  26290. return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
  26291. };
  26292. };
  26293. },{"./_array-species-create":186,"./_ctx":194,"./_iobject":208,"./_to-length":246,"./_to-object":247}],185:[function(require,module,exports){
  26294. var isObject = require('./_is-object');
  26295. var isArray = require('./_is-array');
  26296. var SPECIES = require('./_wks')('species');
  26297. module.exports = function (original) {
  26298. var C;
  26299. if (isArray(original)) {
  26300. C = original.constructor;
  26301. // cross-realm fallback
  26302. if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
  26303. if (isObject(C)) {
  26304. C = C[SPECIES];
  26305. if (C === null) C = undefined;
  26306. }
  26307. } return C === undefined ? Array : C;
  26308. };
  26309. },{"./_is-array":210,"./_is-object":211,"./_wks":253}],186:[function(require,module,exports){
  26310. // 9.4.2.3 ArraySpeciesCreate(originalArray, length)
  26311. var speciesConstructor = require('./_array-species-constructor');
  26312. module.exports = function (original, length) {
  26313. return new (speciesConstructor(original))(length);
  26314. };
  26315. },{"./_array-species-constructor":185}],187:[function(require,module,exports){
  26316. // getting tag from 19.1.3.6 Object.prototype.toString()
  26317. var cof = require('./_cof');
  26318. var TAG = require('./_wks')('toStringTag');
  26319. // ES3 wrong here
  26320. var ARG = cof(function () { return arguments; }()) == 'Arguments';
  26321. // fallback for IE11 Script Access Denied error
  26322. var tryGet = function (it, key) {
  26323. try {
  26324. return it[key];
  26325. } catch (e) { /* empty */ }
  26326. };
  26327. module.exports = function (it) {
  26328. var O, T, B;
  26329. return it === undefined ? 'Undefined' : it === null ? 'Null'
  26330. // @@toStringTag case
  26331. : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
  26332. // builtinTag case
  26333. : ARG ? cof(O)
  26334. // ES3 arguments fallback
  26335. : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
  26336. };
  26337. },{"./_cof":188,"./_wks":253}],188:[function(require,module,exports){
  26338. var toString = {}.toString;
  26339. module.exports = function (it) {
  26340. return toString.call(it).slice(8, -1);
  26341. };
  26342. },{}],189:[function(require,module,exports){
  26343. 'use strict';
  26344. var dP = require('./_object-dp').f;
  26345. var create = require('./_object-create');
  26346. var redefineAll = require('./_redefine-all');
  26347. var ctx = require('./_ctx');
  26348. var anInstance = require('./_an-instance');
  26349. var forOf = require('./_for-of');
  26350. var $iterDefine = require('./_iter-define');
  26351. var step = require('./_iter-step');
  26352. var setSpecies = require('./_set-species');
  26353. var DESCRIPTORS = require('./_descriptors');
  26354. var fastKey = require('./_meta').fastKey;
  26355. var validate = require('./_validate-collection');
  26356. var SIZE = DESCRIPTORS ? '_s' : 'size';
  26357. var getEntry = function (that, key) {
  26358. // fast case
  26359. var index = fastKey(key);
  26360. var entry;
  26361. if (index !== 'F') return that._i[index];
  26362. // frozen object case
  26363. for (entry = that._f; entry; entry = entry.n) {
  26364. if (entry.k == key) return entry;
  26365. }
  26366. };
  26367. module.exports = {
  26368. getConstructor: function (wrapper, NAME, IS_MAP, ADDER) {
  26369. var C = wrapper(function (that, iterable) {
  26370. anInstance(that, C, NAME, '_i');
  26371. that._t = NAME; // collection type
  26372. that._i = create(null); // index
  26373. that._f = undefined; // first entry
  26374. that._l = undefined; // last entry
  26375. that[SIZE] = 0; // size
  26376. if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);
  26377. });
  26378. redefineAll(C.prototype, {
  26379. // 23.1.3.1 Map.prototype.clear()
  26380. // 23.2.3.2 Set.prototype.clear()
  26381. clear: function clear() {
  26382. for (var that = validate(this, NAME), data = that._i, entry = that._f; entry; entry = entry.n) {
  26383. entry.r = true;
  26384. if (entry.p) entry.p = entry.p.n = undefined;
  26385. delete data[entry.i];
  26386. }
  26387. that._f = that._l = undefined;
  26388. that[SIZE] = 0;
  26389. },
  26390. // 23.1.3.3 Map.prototype.delete(key)
  26391. // 23.2.3.4 Set.prototype.delete(value)
  26392. 'delete': function (key) {
  26393. var that = validate(this, NAME);
  26394. var entry = getEntry(that, key);
  26395. if (entry) {
  26396. var next = entry.n;
  26397. var prev = entry.p;
  26398. delete that._i[entry.i];
  26399. entry.r = true;
  26400. if (prev) prev.n = next;
  26401. if (next) next.p = prev;
  26402. if (that._f == entry) that._f = next;
  26403. if (that._l == entry) that._l = prev;
  26404. that[SIZE]--;
  26405. } return !!entry;
  26406. },
  26407. // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
  26408. // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
  26409. forEach: function forEach(callbackfn /* , that = undefined */) {
  26410. validate(this, NAME);
  26411. var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
  26412. var entry;
  26413. while (entry = entry ? entry.n : this._f) {
  26414. f(entry.v, entry.k, this);
  26415. // revert to the last existing entry
  26416. while (entry && entry.r) entry = entry.p;
  26417. }
  26418. },
  26419. // 23.1.3.7 Map.prototype.has(key)
  26420. // 23.2.3.7 Set.prototype.has(value)
  26421. has: function has(key) {
  26422. return !!getEntry(validate(this, NAME), key);
  26423. }
  26424. });
  26425. if (DESCRIPTORS) dP(C.prototype, 'size', {
  26426. get: function () {
  26427. return validate(this, NAME)[SIZE];
  26428. }
  26429. });
  26430. return C;
  26431. },
  26432. def: function (that, key, value) {
  26433. var entry = getEntry(that, key);
  26434. var prev, index;
  26435. // change existing entry
  26436. if (entry) {
  26437. entry.v = value;
  26438. // create new entry
  26439. } else {
  26440. that._l = entry = {
  26441. i: index = fastKey(key, true), // <- index
  26442. k: key, // <- key
  26443. v: value, // <- value
  26444. p: prev = that._l, // <- previous entry
  26445. n: undefined, // <- next entry
  26446. r: false // <- removed
  26447. };
  26448. if (!that._f) that._f = entry;
  26449. if (prev) prev.n = entry;
  26450. that[SIZE]++;
  26451. // add to index
  26452. if (index !== 'F') that._i[index] = entry;
  26453. } return that;
  26454. },
  26455. getEntry: getEntry,
  26456. setStrong: function (C, NAME, IS_MAP) {
  26457. // add .keys, .values, .entries, [@@iterator]
  26458. // 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
  26459. $iterDefine(C, NAME, function (iterated, kind) {
  26460. this._t = validate(iterated, NAME); // target
  26461. this._k = kind; // kind
  26462. this._l = undefined; // previous
  26463. }, function () {
  26464. var that = this;
  26465. var kind = that._k;
  26466. var entry = that._l;
  26467. // revert to the last existing entry
  26468. while (entry && entry.r) entry = entry.p;
  26469. // get next entry
  26470. if (!that._t || !(that._l = entry = entry ? entry.n : that._t._f)) {
  26471. // or finish the iteration
  26472. that._t = undefined;
  26473. return step(1);
  26474. }
  26475. // return step by kind
  26476. if (kind == 'keys') return step(0, entry.k);
  26477. if (kind == 'values') return step(0, entry.v);
  26478. return step(0, [entry.k, entry.v]);
  26479. }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
  26480. // add [@@species], 23.1.2.2, 23.2.2.2
  26481. setSpecies(NAME);
  26482. }
  26483. };
  26484. },{"./_an-instance":180,"./_ctx":194,"./_descriptors":196,"./_for-of":202,"./_iter-define":214,"./_iter-step":215,"./_meta":218,"./_object-create":220,"./_object-dp":221,"./_redefine-all":233,"./_set-species":238,"./_validate-collection":250}],190:[function(require,module,exports){
  26485. // https://github.com/DavidBruant/Map-Set.prototype.toJSON
  26486. var classof = require('./_classof');
  26487. var from = require('./_array-from-iterable');
  26488. module.exports = function (NAME) {
  26489. return function toJSON() {
  26490. if (classof(this) != NAME) throw TypeError(NAME + "#toJSON isn't generic");
  26491. return from(this);
  26492. };
  26493. };
  26494. },{"./_array-from-iterable":182,"./_classof":187}],191:[function(require,module,exports){
  26495. 'use strict';
  26496. var redefineAll = require('./_redefine-all');
  26497. var getWeak = require('./_meta').getWeak;
  26498. var anObject = require('./_an-object');
  26499. var isObject = require('./_is-object');
  26500. var anInstance = require('./_an-instance');
  26501. var forOf = require('./_for-of');
  26502. var createArrayMethod = require('./_array-methods');
  26503. var $has = require('./_has');
  26504. var validate = require('./_validate-collection');
  26505. var arrayFind = createArrayMethod(5);
  26506. var arrayFindIndex = createArrayMethod(6);
  26507. var id = 0;
  26508. // fallback for uncaught frozen keys
  26509. var uncaughtFrozenStore = function (that) {
  26510. return that._l || (that._l = new UncaughtFrozenStore());
  26511. };
  26512. var UncaughtFrozenStore = function () {
  26513. this.a = [];
  26514. };
  26515. var findUncaughtFrozen = function (store, key) {
  26516. return arrayFind(store.a, function (it) {
  26517. return it[0] === key;
  26518. });
  26519. };
  26520. UncaughtFrozenStore.prototype = {
  26521. get: function (key) {
  26522. var entry = findUncaughtFrozen(this, key);
  26523. if (entry) return entry[1];
  26524. },
  26525. has: function (key) {
  26526. return !!findUncaughtFrozen(this, key);
  26527. },
  26528. set: function (key, value) {
  26529. var entry = findUncaughtFrozen(this, key);
  26530. if (entry) entry[1] = value;
  26531. else this.a.push([key, value]);
  26532. },
  26533. 'delete': function (key) {
  26534. var index = arrayFindIndex(this.a, function (it) {
  26535. return it[0] === key;
  26536. });
  26537. if (~index) this.a.splice(index, 1);
  26538. return !!~index;
  26539. }
  26540. };
  26541. module.exports = {
  26542. getConstructor: function (wrapper, NAME, IS_MAP, ADDER) {
  26543. var C = wrapper(function (that, iterable) {
  26544. anInstance(that, C, NAME, '_i');
  26545. that._t = NAME; // collection type
  26546. that._i = id++; // collection id
  26547. that._l = undefined; // leak store for uncaught frozen objects
  26548. if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);
  26549. });
  26550. redefineAll(C.prototype, {
  26551. // 23.3.3.2 WeakMap.prototype.delete(key)
  26552. // 23.4.3.3 WeakSet.prototype.delete(value)
  26553. 'delete': function (key) {
  26554. if (!isObject(key)) return false;
  26555. var data = getWeak(key);
  26556. if (data === true) return uncaughtFrozenStore(validate(this, NAME))['delete'](key);
  26557. return data && $has(data, this._i) && delete data[this._i];
  26558. },
  26559. // 23.3.3.4 WeakMap.prototype.has(key)
  26560. // 23.4.3.4 WeakSet.prototype.has(value)
  26561. has: function has(key) {
  26562. if (!isObject(key)) return false;
  26563. var data = getWeak(key);
  26564. if (data === true) return uncaughtFrozenStore(validate(this, NAME)).has(key);
  26565. return data && $has(data, this._i);
  26566. }
  26567. });
  26568. return C;
  26569. },
  26570. def: function (that, key, value) {
  26571. var data = getWeak(anObject(key), true);
  26572. if (data === true) uncaughtFrozenStore(that).set(key, value);
  26573. else data[that._i] = value;
  26574. return that;
  26575. },
  26576. ufstore: uncaughtFrozenStore
  26577. };
  26578. },{"./_an-instance":180,"./_an-object":181,"./_array-methods":184,"./_for-of":202,"./_has":204,"./_is-object":211,"./_meta":218,"./_redefine-all":233,"./_validate-collection":250}],192:[function(require,module,exports){
  26579. 'use strict';
  26580. var global = require('./_global');
  26581. var $export = require('./_export');
  26582. var meta = require('./_meta');
  26583. var fails = require('./_fails');
  26584. var hide = require('./_hide');
  26585. var redefineAll = require('./_redefine-all');
  26586. var forOf = require('./_for-of');
  26587. var anInstance = require('./_an-instance');
  26588. var isObject = require('./_is-object');
  26589. var setToStringTag = require('./_set-to-string-tag');
  26590. var dP = require('./_object-dp').f;
  26591. var each = require('./_array-methods')(0);
  26592. var DESCRIPTORS = require('./_descriptors');
  26593. module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) {
  26594. var Base = global[NAME];
  26595. var C = Base;
  26596. var ADDER = IS_MAP ? 'set' : 'add';
  26597. var proto = C && C.prototype;
  26598. var O = {};
  26599. if (!DESCRIPTORS || typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function () {
  26600. new C().entries().next();
  26601. }))) {
  26602. // create collection constructor
  26603. C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
  26604. redefineAll(C.prototype, methods);
  26605. meta.NEED = true;
  26606. } else {
  26607. C = wrapper(function (target, iterable) {
  26608. anInstance(target, C, NAME, '_c');
  26609. target._c = new Base();
  26610. if (iterable != undefined) forOf(iterable, IS_MAP, target[ADDER], target);
  26611. });
  26612. each('add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON'.split(','), function (KEY) {
  26613. var IS_ADDER = KEY == 'add' || KEY == 'set';
  26614. if (KEY in proto && !(IS_WEAK && KEY == 'clear')) hide(C.prototype, KEY, function (a, b) {
  26615. anInstance(this, C, KEY);
  26616. if (!IS_ADDER && IS_WEAK && !isObject(a)) return KEY == 'get' ? undefined : false;
  26617. var result = this._c[KEY](a === 0 ? 0 : a, b);
  26618. return IS_ADDER ? this : result;
  26619. });
  26620. });
  26621. IS_WEAK || dP(C.prototype, 'size', {
  26622. get: function () {
  26623. return this._c.size;
  26624. }
  26625. });
  26626. }
  26627. setToStringTag(C, NAME);
  26628. O[NAME] = C;
  26629. $export($export.G + $export.W + $export.F, O);
  26630. if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP);
  26631. return C;
  26632. };
  26633. },{"./_an-instance":180,"./_array-methods":184,"./_descriptors":196,"./_export":200,"./_fails":201,"./_for-of":202,"./_global":203,"./_hide":205,"./_is-object":211,"./_meta":218,"./_object-dp":221,"./_redefine-all":233,"./_set-to-string-tag":239}],193:[function(require,module,exports){
  26634. var core = module.exports = { version: '2.5.3' };
  26635. if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
  26636. },{}],194:[function(require,module,exports){
  26637. // optional / simple context binding
  26638. var aFunction = require('./_a-function');
  26639. module.exports = function (fn, that, length) {
  26640. aFunction(fn);
  26641. if (that === undefined) return fn;
  26642. switch (length) {
  26643. case 1: return function (a) {
  26644. return fn.call(that, a);
  26645. };
  26646. case 2: return function (a, b) {
  26647. return fn.call(that, a, b);
  26648. };
  26649. case 3: return function (a, b, c) {
  26650. return fn.call(that, a, b, c);
  26651. };
  26652. }
  26653. return function (/* ...args */) {
  26654. return fn.apply(that, arguments);
  26655. };
  26656. };
  26657. },{"./_a-function":178}],195:[function(require,module,exports){
  26658. // 7.2.1 RequireObjectCoercible(argument)
  26659. module.exports = function (it) {
  26660. if (it == undefined) throw TypeError("Can't call method on " + it);
  26661. return it;
  26662. };
  26663. },{}],196:[function(require,module,exports){
  26664. // Thank's IE8 for his funny defineProperty
  26665. module.exports = !require('./_fails')(function () {
  26666. return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
  26667. });
  26668. },{"./_fails":201}],197:[function(require,module,exports){
  26669. var isObject = require('./_is-object');
  26670. var document = require('./_global').document;
  26671. // typeof document.createElement is 'object' in old IE
  26672. var is = isObject(document) && isObject(document.createElement);
  26673. module.exports = function (it) {
  26674. return is ? document.createElement(it) : {};
  26675. };
  26676. },{"./_global":203,"./_is-object":211}],198:[function(require,module,exports){
  26677. // IE 8- don't enum bug keys
  26678. module.exports = (
  26679. 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
  26680. ).split(',');
  26681. },{}],199:[function(require,module,exports){
  26682. // all enumerable object keys, includes symbols
  26683. var getKeys = require('./_object-keys');
  26684. var gOPS = require('./_object-gops');
  26685. var pIE = require('./_object-pie');
  26686. module.exports = function (it) {
  26687. var result = getKeys(it);
  26688. var getSymbols = gOPS.f;
  26689. if (getSymbols) {
  26690. var symbols = getSymbols(it);
  26691. var isEnum = pIE.f;
  26692. var i = 0;
  26693. var key;
  26694. while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key);
  26695. } return result;
  26696. };
  26697. },{"./_object-gops":226,"./_object-keys":229,"./_object-pie":230}],200:[function(require,module,exports){
  26698. var global = require('./_global');
  26699. var core = require('./_core');
  26700. var ctx = require('./_ctx');
  26701. var hide = require('./_hide');
  26702. var PROTOTYPE = 'prototype';
  26703. var $export = function (type, name, source) {
  26704. var IS_FORCED = type & $export.F;
  26705. var IS_GLOBAL = type & $export.G;
  26706. var IS_STATIC = type & $export.S;
  26707. var IS_PROTO = type & $export.P;
  26708. var IS_BIND = type & $export.B;
  26709. var IS_WRAP = type & $export.W;
  26710. var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
  26711. var expProto = exports[PROTOTYPE];
  26712. var target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE];
  26713. var key, own, out;
  26714. if (IS_GLOBAL) source = name;
  26715. for (key in source) {
  26716. // contains in native
  26717. own = !IS_FORCED && target && target[key] !== undefined;
  26718. if (own && key in exports) continue;
  26719. // export native or passed
  26720. out = own ? target[key] : source[key];
  26721. // prevent global pollution for namespaces
  26722. exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
  26723. // bind timers to global for call from export context
  26724. : IS_BIND && own ? ctx(out, global)
  26725. // wrap global constructors for prevent change them in library
  26726. : IS_WRAP && target[key] == out ? (function (C) {
  26727. var F = function (a, b, c) {
  26728. if (this instanceof C) {
  26729. switch (arguments.length) {
  26730. case 0: return new C();
  26731. case 1: return new C(a);
  26732. case 2: return new C(a, b);
  26733. } return new C(a, b, c);
  26734. } return C.apply(this, arguments);
  26735. };
  26736. F[PROTOTYPE] = C[PROTOTYPE];
  26737. return F;
  26738. // make static versions for prototype methods
  26739. })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
  26740. // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
  26741. if (IS_PROTO) {
  26742. (exports.virtual || (exports.virtual = {}))[key] = out;
  26743. // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
  26744. if (type & $export.R && expProto && !expProto[key]) hide(expProto, key, out);
  26745. }
  26746. }
  26747. };
  26748. // type bitmap
  26749. $export.F = 1; // forced
  26750. $export.G = 2; // global
  26751. $export.S = 4; // static
  26752. $export.P = 8; // proto
  26753. $export.B = 16; // bind
  26754. $export.W = 32; // wrap
  26755. $export.U = 64; // safe
  26756. $export.R = 128; // real proto method for `library`
  26757. module.exports = $export;
  26758. },{"./_core":193,"./_ctx":194,"./_global":203,"./_hide":205}],201:[function(require,module,exports){
  26759. module.exports = function (exec) {
  26760. try {
  26761. return !!exec();
  26762. } catch (e) {
  26763. return true;
  26764. }
  26765. };
  26766. },{}],202:[function(require,module,exports){
  26767. var ctx = require('./_ctx');
  26768. var call = require('./_iter-call');
  26769. var isArrayIter = require('./_is-array-iter');
  26770. var anObject = require('./_an-object');
  26771. var toLength = require('./_to-length');
  26772. var getIterFn = require('./core.get-iterator-method');
  26773. var BREAK = {};
  26774. var RETURN = {};
  26775. var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {
  26776. var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable);
  26777. var f = ctx(fn, that, entries ? 2 : 1);
  26778. var index = 0;
  26779. var length, step, iterator, result;
  26780. if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');
  26781. // fast case for arrays with default iterator
  26782. if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) {
  26783. result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
  26784. if (result === BREAK || result === RETURN) return result;
  26785. } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {
  26786. result = call(iterator, f, step.value, entries);
  26787. if (result === BREAK || result === RETURN) return result;
  26788. }
  26789. };
  26790. exports.BREAK = BREAK;
  26791. exports.RETURN = RETURN;
  26792. },{"./_an-object":181,"./_ctx":194,"./_is-array-iter":209,"./_iter-call":212,"./_to-length":246,"./core.get-iterator-method":254}],203:[function(require,module,exports){
  26793. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  26794. var global = module.exports = typeof window != 'undefined' && window.Math == Math
  26795. ? window : typeof self != 'undefined' && self.Math == Math ? self
  26796. // eslint-disable-next-line no-new-func
  26797. : Function('return this')();
  26798. if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
  26799. },{}],204:[function(require,module,exports){
  26800. var hasOwnProperty = {}.hasOwnProperty;
  26801. module.exports = function (it, key) {
  26802. return hasOwnProperty.call(it, key);
  26803. };
  26804. },{}],205:[function(require,module,exports){
  26805. var dP = require('./_object-dp');
  26806. var createDesc = require('./_property-desc');
  26807. module.exports = require('./_descriptors') ? function (object, key, value) {
  26808. return dP.f(object, key, createDesc(1, value));
  26809. } : function (object, key, value) {
  26810. object[key] = value;
  26811. return object;
  26812. };
  26813. },{"./_descriptors":196,"./_object-dp":221,"./_property-desc":232}],206:[function(require,module,exports){
  26814. var document = require('./_global').document;
  26815. module.exports = document && document.documentElement;
  26816. },{"./_global":203}],207:[function(require,module,exports){
  26817. module.exports = !require('./_descriptors') && !require('./_fails')(function () {
  26818. return Object.defineProperty(require('./_dom-create')('div'), 'a', { get: function () { return 7; } }).a != 7;
  26819. });
  26820. },{"./_descriptors":196,"./_dom-create":197,"./_fails":201}],208:[function(require,module,exports){
  26821. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  26822. var cof = require('./_cof');
  26823. // eslint-disable-next-line no-prototype-builtins
  26824. module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
  26825. return cof(it) == 'String' ? it.split('') : Object(it);
  26826. };
  26827. },{"./_cof":188}],209:[function(require,module,exports){
  26828. // check on default Array iterator
  26829. var Iterators = require('./_iterators');
  26830. var ITERATOR = require('./_wks')('iterator');
  26831. var ArrayProto = Array.prototype;
  26832. module.exports = function (it) {
  26833. return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
  26834. };
  26835. },{"./_iterators":216,"./_wks":253}],210:[function(require,module,exports){
  26836. // 7.2.2 IsArray(argument)
  26837. var cof = require('./_cof');
  26838. module.exports = Array.isArray || function isArray(arg) {
  26839. return cof(arg) == 'Array';
  26840. };
  26841. },{"./_cof":188}],211:[function(require,module,exports){
  26842. module.exports = function (it) {
  26843. return typeof it === 'object' ? it !== null : typeof it === 'function';
  26844. };
  26845. },{}],212:[function(require,module,exports){
  26846. // call something on iterator step with safe closing on error
  26847. var anObject = require('./_an-object');
  26848. module.exports = function (iterator, fn, value, entries) {
  26849. try {
  26850. return entries ? fn(anObject(value)[0], value[1]) : fn(value);
  26851. // 7.4.6 IteratorClose(iterator, completion)
  26852. } catch (e) {
  26853. var ret = iterator['return'];
  26854. if (ret !== undefined) anObject(ret.call(iterator));
  26855. throw e;
  26856. }
  26857. };
  26858. },{"./_an-object":181}],213:[function(require,module,exports){
  26859. 'use strict';
  26860. var create = require('./_object-create');
  26861. var descriptor = require('./_property-desc');
  26862. var setToStringTag = require('./_set-to-string-tag');
  26863. var IteratorPrototype = {};
  26864. // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
  26865. require('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function () { return this; });
  26866. module.exports = function (Constructor, NAME, next) {
  26867. Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });
  26868. setToStringTag(Constructor, NAME + ' Iterator');
  26869. };
  26870. },{"./_hide":205,"./_object-create":220,"./_property-desc":232,"./_set-to-string-tag":239,"./_wks":253}],214:[function(require,module,exports){
  26871. 'use strict';
  26872. var LIBRARY = require('./_library');
  26873. var $export = require('./_export');
  26874. var redefine = require('./_redefine');
  26875. var hide = require('./_hide');
  26876. var has = require('./_has');
  26877. var Iterators = require('./_iterators');
  26878. var $iterCreate = require('./_iter-create');
  26879. var setToStringTag = require('./_set-to-string-tag');
  26880. var getPrototypeOf = require('./_object-gpo');
  26881. var ITERATOR = require('./_wks')('iterator');
  26882. var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
  26883. var FF_ITERATOR = '@@iterator';
  26884. var KEYS = 'keys';
  26885. var VALUES = 'values';
  26886. var returnThis = function () { return this; };
  26887. module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
  26888. $iterCreate(Constructor, NAME, next);
  26889. var getMethod = function (kind) {
  26890. if (!BUGGY && kind in proto) return proto[kind];
  26891. switch (kind) {
  26892. case KEYS: return function keys() { return new Constructor(this, kind); };
  26893. case VALUES: return function values() { return new Constructor(this, kind); };
  26894. } return function entries() { return new Constructor(this, kind); };
  26895. };
  26896. var TAG = NAME + ' Iterator';
  26897. var DEF_VALUES = DEFAULT == VALUES;
  26898. var VALUES_BUG = false;
  26899. var proto = Base.prototype;
  26900. var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
  26901. var $default = (!BUGGY && $native) || getMethod(DEFAULT);
  26902. var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
  26903. var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
  26904. var methods, key, IteratorPrototype;
  26905. // Fix native
  26906. if ($anyNative) {
  26907. IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));
  26908. if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
  26909. // Set @@toStringTag to native iterators
  26910. setToStringTag(IteratorPrototype, TAG, true);
  26911. // fix for some old engines
  26912. if (!LIBRARY && !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis);
  26913. }
  26914. }
  26915. // fix Array#{values, @@iterator}.name in V8 / FF
  26916. if (DEF_VALUES && $native && $native.name !== VALUES) {
  26917. VALUES_BUG = true;
  26918. $default = function values() { return $native.call(this); };
  26919. }
  26920. // Define iterator
  26921. if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
  26922. hide(proto, ITERATOR, $default);
  26923. }
  26924. // Plug for library
  26925. Iterators[NAME] = $default;
  26926. Iterators[TAG] = returnThis;
  26927. if (DEFAULT) {
  26928. methods = {
  26929. values: DEF_VALUES ? $default : getMethod(VALUES),
  26930. keys: IS_SET ? $default : getMethod(KEYS),
  26931. entries: $entries
  26932. };
  26933. if (FORCED) for (key in methods) {
  26934. if (!(key in proto)) redefine(proto, key, methods[key]);
  26935. } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
  26936. }
  26937. return methods;
  26938. };
  26939. },{"./_export":200,"./_has":204,"./_hide":205,"./_iter-create":213,"./_iterators":216,"./_library":217,"./_object-gpo":227,"./_redefine":234,"./_set-to-string-tag":239,"./_wks":253}],215:[function(require,module,exports){
  26940. module.exports = function (done, value) {
  26941. return { value: value, done: !!done };
  26942. };
  26943. },{}],216:[function(require,module,exports){
  26944. module.exports = {};
  26945. },{}],217:[function(require,module,exports){
  26946. module.exports = true;
  26947. },{}],218:[function(require,module,exports){
  26948. var META = require('./_uid')('meta');
  26949. var isObject = require('./_is-object');
  26950. var has = require('./_has');
  26951. var setDesc = require('./_object-dp').f;
  26952. var id = 0;
  26953. var isExtensible = Object.isExtensible || function () {
  26954. return true;
  26955. };
  26956. var FREEZE = !require('./_fails')(function () {
  26957. return isExtensible(Object.preventExtensions({}));
  26958. });
  26959. var setMeta = function (it) {
  26960. setDesc(it, META, { value: {
  26961. i: 'O' + ++id, // object ID
  26962. w: {} // weak collections IDs
  26963. } });
  26964. };
  26965. var fastKey = function (it, create) {
  26966. // return primitive with prefix
  26967. if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
  26968. if (!has(it, META)) {
  26969. // can't set metadata to uncaught frozen object
  26970. if (!isExtensible(it)) return 'F';
  26971. // not necessary to add metadata
  26972. if (!create) return 'E';
  26973. // add missing metadata
  26974. setMeta(it);
  26975. // return object ID
  26976. } return it[META].i;
  26977. };
  26978. var getWeak = function (it, create) {
  26979. if (!has(it, META)) {
  26980. // can't set metadata to uncaught frozen object
  26981. if (!isExtensible(it)) return true;
  26982. // not necessary to add metadata
  26983. if (!create) return false;
  26984. // add missing metadata
  26985. setMeta(it);
  26986. // return hash weak collections IDs
  26987. } return it[META].w;
  26988. };
  26989. // add metadata on freeze-family methods calling
  26990. var onFreeze = function (it) {
  26991. if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);
  26992. return it;
  26993. };
  26994. var meta = module.exports = {
  26995. KEY: META,
  26996. NEED: false,
  26997. fastKey: fastKey,
  26998. getWeak: getWeak,
  26999. onFreeze: onFreeze
  27000. };
  27001. },{"./_fails":201,"./_has":204,"./_is-object":211,"./_object-dp":221,"./_uid":249}],219:[function(require,module,exports){
  27002. 'use strict';
  27003. // 19.1.2.1 Object.assign(target, source, ...)
  27004. var getKeys = require('./_object-keys');
  27005. var gOPS = require('./_object-gops');
  27006. var pIE = require('./_object-pie');
  27007. var toObject = require('./_to-object');
  27008. var IObject = require('./_iobject');
  27009. var $assign = Object.assign;
  27010. // should work with symbols and should have deterministic property order (V8 bug)
  27011. module.exports = !$assign || require('./_fails')(function () {
  27012. var A = {};
  27013. var B = {};
  27014. // eslint-disable-next-line no-undef
  27015. var S = Symbol();
  27016. var K = 'abcdefghijklmnopqrst';
  27017. A[S] = 7;
  27018. K.split('').forEach(function (k) { B[k] = k; });
  27019. return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
  27020. }) ? function assign(target, source) { // eslint-disable-line no-unused-vars
  27021. var T = toObject(target);
  27022. var aLen = arguments.length;
  27023. var index = 1;
  27024. var getSymbols = gOPS.f;
  27025. var isEnum = pIE.f;
  27026. while (aLen > index) {
  27027. var S = IObject(arguments[index++]);
  27028. var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);
  27029. var length = keys.length;
  27030. var j = 0;
  27031. var key;
  27032. while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key];
  27033. } return T;
  27034. } : $assign;
  27035. },{"./_fails":201,"./_iobject":208,"./_object-gops":226,"./_object-keys":229,"./_object-pie":230,"./_to-object":247}],220:[function(require,module,exports){
  27036. // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
  27037. var anObject = require('./_an-object');
  27038. var dPs = require('./_object-dps');
  27039. var enumBugKeys = require('./_enum-bug-keys');
  27040. var IE_PROTO = require('./_shared-key')('IE_PROTO');
  27041. var Empty = function () { /* empty */ };
  27042. var PROTOTYPE = 'prototype';
  27043. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  27044. var createDict = function () {
  27045. // Thrash, waste and sodomy: IE GC bug
  27046. var iframe = require('./_dom-create')('iframe');
  27047. var i = enumBugKeys.length;
  27048. var lt = '<';
  27049. var gt = '>';
  27050. var iframeDocument;
  27051. iframe.style.display = 'none';
  27052. require('./_html').appendChild(iframe);
  27053. iframe.src = 'javascript:'; // eslint-disable-line no-script-url
  27054. // createDict = iframe.contentWindow.Object;
  27055. // html.removeChild(iframe);
  27056. iframeDocument = iframe.contentWindow.document;
  27057. iframeDocument.open();
  27058. iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
  27059. iframeDocument.close();
  27060. createDict = iframeDocument.F;
  27061. while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];
  27062. return createDict();
  27063. };
  27064. module.exports = Object.create || function create(O, Properties) {
  27065. var result;
  27066. if (O !== null) {
  27067. Empty[PROTOTYPE] = anObject(O);
  27068. result = new Empty();
  27069. Empty[PROTOTYPE] = null;
  27070. // add "__proto__" for Object.getPrototypeOf polyfill
  27071. result[IE_PROTO] = O;
  27072. } else result = createDict();
  27073. return Properties === undefined ? result : dPs(result, Properties);
  27074. };
  27075. },{"./_an-object":181,"./_dom-create":197,"./_enum-bug-keys":198,"./_html":206,"./_object-dps":222,"./_shared-key":240}],221:[function(require,module,exports){
  27076. var anObject = require('./_an-object');
  27077. var IE8_DOM_DEFINE = require('./_ie8-dom-define');
  27078. var toPrimitive = require('./_to-primitive');
  27079. var dP = Object.defineProperty;
  27080. exports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes) {
  27081. anObject(O);
  27082. P = toPrimitive(P, true);
  27083. anObject(Attributes);
  27084. if (IE8_DOM_DEFINE) try {
  27085. return dP(O, P, Attributes);
  27086. } catch (e) { /* empty */ }
  27087. if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
  27088. if ('value' in Attributes) O[P] = Attributes.value;
  27089. return O;
  27090. };
  27091. },{"./_an-object":181,"./_descriptors":196,"./_ie8-dom-define":207,"./_to-primitive":248}],222:[function(require,module,exports){
  27092. var dP = require('./_object-dp');
  27093. var anObject = require('./_an-object');
  27094. var getKeys = require('./_object-keys');
  27095. module.exports = require('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties) {
  27096. anObject(O);
  27097. var keys = getKeys(Properties);
  27098. var length = keys.length;
  27099. var i = 0;
  27100. var P;
  27101. while (length > i) dP.f(O, P = keys[i++], Properties[P]);
  27102. return O;
  27103. };
  27104. },{"./_an-object":181,"./_descriptors":196,"./_object-dp":221,"./_object-keys":229}],223:[function(require,module,exports){
  27105. var pIE = require('./_object-pie');
  27106. var createDesc = require('./_property-desc');
  27107. var toIObject = require('./_to-iobject');
  27108. var toPrimitive = require('./_to-primitive');
  27109. var has = require('./_has');
  27110. var IE8_DOM_DEFINE = require('./_ie8-dom-define');
  27111. var gOPD = Object.getOwnPropertyDescriptor;
  27112. exports.f = require('./_descriptors') ? gOPD : function getOwnPropertyDescriptor(O, P) {
  27113. O = toIObject(O);
  27114. P = toPrimitive(P, true);
  27115. if (IE8_DOM_DEFINE) try {
  27116. return gOPD(O, P);
  27117. } catch (e) { /* empty */ }
  27118. if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);
  27119. };
  27120. },{"./_descriptors":196,"./_has":204,"./_ie8-dom-define":207,"./_object-pie":230,"./_property-desc":232,"./_to-iobject":245,"./_to-primitive":248}],224:[function(require,module,exports){
  27121. // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
  27122. var toIObject = require('./_to-iobject');
  27123. var gOPN = require('./_object-gopn').f;
  27124. var toString = {}.toString;
  27125. var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
  27126. ? Object.getOwnPropertyNames(window) : [];
  27127. var getWindowNames = function (it) {
  27128. try {
  27129. return gOPN(it);
  27130. } catch (e) {
  27131. return windowNames.slice();
  27132. }
  27133. };
  27134. module.exports.f = function getOwnPropertyNames(it) {
  27135. return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
  27136. };
  27137. },{"./_object-gopn":225,"./_to-iobject":245}],225:[function(require,module,exports){
  27138. // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
  27139. var $keys = require('./_object-keys-internal');
  27140. var hiddenKeys = require('./_enum-bug-keys').concat('length', 'prototype');
  27141. exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  27142. return $keys(O, hiddenKeys);
  27143. };
  27144. },{"./_enum-bug-keys":198,"./_object-keys-internal":228}],226:[function(require,module,exports){
  27145. exports.f = Object.getOwnPropertySymbols;
  27146. },{}],227:[function(require,module,exports){
  27147. // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
  27148. var has = require('./_has');
  27149. var toObject = require('./_to-object');
  27150. var IE_PROTO = require('./_shared-key')('IE_PROTO');
  27151. var ObjectProto = Object.prototype;
  27152. module.exports = Object.getPrototypeOf || function (O) {
  27153. O = toObject(O);
  27154. if (has(O, IE_PROTO)) return O[IE_PROTO];
  27155. if (typeof O.constructor == 'function' && O instanceof O.constructor) {
  27156. return O.constructor.prototype;
  27157. } return O instanceof Object ? ObjectProto : null;
  27158. };
  27159. },{"./_has":204,"./_shared-key":240,"./_to-object":247}],228:[function(require,module,exports){
  27160. var has = require('./_has');
  27161. var toIObject = require('./_to-iobject');
  27162. var arrayIndexOf = require('./_array-includes')(false);
  27163. var IE_PROTO = require('./_shared-key')('IE_PROTO');
  27164. module.exports = function (object, names) {
  27165. var O = toIObject(object);
  27166. var i = 0;
  27167. var result = [];
  27168. var key;
  27169. for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);
  27170. // Don't enum bug & hidden keys
  27171. while (names.length > i) if (has(O, key = names[i++])) {
  27172. ~arrayIndexOf(result, key) || result.push(key);
  27173. }
  27174. return result;
  27175. };
  27176. },{"./_array-includes":183,"./_has":204,"./_shared-key":240,"./_to-iobject":245}],229:[function(require,module,exports){
  27177. // 19.1.2.14 / 15.2.3.14 Object.keys(O)
  27178. var $keys = require('./_object-keys-internal');
  27179. var enumBugKeys = require('./_enum-bug-keys');
  27180. module.exports = Object.keys || function keys(O) {
  27181. return $keys(O, enumBugKeys);
  27182. };
  27183. },{"./_enum-bug-keys":198,"./_object-keys-internal":228}],230:[function(require,module,exports){
  27184. exports.f = {}.propertyIsEnumerable;
  27185. },{}],231:[function(require,module,exports){
  27186. // most Object methods by ES6 should accept primitives
  27187. var $export = require('./_export');
  27188. var core = require('./_core');
  27189. var fails = require('./_fails');
  27190. module.exports = function (KEY, exec) {
  27191. var fn = (core.Object || {})[KEY] || Object[KEY];
  27192. var exp = {};
  27193. exp[KEY] = exec(fn);
  27194. $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp);
  27195. };
  27196. },{"./_core":193,"./_export":200,"./_fails":201}],232:[function(require,module,exports){
  27197. module.exports = function (bitmap, value) {
  27198. return {
  27199. enumerable: !(bitmap & 1),
  27200. configurable: !(bitmap & 2),
  27201. writable: !(bitmap & 4),
  27202. value: value
  27203. };
  27204. };
  27205. },{}],233:[function(require,module,exports){
  27206. var hide = require('./_hide');
  27207. module.exports = function (target, src, safe) {
  27208. for (var key in src) {
  27209. if (safe && target[key]) target[key] = src[key];
  27210. else hide(target, key, src[key]);
  27211. } return target;
  27212. };
  27213. },{"./_hide":205}],234:[function(require,module,exports){
  27214. module.exports = require('./_hide');
  27215. },{"./_hide":205}],235:[function(require,module,exports){
  27216. 'use strict';
  27217. // https://tc39.github.io/proposal-setmap-offrom/
  27218. var $export = require('./_export');
  27219. var aFunction = require('./_a-function');
  27220. var ctx = require('./_ctx');
  27221. var forOf = require('./_for-of');
  27222. module.exports = function (COLLECTION) {
  27223. $export($export.S, COLLECTION, { from: function from(source /* , mapFn, thisArg */) {
  27224. var mapFn = arguments[1];
  27225. var mapping, A, n, cb;
  27226. aFunction(this);
  27227. mapping = mapFn !== undefined;
  27228. if (mapping) aFunction(mapFn);
  27229. if (source == undefined) return new this();
  27230. A = [];
  27231. if (mapping) {
  27232. n = 0;
  27233. cb = ctx(mapFn, arguments[2], 2);
  27234. forOf(source, false, function (nextItem) {
  27235. A.push(cb(nextItem, n++));
  27236. });
  27237. } else {
  27238. forOf(source, false, A.push, A);
  27239. }
  27240. return new this(A);
  27241. } });
  27242. };
  27243. },{"./_a-function":178,"./_ctx":194,"./_export":200,"./_for-of":202}],236:[function(require,module,exports){
  27244. 'use strict';
  27245. // https://tc39.github.io/proposal-setmap-offrom/
  27246. var $export = require('./_export');
  27247. module.exports = function (COLLECTION) {
  27248. $export($export.S, COLLECTION, { of: function of() {
  27249. var length = arguments.length;
  27250. var A = new Array(length);
  27251. while (length--) A[length] = arguments[length];
  27252. return new this(A);
  27253. } });
  27254. };
  27255. },{"./_export":200}],237:[function(require,module,exports){
  27256. // Works with __proto__ only. Old v8 can't work with null proto objects.
  27257. /* eslint-disable no-proto */
  27258. var isObject = require('./_is-object');
  27259. var anObject = require('./_an-object');
  27260. var check = function (O, proto) {
  27261. anObject(O);
  27262. if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!");
  27263. };
  27264. module.exports = {
  27265. set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line
  27266. function (test, buggy, set) {
  27267. try {
  27268. set = require('./_ctx')(Function.call, require('./_object-gopd').f(Object.prototype, '__proto__').set, 2);
  27269. set(test, []);
  27270. buggy = !(test instanceof Array);
  27271. } catch (e) { buggy = true; }
  27272. return function setPrototypeOf(O, proto) {
  27273. check(O, proto);
  27274. if (buggy) O.__proto__ = proto;
  27275. else set(O, proto);
  27276. return O;
  27277. };
  27278. }({}, false) : undefined),
  27279. check: check
  27280. };
  27281. },{"./_an-object":181,"./_ctx":194,"./_is-object":211,"./_object-gopd":223}],238:[function(require,module,exports){
  27282. 'use strict';
  27283. var global = require('./_global');
  27284. var core = require('./_core');
  27285. var dP = require('./_object-dp');
  27286. var DESCRIPTORS = require('./_descriptors');
  27287. var SPECIES = require('./_wks')('species');
  27288. module.exports = function (KEY) {
  27289. var C = typeof core[KEY] == 'function' ? core[KEY] : global[KEY];
  27290. if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, {
  27291. configurable: true,
  27292. get: function () { return this; }
  27293. });
  27294. };
  27295. },{"./_core":193,"./_descriptors":196,"./_global":203,"./_object-dp":221,"./_wks":253}],239:[function(require,module,exports){
  27296. var def = require('./_object-dp').f;
  27297. var has = require('./_has');
  27298. var TAG = require('./_wks')('toStringTag');
  27299. module.exports = function (it, tag, stat) {
  27300. if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
  27301. };
  27302. },{"./_has":204,"./_object-dp":221,"./_wks":253}],240:[function(require,module,exports){
  27303. var shared = require('./_shared')('keys');
  27304. var uid = require('./_uid');
  27305. module.exports = function (key) {
  27306. return shared[key] || (shared[key] = uid(key));
  27307. };
  27308. },{"./_shared":241,"./_uid":249}],241:[function(require,module,exports){
  27309. var global = require('./_global');
  27310. var SHARED = '__core-js_shared__';
  27311. var store = global[SHARED] || (global[SHARED] = {});
  27312. module.exports = function (key) {
  27313. return store[key] || (store[key] = {});
  27314. };
  27315. },{"./_global":203}],242:[function(require,module,exports){
  27316. var toInteger = require('./_to-integer');
  27317. var defined = require('./_defined');
  27318. // true -> String#at
  27319. // false -> String#codePointAt
  27320. module.exports = function (TO_STRING) {
  27321. return function (that, pos) {
  27322. var s = String(defined(that));
  27323. var i = toInteger(pos);
  27324. var l = s.length;
  27325. var a, b;
  27326. if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
  27327. a = s.charCodeAt(i);
  27328. return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
  27329. ? TO_STRING ? s.charAt(i) : a
  27330. : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
  27331. };
  27332. };
  27333. },{"./_defined":195,"./_to-integer":244}],243:[function(require,module,exports){
  27334. var toInteger = require('./_to-integer');
  27335. var max = Math.max;
  27336. var min = Math.min;
  27337. module.exports = function (index, length) {
  27338. index = toInteger(index);
  27339. return index < 0 ? max(index + length, 0) : min(index, length);
  27340. };
  27341. },{"./_to-integer":244}],244:[function(require,module,exports){
  27342. // 7.1.4 ToInteger
  27343. var ceil = Math.ceil;
  27344. var floor = Math.floor;
  27345. module.exports = function (it) {
  27346. return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
  27347. };
  27348. },{}],245:[function(require,module,exports){
  27349. // to indexed object, toObject with fallback for non-array-like ES3 strings
  27350. var IObject = require('./_iobject');
  27351. var defined = require('./_defined');
  27352. module.exports = function (it) {
  27353. return IObject(defined(it));
  27354. };
  27355. },{"./_defined":195,"./_iobject":208}],246:[function(require,module,exports){
  27356. // 7.1.15 ToLength
  27357. var toInteger = require('./_to-integer');
  27358. var min = Math.min;
  27359. module.exports = function (it) {
  27360. return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
  27361. };
  27362. },{"./_to-integer":244}],247:[function(require,module,exports){
  27363. // 7.1.13 ToObject(argument)
  27364. var defined = require('./_defined');
  27365. module.exports = function (it) {
  27366. return Object(defined(it));
  27367. };
  27368. },{"./_defined":195}],248:[function(require,module,exports){
  27369. // 7.1.1 ToPrimitive(input [, PreferredType])
  27370. var isObject = require('./_is-object');
  27371. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  27372. // and the second argument - flag - preferred type is a string
  27373. module.exports = function (it, S) {
  27374. if (!isObject(it)) return it;
  27375. var fn, val;
  27376. if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
  27377. if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
  27378. if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
  27379. throw TypeError("Can't convert object to primitive value");
  27380. };
  27381. },{"./_is-object":211}],249:[function(require,module,exports){
  27382. var id = 0;
  27383. var px = Math.random();
  27384. module.exports = function (key) {
  27385. return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
  27386. };
  27387. },{}],250:[function(require,module,exports){
  27388. var isObject = require('./_is-object');
  27389. module.exports = function (it, TYPE) {
  27390. if (!isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!');
  27391. return it;
  27392. };
  27393. },{"./_is-object":211}],251:[function(require,module,exports){
  27394. var global = require('./_global');
  27395. var core = require('./_core');
  27396. var LIBRARY = require('./_library');
  27397. var wksExt = require('./_wks-ext');
  27398. var defineProperty = require('./_object-dp').f;
  27399. module.exports = function (name) {
  27400. var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
  27401. if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) });
  27402. };
  27403. },{"./_core":193,"./_global":203,"./_library":217,"./_object-dp":221,"./_wks-ext":252}],252:[function(require,module,exports){
  27404. exports.f = require('./_wks');
  27405. },{"./_wks":253}],253:[function(require,module,exports){
  27406. var store = require('./_shared')('wks');
  27407. var uid = require('./_uid');
  27408. var Symbol = require('./_global').Symbol;
  27409. var USE_SYMBOL = typeof Symbol == 'function';
  27410. var $exports = module.exports = function (name) {
  27411. return store[name] || (store[name] =
  27412. USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
  27413. };
  27414. $exports.store = store;
  27415. },{"./_global":203,"./_shared":241,"./_uid":249}],254:[function(require,module,exports){
  27416. var classof = require('./_classof');
  27417. var ITERATOR = require('./_wks')('iterator');
  27418. var Iterators = require('./_iterators');
  27419. module.exports = require('./_core').getIteratorMethod = function (it) {
  27420. if (it != undefined) return it[ITERATOR]
  27421. || it['@@iterator']
  27422. || Iterators[classof(it)];
  27423. };
  27424. },{"./_classof":187,"./_core":193,"./_iterators":216,"./_wks":253}],255:[function(require,module,exports){
  27425. var anObject = require('./_an-object');
  27426. var get = require('./core.get-iterator-method');
  27427. module.exports = require('./_core').getIterator = function (it) {
  27428. var iterFn = get(it);
  27429. if (typeof iterFn != 'function') throw TypeError(it + ' is not iterable!');
  27430. return anObject(iterFn.call(it));
  27431. };
  27432. },{"./_an-object":181,"./_core":193,"./core.get-iterator-method":254}],256:[function(require,module,exports){
  27433. 'use strict';
  27434. var addToUnscopables = require('./_add-to-unscopables');
  27435. var step = require('./_iter-step');
  27436. var Iterators = require('./_iterators');
  27437. var toIObject = require('./_to-iobject');
  27438. // 22.1.3.4 Array.prototype.entries()
  27439. // 22.1.3.13 Array.prototype.keys()
  27440. // 22.1.3.29 Array.prototype.values()
  27441. // 22.1.3.30 Array.prototype[@@iterator]()
  27442. module.exports = require('./_iter-define')(Array, 'Array', function (iterated, kind) {
  27443. this._t = toIObject(iterated); // target
  27444. this._i = 0; // next index
  27445. this._k = kind; // kind
  27446. // 22.1.5.2.1 %ArrayIteratorPrototype%.next()
  27447. }, function () {
  27448. var O = this._t;
  27449. var kind = this._k;
  27450. var index = this._i++;
  27451. if (!O || index >= O.length) {
  27452. this._t = undefined;
  27453. return step(1);
  27454. }
  27455. if (kind == 'keys') return step(0, index);
  27456. if (kind == 'values') return step(0, O[index]);
  27457. return step(0, [index, O[index]]);
  27458. }, 'values');
  27459. // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
  27460. Iterators.Arguments = Iterators.Array;
  27461. addToUnscopables('keys');
  27462. addToUnscopables('values');
  27463. addToUnscopables('entries');
  27464. },{"./_add-to-unscopables":179,"./_iter-define":214,"./_iter-step":215,"./_iterators":216,"./_to-iobject":245}],257:[function(require,module,exports){
  27465. 'use strict';
  27466. var strong = require('./_collection-strong');
  27467. var validate = require('./_validate-collection');
  27468. var MAP = 'Map';
  27469. // 23.1 Map Objects
  27470. module.exports = require('./_collection')(MAP, function (get) {
  27471. return function Map() { return get(this, arguments.length > 0 ? arguments[0] : undefined); };
  27472. }, {
  27473. // 23.1.3.6 Map.prototype.get(key)
  27474. get: function get(key) {
  27475. var entry = strong.getEntry(validate(this, MAP), key);
  27476. return entry && entry.v;
  27477. },
  27478. // 23.1.3.9 Map.prototype.set(key, value)
  27479. set: function set(key, value) {
  27480. return strong.def(validate(this, MAP), key === 0 ? 0 : key, value);
  27481. }
  27482. }, strong, true);
  27483. },{"./_collection":192,"./_collection-strong":189,"./_validate-collection":250}],258:[function(require,module,exports){
  27484. // 20.1.2.6 Number.MAX_SAFE_INTEGER
  27485. var $export = require('./_export');
  27486. $export($export.S, 'Number', { MAX_SAFE_INTEGER: 0x1fffffffffffff });
  27487. },{"./_export":200}],259:[function(require,module,exports){
  27488. // 19.1.3.1 Object.assign(target, source)
  27489. var $export = require('./_export');
  27490. $export($export.S + $export.F, 'Object', { assign: require('./_object-assign') });
  27491. },{"./_export":200,"./_object-assign":219}],260:[function(require,module,exports){
  27492. var $export = require('./_export');
  27493. // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
  27494. $export($export.S, 'Object', { create: require('./_object-create') });
  27495. },{"./_export":200,"./_object-create":220}],261:[function(require,module,exports){
  27496. // 19.1.2.14 Object.keys(O)
  27497. var toObject = require('./_to-object');
  27498. var $keys = require('./_object-keys');
  27499. require('./_object-sap')('keys', function () {
  27500. return function keys(it) {
  27501. return $keys(toObject(it));
  27502. };
  27503. });
  27504. },{"./_object-keys":229,"./_object-sap":231,"./_to-object":247}],262:[function(require,module,exports){
  27505. // 19.1.3.19 Object.setPrototypeOf(O, proto)
  27506. var $export = require('./_export');
  27507. $export($export.S, 'Object', { setPrototypeOf: require('./_set-proto').set });
  27508. },{"./_export":200,"./_set-proto":237}],263:[function(require,module,exports){
  27509. arguments[4][159][0].apply(exports,arguments)
  27510. },{"dup":159}],264:[function(require,module,exports){
  27511. 'use strict';
  27512. var $at = require('./_string-at')(true);
  27513. // 21.1.3.27 String.prototype[@@iterator]()
  27514. require('./_iter-define')(String, 'String', function (iterated) {
  27515. this._t = String(iterated); // target
  27516. this._i = 0; // next index
  27517. // 21.1.5.2.1 %StringIteratorPrototype%.next()
  27518. }, function () {
  27519. var O = this._t;
  27520. var index = this._i;
  27521. var point;
  27522. if (index >= O.length) return { value: undefined, done: true };
  27523. point = $at(O, index);
  27524. this._i += point.length;
  27525. return { value: point, done: false };
  27526. });
  27527. },{"./_iter-define":214,"./_string-at":242}],265:[function(require,module,exports){
  27528. 'use strict';
  27529. // ECMAScript 6 symbols shim
  27530. var global = require('./_global');
  27531. var has = require('./_has');
  27532. var DESCRIPTORS = require('./_descriptors');
  27533. var $export = require('./_export');
  27534. var redefine = require('./_redefine');
  27535. var META = require('./_meta').KEY;
  27536. var $fails = require('./_fails');
  27537. var shared = require('./_shared');
  27538. var setToStringTag = require('./_set-to-string-tag');
  27539. var uid = require('./_uid');
  27540. var wks = require('./_wks');
  27541. var wksExt = require('./_wks-ext');
  27542. var wksDefine = require('./_wks-define');
  27543. var enumKeys = require('./_enum-keys');
  27544. var isArray = require('./_is-array');
  27545. var anObject = require('./_an-object');
  27546. var isObject = require('./_is-object');
  27547. var toIObject = require('./_to-iobject');
  27548. var toPrimitive = require('./_to-primitive');
  27549. var createDesc = require('./_property-desc');
  27550. var _create = require('./_object-create');
  27551. var gOPNExt = require('./_object-gopn-ext');
  27552. var $GOPD = require('./_object-gopd');
  27553. var $DP = require('./_object-dp');
  27554. var $keys = require('./_object-keys');
  27555. var gOPD = $GOPD.f;
  27556. var dP = $DP.f;
  27557. var gOPN = gOPNExt.f;
  27558. var $Symbol = global.Symbol;
  27559. var $JSON = global.JSON;
  27560. var _stringify = $JSON && $JSON.stringify;
  27561. var PROTOTYPE = 'prototype';
  27562. var HIDDEN = wks('_hidden');
  27563. var TO_PRIMITIVE = wks('toPrimitive');
  27564. var isEnum = {}.propertyIsEnumerable;
  27565. var SymbolRegistry = shared('symbol-registry');
  27566. var AllSymbols = shared('symbols');
  27567. var OPSymbols = shared('op-symbols');
  27568. var ObjectProto = Object[PROTOTYPE];
  27569. var USE_NATIVE = typeof $Symbol == 'function';
  27570. var QObject = global.QObject;
  27571. // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
  27572. var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
  27573. // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
  27574. var setSymbolDesc = DESCRIPTORS && $fails(function () {
  27575. return _create(dP({}, 'a', {
  27576. get: function () { return dP(this, 'a', { value: 7 }).a; }
  27577. })).a != 7;
  27578. }) ? function (it, key, D) {
  27579. var protoDesc = gOPD(ObjectProto, key);
  27580. if (protoDesc) delete ObjectProto[key];
  27581. dP(it, key, D);
  27582. if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc);
  27583. } : dP;
  27584. var wrap = function (tag) {
  27585. var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
  27586. sym._k = tag;
  27587. return sym;
  27588. };
  27589. var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) {
  27590. return typeof it == 'symbol';
  27591. } : function (it) {
  27592. return it instanceof $Symbol;
  27593. };
  27594. var $defineProperty = function defineProperty(it, key, D) {
  27595. if (it === ObjectProto) $defineProperty(OPSymbols, key, D);
  27596. anObject(it);
  27597. key = toPrimitive(key, true);
  27598. anObject(D);
  27599. if (has(AllSymbols, key)) {
  27600. if (!D.enumerable) {
  27601. if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {}));
  27602. it[HIDDEN][key] = true;
  27603. } else {
  27604. if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;
  27605. D = _create(D, { enumerable: createDesc(0, false) });
  27606. } return setSymbolDesc(it, key, D);
  27607. } return dP(it, key, D);
  27608. };
  27609. var $defineProperties = function defineProperties(it, P) {
  27610. anObject(it);
  27611. var keys = enumKeys(P = toIObject(P));
  27612. var i = 0;
  27613. var l = keys.length;
  27614. var key;
  27615. while (l > i) $defineProperty(it, key = keys[i++], P[key]);
  27616. return it;
  27617. };
  27618. var $create = function create(it, P) {
  27619. return P === undefined ? _create(it) : $defineProperties(_create(it), P);
  27620. };
  27621. var $propertyIsEnumerable = function propertyIsEnumerable(key) {
  27622. var E = isEnum.call(this, key = toPrimitive(key, true));
  27623. if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false;
  27624. return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
  27625. };
  27626. var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {
  27627. it = toIObject(it);
  27628. key = toPrimitive(key, true);
  27629. if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return;
  27630. var D = gOPD(it, key);
  27631. if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;
  27632. return D;
  27633. };
  27634. var $getOwnPropertyNames = function getOwnPropertyNames(it) {
  27635. var names = gOPN(toIObject(it));
  27636. var result = [];
  27637. var i = 0;
  27638. var key;
  27639. while (names.length > i) {
  27640. if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);
  27641. } return result;
  27642. };
  27643. var $getOwnPropertySymbols = function getOwnPropertySymbols(it) {
  27644. var IS_OP = it === ObjectProto;
  27645. var names = gOPN(IS_OP ? OPSymbols : toIObject(it));
  27646. var result = [];
  27647. var i = 0;
  27648. var key;
  27649. while (names.length > i) {
  27650. if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]);
  27651. } return result;
  27652. };
  27653. // 19.4.1.1 Symbol([description])
  27654. if (!USE_NATIVE) {
  27655. $Symbol = function Symbol() {
  27656. if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!');
  27657. var tag = uid(arguments.length > 0 ? arguments[0] : undefined);
  27658. var $set = function (value) {
  27659. if (this === ObjectProto) $set.call(OPSymbols, value);
  27660. if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
  27661. setSymbolDesc(this, tag, createDesc(1, value));
  27662. };
  27663. if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set });
  27664. return wrap(tag);
  27665. };
  27666. redefine($Symbol[PROTOTYPE], 'toString', function toString() {
  27667. return this._k;
  27668. });
  27669. $GOPD.f = $getOwnPropertyDescriptor;
  27670. $DP.f = $defineProperty;
  27671. require('./_object-gopn').f = gOPNExt.f = $getOwnPropertyNames;
  27672. require('./_object-pie').f = $propertyIsEnumerable;
  27673. require('./_object-gops').f = $getOwnPropertySymbols;
  27674. if (DESCRIPTORS && !require('./_library')) {
  27675. redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
  27676. }
  27677. wksExt.f = function (name) {
  27678. return wrap(wks(name));
  27679. };
  27680. }
  27681. $export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol });
  27682. for (var es6Symbols = (
  27683. // 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
  27684. 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'
  27685. ).split(','), j = 0; es6Symbols.length > j;)wks(es6Symbols[j++]);
  27686. for (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) wksDefine(wellKnownSymbols[k++]);
  27687. $export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
  27688. // 19.4.2.1 Symbol.for(key)
  27689. 'for': function (key) {
  27690. return has(SymbolRegistry, key += '')
  27691. ? SymbolRegistry[key]
  27692. : SymbolRegistry[key] = $Symbol(key);
  27693. },
  27694. // 19.4.2.5 Symbol.keyFor(sym)
  27695. keyFor: function keyFor(sym) {
  27696. if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');
  27697. for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key;
  27698. },
  27699. useSetter: function () { setter = true; },
  27700. useSimple: function () { setter = false; }
  27701. });
  27702. $export($export.S + $export.F * !USE_NATIVE, 'Object', {
  27703. // 19.1.2.2 Object.create(O [, Properties])
  27704. create: $create,
  27705. // 19.1.2.4 Object.defineProperty(O, P, Attributes)
  27706. defineProperty: $defineProperty,
  27707. // 19.1.2.3 Object.defineProperties(O, Properties)
  27708. defineProperties: $defineProperties,
  27709. // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
  27710. getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
  27711. // 19.1.2.7 Object.getOwnPropertyNames(O)
  27712. getOwnPropertyNames: $getOwnPropertyNames,
  27713. // 19.1.2.8 Object.getOwnPropertySymbols(O)
  27714. getOwnPropertySymbols: $getOwnPropertySymbols
  27715. });
  27716. // 24.3.2 JSON.stringify(value [, replacer [, space]])
  27717. $JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () {
  27718. var S = $Symbol();
  27719. // MS Edge converts symbol values to JSON as {}
  27720. // WebKit converts symbol values to JSON as null
  27721. // V8 throws on boxed symbols
  27722. return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}';
  27723. })), 'JSON', {
  27724. stringify: function stringify(it) {
  27725. var args = [it];
  27726. var i = 1;
  27727. var replacer, $replacer;
  27728. while (arguments.length > i) args.push(arguments[i++]);
  27729. $replacer = replacer = args[1];
  27730. if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
  27731. if (!isArray(replacer)) replacer = function (key, value) {
  27732. if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
  27733. if (!isSymbol(value)) return value;
  27734. };
  27735. args[1] = replacer;
  27736. return _stringify.apply($JSON, args);
  27737. }
  27738. });
  27739. // 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
  27740. $Symbol[PROTOTYPE][TO_PRIMITIVE] || require('./_hide')($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
  27741. // 19.4.3.5 Symbol.prototype[@@toStringTag]
  27742. setToStringTag($Symbol, 'Symbol');
  27743. // 20.2.1.9 Math[@@toStringTag]
  27744. setToStringTag(Math, 'Math', true);
  27745. // 24.3.3 JSON[@@toStringTag]
  27746. setToStringTag(global.JSON, 'JSON', true);
  27747. },{"./_an-object":181,"./_descriptors":196,"./_enum-keys":199,"./_export":200,"./_fails":201,"./_global":203,"./_has":204,"./_hide":205,"./_is-array":210,"./_is-object":211,"./_library":217,"./_meta":218,"./_object-create":220,"./_object-dp":221,"./_object-gopd":223,"./_object-gopn":225,"./_object-gopn-ext":224,"./_object-gops":226,"./_object-keys":229,"./_object-pie":230,"./_property-desc":232,"./_redefine":234,"./_set-to-string-tag":239,"./_shared":241,"./_to-iobject":245,"./_to-primitive":248,"./_uid":249,"./_wks":253,"./_wks-define":251,"./_wks-ext":252}],266:[function(require,module,exports){
  27748. 'use strict';
  27749. var each = require('./_array-methods')(0);
  27750. var redefine = require('./_redefine');
  27751. var meta = require('./_meta');
  27752. var assign = require('./_object-assign');
  27753. var weak = require('./_collection-weak');
  27754. var isObject = require('./_is-object');
  27755. var fails = require('./_fails');
  27756. var validate = require('./_validate-collection');
  27757. var WEAK_MAP = 'WeakMap';
  27758. var getWeak = meta.getWeak;
  27759. var isExtensible = Object.isExtensible;
  27760. var uncaughtFrozenStore = weak.ufstore;
  27761. var tmp = {};
  27762. var InternalMap;
  27763. var wrapper = function (get) {
  27764. return function WeakMap() {
  27765. return get(this, arguments.length > 0 ? arguments[0] : undefined);
  27766. };
  27767. };
  27768. var methods = {
  27769. // 23.3.3.3 WeakMap.prototype.get(key)
  27770. get: function get(key) {
  27771. if (isObject(key)) {
  27772. var data = getWeak(key);
  27773. if (data === true) return uncaughtFrozenStore(validate(this, WEAK_MAP)).get(key);
  27774. return data ? data[this._i] : undefined;
  27775. }
  27776. },
  27777. // 23.3.3.5 WeakMap.prototype.set(key, value)
  27778. set: function set(key, value) {
  27779. return weak.def(validate(this, WEAK_MAP), key, value);
  27780. }
  27781. };
  27782. // 23.3 WeakMap Objects
  27783. var $WeakMap = module.exports = require('./_collection')(WEAK_MAP, wrapper, methods, weak, true, true);
  27784. // IE11 WeakMap frozen keys fix
  27785. if (fails(function () { return new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7; })) {
  27786. InternalMap = weak.getConstructor(wrapper, WEAK_MAP);
  27787. assign(InternalMap.prototype, methods);
  27788. meta.NEED = true;
  27789. each(['delete', 'has', 'get', 'set'], function (key) {
  27790. var proto = $WeakMap.prototype;
  27791. var method = proto[key];
  27792. redefine(proto, key, function (a, b) {
  27793. // store frozen objects on internal weakmap shim
  27794. if (isObject(a) && !isExtensible(a)) {
  27795. if (!this._f) this._f = new InternalMap();
  27796. var result = this._f[key](a, b);
  27797. return key == 'set' ? this : result;
  27798. // store all the rest on native weakmap
  27799. } return method.call(this, a, b);
  27800. });
  27801. });
  27802. }
  27803. },{"./_array-methods":184,"./_collection":192,"./_collection-weak":191,"./_fails":201,"./_is-object":211,"./_meta":218,"./_object-assign":219,"./_redefine":234,"./_validate-collection":250}],267:[function(require,module,exports){
  27804. 'use strict';
  27805. var weak = require('./_collection-weak');
  27806. var validate = require('./_validate-collection');
  27807. var WEAK_SET = 'WeakSet';
  27808. // 23.4 WeakSet Objects
  27809. require('./_collection')(WEAK_SET, function (get) {
  27810. return function WeakSet() { return get(this, arguments.length > 0 ? arguments[0] : undefined); };
  27811. }, {
  27812. // 23.4.3.1 WeakSet.prototype.add(value)
  27813. add: function add(value) {
  27814. return weak.def(validate(this, WEAK_SET), value, true);
  27815. }
  27816. }, weak, false, true);
  27817. },{"./_collection":192,"./_collection-weak":191,"./_validate-collection":250}],268:[function(require,module,exports){
  27818. // https://tc39.github.io/proposal-setmap-offrom/#sec-map.from
  27819. require('./_set-collection-from')('Map');
  27820. },{"./_set-collection-from":235}],269:[function(require,module,exports){
  27821. // https://tc39.github.io/proposal-setmap-offrom/#sec-map.of
  27822. require('./_set-collection-of')('Map');
  27823. },{"./_set-collection-of":236}],270:[function(require,module,exports){
  27824. // https://github.com/DavidBruant/Map-Set.prototype.toJSON
  27825. var $export = require('./_export');
  27826. $export($export.P + $export.R, 'Map', { toJSON: require('./_collection-to-json')('Map') });
  27827. },{"./_collection-to-json":190,"./_export":200}],271:[function(require,module,exports){
  27828. require('./_wks-define')('asyncIterator');
  27829. },{"./_wks-define":251}],272:[function(require,module,exports){
  27830. require('./_wks-define')('observable');
  27831. },{"./_wks-define":251}],273:[function(require,module,exports){
  27832. // https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.from
  27833. require('./_set-collection-from')('WeakMap');
  27834. },{"./_set-collection-from":235}],274:[function(require,module,exports){
  27835. // https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.of
  27836. require('./_set-collection-of')('WeakMap');
  27837. },{"./_set-collection-of":236}],275:[function(require,module,exports){
  27838. // https://tc39.github.io/proposal-setmap-offrom/#sec-weakset.from
  27839. require('./_set-collection-from')('WeakSet');
  27840. },{"./_set-collection-from":235}],276:[function(require,module,exports){
  27841. // https://tc39.github.io/proposal-setmap-offrom/#sec-weakset.of
  27842. require('./_set-collection-of')('WeakSet');
  27843. },{"./_set-collection-of":236}],277:[function(require,module,exports){
  27844. require('./es6.array.iterator');
  27845. var global = require('./_global');
  27846. var hide = require('./_hide');
  27847. var Iterators = require('./_iterators');
  27848. var TO_STRING_TAG = require('./_wks')('toStringTag');
  27849. var DOMIterables = ('CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,' +
  27850. 'DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,' +
  27851. 'MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,' +
  27852. 'SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,' +
  27853. 'TextTrackList,TouchList').split(',');
  27854. for (var i = 0; i < DOMIterables.length; i++) {
  27855. var NAME = DOMIterables[i];
  27856. var Collection = global[NAME];
  27857. var proto = Collection && Collection.prototype;
  27858. if (proto && !proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);
  27859. Iterators[NAME] = Iterators.Array;
  27860. }
  27861. },{"./_global":203,"./_hide":205,"./_iterators":216,"./_wks":253,"./es6.array.iterator":256}],278:[function(require,module,exports){
  27862. module.exports = require('./src/node');
  27863. },{"./src/node":281}],279:[function(require,module,exports){
  27864. (function (process){
  27865. /**
  27866. * This is the web browser implementation of `debug()`.
  27867. *
  27868. * Expose `debug()` as the module.
  27869. */
  27870. exports = module.exports = require('./debug');
  27871. exports.log = log;
  27872. exports.formatArgs = formatArgs;
  27873. exports.save = save;
  27874. exports.load = load;
  27875. exports.useColors = useColors;
  27876. exports.storage = 'undefined' != typeof chrome
  27877. && 'undefined' != typeof chrome.storage
  27878. ? chrome.storage.local
  27879. : localstorage();
  27880. /**
  27881. * Colors.
  27882. */
  27883. exports.colors = [
  27884. 'lightseagreen',
  27885. 'forestgreen',
  27886. 'goldenrod',
  27887. 'dodgerblue',
  27888. 'darkorchid',
  27889. 'crimson'
  27890. ];
  27891. /**
  27892. * Currently only WebKit-based Web Inspectors, Firefox >= v31,
  27893. * and the Firebug extension (any Firefox version) are known
  27894. * to support "%c" CSS customizations.
  27895. *
  27896. * TODO: add a `localStorage` variable to explicitly enable/disable colors
  27897. */
  27898. function useColors() {
  27899. // NB: In an Electron preload script, document will be defined but not fully
  27900. // initialized. Since we know we're in Chrome, we'll just detect this case
  27901. // explicitly
  27902. if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {
  27903. return true;
  27904. }
  27905. // is webkit? http://stackoverflow.com/a/16459606/376773
  27906. // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
  27907. return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
  27908. // is firebug? http://stackoverflow.com/a/398120/376773
  27909. (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
  27910. // is firefox >= v31?
  27911. // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
  27912. (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
  27913. // double check webkit in userAgent just in case we are in a worker
  27914. (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
  27915. }
  27916. /**
  27917. * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
  27918. */
  27919. exports.formatters.j = function(v) {
  27920. try {
  27921. return JSON.stringify(v);
  27922. } catch (err) {
  27923. return '[UnexpectedJSONParseError]: ' + err.message;
  27924. }
  27925. };
  27926. /**
  27927. * Colorize log arguments if enabled.
  27928. *
  27929. * @api public
  27930. */
  27931. function formatArgs(args) {
  27932. var useColors = this.useColors;
  27933. args[0] = (useColors ? '%c' : '')
  27934. + this.namespace
  27935. + (useColors ? ' %c' : ' ')
  27936. + args[0]
  27937. + (useColors ? '%c ' : ' ')
  27938. + '+' + exports.humanize(this.diff);
  27939. if (!useColors) return;
  27940. var c = 'color: ' + this.color;
  27941. args.splice(1, 0, c, 'color: inherit')
  27942. // the final "%c" is somewhat tricky, because there could be other
  27943. // arguments passed either before or after the %c, so we need to
  27944. // figure out the correct index to insert the CSS into
  27945. var index = 0;
  27946. var lastC = 0;
  27947. args[0].replace(/%[a-zA-Z%]/g, function(match) {
  27948. if ('%%' === match) return;
  27949. index++;
  27950. if ('%c' === match) {
  27951. // we only are interested in the *last* %c
  27952. // (the user may have provided their own)
  27953. lastC = index;
  27954. }
  27955. });
  27956. args.splice(lastC, 0, c);
  27957. }
  27958. /**
  27959. * Invokes `console.log()` when available.
  27960. * No-op when `console.log` is not a "function".
  27961. *
  27962. * @api public
  27963. */
  27964. function log() {
  27965. // this hackery is required for IE8/9, where
  27966. // the `console.log` function doesn't have 'apply'
  27967. return 'object' === typeof console
  27968. && console.log
  27969. && Function.prototype.apply.call(console.log, console, arguments);
  27970. }
  27971. /**
  27972. * Save `namespaces`.
  27973. *
  27974. * @param {String} namespaces
  27975. * @api private
  27976. */
  27977. function save(namespaces) {
  27978. try {
  27979. if (null == namespaces) {
  27980. exports.storage.removeItem('debug');
  27981. } else {
  27982. exports.storage.debug = namespaces;
  27983. }
  27984. } catch(e) {}
  27985. }
  27986. /**
  27987. * Load `namespaces`.
  27988. *
  27989. * @return {String} returns the previously persisted debug modes
  27990. * @api private
  27991. */
  27992. function load() {
  27993. var r;
  27994. try {
  27995. r = exports.storage.debug;
  27996. } catch(e) {}
  27997. // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
  27998. if (!r && typeof process !== 'undefined' && 'env' in process) {
  27999. r = process.env.DEBUG;
  28000. }
  28001. return r;
  28002. }
  28003. /**
  28004. * Enable namespaces listed in `localStorage.debug` initially.
  28005. */
  28006. exports.enable(load());
  28007. /**
  28008. * Localstorage attempts to return the localstorage.
  28009. *
  28010. * This is necessary because safari throws
  28011. * when a user disables cookies/localstorage
  28012. * and you attempt to access it.
  28013. *
  28014. * @return {LocalStorage}
  28015. * @api private
  28016. */
  28017. function localstorage() {
  28018. try {
  28019. return window.localStorage;
  28020. } catch (e) {}
  28021. }
  28022. }).call(this,require('_process'))
  28023. },{"./debug":280,"_process":525}],280:[function(require,module,exports){
  28024. /**
  28025. * This is the common logic for both the Node.js and web browser
  28026. * implementations of `debug()`.
  28027. *
  28028. * Expose `debug()` as the module.
  28029. */
  28030. exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
  28031. exports.coerce = coerce;
  28032. exports.disable = disable;
  28033. exports.enable = enable;
  28034. exports.enabled = enabled;
  28035. exports.humanize = require('ms');
  28036. /**
  28037. * The currently active debug mode names, and names to skip.
  28038. */
  28039. exports.names = [];
  28040. exports.skips = [];
  28041. /**
  28042. * Map of special "%n" handling functions, for the debug "format" argument.
  28043. *
  28044. * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
  28045. */
  28046. exports.formatters = {};
  28047. /**
  28048. * Previous log timestamp.
  28049. */
  28050. var prevTime;
  28051. /**
  28052. * Select a color.
  28053. * @param {String} namespace
  28054. * @return {Number}
  28055. * @api private
  28056. */
  28057. function selectColor(namespace) {
  28058. var hash = 0, i;
  28059. for (i in namespace) {
  28060. hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
  28061. hash |= 0; // Convert to 32bit integer
  28062. }
  28063. return exports.colors[Math.abs(hash) % exports.colors.length];
  28064. }
  28065. /**
  28066. * Create a debugger with the given `namespace`.
  28067. *
  28068. * @param {String} namespace
  28069. * @return {Function}
  28070. * @api public
  28071. */
  28072. function createDebug(namespace) {
  28073. function debug() {
  28074. // disabled?
  28075. if (!debug.enabled) return;
  28076. var self = debug;
  28077. // set `diff` timestamp
  28078. var curr = +new Date();
  28079. var ms = curr - (prevTime || curr);
  28080. self.diff = ms;
  28081. self.prev = prevTime;
  28082. self.curr = curr;
  28083. prevTime = curr;
  28084. // turn the `arguments` into a proper Array
  28085. var args = new Array(arguments.length);
  28086. for (var i = 0; i < args.length; i++) {
  28087. args[i] = arguments[i];
  28088. }
  28089. args[0] = exports.coerce(args[0]);
  28090. if ('string' !== typeof args[0]) {
  28091. // anything else let's inspect with %O
  28092. args.unshift('%O');
  28093. }
  28094. // apply any `formatters` transformations
  28095. var index = 0;
  28096. args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
  28097. // if we encounter an escaped % then don't increase the array index
  28098. if (match === '%%') return match;
  28099. index++;
  28100. var formatter = exports.formatters[format];
  28101. if ('function' === typeof formatter) {
  28102. var val = args[index];
  28103. match = formatter.call(self, val);
  28104. // now we need to remove `args[index]` since it's inlined in the `format`
  28105. args.splice(index, 1);
  28106. index--;
  28107. }
  28108. return match;
  28109. });
  28110. // apply env-specific formatting (colors, etc.)
  28111. exports.formatArgs.call(self, args);
  28112. var logFn = debug.log || exports.log || console.log.bind(console);
  28113. logFn.apply(self, args);
  28114. }
  28115. debug.namespace = namespace;
  28116. debug.enabled = exports.enabled(namespace);
  28117. debug.useColors = exports.useColors();
  28118. debug.color = selectColor(namespace);
  28119. // env-specific initialization logic for debug instances
  28120. if ('function' === typeof exports.init) {
  28121. exports.init(debug);
  28122. }
  28123. return debug;
  28124. }
  28125. /**
  28126. * Enables a debug mode by namespaces. This can include modes
  28127. * separated by a colon and wildcards.
  28128. *
  28129. * @param {String} namespaces
  28130. * @api public
  28131. */
  28132. function enable(namespaces) {
  28133. exports.save(namespaces);
  28134. exports.names = [];
  28135. exports.skips = [];
  28136. var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
  28137. var len = split.length;
  28138. for (var i = 0; i < len; i++) {
  28139. if (!split[i]) continue; // ignore empty strings
  28140. namespaces = split[i].replace(/\*/g, '.*?');
  28141. if (namespaces[0] === '-') {
  28142. exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
  28143. } else {
  28144. exports.names.push(new RegExp('^' + namespaces + '$'));
  28145. }
  28146. }
  28147. }
  28148. /**
  28149. * Disable debug output.
  28150. *
  28151. * @api public
  28152. */
  28153. function disable() {
  28154. exports.enable('');
  28155. }
  28156. /**
  28157. * Returns true if the given mode name is enabled, false otherwise.
  28158. *
  28159. * @param {String} name
  28160. * @return {Boolean}
  28161. * @api public
  28162. */
  28163. function enabled(name) {
  28164. var i, len;
  28165. for (i = 0, len = exports.skips.length; i < len; i++) {
  28166. if (exports.skips[i].test(name)) {
  28167. return false;
  28168. }
  28169. }
  28170. for (i = 0, len = exports.names.length; i < len; i++) {
  28171. if (exports.names[i].test(name)) {
  28172. return true;
  28173. }
  28174. }
  28175. return false;
  28176. }
  28177. /**
  28178. * Coerce `val`.
  28179. *
  28180. * @param {Mixed} val
  28181. * @return {Mixed}
  28182. * @api private
  28183. */
  28184. function coerce(val) {
  28185. if (val instanceof Error) return val.stack || val.message;
  28186. return val;
  28187. }
  28188. },{"ms":520}],281:[function(require,module,exports){
  28189. (function (process){
  28190. /**
  28191. * Module dependencies.
  28192. */
  28193. var tty = require('tty');
  28194. var util = require('util');
  28195. /**
  28196. * This is the Node.js implementation of `debug()`.
  28197. *
  28198. * Expose `debug()` as the module.
  28199. */
  28200. exports = module.exports = require('./debug');
  28201. exports.init = init;
  28202. exports.log = log;
  28203. exports.formatArgs = formatArgs;
  28204. exports.save = save;
  28205. exports.load = load;
  28206. exports.useColors = useColors;
  28207. /**
  28208. * Colors.
  28209. */
  28210. exports.colors = [6, 2, 3, 4, 5, 1];
  28211. /**
  28212. * Build up the default `inspectOpts` object from the environment variables.
  28213. *
  28214. * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
  28215. */
  28216. exports.inspectOpts = Object.keys(process.env).filter(function (key) {
  28217. return /^debug_/i.test(key);
  28218. }).reduce(function (obj, key) {
  28219. // camel-case
  28220. var prop = key
  28221. .substring(6)
  28222. .toLowerCase()
  28223. .replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() });
  28224. // coerce string value into JS value
  28225. var val = process.env[key];
  28226. if (/^(yes|on|true|enabled)$/i.test(val)) val = true;
  28227. else if (/^(no|off|false|disabled)$/i.test(val)) val = false;
  28228. else if (val === 'null') val = null;
  28229. else val = Number(val);
  28230. obj[prop] = val;
  28231. return obj;
  28232. }, {});
  28233. /**
  28234. * The file descriptor to write the `debug()` calls to.
  28235. * Set the `DEBUG_FD` env variable to override with another value. i.e.:
  28236. *
  28237. * $ DEBUG_FD=3 node script.js 3>debug.log
  28238. */
  28239. var fd = parseInt(process.env.DEBUG_FD, 10) || 2;
  28240. if (1 !== fd && 2 !== fd) {
  28241. 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)')()
  28242. }
  28243. var stream = 1 === fd ? process.stdout :
  28244. 2 === fd ? process.stderr :
  28245. createWritableStdioStream(fd);
  28246. /**
  28247. * Is stdout a TTY? Colored output is enabled when `true`.
  28248. */
  28249. function useColors() {
  28250. return 'colors' in exports.inspectOpts
  28251. ? Boolean(exports.inspectOpts.colors)
  28252. : tty.isatty(fd);
  28253. }
  28254. /**
  28255. * Map %o to `util.inspect()`, all on a single line.
  28256. */
  28257. exports.formatters.o = function(v) {
  28258. this.inspectOpts.colors = this.useColors;
  28259. return util.inspect(v, this.inspectOpts)
  28260. .split('\n').map(function(str) {
  28261. return str.trim()
  28262. }).join(' ');
  28263. };
  28264. /**
  28265. * Map %o to `util.inspect()`, allowing multiple lines if needed.
  28266. */
  28267. exports.formatters.O = function(v) {
  28268. this.inspectOpts.colors = this.useColors;
  28269. return util.inspect(v, this.inspectOpts);
  28270. };
  28271. /**
  28272. * Adds ANSI color escape codes if enabled.
  28273. *
  28274. * @api public
  28275. */
  28276. function formatArgs(args) {
  28277. var name = this.namespace;
  28278. var useColors = this.useColors;
  28279. if (useColors) {
  28280. var c = this.color;
  28281. var prefix = ' \u001b[3' + c + ';1m' + name + ' ' + '\u001b[0m';
  28282. args[0] = prefix + args[0].split('\n').join('\n' + prefix);
  28283. args.push('\u001b[3' + c + 'm+' + exports.humanize(this.diff) + '\u001b[0m');
  28284. } else {
  28285. args[0] = new Date().toUTCString()
  28286. + ' ' + name + ' ' + args[0];
  28287. }
  28288. }
  28289. /**
  28290. * Invokes `util.format()` with the specified arguments and writes to `stream`.
  28291. */
  28292. function log() {
  28293. return stream.write(util.format.apply(util, arguments) + '\n');
  28294. }
  28295. /**
  28296. * Save `namespaces`.
  28297. *
  28298. * @param {String} namespaces
  28299. * @api private
  28300. */
  28301. function save(namespaces) {
  28302. if (null == namespaces) {
  28303. // If you set a process.env field to null or undefined, it gets cast to the
  28304. // string 'null' or 'undefined'. Just delete instead.
  28305. delete process.env.DEBUG;
  28306. } else {
  28307. process.env.DEBUG = namespaces;
  28308. }
  28309. }
  28310. /**
  28311. * Load `namespaces`.
  28312. *
  28313. * @return {String} returns the previously persisted debug modes
  28314. * @api private
  28315. */
  28316. function load() {
  28317. return process.env.DEBUG;
  28318. }
  28319. /**
  28320. * Copied from `node/src/node.js`.
  28321. *
  28322. * XXX: It's lame that node doesn't expose this API out-of-the-box. It also
  28323. * relies on the undocumented `tty_wrap.guessHandleType()` which is also lame.
  28324. */
  28325. function createWritableStdioStream (fd) {
  28326. var stream;
  28327. var tty_wrap = process.binding('tty_wrap');
  28328. // Note stream._type is used for test-module-load-list.js
  28329. switch (tty_wrap.guessHandleType(fd)) {
  28330. case 'TTY':
  28331. stream = new tty.WriteStream(fd);
  28332. stream._type = 'tty';
  28333. // Hack to have stream not keep the event loop alive.
  28334. // See https://github.com/joyent/node/issues/1726
  28335. if (stream._handle && stream._handle.unref) {
  28336. stream._handle.unref();
  28337. }
  28338. break;
  28339. case 'FILE':
  28340. var fs = require('fs');
  28341. stream = new fs.SyncWriteStream(fd, { autoClose: false });
  28342. stream._type = 'fs';
  28343. break;
  28344. case 'PIPE':
  28345. case 'TCP':
  28346. var net = require('net');
  28347. stream = new net.Socket({
  28348. fd: fd,
  28349. readable: false,
  28350. writable: true
  28351. });
  28352. // FIXME Should probably have an option in net.Socket to create a
  28353. // stream from an existing fd which is writable only. But for now
  28354. // we'll just add this hack and set the `readable` member to false.
  28355. // Test: ./node test/fixtures/echo.js < /etc/passwd
  28356. stream.readable = false;
  28357. stream.read = null;
  28358. stream._type = 'pipe';
  28359. // FIXME Hack to have stream not keep the event loop alive.
  28360. // See https://github.com/joyent/node/issues/1726
  28361. if (stream._handle && stream._handle.unref) {
  28362. stream._handle.unref();
  28363. }
  28364. break;
  28365. default:
  28366. // Probably an error on in uv_guess_handle()
  28367. throw new Error('Implement me. Unknown stream file type!');
  28368. }
  28369. // For supporting legacy API we put the FD here.
  28370. stream.fd = fd;
  28371. stream._isStdio = true;
  28372. return stream;
  28373. }
  28374. /**
  28375. * Init logic for `debug` instances.
  28376. *
  28377. * Create a new `inspectOpts` object in case `useColors` is set
  28378. * differently for a particular `debug` instance.
  28379. */
  28380. function init (debug) {
  28381. debug.inspectOpts = {};
  28382. var keys = Object.keys(exports.inspectOpts);
  28383. for (var i = 0; i < keys.length; i++) {
  28384. debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
  28385. }
  28386. }
  28387. /**
  28388. * Enable namespaces listed in `process.env.DEBUG` initially.
  28389. */
  28390. exports.enable(load());
  28391. }).call(this,require('_process'))
  28392. },{"./debug":280,"_process":525,"fs":159,"net":159,"tty":557,"util":560}],282:[function(require,module,exports){
  28393. /* eslint-disable guard-for-in */
  28394. 'use strict';
  28395. var repeating = require('repeating');
  28396. // detect either spaces or tabs but not both to properly handle tabs
  28397. // for indentation and spaces for alignment
  28398. var INDENT_RE = /^(?:( )+|\t+)/;
  28399. function getMostUsed(indents) {
  28400. var result = 0;
  28401. var maxUsed = 0;
  28402. var maxWeight = 0;
  28403. for (var n in indents) {
  28404. var indent = indents[n];
  28405. var u = indent[0];
  28406. var w = indent[1];
  28407. if (u > maxUsed || u === maxUsed && w > maxWeight) {
  28408. maxUsed = u;
  28409. maxWeight = w;
  28410. result = Number(n);
  28411. }
  28412. }
  28413. return result;
  28414. }
  28415. module.exports = function (str) {
  28416. if (typeof str !== 'string') {
  28417. throw new TypeError('Expected a string');
  28418. }
  28419. // used to see if tabs or spaces are the most used
  28420. var tabs = 0;
  28421. var spaces = 0;
  28422. // remember the size of previous line's indentation
  28423. var prev = 0;
  28424. // remember how many indents/unindents as occurred for a given size
  28425. // and how much lines follow a given indentation
  28426. //
  28427. // indents = {
  28428. // 3: [1, 0],
  28429. // 4: [1, 5],
  28430. // 5: [1, 0],
  28431. // 12: [1, 0],
  28432. // }
  28433. var indents = {};
  28434. // pointer to the array of last used indent
  28435. var current;
  28436. // whether the last action was an indent (opposed to an unindent)
  28437. var isIndent;
  28438. str.split(/\n/g).forEach(function (line) {
  28439. if (!line) {
  28440. // ignore empty lines
  28441. return;
  28442. }
  28443. var indent;
  28444. var matches = line.match(INDENT_RE);
  28445. if (!matches) {
  28446. indent = 0;
  28447. } else {
  28448. indent = matches[0].length;
  28449. if (matches[1]) {
  28450. spaces++;
  28451. } else {
  28452. tabs++;
  28453. }
  28454. }
  28455. var diff = indent - prev;
  28456. prev = indent;
  28457. if (diff) {
  28458. // an indent or unindent has been detected
  28459. isIndent = diff > 0;
  28460. current = indents[isIndent ? diff : -diff];
  28461. if (current) {
  28462. current[0]++;
  28463. } else {
  28464. current = indents[diff] = [1, 0];
  28465. }
  28466. } else if (current) {
  28467. // if the last action was an indent, increment the weight
  28468. current[1] += Number(isIndent);
  28469. }
  28470. });
  28471. var amount = getMostUsed(indents);
  28472. var type;
  28473. var actual;
  28474. if (!amount) {
  28475. type = null;
  28476. actual = '';
  28477. } else if (spaces >= tabs) {
  28478. type = 'space';
  28479. actual = repeating(' ', amount);
  28480. } else {
  28481. type = 'tab';
  28482. actual = repeating('\t', amount);
  28483. }
  28484. return {
  28485. amount: amount,
  28486. type: type,
  28487. indent: actual
  28488. };
  28489. };
  28490. },{"repeating":540}],283:[function(require,module,exports){
  28491. 'use strict';
  28492. var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
  28493. module.exports = function (str) {
  28494. if (typeof str !== 'string') {
  28495. throw new TypeError('Expected a string');
  28496. }
  28497. return str.replace(matchOperatorsRe, '\\$&');
  28498. };
  28499. },{}],284:[function(require,module,exports){
  28500. /*
  28501. Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
  28502. Redistribution and use in source and binary forms, with or without
  28503. modification, are permitted provided that the following conditions are met:
  28504. * Redistributions of source code must retain the above copyright
  28505. notice, this list of conditions and the following disclaimer.
  28506. * Redistributions in binary form must reproduce the above copyright
  28507. notice, this list of conditions and the following disclaimer in the
  28508. documentation and/or other materials provided with the distribution.
  28509. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
  28510. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  28511. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  28512. ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  28513. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  28514. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  28515. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  28516. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  28517. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  28518. THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28519. */
  28520. (function () {
  28521. 'use strict';
  28522. function isExpression(node) {
  28523. if (node == null) { return false; }
  28524. switch (node.type) {
  28525. case 'ArrayExpression':
  28526. case 'AssignmentExpression':
  28527. case 'BinaryExpression':
  28528. case 'CallExpression':
  28529. case 'ConditionalExpression':
  28530. case 'FunctionExpression':
  28531. case 'Identifier':
  28532. case 'Literal':
  28533. case 'LogicalExpression':
  28534. case 'MemberExpression':
  28535. case 'NewExpression':
  28536. case 'ObjectExpression':
  28537. case 'SequenceExpression':
  28538. case 'ThisExpression':
  28539. case 'UnaryExpression':
  28540. case 'UpdateExpression':
  28541. return true;
  28542. }
  28543. return false;
  28544. }
  28545. function isIterationStatement(node) {
  28546. if (node == null) { return false; }
  28547. switch (node.type) {
  28548. case 'DoWhileStatement':
  28549. case 'ForInStatement':
  28550. case 'ForStatement':
  28551. case 'WhileStatement':
  28552. return true;
  28553. }
  28554. return false;
  28555. }
  28556. function isStatement(node) {
  28557. if (node == null) { return false; }
  28558. switch (node.type) {
  28559. case 'BlockStatement':
  28560. case 'BreakStatement':
  28561. case 'ContinueStatement':
  28562. case 'DebuggerStatement':
  28563. case 'DoWhileStatement':
  28564. case 'EmptyStatement':
  28565. case 'ExpressionStatement':
  28566. case 'ForInStatement':
  28567. case 'ForStatement':
  28568. case 'IfStatement':
  28569. case 'LabeledStatement':
  28570. case 'ReturnStatement':
  28571. case 'SwitchStatement':
  28572. case 'ThrowStatement':
  28573. case 'TryStatement':
  28574. case 'VariableDeclaration':
  28575. case 'WhileStatement':
  28576. case 'WithStatement':
  28577. return true;
  28578. }
  28579. return false;
  28580. }
  28581. function isSourceElement(node) {
  28582. return isStatement(node) || node != null && node.type === 'FunctionDeclaration';
  28583. }
  28584. function trailingStatement(node) {
  28585. switch (node.type) {
  28586. case 'IfStatement':
  28587. if (node.alternate != null) {
  28588. return node.alternate;
  28589. }
  28590. return node.consequent;
  28591. case 'LabeledStatement':
  28592. case 'ForStatement':
  28593. case 'ForInStatement':
  28594. case 'WhileStatement':
  28595. case 'WithStatement':
  28596. return node.body;
  28597. }
  28598. return null;
  28599. }
  28600. function isProblematicIfStatement(node) {
  28601. var current;
  28602. if (node.type !== 'IfStatement') {
  28603. return false;
  28604. }
  28605. if (node.alternate == null) {
  28606. return false;
  28607. }
  28608. current = node.consequent;
  28609. do {
  28610. if (current.type === 'IfStatement') {
  28611. if (current.alternate == null) {
  28612. return true;
  28613. }
  28614. }
  28615. current = trailingStatement(current);
  28616. } while (current);
  28617. return false;
  28618. }
  28619. module.exports = {
  28620. isExpression: isExpression,
  28621. isStatement: isStatement,
  28622. isIterationStatement: isIterationStatement,
  28623. isSourceElement: isSourceElement,
  28624. isProblematicIfStatement: isProblematicIfStatement,
  28625. trailingStatement: trailingStatement
  28626. };
  28627. }());
  28628. /* vim: set sw=4 ts=4 et tw=80 : */
  28629. },{}],285:[function(require,module,exports){
  28630. /*
  28631. Copyright (C) 2013-2014 Yusuke Suzuki <utatane.tea@gmail.com>
  28632. Copyright (C) 2014 Ivan Nikulin <ifaaan@gmail.com>
  28633. Redistribution and use in source and binary forms, with or without
  28634. modification, are permitted provided that the following conditions are met:
  28635. * Redistributions of source code must retain the above copyright
  28636. notice, this list of conditions and the following disclaimer.
  28637. * Redistributions in binary form must reproduce the above copyright
  28638. notice, this list of conditions and the following disclaimer in the
  28639. documentation and/or other materials provided with the distribution.
  28640. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  28641. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  28642. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  28643. ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  28644. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  28645. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  28646. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  28647. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  28648. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  28649. THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28650. */
  28651. (function () {
  28652. 'use strict';
  28653. var ES6Regex, ES5Regex, NON_ASCII_WHITESPACES, IDENTIFIER_START, IDENTIFIER_PART, ch;
  28654. // See `tools/generate-identifier-regex.js`.
  28655. ES5Regex = {
  28656. // ECMAScript 5.1/Unicode v7.0.0 NonAsciiIdentifierStart:
  28657. 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]/,
  28658. // ECMAScript 5.1/Unicode v7.0.0 NonAsciiIdentifierPart:
  28659. 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]/
  28660. };
  28661. ES6Regex = {
  28662. // ECMAScript 6/Unicode v7.0.0 NonAsciiIdentifierStart:
  28663. 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]/,
  28664. // ECMAScript 6/Unicode v7.0.0 NonAsciiIdentifierPart:
  28665. 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]/
  28666. };
  28667. function isDecimalDigit(ch) {
  28668. return 0x30 <= ch && ch <= 0x39; // 0..9
  28669. }
  28670. function isHexDigit(ch) {
  28671. return 0x30 <= ch && ch <= 0x39 || // 0..9
  28672. 0x61 <= ch && ch <= 0x66 || // a..f
  28673. 0x41 <= ch && ch <= 0x46; // A..F
  28674. }
  28675. function isOctalDigit(ch) {
  28676. return ch >= 0x30 && ch <= 0x37; // 0..7
  28677. }
  28678. // 7.2 White Space
  28679. NON_ASCII_WHITESPACES = [
  28680. 0x1680, 0x180E,
  28681. 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A,
  28682. 0x202F, 0x205F,
  28683. 0x3000,
  28684. 0xFEFF
  28685. ];
  28686. function isWhiteSpace(ch) {
  28687. return ch === 0x20 || ch === 0x09 || ch === 0x0B || ch === 0x0C || ch === 0xA0 ||
  28688. ch >= 0x1680 && NON_ASCII_WHITESPACES.indexOf(ch) >= 0;
  28689. }
  28690. // 7.3 Line Terminators
  28691. function isLineTerminator(ch) {
  28692. return ch === 0x0A || ch === 0x0D || ch === 0x2028 || ch === 0x2029;
  28693. }
  28694. // 7.6 Identifier Names and Identifiers
  28695. function fromCodePoint(cp) {
  28696. if (cp <= 0xFFFF) { return String.fromCharCode(cp); }
  28697. var cu1 = String.fromCharCode(Math.floor((cp - 0x10000) / 0x400) + 0xD800);
  28698. var cu2 = String.fromCharCode(((cp - 0x10000) % 0x400) + 0xDC00);
  28699. return cu1 + cu2;
  28700. }
  28701. IDENTIFIER_START = new Array(0x80);
  28702. for(ch = 0; ch < 0x80; ++ch) {
  28703. IDENTIFIER_START[ch] =
  28704. ch >= 0x61 && ch <= 0x7A || // a..z
  28705. ch >= 0x41 && ch <= 0x5A || // A..Z
  28706. ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore)
  28707. }
  28708. IDENTIFIER_PART = new Array(0x80);
  28709. for(ch = 0; ch < 0x80; ++ch) {
  28710. IDENTIFIER_PART[ch] =
  28711. ch >= 0x61 && ch <= 0x7A || // a..z
  28712. ch >= 0x41 && ch <= 0x5A || // A..Z
  28713. ch >= 0x30 && ch <= 0x39 || // 0..9
  28714. ch === 0x24 || ch === 0x5F; // $ (dollar) and _ (underscore)
  28715. }
  28716. function isIdentifierStartES5(ch) {
  28717. return ch < 0x80 ? IDENTIFIER_START[ch] : ES5Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch));
  28718. }
  28719. function isIdentifierPartES5(ch) {
  28720. return ch < 0x80 ? IDENTIFIER_PART[ch] : ES5Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch));
  28721. }
  28722. function isIdentifierStartES6(ch) {
  28723. return ch < 0x80 ? IDENTIFIER_START[ch] : ES6Regex.NonAsciiIdentifierStart.test(fromCodePoint(ch));
  28724. }
  28725. function isIdentifierPartES6(ch) {
  28726. return ch < 0x80 ? IDENTIFIER_PART[ch] : ES6Regex.NonAsciiIdentifierPart.test(fromCodePoint(ch));
  28727. }
  28728. module.exports = {
  28729. isDecimalDigit: isDecimalDigit,
  28730. isHexDigit: isHexDigit,
  28731. isOctalDigit: isOctalDigit,
  28732. isWhiteSpace: isWhiteSpace,
  28733. isLineTerminator: isLineTerminator,
  28734. isIdentifierStartES5: isIdentifierStartES5,
  28735. isIdentifierPartES5: isIdentifierPartES5,
  28736. isIdentifierStartES6: isIdentifierStartES6,
  28737. isIdentifierPartES6: isIdentifierPartES6
  28738. };
  28739. }());
  28740. /* vim: set sw=4 ts=4 et tw=80 : */
  28741. },{}],286:[function(require,module,exports){
  28742. /*
  28743. Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
  28744. Redistribution and use in source and binary forms, with or without
  28745. modification, are permitted provided that the following conditions are met:
  28746. * Redistributions of source code must retain the above copyright
  28747. notice, this list of conditions and the following disclaimer.
  28748. * Redistributions in binary form must reproduce the above copyright
  28749. notice, this list of conditions and the following disclaimer in the
  28750. documentation and/or other materials provided with the distribution.
  28751. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  28752. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  28753. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  28754. ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  28755. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  28756. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  28757. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  28758. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  28759. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  28760. THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28761. */
  28762. (function () {
  28763. 'use strict';
  28764. var code = require('./code');
  28765. function isStrictModeReservedWordES6(id) {
  28766. switch (id) {
  28767. case 'implements':
  28768. case 'interface':
  28769. case 'package':
  28770. case 'private':
  28771. case 'protected':
  28772. case 'public':
  28773. case 'static':
  28774. case 'let':
  28775. return true;
  28776. default:
  28777. return false;
  28778. }
  28779. }
  28780. function isKeywordES5(id, strict) {
  28781. // yield should not be treated as keyword under non-strict mode.
  28782. if (!strict && id === 'yield') {
  28783. return false;
  28784. }
  28785. return isKeywordES6(id, strict);
  28786. }
  28787. function isKeywordES6(id, strict) {
  28788. if (strict && isStrictModeReservedWordES6(id)) {
  28789. return true;
  28790. }
  28791. switch (id.length) {
  28792. case 2:
  28793. return (id === 'if') || (id === 'in') || (id === 'do');
  28794. case 3:
  28795. return (id === 'var') || (id === 'for') || (id === 'new') || (id === 'try');
  28796. case 4:
  28797. return (id === 'this') || (id === 'else') || (id === 'case') ||
  28798. (id === 'void') || (id === 'with') || (id === 'enum');
  28799. case 5:
  28800. return (id === 'while') || (id === 'break') || (id === 'catch') ||
  28801. (id === 'throw') || (id === 'const') || (id === 'yield') ||
  28802. (id === 'class') || (id === 'super');
  28803. case 6:
  28804. return (id === 'return') || (id === 'typeof') || (id === 'delete') ||
  28805. (id === 'switch') || (id === 'export') || (id === 'import');
  28806. case 7:
  28807. return (id === 'default') || (id === 'finally') || (id === 'extends');
  28808. case 8:
  28809. return (id === 'function') || (id === 'continue') || (id === 'debugger');
  28810. case 10:
  28811. return (id === 'instanceof');
  28812. default:
  28813. return false;
  28814. }
  28815. }
  28816. function isReservedWordES5(id, strict) {
  28817. return id === 'null' || id === 'true' || id === 'false' || isKeywordES5(id, strict);
  28818. }
  28819. function isReservedWordES6(id, strict) {
  28820. return id === 'null' || id === 'true' || id === 'false' || isKeywordES6(id, strict);
  28821. }
  28822. function isRestrictedWord(id) {
  28823. return id === 'eval' || id === 'arguments';
  28824. }
  28825. function isIdentifierNameES5(id) {
  28826. var i, iz, ch;
  28827. if (id.length === 0) { return false; }
  28828. ch = id.charCodeAt(0);
  28829. if (!code.isIdentifierStartES5(ch)) {
  28830. return false;
  28831. }
  28832. for (i = 1, iz = id.length; i < iz; ++i) {
  28833. ch = id.charCodeAt(i);
  28834. if (!code.isIdentifierPartES5(ch)) {
  28835. return false;
  28836. }
  28837. }
  28838. return true;
  28839. }
  28840. function decodeUtf16(lead, trail) {
  28841. return (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;
  28842. }
  28843. function isIdentifierNameES6(id) {
  28844. var i, iz, ch, lowCh, check;
  28845. if (id.length === 0) { return false; }
  28846. check = code.isIdentifierStartES6;
  28847. for (i = 0, iz = id.length; i < iz; ++i) {
  28848. ch = id.charCodeAt(i);
  28849. if (0xD800 <= ch && ch <= 0xDBFF) {
  28850. ++i;
  28851. if (i >= iz) { return false; }
  28852. lowCh = id.charCodeAt(i);
  28853. if (!(0xDC00 <= lowCh && lowCh <= 0xDFFF)) {
  28854. return false;
  28855. }
  28856. ch = decodeUtf16(ch, lowCh);
  28857. }
  28858. if (!check(ch)) {
  28859. return false;
  28860. }
  28861. check = code.isIdentifierPartES6;
  28862. }
  28863. return true;
  28864. }
  28865. function isIdentifierES5(id, strict) {
  28866. return isIdentifierNameES5(id) && !isReservedWordES5(id, strict);
  28867. }
  28868. function isIdentifierES6(id, strict) {
  28869. return isIdentifierNameES6(id) && !isReservedWordES6(id, strict);
  28870. }
  28871. module.exports = {
  28872. isKeywordES5: isKeywordES5,
  28873. isKeywordES6: isKeywordES6,
  28874. isReservedWordES5: isReservedWordES5,
  28875. isReservedWordES6: isReservedWordES6,
  28876. isRestrictedWord: isRestrictedWord,
  28877. isIdentifierNameES5: isIdentifierNameES5,
  28878. isIdentifierNameES6: isIdentifierNameES6,
  28879. isIdentifierES5: isIdentifierES5,
  28880. isIdentifierES6: isIdentifierES6
  28881. };
  28882. }());
  28883. /* vim: set sw=4 ts=4 et tw=80 : */
  28884. },{"./code":285}],287:[function(require,module,exports){
  28885. /*
  28886. Copyright (C) 2013 Yusuke Suzuki <utatane.tea@gmail.com>
  28887. Redistribution and use in source and binary forms, with or without
  28888. modification, are permitted provided that the following conditions are met:
  28889. * Redistributions of source code must retain the above copyright
  28890. notice, this list of conditions and the following disclaimer.
  28891. * Redistributions in binary form must reproduce the above copyright
  28892. notice, this list of conditions and the following disclaimer in the
  28893. documentation and/or other materials provided with the distribution.
  28894. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  28895. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  28896. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  28897. ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
  28898. DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  28899. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  28900. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  28901. ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  28902. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  28903. THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28904. */
  28905. (function () {
  28906. 'use strict';
  28907. exports.ast = require('./ast');
  28908. exports.code = require('./code');
  28909. exports.keyword = require('./keyword');
  28910. }());
  28911. /* vim: set sw=4 ts=4 et tw=80 : */
  28912. },{"./ast":284,"./code":285,"./keyword":286}],288:[function(require,module,exports){
  28913. module.exports={
  28914. "builtin": {
  28915. "Array": false,
  28916. "ArrayBuffer": false,
  28917. "Boolean": false,
  28918. "constructor": false,
  28919. "DataView": false,
  28920. "Date": false,
  28921. "decodeURI": false,
  28922. "decodeURIComponent": false,
  28923. "encodeURI": false,
  28924. "encodeURIComponent": false,
  28925. "Error": false,
  28926. "escape": false,
  28927. "eval": false,
  28928. "EvalError": false,
  28929. "Float32Array": false,
  28930. "Float64Array": false,
  28931. "Function": false,
  28932. "hasOwnProperty": false,
  28933. "Infinity": false,
  28934. "Int16Array": false,
  28935. "Int32Array": false,
  28936. "Int8Array": false,
  28937. "isFinite": false,
  28938. "isNaN": false,
  28939. "isPrototypeOf": false,
  28940. "JSON": false,
  28941. "Map": false,
  28942. "Math": false,
  28943. "NaN": false,
  28944. "Number": false,
  28945. "Object": false,
  28946. "parseFloat": false,
  28947. "parseInt": false,
  28948. "Promise": false,
  28949. "propertyIsEnumerable": false,
  28950. "Proxy": false,
  28951. "RangeError": false,
  28952. "ReferenceError": false,
  28953. "Reflect": false,
  28954. "RegExp": false,
  28955. "Set": false,
  28956. "String": false,
  28957. "Symbol": false,
  28958. "SyntaxError": false,
  28959. "System": false,
  28960. "toLocaleString": false,
  28961. "toString": false,
  28962. "TypeError": false,
  28963. "Uint16Array": false,
  28964. "Uint32Array": false,
  28965. "Uint8Array": false,
  28966. "Uint8ClampedArray": false,
  28967. "undefined": false,
  28968. "unescape": false,
  28969. "URIError": false,
  28970. "valueOf": false,
  28971. "WeakMap": false,
  28972. "WeakSet": false
  28973. },
  28974. "es5": {
  28975. "Array": false,
  28976. "Boolean": false,
  28977. "constructor": false,
  28978. "Date": false,
  28979. "decodeURI": false,
  28980. "decodeURIComponent": false,
  28981. "encodeURI": false,
  28982. "encodeURIComponent": false,
  28983. "Error": false,
  28984. "escape": false,
  28985. "eval": false,
  28986. "EvalError": false,
  28987. "Function": false,
  28988. "hasOwnProperty": false,
  28989. "Infinity": false,
  28990. "isFinite": false,
  28991. "isNaN": false,
  28992. "isPrototypeOf": false,
  28993. "JSON": false,
  28994. "Math": false,
  28995. "NaN": false,
  28996. "Number": false,
  28997. "Object": false,
  28998. "parseFloat": false,
  28999. "parseInt": false,
  29000. "propertyIsEnumerable": false,
  29001. "RangeError": false,
  29002. "ReferenceError": false,
  29003. "RegExp": false,
  29004. "String": false,
  29005. "SyntaxError": false,
  29006. "toLocaleString": false,
  29007. "toString": false,
  29008. "TypeError": false,
  29009. "undefined": false,
  29010. "unescape": false,
  29011. "URIError": false,
  29012. "valueOf": false
  29013. },
  29014. "es6": {
  29015. "Array": false,
  29016. "ArrayBuffer": false,
  29017. "Boolean": false,
  29018. "constructor": false,
  29019. "DataView": false,
  29020. "Date": false,
  29021. "decodeURI": false,
  29022. "decodeURIComponent": false,
  29023. "encodeURI": false,
  29024. "encodeURIComponent": false,
  29025. "Error": false,
  29026. "escape": false,
  29027. "eval": false,
  29028. "EvalError": false,
  29029. "Float32Array": false,
  29030. "Float64Array": false,
  29031. "Function": false,
  29032. "hasOwnProperty": false,
  29033. "Infinity": false,
  29034. "Int16Array": false,
  29035. "Int32Array": false,
  29036. "Int8Array": false,
  29037. "isFinite": false,
  29038. "isNaN": false,
  29039. "isPrototypeOf": false,
  29040. "JSON": false,
  29041. "Map": false,
  29042. "Math": false,
  29043. "NaN": false,
  29044. "Number": false,
  29045. "Object": false,
  29046. "parseFloat": false,
  29047. "parseInt": false,
  29048. "Promise": false,
  29049. "propertyIsEnumerable": false,
  29050. "Proxy": false,
  29051. "RangeError": false,
  29052. "ReferenceError": false,
  29053. "Reflect": false,
  29054. "RegExp": false,
  29055. "Set": false,
  29056. "String": false,
  29057. "Symbol": false,
  29058. "SyntaxError": false,
  29059. "System": false,
  29060. "toLocaleString": false,
  29061. "toString": false,
  29062. "TypeError": false,
  29063. "Uint16Array": false,
  29064. "Uint32Array": false,
  29065. "Uint8Array": false,
  29066. "Uint8ClampedArray": false,
  29067. "undefined": false,
  29068. "unescape": false,
  29069. "URIError": false,
  29070. "valueOf": false,
  29071. "WeakMap": false,
  29072. "WeakSet": false
  29073. },
  29074. "browser": {
  29075. "addEventListener": false,
  29076. "alert": false,
  29077. "AnalyserNode": false,
  29078. "Animation": false,
  29079. "AnimationEffectReadOnly": false,
  29080. "AnimationEffectTiming": false,
  29081. "AnimationEffectTimingReadOnly": false,
  29082. "AnimationEvent": false,
  29083. "AnimationPlaybackEvent": false,
  29084. "AnimationTimeline": false,
  29085. "applicationCache": false,
  29086. "ApplicationCache": false,
  29087. "ApplicationCacheErrorEvent": false,
  29088. "atob": false,
  29089. "Attr": false,
  29090. "Audio": false,
  29091. "AudioBuffer": false,
  29092. "AudioBufferSourceNode": false,
  29093. "AudioContext": false,
  29094. "AudioDestinationNode": false,
  29095. "AudioListener": false,
  29096. "AudioNode": false,
  29097. "AudioParam": false,
  29098. "AudioProcessingEvent": false,
  29099. "AutocompleteErrorEvent": false,
  29100. "BarProp": false,
  29101. "BatteryManager": false,
  29102. "BeforeUnloadEvent": false,
  29103. "BiquadFilterNode": false,
  29104. "Blob": false,
  29105. "blur": false,
  29106. "btoa": false,
  29107. "Cache": false,
  29108. "caches": false,
  29109. "CacheStorage": false,
  29110. "cancelAnimationFrame": false,
  29111. "cancelIdleCallback": false,
  29112. "CanvasGradient": false,
  29113. "CanvasPattern": false,
  29114. "CanvasRenderingContext2D": false,
  29115. "CDATASection": false,
  29116. "ChannelMergerNode": false,
  29117. "ChannelSplitterNode": false,
  29118. "CharacterData": false,
  29119. "clearInterval": false,
  29120. "clearTimeout": false,
  29121. "clientInformation": false,
  29122. "ClientRect": false,
  29123. "ClientRectList": false,
  29124. "ClipboardEvent": false,
  29125. "close": false,
  29126. "closed": false,
  29127. "CloseEvent": false,
  29128. "Comment": false,
  29129. "CompositionEvent": false,
  29130. "confirm": false,
  29131. "console": false,
  29132. "ConvolverNode": false,
  29133. "createImageBitmap": false,
  29134. "Credential": false,
  29135. "CredentialsContainer": false,
  29136. "crypto": false,
  29137. "Crypto": false,
  29138. "CryptoKey": false,
  29139. "CSS": false,
  29140. "CSSAnimation": false,
  29141. "CSSFontFaceRule": false,
  29142. "CSSImportRule": false,
  29143. "CSSKeyframeRule": false,
  29144. "CSSKeyframesRule": false,
  29145. "CSSMediaRule": false,
  29146. "CSSPageRule": false,
  29147. "CSSRule": false,
  29148. "CSSRuleList": false,
  29149. "CSSStyleDeclaration": false,
  29150. "CSSStyleRule": false,
  29151. "CSSStyleSheet": false,
  29152. "CSSSupportsRule": false,
  29153. "CSSTransition": false,
  29154. "CSSUnknownRule": false,
  29155. "CSSViewportRule": false,
  29156. "customElements": false,
  29157. "CustomEvent": false,
  29158. "DataTransfer": false,
  29159. "DataTransferItem": false,
  29160. "DataTransferItemList": false,
  29161. "Debug": false,
  29162. "defaultStatus": false,
  29163. "defaultstatus": false,
  29164. "DelayNode": false,
  29165. "DeviceMotionEvent": false,
  29166. "DeviceOrientationEvent": false,
  29167. "devicePixelRatio": false,
  29168. "dispatchEvent": false,
  29169. "document": false,
  29170. "Document": false,
  29171. "DocumentFragment": false,
  29172. "DocumentTimeline": false,
  29173. "DocumentType": false,
  29174. "DOMError": false,
  29175. "DOMException": false,
  29176. "DOMImplementation": false,
  29177. "DOMParser": false,
  29178. "DOMSettableTokenList": false,
  29179. "DOMStringList": false,
  29180. "DOMStringMap": false,
  29181. "DOMTokenList": false,
  29182. "DragEvent": false,
  29183. "DynamicsCompressorNode": false,
  29184. "Element": false,
  29185. "ElementTimeControl": false,
  29186. "ErrorEvent": false,
  29187. "event": false,
  29188. "Event": false,
  29189. "EventSource": false,
  29190. "EventTarget": false,
  29191. "external": false,
  29192. "FederatedCredential": false,
  29193. "fetch": false,
  29194. "File": false,
  29195. "FileError": false,
  29196. "FileList": false,
  29197. "FileReader": false,
  29198. "find": false,
  29199. "focus": false,
  29200. "FocusEvent": false,
  29201. "FontFace": false,
  29202. "FormData": false,
  29203. "frameElement": false,
  29204. "frames": false,
  29205. "GainNode": false,
  29206. "Gamepad": false,
  29207. "GamepadButton": false,
  29208. "GamepadEvent": false,
  29209. "getComputedStyle": false,
  29210. "getSelection": false,
  29211. "HashChangeEvent": false,
  29212. "Headers": false,
  29213. "history": false,
  29214. "History": false,
  29215. "HTMLAllCollection": false,
  29216. "HTMLAnchorElement": false,
  29217. "HTMLAppletElement": false,
  29218. "HTMLAreaElement": false,
  29219. "HTMLAudioElement": false,
  29220. "HTMLBaseElement": false,
  29221. "HTMLBlockquoteElement": false,
  29222. "HTMLBodyElement": false,
  29223. "HTMLBRElement": false,
  29224. "HTMLButtonElement": false,
  29225. "HTMLCanvasElement": false,
  29226. "HTMLCollection": false,
  29227. "HTMLContentElement": false,
  29228. "HTMLDataListElement": false,
  29229. "HTMLDetailsElement": false,
  29230. "HTMLDialogElement": false,
  29231. "HTMLDirectoryElement": false,
  29232. "HTMLDivElement": false,
  29233. "HTMLDListElement": false,
  29234. "HTMLDocument": false,
  29235. "HTMLElement": false,
  29236. "HTMLEmbedElement": false,
  29237. "HTMLFieldSetElement": false,
  29238. "HTMLFontElement": false,
  29239. "HTMLFormControlsCollection": false,
  29240. "HTMLFormElement": false,
  29241. "HTMLFrameElement": false,
  29242. "HTMLFrameSetElement": false,
  29243. "HTMLHeadElement": false,
  29244. "HTMLHeadingElement": false,
  29245. "HTMLHRElement": false,
  29246. "HTMLHtmlElement": false,
  29247. "HTMLIFrameElement": false,
  29248. "HTMLImageElement": false,
  29249. "HTMLInputElement": false,
  29250. "HTMLIsIndexElement": false,
  29251. "HTMLKeygenElement": false,
  29252. "HTMLLabelElement": false,
  29253. "HTMLLayerElement": false,
  29254. "HTMLLegendElement": false,
  29255. "HTMLLIElement": false,
  29256. "HTMLLinkElement": false,
  29257. "HTMLMapElement": false,
  29258. "HTMLMarqueeElement": false,
  29259. "HTMLMediaElement": false,
  29260. "HTMLMenuElement": false,
  29261. "HTMLMetaElement": false,
  29262. "HTMLMeterElement": false,
  29263. "HTMLModElement": false,
  29264. "HTMLObjectElement": false,
  29265. "HTMLOListElement": false,
  29266. "HTMLOptGroupElement": false,
  29267. "HTMLOptionElement": false,
  29268. "HTMLOptionsCollection": false,
  29269. "HTMLOutputElement": false,
  29270. "HTMLParagraphElement": false,
  29271. "HTMLParamElement": false,
  29272. "HTMLPictureElement": false,
  29273. "HTMLPreElement": false,
  29274. "HTMLProgressElement": false,
  29275. "HTMLQuoteElement": false,
  29276. "HTMLScriptElement": false,
  29277. "HTMLSelectElement": false,
  29278. "HTMLShadowElement": false,
  29279. "HTMLSourceElement": false,
  29280. "HTMLSpanElement": false,
  29281. "HTMLStyleElement": false,
  29282. "HTMLTableCaptionElement": false,
  29283. "HTMLTableCellElement": false,
  29284. "HTMLTableColElement": false,
  29285. "HTMLTableElement": false,
  29286. "HTMLTableRowElement": false,
  29287. "HTMLTableSectionElement": false,
  29288. "HTMLTemplateElement": false,
  29289. "HTMLTextAreaElement": false,
  29290. "HTMLTitleElement": false,
  29291. "HTMLTrackElement": false,
  29292. "HTMLUListElement": false,
  29293. "HTMLUnknownElement": false,
  29294. "HTMLVideoElement": false,
  29295. "IDBCursor": false,
  29296. "IDBCursorWithValue": false,
  29297. "IDBDatabase": false,
  29298. "IDBEnvironment": false,
  29299. "IDBFactory": false,
  29300. "IDBIndex": false,
  29301. "IDBKeyRange": false,
  29302. "IDBObjectStore": false,
  29303. "IDBOpenDBRequest": false,
  29304. "IDBRequest": false,
  29305. "IDBTransaction": false,
  29306. "IDBVersionChangeEvent": false,
  29307. "Image": false,
  29308. "ImageBitmap": false,
  29309. "ImageData": false,
  29310. "indexedDB": false,
  29311. "innerHeight": false,
  29312. "innerWidth": false,
  29313. "InputEvent": false,
  29314. "InputMethodContext": false,
  29315. "IntersectionObserver": false,
  29316. "IntersectionObserverEntry": false,
  29317. "Intl": false,
  29318. "KeyboardEvent": false,
  29319. "KeyframeEffect": false,
  29320. "KeyframeEffectReadOnly": false,
  29321. "length": false,
  29322. "localStorage": false,
  29323. "location": false,
  29324. "Location": false,
  29325. "locationbar": false,
  29326. "matchMedia": false,
  29327. "MediaElementAudioSourceNode": false,
  29328. "MediaEncryptedEvent": false,
  29329. "MediaError": false,
  29330. "MediaKeyError": false,
  29331. "MediaKeyEvent": false,
  29332. "MediaKeyMessageEvent": false,
  29333. "MediaKeys": false,
  29334. "MediaKeySession": false,
  29335. "MediaKeyStatusMap": false,
  29336. "MediaKeySystemAccess": false,
  29337. "MediaList": false,
  29338. "MediaQueryList": false,
  29339. "MediaQueryListEvent": false,
  29340. "MediaSource": false,
  29341. "MediaRecorder": false,
  29342. "MediaStream": false,
  29343. "MediaStreamAudioDestinationNode": false,
  29344. "MediaStreamAudioSourceNode": false,
  29345. "MediaStreamEvent": false,
  29346. "MediaStreamTrack": false,
  29347. "menubar": false,
  29348. "MessageChannel": false,
  29349. "MessageEvent": false,
  29350. "MessagePort": false,
  29351. "MIDIAccess": false,
  29352. "MIDIConnectionEvent": false,
  29353. "MIDIInput": false,
  29354. "MIDIInputMap": false,
  29355. "MIDIMessageEvent": false,
  29356. "MIDIOutput": false,
  29357. "MIDIOutputMap": false,
  29358. "MIDIPort": false,
  29359. "MimeType": false,
  29360. "MimeTypeArray": false,
  29361. "MouseEvent": false,
  29362. "moveBy": false,
  29363. "moveTo": false,
  29364. "MutationEvent": false,
  29365. "MutationObserver": false,
  29366. "MutationRecord": false,
  29367. "name": false,
  29368. "NamedNodeMap": false,
  29369. "navigator": false,
  29370. "Navigator": false,
  29371. "Node": false,
  29372. "NodeFilter": false,
  29373. "NodeIterator": false,
  29374. "NodeList": false,
  29375. "Notification": false,
  29376. "OfflineAudioCompletionEvent": false,
  29377. "OfflineAudioContext": false,
  29378. "offscreenBuffering": false,
  29379. "onbeforeunload": true,
  29380. "onblur": true,
  29381. "onerror": true,
  29382. "onfocus": true,
  29383. "onload": true,
  29384. "onresize": true,
  29385. "onunload": true,
  29386. "open": false,
  29387. "openDatabase": false,
  29388. "opener": false,
  29389. "opera": false,
  29390. "Option": false,
  29391. "OscillatorNode": false,
  29392. "outerHeight": false,
  29393. "outerWidth": false,
  29394. "PageTransitionEvent": false,
  29395. "pageXOffset": false,
  29396. "pageYOffset": false,
  29397. "parent": false,
  29398. "PasswordCredential": false,
  29399. "Path2D": false,
  29400. "performance": false,
  29401. "Performance": false,
  29402. "PerformanceEntry": false,
  29403. "PerformanceMark": false,
  29404. "PerformanceMeasure": false,
  29405. "PerformanceNavigation": false,
  29406. "PerformanceResourceTiming": false,
  29407. "PerformanceTiming": false,
  29408. "PeriodicWave": false,
  29409. "Permissions": false,
  29410. "PermissionStatus": false,
  29411. "personalbar": false,
  29412. "Plugin": false,
  29413. "PluginArray": false,
  29414. "PopStateEvent": false,
  29415. "postMessage": false,
  29416. "print": false,
  29417. "ProcessingInstruction": false,
  29418. "ProgressEvent": false,
  29419. "PromiseRejectionEvent": false,
  29420. "prompt": false,
  29421. "PushManager": false,
  29422. "PushSubscription": false,
  29423. "RadioNodeList": false,
  29424. "Range": false,
  29425. "ReadableByteStream": false,
  29426. "ReadableStream": false,
  29427. "removeEventListener": false,
  29428. "Request": false,
  29429. "requestAnimationFrame": false,
  29430. "requestIdleCallback": false,
  29431. "resizeBy": false,
  29432. "resizeTo": false,
  29433. "Response": false,
  29434. "RTCIceCandidate": false,
  29435. "RTCSessionDescription": false,
  29436. "RTCPeerConnection": false,
  29437. "screen": false,
  29438. "Screen": false,
  29439. "screenLeft": false,
  29440. "ScreenOrientation": false,
  29441. "screenTop": false,
  29442. "screenX": false,
  29443. "screenY": false,
  29444. "ScriptProcessorNode": false,
  29445. "scroll": false,
  29446. "scrollbars": false,
  29447. "scrollBy": false,
  29448. "scrollTo": false,
  29449. "scrollX": false,
  29450. "scrollY": false,
  29451. "SecurityPolicyViolationEvent": false,
  29452. "Selection": false,
  29453. "self": false,
  29454. "ServiceWorker": false,
  29455. "ServiceWorkerContainer": false,
  29456. "ServiceWorkerRegistration": false,
  29457. "sessionStorage": false,
  29458. "setInterval": false,
  29459. "setTimeout": false,
  29460. "ShadowRoot": false,
  29461. "SharedKeyframeList": false,
  29462. "SharedWorker": false,
  29463. "showModalDialog": false,
  29464. "SiteBoundCredential": false,
  29465. "speechSynthesis": false,
  29466. "SpeechSynthesisEvent": false,
  29467. "SpeechSynthesisUtterance": false,
  29468. "status": false,
  29469. "statusbar": false,
  29470. "stop": false,
  29471. "Storage": false,
  29472. "StorageEvent": false,
  29473. "styleMedia": false,
  29474. "StyleSheet": false,
  29475. "StyleSheetList": false,
  29476. "SubtleCrypto": false,
  29477. "SVGAElement": false,
  29478. "SVGAltGlyphDefElement": false,
  29479. "SVGAltGlyphElement": false,
  29480. "SVGAltGlyphItemElement": false,
  29481. "SVGAngle": false,
  29482. "SVGAnimateColorElement": false,
  29483. "SVGAnimatedAngle": false,
  29484. "SVGAnimatedBoolean": false,
  29485. "SVGAnimatedEnumeration": false,
  29486. "SVGAnimatedInteger": false,
  29487. "SVGAnimatedLength": false,
  29488. "SVGAnimatedLengthList": false,
  29489. "SVGAnimatedNumber": false,
  29490. "SVGAnimatedNumberList": false,
  29491. "SVGAnimatedPathData": false,
  29492. "SVGAnimatedPoints": false,
  29493. "SVGAnimatedPreserveAspectRatio": false,
  29494. "SVGAnimatedRect": false,
  29495. "SVGAnimatedString": false,
  29496. "SVGAnimatedTransformList": false,
  29497. "SVGAnimateElement": false,
  29498. "SVGAnimateMotionElement": false,
  29499. "SVGAnimateTransformElement": false,
  29500. "SVGAnimationElement": false,
  29501. "SVGCircleElement": false,
  29502. "SVGClipPathElement": false,
  29503. "SVGColor": false,
  29504. "SVGColorProfileElement": false,
  29505. "SVGColorProfileRule": false,
  29506. "SVGComponentTransferFunctionElement": false,
  29507. "SVGCSSRule": false,
  29508. "SVGCursorElement": false,
  29509. "SVGDefsElement": false,
  29510. "SVGDescElement": false,
  29511. "SVGDiscardElement": false,
  29512. "SVGDocument": false,
  29513. "SVGElement": false,
  29514. "SVGElementInstance": false,
  29515. "SVGElementInstanceList": false,
  29516. "SVGEllipseElement": false,
  29517. "SVGEvent": false,
  29518. "SVGExternalResourcesRequired": false,
  29519. "SVGFEBlendElement": false,
  29520. "SVGFEColorMatrixElement": false,
  29521. "SVGFEComponentTransferElement": false,
  29522. "SVGFECompositeElement": false,
  29523. "SVGFEConvolveMatrixElement": false,
  29524. "SVGFEDiffuseLightingElement": false,
  29525. "SVGFEDisplacementMapElement": false,
  29526. "SVGFEDistantLightElement": false,
  29527. "SVGFEDropShadowElement": false,
  29528. "SVGFEFloodElement": false,
  29529. "SVGFEFuncAElement": false,
  29530. "SVGFEFuncBElement": false,
  29531. "SVGFEFuncGElement": false,
  29532. "SVGFEFuncRElement": false,
  29533. "SVGFEGaussianBlurElement": false,
  29534. "SVGFEImageElement": false,
  29535. "SVGFEMergeElement": false,
  29536. "SVGFEMergeNodeElement": false,
  29537. "SVGFEMorphologyElement": false,
  29538. "SVGFEOffsetElement": false,
  29539. "SVGFEPointLightElement": false,
  29540. "SVGFESpecularLightingElement": false,
  29541. "SVGFESpotLightElement": false,
  29542. "SVGFETileElement": false,
  29543. "SVGFETurbulenceElement": false,
  29544. "SVGFilterElement": false,
  29545. "SVGFilterPrimitiveStandardAttributes": false,
  29546. "SVGFitToViewBox": false,
  29547. "SVGFontElement": false,
  29548. "SVGFontFaceElement": false,
  29549. "SVGFontFaceFormatElement": false,
  29550. "SVGFontFaceNameElement": false,
  29551. "SVGFontFaceSrcElement": false,
  29552. "SVGFontFaceUriElement": false,
  29553. "SVGForeignObjectElement": false,
  29554. "SVGGElement": false,
  29555. "SVGGeometryElement": false,
  29556. "SVGGlyphElement": false,
  29557. "SVGGlyphRefElement": false,
  29558. "SVGGradientElement": false,
  29559. "SVGGraphicsElement": false,
  29560. "SVGHKernElement": false,
  29561. "SVGICCColor": false,
  29562. "SVGImageElement": false,
  29563. "SVGLangSpace": false,
  29564. "SVGLength": false,
  29565. "SVGLengthList": false,
  29566. "SVGLinearGradientElement": false,
  29567. "SVGLineElement": false,
  29568. "SVGLocatable": false,
  29569. "SVGMarkerElement": false,
  29570. "SVGMaskElement": false,
  29571. "SVGMatrix": false,
  29572. "SVGMetadataElement": false,
  29573. "SVGMissingGlyphElement": false,
  29574. "SVGMPathElement": false,
  29575. "SVGNumber": false,
  29576. "SVGNumberList": false,
  29577. "SVGPaint": false,
  29578. "SVGPathElement": false,
  29579. "SVGPathSeg": false,
  29580. "SVGPathSegArcAbs": false,
  29581. "SVGPathSegArcRel": false,
  29582. "SVGPathSegClosePath": false,
  29583. "SVGPathSegCurvetoCubicAbs": false,
  29584. "SVGPathSegCurvetoCubicRel": false,
  29585. "SVGPathSegCurvetoCubicSmoothAbs": false,
  29586. "SVGPathSegCurvetoCubicSmoothRel": false,
  29587. "SVGPathSegCurvetoQuadraticAbs": false,
  29588. "SVGPathSegCurvetoQuadraticRel": false,
  29589. "SVGPathSegCurvetoQuadraticSmoothAbs": false,
  29590. "SVGPathSegCurvetoQuadraticSmoothRel": false,
  29591. "SVGPathSegLinetoAbs": false,
  29592. "SVGPathSegLinetoHorizontalAbs": false,
  29593. "SVGPathSegLinetoHorizontalRel": false,
  29594. "SVGPathSegLinetoRel": false,
  29595. "SVGPathSegLinetoVerticalAbs": false,
  29596. "SVGPathSegLinetoVerticalRel": false,
  29597. "SVGPathSegList": false,
  29598. "SVGPathSegMovetoAbs": false,
  29599. "SVGPathSegMovetoRel": false,
  29600. "SVGPatternElement": false,
  29601. "SVGPoint": false,
  29602. "SVGPointList": false,
  29603. "SVGPolygonElement": false,
  29604. "SVGPolylineElement": false,
  29605. "SVGPreserveAspectRatio": false,
  29606. "SVGRadialGradientElement": false,
  29607. "SVGRect": false,
  29608. "SVGRectElement": false,
  29609. "SVGRenderingIntent": false,
  29610. "SVGScriptElement": false,
  29611. "SVGSetElement": false,
  29612. "SVGStopElement": false,
  29613. "SVGStringList": false,
  29614. "SVGStylable": false,
  29615. "SVGStyleElement": false,
  29616. "SVGSVGElement": false,
  29617. "SVGSwitchElement": false,
  29618. "SVGSymbolElement": false,
  29619. "SVGTests": false,
  29620. "SVGTextContentElement": false,
  29621. "SVGTextElement": false,
  29622. "SVGTextPathElement": false,
  29623. "SVGTextPositioningElement": false,
  29624. "SVGTitleElement": false,
  29625. "SVGTransform": false,
  29626. "SVGTransformable": false,
  29627. "SVGTransformList": false,
  29628. "SVGTRefElement": false,
  29629. "SVGTSpanElement": false,
  29630. "SVGUnitTypes": false,
  29631. "SVGURIReference": false,
  29632. "SVGUseElement": false,
  29633. "SVGViewElement": false,
  29634. "SVGViewSpec": false,
  29635. "SVGVKernElement": false,
  29636. "SVGZoomAndPan": false,
  29637. "SVGZoomEvent": false,
  29638. "Text": false,
  29639. "TextDecoder": false,
  29640. "TextEncoder": false,
  29641. "TextEvent": false,
  29642. "TextMetrics": false,
  29643. "TextTrack": false,
  29644. "TextTrackCue": false,
  29645. "TextTrackCueList": false,
  29646. "TextTrackList": false,
  29647. "TimeEvent": false,
  29648. "TimeRanges": false,
  29649. "toolbar": false,
  29650. "top": false,
  29651. "Touch": false,
  29652. "TouchEvent": false,
  29653. "TouchList": false,
  29654. "TrackEvent": false,
  29655. "TransitionEvent": false,
  29656. "TreeWalker": false,
  29657. "UIEvent": false,
  29658. "URL": false,
  29659. "URLSearchParams": false,
  29660. "ValidityState": false,
  29661. "VTTCue": false,
  29662. "WaveShaperNode": false,
  29663. "WebGLActiveInfo": false,
  29664. "WebGLBuffer": false,
  29665. "WebGLContextEvent": false,
  29666. "WebGLFramebuffer": false,
  29667. "WebGLProgram": false,
  29668. "WebGLRenderbuffer": false,
  29669. "WebGLRenderingContext": false,
  29670. "WebGLShader": false,
  29671. "WebGLShaderPrecisionFormat": false,
  29672. "WebGLTexture": false,
  29673. "WebGLUniformLocation": false,
  29674. "WebSocket": false,
  29675. "WheelEvent": false,
  29676. "window": false,
  29677. "Window": false,
  29678. "Worker": false,
  29679. "XDomainRequest": false,
  29680. "XMLDocument": false,
  29681. "XMLHttpRequest": false,
  29682. "XMLHttpRequestEventTarget": false,
  29683. "XMLHttpRequestProgressEvent": false,
  29684. "XMLHttpRequestUpload": false,
  29685. "XMLSerializer": false,
  29686. "XPathEvaluator": false,
  29687. "XPathException": false,
  29688. "XPathExpression": false,
  29689. "XPathNamespace": false,
  29690. "XPathNSResolver": false,
  29691. "XPathResult": false,
  29692. "XSLTProcessor": false
  29693. },
  29694. "worker": {
  29695. "applicationCache": false,
  29696. "atob": false,
  29697. "Blob": false,
  29698. "BroadcastChannel": false,
  29699. "btoa": false,
  29700. "Cache": false,
  29701. "caches": false,
  29702. "clearInterval": false,
  29703. "clearTimeout": false,
  29704. "close": true,
  29705. "console": false,
  29706. "fetch": false,
  29707. "FileReaderSync": false,
  29708. "FormData": false,
  29709. "Headers": false,
  29710. "IDBCursor": false,
  29711. "IDBCursorWithValue": false,
  29712. "IDBDatabase": false,
  29713. "IDBFactory": false,
  29714. "IDBIndex": false,
  29715. "IDBKeyRange": false,
  29716. "IDBObjectStore": false,
  29717. "IDBOpenDBRequest": false,
  29718. "IDBRequest": false,
  29719. "IDBTransaction": false,
  29720. "IDBVersionChangeEvent": false,
  29721. "ImageData": false,
  29722. "importScripts": true,
  29723. "indexedDB": false,
  29724. "location": false,
  29725. "MessageChannel": false,
  29726. "MessagePort": false,
  29727. "name": false,
  29728. "navigator": false,
  29729. "Notification": false,
  29730. "onclose": true,
  29731. "onconnect": true,
  29732. "onerror": true,
  29733. "onlanguagechange": true,
  29734. "onmessage": true,
  29735. "onoffline": true,
  29736. "ononline": true,
  29737. "onrejectionhandled": true,
  29738. "onunhandledrejection": true,
  29739. "performance": false,
  29740. "Performance": false,
  29741. "PerformanceEntry": false,
  29742. "PerformanceMark": false,
  29743. "PerformanceMeasure": false,
  29744. "PerformanceNavigation": false,
  29745. "PerformanceResourceTiming": false,
  29746. "PerformanceTiming": false,
  29747. "postMessage": true,
  29748. "Promise": false,
  29749. "Request": false,
  29750. "Response": false,
  29751. "self": true,
  29752. "ServiceWorkerRegistration": false,
  29753. "setInterval": false,
  29754. "setTimeout": false,
  29755. "TextDecoder": false,
  29756. "TextEncoder": false,
  29757. "URL": false,
  29758. "URLSearchParams": false,
  29759. "WebSocket": false,
  29760. "Worker": false,
  29761. "XMLHttpRequest": false
  29762. },
  29763. "node": {
  29764. "__dirname": false,
  29765. "__filename": false,
  29766. "arguments": false,
  29767. "Buffer": false,
  29768. "clearImmediate": false,
  29769. "clearInterval": false,
  29770. "clearTimeout": false,
  29771. "console": false,
  29772. "exports": true,
  29773. "GLOBAL": false,
  29774. "global": false,
  29775. "Intl": false,
  29776. "module": false,
  29777. "process": false,
  29778. "require": false,
  29779. "root": false,
  29780. "setImmediate": false,
  29781. "setInterval": false,
  29782. "setTimeout": false
  29783. },
  29784. "commonjs": {
  29785. "exports": true,
  29786. "module": false,
  29787. "require": false,
  29788. "global": false
  29789. },
  29790. "amd": {
  29791. "define": false,
  29792. "require": false
  29793. },
  29794. "mocha": {
  29795. "after": false,
  29796. "afterEach": false,
  29797. "before": false,
  29798. "beforeEach": false,
  29799. "context": false,
  29800. "describe": false,
  29801. "it": false,
  29802. "mocha": false,
  29803. "run": false,
  29804. "setup": false,
  29805. "specify": false,
  29806. "suite": false,
  29807. "suiteSetup": false,
  29808. "suiteTeardown": false,
  29809. "teardown": false,
  29810. "test": false,
  29811. "xcontext": false,
  29812. "xdescribe": false,
  29813. "xit": false,
  29814. "xspecify": false
  29815. },
  29816. "jasmine": {
  29817. "afterAll": false,
  29818. "afterEach": false,
  29819. "beforeAll": false,
  29820. "beforeEach": false,
  29821. "describe": false,
  29822. "expect": false,
  29823. "fail": false,
  29824. "fdescribe": false,
  29825. "fit": false,
  29826. "it": false,
  29827. "jasmine": false,
  29828. "pending": false,
  29829. "runs": false,
  29830. "spyOn": false,
  29831. "spyOnProperty": false,
  29832. "waits": false,
  29833. "waitsFor": false,
  29834. "xdescribe": false,
  29835. "xit": false
  29836. },
  29837. "jest": {
  29838. "afterAll": false,
  29839. "afterEach": false,
  29840. "beforeAll": false,
  29841. "beforeEach": false,
  29842. "check": false,
  29843. "describe": false,
  29844. "expect": false,
  29845. "gen": false,
  29846. "it": false,
  29847. "fdescribe": false,
  29848. "fit": false,
  29849. "jest": false,
  29850. "pit": false,
  29851. "require": false,
  29852. "test": false,
  29853. "xdescribe": false,
  29854. "xit": false,
  29855. "xtest": false
  29856. },
  29857. "qunit": {
  29858. "asyncTest": false,
  29859. "deepEqual": false,
  29860. "equal": false,
  29861. "expect": false,
  29862. "module": false,
  29863. "notDeepEqual": false,
  29864. "notEqual": false,
  29865. "notOk": false,
  29866. "notPropEqual": false,
  29867. "notStrictEqual": false,
  29868. "ok": false,
  29869. "propEqual": false,
  29870. "QUnit": false,
  29871. "raises": false,
  29872. "start": false,
  29873. "stop": false,
  29874. "strictEqual": false,
  29875. "test": false,
  29876. "throws": false
  29877. },
  29878. "phantomjs": {
  29879. "console": true,
  29880. "exports": true,
  29881. "phantom": true,
  29882. "require": true,
  29883. "WebPage": true
  29884. },
  29885. "couch": {
  29886. "emit": false,
  29887. "exports": false,
  29888. "getRow": false,
  29889. "log": false,
  29890. "module": false,
  29891. "provides": false,
  29892. "require": false,
  29893. "respond": false,
  29894. "send": false,
  29895. "start": false,
  29896. "sum": false
  29897. },
  29898. "rhino": {
  29899. "defineClass": false,
  29900. "deserialize": false,
  29901. "gc": false,
  29902. "help": false,
  29903. "importClass": false,
  29904. "importPackage": false,
  29905. "java": false,
  29906. "load": false,
  29907. "loadClass": false,
  29908. "Packages": false,
  29909. "print": false,
  29910. "quit": false,
  29911. "readFile": false,
  29912. "readUrl": false,
  29913. "runCommand": false,
  29914. "seal": false,
  29915. "serialize": false,
  29916. "spawn": false,
  29917. "sync": false,
  29918. "toint32": false,
  29919. "version": false
  29920. },
  29921. "nashorn": {
  29922. "__DIR__": false,
  29923. "__FILE__": false,
  29924. "__LINE__": false,
  29925. "com": false,
  29926. "edu": false,
  29927. "exit": false,
  29928. "Java": false,
  29929. "java": false,
  29930. "javafx": false,
  29931. "JavaImporter": false,
  29932. "javax": false,
  29933. "JSAdapter": false,
  29934. "load": false,
  29935. "loadWithNewGlobal": false,
  29936. "org": false,
  29937. "Packages": false,
  29938. "print": false,
  29939. "quit": false
  29940. },
  29941. "wsh": {
  29942. "ActiveXObject": true,
  29943. "Enumerator": true,
  29944. "GetObject": true,
  29945. "ScriptEngine": true,
  29946. "ScriptEngineBuildVersion": true,
  29947. "ScriptEngineMajorVersion": true,
  29948. "ScriptEngineMinorVersion": true,
  29949. "VBArray": true,
  29950. "WScript": true,
  29951. "WSH": true,
  29952. "XDomainRequest": true
  29953. },
  29954. "jquery": {
  29955. "$": false,
  29956. "jQuery": false
  29957. },
  29958. "yui": {
  29959. "Y": false,
  29960. "YUI": false,
  29961. "YUI_config": false
  29962. },
  29963. "shelljs": {
  29964. "cat": false,
  29965. "cd": false,
  29966. "chmod": false,
  29967. "config": false,
  29968. "cp": false,
  29969. "dirs": false,
  29970. "echo": false,
  29971. "env": false,
  29972. "error": false,
  29973. "exec": false,
  29974. "exit": false,
  29975. "find": false,
  29976. "grep": false,
  29977. "ls": false,
  29978. "ln": false,
  29979. "mkdir": false,
  29980. "mv": false,
  29981. "popd": false,
  29982. "pushd": false,
  29983. "pwd": false,
  29984. "rm": false,
  29985. "sed": false,
  29986. "set": false,
  29987. "target": false,
  29988. "tempdir": false,
  29989. "test": false,
  29990. "touch": false,
  29991. "which": false
  29992. },
  29993. "prototypejs": {
  29994. "$": false,
  29995. "$$": false,
  29996. "$A": false,
  29997. "$break": false,
  29998. "$continue": false,
  29999. "$F": false,
  30000. "$H": false,
  30001. "$R": false,
  30002. "$w": false,
  30003. "Abstract": false,
  30004. "Ajax": false,
  30005. "Autocompleter": false,
  30006. "Builder": false,
  30007. "Class": false,
  30008. "Control": false,
  30009. "Draggable": false,
  30010. "Draggables": false,
  30011. "Droppables": false,
  30012. "Effect": false,
  30013. "Element": false,
  30014. "Enumerable": false,
  30015. "Event": false,
  30016. "Field": false,
  30017. "Form": false,
  30018. "Hash": false,
  30019. "Insertion": false,
  30020. "ObjectRange": false,
  30021. "PeriodicalExecuter": false,
  30022. "Position": false,
  30023. "Prototype": false,
  30024. "Scriptaculous": false,
  30025. "Selector": false,
  30026. "Sortable": false,
  30027. "SortableObserver": false,
  30028. "Sound": false,
  30029. "Template": false,
  30030. "Toggle": false,
  30031. "Try": false
  30032. },
  30033. "meteor": {
  30034. "$": false,
  30035. "_": false,
  30036. "Accounts": false,
  30037. "AccountsClient": false,
  30038. "AccountsServer": false,
  30039. "AccountsCommon": false,
  30040. "App": false,
  30041. "Assets": false,
  30042. "Blaze": false,
  30043. "check": false,
  30044. "Cordova": false,
  30045. "DDP": false,
  30046. "DDPServer": false,
  30047. "DDPRateLimiter": false,
  30048. "Deps": false,
  30049. "EJSON": false,
  30050. "Email": false,
  30051. "HTTP": false,
  30052. "Log": false,
  30053. "Match": false,
  30054. "Meteor": false,
  30055. "Mongo": false,
  30056. "MongoInternals": false,
  30057. "Npm": false,
  30058. "Package": false,
  30059. "Plugin": false,
  30060. "process": false,
  30061. "Random": false,
  30062. "ReactiveDict": false,
  30063. "ReactiveVar": false,
  30064. "Router": false,
  30065. "ServiceConfiguration": false,
  30066. "Session": false,
  30067. "share": false,
  30068. "Spacebars": false,
  30069. "Template": false,
  30070. "Tinytest": false,
  30071. "Tracker": false,
  30072. "UI": false,
  30073. "Utils": false,
  30074. "WebApp": false,
  30075. "WebAppInternals": false
  30076. },
  30077. "mongo": {
  30078. "_isWindows": false,
  30079. "_rand": false,
  30080. "BulkWriteResult": false,
  30081. "cat": false,
  30082. "cd": false,
  30083. "connect": false,
  30084. "db": false,
  30085. "getHostName": false,
  30086. "getMemInfo": false,
  30087. "hostname": false,
  30088. "ISODate": false,
  30089. "listFiles": false,
  30090. "load": false,
  30091. "ls": false,
  30092. "md5sumFile": false,
  30093. "mkdir": false,
  30094. "Mongo": false,
  30095. "NumberInt": false,
  30096. "NumberLong": false,
  30097. "ObjectId": false,
  30098. "PlanCache": false,
  30099. "print": false,
  30100. "printjson": false,
  30101. "pwd": false,
  30102. "quit": false,
  30103. "removeFile": false,
  30104. "rs": false,
  30105. "sh": false,
  30106. "UUID": false,
  30107. "version": false,
  30108. "WriteResult": false
  30109. },
  30110. "applescript": {
  30111. "$": false,
  30112. "Application": false,
  30113. "Automation": false,
  30114. "console": false,
  30115. "delay": false,
  30116. "Library": false,
  30117. "ObjC": false,
  30118. "ObjectSpecifier": false,
  30119. "Path": false,
  30120. "Progress": false,
  30121. "Ref": false
  30122. },
  30123. "serviceworker": {
  30124. "caches": false,
  30125. "Cache": false,
  30126. "CacheStorage": false,
  30127. "Client": false,
  30128. "clients": false,
  30129. "Clients": false,
  30130. "ExtendableEvent": false,
  30131. "ExtendableMessageEvent": false,
  30132. "FetchEvent": false,
  30133. "importScripts": false,
  30134. "registration": false,
  30135. "self": false,
  30136. "ServiceWorker": false,
  30137. "ServiceWorkerContainer": false,
  30138. "ServiceWorkerGlobalScope": false,
  30139. "ServiceWorkerMessageEvent": false,
  30140. "ServiceWorkerRegistration": false,
  30141. "skipWaiting": false,
  30142. "WindowClient": false
  30143. },
  30144. "atomtest": {
  30145. "advanceClock": false,
  30146. "fakeClearInterval": false,
  30147. "fakeClearTimeout": false,
  30148. "fakeSetInterval": false,
  30149. "fakeSetTimeout": false,
  30150. "resetTimeouts": false,
  30151. "waitsForPromise": false
  30152. },
  30153. "embertest": {
  30154. "andThen": false,
  30155. "click": false,
  30156. "currentPath": false,
  30157. "currentRouteName": false,
  30158. "currentURL": false,
  30159. "fillIn": false,
  30160. "find": false,
  30161. "findWithAssert": false,
  30162. "keyEvent": false,
  30163. "pauseTest": false,
  30164. "resumeTest": false,
  30165. "triggerEvent": false,
  30166. "visit": false
  30167. },
  30168. "protractor": {
  30169. "$": false,
  30170. "$$": false,
  30171. "browser": false,
  30172. "By": false,
  30173. "by": false,
  30174. "DartObject": false,
  30175. "element": false,
  30176. "protractor": false
  30177. },
  30178. "shared-node-browser": {
  30179. "clearInterval": false,
  30180. "clearTimeout": false,
  30181. "console": false,
  30182. "setInterval": false,
  30183. "setTimeout": false
  30184. },
  30185. "webextensions": {
  30186. "browser": false,
  30187. "chrome": false,
  30188. "opr": false
  30189. },
  30190. "greasemonkey": {
  30191. "GM_addStyle": false,
  30192. "GM_deleteValue": false,
  30193. "GM_getResourceText": false,
  30194. "GM_getResourceURL": false,
  30195. "GM_getValue": false,
  30196. "GM_info": false,
  30197. "GM_listValues": false,
  30198. "GM_log": false,
  30199. "GM_openInTab": false,
  30200. "GM_registerMenuCommand": false,
  30201. "GM_setClipboard": false,
  30202. "GM_setValue": false,
  30203. "GM_xmlhttpRequest": false,
  30204. "unsafeWindow": false
  30205. }
  30206. }
  30207. },{}],289:[function(require,module,exports){
  30208. module.exports = require('./globals.json');
  30209. },{"./globals.json":288}],290:[function(require,module,exports){
  30210. 'use strict';
  30211. var ansiRegex = require('ansi-regex');
  30212. var re = new RegExp(ansiRegex().source); // remove the `g` flag
  30213. module.exports = re.test.bind(re);
  30214. },{"ansi-regex":1}],291:[function(require,module,exports){
  30215. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  30216. var e, m
  30217. var eLen = nBytes * 8 - mLen - 1
  30218. var eMax = (1 << eLen) - 1
  30219. var eBias = eMax >> 1
  30220. var nBits = -7
  30221. var i = isLE ? (nBytes - 1) : 0
  30222. var d = isLE ? -1 : 1
  30223. var s = buffer[offset + i]
  30224. i += d
  30225. e = s & ((1 << (-nBits)) - 1)
  30226. s >>= (-nBits)
  30227. nBits += eLen
  30228. for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
  30229. m = e & ((1 << (-nBits)) - 1)
  30230. e >>= (-nBits)
  30231. nBits += mLen
  30232. for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
  30233. if (e === 0) {
  30234. e = 1 - eBias
  30235. } else if (e === eMax) {
  30236. return m ? NaN : ((s ? -1 : 1) * Infinity)
  30237. } else {
  30238. m = m + Math.pow(2, mLen)
  30239. e = e - eBias
  30240. }
  30241. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  30242. }
  30243. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  30244. var e, m, c
  30245. var eLen = nBytes * 8 - mLen - 1
  30246. var eMax = (1 << eLen) - 1
  30247. var eBias = eMax >> 1
  30248. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  30249. var i = isLE ? 0 : (nBytes - 1)
  30250. var d = isLE ? 1 : -1
  30251. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  30252. value = Math.abs(value)
  30253. if (isNaN(value) || value === Infinity) {
  30254. m = isNaN(value) ? 1 : 0
  30255. e = eMax
  30256. } else {
  30257. e = Math.floor(Math.log(value) / Math.LN2)
  30258. if (value * (c = Math.pow(2, -e)) < 1) {
  30259. e--
  30260. c *= 2
  30261. }
  30262. if (e + eBias >= 1) {
  30263. value += rt / c
  30264. } else {
  30265. value += rt * Math.pow(2, 1 - eBias)
  30266. }
  30267. if (value * c >= 2) {
  30268. e++
  30269. c /= 2
  30270. }
  30271. if (e + eBias >= eMax) {
  30272. m = 0
  30273. e = eMax
  30274. } else if (e + eBias >= 1) {
  30275. m = (value * c - 1) * Math.pow(2, mLen)
  30276. e = e + eBias
  30277. } else {
  30278. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  30279. e = 0
  30280. }
  30281. }
  30282. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  30283. e = (e << mLen) | m
  30284. eLen += mLen
  30285. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  30286. buffer[offset + i - d] |= s * 128
  30287. }
  30288. },{}],292:[function(require,module,exports){
  30289. (function (process){
  30290. /**
  30291. * Copyright 2013-2015, Facebook, Inc.
  30292. * All rights reserved.
  30293. *
  30294. * This source code is licensed under the BSD-style license found in the
  30295. * LICENSE file in the root directory of this source tree. An additional grant
  30296. * of patent rights can be found in the PATENTS file in the same directory.
  30297. */
  30298. 'use strict';
  30299. /**
  30300. * Use invariant() to assert state which your program assumes to be true.
  30301. *
  30302. * Provide sprintf-style format (only %s is supported) and arguments
  30303. * to provide information about what broke and what you were
  30304. * expecting.
  30305. *
  30306. * The invariant message will be stripped in production, but the invariant
  30307. * will remain to ensure logic does not differ in production.
  30308. */
  30309. var invariant = function(condition, format, a, b, c, d, e, f) {
  30310. if (process.env.NODE_ENV !== 'production') {
  30311. if (format === undefined) {
  30312. throw new Error('invariant requires an error message argument');
  30313. }
  30314. }
  30315. if (!condition) {
  30316. var error;
  30317. if (format === undefined) {
  30318. error = new Error(
  30319. 'Minified exception occurred; use the non-minified dev environment ' +
  30320. 'for the full error message and additional helpful warnings.'
  30321. );
  30322. } else {
  30323. var args = [a, b, c, d, e, f];
  30324. var argIndex = 0;
  30325. error = new Error(
  30326. format.replace(/%s/g, function() { return args[argIndex++]; })
  30327. );
  30328. error.name = 'Invariant Violation';
  30329. }
  30330. error.framesToPop = 1; // we don't care about invariant's own frame
  30331. throw error;
  30332. }
  30333. };
  30334. module.exports = invariant;
  30335. }).call(this,require('_process'))
  30336. },{"_process":525}],293:[function(require,module,exports){
  30337. 'use strict';
  30338. var numberIsNan = require('number-is-nan');
  30339. module.exports = Number.isFinite || function (val) {
  30340. return !(typeof val !== 'number' || numberIsNan(val) || val === Infinity || val === -Infinity);
  30341. };
  30342. },{"number-is-nan":521}],294:[function(require,module,exports){
  30343. var toString = {}.toString;
  30344. module.exports = Array.isArray || function (arr) {
  30345. return toString.call(arr) == '[object Array]';
  30346. };
  30347. },{}],295:[function(require,module,exports){
  30348. // Copyright 2014, 2015, 2016, 2017 Simon Lydell
  30349. // License: MIT. (See LICENSE.)
  30350. Object.defineProperty(exports, "__esModule", {
  30351. value: true
  30352. })
  30353. // This regex comes from regex.coffee, and is inserted here by generate-index.js
  30354. // (run `npm run build`).
  30355. 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
  30356. exports.matchToToken = function(match) {
  30357. var token = {type: "invalid", value: match[0]}
  30358. if (match[ 1]) token.type = "string" , token.closed = !!(match[3] || match[4])
  30359. else if (match[ 5]) token.type = "comment"
  30360. else if (match[ 6]) token.type = "comment", token.closed = !!match[7]
  30361. else if (match[ 8]) token.type = "regex"
  30362. else if (match[ 9]) token.type = "number"
  30363. else if (match[10]) token.type = "name"
  30364. else if (match[11]) token.type = "punctuator"
  30365. else if (match[12]) token.type = "whitespace"
  30366. return token
  30367. }
  30368. },{}],296:[function(require,module,exports){
  30369. (function (global){
  30370. /*! https://mths.be/jsesc v1.3.0 by @mathias */
  30371. ;(function(root) {
  30372. // Detect free variables `exports`
  30373. var freeExports = typeof exports == 'object' && exports;
  30374. // Detect free variable `module`
  30375. var freeModule = typeof module == 'object' && module &&
  30376. module.exports == freeExports && module;
  30377. // Detect free variable `global`, from Node.js or Browserified code,
  30378. // and use it as `root`
  30379. var freeGlobal = typeof global == 'object' && global;
  30380. if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
  30381. root = freeGlobal;
  30382. }
  30383. /*--------------------------------------------------------------------------*/
  30384. var object = {};
  30385. var hasOwnProperty = object.hasOwnProperty;
  30386. var forOwn = function(object, callback) {
  30387. var key;
  30388. for (key in object) {
  30389. if (hasOwnProperty.call(object, key)) {
  30390. callback(key, object[key]);
  30391. }
  30392. }
  30393. };
  30394. var extend = function(destination, source) {
  30395. if (!source) {
  30396. return destination;
  30397. }
  30398. forOwn(source, function(key, value) {
  30399. destination[key] = value;
  30400. });
  30401. return destination;
  30402. };
  30403. var forEach = function(array, callback) {
  30404. var length = array.length;
  30405. var index = -1;
  30406. while (++index < length) {
  30407. callback(array[index]);
  30408. }
  30409. };
  30410. var toString = object.toString;
  30411. var isArray = function(value) {
  30412. return toString.call(value) == '[object Array]';
  30413. };
  30414. var isObject = function(value) {
  30415. // This is a very simple check, but it’s good enough for what we need.
  30416. return toString.call(value) == '[object Object]';
  30417. };
  30418. var isString = function(value) {
  30419. return typeof value == 'string' ||
  30420. toString.call(value) == '[object String]';
  30421. };
  30422. var isNumber = function(value) {
  30423. return typeof value == 'number' ||
  30424. toString.call(value) == '[object Number]';
  30425. };
  30426. var isFunction = function(value) {
  30427. // In a perfect world, the `typeof` check would be sufficient. However,
  30428. // in Chrome 1–12, `typeof /x/ == 'object'`, and in IE 6–8
  30429. // `typeof alert == 'object'` and similar for other host objects.
  30430. return typeof value == 'function' ||
  30431. toString.call(value) == '[object Function]';
  30432. };
  30433. var isMap = function(value) {
  30434. return toString.call(value) == '[object Map]';
  30435. };
  30436. var isSet = function(value) {
  30437. return toString.call(value) == '[object Set]';
  30438. };
  30439. /*--------------------------------------------------------------------------*/
  30440. // https://mathiasbynens.be/notes/javascript-escapes#single
  30441. var singleEscapes = {
  30442. '"': '\\"',
  30443. '\'': '\\\'',
  30444. '\\': '\\\\',
  30445. '\b': '\\b',
  30446. '\f': '\\f',
  30447. '\n': '\\n',
  30448. '\r': '\\r',
  30449. '\t': '\\t'
  30450. // `\v` is omitted intentionally, because in IE < 9, '\v' == 'v'.
  30451. // '\v': '\\x0B'
  30452. };
  30453. var regexSingleEscape = /["'\\\b\f\n\r\t]/;
  30454. var regexDigit = /[0-9]/;
  30455. var regexWhitelist = /[ !#-&\(-\[\]-~]/;
  30456. var jsesc = function(argument, options) {
  30457. // Handle options
  30458. var defaults = {
  30459. 'escapeEverything': false,
  30460. 'escapeEtago': false,
  30461. 'quotes': 'single',
  30462. 'wrap': false,
  30463. 'es6': false,
  30464. 'json': false,
  30465. 'compact': true,
  30466. 'lowercaseHex': false,
  30467. 'numbers': 'decimal',
  30468. 'indent': '\t',
  30469. '__indent__': '',
  30470. '__inline1__': false,
  30471. '__inline2__': false
  30472. };
  30473. var json = options && options.json;
  30474. if (json) {
  30475. defaults.quotes = 'double';
  30476. defaults.wrap = true;
  30477. }
  30478. options = extend(defaults, options);
  30479. if (options.quotes != 'single' && options.quotes != 'double') {
  30480. options.quotes = 'single';
  30481. }
  30482. var quote = options.quotes == 'double' ? '"' : '\'';
  30483. var compact = options.compact;
  30484. var indent = options.indent;
  30485. var lowercaseHex = options.lowercaseHex;
  30486. var oldIndent = '';
  30487. var inline1 = options.__inline1__;
  30488. var inline2 = options.__inline2__;
  30489. var newLine = compact ? '' : '\n';
  30490. var result;
  30491. var isEmpty = true;
  30492. var useBinNumbers = options.numbers == 'binary';
  30493. var useOctNumbers = options.numbers == 'octal';
  30494. var useDecNumbers = options.numbers == 'decimal';
  30495. var useHexNumbers = options.numbers == 'hexadecimal';
  30496. if (json && argument && isFunction(argument.toJSON)) {
  30497. argument = argument.toJSON();
  30498. }
  30499. if (!isString(argument)) {
  30500. if (isMap(argument)) {
  30501. if (argument.size == 0) {
  30502. return 'new Map()';
  30503. }
  30504. if (!compact) {
  30505. options.__inline1__ = true;
  30506. }
  30507. return 'new Map(' + jsesc(Array.from(argument), options) + ')';
  30508. }
  30509. if (isSet(argument)) {
  30510. if (argument.size == 0) {
  30511. return 'new Set()';
  30512. }
  30513. return 'new Set(' + jsesc(Array.from(argument), options) + ')';
  30514. }
  30515. if (isArray(argument)) {
  30516. result = [];
  30517. options.wrap = true;
  30518. if (inline1) {
  30519. options.__inline1__ = false;
  30520. options.__inline2__ = true;
  30521. } else {
  30522. oldIndent = options.__indent__;
  30523. indent += oldIndent;
  30524. options.__indent__ = indent;
  30525. }
  30526. forEach(argument, function(value) {
  30527. isEmpty = false;
  30528. if (inline2) {
  30529. options.__inline2__ = false;
  30530. }
  30531. result.push(
  30532. (compact || inline2 ? '' : indent) +
  30533. jsesc(value, options)
  30534. );
  30535. });
  30536. if (isEmpty) {
  30537. return '[]';
  30538. }
  30539. if (inline2) {
  30540. return '[' + result.join(', ') + ']';
  30541. }
  30542. return '[' + newLine + result.join(',' + newLine) + newLine +
  30543. (compact ? '' : oldIndent) + ']';
  30544. } else if (isNumber(argument)) {
  30545. if (json) {
  30546. // Some number values (e.g. `Infinity`) cannot be represented in JSON.
  30547. return JSON.stringify(argument);
  30548. }
  30549. if (useDecNumbers) {
  30550. return String(argument);
  30551. }
  30552. if (useHexNumbers) {
  30553. var tmp = argument.toString(16);
  30554. if (!lowercaseHex) {
  30555. tmp = tmp.toUpperCase();
  30556. }
  30557. return '0x' + tmp;
  30558. }
  30559. if (useBinNumbers) {
  30560. return '0b' + argument.toString(2);
  30561. }
  30562. if (useOctNumbers) {
  30563. return '0o' + argument.toString(8);
  30564. }
  30565. } else if (!isObject(argument)) {
  30566. if (json) {
  30567. // For some values (e.g. `undefined`, `function` objects),
  30568. // `JSON.stringify(value)` returns `undefined` (which isn’t valid
  30569. // JSON) instead of `'null'`.
  30570. return JSON.stringify(argument) || 'null';
  30571. }
  30572. return String(argument);
  30573. } else { // it’s an object
  30574. result = [];
  30575. options.wrap = true;
  30576. oldIndent = options.__indent__;
  30577. indent += oldIndent;
  30578. options.__indent__ = indent;
  30579. forOwn(argument, function(key, value) {
  30580. isEmpty = false;
  30581. result.push(
  30582. (compact ? '' : indent) +
  30583. jsesc(key, options) + ':' +
  30584. (compact ? '' : ' ') +
  30585. jsesc(value, options)
  30586. );
  30587. });
  30588. if (isEmpty) {
  30589. return '{}';
  30590. }
  30591. return '{' + newLine + result.join(',' + newLine) + newLine +
  30592. (compact ? '' : oldIndent) + '}';
  30593. }
  30594. }
  30595. var string = argument;
  30596. // Loop over each code unit in the string and escape it
  30597. var index = -1;
  30598. var length = string.length;
  30599. var first;
  30600. var second;
  30601. var codePoint;
  30602. result = '';
  30603. while (++index < length) {
  30604. var character = string.charAt(index);
  30605. if (options.es6) {
  30606. first = string.charCodeAt(index);
  30607. if ( // check if it’s the start of a surrogate pair
  30608. first >= 0xD800 && first <= 0xDBFF && // high surrogate
  30609. length > index + 1 // there is a next code unit
  30610. ) {
  30611. second = string.charCodeAt(index + 1);
  30612. if (second >= 0xDC00 && second <= 0xDFFF) { // low surrogate
  30613. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  30614. codePoint = (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
  30615. var hexadecimal = codePoint.toString(16);
  30616. if (!lowercaseHex) {
  30617. hexadecimal = hexadecimal.toUpperCase();
  30618. }
  30619. result += '\\u{' + hexadecimal + '}';
  30620. index++;
  30621. continue;
  30622. }
  30623. }
  30624. }
  30625. if (!options.escapeEverything) {
  30626. if (regexWhitelist.test(character)) {
  30627. // It’s a printable ASCII character that is not `"`, `'` or `\`,
  30628. // so don’t escape it.
  30629. result += character;
  30630. continue;
  30631. }
  30632. if (character == '"') {
  30633. result += quote == character ? '\\"' : character;
  30634. continue;
  30635. }
  30636. if (character == '\'') {
  30637. result += quote == character ? '\\\'' : character;
  30638. continue;
  30639. }
  30640. }
  30641. if (
  30642. character == '\0' &&
  30643. !json &&
  30644. !regexDigit.test(string.charAt(index + 1))
  30645. ) {
  30646. result += '\\0';
  30647. continue;
  30648. }
  30649. if (regexSingleEscape.test(character)) {
  30650. // no need for a `hasOwnProperty` check here
  30651. result += singleEscapes[character];
  30652. continue;
  30653. }
  30654. var charCode = character.charCodeAt(0);
  30655. var hexadecimal = charCode.toString(16);
  30656. if (!lowercaseHex) {
  30657. hexadecimal = hexadecimal.toUpperCase();
  30658. }
  30659. var longhand = hexadecimal.length > 2 || json;
  30660. var escaped = '\\' + (longhand ? 'u' : 'x') +
  30661. ('0000' + hexadecimal).slice(longhand ? -4 : -2);
  30662. result += escaped;
  30663. continue;
  30664. }
  30665. if (options.wrap) {
  30666. result = quote + result + quote;
  30667. }
  30668. if (options.escapeEtago) {
  30669. // https://mathiasbynens.be/notes/etago
  30670. return result.replace(/<\/(script|style)/gi, '<\\/$1');
  30671. }
  30672. return result;
  30673. };
  30674. jsesc.version = '1.3.0';
  30675. /*--------------------------------------------------------------------------*/
  30676. // Some AMD build optimizers, like r.js, check for specific condition patterns
  30677. // like the following:
  30678. if (
  30679. typeof define == 'function' &&
  30680. typeof define.amd == 'object' &&
  30681. define.amd
  30682. ) {
  30683. define(function() {
  30684. return jsesc;
  30685. });
  30686. } else if (freeExports && !freeExports.nodeType) {
  30687. if (freeModule) { // in Node.js or RingoJS v0.8.0+
  30688. freeModule.exports = jsesc;
  30689. } else { // in Narwhal or RingoJS v0.7.0-
  30690. freeExports.jsesc = jsesc;
  30691. }
  30692. } else { // in Rhino or a web browser
  30693. root.jsesc = jsesc;
  30694. }
  30695. }(this));
  30696. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  30697. },{}],297:[function(require,module,exports){
  30698. // json5.js
  30699. // Modern JSON. See README.md for details.
  30700. //
  30701. // This file is based directly off of Douglas Crockford's json_parse.js:
  30702. // https://github.com/douglascrockford/JSON-js/blob/master/json_parse.js
  30703. var JSON5 = (typeof exports === 'object' ? exports : {});
  30704. JSON5.parse = (function () {
  30705. "use strict";
  30706. // This is a function that can parse a JSON5 text, producing a JavaScript
  30707. // data structure. It is a simple, recursive descent parser. It does not use
  30708. // eval or regular expressions, so it can be used as a model for implementing
  30709. // a JSON5 parser in other languages.
  30710. // We are defining the function inside of another function to avoid creating
  30711. // global variables.
  30712. var at, // The index of the current character
  30713. lineNumber, // The current line number
  30714. columnNumber, // The current column number
  30715. ch, // The current character
  30716. escapee = {
  30717. "'": "'",
  30718. '"': '"',
  30719. '\\': '\\',
  30720. '/': '/',
  30721. '\n': '', // Replace escaped newlines in strings w/ empty string
  30722. b: '\b',
  30723. f: '\f',
  30724. n: '\n',
  30725. r: '\r',
  30726. t: '\t'
  30727. },
  30728. ws = [
  30729. ' ',
  30730. '\t',
  30731. '\r',
  30732. '\n',
  30733. '\v',
  30734. '\f',
  30735. '\xA0',
  30736. '\uFEFF'
  30737. ],
  30738. text,
  30739. renderChar = function (chr) {
  30740. return chr === '' ? 'EOF' : "'" + chr + "'";
  30741. },
  30742. error = function (m) {
  30743. // Call error when something is wrong.
  30744. var error = new SyntaxError();
  30745. // 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
  30746. error.message = m + " at line " + lineNumber + " column " + columnNumber + " of the JSON5 data. Still to read: " + JSON.stringify(text.substring(at - 1, at + 19));
  30747. error.at = at;
  30748. // These two property names have been chosen to agree with the ones in Gecko, the only popular
  30749. // environment which seems to supply this info on JSON.parse
  30750. error.lineNumber = lineNumber;
  30751. error.columnNumber = columnNumber;
  30752. throw error;
  30753. },
  30754. next = function (c) {
  30755. // If a c parameter is provided, verify that it matches the current character.
  30756. if (c && c !== ch) {
  30757. error("Expected " + renderChar(c) + " instead of " + renderChar(ch));
  30758. }
  30759. // Get the next character. When there are no more characters,
  30760. // return the empty string.
  30761. ch = text.charAt(at);
  30762. at++;
  30763. columnNumber++;
  30764. if (ch === '\n' || ch === '\r' && peek() !== '\n') {
  30765. lineNumber++;
  30766. columnNumber = 0;
  30767. }
  30768. return ch;
  30769. },
  30770. peek = function () {
  30771. // Get the next character without consuming it or
  30772. // assigning it to the ch varaible.
  30773. return text.charAt(at);
  30774. },
  30775. identifier = function () {
  30776. // Parse an identifier. Normally, reserved words are disallowed here, but we
  30777. // only use this for unquoted object keys, where reserved words are allowed,
  30778. // so we don't check for those here. References:
  30779. // - http://es5.github.com/#x7.6
  30780. // - https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Core_Language_Features#Variables
  30781. // - http://docstore.mik.ua/orelly/webprog/jscript/ch02_07.htm
  30782. // TODO Identifiers can have Unicode "letters" in them; add support for those.
  30783. var key = ch;
  30784. // Identifiers must start with a letter, _ or $.
  30785. if ((ch !== '_' && ch !== '$') &&
  30786. (ch < 'a' || ch > 'z') &&
  30787. (ch < 'A' || ch > 'Z')) {
  30788. error("Bad identifier as unquoted key");
  30789. }
  30790. // Subsequent characters can contain digits.
  30791. while (next() && (
  30792. ch === '_' || ch === '$' ||
  30793. (ch >= 'a' && ch <= 'z') ||
  30794. (ch >= 'A' && ch <= 'Z') ||
  30795. (ch >= '0' && ch <= '9'))) {
  30796. key += ch;
  30797. }
  30798. return key;
  30799. },
  30800. number = function () {
  30801. // Parse a number value.
  30802. var number,
  30803. sign = '',
  30804. string = '',
  30805. base = 10;
  30806. if (ch === '-' || ch === '+') {
  30807. sign = ch;
  30808. next(ch);
  30809. }
  30810. // support for Infinity (could tweak to allow other words):
  30811. if (ch === 'I') {
  30812. number = word();
  30813. if (typeof number !== 'number' || isNaN(number)) {
  30814. error('Unexpected word for number');
  30815. }
  30816. return (sign === '-') ? -number : number;
  30817. }
  30818. // support for NaN
  30819. if (ch === 'N' ) {
  30820. number = word();
  30821. if (!isNaN(number)) {
  30822. error('expected word to be NaN');
  30823. }
  30824. // ignore sign as -NaN also is NaN
  30825. return number;
  30826. }
  30827. if (ch === '0') {
  30828. string += ch;
  30829. next();
  30830. if (ch === 'x' || ch === 'X') {
  30831. string += ch;
  30832. next();
  30833. base = 16;
  30834. } else if (ch >= '0' && ch <= '9') {
  30835. error('Octal literal');
  30836. }
  30837. }
  30838. switch (base) {
  30839. case 10:
  30840. while (ch >= '0' && ch <= '9' ) {
  30841. string += ch;
  30842. next();
  30843. }
  30844. if (ch === '.') {
  30845. string += '.';
  30846. while (next() && ch >= '0' && ch <= '9') {
  30847. string += ch;
  30848. }
  30849. }
  30850. if (ch === 'e' || ch === 'E') {
  30851. string += ch;
  30852. next();
  30853. if (ch === '-' || ch === '+') {
  30854. string += ch;
  30855. next();
  30856. }
  30857. while (ch >= '0' && ch <= '9') {
  30858. string += ch;
  30859. next();
  30860. }
  30861. }
  30862. break;
  30863. case 16:
  30864. while (ch >= '0' && ch <= '9' || ch >= 'A' && ch <= 'F' || ch >= 'a' && ch <= 'f') {
  30865. string += ch;
  30866. next();
  30867. }
  30868. break;
  30869. }
  30870. if(sign === '-') {
  30871. number = -string;
  30872. } else {
  30873. number = +string;
  30874. }
  30875. if (!isFinite(number)) {
  30876. error("Bad number");
  30877. } else {
  30878. return number;
  30879. }
  30880. },
  30881. string = function () {
  30882. // Parse a string value.
  30883. var hex,
  30884. i,
  30885. string = '',
  30886. delim, // double quote or single quote
  30887. uffff;
  30888. // When parsing for string values, we must look for ' or " and \ characters.
  30889. if (ch === '"' || ch === "'") {
  30890. delim = ch;
  30891. while (next()) {
  30892. if (ch === delim) {
  30893. next();
  30894. return string;
  30895. } else if (ch === '\\') {
  30896. next();
  30897. if (ch === 'u') {
  30898. uffff = 0;
  30899. for (i = 0; i < 4; i += 1) {
  30900. hex = parseInt(next(), 16);
  30901. if (!isFinite(hex)) {
  30902. break;
  30903. }
  30904. uffff = uffff * 16 + hex;
  30905. }
  30906. string += String.fromCharCode(uffff);
  30907. } else if (ch === '\r') {
  30908. if (peek() === '\n') {
  30909. next();
  30910. }
  30911. } else if (typeof escapee[ch] === 'string') {
  30912. string += escapee[ch];
  30913. } else {
  30914. break;
  30915. }
  30916. } else if (ch === '\n') {
  30917. // unescaped newlines are invalid; see:
  30918. // https://github.com/aseemk/json5/issues/24
  30919. // TODO this feels special-cased; are there other
  30920. // invalid unescaped chars?
  30921. break;
  30922. } else {
  30923. string += ch;
  30924. }
  30925. }
  30926. }
  30927. error("Bad string");
  30928. },
  30929. inlineComment = function () {
  30930. // Skip an inline comment, assuming this is one. The current character should
  30931. // be the second / character in the // pair that begins this inline comment.
  30932. // To finish the inline comment, we look for a newline or the end of the text.
  30933. if (ch !== '/') {
  30934. error("Not an inline comment");
  30935. }
  30936. do {
  30937. next();
  30938. if (ch === '\n' || ch === '\r') {
  30939. next();
  30940. return;
  30941. }
  30942. } while (ch);
  30943. },
  30944. blockComment = function () {
  30945. // Skip a block comment, assuming this is one. The current character should be
  30946. // the * character in the /* pair that begins this block comment.
  30947. // To finish the block comment, we look for an ending */ pair of characters,
  30948. // but we also watch for the end of text before the comment is terminated.
  30949. if (ch !== '*') {
  30950. error("Not a block comment");
  30951. }
  30952. do {
  30953. next();
  30954. while (ch === '*') {
  30955. next('*');
  30956. if (ch === '/') {
  30957. next('/');
  30958. return;
  30959. }
  30960. }
  30961. } while (ch);
  30962. error("Unterminated block comment");
  30963. },
  30964. comment = function () {
  30965. // Skip a comment, whether inline or block-level, assuming this is one.
  30966. // Comments always begin with a / character.
  30967. if (ch !== '/') {
  30968. error("Not a comment");
  30969. }
  30970. next('/');
  30971. if (ch === '/') {
  30972. inlineComment();
  30973. } else if (ch === '*') {
  30974. blockComment();
  30975. } else {
  30976. error("Unrecognized comment");
  30977. }
  30978. },
  30979. white = function () {
  30980. // Skip whitespace and comments.
  30981. // Note that we're detecting comments by only a single / character.
  30982. // This works since regular expressions are not valid JSON(5), but this will
  30983. // break if there are other valid values that begin with a / character!
  30984. while (ch) {
  30985. if (ch === '/') {
  30986. comment();
  30987. } else if (ws.indexOf(ch) >= 0) {
  30988. next();
  30989. } else {
  30990. return;
  30991. }
  30992. }
  30993. },
  30994. word = function () {
  30995. // true, false, or null.
  30996. switch (ch) {
  30997. case 't':
  30998. next('t');
  30999. next('r');
  31000. next('u');
  31001. next('e');
  31002. return true;
  31003. case 'f':
  31004. next('f');
  31005. next('a');
  31006. next('l');
  31007. next('s');
  31008. next('e');
  31009. return false;
  31010. case 'n':
  31011. next('n');
  31012. next('u');
  31013. next('l');
  31014. next('l');
  31015. return null;
  31016. case 'I':
  31017. next('I');
  31018. next('n');
  31019. next('f');
  31020. next('i');
  31021. next('n');
  31022. next('i');
  31023. next('t');
  31024. next('y');
  31025. return Infinity;
  31026. case 'N':
  31027. next( 'N' );
  31028. next( 'a' );
  31029. next( 'N' );
  31030. return NaN;
  31031. }
  31032. error("Unexpected " + renderChar(ch));
  31033. },
  31034. value, // Place holder for the value function.
  31035. array = function () {
  31036. // Parse an array value.
  31037. var array = [];
  31038. if (ch === '[') {
  31039. next('[');
  31040. white();
  31041. while (ch) {
  31042. if (ch === ']') {
  31043. next(']');
  31044. return array; // Potentially empty array
  31045. }
  31046. // ES5 allows omitting elements in arrays, e.g. [,] and
  31047. // [,null]. We don't allow this in JSON5.
  31048. if (ch === ',') {
  31049. error("Missing array element");
  31050. } else {
  31051. array.push(value());
  31052. }
  31053. white();
  31054. // If there's no comma after this value, this needs to
  31055. // be the end of the array.
  31056. if (ch !== ',') {
  31057. next(']');
  31058. return array;
  31059. }
  31060. next(',');
  31061. white();
  31062. }
  31063. }
  31064. error("Bad array");
  31065. },
  31066. object = function () {
  31067. // Parse an object value.
  31068. var key,
  31069. object = {};
  31070. if (ch === '{') {
  31071. next('{');
  31072. white();
  31073. while (ch) {
  31074. if (ch === '}') {
  31075. next('}');
  31076. return object; // Potentially empty object
  31077. }
  31078. // Keys can be unquoted. If they are, they need to be
  31079. // valid JS identifiers.
  31080. if (ch === '"' || ch === "'") {
  31081. key = string();
  31082. } else {
  31083. key = identifier();
  31084. }
  31085. white();
  31086. next(':');
  31087. object[key] = value();
  31088. white();
  31089. // If there's no comma after this pair, this needs to be
  31090. // the end of the object.
  31091. if (ch !== ',') {
  31092. next('}');
  31093. return object;
  31094. }
  31095. next(',');
  31096. white();
  31097. }
  31098. }
  31099. error("Bad object");
  31100. };
  31101. value = function () {
  31102. // Parse a JSON value. It could be an object, an array, a string, a number,
  31103. // or a word.
  31104. white();
  31105. switch (ch) {
  31106. case '{':
  31107. return object();
  31108. case '[':
  31109. return array();
  31110. case '"':
  31111. case "'":
  31112. return string();
  31113. case '-':
  31114. case '+':
  31115. case '.':
  31116. return number();
  31117. default:
  31118. return ch >= '0' && ch <= '9' ? number() : word();
  31119. }
  31120. };
  31121. // Return the json_parse function. It will have access to all of the above
  31122. // functions and variables.
  31123. return function (source, reviver) {
  31124. var result;
  31125. text = String(source);
  31126. at = 0;
  31127. lineNumber = 1;
  31128. columnNumber = 1;
  31129. ch = ' ';
  31130. result = value();
  31131. white();
  31132. if (ch) {
  31133. error("Syntax error");
  31134. }
  31135. // If there is a reviver function, we recursively walk the new structure,
  31136. // passing each name/value pair to the reviver function for possible
  31137. // transformation, starting with a temporary root object that holds the result
  31138. // in an empty key. If there is not a reviver function, we simply return the
  31139. // result.
  31140. return typeof reviver === 'function' ? (function walk(holder, key) {
  31141. var k, v, value = holder[key];
  31142. if (value && typeof value === 'object') {
  31143. for (k in value) {
  31144. if (Object.prototype.hasOwnProperty.call(value, k)) {
  31145. v = walk(value, k);
  31146. if (v !== undefined) {
  31147. value[k] = v;
  31148. } else {
  31149. delete value[k];
  31150. }
  31151. }
  31152. }
  31153. }
  31154. return reviver.call(holder, key, value);
  31155. }({'': result}, '')) : result;
  31156. };
  31157. }());
  31158. // JSON5 stringify will not quote keys where appropriate
  31159. JSON5.stringify = function (obj, replacer, space) {
  31160. if (replacer && (typeof(replacer) !== "function" && !isArray(replacer))) {
  31161. throw new Error('Replacer must be a function or an array');
  31162. }
  31163. var getReplacedValueOrUndefined = function(holder, key, isTopLevel) {
  31164. var value = holder[key];
  31165. // Replace the value with its toJSON value first, if possible
  31166. if (value && value.toJSON && typeof value.toJSON === "function") {
  31167. value = value.toJSON();
  31168. }
  31169. // If the user-supplied replacer if a function, call it. If it's an array, check objects' string keys for
  31170. // presence in the array (removing the key/value pair from the resulting JSON if the key is missing).
  31171. if (typeof(replacer) === "function") {
  31172. return replacer.call(holder, key, value);
  31173. } else if(replacer) {
  31174. if (isTopLevel || isArray(holder) || replacer.indexOf(key) >= 0) {
  31175. return value;
  31176. } else {
  31177. return undefined;
  31178. }
  31179. } else {
  31180. return value;
  31181. }
  31182. };
  31183. function isWordChar(c) {
  31184. return (c >= 'a' && c <= 'z') ||
  31185. (c >= 'A' && c <= 'Z') ||
  31186. (c >= '0' && c <= '9') ||
  31187. c === '_' || c === '$';
  31188. }
  31189. function isWordStart(c) {
  31190. return (c >= 'a' && c <= 'z') ||
  31191. (c >= 'A' && c <= 'Z') ||
  31192. c === '_' || c === '$';
  31193. }
  31194. function isWord(key) {
  31195. if (typeof key !== 'string') {
  31196. return false;
  31197. }
  31198. if (!isWordStart(key[0])) {
  31199. return false;
  31200. }
  31201. var i = 1, length = key.length;
  31202. while (i < length) {
  31203. if (!isWordChar(key[i])) {
  31204. return false;
  31205. }
  31206. i++;
  31207. }
  31208. return true;
  31209. }
  31210. // export for use in tests
  31211. JSON5.isWord = isWord;
  31212. // polyfills
  31213. function isArray(obj) {
  31214. if (Array.isArray) {
  31215. return Array.isArray(obj);
  31216. } else {
  31217. return Object.prototype.toString.call(obj) === '[object Array]';
  31218. }
  31219. }
  31220. function isDate(obj) {
  31221. return Object.prototype.toString.call(obj) === '[object Date]';
  31222. }
  31223. var objStack = [];
  31224. function checkForCircular(obj) {
  31225. for (var i = 0; i < objStack.length; i++) {
  31226. if (objStack[i] === obj) {
  31227. throw new TypeError("Converting circular structure to JSON");
  31228. }
  31229. }
  31230. }
  31231. function makeIndent(str, num, noNewLine) {
  31232. if (!str) {
  31233. return "";
  31234. }
  31235. // indentation no more than 10 chars
  31236. if (str.length > 10) {
  31237. str = str.substring(0, 10);
  31238. }
  31239. var indent = noNewLine ? "" : "\n";
  31240. for (var i = 0; i < num; i++) {
  31241. indent += str;
  31242. }
  31243. return indent;
  31244. }
  31245. var indentStr;
  31246. if (space) {
  31247. if (typeof space === "string") {
  31248. indentStr = space;
  31249. } else if (typeof space === "number" && space >= 0) {
  31250. indentStr = makeIndent(" ", space, true);
  31251. } else {
  31252. // ignore space parameter
  31253. }
  31254. }
  31255. // Copied from Crokford's implementation of JSON
  31256. // See https://github.com/douglascrockford/JSON-js/blob/e39db4b7e6249f04a195e7dd0840e610cc9e941e/json2.js#L195
  31257. // Begin
  31258. var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
  31259. escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
  31260. meta = { // table of character substitutions
  31261. '\b': '\\b',
  31262. '\t': '\\t',
  31263. '\n': '\\n',
  31264. '\f': '\\f',
  31265. '\r': '\\r',
  31266. '"' : '\\"',
  31267. '\\': '\\\\'
  31268. };
  31269. function escapeString(string) {
  31270. // If the string contains no control characters, no quote characters, and no
  31271. // backslash characters, then we can safely slap some quotes around it.
  31272. // Otherwise we must also replace the offending characters with safe escape
  31273. // sequences.
  31274. escapable.lastIndex = 0;
  31275. return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
  31276. var c = meta[a];
  31277. return typeof c === 'string' ?
  31278. c :
  31279. '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
  31280. }) + '"' : '"' + string + '"';
  31281. }
  31282. // End
  31283. function internalStringify(holder, key, isTopLevel) {
  31284. var buffer, res;
  31285. // Replace the value, if necessary
  31286. var obj_part = getReplacedValueOrUndefined(holder, key, isTopLevel);
  31287. if (obj_part && !isDate(obj_part)) {
  31288. // unbox objects
  31289. // don't unbox dates, since will turn it into number
  31290. obj_part = obj_part.valueOf();
  31291. }
  31292. switch(typeof obj_part) {
  31293. case "boolean":
  31294. return obj_part.toString();
  31295. case "number":
  31296. if (isNaN(obj_part) || !isFinite(obj_part)) {
  31297. return "null";
  31298. }
  31299. return obj_part.toString();
  31300. case "string":
  31301. return escapeString(obj_part.toString());
  31302. case "object":
  31303. if (obj_part === null) {
  31304. return "null";
  31305. } else if (isArray(obj_part)) {
  31306. checkForCircular(obj_part);
  31307. buffer = "[";
  31308. objStack.push(obj_part);
  31309. for (var i = 0; i < obj_part.length; i++) {
  31310. res = internalStringify(obj_part, i, false);
  31311. buffer += makeIndent(indentStr, objStack.length);
  31312. if (res === null || typeof res === "undefined") {
  31313. buffer += "null";
  31314. } else {
  31315. buffer += res;
  31316. }
  31317. if (i < obj_part.length-1) {
  31318. buffer += ",";
  31319. } else if (indentStr) {
  31320. buffer += "\n";
  31321. }
  31322. }
  31323. objStack.pop();
  31324. if (obj_part.length) {
  31325. buffer += makeIndent(indentStr, objStack.length, true)
  31326. }
  31327. buffer += "]";
  31328. } else {
  31329. checkForCircular(obj_part);
  31330. buffer = "{";
  31331. var nonEmpty = false;
  31332. objStack.push(obj_part);
  31333. for (var prop in obj_part) {
  31334. if (obj_part.hasOwnProperty(prop)) {
  31335. var value = internalStringify(obj_part, prop, false);
  31336. isTopLevel = false;
  31337. if (typeof value !== "undefined" && value !== null) {
  31338. buffer += makeIndent(indentStr, objStack.length);
  31339. nonEmpty = true;
  31340. key = isWord(prop) ? prop : escapeString(prop);
  31341. buffer += key + ":" + (indentStr ? ' ' : '') + value + ",";
  31342. }
  31343. }
  31344. }
  31345. objStack.pop();
  31346. if (nonEmpty) {
  31347. buffer = buffer.substring(0, buffer.length-1) + makeIndent(indentStr, objStack.length) + "}";
  31348. } else {
  31349. buffer = '{}';
  31350. }
  31351. }
  31352. return buffer;
  31353. default:
  31354. // functions and undefined should be ignored
  31355. return undefined;
  31356. }
  31357. }
  31358. // special case...when undefined is used inside of
  31359. // a compound object/array, return null.
  31360. // but when top-level, return undefined
  31361. var topLevelHolder = {"":obj};
  31362. if (obj === undefined) {
  31363. return getReplacedValueOrUndefined(topLevelHolder, '', true);
  31364. }
  31365. return internalStringify(topLevelHolder, '', true);
  31366. };
  31367. },{}],298:[function(require,module,exports){
  31368. var getNative = require('./_getNative'),
  31369. root = require('./_root');
  31370. /* Built-in method references that are verified to be native. */
  31371. var DataView = getNative(root, 'DataView');
  31372. module.exports = DataView;
  31373. },{"./_getNative":404,"./_root":448}],299:[function(require,module,exports){
  31374. var hashClear = require('./_hashClear'),
  31375. hashDelete = require('./_hashDelete'),
  31376. hashGet = require('./_hashGet'),
  31377. hashHas = require('./_hashHas'),
  31378. hashSet = require('./_hashSet');
  31379. /**
  31380. * Creates a hash object.
  31381. *
  31382. * @private
  31383. * @constructor
  31384. * @param {Array} [entries] The key-value pairs to cache.
  31385. */
  31386. function Hash(entries) {
  31387. var index = -1,
  31388. length = entries == null ? 0 : entries.length;
  31389. this.clear();
  31390. while (++index < length) {
  31391. var entry = entries[index];
  31392. this.set(entry[0], entry[1]);
  31393. }
  31394. }
  31395. // Add methods to `Hash`.
  31396. Hash.prototype.clear = hashClear;
  31397. Hash.prototype['delete'] = hashDelete;
  31398. Hash.prototype.get = hashGet;
  31399. Hash.prototype.has = hashHas;
  31400. Hash.prototype.set = hashSet;
  31401. module.exports = Hash;
  31402. },{"./_hashClear":412,"./_hashDelete":413,"./_hashGet":414,"./_hashHas":415,"./_hashSet":416}],300:[function(require,module,exports){
  31403. var listCacheClear = require('./_listCacheClear'),
  31404. listCacheDelete = require('./_listCacheDelete'),
  31405. listCacheGet = require('./_listCacheGet'),
  31406. listCacheHas = require('./_listCacheHas'),
  31407. listCacheSet = require('./_listCacheSet');
  31408. /**
  31409. * Creates an list cache object.
  31410. *
  31411. * @private
  31412. * @constructor
  31413. * @param {Array} [entries] The key-value pairs to cache.
  31414. */
  31415. function ListCache(entries) {
  31416. var index = -1,
  31417. length = entries == null ? 0 : entries.length;
  31418. this.clear();
  31419. while (++index < length) {
  31420. var entry = entries[index];
  31421. this.set(entry[0], entry[1]);
  31422. }
  31423. }
  31424. // Add methods to `ListCache`.
  31425. ListCache.prototype.clear = listCacheClear;
  31426. ListCache.prototype['delete'] = listCacheDelete;
  31427. ListCache.prototype.get = listCacheGet;
  31428. ListCache.prototype.has = listCacheHas;
  31429. ListCache.prototype.set = listCacheSet;
  31430. module.exports = ListCache;
  31431. },{"./_listCacheClear":428,"./_listCacheDelete":429,"./_listCacheGet":430,"./_listCacheHas":431,"./_listCacheSet":432}],301:[function(require,module,exports){
  31432. var getNative = require('./_getNative'),
  31433. root = require('./_root');
  31434. /* Built-in method references that are verified to be native. */
  31435. var Map = getNative(root, 'Map');
  31436. module.exports = Map;
  31437. },{"./_getNative":404,"./_root":448}],302:[function(require,module,exports){
  31438. var mapCacheClear = require('./_mapCacheClear'),
  31439. mapCacheDelete = require('./_mapCacheDelete'),
  31440. mapCacheGet = require('./_mapCacheGet'),
  31441. mapCacheHas = require('./_mapCacheHas'),
  31442. mapCacheSet = require('./_mapCacheSet');
  31443. /**
  31444. * Creates a map cache object to store key-value pairs.
  31445. *
  31446. * @private
  31447. * @constructor
  31448. * @param {Array} [entries] The key-value pairs to cache.
  31449. */
  31450. function MapCache(entries) {
  31451. var index = -1,
  31452. length = entries == null ? 0 : entries.length;
  31453. this.clear();
  31454. while (++index < length) {
  31455. var entry = entries[index];
  31456. this.set(entry[0], entry[1]);
  31457. }
  31458. }
  31459. // Add methods to `MapCache`.
  31460. MapCache.prototype.clear = mapCacheClear;
  31461. MapCache.prototype['delete'] = mapCacheDelete;
  31462. MapCache.prototype.get = mapCacheGet;
  31463. MapCache.prototype.has = mapCacheHas;
  31464. MapCache.prototype.set = mapCacheSet;
  31465. module.exports = MapCache;
  31466. },{"./_mapCacheClear":433,"./_mapCacheDelete":434,"./_mapCacheGet":435,"./_mapCacheHas":436,"./_mapCacheSet":437}],303:[function(require,module,exports){
  31467. var getNative = require('./_getNative'),
  31468. root = require('./_root');
  31469. /* Built-in method references that are verified to be native. */
  31470. var Promise = getNative(root, 'Promise');
  31471. module.exports = Promise;
  31472. },{"./_getNative":404,"./_root":448}],304:[function(require,module,exports){
  31473. var getNative = require('./_getNative'),
  31474. root = require('./_root');
  31475. /* Built-in method references that are verified to be native. */
  31476. var Set = getNative(root, 'Set');
  31477. module.exports = Set;
  31478. },{"./_getNative":404,"./_root":448}],305:[function(require,module,exports){
  31479. var MapCache = require('./_MapCache'),
  31480. setCacheAdd = require('./_setCacheAdd'),
  31481. setCacheHas = require('./_setCacheHas');
  31482. /**
  31483. *
  31484. * Creates an array cache object to store unique values.
  31485. *
  31486. * @private
  31487. * @constructor
  31488. * @param {Array} [values] The values to cache.
  31489. */
  31490. function SetCache(values) {
  31491. var index = -1,
  31492. length = values == null ? 0 : values.length;
  31493. this.__data__ = new MapCache;
  31494. while (++index < length) {
  31495. this.add(values[index]);
  31496. }
  31497. }
  31498. // Add methods to `SetCache`.
  31499. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  31500. SetCache.prototype.has = setCacheHas;
  31501. module.exports = SetCache;
  31502. },{"./_MapCache":302,"./_setCacheAdd":449,"./_setCacheHas":450}],306:[function(require,module,exports){
  31503. var ListCache = require('./_ListCache'),
  31504. stackClear = require('./_stackClear'),
  31505. stackDelete = require('./_stackDelete'),
  31506. stackGet = require('./_stackGet'),
  31507. stackHas = require('./_stackHas'),
  31508. stackSet = require('./_stackSet');
  31509. /**
  31510. * Creates a stack cache object to store key-value pairs.
  31511. *
  31512. * @private
  31513. * @constructor
  31514. * @param {Array} [entries] The key-value pairs to cache.
  31515. */
  31516. function Stack(entries) {
  31517. var data = this.__data__ = new ListCache(entries);
  31518. this.size = data.size;
  31519. }
  31520. // Add methods to `Stack`.
  31521. Stack.prototype.clear = stackClear;
  31522. Stack.prototype['delete'] = stackDelete;
  31523. Stack.prototype.get = stackGet;
  31524. Stack.prototype.has = stackHas;
  31525. Stack.prototype.set = stackSet;
  31526. module.exports = Stack;
  31527. },{"./_ListCache":300,"./_stackClear":454,"./_stackDelete":455,"./_stackGet":456,"./_stackHas":457,"./_stackSet":458}],307:[function(require,module,exports){
  31528. var root = require('./_root');
  31529. /** Built-in value references. */
  31530. var Symbol = root.Symbol;
  31531. module.exports = Symbol;
  31532. },{"./_root":448}],308:[function(require,module,exports){
  31533. var root = require('./_root');
  31534. /** Built-in value references. */
  31535. var Uint8Array = root.Uint8Array;
  31536. module.exports = Uint8Array;
  31537. },{"./_root":448}],309:[function(require,module,exports){
  31538. var getNative = require('./_getNative'),
  31539. root = require('./_root');
  31540. /* Built-in method references that are verified to be native. */
  31541. var WeakMap = getNative(root, 'WeakMap');
  31542. module.exports = WeakMap;
  31543. },{"./_getNative":404,"./_root":448}],310:[function(require,module,exports){
  31544. /**
  31545. * Adds the key-value `pair` to `map`.
  31546. *
  31547. * @private
  31548. * @param {Object} map The map to modify.
  31549. * @param {Array} pair The key-value pair to add.
  31550. * @returns {Object} Returns `map`.
  31551. */
  31552. function addMapEntry(map, pair) {
  31553. // Don't return `map.set` because it's not chainable in IE 11.
  31554. map.set(pair[0], pair[1]);
  31555. return map;
  31556. }
  31557. module.exports = addMapEntry;
  31558. },{}],311:[function(require,module,exports){
  31559. /**
  31560. * Adds `value` to `set`.
  31561. *
  31562. * @private
  31563. * @param {Object} set The set to modify.
  31564. * @param {*} value The value to add.
  31565. * @returns {Object} Returns `set`.
  31566. */
  31567. function addSetEntry(set, value) {
  31568. // Don't return `set.add` because it's not chainable in IE 11.
  31569. set.add(value);
  31570. return set;
  31571. }
  31572. module.exports = addSetEntry;
  31573. },{}],312:[function(require,module,exports){
  31574. /**
  31575. * A faster alternative to `Function#apply`, this function invokes `func`
  31576. * with the `this` binding of `thisArg` and the arguments of `args`.
  31577. *
  31578. * @private
  31579. * @param {Function} func The function to invoke.
  31580. * @param {*} thisArg The `this` binding of `func`.
  31581. * @param {Array} args The arguments to invoke `func` with.
  31582. * @returns {*} Returns the result of `func`.
  31583. */
  31584. function apply(func, thisArg, args) {
  31585. switch (args.length) {
  31586. case 0: return func.call(thisArg);
  31587. case 1: return func.call(thisArg, args[0]);
  31588. case 2: return func.call(thisArg, args[0], args[1]);
  31589. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  31590. }
  31591. return func.apply(thisArg, args);
  31592. }
  31593. module.exports = apply;
  31594. },{}],313:[function(require,module,exports){
  31595. /**
  31596. * A specialized version of `_.forEach` for arrays without support for
  31597. * iteratee shorthands.
  31598. *
  31599. * @private
  31600. * @param {Array} [array] The array to iterate over.
  31601. * @param {Function} iteratee The function invoked per iteration.
  31602. * @returns {Array} Returns `array`.
  31603. */
  31604. function arrayEach(array, iteratee) {
  31605. var index = -1,
  31606. length = array == null ? 0 : array.length;
  31607. while (++index < length) {
  31608. if (iteratee(array[index], index, array) === false) {
  31609. break;
  31610. }
  31611. }
  31612. return array;
  31613. }
  31614. module.exports = arrayEach;
  31615. },{}],314:[function(require,module,exports){
  31616. /**
  31617. * A specialized version of `_.filter` for arrays without support for
  31618. * iteratee shorthands.
  31619. *
  31620. * @private
  31621. * @param {Array} [array] The array to iterate over.
  31622. * @param {Function} predicate The function invoked per iteration.
  31623. * @returns {Array} Returns the new filtered array.
  31624. */
  31625. function arrayFilter(array, predicate) {
  31626. var index = -1,
  31627. length = array == null ? 0 : array.length,
  31628. resIndex = 0,
  31629. result = [];
  31630. while (++index < length) {
  31631. var value = array[index];
  31632. if (predicate(value, index, array)) {
  31633. result[resIndex++] = value;
  31634. }
  31635. }
  31636. return result;
  31637. }
  31638. module.exports = arrayFilter;
  31639. },{}],315:[function(require,module,exports){
  31640. var baseIndexOf = require('./_baseIndexOf');
  31641. /**
  31642. * A specialized version of `_.includes` for arrays without support for
  31643. * specifying an index to search from.
  31644. *
  31645. * @private
  31646. * @param {Array} [array] The array to inspect.
  31647. * @param {*} target The value to search for.
  31648. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  31649. */
  31650. function arrayIncludes(array, value) {
  31651. var length = array == null ? 0 : array.length;
  31652. return !!length && baseIndexOf(array, value, 0) > -1;
  31653. }
  31654. module.exports = arrayIncludes;
  31655. },{"./_baseIndexOf":341}],316:[function(require,module,exports){
  31656. /**
  31657. * This function is like `arrayIncludes` except that it accepts a comparator.
  31658. *
  31659. * @private
  31660. * @param {Array} [array] The array to inspect.
  31661. * @param {*} target The value to search for.
  31662. * @param {Function} comparator The comparator invoked per element.
  31663. * @returns {boolean} Returns `true` if `target` is found, else `false`.
  31664. */
  31665. function arrayIncludesWith(array, value, comparator) {
  31666. var index = -1,
  31667. length = array == null ? 0 : array.length;
  31668. while (++index < length) {
  31669. if (comparator(value, array[index])) {
  31670. return true;
  31671. }
  31672. }
  31673. return false;
  31674. }
  31675. module.exports = arrayIncludesWith;
  31676. },{}],317:[function(require,module,exports){
  31677. var baseTimes = require('./_baseTimes'),
  31678. isArguments = require('./isArguments'),
  31679. isArray = require('./isArray'),
  31680. isBuffer = require('./isBuffer'),
  31681. isIndex = require('./_isIndex'),
  31682. isTypedArray = require('./isTypedArray');
  31683. /** Used for built-in method references. */
  31684. var objectProto = Object.prototype;
  31685. /** Used to check objects for own properties. */
  31686. var hasOwnProperty = objectProto.hasOwnProperty;
  31687. /**
  31688. * Creates an array of the enumerable property names of the array-like `value`.
  31689. *
  31690. * @private
  31691. * @param {*} value The value to query.
  31692. * @param {boolean} inherited Specify returning inherited property names.
  31693. * @returns {Array} Returns the array of property names.
  31694. */
  31695. function arrayLikeKeys(value, inherited) {
  31696. var isArr = isArray(value),
  31697. isArg = !isArr && isArguments(value),
  31698. isBuff = !isArr && !isArg && isBuffer(value),
  31699. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  31700. skipIndexes = isArr || isArg || isBuff || isType,
  31701. result = skipIndexes ? baseTimes(value.length, String) : [],
  31702. length = result.length;
  31703. for (var key in value) {
  31704. if ((inherited || hasOwnProperty.call(value, key)) &&
  31705. !(skipIndexes && (
  31706. // Safari 9 has enumerable `arguments.length` in strict mode.
  31707. key == 'length' ||
  31708. // Node.js 0.10 has enumerable non-index properties on buffers.
  31709. (isBuff && (key == 'offset' || key == 'parent')) ||
  31710. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  31711. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  31712. // Skip index properties.
  31713. isIndex(key, length)
  31714. ))) {
  31715. result.push(key);
  31716. }
  31717. }
  31718. return result;
  31719. }
  31720. module.exports = arrayLikeKeys;
  31721. },{"./_baseTimes":367,"./_isIndex":421,"./isArguments":483,"./isArray":484,"./isBuffer":487,"./isTypedArray":497}],318:[function(require,module,exports){
  31722. /**
  31723. * A specialized version of `_.map` for arrays without support for iteratee
  31724. * shorthands.
  31725. *
  31726. * @private
  31727. * @param {Array} [array] The array to iterate over.
  31728. * @param {Function} iteratee The function invoked per iteration.
  31729. * @returns {Array} Returns the new mapped array.
  31730. */
  31731. function arrayMap(array, iteratee) {
  31732. var index = -1,
  31733. length = array == null ? 0 : array.length,
  31734. result = Array(length);
  31735. while (++index < length) {
  31736. result[index] = iteratee(array[index], index, array);
  31737. }
  31738. return result;
  31739. }
  31740. module.exports = arrayMap;
  31741. },{}],319:[function(require,module,exports){
  31742. /**
  31743. * Appends the elements of `values` to `array`.
  31744. *
  31745. * @private
  31746. * @param {Array} array The array to modify.
  31747. * @param {Array} values The values to append.
  31748. * @returns {Array} Returns `array`.
  31749. */
  31750. function arrayPush(array, values) {
  31751. var index = -1,
  31752. length = values.length,
  31753. offset = array.length;
  31754. while (++index < length) {
  31755. array[offset + index] = values[index];
  31756. }
  31757. return array;
  31758. }
  31759. module.exports = arrayPush;
  31760. },{}],320:[function(require,module,exports){
  31761. /**
  31762. * A specialized version of `_.reduce` for arrays without support for
  31763. * iteratee shorthands.
  31764. *
  31765. * @private
  31766. * @param {Array} [array] The array to iterate over.
  31767. * @param {Function} iteratee The function invoked per iteration.
  31768. * @param {*} [accumulator] The initial value.
  31769. * @param {boolean} [initAccum] Specify using the first element of `array` as
  31770. * the initial value.
  31771. * @returns {*} Returns the accumulated value.
  31772. */
  31773. function arrayReduce(array, iteratee, accumulator, initAccum) {
  31774. var index = -1,
  31775. length = array == null ? 0 : array.length;
  31776. if (initAccum && length) {
  31777. accumulator = array[++index];
  31778. }
  31779. while (++index < length) {
  31780. accumulator = iteratee(accumulator, array[index], index, array);
  31781. }
  31782. return accumulator;
  31783. }
  31784. module.exports = arrayReduce;
  31785. },{}],321:[function(require,module,exports){
  31786. /**
  31787. * A specialized version of `_.some` for arrays without support for iteratee
  31788. * shorthands.
  31789. *
  31790. * @private
  31791. * @param {Array} [array] The array to iterate over.
  31792. * @param {Function} predicate The function invoked per iteration.
  31793. * @returns {boolean} Returns `true` if any element passes the predicate check,
  31794. * else `false`.
  31795. */
  31796. function arraySome(array, predicate) {
  31797. var index = -1,
  31798. length = array == null ? 0 : array.length;
  31799. while (++index < length) {
  31800. if (predicate(array[index], index, array)) {
  31801. return true;
  31802. }
  31803. }
  31804. return false;
  31805. }
  31806. module.exports = arraySome;
  31807. },{}],322:[function(require,module,exports){
  31808. var baseAssignValue = require('./_baseAssignValue'),
  31809. eq = require('./eq');
  31810. /**
  31811. * This function is like `assignValue` except that it doesn't assign
  31812. * `undefined` values.
  31813. *
  31814. * @private
  31815. * @param {Object} object The object to modify.
  31816. * @param {string} key The key of the property to assign.
  31817. * @param {*} value The value to assign.
  31818. */
  31819. function assignMergeValue(object, key, value) {
  31820. if ((value !== undefined && !eq(object[key], value)) ||
  31821. (value === undefined && !(key in object))) {
  31822. baseAssignValue(object, key, value);
  31823. }
  31824. }
  31825. module.exports = assignMergeValue;
  31826. },{"./_baseAssignValue":327,"./eq":471}],323:[function(require,module,exports){
  31827. var baseAssignValue = require('./_baseAssignValue'),
  31828. eq = require('./eq');
  31829. /** Used for built-in method references. */
  31830. var objectProto = Object.prototype;
  31831. /** Used to check objects for own properties. */
  31832. var hasOwnProperty = objectProto.hasOwnProperty;
  31833. /**
  31834. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  31835. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  31836. * for equality comparisons.
  31837. *
  31838. * @private
  31839. * @param {Object} object The object to modify.
  31840. * @param {string} key The key of the property to assign.
  31841. * @param {*} value The value to assign.
  31842. */
  31843. function assignValue(object, key, value) {
  31844. var objValue = object[key];
  31845. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  31846. (value === undefined && !(key in object))) {
  31847. baseAssignValue(object, key, value);
  31848. }
  31849. }
  31850. module.exports = assignValue;
  31851. },{"./_baseAssignValue":327,"./eq":471}],324:[function(require,module,exports){
  31852. var eq = require('./eq');
  31853. /**
  31854. * Gets the index at which the `key` is found in `array` of key-value pairs.
  31855. *
  31856. * @private
  31857. * @param {Array} array The array to inspect.
  31858. * @param {*} key The key to search for.
  31859. * @returns {number} Returns the index of the matched value, else `-1`.
  31860. */
  31861. function assocIndexOf(array, key) {
  31862. var length = array.length;
  31863. while (length--) {
  31864. if (eq(array[length][0], key)) {
  31865. return length;
  31866. }
  31867. }
  31868. return -1;
  31869. }
  31870. module.exports = assocIndexOf;
  31871. },{"./eq":471}],325:[function(require,module,exports){
  31872. var copyObject = require('./_copyObject'),
  31873. keys = require('./keys');
  31874. /**
  31875. * The base implementation of `_.assign` without support for multiple sources
  31876. * or `customizer` functions.
  31877. *
  31878. * @private
  31879. * @param {Object} object The destination object.
  31880. * @param {Object} source The source object.
  31881. * @returns {Object} Returns `object`.
  31882. */
  31883. function baseAssign(object, source) {
  31884. return object && copyObject(source, keys(source), object);
  31885. }
  31886. module.exports = baseAssign;
  31887. },{"./_copyObject":385,"./keys":498}],326:[function(require,module,exports){
  31888. var copyObject = require('./_copyObject'),
  31889. keysIn = require('./keysIn');
  31890. /**
  31891. * The base implementation of `_.assignIn` without support for multiple sources
  31892. * or `customizer` functions.
  31893. *
  31894. * @private
  31895. * @param {Object} object The destination object.
  31896. * @param {Object} source The source object.
  31897. * @returns {Object} Returns `object`.
  31898. */
  31899. function baseAssignIn(object, source) {
  31900. return object && copyObject(source, keysIn(source), object);
  31901. }
  31902. module.exports = baseAssignIn;
  31903. },{"./_copyObject":385,"./keysIn":499}],327:[function(require,module,exports){
  31904. var defineProperty = require('./_defineProperty');
  31905. /**
  31906. * The base implementation of `assignValue` and `assignMergeValue` without
  31907. * value checks.
  31908. *
  31909. * @private
  31910. * @param {Object} object The object to modify.
  31911. * @param {string} key The key of the property to assign.
  31912. * @param {*} value The value to assign.
  31913. */
  31914. function baseAssignValue(object, key, value) {
  31915. if (key == '__proto__' && defineProperty) {
  31916. defineProperty(object, key, {
  31917. 'configurable': true,
  31918. 'enumerable': true,
  31919. 'value': value,
  31920. 'writable': true
  31921. });
  31922. } else {
  31923. object[key] = value;
  31924. }
  31925. }
  31926. module.exports = baseAssignValue;
  31927. },{"./_defineProperty":395}],328:[function(require,module,exports){
  31928. /**
  31929. * The base implementation of `_.clamp` which doesn't coerce arguments.
  31930. *
  31931. * @private
  31932. * @param {number} number The number to clamp.
  31933. * @param {number} [lower] The lower bound.
  31934. * @param {number} upper The upper bound.
  31935. * @returns {number} Returns the clamped number.
  31936. */
  31937. function baseClamp(number, lower, upper) {
  31938. if (number === number) {
  31939. if (upper !== undefined) {
  31940. number = number <= upper ? number : upper;
  31941. }
  31942. if (lower !== undefined) {
  31943. number = number >= lower ? number : lower;
  31944. }
  31945. }
  31946. return number;
  31947. }
  31948. module.exports = baseClamp;
  31949. },{}],329:[function(require,module,exports){
  31950. var Stack = require('./_Stack'),
  31951. arrayEach = require('./_arrayEach'),
  31952. assignValue = require('./_assignValue'),
  31953. baseAssign = require('./_baseAssign'),
  31954. baseAssignIn = require('./_baseAssignIn'),
  31955. cloneBuffer = require('./_cloneBuffer'),
  31956. copyArray = require('./_copyArray'),
  31957. copySymbols = require('./_copySymbols'),
  31958. copySymbolsIn = require('./_copySymbolsIn'),
  31959. getAllKeys = require('./_getAllKeys'),
  31960. getAllKeysIn = require('./_getAllKeysIn'),
  31961. getTag = require('./_getTag'),
  31962. initCloneArray = require('./_initCloneArray'),
  31963. initCloneByTag = require('./_initCloneByTag'),
  31964. initCloneObject = require('./_initCloneObject'),
  31965. isArray = require('./isArray'),
  31966. isBuffer = require('./isBuffer'),
  31967. isObject = require('./isObject'),
  31968. keys = require('./keys');
  31969. /** Used to compose bitmasks for cloning. */
  31970. var CLONE_DEEP_FLAG = 1,
  31971. CLONE_FLAT_FLAG = 2,
  31972. CLONE_SYMBOLS_FLAG = 4;
  31973. /** `Object#toString` result references. */
  31974. var argsTag = '[object Arguments]',
  31975. arrayTag = '[object Array]',
  31976. boolTag = '[object Boolean]',
  31977. dateTag = '[object Date]',
  31978. errorTag = '[object Error]',
  31979. funcTag = '[object Function]',
  31980. genTag = '[object GeneratorFunction]',
  31981. mapTag = '[object Map]',
  31982. numberTag = '[object Number]',
  31983. objectTag = '[object Object]',
  31984. regexpTag = '[object RegExp]',
  31985. setTag = '[object Set]',
  31986. stringTag = '[object String]',
  31987. symbolTag = '[object Symbol]',
  31988. weakMapTag = '[object WeakMap]';
  31989. var arrayBufferTag = '[object ArrayBuffer]',
  31990. dataViewTag = '[object DataView]',
  31991. float32Tag = '[object Float32Array]',
  31992. float64Tag = '[object Float64Array]',
  31993. int8Tag = '[object Int8Array]',
  31994. int16Tag = '[object Int16Array]',
  31995. int32Tag = '[object Int32Array]',
  31996. uint8Tag = '[object Uint8Array]',
  31997. uint8ClampedTag = '[object Uint8ClampedArray]',
  31998. uint16Tag = '[object Uint16Array]',
  31999. uint32Tag = '[object Uint32Array]';
  32000. /** Used to identify `toStringTag` values supported by `_.clone`. */
  32001. var cloneableTags = {};
  32002. cloneableTags[argsTag] = cloneableTags[arrayTag] =
  32003. cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =
  32004. cloneableTags[boolTag] = cloneableTags[dateTag] =
  32005. cloneableTags[float32Tag] = cloneableTags[float64Tag] =
  32006. cloneableTags[int8Tag] = cloneableTags[int16Tag] =
  32007. cloneableTags[int32Tag] = cloneableTags[mapTag] =
  32008. cloneableTags[numberTag] = cloneableTags[objectTag] =
  32009. cloneableTags[regexpTag] = cloneableTags[setTag] =
  32010. cloneableTags[stringTag] = cloneableTags[symbolTag] =
  32011. cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =
  32012. cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  32013. cloneableTags[errorTag] = cloneableTags[funcTag] =
  32014. cloneableTags[weakMapTag] = false;
  32015. /**
  32016. * The base implementation of `_.clone` and `_.cloneDeep` which tracks
  32017. * traversed objects.
  32018. *
  32019. * @private
  32020. * @param {*} value The value to clone.
  32021. * @param {boolean} bitmask The bitmask flags.
  32022. * 1 - Deep clone
  32023. * 2 - Flatten inherited properties
  32024. * 4 - Clone symbols
  32025. * @param {Function} [customizer] The function to customize cloning.
  32026. * @param {string} [key] The key of `value`.
  32027. * @param {Object} [object] The parent object of `value`.
  32028. * @param {Object} [stack] Tracks traversed objects and their clone counterparts.
  32029. * @returns {*} Returns the cloned value.
  32030. */
  32031. function baseClone(value, bitmask, customizer, key, object, stack) {
  32032. var result,
  32033. isDeep = bitmask & CLONE_DEEP_FLAG,
  32034. isFlat = bitmask & CLONE_FLAT_FLAG,
  32035. isFull = bitmask & CLONE_SYMBOLS_FLAG;
  32036. if (customizer) {
  32037. result = object ? customizer(value, key, object, stack) : customizer(value);
  32038. }
  32039. if (result !== undefined) {
  32040. return result;
  32041. }
  32042. if (!isObject(value)) {
  32043. return value;
  32044. }
  32045. var isArr = isArray(value);
  32046. if (isArr) {
  32047. result = initCloneArray(value);
  32048. if (!isDeep) {
  32049. return copyArray(value, result);
  32050. }
  32051. } else {
  32052. var tag = getTag(value),
  32053. isFunc = tag == funcTag || tag == genTag;
  32054. if (isBuffer(value)) {
  32055. return cloneBuffer(value, isDeep);
  32056. }
  32057. if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
  32058. result = (isFlat || isFunc) ? {} : initCloneObject(value);
  32059. if (!isDeep) {
  32060. return isFlat
  32061. ? copySymbolsIn(value, baseAssignIn(result, value))
  32062. : copySymbols(value, baseAssign(result, value));
  32063. }
  32064. } else {
  32065. if (!cloneableTags[tag]) {
  32066. return object ? value : {};
  32067. }
  32068. result = initCloneByTag(value, tag, baseClone, isDeep);
  32069. }
  32070. }
  32071. // Check for circular references and return its corresponding clone.
  32072. stack || (stack = new Stack);
  32073. var stacked = stack.get(value);
  32074. if (stacked) {
  32075. return stacked;
  32076. }
  32077. stack.set(value, result);
  32078. var keysFunc = isFull
  32079. ? (isFlat ? getAllKeysIn : getAllKeys)
  32080. : (isFlat ? keysIn : keys);
  32081. var props = isArr ? undefined : keysFunc(value);
  32082. arrayEach(props || value, function(subValue, key) {
  32083. if (props) {
  32084. key = subValue;
  32085. subValue = value[key];
  32086. }
  32087. // Recursively populate clone (susceptible to call stack limits).
  32088. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  32089. });
  32090. return result;
  32091. }
  32092. module.exports = baseClone;
  32093. },{"./_Stack":306,"./_arrayEach":313,"./_assignValue":323,"./_baseAssign":325,"./_baseAssignIn":326,"./_cloneBuffer":375,"./_copyArray":384,"./_copySymbols":386,"./_copySymbolsIn":387,"./_getAllKeys":400,"./_getAllKeysIn":401,"./_getTag":409,"./_initCloneArray":417,"./_initCloneByTag":418,"./_initCloneObject":419,"./isArray":484,"./isBuffer":487,"./isObject":491,"./keys":498}],330:[function(require,module,exports){
  32094. var isObject = require('./isObject');
  32095. /** Built-in value references. */
  32096. var objectCreate = Object.create;
  32097. /**
  32098. * The base implementation of `_.create` without support for assigning
  32099. * properties to the created object.
  32100. *
  32101. * @private
  32102. * @param {Object} proto The object to inherit from.
  32103. * @returns {Object} Returns the new object.
  32104. */
  32105. var baseCreate = (function() {
  32106. function object() {}
  32107. return function(proto) {
  32108. if (!isObject(proto)) {
  32109. return {};
  32110. }
  32111. if (objectCreate) {
  32112. return objectCreate(proto);
  32113. }
  32114. object.prototype = proto;
  32115. var result = new object;
  32116. object.prototype = undefined;
  32117. return result;
  32118. };
  32119. }());
  32120. module.exports = baseCreate;
  32121. },{"./isObject":491}],331:[function(require,module,exports){
  32122. var baseForOwn = require('./_baseForOwn'),
  32123. createBaseEach = require('./_createBaseEach');
  32124. /**
  32125. * The base implementation of `_.forEach` without support for iteratee shorthands.
  32126. *
  32127. * @private
  32128. * @param {Array|Object} collection The collection to iterate over.
  32129. * @param {Function} iteratee The function invoked per iteration.
  32130. * @returns {Array|Object} Returns `collection`.
  32131. */
  32132. var baseEach = createBaseEach(baseForOwn);
  32133. module.exports = baseEach;
  32134. },{"./_baseForOwn":335,"./_createBaseEach":390}],332:[function(require,module,exports){
  32135. /**
  32136. * The base implementation of `_.findIndex` and `_.findLastIndex` without
  32137. * support for iteratee shorthands.
  32138. *
  32139. * @private
  32140. * @param {Array} array The array to inspect.
  32141. * @param {Function} predicate The function invoked per iteration.
  32142. * @param {number} fromIndex The index to search from.
  32143. * @param {boolean} [fromRight] Specify iterating from right to left.
  32144. * @returns {number} Returns the index of the matched value, else `-1`.
  32145. */
  32146. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  32147. var length = array.length,
  32148. index = fromIndex + (fromRight ? 1 : -1);
  32149. while ((fromRight ? index-- : ++index < length)) {
  32150. if (predicate(array[index], index, array)) {
  32151. return index;
  32152. }
  32153. }
  32154. return -1;
  32155. }
  32156. module.exports = baseFindIndex;
  32157. },{}],333:[function(require,module,exports){
  32158. var arrayPush = require('./_arrayPush'),
  32159. isFlattenable = require('./_isFlattenable');
  32160. /**
  32161. * The base implementation of `_.flatten` with support for restricting flattening.
  32162. *
  32163. * @private
  32164. * @param {Array} array The array to flatten.
  32165. * @param {number} depth The maximum recursion depth.
  32166. * @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
  32167. * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
  32168. * @param {Array} [result=[]] The initial result value.
  32169. * @returns {Array} Returns the new flattened array.
  32170. */
  32171. function baseFlatten(array, depth, predicate, isStrict, result) {
  32172. var index = -1,
  32173. length = array.length;
  32174. predicate || (predicate = isFlattenable);
  32175. result || (result = []);
  32176. while (++index < length) {
  32177. var value = array[index];
  32178. if (depth > 0 && predicate(value)) {
  32179. if (depth > 1) {
  32180. // Recursively flatten arrays (susceptible to call stack limits).
  32181. baseFlatten(value, depth - 1, predicate, isStrict, result);
  32182. } else {
  32183. arrayPush(result, value);
  32184. }
  32185. } else if (!isStrict) {
  32186. result[result.length] = value;
  32187. }
  32188. }
  32189. return result;
  32190. }
  32191. module.exports = baseFlatten;
  32192. },{"./_arrayPush":319,"./_isFlattenable":420}],334:[function(require,module,exports){
  32193. var createBaseFor = require('./_createBaseFor');
  32194. /**
  32195. * The base implementation of `baseForOwn` which iterates over `object`
  32196. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  32197. * Iteratee functions may exit iteration early by explicitly returning `false`.
  32198. *
  32199. * @private
  32200. * @param {Object} object The object to iterate over.
  32201. * @param {Function} iteratee The function invoked per iteration.
  32202. * @param {Function} keysFunc The function to get the keys of `object`.
  32203. * @returns {Object} Returns `object`.
  32204. */
  32205. var baseFor = createBaseFor();
  32206. module.exports = baseFor;
  32207. },{"./_createBaseFor":391}],335:[function(require,module,exports){
  32208. var baseFor = require('./_baseFor'),
  32209. keys = require('./keys');
  32210. /**
  32211. * The base implementation of `_.forOwn` without support for iteratee shorthands.
  32212. *
  32213. * @private
  32214. * @param {Object} object The object to iterate over.
  32215. * @param {Function} iteratee The function invoked per iteration.
  32216. * @returns {Object} Returns `object`.
  32217. */
  32218. function baseForOwn(object, iteratee) {
  32219. return object && baseFor(object, iteratee, keys);
  32220. }
  32221. module.exports = baseForOwn;
  32222. },{"./_baseFor":334,"./keys":498}],336:[function(require,module,exports){
  32223. var castPath = require('./_castPath'),
  32224. toKey = require('./_toKey');
  32225. /**
  32226. * The base implementation of `_.get` without support for default values.
  32227. *
  32228. * @private
  32229. * @param {Object} object The object to query.
  32230. * @param {Array|string} path The path of the property to get.
  32231. * @returns {*} Returns the resolved value.
  32232. */
  32233. function baseGet(object, path) {
  32234. path = castPath(path, object);
  32235. var index = 0,
  32236. length = path.length;
  32237. while (object != null && index < length) {
  32238. object = object[toKey(path[index++])];
  32239. }
  32240. return (index && index == length) ? object : undefined;
  32241. }
  32242. module.exports = baseGet;
  32243. },{"./_castPath":373,"./_toKey":461}],337:[function(require,module,exports){
  32244. var arrayPush = require('./_arrayPush'),
  32245. isArray = require('./isArray');
  32246. /**
  32247. * The base implementation of `getAllKeys` and `getAllKeysIn` which uses
  32248. * `keysFunc` and `symbolsFunc` to get the enumerable property names and
  32249. * symbols of `object`.
  32250. *
  32251. * @private
  32252. * @param {Object} object The object to query.
  32253. * @param {Function} keysFunc The function to get the keys of `object`.
  32254. * @param {Function} symbolsFunc The function to get the symbols of `object`.
  32255. * @returns {Array} Returns the array of property names and symbols.
  32256. */
  32257. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  32258. var result = keysFunc(object);
  32259. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  32260. }
  32261. module.exports = baseGetAllKeys;
  32262. },{"./_arrayPush":319,"./isArray":484}],338:[function(require,module,exports){
  32263. var Symbol = require('./_Symbol'),
  32264. getRawTag = require('./_getRawTag'),
  32265. objectToString = require('./_objectToString');
  32266. /** `Object#toString` result references. */
  32267. var nullTag = '[object Null]',
  32268. undefinedTag = '[object Undefined]';
  32269. /** Built-in value references. */
  32270. var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  32271. /**
  32272. * The base implementation of `getTag` without fallbacks for buggy environments.
  32273. *
  32274. * @private
  32275. * @param {*} value The value to query.
  32276. * @returns {string} Returns the `toStringTag`.
  32277. */
  32278. function baseGetTag(value) {
  32279. if (value == null) {
  32280. return value === undefined ? undefinedTag : nullTag;
  32281. }
  32282. return (symToStringTag && symToStringTag in Object(value))
  32283. ? getRawTag(value)
  32284. : objectToString(value);
  32285. }
  32286. module.exports = baseGetTag;
  32287. },{"./_Symbol":307,"./_getRawTag":406,"./_objectToString":445}],339:[function(require,module,exports){
  32288. /** Used for built-in method references. */
  32289. var objectProto = Object.prototype;
  32290. /** Used to check objects for own properties. */
  32291. var hasOwnProperty = objectProto.hasOwnProperty;
  32292. /**
  32293. * The base implementation of `_.has` without support for deep paths.
  32294. *
  32295. * @private
  32296. * @param {Object} [object] The object to query.
  32297. * @param {Array|string} key The key to check.
  32298. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  32299. */
  32300. function baseHas(object, key) {
  32301. return object != null && hasOwnProperty.call(object, key);
  32302. }
  32303. module.exports = baseHas;
  32304. },{}],340:[function(require,module,exports){
  32305. /**
  32306. * The base implementation of `_.hasIn` without support for deep paths.
  32307. *
  32308. * @private
  32309. * @param {Object} [object] The object to query.
  32310. * @param {Array|string} key The key to check.
  32311. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  32312. */
  32313. function baseHasIn(object, key) {
  32314. return object != null && key in Object(object);
  32315. }
  32316. module.exports = baseHasIn;
  32317. },{}],341:[function(require,module,exports){
  32318. var baseFindIndex = require('./_baseFindIndex'),
  32319. baseIsNaN = require('./_baseIsNaN'),
  32320. strictIndexOf = require('./_strictIndexOf');
  32321. /**
  32322. * The base implementation of `_.indexOf` without `fromIndex` bounds checks.
  32323. *
  32324. * @private
  32325. * @param {Array} array The array to inspect.
  32326. * @param {*} value The value to search for.
  32327. * @param {number} fromIndex The index to search from.
  32328. * @returns {number} Returns the index of the matched value, else `-1`.
  32329. */
  32330. function baseIndexOf(array, value, fromIndex) {
  32331. return value === value
  32332. ? strictIndexOf(array, value, fromIndex)
  32333. : baseFindIndex(array, baseIsNaN, fromIndex);
  32334. }
  32335. module.exports = baseIndexOf;
  32336. },{"./_baseFindIndex":332,"./_baseIsNaN":347,"./_strictIndexOf":459}],342:[function(require,module,exports){
  32337. /**
  32338. * This function is like `baseIndexOf` except that it accepts a comparator.
  32339. *
  32340. * @private
  32341. * @param {Array} array The array to inspect.
  32342. * @param {*} value The value to search for.
  32343. * @param {number} fromIndex The index to search from.
  32344. * @param {Function} comparator The comparator invoked per element.
  32345. * @returns {number} Returns the index of the matched value, else `-1`.
  32346. */
  32347. function baseIndexOfWith(array, value, fromIndex, comparator) {
  32348. var index = fromIndex - 1,
  32349. length = array.length;
  32350. while (++index < length) {
  32351. if (comparator(array[index], value)) {
  32352. return index;
  32353. }
  32354. }
  32355. return -1;
  32356. }
  32357. module.exports = baseIndexOfWith;
  32358. },{}],343:[function(require,module,exports){
  32359. var baseGetTag = require('./_baseGetTag'),
  32360. isObjectLike = require('./isObjectLike');
  32361. /** `Object#toString` result references. */
  32362. var argsTag = '[object Arguments]';
  32363. /**
  32364. * The base implementation of `_.isArguments`.
  32365. *
  32366. * @private
  32367. * @param {*} value The value to check.
  32368. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  32369. */
  32370. function baseIsArguments(value) {
  32371. return isObjectLike(value) && baseGetTag(value) == argsTag;
  32372. }
  32373. module.exports = baseIsArguments;
  32374. },{"./_baseGetTag":338,"./isObjectLike":492}],344:[function(require,module,exports){
  32375. var baseIsEqualDeep = require('./_baseIsEqualDeep'),
  32376. isObjectLike = require('./isObjectLike');
  32377. /**
  32378. * The base implementation of `_.isEqual` which supports partial comparisons
  32379. * and tracks traversed objects.
  32380. *
  32381. * @private
  32382. * @param {*} value The value to compare.
  32383. * @param {*} other The other value to compare.
  32384. * @param {boolean} bitmask The bitmask flags.
  32385. * 1 - Unordered comparison
  32386. * 2 - Partial comparison
  32387. * @param {Function} [customizer] The function to customize comparisons.
  32388. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  32389. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  32390. */
  32391. function baseIsEqual(value, other, bitmask, customizer, stack) {
  32392. if (value === other) {
  32393. return true;
  32394. }
  32395. if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
  32396. return value !== value && other !== other;
  32397. }
  32398. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  32399. }
  32400. module.exports = baseIsEqual;
  32401. },{"./_baseIsEqualDeep":345,"./isObjectLike":492}],345:[function(require,module,exports){
  32402. var Stack = require('./_Stack'),
  32403. equalArrays = require('./_equalArrays'),
  32404. equalByTag = require('./_equalByTag'),
  32405. equalObjects = require('./_equalObjects'),
  32406. getTag = require('./_getTag'),
  32407. isArray = require('./isArray'),
  32408. isBuffer = require('./isBuffer'),
  32409. isTypedArray = require('./isTypedArray');
  32410. /** Used to compose bitmasks for value comparisons. */
  32411. var COMPARE_PARTIAL_FLAG = 1;
  32412. /** `Object#toString` result references. */
  32413. var argsTag = '[object Arguments]',
  32414. arrayTag = '[object Array]',
  32415. objectTag = '[object Object]';
  32416. /** Used for built-in method references. */
  32417. var objectProto = Object.prototype;
  32418. /** Used to check objects for own properties. */
  32419. var hasOwnProperty = objectProto.hasOwnProperty;
  32420. /**
  32421. * A specialized version of `baseIsEqual` for arrays and objects which performs
  32422. * deep comparisons and tracks traversed objects enabling objects with circular
  32423. * references to be compared.
  32424. *
  32425. * @private
  32426. * @param {Object} object The object to compare.
  32427. * @param {Object} other The other object to compare.
  32428. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  32429. * @param {Function} customizer The function to customize comparisons.
  32430. * @param {Function} equalFunc The function to determine equivalents of values.
  32431. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  32432. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  32433. */
  32434. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  32435. var objIsArr = isArray(object),
  32436. othIsArr = isArray(other),
  32437. objTag = objIsArr ? arrayTag : getTag(object),
  32438. othTag = othIsArr ? arrayTag : getTag(other);
  32439. objTag = objTag == argsTag ? objectTag : objTag;
  32440. othTag = othTag == argsTag ? objectTag : othTag;
  32441. var objIsObj = objTag == objectTag,
  32442. othIsObj = othTag == objectTag,
  32443. isSameTag = objTag == othTag;
  32444. if (isSameTag && isBuffer(object)) {
  32445. if (!isBuffer(other)) {
  32446. return false;
  32447. }
  32448. objIsArr = true;
  32449. objIsObj = false;
  32450. }
  32451. if (isSameTag && !objIsObj) {
  32452. stack || (stack = new Stack);
  32453. return (objIsArr || isTypedArray(object))
  32454. ? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
  32455. : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  32456. }
  32457. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  32458. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  32459. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  32460. if (objIsWrapped || othIsWrapped) {
  32461. var objUnwrapped = objIsWrapped ? object.value() : object,
  32462. othUnwrapped = othIsWrapped ? other.value() : other;
  32463. stack || (stack = new Stack);
  32464. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  32465. }
  32466. }
  32467. if (!isSameTag) {
  32468. return false;
  32469. }
  32470. stack || (stack = new Stack);
  32471. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  32472. }
  32473. module.exports = baseIsEqualDeep;
  32474. },{"./_Stack":306,"./_equalArrays":396,"./_equalByTag":397,"./_equalObjects":398,"./_getTag":409,"./isArray":484,"./isBuffer":487,"./isTypedArray":497}],346:[function(require,module,exports){
  32475. var Stack = require('./_Stack'),
  32476. baseIsEqual = require('./_baseIsEqual');
  32477. /** Used to compose bitmasks for value comparisons. */
  32478. var COMPARE_PARTIAL_FLAG = 1,
  32479. COMPARE_UNORDERED_FLAG = 2;
  32480. /**
  32481. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  32482. *
  32483. * @private
  32484. * @param {Object} object The object to inspect.
  32485. * @param {Object} source The object of property values to match.
  32486. * @param {Array} matchData The property names, values, and compare flags to match.
  32487. * @param {Function} [customizer] The function to customize comparisons.
  32488. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  32489. */
  32490. function baseIsMatch(object, source, matchData, customizer) {
  32491. var index = matchData.length,
  32492. length = index,
  32493. noCustomizer = !customizer;
  32494. if (object == null) {
  32495. return !length;
  32496. }
  32497. object = Object(object);
  32498. while (index--) {
  32499. var data = matchData[index];
  32500. if ((noCustomizer && data[2])
  32501. ? data[1] !== object[data[0]]
  32502. : !(data[0] in object)
  32503. ) {
  32504. return false;
  32505. }
  32506. }
  32507. while (++index < length) {
  32508. data = matchData[index];
  32509. var key = data[0],
  32510. objValue = object[key],
  32511. srcValue = data[1];
  32512. if (noCustomizer && data[2]) {
  32513. if (objValue === undefined && !(key in object)) {
  32514. return false;
  32515. }
  32516. } else {
  32517. var stack = new Stack;
  32518. if (customizer) {
  32519. var result = customizer(objValue, srcValue, key, object, source, stack);
  32520. }
  32521. if (!(result === undefined
  32522. ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack)
  32523. : result
  32524. )) {
  32525. return false;
  32526. }
  32527. }
  32528. }
  32529. return true;
  32530. }
  32531. module.exports = baseIsMatch;
  32532. },{"./_Stack":306,"./_baseIsEqual":344}],347:[function(require,module,exports){
  32533. /**
  32534. * The base implementation of `_.isNaN` without support for number objects.
  32535. *
  32536. * @private
  32537. * @param {*} value The value to check.
  32538. * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
  32539. */
  32540. function baseIsNaN(value) {
  32541. return value !== value;
  32542. }
  32543. module.exports = baseIsNaN;
  32544. },{}],348:[function(require,module,exports){
  32545. var isFunction = require('./isFunction'),
  32546. isMasked = require('./_isMasked'),
  32547. isObject = require('./isObject'),
  32548. toSource = require('./_toSource');
  32549. /**
  32550. * Used to match `RegExp`
  32551. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  32552. */
  32553. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  32554. /** Used to detect host constructors (Safari). */
  32555. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  32556. /** Used for built-in method references. */
  32557. var funcProto = Function.prototype,
  32558. objectProto = Object.prototype;
  32559. /** Used to resolve the decompiled source of functions. */
  32560. var funcToString = funcProto.toString;
  32561. /** Used to check objects for own properties. */
  32562. var hasOwnProperty = objectProto.hasOwnProperty;
  32563. /** Used to detect if a method is native. */
  32564. var reIsNative = RegExp('^' +
  32565. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  32566. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  32567. );
  32568. /**
  32569. * The base implementation of `_.isNative` without bad shim checks.
  32570. *
  32571. * @private
  32572. * @param {*} value The value to check.
  32573. * @returns {boolean} Returns `true` if `value` is a native function,
  32574. * else `false`.
  32575. */
  32576. function baseIsNative(value) {
  32577. if (!isObject(value) || isMasked(value)) {
  32578. return false;
  32579. }
  32580. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  32581. return pattern.test(toSource(value));
  32582. }
  32583. module.exports = baseIsNative;
  32584. },{"./_isMasked":425,"./_toSource":462,"./isFunction":488,"./isObject":491}],349:[function(require,module,exports){
  32585. var baseGetTag = require('./_baseGetTag'),
  32586. isObjectLike = require('./isObjectLike');
  32587. /** `Object#toString` result references. */
  32588. var regexpTag = '[object RegExp]';
  32589. /**
  32590. * The base implementation of `_.isRegExp` without Node.js optimizations.
  32591. *
  32592. * @private
  32593. * @param {*} value The value to check.
  32594. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  32595. */
  32596. function baseIsRegExp(value) {
  32597. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  32598. }
  32599. module.exports = baseIsRegExp;
  32600. },{"./_baseGetTag":338,"./isObjectLike":492}],350:[function(require,module,exports){
  32601. var baseGetTag = require('./_baseGetTag'),
  32602. isLength = require('./isLength'),
  32603. isObjectLike = require('./isObjectLike');
  32604. /** `Object#toString` result references. */
  32605. var argsTag = '[object Arguments]',
  32606. arrayTag = '[object Array]',
  32607. boolTag = '[object Boolean]',
  32608. dateTag = '[object Date]',
  32609. errorTag = '[object Error]',
  32610. funcTag = '[object Function]',
  32611. mapTag = '[object Map]',
  32612. numberTag = '[object Number]',
  32613. objectTag = '[object Object]',
  32614. regexpTag = '[object RegExp]',
  32615. setTag = '[object Set]',
  32616. stringTag = '[object String]',
  32617. weakMapTag = '[object WeakMap]';
  32618. var arrayBufferTag = '[object ArrayBuffer]',
  32619. dataViewTag = '[object DataView]',
  32620. float32Tag = '[object Float32Array]',
  32621. float64Tag = '[object Float64Array]',
  32622. int8Tag = '[object Int8Array]',
  32623. int16Tag = '[object Int16Array]',
  32624. int32Tag = '[object Int32Array]',
  32625. uint8Tag = '[object Uint8Array]',
  32626. uint8ClampedTag = '[object Uint8ClampedArray]',
  32627. uint16Tag = '[object Uint16Array]',
  32628. uint32Tag = '[object Uint32Array]';
  32629. /** Used to identify `toStringTag` values of typed arrays. */
  32630. var typedArrayTags = {};
  32631. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  32632. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  32633. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  32634. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  32635. typedArrayTags[uint32Tag] = true;
  32636. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  32637. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  32638. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  32639. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  32640. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  32641. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  32642. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  32643. typedArrayTags[weakMapTag] = false;
  32644. /**
  32645. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  32646. *
  32647. * @private
  32648. * @param {*} value The value to check.
  32649. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  32650. */
  32651. function baseIsTypedArray(value) {
  32652. return isObjectLike(value) &&
  32653. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  32654. }
  32655. module.exports = baseIsTypedArray;
  32656. },{"./_baseGetTag":338,"./isLength":490,"./isObjectLike":492}],351:[function(require,module,exports){
  32657. var baseMatches = require('./_baseMatches'),
  32658. baseMatchesProperty = require('./_baseMatchesProperty'),
  32659. identity = require('./identity'),
  32660. isArray = require('./isArray'),
  32661. property = require('./property');
  32662. /**
  32663. * The base implementation of `_.iteratee`.
  32664. *
  32665. * @private
  32666. * @param {*} [value=_.identity] The value to convert to an iteratee.
  32667. * @returns {Function} Returns the iteratee.
  32668. */
  32669. function baseIteratee(value) {
  32670. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  32671. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  32672. if (typeof value == 'function') {
  32673. return value;
  32674. }
  32675. if (value == null) {
  32676. return identity;
  32677. }
  32678. if (typeof value == 'object') {
  32679. return isArray(value)
  32680. ? baseMatchesProperty(value[0], value[1])
  32681. : baseMatches(value);
  32682. }
  32683. return property(value);
  32684. }
  32685. module.exports = baseIteratee;
  32686. },{"./_baseMatches":355,"./_baseMatchesProperty":356,"./identity":481,"./isArray":484,"./property":504}],352:[function(require,module,exports){
  32687. var isPrototype = require('./_isPrototype'),
  32688. nativeKeys = require('./_nativeKeys');
  32689. /** Used for built-in method references. */
  32690. var objectProto = Object.prototype;
  32691. /** Used to check objects for own properties. */
  32692. var hasOwnProperty = objectProto.hasOwnProperty;
  32693. /**
  32694. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  32695. *
  32696. * @private
  32697. * @param {Object} object The object to query.
  32698. * @returns {Array} Returns the array of property names.
  32699. */
  32700. function baseKeys(object) {
  32701. if (!isPrototype(object)) {
  32702. return nativeKeys(object);
  32703. }
  32704. var result = [];
  32705. for (var key in Object(object)) {
  32706. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  32707. result.push(key);
  32708. }
  32709. }
  32710. return result;
  32711. }
  32712. module.exports = baseKeys;
  32713. },{"./_isPrototype":426,"./_nativeKeys":442}],353:[function(require,module,exports){
  32714. var isObject = require('./isObject'),
  32715. isPrototype = require('./_isPrototype'),
  32716. nativeKeysIn = require('./_nativeKeysIn');
  32717. /** Used for built-in method references. */
  32718. var objectProto = Object.prototype;
  32719. /** Used to check objects for own properties. */
  32720. var hasOwnProperty = objectProto.hasOwnProperty;
  32721. /**
  32722. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  32723. *
  32724. * @private
  32725. * @param {Object} object The object to query.
  32726. * @returns {Array} Returns the array of property names.
  32727. */
  32728. function baseKeysIn(object) {
  32729. if (!isObject(object)) {
  32730. return nativeKeysIn(object);
  32731. }
  32732. var isProto = isPrototype(object),
  32733. result = [];
  32734. for (var key in object) {
  32735. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  32736. result.push(key);
  32737. }
  32738. }
  32739. return result;
  32740. }
  32741. module.exports = baseKeysIn;
  32742. },{"./_isPrototype":426,"./_nativeKeysIn":443,"./isObject":491}],354:[function(require,module,exports){
  32743. var baseEach = require('./_baseEach'),
  32744. isArrayLike = require('./isArrayLike');
  32745. /**
  32746. * The base implementation of `_.map` without support for iteratee shorthands.
  32747. *
  32748. * @private
  32749. * @param {Array|Object} collection The collection to iterate over.
  32750. * @param {Function} iteratee The function invoked per iteration.
  32751. * @returns {Array} Returns the new mapped array.
  32752. */
  32753. function baseMap(collection, iteratee) {
  32754. var index = -1,
  32755. result = isArrayLike(collection) ? Array(collection.length) : [];
  32756. baseEach(collection, function(value, key, collection) {
  32757. result[++index] = iteratee(value, key, collection);
  32758. });
  32759. return result;
  32760. }
  32761. module.exports = baseMap;
  32762. },{"./_baseEach":331,"./isArrayLike":485}],355:[function(require,module,exports){
  32763. var baseIsMatch = require('./_baseIsMatch'),
  32764. getMatchData = require('./_getMatchData'),
  32765. matchesStrictComparable = require('./_matchesStrictComparable');
  32766. /**
  32767. * The base implementation of `_.matches` which doesn't clone `source`.
  32768. *
  32769. * @private
  32770. * @param {Object} source The object of property values to match.
  32771. * @returns {Function} Returns the new spec function.
  32772. */
  32773. function baseMatches(source) {
  32774. var matchData = getMatchData(source);
  32775. if (matchData.length == 1 && matchData[0][2]) {
  32776. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  32777. }
  32778. return function(object) {
  32779. return object === source || baseIsMatch(object, source, matchData);
  32780. };
  32781. }
  32782. module.exports = baseMatches;
  32783. },{"./_baseIsMatch":346,"./_getMatchData":403,"./_matchesStrictComparable":439}],356:[function(require,module,exports){
  32784. var baseIsEqual = require('./_baseIsEqual'),
  32785. get = require('./get'),
  32786. hasIn = require('./hasIn'),
  32787. isKey = require('./_isKey'),
  32788. isStrictComparable = require('./_isStrictComparable'),
  32789. matchesStrictComparable = require('./_matchesStrictComparable'),
  32790. toKey = require('./_toKey');
  32791. /** Used to compose bitmasks for value comparisons. */
  32792. var COMPARE_PARTIAL_FLAG = 1,
  32793. COMPARE_UNORDERED_FLAG = 2;
  32794. /**
  32795. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  32796. *
  32797. * @private
  32798. * @param {string} path The path of the property to get.
  32799. * @param {*} srcValue The value to match.
  32800. * @returns {Function} Returns the new spec function.
  32801. */
  32802. function baseMatchesProperty(path, srcValue) {
  32803. if (isKey(path) && isStrictComparable(srcValue)) {
  32804. return matchesStrictComparable(toKey(path), srcValue);
  32805. }
  32806. return function(object) {
  32807. var objValue = get(object, path);
  32808. return (objValue === undefined && objValue === srcValue)
  32809. ? hasIn(object, path)
  32810. : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  32811. };
  32812. }
  32813. module.exports = baseMatchesProperty;
  32814. },{"./_baseIsEqual":344,"./_isKey":423,"./_isStrictComparable":427,"./_matchesStrictComparable":439,"./_toKey":461,"./get":478,"./hasIn":480}],357:[function(require,module,exports){
  32815. var Stack = require('./_Stack'),
  32816. assignMergeValue = require('./_assignMergeValue'),
  32817. baseFor = require('./_baseFor'),
  32818. baseMergeDeep = require('./_baseMergeDeep'),
  32819. isObject = require('./isObject'),
  32820. keysIn = require('./keysIn');
  32821. /**
  32822. * The base implementation of `_.merge` without support for multiple sources.
  32823. *
  32824. * @private
  32825. * @param {Object} object The destination object.
  32826. * @param {Object} source The source object.
  32827. * @param {number} srcIndex The index of `source`.
  32828. * @param {Function} [customizer] The function to customize merged values.
  32829. * @param {Object} [stack] Tracks traversed source values and their merged
  32830. * counterparts.
  32831. */
  32832. function baseMerge(object, source, srcIndex, customizer, stack) {
  32833. if (object === source) {
  32834. return;
  32835. }
  32836. baseFor(source, function(srcValue, key) {
  32837. if (isObject(srcValue)) {
  32838. stack || (stack = new Stack);
  32839. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  32840. }
  32841. else {
  32842. var newValue = customizer
  32843. ? customizer(object[key], srcValue, (key + ''), object, source, stack)
  32844. : undefined;
  32845. if (newValue === undefined) {
  32846. newValue = srcValue;
  32847. }
  32848. assignMergeValue(object, key, newValue);
  32849. }
  32850. }, keysIn);
  32851. }
  32852. module.exports = baseMerge;
  32853. },{"./_Stack":306,"./_assignMergeValue":322,"./_baseFor":334,"./_baseMergeDeep":358,"./isObject":491,"./keysIn":499}],358:[function(require,module,exports){
  32854. var assignMergeValue = require('./_assignMergeValue'),
  32855. cloneBuffer = require('./_cloneBuffer'),
  32856. cloneTypedArray = require('./_cloneTypedArray'),
  32857. copyArray = require('./_copyArray'),
  32858. initCloneObject = require('./_initCloneObject'),
  32859. isArguments = require('./isArguments'),
  32860. isArray = require('./isArray'),
  32861. isArrayLikeObject = require('./isArrayLikeObject'),
  32862. isBuffer = require('./isBuffer'),
  32863. isFunction = require('./isFunction'),
  32864. isObject = require('./isObject'),
  32865. isPlainObject = require('./isPlainObject'),
  32866. isTypedArray = require('./isTypedArray'),
  32867. toPlainObject = require('./toPlainObject');
  32868. /**
  32869. * A specialized version of `baseMerge` for arrays and objects which performs
  32870. * deep merges and tracks traversed objects enabling objects with circular
  32871. * references to be merged.
  32872. *
  32873. * @private
  32874. * @param {Object} object The destination object.
  32875. * @param {Object} source The source object.
  32876. * @param {string} key The key of the value to merge.
  32877. * @param {number} srcIndex The index of `source`.
  32878. * @param {Function} mergeFunc The function to merge values.
  32879. * @param {Function} [customizer] The function to customize assigned values.
  32880. * @param {Object} [stack] Tracks traversed source values and their merged
  32881. * counterparts.
  32882. */
  32883. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  32884. var objValue = object[key],
  32885. srcValue = source[key],
  32886. stacked = stack.get(srcValue);
  32887. if (stacked) {
  32888. assignMergeValue(object, key, stacked);
  32889. return;
  32890. }
  32891. var newValue = customizer
  32892. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  32893. : undefined;
  32894. var isCommon = newValue === undefined;
  32895. if (isCommon) {
  32896. var isArr = isArray(srcValue),
  32897. isBuff = !isArr && isBuffer(srcValue),
  32898. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  32899. newValue = srcValue;
  32900. if (isArr || isBuff || isTyped) {
  32901. if (isArray(objValue)) {
  32902. newValue = objValue;
  32903. }
  32904. else if (isArrayLikeObject(objValue)) {
  32905. newValue = copyArray(objValue);
  32906. }
  32907. else if (isBuff) {
  32908. isCommon = false;
  32909. newValue = cloneBuffer(srcValue, true);
  32910. }
  32911. else if (isTyped) {
  32912. isCommon = false;
  32913. newValue = cloneTypedArray(srcValue, true);
  32914. }
  32915. else {
  32916. newValue = [];
  32917. }
  32918. }
  32919. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  32920. newValue = objValue;
  32921. if (isArguments(objValue)) {
  32922. newValue = toPlainObject(objValue);
  32923. }
  32924. else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
  32925. newValue = initCloneObject(srcValue);
  32926. }
  32927. }
  32928. else {
  32929. isCommon = false;
  32930. }
  32931. }
  32932. if (isCommon) {
  32933. // Recursively merge objects and arrays (susceptible to call stack limits).
  32934. stack.set(srcValue, newValue);
  32935. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  32936. stack['delete'](srcValue);
  32937. }
  32938. assignMergeValue(object, key, newValue);
  32939. }
  32940. module.exports = baseMergeDeep;
  32941. },{"./_assignMergeValue":322,"./_cloneBuffer":375,"./_cloneTypedArray":381,"./_copyArray":384,"./_initCloneObject":419,"./isArguments":483,"./isArray":484,"./isArrayLikeObject":486,"./isBuffer":487,"./isFunction":488,"./isObject":491,"./isPlainObject":493,"./isTypedArray":497,"./toPlainObject":515}],359:[function(require,module,exports){
  32942. var arrayMap = require('./_arrayMap'),
  32943. baseIteratee = require('./_baseIteratee'),
  32944. baseMap = require('./_baseMap'),
  32945. baseSortBy = require('./_baseSortBy'),
  32946. baseUnary = require('./_baseUnary'),
  32947. compareMultiple = require('./_compareMultiple'),
  32948. identity = require('./identity');
  32949. /**
  32950. * The base implementation of `_.orderBy` without param guards.
  32951. *
  32952. * @private
  32953. * @param {Array|Object} collection The collection to iterate over.
  32954. * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
  32955. * @param {string[]} orders The sort orders of `iteratees`.
  32956. * @returns {Array} Returns the new sorted array.
  32957. */
  32958. function baseOrderBy(collection, iteratees, orders) {
  32959. var index = -1;
  32960. iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(baseIteratee));
  32961. var result = baseMap(collection, function(value, key, collection) {
  32962. var criteria = arrayMap(iteratees, function(iteratee) {
  32963. return iteratee(value);
  32964. });
  32965. return { 'criteria': criteria, 'index': ++index, 'value': value };
  32966. });
  32967. return baseSortBy(result, function(object, other) {
  32968. return compareMultiple(object, other, orders);
  32969. });
  32970. }
  32971. module.exports = baseOrderBy;
  32972. },{"./_arrayMap":318,"./_baseIteratee":351,"./_baseMap":354,"./_baseSortBy":366,"./_baseUnary":369,"./_compareMultiple":383,"./identity":481}],360:[function(require,module,exports){
  32973. /**
  32974. * The base implementation of `_.property` without support for deep paths.
  32975. *
  32976. * @private
  32977. * @param {string} key The key of the property to get.
  32978. * @returns {Function} Returns the new accessor function.
  32979. */
  32980. function baseProperty(key) {
  32981. return function(object) {
  32982. return object == null ? undefined : object[key];
  32983. };
  32984. }
  32985. module.exports = baseProperty;
  32986. },{}],361:[function(require,module,exports){
  32987. var baseGet = require('./_baseGet');
  32988. /**
  32989. * A specialized version of `baseProperty` which supports deep paths.
  32990. *
  32991. * @private
  32992. * @param {Array|string} path The path of the property to get.
  32993. * @returns {Function} Returns the new accessor function.
  32994. */
  32995. function basePropertyDeep(path) {
  32996. return function(object) {
  32997. return baseGet(object, path);
  32998. };
  32999. }
  33000. module.exports = basePropertyDeep;
  33001. },{"./_baseGet":336}],362:[function(require,module,exports){
  33002. var arrayMap = require('./_arrayMap'),
  33003. baseIndexOf = require('./_baseIndexOf'),
  33004. baseIndexOfWith = require('./_baseIndexOfWith'),
  33005. baseUnary = require('./_baseUnary'),
  33006. copyArray = require('./_copyArray');
  33007. /** Used for built-in method references. */
  33008. var arrayProto = Array.prototype;
  33009. /** Built-in value references. */
  33010. var splice = arrayProto.splice;
  33011. /**
  33012. * The base implementation of `_.pullAllBy` without support for iteratee
  33013. * shorthands.
  33014. *
  33015. * @private
  33016. * @param {Array} array The array to modify.
  33017. * @param {Array} values The values to remove.
  33018. * @param {Function} [iteratee] The iteratee invoked per element.
  33019. * @param {Function} [comparator] The comparator invoked per element.
  33020. * @returns {Array} Returns `array`.
  33021. */
  33022. function basePullAll(array, values, iteratee, comparator) {
  33023. var indexOf = comparator ? baseIndexOfWith : baseIndexOf,
  33024. index = -1,
  33025. length = values.length,
  33026. seen = array;
  33027. if (array === values) {
  33028. values = copyArray(values);
  33029. }
  33030. if (iteratee) {
  33031. seen = arrayMap(array, baseUnary(iteratee));
  33032. }
  33033. while (++index < length) {
  33034. var fromIndex = 0,
  33035. value = values[index],
  33036. computed = iteratee ? iteratee(value) : value;
  33037. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  33038. if (seen !== array) {
  33039. splice.call(seen, fromIndex, 1);
  33040. }
  33041. splice.call(array, fromIndex, 1);
  33042. }
  33043. }
  33044. return array;
  33045. }
  33046. module.exports = basePullAll;
  33047. },{"./_arrayMap":318,"./_baseIndexOf":341,"./_baseIndexOfWith":342,"./_baseUnary":369,"./_copyArray":384}],363:[function(require,module,exports){
  33048. /** Used as references for various `Number` constants. */
  33049. var MAX_SAFE_INTEGER = 9007199254740991;
  33050. /* Built-in method references for those with the same name as other `lodash` methods. */
  33051. var nativeFloor = Math.floor;
  33052. /**
  33053. * The base implementation of `_.repeat` which doesn't coerce arguments.
  33054. *
  33055. * @private
  33056. * @param {string} string The string to repeat.
  33057. * @param {number} n The number of times to repeat the string.
  33058. * @returns {string} Returns the repeated string.
  33059. */
  33060. function baseRepeat(string, n) {
  33061. var result = '';
  33062. if (!string || n < 1 || n > MAX_SAFE_INTEGER) {
  33063. return result;
  33064. }
  33065. // Leverage the exponentiation by squaring algorithm for a faster repeat.
  33066. // See https://en.wikipedia.org/wiki/Exponentiation_by_squaring for more details.
  33067. do {
  33068. if (n % 2) {
  33069. result += string;
  33070. }
  33071. n = nativeFloor(n / 2);
  33072. if (n) {
  33073. string += string;
  33074. }
  33075. } while (n);
  33076. return result;
  33077. }
  33078. module.exports = baseRepeat;
  33079. },{}],364:[function(require,module,exports){
  33080. var identity = require('./identity'),
  33081. overRest = require('./_overRest'),
  33082. setToString = require('./_setToString');
  33083. /**
  33084. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  33085. *
  33086. * @private
  33087. * @param {Function} func The function to apply a rest parameter to.
  33088. * @param {number} [start=func.length-1] The start position of the rest parameter.
  33089. * @returns {Function} Returns the new function.
  33090. */
  33091. function baseRest(func, start) {
  33092. return setToString(overRest(func, start, identity), func + '');
  33093. }
  33094. module.exports = baseRest;
  33095. },{"./_overRest":447,"./_setToString":452,"./identity":481}],365:[function(require,module,exports){
  33096. var constant = require('./constant'),
  33097. defineProperty = require('./_defineProperty'),
  33098. identity = require('./identity');
  33099. /**
  33100. * The base implementation of `setToString` without support for hot loop shorting.
  33101. *
  33102. * @private
  33103. * @param {Function} func The function to modify.
  33104. * @param {Function} string The `toString` result.
  33105. * @returns {Function} Returns `func`.
  33106. */
  33107. var baseSetToString = !defineProperty ? identity : function(func, string) {
  33108. return defineProperty(func, 'toString', {
  33109. 'configurable': true,
  33110. 'enumerable': false,
  33111. 'value': constant(string),
  33112. 'writable': true
  33113. });
  33114. };
  33115. module.exports = baseSetToString;
  33116. },{"./_defineProperty":395,"./constant":469,"./identity":481}],366:[function(require,module,exports){
  33117. /**
  33118. * The base implementation of `_.sortBy` which uses `comparer` to define the
  33119. * sort order of `array` and replaces criteria objects with their corresponding
  33120. * values.
  33121. *
  33122. * @private
  33123. * @param {Array} array The array to sort.
  33124. * @param {Function} comparer The function to define sort order.
  33125. * @returns {Array} Returns `array`.
  33126. */
  33127. function baseSortBy(array, comparer) {
  33128. var length = array.length;
  33129. array.sort(comparer);
  33130. while (length--) {
  33131. array[length] = array[length].value;
  33132. }
  33133. return array;
  33134. }
  33135. module.exports = baseSortBy;
  33136. },{}],367:[function(require,module,exports){
  33137. /**
  33138. * The base implementation of `_.times` without support for iteratee shorthands
  33139. * or max array length checks.
  33140. *
  33141. * @private
  33142. * @param {number} n The number of times to invoke `iteratee`.
  33143. * @param {Function} iteratee The function invoked per iteration.
  33144. * @returns {Array} Returns the array of results.
  33145. */
  33146. function baseTimes(n, iteratee) {
  33147. var index = -1,
  33148. result = Array(n);
  33149. while (++index < n) {
  33150. result[index] = iteratee(index);
  33151. }
  33152. return result;
  33153. }
  33154. module.exports = baseTimes;
  33155. },{}],368:[function(require,module,exports){
  33156. var Symbol = require('./_Symbol'),
  33157. arrayMap = require('./_arrayMap'),
  33158. isArray = require('./isArray'),
  33159. isSymbol = require('./isSymbol');
  33160. /** Used as references for various `Number` constants. */
  33161. var INFINITY = 1 / 0;
  33162. /** Used to convert symbols to primitives and strings. */
  33163. var symbolProto = Symbol ? Symbol.prototype : undefined,
  33164. symbolToString = symbolProto ? symbolProto.toString : undefined;
  33165. /**
  33166. * The base implementation of `_.toString` which doesn't convert nullish
  33167. * values to empty strings.
  33168. *
  33169. * @private
  33170. * @param {*} value The value to process.
  33171. * @returns {string} Returns the string.
  33172. */
  33173. function baseToString(value) {
  33174. // Exit early for strings to avoid a performance hit in some environments.
  33175. if (typeof value == 'string') {
  33176. return value;
  33177. }
  33178. if (isArray(value)) {
  33179. // Recursively convert values (susceptible to call stack limits).
  33180. return arrayMap(value, baseToString) + '';
  33181. }
  33182. if (isSymbol(value)) {
  33183. return symbolToString ? symbolToString.call(value) : '';
  33184. }
  33185. var result = (value + '');
  33186. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  33187. }
  33188. module.exports = baseToString;
  33189. },{"./_Symbol":307,"./_arrayMap":318,"./isArray":484,"./isSymbol":496}],369:[function(require,module,exports){
  33190. /**
  33191. * The base implementation of `_.unary` without support for storing metadata.
  33192. *
  33193. * @private
  33194. * @param {Function} func The function to cap arguments for.
  33195. * @returns {Function} Returns the new capped function.
  33196. */
  33197. function baseUnary(func) {
  33198. return function(value) {
  33199. return func(value);
  33200. };
  33201. }
  33202. module.exports = baseUnary;
  33203. },{}],370:[function(require,module,exports){
  33204. var SetCache = require('./_SetCache'),
  33205. arrayIncludes = require('./_arrayIncludes'),
  33206. arrayIncludesWith = require('./_arrayIncludesWith'),
  33207. cacheHas = require('./_cacheHas'),
  33208. createSet = require('./_createSet'),
  33209. setToArray = require('./_setToArray');
  33210. /** Used as the size to enable large array optimizations. */
  33211. var LARGE_ARRAY_SIZE = 200;
  33212. /**
  33213. * The base implementation of `_.uniqBy` without support for iteratee shorthands.
  33214. *
  33215. * @private
  33216. * @param {Array} array The array to inspect.
  33217. * @param {Function} [iteratee] The iteratee invoked per element.
  33218. * @param {Function} [comparator] The comparator invoked per element.
  33219. * @returns {Array} Returns the new duplicate free array.
  33220. */
  33221. function baseUniq(array, iteratee, comparator) {
  33222. var index = -1,
  33223. includes = arrayIncludes,
  33224. length = array.length,
  33225. isCommon = true,
  33226. result = [],
  33227. seen = result;
  33228. if (comparator) {
  33229. isCommon = false;
  33230. includes = arrayIncludesWith;
  33231. }
  33232. else if (length >= LARGE_ARRAY_SIZE) {
  33233. var set = iteratee ? null : createSet(array);
  33234. if (set) {
  33235. return setToArray(set);
  33236. }
  33237. isCommon = false;
  33238. includes = cacheHas;
  33239. seen = new SetCache;
  33240. }
  33241. else {
  33242. seen = iteratee ? [] : result;
  33243. }
  33244. outer:
  33245. while (++index < length) {
  33246. var value = array[index],
  33247. computed = iteratee ? iteratee(value) : value;
  33248. value = (comparator || value !== 0) ? value : 0;
  33249. if (isCommon && computed === computed) {
  33250. var seenIndex = seen.length;
  33251. while (seenIndex--) {
  33252. if (seen[seenIndex] === computed) {
  33253. continue outer;
  33254. }
  33255. }
  33256. if (iteratee) {
  33257. seen.push(computed);
  33258. }
  33259. result.push(value);
  33260. }
  33261. else if (!includes(seen, computed, comparator)) {
  33262. if (seen !== result) {
  33263. seen.push(computed);
  33264. }
  33265. result.push(value);
  33266. }
  33267. }
  33268. return result;
  33269. }
  33270. module.exports = baseUniq;
  33271. },{"./_SetCache":305,"./_arrayIncludes":315,"./_arrayIncludesWith":316,"./_cacheHas":372,"./_createSet":393,"./_setToArray":451}],371:[function(require,module,exports){
  33272. var arrayMap = require('./_arrayMap');
  33273. /**
  33274. * The base implementation of `_.values` and `_.valuesIn` which creates an
  33275. * array of `object` property values corresponding to the property names
  33276. * of `props`.
  33277. *
  33278. * @private
  33279. * @param {Object} object The object to query.
  33280. * @param {Array} props The property names to get values for.
  33281. * @returns {Object} Returns the array of property values.
  33282. */
  33283. function baseValues(object, props) {
  33284. return arrayMap(props, function(key) {
  33285. return object[key];
  33286. });
  33287. }
  33288. module.exports = baseValues;
  33289. },{"./_arrayMap":318}],372:[function(require,module,exports){
  33290. /**
  33291. * Checks if a `cache` value for `key` exists.
  33292. *
  33293. * @private
  33294. * @param {Object} cache The cache to query.
  33295. * @param {string} key The key of the entry to check.
  33296. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  33297. */
  33298. function cacheHas(cache, key) {
  33299. return cache.has(key);
  33300. }
  33301. module.exports = cacheHas;
  33302. },{}],373:[function(require,module,exports){
  33303. var isArray = require('./isArray'),
  33304. isKey = require('./_isKey'),
  33305. stringToPath = require('./_stringToPath'),
  33306. toString = require('./toString');
  33307. /**
  33308. * Casts `value` to a path array if it's not one.
  33309. *
  33310. * @private
  33311. * @param {*} value The value to inspect.
  33312. * @param {Object} [object] The object to query keys on.
  33313. * @returns {Array} Returns the cast property path array.
  33314. */
  33315. function castPath(value, object) {
  33316. if (isArray(value)) {
  33317. return value;
  33318. }
  33319. return isKey(value, object) ? [value] : stringToPath(toString(value));
  33320. }
  33321. module.exports = castPath;
  33322. },{"./_isKey":423,"./_stringToPath":460,"./isArray":484,"./toString":516}],374:[function(require,module,exports){
  33323. var Uint8Array = require('./_Uint8Array');
  33324. /**
  33325. * Creates a clone of `arrayBuffer`.
  33326. *
  33327. * @private
  33328. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  33329. * @returns {ArrayBuffer} Returns the cloned array buffer.
  33330. */
  33331. function cloneArrayBuffer(arrayBuffer) {
  33332. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  33333. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  33334. return result;
  33335. }
  33336. module.exports = cloneArrayBuffer;
  33337. },{"./_Uint8Array":308}],375:[function(require,module,exports){
  33338. var root = require('./_root');
  33339. /** Detect free variable `exports`. */
  33340. var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
  33341. /** Detect free variable `module`. */
  33342. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  33343. /** Detect the popular CommonJS extension `module.exports`. */
  33344. var moduleExports = freeModule && freeModule.exports === freeExports;
  33345. /** Built-in value references. */
  33346. var Buffer = moduleExports ? root.Buffer : undefined,
  33347. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
  33348. /**
  33349. * Creates a clone of `buffer`.
  33350. *
  33351. * @private
  33352. * @param {Buffer} buffer The buffer to clone.
  33353. * @param {boolean} [isDeep] Specify a deep clone.
  33354. * @returns {Buffer} Returns the cloned buffer.
  33355. */
  33356. function cloneBuffer(buffer, isDeep) {
  33357. if (isDeep) {
  33358. return buffer.slice();
  33359. }
  33360. var length = buffer.length,
  33361. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  33362. buffer.copy(result);
  33363. return result;
  33364. }
  33365. module.exports = cloneBuffer;
  33366. },{"./_root":448}],376:[function(require,module,exports){
  33367. var cloneArrayBuffer = require('./_cloneArrayBuffer');
  33368. /**
  33369. * Creates a clone of `dataView`.
  33370. *
  33371. * @private
  33372. * @param {Object} dataView The data view to clone.
  33373. * @param {boolean} [isDeep] Specify a deep clone.
  33374. * @returns {Object} Returns the cloned data view.
  33375. */
  33376. function cloneDataView(dataView, isDeep) {
  33377. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  33378. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  33379. }
  33380. module.exports = cloneDataView;
  33381. },{"./_cloneArrayBuffer":374}],377:[function(require,module,exports){
  33382. var addMapEntry = require('./_addMapEntry'),
  33383. arrayReduce = require('./_arrayReduce'),
  33384. mapToArray = require('./_mapToArray');
  33385. /** Used to compose bitmasks for cloning. */
  33386. var CLONE_DEEP_FLAG = 1;
  33387. /**
  33388. * Creates a clone of `map`.
  33389. *
  33390. * @private
  33391. * @param {Object} map The map to clone.
  33392. * @param {Function} cloneFunc The function to clone values.
  33393. * @param {boolean} [isDeep] Specify a deep clone.
  33394. * @returns {Object} Returns the cloned map.
  33395. */
  33396. function cloneMap(map, isDeep, cloneFunc) {
  33397. var array = isDeep ? cloneFunc(mapToArray(map), CLONE_DEEP_FLAG) : mapToArray(map);
  33398. return arrayReduce(array, addMapEntry, new map.constructor);
  33399. }
  33400. module.exports = cloneMap;
  33401. },{"./_addMapEntry":310,"./_arrayReduce":320,"./_mapToArray":438}],378:[function(require,module,exports){
  33402. /** Used to match `RegExp` flags from their coerced string values. */
  33403. var reFlags = /\w*$/;
  33404. /**
  33405. * Creates a clone of `regexp`.
  33406. *
  33407. * @private
  33408. * @param {Object} regexp The regexp to clone.
  33409. * @returns {Object} Returns the cloned regexp.
  33410. */
  33411. function cloneRegExp(regexp) {
  33412. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  33413. result.lastIndex = regexp.lastIndex;
  33414. return result;
  33415. }
  33416. module.exports = cloneRegExp;
  33417. },{}],379:[function(require,module,exports){
  33418. var addSetEntry = require('./_addSetEntry'),
  33419. arrayReduce = require('./_arrayReduce'),
  33420. setToArray = require('./_setToArray');
  33421. /** Used to compose bitmasks for cloning. */
  33422. var CLONE_DEEP_FLAG = 1;
  33423. /**
  33424. * Creates a clone of `set`.
  33425. *
  33426. * @private
  33427. * @param {Object} set The set to clone.
  33428. * @param {Function} cloneFunc The function to clone values.
  33429. * @param {boolean} [isDeep] Specify a deep clone.
  33430. * @returns {Object} Returns the cloned set.
  33431. */
  33432. function cloneSet(set, isDeep, cloneFunc) {
  33433. var array = isDeep ? cloneFunc(setToArray(set), CLONE_DEEP_FLAG) : setToArray(set);
  33434. return arrayReduce(array, addSetEntry, new set.constructor);
  33435. }
  33436. module.exports = cloneSet;
  33437. },{"./_addSetEntry":311,"./_arrayReduce":320,"./_setToArray":451}],380:[function(require,module,exports){
  33438. var Symbol = require('./_Symbol');
  33439. /** Used to convert symbols to primitives and strings. */
  33440. var symbolProto = Symbol ? Symbol.prototype : undefined,
  33441. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
  33442. /**
  33443. * Creates a clone of the `symbol` object.
  33444. *
  33445. * @private
  33446. * @param {Object} symbol The symbol object to clone.
  33447. * @returns {Object} Returns the cloned symbol object.
  33448. */
  33449. function cloneSymbol(symbol) {
  33450. return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
  33451. }
  33452. module.exports = cloneSymbol;
  33453. },{"./_Symbol":307}],381:[function(require,module,exports){
  33454. var cloneArrayBuffer = require('./_cloneArrayBuffer');
  33455. /**
  33456. * Creates a clone of `typedArray`.
  33457. *
  33458. * @private
  33459. * @param {Object} typedArray The typed array to clone.
  33460. * @param {boolean} [isDeep] Specify a deep clone.
  33461. * @returns {Object} Returns the cloned typed array.
  33462. */
  33463. function cloneTypedArray(typedArray, isDeep) {
  33464. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  33465. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  33466. }
  33467. module.exports = cloneTypedArray;
  33468. },{"./_cloneArrayBuffer":374}],382:[function(require,module,exports){
  33469. var isSymbol = require('./isSymbol');
  33470. /**
  33471. * Compares values to sort them in ascending order.
  33472. *
  33473. * @private
  33474. * @param {*} value The value to compare.
  33475. * @param {*} other The other value to compare.
  33476. * @returns {number} Returns the sort order indicator for `value`.
  33477. */
  33478. function compareAscending(value, other) {
  33479. if (value !== other) {
  33480. var valIsDefined = value !== undefined,
  33481. valIsNull = value === null,
  33482. valIsReflexive = value === value,
  33483. valIsSymbol = isSymbol(value);
  33484. var othIsDefined = other !== undefined,
  33485. othIsNull = other === null,
  33486. othIsReflexive = other === other,
  33487. othIsSymbol = isSymbol(other);
  33488. if ((!othIsNull && !othIsSymbol && !valIsSymbol && value > other) ||
  33489. (valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol) ||
  33490. (valIsNull && othIsDefined && othIsReflexive) ||
  33491. (!valIsDefined && othIsReflexive) ||
  33492. !valIsReflexive) {
  33493. return 1;
  33494. }
  33495. if ((!valIsNull && !valIsSymbol && !othIsSymbol && value < other) ||
  33496. (othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol) ||
  33497. (othIsNull && valIsDefined && valIsReflexive) ||
  33498. (!othIsDefined && valIsReflexive) ||
  33499. !othIsReflexive) {
  33500. return -1;
  33501. }
  33502. }
  33503. return 0;
  33504. }
  33505. module.exports = compareAscending;
  33506. },{"./isSymbol":496}],383:[function(require,module,exports){
  33507. var compareAscending = require('./_compareAscending');
  33508. /**
  33509. * Used by `_.orderBy` to compare multiple properties of a value to another
  33510. * and stable sort them.
  33511. *
  33512. * If `orders` is unspecified, all values are sorted in ascending order. Otherwise,
  33513. * specify an order of "desc" for descending or "asc" for ascending sort order
  33514. * of corresponding values.
  33515. *
  33516. * @private
  33517. * @param {Object} object The object to compare.
  33518. * @param {Object} other The other object to compare.
  33519. * @param {boolean[]|string[]} orders The order to sort by for each property.
  33520. * @returns {number} Returns the sort order indicator for `object`.
  33521. */
  33522. function compareMultiple(object, other, orders) {
  33523. var index = -1,
  33524. objCriteria = object.criteria,
  33525. othCriteria = other.criteria,
  33526. length = objCriteria.length,
  33527. ordersLength = orders.length;
  33528. while (++index < length) {
  33529. var result = compareAscending(objCriteria[index], othCriteria[index]);
  33530. if (result) {
  33531. if (index >= ordersLength) {
  33532. return result;
  33533. }
  33534. var order = orders[index];
  33535. return result * (order == 'desc' ? -1 : 1);
  33536. }
  33537. }
  33538. // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications
  33539. // that causes it, under certain circumstances, to provide the same value for
  33540. // `object` and `other`. See https://github.com/jashkenas/underscore/pull/1247
  33541. // for more details.
  33542. //
  33543. // This also ensures a stable sort in V8 and other engines.
  33544. // See https://bugs.chromium.org/p/v8/issues/detail?id=90 for more details.
  33545. return object.index - other.index;
  33546. }
  33547. module.exports = compareMultiple;
  33548. },{"./_compareAscending":382}],384:[function(require,module,exports){
  33549. /**
  33550. * Copies the values of `source` to `array`.
  33551. *
  33552. * @private
  33553. * @param {Array} source The array to copy values from.
  33554. * @param {Array} [array=[]] The array to copy values to.
  33555. * @returns {Array} Returns `array`.
  33556. */
  33557. function copyArray(source, array) {
  33558. var index = -1,
  33559. length = source.length;
  33560. array || (array = Array(length));
  33561. while (++index < length) {
  33562. array[index] = source[index];
  33563. }
  33564. return array;
  33565. }
  33566. module.exports = copyArray;
  33567. },{}],385:[function(require,module,exports){
  33568. var assignValue = require('./_assignValue'),
  33569. baseAssignValue = require('./_baseAssignValue');
  33570. /**
  33571. * Copies properties of `source` to `object`.
  33572. *
  33573. * @private
  33574. * @param {Object} source The object to copy properties from.
  33575. * @param {Array} props The property identifiers to copy.
  33576. * @param {Object} [object={}] The object to copy properties to.
  33577. * @param {Function} [customizer] The function to customize copied values.
  33578. * @returns {Object} Returns `object`.
  33579. */
  33580. function copyObject(source, props, object, customizer) {
  33581. var isNew = !object;
  33582. object || (object = {});
  33583. var index = -1,
  33584. length = props.length;
  33585. while (++index < length) {
  33586. var key = props[index];
  33587. var newValue = customizer
  33588. ? customizer(object[key], source[key], key, object, source)
  33589. : undefined;
  33590. if (newValue === undefined) {
  33591. newValue = source[key];
  33592. }
  33593. if (isNew) {
  33594. baseAssignValue(object, key, newValue);
  33595. } else {
  33596. assignValue(object, key, newValue);
  33597. }
  33598. }
  33599. return object;
  33600. }
  33601. module.exports = copyObject;
  33602. },{"./_assignValue":323,"./_baseAssignValue":327}],386:[function(require,module,exports){
  33603. var copyObject = require('./_copyObject'),
  33604. getSymbols = require('./_getSymbols');
  33605. /**
  33606. * Copies own symbols of `source` to `object`.
  33607. *
  33608. * @private
  33609. * @param {Object} source The object to copy symbols from.
  33610. * @param {Object} [object={}] The object to copy symbols to.
  33611. * @returns {Object} Returns `object`.
  33612. */
  33613. function copySymbols(source, object) {
  33614. return copyObject(source, getSymbols(source), object);
  33615. }
  33616. module.exports = copySymbols;
  33617. },{"./_copyObject":385,"./_getSymbols":407}],387:[function(require,module,exports){
  33618. var copyObject = require('./_copyObject'),
  33619. getSymbolsIn = require('./_getSymbolsIn');
  33620. /**
  33621. * Copies own and inherited symbols of `source` to `object`.
  33622. *
  33623. * @private
  33624. * @param {Object} source The object to copy symbols from.
  33625. * @param {Object} [object={}] The object to copy symbols to.
  33626. * @returns {Object} Returns `object`.
  33627. */
  33628. function copySymbolsIn(source, object) {
  33629. return copyObject(source, getSymbolsIn(source), object);
  33630. }
  33631. module.exports = copySymbolsIn;
  33632. },{"./_copyObject":385,"./_getSymbolsIn":408}],388:[function(require,module,exports){
  33633. var root = require('./_root');
  33634. /** Used to detect overreaching core-js shims. */
  33635. var coreJsData = root['__core-js_shared__'];
  33636. module.exports = coreJsData;
  33637. },{"./_root":448}],389:[function(require,module,exports){
  33638. var baseRest = require('./_baseRest'),
  33639. isIterateeCall = require('./_isIterateeCall');
  33640. /**
  33641. * Creates a function like `_.assign`.
  33642. *
  33643. * @private
  33644. * @param {Function} assigner The function to assign values.
  33645. * @returns {Function} Returns the new assigner function.
  33646. */
  33647. function createAssigner(assigner) {
  33648. return baseRest(function(object, sources) {
  33649. var index = -1,
  33650. length = sources.length,
  33651. customizer = length > 1 ? sources[length - 1] : undefined,
  33652. guard = length > 2 ? sources[2] : undefined;
  33653. customizer = (assigner.length > 3 && typeof customizer == 'function')
  33654. ? (length--, customizer)
  33655. : undefined;
  33656. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  33657. customizer = length < 3 ? undefined : customizer;
  33658. length = 1;
  33659. }
  33660. object = Object(object);
  33661. while (++index < length) {
  33662. var source = sources[index];
  33663. if (source) {
  33664. assigner(object, source, index, customizer);
  33665. }
  33666. }
  33667. return object;
  33668. });
  33669. }
  33670. module.exports = createAssigner;
  33671. },{"./_baseRest":364,"./_isIterateeCall":422}],390:[function(require,module,exports){
  33672. var isArrayLike = require('./isArrayLike');
  33673. /**
  33674. * Creates a `baseEach` or `baseEachRight` function.
  33675. *
  33676. * @private
  33677. * @param {Function} eachFunc The function to iterate over a collection.
  33678. * @param {boolean} [fromRight] Specify iterating from right to left.
  33679. * @returns {Function} Returns the new base function.
  33680. */
  33681. function createBaseEach(eachFunc, fromRight) {
  33682. return function(collection, iteratee) {
  33683. if (collection == null) {
  33684. return collection;
  33685. }
  33686. if (!isArrayLike(collection)) {
  33687. return eachFunc(collection, iteratee);
  33688. }
  33689. var length = collection.length,
  33690. index = fromRight ? length : -1,
  33691. iterable = Object(collection);
  33692. while ((fromRight ? index-- : ++index < length)) {
  33693. if (iteratee(iterable[index], index, iterable) === false) {
  33694. break;
  33695. }
  33696. }
  33697. return collection;
  33698. };
  33699. }
  33700. module.exports = createBaseEach;
  33701. },{"./isArrayLike":485}],391:[function(require,module,exports){
  33702. /**
  33703. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  33704. *
  33705. * @private
  33706. * @param {boolean} [fromRight] Specify iterating from right to left.
  33707. * @returns {Function} Returns the new base function.
  33708. */
  33709. function createBaseFor(fromRight) {
  33710. return function(object, iteratee, keysFunc) {
  33711. var index = -1,
  33712. iterable = Object(object),
  33713. props = keysFunc(object),
  33714. length = props.length;
  33715. while (length--) {
  33716. var key = props[fromRight ? length : ++index];
  33717. if (iteratee(iterable[key], key, iterable) === false) {
  33718. break;
  33719. }
  33720. }
  33721. return object;
  33722. };
  33723. }
  33724. module.exports = createBaseFor;
  33725. },{}],392:[function(require,module,exports){
  33726. var baseIteratee = require('./_baseIteratee'),
  33727. isArrayLike = require('./isArrayLike'),
  33728. keys = require('./keys');
  33729. /**
  33730. * Creates a `_.find` or `_.findLast` function.
  33731. *
  33732. * @private
  33733. * @param {Function} findIndexFunc The function to find the collection index.
  33734. * @returns {Function} Returns the new find function.
  33735. */
  33736. function createFind(findIndexFunc) {
  33737. return function(collection, predicate, fromIndex) {
  33738. var iterable = Object(collection);
  33739. if (!isArrayLike(collection)) {
  33740. var iteratee = baseIteratee(predicate, 3);
  33741. collection = keys(collection);
  33742. predicate = function(key) { return iteratee(iterable[key], key, iterable); };
  33743. }
  33744. var index = findIndexFunc(collection, predicate, fromIndex);
  33745. return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
  33746. };
  33747. }
  33748. module.exports = createFind;
  33749. },{"./_baseIteratee":351,"./isArrayLike":485,"./keys":498}],393:[function(require,module,exports){
  33750. var Set = require('./_Set'),
  33751. noop = require('./noop'),
  33752. setToArray = require('./_setToArray');
  33753. /** Used as references for various `Number` constants. */
  33754. var INFINITY = 1 / 0;
  33755. /**
  33756. * Creates a set object of `values`.
  33757. *
  33758. * @private
  33759. * @param {Array} values The values to add to the set.
  33760. * @returns {Object} Returns the new set.
  33761. */
  33762. var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
  33763. return new Set(values);
  33764. };
  33765. module.exports = createSet;
  33766. },{"./_Set":304,"./_setToArray":451,"./noop":503}],394:[function(require,module,exports){
  33767. var eq = require('./eq');
  33768. /** Used for built-in method references. */
  33769. var objectProto = Object.prototype;
  33770. /** Used to check objects for own properties. */
  33771. var hasOwnProperty = objectProto.hasOwnProperty;
  33772. /**
  33773. * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
  33774. * of source objects to the destination object for all destination properties
  33775. * that resolve to `undefined`.
  33776. *
  33777. * @private
  33778. * @param {*} objValue The destination value.
  33779. * @param {*} srcValue The source value.
  33780. * @param {string} key The key of the property to assign.
  33781. * @param {Object} object The parent object of `objValue`.
  33782. * @returns {*} Returns the value to assign.
  33783. */
  33784. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  33785. if (objValue === undefined ||
  33786. (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
  33787. return srcValue;
  33788. }
  33789. return objValue;
  33790. }
  33791. module.exports = customDefaultsAssignIn;
  33792. },{"./eq":471}],395:[function(require,module,exports){
  33793. var getNative = require('./_getNative');
  33794. var defineProperty = (function() {
  33795. try {
  33796. var func = getNative(Object, 'defineProperty');
  33797. func({}, '', {});
  33798. return func;
  33799. } catch (e) {}
  33800. }());
  33801. module.exports = defineProperty;
  33802. },{"./_getNative":404}],396:[function(require,module,exports){
  33803. var SetCache = require('./_SetCache'),
  33804. arraySome = require('./_arraySome'),
  33805. cacheHas = require('./_cacheHas');
  33806. /** Used to compose bitmasks for value comparisons. */
  33807. var COMPARE_PARTIAL_FLAG = 1,
  33808. COMPARE_UNORDERED_FLAG = 2;
  33809. /**
  33810. * A specialized version of `baseIsEqualDeep` for arrays with support for
  33811. * partial deep comparisons.
  33812. *
  33813. * @private
  33814. * @param {Array} array The array to compare.
  33815. * @param {Array} other The other array to compare.
  33816. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  33817. * @param {Function} customizer The function to customize comparisons.
  33818. * @param {Function} equalFunc The function to determine equivalents of values.
  33819. * @param {Object} stack Tracks traversed `array` and `other` objects.
  33820. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  33821. */
  33822. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  33823. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  33824. arrLength = array.length,
  33825. othLength = other.length;
  33826. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  33827. return false;
  33828. }
  33829. // Assume cyclic values are equal.
  33830. var stacked = stack.get(array);
  33831. if (stacked && stack.get(other)) {
  33832. return stacked == other;
  33833. }
  33834. var index = -1,
  33835. result = true,
  33836. seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined;
  33837. stack.set(array, other);
  33838. stack.set(other, array);
  33839. // Ignore non-index properties.
  33840. while (++index < arrLength) {
  33841. var arrValue = array[index],
  33842. othValue = other[index];
  33843. if (customizer) {
  33844. var compared = isPartial
  33845. ? customizer(othValue, arrValue, index, other, array, stack)
  33846. : customizer(arrValue, othValue, index, array, other, stack);
  33847. }
  33848. if (compared !== undefined) {
  33849. if (compared) {
  33850. continue;
  33851. }
  33852. result = false;
  33853. break;
  33854. }
  33855. // Recursively compare arrays (susceptible to call stack limits).
  33856. if (seen) {
  33857. if (!arraySome(other, function(othValue, othIndex) {
  33858. if (!cacheHas(seen, othIndex) &&
  33859. (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  33860. return seen.push(othIndex);
  33861. }
  33862. })) {
  33863. result = false;
  33864. break;
  33865. }
  33866. } else if (!(
  33867. arrValue === othValue ||
  33868. equalFunc(arrValue, othValue, bitmask, customizer, stack)
  33869. )) {
  33870. result = false;
  33871. break;
  33872. }
  33873. }
  33874. stack['delete'](array);
  33875. stack['delete'](other);
  33876. return result;
  33877. }
  33878. module.exports = equalArrays;
  33879. },{"./_SetCache":305,"./_arraySome":321,"./_cacheHas":372}],397:[function(require,module,exports){
  33880. var Symbol = require('./_Symbol'),
  33881. Uint8Array = require('./_Uint8Array'),
  33882. eq = require('./eq'),
  33883. equalArrays = require('./_equalArrays'),
  33884. mapToArray = require('./_mapToArray'),
  33885. setToArray = require('./_setToArray');
  33886. /** Used to compose bitmasks for value comparisons. */
  33887. var COMPARE_PARTIAL_FLAG = 1,
  33888. COMPARE_UNORDERED_FLAG = 2;
  33889. /** `Object#toString` result references. */
  33890. var boolTag = '[object Boolean]',
  33891. dateTag = '[object Date]',
  33892. errorTag = '[object Error]',
  33893. mapTag = '[object Map]',
  33894. numberTag = '[object Number]',
  33895. regexpTag = '[object RegExp]',
  33896. setTag = '[object Set]',
  33897. stringTag = '[object String]',
  33898. symbolTag = '[object Symbol]';
  33899. var arrayBufferTag = '[object ArrayBuffer]',
  33900. dataViewTag = '[object DataView]';
  33901. /** Used to convert symbols to primitives and strings. */
  33902. var symbolProto = Symbol ? Symbol.prototype : undefined,
  33903. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
  33904. /**
  33905. * A specialized version of `baseIsEqualDeep` for comparing objects of
  33906. * the same `toStringTag`.
  33907. *
  33908. * **Note:** This function only supports comparing values with tags of
  33909. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  33910. *
  33911. * @private
  33912. * @param {Object} object The object to compare.
  33913. * @param {Object} other The other object to compare.
  33914. * @param {string} tag The `toStringTag` of the objects to compare.
  33915. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  33916. * @param {Function} customizer The function to customize comparisons.
  33917. * @param {Function} equalFunc The function to determine equivalents of values.
  33918. * @param {Object} stack Tracks traversed `object` and `other` objects.
  33919. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  33920. */
  33921. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  33922. switch (tag) {
  33923. case dataViewTag:
  33924. if ((object.byteLength != other.byteLength) ||
  33925. (object.byteOffset != other.byteOffset)) {
  33926. return false;
  33927. }
  33928. object = object.buffer;
  33929. other = other.buffer;
  33930. case arrayBufferTag:
  33931. if ((object.byteLength != other.byteLength) ||
  33932. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  33933. return false;
  33934. }
  33935. return true;
  33936. case boolTag:
  33937. case dateTag:
  33938. case numberTag:
  33939. // Coerce booleans to `1` or `0` and dates to milliseconds.
  33940. // Invalid dates are coerced to `NaN`.
  33941. return eq(+object, +other);
  33942. case errorTag:
  33943. return object.name == other.name && object.message == other.message;
  33944. case regexpTag:
  33945. case stringTag:
  33946. // Coerce regexes to strings and treat strings, primitives and objects,
  33947. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  33948. // for more details.
  33949. return object == (other + '');
  33950. case mapTag:
  33951. var convert = mapToArray;
  33952. case setTag:
  33953. var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
  33954. convert || (convert = setToArray);
  33955. if (object.size != other.size && !isPartial) {
  33956. return false;
  33957. }
  33958. // Assume cyclic values are equal.
  33959. var stacked = stack.get(object);
  33960. if (stacked) {
  33961. return stacked == other;
  33962. }
  33963. bitmask |= COMPARE_UNORDERED_FLAG;
  33964. // Recursively compare objects (susceptible to call stack limits).
  33965. stack.set(object, other);
  33966. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  33967. stack['delete'](object);
  33968. return result;
  33969. case symbolTag:
  33970. if (symbolValueOf) {
  33971. return symbolValueOf.call(object) == symbolValueOf.call(other);
  33972. }
  33973. }
  33974. return false;
  33975. }
  33976. module.exports = equalByTag;
  33977. },{"./_Symbol":307,"./_Uint8Array":308,"./_equalArrays":396,"./_mapToArray":438,"./_setToArray":451,"./eq":471}],398:[function(require,module,exports){
  33978. var getAllKeys = require('./_getAllKeys');
  33979. /** Used to compose bitmasks for value comparisons. */
  33980. var COMPARE_PARTIAL_FLAG = 1;
  33981. /** Used for built-in method references. */
  33982. var objectProto = Object.prototype;
  33983. /** Used to check objects for own properties. */
  33984. var hasOwnProperty = objectProto.hasOwnProperty;
  33985. /**
  33986. * A specialized version of `baseIsEqualDeep` for objects with support for
  33987. * partial deep comparisons.
  33988. *
  33989. * @private
  33990. * @param {Object} object The object to compare.
  33991. * @param {Object} other The other object to compare.
  33992. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
  33993. * @param {Function} customizer The function to customize comparisons.
  33994. * @param {Function} equalFunc The function to determine equivalents of values.
  33995. * @param {Object} stack Tracks traversed `object` and `other` objects.
  33996. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  33997. */
  33998. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  33999. var isPartial = bitmask & COMPARE_PARTIAL_FLAG,
  34000. objProps = getAllKeys(object),
  34001. objLength = objProps.length,
  34002. othProps = getAllKeys(other),
  34003. othLength = othProps.length;
  34004. if (objLength != othLength && !isPartial) {
  34005. return false;
  34006. }
  34007. var index = objLength;
  34008. while (index--) {
  34009. var key = objProps[index];
  34010. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  34011. return false;
  34012. }
  34013. }
  34014. // Assume cyclic values are equal.
  34015. var stacked = stack.get(object);
  34016. if (stacked && stack.get(other)) {
  34017. return stacked == other;
  34018. }
  34019. var result = true;
  34020. stack.set(object, other);
  34021. stack.set(other, object);
  34022. var skipCtor = isPartial;
  34023. while (++index < objLength) {
  34024. key = objProps[index];
  34025. var objValue = object[key],
  34026. othValue = other[key];
  34027. if (customizer) {
  34028. var compared = isPartial
  34029. ? customizer(othValue, objValue, key, other, object, stack)
  34030. : customizer(objValue, othValue, key, object, other, stack);
  34031. }
  34032. // Recursively compare objects (susceptible to call stack limits).
  34033. if (!(compared === undefined
  34034. ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
  34035. : compared
  34036. )) {
  34037. result = false;
  34038. break;
  34039. }
  34040. skipCtor || (skipCtor = key == 'constructor');
  34041. }
  34042. if (result && !skipCtor) {
  34043. var objCtor = object.constructor,
  34044. othCtor = other.constructor;
  34045. // Non `Object` object instances with different constructors are not equal.
  34046. if (objCtor != othCtor &&
  34047. ('constructor' in object && 'constructor' in other) &&
  34048. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  34049. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  34050. result = false;
  34051. }
  34052. }
  34053. stack['delete'](object);
  34054. stack['delete'](other);
  34055. return result;
  34056. }
  34057. module.exports = equalObjects;
  34058. },{"./_getAllKeys":400}],399:[function(require,module,exports){
  34059. (function (global){
  34060. /** Detect free variable `global` from Node.js. */
  34061. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  34062. module.exports = freeGlobal;
  34063. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  34064. },{}],400:[function(require,module,exports){
  34065. var baseGetAllKeys = require('./_baseGetAllKeys'),
  34066. getSymbols = require('./_getSymbols'),
  34067. keys = require('./keys');
  34068. /**
  34069. * Creates an array of own enumerable property names and symbols of `object`.
  34070. *
  34071. * @private
  34072. * @param {Object} object The object to query.
  34073. * @returns {Array} Returns the array of property names and symbols.
  34074. */
  34075. function getAllKeys(object) {
  34076. return baseGetAllKeys(object, keys, getSymbols);
  34077. }
  34078. module.exports = getAllKeys;
  34079. },{"./_baseGetAllKeys":337,"./_getSymbols":407,"./keys":498}],401:[function(require,module,exports){
  34080. var baseGetAllKeys = require('./_baseGetAllKeys'),
  34081. getSymbolsIn = require('./_getSymbolsIn'),
  34082. keysIn = require('./keysIn');
  34083. /**
  34084. * Creates an array of own and inherited enumerable property names and
  34085. * symbols of `object`.
  34086. *
  34087. * @private
  34088. * @param {Object} object The object to query.
  34089. * @returns {Array} Returns the array of property names and symbols.
  34090. */
  34091. function getAllKeysIn(object) {
  34092. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  34093. }
  34094. module.exports = getAllKeysIn;
  34095. },{"./_baseGetAllKeys":337,"./_getSymbolsIn":408,"./keysIn":499}],402:[function(require,module,exports){
  34096. var isKeyable = require('./_isKeyable');
  34097. /**
  34098. * Gets the data for `map`.
  34099. *
  34100. * @private
  34101. * @param {Object} map The map to query.
  34102. * @param {string} key The reference key.
  34103. * @returns {*} Returns the map data.
  34104. */
  34105. function getMapData(map, key) {
  34106. var data = map.__data__;
  34107. return isKeyable(key)
  34108. ? data[typeof key == 'string' ? 'string' : 'hash']
  34109. : data.map;
  34110. }
  34111. module.exports = getMapData;
  34112. },{"./_isKeyable":424}],403:[function(require,module,exports){
  34113. var isStrictComparable = require('./_isStrictComparable'),
  34114. keys = require('./keys');
  34115. /**
  34116. * Gets the property names, values, and compare flags of `object`.
  34117. *
  34118. * @private
  34119. * @param {Object} object The object to query.
  34120. * @returns {Array} Returns the match data of `object`.
  34121. */
  34122. function getMatchData(object) {
  34123. var result = keys(object),
  34124. length = result.length;
  34125. while (length--) {
  34126. var key = result[length],
  34127. value = object[key];
  34128. result[length] = [key, value, isStrictComparable(value)];
  34129. }
  34130. return result;
  34131. }
  34132. module.exports = getMatchData;
  34133. },{"./_isStrictComparable":427,"./keys":498}],404:[function(require,module,exports){
  34134. var baseIsNative = require('./_baseIsNative'),
  34135. getValue = require('./_getValue');
  34136. /**
  34137. * Gets the native function at `key` of `object`.
  34138. *
  34139. * @private
  34140. * @param {Object} object The object to query.
  34141. * @param {string} key The key of the method to get.
  34142. * @returns {*} Returns the function if it's native, else `undefined`.
  34143. */
  34144. function getNative(object, key) {
  34145. var value = getValue(object, key);
  34146. return baseIsNative(value) ? value : undefined;
  34147. }
  34148. module.exports = getNative;
  34149. },{"./_baseIsNative":348,"./_getValue":410}],405:[function(require,module,exports){
  34150. var overArg = require('./_overArg');
  34151. /** Built-in value references. */
  34152. var getPrototype = overArg(Object.getPrototypeOf, Object);
  34153. module.exports = getPrototype;
  34154. },{"./_overArg":446}],406:[function(require,module,exports){
  34155. var Symbol = require('./_Symbol');
  34156. /** Used for built-in method references. */
  34157. var objectProto = Object.prototype;
  34158. /** Used to check objects for own properties. */
  34159. var hasOwnProperty = objectProto.hasOwnProperty;
  34160. /**
  34161. * Used to resolve the
  34162. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  34163. * of values.
  34164. */
  34165. var nativeObjectToString = objectProto.toString;
  34166. /** Built-in value references. */
  34167. var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  34168. /**
  34169. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  34170. *
  34171. * @private
  34172. * @param {*} value The value to query.
  34173. * @returns {string} Returns the raw `toStringTag`.
  34174. */
  34175. function getRawTag(value) {
  34176. var isOwn = hasOwnProperty.call(value, symToStringTag),
  34177. tag = value[symToStringTag];
  34178. try {
  34179. value[symToStringTag] = undefined;
  34180. var unmasked = true;
  34181. } catch (e) {}
  34182. var result = nativeObjectToString.call(value);
  34183. if (unmasked) {
  34184. if (isOwn) {
  34185. value[symToStringTag] = tag;
  34186. } else {
  34187. delete value[symToStringTag];
  34188. }
  34189. }
  34190. return result;
  34191. }
  34192. module.exports = getRawTag;
  34193. },{"./_Symbol":307}],407:[function(require,module,exports){
  34194. var arrayFilter = require('./_arrayFilter'),
  34195. stubArray = require('./stubArray');
  34196. /** Used for built-in method references. */
  34197. var objectProto = Object.prototype;
  34198. /** Built-in value references. */
  34199. var propertyIsEnumerable = objectProto.propertyIsEnumerable;
  34200. /* Built-in method references for those with the same name as other `lodash` methods. */
  34201. var nativeGetSymbols = Object.getOwnPropertySymbols;
  34202. /**
  34203. * Creates an array of the own enumerable symbols of `object`.
  34204. *
  34205. * @private
  34206. * @param {Object} object The object to query.
  34207. * @returns {Array} Returns the array of symbols.
  34208. */
  34209. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  34210. if (object == null) {
  34211. return [];
  34212. }
  34213. object = Object(object);
  34214. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  34215. return propertyIsEnumerable.call(object, symbol);
  34216. });
  34217. };
  34218. module.exports = getSymbols;
  34219. },{"./_arrayFilter":314,"./stubArray":510}],408:[function(require,module,exports){
  34220. var arrayPush = require('./_arrayPush'),
  34221. getPrototype = require('./_getPrototype'),
  34222. getSymbols = require('./_getSymbols'),
  34223. stubArray = require('./stubArray');
  34224. /* Built-in method references for those with the same name as other `lodash` methods. */
  34225. var nativeGetSymbols = Object.getOwnPropertySymbols;
  34226. /**
  34227. * Creates an array of the own and inherited enumerable symbols of `object`.
  34228. *
  34229. * @private
  34230. * @param {Object} object The object to query.
  34231. * @returns {Array} Returns the array of symbols.
  34232. */
  34233. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  34234. var result = [];
  34235. while (object) {
  34236. arrayPush(result, getSymbols(object));
  34237. object = getPrototype(object);
  34238. }
  34239. return result;
  34240. };
  34241. module.exports = getSymbolsIn;
  34242. },{"./_arrayPush":319,"./_getPrototype":405,"./_getSymbols":407,"./stubArray":510}],409:[function(require,module,exports){
  34243. var DataView = require('./_DataView'),
  34244. Map = require('./_Map'),
  34245. Promise = require('./_Promise'),
  34246. Set = require('./_Set'),
  34247. WeakMap = require('./_WeakMap'),
  34248. baseGetTag = require('./_baseGetTag'),
  34249. toSource = require('./_toSource');
  34250. /** `Object#toString` result references. */
  34251. var mapTag = '[object Map]',
  34252. objectTag = '[object Object]',
  34253. promiseTag = '[object Promise]',
  34254. setTag = '[object Set]',
  34255. weakMapTag = '[object WeakMap]';
  34256. var dataViewTag = '[object DataView]';
  34257. /** Used to detect maps, sets, and weakmaps. */
  34258. var dataViewCtorString = toSource(DataView),
  34259. mapCtorString = toSource(Map),
  34260. promiseCtorString = toSource(Promise),
  34261. setCtorString = toSource(Set),
  34262. weakMapCtorString = toSource(WeakMap);
  34263. /**
  34264. * Gets the `toStringTag` of `value`.
  34265. *
  34266. * @private
  34267. * @param {*} value The value to query.
  34268. * @returns {string} Returns the `toStringTag`.
  34269. */
  34270. var getTag = baseGetTag;
  34271. // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
  34272. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  34273. (Map && getTag(new Map) != mapTag) ||
  34274. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  34275. (Set && getTag(new Set) != setTag) ||
  34276. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  34277. getTag = function(value) {
  34278. var result = baseGetTag(value),
  34279. Ctor = result == objectTag ? value.constructor : undefined,
  34280. ctorString = Ctor ? toSource(Ctor) : '';
  34281. if (ctorString) {
  34282. switch (ctorString) {
  34283. case dataViewCtorString: return dataViewTag;
  34284. case mapCtorString: return mapTag;
  34285. case promiseCtorString: return promiseTag;
  34286. case setCtorString: return setTag;
  34287. case weakMapCtorString: return weakMapTag;
  34288. }
  34289. }
  34290. return result;
  34291. };
  34292. }
  34293. module.exports = getTag;
  34294. },{"./_DataView":298,"./_Map":301,"./_Promise":303,"./_Set":304,"./_WeakMap":309,"./_baseGetTag":338,"./_toSource":462}],410:[function(require,module,exports){
  34295. /**
  34296. * Gets the value at `key` of `object`.
  34297. *
  34298. * @private
  34299. * @param {Object} [object] The object to query.
  34300. * @param {string} key The key of the property to get.
  34301. * @returns {*} Returns the property value.
  34302. */
  34303. function getValue(object, key) {
  34304. return object == null ? undefined : object[key];
  34305. }
  34306. module.exports = getValue;
  34307. },{}],411:[function(require,module,exports){
  34308. var castPath = require('./_castPath'),
  34309. isArguments = require('./isArguments'),
  34310. isArray = require('./isArray'),
  34311. isIndex = require('./_isIndex'),
  34312. isLength = require('./isLength'),
  34313. toKey = require('./_toKey');
  34314. /**
  34315. * Checks if `path` exists on `object`.
  34316. *
  34317. * @private
  34318. * @param {Object} object The object to query.
  34319. * @param {Array|string} path The path to check.
  34320. * @param {Function} hasFunc The function to check properties.
  34321. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  34322. */
  34323. function hasPath(object, path, hasFunc) {
  34324. path = castPath(path, object);
  34325. var index = -1,
  34326. length = path.length,
  34327. result = false;
  34328. while (++index < length) {
  34329. var key = toKey(path[index]);
  34330. if (!(result = object != null && hasFunc(object, key))) {
  34331. break;
  34332. }
  34333. object = object[key];
  34334. }
  34335. if (result || ++index != length) {
  34336. return result;
  34337. }
  34338. length = object == null ? 0 : object.length;
  34339. return !!length && isLength(length) && isIndex(key, length) &&
  34340. (isArray(object) || isArguments(object));
  34341. }
  34342. module.exports = hasPath;
  34343. },{"./_castPath":373,"./_isIndex":421,"./_toKey":461,"./isArguments":483,"./isArray":484,"./isLength":490}],412:[function(require,module,exports){
  34344. var nativeCreate = require('./_nativeCreate');
  34345. /**
  34346. * Removes all key-value entries from the hash.
  34347. *
  34348. * @private
  34349. * @name clear
  34350. * @memberOf Hash
  34351. */
  34352. function hashClear() {
  34353. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  34354. this.size = 0;
  34355. }
  34356. module.exports = hashClear;
  34357. },{"./_nativeCreate":441}],413:[function(require,module,exports){
  34358. /**
  34359. * Removes `key` and its value from the hash.
  34360. *
  34361. * @private
  34362. * @name delete
  34363. * @memberOf Hash
  34364. * @param {Object} hash The hash to modify.
  34365. * @param {string} key The key of the value to remove.
  34366. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  34367. */
  34368. function hashDelete(key) {
  34369. var result = this.has(key) && delete this.__data__[key];
  34370. this.size -= result ? 1 : 0;
  34371. return result;
  34372. }
  34373. module.exports = hashDelete;
  34374. },{}],414:[function(require,module,exports){
  34375. var nativeCreate = require('./_nativeCreate');
  34376. /** Used to stand-in for `undefined` hash values. */
  34377. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  34378. /** Used for built-in method references. */
  34379. var objectProto = Object.prototype;
  34380. /** Used to check objects for own properties. */
  34381. var hasOwnProperty = objectProto.hasOwnProperty;
  34382. /**
  34383. * Gets the hash value for `key`.
  34384. *
  34385. * @private
  34386. * @name get
  34387. * @memberOf Hash
  34388. * @param {string} key The key of the value to get.
  34389. * @returns {*} Returns the entry value.
  34390. */
  34391. function hashGet(key) {
  34392. var data = this.__data__;
  34393. if (nativeCreate) {
  34394. var result = data[key];
  34395. return result === HASH_UNDEFINED ? undefined : result;
  34396. }
  34397. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  34398. }
  34399. module.exports = hashGet;
  34400. },{"./_nativeCreate":441}],415:[function(require,module,exports){
  34401. var nativeCreate = require('./_nativeCreate');
  34402. /** Used for built-in method references. */
  34403. var objectProto = Object.prototype;
  34404. /** Used to check objects for own properties. */
  34405. var hasOwnProperty = objectProto.hasOwnProperty;
  34406. /**
  34407. * Checks if a hash value for `key` exists.
  34408. *
  34409. * @private
  34410. * @name has
  34411. * @memberOf Hash
  34412. * @param {string} key The key of the entry to check.
  34413. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  34414. */
  34415. function hashHas(key) {
  34416. var data = this.__data__;
  34417. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  34418. }
  34419. module.exports = hashHas;
  34420. },{"./_nativeCreate":441}],416:[function(require,module,exports){
  34421. var nativeCreate = require('./_nativeCreate');
  34422. /** Used to stand-in for `undefined` hash values. */
  34423. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  34424. /**
  34425. * Sets the hash `key` to `value`.
  34426. *
  34427. * @private
  34428. * @name set
  34429. * @memberOf Hash
  34430. * @param {string} key The key of the value to set.
  34431. * @param {*} value The value to set.
  34432. * @returns {Object} Returns the hash instance.
  34433. */
  34434. function hashSet(key, value) {
  34435. var data = this.__data__;
  34436. this.size += this.has(key) ? 0 : 1;
  34437. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  34438. return this;
  34439. }
  34440. module.exports = hashSet;
  34441. },{"./_nativeCreate":441}],417:[function(require,module,exports){
  34442. /** Used for built-in method references. */
  34443. var objectProto = Object.prototype;
  34444. /** Used to check objects for own properties. */
  34445. var hasOwnProperty = objectProto.hasOwnProperty;
  34446. /**
  34447. * Initializes an array clone.
  34448. *
  34449. * @private
  34450. * @param {Array} array The array to clone.
  34451. * @returns {Array} Returns the initialized clone.
  34452. */
  34453. function initCloneArray(array) {
  34454. var length = array.length,
  34455. result = array.constructor(length);
  34456. // Add properties assigned by `RegExp#exec`.
  34457. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {
  34458. result.index = array.index;
  34459. result.input = array.input;
  34460. }
  34461. return result;
  34462. }
  34463. module.exports = initCloneArray;
  34464. },{}],418:[function(require,module,exports){
  34465. var cloneArrayBuffer = require('./_cloneArrayBuffer'),
  34466. cloneDataView = require('./_cloneDataView'),
  34467. cloneMap = require('./_cloneMap'),
  34468. cloneRegExp = require('./_cloneRegExp'),
  34469. cloneSet = require('./_cloneSet'),
  34470. cloneSymbol = require('./_cloneSymbol'),
  34471. cloneTypedArray = require('./_cloneTypedArray');
  34472. /** `Object#toString` result references. */
  34473. var boolTag = '[object Boolean]',
  34474. dateTag = '[object Date]',
  34475. mapTag = '[object Map]',
  34476. numberTag = '[object Number]',
  34477. regexpTag = '[object RegExp]',
  34478. setTag = '[object Set]',
  34479. stringTag = '[object String]',
  34480. symbolTag = '[object Symbol]';
  34481. var arrayBufferTag = '[object ArrayBuffer]',
  34482. dataViewTag = '[object DataView]',
  34483. float32Tag = '[object Float32Array]',
  34484. float64Tag = '[object Float64Array]',
  34485. int8Tag = '[object Int8Array]',
  34486. int16Tag = '[object Int16Array]',
  34487. int32Tag = '[object Int32Array]',
  34488. uint8Tag = '[object Uint8Array]',
  34489. uint8ClampedTag = '[object Uint8ClampedArray]',
  34490. uint16Tag = '[object Uint16Array]',
  34491. uint32Tag = '[object Uint32Array]';
  34492. /**
  34493. * Initializes an object clone based on its `toStringTag`.
  34494. *
  34495. * **Note:** This function only supports cloning values with tags of
  34496. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  34497. *
  34498. * @private
  34499. * @param {Object} object The object to clone.
  34500. * @param {string} tag The `toStringTag` of the object to clone.
  34501. * @param {Function} cloneFunc The function to clone values.
  34502. * @param {boolean} [isDeep] Specify a deep clone.
  34503. * @returns {Object} Returns the initialized clone.
  34504. */
  34505. function initCloneByTag(object, tag, cloneFunc, isDeep) {
  34506. var Ctor = object.constructor;
  34507. switch (tag) {
  34508. case arrayBufferTag:
  34509. return cloneArrayBuffer(object);
  34510. case boolTag:
  34511. case dateTag:
  34512. return new Ctor(+object);
  34513. case dataViewTag:
  34514. return cloneDataView(object, isDeep);
  34515. case float32Tag: case float64Tag:
  34516. case int8Tag: case int16Tag: case int32Tag:
  34517. case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:
  34518. return cloneTypedArray(object, isDeep);
  34519. case mapTag:
  34520. return cloneMap(object, isDeep, cloneFunc);
  34521. case numberTag:
  34522. case stringTag:
  34523. return new Ctor(object);
  34524. case regexpTag:
  34525. return cloneRegExp(object);
  34526. case setTag:
  34527. return cloneSet(object, isDeep, cloneFunc);
  34528. case symbolTag:
  34529. return cloneSymbol(object);
  34530. }
  34531. }
  34532. module.exports = initCloneByTag;
  34533. },{"./_cloneArrayBuffer":374,"./_cloneDataView":376,"./_cloneMap":377,"./_cloneRegExp":378,"./_cloneSet":379,"./_cloneSymbol":380,"./_cloneTypedArray":381}],419:[function(require,module,exports){
  34534. var baseCreate = require('./_baseCreate'),
  34535. getPrototype = require('./_getPrototype'),
  34536. isPrototype = require('./_isPrototype');
  34537. /**
  34538. * Initializes an object clone.
  34539. *
  34540. * @private
  34541. * @param {Object} object The object to clone.
  34542. * @returns {Object} Returns the initialized clone.
  34543. */
  34544. function initCloneObject(object) {
  34545. return (typeof object.constructor == 'function' && !isPrototype(object))
  34546. ? baseCreate(getPrototype(object))
  34547. : {};
  34548. }
  34549. module.exports = initCloneObject;
  34550. },{"./_baseCreate":330,"./_getPrototype":405,"./_isPrototype":426}],420:[function(require,module,exports){
  34551. var Symbol = require('./_Symbol'),
  34552. isArguments = require('./isArguments'),
  34553. isArray = require('./isArray');
  34554. /** Built-in value references. */
  34555. var spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
  34556. /**
  34557. * Checks if `value` is a flattenable `arguments` object or array.
  34558. *
  34559. * @private
  34560. * @param {*} value The value to check.
  34561. * @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
  34562. */
  34563. function isFlattenable(value) {
  34564. return isArray(value) || isArguments(value) ||
  34565. !!(spreadableSymbol && value && value[spreadableSymbol]);
  34566. }
  34567. module.exports = isFlattenable;
  34568. },{"./_Symbol":307,"./isArguments":483,"./isArray":484}],421:[function(require,module,exports){
  34569. /** Used as references for various `Number` constants. */
  34570. var MAX_SAFE_INTEGER = 9007199254740991;
  34571. /** Used to detect unsigned integer values. */
  34572. var reIsUint = /^(?:0|[1-9]\d*)$/;
  34573. /**
  34574. * Checks if `value` is a valid array-like index.
  34575. *
  34576. * @private
  34577. * @param {*} value The value to check.
  34578. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  34579. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  34580. */
  34581. function isIndex(value, length) {
  34582. length = length == null ? MAX_SAFE_INTEGER : length;
  34583. return !!length &&
  34584. (typeof value == 'number' || reIsUint.test(value)) &&
  34585. (value > -1 && value % 1 == 0 && value < length);
  34586. }
  34587. module.exports = isIndex;
  34588. },{}],422:[function(require,module,exports){
  34589. var eq = require('./eq'),
  34590. isArrayLike = require('./isArrayLike'),
  34591. isIndex = require('./_isIndex'),
  34592. isObject = require('./isObject');
  34593. /**
  34594. * Checks if the given arguments are from an iteratee call.
  34595. *
  34596. * @private
  34597. * @param {*} value The potential iteratee value argument.
  34598. * @param {*} index The potential iteratee index or key argument.
  34599. * @param {*} object The potential iteratee object argument.
  34600. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  34601. * else `false`.
  34602. */
  34603. function isIterateeCall(value, index, object) {
  34604. if (!isObject(object)) {
  34605. return false;
  34606. }
  34607. var type = typeof index;
  34608. if (type == 'number'
  34609. ? (isArrayLike(object) && isIndex(index, object.length))
  34610. : (type == 'string' && index in object)
  34611. ) {
  34612. return eq(object[index], value);
  34613. }
  34614. return false;
  34615. }
  34616. module.exports = isIterateeCall;
  34617. },{"./_isIndex":421,"./eq":471,"./isArrayLike":485,"./isObject":491}],423:[function(require,module,exports){
  34618. var isArray = require('./isArray'),
  34619. isSymbol = require('./isSymbol');
  34620. /** Used to match property names within property paths. */
  34621. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  34622. reIsPlainProp = /^\w*$/;
  34623. /**
  34624. * Checks if `value` is a property name and not a property path.
  34625. *
  34626. * @private
  34627. * @param {*} value The value to check.
  34628. * @param {Object} [object] The object to query keys on.
  34629. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  34630. */
  34631. function isKey(value, object) {
  34632. if (isArray(value)) {
  34633. return false;
  34634. }
  34635. var type = typeof value;
  34636. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  34637. value == null || isSymbol(value)) {
  34638. return true;
  34639. }
  34640. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  34641. (object != null && value in Object(object));
  34642. }
  34643. module.exports = isKey;
  34644. },{"./isArray":484,"./isSymbol":496}],424:[function(require,module,exports){
  34645. /**
  34646. * Checks if `value` is suitable for use as unique object key.
  34647. *
  34648. * @private
  34649. * @param {*} value The value to check.
  34650. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  34651. */
  34652. function isKeyable(value) {
  34653. var type = typeof value;
  34654. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  34655. ? (value !== '__proto__')
  34656. : (value === null);
  34657. }
  34658. module.exports = isKeyable;
  34659. },{}],425:[function(require,module,exports){
  34660. var coreJsData = require('./_coreJsData');
  34661. /** Used to detect methods masquerading as native. */
  34662. var maskSrcKey = (function() {
  34663. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  34664. return uid ? ('Symbol(src)_1.' + uid) : '';
  34665. }());
  34666. /**
  34667. * Checks if `func` has its source masked.
  34668. *
  34669. * @private
  34670. * @param {Function} func The function to check.
  34671. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  34672. */
  34673. function isMasked(func) {
  34674. return !!maskSrcKey && (maskSrcKey in func);
  34675. }
  34676. module.exports = isMasked;
  34677. },{"./_coreJsData":388}],426:[function(require,module,exports){
  34678. /** Used for built-in method references. */
  34679. var objectProto = Object.prototype;
  34680. /**
  34681. * Checks if `value` is likely a prototype object.
  34682. *
  34683. * @private
  34684. * @param {*} value The value to check.
  34685. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  34686. */
  34687. function isPrototype(value) {
  34688. var Ctor = value && value.constructor,
  34689. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  34690. return value === proto;
  34691. }
  34692. module.exports = isPrototype;
  34693. },{}],427:[function(require,module,exports){
  34694. var isObject = require('./isObject');
  34695. /**
  34696. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  34697. *
  34698. * @private
  34699. * @param {*} value The value to check.
  34700. * @returns {boolean} Returns `true` if `value` if suitable for strict
  34701. * equality comparisons, else `false`.
  34702. */
  34703. function isStrictComparable(value) {
  34704. return value === value && !isObject(value);
  34705. }
  34706. module.exports = isStrictComparable;
  34707. },{"./isObject":491}],428:[function(require,module,exports){
  34708. /**
  34709. * Removes all key-value entries from the list cache.
  34710. *
  34711. * @private
  34712. * @name clear
  34713. * @memberOf ListCache
  34714. */
  34715. function listCacheClear() {
  34716. this.__data__ = [];
  34717. this.size = 0;
  34718. }
  34719. module.exports = listCacheClear;
  34720. },{}],429:[function(require,module,exports){
  34721. var assocIndexOf = require('./_assocIndexOf');
  34722. /** Used for built-in method references. */
  34723. var arrayProto = Array.prototype;
  34724. /** Built-in value references. */
  34725. var splice = arrayProto.splice;
  34726. /**
  34727. * Removes `key` and its value from the list cache.
  34728. *
  34729. * @private
  34730. * @name delete
  34731. * @memberOf ListCache
  34732. * @param {string} key The key of the value to remove.
  34733. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  34734. */
  34735. function listCacheDelete(key) {
  34736. var data = this.__data__,
  34737. index = assocIndexOf(data, key);
  34738. if (index < 0) {
  34739. return false;
  34740. }
  34741. var lastIndex = data.length - 1;
  34742. if (index == lastIndex) {
  34743. data.pop();
  34744. } else {
  34745. splice.call(data, index, 1);
  34746. }
  34747. --this.size;
  34748. return true;
  34749. }
  34750. module.exports = listCacheDelete;
  34751. },{"./_assocIndexOf":324}],430:[function(require,module,exports){
  34752. var assocIndexOf = require('./_assocIndexOf');
  34753. /**
  34754. * Gets the list cache value for `key`.
  34755. *
  34756. * @private
  34757. * @name get
  34758. * @memberOf ListCache
  34759. * @param {string} key The key of the value to get.
  34760. * @returns {*} Returns the entry value.
  34761. */
  34762. function listCacheGet(key) {
  34763. var data = this.__data__,
  34764. index = assocIndexOf(data, key);
  34765. return index < 0 ? undefined : data[index][1];
  34766. }
  34767. module.exports = listCacheGet;
  34768. },{"./_assocIndexOf":324}],431:[function(require,module,exports){
  34769. var assocIndexOf = require('./_assocIndexOf');
  34770. /**
  34771. * Checks if a list cache value for `key` exists.
  34772. *
  34773. * @private
  34774. * @name has
  34775. * @memberOf ListCache
  34776. * @param {string} key The key of the entry to check.
  34777. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  34778. */
  34779. function listCacheHas(key) {
  34780. return assocIndexOf(this.__data__, key) > -1;
  34781. }
  34782. module.exports = listCacheHas;
  34783. },{"./_assocIndexOf":324}],432:[function(require,module,exports){
  34784. var assocIndexOf = require('./_assocIndexOf');
  34785. /**
  34786. * Sets the list cache `key` to `value`.
  34787. *
  34788. * @private
  34789. * @name set
  34790. * @memberOf ListCache
  34791. * @param {string} key The key of the value to set.
  34792. * @param {*} value The value to set.
  34793. * @returns {Object} Returns the list cache instance.
  34794. */
  34795. function listCacheSet(key, value) {
  34796. var data = this.__data__,
  34797. index = assocIndexOf(data, key);
  34798. if (index < 0) {
  34799. ++this.size;
  34800. data.push([key, value]);
  34801. } else {
  34802. data[index][1] = value;
  34803. }
  34804. return this;
  34805. }
  34806. module.exports = listCacheSet;
  34807. },{"./_assocIndexOf":324}],433:[function(require,module,exports){
  34808. var Hash = require('./_Hash'),
  34809. ListCache = require('./_ListCache'),
  34810. Map = require('./_Map');
  34811. /**
  34812. * Removes all key-value entries from the map.
  34813. *
  34814. * @private
  34815. * @name clear
  34816. * @memberOf MapCache
  34817. */
  34818. function mapCacheClear() {
  34819. this.size = 0;
  34820. this.__data__ = {
  34821. 'hash': new Hash,
  34822. 'map': new (Map || ListCache),
  34823. 'string': new Hash
  34824. };
  34825. }
  34826. module.exports = mapCacheClear;
  34827. },{"./_Hash":299,"./_ListCache":300,"./_Map":301}],434:[function(require,module,exports){
  34828. var getMapData = require('./_getMapData');
  34829. /**
  34830. * Removes `key` and its value from the map.
  34831. *
  34832. * @private
  34833. * @name delete
  34834. * @memberOf MapCache
  34835. * @param {string} key The key of the value to remove.
  34836. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  34837. */
  34838. function mapCacheDelete(key) {
  34839. var result = getMapData(this, key)['delete'](key);
  34840. this.size -= result ? 1 : 0;
  34841. return result;
  34842. }
  34843. module.exports = mapCacheDelete;
  34844. },{"./_getMapData":402}],435:[function(require,module,exports){
  34845. var getMapData = require('./_getMapData');
  34846. /**
  34847. * Gets the map value for `key`.
  34848. *
  34849. * @private
  34850. * @name get
  34851. * @memberOf MapCache
  34852. * @param {string} key The key of the value to get.
  34853. * @returns {*} Returns the entry value.
  34854. */
  34855. function mapCacheGet(key) {
  34856. return getMapData(this, key).get(key);
  34857. }
  34858. module.exports = mapCacheGet;
  34859. },{"./_getMapData":402}],436:[function(require,module,exports){
  34860. var getMapData = require('./_getMapData');
  34861. /**
  34862. * Checks if a map value for `key` exists.
  34863. *
  34864. * @private
  34865. * @name has
  34866. * @memberOf MapCache
  34867. * @param {string} key The key of the entry to check.
  34868. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  34869. */
  34870. function mapCacheHas(key) {
  34871. return getMapData(this, key).has(key);
  34872. }
  34873. module.exports = mapCacheHas;
  34874. },{"./_getMapData":402}],437:[function(require,module,exports){
  34875. var getMapData = require('./_getMapData');
  34876. /**
  34877. * Sets the map `key` to `value`.
  34878. *
  34879. * @private
  34880. * @name set
  34881. * @memberOf MapCache
  34882. * @param {string} key The key of the value to set.
  34883. * @param {*} value The value to set.
  34884. * @returns {Object} Returns the map cache instance.
  34885. */
  34886. function mapCacheSet(key, value) {
  34887. var data = getMapData(this, key),
  34888. size = data.size;
  34889. data.set(key, value);
  34890. this.size += data.size == size ? 0 : 1;
  34891. return this;
  34892. }
  34893. module.exports = mapCacheSet;
  34894. },{"./_getMapData":402}],438:[function(require,module,exports){
  34895. /**
  34896. * Converts `map` to its key-value pairs.
  34897. *
  34898. * @private
  34899. * @param {Object} map The map to convert.
  34900. * @returns {Array} Returns the key-value pairs.
  34901. */
  34902. function mapToArray(map) {
  34903. var index = -1,
  34904. result = Array(map.size);
  34905. map.forEach(function(value, key) {
  34906. result[++index] = [key, value];
  34907. });
  34908. return result;
  34909. }
  34910. module.exports = mapToArray;
  34911. },{}],439:[function(require,module,exports){
  34912. /**
  34913. * A specialized version of `matchesProperty` for source values suitable
  34914. * for strict equality comparisons, i.e. `===`.
  34915. *
  34916. * @private
  34917. * @param {string} key The key of the property to get.
  34918. * @param {*} srcValue The value to match.
  34919. * @returns {Function} Returns the new spec function.
  34920. */
  34921. function matchesStrictComparable(key, srcValue) {
  34922. return function(object) {
  34923. if (object == null) {
  34924. return false;
  34925. }
  34926. return object[key] === srcValue &&
  34927. (srcValue !== undefined || (key in Object(object)));
  34928. };
  34929. }
  34930. module.exports = matchesStrictComparable;
  34931. },{}],440:[function(require,module,exports){
  34932. var memoize = require('./memoize');
  34933. /** Used as the maximum memoize cache size. */
  34934. var MAX_MEMOIZE_SIZE = 500;
  34935. /**
  34936. * A specialized version of `_.memoize` which clears the memoized function's
  34937. * cache when it exceeds `MAX_MEMOIZE_SIZE`.
  34938. *
  34939. * @private
  34940. * @param {Function} func The function to have its output memoized.
  34941. * @returns {Function} Returns the new memoized function.
  34942. */
  34943. function memoizeCapped(func) {
  34944. var result = memoize(func, function(key) {
  34945. if (cache.size === MAX_MEMOIZE_SIZE) {
  34946. cache.clear();
  34947. }
  34948. return key;
  34949. });
  34950. var cache = result.cache;
  34951. return result;
  34952. }
  34953. module.exports = memoizeCapped;
  34954. },{"./memoize":501}],441:[function(require,module,exports){
  34955. var getNative = require('./_getNative');
  34956. /* Built-in method references that are verified to be native. */
  34957. var nativeCreate = getNative(Object, 'create');
  34958. module.exports = nativeCreate;
  34959. },{"./_getNative":404}],442:[function(require,module,exports){
  34960. var overArg = require('./_overArg');
  34961. /* Built-in method references for those with the same name as other `lodash` methods. */
  34962. var nativeKeys = overArg(Object.keys, Object);
  34963. module.exports = nativeKeys;
  34964. },{"./_overArg":446}],443:[function(require,module,exports){
  34965. /**
  34966. * This function is like
  34967. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  34968. * except that it includes inherited enumerable properties.
  34969. *
  34970. * @private
  34971. * @param {Object} object The object to query.
  34972. * @returns {Array} Returns the array of property names.
  34973. */
  34974. function nativeKeysIn(object) {
  34975. var result = [];
  34976. if (object != null) {
  34977. for (var key in Object(object)) {
  34978. result.push(key);
  34979. }
  34980. }
  34981. return result;
  34982. }
  34983. module.exports = nativeKeysIn;
  34984. },{}],444:[function(require,module,exports){
  34985. var freeGlobal = require('./_freeGlobal');
  34986. /** Detect free variable `exports`. */
  34987. var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
  34988. /** Detect free variable `module`. */
  34989. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  34990. /** Detect the popular CommonJS extension `module.exports`. */
  34991. var moduleExports = freeModule && freeModule.exports === freeExports;
  34992. /** Detect free variable `process` from Node.js. */
  34993. var freeProcess = moduleExports && freeGlobal.process;
  34994. /** Used to access faster Node.js helpers. */
  34995. var nodeUtil = (function() {
  34996. try {
  34997. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  34998. } catch (e) {}
  34999. }());
  35000. module.exports = nodeUtil;
  35001. },{"./_freeGlobal":399}],445:[function(require,module,exports){
  35002. /** Used for built-in method references. */
  35003. var objectProto = Object.prototype;
  35004. /**
  35005. * Used to resolve the
  35006. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  35007. * of values.
  35008. */
  35009. var nativeObjectToString = objectProto.toString;
  35010. /**
  35011. * Converts `value` to a string using `Object.prototype.toString`.
  35012. *
  35013. * @private
  35014. * @param {*} value The value to convert.
  35015. * @returns {string} Returns the converted string.
  35016. */
  35017. function objectToString(value) {
  35018. return nativeObjectToString.call(value);
  35019. }
  35020. module.exports = objectToString;
  35021. },{}],446:[function(require,module,exports){
  35022. /**
  35023. * Creates a unary function that invokes `func` with its argument transformed.
  35024. *
  35025. * @private
  35026. * @param {Function} func The function to wrap.
  35027. * @param {Function} transform The argument transform.
  35028. * @returns {Function} Returns the new function.
  35029. */
  35030. function overArg(func, transform) {
  35031. return function(arg) {
  35032. return func(transform(arg));
  35033. };
  35034. }
  35035. module.exports = overArg;
  35036. },{}],447:[function(require,module,exports){
  35037. var apply = require('./_apply');
  35038. /* Built-in method references for those with the same name as other `lodash` methods. */
  35039. var nativeMax = Math.max;
  35040. /**
  35041. * A specialized version of `baseRest` which transforms the rest array.
  35042. *
  35043. * @private
  35044. * @param {Function} func The function to apply a rest parameter to.
  35045. * @param {number} [start=func.length-1] The start position of the rest parameter.
  35046. * @param {Function} transform The rest array transform.
  35047. * @returns {Function} Returns the new function.
  35048. */
  35049. function overRest(func, start, transform) {
  35050. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  35051. return function() {
  35052. var args = arguments,
  35053. index = -1,
  35054. length = nativeMax(args.length - start, 0),
  35055. array = Array(length);
  35056. while (++index < length) {
  35057. array[index] = args[start + index];
  35058. }
  35059. index = -1;
  35060. var otherArgs = Array(start + 1);
  35061. while (++index < start) {
  35062. otherArgs[index] = args[index];
  35063. }
  35064. otherArgs[start] = transform(array);
  35065. return apply(func, this, otherArgs);
  35066. };
  35067. }
  35068. module.exports = overRest;
  35069. },{"./_apply":312}],448:[function(require,module,exports){
  35070. var freeGlobal = require('./_freeGlobal');
  35071. /** Detect free variable `self`. */
  35072. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  35073. /** Used as a reference to the global object. */
  35074. var root = freeGlobal || freeSelf || Function('return this')();
  35075. module.exports = root;
  35076. },{"./_freeGlobal":399}],449:[function(require,module,exports){
  35077. /** Used to stand-in for `undefined` hash values. */
  35078. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  35079. /**
  35080. * Adds `value` to the array cache.
  35081. *
  35082. * @private
  35083. * @name add
  35084. * @memberOf SetCache
  35085. * @alias push
  35086. * @param {*} value The value to cache.
  35087. * @returns {Object} Returns the cache instance.
  35088. */
  35089. function setCacheAdd(value) {
  35090. this.__data__.set(value, HASH_UNDEFINED);
  35091. return this;
  35092. }
  35093. module.exports = setCacheAdd;
  35094. },{}],450:[function(require,module,exports){
  35095. /**
  35096. * Checks if `value` is in the array cache.
  35097. *
  35098. * @private
  35099. * @name has
  35100. * @memberOf SetCache
  35101. * @param {*} value The value to search for.
  35102. * @returns {number} Returns `true` if `value` is found, else `false`.
  35103. */
  35104. function setCacheHas(value) {
  35105. return this.__data__.has(value);
  35106. }
  35107. module.exports = setCacheHas;
  35108. },{}],451:[function(require,module,exports){
  35109. /**
  35110. * Converts `set` to an array of its values.
  35111. *
  35112. * @private
  35113. * @param {Object} set The set to convert.
  35114. * @returns {Array} Returns the values.
  35115. */
  35116. function setToArray(set) {
  35117. var index = -1,
  35118. result = Array(set.size);
  35119. set.forEach(function(value) {
  35120. result[++index] = value;
  35121. });
  35122. return result;
  35123. }
  35124. module.exports = setToArray;
  35125. },{}],452:[function(require,module,exports){
  35126. var baseSetToString = require('./_baseSetToString'),
  35127. shortOut = require('./_shortOut');
  35128. /**
  35129. * Sets the `toString` method of `func` to return `string`.
  35130. *
  35131. * @private
  35132. * @param {Function} func The function to modify.
  35133. * @param {Function} string The `toString` result.
  35134. * @returns {Function} Returns `func`.
  35135. */
  35136. var setToString = shortOut(baseSetToString);
  35137. module.exports = setToString;
  35138. },{"./_baseSetToString":365,"./_shortOut":453}],453:[function(require,module,exports){
  35139. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  35140. var HOT_COUNT = 800,
  35141. HOT_SPAN = 16;
  35142. /* Built-in method references for those with the same name as other `lodash` methods. */
  35143. var nativeNow = Date.now;
  35144. /**
  35145. * Creates a function that'll short out and invoke `identity` instead
  35146. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  35147. * milliseconds.
  35148. *
  35149. * @private
  35150. * @param {Function} func The function to restrict.
  35151. * @returns {Function} Returns the new shortable function.
  35152. */
  35153. function shortOut(func) {
  35154. var count = 0,
  35155. lastCalled = 0;
  35156. return function() {
  35157. var stamp = nativeNow(),
  35158. remaining = HOT_SPAN - (stamp - lastCalled);
  35159. lastCalled = stamp;
  35160. if (remaining > 0) {
  35161. if (++count >= HOT_COUNT) {
  35162. return arguments[0];
  35163. }
  35164. } else {
  35165. count = 0;
  35166. }
  35167. return func.apply(undefined, arguments);
  35168. };
  35169. }
  35170. module.exports = shortOut;
  35171. },{}],454:[function(require,module,exports){
  35172. var ListCache = require('./_ListCache');
  35173. /**
  35174. * Removes all key-value entries from the stack.
  35175. *
  35176. * @private
  35177. * @name clear
  35178. * @memberOf Stack
  35179. */
  35180. function stackClear() {
  35181. this.__data__ = new ListCache;
  35182. this.size = 0;
  35183. }
  35184. module.exports = stackClear;
  35185. },{"./_ListCache":300}],455:[function(require,module,exports){
  35186. /**
  35187. * Removes `key` and its value from the stack.
  35188. *
  35189. * @private
  35190. * @name delete
  35191. * @memberOf Stack
  35192. * @param {string} key The key of the value to remove.
  35193. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  35194. */
  35195. function stackDelete(key) {
  35196. var data = this.__data__,
  35197. result = data['delete'](key);
  35198. this.size = data.size;
  35199. return result;
  35200. }
  35201. module.exports = stackDelete;
  35202. },{}],456:[function(require,module,exports){
  35203. /**
  35204. * Gets the stack value for `key`.
  35205. *
  35206. * @private
  35207. * @name get
  35208. * @memberOf Stack
  35209. * @param {string} key The key of the value to get.
  35210. * @returns {*} Returns the entry value.
  35211. */
  35212. function stackGet(key) {
  35213. return this.__data__.get(key);
  35214. }
  35215. module.exports = stackGet;
  35216. },{}],457:[function(require,module,exports){
  35217. /**
  35218. * Checks if a stack value for `key` exists.
  35219. *
  35220. * @private
  35221. * @name has
  35222. * @memberOf Stack
  35223. * @param {string} key The key of the entry to check.
  35224. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  35225. */
  35226. function stackHas(key) {
  35227. return this.__data__.has(key);
  35228. }
  35229. module.exports = stackHas;
  35230. },{}],458:[function(require,module,exports){
  35231. var ListCache = require('./_ListCache'),
  35232. Map = require('./_Map'),
  35233. MapCache = require('./_MapCache');
  35234. /** Used as the size to enable large array optimizations. */
  35235. var LARGE_ARRAY_SIZE = 200;
  35236. /**
  35237. * Sets the stack `key` to `value`.
  35238. *
  35239. * @private
  35240. * @name set
  35241. * @memberOf Stack
  35242. * @param {string} key The key of the value to set.
  35243. * @param {*} value The value to set.
  35244. * @returns {Object} Returns the stack cache instance.
  35245. */
  35246. function stackSet(key, value) {
  35247. var data = this.__data__;
  35248. if (data instanceof ListCache) {
  35249. var pairs = data.__data__;
  35250. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  35251. pairs.push([key, value]);
  35252. this.size = ++data.size;
  35253. return this;
  35254. }
  35255. data = this.__data__ = new MapCache(pairs);
  35256. }
  35257. data.set(key, value);
  35258. this.size = data.size;
  35259. return this;
  35260. }
  35261. module.exports = stackSet;
  35262. },{"./_ListCache":300,"./_Map":301,"./_MapCache":302}],459:[function(require,module,exports){
  35263. /**
  35264. * A specialized version of `_.indexOf` which performs strict equality
  35265. * comparisons of values, i.e. `===`.
  35266. *
  35267. * @private
  35268. * @param {Array} array The array to inspect.
  35269. * @param {*} value The value to search for.
  35270. * @param {number} fromIndex The index to search from.
  35271. * @returns {number} Returns the index of the matched value, else `-1`.
  35272. */
  35273. function strictIndexOf(array, value, fromIndex) {
  35274. var index = fromIndex - 1,
  35275. length = array.length;
  35276. while (++index < length) {
  35277. if (array[index] === value) {
  35278. return index;
  35279. }
  35280. }
  35281. return -1;
  35282. }
  35283. module.exports = strictIndexOf;
  35284. },{}],460:[function(require,module,exports){
  35285. var memoizeCapped = require('./_memoizeCapped');
  35286. /** Used to match property names within property paths. */
  35287. var reLeadingDot = /^\./,
  35288. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  35289. /** Used to match backslashes in property paths. */
  35290. var reEscapeChar = /\\(\\)?/g;
  35291. /**
  35292. * Converts `string` to a property path array.
  35293. *
  35294. * @private
  35295. * @param {string} string The string to convert.
  35296. * @returns {Array} Returns the property path array.
  35297. */
  35298. var stringToPath = memoizeCapped(function(string) {
  35299. var result = [];
  35300. if (reLeadingDot.test(string)) {
  35301. result.push('');
  35302. }
  35303. string.replace(rePropName, function(match, number, quote, string) {
  35304. result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
  35305. });
  35306. return result;
  35307. });
  35308. module.exports = stringToPath;
  35309. },{"./_memoizeCapped":440}],461:[function(require,module,exports){
  35310. var isSymbol = require('./isSymbol');
  35311. /** Used as references for various `Number` constants. */
  35312. var INFINITY = 1 / 0;
  35313. /**
  35314. * Converts `value` to a string key if it's not a string or symbol.
  35315. *
  35316. * @private
  35317. * @param {*} value The value to inspect.
  35318. * @returns {string|symbol} Returns the key.
  35319. */
  35320. function toKey(value) {
  35321. if (typeof value == 'string' || isSymbol(value)) {
  35322. return value;
  35323. }
  35324. var result = (value + '');
  35325. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  35326. }
  35327. module.exports = toKey;
  35328. },{"./isSymbol":496}],462:[function(require,module,exports){
  35329. /** Used for built-in method references. */
  35330. var funcProto = Function.prototype;
  35331. /** Used to resolve the decompiled source of functions. */
  35332. var funcToString = funcProto.toString;
  35333. /**
  35334. * Converts `func` to its source code.
  35335. *
  35336. * @private
  35337. * @param {Function} func The function to convert.
  35338. * @returns {string} Returns the source code.
  35339. */
  35340. function toSource(func) {
  35341. if (func != null) {
  35342. try {
  35343. return funcToString.call(func);
  35344. } catch (e) {}
  35345. try {
  35346. return (func + '');
  35347. } catch (e) {}
  35348. }
  35349. return '';
  35350. }
  35351. module.exports = toSource;
  35352. },{}],463:[function(require,module,exports){
  35353. var assignValue = require('./_assignValue'),
  35354. copyObject = require('./_copyObject'),
  35355. createAssigner = require('./_createAssigner'),
  35356. isArrayLike = require('./isArrayLike'),
  35357. isPrototype = require('./_isPrototype'),
  35358. keys = require('./keys');
  35359. /** Used for built-in method references. */
  35360. var objectProto = Object.prototype;
  35361. /** Used to check objects for own properties. */
  35362. var hasOwnProperty = objectProto.hasOwnProperty;
  35363. /**
  35364. * Assigns own enumerable string keyed properties of source objects to the
  35365. * destination object. Source objects are applied from left to right.
  35366. * Subsequent sources overwrite property assignments of previous sources.
  35367. *
  35368. * **Note:** This method mutates `object` and is loosely based on
  35369. * [`Object.assign`](https://mdn.io/Object/assign).
  35370. *
  35371. * @static
  35372. * @memberOf _
  35373. * @since 0.10.0
  35374. * @category Object
  35375. * @param {Object} object The destination object.
  35376. * @param {...Object} [sources] The source objects.
  35377. * @returns {Object} Returns `object`.
  35378. * @see _.assignIn
  35379. * @example
  35380. *
  35381. * function Foo() {
  35382. * this.a = 1;
  35383. * }
  35384. *
  35385. * function Bar() {
  35386. * this.c = 3;
  35387. * }
  35388. *
  35389. * Foo.prototype.b = 2;
  35390. * Bar.prototype.d = 4;
  35391. *
  35392. * _.assign({ 'a': 0 }, new Foo, new Bar);
  35393. * // => { 'a': 1, 'c': 3 }
  35394. */
  35395. var assign = createAssigner(function(object, source) {
  35396. if (isPrototype(source) || isArrayLike(source)) {
  35397. copyObject(source, keys(source), object);
  35398. return;
  35399. }
  35400. for (var key in source) {
  35401. if (hasOwnProperty.call(source, key)) {
  35402. assignValue(object, key, source[key]);
  35403. }
  35404. }
  35405. });
  35406. module.exports = assign;
  35407. },{"./_assignValue":323,"./_copyObject":385,"./_createAssigner":389,"./_isPrototype":426,"./isArrayLike":485,"./keys":498}],464:[function(require,module,exports){
  35408. var copyObject = require('./_copyObject'),
  35409. createAssigner = require('./_createAssigner'),
  35410. keysIn = require('./keysIn');
  35411. /**
  35412. * This method is like `_.assign` except that it iterates over own and
  35413. * inherited source properties.
  35414. *
  35415. * **Note:** This method mutates `object`.
  35416. *
  35417. * @static
  35418. * @memberOf _
  35419. * @since 4.0.0
  35420. * @alias extend
  35421. * @category Object
  35422. * @param {Object} object The destination object.
  35423. * @param {...Object} [sources] The source objects.
  35424. * @returns {Object} Returns `object`.
  35425. * @see _.assign
  35426. * @example
  35427. *
  35428. * function Foo() {
  35429. * this.a = 1;
  35430. * }
  35431. *
  35432. * function Bar() {
  35433. * this.c = 3;
  35434. * }
  35435. *
  35436. * Foo.prototype.b = 2;
  35437. * Bar.prototype.d = 4;
  35438. *
  35439. * _.assignIn({ 'a': 0 }, new Foo, new Bar);
  35440. * // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
  35441. */
  35442. var assignIn = createAssigner(function(object, source) {
  35443. copyObject(source, keysIn(source), object);
  35444. });
  35445. module.exports = assignIn;
  35446. },{"./_copyObject":385,"./_createAssigner":389,"./keysIn":499}],465:[function(require,module,exports){
  35447. var copyObject = require('./_copyObject'),
  35448. createAssigner = require('./_createAssigner'),
  35449. keysIn = require('./keysIn');
  35450. /**
  35451. * This method is like `_.assignIn` except that it accepts `customizer`
  35452. * which is invoked to produce the assigned values. If `customizer` returns
  35453. * `undefined`, assignment is handled by the method instead. The `customizer`
  35454. * is invoked with five arguments: (objValue, srcValue, key, object, source).
  35455. *
  35456. * **Note:** This method mutates `object`.
  35457. *
  35458. * @static
  35459. * @memberOf _
  35460. * @since 4.0.0
  35461. * @alias extendWith
  35462. * @category Object
  35463. * @param {Object} object The destination object.
  35464. * @param {...Object} sources The source objects.
  35465. * @param {Function} [customizer] The function to customize assigned values.
  35466. * @returns {Object} Returns `object`.
  35467. * @see _.assignWith
  35468. * @example
  35469. *
  35470. * function customizer(objValue, srcValue) {
  35471. * return _.isUndefined(objValue) ? srcValue : objValue;
  35472. * }
  35473. *
  35474. * var defaults = _.partialRight(_.assignInWith, customizer);
  35475. *
  35476. * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  35477. * // => { 'a': 1, 'b': 2 }
  35478. */
  35479. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  35480. copyObject(source, keysIn(source), object, customizer);
  35481. });
  35482. module.exports = assignInWith;
  35483. },{"./_copyObject":385,"./_createAssigner":389,"./keysIn":499}],466:[function(require,module,exports){
  35484. var baseClone = require('./_baseClone');
  35485. /** Used to compose bitmasks for cloning. */
  35486. var CLONE_SYMBOLS_FLAG = 4;
  35487. /**
  35488. * Creates a shallow clone of `value`.
  35489. *
  35490. * **Note:** This method is loosely based on the
  35491. * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
  35492. * and supports cloning arrays, array buffers, booleans, date objects, maps,
  35493. * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
  35494. * arrays. The own enumerable properties of `arguments` objects are cloned
  35495. * as plain objects. An empty object is returned for uncloneable values such
  35496. * as error objects, functions, DOM nodes, and WeakMaps.
  35497. *
  35498. * @static
  35499. * @memberOf _
  35500. * @since 0.1.0
  35501. * @category Lang
  35502. * @param {*} value The value to clone.
  35503. * @returns {*} Returns the cloned value.
  35504. * @see _.cloneDeep
  35505. * @example
  35506. *
  35507. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  35508. *
  35509. * var shallow = _.clone(objects);
  35510. * console.log(shallow[0] === objects[0]);
  35511. * // => true
  35512. */
  35513. function clone(value) {
  35514. return baseClone(value, CLONE_SYMBOLS_FLAG);
  35515. }
  35516. module.exports = clone;
  35517. },{"./_baseClone":329}],467:[function(require,module,exports){
  35518. var baseClone = require('./_baseClone');
  35519. /** Used to compose bitmasks for cloning. */
  35520. var CLONE_DEEP_FLAG = 1,
  35521. CLONE_SYMBOLS_FLAG = 4;
  35522. /**
  35523. * This method is like `_.clone` except that it recursively clones `value`.
  35524. *
  35525. * @static
  35526. * @memberOf _
  35527. * @since 1.0.0
  35528. * @category Lang
  35529. * @param {*} value The value to recursively clone.
  35530. * @returns {*} Returns the deep cloned value.
  35531. * @see _.clone
  35532. * @example
  35533. *
  35534. * var objects = [{ 'a': 1 }, { 'b': 2 }];
  35535. *
  35536. * var deep = _.cloneDeep(objects);
  35537. * console.log(deep[0] === objects[0]);
  35538. * // => false
  35539. */
  35540. function cloneDeep(value) {
  35541. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
  35542. }
  35543. module.exports = cloneDeep;
  35544. },{"./_baseClone":329}],468:[function(require,module,exports){
  35545. var baseClone = require('./_baseClone');
  35546. /** Used to compose bitmasks for cloning. */
  35547. var CLONE_DEEP_FLAG = 1,
  35548. CLONE_SYMBOLS_FLAG = 4;
  35549. /**
  35550. * This method is like `_.cloneWith` except that it recursively clones `value`.
  35551. *
  35552. * @static
  35553. * @memberOf _
  35554. * @since 4.0.0
  35555. * @category Lang
  35556. * @param {*} value The value to recursively clone.
  35557. * @param {Function} [customizer] The function to customize cloning.
  35558. * @returns {*} Returns the deep cloned value.
  35559. * @see _.cloneWith
  35560. * @example
  35561. *
  35562. * function customizer(value) {
  35563. * if (_.isElement(value)) {
  35564. * return value.cloneNode(true);
  35565. * }
  35566. * }
  35567. *
  35568. * var el = _.cloneDeepWith(document.body, customizer);
  35569. *
  35570. * console.log(el === document.body);
  35571. * // => false
  35572. * console.log(el.nodeName);
  35573. * // => 'BODY'
  35574. * console.log(el.childNodes.length);
  35575. * // => 20
  35576. */
  35577. function cloneDeepWith(value, customizer) {
  35578. customizer = typeof customizer == 'function' ? customizer : undefined;
  35579. return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer);
  35580. }
  35581. module.exports = cloneDeepWith;
  35582. },{"./_baseClone":329}],469:[function(require,module,exports){
  35583. /**
  35584. * Creates a function that returns `value`.
  35585. *
  35586. * @static
  35587. * @memberOf _
  35588. * @since 2.4.0
  35589. * @category Util
  35590. * @param {*} value The value to return from the new function.
  35591. * @returns {Function} Returns the new constant function.
  35592. * @example
  35593. *
  35594. * var objects = _.times(2, _.constant({ 'a': 1 }));
  35595. *
  35596. * console.log(objects);
  35597. * // => [{ 'a': 1 }, { 'a': 1 }]
  35598. *
  35599. * console.log(objects[0] === objects[1]);
  35600. * // => true
  35601. */
  35602. function constant(value) {
  35603. return function() {
  35604. return value;
  35605. };
  35606. }
  35607. module.exports = constant;
  35608. },{}],470:[function(require,module,exports){
  35609. var apply = require('./_apply'),
  35610. assignInWith = require('./assignInWith'),
  35611. baseRest = require('./_baseRest'),
  35612. customDefaultsAssignIn = require('./_customDefaultsAssignIn');
  35613. /**
  35614. * Assigns own and inherited enumerable string keyed properties of source
  35615. * objects to the destination object for all destination properties that
  35616. * resolve to `undefined`. Source objects are applied from left to right.
  35617. * Once a property is set, additional values of the same property are ignored.
  35618. *
  35619. * **Note:** This method mutates `object`.
  35620. *
  35621. * @static
  35622. * @since 0.1.0
  35623. * @memberOf _
  35624. * @category Object
  35625. * @param {Object} object The destination object.
  35626. * @param {...Object} [sources] The source objects.
  35627. * @returns {Object} Returns `object`.
  35628. * @see _.defaultsDeep
  35629. * @example
  35630. *
  35631. * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
  35632. * // => { 'a': 1, 'b': 2 }
  35633. */
  35634. var defaults = baseRest(function(args) {
  35635. args.push(undefined, customDefaultsAssignIn);
  35636. return apply(assignInWith, undefined, args);
  35637. });
  35638. module.exports = defaults;
  35639. },{"./_apply":312,"./_baseRest":364,"./_customDefaultsAssignIn":394,"./assignInWith":465}],471:[function(require,module,exports){
  35640. /**
  35641. * Performs a
  35642. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  35643. * comparison between two values to determine if they are equivalent.
  35644. *
  35645. * @static
  35646. * @memberOf _
  35647. * @since 4.0.0
  35648. * @category Lang
  35649. * @param {*} value The value to compare.
  35650. * @param {*} other The other value to compare.
  35651. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  35652. * @example
  35653. *
  35654. * var object = { 'a': 1 };
  35655. * var other = { 'a': 1 };
  35656. *
  35657. * _.eq(object, object);
  35658. * // => true
  35659. *
  35660. * _.eq(object, other);
  35661. * // => false
  35662. *
  35663. * _.eq('a', 'a');
  35664. * // => true
  35665. *
  35666. * _.eq('a', Object('a'));
  35667. * // => false
  35668. *
  35669. * _.eq(NaN, NaN);
  35670. * // => true
  35671. */
  35672. function eq(value, other) {
  35673. return value === other || (value !== value && other !== other);
  35674. }
  35675. module.exports = eq;
  35676. },{}],472:[function(require,module,exports){
  35677. var toString = require('./toString');
  35678. /**
  35679. * Used to match `RegExp`
  35680. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  35681. */
  35682. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
  35683. reHasRegExpChar = RegExp(reRegExpChar.source);
  35684. /**
  35685. * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
  35686. * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
  35687. *
  35688. * @static
  35689. * @memberOf _
  35690. * @since 3.0.0
  35691. * @category String
  35692. * @param {string} [string=''] The string to escape.
  35693. * @returns {string} Returns the escaped string.
  35694. * @example
  35695. *
  35696. * _.escapeRegExp('[lodash](https://lodash.com/)');
  35697. * // => '\[lodash\]\(https://lodash\.com/\)'
  35698. */
  35699. function escapeRegExp(string) {
  35700. string = toString(string);
  35701. return (string && reHasRegExpChar.test(string))
  35702. ? string.replace(reRegExpChar, '\\$&')
  35703. : string;
  35704. }
  35705. module.exports = escapeRegExp;
  35706. },{"./toString":516}],473:[function(require,module,exports){
  35707. module.exports = require('./assignIn');
  35708. },{"./assignIn":464}],474:[function(require,module,exports){
  35709. var createFind = require('./_createFind'),
  35710. findIndex = require('./findIndex');
  35711. /**
  35712. * Iterates over elements of `collection`, returning the first element
  35713. * `predicate` returns truthy for. The predicate is invoked with three
  35714. * arguments: (value, index|key, collection).
  35715. *
  35716. * @static
  35717. * @memberOf _
  35718. * @since 0.1.0
  35719. * @category Collection
  35720. * @param {Array|Object} collection The collection to inspect.
  35721. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  35722. * @param {number} [fromIndex=0] The index to search from.
  35723. * @returns {*} Returns the matched element, else `undefined`.
  35724. * @example
  35725. *
  35726. * var users = [
  35727. * { 'user': 'barney', 'age': 36, 'active': true },
  35728. * { 'user': 'fred', 'age': 40, 'active': false },
  35729. * { 'user': 'pebbles', 'age': 1, 'active': true }
  35730. * ];
  35731. *
  35732. * _.find(users, function(o) { return o.age < 40; });
  35733. * // => object for 'barney'
  35734. *
  35735. * // The `_.matches` iteratee shorthand.
  35736. * _.find(users, { 'age': 1, 'active': true });
  35737. * // => object for 'pebbles'
  35738. *
  35739. * // The `_.matchesProperty` iteratee shorthand.
  35740. * _.find(users, ['active', false]);
  35741. * // => object for 'fred'
  35742. *
  35743. * // The `_.property` iteratee shorthand.
  35744. * _.find(users, 'active');
  35745. * // => object for 'barney'
  35746. */
  35747. var find = createFind(findIndex);
  35748. module.exports = find;
  35749. },{"./_createFind":392,"./findIndex":475}],475:[function(require,module,exports){
  35750. var baseFindIndex = require('./_baseFindIndex'),
  35751. baseIteratee = require('./_baseIteratee'),
  35752. toInteger = require('./toInteger');
  35753. /* Built-in method references for those with the same name as other `lodash` methods. */
  35754. var nativeMax = Math.max;
  35755. /**
  35756. * This method is like `_.find` except that it returns the index of the first
  35757. * element `predicate` returns truthy for instead of the element itself.
  35758. *
  35759. * @static
  35760. * @memberOf _
  35761. * @since 1.1.0
  35762. * @category Array
  35763. * @param {Array} array The array to inspect.
  35764. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  35765. * @param {number} [fromIndex=0] The index to search from.
  35766. * @returns {number} Returns the index of the found element, else `-1`.
  35767. * @example
  35768. *
  35769. * var users = [
  35770. * { 'user': 'barney', 'active': false },
  35771. * { 'user': 'fred', 'active': false },
  35772. * { 'user': 'pebbles', 'active': true }
  35773. * ];
  35774. *
  35775. * _.findIndex(users, function(o) { return o.user == 'barney'; });
  35776. * // => 0
  35777. *
  35778. * // The `_.matches` iteratee shorthand.
  35779. * _.findIndex(users, { 'user': 'fred', 'active': false });
  35780. * // => 1
  35781. *
  35782. * // The `_.matchesProperty` iteratee shorthand.
  35783. * _.findIndex(users, ['active', false]);
  35784. * // => 0
  35785. *
  35786. * // The `_.property` iteratee shorthand.
  35787. * _.findIndex(users, 'active');
  35788. * // => 2
  35789. */
  35790. function findIndex(array, predicate, fromIndex) {
  35791. var length = array == null ? 0 : array.length;
  35792. if (!length) {
  35793. return -1;
  35794. }
  35795. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  35796. if (index < 0) {
  35797. index = nativeMax(length + index, 0);
  35798. }
  35799. return baseFindIndex(array, baseIteratee(predicate, 3), index);
  35800. }
  35801. module.exports = findIndex;
  35802. },{"./_baseFindIndex":332,"./_baseIteratee":351,"./toInteger":513}],476:[function(require,module,exports){
  35803. var createFind = require('./_createFind'),
  35804. findLastIndex = require('./findLastIndex');
  35805. /**
  35806. * This method is like `_.find` except that it iterates over elements of
  35807. * `collection` from right to left.
  35808. *
  35809. * @static
  35810. * @memberOf _
  35811. * @since 2.0.0
  35812. * @category Collection
  35813. * @param {Array|Object} collection The collection to inspect.
  35814. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  35815. * @param {number} [fromIndex=collection.length-1] The index to search from.
  35816. * @returns {*} Returns the matched element, else `undefined`.
  35817. * @example
  35818. *
  35819. * _.findLast([1, 2, 3, 4], function(n) {
  35820. * return n % 2 == 1;
  35821. * });
  35822. * // => 3
  35823. */
  35824. var findLast = createFind(findLastIndex);
  35825. module.exports = findLast;
  35826. },{"./_createFind":392,"./findLastIndex":477}],477:[function(require,module,exports){
  35827. var baseFindIndex = require('./_baseFindIndex'),
  35828. baseIteratee = require('./_baseIteratee'),
  35829. toInteger = require('./toInteger');
  35830. /* Built-in method references for those with the same name as other `lodash` methods. */
  35831. var nativeMax = Math.max,
  35832. nativeMin = Math.min;
  35833. /**
  35834. * This method is like `_.findIndex` except that it iterates over elements
  35835. * of `collection` from right to left.
  35836. *
  35837. * @static
  35838. * @memberOf _
  35839. * @since 2.0.0
  35840. * @category Array
  35841. * @param {Array} array The array to inspect.
  35842. * @param {Function} [predicate=_.identity] The function invoked per iteration.
  35843. * @param {number} [fromIndex=array.length-1] The index to search from.
  35844. * @returns {number} Returns the index of the found element, else `-1`.
  35845. * @example
  35846. *
  35847. * var users = [
  35848. * { 'user': 'barney', 'active': true },
  35849. * { 'user': 'fred', 'active': false },
  35850. * { 'user': 'pebbles', 'active': false }
  35851. * ];
  35852. *
  35853. * _.findLastIndex(users, function(o) { return o.user == 'pebbles'; });
  35854. * // => 2
  35855. *
  35856. * // The `_.matches` iteratee shorthand.
  35857. * _.findLastIndex(users, { 'user': 'barney', 'active': true });
  35858. * // => 0
  35859. *
  35860. * // The `_.matchesProperty` iteratee shorthand.
  35861. * _.findLastIndex(users, ['active', false]);
  35862. * // => 2
  35863. *
  35864. * // The `_.property` iteratee shorthand.
  35865. * _.findLastIndex(users, 'active');
  35866. * // => 0
  35867. */
  35868. function findLastIndex(array, predicate, fromIndex) {
  35869. var length = array == null ? 0 : array.length;
  35870. if (!length) {
  35871. return -1;
  35872. }
  35873. var index = length - 1;
  35874. if (fromIndex !== undefined) {
  35875. index = toInteger(fromIndex);
  35876. index = fromIndex < 0
  35877. ? nativeMax(length + index, 0)
  35878. : nativeMin(index, length - 1);
  35879. }
  35880. return baseFindIndex(array, baseIteratee(predicate, 3), index, true);
  35881. }
  35882. module.exports = findLastIndex;
  35883. },{"./_baseFindIndex":332,"./_baseIteratee":351,"./toInteger":513}],478:[function(require,module,exports){
  35884. var baseGet = require('./_baseGet');
  35885. /**
  35886. * Gets the value at `path` of `object`. If the resolved value is
  35887. * `undefined`, the `defaultValue` is returned in its place.
  35888. *
  35889. * @static
  35890. * @memberOf _
  35891. * @since 3.7.0
  35892. * @category Object
  35893. * @param {Object} object The object to query.
  35894. * @param {Array|string} path The path of the property to get.
  35895. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  35896. * @returns {*} Returns the resolved value.
  35897. * @example
  35898. *
  35899. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  35900. *
  35901. * _.get(object, 'a[0].b.c');
  35902. * // => 3
  35903. *
  35904. * _.get(object, ['a', '0', 'b', 'c']);
  35905. * // => 3
  35906. *
  35907. * _.get(object, 'a.b.c', 'default');
  35908. * // => 'default'
  35909. */
  35910. function get(object, path, defaultValue) {
  35911. var result = object == null ? undefined : baseGet(object, path);
  35912. return result === undefined ? defaultValue : result;
  35913. }
  35914. module.exports = get;
  35915. },{"./_baseGet":336}],479:[function(require,module,exports){
  35916. var baseHas = require('./_baseHas'),
  35917. hasPath = require('./_hasPath');
  35918. /**
  35919. * Checks if `path` is a direct property of `object`.
  35920. *
  35921. * @static
  35922. * @since 0.1.0
  35923. * @memberOf _
  35924. * @category Object
  35925. * @param {Object} object The object to query.
  35926. * @param {Array|string} path The path to check.
  35927. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  35928. * @example
  35929. *
  35930. * var object = { 'a': { 'b': 2 } };
  35931. * var other = _.create({ 'a': _.create({ 'b': 2 }) });
  35932. *
  35933. * _.has(object, 'a');
  35934. * // => true
  35935. *
  35936. * _.has(object, 'a.b');
  35937. * // => true
  35938. *
  35939. * _.has(object, ['a', 'b']);
  35940. * // => true
  35941. *
  35942. * _.has(other, 'a');
  35943. * // => false
  35944. */
  35945. function has(object, path) {
  35946. return object != null && hasPath(object, path, baseHas);
  35947. }
  35948. module.exports = has;
  35949. },{"./_baseHas":339,"./_hasPath":411}],480:[function(require,module,exports){
  35950. var baseHasIn = require('./_baseHasIn'),
  35951. hasPath = require('./_hasPath');
  35952. /**
  35953. * Checks if `path` is a direct or inherited property of `object`.
  35954. *
  35955. * @static
  35956. * @memberOf _
  35957. * @since 4.0.0
  35958. * @category Object
  35959. * @param {Object} object The object to query.
  35960. * @param {Array|string} path The path to check.
  35961. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  35962. * @example
  35963. *
  35964. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  35965. *
  35966. * _.hasIn(object, 'a');
  35967. * // => true
  35968. *
  35969. * _.hasIn(object, 'a.b');
  35970. * // => true
  35971. *
  35972. * _.hasIn(object, ['a', 'b']);
  35973. * // => true
  35974. *
  35975. * _.hasIn(object, 'b');
  35976. * // => false
  35977. */
  35978. function hasIn(object, path) {
  35979. return object != null && hasPath(object, path, baseHasIn);
  35980. }
  35981. module.exports = hasIn;
  35982. },{"./_baseHasIn":340,"./_hasPath":411}],481:[function(require,module,exports){
  35983. /**
  35984. * This method returns the first argument it receives.
  35985. *
  35986. * @static
  35987. * @since 0.1.0
  35988. * @memberOf _
  35989. * @category Util
  35990. * @param {*} value Any value.
  35991. * @returns {*} Returns `value`.
  35992. * @example
  35993. *
  35994. * var object = { 'a': 1 };
  35995. *
  35996. * console.log(_.identity(object) === object);
  35997. * // => true
  35998. */
  35999. function identity(value) {
  36000. return value;
  36001. }
  36002. module.exports = identity;
  36003. },{}],482:[function(require,module,exports){
  36004. var baseIndexOf = require('./_baseIndexOf'),
  36005. isArrayLike = require('./isArrayLike'),
  36006. isString = require('./isString'),
  36007. toInteger = require('./toInteger'),
  36008. values = require('./values');
  36009. /* Built-in method references for those with the same name as other `lodash` methods. */
  36010. var nativeMax = Math.max;
  36011. /**
  36012. * Checks if `value` is in `collection`. If `collection` is a string, it's
  36013. * checked for a substring of `value`, otherwise
  36014. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  36015. * is used for equality comparisons. If `fromIndex` is negative, it's used as
  36016. * the offset from the end of `collection`.
  36017. *
  36018. * @static
  36019. * @memberOf _
  36020. * @since 0.1.0
  36021. * @category Collection
  36022. * @param {Array|Object|string} collection The collection to inspect.
  36023. * @param {*} value The value to search for.
  36024. * @param {number} [fromIndex=0] The index to search from.
  36025. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.reduce`.
  36026. * @returns {boolean} Returns `true` if `value` is found, else `false`.
  36027. * @example
  36028. *
  36029. * _.includes([1, 2, 3], 1);
  36030. * // => true
  36031. *
  36032. * _.includes([1, 2, 3], 1, 2);
  36033. * // => false
  36034. *
  36035. * _.includes({ 'a': 1, 'b': 2 }, 1);
  36036. * // => true
  36037. *
  36038. * _.includes('abcd', 'bc');
  36039. * // => true
  36040. */
  36041. function includes(collection, value, fromIndex, guard) {
  36042. collection = isArrayLike(collection) ? collection : values(collection);
  36043. fromIndex = (fromIndex && !guard) ? toInteger(fromIndex) : 0;
  36044. var length = collection.length;
  36045. if (fromIndex < 0) {
  36046. fromIndex = nativeMax(length + fromIndex, 0);
  36047. }
  36048. return isString(collection)
  36049. ? (fromIndex <= length && collection.indexOf(value, fromIndex) > -1)
  36050. : (!!length && baseIndexOf(collection, value, fromIndex) > -1);
  36051. }
  36052. module.exports = includes;
  36053. },{"./_baseIndexOf":341,"./isArrayLike":485,"./isString":495,"./toInteger":513,"./values":518}],483:[function(require,module,exports){
  36054. var baseIsArguments = require('./_baseIsArguments'),
  36055. isObjectLike = require('./isObjectLike');
  36056. /** Used for built-in method references. */
  36057. var objectProto = Object.prototype;
  36058. /** Used to check objects for own properties. */
  36059. var hasOwnProperty = objectProto.hasOwnProperty;
  36060. /** Built-in value references. */
  36061. var propertyIsEnumerable = objectProto.propertyIsEnumerable;
  36062. /**
  36063. * Checks if `value` is likely an `arguments` object.
  36064. *
  36065. * @static
  36066. * @memberOf _
  36067. * @since 0.1.0
  36068. * @category Lang
  36069. * @param {*} value The value to check.
  36070. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  36071. * else `false`.
  36072. * @example
  36073. *
  36074. * _.isArguments(function() { return arguments; }());
  36075. * // => true
  36076. *
  36077. * _.isArguments([1, 2, 3]);
  36078. * // => false
  36079. */
  36080. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  36081. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  36082. !propertyIsEnumerable.call(value, 'callee');
  36083. };
  36084. module.exports = isArguments;
  36085. },{"./_baseIsArguments":343,"./isObjectLike":492}],484:[function(require,module,exports){
  36086. /**
  36087. * Checks if `value` is classified as an `Array` object.
  36088. *
  36089. * @static
  36090. * @memberOf _
  36091. * @since 0.1.0
  36092. * @category Lang
  36093. * @param {*} value The value to check.
  36094. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  36095. * @example
  36096. *
  36097. * _.isArray([1, 2, 3]);
  36098. * // => true
  36099. *
  36100. * _.isArray(document.body.children);
  36101. * // => false
  36102. *
  36103. * _.isArray('abc');
  36104. * // => false
  36105. *
  36106. * _.isArray(_.noop);
  36107. * // => false
  36108. */
  36109. var isArray = Array.isArray;
  36110. module.exports = isArray;
  36111. },{}],485:[function(require,module,exports){
  36112. var isFunction = require('./isFunction'),
  36113. isLength = require('./isLength');
  36114. /**
  36115. * Checks if `value` is array-like. A value is considered array-like if it's
  36116. * not a function and has a `value.length` that's an integer greater than or
  36117. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  36118. *
  36119. * @static
  36120. * @memberOf _
  36121. * @since 4.0.0
  36122. * @category Lang
  36123. * @param {*} value The value to check.
  36124. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  36125. * @example
  36126. *
  36127. * _.isArrayLike([1, 2, 3]);
  36128. * // => true
  36129. *
  36130. * _.isArrayLike(document.body.children);
  36131. * // => true
  36132. *
  36133. * _.isArrayLike('abc');
  36134. * // => true
  36135. *
  36136. * _.isArrayLike(_.noop);
  36137. * // => false
  36138. */
  36139. function isArrayLike(value) {
  36140. return value != null && isLength(value.length) && !isFunction(value);
  36141. }
  36142. module.exports = isArrayLike;
  36143. },{"./isFunction":488,"./isLength":490}],486:[function(require,module,exports){
  36144. var isArrayLike = require('./isArrayLike'),
  36145. isObjectLike = require('./isObjectLike');
  36146. /**
  36147. * This method is like `_.isArrayLike` except that it also checks if `value`
  36148. * is an object.
  36149. *
  36150. * @static
  36151. * @memberOf _
  36152. * @since 4.0.0
  36153. * @category Lang
  36154. * @param {*} value The value to check.
  36155. * @returns {boolean} Returns `true` if `value` is an array-like object,
  36156. * else `false`.
  36157. * @example
  36158. *
  36159. * _.isArrayLikeObject([1, 2, 3]);
  36160. * // => true
  36161. *
  36162. * _.isArrayLikeObject(document.body.children);
  36163. * // => true
  36164. *
  36165. * _.isArrayLikeObject('abc');
  36166. * // => false
  36167. *
  36168. * _.isArrayLikeObject(_.noop);
  36169. * // => false
  36170. */
  36171. function isArrayLikeObject(value) {
  36172. return isObjectLike(value) && isArrayLike(value);
  36173. }
  36174. module.exports = isArrayLikeObject;
  36175. },{"./isArrayLike":485,"./isObjectLike":492}],487:[function(require,module,exports){
  36176. var root = require('./_root'),
  36177. stubFalse = require('./stubFalse');
  36178. /** Detect free variable `exports`. */
  36179. var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
  36180. /** Detect free variable `module`. */
  36181. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  36182. /** Detect the popular CommonJS extension `module.exports`. */
  36183. var moduleExports = freeModule && freeModule.exports === freeExports;
  36184. /** Built-in value references. */
  36185. var Buffer = moduleExports ? root.Buffer : undefined;
  36186. /* Built-in method references for those with the same name as other `lodash` methods. */
  36187. var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
  36188. /**
  36189. * Checks if `value` is a buffer.
  36190. *
  36191. * @static
  36192. * @memberOf _
  36193. * @since 4.3.0
  36194. * @category Lang
  36195. * @param {*} value The value to check.
  36196. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  36197. * @example
  36198. *
  36199. * _.isBuffer(new Buffer(2));
  36200. * // => true
  36201. *
  36202. * _.isBuffer(new Uint8Array(2));
  36203. * // => false
  36204. */
  36205. var isBuffer = nativeIsBuffer || stubFalse;
  36206. module.exports = isBuffer;
  36207. },{"./_root":448,"./stubFalse":511}],488:[function(require,module,exports){
  36208. var baseGetTag = require('./_baseGetTag'),
  36209. isObject = require('./isObject');
  36210. /** `Object#toString` result references. */
  36211. var asyncTag = '[object AsyncFunction]',
  36212. funcTag = '[object Function]',
  36213. genTag = '[object GeneratorFunction]',
  36214. proxyTag = '[object Proxy]';
  36215. /**
  36216. * Checks if `value` is classified as a `Function` object.
  36217. *
  36218. * @static
  36219. * @memberOf _
  36220. * @since 0.1.0
  36221. * @category Lang
  36222. * @param {*} value The value to check.
  36223. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  36224. * @example
  36225. *
  36226. * _.isFunction(_);
  36227. * // => true
  36228. *
  36229. * _.isFunction(/abc/);
  36230. * // => false
  36231. */
  36232. function isFunction(value) {
  36233. if (!isObject(value)) {
  36234. return false;
  36235. }
  36236. // The use of `Object#toString` avoids issues with the `typeof` operator
  36237. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  36238. var tag = baseGetTag(value);
  36239. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  36240. }
  36241. module.exports = isFunction;
  36242. },{"./_baseGetTag":338,"./isObject":491}],489:[function(require,module,exports){
  36243. var toInteger = require('./toInteger');
  36244. /**
  36245. * Checks if `value` is an integer.
  36246. *
  36247. * **Note:** This method is based on
  36248. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  36249. *
  36250. * @static
  36251. * @memberOf _
  36252. * @since 4.0.0
  36253. * @category Lang
  36254. * @param {*} value The value to check.
  36255. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  36256. * @example
  36257. *
  36258. * _.isInteger(3);
  36259. * // => true
  36260. *
  36261. * _.isInteger(Number.MIN_VALUE);
  36262. * // => false
  36263. *
  36264. * _.isInteger(Infinity);
  36265. * // => false
  36266. *
  36267. * _.isInteger('3');
  36268. * // => false
  36269. */
  36270. function isInteger(value) {
  36271. return typeof value == 'number' && value == toInteger(value);
  36272. }
  36273. module.exports = isInteger;
  36274. },{"./toInteger":513}],490:[function(require,module,exports){
  36275. /** Used as references for various `Number` constants. */
  36276. var MAX_SAFE_INTEGER = 9007199254740991;
  36277. /**
  36278. * Checks if `value` is a valid array-like length.
  36279. *
  36280. * **Note:** This method is loosely based on
  36281. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  36282. *
  36283. * @static
  36284. * @memberOf _
  36285. * @since 4.0.0
  36286. * @category Lang
  36287. * @param {*} value The value to check.
  36288. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  36289. * @example
  36290. *
  36291. * _.isLength(3);
  36292. * // => true
  36293. *
  36294. * _.isLength(Number.MIN_VALUE);
  36295. * // => false
  36296. *
  36297. * _.isLength(Infinity);
  36298. * // => false
  36299. *
  36300. * _.isLength('3');
  36301. * // => false
  36302. */
  36303. function isLength(value) {
  36304. return typeof value == 'number' &&
  36305. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  36306. }
  36307. module.exports = isLength;
  36308. },{}],491:[function(require,module,exports){
  36309. /**
  36310. * Checks if `value` is the
  36311. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  36312. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  36313. *
  36314. * @static
  36315. * @memberOf _
  36316. * @since 0.1.0
  36317. * @category Lang
  36318. * @param {*} value The value to check.
  36319. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  36320. * @example
  36321. *
  36322. * _.isObject({});
  36323. * // => true
  36324. *
  36325. * _.isObject([1, 2, 3]);
  36326. * // => true
  36327. *
  36328. * _.isObject(_.noop);
  36329. * // => true
  36330. *
  36331. * _.isObject(null);
  36332. * // => false
  36333. */
  36334. function isObject(value) {
  36335. var type = typeof value;
  36336. return value != null && (type == 'object' || type == 'function');
  36337. }
  36338. module.exports = isObject;
  36339. },{}],492:[function(require,module,exports){
  36340. /**
  36341. * Checks if `value` is object-like. A value is object-like if it's not `null`
  36342. * and has a `typeof` result of "object".
  36343. *
  36344. * @static
  36345. * @memberOf _
  36346. * @since 4.0.0
  36347. * @category Lang
  36348. * @param {*} value The value to check.
  36349. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  36350. * @example
  36351. *
  36352. * _.isObjectLike({});
  36353. * // => true
  36354. *
  36355. * _.isObjectLike([1, 2, 3]);
  36356. * // => true
  36357. *
  36358. * _.isObjectLike(_.noop);
  36359. * // => false
  36360. *
  36361. * _.isObjectLike(null);
  36362. * // => false
  36363. */
  36364. function isObjectLike(value) {
  36365. return value != null && typeof value == 'object';
  36366. }
  36367. module.exports = isObjectLike;
  36368. },{}],493:[function(require,module,exports){
  36369. var baseGetTag = require('./_baseGetTag'),
  36370. getPrototype = require('./_getPrototype'),
  36371. isObjectLike = require('./isObjectLike');
  36372. /** `Object#toString` result references. */
  36373. var objectTag = '[object Object]';
  36374. /** Used for built-in method references. */
  36375. var funcProto = Function.prototype,
  36376. objectProto = Object.prototype;
  36377. /** Used to resolve the decompiled source of functions. */
  36378. var funcToString = funcProto.toString;
  36379. /** Used to check objects for own properties. */
  36380. var hasOwnProperty = objectProto.hasOwnProperty;
  36381. /** Used to infer the `Object` constructor. */
  36382. var objectCtorString = funcToString.call(Object);
  36383. /**
  36384. * Checks if `value` is a plain object, that is, an object created by the
  36385. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  36386. *
  36387. * @static
  36388. * @memberOf _
  36389. * @since 0.8.0
  36390. * @category Lang
  36391. * @param {*} value The value to check.
  36392. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  36393. * @example
  36394. *
  36395. * function Foo() {
  36396. * this.a = 1;
  36397. * }
  36398. *
  36399. * _.isPlainObject(new Foo);
  36400. * // => false
  36401. *
  36402. * _.isPlainObject([1, 2, 3]);
  36403. * // => false
  36404. *
  36405. * _.isPlainObject({ 'x': 0, 'y': 0 });
  36406. * // => true
  36407. *
  36408. * _.isPlainObject(Object.create(null));
  36409. * // => true
  36410. */
  36411. function isPlainObject(value) {
  36412. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  36413. return false;
  36414. }
  36415. var proto = getPrototype(value);
  36416. if (proto === null) {
  36417. return true;
  36418. }
  36419. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  36420. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  36421. funcToString.call(Ctor) == objectCtorString;
  36422. }
  36423. module.exports = isPlainObject;
  36424. },{"./_baseGetTag":338,"./_getPrototype":405,"./isObjectLike":492}],494:[function(require,module,exports){
  36425. var baseIsRegExp = require('./_baseIsRegExp'),
  36426. baseUnary = require('./_baseUnary'),
  36427. nodeUtil = require('./_nodeUtil');
  36428. /* Node.js helper references. */
  36429. var nodeIsRegExp = nodeUtil && nodeUtil.isRegExp;
  36430. /**
  36431. * Checks if `value` is classified as a `RegExp` object.
  36432. *
  36433. * @static
  36434. * @memberOf _
  36435. * @since 0.1.0
  36436. * @category Lang
  36437. * @param {*} value The value to check.
  36438. * @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
  36439. * @example
  36440. *
  36441. * _.isRegExp(/abc/);
  36442. * // => true
  36443. *
  36444. * _.isRegExp('/abc/');
  36445. * // => false
  36446. */
  36447. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  36448. module.exports = isRegExp;
  36449. },{"./_baseIsRegExp":349,"./_baseUnary":369,"./_nodeUtil":444}],495:[function(require,module,exports){
  36450. var baseGetTag = require('./_baseGetTag'),
  36451. isArray = require('./isArray'),
  36452. isObjectLike = require('./isObjectLike');
  36453. /** `Object#toString` result references. */
  36454. var stringTag = '[object String]';
  36455. /**
  36456. * Checks if `value` is classified as a `String` primitive or object.
  36457. *
  36458. * @static
  36459. * @since 0.1.0
  36460. * @memberOf _
  36461. * @category Lang
  36462. * @param {*} value The value to check.
  36463. * @returns {boolean} Returns `true` if `value` is a string, else `false`.
  36464. * @example
  36465. *
  36466. * _.isString('abc');
  36467. * // => true
  36468. *
  36469. * _.isString(1);
  36470. * // => false
  36471. */
  36472. function isString(value) {
  36473. return typeof value == 'string' ||
  36474. (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
  36475. }
  36476. module.exports = isString;
  36477. },{"./_baseGetTag":338,"./isArray":484,"./isObjectLike":492}],496:[function(require,module,exports){
  36478. var baseGetTag = require('./_baseGetTag'),
  36479. isObjectLike = require('./isObjectLike');
  36480. /** `Object#toString` result references. */
  36481. var symbolTag = '[object Symbol]';
  36482. /**
  36483. * Checks if `value` is classified as a `Symbol` primitive or object.
  36484. *
  36485. * @static
  36486. * @memberOf _
  36487. * @since 4.0.0
  36488. * @category Lang
  36489. * @param {*} value The value to check.
  36490. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  36491. * @example
  36492. *
  36493. * _.isSymbol(Symbol.iterator);
  36494. * // => true
  36495. *
  36496. * _.isSymbol('abc');
  36497. * // => false
  36498. */
  36499. function isSymbol(value) {
  36500. return typeof value == 'symbol' ||
  36501. (isObjectLike(value) && baseGetTag(value) == symbolTag);
  36502. }
  36503. module.exports = isSymbol;
  36504. },{"./_baseGetTag":338,"./isObjectLike":492}],497:[function(require,module,exports){
  36505. var baseIsTypedArray = require('./_baseIsTypedArray'),
  36506. baseUnary = require('./_baseUnary'),
  36507. nodeUtil = require('./_nodeUtil');
  36508. /* Node.js helper references. */
  36509. var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  36510. /**
  36511. * Checks if `value` is classified as a typed array.
  36512. *
  36513. * @static
  36514. * @memberOf _
  36515. * @since 3.0.0
  36516. * @category Lang
  36517. * @param {*} value The value to check.
  36518. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  36519. * @example
  36520. *
  36521. * _.isTypedArray(new Uint8Array);
  36522. * // => true
  36523. *
  36524. * _.isTypedArray([]);
  36525. * // => false
  36526. */
  36527. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  36528. module.exports = isTypedArray;
  36529. },{"./_baseIsTypedArray":350,"./_baseUnary":369,"./_nodeUtil":444}],498:[function(require,module,exports){
  36530. var arrayLikeKeys = require('./_arrayLikeKeys'),
  36531. baseKeys = require('./_baseKeys'),
  36532. isArrayLike = require('./isArrayLike');
  36533. /**
  36534. * Creates an array of the own enumerable property names of `object`.
  36535. *
  36536. * **Note:** Non-object values are coerced to objects. See the
  36537. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  36538. * for more details.
  36539. *
  36540. * @static
  36541. * @since 0.1.0
  36542. * @memberOf _
  36543. * @category Object
  36544. * @param {Object} object The object to query.
  36545. * @returns {Array} Returns the array of property names.
  36546. * @example
  36547. *
  36548. * function Foo() {
  36549. * this.a = 1;
  36550. * this.b = 2;
  36551. * }
  36552. *
  36553. * Foo.prototype.c = 3;
  36554. *
  36555. * _.keys(new Foo);
  36556. * // => ['a', 'b'] (iteration order is not guaranteed)
  36557. *
  36558. * _.keys('hi');
  36559. * // => ['0', '1']
  36560. */
  36561. function keys(object) {
  36562. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  36563. }
  36564. module.exports = keys;
  36565. },{"./_arrayLikeKeys":317,"./_baseKeys":352,"./isArrayLike":485}],499:[function(require,module,exports){
  36566. var arrayLikeKeys = require('./_arrayLikeKeys'),
  36567. baseKeysIn = require('./_baseKeysIn'),
  36568. isArrayLike = require('./isArrayLike');
  36569. /**
  36570. * Creates an array of the own and inherited enumerable property names of `object`.
  36571. *
  36572. * **Note:** Non-object values are coerced to objects.
  36573. *
  36574. * @static
  36575. * @memberOf _
  36576. * @since 3.0.0
  36577. * @category Object
  36578. * @param {Object} object The object to query.
  36579. * @returns {Array} Returns the array of property names.
  36580. * @example
  36581. *
  36582. * function Foo() {
  36583. * this.a = 1;
  36584. * this.b = 2;
  36585. * }
  36586. *
  36587. * Foo.prototype.c = 3;
  36588. *
  36589. * _.keysIn(new Foo);
  36590. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  36591. */
  36592. function keysIn(object) {
  36593. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  36594. }
  36595. module.exports = keysIn;
  36596. },{"./_arrayLikeKeys":317,"./_baseKeysIn":353,"./isArrayLike":485}],500:[function(require,module,exports){
  36597. var arrayMap = require('./_arrayMap'),
  36598. baseIteratee = require('./_baseIteratee'),
  36599. baseMap = require('./_baseMap'),
  36600. isArray = require('./isArray');
  36601. /**
  36602. * Creates an array of values by running each element in `collection` thru
  36603. * `iteratee`. The iteratee is invoked with three arguments:
  36604. * (value, index|key, collection).
  36605. *
  36606. * Many lodash methods are guarded to work as iteratees for methods like
  36607. * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`.
  36608. *
  36609. * The guarded methods are:
  36610. * `ary`, `chunk`, `curry`, `curryRight`, `drop`, `dropRight`, `every`,
  36611. * `fill`, `invert`, `parseInt`, `random`, `range`, `rangeRight`, `repeat`,
  36612. * `sampleSize`, `slice`, `some`, `sortBy`, `split`, `take`, `takeRight`,
  36613. * `template`, `trim`, `trimEnd`, `trimStart`, and `words`
  36614. *
  36615. * @static
  36616. * @memberOf _
  36617. * @since 0.1.0
  36618. * @category Collection
  36619. * @param {Array|Object} collection The collection to iterate over.
  36620. * @param {Function} [iteratee=_.identity] The function invoked per iteration.
  36621. * @returns {Array} Returns the new mapped array.
  36622. * @example
  36623. *
  36624. * function square(n) {
  36625. * return n * n;
  36626. * }
  36627. *
  36628. * _.map([4, 8], square);
  36629. * // => [16, 64]
  36630. *
  36631. * _.map({ 'a': 4, 'b': 8 }, square);
  36632. * // => [16, 64] (iteration order is not guaranteed)
  36633. *
  36634. * var users = [
  36635. * { 'user': 'barney' },
  36636. * { 'user': 'fred' }
  36637. * ];
  36638. *
  36639. * // The `_.property` iteratee shorthand.
  36640. * _.map(users, 'user');
  36641. * // => ['barney', 'fred']
  36642. */
  36643. function map(collection, iteratee) {
  36644. var func = isArray(collection) ? arrayMap : baseMap;
  36645. return func(collection, baseIteratee(iteratee, 3));
  36646. }
  36647. module.exports = map;
  36648. },{"./_arrayMap":318,"./_baseIteratee":351,"./_baseMap":354,"./isArray":484}],501:[function(require,module,exports){
  36649. var MapCache = require('./_MapCache');
  36650. /** Error message constants. */
  36651. var FUNC_ERROR_TEXT = 'Expected a function';
  36652. /**
  36653. * Creates a function that memoizes the result of `func`. If `resolver` is
  36654. * provided, it determines the cache key for storing the result based on the
  36655. * arguments provided to the memoized function. By default, the first argument
  36656. * provided to the memoized function is used as the map cache key. The `func`
  36657. * is invoked with the `this` binding of the memoized function.
  36658. *
  36659. * **Note:** The cache is exposed as the `cache` property on the memoized
  36660. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  36661. * constructor with one whose instances implement the
  36662. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  36663. * method interface of `clear`, `delete`, `get`, `has`, and `set`.
  36664. *
  36665. * @static
  36666. * @memberOf _
  36667. * @since 0.1.0
  36668. * @category Function
  36669. * @param {Function} func The function to have its output memoized.
  36670. * @param {Function} [resolver] The function to resolve the cache key.
  36671. * @returns {Function} Returns the new memoized function.
  36672. * @example
  36673. *
  36674. * var object = { 'a': 1, 'b': 2 };
  36675. * var other = { 'c': 3, 'd': 4 };
  36676. *
  36677. * var values = _.memoize(_.values);
  36678. * values(object);
  36679. * // => [1, 2]
  36680. *
  36681. * values(other);
  36682. * // => [3, 4]
  36683. *
  36684. * object.a = 2;
  36685. * values(object);
  36686. * // => [1, 2]
  36687. *
  36688. * // Modify the result cache.
  36689. * values.cache.set(object, ['a', 'b']);
  36690. * values(object);
  36691. * // => ['a', 'b']
  36692. *
  36693. * // Replace `_.memoize.Cache`.
  36694. * _.memoize.Cache = WeakMap;
  36695. */
  36696. function memoize(func, resolver) {
  36697. if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
  36698. throw new TypeError(FUNC_ERROR_TEXT);
  36699. }
  36700. var memoized = function() {
  36701. var args = arguments,
  36702. key = resolver ? resolver.apply(this, args) : args[0],
  36703. cache = memoized.cache;
  36704. if (cache.has(key)) {
  36705. return cache.get(key);
  36706. }
  36707. var result = func.apply(this, args);
  36708. memoized.cache = cache.set(key, result) || cache;
  36709. return result;
  36710. };
  36711. memoized.cache = new (memoize.Cache || MapCache);
  36712. return memoized;
  36713. }
  36714. // Expose `MapCache`.
  36715. memoize.Cache = MapCache;
  36716. module.exports = memoize;
  36717. },{"./_MapCache":302}],502:[function(require,module,exports){
  36718. var baseMerge = require('./_baseMerge'),
  36719. createAssigner = require('./_createAssigner');
  36720. /**
  36721. * This method is like `_.merge` except that it accepts `customizer` which
  36722. * is invoked to produce the merged values of the destination and source
  36723. * properties. If `customizer` returns `undefined`, merging is handled by the
  36724. * method instead. The `customizer` is invoked with six arguments:
  36725. * (objValue, srcValue, key, object, source, stack).
  36726. *
  36727. * **Note:** This method mutates `object`.
  36728. *
  36729. * @static
  36730. * @memberOf _
  36731. * @since 4.0.0
  36732. * @category Object
  36733. * @param {Object} object The destination object.
  36734. * @param {...Object} sources The source objects.
  36735. * @param {Function} customizer The function to customize assigned values.
  36736. * @returns {Object} Returns `object`.
  36737. * @example
  36738. *
  36739. * function customizer(objValue, srcValue) {
  36740. * if (_.isArray(objValue)) {
  36741. * return objValue.concat(srcValue);
  36742. * }
  36743. * }
  36744. *
  36745. * var object = { 'a': [1], 'b': [2] };
  36746. * var other = { 'a': [3], 'b': [4] };
  36747. *
  36748. * _.mergeWith(object, other, customizer);
  36749. * // => { 'a': [1, 3], 'b': [2, 4] }
  36750. */
  36751. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  36752. baseMerge(object, source, srcIndex, customizer);
  36753. });
  36754. module.exports = mergeWith;
  36755. },{"./_baseMerge":357,"./_createAssigner":389}],503:[function(require,module,exports){
  36756. /**
  36757. * This method returns `undefined`.
  36758. *
  36759. * @static
  36760. * @memberOf _
  36761. * @since 2.3.0
  36762. * @category Util
  36763. * @example
  36764. *
  36765. * _.times(2, _.noop);
  36766. * // => [undefined, undefined]
  36767. */
  36768. function noop() {
  36769. // No operation performed.
  36770. }
  36771. module.exports = noop;
  36772. },{}],504:[function(require,module,exports){
  36773. var baseProperty = require('./_baseProperty'),
  36774. basePropertyDeep = require('./_basePropertyDeep'),
  36775. isKey = require('./_isKey'),
  36776. toKey = require('./_toKey');
  36777. /**
  36778. * Creates a function that returns the value at `path` of a given object.
  36779. *
  36780. * @static
  36781. * @memberOf _
  36782. * @since 2.4.0
  36783. * @category Util
  36784. * @param {Array|string} path The path of the property to get.
  36785. * @returns {Function} Returns the new accessor function.
  36786. * @example
  36787. *
  36788. * var objects = [
  36789. * { 'a': { 'b': 2 } },
  36790. * { 'a': { 'b': 1 } }
  36791. * ];
  36792. *
  36793. * _.map(objects, _.property('a.b'));
  36794. * // => [2, 1]
  36795. *
  36796. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  36797. * // => [1, 2]
  36798. */
  36799. function property(path) {
  36800. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  36801. }
  36802. module.exports = property;
  36803. },{"./_baseProperty":360,"./_basePropertyDeep":361,"./_isKey":423,"./_toKey":461}],505:[function(require,module,exports){
  36804. var baseRest = require('./_baseRest'),
  36805. pullAll = require('./pullAll');
  36806. /**
  36807. * Removes all given values from `array` using
  36808. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  36809. * for equality comparisons.
  36810. *
  36811. * **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
  36812. * to remove elements from an array by predicate.
  36813. *
  36814. * @static
  36815. * @memberOf _
  36816. * @since 2.0.0
  36817. * @category Array
  36818. * @param {Array} array The array to modify.
  36819. * @param {...*} [values] The values to remove.
  36820. * @returns {Array} Returns `array`.
  36821. * @example
  36822. *
  36823. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  36824. *
  36825. * _.pull(array, 'a', 'c');
  36826. * console.log(array);
  36827. * // => ['b', 'b']
  36828. */
  36829. var pull = baseRest(pullAll);
  36830. module.exports = pull;
  36831. },{"./_baseRest":364,"./pullAll":506}],506:[function(require,module,exports){
  36832. var basePullAll = require('./_basePullAll');
  36833. /**
  36834. * This method is like `_.pull` except that it accepts an array of values to remove.
  36835. *
  36836. * **Note:** Unlike `_.difference`, this method mutates `array`.
  36837. *
  36838. * @static
  36839. * @memberOf _
  36840. * @since 4.0.0
  36841. * @category Array
  36842. * @param {Array} array The array to modify.
  36843. * @param {Array} values The values to remove.
  36844. * @returns {Array} Returns `array`.
  36845. * @example
  36846. *
  36847. * var array = ['a', 'b', 'c', 'a', 'b', 'c'];
  36848. *
  36849. * _.pullAll(array, ['a', 'c']);
  36850. * console.log(array);
  36851. * // => ['b', 'b']
  36852. */
  36853. function pullAll(array, values) {
  36854. return (array && array.length && values && values.length)
  36855. ? basePullAll(array, values)
  36856. : array;
  36857. }
  36858. module.exports = pullAll;
  36859. },{"./_basePullAll":362}],507:[function(require,module,exports){
  36860. var baseRepeat = require('./_baseRepeat'),
  36861. isIterateeCall = require('./_isIterateeCall'),
  36862. toInteger = require('./toInteger'),
  36863. toString = require('./toString');
  36864. /**
  36865. * Repeats the given string `n` times.
  36866. *
  36867. * @static
  36868. * @memberOf _
  36869. * @since 3.0.0
  36870. * @category String
  36871. * @param {string} [string=''] The string to repeat.
  36872. * @param {number} [n=1] The number of times to repeat the string.
  36873. * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`.
  36874. * @returns {string} Returns the repeated string.
  36875. * @example
  36876. *
  36877. * _.repeat('*', 3);
  36878. * // => '***'
  36879. *
  36880. * _.repeat('abc', 2);
  36881. * // => 'abcabc'
  36882. *
  36883. * _.repeat('abc', 0);
  36884. * // => ''
  36885. */
  36886. function repeat(string, n, guard) {
  36887. if ((guard ? isIterateeCall(string, n, guard) : n === undefined)) {
  36888. n = 1;
  36889. } else {
  36890. n = toInteger(n);
  36891. }
  36892. return baseRepeat(toString(string), n);
  36893. }
  36894. module.exports = repeat;
  36895. },{"./_baseRepeat":363,"./_isIterateeCall":422,"./toInteger":513,"./toString":516}],508:[function(require,module,exports){
  36896. var baseFlatten = require('./_baseFlatten'),
  36897. baseOrderBy = require('./_baseOrderBy'),
  36898. baseRest = require('./_baseRest'),
  36899. isIterateeCall = require('./_isIterateeCall');
  36900. /**
  36901. * Creates an array of elements, sorted in ascending order by the results of
  36902. * running each element in a collection thru each iteratee. This method
  36903. * performs a stable sort, that is, it preserves the original sort order of
  36904. * equal elements. The iteratees are invoked with one argument: (value).
  36905. *
  36906. * @static
  36907. * @memberOf _
  36908. * @since 0.1.0
  36909. * @category Collection
  36910. * @param {Array|Object} collection The collection to iterate over.
  36911. * @param {...(Function|Function[])} [iteratees=[_.identity]]
  36912. * The iteratees to sort by.
  36913. * @returns {Array} Returns the new sorted array.
  36914. * @example
  36915. *
  36916. * var users = [
  36917. * { 'user': 'fred', 'age': 48 },
  36918. * { 'user': 'barney', 'age': 36 },
  36919. * { 'user': 'fred', 'age': 40 },
  36920. * { 'user': 'barney', 'age': 34 }
  36921. * ];
  36922. *
  36923. * _.sortBy(users, [function(o) { return o.user; }]);
  36924. * // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 40]]
  36925. *
  36926. * _.sortBy(users, ['user', 'age']);
  36927. * // => objects for [['barney', 34], ['barney', 36], ['fred', 40], ['fred', 48]]
  36928. */
  36929. var sortBy = baseRest(function(collection, iteratees) {
  36930. if (collection == null) {
  36931. return [];
  36932. }
  36933. var length = iteratees.length;
  36934. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  36935. iteratees = [];
  36936. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  36937. iteratees = [iteratees[0]];
  36938. }
  36939. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  36940. });
  36941. module.exports = sortBy;
  36942. },{"./_baseFlatten":333,"./_baseOrderBy":359,"./_baseRest":364,"./_isIterateeCall":422}],509:[function(require,module,exports){
  36943. var baseClamp = require('./_baseClamp'),
  36944. baseToString = require('./_baseToString'),
  36945. toInteger = require('./toInteger'),
  36946. toString = require('./toString');
  36947. /**
  36948. * Checks if `string` starts with the given target string.
  36949. *
  36950. * @static
  36951. * @memberOf _
  36952. * @since 3.0.0
  36953. * @category String
  36954. * @param {string} [string=''] The string to inspect.
  36955. * @param {string} [target] The string to search for.
  36956. * @param {number} [position=0] The position to search from.
  36957. * @returns {boolean} Returns `true` if `string` starts with `target`,
  36958. * else `false`.
  36959. * @example
  36960. *
  36961. * _.startsWith('abc', 'a');
  36962. * // => true
  36963. *
  36964. * _.startsWith('abc', 'b');
  36965. * // => false
  36966. *
  36967. * _.startsWith('abc', 'b', 1);
  36968. * // => true
  36969. */
  36970. function startsWith(string, target, position) {
  36971. string = toString(string);
  36972. position = position == null
  36973. ? 0
  36974. : baseClamp(toInteger(position), 0, string.length);
  36975. target = baseToString(target);
  36976. return string.slice(position, position + target.length) == target;
  36977. }
  36978. module.exports = startsWith;
  36979. },{"./_baseClamp":328,"./_baseToString":368,"./toInteger":513,"./toString":516}],510:[function(require,module,exports){
  36980. /**
  36981. * This method returns a new empty array.
  36982. *
  36983. * @static
  36984. * @memberOf _
  36985. * @since 4.13.0
  36986. * @category Util
  36987. * @returns {Array} Returns the new empty array.
  36988. * @example
  36989. *
  36990. * var arrays = _.times(2, _.stubArray);
  36991. *
  36992. * console.log(arrays);
  36993. * // => [[], []]
  36994. *
  36995. * console.log(arrays[0] === arrays[1]);
  36996. * // => false
  36997. */
  36998. function stubArray() {
  36999. return [];
  37000. }
  37001. module.exports = stubArray;
  37002. },{}],511:[function(require,module,exports){
  37003. /**
  37004. * This method returns `false`.
  37005. *
  37006. * @static
  37007. * @memberOf _
  37008. * @since 4.13.0
  37009. * @category Util
  37010. * @returns {boolean} Returns `false`.
  37011. * @example
  37012. *
  37013. * _.times(2, _.stubFalse);
  37014. * // => [false, false]
  37015. */
  37016. function stubFalse() {
  37017. return false;
  37018. }
  37019. module.exports = stubFalse;
  37020. },{}],512:[function(require,module,exports){
  37021. var toNumber = require('./toNumber');
  37022. /** Used as references for various `Number` constants. */
  37023. var INFINITY = 1 / 0,
  37024. MAX_INTEGER = 1.7976931348623157e+308;
  37025. /**
  37026. * Converts `value` to a finite number.
  37027. *
  37028. * @static
  37029. * @memberOf _
  37030. * @since 4.12.0
  37031. * @category Lang
  37032. * @param {*} value The value to convert.
  37033. * @returns {number} Returns the converted number.
  37034. * @example
  37035. *
  37036. * _.toFinite(3.2);
  37037. * // => 3.2
  37038. *
  37039. * _.toFinite(Number.MIN_VALUE);
  37040. * // => 5e-324
  37041. *
  37042. * _.toFinite(Infinity);
  37043. * // => 1.7976931348623157e+308
  37044. *
  37045. * _.toFinite('3.2');
  37046. * // => 3.2
  37047. */
  37048. function toFinite(value) {
  37049. if (!value) {
  37050. return value === 0 ? value : 0;
  37051. }
  37052. value = toNumber(value);
  37053. if (value === INFINITY || value === -INFINITY) {
  37054. var sign = (value < 0 ? -1 : 1);
  37055. return sign * MAX_INTEGER;
  37056. }
  37057. return value === value ? value : 0;
  37058. }
  37059. module.exports = toFinite;
  37060. },{"./toNumber":514}],513:[function(require,module,exports){
  37061. var toFinite = require('./toFinite');
  37062. /**
  37063. * Converts `value` to an integer.
  37064. *
  37065. * **Note:** This method is loosely based on
  37066. * [`ToInteger`](http://www.ecma-international.org/ecma-262/7.0/#sec-tointeger).
  37067. *
  37068. * @static
  37069. * @memberOf _
  37070. * @since 4.0.0
  37071. * @category Lang
  37072. * @param {*} value The value to convert.
  37073. * @returns {number} Returns the converted integer.
  37074. * @example
  37075. *
  37076. * _.toInteger(3.2);
  37077. * // => 3
  37078. *
  37079. * _.toInteger(Number.MIN_VALUE);
  37080. * // => 0
  37081. *
  37082. * _.toInteger(Infinity);
  37083. * // => 1.7976931348623157e+308
  37084. *
  37085. * _.toInteger('3.2');
  37086. * // => 3
  37087. */
  37088. function toInteger(value) {
  37089. var result = toFinite(value),
  37090. remainder = result % 1;
  37091. return result === result ? (remainder ? result - remainder : result) : 0;
  37092. }
  37093. module.exports = toInteger;
  37094. },{"./toFinite":512}],514:[function(require,module,exports){
  37095. var isObject = require('./isObject'),
  37096. isSymbol = require('./isSymbol');
  37097. /** Used as references for various `Number` constants. */
  37098. var NAN = 0 / 0;
  37099. /** Used to match leading and trailing whitespace. */
  37100. var reTrim = /^\s+|\s+$/g;
  37101. /** Used to detect bad signed hexadecimal string values. */
  37102. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  37103. /** Used to detect binary string values. */
  37104. var reIsBinary = /^0b[01]+$/i;
  37105. /** Used to detect octal string values. */
  37106. var reIsOctal = /^0o[0-7]+$/i;
  37107. /** Built-in method references without a dependency on `root`. */
  37108. var freeParseInt = parseInt;
  37109. /**
  37110. * Converts `value` to a number.
  37111. *
  37112. * @static
  37113. * @memberOf _
  37114. * @since 4.0.0
  37115. * @category Lang
  37116. * @param {*} value The value to process.
  37117. * @returns {number} Returns the number.
  37118. * @example
  37119. *
  37120. * _.toNumber(3.2);
  37121. * // => 3.2
  37122. *
  37123. * _.toNumber(Number.MIN_VALUE);
  37124. * // => 5e-324
  37125. *
  37126. * _.toNumber(Infinity);
  37127. * // => Infinity
  37128. *
  37129. * _.toNumber('3.2');
  37130. * // => 3.2
  37131. */
  37132. function toNumber(value) {
  37133. if (typeof value == 'number') {
  37134. return value;
  37135. }
  37136. if (isSymbol(value)) {
  37137. return NAN;
  37138. }
  37139. if (isObject(value)) {
  37140. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  37141. value = isObject(other) ? (other + '') : other;
  37142. }
  37143. if (typeof value != 'string') {
  37144. return value === 0 ? value : +value;
  37145. }
  37146. value = value.replace(reTrim, '');
  37147. var isBinary = reIsBinary.test(value);
  37148. return (isBinary || reIsOctal.test(value))
  37149. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  37150. : (reIsBadHex.test(value) ? NAN : +value);
  37151. }
  37152. module.exports = toNumber;
  37153. },{"./isObject":491,"./isSymbol":496}],515:[function(require,module,exports){
  37154. var copyObject = require('./_copyObject'),
  37155. keysIn = require('./keysIn');
  37156. /**
  37157. * Converts `value` to a plain object flattening inherited enumerable string
  37158. * keyed properties of `value` to own properties of the plain object.
  37159. *
  37160. * @static
  37161. * @memberOf _
  37162. * @since 3.0.0
  37163. * @category Lang
  37164. * @param {*} value The value to convert.
  37165. * @returns {Object} Returns the converted plain object.
  37166. * @example
  37167. *
  37168. * function Foo() {
  37169. * this.b = 2;
  37170. * }
  37171. *
  37172. * Foo.prototype.c = 3;
  37173. *
  37174. * _.assign({ 'a': 1 }, new Foo);
  37175. * // => { 'a': 1, 'b': 2 }
  37176. *
  37177. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  37178. * // => { 'a': 1, 'b': 2, 'c': 3 }
  37179. */
  37180. function toPlainObject(value) {
  37181. return copyObject(value, keysIn(value));
  37182. }
  37183. module.exports = toPlainObject;
  37184. },{"./_copyObject":385,"./keysIn":499}],516:[function(require,module,exports){
  37185. var baseToString = require('./_baseToString');
  37186. /**
  37187. * Converts `value` to a string. An empty string is returned for `null`
  37188. * and `undefined` values. The sign of `-0` is preserved.
  37189. *
  37190. * @static
  37191. * @memberOf _
  37192. * @since 4.0.0
  37193. * @category Lang
  37194. * @param {*} value The value to convert.
  37195. * @returns {string} Returns the converted string.
  37196. * @example
  37197. *
  37198. * _.toString(null);
  37199. * // => ''
  37200. *
  37201. * _.toString(-0);
  37202. * // => '-0'
  37203. *
  37204. * _.toString([1, 2, 3]);
  37205. * // => '1,2,3'
  37206. */
  37207. function toString(value) {
  37208. return value == null ? '' : baseToString(value);
  37209. }
  37210. module.exports = toString;
  37211. },{"./_baseToString":368}],517:[function(require,module,exports){
  37212. var baseUniq = require('./_baseUniq');
  37213. /**
  37214. * Creates a duplicate-free version of an array, using
  37215. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  37216. * for equality comparisons, in which only the first occurrence of each element
  37217. * is kept. The order of result values is determined by the order they occur
  37218. * in the array.
  37219. *
  37220. * @static
  37221. * @memberOf _
  37222. * @since 0.1.0
  37223. * @category Array
  37224. * @param {Array} array The array to inspect.
  37225. * @returns {Array} Returns the new duplicate free array.
  37226. * @example
  37227. *
  37228. * _.uniq([2, 1, 2]);
  37229. * // => [2, 1]
  37230. */
  37231. function uniq(array) {
  37232. return (array && array.length) ? baseUniq(array) : [];
  37233. }
  37234. module.exports = uniq;
  37235. },{"./_baseUniq":370}],518:[function(require,module,exports){
  37236. var baseValues = require('./_baseValues'),
  37237. keys = require('./keys');
  37238. /**
  37239. * Creates an array of the own enumerable string keyed property values of `object`.
  37240. *
  37241. * **Note:** Non-object values are coerced to objects.
  37242. *
  37243. * @static
  37244. * @since 0.1.0
  37245. * @memberOf _
  37246. * @category Object
  37247. * @param {Object} object The object to query.
  37248. * @returns {Array} Returns the array of property values.
  37249. * @example
  37250. *
  37251. * function Foo() {
  37252. * this.a = 1;
  37253. * this.b = 2;
  37254. * }
  37255. *
  37256. * Foo.prototype.c = 3;
  37257. *
  37258. * _.values(new Foo);
  37259. * // => [1, 2] (iteration order is not guaranteed)
  37260. *
  37261. * _.values('hi');
  37262. * // => ['h', 'i']
  37263. */
  37264. function values(object) {
  37265. return object == null ? [] : baseValues(object, keys(object));
  37266. }
  37267. module.exports = values;
  37268. },{"./_baseValues":371,"./keys":498}],519:[function(require,module,exports){
  37269. module.exports = minimatch
  37270. minimatch.Minimatch = Minimatch
  37271. var path = { sep: '/' }
  37272. try {
  37273. path = require('path')
  37274. } catch (er) {}
  37275. var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}
  37276. var expand = require('brace-expansion')
  37277. var plTypes = {
  37278. '!': { open: '(?:(?!(?:', close: '))[^/]*?)'},
  37279. '?': { open: '(?:', close: ')?' },
  37280. '+': { open: '(?:', close: ')+' },
  37281. '*': { open: '(?:', close: ')*' },
  37282. '@': { open: '(?:', close: ')' }
  37283. }
  37284. // any single thing other than /
  37285. // don't need to escape / when using new RegExp()
  37286. var qmark = '[^/]'
  37287. // * => any number of characters
  37288. var star = qmark + '*?'
  37289. // ** when dots are allowed. Anything goes, except .. and .
  37290. // not (^ or / followed by one or two dots followed by $ or /),
  37291. // followed by anything, any number of times.
  37292. var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?'
  37293. // not a ^ or / followed by a dot,
  37294. // followed by anything, any number of times.
  37295. var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?'
  37296. // characters that need to be escaped in RegExp.
  37297. var reSpecials = charSet('().*{}+?[]^$\\!')
  37298. // "abc" -> { a:true, b:true, c:true }
  37299. function charSet (s) {
  37300. return s.split('').reduce(function (set, c) {
  37301. set[c] = true
  37302. return set
  37303. }, {})
  37304. }
  37305. // normalizes slashes.
  37306. var slashSplit = /\/+/
  37307. minimatch.filter = filter
  37308. function filter (pattern, options) {
  37309. options = options || {}
  37310. return function (p, i, list) {
  37311. return minimatch(p, pattern, options)
  37312. }
  37313. }
  37314. function ext (a, b) {
  37315. a = a || {}
  37316. b = b || {}
  37317. var t = {}
  37318. Object.keys(b).forEach(function (k) {
  37319. t[k] = b[k]
  37320. })
  37321. Object.keys(a).forEach(function (k) {
  37322. t[k] = a[k]
  37323. })
  37324. return t
  37325. }
  37326. minimatch.defaults = function (def) {
  37327. if (!def || !Object.keys(def).length) return minimatch
  37328. var orig = minimatch
  37329. var m = function minimatch (p, pattern, options) {
  37330. return orig.minimatch(p, pattern, ext(def, options))
  37331. }
  37332. m.Minimatch = function Minimatch (pattern, options) {
  37333. return new orig.Minimatch(pattern, ext(def, options))
  37334. }
  37335. return m
  37336. }
  37337. Minimatch.defaults = function (def) {
  37338. if (!def || !Object.keys(def).length) return Minimatch
  37339. return minimatch.defaults(def).Minimatch
  37340. }
  37341. function minimatch (p, pattern, options) {
  37342. if (typeof pattern !== 'string') {
  37343. throw new TypeError('glob pattern string required')
  37344. }
  37345. if (!options) options = {}
  37346. // shortcut: comments match nothing.
  37347. if (!options.nocomment && pattern.charAt(0) === '#') {
  37348. return false
  37349. }
  37350. // "" only matches ""
  37351. if (pattern.trim() === '') return p === ''
  37352. return new Minimatch(pattern, options).match(p)
  37353. }
  37354. function Minimatch (pattern, options) {
  37355. if (!(this instanceof Minimatch)) {
  37356. return new Minimatch(pattern, options)
  37357. }
  37358. if (typeof pattern !== 'string') {
  37359. throw new TypeError('glob pattern string required')
  37360. }
  37361. if (!options) options = {}
  37362. pattern = pattern.trim()
  37363. // windows support: need to use /, not \
  37364. if (path.sep !== '/') {
  37365. pattern = pattern.split(path.sep).join('/')
  37366. }
  37367. this.options = options
  37368. this.set = []
  37369. this.pattern = pattern
  37370. this.regexp = null
  37371. this.negate = false
  37372. this.comment = false
  37373. this.empty = false
  37374. // make the set of regexps etc.
  37375. this.make()
  37376. }
  37377. Minimatch.prototype.debug = function () {}
  37378. Minimatch.prototype.make = make
  37379. function make () {
  37380. // don't do it more than once.
  37381. if (this._made) return
  37382. var pattern = this.pattern
  37383. var options = this.options
  37384. // empty patterns and comments match nothing.
  37385. if (!options.nocomment && pattern.charAt(0) === '#') {
  37386. this.comment = true
  37387. return
  37388. }
  37389. if (!pattern) {
  37390. this.empty = true
  37391. return
  37392. }
  37393. // step 1: figure out negation, etc.
  37394. this.parseNegate()
  37395. // step 2: expand braces
  37396. var set = this.globSet = this.braceExpand()
  37397. if (options.debug) this.debug = console.error
  37398. this.debug(this.pattern, set)
  37399. // step 3: now we have a set, so turn each one into a series of path-portion
  37400. // matching patterns.
  37401. // These will be regexps, except in the case of "**", which is
  37402. // set to the GLOBSTAR object for globstar behavior,
  37403. // and will not contain any / characters
  37404. set = this.globParts = set.map(function (s) {
  37405. return s.split(slashSplit)
  37406. })
  37407. this.debug(this.pattern, set)
  37408. // glob --> regexps
  37409. set = set.map(function (s, si, set) {
  37410. return s.map(this.parse, this)
  37411. }, this)
  37412. this.debug(this.pattern, set)
  37413. // filter out everything that didn't compile properly.
  37414. set = set.filter(function (s) {
  37415. return s.indexOf(false) === -1
  37416. })
  37417. this.debug(this.pattern, set)
  37418. this.set = set
  37419. }
  37420. Minimatch.prototype.parseNegate = parseNegate
  37421. function parseNegate () {
  37422. var pattern = this.pattern
  37423. var negate = false
  37424. var options = this.options
  37425. var negateOffset = 0
  37426. if (options.nonegate) return
  37427. for (var i = 0, l = pattern.length
  37428. ; i < l && pattern.charAt(i) === '!'
  37429. ; i++) {
  37430. negate = !negate
  37431. negateOffset++
  37432. }
  37433. if (negateOffset) this.pattern = pattern.substr(negateOffset)
  37434. this.negate = negate
  37435. }
  37436. // Brace expansion:
  37437. // a{b,c}d -> abd acd
  37438. // a{b,}c -> abc ac
  37439. // a{0..3}d -> a0d a1d a2d a3d
  37440. // a{b,c{d,e}f}g -> abg acdfg acefg
  37441. // a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
  37442. //
  37443. // Invalid sets are not expanded.
  37444. // a{2..}b -> a{2..}b
  37445. // a{b}c -> a{b}c
  37446. minimatch.braceExpand = function (pattern, options) {
  37447. return braceExpand(pattern, options)
  37448. }
  37449. Minimatch.prototype.braceExpand = braceExpand
  37450. function braceExpand (pattern, options) {
  37451. if (!options) {
  37452. if (this instanceof Minimatch) {
  37453. options = this.options
  37454. } else {
  37455. options = {}
  37456. }
  37457. }
  37458. pattern = typeof pattern === 'undefined'
  37459. ? this.pattern : pattern
  37460. if (typeof pattern === 'undefined') {
  37461. throw new TypeError('undefined pattern')
  37462. }
  37463. if (options.nobrace ||
  37464. !pattern.match(/\{.*\}/)) {
  37465. // shortcut. no need to expand.
  37466. return [pattern]
  37467. }
  37468. return expand(pattern)
  37469. }
  37470. // parse a component of the expanded set.
  37471. // At this point, no pattern may contain "/" in it
  37472. // so we're going to return a 2d array, where each entry is the full
  37473. // pattern, split on '/', and then turned into a regular expression.
  37474. // A regexp is made at the end which joins each array with an
  37475. // escaped /, and another full one which joins each regexp with |.
  37476. //
  37477. // Following the lead of Bash 4.1, note that "**" only has special meaning
  37478. // when it is the *only* thing in a path portion. Otherwise, any series
  37479. // of * is equivalent to a single *. Globstar behavior is enabled by
  37480. // default, and can be disabled by setting options.noglobstar.
  37481. Minimatch.prototype.parse = parse
  37482. var SUBPARSE = {}
  37483. function parse (pattern, isSub) {
  37484. if (pattern.length > 1024 * 64) {
  37485. throw new TypeError('pattern is too long')
  37486. }
  37487. var options = this.options
  37488. // shortcuts
  37489. if (!options.noglobstar && pattern === '**') return GLOBSTAR
  37490. if (pattern === '') return ''
  37491. var re = ''
  37492. var hasMagic = !!options.nocase
  37493. var escaping = false
  37494. // ? => one single character
  37495. var patternListStack = []
  37496. var negativeLists = []
  37497. var stateChar
  37498. var inClass = false
  37499. var reClassStart = -1
  37500. var classStart = -1
  37501. // . and .. never match anything that doesn't start with .,
  37502. // even when options.dot is set.
  37503. var patternStart = pattern.charAt(0) === '.' ? '' // anything
  37504. // not (start or / followed by . or .. followed by / or end)
  37505. : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))'
  37506. : '(?!\\.)'
  37507. var self = this
  37508. function clearStateChar () {
  37509. if (stateChar) {
  37510. // we had some state-tracking character
  37511. // that wasn't consumed by this pass.
  37512. switch (stateChar) {
  37513. case '*':
  37514. re += star
  37515. hasMagic = true
  37516. break
  37517. case '?':
  37518. re += qmark
  37519. hasMagic = true
  37520. break
  37521. default:
  37522. re += '\\' + stateChar
  37523. break
  37524. }
  37525. self.debug('clearStateChar %j %j', stateChar, re)
  37526. stateChar = false
  37527. }
  37528. }
  37529. for (var i = 0, len = pattern.length, c
  37530. ; (i < len) && (c = pattern.charAt(i))
  37531. ; i++) {
  37532. this.debug('%s\t%s %s %j', pattern, i, re, c)
  37533. // skip over any that are escaped.
  37534. if (escaping && reSpecials[c]) {
  37535. re += '\\' + c
  37536. escaping = false
  37537. continue
  37538. }
  37539. switch (c) {
  37540. case '/':
  37541. // completely not allowed, even escaped.
  37542. // Should already be path-split by now.
  37543. return false
  37544. case '\\':
  37545. clearStateChar()
  37546. escaping = true
  37547. continue
  37548. // the various stateChar values
  37549. // for the "extglob" stuff.
  37550. case '?':
  37551. case '*':
  37552. case '+':
  37553. case '@':
  37554. case '!':
  37555. this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c)
  37556. // all of those are literals inside a class, except that
  37557. // the glob [!a] means [^a] in regexp
  37558. if (inClass) {
  37559. this.debug(' in class')
  37560. if (c === '!' && i === classStart + 1) c = '^'
  37561. re += c
  37562. continue
  37563. }
  37564. // if we already have a stateChar, then it means
  37565. // that there was something like ** or +? in there.
  37566. // Handle the stateChar, then proceed with this one.
  37567. self.debug('call clearStateChar %j', stateChar)
  37568. clearStateChar()
  37569. stateChar = c
  37570. // if extglob is disabled, then +(asdf|foo) isn't a thing.
  37571. // just clear the statechar *now*, rather than even diving into
  37572. // the patternList stuff.
  37573. if (options.noext) clearStateChar()
  37574. continue
  37575. case '(':
  37576. if (inClass) {
  37577. re += '('
  37578. continue
  37579. }
  37580. if (!stateChar) {
  37581. re += '\\('
  37582. continue
  37583. }
  37584. patternListStack.push({
  37585. type: stateChar,
  37586. start: i - 1,
  37587. reStart: re.length,
  37588. open: plTypes[stateChar].open,
  37589. close: plTypes[stateChar].close
  37590. })
  37591. // negation is (?:(?!js)[^/]*)
  37592. re += stateChar === '!' ? '(?:(?!(?:' : '(?:'
  37593. this.debug('plType %j %j', stateChar, re)
  37594. stateChar = false
  37595. continue
  37596. case ')':
  37597. if (inClass || !patternListStack.length) {
  37598. re += '\\)'
  37599. continue
  37600. }
  37601. clearStateChar()
  37602. hasMagic = true
  37603. var pl = patternListStack.pop()
  37604. // negation is (?:(?!js)[^/]*)
  37605. // The others are (?:<pattern>)<type>
  37606. re += pl.close
  37607. if (pl.type === '!') {
  37608. negativeLists.push(pl)
  37609. }
  37610. pl.reEnd = re.length
  37611. continue
  37612. case '|':
  37613. if (inClass || !patternListStack.length || escaping) {
  37614. re += '\\|'
  37615. escaping = false
  37616. continue
  37617. }
  37618. clearStateChar()
  37619. re += '|'
  37620. continue
  37621. // these are mostly the same in regexp and glob
  37622. case '[':
  37623. // swallow any state-tracking char before the [
  37624. clearStateChar()
  37625. if (inClass) {
  37626. re += '\\' + c
  37627. continue
  37628. }
  37629. inClass = true
  37630. classStart = i
  37631. reClassStart = re.length
  37632. re += c
  37633. continue
  37634. case ']':
  37635. // a right bracket shall lose its special
  37636. // meaning and represent itself in
  37637. // a bracket expression if it occurs
  37638. // first in the list. -- POSIX.2 2.8.3.2
  37639. if (i === classStart + 1 || !inClass) {
  37640. re += '\\' + c
  37641. escaping = false
  37642. continue
  37643. }
  37644. // handle the case where we left a class open.
  37645. // "[z-a]" is valid, equivalent to "\[z-a\]"
  37646. if (inClass) {
  37647. // split where the last [ was, make sure we don't have
  37648. // an invalid re. if so, re-walk the contents of the
  37649. // would-be class to re-translate any characters that
  37650. // were passed through as-is
  37651. // TODO: It would probably be faster to determine this
  37652. // without a try/catch and a new RegExp, but it's tricky
  37653. // to do safely. For now, this is safe and works.
  37654. var cs = pattern.substring(classStart + 1, i)
  37655. try {
  37656. RegExp('[' + cs + ']')
  37657. } catch (er) {
  37658. // not a valid class!
  37659. var sp = this.parse(cs, SUBPARSE)
  37660. re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'
  37661. hasMagic = hasMagic || sp[1]
  37662. inClass = false
  37663. continue
  37664. }
  37665. }
  37666. // finish up the class.
  37667. hasMagic = true
  37668. inClass = false
  37669. re += c
  37670. continue
  37671. default:
  37672. // swallow any state char that wasn't consumed
  37673. clearStateChar()
  37674. if (escaping) {
  37675. // no need
  37676. escaping = false
  37677. } else if (reSpecials[c]
  37678. && !(c === '^' && inClass)) {
  37679. re += '\\'
  37680. }
  37681. re += c
  37682. } // switch
  37683. } // for
  37684. // handle the case where we left a class open.
  37685. // "[abc" is valid, equivalent to "\[abc"
  37686. if (inClass) {
  37687. // split where the last [ was, and escape it
  37688. // this is a huge pita. We now have to re-walk
  37689. // the contents of the would-be class to re-translate
  37690. // any characters that were passed through as-is
  37691. cs = pattern.substr(classStart + 1)
  37692. sp = this.parse(cs, SUBPARSE)
  37693. re = re.substr(0, reClassStart) + '\\[' + sp[0]
  37694. hasMagic = hasMagic || sp[1]
  37695. }
  37696. // handle the case where we had a +( thing at the *end*
  37697. // of the pattern.
  37698. // each pattern list stack adds 3 chars, and we need to go through
  37699. // and escape any | chars that were passed through as-is for the regexp.
  37700. // Go through and escape them, taking care not to double-escape any
  37701. // | chars that were already escaped.
  37702. for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
  37703. var tail = re.slice(pl.reStart + pl.open.length)
  37704. this.debug('setting tail', re, pl)
  37705. // maybe some even number of \, then maybe 1 \, followed by a |
  37706. tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) {
  37707. if (!$2) {
  37708. // the | isn't already escaped, so escape it.
  37709. $2 = '\\'
  37710. }
  37711. // need to escape all those slashes *again*, without escaping the
  37712. // one that we need for escaping the | character. As it works out,
  37713. // escaping an even number of slashes can be done by simply repeating
  37714. // it exactly after itself. That's why this trick works.
  37715. //
  37716. // I am sorry that you have to see this.
  37717. return $1 + $1 + $2 + '|'
  37718. })
  37719. this.debug('tail=%j\n %s', tail, tail, pl, re)
  37720. var t = pl.type === '*' ? star
  37721. : pl.type === '?' ? qmark
  37722. : '\\' + pl.type
  37723. hasMagic = true
  37724. re = re.slice(0, pl.reStart) + t + '\\(' + tail
  37725. }
  37726. // handle trailing things that only matter at the very end.
  37727. clearStateChar()
  37728. if (escaping) {
  37729. // trailing \\
  37730. re += '\\\\'
  37731. }
  37732. // only need to apply the nodot start if the re starts with
  37733. // something that could conceivably capture a dot
  37734. var addPatternStart = false
  37735. switch (re.charAt(0)) {
  37736. case '.':
  37737. case '[':
  37738. case '(': addPatternStart = true
  37739. }
  37740. // Hack to work around lack of negative lookbehind in JS
  37741. // A pattern like: *.!(x).!(y|z) needs to ensure that a name
  37742. // like 'a.xyz.yz' doesn't match. So, the first negative
  37743. // lookahead, has to look ALL the way ahead, to the end of
  37744. // the pattern.
  37745. for (var n = negativeLists.length - 1; n > -1; n--) {
  37746. var nl = negativeLists[n]
  37747. var nlBefore = re.slice(0, nl.reStart)
  37748. var nlFirst = re.slice(nl.reStart, nl.reEnd - 8)
  37749. var nlLast = re.slice(nl.reEnd - 8, nl.reEnd)
  37750. var nlAfter = re.slice(nl.reEnd)
  37751. nlLast += nlAfter
  37752. // Handle nested stuff like *(*.js|!(*.json)), where open parens
  37753. // mean that we should *not* include the ) in the bit that is considered
  37754. // "after" the negated section.
  37755. var openParensBefore = nlBefore.split('(').length - 1
  37756. var cleanAfter = nlAfter
  37757. for (i = 0; i < openParensBefore; i++) {
  37758. cleanAfter = cleanAfter.replace(/\)[+*?]?/, '')
  37759. }
  37760. nlAfter = cleanAfter
  37761. var dollar = ''
  37762. if (nlAfter === '' && isSub !== SUBPARSE) {
  37763. dollar = '$'
  37764. }
  37765. var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast
  37766. re = newRe
  37767. }
  37768. // if the re is not "" at this point, then we need to make sure
  37769. // it doesn't match against an empty path part.
  37770. // Otherwise a/* will match a/, which it should not.
  37771. if (re !== '' && hasMagic) {
  37772. re = '(?=.)' + re
  37773. }
  37774. if (addPatternStart) {
  37775. re = patternStart + re
  37776. }
  37777. // parsing just a piece of a larger pattern.
  37778. if (isSub === SUBPARSE) {
  37779. return [re, hasMagic]
  37780. }
  37781. // skip the regexp for non-magical patterns
  37782. // unescape anything in it, though, so that it'll be
  37783. // an exact match against a file etc.
  37784. if (!hasMagic) {
  37785. return globUnescape(pattern)
  37786. }
  37787. var flags = options.nocase ? 'i' : ''
  37788. try {
  37789. var regExp = new RegExp('^' + re + '$', flags)
  37790. } catch (er) {
  37791. // If it was an invalid regular expression, then it can't match
  37792. // anything. This trick looks for a character after the end of
  37793. // the string, which is of course impossible, except in multi-line
  37794. // mode, but it's not a /m regex.
  37795. return new RegExp('$.')
  37796. }
  37797. regExp._glob = pattern
  37798. regExp._src = re
  37799. return regExp
  37800. }
  37801. minimatch.makeRe = function (pattern, options) {
  37802. return new Minimatch(pattern, options || {}).makeRe()
  37803. }
  37804. Minimatch.prototype.makeRe = makeRe
  37805. function makeRe () {
  37806. if (this.regexp || this.regexp === false) return this.regexp
  37807. // at this point, this.set is a 2d array of partial
  37808. // pattern strings, or "**".
  37809. //
  37810. // It's better to use .match(). This function shouldn't
  37811. // be used, really, but it's pretty convenient sometimes,
  37812. // when you just want to work with a regex.
  37813. var set = this.set
  37814. if (!set.length) {
  37815. this.regexp = false
  37816. return this.regexp
  37817. }
  37818. var options = this.options
  37819. var twoStar = options.noglobstar ? star
  37820. : options.dot ? twoStarDot
  37821. : twoStarNoDot
  37822. var flags = options.nocase ? 'i' : ''
  37823. var re = set.map(function (pattern) {
  37824. return pattern.map(function (p) {
  37825. return (p === GLOBSTAR) ? twoStar
  37826. : (typeof p === 'string') ? regExpEscape(p)
  37827. : p._src
  37828. }).join('\\\/')
  37829. }).join('|')
  37830. // must match entire pattern
  37831. // ending in a * or ** will make it less strict.
  37832. re = '^(?:' + re + ')$'
  37833. // can match anything, as long as it's not this.
  37834. if (this.negate) re = '^(?!' + re + ').*$'
  37835. try {
  37836. this.regexp = new RegExp(re, flags)
  37837. } catch (ex) {
  37838. this.regexp = false
  37839. }
  37840. return this.regexp
  37841. }
  37842. minimatch.match = function (list, pattern, options) {
  37843. options = options || {}
  37844. var mm = new Minimatch(pattern, options)
  37845. list = list.filter(function (f) {
  37846. return mm.match(f)
  37847. })
  37848. if (mm.options.nonull && !list.length) {
  37849. list.push(pattern)
  37850. }
  37851. return list
  37852. }
  37853. Minimatch.prototype.match = match
  37854. function match (f, partial) {
  37855. this.debug('match', f, this.pattern)
  37856. // short-circuit in the case of busted things.
  37857. // comments, etc.
  37858. if (this.comment) return false
  37859. if (this.empty) return f === ''
  37860. if (f === '/' && partial) return true
  37861. var options = this.options
  37862. // windows: need to use /, not \
  37863. if (path.sep !== '/') {
  37864. f = f.split(path.sep).join('/')
  37865. }
  37866. // treat the test path as a set of pathparts.
  37867. f = f.split(slashSplit)
  37868. this.debug(this.pattern, 'split', f)
  37869. // just ONE of the pattern sets in this.set needs to match
  37870. // in order for it to be valid. If negating, then just one
  37871. // match means that we have failed.
  37872. // Either way, return on the first hit.
  37873. var set = this.set
  37874. this.debug(this.pattern, 'set', set)
  37875. // Find the basename of the path by looking for the last non-empty segment
  37876. var filename
  37877. var i
  37878. for (i = f.length - 1; i >= 0; i--) {
  37879. filename = f[i]
  37880. if (filename) break
  37881. }
  37882. for (i = 0; i < set.length; i++) {
  37883. var pattern = set[i]
  37884. var file = f
  37885. if (options.matchBase && pattern.length === 1) {
  37886. file = [filename]
  37887. }
  37888. var hit = this.matchOne(file, pattern, partial)
  37889. if (hit) {
  37890. if (options.flipNegate) return true
  37891. return !this.negate
  37892. }
  37893. }
  37894. // didn't get any hits. this is success if it's a negative
  37895. // pattern, failure otherwise.
  37896. if (options.flipNegate) return false
  37897. return this.negate
  37898. }
  37899. // set partial to true to test if, for example,
  37900. // "/a/b" matches the start of "/*/b/*/d"
  37901. // Partial means, if you run out of file before you run
  37902. // out of pattern, then that's fine, as long as all
  37903. // the parts match.
  37904. Minimatch.prototype.matchOne = function (file, pattern, partial) {
  37905. var options = this.options
  37906. this.debug('matchOne',
  37907. { 'this': this, file: file, pattern: pattern })
  37908. this.debug('matchOne', file.length, pattern.length)
  37909. for (var fi = 0,
  37910. pi = 0,
  37911. fl = file.length,
  37912. pl = pattern.length
  37913. ; (fi < fl) && (pi < pl)
  37914. ; fi++, pi++) {
  37915. this.debug('matchOne loop')
  37916. var p = pattern[pi]
  37917. var f = file[fi]
  37918. this.debug(pattern, p, f)
  37919. // should be impossible.
  37920. // some invalid regexp stuff in the set.
  37921. if (p === false) return false
  37922. if (p === GLOBSTAR) {
  37923. this.debug('GLOBSTAR', [pattern, p, f])
  37924. // "**"
  37925. // a/**/b/**/c would match the following:
  37926. // a/b/x/y/z/c
  37927. // a/x/y/z/b/c
  37928. // a/b/x/b/x/c
  37929. // a/b/c
  37930. // To do this, take the rest of the pattern after
  37931. // the **, and see if it would match the file remainder.
  37932. // If so, return success.
  37933. // If not, the ** "swallows" a segment, and try again.
  37934. // This is recursively awful.
  37935. //
  37936. // a/**/b/**/c matching a/b/x/y/z/c
  37937. // - a matches a
  37938. // - doublestar
  37939. // - matchOne(b/x/y/z/c, b/**/c)
  37940. // - b matches b
  37941. // - doublestar
  37942. // - matchOne(x/y/z/c, c) -> no
  37943. // - matchOne(y/z/c, c) -> no
  37944. // - matchOne(z/c, c) -> no
  37945. // - matchOne(c, c) yes, hit
  37946. var fr = fi
  37947. var pr = pi + 1
  37948. if (pr === pl) {
  37949. this.debug('** at the end')
  37950. // a ** at the end will just swallow the rest.
  37951. // We have found a match.
  37952. // however, it will not swallow /.x, unless
  37953. // options.dot is set.
  37954. // . and .. are *never* matched by **, for explosively
  37955. // exponential reasons.
  37956. for (; fi < fl; fi++) {
  37957. if (file[fi] === '.' || file[fi] === '..' ||
  37958. (!options.dot && file[fi].charAt(0) === '.')) return false
  37959. }
  37960. return true
  37961. }
  37962. // ok, let's see if we can swallow whatever we can.
  37963. while (fr < fl) {
  37964. var swallowee = file[fr]
  37965. this.debug('\nglobstar while', file, fr, pattern, pr, swallowee)
  37966. // XXX remove this slice. Just pass the start index.
  37967. if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
  37968. this.debug('globstar found match!', fr, fl, swallowee)
  37969. // found a match.
  37970. return true
  37971. } else {
  37972. // can't swallow "." or ".." ever.
  37973. // can only swallow ".foo" when explicitly asked.
  37974. if (swallowee === '.' || swallowee === '..' ||
  37975. (!options.dot && swallowee.charAt(0) === '.')) {
  37976. this.debug('dot detected!', file, fr, pattern, pr)
  37977. break
  37978. }
  37979. // ** swallows a segment, and continue.
  37980. this.debug('globstar swallow a segment, and continue')
  37981. fr++
  37982. }
  37983. }
  37984. // no match was found.
  37985. // However, in partial mode, we can't say this is necessarily over.
  37986. // If there's more *pattern* left, then
  37987. if (partial) {
  37988. // ran out of file
  37989. this.debug('\n>>> no match, partial?', file, fr, pattern, pr)
  37990. if (fr === fl) return true
  37991. }
  37992. return false
  37993. }
  37994. // something other than **
  37995. // non-magic patterns just have to match exactly
  37996. // patterns with magic have been turned into regexps.
  37997. var hit
  37998. if (typeof p === 'string') {
  37999. if (options.nocase) {
  38000. hit = f.toLowerCase() === p.toLowerCase()
  38001. } else {
  38002. hit = f === p
  38003. }
  38004. this.debug('string match', p, f, hit)
  38005. } else {
  38006. hit = f.match(p)
  38007. this.debug('pattern match', p, f, hit)
  38008. }
  38009. if (!hit) return false
  38010. }
  38011. // Note: ending in / means that we'll get a final ""
  38012. // at the end of the pattern. This can only match a
  38013. // corresponding "" at the end of the file.
  38014. // If the file ends in /, then it can only match a
  38015. // a pattern that ends in /, unless the pattern just
  38016. // doesn't have any more for it. But, a/b/ should *not*
  38017. // match "a/b/*", even though "" matches against the
  38018. // [^/]*? pattern, except in partial mode, where it might
  38019. // simply not be reached yet.
  38020. // However, a/b/ should still satisfy a/*
  38021. // now either we fell off the end of the pattern, or we're done.
  38022. if (fi === fl && pi === pl) {
  38023. // ran out of pattern and filename at the same time.
  38024. // an exact hit!
  38025. return true
  38026. } else if (fi === fl) {
  38027. // ran out of file, but still had pattern left.
  38028. // this is ok if we're doing the match as part of
  38029. // a glob fs traversal.
  38030. return partial
  38031. } else if (pi === pl) {
  38032. // ran out of pattern, still have file left.
  38033. // this is only acceptable if we're on the very last
  38034. // empty segment of a file with a trailing slash.
  38035. // a/* should match a/b/
  38036. var emptyFileEnd = (fi === fl - 1) && (file[fi] === '')
  38037. return emptyFileEnd
  38038. }
  38039. // should be unreachable.
  38040. throw new Error('wtf?')
  38041. }
  38042. // replace stuff like \* with *
  38043. function globUnescape (s) {
  38044. return s.replace(/\\(.)/g, '$1')
  38045. }
  38046. function regExpEscape (s) {
  38047. return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')
  38048. }
  38049. },{"brace-expansion":158,"path":522}],520:[function(require,module,exports){
  38050. /**
  38051. * Helpers.
  38052. */
  38053. var s = 1000;
  38054. var m = s * 60;
  38055. var h = m * 60;
  38056. var d = h * 24;
  38057. var y = d * 365.25;
  38058. /**
  38059. * Parse or format the given `val`.
  38060. *
  38061. * Options:
  38062. *
  38063. * - `long` verbose formatting [false]
  38064. *
  38065. * @param {String|Number} val
  38066. * @param {Object} [options]
  38067. * @throws {Error} throw an error if val is not a non-empty string or a number
  38068. * @return {String|Number}
  38069. * @api public
  38070. */
  38071. module.exports = function(val, options) {
  38072. options = options || {};
  38073. var type = typeof val;
  38074. if (type === 'string' && val.length > 0) {
  38075. return parse(val);
  38076. } else if (type === 'number' && isNaN(val) === false) {
  38077. return options.long ? fmtLong(val) : fmtShort(val);
  38078. }
  38079. throw new Error(
  38080. 'val is not a non-empty string or a valid number. val=' +
  38081. JSON.stringify(val)
  38082. );
  38083. };
  38084. /**
  38085. * Parse the given `str` and return milliseconds.
  38086. *
  38087. * @param {String} str
  38088. * @return {Number}
  38089. * @api private
  38090. */
  38091. function parse(str) {
  38092. str = String(str);
  38093. if (str.length > 100) {
  38094. return;
  38095. }
  38096. var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(
  38097. str
  38098. );
  38099. if (!match) {
  38100. return;
  38101. }
  38102. var n = parseFloat(match[1]);
  38103. var type = (match[2] || 'ms').toLowerCase();
  38104. switch (type) {
  38105. case 'years':
  38106. case 'year':
  38107. case 'yrs':
  38108. case 'yr':
  38109. case 'y':
  38110. return n * y;
  38111. case 'days':
  38112. case 'day':
  38113. case 'd':
  38114. return n * d;
  38115. case 'hours':
  38116. case 'hour':
  38117. case 'hrs':
  38118. case 'hr':
  38119. case 'h':
  38120. return n * h;
  38121. case 'minutes':
  38122. case 'minute':
  38123. case 'mins':
  38124. case 'min':
  38125. case 'm':
  38126. return n * m;
  38127. case 'seconds':
  38128. case 'second':
  38129. case 'secs':
  38130. case 'sec':
  38131. case 's':
  38132. return n * s;
  38133. case 'milliseconds':
  38134. case 'millisecond':
  38135. case 'msecs':
  38136. case 'msec':
  38137. case 'ms':
  38138. return n;
  38139. default:
  38140. return undefined;
  38141. }
  38142. }
  38143. /**
  38144. * Short format for `ms`.
  38145. *
  38146. * @param {Number} ms
  38147. * @return {String}
  38148. * @api private
  38149. */
  38150. function fmtShort(ms) {
  38151. if (ms >= d) {
  38152. return Math.round(ms / d) + 'd';
  38153. }
  38154. if (ms >= h) {
  38155. return Math.round(ms / h) + 'h';
  38156. }
  38157. if (ms >= m) {
  38158. return Math.round(ms / m) + 'm';
  38159. }
  38160. if (ms >= s) {
  38161. return Math.round(ms / s) + 's';
  38162. }
  38163. return ms + 'ms';
  38164. }
  38165. /**
  38166. * Long format for `ms`.
  38167. *
  38168. * @param {Number} ms
  38169. * @return {String}
  38170. * @api private
  38171. */
  38172. function fmtLong(ms) {
  38173. return plural(ms, d, 'day') ||
  38174. plural(ms, h, 'hour') ||
  38175. plural(ms, m, 'minute') ||
  38176. plural(ms, s, 'second') ||
  38177. ms + ' ms';
  38178. }
  38179. /**
  38180. * Pluralization helper.
  38181. */
  38182. function plural(ms, n, name) {
  38183. if (ms < n) {
  38184. return;
  38185. }
  38186. if (ms < n * 1.5) {
  38187. return Math.floor(ms / n) + ' ' + name;
  38188. }
  38189. return Math.ceil(ms / n) + ' ' + name + 's';
  38190. }
  38191. },{}],521:[function(require,module,exports){
  38192. 'use strict';
  38193. module.exports = Number.isNaN || function (x) {
  38194. return x !== x;
  38195. };
  38196. },{}],522:[function(require,module,exports){
  38197. (function (process){
  38198. // Copyright Joyent, Inc. and other Node contributors.
  38199. //
  38200. // Permission is hereby granted, free of charge, to any person obtaining a
  38201. // copy of this software and associated documentation files (the
  38202. // "Software"), to deal in the Software without restriction, including
  38203. // without limitation the rights to use, copy, modify, merge, publish,
  38204. // distribute, sublicense, and/or sell copies of the Software, and to permit
  38205. // persons to whom the Software is furnished to do so, subject to the
  38206. // following conditions:
  38207. //
  38208. // The above copyright notice and this permission notice shall be included
  38209. // in all copies or substantial portions of the Software.
  38210. //
  38211. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  38212. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  38213. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  38214. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  38215. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  38216. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  38217. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  38218. // resolves . and .. elements in a path array with directory names there
  38219. // must be no slashes, empty elements, or device names (c:\) in the array
  38220. // (so also no leading and trailing slashes - it does not distinguish
  38221. // relative and absolute paths)
  38222. function normalizeArray(parts, allowAboveRoot) {
  38223. // if the path tries to go above the root, `up` ends up > 0
  38224. var up = 0;
  38225. for (var i = parts.length - 1; i >= 0; i--) {
  38226. var last = parts[i];
  38227. if (last === '.') {
  38228. parts.splice(i, 1);
  38229. } else if (last === '..') {
  38230. parts.splice(i, 1);
  38231. up++;
  38232. } else if (up) {
  38233. parts.splice(i, 1);
  38234. up--;
  38235. }
  38236. }
  38237. // if the path is allowed to go above the root, restore leading ..s
  38238. if (allowAboveRoot) {
  38239. for (; up--; up) {
  38240. parts.unshift('..');
  38241. }
  38242. }
  38243. return parts;
  38244. }
  38245. // Split a filename into [root, dir, basename, ext], unix version
  38246. // 'root' is just a slash, or nothing.
  38247. var splitPathRe =
  38248. /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
  38249. var splitPath = function(filename) {
  38250. return splitPathRe.exec(filename).slice(1);
  38251. };
  38252. // path.resolve([from ...], to)
  38253. // posix version
  38254. exports.resolve = function() {
  38255. var resolvedPath = '',
  38256. resolvedAbsolute = false;
  38257. for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
  38258. var path = (i >= 0) ? arguments[i] : process.cwd();
  38259. // Skip empty and invalid entries
  38260. if (typeof path !== 'string') {
  38261. throw new TypeError('Arguments to path.resolve must be strings');
  38262. } else if (!path) {
  38263. continue;
  38264. }
  38265. resolvedPath = path + '/' + resolvedPath;
  38266. resolvedAbsolute = path.charAt(0) === '/';
  38267. }
  38268. // At this point the path should be resolved to a full absolute path, but
  38269. // handle relative paths to be safe (might happen when process.cwd() fails)
  38270. // Normalize the path
  38271. resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
  38272. return !!p;
  38273. }), !resolvedAbsolute).join('/');
  38274. return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
  38275. };
  38276. // path.normalize(path)
  38277. // posix version
  38278. exports.normalize = function(path) {
  38279. var isAbsolute = exports.isAbsolute(path),
  38280. trailingSlash = substr(path, -1) === '/';
  38281. // Normalize the path
  38282. path = normalizeArray(filter(path.split('/'), function(p) {
  38283. return !!p;
  38284. }), !isAbsolute).join('/');
  38285. if (!path && !isAbsolute) {
  38286. path = '.';
  38287. }
  38288. if (path && trailingSlash) {
  38289. path += '/';
  38290. }
  38291. return (isAbsolute ? '/' : '') + path;
  38292. };
  38293. // posix version
  38294. exports.isAbsolute = function(path) {
  38295. return path.charAt(0) === '/';
  38296. };
  38297. // posix version
  38298. exports.join = function() {
  38299. var paths = Array.prototype.slice.call(arguments, 0);
  38300. return exports.normalize(filter(paths, function(p, index) {
  38301. if (typeof p !== 'string') {
  38302. throw new TypeError('Arguments to path.join must be strings');
  38303. }
  38304. return p;
  38305. }).join('/'));
  38306. };
  38307. // path.relative(from, to)
  38308. // posix version
  38309. exports.relative = function(from, to) {
  38310. from = exports.resolve(from).substr(1);
  38311. to = exports.resolve(to).substr(1);
  38312. function trim(arr) {
  38313. var start = 0;
  38314. for (; start < arr.length; start++) {
  38315. if (arr[start] !== '') break;
  38316. }
  38317. var end = arr.length - 1;
  38318. for (; end >= 0; end--) {
  38319. if (arr[end] !== '') break;
  38320. }
  38321. if (start > end) return [];
  38322. return arr.slice(start, end - start + 1);
  38323. }
  38324. var fromParts = trim(from.split('/'));
  38325. var toParts = trim(to.split('/'));
  38326. var length = Math.min(fromParts.length, toParts.length);
  38327. var samePartsLength = length;
  38328. for (var i = 0; i < length; i++) {
  38329. if (fromParts[i] !== toParts[i]) {
  38330. samePartsLength = i;
  38331. break;
  38332. }
  38333. }
  38334. var outputParts = [];
  38335. for (var i = samePartsLength; i < fromParts.length; i++) {
  38336. outputParts.push('..');
  38337. }
  38338. outputParts = outputParts.concat(toParts.slice(samePartsLength));
  38339. return outputParts.join('/');
  38340. };
  38341. exports.sep = '/';
  38342. exports.delimiter = ':';
  38343. exports.dirname = function(path) {
  38344. var result = splitPath(path),
  38345. root = result[0],
  38346. dir = result[1];
  38347. if (!root && !dir) {
  38348. // No dirname whatsoever
  38349. return '.';
  38350. }
  38351. if (dir) {
  38352. // It has a dirname, strip trailing slash
  38353. dir = dir.substr(0, dir.length - 1);
  38354. }
  38355. return root + dir;
  38356. };
  38357. exports.basename = function(path, ext) {
  38358. var f = splitPath(path)[2];
  38359. // TODO: make this comparison case-insensitive on windows?
  38360. if (ext && f.substr(-1 * ext.length) === ext) {
  38361. f = f.substr(0, f.length - ext.length);
  38362. }
  38363. return f;
  38364. };
  38365. exports.extname = function(path) {
  38366. return splitPath(path)[3];
  38367. };
  38368. function filter (xs, f) {
  38369. if (xs.filter) return xs.filter(f);
  38370. var res = [];
  38371. for (var i = 0; i < xs.length; i++) {
  38372. if (f(xs[i], i, xs)) res.push(xs[i]);
  38373. }
  38374. return res;
  38375. }
  38376. // String.prototype.substr - negative index don't work in IE8
  38377. var substr = 'ab'.substr(-1) === 'b'
  38378. ? function (str, start, len) { return str.substr(start, len) }
  38379. : function (str, start, len) {
  38380. if (start < 0) start = str.length + start;
  38381. return str.substr(start, len);
  38382. }
  38383. ;
  38384. }).call(this,require('_process'))
  38385. },{"_process":525}],523:[function(require,module,exports){
  38386. (function (process){
  38387. 'use strict';
  38388. function posix(path) {
  38389. return path.charAt(0) === '/';
  38390. }
  38391. function win32(path) {
  38392. // https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56
  38393. var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
  38394. var result = splitDeviceRe.exec(path);
  38395. var device = result[1] || '';
  38396. var isUnc = Boolean(device && device.charAt(1) !== ':');
  38397. // UNC paths are always absolute
  38398. return Boolean(result[2] || isUnc);
  38399. }
  38400. module.exports = process.platform === 'win32' ? win32 : posix;
  38401. module.exports.posix = posix;
  38402. module.exports.win32 = win32;
  38403. }).call(this,require('_process'))
  38404. },{"_process":525}],524:[function(require,module,exports){
  38405. "use strict";
  38406. var originalObject = Object;
  38407. var originalDefProp = Object.defineProperty;
  38408. var originalCreate = Object.create;
  38409. function defProp(obj, name, value) {
  38410. if (originalDefProp) try {
  38411. originalDefProp.call(originalObject, obj, name, { value: value });
  38412. } catch (definePropertyIsBrokenInIE8) {
  38413. obj[name] = value;
  38414. } else {
  38415. obj[name] = value;
  38416. }
  38417. }
  38418. // For functions that will be invoked using .call or .apply, we need to
  38419. // define those methods on the function objects themselves, rather than
  38420. // inheriting them from Function.prototype, so that a malicious or clumsy
  38421. // third party cannot interfere with the functionality of this module by
  38422. // redefining Function.prototype.call or .apply.
  38423. function makeSafeToCall(fun) {
  38424. if (fun) {
  38425. defProp(fun, "call", fun.call);
  38426. defProp(fun, "apply", fun.apply);
  38427. }
  38428. return fun;
  38429. }
  38430. makeSafeToCall(originalDefProp);
  38431. makeSafeToCall(originalCreate);
  38432. var hasOwn = makeSafeToCall(Object.prototype.hasOwnProperty);
  38433. var numToStr = makeSafeToCall(Number.prototype.toString);
  38434. var strSlice = makeSafeToCall(String.prototype.slice);
  38435. var cloner = function(){};
  38436. function create(prototype) {
  38437. if (originalCreate) {
  38438. return originalCreate.call(originalObject, prototype);
  38439. }
  38440. cloner.prototype = prototype || null;
  38441. return new cloner;
  38442. }
  38443. var rand = Math.random;
  38444. var uniqueKeys = create(null);
  38445. function makeUniqueKey() {
  38446. // Collisions are highly unlikely, but this module is in the business of
  38447. // making guarantees rather than safe bets.
  38448. do var uniqueKey = internString(strSlice.call(numToStr.call(rand(), 36), 2));
  38449. while (hasOwn.call(uniqueKeys, uniqueKey));
  38450. return uniqueKeys[uniqueKey] = uniqueKey;
  38451. }
  38452. function internString(str) {
  38453. var obj = {};
  38454. obj[str] = true;
  38455. return Object.keys(obj)[0];
  38456. }
  38457. // External users might find this function useful, but it is not necessary
  38458. // for the typical use of this module.
  38459. exports.makeUniqueKey = makeUniqueKey;
  38460. // Object.getOwnPropertyNames is the only way to enumerate non-enumerable
  38461. // properties, so if we wrap it to ignore our secret keys, there should be
  38462. // no way (except guessing) to access those properties.
  38463. var originalGetOPNs = Object.getOwnPropertyNames;
  38464. Object.getOwnPropertyNames = function getOwnPropertyNames(object) {
  38465. for (var names = originalGetOPNs(object),
  38466. src = 0,
  38467. dst = 0,
  38468. len = names.length;
  38469. src < len;
  38470. ++src) {
  38471. if (!hasOwn.call(uniqueKeys, names[src])) {
  38472. if (src > dst) {
  38473. names[dst] = names[src];
  38474. }
  38475. ++dst;
  38476. }
  38477. }
  38478. names.length = dst;
  38479. return names;
  38480. };
  38481. function defaultCreatorFn(object) {
  38482. return create(null);
  38483. }
  38484. function makeAccessor(secretCreatorFn) {
  38485. var brand = makeUniqueKey();
  38486. var passkey = create(null);
  38487. secretCreatorFn = secretCreatorFn || defaultCreatorFn;
  38488. function register(object) {
  38489. var secret; // Created lazily.
  38490. function vault(key, forget) {
  38491. // Only code that has access to the passkey can retrieve (or forget)
  38492. // the secret object.
  38493. if (key === passkey) {
  38494. return forget
  38495. ? secret = null
  38496. : secret || (secret = secretCreatorFn(object));
  38497. }
  38498. }
  38499. defProp(object, brand, vault);
  38500. }
  38501. function accessor(object) {
  38502. if (!hasOwn.call(object, brand))
  38503. register(object);
  38504. return object[brand](passkey);
  38505. }
  38506. accessor.forget = function(object) {
  38507. if (hasOwn.call(object, brand))
  38508. object[brand](passkey, true);
  38509. };
  38510. return accessor;
  38511. }
  38512. exports.makeAccessor = makeAccessor;
  38513. },{}],525:[function(require,module,exports){
  38514. // shim for using process in browser
  38515. var process = module.exports = {};
  38516. // cached from whatever global is present so that test runners that stub it
  38517. // don't break things. But we need to wrap it in a try catch in case it is
  38518. // wrapped in strict mode code which doesn't define any globals. It's inside a
  38519. // function because try/catches deoptimize in certain engines.
  38520. var cachedSetTimeout;
  38521. var cachedClearTimeout;
  38522. function defaultSetTimout() {
  38523. throw new Error('setTimeout has not been defined');
  38524. }
  38525. function defaultClearTimeout () {
  38526. throw new Error('clearTimeout has not been defined');
  38527. }
  38528. (function () {
  38529. try {
  38530. if (typeof setTimeout === 'function') {
  38531. cachedSetTimeout = setTimeout;
  38532. } else {
  38533. cachedSetTimeout = defaultSetTimout;
  38534. }
  38535. } catch (e) {
  38536. cachedSetTimeout = defaultSetTimout;
  38537. }
  38538. try {
  38539. if (typeof clearTimeout === 'function') {
  38540. cachedClearTimeout = clearTimeout;
  38541. } else {
  38542. cachedClearTimeout = defaultClearTimeout;
  38543. }
  38544. } catch (e) {
  38545. cachedClearTimeout = defaultClearTimeout;
  38546. }
  38547. } ())
  38548. function runTimeout(fun) {
  38549. if (cachedSetTimeout === setTimeout) {
  38550. //normal enviroments in sane situations
  38551. return setTimeout(fun, 0);
  38552. }
  38553. // if setTimeout wasn't available but was latter defined
  38554. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  38555. cachedSetTimeout = setTimeout;
  38556. return setTimeout(fun, 0);
  38557. }
  38558. try {
  38559. // when when somebody has screwed with setTimeout but no I.E. maddness
  38560. return cachedSetTimeout(fun, 0);
  38561. } catch(e){
  38562. try {
  38563. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  38564. return cachedSetTimeout.call(null, fun, 0);
  38565. } catch(e){
  38566. // 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
  38567. return cachedSetTimeout.call(this, fun, 0);
  38568. }
  38569. }
  38570. }
  38571. function runClearTimeout(marker) {
  38572. if (cachedClearTimeout === clearTimeout) {
  38573. //normal enviroments in sane situations
  38574. return clearTimeout(marker);
  38575. }
  38576. // if clearTimeout wasn't available but was latter defined
  38577. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  38578. cachedClearTimeout = clearTimeout;
  38579. return clearTimeout(marker);
  38580. }
  38581. try {
  38582. // when when somebody has screwed with setTimeout but no I.E. maddness
  38583. return cachedClearTimeout(marker);
  38584. } catch (e){
  38585. try {
  38586. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  38587. return cachedClearTimeout.call(null, marker);
  38588. } catch (e){
  38589. // 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.
  38590. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  38591. return cachedClearTimeout.call(this, marker);
  38592. }
  38593. }
  38594. }
  38595. var queue = [];
  38596. var draining = false;
  38597. var currentQueue;
  38598. var queueIndex = -1;
  38599. function cleanUpNextTick() {
  38600. if (!draining || !currentQueue) {
  38601. return;
  38602. }
  38603. draining = false;
  38604. if (currentQueue.length) {
  38605. queue = currentQueue.concat(queue);
  38606. } else {
  38607. queueIndex = -1;
  38608. }
  38609. if (queue.length) {
  38610. drainQueue();
  38611. }
  38612. }
  38613. function drainQueue() {
  38614. if (draining) {
  38615. return;
  38616. }
  38617. var timeout = runTimeout(cleanUpNextTick);
  38618. draining = true;
  38619. var len = queue.length;
  38620. while(len) {
  38621. currentQueue = queue;
  38622. queue = [];
  38623. while (++queueIndex < len) {
  38624. if (currentQueue) {
  38625. currentQueue[queueIndex].run();
  38626. }
  38627. }
  38628. queueIndex = -1;
  38629. len = queue.length;
  38630. }
  38631. currentQueue = null;
  38632. draining = false;
  38633. runClearTimeout(timeout);
  38634. }
  38635. process.nextTick = function (fun) {
  38636. var args = new Array(arguments.length - 1);
  38637. if (arguments.length > 1) {
  38638. for (var i = 1; i < arguments.length; i++) {
  38639. args[i - 1] = arguments[i];
  38640. }
  38641. }
  38642. queue.push(new Item(fun, args));
  38643. if (queue.length === 1 && !draining) {
  38644. runTimeout(drainQueue);
  38645. }
  38646. };
  38647. // v8 likes predictible objects
  38648. function Item(fun, array) {
  38649. this.fun = fun;
  38650. this.array = array;
  38651. }
  38652. Item.prototype.run = function () {
  38653. this.fun.apply(null, this.array);
  38654. };
  38655. process.title = 'browser';
  38656. process.browser = true;
  38657. process.env = {};
  38658. process.argv = [];
  38659. process.version = ''; // empty string to avoid regexp issues
  38660. process.versions = {};
  38661. function noop() {}
  38662. process.on = noop;
  38663. process.addListener = noop;
  38664. process.once = noop;
  38665. process.off = noop;
  38666. process.removeListener = noop;
  38667. process.removeAllListeners = noop;
  38668. process.emit = noop;
  38669. process.prependListener = noop;
  38670. process.prependOnceListener = noop;
  38671. process.listeners = function (name) { return [] }
  38672. process.binding = function (name) {
  38673. throw new Error('process.binding is not supported');
  38674. };
  38675. process.cwd = function () { return '/' };
  38676. process.chdir = function (dir) {
  38677. throw new Error('process.chdir is not supported');
  38678. };
  38679. process.umask = function() { return 0; };
  38680. },{}],526:[function(require,module,exports){
  38681. (function (global){
  38682. /*! https://mths.be/regenerate v1.3.3 by @mathias | MIT license */
  38683. ;(function(root) {
  38684. // Detect free variables `exports`.
  38685. var freeExports = typeof exports == 'object' && exports;
  38686. // Detect free variable `module`.
  38687. var freeModule = typeof module == 'object' && module &&
  38688. module.exports == freeExports && module;
  38689. // Detect free variable `global`, from Node.js/io.js or Browserified code,
  38690. // and use it as `root`.
  38691. var freeGlobal = typeof global == 'object' && global;
  38692. if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
  38693. root = freeGlobal;
  38694. }
  38695. /*--------------------------------------------------------------------------*/
  38696. var ERRORS = {
  38697. 'rangeOrder': 'A range\u2019s `stop` value must be greater than or equal ' +
  38698. 'to the `start` value.',
  38699. 'codePointRange': 'Invalid code point value. Code points range from ' +
  38700. 'U+000000 to U+10FFFF.'
  38701. };
  38702. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-pairs
  38703. var HIGH_SURROGATE_MIN = 0xD800;
  38704. var HIGH_SURROGATE_MAX = 0xDBFF;
  38705. var LOW_SURROGATE_MIN = 0xDC00;
  38706. var LOW_SURROGATE_MAX = 0xDFFF;
  38707. // In Regenerate output, `\0` is never preceded by `\` because we sort by
  38708. // code point value, so let’s keep this regular expression simple.
  38709. var regexNull = /\\x00([^0123456789]|$)/g;
  38710. var object = {};
  38711. var hasOwnProperty = object.hasOwnProperty;
  38712. var extend = function(destination, source) {
  38713. var key;
  38714. for (key in source) {
  38715. if (hasOwnProperty.call(source, key)) {
  38716. destination[key] = source[key];
  38717. }
  38718. }
  38719. return destination;
  38720. };
  38721. var forEach = function(array, callback) {
  38722. var index = -1;
  38723. var length = array.length;
  38724. while (++index < length) {
  38725. callback(array[index], index);
  38726. }
  38727. };
  38728. var toString = object.toString;
  38729. var isArray = function(value) {
  38730. return toString.call(value) == '[object Array]';
  38731. };
  38732. var isNumber = function(value) {
  38733. return typeof value == 'number' ||
  38734. toString.call(value) == '[object Number]';
  38735. };
  38736. // This assumes that `number` is a positive integer that `toString()`s nicely
  38737. // (which is the case for all code point values).
  38738. var zeroes = '0000';
  38739. var pad = function(number, totalCharacters) {
  38740. var string = String(number);
  38741. return string.length < totalCharacters
  38742. ? (zeroes + string).slice(-totalCharacters)
  38743. : string;
  38744. };
  38745. var hex = function(number) {
  38746. return Number(number).toString(16).toUpperCase();
  38747. };
  38748. var slice = [].slice;
  38749. /*--------------------------------------------------------------------------*/
  38750. var dataFromCodePoints = function(codePoints) {
  38751. var index = -1;
  38752. var length = codePoints.length;
  38753. var max = length - 1;
  38754. var result = [];
  38755. var isStart = true;
  38756. var tmp;
  38757. var previous = 0;
  38758. while (++index < length) {
  38759. tmp = codePoints[index];
  38760. if (isStart) {
  38761. result.push(tmp);
  38762. previous = tmp;
  38763. isStart = false;
  38764. } else {
  38765. if (tmp == previous + 1) {
  38766. if (index != max) {
  38767. previous = tmp;
  38768. continue;
  38769. } else {
  38770. isStart = true;
  38771. result.push(tmp + 1);
  38772. }
  38773. } else {
  38774. // End the previous range and start a new one.
  38775. result.push(previous + 1, tmp);
  38776. previous = tmp;
  38777. }
  38778. }
  38779. }
  38780. if (!isStart) {
  38781. result.push(tmp + 1);
  38782. }
  38783. return result;
  38784. };
  38785. var dataRemove = function(data, codePoint) {
  38786. // Iterate over the data per `(start, end)` pair.
  38787. var index = 0;
  38788. var start;
  38789. var end;
  38790. var length = data.length;
  38791. while (index < length) {
  38792. start = data[index];
  38793. end = data[index + 1];
  38794. if (codePoint >= start && codePoint < end) {
  38795. // Modify this pair.
  38796. if (codePoint == start) {
  38797. if (end == start + 1) {
  38798. // Just remove `start` and `end`.
  38799. data.splice(index, 2);
  38800. return data;
  38801. } else {
  38802. // Just replace `start` with a new value.
  38803. data[index] = codePoint + 1;
  38804. return data;
  38805. }
  38806. } else if (codePoint == end - 1) {
  38807. // Just replace `end` with a new value.
  38808. data[index + 1] = codePoint;
  38809. return data;
  38810. } else {
  38811. // Replace `[start, end]` with `[startA, endA, startB, endB]`.
  38812. data.splice(index, 2, start, codePoint, codePoint + 1, end);
  38813. return data;
  38814. }
  38815. }
  38816. index += 2;
  38817. }
  38818. return data;
  38819. };
  38820. var dataRemoveRange = function(data, rangeStart, rangeEnd) {
  38821. if (rangeEnd < rangeStart) {
  38822. throw Error(ERRORS.rangeOrder);
  38823. }
  38824. // Iterate over the data per `(start, end)` pair.
  38825. var index = 0;
  38826. var start;
  38827. var end;
  38828. while (index < data.length) {
  38829. start = data[index];
  38830. end = data[index + 1] - 1; // Note: the `- 1` makes `end` inclusive.
  38831. // Exit as soon as no more matching pairs can be found.
  38832. if (start > rangeEnd) {
  38833. return data;
  38834. }
  38835. // Check if this range pair is equal to, or forms a subset of, the range
  38836. // to be removed.
  38837. // E.g. we have `[0, 11, 40, 51]` and want to remove 0-10 → `[40, 51]`.
  38838. // E.g. we have `[40, 51]` and want to remove 0-100 → `[]`.
  38839. if (rangeStart <= start && rangeEnd >= end) {
  38840. // Remove this pair.
  38841. data.splice(index, 2);
  38842. continue;
  38843. }
  38844. // Check if both `rangeStart` and `rangeEnd` are within the bounds of
  38845. // this pair.
  38846. // E.g. we have `[0, 11]` and want to remove 4-6 → `[0, 4, 7, 11]`.
  38847. if (rangeStart >= start && rangeEnd < end) {
  38848. if (rangeStart == start) {
  38849. // Replace `[start, end]` with `[startB, endB]`.
  38850. data[index] = rangeEnd + 1;
  38851. data[index + 1] = end + 1;
  38852. return data;
  38853. }
  38854. // Replace `[start, end]` with `[startA, endA, startB, endB]`.
  38855. data.splice(index, 2, start, rangeStart, rangeEnd + 1, end + 1);
  38856. return data;
  38857. }
  38858. // Check if only `rangeStart` is within the bounds of this pair.
  38859. // E.g. we have `[0, 11]` and want to remove 4-20 → `[0, 4]`.
  38860. if (rangeStart >= start && rangeStart <= end) {
  38861. // Replace `end` with `rangeStart`.
  38862. data[index + 1] = rangeStart;
  38863. // Note: we cannot `return` just yet, in case any following pairs still
  38864. // contain matching code points.
  38865. // E.g. we have `[0, 11, 14, 31]` and want to remove 4-20
  38866. // → `[0, 4, 21, 31]`.
  38867. }
  38868. // Check if only `rangeEnd` is within the bounds of this pair.
  38869. // E.g. we have `[14, 31]` and want to remove 4-20 → `[21, 31]`.
  38870. else if (rangeEnd >= start && rangeEnd <= end) {
  38871. // Just replace `start`.
  38872. data[index] = rangeEnd + 1;
  38873. return data;
  38874. }
  38875. index += 2;
  38876. }
  38877. return data;
  38878. };
  38879. var dataAdd = function(data, codePoint) {
  38880. // Iterate over the data per `(start, end)` pair.
  38881. var index = 0;
  38882. var start;
  38883. var end;
  38884. var lastIndex = null;
  38885. var length = data.length;
  38886. if (codePoint < 0x0 || codePoint > 0x10FFFF) {
  38887. throw RangeError(ERRORS.codePointRange);
  38888. }
  38889. while (index < length) {
  38890. start = data[index];
  38891. end = data[index + 1];
  38892. // Check if the code point is already in the set.
  38893. if (codePoint >= start && codePoint < end) {
  38894. return data;
  38895. }
  38896. if (codePoint == start - 1) {
  38897. // Just replace `start` with a new value.
  38898. data[index] = codePoint;
  38899. return data;
  38900. }
  38901. // At this point, if `start` is `greater` than `codePoint`, insert a new
  38902. // `[start, end]` pair before the current pair, or after the current pair
  38903. // if there is a known `lastIndex`.
  38904. if (start > codePoint) {
  38905. data.splice(
  38906. lastIndex != null ? lastIndex + 2 : 0,
  38907. 0,
  38908. codePoint,
  38909. codePoint + 1
  38910. );
  38911. return data;
  38912. }
  38913. if (codePoint == end) {
  38914. // Check if adding this code point causes two separate ranges to become
  38915. // a single range, e.g. `dataAdd([0, 4, 5, 10], 4)` → `[0, 10]`.
  38916. if (codePoint + 1 == data[index + 2]) {
  38917. data.splice(index, 4, start, data[index + 3]);
  38918. return data;
  38919. }
  38920. // Else, just replace `end` with a new value.
  38921. data[index + 1] = codePoint + 1;
  38922. return data;
  38923. }
  38924. lastIndex = index;
  38925. index += 2;
  38926. }
  38927. // The loop has finished; add the new pair to the end of the data set.
  38928. data.push(codePoint, codePoint + 1);
  38929. return data;
  38930. };
  38931. var dataAddData = function(dataA, dataB) {
  38932. // Iterate over the data per `(start, end)` pair.
  38933. var index = 0;
  38934. var start;
  38935. var end;
  38936. var data = dataA.slice();
  38937. var length = dataB.length;
  38938. while (index < length) {
  38939. start = dataB[index];
  38940. end = dataB[index + 1] - 1;
  38941. if (start == end) {
  38942. data = dataAdd(data, start);
  38943. } else {
  38944. data = dataAddRange(data, start, end);
  38945. }
  38946. index += 2;
  38947. }
  38948. return data;
  38949. };
  38950. var dataRemoveData = function(dataA, dataB) {
  38951. // Iterate over the data per `(start, end)` pair.
  38952. var index = 0;
  38953. var start;
  38954. var end;
  38955. var data = dataA.slice();
  38956. var length = dataB.length;
  38957. while (index < length) {
  38958. start = dataB[index];
  38959. end = dataB[index + 1] - 1;
  38960. if (start == end) {
  38961. data = dataRemove(data, start);
  38962. } else {
  38963. data = dataRemoveRange(data, start, end);
  38964. }
  38965. index += 2;
  38966. }
  38967. return data;
  38968. };
  38969. var dataAddRange = function(data, rangeStart, rangeEnd) {
  38970. if (rangeEnd < rangeStart) {
  38971. throw Error(ERRORS.rangeOrder);
  38972. }
  38973. if (
  38974. rangeStart < 0x0 || rangeStart > 0x10FFFF ||
  38975. rangeEnd < 0x0 || rangeEnd > 0x10FFFF
  38976. ) {
  38977. throw RangeError(ERRORS.codePointRange);
  38978. }
  38979. // Iterate over the data per `(start, end)` pair.
  38980. var index = 0;
  38981. var start;
  38982. var end;
  38983. var added = false;
  38984. var length = data.length;
  38985. while (index < length) {
  38986. start = data[index];
  38987. end = data[index + 1];
  38988. if (added) {
  38989. // The range has already been added to the set; at this point, we just
  38990. // need to get rid of the following ranges in case they overlap.
  38991. // Check if this range can be combined with the previous range.
  38992. if (start == rangeEnd + 1) {
  38993. data.splice(index - 1, 2);
  38994. return data;
  38995. }
  38996. // Exit as soon as no more possibly overlapping pairs can be found.
  38997. if (start > rangeEnd) {
  38998. return data;
  38999. }
  39000. // E.g. `[0, 11, 12, 16]` and we’ve added 5-15, so we now have
  39001. // `[0, 16, 12, 16]`. Remove the `12,16` part, as it lies within the
  39002. // `0,16` range that was previously added.
  39003. if (start >= rangeStart && start <= rangeEnd) {
  39004. // `start` lies within the range that was previously added.
  39005. if (end > rangeStart && end - 1 <= rangeEnd) {
  39006. // `end` lies within the range that was previously added as well,
  39007. // so remove this pair.
  39008. data.splice(index, 2);
  39009. index -= 2;
  39010. // Note: we cannot `return` just yet, as there may still be other
  39011. // overlapping pairs.
  39012. } else {
  39013. // `start` lies within the range that was previously added, but
  39014. // `end` doesn’t. E.g. `[0, 11, 12, 31]` and we’ve added 5-15, so
  39015. // now we have `[0, 16, 12, 31]`. This must be written as `[0, 31]`.
  39016. // Remove the previously added `end` and the current `start`.
  39017. data.splice(index - 1, 2);
  39018. index -= 2;
  39019. }
  39020. // Note: we cannot return yet.
  39021. }
  39022. }
  39023. else if (start == rangeEnd + 1) {
  39024. data[index] = rangeStart;
  39025. return data;
  39026. }
  39027. // Check if a new pair must be inserted *before* the current one.
  39028. else if (start > rangeEnd) {
  39029. data.splice(index, 0, rangeStart, rangeEnd + 1);
  39030. return data;
  39031. }
  39032. else if (rangeStart >= start && rangeStart < end && rangeEnd + 1 <= end) {
  39033. // The new range lies entirely within an existing range pair. No action
  39034. // needed.
  39035. return data;
  39036. }
  39037. else if (
  39038. // E.g. `[0, 11]` and you add 5-15 → `[0, 16]`.
  39039. (rangeStart >= start && rangeStart < end) ||
  39040. // E.g. `[0, 3]` and you add 3-6 → `[0, 7]`.
  39041. end == rangeStart
  39042. ) {
  39043. // Replace `end` with the new value.
  39044. data[index + 1] = rangeEnd + 1;
  39045. // Make sure the next range pair doesn’t overlap, e.g. `[0, 11, 12, 14]`
  39046. // and you add 5-15 → `[0, 16]`, i.e. remove the `12,14` part.
  39047. added = true;
  39048. // Note: we cannot `return` just yet.
  39049. }
  39050. else if (rangeStart <= start && rangeEnd + 1 >= end) {
  39051. // The new range is a superset of the old range.
  39052. data[index] = rangeStart;
  39053. data[index + 1] = rangeEnd + 1;
  39054. added = true;
  39055. }
  39056. index += 2;
  39057. }
  39058. // The loop has finished without doing anything; add the new pair to the end
  39059. // of the data set.
  39060. if (!added) {
  39061. data.push(rangeStart, rangeEnd + 1);
  39062. }
  39063. return data;
  39064. };
  39065. var dataContains = function(data, codePoint) {
  39066. var index = 0;
  39067. var length = data.length;
  39068. // Exit early if `codePoint` is not within `data`’s overall range.
  39069. var start = data[index];
  39070. var end = data[length - 1];
  39071. if (length >= 2) {
  39072. if (codePoint < start || codePoint > end) {
  39073. return false;
  39074. }
  39075. }
  39076. // Iterate over the data per `(start, end)` pair.
  39077. while (index < length) {
  39078. start = data[index];
  39079. end = data[index + 1];
  39080. if (codePoint >= start && codePoint < end) {
  39081. return true;
  39082. }
  39083. index += 2;
  39084. }
  39085. return false;
  39086. };
  39087. var dataIntersection = function(data, codePoints) {
  39088. var index = 0;
  39089. var length = codePoints.length;
  39090. var codePoint;
  39091. var result = [];
  39092. while (index < length) {
  39093. codePoint = codePoints[index];
  39094. if (dataContains(data, codePoint)) {
  39095. result.push(codePoint);
  39096. }
  39097. ++index;
  39098. }
  39099. return dataFromCodePoints(result);
  39100. };
  39101. var dataIsEmpty = function(data) {
  39102. return !data.length;
  39103. };
  39104. var dataIsSingleton = function(data) {
  39105. // Check if the set only represents a single code point.
  39106. return data.length == 2 && data[0] + 1 == data[1];
  39107. };
  39108. var dataToArray = function(data) {
  39109. // Iterate over the data per `(start, end)` pair.
  39110. var index = 0;
  39111. var start;
  39112. var end;
  39113. var result = [];
  39114. var length = data.length;
  39115. while (index < length) {
  39116. start = data[index];
  39117. end = data[index + 1];
  39118. while (start < end) {
  39119. result.push(start);
  39120. ++start;
  39121. }
  39122. index += 2;
  39123. }
  39124. return result;
  39125. };
  39126. /*--------------------------------------------------------------------------*/
  39127. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  39128. var floor = Math.floor;
  39129. var highSurrogate = function(codePoint) {
  39130. return parseInt(
  39131. floor((codePoint - 0x10000) / 0x400) + HIGH_SURROGATE_MIN,
  39132. 10
  39133. );
  39134. };
  39135. var lowSurrogate = function(codePoint) {
  39136. return parseInt(
  39137. (codePoint - 0x10000) % 0x400 + LOW_SURROGATE_MIN,
  39138. 10
  39139. );
  39140. };
  39141. var stringFromCharCode = String.fromCharCode;
  39142. var codePointToString = function(codePoint) {
  39143. var string;
  39144. // https://mathiasbynens.be/notes/javascript-escapes#single
  39145. // Note: the `\b` escape sequence for U+0008 BACKSPACE in strings has a
  39146. // different meaning in regular expressions (word boundary), so it cannot
  39147. // be used here.
  39148. if (codePoint == 0x09) {
  39149. string = '\\t';
  39150. }
  39151. // Note: IE < 9 treats `'\v'` as `'v'`, so avoid using it.
  39152. // else if (codePoint == 0x0B) {
  39153. // string = '\\v';
  39154. // }
  39155. else if (codePoint == 0x0A) {
  39156. string = '\\n';
  39157. }
  39158. else if (codePoint == 0x0C) {
  39159. string = '\\f';
  39160. }
  39161. else if (codePoint == 0x0D) {
  39162. string = '\\r';
  39163. }
  39164. else if (codePoint == 0x5C) {
  39165. string = '\\\\';
  39166. }
  39167. else if (
  39168. codePoint == 0x24 ||
  39169. (codePoint >= 0x28 && codePoint <= 0x2B) ||
  39170. (codePoint >= 0x2D && codePoint <= 0x2F) ||
  39171. codePoint == 0x3F ||
  39172. (codePoint >= 0x5B && codePoint <= 0x5E) ||
  39173. (codePoint >= 0x7B && codePoint <= 0x7D)
  39174. ) {
  39175. // The code point maps to an unsafe printable ASCII character;
  39176. // backslash-escape it. Here’s the list of those symbols:
  39177. //
  39178. // $()*+-./?[\]^{|}
  39179. //
  39180. // See #7 for more info.
  39181. string = '\\' + stringFromCharCode(codePoint);
  39182. }
  39183. else if (codePoint >= 0x20 && codePoint <= 0x7E) {
  39184. // The code point maps to one of these printable ASCII symbols
  39185. // (including the space character):
  39186. //
  39187. // !"#%&',/0123456789:;<=>@ABCDEFGHIJKLMNO
  39188. // PQRSTUVWXYZ_`abcdefghijklmnopqrstuvwxyz~
  39189. //
  39190. // These can safely be used directly.
  39191. string = stringFromCharCode(codePoint);
  39192. }
  39193. else if (codePoint <= 0xFF) {
  39194. // https://mathiasbynens.be/notes/javascript-escapes#hexadecimal
  39195. string = '\\x' + pad(hex(codePoint), 2);
  39196. }
  39197. else { // `codePoint <= 0xFFFF` holds true.
  39198. // https://mathiasbynens.be/notes/javascript-escapes#unicode
  39199. string = '\\u' + pad(hex(codePoint), 4);
  39200. }
  39201. // There’s no need to account for astral symbols / surrogate pairs here,
  39202. // since `codePointToString` is private and only used for BMP code points.
  39203. // But if that’s what you need, just add an `else` block with this code:
  39204. //
  39205. // string = '\\u' + pad(hex(highSurrogate(codePoint)), 4)
  39206. // + '\\u' + pad(hex(lowSurrogate(codePoint)), 4);
  39207. return string;
  39208. };
  39209. var codePointToStringUnicode = function(codePoint) {
  39210. if (codePoint <= 0xFFFF) {
  39211. return codePointToString(codePoint);
  39212. }
  39213. return '\\u{' + codePoint.toString(16).toUpperCase() + '}';
  39214. };
  39215. var symbolToCodePoint = function(symbol) {
  39216. var length = symbol.length;
  39217. var first = symbol.charCodeAt(0);
  39218. var second;
  39219. if (
  39220. first >= HIGH_SURROGATE_MIN && first <= HIGH_SURROGATE_MAX &&
  39221. length > 1 // There is a next code unit.
  39222. ) {
  39223. // `first` is a high surrogate, and there is a next character. Assume
  39224. // it’s a low surrogate (else it’s invalid usage of Regenerate anyway).
  39225. second = symbol.charCodeAt(1);
  39226. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  39227. return (first - HIGH_SURROGATE_MIN) * 0x400 +
  39228. second - LOW_SURROGATE_MIN + 0x10000;
  39229. }
  39230. return first;
  39231. };
  39232. var createBMPCharacterClasses = function(data) {
  39233. // Iterate over the data per `(start, end)` pair.
  39234. var result = '';
  39235. var index = 0;
  39236. var start;
  39237. var end;
  39238. var length = data.length;
  39239. if (dataIsSingleton(data)) {
  39240. return codePointToString(data[0]);
  39241. }
  39242. while (index < length) {
  39243. start = data[index];
  39244. end = data[index + 1] - 1; // Note: the `- 1` makes `end` inclusive.
  39245. if (start == end) {
  39246. result += codePointToString(start);
  39247. } else if (start + 1 == end) {
  39248. result += codePointToString(start) + codePointToString(end);
  39249. } else {
  39250. result += codePointToString(start) + '-' + codePointToString(end);
  39251. }
  39252. index += 2;
  39253. }
  39254. return '[' + result + ']';
  39255. };
  39256. var createUnicodeCharacterClasses = function(data) {
  39257. // Iterate over the data per `(start, end)` pair.
  39258. var result = '';
  39259. var index = 0;
  39260. var start;
  39261. var end;
  39262. var length = data.length;
  39263. if (dataIsSingleton(data)) {
  39264. return codePointToStringUnicode(data[0]);
  39265. }
  39266. while (index < length) {
  39267. start = data[index];
  39268. end = data[index + 1] - 1; // Note: the `- 1` makes `end` inclusive.
  39269. if (start == end) {
  39270. result += codePointToStringUnicode(start);
  39271. } else if (start + 1 == end) {
  39272. result += codePointToStringUnicode(start) + codePointToStringUnicode(end);
  39273. } else {
  39274. result += codePointToStringUnicode(start) + '-' + codePointToStringUnicode(end);
  39275. }
  39276. index += 2;
  39277. }
  39278. return '[' + result + ']';
  39279. };
  39280. var splitAtBMP = function(data) {
  39281. // Iterate over the data per `(start, end)` pair.
  39282. var loneHighSurrogates = [];
  39283. var loneLowSurrogates = [];
  39284. var bmp = [];
  39285. var astral = [];
  39286. var index = 0;
  39287. var start;
  39288. var end;
  39289. var length = data.length;
  39290. while (index < length) {
  39291. start = data[index];
  39292. end = data[index + 1] - 1; // Note: the `- 1` makes `end` inclusive.
  39293. if (start < HIGH_SURROGATE_MIN) {
  39294. // The range starts and ends before the high surrogate range.
  39295. // E.g. (0, 0x10).
  39296. if (end < HIGH_SURROGATE_MIN) {
  39297. bmp.push(start, end + 1);
  39298. }
  39299. // The range starts before the high surrogate range and ends within it.
  39300. // E.g. (0, 0xD855).
  39301. if (end >= HIGH_SURROGATE_MIN && end <= HIGH_SURROGATE_MAX) {
  39302. bmp.push(start, HIGH_SURROGATE_MIN);
  39303. loneHighSurrogates.push(HIGH_SURROGATE_MIN, end + 1);
  39304. }
  39305. // The range starts before the high surrogate range and ends in the low
  39306. // surrogate range. E.g. (0, 0xDCFF).
  39307. if (end >= LOW_SURROGATE_MIN && end <= LOW_SURROGATE_MAX) {
  39308. bmp.push(start, HIGH_SURROGATE_MIN);
  39309. loneHighSurrogates.push(HIGH_SURROGATE_MIN, HIGH_SURROGATE_MAX + 1);
  39310. loneLowSurrogates.push(LOW_SURROGATE_MIN, end + 1);
  39311. }
  39312. // The range starts before the high surrogate range and ends after the
  39313. // low surrogate range. E.g. (0, 0x10FFFF).
  39314. if (end > LOW_SURROGATE_MAX) {
  39315. bmp.push(start, HIGH_SURROGATE_MIN);
  39316. loneHighSurrogates.push(HIGH_SURROGATE_MIN, HIGH_SURROGATE_MAX + 1);
  39317. loneLowSurrogates.push(LOW_SURROGATE_MIN, LOW_SURROGATE_MAX + 1);
  39318. if (end <= 0xFFFF) {
  39319. bmp.push(LOW_SURROGATE_MAX + 1, end + 1);
  39320. } else {
  39321. bmp.push(LOW_SURROGATE_MAX + 1, 0xFFFF + 1);
  39322. astral.push(0xFFFF + 1, end + 1);
  39323. }
  39324. }
  39325. } else if (start >= HIGH_SURROGATE_MIN && start <= HIGH_SURROGATE_MAX) {
  39326. // The range starts and ends in the high surrogate range.
  39327. // E.g. (0xD855, 0xD866).
  39328. if (end >= HIGH_SURROGATE_MIN && end <= HIGH_SURROGATE_MAX) {
  39329. loneHighSurrogates.push(start, end + 1);
  39330. }
  39331. // The range starts in the high surrogate range and ends in the low
  39332. // surrogate range. E.g. (0xD855, 0xDCFF).
  39333. if (end >= LOW_SURROGATE_MIN && end <= LOW_SURROGATE_MAX) {
  39334. loneHighSurrogates.push(start, HIGH_SURROGATE_MAX + 1);
  39335. loneLowSurrogates.push(LOW_SURROGATE_MIN, end + 1);
  39336. }
  39337. // The range starts in the high surrogate range and ends after the low
  39338. // surrogate range. E.g. (0xD855, 0x10FFFF).
  39339. if (end > LOW_SURROGATE_MAX) {
  39340. loneHighSurrogates.push(start, HIGH_SURROGATE_MAX + 1);
  39341. loneLowSurrogates.push(LOW_SURROGATE_MIN, LOW_SURROGATE_MAX + 1);
  39342. if (end <= 0xFFFF) {
  39343. bmp.push(LOW_SURROGATE_MAX + 1, end + 1);
  39344. } else {
  39345. bmp.push(LOW_SURROGATE_MAX + 1, 0xFFFF + 1);
  39346. astral.push(0xFFFF + 1, end + 1);
  39347. }
  39348. }
  39349. } else if (start >= LOW_SURROGATE_MIN && start <= LOW_SURROGATE_MAX) {
  39350. // The range starts and ends in the low surrogate range.
  39351. // E.g. (0xDCFF, 0xDDFF).
  39352. if (end >= LOW_SURROGATE_MIN && end <= LOW_SURROGATE_MAX) {
  39353. loneLowSurrogates.push(start, end + 1);
  39354. }
  39355. // The range starts in the low surrogate range and ends after the low
  39356. // surrogate range. E.g. (0xDCFF, 0x10FFFF).
  39357. if (end > LOW_SURROGATE_MAX) {
  39358. loneLowSurrogates.push(start, LOW_SURROGATE_MAX + 1);
  39359. if (end <= 0xFFFF) {
  39360. bmp.push(LOW_SURROGATE_MAX + 1, end + 1);
  39361. } else {
  39362. bmp.push(LOW_SURROGATE_MAX + 1, 0xFFFF + 1);
  39363. astral.push(0xFFFF + 1, end + 1);
  39364. }
  39365. }
  39366. } else if (start > LOW_SURROGATE_MAX && start <= 0xFFFF) {
  39367. // The range starts and ends after the low surrogate range.
  39368. // E.g. (0xFFAA, 0x10FFFF).
  39369. if (end <= 0xFFFF) {
  39370. bmp.push(start, end + 1);
  39371. } else {
  39372. bmp.push(start, 0xFFFF + 1);
  39373. astral.push(0xFFFF + 1, end + 1);
  39374. }
  39375. } else {
  39376. // The range starts and ends in the astral range.
  39377. astral.push(start, end + 1);
  39378. }
  39379. index += 2;
  39380. }
  39381. return {
  39382. 'loneHighSurrogates': loneHighSurrogates,
  39383. 'loneLowSurrogates': loneLowSurrogates,
  39384. 'bmp': bmp,
  39385. 'astral': astral
  39386. };
  39387. };
  39388. var optimizeSurrogateMappings = function(surrogateMappings) {
  39389. var result = [];
  39390. var tmpLow = [];
  39391. var addLow = false;
  39392. var mapping;
  39393. var nextMapping;
  39394. var highSurrogates;
  39395. var lowSurrogates;
  39396. var nextHighSurrogates;
  39397. var nextLowSurrogates;
  39398. var index = -1;
  39399. var length = surrogateMappings.length;
  39400. while (++index < length) {
  39401. mapping = surrogateMappings[index];
  39402. nextMapping = surrogateMappings[index + 1];
  39403. if (!nextMapping) {
  39404. result.push(mapping);
  39405. continue;
  39406. }
  39407. highSurrogates = mapping[0];
  39408. lowSurrogates = mapping[1];
  39409. nextHighSurrogates = nextMapping[0];
  39410. nextLowSurrogates = nextMapping[1];
  39411. // Check for identical high surrogate ranges.
  39412. tmpLow = lowSurrogates;
  39413. while (
  39414. nextHighSurrogates &&
  39415. highSurrogates[0] == nextHighSurrogates[0] &&
  39416. highSurrogates[1] == nextHighSurrogates[1]
  39417. ) {
  39418. // Merge with the next item.
  39419. if (dataIsSingleton(nextLowSurrogates)) {
  39420. tmpLow = dataAdd(tmpLow, nextLowSurrogates[0]);
  39421. } else {
  39422. tmpLow = dataAddRange(
  39423. tmpLow,
  39424. nextLowSurrogates[0],
  39425. nextLowSurrogates[1] - 1
  39426. );
  39427. }
  39428. ++index;
  39429. mapping = surrogateMappings[index];
  39430. highSurrogates = mapping[0];
  39431. lowSurrogates = mapping[1];
  39432. nextMapping = surrogateMappings[index + 1];
  39433. nextHighSurrogates = nextMapping && nextMapping[0];
  39434. nextLowSurrogates = nextMapping && nextMapping[1];
  39435. addLow = true;
  39436. }
  39437. result.push([
  39438. highSurrogates,
  39439. addLow ? tmpLow : lowSurrogates
  39440. ]);
  39441. addLow = false;
  39442. }
  39443. return optimizeByLowSurrogates(result);
  39444. };
  39445. var optimizeByLowSurrogates = function(surrogateMappings) {
  39446. if (surrogateMappings.length == 1) {
  39447. return surrogateMappings;
  39448. }
  39449. var index = -1;
  39450. var innerIndex = -1;
  39451. while (++index < surrogateMappings.length) {
  39452. var mapping = surrogateMappings[index];
  39453. var lowSurrogates = mapping[1];
  39454. var lowSurrogateStart = lowSurrogates[0];
  39455. var lowSurrogateEnd = lowSurrogates[1];
  39456. innerIndex = index; // Note: the loop starts at the next index.
  39457. while (++innerIndex < surrogateMappings.length) {
  39458. var otherMapping = surrogateMappings[innerIndex];
  39459. var otherLowSurrogates = otherMapping[1];
  39460. var otherLowSurrogateStart = otherLowSurrogates[0];
  39461. var otherLowSurrogateEnd = otherLowSurrogates[1];
  39462. if (
  39463. lowSurrogateStart == otherLowSurrogateStart &&
  39464. lowSurrogateEnd == otherLowSurrogateEnd
  39465. ) {
  39466. // Add the code points in the other item to this one.
  39467. if (dataIsSingleton(otherMapping[0])) {
  39468. mapping[0] = dataAdd(mapping[0], otherMapping[0][0]);
  39469. } else {
  39470. mapping[0] = dataAddRange(
  39471. mapping[0],
  39472. otherMapping[0][0],
  39473. otherMapping[0][1] - 1
  39474. );
  39475. }
  39476. // Remove the other, now redundant, item.
  39477. surrogateMappings.splice(innerIndex, 1);
  39478. --innerIndex;
  39479. }
  39480. }
  39481. }
  39482. return surrogateMappings;
  39483. };
  39484. var surrogateSet = function(data) {
  39485. // Exit early if `data` is an empty set.
  39486. if (!data.length) {
  39487. return [];
  39488. }
  39489. // Iterate over the data per `(start, end)` pair.
  39490. var index = 0;
  39491. var start;
  39492. var end;
  39493. var startHigh;
  39494. var startLow;
  39495. var endHigh;
  39496. var endLow;
  39497. var surrogateMappings = [];
  39498. var length = data.length;
  39499. while (index < length) {
  39500. start = data[index];
  39501. end = data[index + 1] - 1;
  39502. startHigh = highSurrogate(start);
  39503. startLow = lowSurrogate(start);
  39504. endHigh = highSurrogate(end);
  39505. endLow = lowSurrogate(end);
  39506. var startsWithLowestLowSurrogate = startLow == LOW_SURROGATE_MIN;
  39507. var endsWithHighestLowSurrogate = endLow == LOW_SURROGATE_MAX;
  39508. var complete = false;
  39509. // Append the previous high-surrogate-to-low-surrogate mappings.
  39510. // Step 1: `(startHigh, startLow)` to `(startHigh, LOW_SURROGATE_MAX)`.
  39511. if (
  39512. startHigh == endHigh ||
  39513. startsWithLowestLowSurrogate && endsWithHighestLowSurrogate
  39514. ) {
  39515. surrogateMappings.push([
  39516. [startHigh, endHigh + 1],
  39517. [startLow, endLow + 1]
  39518. ]);
  39519. complete = true;
  39520. } else {
  39521. surrogateMappings.push([
  39522. [startHigh, startHigh + 1],
  39523. [startLow, LOW_SURROGATE_MAX + 1]
  39524. ]);
  39525. }
  39526. // Step 2: `(startHigh + 1, LOW_SURROGATE_MIN)` to
  39527. // `(endHigh - 1, LOW_SURROGATE_MAX)`.
  39528. if (!complete && startHigh + 1 < endHigh) {
  39529. if (endsWithHighestLowSurrogate) {
  39530. // Combine step 2 and step 3.
  39531. surrogateMappings.push([
  39532. [startHigh + 1, endHigh + 1],
  39533. [LOW_SURROGATE_MIN, endLow + 1]
  39534. ]);
  39535. complete = true;
  39536. } else {
  39537. surrogateMappings.push([
  39538. [startHigh + 1, endHigh],
  39539. [LOW_SURROGATE_MIN, LOW_SURROGATE_MAX + 1]
  39540. ]);
  39541. }
  39542. }
  39543. // Step 3. `(endHigh, LOW_SURROGATE_MIN)` to `(endHigh, endLow)`.
  39544. if (!complete) {
  39545. surrogateMappings.push([
  39546. [endHigh, endHigh + 1],
  39547. [LOW_SURROGATE_MIN, endLow + 1]
  39548. ]);
  39549. }
  39550. index += 2;
  39551. }
  39552. // The format of `surrogateMappings` is as follows:
  39553. //
  39554. // [ surrogateMapping1, surrogateMapping2 ]
  39555. //
  39556. // i.e.:
  39557. //
  39558. // [
  39559. // [ highSurrogates1, lowSurrogates1 ],
  39560. // [ highSurrogates2, lowSurrogates2 ]
  39561. // ]
  39562. return optimizeSurrogateMappings(surrogateMappings);
  39563. };
  39564. var createSurrogateCharacterClasses = function(surrogateMappings) {
  39565. var result = [];
  39566. forEach(surrogateMappings, function(surrogateMapping) {
  39567. var highSurrogates = surrogateMapping[0];
  39568. var lowSurrogates = surrogateMapping[1];
  39569. result.push(
  39570. createBMPCharacterClasses(highSurrogates) +
  39571. createBMPCharacterClasses(lowSurrogates)
  39572. );
  39573. });
  39574. return result.join('|');
  39575. };
  39576. var createCharacterClassesFromData = function(data, bmpOnly, hasUnicodeFlag) {
  39577. if (hasUnicodeFlag) {
  39578. return createUnicodeCharacterClasses(data);
  39579. }
  39580. var result = [];
  39581. var parts = splitAtBMP(data);
  39582. var loneHighSurrogates = parts.loneHighSurrogates;
  39583. var loneLowSurrogates = parts.loneLowSurrogates;
  39584. var bmp = parts.bmp;
  39585. var astral = parts.astral;
  39586. var hasLoneHighSurrogates = !dataIsEmpty(loneHighSurrogates);
  39587. var hasLoneLowSurrogates = !dataIsEmpty(loneLowSurrogates);
  39588. var surrogateMappings = surrogateSet(astral);
  39589. if (bmpOnly) {
  39590. bmp = dataAddData(bmp, loneHighSurrogates);
  39591. hasLoneHighSurrogates = false;
  39592. bmp = dataAddData(bmp, loneLowSurrogates);
  39593. hasLoneLowSurrogates = false;
  39594. }
  39595. if (!dataIsEmpty(bmp)) {
  39596. // The data set contains BMP code points that are not high surrogates
  39597. // needed for astral code points in the set.
  39598. result.push(createBMPCharacterClasses(bmp));
  39599. }
  39600. if (surrogateMappings.length) {
  39601. // The data set contains astral code points; append character classes
  39602. // based on their surrogate pairs.
  39603. result.push(createSurrogateCharacterClasses(surrogateMappings));
  39604. }
  39605. // https://gist.github.com/mathiasbynens/bbe7f870208abcfec860
  39606. if (hasLoneHighSurrogates) {
  39607. result.push(
  39608. createBMPCharacterClasses(loneHighSurrogates) +
  39609. // Make sure the high surrogates aren’t part of a surrogate pair.
  39610. '(?![\\uDC00-\\uDFFF])'
  39611. );
  39612. }
  39613. if (hasLoneLowSurrogates) {
  39614. result.push(
  39615. // It is not possible to accurately assert the low surrogates aren’t
  39616. // part of a surrogate pair, since JavaScript regular expressions do
  39617. // not support lookbehind.
  39618. '(?:[^\\uD800-\\uDBFF]|^)' +
  39619. createBMPCharacterClasses(loneLowSurrogates)
  39620. );
  39621. }
  39622. return result.join('|');
  39623. };
  39624. /*--------------------------------------------------------------------------*/
  39625. // `regenerate` can be used as a constructor (and new methods can be added to
  39626. // its prototype) but also as a regular function, the latter of which is the
  39627. // documented and most common usage. For that reason, it’s not capitalized.
  39628. var regenerate = function(value) {
  39629. if (arguments.length > 1) {
  39630. value = slice.call(arguments);
  39631. }
  39632. if (this instanceof regenerate) {
  39633. this.data = [];
  39634. return value ? this.add(value) : this;
  39635. }
  39636. return (new regenerate).add(value);
  39637. };
  39638. regenerate.version = '1.3.3';
  39639. var proto = regenerate.prototype;
  39640. extend(proto, {
  39641. 'add': function(value) {
  39642. var $this = this;
  39643. if (value == null) {
  39644. return $this;
  39645. }
  39646. if (value instanceof regenerate) {
  39647. // Allow passing other Regenerate instances.
  39648. $this.data = dataAddData($this.data, value.data);
  39649. return $this;
  39650. }
  39651. if (arguments.length > 1) {
  39652. value = slice.call(arguments);
  39653. }
  39654. if (isArray(value)) {
  39655. forEach(value, function(item) {
  39656. $this.add(item);
  39657. });
  39658. return $this;
  39659. }
  39660. $this.data = dataAdd(
  39661. $this.data,
  39662. isNumber(value) ? value : symbolToCodePoint(value)
  39663. );
  39664. return $this;
  39665. },
  39666. 'remove': function(value) {
  39667. var $this = this;
  39668. if (value == null) {
  39669. return $this;
  39670. }
  39671. if (value instanceof regenerate) {
  39672. // Allow passing other Regenerate instances.
  39673. $this.data = dataRemoveData($this.data, value.data);
  39674. return $this;
  39675. }
  39676. if (arguments.length > 1) {
  39677. value = slice.call(arguments);
  39678. }
  39679. if (isArray(value)) {
  39680. forEach(value, function(item) {
  39681. $this.remove(item);
  39682. });
  39683. return $this;
  39684. }
  39685. $this.data = dataRemove(
  39686. $this.data,
  39687. isNumber(value) ? value : symbolToCodePoint(value)
  39688. );
  39689. return $this;
  39690. },
  39691. 'addRange': function(start, end) {
  39692. var $this = this;
  39693. $this.data = dataAddRange($this.data,
  39694. isNumber(start) ? start : symbolToCodePoint(start),
  39695. isNumber(end) ? end : symbolToCodePoint(end)
  39696. );
  39697. return $this;
  39698. },
  39699. 'removeRange': function(start, end) {
  39700. var $this = this;
  39701. var startCodePoint = isNumber(start) ? start : symbolToCodePoint(start);
  39702. var endCodePoint = isNumber(end) ? end : symbolToCodePoint(end);
  39703. $this.data = dataRemoveRange(
  39704. $this.data,
  39705. startCodePoint,
  39706. endCodePoint
  39707. );
  39708. return $this;
  39709. },
  39710. 'intersection': function(argument) {
  39711. var $this = this;
  39712. // Allow passing other Regenerate instances.
  39713. // TODO: Optimize this by writing and using `dataIntersectionData()`.
  39714. var array = argument instanceof regenerate ?
  39715. dataToArray(argument.data) :
  39716. argument;
  39717. $this.data = dataIntersection($this.data, array);
  39718. return $this;
  39719. },
  39720. 'contains': function(codePoint) {
  39721. return dataContains(
  39722. this.data,
  39723. isNumber(codePoint) ? codePoint : symbolToCodePoint(codePoint)
  39724. );
  39725. },
  39726. 'clone': function() {
  39727. var set = new regenerate;
  39728. set.data = this.data.slice(0);
  39729. return set;
  39730. },
  39731. 'toString': function(options) {
  39732. var result = createCharacterClassesFromData(
  39733. this.data,
  39734. options ? options.bmpOnly : false,
  39735. options ? options.hasUnicodeFlag : false
  39736. );
  39737. if (!result) {
  39738. // For an empty set, return something that can be inserted `/here/` to
  39739. // form a valid regular expression. Avoid `(?:)` since that matches the
  39740. // empty string.
  39741. return '[]';
  39742. }
  39743. // Use `\0` instead of `\x00` where possible.
  39744. return result.replace(regexNull, '\\0$1');
  39745. },
  39746. 'toRegExp': function(flags) {
  39747. var pattern = this.toString(
  39748. flags && flags.indexOf('u') != -1 ?
  39749. { 'hasUnicodeFlag': true } :
  39750. null
  39751. );
  39752. return RegExp(pattern, flags || '');
  39753. },
  39754. 'valueOf': function() { // Note: `valueOf` is aliased as `toArray`.
  39755. return dataToArray(this.data);
  39756. }
  39757. });
  39758. proto.toArray = proto.valueOf;
  39759. // Some AMD build optimizers, like r.js, check for specific condition patterns
  39760. // like the following:
  39761. if (
  39762. typeof define == 'function' &&
  39763. typeof define.amd == 'object' &&
  39764. define.amd
  39765. ) {
  39766. define(function() {
  39767. return regenerate;
  39768. });
  39769. } else if (freeExports && !freeExports.nodeType) {
  39770. if (freeModule) { // in Node.js, io.js, or RingoJS v0.8.0+
  39771. freeModule.exports = regenerate;
  39772. } else { // in Narwhal or RingoJS v0.7.0-
  39773. freeExports.regenerate = regenerate;
  39774. }
  39775. } else { // in Rhino or a web browser
  39776. root.regenerate = regenerate;
  39777. }
  39778. }(this));
  39779. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  39780. },{}],527:[function(require,module,exports){
  39781. "use strict";
  39782. var _stringify = require("babel-runtime/core-js/json/stringify");
  39783. var _stringify2 = _interopRequireDefault(_stringify);
  39784. var _assert = require("assert");
  39785. var _assert2 = _interopRequireDefault(_assert);
  39786. var _babelTypes = require("babel-types");
  39787. var t = _interopRequireWildcard(_babelTypes);
  39788. var _leap = require("./leap");
  39789. var leap = _interopRequireWildcard(_leap);
  39790. var _meta = require("./meta");
  39791. var meta = _interopRequireWildcard(_meta);
  39792. var _util = require("./util");
  39793. var util = _interopRequireWildcard(_util);
  39794. 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; } }
  39795. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  39796. var hasOwn = Object.prototype.hasOwnProperty; /**
  39797. * Copyright (c) 2014, Facebook, Inc.
  39798. * All rights reserved.
  39799. *
  39800. * This source code is licensed under the BSD-style license found in the
  39801. * https://raw.github.com/facebook/regenerator/master/LICENSE file. An
  39802. * additional grant of patent rights can be found in the PATENTS file in
  39803. * the same directory.
  39804. */
  39805. function Emitter(contextId) {
  39806. _assert2.default.ok(this instanceof Emitter);
  39807. t.assertIdentifier(contextId);
  39808. // Used to generate unique temporary names.
  39809. this.nextTempId = 0;
  39810. // In order to make sure the context object does not collide with
  39811. // anything in the local scope, we might have to rename it, so we
  39812. // refer to it symbolically instead of just assuming that it will be
  39813. // called "context".
  39814. this.contextId = contextId;
  39815. // An append-only list of Statements that grows each time this.emit is
  39816. // called.
  39817. this.listing = [];
  39818. // A sparse array whose keys correspond to locations in this.listing
  39819. // that have been marked as branch/jump targets.
  39820. this.marked = [true];
  39821. // The last location will be marked when this.getDispatchLoop is
  39822. // called.
  39823. this.finalLoc = loc();
  39824. // A list of all leap.TryEntry statements emitted.
  39825. this.tryEntries = [];
  39826. // Each time we evaluate the body of a loop, we tell this.leapManager
  39827. // to enter a nested loop context that determines the meaning of break
  39828. // and continue statements therein.
  39829. this.leapManager = new leap.LeapManager(this);
  39830. }
  39831. var Ep = Emitter.prototype;
  39832. exports.Emitter = Emitter;
  39833. // Offsets into this.listing that could be used as targets for branches or
  39834. // jumps are represented as numeric Literal nodes. This representation has
  39835. // the amazingly convenient benefit of allowing the exact value of the
  39836. // location to be determined at any time, even after generating code that
  39837. // refers to the location.
  39838. function loc() {
  39839. return t.numericLiteral(-1);
  39840. }
  39841. // Sets the exact value of the given location to the offset of the next
  39842. // Statement emitted.
  39843. Ep.mark = function (loc) {
  39844. t.assertLiteral(loc);
  39845. var index = this.listing.length;
  39846. if (loc.value === -1) {
  39847. loc.value = index;
  39848. } else {
  39849. // Locations can be marked redundantly, but their values cannot change
  39850. // once set the first time.
  39851. _assert2.default.strictEqual(loc.value, index);
  39852. }
  39853. this.marked[index] = true;
  39854. return loc;
  39855. };
  39856. Ep.emit = function (node) {
  39857. if (t.isExpression(node)) {
  39858. node = t.expressionStatement(node);
  39859. }
  39860. t.assertStatement(node);
  39861. this.listing.push(node);
  39862. };
  39863. // Shorthand for emitting assignment statements. This will come in handy
  39864. // for assignments to temporary variables.
  39865. Ep.emitAssign = function (lhs, rhs) {
  39866. this.emit(this.assign(lhs, rhs));
  39867. return lhs;
  39868. };
  39869. // Shorthand for an assignment statement.
  39870. Ep.assign = function (lhs, rhs) {
  39871. return t.expressionStatement(t.assignmentExpression("=", lhs, rhs));
  39872. };
  39873. // Convenience function for generating expressions like context.next,
  39874. // context.sent, and context.rval.
  39875. Ep.contextProperty = function (name, computed) {
  39876. return t.memberExpression(this.contextId, computed ? t.stringLiteral(name) : t.identifier(name), !!computed);
  39877. };
  39878. // Shorthand for setting context.rval and jumping to `context.stop()`.
  39879. Ep.stop = function (rval) {
  39880. if (rval) {
  39881. this.setReturnValue(rval);
  39882. }
  39883. this.jump(this.finalLoc);
  39884. };
  39885. Ep.setReturnValue = function (valuePath) {
  39886. t.assertExpression(valuePath.value);
  39887. this.emitAssign(this.contextProperty("rval"), this.explodeExpression(valuePath));
  39888. };
  39889. Ep.clearPendingException = function (tryLoc, assignee) {
  39890. t.assertLiteral(tryLoc);
  39891. var catchCall = t.callExpression(this.contextProperty("catch", true), [tryLoc]);
  39892. if (assignee) {
  39893. this.emitAssign(assignee, catchCall);
  39894. } else {
  39895. this.emit(catchCall);
  39896. }
  39897. };
  39898. // Emits code for an unconditional jump to the given location, even if the
  39899. // exact value of the location is not yet known.
  39900. Ep.jump = function (toLoc) {
  39901. this.emitAssign(this.contextProperty("next"), toLoc);
  39902. this.emit(t.breakStatement());
  39903. };
  39904. // Conditional jump.
  39905. Ep.jumpIf = function (test, toLoc) {
  39906. t.assertExpression(test);
  39907. t.assertLiteral(toLoc);
  39908. this.emit(t.ifStatement(test, t.blockStatement([this.assign(this.contextProperty("next"), toLoc), t.breakStatement()])));
  39909. };
  39910. // Conditional jump, with the condition negated.
  39911. Ep.jumpIfNot = function (test, toLoc) {
  39912. t.assertExpression(test);
  39913. t.assertLiteral(toLoc);
  39914. var negatedTest = void 0;
  39915. if (t.isUnaryExpression(test) && test.operator === "!") {
  39916. // Avoid double negation.
  39917. negatedTest = test.argument;
  39918. } else {
  39919. negatedTest = t.unaryExpression("!", test);
  39920. }
  39921. this.emit(t.ifStatement(negatedTest, t.blockStatement([this.assign(this.contextProperty("next"), toLoc), t.breakStatement()])));
  39922. };
  39923. // Returns a unique MemberExpression that can be used to store and
  39924. // retrieve temporary values. Since the object of the member expression is
  39925. // the context object, which is presumed to coexist peacefully with all
  39926. // other local variables, and since we just increment `nextTempId`
  39927. // monotonically, uniqueness is assured.
  39928. Ep.makeTempVar = function () {
  39929. return this.contextProperty("t" + this.nextTempId++);
  39930. };
  39931. Ep.getContextFunction = function (id) {
  39932. return t.functionExpression(id || null /*Anonymous*/
  39933. , [this.contextId], t.blockStatement([this.getDispatchLoop()]), false, // Not a generator anymore!
  39934. false // Nor an expression.
  39935. );
  39936. };
  39937. // Turns this.listing into a loop of the form
  39938. //
  39939. // while (1) switch (context.next) {
  39940. // case 0:
  39941. // ...
  39942. // case n:
  39943. // return context.stop();
  39944. // }
  39945. //
  39946. // Each marked location in this.listing will correspond to one generated
  39947. // case statement.
  39948. Ep.getDispatchLoop = function () {
  39949. var self = this;
  39950. var cases = [];
  39951. var current = void 0;
  39952. // If we encounter a break, continue, or return statement in a switch
  39953. // case, we can skip the rest of the statements until the next case.
  39954. var alreadyEnded = false;
  39955. self.listing.forEach(function (stmt, i) {
  39956. if (self.marked.hasOwnProperty(i)) {
  39957. cases.push(t.switchCase(t.numericLiteral(i), current = []));
  39958. alreadyEnded = false;
  39959. }
  39960. if (!alreadyEnded) {
  39961. current.push(stmt);
  39962. if (t.isCompletionStatement(stmt)) alreadyEnded = true;
  39963. }
  39964. });
  39965. // Now that we know how many statements there will be in this.listing,
  39966. // we can finally resolve this.finalLoc.value.
  39967. this.finalLoc.value = this.listing.length;
  39968. cases.push(t.switchCase(this.finalLoc, [
  39969. // Intentionally fall through to the "end" case...
  39970. ]),
  39971. // So that the runtime can jump to the final location without having
  39972. // to know its offset, we provide the "end" case as a synonym.
  39973. t.switchCase(t.stringLiteral("end"), [
  39974. // This will check/clear both context.thrown and context.rval.
  39975. t.returnStatement(t.callExpression(this.contextProperty("stop"), []))]));
  39976. return t.whileStatement(t.numericLiteral(1), t.switchStatement(t.assignmentExpression("=", this.contextProperty("prev"), this.contextProperty("next")), cases));
  39977. };
  39978. Ep.getTryLocsList = function () {
  39979. if (this.tryEntries.length === 0) {
  39980. // To avoid adding a needless [] to the majority of runtime.wrap
  39981. // argument lists, force the caller to handle this case specially.
  39982. return null;
  39983. }
  39984. var lastLocValue = 0;
  39985. return t.arrayExpression(this.tryEntries.map(function (tryEntry) {
  39986. var thisLocValue = tryEntry.firstLoc.value;
  39987. _assert2.default.ok(thisLocValue >= lastLocValue, "try entries out of order");
  39988. lastLocValue = thisLocValue;
  39989. var ce = tryEntry.catchEntry;
  39990. var fe = tryEntry.finallyEntry;
  39991. var locs = [tryEntry.firstLoc,
  39992. // The null here makes a hole in the array.
  39993. ce ? ce.firstLoc : null];
  39994. if (fe) {
  39995. locs[2] = fe.firstLoc;
  39996. locs[3] = fe.afterLoc;
  39997. }
  39998. return t.arrayExpression(locs);
  39999. }));
  40000. };
  40001. // All side effects must be realized in order.
  40002. // If any subexpression harbors a leap, all subexpressions must be
  40003. // neutered of side effects.
  40004. // No destructive modification of AST nodes.
  40005. Ep.explode = function (path, ignoreResult) {
  40006. var node = path.node;
  40007. var self = this;
  40008. t.assertNode(node);
  40009. if (t.isDeclaration(node)) throw getDeclError(node);
  40010. if (t.isStatement(node)) return self.explodeStatement(path);
  40011. if (t.isExpression(node)) return self.explodeExpression(path, ignoreResult);
  40012. switch (node.type) {
  40013. case "Program":
  40014. return path.get("body").map(self.explodeStatement, self);
  40015. case "VariableDeclarator":
  40016. throw getDeclError(node);
  40017. // These node types should be handled by their parent nodes
  40018. // (ObjectExpression, SwitchStatement, and TryStatement, respectively).
  40019. case "Property":
  40020. case "SwitchCase":
  40021. case "CatchClause":
  40022. throw new Error(node.type + " nodes should be handled by their parents");
  40023. default:
  40024. throw new Error("unknown Node of type " + (0, _stringify2.default)(node.type));
  40025. }
  40026. };
  40027. function getDeclError(node) {
  40028. return new Error("all declarations should have been transformed into " + "assignments before the Exploder began its work: " + (0, _stringify2.default)(node));
  40029. }
  40030. Ep.explodeStatement = function (path, labelId) {
  40031. var stmt = path.node;
  40032. var self = this;
  40033. var before = void 0,
  40034. after = void 0,
  40035. head = void 0;
  40036. t.assertStatement(stmt);
  40037. if (labelId) {
  40038. t.assertIdentifier(labelId);
  40039. } else {
  40040. labelId = null;
  40041. }
  40042. // Explode BlockStatement nodes even if they do not contain a yield,
  40043. // because we don't want or need the curly braces.
  40044. if (t.isBlockStatement(stmt)) {
  40045. path.get("body").forEach(function (path) {
  40046. self.explodeStatement(path);
  40047. });
  40048. return;
  40049. }
  40050. if (!meta.containsLeap(stmt)) {
  40051. // Technically we should be able to avoid emitting the statement
  40052. // altogether if !meta.hasSideEffects(stmt), but that leads to
  40053. // confusing generated code (for instance, `while (true) {}` just
  40054. // disappears) and is probably a more appropriate job for a dedicated
  40055. // dead code elimination pass.
  40056. self.emit(stmt);
  40057. return;
  40058. }
  40059. switch (stmt.type) {
  40060. case "ExpressionStatement":
  40061. self.explodeExpression(path.get("expression"), true);
  40062. break;
  40063. case "LabeledStatement":
  40064. after = loc();
  40065. // Did you know you can break from any labeled block statement or
  40066. // control structure? Well, you can! Note: when a labeled loop is
  40067. // encountered, the leap.LabeledEntry created here will immediately
  40068. // enclose a leap.LoopEntry on the leap manager's stack, and both
  40069. // entries will have the same label. Though this works just fine, it
  40070. // may seem a bit redundant. In theory, we could check here to
  40071. // determine if stmt knows how to handle its own label; for example,
  40072. // stmt happens to be a WhileStatement and so we know it's going to
  40073. // establish its own LoopEntry when we explode it (below). Then this
  40074. // LabeledEntry would be unnecessary. Alternatively, we might be
  40075. // tempted not to pass stmt.label down into self.explodeStatement,
  40076. // because we've handled the label here, but that's a mistake because
  40077. // labeled loops may contain labeled continue statements, which is not
  40078. // something we can handle in this generic case. All in all, I think a
  40079. // little redundancy greatly simplifies the logic of this case, since
  40080. // it's clear that we handle all possible LabeledStatements correctly
  40081. // here, regardless of whether they interact with the leap manager
  40082. // themselves. Also remember that labels and break/continue-to-label
  40083. // statements are rare, and all of this logic happens at transform
  40084. // time, so it has no additional runtime cost.
  40085. self.leapManager.withEntry(new leap.LabeledEntry(after, stmt.label), function () {
  40086. self.explodeStatement(path.get("body"), stmt.label);
  40087. });
  40088. self.mark(after);
  40089. break;
  40090. case "WhileStatement":
  40091. before = loc();
  40092. after = loc();
  40093. self.mark(before);
  40094. self.jumpIfNot(self.explodeExpression(path.get("test")), after);
  40095. self.leapManager.withEntry(new leap.LoopEntry(after, before, labelId), function () {
  40096. self.explodeStatement(path.get("body"));
  40097. });
  40098. self.jump(before);
  40099. self.mark(after);
  40100. break;
  40101. case "DoWhileStatement":
  40102. var first = loc();
  40103. var test = loc();
  40104. after = loc();
  40105. self.mark(first);
  40106. self.leapManager.withEntry(new leap.LoopEntry(after, test, labelId), function () {
  40107. self.explode(path.get("body"));
  40108. });
  40109. self.mark(test);
  40110. self.jumpIf(self.explodeExpression(path.get("test")), first);
  40111. self.mark(after);
  40112. break;
  40113. case "ForStatement":
  40114. head = loc();
  40115. var update = loc();
  40116. after = loc();
  40117. if (stmt.init) {
  40118. // We pass true here to indicate that if stmt.init is an expression
  40119. // then we do not care about its result.
  40120. self.explode(path.get("init"), true);
  40121. }
  40122. self.mark(head);
  40123. if (stmt.test) {
  40124. self.jumpIfNot(self.explodeExpression(path.get("test")), after);
  40125. } else {
  40126. // No test means continue unconditionally.
  40127. }
  40128. self.leapManager.withEntry(new leap.LoopEntry(after, update, labelId), function () {
  40129. self.explodeStatement(path.get("body"));
  40130. });
  40131. self.mark(update);
  40132. if (stmt.update) {
  40133. // We pass true here to indicate that if stmt.update is an
  40134. // expression then we do not care about its result.
  40135. self.explode(path.get("update"), true);
  40136. }
  40137. self.jump(head);
  40138. self.mark(after);
  40139. break;
  40140. case "TypeCastExpression":
  40141. return self.explodeExpression(path.get("expression"));
  40142. case "ForInStatement":
  40143. head = loc();
  40144. after = loc();
  40145. var keyIterNextFn = self.makeTempVar();
  40146. self.emitAssign(keyIterNextFn, t.callExpression(util.runtimeProperty("keys"), [self.explodeExpression(path.get("right"))]));
  40147. self.mark(head);
  40148. var keyInfoTmpVar = self.makeTempVar();
  40149. self.jumpIf(t.memberExpression(t.assignmentExpression("=", keyInfoTmpVar, t.callExpression(keyIterNextFn, [])), t.identifier("done"), false), after);
  40150. self.emitAssign(stmt.left, t.memberExpression(keyInfoTmpVar, t.identifier("value"), false));
  40151. self.leapManager.withEntry(new leap.LoopEntry(after, head, labelId), function () {
  40152. self.explodeStatement(path.get("body"));
  40153. });
  40154. self.jump(head);
  40155. self.mark(after);
  40156. break;
  40157. case "BreakStatement":
  40158. self.emitAbruptCompletion({
  40159. type: "break",
  40160. target: self.leapManager.getBreakLoc(stmt.label)
  40161. });
  40162. break;
  40163. case "ContinueStatement":
  40164. self.emitAbruptCompletion({
  40165. type: "continue",
  40166. target: self.leapManager.getContinueLoc(stmt.label)
  40167. });
  40168. break;
  40169. case "SwitchStatement":
  40170. // Always save the discriminant into a temporary variable in case the
  40171. // test expressions overwrite values like context.sent.
  40172. var disc = self.emitAssign(self.makeTempVar(), self.explodeExpression(path.get("discriminant")));
  40173. after = loc();
  40174. var defaultLoc = loc();
  40175. var condition = defaultLoc;
  40176. var caseLocs = [];
  40177. // If there are no cases, .cases might be undefined.
  40178. var cases = stmt.cases || [];
  40179. for (var i = cases.length - 1; i >= 0; --i) {
  40180. var c = cases[i];
  40181. t.assertSwitchCase(c);
  40182. if (c.test) {
  40183. condition = t.conditionalExpression(t.binaryExpression("===", disc, c.test), caseLocs[i] = loc(), condition);
  40184. } else {
  40185. caseLocs[i] = defaultLoc;
  40186. }
  40187. }
  40188. var discriminant = path.get("discriminant");
  40189. util.replaceWithOrRemove(discriminant, condition);
  40190. self.jump(self.explodeExpression(discriminant));
  40191. self.leapManager.withEntry(new leap.SwitchEntry(after), function () {
  40192. path.get("cases").forEach(function (casePath) {
  40193. var i = casePath.key;
  40194. self.mark(caseLocs[i]);
  40195. casePath.get("consequent").forEach(function (path) {
  40196. self.explodeStatement(path);
  40197. });
  40198. });
  40199. });
  40200. self.mark(after);
  40201. if (defaultLoc.value === -1) {
  40202. self.mark(defaultLoc);
  40203. _assert2.default.strictEqual(after.value, defaultLoc.value);
  40204. }
  40205. break;
  40206. case "IfStatement":
  40207. var elseLoc = stmt.alternate && loc();
  40208. after = loc();
  40209. self.jumpIfNot(self.explodeExpression(path.get("test")), elseLoc || after);
  40210. self.explodeStatement(path.get("consequent"));
  40211. if (elseLoc) {
  40212. self.jump(after);
  40213. self.mark(elseLoc);
  40214. self.explodeStatement(path.get("alternate"));
  40215. }
  40216. self.mark(after);
  40217. break;
  40218. case "ReturnStatement":
  40219. self.emitAbruptCompletion({
  40220. type: "return",
  40221. value: self.explodeExpression(path.get("argument"))
  40222. });
  40223. break;
  40224. case "WithStatement":
  40225. throw new Error("WithStatement not supported in generator functions.");
  40226. case "TryStatement":
  40227. after = loc();
  40228. var handler = stmt.handler;
  40229. var catchLoc = handler && loc();
  40230. var catchEntry = catchLoc && new leap.CatchEntry(catchLoc, handler.param);
  40231. var finallyLoc = stmt.finalizer && loc();
  40232. var finallyEntry = finallyLoc && new leap.FinallyEntry(finallyLoc, after);
  40233. var tryEntry = new leap.TryEntry(self.getUnmarkedCurrentLoc(), catchEntry, finallyEntry);
  40234. self.tryEntries.push(tryEntry);
  40235. self.updateContextPrevLoc(tryEntry.firstLoc);
  40236. self.leapManager.withEntry(tryEntry, function () {
  40237. self.explodeStatement(path.get("block"));
  40238. if (catchLoc) {
  40239. if (finallyLoc) {
  40240. // If we have both a catch block and a finally block, then
  40241. // because we emit the catch block first, we need to jump over
  40242. // it to the finally block.
  40243. self.jump(finallyLoc);
  40244. } else {
  40245. // If there is no finally block, then we need to jump over the
  40246. // catch block to the fall-through location.
  40247. self.jump(after);
  40248. }
  40249. self.updateContextPrevLoc(self.mark(catchLoc));
  40250. var bodyPath = path.get("handler.body");
  40251. var safeParam = self.makeTempVar();
  40252. self.clearPendingException(tryEntry.firstLoc, safeParam);
  40253. bodyPath.traverse(catchParamVisitor, {
  40254. safeParam: safeParam,
  40255. catchParamName: handler.param.name
  40256. });
  40257. self.leapManager.withEntry(catchEntry, function () {
  40258. self.explodeStatement(bodyPath);
  40259. });
  40260. }
  40261. if (finallyLoc) {
  40262. self.updateContextPrevLoc(self.mark(finallyLoc));
  40263. self.leapManager.withEntry(finallyEntry, function () {
  40264. self.explodeStatement(path.get("finalizer"));
  40265. });
  40266. self.emit(t.returnStatement(t.callExpression(self.contextProperty("finish"), [finallyEntry.firstLoc])));
  40267. }
  40268. });
  40269. self.mark(after);
  40270. break;
  40271. case "ThrowStatement":
  40272. self.emit(t.throwStatement(self.explodeExpression(path.get("argument"))));
  40273. break;
  40274. default:
  40275. throw new Error("unknown Statement of type " + (0, _stringify2.default)(stmt.type));
  40276. }
  40277. };
  40278. var catchParamVisitor = {
  40279. Identifier: function Identifier(path, state) {
  40280. if (path.node.name === state.catchParamName && util.isReference(path)) {
  40281. util.replaceWithOrRemove(path, state.safeParam);
  40282. }
  40283. },
  40284. Scope: function Scope(path, state) {
  40285. if (path.scope.hasOwnBinding(state.catchParamName)) {
  40286. // Don't descend into nested scopes that shadow the catch
  40287. // parameter with their own declarations.
  40288. path.skip();
  40289. }
  40290. }
  40291. };
  40292. Ep.emitAbruptCompletion = function (record) {
  40293. if (!isValidCompletion(record)) {
  40294. _assert2.default.ok(false, "invalid completion record: " + (0, _stringify2.default)(record));
  40295. }
  40296. _assert2.default.notStrictEqual(record.type, "normal", "normal completions are not abrupt");
  40297. var abruptArgs = [t.stringLiteral(record.type)];
  40298. if (record.type === "break" || record.type === "continue") {
  40299. t.assertLiteral(record.target);
  40300. abruptArgs[1] = record.target;
  40301. } else if (record.type === "return" || record.type === "throw") {
  40302. if (record.value) {
  40303. t.assertExpression(record.value);
  40304. abruptArgs[1] = record.value;
  40305. }
  40306. }
  40307. this.emit(t.returnStatement(t.callExpression(this.contextProperty("abrupt"), abruptArgs)));
  40308. };
  40309. function isValidCompletion(record) {
  40310. var type = record.type;
  40311. if (type === "normal") {
  40312. return !hasOwn.call(record, "target");
  40313. }
  40314. if (type === "break" || type === "continue") {
  40315. return !hasOwn.call(record, "value") && t.isLiteral(record.target);
  40316. }
  40317. if (type === "return" || type === "throw") {
  40318. return hasOwn.call(record, "value") && !hasOwn.call(record, "target");
  40319. }
  40320. return false;
  40321. }
  40322. // Not all offsets into emitter.listing are potential jump targets. For
  40323. // example, execution typically falls into the beginning of a try block
  40324. // without jumping directly there. This method returns the current offset
  40325. // without marking it, so that a switch case will not necessarily be
  40326. // generated for this offset (I say "not necessarily" because the same
  40327. // location might end up being marked in the process of emitting other
  40328. // statements). There's no logical harm in marking such locations as jump
  40329. // targets, but minimizing the number of switch cases keeps the generated
  40330. // code shorter.
  40331. Ep.getUnmarkedCurrentLoc = function () {
  40332. return t.numericLiteral(this.listing.length);
  40333. };
  40334. // The context.prev property takes the value of context.next whenever we
  40335. // evaluate the switch statement discriminant, which is generally good
  40336. // enough for tracking the last location we jumped to, but sometimes
  40337. // context.prev needs to be more precise, such as when we fall
  40338. // successfully out of a try block and into a finally block without
  40339. // jumping. This method exists to update context.prev to the freshest
  40340. // available location. If we were implementing a full interpreter, we
  40341. // would know the location of the current instruction with complete
  40342. // precision at all times, but we don't have that luxury here, as it would
  40343. // be costly and verbose to set context.prev before every statement.
  40344. Ep.updateContextPrevLoc = function (loc) {
  40345. if (loc) {
  40346. t.assertLiteral(loc);
  40347. if (loc.value === -1) {
  40348. // If an uninitialized location literal was passed in, set its value
  40349. // to the current this.listing.length.
  40350. loc.value = this.listing.length;
  40351. } else {
  40352. // Otherwise assert that the location matches the current offset.
  40353. _assert2.default.strictEqual(loc.value, this.listing.length);
  40354. }
  40355. } else {
  40356. loc = this.getUnmarkedCurrentLoc();
  40357. }
  40358. // Make sure context.prev is up to date in case we fell into this try
  40359. // statement without jumping to it. TODO Consider avoiding this
  40360. // assignment when we know control must have jumped here.
  40361. this.emitAssign(this.contextProperty("prev"), loc);
  40362. };
  40363. Ep.explodeExpression = function (path, ignoreResult) {
  40364. var expr = path.node;
  40365. if (expr) {
  40366. t.assertExpression(expr);
  40367. } else {
  40368. return expr;
  40369. }
  40370. var self = this;
  40371. var result = void 0; // Used optionally by several cases below.
  40372. var after = void 0;
  40373. function finish(expr) {
  40374. t.assertExpression(expr);
  40375. if (ignoreResult) {
  40376. self.emit(expr);
  40377. } else {
  40378. return expr;
  40379. }
  40380. }
  40381. // If the expression does not contain a leap, then we either emit the
  40382. // expression as a standalone statement or return it whole.
  40383. if (!meta.containsLeap(expr)) {
  40384. return finish(expr);
  40385. }
  40386. // If any child contains a leap (such as a yield or labeled continue or
  40387. // break statement), then any sibling subexpressions will almost
  40388. // certainly have to be exploded in order to maintain the order of their
  40389. // side effects relative to the leaping child(ren).
  40390. var hasLeapingChildren = meta.containsLeap.onlyChildren(expr);
  40391. // In order to save the rest of explodeExpression from a combinatorial
  40392. // trainwreck of special cases, explodeViaTempVar is responsible for
  40393. // deciding when a subexpression needs to be "exploded," which is my
  40394. // very technical term for emitting the subexpression as an assignment
  40395. // to a temporary variable and the substituting the temporary variable
  40396. // for the original subexpression. Think of exploded view diagrams, not
  40397. // Michael Bay movies. The point of exploding subexpressions is to
  40398. // control the precise order in which the generated code realizes the
  40399. // side effects of those subexpressions.
  40400. function explodeViaTempVar(tempVar, childPath, ignoreChildResult) {
  40401. _assert2.default.ok(!ignoreChildResult || !tempVar, "Ignoring the result of a child expression but forcing it to " + "be assigned to a temporary variable?");
  40402. var result = self.explodeExpression(childPath, ignoreChildResult);
  40403. if (ignoreChildResult) {
  40404. // Side effects already emitted above.
  40405. } else if (tempVar || hasLeapingChildren && !t.isLiteral(result)) {
  40406. // If tempVar was provided, then the result will always be assigned
  40407. // to it, even if the result does not otherwise need to be assigned
  40408. // to a temporary variable. When no tempVar is provided, we have
  40409. // the flexibility to decide whether a temporary variable is really
  40410. // necessary. Unfortunately, in general, a temporary variable is
  40411. // required whenever any child contains a yield expression, since it
  40412. // is difficult to prove (at all, let alone efficiently) whether
  40413. // this result would evaluate to the same value before and after the
  40414. // yield (see #206). One narrow case where we can prove it doesn't
  40415. // matter (and thus we do not need a temporary variable) is when the
  40416. // result in question is a Literal value.
  40417. result = self.emitAssign(tempVar || self.makeTempVar(), result);
  40418. }
  40419. return result;
  40420. }
  40421. // If ignoreResult is true, then we must take full responsibility for
  40422. // emitting the expression with all its side effects, and we should not
  40423. // return a result.
  40424. switch (expr.type) {
  40425. case "MemberExpression":
  40426. return finish(t.memberExpression(self.explodeExpression(path.get("object")), expr.computed ? explodeViaTempVar(null, path.get("property")) : expr.property, expr.computed));
  40427. case "CallExpression":
  40428. var calleePath = path.get("callee");
  40429. var argsPath = path.get("arguments");
  40430. var newCallee = void 0;
  40431. var newArgs = [];
  40432. var hasLeapingArgs = false;
  40433. argsPath.forEach(function (argPath) {
  40434. hasLeapingArgs = hasLeapingArgs || meta.containsLeap(argPath.node);
  40435. });
  40436. if (t.isMemberExpression(calleePath.node)) {
  40437. if (hasLeapingArgs) {
  40438. // If the arguments of the CallExpression contained any yield
  40439. // expressions, then we need to be sure to evaluate the callee
  40440. // before evaluating the arguments, but if the callee was a member
  40441. // expression, then we must be careful that the object of the
  40442. // member expression still gets bound to `this` for the call.
  40443. var newObject = explodeViaTempVar(
  40444. // Assign the exploded callee.object expression to a temporary
  40445. // variable so that we can use it twice without reevaluating it.
  40446. self.makeTempVar(), calleePath.get("object"));
  40447. var newProperty = calleePath.node.computed ? explodeViaTempVar(null, calleePath.get("property")) : calleePath.node.property;
  40448. newArgs.unshift(newObject);
  40449. newCallee = t.memberExpression(t.memberExpression(newObject, newProperty, calleePath.node.computed), t.identifier("call"), false);
  40450. } else {
  40451. newCallee = self.explodeExpression(calleePath);
  40452. }
  40453. } else {
  40454. newCallee = explodeViaTempVar(null, calleePath);
  40455. if (t.isMemberExpression(newCallee)) {
  40456. // If the callee was not previously a MemberExpression, then the
  40457. // CallExpression was "unqualified," meaning its `this` object
  40458. // should be the global object. If the exploded expression has
  40459. // become a MemberExpression (e.g. a context property, probably a
  40460. // temporary variable), then we need to force it to be unqualified
  40461. // by using the (0, object.property)(...) trick; otherwise, it
  40462. // will receive the object of the MemberExpression as its `this`
  40463. // object.
  40464. newCallee = t.sequenceExpression([t.numericLiteral(0), newCallee]);
  40465. }
  40466. }
  40467. argsPath.forEach(function (argPath) {
  40468. newArgs.push(explodeViaTempVar(null, argPath));
  40469. });
  40470. return finish(t.callExpression(newCallee, newArgs));
  40471. case "NewExpression":
  40472. return finish(t.newExpression(explodeViaTempVar(null, path.get("callee")), path.get("arguments").map(function (argPath) {
  40473. return explodeViaTempVar(null, argPath);
  40474. })));
  40475. case "ObjectExpression":
  40476. return finish(t.objectExpression(path.get("properties").map(function (propPath) {
  40477. if (propPath.isObjectProperty()) {
  40478. return t.objectProperty(propPath.node.key, explodeViaTempVar(null, propPath.get("value")), propPath.node.computed);
  40479. } else {
  40480. return propPath.node;
  40481. }
  40482. })));
  40483. case "ArrayExpression":
  40484. return finish(t.arrayExpression(path.get("elements").map(function (elemPath) {
  40485. return explodeViaTempVar(null, elemPath);
  40486. })));
  40487. case "SequenceExpression":
  40488. var lastIndex = expr.expressions.length - 1;
  40489. path.get("expressions").forEach(function (exprPath) {
  40490. if (exprPath.key === lastIndex) {
  40491. result = self.explodeExpression(exprPath, ignoreResult);
  40492. } else {
  40493. self.explodeExpression(exprPath, true);
  40494. }
  40495. });
  40496. return result;
  40497. case "LogicalExpression":
  40498. after = loc();
  40499. if (!ignoreResult) {
  40500. result = self.makeTempVar();
  40501. }
  40502. var left = explodeViaTempVar(result, path.get("left"));
  40503. if (expr.operator === "&&") {
  40504. self.jumpIfNot(left, after);
  40505. } else {
  40506. _assert2.default.strictEqual(expr.operator, "||");
  40507. self.jumpIf(left, after);
  40508. }
  40509. explodeViaTempVar(result, path.get("right"), ignoreResult);
  40510. self.mark(after);
  40511. return result;
  40512. case "ConditionalExpression":
  40513. var elseLoc = loc();
  40514. after = loc();
  40515. var test = self.explodeExpression(path.get("test"));
  40516. self.jumpIfNot(test, elseLoc);
  40517. if (!ignoreResult) {
  40518. result = self.makeTempVar();
  40519. }
  40520. explodeViaTempVar(result, path.get("consequent"), ignoreResult);
  40521. self.jump(after);
  40522. self.mark(elseLoc);
  40523. explodeViaTempVar(result, path.get("alternate"), ignoreResult);
  40524. self.mark(after);
  40525. return result;
  40526. case "UnaryExpression":
  40527. return finish(t.unaryExpression(expr.operator,
  40528. // Can't (and don't need to) break up the syntax of the argument.
  40529. // Think about delete a[b].
  40530. self.explodeExpression(path.get("argument")), !!expr.prefix));
  40531. case "BinaryExpression":
  40532. return finish(t.binaryExpression(expr.operator, explodeViaTempVar(null, path.get("left")), explodeViaTempVar(null, path.get("right"))));
  40533. case "AssignmentExpression":
  40534. return finish(t.assignmentExpression(expr.operator, self.explodeExpression(path.get("left")), self.explodeExpression(path.get("right"))));
  40535. case "UpdateExpression":
  40536. return finish(t.updateExpression(expr.operator, self.explodeExpression(path.get("argument")), expr.prefix));
  40537. case "YieldExpression":
  40538. after = loc();
  40539. var arg = expr.argument && self.explodeExpression(path.get("argument"));
  40540. if (arg && expr.delegate) {
  40541. var _result = self.makeTempVar();
  40542. self.emit(t.returnStatement(t.callExpression(self.contextProperty("delegateYield"), [arg, t.stringLiteral(_result.property.name), after])));
  40543. self.mark(after);
  40544. return _result;
  40545. }
  40546. self.emitAssign(self.contextProperty("next"), after);
  40547. self.emit(t.returnStatement(arg || null));
  40548. self.mark(after);
  40549. return self.contextProperty("sent");
  40550. default:
  40551. throw new Error("unknown Expression of type " + (0, _stringify2.default)(expr.type));
  40552. }
  40553. };
  40554. },{"./leap":530,"./meta":531,"./util":533,"assert":3,"babel-runtime/core-js/json/stringify":96,"babel-types":151}],528:[function(require,module,exports){
  40555. "use strict";
  40556. var _keys = require("babel-runtime/core-js/object/keys");
  40557. var _keys2 = _interopRequireDefault(_keys);
  40558. var _babelTypes = require("babel-types");
  40559. var t = _interopRequireWildcard(_babelTypes);
  40560. var _util = require("./util");
  40561. var util = _interopRequireWildcard(_util);
  40562. 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; } }
  40563. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  40564. /**
  40565. * Copyright (c) 2014, Facebook, Inc.
  40566. * All rights reserved.
  40567. *
  40568. * This source code is licensed under the BSD-style license found in the
  40569. * https://raw.github.com/facebook/regenerator/master/LICENSE file. An
  40570. * additional grant of patent rights can be found in the PATENTS file in
  40571. * the same directory.
  40572. */
  40573. var hasOwn = Object.prototype.hasOwnProperty;
  40574. // The hoist function takes a FunctionExpression or FunctionDeclaration
  40575. // and replaces any Declaration nodes in its body with assignments, then
  40576. // returns a VariableDeclaration containing just the names of the removed
  40577. // declarations.
  40578. exports.hoist = function (funPath) {
  40579. t.assertFunction(funPath.node);
  40580. var vars = {};
  40581. function varDeclToExpr(vdec, includeIdentifiers) {
  40582. t.assertVariableDeclaration(vdec);
  40583. // TODO assert.equal(vdec.kind, "var");
  40584. var exprs = [];
  40585. vdec.declarations.forEach(function (dec) {
  40586. // Note: We duplicate 'dec.id' here to ensure that the variable declaration IDs don't
  40587. // have the same 'loc' value, since that can make sourcemaps and retainLines behave poorly.
  40588. vars[dec.id.name] = t.identifier(dec.id.name);
  40589. if (dec.init) {
  40590. exprs.push(t.assignmentExpression("=", dec.id, dec.init));
  40591. } else if (includeIdentifiers) {
  40592. exprs.push(dec.id);
  40593. }
  40594. });
  40595. if (exprs.length === 0) return null;
  40596. if (exprs.length === 1) return exprs[0];
  40597. return t.sequenceExpression(exprs);
  40598. }
  40599. funPath.get("body").traverse({
  40600. VariableDeclaration: {
  40601. exit: function exit(path) {
  40602. var expr = varDeclToExpr(path.node, false);
  40603. if (expr === null) {
  40604. path.remove();
  40605. } else {
  40606. // We don't need to traverse this expression any further because
  40607. // there can't be any new declarations inside an expression.
  40608. util.replaceWithOrRemove(path, t.expressionStatement(expr));
  40609. }
  40610. // Since the original node has been either removed or replaced,
  40611. // avoid traversing it any further.
  40612. path.skip();
  40613. }
  40614. },
  40615. ForStatement: function ForStatement(path) {
  40616. var init = path.node.init;
  40617. if (t.isVariableDeclaration(init)) {
  40618. util.replaceWithOrRemove(path.get("init"), varDeclToExpr(init, false));
  40619. }
  40620. },
  40621. ForXStatement: function ForXStatement(path) {
  40622. var left = path.get("left");
  40623. if (left.isVariableDeclaration()) {
  40624. util.replaceWithOrRemove(left, varDeclToExpr(left.node, true));
  40625. }
  40626. },
  40627. FunctionDeclaration: function FunctionDeclaration(path) {
  40628. var node = path.node;
  40629. vars[node.id.name] = node.id;
  40630. var assignment = t.expressionStatement(t.assignmentExpression("=", node.id, t.functionExpression(node.id, node.params, node.body, node.generator, node.expression)));
  40631. if (path.parentPath.isBlockStatement()) {
  40632. // Insert the assignment form before the first statement in the
  40633. // enclosing block.
  40634. path.parentPath.unshiftContainer("body", assignment);
  40635. // Remove the function declaration now that we've inserted the
  40636. // equivalent assignment form at the beginning of the block.
  40637. path.remove();
  40638. } else {
  40639. // If the parent node is not a block statement, then we can just
  40640. // replace the declaration with the equivalent assignment form
  40641. // without worrying about hoisting it.
  40642. util.replaceWithOrRemove(path, assignment);
  40643. }
  40644. // Don't hoist variables out of inner functions.
  40645. path.skip();
  40646. },
  40647. FunctionExpression: function FunctionExpression(path) {
  40648. // Don't descend into nested function expressions.
  40649. path.skip();
  40650. }
  40651. });
  40652. var paramNames = {};
  40653. funPath.get("params").forEach(function (paramPath) {
  40654. var param = paramPath.node;
  40655. if (t.isIdentifier(param)) {
  40656. paramNames[param.name] = param;
  40657. } else {
  40658. // Variables declared by destructuring parameter patterns will be
  40659. // harmlessly re-declared.
  40660. }
  40661. });
  40662. var declarations = [];
  40663. (0, _keys2.default)(vars).forEach(function (name) {
  40664. if (!hasOwn.call(paramNames, name)) {
  40665. declarations.push(t.variableDeclarator(vars[name], null));
  40666. }
  40667. });
  40668. if (declarations.length === 0) {
  40669. return null; // Be sure to handle this case!
  40670. }
  40671. return t.variableDeclaration("var", declarations);
  40672. };
  40673. },{"./util":533,"babel-runtime/core-js/object/keys":102,"babel-types":151}],529:[function(require,module,exports){
  40674. "use strict";
  40675. exports.__esModule = true;
  40676. exports.default = function (context) {
  40677. var plugin = {
  40678. visitor: require("./visit").visitor
  40679. };
  40680. // Some presets manually call child presets, but fail to pass along the
  40681. // context object. Out of an abundance of caution, we verify that it
  40682. // exists first to avoid causing unnecessary breaking changes.
  40683. var version = context && context.version;
  40684. // The "name" property is not allowed in older versions of Babel (6.x)
  40685. // and will cause the plugin validator to throw an exception.
  40686. if (version && parseInt(version, 10) >= 7) {
  40687. plugin.name = "regenerator-transform";
  40688. }
  40689. return plugin;
  40690. };
  40691. },{"./visit":534}],530:[function(require,module,exports){
  40692. "use strict";
  40693. var _assert = require("assert");
  40694. var _assert2 = _interopRequireDefault(_assert);
  40695. var _babelTypes = require("babel-types");
  40696. var t = _interopRequireWildcard(_babelTypes);
  40697. var _util = require("util");
  40698. 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; } }
  40699. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  40700. function Entry() {
  40701. _assert2.default.ok(this instanceof Entry);
  40702. } /**
  40703. * Copyright (c) 2014, Facebook, Inc.
  40704. * All rights reserved.
  40705. *
  40706. * This source code is licensed under the BSD-style license found in the
  40707. * https://raw.github.com/facebook/regenerator/master/LICENSE file. An
  40708. * additional grant of patent rights can be found in the PATENTS file in
  40709. * the same directory.
  40710. */
  40711. function FunctionEntry(returnLoc) {
  40712. Entry.call(this);
  40713. t.assertLiteral(returnLoc);
  40714. this.returnLoc = returnLoc;
  40715. }
  40716. (0, _util.inherits)(FunctionEntry, Entry);
  40717. exports.FunctionEntry = FunctionEntry;
  40718. function LoopEntry(breakLoc, continueLoc, label) {
  40719. Entry.call(this);
  40720. t.assertLiteral(breakLoc);
  40721. t.assertLiteral(continueLoc);
  40722. if (label) {
  40723. t.assertIdentifier(label);
  40724. } else {
  40725. label = null;
  40726. }
  40727. this.breakLoc = breakLoc;
  40728. this.continueLoc = continueLoc;
  40729. this.label = label;
  40730. }
  40731. (0, _util.inherits)(LoopEntry, Entry);
  40732. exports.LoopEntry = LoopEntry;
  40733. function SwitchEntry(breakLoc) {
  40734. Entry.call(this);
  40735. t.assertLiteral(breakLoc);
  40736. this.breakLoc = breakLoc;
  40737. }
  40738. (0, _util.inherits)(SwitchEntry, Entry);
  40739. exports.SwitchEntry = SwitchEntry;
  40740. function TryEntry(firstLoc, catchEntry, finallyEntry) {
  40741. Entry.call(this);
  40742. t.assertLiteral(firstLoc);
  40743. if (catchEntry) {
  40744. _assert2.default.ok(catchEntry instanceof CatchEntry);
  40745. } else {
  40746. catchEntry = null;
  40747. }
  40748. if (finallyEntry) {
  40749. _assert2.default.ok(finallyEntry instanceof FinallyEntry);
  40750. } else {
  40751. finallyEntry = null;
  40752. }
  40753. // Have to have one or the other (or both).
  40754. _assert2.default.ok(catchEntry || finallyEntry);
  40755. this.firstLoc = firstLoc;
  40756. this.catchEntry = catchEntry;
  40757. this.finallyEntry = finallyEntry;
  40758. }
  40759. (0, _util.inherits)(TryEntry, Entry);
  40760. exports.TryEntry = TryEntry;
  40761. function CatchEntry(firstLoc, paramId) {
  40762. Entry.call(this);
  40763. t.assertLiteral(firstLoc);
  40764. t.assertIdentifier(paramId);
  40765. this.firstLoc = firstLoc;
  40766. this.paramId = paramId;
  40767. }
  40768. (0, _util.inherits)(CatchEntry, Entry);
  40769. exports.CatchEntry = CatchEntry;
  40770. function FinallyEntry(firstLoc, afterLoc) {
  40771. Entry.call(this);
  40772. t.assertLiteral(firstLoc);
  40773. t.assertLiteral(afterLoc);
  40774. this.firstLoc = firstLoc;
  40775. this.afterLoc = afterLoc;
  40776. }
  40777. (0, _util.inherits)(FinallyEntry, Entry);
  40778. exports.FinallyEntry = FinallyEntry;
  40779. function LabeledEntry(breakLoc, label) {
  40780. Entry.call(this);
  40781. t.assertLiteral(breakLoc);
  40782. t.assertIdentifier(label);
  40783. this.breakLoc = breakLoc;
  40784. this.label = label;
  40785. }
  40786. (0, _util.inherits)(LabeledEntry, Entry);
  40787. exports.LabeledEntry = LabeledEntry;
  40788. function LeapManager(emitter) {
  40789. _assert2.default.ok(this instanceof LeapManager);
  40790. var Emitter = require("./emit").Emitter;
  40791. _assert2.default.ok(emitter instanceof Emitter);
  40792. this.emitter = emitter;
  40793. this.entryStack = [new FunctionEntry(emitter.finalLoc)];
  40794. }
  40795. var LMp = LeapManager.prototype;
  40796. exports.LeapManager = LeapManager;
  40797. LMp.withEntry = function (entry, callback) {
  40798. _assert2.default.ok(entry instanceof Entry);
  40799. this.entryStack.push(entry);
  40800. try {
  40801. callback.call(this.emitter);
  40802. } finally {
  40803. var popped = this.entryStack.pop();
  40804. _assert2.default.strictEqual(popped, entry);
  40805. }
  40806. };
  40807. LMp._findLeapLocation = function (property, label) {
  40808. for (var i = this.entryStack.length - 1; i >= 0; --i) {
  40809. var entry = this.entryStack[i];
  40810. var loc = entry[property];
  40811. if (loc) {
  40812. if (label) {
  40813. if (entry.label && entry.label.name === label.name) {
  40814. return loc;
  40815. }
  40816. } else if (entry instanceof LabeledEntry) {
  40817. // Ignore LabeledEntry entries unless we are actually breaking to
  40818. // a label.
  40819. } else {
  40820. return loc;
  40821. }
  40822. }
  40823. }
  40824. return null;
  40825. };
  40826. LMp.getBreakLoc = function (label) {
  40827. return this._findLeapLocation("breakLoc", label);
  40828. };
  40829. LMp.getContinueLoc = function (label) {
  40830. return this._findLeapLocation("continueLoc", label);
  40831. };
  40832. },{"./emit":527,"assert":3,"babel-types":151,"util":560}],531:[function(require,module,exports){
  40833. "use strict";
  40834. var _assert = require("assert");
  40835. var _assert2 = _interopRequireDefault(_assert);
  40836. var _babelTypes = require("babel-types");
  40837. var t = _interopRequireWildcard(_babelTypes);
  40838. 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; } }
  40839. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  40840. var m = require("private").makeAccessor(); /**
  40841. * Copyright (c) 2014, Facebook, Inc.
  40842. * All rights reserved.
  40843. *
  40844. * This source code is licensed under the BSD-style license found in the
  40845. * https://raw.github.com/facebook/regenerator/master/LICENSE file. An
  40846. * additional grant of patent rights can be found in the PATENTS file in
  40847. * the same directory.
  40848. */
  40849. var hasOwn = Object.prototype.hasOwnProperty;
  40850. function makePredicate(propertyName, knownTypes) {
  40851. function onlyChildren(node) {
  40852. t.assertNode(node);
  40853. // Assume no side effects until we find out otherwise.
  40854. var result = false;
  40855. function check(child) {
  40856. if (result) {
  40857. // Do nothing.
  40858. } else if (Array.isArray(child)) {
  40859. child.some(check);
  40860. } else if (t.isNode(child)) {
  40861. _assert2.default.strictEqual(result, false);
  40862. result = predicate(child);
  40863. }
  40864. return result;
  40865. }
  40866. var keys = t.VISITOR_KEYS[node.type];
  40867. if (keys) {
  40868. for (var i = 0; i < keys.length; i++) {
  40869. var key = keys[i];
  40870. var child = node[key];
  40871. check(child);
  40872. }
  40873. }
  40874. return result;
  40875. }
  40876. function predicate(node) {
  40877. t.assertNode(node);
  40878. var meta = m(node);
  40879. if (hasOwn.call(meta, propertyName)) return meta[propertyName];
  40880. // Certain types are "opaque," which means they have no side
  40881. // effects or leaps and we don't care about their subexpressions.
  40882. if (hasOwn.call(opaqueTypes, node.type)) return meta[propertyName] = false;
  40883. if (hasOwn.call(knownTypes, node.type)) return meta[propertyName] = true;
  40884. return meta[propertyName] = onlyChildren(node);
  40885. }
  40886. predicate.onlyChildren = onlyChildren;
  40887. return predicate;
  40888. }
  40889. var opaqueTypes = {
  40890. FunctionExpression: true,
  40891. ArrowFunctionExpression: true
  40892. };
  40893. // These types potentially have side effects regardless of what side
  40894. // effects their subexpressions have.
  40895. var sideEffectTypes = {
  40896. CallExpression: true, // Anything could happen!
  40897. ForInStatement: true, // Modifies the key variable.
  40898. UnaryExpression: true, // Think delete.
  40899. BinaryExpression: true, // Might invoke .toString() or .valueOf().
  40900. AssignmentExpression: true, // Side-effecting by definition.
  40901. UpdateExpression: true, // Updates are essentially assignments.
  40902. NewExpression: true // Similar to CallExpression.
  40903. };
  40904. // These types are the direct cause of all leaps in control flow.
  40905. var leapTypes = {
  40906. YieldExpression: true,
  40907. BreakStatement: true,
  40908. ContinueStatement: true,
  40909. ReturnStatement: true,
  40910. ThrowStatement: true
  40911. };
  40912. // All leap types are also side effect types.
  40913. for (var type in leapTypes) {
  40914. if (hasOwn.call(leapTypes, type)) {
  40915. sideEffectTypes[type] = leapTypes[type];
  40916. }
  40917. }
  40918. exports.hasSideEffects = makePredicate("hasSideEffects", sideEffectTypes);
  40919. exports.containsLeap = makePredicate("containsLeap", leapTypes);
  40920. },{"assert":3,"babel-types":151,"private":524}],532:[function(require,module,exports){
  40921. "use strict";
  40922. exports.__esModule = true;
  40923. exports.default = replaceShorthandObjectMethod;
  40924. var _babelTypes = require("babel-types");
  40925. var t = _interopRequireWildcard(_babelTypes);
  40926. var _util = require("./util");
  40927. var util = _interopRequireWildcard(_util);
  40928. 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; } }
  40929. // this function converts a shorthand object generator method into a normal
  40930. // (non-shorthand) object property which is a generator function expression. for
  40931. // example, this:
  40932. //
  40933. // var foo = {
  40934. // *bar(baz) { return 5; }
  40935. // }
  40936. //
  40937. // should be replaced with:
  40938. //
  40939. // var foo = {
  40940. // bar: function*(baz) { return 5; }
  40941. // }
  40942. //
  40943. // to do this, it clones the parameter array and the body of the object generator
  40944. // method into a new FunctionExpression.
  40945. //
  40946. // this method can be passed any Function AST node path, and it will return
  40947. // either:
  40948. // a) the path that was passed in (iff the path did not need to be replaced) or
  40949. // b) the path of the new FunctionExpression that was created as a replacement
  40950. // (iff the path did need to be replaced)
  40951. //
  40952. // In either case, though, the caller can count on the fact that the return value
  40953. // is a Function AST node path.
  40954. //
  40955. // If this function is called with an AST node path that is not a Function (or with an
  40956. // argument that isn't an AST node path), it will throw an error.
  40957. function replaceShorthandObjectMethod(path) {
  40958. if (!path.node || !t.isFunction(path.node)) {
  40959. throw new Error("replaceShorthandObjectMethod can only be called on Function AST node paths.");
  40960. }
  40961. // this function only replaces shorthand object methods (called ObjectMethod
  40962. // in Babel-speak).
  40963. if (!t.isObjectMethod(path.node)) {
  40964. return path;
  40965. }
  40966. // this function only replaces generators.
  40967. if (!path.node.generator) {
  40968. return path;
  40969. }
  40970. var parameters = path.node.params.map(function (param) {
  40971. return t.cloneDeep(param);
  40972. });
  40973. var functionExpression = t.functionExpression(null, // id
  40974. parameters, // params
  40975. t.cloneDeep(path.node.body), // body
  40976. path.node.generator, path.node.async);
  40977. util.replaceWithOrRemove(path, t.objectProperty(t.cloneDeep(path.node.key), // key
  40978. functionExpression, //value
  40979. path.node.computed, // computed
  40980. false // shorthand
  40981. ));
  40982. // path now refers to the ObjectProperty AST node path, but we want to return a
  40983. // Function AST node path for the function expression we created. we know that
  40984. // the FunctionExpression we just created is the value of the ObjectProperty,
  40985. // so return the "value" path off of this path.
  40986. return path.get("value");
  40987. }
  40988. },{"./util":533,"babel-types":151}],533:[function(require,module,exports){
  40989. "use strict";
  40990. exports.__esModule = true;
  40991. exports.runtimeProperty = runtimeProperty;
  40992. exports.isReference = isReference;
  40993. exports.replaceWithOrRemove = replaceWithOrRemove;
  40994. var _babelTypes = require("babel-types");
  40995. var t = _interopRequireWildcard(_babelTypes);
  40996. 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; } }
  40997. function runtimeProperty(name) {
  40998. return t.memberExpression(t.identifier("regeneratorRuntime"), t.identifier(name), false);
  40999. } /**
  41000. * Copyright (c) 2014, Facebook, Inc.
  41001. * All rights reserved.
  41002. *
  41003. * This source code is licensed under the BSD-style license found in the
  41004. * https://raw.github.com/facebook/regenerator/master/LICENSE file. An
  41005. * additional grant of patent rights can be found in the PATENTS file in
  41006. * the same directory.
  41007. */
  41008. function isReference(path) {
  41009. return path.isReferenced() || path.parentPath.isAssignmentExpression({ left: path.node });
  41010. }
  41011. function replaceWithOrRemove(path, replacement) {
  41012. if (replacement) {
  41013. path.replaceWith(replacement);
  41014. } else {
  41015. path.remove();
  41016. }
  41017. }
  41018. },{"babel-types":151}],534:[function(require,module,exports){
  41019. /**
  41020. * Copyright (c) 2014, Facebook, Inc.
  41021. * All rights reserved.
  41022. *
  41023. * This source code is licensed under the BSD-style license found in the
  41024. * https://raw.github.com/facebook/regenerator/master/LICENSE file. An
  41025. * additional grant of patent rights can be found in the PATENTS file in
  41026. * the same directory.
  41027. */
  41028. "use strict";
  41029. var _assert = require("assert");
  41030. var _assert2 = _interopRequireDefault(_assert);
  41031. var _babelTypes = require("babel-types");
  41032. var t = _interopRequireWildcard(_babelTypes);
  41033. var _hoist = require("./hoist");
  41034. var _emit = require("./emit");
  41035. var _replaceShorthandObjectMethod = require("./replaceShorthandObjectMethod");
  41036. var _replaceShorthandObjectMethod2 = _interopRequireDefault(_replaceShorthandObjectMethod);
  41037. var _util = require("./util");
  41038. var util = _interopRequireWildcard(_util);
  41039. 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; } }
  41040. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  41041. exports.visitor = {
  41042. Function: {
  41043. exit: function exit(path, state) {
  41044. var node = path.node;
  41045. if (node.generator) {
  41046. if (node.async) {
  41047. // Async generator
  41048. if (state.opts.asyncGenerators === false) return;
  41049. } else {
  41050. // Plain generator
  41051. if (state.opts.generators === false) return;
  41052. }
  41053. } else if (node.async) {
  41054. // Async function
  41055. if (state.opts.async === false) return;
  41056. } else {
  41057. // Not a generator or async function.
  41058. return;
  41059. }
  41060. // if this is an ObjectMethod, we need to convert it to an ObjectProperty
  41061. path = (0, _replaceShorthandObjectMethod2.default)(path);
  41062. node = path.node;
  41063. var contextId = path.scope.generateUidIdentifier("context");
  41064. var argsId = path.scope.generateUidIdentifier("args");
  41065. path.ensureBlock();
  41066. var bodyBlockPath = path.get("body");
  41067. if (node.async) {
  41068. bodyBlockPath.traverse(awaitVisitor);
  41069. }
  41070. bodyBlockPath.traverse(functionSentVisitor, {
  41071. context: contextId
  41072. });
  41073. var outerBody = [];
  41074. var innerBody = [];
  41075. bodyBlockPath.get("body").forEach(function (childPath) {
  41076. var node = childPath.node;
  41077. if (t.isExpressionStatement(node) && t.isStringLiteral(node.expression)) {
  41078. // Babylon represents directives like "use strict" as elements
  41079. // of a bodyBlockPath.node.directives array, but they could just
  41080. // as easily be represented (by other parsers) as traditional
  41081. // string-literal-valued expression statements, so we need to
  41082. // handle that here. (#248)
  41083. outerBody.push(node);
  41084. } else if (node && node._blockHoist != null) {
  41085. outerBody.push(node);
  41086. } else {
  41087. innerBody.push(node);
  41088. }
  41089. });
  41090. if (outerBody.length > 0) {
  41091. // Only replace the inner body if we actually hoisted any statements
  41092. // to the outer body.
  41093. bodyBlockPath.node.body = innerBody;
  41094. }
  41095. var outerFnExpr = getOuterFnExpr(path);
  41096. // Note that getOuterFnExpr has the side-effect of ensuring that the
  41097. // function has a name (so node.id will always be an Identifier), even
  41098. // if a temporary name has to be synthesized.
  41099. t.assertIdentifier(node.id);
  41100. var innerFnId = t.identifier(node.id.name + "$");
  41101. // Turn all declarations into vars, and replace the original
  41102. // declarations with equivalent assignment expressions.
  41103. var vars = (0, _hoist.hoist)(path);
  41104. var didRenameArguments = renameArguments(path, argsId);
  41105. if (didRenameArguments) {
  41106. vars = vars || t.variableDeclaration("var", []);
  41107. var argumentIdentifier = t.identifier("arguments");
  41108. // we need to do this as otherwise arguments in arrow functions gets hoisted
  41109. argumentIdentifier._shadowedFunctionLiteral = path;
  41110. vars.declarations.push(t.variableDeclarator(argsId, argumentIdentifier));
  41111. }
  41112. var emitter = new _emit.Emitter(contextId);
  41113. emitter.explode(path.get("body"));
  41114. if (vars && vars.declarations.length > 0) {
  41115. outerBody.push(vars);
  41116. }
  41117. var wrapArgs = [emitter.getContextFunction(innerFnId),
  41118. // Async functions that are not generators don't care about the
  41119. // outer function because they don't need it to be marked and don't
  41120. // inherit from its .prototype.
  41121. node.generator ? outerFnExpr : t.nullLiteral(), t.thisExpression()];
  41122. var tryLocsList = emitter.getTryLocsList();
  41123. if (tryLocsList) {
  41124. wrapArgs.push(tryLocsList);
  41125. }
  41126. var wrapCall = t.callExpression(util.runtimeProperty(node.async ? "async" : "wrap"), wrapArgs);
  41127. outerBody.push(t.returnStatement(wrapCall));
  41128. node.body = t.blockStatement(outerBody);
  41129. var oldDirectives = bodyBlockPath.node.directives;
  41130. if (oldDirectives) {
  41131. // Babylon represents directives like "use strict" as elements of
  41132. // a bodyBlockPath.node.directives array. (#248)
  41133. node.body.directives = oldDirectives;
  41134. }
  41135. var wasGeneratorFunction = node.generator;
  41136. if (wasGeneratorFunction) {
  41137. node.generator = false;
  41138. }
  41139. if (node.async) {
  41140. node.async = false;
  41141. }
  41142. if (wasGeneratorFunction && t.isExpression(node)) {
  41143. util.replaceWithOrRemove(path, t.callExpression(util.runtimeProperty("mark"), [node]));
  41144. path.addComment("leading", "#__PURE__");
  41145. }
  41146. // Generators are processed in 'exit' handlers so that regenerator only has to run on
  41147. // an ES5 AST, but that means traversal will not pick up newly inserted references
  41148. // to things like 'regeneratorRuntime'. To avoid this, we explicitly requeue.
  41149. path.requeue();
  41150. }
  41151. }
  41152. };
  41153. // Given a NodePath for a Function, return an Expression node that can be
  41154. // used to refer reliably to the function object from inside the function.
  41155. // This expression is essentially a replacement for arguments.callee, with
  41156. // the key advantage that it works in strict mode.
  41157. function getOuterFnExpr(funPath) {
  41158. var node = funPath.node;
  41159. t.assertFunction(node);
  41160. if (!node.id) {
  41161. // Default-exported function declarations, and function expressions may not
  41162. // have a name to reference, so we explicitly add one.
  41163. node.id = funPath.scope.parent.generateUidIdentifier("callee");
  41164. }
  41165. if (node.generator && // Non-generator functions don't need to be marked.
  41166. t.isFunctionDeclaration(node)) {
  41167. // Return the identifier returned by runtime.mark(<node.id>).
  41168. return getMarkedFunctionId(funPath);
  41169. }
  41170. return node.id;
  41171. }
  41172. var getMarkInfo = require("private").makeAccessor();
  41173. function getMarkedFunctionId(funPath) {
  41174. var node = funPath.node;
  41175. t.assertIdentifier(node.id);
  41176. var blockPath = funPath.findParent(function (path) {
  41177. return path.isProgram() || path.isBlockStatement();
  41178. });
  41179. if (!blockPath) {
  41180. return node.id;
  41181. }
  41182. var block = blockPath.node;
  41183. _assert2.default.ok(Array.isArray(block.body));
  41184. var info = getMarkInfo(block);
  41185. if (!info.decl) {
  41186. info.decl = t.variableDeclaration("var", []);
  41187. blockPath.unshiftContainer("body", info.decl);
  41188. info.declPath = blockPath.get("body.0");
  41189. }
  41190. _assert2.default.strictEqual(info.declPath.node, info.decl);
  41191. // Get a new unique identifier for our marked variable.
  41192. var markedId = blockPath.scope.generateUidIdentifier("marked");
  41193. var markCallExp = t.callExpression(util.runtimeProperty("mark"), [node.id]);
  41194. var index = info.decl.declarations.push(t.variableDeclarator(markedId, markCallExp)) - 1;
  41195. var markCallExpPath = info.declPath.get("declarations." + index + ".init");
  41196. _assert2.default.strictEqual(markCallExpPath.node, markCallExp);
  41197. markCallExpPath.addComment("leading", "#__PURE__");
  41198. return markedId;
  41199. }
  41200. function renameArguments(funcPath, argsId) {
  41201. var state = {
  41202. didRenameArguments: false,
  41203. argsId: argsId
  41204. };
  41205. funcPath.traverse(argumentsVisitor, state);
  41206. // If the traversal replaced any arguments references, then we need to
  41207. // alias the outer function's arguments binding (be it the implicit
  41208. // arguments object or some other parameter or variable) to the variable
  41209. // named by argsId.
  41210. return state.didRenameArguments;
  41211. }
  41212. var argumentsVisitor = {
  41213. "FunctionExpression|FunctionDeclaration": function FunctionExpressionFunctionDeclaration(path) {
  41214. path.skip();
  41215. },
  41216. Identifier: function Identifier(path, state) {
  41217. if (path.node.name === "arguments" && util.isReference(path)) {
  41218. util.replaceWithOrRemove(path, state.argsId);
  41219. state.didRenameArguments = true;
  41220. }
  41221. }
  41222. };
  41223. var functionSentVisitor = {
  41224. MetaProperty: function MetaProperty(path) {
  41225. var node = path.node;
  41226. if (node.meta.name === "function" && node.property.name === "sent") {
  41227. util.replaceWithOrRemove(path, t.memberExpression(this.context, t.identifier("_sent")));
  41228. }
  41229. }
  41230. };
  41231. var awaitVisitor = {
  41232. Function: function Function(path) {
  41233. path.skip(); // Don't descend into nested function scopes.
  41234. },
  41235. AwaitExpression: function AwaitExpression(path) {
  41236. // Convert await expressions to yield expressions.
  41237. var argument = path.node.argument;
  41238. // Transforming `await x` to `yield regeneratorRuntime.awrap(x)`
  41239. // causes the argument to be wrapped in such a way that the runtime
  41240. // can distinguish between awaited and merely yielded values.
  41241. util.replaceWithOrRemove(path, t.yieldExpression(t.callExpression(util.runtimeProperty("awrap"), [argument]), false));
  41242. }
  41243. };
  41244. },{"./emit":527,"./hoist":528,"./replaceShorthandObjectMethod":532,"./util":533,"assert":3,"babel-types":151,"private":524}],535:[function(require,module,exports){
  41245. // Generated by `/scripts/character-class-escape-sets.js`. Do not edit.
  41246. var regenerate = require('regenerate');
  41247. exports.REGULAR = {
  41248. 'd': regenerate()
  41249. .addRange(0x30, 0x39),
  41250. 'D': regenerate()
  41251. .addRange(0x0, 0x2F)
  41252. .addRange(0x3A, 0xFFFF),
  41253. 's': regenerate(0x20, 0xA0, 0x1680, 0x202F, 0x205F, 0x3000, 0xFEFF)
  41254. .addRange(0x9, 0xD)
  41255. .addRange(0x2000, 0x200A)
  41256. .addRange(0x2028, 0x2029),
  41257. 'S': regenerate()
  41258. .addRange(0x0, 0x8)
  41259. .addRange(0xE, 0x1F)
  41260. .addRange(0x21, 0x9F)
  41261. .addRange(0xA1, 0x167F)
  41262. .addRange(0x1681, 0x1FFF)
  41263. .addRange(0x200B, 0x2027)
  41264. .addRange(0x202A, 0x202E)
  41265. .addRange(0x2030, 0x205E)
  41266. .addRange(0x2060, 0x2FFF)
  41267. .addRange(0x3001, 0xFEFE)
  41268. .addRange(0xFF00, 0xFFFF),
  41269. 'w': regenerate(0x5F)
  41270. .addRange(0x30, 0x39)
  41271. .addRange(0x41, 0x5A)
  41272. .addRange(0x61, 0x7A),
  41273. 'W': regenerate(0x60)
  41274. .addRange(0x0, 0x2F)
  41275. .addRange(0x3A, 0x40)
  41276. .addRange(0x5B, 0x5E)
  41277. .addRange(0x7B, 0xFFFF)
  41278. };
  41279. exports.UNICODE = {
  41280. 'd': regenerate()
  41281. .addRange(0x30, 0x39),
  41282. 'D': regenerate()
  41283. .addRange(0x0, 0x2F)
  41284. .addRange(0x3A, 0x10FFFF),
  41285. 's': regenerate(0x20, 0xA0, 0x1680, 0x202F, 0x205F, 0x3000, 0xFEFF)
  41286. .addRange(0x9, 0xD)
  41287. .addRange(0x2000, 0x200A)
  41288. .addRange(0x2028, 0x2029),
  41289. 'S': regenerate()
  41290. .addRange(0x0, 0x8)
  41291. .addRange(0xE, 0x1F)
  41292. .addRange(0x21, 0x9F)
  41293. .addRange(0xA1, 0x167F)
  41294. .addRange(0x1681, 0x1FFF)
  41295. .addRange(0x200B, 0x2027)
  41296. .addRange(0x202A, 0x202E)
  41297. .addRange(0x2030, 0x205E)
  41298. .addRange(0x2060, 0x2FFF)
  41299. .addRange(0x3001, 0xFEFE)
  41300. .addRange(0xFF00, 0x10FFFF),
  41301. 'w': regenerate(0x5F)
  41302. .addRange(0x30, 0x39)
  41303. .addRange(0x41, 0x5A)
  41304. .addRange(0x61, 0x7A),
  41305. 'W': regenerate(0x60)
  41306. .addRange(0x0, 0x2F)
  41307. .addRange(0x3A, 0x40)
  41308. .addRange(0x5B, 0x5E)
  41309. .addRange(0x7B, 0x10FFFF)
  41310. };
  41311. exports.UNICODE_IGNORE_CASE = {
  41312. 'd': regenerate()
  41313. .addRange(0x30, 0x39),
  41314. 'D': regenerate()
  41315. .addRange(0x0, 0x2F)
  41316. .addRange(0x3A, 0x10FFFF),
  41317. 's': regenerate(0x20, 0xA0, 0x1680, 0x202F, 0x205F, 0x3000, 0xFEFF)
  41318. .addRange(0x9, 0xD)
  41319. .addRange(0x2000, 0x200A)
  41320. .addRange(0x2028, 0x2029),
  41321. 'S': regenerate()
  41322. .addRange(0x0, 0x8)
  41323. .addRange(0xE, 0x1F)
  41324. .addRange(0x21, 0x9F)
  41325. .addRange(0xA1, 0x167F)
  41326. .addRange(0x1681, 0x1FFF)
  41327. .addRange(0x200B, 0x2027)
  41328. .addRange(0x202A, 0x202E)
  41329. .addRange(0x2030, 0x205E)
  41330. .addRange(0x2060, 0x2FFF)
  41331. .addRange(0x3001, 0xFEFE)
  41332. .addRange(0xFF00, 0x10FFFF),
  41333. 'w': regenerate(0x5F, 0x17F, 0x212A)
  41334. .addRange(0x30, 0x39)
  41335. .addRange(0x41, 0x5A)
  41336. .addRange(0x61, 0x7A),
  41337. 'W': regenerate(0x4B, 0x53, 0x60)
  41338. .addRange(0x0, 0x2F)
  41339. .addRange(0x3A, 0x40)
  41340. .addRange(0x5B, 0x5E)
  41341. .addRange(0x7B, 0x10FFFF)
  41342. };
  41343. },{"regenerate":526}],536:[function(require,module,exports){
  41344. module.exports={
  41345. "75": 8490,
  41346. "83": 383,
  41347. "107": 8490,
  41348. "115": 383,
  41349. "181": 924,
  41350. "197": 8491,
  41351. "383": 83,
  41352. "452": 453,
  41353. "453": 452,
  41354. "455": 456,
  41355. "456": 455,
  41356. "458": 459,
  41357. "459": 458,
  41358. "497": 498,
  41359. "498": 497,
  41360. "837": 8126,
  41361. "914": 976,
  41362. "917": 1013,
  41363. "920": 1012,
  41364. "921": 8126,
  41365. "922": 1008,
  41366. "924": 181,
  41367. "928": 982,
  41368. "929": 1009,
  41369. "931": 962,
  41370. "934": 981,
  41371. "937": 8486,
  41372. "962": 931,
  41373. "976": 914,
  41374. "977": 1012,
  41375. "981": 934,
  41376. "982": 928,
  41377. "1008": 922,
  41378. "1009": 929,
  41379. "1012": [
  41380. 920,
  41381. 977
  41382. ],
  41383. "1013": 917,
  41384. "7776": 7835,
  41385. "7835": 7776,
  41386. "8126": [
  41387. 837,
  41388. 921
  41389. ],
  41390. "8486": 937,
  41391. "8490": 75,
  41392. "8491": 197,
  41393. "66560": 66600,
  41394. "66561": 66601,
  41395. "66562": 66602,
  41396. "66563": 66603,
  41397. "66564": 66604,
  41398. "66565": 66605,
  41399. "66566": 66606,
  41400. "66567": 66607,
  41401. "66568": 66608,
  41402. "66569": 66609,
  41403. "66570": 66610,
  41404. "66571": 66611,
  41405. "66572": 66612,
  41406. "66573": 66613,
  41407. "66574": 66614,
  41408. "66575": 66615,
  41409. "66576": 66616,
  41410. "66577": 66617,
  41411. "66578": 66618,
  41412. "66579": 66619,
  41413. "66580": 66620,
  41414. "66581": 66621,
  41415. "66582": 66622,
  41416. "66583": 66623,
  41417. "66584": 66624,
  41418. "66585": 66625,
  41419. "66586": 66626,
  41420. "66587": 66627,
  41421. "66588": 66628,
  41422. "66589": 66629,
  41423. "66590": 66630,
  41424. "66591": 66631,
  41425. "66592": 66632,
  41426. "66593": 66633,
  41427. "66594": 66634,
  41428. "66595": 66635,
  41429. "66596": 66636,
  41430. "66597": 66637,
  41431. "66598": 66638,
  41432. "66599": 66639,
  41433. "66600": 66560,
  41434. "66601": 66561,
  41435. "66602": 66562,
  41436. "66603": 66563,
  41437. "66604": 66564,
  41438. "66605": 66565,
  41439. "66606": 66566,
  41440. "66607": 66567,
  41441. "66608": 66568,
  41442. "66609": 66569,
  41443. "66610": 66570,
  41444. "66611": 66571,
  41445. "66612": 66572,
  41446. "66613": 66573,
  41447. "66614": 66574,
  41448. "66615": 66575,
  41449. "66616": 66576,
  41450. "66617": 66577,
  41451. "66618": 66578,
  41452. "66619": 66579,
  41453. "66620": 66580,
  41454. "66621": 66581,
  41455. "66622": 66582,
  41456. "66623": 66583,
  41457. "66624": 66584,
  41458. "66625": 66585,
  41459. "66626": 66586,
  41460. "66627": 66587,
  41461. "66628": 66588,
  41462. "66629": 66589,
  41463. "66630": 66590,
  41464. "66631": 66591,
  41465. "66632": 66592,
  41466. "66633": 66593,
  41467. "66634": 66594,
  41468. "66635": 66595,
  41469. "66636": 66596,
  41470. "66637": 66597,
  41471. "66638": 66598,
  41472. "66639": 66599,
  41473. "68736": 68800,
  41474. "68737": 68801,
  41475. "68738": 68802,
  41476. "68739": 68803,
  41477. "68740": 68804,
  41478. "68741": 68805,
  41479. "68742": 68806,
  41480. "68743": 68807,
  41481. "68744": 68808,
  41482. "68745": 68809,
  41483. "68746": 68810,
  41484. "68747": 68811,
  41485. "68748": 68812,
  41486. "68749": 68813,
  41487. "68750": 68814,
  41488. "68751": 68815,
  41489. "68752": 68816,
  41490. "68753": 68817,
  41491. "68754": 68818,
  41492. "68755": 68819,
  41493. "68756": 68820,
  41494. "68757": 68821,
  41495. "68758": 68822,
  41496. "68759": 68823,
  41497. "68760": 68824,
  41498. "68761": 68825,
  41499. "68762": 68826,
  41500. "68763": 68827,
  41501. "68764": 68828,
  41502. "68765": 68829,
  41503. "68766": 68830,
  41504. "68767": 68831,
  41505. "68768": 68832,
  41506. "68769": 68833,
  41507. "68770": 68834,
  41508. "68771": 68835,
  41509. "68772": 68836,
  41510. "68773": 68837,
  41511. "68774": 68838,
  41512. "68775": 68839,
  41513. "68776": 68840,
  41514. "68777": 68841,
  41515. "68778": 68842,
  41516. "68779": 68843,
  41517. "68780": 68844,
  41518. "68781": 68845,
  41519. "68782": 68846,
  41520. "68783": 68847,
  41521. "68784": 68848,
  41522. "68785": 68849,
  41523. "68786": 68850,
  41524. "68800": 68736,
  41525. "68801": 68737,
  41526. "68802": 68738,
  41527. "68803": 68739,
  41528. "68804": 68740,
  41529. "68805": 68741,
  41530. "68806": 68742,
  41531. "68807": 68743,
  41532. "68808": 68744,
  41533. "68809": 68745,
  41534. "68810": 68746,
  41535. "68811": 68747,
  41536. "68812": 68748,
  41537. "68813": 68749,
  41538. "68814": 68750,
  41539. "68815": 68751,
  41540. "68816": 68752,
  41541. "68817": 68753,
  41542. "68818": 68754,
  41543. "68819": 68755,
  41544. "68820": 68756,
  41545. "68821": 68757,
  41546. "68822": 68758,
  41547. "68823": 68759,
  41548. "68824": 68760,
  41549. "68825": 68761,
  41550. "68826": 68762,
  41551. "68827": 68763,
  41552. "68828": 68764,
  41553. "68829": 68765,
  41554. "68830": 68766,
  41555. "68831": 68767,
  41556. "68832": 68768,
  41557. "68833": 68769,
  41558. "68834": 68770,
  41559. "68835": 68771,
  41560. "68836": 68772,
  41561. "68837": 68773,
  41562. "68838": 68774,
  41563. "68839": 68775,
  41564. "68840": 68776,
  41565. "68841": 68777,
  41566. "68842": 68778,
  41567. "68843": 68779,
  41568. "68844": 68780,
  41569. "68845": 68781,
  41570. "68846": 68782,
  41571. "68847": 68783,
  41572. "68848": 68784,
  41573. "68849": 68785,
  41574. "68850": 68786,
  41575. "71840": 71872,
  41576. "71841": 71873,
  41577. "71842": 71874,
  41578. "71843": 71875,
  41579. "71844": 71876,
  41580. "71845": 71877,
  41581. "71846": 71878,
  41582. "71847": 71879,
  41583. "71848": 71880,
  41584. "71849": 71881,
  41585. "71850": 71882,
  41586. "71851": 71883,
  41587. "71852": 71884,
  41588. "71853": 71885,
  41589. "71854": 71886,
  41590. "71855": 71887,
  41591. "71856": 71888,
  41592. "71857": 71889,
  41593. "71858": 71890,
  41594. "71859": 71891,
  41595. "71860": 71892,
  41596. "71861": 71893,
  41597. "71862": 71894,
  41598. "71863": 71895,
  41599. "71864": 71896,
  41600. "71865": 71897,
  41601. "71866": 71898,
  41602. "71867": 71899,
  41603. "71868": 71900,
  41604. "71869": 71901,
  41605. "71870": 71902,
  41606. "71871": 71903,
  41607. "71872": 71840,
  41608. "71873": 71841,
  41609. "71874": 71842,
  41610. "71875": 71843,
  41611. "71876": 71844,
  41612. "71877": 71845,
  41613. "71878": 71846,
  41614. "71879": 71847,
  41615. "71880": 71848,
  41616. "71881": 71849,
  41617. "71882": 71850,
  41618. "71883": 71851,
  41619. "71884": 71852,
  41620. "71885": 71853,
  41621. "71886": 71854,
  41622. "71887": 71855,
  41623. "71888": 71856,
  41624. "71889": 71857,
  41625. "71890": 71858,
  41626. "71891": 71859,
  41627. "71892": 71860,
  41628. "71893": 71861,
  41629. "71894": 71862,
  41630. "71895": 71863,
  41631. "71896": 71864,
  41632. "71897": 71865,
  41633. "71898": 71866,
  41634. "71899": 71867,
  41635. "71900": 71868,
  41636. "71901": 71869,
  41637. "71902": 71870,
  41638. "71903": 71871
  41639. }
  41640. },{}],537:[function(require,module,exports){
  41641. var generate = require('regjsgen').generate;
  41642. var parse = require('regjsparser').parse;
  41643. var regenerate = require('regenerate');
  41644. var iuMappings = require('./data/iu-mappings.json');
  41645. var ESCAPE_SETS = require('./data/character-class-escape-sets.js');
  41646. function getCharacterClassEscapeSet(character) {
  41647. if (unicode) {
  41648. if (ignoreCase) {
  41649. return ESCAPE_SETS.UNICODE_IGNORE_CASE[character];
  41650. }
  41651. return ESCAPE_SETS.UNICODE[character];
  41652. }
  41653. return ESCAPE_SETS.REGULAR[character];
  41654. }
  41655. var object = {};
  41656. var hasOwnProperty = object.hasOwnProperty;
  41657. function has(object, property) {
  41658. return hasOwnProperty.call(object, property);
  41659. }
  41660. // Prepare a Regenerate set containing all code points, used for negative
  41661. // character classes (if any).
  41662. var UNICODE_SET = regenerate().addRange(0x0, 0x10FFFF);
  41663. // Without the `u` flag, the range stops at 0xFFFF.
  41664. // https://mths.be/es6#sec-pattern-semantics
  41665. var BMP_SET = regenerate().addRange(0x0, 0xFFFF);
  41666. // Prepare a Regenerate set containing all code points that are supposed to be
  41667. // matched by `/./u`. https://mths.be/es6#sec-atom
  41668. var DOT_SET_UNICODE = UNICODE_SET.clone() // all Unicode code points
  41669. .remove(
  41670. // minus `LineTerminator`s (https://mths.be/es6#sec-line-terminators):
  41671. 0x000A, // Line Feed <LF>
  41672. 0x000D, // Carriage Return <CR>
  41673. 0x2028, // Line Separator <LS>
  41674. 0x2029 // Paragraph Separator <PS>
  41675. );
  41676. // Prepare a Regenerate set containing all code points that are supposed to be
  41677. // matched by `/./` (only BMP code points).
  41678. var DOT_SET = DOT_SET_UNICODE.clone()
  41679. .intersection(BMP_SET);
  41680. // Add a range of code points + any case-folded code points in that range to a
  41681. // set.
  41682. regenerate.prototype.iuAddRange = function(min, max) {
  41683. var $this = this;
  41684. do {
  41685. var folded = caseFold(min);
  41686. if (folded) {
  41687. $this.add(folded);
  41688. }
  41689. } while (++min <= max);
  41690. return $this;
  41691. };
  41692. function assign(target, source) {
  41693. for (var key in source) {
  41694. // Note: `hasOwnProperty` is not needed here.
  41695. target[key] = source[key];
  41696. }
  41697. }
  41698. function update(item, pattern) {
  41699. // TODO: Test if memoizing `pattern` here is worth the effort.
  41700. if (!pattern) {
  41701. return;
  41702. }
  41703. var tree = parse(pattern, '');
  41704. switch (tree.type) {
  41705. case 'characterClass':
  41706. case 'group':
  41707. case 'value':
  41708. // No wrapping needed.
  41709. break;
  41710. default:
  41711. // Wrap the pattern in a non-capturing group.
  41712. tree = wrap(tree, pattern);
  41713. }
  41714. assign(item, tree);
  41715. }
  41716. function wrap(tree, pattern) {
  41717. // Wrap the pattern in a non-capturing group.
  41718. return {
  41719. 'type': 'group',
  41720. 'behavior': 'ignore',
  41721. 'body': [tree],
  41722. 'raw': '(?:' + pattern + ')'
  41723. };
  41724. }
  41725. function caseFold(codePoint) {
  41726. return has(iuMappings, codePoint) ? iuMappings[codePoint] : false;
  41727. }
  41728. var ignoreCase = false;
  41729. var unicode = false;
  41730. function processCharacterClass(characterClassItem) {
  41731. var set = regenerate();
  41732. var body = characterClassItem.body.forEach(function(item) {
  41733. switch (item.type) {
  41734. case 'value':
  41735. set.add(item.codePoint);
  41736. if (ignoreCase && unicode) {
  41737. var folded = caseFold(item.codePoint);
  41738. if (folded) {
  41739. set.add(folded);
  41740. }
  41741. }
  41742. break;
  41743. case 'characterClassRange':
  41744. var min = item.min.codePoint;
  41745. var max = item.max.codePoint;
  41746. set.addRange(min, max);
  41747. if (ignoreCase && unicode) {
  41748. set.iuAddRange(min, max);
  41749. }
  41750. break;
  41751. case 'characterClassEscape':
  41752. set.add(getCharacterClassEscapeSet(item.value));
  41753. break;
  41754. // The `default` clause is only here as a safeguard; it should never be
  41755. // reached. Code coverage tools should ignore it.
  41756. /* istanbul ignore next */
  41757. default:
  41758. throw Error('Unknown term type: ' + item.type);
  41759. }
  41760. });
  41761. if (characterClassItem.negative) {
  41762. set = (unicode ? UNICODE_SET : BMP_SET).clone().remove(set);
  41763. }
  41764. update(characterClassItem, set.toString());
  41765. return characterClassItem;
  41766. }
  41767. function processTerm(item) {
  41768. switch (item.type) {
  41769. case 'dot':
  41770. update(
  41771. item,
  41772. (unicode ? DOT_SET_UNICODE : DOT_SET).toString()
  41773. );
  41774. break;
  41775. case 'characterClass':
  41776. item = processCharacterClass(item);
  41777. break;
  41778. case 'characterClassEscape':
  41779. update(
  41780. item,
  41781. getCharacterClassEscapeSet(item.value).toString()
  41782. );
  41783. break;
  41784. case 'alternative':
  41785. case 'disjunction':
  41786. case 'group':
  41787. case 'quantifier':
  41788. item.body = item.body.map(processTerm);
  41789. break;
  41790. case 'value':
  41791. var codePoint = item.codePoint;
  41792. var set = regenerate(codePoint);
  41793. if (ignoreCase && unicode) {
  41794. var folded = caseFold(codePoint);
  41795. if (folded) {
  41796. set.add(folded);
  41797. }
  41798. }
  41799. update(item, set.toString());
  41800. break;
  41801. case 'anchor':
  41802. case 'empty':
  41803. case 'group':
  41804. case 'reference':
  41805. // Nothing to do here.
  41806. break;
  41807. // The `default` clause is only here as a safeguard; it should never be
  41808. // reached. Code coverage tools should ignore it.
  41809. /* istanbul ignore next */
  41810. default:
  41811. throw Error('Unknown term type: ' + item.type);
  41812. }
  41813. return item;
  41814. };
  41815. module.exports = function(pattern, flags) {
  41816. var tree = parse(pattern, flags);
  41817. ignoreCase = flags ? flags.indexOf('i') > -1 : false;
  41818. unicode = flags ? flags.indexOf('u') > -1 : false;
  41819. assign(tree, processTerm(tree));
  41820. return generate(tree);
  41821. };
  41822. },{"./data/character-class-escape-sets.js":535,"./data/iu-mappings.json":536,"regenerate":526,"regjsgen":538,"regjsparser":539}],538:[function(require,module,exports){
  41823. (function (global){
  41824. /*!
  41825. * RegJSGen
  41826. * Copyright 2014 Benjamin Tan <https://d10.github.io/>
  41827. * Available under MIT license <http://d10.mit-license.org/>
  41828. */
  41829. ;(function() {
  41830. 'use strict';
  41831. /** Used to determine if values are of the language type `Object` */
  41832. var objectTypes = {
  41833. 'function': true,
  41834. 'object': true
  41835. };
  41836. /** Used as a reference to the global object */
  41837. var root = (objectTypes[typeof window] && window) || this;
  41838. /** Backup possible global object */
  41839. var oldRoot = root;
  41840. /** Detect free variable `exports` */
  41841. var freeExports = objectTypes[typeof exports] && exports;
  41842. /** Detect free variable `module` */
  41843. var freeModule = objectTypes[typeof module] && module && !module.nodeType && module;
  41844. /** Detect free variable `global` from Node.js or Browserified code and use it as `root` */
  41845. var freeGlobal = freeExports && freeModule && typeof global == 'object' && global;
  41846. if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) {
  41847. root = freeGlobal;
  41848. }
  41849. /*--------------------------------------------------------------------------*/
  41850. /*! Based on https://mths.be/fromcodepoint v0.2.0 by @mathias */
  41851. var stringFromCharCode = String.fromCharCode;
  41852. var floor = Math.floor;
  41853. function fromCodePoint() {
  41854. var MAX_SIZE = 0x4000;
  41855. var codeUnits = [];
  41856. var highSurrogate;
  41857. var lowSurrogate;
  41858. var index = -1;
  41859. var length = arguments.length;
  41860. if (!length) {
  41861. return '';
  41862. }
  41863. var result = '';
  41864. while (++index < length) {
  41865. var codePoint = Number(arguments[index]);
  41866. if (
  41867. !isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`
  41868. codePoint < 0 || // not a valid Unicode code point
  41869. codePoint > 0x10FFFF || // not a valid Unicode code point
  41870. floor(codePoint) != codePoint // not an integer
  41871. ) {
  41872. throw RangeError('Invalid code point: ' + codePoint);
  41873. }
  41874. if (codePoint <= 0xFFFF) {
  41875. // BMP code point
  41876. codeUnits.push(codePoint);
  41877. } else {
  41878. // Astral code point; split in surrogate halves
  41879. // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  41880. codePoint -= 0x10000;
  41881. highSurrogate = (codePoint >> 10) + 0xD800;
  41882. lowSurrogate = (codePoint % 0x400) + 0xDC00;
  41883. codeUnits.push(highSurrogate, lowSurrogate);
  41884. }
  41885. if (index + 1 == length || codeUnits.length > MAX_SIZE) {
  41886. result += stringFromCharCode.apply(null, codeUnits);
  41887. codeUnits.length = 0;
  41888. }
  41889. }
  41890. return result;
  41891. }
  41892. function assertType(type, expected) {
  41893. if (expected.indexOf('|') == -1) {
  41894. if (type == expected) {
  41895. return;
  41896. }
  41897. throw Error('Invalid node type: ' + type);
  41898. }
  41899. expected = assertType.hasOwnProperty(expected)
  41900. ? assertType[expected]
  41901. : (assertType[expected] = RegExp('^(?:' + expected + ')$'));
  41902. if (expected.test(type)) {
  41903. return;
  41904. }
  41905. throw Error('Invalid node type: ' + type);
  41906. }
  41907. /*--------------------------------------------------------------------------*/
  41908. function generate(node) {
  41909. var type = node.type;
  41910. if (generate.hasOwnProperty(type) && typeof generate[type] == 'function') {
  41911. return generate[type](node);
  41912. }
  41913. throw Error('Invalid node type: ' + type);
  41914. }
  41915. /*--------------------------------------------------------------------------*/
  41916. function generateAlternative(node) {
  41917. assertType(node.type, 'alternative');
  41918. var terms = node.body,
  41919. length = terms ? terms.length : 0;
  41920. if (length == 1) {
  41921. return generateTerm(terms[0]);
  41922. } else {
  41923. var i = -1,
  41924. result = '';
  41925. while (++i < length) {
  41926. result += generateTerm(terms[i]);
  41927. }
  41928. return result;
  41929. }
  41930. }
  41931. function generateAnchor(node) {
  41932. assertType(node.type, 'anchor');
  41933. switch (node.kind) {
  41934. case 'start':
  41935. return '^';
  41936. case 'end':
  41937. return '$';
  41938. case 'boundary':
  41939. return '\\b';
  41940. case 'not-boundary':
  41941. return '\\B';
  41942. default:
  41943. throw Error('Invalid assertion');
  41944. }
  41945. }
  41946. function generateAtom(node) {
  41947. assertType(node.type, 'anchor|characterClass|characterClassEscape|dot|group|reference|value');
  41948. return generate(node);
  41949. }
  41950. function generateCharacterClass(node) {
  41951. assertType(node.type, 'characterClass');
  41952. var classRanges = node.body,
  41953. length = classRanges ? classRanges.length : 0;
  41954. var i = -1,
  41955. result = '[';
  41956. if (node.negative) {
  41957. result += '^';
  41958. }
  41959. while (++i < length) {
  41960. result += generateClassAtom(classRanges[i]);
  41961. }
  41962. result += ']';
  41963. return result;
  41964. }
  41965. function generateCharacterClassEscape(node) {
  41966. assertType(node.type, 'characterClassEscape');
  41967. return '\\' + node.value;
  41968. }
  41969. function generateCharacterClassRange(node) {
  41970. assertType(node.type, 'characterClassRange');
  41971. var min = node.min,
  41972. max = node.max;
  41973. if (min.type == 'characterClassRange' || max.type == 'characterClassRange') {
  41974. throw Error('Invalid character class range');
  41975. }
  41976. return generateClassAtom(min) + '-' + generateClassAtom(max);
  41977. }
  41978. function generateClassAtom(node) {
  41979. assertType(node.type, 'anchor|characterClassEscape|characterClassRange|dot|value');
  41980. return generate(node);
  41981. }
  41982. function generateDisjunction(node) {
  41983. assertType(node.type, 'disjunction');
  41984. var body = node.body,
  41985. length = body ? body.length : 0;
  41986. if (length == 0) {
  41987. throw Error('No body');
  41988. } else if (length == 1) {
  41989. return generate(body[0]);
  41990. } else {
  41991. var i = -1,
  41992. result = '';
  41993. while (++i < length) {
  41994. if (i != 0) {
  41995. result += '|';
  41996. }
  41997. result += generate(body[i]);
  41998. }
  41999. return result;
  42000. }
  42001. }
  42002. function generateDot(node) {
  42003. assertType(node.type, 'dot');
  42004. return '.';
  42005. }
  42006. function generateGroup(node) {
  42007. assertType(node.type, 'group');
  42008. var result = '(';
  42009. switch (node.behavior) {
  42010. case 'normal':
  42011. break;
  42012. case 'ignore':
  42013. result += '?:';
  42014. break;
  42015. case 'lookahead':
  42016. result += '?=';
  42017. break;
  42018. case 'negativeLookahead':
  42019. result += '?!';
  42020. break;
  42021. default:
  42022. throw Error('Invalid behaviour: ' + node.behaviour);
  42023. }
  42024. var body = node.body,
  42025. length = body ? body.length : 0;
  42026. if (length == 1) {
  42027. result += generate(body[0]);
  42028. } else {
  42029. var i = -1;
  42030. while (++i < length) {
  42031. result += generate(body[i]);
  42032. }
  42033. }
  42034. result += ')';
  42035. return result;
  42036. }
  42037. function generateQuantifier(node) {
  42038. assertType(node.type, 'quantifier');
  42039. var quantifier = '',
  42040. min = node.min,
  42041. max = node.max;
  42042. switch (max) {
  42043. case undefined:
  42044. case null:
  42045. switch (min) {
  42046. case 0:
  42047. quantifier = '*'
  42048. break;
  42049. case 1:
  42050. quantifier = '+';
  42051. break;
  42052. default:
  42053. quantifier = '{' + min + ',}';
  42054. break;
  42055. }
  42056. break;
  42057. default:
  42058. if (min == max) {
  42059. quantifier = '{' + min + '}';
  42060. }
  42061. else if (min == 0 && max == 1) {
  42062. quantifier = '?';
  42063. } else {
  42064. quantifier = '{' + min + ',' + max + '}';
  42065. }
  42066. break;
  42067. }
  42068. if (!node.greedy) {
  42069. quantifier += '?';
  42070. }
  42071. return generateAtom(node.body[0]) + quantifier;
  42072. }
  42073. function generateReference(node) {
  42074. assertType(node.type, 'reference');
  42075. return '\\' + node.matchIndex;
  42076. }
  42077. function generateTerm(node) {
  42078. assertType(node.type, 'anchor|characterClass|characterClassEscape|empty|group|quantifier|reference|value');
  42079. return generate(node);
  42080. }
  42081. function generateValue(node) {
  42082. assertType(node.type, 'value');
  42083. var kind = node.kind,
  42084. codePoint = node.codePoint;
  42085. switch (kind) {
  42086. case 'controlLetter':
  42087. return '\\c' + fromCodePoint(codePoint + 64);
  42088. case 'hexadecimalEscape':
  42089. return '\\x' + ('00' + codePoint.toString(16).toUpperCase()).slice(-2);
  42090. case 'identifier':
  42091. return '\\' + fromCodePoint(codePoint);
  42092. case 'null':
  42093. return '\\' + codePoint;
  42094. case 'octal':
  42095. return '\\' + codePoint.toString(8);
  42096. case 'singleEscape':
  42097. switch (codePoint) {
  42098. case 0x0008:
  42099. return '\\b';
  42100. case 0x009:
  42101. return '\\t';
  42102. case 0x00A:
  42103. return '\\n';
  42104. case 0x00B:
  42105. return '\\v';
  42106. case 0x00C:
  42107. return '\\f';
  42108. case 0x00D:
  42109. return '\\r';
  42110. default:
  42111. throw Error('Invalid codepoint: ' + codePoint);
  42112. }
  42113. case 'symbol':
  42114. return fromCodePoint(codePoint);
  42115. case 'unicodeEscape':
  42116. return '\\u' + ('0000' + codePoint.toString(16).toUpperCase()).slice(-4);
  42117. case 'unicodeCodePointEscape':
  42118. return '\\u{' + codePoint.toString(16).toUpperCase() + '}';
  42119. default:
  42120. throw Error('Unsupported node kind: ' + kind);
  42121. }
  42122. }
  42123. /*--------------------------------------------------------------------------*/
  42124. generate.alternative = generateAlternative;
  42125. generate.anchor = generateAnchor;
  42126. generate.characterClass = generateCharacterClass;
  42127. generate.characterClassEscape = generateCharacterClassEscape;
  42128. generate.characterClassRange = generateCharacterClassRange;
  42129. generate.disjunction = generateDisjunction;
  42130. generate.dot = generateDot;
  42131. generate.group = generateGroup;
  42132. generate.quantifier = generateQuantifier;
  42133. generate.reference = generateReference;
  42134. generate.value = generateValue;
  42135. /*--------------------------------------------------------------------------*/
  42136. // export regjsgen
  42137. // some AMD build optimizers, like r.js, check for condition patterns like the following:
  42138. if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
  42139. // define as an anonymous module so, through path mapping, it can be aliased
  42140. define(function() {
  42141. return {
  42142. 'generate': generate
  42143. };
  42144. });
  42145. }
  42146. // check for `exports` after `define` in case a build optimizer adds an `exports` object
  42147. else if (freeExports && freeModule) {
  42148. // in Narwhal, Node.js, Rhino -require, or RingoJS
  42149. freeExports.generate = generate;
  42150. }
  42151. // in a browser or Rhino
  42152. else {
  42153. root.regjsgen = {
  42154. 'generate': generate
  42155. };
  42156. }
  42157. }.call(this));
  42158. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  42159. },{}],539:[function(require,module,exports){
  42160. // regjsparser
  42161. //
  42162. // ==================================================================
  42163. //
  42164. // See ECMA-262 Standard: 15.10.1
  42165. //
  42166. // NOTE: The ECMA-262 standard uses the term "Assertion" for /^/. Here the
  42167. // term "Anchor" is used.
  42168. //
  42169. // Pattern ::
  42170. // Disjunction
  42171. //
  42172. // Disjunction ::
  42173. // Alternative
  42174. // Alternative | Disjunction
  42175. //
  42176. // Alternative ::
  42177. // [empty]
  42178. // Alternative Term
  42179. //
  42180. // Term ::
  42181. // Anchor
  42182. // Atom
  42183. // Atom Quantifier
  42184. //
  42185. // Anchor ::
  42186. // ^
  42187. // $
  42188. // \ b
  42189. // \ B
  42190. // ( ? = Disjunction )
  42191. // ( ? ! Disjunction )
  42192. //
  42193. // Quantifier ::
  42194. // QuantifierPrefix
  42195. // QuantifierPrefix ?
  42196. //
  42197. // QuantifierPrefix ::
  42198. // *
  42199. // +
  42200. // ?
  42201. // { DecimalDigits }
  42202. // { DecimalDigits , }
  42203. // { DecimalDigits , DecimalDigits }
  42204. //
  42205. // Atom ::
  42206. // PatternCharacter
  42207. // .
  42208. // \ AtomEscape
  42209. // CharacterClass
  42210. // ( Disjunction )
  42211. // ( ? : Disjunction )
  42212. //
  42213. // PatternCharacter ::
  42214. // SourceCharacter but not any of: ^ $ \ . * + ? ( ) [ ] { } |
  42215. //
  42216. // AtomEscape ::
  42217. // DecimalEscape
  42218. // CharacterEscape
  42219. // CharacterClassEscape
  42220. //
  42221. // CharacterEscape[U] ::
  42222. // ControlEscape
  42223. // c ControlLetter
  42224. // HexEscapeSequence
  42225. // RegExpUnicodeEscapeSequence[?U] (ES6)
  42226. // IdentityEscape[?U]
  42227. //
  42228. // ControlEscape ::
  42229. // one of f n r t v
  42230. // ControlLetter ::
  42231. // one of
  42232. // a b c d e f g h i j k l m n o p q r s t u v w x y z
  42233. // A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
  42234. //
  42235. // IdentityEscape ::
  42236. // SourceCharacter but not IdentifierPart
  42237. // <ZWJ>
  42238. // <ZWNJ>
  42239. //
  42240. // DecimalEscape ::
  42241. // DecimalIntegerLiteral [lookahead ∉ DecimalDigit]
  42242. //
  42243. // CharacterClassEscape ::
  42244. // one of d D s S w W
  42245. //
  42246. // CharacterClass ::
  42247. // [ [lookahead ∉ {^}] ClassRanges ]
  42248. // [ ^ ClassRanges ]
  42249. //
  42250. // ClassRanges ::
  42251. // [empty]
  42252. // NonemptyClassRanges
  42253. //
  42254. // NonemptyClassRanges ::
  42255. // ClassAtom
  42256. // ClassAtom NonemptyClassRangesNoDash
  42257. // ClassAtom - ClassAtom ClassRanges
  42258. //
  42259. // NonemptyClassRangesNoDash ::
  42260. // ClassAtom
  42261. // ClassAtomNoDash NonemptyClassRangesNoDash
  42262. // ClassAtomNoDash - ClassAtom ClassRanges
  42263. //
  42264. // ClassAtom ::
  42265. // -
  42266. // ClassAtomNoDash
  42267. //
  42268. // ClassAtomNoDash ::
  42269. // SourceCharacter but not one of \ or ] or -
  42270. // \ ClassEscape
  42271. //
  42272. // ClassEscape ::
  42273. // DecimalEscape
  42274. // b
  42275. // CharacterEscape
  42276. // CharacterClassEscape
  42277. (function() {
  42278. function parse(str, flags) {
  42279. function addRaw(node) {
  42280. node.raw = str.substring(node.range[0], node.range[1]);
  42281. return node;
  42282. }
  42283. function updateRawStart(node, start) {
  42284. node.range[0] = start;
  42285. return addRaw(node);
  42286. }
  42287. function createAnchor(kind, rawLength) {
  42288. return addRaw({
  42289. type: 'anchor',
  42290. kind: kind,
  42291. range: [
  42292. pos - rawLength,
  42293. pos
  42294. ]
  42295. });
  42296. }
  42297. function createValue(kind, codePoint, from, to) {
  42298. return addRaw({
  42299. type: 'value',
  42300. kind: kind,
  42301. codePoint: codePoint,
  42302. range: [from, to]
  42303. });
  42304. }
  42305. function createEscaped(kind, codePoint, value, fromOffset) {
  42306. fromOffset = fromOffset || 0;
  42307. return createValue(kind, codePoint, pos - (value.length + fromOffset), pos);
  42308. }
  42309. function createCharacter(matches) {
  42310. var _char = matches[0];
  42311. var first = _char.charCodeAt(0);
  42312. if (hasUnicodeFlag) {
  42313. var second;
  42314. if (_char.length === 1 && first >= 0xD800 && first <= 0xDBFF) {
  42315. second = lookahead().charCodeAt(0);
  42316. if (second >= 0xDC00 && second <= 0xDFFF) {
  42317. // Unicode surrogate pair
  42318. pos++;
  42319. return createValue(
  42320. 'symbol',
  42321. (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000,
  42322. pos - 2, pos);
  42323. }
  42324. }
  42325. }
  42326. return createValue('symbol', first, pos - 1, pos);
  42327. }
  42328. function createDisjunction(alternatives, from, to) {
  42329. return addRaw({
  42330. type: 'disjunction',
  42331. body: alternatives,
  42332. range: [
  42333. from,
  42334. to
  42335. ]
  42336. });
  42337. }
  42338. function createDot() {
  42339. return addRaw({
  42340. type: 'dot',
  42341. range: [
  42342. pos - 1,
  42343. pos
  42344. ]
  42345. });
  42346. }
  42347. function createCharacterClassEscape(value) {
  42348. return addRaw({
  42349. type: 'characterClassEscape',
  42350. value: value,
  42351. range: [
  42352. pos - 2,
  42353. pos
  42354. ]
  42355. });
  42356. }
  42357. function createReference(matchIndex) {
  42358. return addRaw({
  42359. type: 'reference',
  42360. matchIndex: parseInt(matchIndex, 10),
  42361. range: [
  42362. pos - 1 - matchIndex.length,
  42363. pos
  42364. ]
  42365. });
  42366. }
  42367. function createGroup(behavior, disjunction, from, to) {
  42368. return addRaw({
  42369. type: 'group',
  42370. behavior: behavior,
  42371. body: disjunction,
  42372. range: [
  42373. from,
  42374. to
  42375. ]
  42376. });
  42377. }
  42378. function createQuantifier(min, max, from, to) {
  42379. if (to == null) {
  42380. from = pos - 1;
  42381. to = pos;
  42382. }
  42383. return addRaw({
  42384. type: 'quantifier',
  42385. min: min,
  42386. max: max,
  42387. greedy: true,
  42388. body: null, // set later on
  42389. range: [
  42390. from,
  42391. to
  42392. ]
  42393. });
  42394. }
  42395. function createAlternative(terms, from, to) {
  42396. return addRaw({
  42397. type: 'alternative',
  42398. body: terms,
  42399. range: [
  42400. from,
  42401. to
  42402. ]
  42403. });
  42404. }
  42405. function createCharacterClass(classRanges, negative, from, to) {
  42406. return addRaw({
  42407. type: 'characterClass',
  42408. body: classRanges,
  42409. negative: negative,
  42410. range: [
  42411. from,
  42412. to
  42413. ]
  42414. });
  42415. }
  42416. function createClassRange(min, max, from, to) {
  42417. // See 15.10.2.15:
  42418. if (min.codePoint > max.codePoint) {
  42419. bail('invalid range in character class', min.raw + '-' + max.raw, from, to);
  42420. }
  42421. return addRaw({
  42422. type: 'characterClassRange',
  42423. min: min,
  42424. max: max,
  42425. range: [
  42426. from,
  42427. to
  42428. ]
  42429. });
  42430. }
  42431. function flattenBody(body) {
  42432. if (body.type === 'alternative') {
  42433. return body.body;
  42434. } else {
  42435. return [body];
  42436. }
  42437. }
  42438. function isEmpty(obj) {
  42439. return obj.type === 'empty';
  42440. }
  42441. function incr(amount) {
  42442. amount = (amount || 1);
  42443. var res = str.substring(pos, pos + amount);
  42444. pos += (amount || 1);
  42445. return res;
  42446. }
  42447. function skip(value) {
  42448. if (!match(value)) {
  42449. bail('character', value);
  42450. }
  42451. }
  42452. function match(value) {
  42453. if (str.indexOf(value, pos) === pos) {
  42454. return incr(value.length);
  42455. }
  42456. }
  42457. function lookahead() {
  42458. return str[pos];
  42459. }
  42460. function current(value) {
  42461. return str.indexOf(value, pos) === pos;
  42462. }
  42463. function next(value) {
  42464. return str[pos + 1] === value;
  42465. }
  42466. function matchReg(regExp) {
  42467. var subStr = str.substring(pos);
  42468. var res = subStr.match(regExp);
  42469. if (res) {
  42470. res.range = [];
  42471. res.range[0] = pos;
  42472. incr(res[0].length);
  42473. res.range[1] = pos;
  42474. }
  42475. return res;
  42476. }
  42477. function parseDisjunction() {
  42478. // Disjunction ::
  42479. // Alternative
  42480. // Alternative | Disjunction
  42481. var res = [], from = pos;
  42482. res.push(parseAlternative());
  42483. while (match('|')) {
  42484. res.push(parseAlternative());
  42485. }
  42486. if (res.length === 1) {
  42487. return res[0];
  42488. }
  42489. return createDisjunction(res, from, pos);
  42490. }
  42491. function parseAlternative() {
  42492. var res = [], from = pos;
  42493. var term;
  42494. // Alternative ::
  42495. // [empty]
  42496. // Alternative Term
  42497. while (term = parseTerm()) {
  42498. res.push(term);
  42499. }
  42500. if (res.length === 1) {
  42501. return res[0];
  42502. }
  42503. return createAlternative(res, from, pos);
  42504. }
  42505. function parseTerm() {
  42506. // Term ::
  42507. // Anchor
  42508. // Atom
  42509. // Atom Quantifier
  42510. if (pos >= str.length || current('|') || current(')')) {
  42511. return null; /* Means: The term is empty */
  42512. }
  42513. var anchor = parseAnchor();
  42514. if (anchor) {
  42515. return anchor;
  42516. }
  42517. var atom = parseAtom();
  42518. if (!atom) {
  42519. bail('Expected atom');
  42520. }
  42521. var quantifier = parseQuantifier() || false;
  42522. if (quantifier) {
  42523. quantifier.body = flattenBody(atom);
  42524. // The quantifier contains the atom. Therefore, the beginning of the
  42525. // quantifier range is given by the beginning of the atom.
  42526. updateRawStart(quantifier, atom.range[0]);
  42527. return quantifier;
  42528. }
  42529. return atom;
  42530. }
  42531. function parseGroup(matchA, typeA, matchB, typeB) {
  42532. var type = null, from = pos;
  42533. if (match(matchA)) {
  42534. type = typeA;
  42535. } else if (match(matchB)) {
  42536. type = typeB;
  42537. } else {
  42538. return false;
  42539. }
  42540. var body = parseDisjunction();
  42541. if (!body) {
  42542. bail('Expected disjunction');
  42543. }
  42544. skip(')');
  42545. var group = createGroup(type, flattenBody(body), from, pos);
  42546. if (type == 'normal') {
  42547. // Keep track of the number of closed groups. This is required for
  42548. // parseDecimalEscape(). In case the string is parsed a second time the
  42549. // value already holds the total count and no incrementation is required.
  42550. if (firstIteration) {
  42551. closedCaptureCounter++;
  42552. }
  42553. }
  42554. return group;
  42555. }
  42556. function parseAnchor() {
  42557. // Anchor ::
  42558. // ^
  42559. // $
  42560. // \ b
  42561. // \ B
  42562. // ( ? = Disjunction )
  42563. // ( ? ! Disjunction )
  42564. var res, from = pos;
  42565. if (match('^')) {
  42566. return createAnchor('start', 1 /* rawLength */);
  42567. } else if (match('$')) {
  42568. return createAnchor('end', 1 /* rawLength */);
  42569. } else if (match('\\b')) {
  42570. return createAnchor('boundary', 2 /* rawLength */);
  42571. } else if (match('\\B')) {
  42572. return createAnchor('not-boundary', 2 /* rawLength */);
  42573. } else {
  42574. return parseGroup('(?=', 'lookahead', '(?!', 'negativeLookahead');
  42575. }
  42576. }
  42577. function parseQuantifier() {
  42578. // Quantifier ::
  42579. // QuantifierPrefix
  42580. // QuantifierPrefix ?
  42581. //
  42582. // QuantifierPrefix ::
  42583. // *
  42584. // +
  42585. // ?
  42586. // { DecimalDigits }
  42587. // { DecimalDigits , }
  42588. // { DecimalDigits , DecimalDigits }
  42589. var res, from = pos;
  42590. var quantifier;
  42591. var min, max;
  42592. if (match('*')) {
  42593. quantifier = createQuantifier(0);
  42594. }
  42595. else if (match('+')) {
  42596. quantifier = createQuantifier(1);
  42597. }
  42598. else if (match('?')) {
  42599. quantifier = createQuantifier(0, 1);
  42600. }
  42601. else if (res = matchReg(/^\{([0-9]+)\}/)) {
  42602. min = parseInt(res[1], 10);
  42603. quantifier = createQuantifier(min, min, res.range[0], res.range[1]);
  42604. }
  42605. else if (res = matchReg(/^\{([0-9]+),\}/)) {
  42606. min = parseInt(res[1], 10);
  42607. quantifier = createQuantifier(min, undefined, res.range[0], res.range[1]);
  42608. }
  42609. else if (res = matchReg(/^\{([0-9]+),([0-9]+)\}/)) {
  42610. min = parseInt(res[1], 10);
  42611. max = parseInt(res[2], 10);
  42612. if (min > max) {
  42613. bail('numbers out of order in {} quantifier', '', from, pos);
  42614. }
  42615. quantifier = createQuantifier(min, max, res.range[0], res.range[1]);
  42616. }
  42617. if (quantifier) {
  42618. if (match('?')) {
  42619. quantifier.greedy = false;
  42620. quantifier.range[1] += 1;
  42621. }
  42622. }
  42623. return quantifier;
  42624. }
  42625. function parseAtom() {
  42626. // Atom ::
  42627. // PatternCharacter
  42628. // .
  42629. // \ AtomEscape
  42630. // CharacterClass
  42631. // ( Disjunction )
  42632. // ( ? : Disjunction )
  42633. var res;
  42634. // jviereck: allow ']', '}' here as well to be compatible with browser's
  42635. // implementations: ']'.match(/]/);
  42636. // if (res = matchReg(/^[^^$\\.*+?()[\]{}|]/)) {
  42637. if (res = matchReg(/^[^^$\\.*+?(){[|]/)) {
  42638. // PatternCharacter
  42639. return createCharacter(res);
  42640. }
  42641. else if (match('.')) {
  42642. // .
  42643. return createDot();
  42644. }
  42645. else if (match('\\')) {
  42646. // \ AtomEscape
  42647. res = parseAtomEscape();
  42648. if (!res) {
  42649. bail('atomEscape');
  42650. }
  42651. return res;
  42652. }
  42653. else if (res = parseCharacterClass()) {
  42654. return res;
  42655. }
  42656. else {
  42657. // ( Disjunction )
  42658. // ( ? : Disjunction )
  42659. return parseGroup('(?:', 'ignore', '(', 'normal');
  42660. }
  42661. }
  42662. function parseUnicodeSurrogatePairEscape(firstEscape) {
  42663. if (hasUnicodeFlag) {
  42664. var first, second;
  42665. if (firstEscape.kind == 'unicodeEscape' &&
  42666. (first = firstEscape.codePoint) >= 0xD800 && first <= 0xDBFF &&
  42667. current('\\') && next('u') ) {
  42668. var prevPos = pos;
  42669. pos++;
  42670. var secondEscape = parseClassEscape();
  42671. if (secondEscape.kind == 'unicodeEscape' &&
  42672. (second = secondEscape.codePoint) >= 0xDC00 && second <= 0xDFFF) {
  42673. // Unicode surrogate pair
  42674. firstEscape.range[1] = secondEscape.range[1];
  42675. firstEscape.codePoint = (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
  42676. firstEscape.type = 'value';
  42677. firstEscape.kind = 'unicodeCodePointEscape';
  42678. addRaw(firstEscape);
  42679. }
  42680. else {
  42681. pos = prevPos;
  42682. }
  42683. }
  42684. }
  42685. return firstEscape;
  42686. }
  42687. function parseClassEscape() {
  42688. return parseAtomEscape(true);
  42689. }
  42690. function parseAtomEscape(insideCharacterClass) {
  42691. // AtomEscape ::
  42692. // DecimalEscape
  42693. // CharacterEscape
  42694. // CharacterClassEscape
  42695. var res, from = pos;
  42696. res = parseDecimalEscape();
  42697. if (res) {
  42698. return res;
  42699. }
  42700. // For ClassEscape
  42701. if (insideCharacterClass) {
  42702. if (match('b')) {
  42703. // 15.10.2.19
  42704. // The production ClassEscape :: b evaluates by returning the
  42705. // CharSet containing the one character <BS> (Unicode value 0008).
  42706. return createEscaped('singleEscape', 0x0008, '\\b');
  42707. } else if (match('B')) {
  42708. bail('\\B not possible inside of CharacterClass', '', from);
  42709. }
  42710. }
  42711. res = parseCharacterEscape();
  42712. return res;
  42713. }
  42714. function parseDecimalEscape() {
  42715. // DecimalEscape ::
  42716. // DecimalIntegerLiteral [lookahead ∉ DecimalDigit]
  42717. // CharacterClassEscape :: one of d D s S w W
  42718. var res, match;
  42719. if (res = matchReg(/^(?!0)\d+/)) {
  42720. match = res[0];
  42721. var refIdx = parseInt(res[0], 10);
  42722. if (refIdx <= closedCaptureCounter) {
  42723. // If the number is smaller than the normal-groups found so
  42724. // far, then it is a reference...
  42725. return createReference(res[0]);
  42726. } else {
  42727. // ... otherwise it needs to be interpreted as a octal (if the
  42728. // number is in an octal format). If it is NOT octal format,
  42729. // then the slash is ignored and the number is matched later
  42730. // as normal characters.
  42731. // Recall the negative decision to decide if the input must be parsed
  42732. // a second time with the total normal-groups.
  42733. backrefDenied.push(refIdx);
  42734. // Reset the position again, as maybe only parts of the previous
  42735. // matched numbers are actual octal numbers. E.g. in '019' only
  42736. // the '01' should be matched.
  42737. incr(-res[0].length);
  42738. if (res = matchReg(/^[0-7]{1,3}/)) {
  42739. return createEscaped('octal', parseInt(res[0], 8), res[0], 1);
  42740. } else {
  42741. // If we end up here, we have a case like /\91/. Then the
  42742. // first slash is to be ignored and the 9 & 1 to be treated
  42743. // like ordinary characters. Create a character for the
  42744. // first number only here - other number-characters
  42745. // (if available) will be matched later.
  42746. res = createCharacter(matchReg(/^[89]/));
  42747. return updateRawStart(res, res.range[0] - 1);
  42748. }
  42749. }
  42750. }
  42751. // Only allow octal numbers in the following. All matched numbers start
  42752. // with a zero (if the do not, the previous if-branch is executed).
  42753. // If the number is not octal format and starts with zero (e.g. `091`)
  42754. // then only the zeros `0` is treated here and the `91` are ordinary
  42755. // characters.
  42756. // Example:
  42757. // /\091/.exec('\091')[0].length === 3
  42758. else if (res = matchReg(/^[0-7]{1,3}/)) {
  42759. match = res[0];
  42760. if (/^0{1,3}$/.test(match)) {
  42761. // If they are all zeros, then only take the first one.
  42762. return createEscaped('null', 0x0000, '0', match.length + 1);
  42763. } else {
  42764. return createEscaped('octal', parseInt(match, 8), match, 1);
  42765. }
  42766. } else if (res = matchReg(/^[dDsSwW]/)) {
  42767. return createCharacterClassEscape(res[0]);
  42768. }
  42769. return false;
  42770. }
  42771. function parseCharacterEscape() {
  42772. // CharacterEscape ::
  42773. // ControlEscape
  42774. // c ControlLetter
  42775. // HexEscapeSequence
  42776. // UnicodeEscapeSequence
  42777. // IdentityEscape
  42778. var res;
  42779. if (res = matchReg(/^[fnrtv]/)) {
  42780. // ControlEscape
  42781. var codePoint = 0;
  42782. switch (res[0]) {
  42783. case 't': codePoint = 0x009; break;
  42784. case 'n': codePoint = 0x00A; break;
  42785. case 'v': codePoint = 0x00B; break;
  42786. case 'f': codePoint = 0x00C; break;
  42787. case 'r': codePoint = 0x00D; break;
  42788. }
  42789. return createEscaped('singleEscape', codePoint, '\\' + res[0]);
  42790. } else if (res = matchReg(/^c([a-zA-Z])/)) {
  42791. // c ControlLetter
  42792. return createEscaped('controlLetter', res[1].charCodeAt(0) % 32, res[1], 2);
  42793. } else if (res = matchReg(/^x([0-9a-fA-F]{2})/)) {
  42794. // HexEscapeSequence
  42795. return createEscaped('hexadecimalEscape', parseInt(res[1], 16), res[1], 2);
  42796. } else if (res = matchReg(/^u([0-9a-fA-F]{4})/)) {
  42797. // UnicodeEscapeSequence
  42798. return parseUnicodeSurrogatePairEscape(
  42799. createEscaped('unicodeEscape', parseInt(res[1], 16), res[1], 2)
  42800. );
  42801. } else if (hasUnicodeFlag && (res = matchReg(/^u\{([0-9a-fA-F]+)\}/))) {
  42802. // RegExpUnicodeEscapeSequence (ES6 Unicode code point escape)
  42803. return createEscaped('unicodeCodePointEscape', parseInt(res[1], 16), res[1], 4);
  42804. } else {
  42805. // IdentityEscape
  42806. return parseIdentityEscape();
  42807. }
  42808. }
  42809. // Taken from the Esprima parser.
  42810. function isIdentifierPart(ch) {
  42811. // Generated by `tools/generate-identifier-regex.js`.
  42812. var NonAsciiIdentifierPart = new RegExp('[\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]');
  42813. return (ch === 36) || (ch === 95) || // $ (dollar) and _ (underscore)
  42814. (ch >= 65 && ch <= 90) || // A..Z
  42815. (ch >= 97 && ch <= 122) || // a..z
  42816. (ch >= 48 && ch <= 57) || // 0..9
  42817. (ch === 92) || // \ (backslash)
  42818. ((ch >= 0x80) && NonAsciiIdentifierPart.test(String.fromCharCode(ch)));
  42819. }
  42820. function parseIdentityEscape() {
  42821. // IdentityEscape ::
  42822. // SourceCharacter but not IdentifierPart
  42823. // <ZWJ>
  42824. // <ZWNJ>
  42825. var ZWJ = '\u200C';
  42826. var ZWNJ = '\u200D';
  42827. var tmp;
  42828. if (!isIdentifierPart(lookahead())) {
  42829. tmp = incr();
  42830. return createEscaped('identifier', tmp.charCodeAt(0), tmp, 1);
  42831. }
  42832. if (match(ZWJ)) {
  42833. // <ZWJ>
  42834. return createEscaped('identifier', 0x200C, ZWJ);
  42835. } else if (match(ZWNJ)) {
  42836. // <ZWNJ>
  42837. return createEscaped('identifier', 0x200D, ZWNJ);
  42838. }
  42839. return null;
  42840. }
  42841. function parseCharacterClass() {
  42842. // CharacterClass ::
  42843. // [ [lookahead ∉ {^}] ClassRanges ]
  42844. // [ ^ ClassRanges ]
  42845. var res, from = pos;
  42846. if (res = matchReg(/^\[\^/)) {
  42847. res = parseClassRanges();
  42848. skip(']');
  42849. return createCharacterClass(res, true, from, pos);
  42850. } else if (match('[')) {
  42851. res = parseClassRanges();
  42852. skip(']');
  42853. return createCharacterClass(res, false, from, pos);
  42854. }
  42855. return null;
  42856. }
  42857. function parseClassRanges() {
  42858. // ClassRanges ::
  42859. // [empty]
  42860. // NonemptyClassRanges
  42861. var res;
  42862. if (current(']')) {
  42863. // Empty array means nothing insinde of the ClassRange.
  42864. return [];
  42865. } else {
  42866. res = parseNonemptyClassRanges();
  42867. if (!res) {
  42868. bail('nonEmptyClassRanges');
  42869. }
  42870. return res;
  42871. }
  42872. }
  42873. function parseHelperClassRanges(atom) {
  42874. var from, to, res;
  42875. if (current('-') && !next(']')) {
  42876. // ClassAtom - ClassAtom ClassRanges
  42877. skip('-');
  42878. res = parseClassAtom();
  42879. if (!res) {
  42880. bail('classAtom');
  42881. }
  42882. to = pos;
  42883. var classRanges = parseClassRanges();
  42884. if (!classRanges) {
  42885. bail('classRanges');
  42886. }
  42887. from = atom.range[0];
  42888. if (classRanges.type === 'empty') {
  42889. return [createClassRange(atom, res, from, to)];
  42890. }
  42891. return [createClassRange(atom, res, from, to)].concat(classRanges);
  42892. }
  42893. res = parseNonemptyClassRangesNoDash();
  42894. if (!res) {
  42895. bail('nonEmptyClassRangesNoDash');
  42896. }
  42897. return [atom].concat(res);
  42898. }
  42899. function parseNonemptyClassRanges() {
  42900. // NonemptyClassRanges ::
  42901. // ClassAtom
  42902. // ClassAtom NonemptyClassRangesNoDash
  42903. // ClassAtom - ClassAtom ClassRanges
  42904. var atom = parseClassAtom();
  42905. if (!atom) {
  42906. bail('classAtom');
  42907. }
  42908. if (current(']')) {
  42909. // ClassAtom
  42910. return [atom];
  42911. }
  42912. // ClassAtom NonemptyClassRangesNoDash
  42913. // ClassAtom - ClassAtom ClassRanges
  42914. return parseHelperClassRanges(atom);
  42915. }
  42916. function parseNonemptyClassRangesNoDash() {
  42917. // NonemptyClassRangesNoDash ::
  42918. // ClassAtom
  42919. // ClassAtomNoDash NonemptyClassRangesNoDash
  42920. // ClassAtomNoDash - ClassAtom ClassRanges
  42921. var res = parseClassAtom();
  42922. if (!res) {
  42923. bail('classAtom');
  42924. }
  42925. if (current(']')) {
  42926. // ClassAtom
  42927. return res;
  42928. }
  42929. // ClassAtomNoDash NonemptyClassRangesNoDash
  42930. // ClassAtomNoDash - ClassAtom ClassRanges
  42931. return parseHelperClassRanges(res);
  42932. }
  42933. function parseClassAtom() {
  42934. // ClassAtom ::
  42935. // -
  42936. // ClassAtomNoDash
  42937. if (match('-')) {
  42938. return createCharacter('-');
  42939. } else {
  42940. return parseClassAtomNoDash();
  42941. }
  42942. }
  42943. function parseClassAtomNoDash() {
  42944. // ClassAtomNoDash ::
  42945. // SourceCharacter but not one of \ or ] or -
  42946. // \ ClassEscape
  42947. var res;
  42948. if (res = matchReg(/^[^\\\]-]/)) {
  42949. return createCharacter(res[0]);
  42950. } else if (match('\\')) {
  42951. res = parseClassEscape();
  42952. if (!res) {
  42953. bail('classEscape');
  42954. }
  42955. return parseUnicodeSurrogatePairEscape(res);
  42956. }
  42957. }
  42958. function bail(message, details, from, to) {
  42959. from = from == null ? pos : from;
  42960. to = to == null ? from : to;
  42961. var contextStart = Math.max(0, from - 10);
  42962. var contextEnd = Math.min(to + 10, str.length);
  42963. // Output a bit of context and a line pointing to where our error is.
  42964. //
  42965. // We are assuming that there are no actual newlines in the content as this is a regular expression.
  42966. var context = ' ' + str.substring(contextStart, contextEnd);
  42967. var pointer = ' ' + new Array(from - contextStart + 1).join(' ') + '^';
  42968. throw SyntaxError(message + ' at position ' + from + (details ? ': ' + details : '') + '\n' + context + '\n' + pointer);
  42969. }
  42970. var backrefDenied = [];
  42971. var closedCaptureCounter = 0;
  42972. var firstIteration = true;
  42973. var hasUnicodeFlag = (flags || "").indexOf("u") !== -1;
  42974. var pos = 0;
  42975. // Convert the input to a string and treat the empty string special.
  42976. str = String(str);
  42977. if (str === '') {
  42978. str = '(?:)';
  42979. }
  42980. var result = parseDisjunction();
  42981. if (result.range[1] !== str.length) {
  42982. bail('Could not parse entire input - got stuck', '', result.range[1]);
  42983. }
  42984. // The spec requires to interpret the `\2` in `/\2()()/` as backreference.
  42985. // As the parser collects the number of capture groups as the string is
  42986. // parsed it is impossible to make these decisions at the point when the
  42987. // `\2` is handled. In case the local decision turns out to be wrong after
  42988. // the parsing has finished, the input string is parsed a second time with
  42989. // the total number of capture groups set.
  42990. //
  42991. // SEE: https://github.com/jviereck/regjsparser/issues/70
  42992. for (var i = 0; i < backrefDenied.length; i++) {
  42993. if (backrefDenied[i] <= closedCaptureCounter) {
  42994. // Parse the input a second time.
  42995. pos = 0;
  42996. firstIteration = false;
  42997. return parseDisjunction();
  42998. }
  42999. }
  43000. return result;
  43001. }
  43002. var regjsparser = {
  43003. parse: parse
  43004. };
  43005. if (typeof module !== 'undefined' && module.exports) {
  43006. module.exports = regjsparser;
  43007. } else {
  43008. window.regjsparser = regjsparser;
  43009. }
  43010. }());
  43011. },{}],540:[function(require,module,exports){
  43012. 'use strict';
  43013. var isFinite = require('is-finite');
  43014. module.exports = function (str, n) {
  43015. if (typeof str !== 'string') {
  43016. throw new TypeError('Expected `input` to be a string');
  43017. }
  43018. if (n < 0 || !isFinite(n)) {
  43019. throw new TypeError('Expected `count` to be a positive finite number');
  43020. }
  43021. var ret = '';
  43022. do {
  43023. if (n & 1) {
  43024. ret += str;
  43025. }
  43026. str += str;
  43027. } while ((n >>= 1));
  43028. return ret;
  43029. };
  43030. },{"is-finite":293}],541:[function(require,module,exports){
  43031. 'use strict';
  43032. module.exports = function (str) {
  43033. var isExtendedLengthPath = /^\\\\\?\\/.test(str);
  43034. var hasNonAscii = /[^\x00-\x80]+/.test(str);
  43035. if (isExtendedLengthPath || hasNonAscii) {
  43036. return str;
  43037. }
  43038. return str.replace(/\\/g, '/');
  43039. };
  43040. },{}],542:[function(require,module,exports){
  43041. /* -*- Mode: js; js-indent-level: 2; -*- */
  43042. /*
  43043. * Copyright 2011 Mozilla Foundation and contributors
  43044. * Licensed under the New BSD license. See LICENSE or:
  43045. * http://opensource.org/licenses/BSD-3-Clause
  43046. */
  43047. var util = require('./util');
  43048. var has = Object.prototype.hasOwnProperty;
  43049. var hasNativeMap = typeof Map !== "undefined";
  43050. /**
  43051. * A data structure which is a combination of an array and a set. Adding a new
  43052. * member is O(1), testing for membership is O(1), and finding the index of an
  43053. * element is O(1). Removing elements from the set is not supported. Only
  43054. * strings are supported for membership.
  43055. */
  43056. function ArraySet() {
  43057. this._array = [];
  43058. this._set = hasNativeMap ? new Map() : Object.create(null);
  43059. }
  43060. /**
  43061. * Static method for creating ArraySet instances from an existing array.
  43062. */
  43063. ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
  43064. var set = new ArraySet();
  43065. for (var i = 0, len = aArray.length; i < len; i++) {
  43066. set.add(aArray[i], aAllowDuplicates);
  43067. }
  43068. return set;
  43069. };
  43070. /**
  43071. * Return how many unique items are in this ArraySet. If duplicates have been
  43072. * added, than those do not count towards the size.
  43073. *
  43074. * @returns Number
  43075. */
  43076. ArraySet.prototype.size = function ArraySet_size() {
  43077. return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
  43078. };
  43079. /**
  43080. * Add the given string to this set.
  43081. *
  43082. * @param String aStr
  43083. */
  43084. ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
  43085. var sStr = hasNativeMap ? aStr : util.toSetString(aStr);
  43086. var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);
  43087. var idx = this._array.length;
  43088. if (!isDuplicate || aAllowDuplicates) {
  43089. this._array.push(aStr);
  43090. }
  43091. if (!isDuplicate) {
  43092. if (hasNativeMap) {
  43093. this._set.set(aStr, idx);
  43094. } else {
  43095. this._set[sStr] = idx;
  43096. }
  43097. }
  43098. };
  43099. /**
  43100. * Is the given string a member of this set?
  43101. *
  43102. * @param String aStr
  43103. */
  43104. ArraySet.prototype.has = function ArraySet_has(aStr) {
  43105. if (hasNativeMap) {
  43106. return this._set.has(aStr);
  43107. } else {
  43108. var sStr = util.toSetString(aStr);
  43109. return has.call(this._set, sStr);
  43110. }
  43111. };
  43112. /**
  43113. * What is the index of the given string in the array?
  43114. *
  43115. * @param String aStr
  43116. */
  43117. ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {
  43118. if (hasNativeMap) {
  43119. var idx = this._set.get(aStr);
  43120. if (idx >= 0) {
  43121. return idx;
  43122. }
  43123. } else {
  43124. var sStr = util.toSetString(aStr);
  43125. if (has.call(this._set, sStr)) {
  43126. return this._set[sStr];
  43127. }
  43128. }
  43129. throw new Error('"' + aStr + '" is not in the set.');
  43130. };
  43131. /**
  43132. * What is the element at the given index?
  43133. *
  43134. * @param Number aIdx
  43135. */
  43136. ArraySet.prototype.at = function ArraySet_at(aIdx) {
  43137. if (aIdx >= 0 && aIdx < this._array.length) {
  43138. return this._array[aIdx];
  43139. }
  43140. throw new Error('No element indexed by ' + aIdx);
  43141. };
  43142. /**
  43143. * Returns the array representation of this set (which has the proper indices
  43144. * indicated by indexOf). Note that this is a copy of the internal array used
  43145. * for storing the members so that no one can mess with internal state.
  43146. */
  43147. ArraySet.prototype.toArray = function ArraySet_toArray() {
  43148. return this._array.slice();
  43149. };
  43150. exports.ArraySet = ArraySet;
  43151. },{"./util":551}],543:[function(require,module,exports){
  43152. /* -*- Mode: js; js-indent-level: 2; -*- */
  43153. /*
  43154. * Copyright 2011 Mozilla Foundation and contributors
  43155. * Licensed under the New BSD license. See LICENSE or:
  43156. * http://opensource.org/licenses/BSD-3-Clause
  43157. *
  43158. * Based on the Base 64 VLQ implementation in Closure Compiler:
  43159. * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
  43160. *
  43161. * Copyright 2011 The Closure Compiler Authors. All rights reserved.
  43162. * Redistribution and use in source and binary forms, with or without
  43163. * modification, are permitted provided that the following conditions are
  43164. * met:
  43165. *
  43166. * * Redistributions of source code must retain the above copyright
  43167. * notice, this list of conditions and the following disclaimer.
  43168. * * Redistributions in binary form must reproduce the above
  43169. * copyright notice, this list of conditions and the following
  43170. * disclaimer in the documentation and/or other materials provided
  43171. * with the distribution.
  43172. * * Neither the name of Google Inc. nor the names of its
  43173. * contributors may be used to endorse or promote products derived
  43174. * from this software without specific prior written permission.
  43175. *
  43176. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  43177. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  43178. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  43179. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  43180. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  43181. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  43182. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  43183. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  43184. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  43185. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  43186. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  43187. */
  43188. var base64 = require('./base64');
  43189. // A single base 64 digit can contain 6 bits of data. For the base 64 variable
  43190. // length quantities we use in the source map spec, the first bit is the sign,
  43191. // the next four bits are the actual value, and the 6th bit is the
  43192. // continuation bit. The continuation bit tells us whether there are more
  43193. // digits in this value following this digit.
  43194. //
  43195. // Continuation
  43196. // | Sign
  43197. // | |
  43198. // V V
  43199. // 101011
  43200. var VLQ_BASE_SHIFT = 5;
  43201. // binary: 100000
  43202. var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
  43203. // binary: 011111
  43204. var VLQ_BASE_MASK = VLQ_BASE - 1;
  43205. // binary: 100000
  43206. var VLQ_CONTINUATION_BIT = VLQ_BASE;
  43207. /**
  43208. * Converts from a two-complement value to a value where the sign bit is
  43209. * placed in the least significant bit. For example, as decimals:
  43210. * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
  43211. * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
  43212. */
  43213. function toVLQSigned(aValue) {
  43214. return aValue < 0
  43215. ? ((-aValue) << 1) + 1
  43216. : (aValue << 1) + 0;
  43217. }
  43218. /**
  43219. * Converts to a two-complement value from a value where the sign bit is
  43220. * placed in the least significant bit. For example, as decimals:
  43221. * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
  43222. * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
  43223. */
  43224. function fromVLQSigned(aValue) {
  43225. var isNegative = (aValue & 1) === 1;
  43226. var shifted = aValue >> 1;
  43227. return isNegative
  43228. ? -shifted
  43229. : shifted;
  43230. }
  43231. /**
  43232. * Returns the base 64 VLQ encoded value.
  43233. */
  43234. exports.encode = function base64VLQ_encode(aValue) {
  43235. var encoded = "";
  43236. var digit;
  43237. var vlq = toVLQSigned(aValue);
  43238. do {
  43239. digit = vlq & VLQ_BASE_MASK;
  43240. vlq >>>= VLQ_BASE_SHIFT;
  43241. if (vlq > 0) {
  43242. // There are still more digits in this value, so we must make sure the
  43243. // continuation bit is marked.
  43244. digit |= VLQ_CONTINUATION_BIT;
  43245. }
  43246. encoded += base64.encode(digit);
  43247. } while (vlq > 0);
  43248. return encoded;
  43249. };
  43250. /**
  43251. * Decodes the next base 64 VLQ value from the given string and returns the
  43252. * value and the rest of the string via the out parameter.
  43253. */
  43254. exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
  43255. var strLen = aStr.length;
  43256. var result = 0;
  43257. var shift = 0;
  43258. var continuation, digit;
  43259. do {
  43260. if (aIndex >= strLen) {
  43261. throw new Error("Expected more digits in base 64 VLQ value.");
  43262. }
  43263. digit = base64.decode(aStr.charCodeAt(aIndex++));
  43264. if (digit === -1) {
  43265. throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
  43266. }
  43267. continuation = !!(digit & VLQ_CONTINUATION_BIT);
  43268. digit &= VLQ_BASE_MASK;
  43269. result = result + (digit << shift);
  43270. shift += VLQ_BASE_SHIFT;
  43271. } while (continuation);
  43272. aOutParam.value = fromVLQSigned(result);
  43273. aOutParam.rest = aIndex;
  43274. };
  43275. },{"./base64":544}],544:[function(require,module,exports){
  43276. /* -*- Mode: js; js-indent-level: 2; -*- */
  43277. /*
  43278. * Copyright 2011 Mozilla Foundation and contributors
  43279. * Licensed under the New BSD license. See LICENSE or:
  43280. * http://opensource.org/licenses/BSD-3-Clause
  43281. */
  43282. var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
  43283. /**
  43284. * Encode an integer in the range of 0 to 63 to a single base 64 digit.
  43285. */
  43286. exports.encode = function (number) {
  43287. if (0 <= number && number < intToCharMap.length) {
  43288. return intToCharMap[number];
  43289. }
  43290. throw new TypeError("Must be between 0 and 63: " + number);
  43291. };
  43292. /**
  43293. * Decode a single base 64 character code digit to an integer. Returns -1 on
  43294. * failure.
  43295. */
  43296. exports.decode = function (charCode) {
  43297. var bigA = 65; // 'A'
  43298. var bigZ = 90; // 'Z'
  43299. var littleA = 97; // 'a'
  43300. var littleZ = 122; // 'z'
  43301. var zero = 48; // '0'
  43302. var nine = 57; // '9'
  43303. var plus = 43; // '+'
  43304. var slash = 47; // '/'
  43305. var littleOffset = 26;
  43306. var numberOffset = 52;
  43307. // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
  43308. if (bigA <= charCode && charCode <= bigZ) {
  43309. return (charCode - bigA);
  43310. }
  43311. // 26 - 51: abcdefghijklmnopqrstuvwxyz
  43312. if (littleA <= charCode && charCode <= littleZ) {
  43313. return (charCode - littleA + littleOffset);
  43314. }
  43315. // 52 - 61: 0123456789
  43316. if (zero <= charCode && charCode <= nine) {
  43317. return (charCode - zero + numberOffset);
  43318. }
  43319. // 62: +
  43320. if (charCode == plus) {
  43321. return 62;
  43322. }
  43323. // 63: /
  43324. if (charCode == slash) {
  43325. return 63;
  43326. }
  43327. // Invalid base64 digit.
  43328. return -1;
  43329. };
  43330. },{}],545:[function(require,module,exports){
  43331. /* -*- Mode: js; js-indent-level: 2; -*- */
  43332. /*
  43333. * Copyright 2011 Mozilla Foundation and contributors
  43334. * Licensed under the New BSD license. See LICENSE or:
  43335. * http://opensource.org/licenses/BSD-3-Clause
  43336. */
  43337. exports.GREATEST_LOWER_BOUND = 1;
  43338. exports.LEAST_UPPER_BOUND = 2;
  43339. /**
  43340. * Recursive implementation of binary search.
  43341. *
  43342. * @param aLow Indices here and lower do not contain the needle.
  43343. * @param aHigh Indices here and higher do not contain the needle.
  43344. * @param aNeedle The element being searched for.
  43345. * @param aHaystack The non-empty array being searched.
  43346. * @param aCompare Function which takes two elements and returns -1, 0, or 1.
  43347. * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
  43348. * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
  43349. * closest element that is smaller than or greater than the one we are
  43350. * searching for, respectively, if the exact element cannot be found.
  43351. */
  43352. function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
  43353. // This function terminates when one of the following is true:
  43354. //
  43355. // 1. We find the exact element we are looking for.
  43356. //
  43357. // 2. We did not find the exact element, but we can return the index of
  43358. // the next-closest element.
  43359. //
  43360. // 3. We did not find the exact element, and there is no next-closest
  43361. // element than the one we are searching for, so we return -1.
  43362. var mid = Math.floor((aHigh - aLow) / 2) + aLow;
  43363. var cmp = aCompare(aNeedle, aHaystack[mid], true);
  43364. if (cmp === 0) {
  43365. // Found the element we are looking for.
  43366. return mid;
  43367. }
  43368. else if (cmp > 0) {
  43369. // Our needle is greater than aHaystack[mid].
  43370. if (aHigh - mid > 1) {
  43371. // The element is in the upper half.
  43372. return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
  43373. }
  43374. // The exact needle element was not found in this haystack. Determine if
  43375. // we are in termination case (3) or (2) and return the appropriate thing.
  43376. if (aBias == exports.LEAST_UPPER_BOUND) {
  43377. return aHigh < aHaystack.length ? aHigh : -1;
  43378. } else {
  43379. return mid;
  43380. }
  43381. }
  43382. else {
  43383. // Our needle is less than aHaystack[mid].
  43384. if (mid - aLow > 1) {
  43385. // The element is in the lower half.
  43386. return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
  43387. }
  43388. // we are in termination case (3) or (2) and return the appropriate thing.
  43389. if (aBias == exports.LEAST_UPPER_BOUND) {
  43390. return mid;
  43391. } else {
  43392. return aLow < 0 ? -1 : aLow;
  43393. }
  43394. }
  43395. }
  43396. /**
  43397. * This is an implementation of binary search which will always try and return
  43398. * the index of the closest element if there is no exact hit. This is because
  43399. * mappings between original and generated line/col pairs are single points,
  43400. * and there is an implicit region between each of them, so a miss just means
  43401. * that you aren't on the very start of a region.
  43402. *
  43403. * @param aNeedle The element you are looking for.
  43404. * @param aHaystack The array that is being searched.
  43405. * @param aCompare A function which takes the needle and an element in the
  43406. * array and returns -1, 0, or 1 depending on whether the needle is less
  43407. * than, equal to, or greater than the element, respectively.
  43408. * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
  43409. * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
  43410. * closest element that is smaller than or greater than the one we are
  43411. * searching for, respectively, if the exact element cannot be found.
  43412. * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.
  43413. */
  43414. exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {
  43415. if (aHaystack.length === 0) {
  43416. return -1;
  43417. }
  43418. var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,
  43419. aCompare, aBias || exports.GREATEST_LOWER_BOUND);
  43420. if (index < 0) {
  43421. return -1;
  43422. }
  43423. // We have found either the exact element, or the next-closest element than
  43424. // the one we are searching for. However, there may be more than one such
  43425. // element. Make sure we always return the smallest of these.
  43426. while (index - 1 >= 0) {
  43427. if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
  43428. break;
  43429. }
  43430. --index;
  43431. }
  43432. return index;
  43433. };
  43434. },{}],546:[function(require,module,exports){
  43435. /* -*- Mode: js; js-indent-level: 2; -*- */
  43436. /*
  43437. * Copyright 2014 Mozilla Foundation and contributors
  43438. * Licensed under the New BSD license. See LICENSE or:
  43439. * http://opensource.org/licenses/BSD-3-Clause
  43440. */
  43441. var util = require('./util');
  43442. /**
  43443. * Determine whether mappingB is after mappingA with respect to generated
  43444. * position.
  43445. */
  43446. function generatedPositionAfter(mappingA, mappingB) {
  43447. // Optimized for most common case
  43448. var lineA = mappingA.generatedLine;
  43449. var lineB = mappingB.generatedLine;
  43450. var columnA = mappingA.generatedColumn;
  43451. var columnB = mappingB.generatedColumn;
  43452. return lineB > lineA || lineB == lineA && columnB >= columnA ||
  43453. util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
  43454. }
  43455. /**
  43456. * A data structure to provide a sorted view of accumulated mappings in a
  43457. * performance conscious manner. It trades a neglibable overhead in general
  43458. * case for a large speedup in case of mappings being added in order.
  43459. */
  43460. function MappingList() {
  43461. this._array = [];
  43462. this._sorted = true;
  43463. // Serves as infimum
  43464. this._last = {generatedLine: -1, generatedColumn: 0};
  43465. }
  43466. /**
  43467. * Iterate through internal items. This method takes the same arguments that
  43468. * `Array.prototype.forEach` takes.
  43469. *
  43470. * NOTE: The order of the mappings is NOT guaranteed.
  43471. */
  43472. MappingList.prototype.unsortedForEach =
  43473. function MappingList_forEach(aCallback, aThisArg) {
  43474. this._array.forEach(aCallback, aThisArg);
  43475. };
  43476. /**
  43477. * Add the given source mapping.
  43478. *
  43479. * @param Object aMapping
  43480. */
  43481. MappingList.prototype.add = function MappingList_add(aMapping) {
  43482. if (generatedPositionAfter(this._last, aMapping)) {
  43483. this._last = aMapping;
  43484. this._array.push(aMapping);
  43485. } else {
  43486. this._sorted = false;
  43487. this._array.push(aMapping);
  43488. }
  43489. };
  43490. /**
  43491. * Returns the flat, sorted array of mappings. The mappings are sorted by
  43492. * generated position.
  43493. *
  43494. * WARNING: This method returns internal data without copying, for
  43495. * performance. The return value must NOT be mutated, and should be treated as
  43496. * an immutable borrow. If you want to take ownership, you must make your own
  43497. * copy.
  43498. */
  43499. MappingList.prototype.toArray = function MappingList_toArray() {
  43500. if (!this._sorted) {
  43501. this._array.sort(util.compareByGeneratedPositionsInflated);
  43502. this._sorted = true;
  43503. }
  43504. return this._array;
  43505. };
  43506. exports.MappingList = MappingList;
  43507. },{"./util":551}],547:[function(require,module,exports){
  43508. /* -*- Mode: js; js-indent-level: 2; -*- */
  43509. /*
  43510. * Copyright 2011 Mozilla Foundation and contributors
  43511. * Licensed under the New BSD license. See LICENSE or:
  43512. * http://opensource.org/licenses/BSD-3-Clause
  43513. */
  43514. // It turns out that some (most?) JavaScript engines don't self-host
  43515. // `Array.prototype.sort`. This makes sense because C++ will likely remain
  43516. // faster than JS when doing raw CPU-intensive sorting. However, when using a
  43517. // custom comparator function, calling back and forth between the VM's C++ and
  43518. // JIT'd JS is rather slow *and* loses JIT type information, resulting in
  43519. // worse generated code for the comparator function than would be optimal. In
  43520. // fact, when sorting with a comparator, these costs outweigh the benefits of
  43521. // sorting in C++. By using our own JS-implemented Quick Sort (below), we get
  43522. // a ~3500ms mean speed-up in `bench/bench.html`.
  43523. /**
  43524. * Swap the elements indexed by `x` and `y` in the array `ary`.
  43525. *
  43526. * @param {Array} ary
  43527. * The array.
  43528. * @param {Number} x
  43529. * The index of the first item.
  43530. * @param {Number} y
  43531. * The index of the second item.
  43532. */
  43533. function swap(ary, x, y) {
  43534. var temp = ary[x];
  43535. ary[x] = ary[y];
  43536. ary[y] = temp;
  43537. }
  43538. /**
  43539. * Returns a random integer within the range `low .. high` inclusive.
  43540. *
  43541. * @param {Number} low
  43542. * The lower bound on the range.
  43543. * @param {Number} high
  43544. * The upper bound on the range.
  43545. */
  43546. function randomIntInRange(low, high) {
  43547. return Math.round(low + (Math.random() * (high - low)));
  43548. }
  43549. /**
  43550. * The Quick Sort algorithm.
  43551. *
  43552. * @param {Array} ary
  43553. * An array to sort.
  43554. * @param {function} comparator
  43555. * Function to use to compare two items.
  43556. * @param {Number} p
  43557. * Start index of the array
  43558. * @param {Number} r
  43559. * End index of the array
  43560. */
  43561. function doQuickSort(ary, comparator, p, r) {
  43562. // If our lower bound is less than our upper bound, we (1) partition the
  43563. // array into two pieces and (2) recurse on each half. If it is not, this is
  43564. // the empty array and our base case.
  43565. if (p < r) {
  43566. // (1) Partitioning.
  43567. //
  43568. // The partitioning chooses a pivot between `p` and `r` and moves all
  43569. // elements that are less than or equal to the pivot to the before it, and
  43570. // all the elements that are greater than it after it. The effect is that
  43571. // once partition is done, the pivot is in the exact place it will be when
  43572. // the array is put in sorted order, and it will not need to be moved
  43573. // again. This runs in O(n) time.
  43574. // Always choose a random pivot so that an input array which is reverse
  43575. // sorted does not cause O(n^2) running time.
  43576. var pivotIndex = randomIntInRange(p, r);
  43577. var i = p - 1;
  43578. swap(ary, pivotIndex, r);
  43579. var pivot = ary[r];
  43580. // Immediately after `j` is incremented in this loop, the following hold
  43581. // true:
  43582. //
  43583. // * Every element in `ary[p .. i]` is less than or equal to the pivot.
  43584. //
  43585. // * Every element in `ary[i+1 .. j-1]` is greater than the pivot.
  43586. for (var j = p; j < r; j++) {
  43587. if (comparator(ary[j], pivot) <= 0) {
  43588. i += 1;
  43589. swap(ary, i, j);
  43590. }
  43591. }
  43592. swap(ary, i + 1, j);
  43593. var q = i + 1;
  43594. // (2) Recurse on each half.
  43595. doQuickSort(ary, comparator, p, q - 1);
  43596. doQuickSort(ary, comparator, q + 1, r);
  43597. }
  43598. }
  43599. /**
  43600. * Sort the given array in-place with the given comparator function.
  43601. *
  43602. * @param {Array} ary
  43603. * An array to sort.
  43604. * @param {function} comparator
  43605. * Function to use to compare two items.
  43606. */
  43607. exports.quickSort = function (ary, comparator) {
  43608. doQuickSort(ary, comparator, 0, ary.length - 1);
  43609. };
  43610. },{}],548:[function(require,module,exports){
  43611. /* -*- Mode: js; js-indent-level: 2; -*- */
  43612. /*
  43613. * Copyright 2011 Mozilla Foundation and contributors
  43614. * Licensed under the New BSD license. See LICENSE or:
  43615. * http://opensource.org/licenses/BSD-3-Clause
  43616. */
  43617. var util = require('./util');
  43618. var binarySearch = require('./binary-search');
  43619. var ArraySet = require('./array-set').ArraySet;
  43620. var base64VLQ = require('./base64-vlq');
  43621. var quickSort = require('./quick-sort').quickSort;
  43622. function SourceMapConsumer(aSourceMap) {
  43623. var sourceMap = aSourceMap;
  43624. if (typeof aSourceMap === 'string') {
  43625. sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, ''));
  43626. }
  43627. return sourceMap.sections != null
  43628. ? new IndexedSourceMapConsumer(sourceMap)
  43629. : new BasicSourceMapConsumer(sourceMap);
  43630. }
  43631. SourceMapConsumer.fromSourceMap = function(aSourceMap) {
  43632. return BasicSourceMapConsumer.fromSourceMap(aSourceMap);
  43633. }
  43634. /**
  43635. * The version of the source mapping spec that we are consuming.
  43636. */
  43637. SourceMapConsumer.prototype._version = 3;
  43638. // `__generatedMappings` and `__originalMappings` are arrays that hold the
  43639. // parsed mapping coordinates from the source map's "mappings" attribute. They
  43640. // are lazily instantiated, accessed via the `_generatedMappings` and
  43641. // `_originalMappings` getters respectively, and we only parse the mappings
  43642. // and create these arrays once queried for a source location. We jump through
  43643. // these hoops because there can be many thousands of mappings, and parsing
  43644. // them is expensive, so we only want to do it if we must.
  43645. //
  43646. // Each object in the arrays is of the form:
  43647. //
  43648. // {
  43649. // generatedLine: The line number in the generated code,
  43650. // generatedColumn: The column number in the generated code,
  43651. // source: The path to the original source file that generated this
  43652. // chunk of code,
  43653. // originalLine: The line number in the original source that
  43654. // corresponds to this chunk of generated code,
  43655. // originalColumn: The column number in the original source that
  43656. // corresponds to this chunk of generated code,
  43657. // name: The name of the original symbol which generated this chunk of
  43658. // code.
  43659. // }
  43660. //
  43661. // All properties except for `generatedLine` and `generatedColumn` can be
  43662. // `null`.
  43663. //
  43664. // `_generatedMappings` is ordered by the generated positions.
  43665. //
  43666. // `_originalMappings` is ordered by the original positions.
  43667. SourceMapConsumer.prototype.__generatedMappings = null;
  43668. Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {
  43669. get: function () {
  43670. if (!this.__generatedMappings) {
  43671. this._parseMappings(this._mappings, this.sourceRoot);
  43672. }
  43673. return this.__generatedMappings;
  43674. }
  43675. });
  43676. SourceMapConsumer.prototype.__originalMappings = null;
  43677. Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {
  43678. get: function () {
  43679. if (!this.__originalMappings) {
  43680. this._parseMappings(this._mappings, this.sourceRoot);
  43681. }
  43682. return this.__originalMappings;
  43683. }
  43684. });
  43685. SourceMapConsumer.prototype._charIsMappingSeparator =
  43686. function SourceMapConsumer_charIsMappingSeparator(aStr, index) {
  43687. var c = aStr.charAt(index);
  43688. return c === ";" || c === ",";
  43689. };
  43690. /**
  43691. * Parse the mappings in a string in to a data structure which we can easily
  43692. * query (the ordered arrays in the `this.__generatedMappings` and
  43693. * `this.__originalMappings` properties).
  43694. */
  43695. SourceMapConsumer.prototype._parseMappings =
  43696. function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
  43697. throw new Error("Subclasses must implement _parseMappings");
  43698. };
  43699. SourceMapConsumer.GENERATED_ORDER = 1;
  43700. SourceMapConsumer.ORIGINAL_ORDER = 2;
  43701. SourceMapConsumer.GREATEST_LOWER_BOUND = 1;
  43702. SourceMapConsumer.LEAST_UPPER_BOUND = 2;
  43703. /**
  43704. * Iterate over each mapping between an original source/line/column and a
  43705. * generated line/column in this source map.
  43706. *
  43707. * @param Function aCallback
  43708. * The function that is called with each mapping.
  43709. * @param Object aContext
  43710. * Optional. If specified, this object will be the value of `this` every
  43711. * time that `aCallback` is called.
  43712. * @param aOrder
  43713. * Either `SourceMapConsumer.GENERATED_ORDER` or
  43714. * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to
  43715. * iterate over the mappings sorted by the generated file's line/column
  43716. * order or the original's source/line/column order, respectively. Defaults to
  43717. * `SourceMapConsumer.GENERATED_ORDER`.
  43718. */
  43719. SourceMapConsumer.prototype.eachMapping =
  43720. function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
  43721. var context = aContext || null;
  43722. var order = aOrder || SourceMapConsumer.GENERATED_ORDER;
  43723. var mappings;
  43724. switch (order) {
  43725. case SourceMapConsumer.GENERATED_ORDER:
  43726. mappings = this._generatedMappings;
  43727. break;
  43728. case SourceMapConsumer.ORIGINAL_ORDER:
  43729. mappings = this._originalMappings;
  43730. break;
  43731. default:
  43732. throw new Error("Unknown order of iteration.");
  43733. }
  43734. var sourceRoot = this.sourceRoot;
  43735. mappings.map(function (mapping) {
  43736. var source = mapping.source === null ? null : this._sources.at(mapping.source);
  43737. if (source != null && sourceRoot != null) {
  43738. source = util.join(sourceRoot, source);
  43739. }
  43740. return {
  43741. source: source,
  43742. generatedLine: mapping.generatedLine,
  43743. generatedColumn: mapping.generatedColumn,
  43744. originalLine: mapping.originalLine,
  43745. originalColumn: mapping.originalColumn,
  43746. name: mapping.name === null ? null : this._names.at(mapping.name)
  43747. };
  43748. }, this).forEach(aCallback, context);
  43749. };
  43750. /**
  43751. * Returns all generated line and column information for the original source,
  43752. * line, and column provided. If no column is provided, returns all mappings
  43753. * corresponding to a either the line we are searching for or the next
  43754. * closest line that has any mappings. Otherwise, returns all mappings
  43755. * corresponding to the given line and either the column we are searching for
  43756. * or the next closest column that has any offsets.
  43757. *
  43758. * The only argument is an object with the following properties:
  43759. *
  43760. * - source: The filename of the original source.
  43761. * - line: The line number in the original source.
  43762. * - column: Optional. the column number in the original source.
  43763. *
  43764. * and an array of objects is returned, each with the following properties:
  43765. *
  43766. * - line: The line number in the generated source, or null.
  43767. * - column: The column number in the generated source, or null.
  43768. */
  43769. SourceMapConsumer.prototype.allGeneratedPositionsFor =
  43770. function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {
  43771. var line = util.getArg(aArgs, 'line');
  43772. // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping
  43773. // returns the index of the closest mapping less than the needle. By
  43774. // setting needle.originalColumn to 0, we thus find the last mapping for
  43775. // the given line, provided such a mapping exists.
  43776. var needle = {
  43777. source: util.getArg(aArgs, 'source'),
  43778. originalLine: line,
  43779. originalColumn: util.getArg(aArgs, 'column', 0)
  43780. };
  43781. if (this.sourceRoot != null) {
  43782. needle.source = util.relative(this.sourceRoot, needle.source);
  43783. }
  43784. if (!this._sources.has(needle.source)) {
  43785. return [];
  43786. }
  43787. needle.source = this._sources.indexOf(needle.source);
  43788. var mappings = [];
  43789. var index = this._findMapping(needle,
  43790. this._originalMappings,
  43791. "originalLine",
  43792. "originalColumn",
  43793. util.compareByOriginalPositions,
  43794. binarySearch.LEAST_UPPER_BOUND);
  43795. if (index >= 0) {
  43796. var mapping = this._originalMappings[index];
  43797. if (aArgs.column === undefined) {
  43798. var originalLine = mapping.originalLine;
  43799. // Iterate until either we run out of mappings, or we run into
  43800. // a mapping for a different line than the one we found. Since
  43801. // mappings are sorted, this is guaranteed to find all mappings for
  43802. // the line we found.
  43803. while (mapping && mapping.originalLine === originalLine) {
  43804. mappings.push({
  43805. line: util.getArg(mapping, 'generatedLine', null),
  43806. column: util.getArg(mapping, 'generatedColumn', null),
  43807. lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
  43808. });
  43809. mapping = this._originalMappings[++index];
  43810. }
  43811. } else {
  43812. var originalColumn = mapping.originalColumn;
  43813. // Iterate until either we run out of mappings, or we run into
  43814. // a mapping for a different line than the one we were searching for.
  43815. // Since mappings are sorted, this is guaranteed to find all mappings for
  43816. // the line we are searching for.
  43817. while (mapping &&
  43818. mapping.originalLine === line &&
  43819. mapping.originalColumn == originalColumn) {
  43820. mappings.push({
  43821. line: util.getArg(mapping, 'generatedLine', null),
  43822. column: util.getArg(mapping, 'generatedColumn', null),
  43823. lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
  43824. });
  43825. mapping = this._originalMappings[++index];
  43826. }
  43827. }
  43828. }
  43829. return mappings;
  43830. };
  43831. exports.SourceMapConsumer = SourceMapConsumer;
  43832. /**
  43833. * A BasicSourceMapConsumer instance represents a parsed source map which we can
  43834. * query for information about the original file positions by giving it a file
  43835. * position in the generated source.
  43836. *
  43837. * The only parameter is the raw source map (either as a JSON string, or
  43838. * already parsed to an object). According to the spec, source maps have the
  43839. * following attributes:
  43840. *
  43841. * - version: Which version of the source map spec this map is following.
  43842. * - sources: An array of URLs to the original source files.
  43843. * - names: An array of identifiers which can be referrenced by individual mappings.
  43844. * - sourceRoot: Optional. The URL root from which all sources are relative.
  43845. * - sourcesContent: Optional. An array of contents of the original source files.
  43846. * - mappings: A string of base64 VLQs which contain the actual mappings.
  43847. * - file: Optional. The generated file this source map is associated with.
  43848. *
  43849. * Here is an example source map, taken from the source map spec[0]:
  43850. *
  43851. * {
  43852. * version : 3,
  43853. * file: "out.js",
  43854. * sourceRoot : "",
  43855. * sources: ["foo.js", "bar.js"],
  43856. * names: ["src", "maps", "are", "fun"],
  43857. * mappings: "AA,AB;;ABCDE;"
  43858. * }
  43859. *
  43860. * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#
  43861. */
  43862. function BasicSourceMapConsumer(aSourceMap) {
  43863. var sourceMap = aSourceMap;
  43864. if (typeof aSourceMap === 'string') {
  43865. sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, ''));
  43866. }
  43867. var version = util.getArg(sourceMap, 'version');
  43868. var sources = util.getArg(sourceMap, 'sources');
  43869. // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which
  43870. // requires the array) to play nice here.
  43871. var names = util.getArg(sourceMap, 'names', []);
  43872. var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);
  43873. var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);
  43874. var mappings = util.getArg(sourceMap, 'mappings');
  43875. var file = util.getArg(sourceMap, 'file', null);
  43876. // Once again, Sass deviates from the spec and supplies the version as a
  43877. // string rather than a number, so we use loose equality checking here.
  43878. if (version != this._version) {
  43879. throw new Error('Unsupported version: ' + version);
  43880. }
  43881. sources = sources
  43882. .map(String)
  43883. // Some source maps produce relative source paths like "./foo.js" instead of
  43884. // "foo.js". Normalize these first so that future comparisons will succeed.
  43885. // See bugzil.la/1090768.
  43886. .map(util.normalize)
  43887. // Always ensure that absolute sources are internally stored relative to
  43888. // the source root, if the source root is absolute. Not doing this would
  43889. // be particularly problematic when the source root is a prefix of the
  43890. // source (valid, but why??). See github issue #199 and bugzil.la/1188982.
  43891. .map(function (source) {
  43892. return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)
  43893. ? util.relative(sourceRoot, source)
  43894. : source;
  43895. });
  43896. // Pass `true` below to allow duplicate names and sources. While source maps
  43897. // are intended to be compressed and deduplicated, the TypeScript compiler
  43898. // sometimes generates source maps with duplicates in them. See Github issue
  43899. // #72 and bugzil.la/889492.
  43900. this._names = ArraySet.fromArray(names.map(String), true);
  43901. this._sources = ArraySet.fromArray(sources, true);
  43902. this.sourceRoot = sourceRoot;
  43903. this.sourcesContent = sourcesContent;
  43904. this._mappings = mappings;
  43905. this.file = file;
  43906. }
  43907. BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
  43908. BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;
  43909. /**
  43910. * Create a BasicSourceMapConsumer from a SourceMapGenerator.
  43911. *
  43912. * @param SourceMapGenerator aSourceMap
  43913. * The source map that will be consumed.
  43914. * @returns BasicSourceMapConsumer
  43915. */
  43916. BasicSourceMapConsumer.fromSourceMap =
  43917. function SourceMapConsumer_fromSourceMap(aSourceMap) {
  43918. var smc = Object.create(BasicSourceMapConsumer.prototype);
  43919. var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);
  43920. var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);
  43921. smc.sourceRoot = aSourceMap._sourceRoot;
  43922. smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),
  43923. smc.sourceRoot);
  43924. smc.file = aSourceMap._file;
  43925. // Because we are modifying the entries (by converting string sources and
  43926. // names to indices into the sources and names ArraySets), we have to make
  43927. // a copy of the entry or else bad things happen. Shared mutable state
  43928. // strikes again! See github issue #191.
  43929. var generatedMappings = aSourceMap._mappings.toArray().slice();
  43930. var destGeneratedMappings = smc.__generatedMappings = [];
  43931. var destOriginalMappings = smc.__originalMappings = [];
  43932. for (var i = 0, length = generatedMappings.length; i < length; i++) {
  43933. var srcMapping = generatedMappings[i];
  43934. var destMapping = new Mapping;
  43935. destMapping.generatedLine = srcMapping.generatedLine;
  43936. destMapping.generatedColumn = srcMapping.generatedColumn;
  43937. if (srcMapping.source) {
  43938. destMapping.source = sources.indexOf(srcMapping.source);
  43939. destMapping.originalLine = srcMapping.originalLine;
  43940. destMapping.originalColumn = srcMapping.originalColumn;
  43941. if (srcMapping.name) {
  43942. destMapping.name = names.indexOf(srcMapping.name);
  43943. }
  43944. destOriginalMappings.push(destMapping);
  43945. }
  43946. destGeneratedMappings.push(destMapping);
  43947. }
  43948. quickSort(smc.__originalMappings, util.compareByOriginalPositions);
  43949. return smc;
  43950. };
  43951. /**
  43952. * The version of the source mapping spec that we are consuming.
  43953. */
  43954. BasicSourceMapConsumer.prototype._version = 3;
  43955. /**
  43956. * The list of original sources.
  43957. */
  43958. Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {
  43959. get: function () {
  43960. return this._sources.toArray().map(function (s) {
  43961. return this.sourceRoot != null ? util.join(this.sourceRoot, s) : s;
  43962. }, this);
  43963. }
  43964. });
  43965. /**
  43966. * Provide the JIT with a nice shape / hidden class.
  43967. */
  43968. function Mapping() {
  43969. this.generatedLine = 0;
  43970. this.generatedColumn = 0;
  43971. this.source = null;
  43972. this.originalLine = null;
  43973. this.originalColumn = null;
  43974. this.name = null;
  43975. }
  43976. /**
  43977. * Parse the mappings in a string in to a data structure which we can easily
  43978. * query (the ordered arrays in the `this.__generatedMappings` and
  43979. * `this.__originalMappings` properties).
  43980. */
  43981. BasicSourceMapConsumer.prototype._parseMappings =
  43982. function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
  43983. var generatedLine = 1;
  43984. var previousGeneratedColumn = 0;
  43985. var previousOriginalLine = 0;
  43986. var previousOriginalColumn = 0;
  43987. var previousSource = 0;
  43988. var previousName = 0;
  43989. var length = aStr.length;
  43990. var index = 0;
  43991. var cachedSegments = {};
  43992. var temp = {};
  43993. var originalMappings = [];
  43994. var generatedMappings = [];
  43995. var mapping, str, segment, end, value;
  43996. while (index < length) {
  43997. if (aStr.charAt(index) === ';') {
  43998. generatedLine++;
  43999. index++;
  44000. previousGeneratedColumn = 0;
  44001. }
  44002. else if (aStr.charAt(index) === ',') {
  44003. index++;
  44004. }
  44005. else {
  44006. mapping = new Mapping();
  44007. mapping.generatedLine = generatedLine;
  44008. // Because each offset is encoded relative to the previous one,
  44009. // many segments often have the same encoding. We can exploit this
  44010. // fact by caching the parsed variable length fields of each segment,
  44011. // allowing us to avoid a second parse if we encounter the same
  44012. // segment again.
  44013. for (end = index; end < length; end++) {
  44014. if (this._charIsMappingSeparator(aStr, end)) {
  44015. break;
  44016. }
  44017. }
  44018. str = aStr.slice(index, end);
  44019. segment = cachedSegments[str];
  44020. if (segment) {
  44021. index += str.length;
  44022. } else {
  44023. segment = [];
  44024. while (index < end) {
  44025. base64VLQ.decode(aStr, index, temp);
  44026. value = temp.value;
  44027. index = temp.rest;
  44028. segment.push(value);
  44029. }
  44030. if (segment.length === 2) {
  44031. throw new Error('Found a source, but no line and column');
  44032. }
  44033. if (segment.length === 3) {
  44034. throw new Error('Found a source and line, but no column');
  44035. }
  44036. cachedSegments[str] = segment;
  44037. }
  44038. // Generated column.
  44039. mapping.generatedColumn = previousGeneratedColumn + segment[0];
  44040. previousGeneratedColumn = mapping.generatedColumn;
  44041. if (segment.length > 1) {
  44042. // Original source.
  44043. mapping.source = previousSource + segment[1];
  44044. previousSource += segment[1];
  44045. // Original line.
  44046. mapping.originalLine = previousOriginalLine + segment[2];
  44047. previousOriginalLine = mapping.originalLine;
  44048. // Lines are stored 0-based
  44049. mapping.originalLine += 1;
  44050. // Original column.
  44051. mapping.originalColumn = previousOriginalColumn + segment[3];
  44052. previousOriginalColumn = mapping.originalColumn;
  44053. if (segment.length > 4) {
  44054. // Original name.
  44055. mapping.name = previousName + segment[4];
  44056. previousName += segment[4];
  44057. }
  44058. }
  44059. generatedMappings.push(mapping);
  44060. if (typeof mapping.originalLine === 'number') {
  44061. originalMappings.push(mapping);
  44062. }
  44063. }
  44064. }
  44065. quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated);
  44066. this.__generatedMappings = generatedMappings;
  44067. quickSort(originalMappings, util.compareByOriginalPositions);
  44068. this.__originalMappings = originalMappings;
  44069. };
  44070. /**
  44071. * Find the mapping that best matches the hypothetical "needle" mapping that
  44072. * we are searching for in the given "haystack" of mappings.
  44073. */
  44074. BasicSourceMapConsumer.prototype._findMapping =
  44075. function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,
  44076. aColumnName, aComparator, aBias) {
  44077. // To return the position we are searching for, we must first find the
  44078. // mapping for the given position and then return the opposite position it
  44079. // points to. Because the mappings are sorted, we can use binary search to
  44080. // find the best mapping.
  44081. if (aNeedle[aLineName] <= 0) {
  44082. throw new TypeError('Line must be greater than or equal to 1, got '
  44083. + aNeedle[aLineName]);
  44084. }
  44085. if (aNeedle[aColumnName] < 0) {
  44086. throw new TypeError('Column must be greater than or equal to 0, got '
  44087. + aNeedle[aColumnName]);
  44088. }
  44089. return binarySearch.search(aNeedle, aMappings, aComparator, aBias);
  44090. };
  44091. /**
  44092. * Compute the last column for each generated mapping. The last column is
  44093. * inclusive.
  44094. */
  44095. BasicSourceMapConsumer.prototype.computeColumnSpans =
  44096. function SourceMapConsumer_computeColumnSpans() {
  44097. for (var index = 0; index < this._generatedMappings.length; ++index) {
  44098. var mapping = this._generatedMappings[index];
  44099. // Mappings do not contain a field for the last generated columnt. We
  44100. // can come up with an optimistic estimate, however, by assuming that
  44101. // mappings are contiguous (i.e. given two consecutive mappings, the
  44102. // first mapping ends where the second one starts).
  44103. if (index + 1 < this._generatedMappings.length) {
  44104. var nextMapping = this._generatedMappings[index + 1];
  44105. if (mapping.generatedLine === nextMapping.generatedLine) {
  44106. mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;
  44107. continue;
  44108. }
  44109. }
  44110. // The last mapping for each line spans the entire line.
  44111. mapping.lastGeneratedColumn = Infinity;
  44112. }
  44113. };
  44114. /**
  44115. * Returns the original source, line, and column information for the generated
  44116. * source's line and column positions provided. The only argument is an object
  44117. * with the following properties:
  44118. *
  44119. * - line: The line number in the generated source.
  44120. * - column: The column number in the generated source.
  44121. * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
  44122. * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
  44123. * closest element that is smaller than or greater than the one we are
  44124. * searching for, respectively, if the exact element cannot be found.
  44125. * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
  44126. *
  44127. * and an object is returned with the following properties:
  44128. *
  44129. * - source: The original source file, or null.
  44130. * - line: The line number in the original source, or null.
  44131. * - column: The column number in the original source, or null.
  44132. * - name: The original identifier, or null.
  44133. */
  44134. BasicSourceMapConsumer.prototype.originalPositionFor =
  44135. function SourceMapConsumer_originalPositionFor(aArgs) {
  44136. var needle = {
  44137. generatedLine: util.getArg(aArgs, 'line'),
  44138. generatedColumn: util.getArg(aArgs, 'column')
  44139. };
  44140. var index = this._findMapping(
  44141. needle,
  44142. this._generatedMappings,
  44143. "generatedLine",
  44144. "generatedColumn",
  44145. util.compareByGeneratedPositionsDeflated,
  44146. util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)
  44147. );
  44148. if (index >= 0) {
  44149. var mapping = this._generatedMappings[index];
  44150. if (mapping.generatedLine === needle.generatedLine) {
  44151. var source = util.getArg(mapping, 'source', null);
  44152. if (source !== null) {
  44153. source = this._sources.at(source);
  44154. if (this.sourceRoot != null) {
  44155. source = util.join(this.sourceRoot, source);
  44156. }
  44157. }
  44158. var name = util.getArg(mapping, 'name', null);
  44159. if (name !== null) {
  44160. name = this._names.at(name);
  44161. }
  44162. return {
  44163. source: source,
  44164. line: util.getArg(mapping, 'originalLine', null),
  44165. column: util.getArg(mapping, 'originalColumn', null),
  44166. name: name
  44167. };
  44168. }
  44169. }
  44170. return {
  44171. source: null,
  44172. line: null,
  44173. column: null,
  44174. name: null
  44175. };
  44176. };
  44177. /**
  44178. * Return true if we have the source content for every source in the source
  44179. * map, false otherwise.
  44180. */
  44181. BasicSourceMapConsumer.prototype.hasContentsOfAllSources =
  44182. function BasicSourceMapConsumer_hasContentsOfAllSources() {
  44183. if (!this.sourcesContent) {
  44184. return false;
  44185. }
  44186. return this.sourcesContent.length >= this._sources.size() &&
  44187. !this.sourcesContent.some(function (sc) { return sc == null; });
  44188. };
  44189. /**
  44190. * Returns the original source content. The only argument is the url of the
  44191. * original source file. Returns null if no original source content is
  44192. * available.
  44193. */
  44194. BasicSourceMapConsumer.prototype.sourceContentFor =
  44195. function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
  44196. if (!this.sourcesContent) {
  44197. return null;
  44198. }
  44199. if (this.sourceRoot != null) {
  44200. aSource = util.relative(this.sourceRoot, aSource);
  44201. }
  44202. if (this._sources.has(aSource)) {
  44203. return this.sourcesContent[this._sources.indexOf(aSource)];
  44204. }
  44205. var url;
  44206. if (this.sourceRoot != null
  44207. && (url = util.urlParse(this.sourceRoot))) {
  44208. // XXX: file:// URIs and absolute paths lead to unexpected behavior for
  44209. // many users. We can help them out when they expect file:// URIs to
  44210. // behave like it would if they were running a local HTTP server. See
  44211. // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.
  44212. var fileUriAbsPath = aSource.replace(/^file:\/\//, "");
  44213. if (url.scheme == "file"
  44214. && this._sources.has(fileUriAbsPath)) {
  44215. return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]
  44216. }
  44217. if ((!url.path || url.path == "/")
  44218. && this._sources.has("/" + aSource)) {
  44219. return this.sourcesContent[this._sources.indexOf("/" + aSource)];
  44220. }
  44221. }
  44222. // This function is used recursively from
  44223. // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we
  44224. // don't want to throw if we can't find the source - we just want to
  44225. // return null, so we provide a flag to exit gracefully.
  44226. if (nullOnMissing) {
  44227. return null;
  44228. }
  44229. else {
  44230. throw new Error('"' + aSource + '" is not in the SourceMap.');
  44231. }
  44232. };
  44233. /**
  44234. * Returns the generated line and column information for the original source,
  44235. * line, and column positions provided. The only argument is an object with
  44236. * the following properties:
  44237. *
  44238. * - source: The filename of the original source.
  44239. * - line: The line number in the original source.
  44240. * - column: The column number in the original source.
  44241. * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
  44242. * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
  44243. * closest element that is smaller than or greater than the one we are
  44244. * searching for, respectively, if the exact element cannot be found.
  44245. * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
  44246. *
  44247. * and an object is returned with the following properties:
  44248. *
  44249. * - line: The line number in the generated source, or null.
  44250. * - column: The column number in the generated source, or null.
  44251. */
  44252. BasicSourceMapConsumer.prototype.generatedPositionFor =
  44253. function SourceMapConsumer_generatedPositionFor(aArgs) {
  44254. var source = util.getArg(aArgs, 'source');
  44255. if (this.sourceRoot != null) {
  44256. source = util.relative(this.sourceRoot, source);
  44257. }
  44258. if (!this._sources.has(source)) {
  44259. return {
  44260. line: null,
  44261. column: null,
  44262. lastColumn: null
  44263. };
  44264. }
  44265. source = this._sources.indexOf(source);
  44266. var needle = {
  44267. source: source,
  44268. originalLine: util.getArg(aArgs, 'line'),
  44269. originalColumn: util.getArg(aArgs, 'column')
  44270. };
  44271. var index = this._findMapping(
  44272. needle,
  44273. this._originalMappings,
  44274. "originalLine",
  44275. "originalColumn",
  44276. util.compareByOriginalPositions,
  44277. util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)
  44278. );
  44279. if (index >= 0) {
  44280. var mapping = this._originalMappings[index];
  44281. if (mapping.source === needle.source) {
  44282. return {
  44283. line: util.getArg(mapping, 'generatedLine', null),
  44284. column: util.getArg(mapping, 'generatedColumn', null),
  44285. lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
  44286. };
  44287. }
  44288. }
  44289. return {
  44290. line: null,
  44291. column: null,
  44292. lastColumn: null
  44293. };
  44294. };
  44295. exports.BasicSourceMapConsumer = BasicSourceMapConsumer;
  44296. /**
  44297. * An IndexedSourceMapConsumer instance represents a parsed source map which
  44298. * we can query for information. It differs from BasicSourceMapConsumer in
  44299. * that it takes "indexed" source maps (i.e. ones with a "sections" field) as
  44300. * input.
  44301. *
  44302. * The only parameter is a raw source map (either as a JSON string, or already
  44303. * parsed to an object). According to the spec for indexed source maps, they
  44304. * have the following attributes:
  44305. *
  44306. * - version: Which version of the source map spec this map is following.
  44307. * - file: Optional. The generated file this source map is associated with.
  44308. * - sections: A list of section definitions.
  44309. *
  44310. * Each value under the "sections" field has two fields:
  44311. * - offset: The offset into the original specified at which this section
  44312. * begins to apply, defined as an object with a "line" and "column"
  44313. * field.
  44314. * - map: A source map definition. This source map could also be indexed,
  44315. * but doesn't have to be.
  44316. *
  44317. * Instead of the "map" field, it's also possible to have a "url" field
  44318. * specifying a URL to retrieve a source map from, but that's currently
  44319. * unsupported.
  44320. *
  44321. * Here's an example source map, taken from the source map spec[0], but
  44322. * modified to omit a section which uses the "url" field.
  44323. *
  44324. * {
  44325. * version : 3,
  44326. * file: "app.js",
  44327. * sections: [{
  44328. * offset: {line:100, column:10},
  44329. * map: {
  44330. * version : 3,
  44331. * file: "section.js",
  44332. * sources: ["foo.js", "bar.js"],
  44333. * names: ["src", "maps", "are", "fun"],
  44334. * mappings: "AAAA,E;;ABCDE;"
  44335. * }
  44336. * }],
  44337. * }
  44338. *
  44339. * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt
  44340. */
  44341. function IndexedSourceMapConsumer(aSourceMap) {
  44342. var sourceMap = aSourceMap;
  44343. if (typeof aSourceMap === 'string') {
  44344. sourceMap = JSON.parse(aSourceMap.replace(/^\)\]\}'/, ''));
  44345. }
  44346. var version = util.getArg(sourceMap, 'version');
  44347. var sections = util.getArg(sourceMap, 'sections');
  44348. if (version != this._version) {
  44349. throw new Error('Unsupported version: ' + version);
  44350. }
  44351. this._sources = new ArraySet();
  44352. this._names = new ArraySet();
  44353. var lastOffset = {
  44354. line: -1,
  44355. column: 0
  44356. };
  44357. this._sections = sections.map(function (s) {
  44358. if (s.url) {
  44359. // The url field will require support for asynchronicity.
  44360. // See https://github.com/mozilla/source-map/issues/16
  44361. throw new Error('Support for url field in sections not implemented.');
  44362. }
  44363. var offset = util.getArg(s, 'offset');
  44364. var offsetLine = util.getArg(offset, 'line');
  44365. var offsetColumn = util.getArg(offset, 'column');
  44366. if (offsetLine < lastOffset.line ||
  44367. (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {
  44368. throw new Error('Section offsets must be ordered and non-overlapping.');
  44369. }
  44370. lastOffset = offset;
  44371. return {
  44372. generatedOffset: {
  44373. // The offset fields are 0-based, but we use 1-based indices when
  44374. // encoding/decoding from VLQ.
  44375. generatedLine: offsetLine + 1,
  44376. generatedColumn: offsetColumn + 1
  44377. },
  44378. consumer: new SourceMapConsumer(util.getArg(s, 'map'))
  44379. }
  44380. });
  44381. }
  44382. IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
  44383. IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;
  44384. /**
  44385. * The version of the source mapping spec that we are consuming.
  44386. */
  44387. IndexedSourceMapConsumer.prototype._version = 3;
  44388. /**
  44389. * The list of original sources.
  44390. */
  44391. Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {
  44392. get: function () {
  44393. var sources = [];
  44394. for (var i = 0; i < this._sections.length; i++) {
  44395. for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {
  44396. sources.push(this._sections[i].consumer.sources[j]);
  44397. }
  44398. }
  44399. return sources;
  44400. }
  44401. });
  44402. /**
  44403. * Returns the original source, line, and column information for the generated
  44404. * source's line and column positions provided. The only argument is an object
  44405. * with the following properties:
  44406. *
  44407. * - line: The line number in the generated source.
  44408. * - column: The column number in the generated source.
  44409. *
  44410. * and an object is returned with the following properties:
  44411. *
  44412. * - source: The original source file, or null.
  44413. * - line: The line number in the original source, or null.
  44414. * - column: The column number in the original source, or null.
  44415. * - name: The original identifier, or null.
  44416. */
  44417. IndexedSourceMapConsumer.prototype.originalPositionFor =
  44418. function IndexedSourceMapConsumer_originalPositionFor(aArgs) {
  44419. var needle = {
  44420. generatedLine: util.getArg(aArgs, 'line'),
  44421. generatedColumn: util.getArg(aArgs, 'column')
  44422. };
  44423. // Find the section containing the generated position we're trying to map
  44424. // to an original position.
  44425. var sectionIndex = binarySearch.search(needle, this._sections,
  44426. function(needle, section) {
  44427. var cmp = needle.generatedLine - section.generatedOffset.generatedLine;
  44428. if (cmp) {
  44429. return cmp;
  44430. }
  44431. return (needle.generatedColumn -
  44432. section.generatedOffset.generatedColumn);
  44433. });
  44434. var section = this._sections[sectionIndex];
  44435. if (!section) {
  44436. return {
  44437. source: null,
  44438. line: null,
  44439. column: null,
  44440. name: null
  44441. };
  44442. }
  44443. return section.consumer.originalPositionFor({
  44444. line: needle.generatedLine -
  44445. (section.generatedOffset.generatedLine - 1),
  44446. column: needle.generatedColumn -
  44447. (section.generatedOffset.generatedLine === needle.generatedLine
  44448. ? section.generatedOffset.generatedColumn - 1
  44449. : 0),
  44450. bias: aArgs.bias
  44451. });
  44452. };
  44453. /**
  44454. * Return true if we have the source content for every source in the source
  44455. * map, false otherwise.
  44456. */
  44457. IndexedSourceMapConsumer.prototype.hasContentsOfAllSources =
  44458. function IndexedSourceMapConsumer_hasContentsOfAllSources() {
  44459. return this._sections.every(function (s) {
  44460. return s.consumer.hasContentsOfAllSources();
  44461. });
  44462. };
  44463. /**
  44464. * Returns the original source content. The only argument is the url of the
  44465. * original source file. Returns null if no original source content is
  44466. * available.
  44467. */
  44468. IndexedSourceMapConsumer.prototype.sourceContentFor =
  44469. function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
  44470. for (var i = 0; i < this._sections.length; i++) {
  44471. var section = this._sections[i];
  44472. var content = section.consumer.sourceContentFor(aSource, true);
  44473. if (content) {
  44474. return content;
  44475. }
  44476. }
  44477. if (nullOnMissing) {
  44478. return null;
  44479. }
  44480. else {
  44481. throw new Error('"' + aSource + '" is not in the SourceMap.');
  44482. }
  44483. };
  44484. /**
  44485. * Returns the generated line and column information for the original source,
  44486. * line, and column positions provided. The only argument is an object with
  44487. * the following properties:
  44488. *
  44489. * - source: The filename of the original source.
  44490. * - line: The line number in the original source.
  44491. * - column: The column number in the original source.
  44492. *
  44493. * and an object is returned with the following properties:
  44494. *
  44495. * - line: The line number in the generated source, or null.
  44496. * - column: The column number in the generated source, or null.
  44497. */
  44498. IndexedSourceMapConsumer.prototype.generatedPositionFor =
  44499. function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {
  44500. for (var i = 0; i < this._sections.length; i++) {
  44501. var section = this._sections[i];
  44502. // Only consider this section if the requested source is in the list of
  44503. // sources of the consumer.
  44504. if (section.consumer.sources.indexOf(util.getArg(aArgs, 'source')) === -1) {
  44505. continue;
  44506. }
  44507. var generatedPosition = section.consumer.generatedPositionFor(aArgs);
  44508. if (generatedPosition) {
  44509. var ret = {
  44510. line: generatedPosition.line +
  44511. (section.generatedOffset.generatedLine - 1),
  44512. column: generatedPosition.column +
  44513. (section.generatedOffset.generatedLine === generatedPosition.line
  44514. ? section.generatedOffset.generatedColumn - 1
  44515. : 0)
  44516. };
  44517. return ret;
  44518. }
  44519. }
  44520. return {
  44521. line: null,
  44522. column: null
  44523. };
  44524. };
  44525. /**
  44526. * Parse the mappings in a string in to a data structure which we can easily
  44527. * query (the ordered arrays in the `this.__generatedMappings` and
  44528. * `this.__originalMappings` properties).
  44529. */
  44530. IndexedSourceMapConsumer.prototype._parseMappings =
  44531. function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {
  44532. this.__generatedMappings = [];
  44533. this.__originalMappings = [];
  44534. for (var i = 0; i < this._sections.length; i++) {
  44535. var section = this._sections[i];
  44536. var sectionMappings = section.consumer._generatedMappings;
  44537. for (var j = 0; j < sectionMappings.length; j++) {
  44538. var mapping = sectionMappings[j];
  44539. var source = section.consumer._sources.at(mapping.source);
  44540. if (section.consumer.sourceRoot !== null) {
  44541. source = util.join(section.consumer.sourceRoot, source);
  44542. }
  44543. this._sources.add(source);
  44544. source = this._sources.indexOf(source);
  44545. var name = section.consumer._names.at(mapping.name);
  44546. this._names.add(name);
  44547. name = this._names.indexOf(name);
  44548. // The mappings coming from the consumer for the section have
  44549. // generated positions relative to the start of the section, so we
  44550. // need to offset them to be relative to the start of the concatenated
  44551. // generated file.
  44552. var adjustedMapping = {
  44553. source: source,
  44554. generatedLine: mapping.generatedLine +
  44555. (section.generatedOffset.generatedLine - 1),
  44556. generatedColumn: mapping.generatedColumn +
  44557. (section.generatedOffset.generatedLine === mapping.generatedLine
  44558. ? section.generatedOffset.generatedColumn - 1
  44559. : 0),
  44560. originalLine: mapping.originalLine,
  44561. originalColumn: mapping.originalColumn,
  44562. name: name
  44563. };
  44564. this.__generatedMappings.push(adjustedMapping);
  44565. if (typeof adjustedMapping.originalLine === 'number') {
  44566. this.__originalMappings.push(adjustedMapping);
  44567. }
  44568. }
  44569. }
  44570. quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);
  44571. quickSort(this.__originalMappings, util.compareByOriginalPositions);
  44572. };
  44573. exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;
  44574. },{"./array-set":542,"./base64-vlq":543,"./binary-search":545,"./quick-sort":547,"./util":551}],549:[function(require,module,exports){
  44575. /* -*- Mode: js; js-indent-level: 2; -*- */
  44576. /*
  44577. * Copyright 2011 Mozilla Foundation and contributors
  44578. * Licensed under the New BSD license. See LICENSE or:
  44579. * http://opensource.org/licenses/BSD-3-Clause
  44580. */
  44581. var base64VLQ = require('./base64-vlq');
  44582. var util = require('./util');
  44583. var ArraySet = require('./array-set').ArraySet;
  44584. var MappingList = require('./mapping-list').MappingList;
  44585. /**
  44586. * An instance of the SourceMapGenerator represents a source map which is
  44587. * being built incrementally. You may pass an object with the following
  44588. * properties:
  44589. *
  44590. * - file: The filename of the generated source.
  44591. * - sourceRoot: A root for all relative URLs in this source map.
  44592. */
  44593. function SourceMapGenerator(aArgs) {
  44594. if (!aArgs) {
  44595. aArgs = {};
  44596. }
  44597. this._file = util.getArg(aArgs, 'file', null);
  44598. this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);
  44599. this._skipValidation = util.getArg(aArgs, 'skipValidation', false);
  44600. this._sources = new ArraySet();
  44601. this._names = new ArraySet();
  44602. this._mappings = new MappingList();
  44603. this._sourcesContents = null;
  44604. }
  44605. SourceMapGenerator.prototype._version = 3;
  44606. /**
  44607. * Creates a new SourceMapGenerator based on a SourceMapConsumer
  44608. *
  44609. * @param aSourceMapConsumer The SourceMap.
  44610. */
  44611. SourceMapGenerator.fromSourceMap =
  44612. function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
  44613. var sourceRoot = aSourceMapConsumer.sourceRoot;
  44614. var generator = new SourceMapGenerator({
  44615. file: aSourceMapConsumer.file,
  44616. sourceRoot: sourceRoot
  44617. });
  44618. aSourceMapConsumer.eachMapping(function (mapping) {
  44619. var newMapping = {
  44620. generated: {
  44621. line: mapping.generatedLine,
  44622. column: mapping.generatedColumn
  44623. }
  44624. };
  44625. if (mapping.source != null) {
  44626. newMapping.source = mapping.source;
  44627. if (sourceRoot != null) {
  44628. newMapping.source = util.relative(sourceRoot, newMapping.source);
  44629. }
  44630. newMapping.original = {
  44631. line: mapping.originalLine,
  44632. column: mapping.originalColumn
  44633. };
  44634. if (mapping.name != null) {
  44635. newMapping.name = mapping.name;
  44636. }
  44637. }
  44638. generator.addMapping(newMapping);
  44639. });
  44640. aSourceMapConsumer.sources.forEach(function (sourceFile) {
  44641. var content = aSourceMapConsumer.sourceContentFor(sourceFile);
  44642. if (content != null) {
  44643. generator.setSourceContent(sourceFile, content);
  44644. }
  44645. });
  44646. return generator;
  44647. };
  44648. /**
  44649. * Add a single mapping from original source line and column to the generated
  44650. * source's line and column for this source map being created. The mapping
  44651. * object should have the following properties:
  44652. *
  44653. * - generated: An object with the generated line and column positions.
  44654. * - original: An object with the original line and column positions.
  44655. * - source: The original source file (relative to the sourceRoot).
  44656. * - name: An optional original token name for this mapping.
  44657. */
  44658. SourceMapGenerator.prototype.addMapping =
  44659. function SourceMapGenerator_addMapping(aArgs) {
  44660. var generated = util.getArg(aArgs, 'generated');
  44661. var original = util.getArg(aArgs, 'original', null);
  44662. var source = util.getArg(aArgs, 'source', null);
  44663. var name = util.getArg(aArgs, 'name', null);
  44664. if (!this._skipValidation) {
  44665. this._validateMapping(generated, original, source, name);
  44666. }
  44667. if (source != null) {
  44668. source = String(source);
  44669. if (!this._sources.has(source)) {
  44670. this._sources.add(source);
  44671. }
  44672. }
  44673. if (name != null) {
  44674. name = String(name);
  44675. if (!this._names.has(name)) {
  44676. this._names.add(name);
  44677. }
  44678. }
  44679. this._mappings.add({
  44680. generatedLine: generated.line,
  44681. generatedColumn: generated.column,
  44682. originalLine: original != null && original.line,
  44683. originalColumn: original != null && original.column,
  44684. source: source,
  44685. name: name
  44686. });
  44687. };
  44688. /**
  44689. * Set the source content for a source file.
  44690. */
  44691. SourceMapGenerator.prototype.setSourceContent =
  44692. function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
  44693. var source = aSourceFile;
  44694. if (this._sourceRoot != null) {
  44695. source = util.relative(this._sourceRoot, source);
  44696. }
  44697. if (aSourceContent != null) {
  44698. // Add the source content to the _sourcesContents map.
  44699. // Create a new _sourcesContents map if the property is null.
  44700. if (!this._sourcesContents) {
  44701. this._sourcesContents = Object.create(null);
  44702. }
  44703. this._sourcesContents[util.toSetString(source)] = aSourceContent;
  44704. } else if (this._sourcesContents) {
  44705. // Remove the source file from the _sourcesContents map.
  44706. // If the _sourcesContents map is empty, set the property to null.
  44707. delete this._sourcesContents[util.toSetString(source)];
  44708. if (Object.keys(this._sourcesContents).length === 0) {
  44709. this._sourcesContents = null;
  44710. }
  44711. }
  44712. };
  44713. /**
  44714. * Applies the mappings of a sub-source-map for a specific source file to the
  44715. * source map being generated. Each mapping to the supplied source file is
  44716. * rewritten using the supplied source map. Note: The resolution for the
  44717. * resulting mappings is the minimium of this map and the supplied map.
  44718. *
  44719. * @param aSourceMapConsumer The source map to be applied.
  44720. * @param aSourceFile Optional. The filename of the source file.
  44721. * If omitted, SourceMapConsumer's file property will be used.
  44722. * @param aSourceMapPath Optional. The dirname of the path to the source map
  44723. * to be applied. If relative, it is relative to the SourceMapConsumer.
  44724. * This parameter is needed when the two source maps aren't in the same
  44725. * directory, and the source map to be applied contains relative source
  44726. * paths. If so, those relative source paths need to be rewritten
  44727. * relative to the SourceMapGenerator.
  44728. */
  44729. SourceMapGenerator.prototype.applySourceMap =
  44730. function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
  44731. var sourceFile = aSourceFile;
  44732. // If aSourceFile is omitted, we will use the file property of the SourceMap
  44733. if (aSourceFile == null) {
  44734. if (aSourceMapConsumer.file == null) {
  44735. throw new Error(
  44736. 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +
  44737. 'or the source map\'s "file" property. Both were omitted.'
  44738. );
  44739. }
  44740. sourceFile = aSourceMapConsumer.file;
  44741. }
  44742. var sourceRoot = this._sourceRoot;
  44743. // Make "sourceFile" relative if an absolute Url is passed.
  44744. if (sourceRoot != null) {
  44745. sourceFile = util.relative(sourceRoot, sourceFile);
  44746. }
  44747. // Applying the SourceMap can add and remove items from the sources and
  44748. // the names array.
  44749. var newSources = new ArraySet();
  44750. var newNames = new ArraySet();
  44751. // Find mappings for the "sourceFile"
  44752. this._mappings.unsortedForEach(function (mapping) {
  44753. if (mapping.source === sourceFile && mapping.originalLine != null) {
  44754. // Check if it can be mapped by the source map, then update the mapping.
  44755. var original = aSourceMapConsumer.originalPositionFor({
  44756. line: mapping.originalLine,
  44757. column: mapping.originalColumn
  44758. });
  44759. if (original.source != null) {
  44760. // Copy mapping
  44761. mapping.source = original.source;
  44762. if (aSourceMapPath != null) {
  44763. mapping.source = util.join(aSourceMapPath, mapping.source)
  44764. }
  44765. if (sourceRoot != null) {
  44766. mapping.source = util.relative(sourceRoot, mapping.source);
  44767. }
  44768. mapping.originalLine = original.line;
  44769. mapping.originalColumn = original.column;
  44770. if (original.name != null) {
  44771. mapping.name = original.name;
  44772. }
  44773. }
  44774. }
  44775. var source = mapping.source;
  44776. if (source != null && !newSources.has(source)) {
  44777. newSources.add(source);
  44778. }
  44779. var name = mapping.name;
  44780. if (name != null && !newNames.has(name)) {
  44781. newNames.add(name);
  44782. }
  44783. }, this);
  44784. this._sources = newSources;
  44785. this._names = newNames;
  44786. // Copy sourcesContents of applied map.
  44787. aSourceMapConsumer.sources.forEach(function (sourceFile) {
  44788. var content = aSourceMapConsumer.sourceContentFor(sourceFile);
  44789. if (content != null) {
  44790. if (aSourceMapPath != null) {
  44791. sourceFile = util.join(aSourceMapPath, sourceFile);
  44792. }
  44793. if (sourceRoot != null) {
  44794. sourceFile = util.relative(sourceRoot, sourceFile);
  44795. }
  44796. this.setSourceContent(sourceFile, content);
  44797. }
  44798. }, this);
  44799. };
  44800. /**
  44801. * A mapping can have one of the three levels of data:
  44802. *
  44803. * 1. Just the generated position.
  44804. * 2. The Generated position, original position, and original source.
  44805. * 3. Generated and original position, original source, as well as a name
  44806. * token.
  44807. *
  44808. * To maintain consistency, we validate that any new mapping being added falls
  44809. * in to one of these categories.
  44810. */
  44811. SourceMapGenerator.prototype._validateMapping =
  44812. function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,
  44813. aName) {
  44814. // When aOriginal is truthy but has empty values for .line and .column,
  44815. // it is most likely a programmer error. In this case we throw a very
  44816. // specific error message to try to guide them the right way.
  44817. // For example: https://github.com/Polymer/polymer-bundler/pull/519
  44818. if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {
  44819. throw new Error(
  44820. 'original.line and original.column are not numbers -- you probably meant to omit ' +
  44821. 'the original mapping entirely and only map the generated position. If so, pass ' +
  44822. 'null for the original mapping instead of an object with empty or null values.'
  44823. );
  44824. }
  44825. if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
  44826. && aGenerated.line > 0 && aGenerated.column >= 0
  44827. && !aOriginal && !aSource && !aName) {
  44828. // Case 1.
  44829. return;
  44830. }
  44831. else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
  44832. && aOriginal && 'line' in aOriginal && 'column' in aOriginal
  44833. && aGenerated.line > 0 && aGenerated.column >= 0
  44834. && aOriginal.line > 0 && aOriginal.column >= 0
  44835. && aSource) {
  44836. // Cases 2 and 3.
  44837. return;
  44838. }
  44839. else {
  44840. throw new Error('Invalid mapping: ' + JSON.stringify({
  44841. generated: aGenerated,
  44842. source: aSource,
  44843. original: aOriginal,
  44844. name: aName
  44845. }));
  44846. }
  44847. };
  44848. /**
  44849. * Serialize the accumulated mappings in to the stream of base 64 VLQs
  44850. * specified by the source map format.
  44851. */
  44852. SourceMapGenerator.prototype._serializeMappings =
  44853. function SourceMapGenerator_serializeMappings() {
  44854. var previousGeneratedColumn = 0;
  44855. var previousGeneratedLine = 1;
  44856. var previousOriginalColumn = 0;
  44857. var previousOriginalLine = 0;
  44858. var previousName = 0;
  44859. var previousSource = 0;
  44860. var result = '';
  44861. var next;
  44862. var mapping;
  44863. var nameIdx;
  44864. var sourceIdx;
  44865. var mappings = this._mappings.toArray();
  44866. for (var i = 0, len = mappings.length; i < len; i++) {
  44867. mapping = mappings[i];
  44868. next = ''
  44869. if (mapping.generatedLine !== previousGeneratedLine) {
  44870. previousGeneratedColumn = 0;
  44871. while (mapping.generatedLine !== previousGeneratedLine) {
  44872. next += ';';
  44873. previousGeneratedLine++;
  44874. }
  44875. }
  44876. else {
  44877. if (i > 0) {
  44878. if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
  44879. continue;
  44880. }
  44881. next += ',';
  44882. }
  44883. }
  44884. next += base64VLQ.encode(mapping.generatedColumn
  44885. - previousGeneratedColumn);
  44886. previousGeneratedColumn = mapping.generatedColumn;
  44887. if (mapping.source != null) {
  44888. sourceIdx = this._sources.indexOf(mapping.source);
  44889. next += base64VLQ.encode(sourceIdx - previousSource);
  44890. previousSource = sourceIdx;
  44891. // lines are stored 0-based in SourceMap spec version 3
  44892. next += base64VLQ.encode(mapping.originalLine - 1
  44893. - previousOriginalLine);
  44894. previousOriginalLine = mapping.originalLine - 1;
  44895. next += base64VLQ.encode(mapping.originalColumn
  44896. - previousOriginalColumn);
  44897. previousOriginalColumn = mapping.originalColumn;
  44898. if (mapping.name != null) {
  44899. nameIdx = this._names.indexOf(mapping.name);
  44900. next += base64VLQ.encode(nameIdx - previousName);
  44901. previousName = nameIdx;
  44902. }
  44903. }
  44904. result += next;
  44905. }
  44906. return result;
  44907. };
  44908. SourceMapGenerator.prototype._generateSourcesContent =
  44909. function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
  44910. return aSources.map(function (source) {
  44911. if (!this._sourcesContents) {
  44912. return null;
  44913. }
  44914. if (aSourceRoot != null) {
  44915. source = util.relative(aSourceRoot, source);
  44916. }
  44917. var key = util.toSetString(source);
  44918. return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)
  44919. ? this._sourcesContents[key]
  44920. : null;
  44921. }, this);
  44922. };
  44923. /**
  44924. * Externalize the source map.
  44925. */
  44926. SourceMapGenerator.prototype.toJSON =
  44927. function SourceMapGenerator_toJSON() {
  44928. var map = {
  44929. version: this._version,
  44930. sources: this._sources.toArray(),
  44931. names: this._names.toArray(),
  44932. mappings: this._serializeMappings()
  44933. };
  44934. if (this._file != null) {
  44935. map.file = this._file;
  44936. }
  44937. if (this._sourceRoot != null) {
  44938. map.sourceRoot = this._sourceRoot;
  44939. }
  44940. if (this._sourcesContents) {
  44941. map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
  44942. }
  44943. return map;
  44944. };
  44945. /**
  44946. * Render the source map being generated to a string.
  44947. */
  44948. SourceMapGenerator.prototype.toString =
  44949. function SourceMapGenerator_toString() {
  44950. return JSON.stringify(this.toJSON());
  44951. };
  44952. exports.SourceMapGenerator = SourceMapGenerator;
  44953. },{"./array-set":542,"./base64-vlq":543,"./mapping-list":546,"./util":551}],550:[function(require,module,exports){
  44954. /* -*- Mode: js; js-indent-level: 2; -*- */
  44955. /*
  44956. * Copyright 2011 Mozilla Foundation and contributors
  44957. * Licensed under the New BSD license. See LICENSE or:
  44958. * http://opensource.org/licenses/BSD-3-Clause
  44959. */
  44960. var SourceMapGenerator = require('./source-map-generator').SourceMapGenerator;
  44961. var util = require('./util');
  44962. // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other
  44963. // operating systems these days (capturing the result).
  44964. var REGEX_NEWLINE = /(\r?\n)/;
  44965. // Newline character code for charCodeAt() comparisons
  44966. var NEWLINE_CODE = 10;
  44967. // Private symbol for identifying `SourceNode`s when multiple versions of
  44968. // the source-map library are loaded. This MUST NOT CHANGE across
  44969. // versions!
  44970. var isSourceNode = "$$$isSourceNode$$$";
  44971. /**
  44972. * SourceNodes provide a way to abstract over interpolating/concatenating
  44973. * snippets of generated JavaScript source code while maintaining the line and
  44974. * column information associated with the original source code.
  44975. *
  44976. * @param aLine The original line number.
  44977. * @param aColumn The original column number.
  44978. * @param aSource The original source's filename.
  44979. * @param aChunks Optional. An array of strings which are snippets of
  44980. * generated JS, or other SourceNodes.
  44981. * @param aName The original identifier.
  44982. */
  44983. function SourceNode(aLine, aColumn, aSource, aChunks, aName) {
  44984. this.children = [];
  44985. this.sourceContents = {};
  44986. this.line = aLine == null ? null : aLine;
  44987. this.column = aColumn == null ? null : aColumn;
  44988. this.source = aSource == null ? null : aSource;
  44989. this.name = aName == null ? null : aName;
  44990. this[isSourceNode] = true;
  44991. if (aChunks != null) this.add(aChunks);
  44992. }
  44993. /**
  44994. * Creates a SourceNode from generated code and a SourceMapConsumer.
  44995. *
  44996. * @param aGeneratedCode The generated code
  44997. * @param aSourceMapConsumer The SourceMap for the generated code
  44998. * @param aRelativePath Optional. The path that relative sources in the
  44999. * SourceMapConsumer should be relative to.
  45000. */
  45001. SourceNode.fromStringWithSourceMap =
  45002. function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {
  45003. // The SourceNode we want to fill with the generated code
  45004. // and the SourceMap
  45005. var node = new SourceNode();
  45006. // All even indices of this array are one line of the generated code,
  45007. // while all odd indices are the newlines between two adjacent lines
  45008. // (since `REGEX_NEWLINE` captures its match).
  45009. // Processed fragments are accessed by calling `shiftNextLine`.
  45010. var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
  45011. var remainingLinesIndex = 0;
  45012. var shiftNextLine = function() {
  45013. var lineContents = getNextLine();
  45014. // The last line of a file might not have a newline.
  45015. var newLine = getNextLine() || "";
  45016. return lineContents + newLine;
  45017. function getNextLine() {
  45018. return remainingLinesIndex < remainingLines.length ?
  45019. remainingLines[remainingLinesIndex++] : undefined;
  45020. }
  45021. };
  45022. // We need to remember the position of "remainingLines"
  45023. var lastGeneratedLine = 1, lastGeneratedColumn = 0;
  45024. // The generate SourceNodes we need a code range.
  45025. // To extract it current and last mapping is used.
  45026. // Here we store the last mapping.
  45027. var lastMapping = null;
  45028. aSourceMapConsumer.eachMapping(function (mapping) {
  45029. if (lastMapping !== null) {
  45030. // We add the code from "lastMapping" to "mapping":
  45031. // First check if there is a new line in between.
  45032. if (lastGeneratedLine < mapping.generatedLine) {
  45033. // Associate first line with "lastMapping"
  45034. addMappingWithCode(lastMapping, shiftNextLine());
  45035. lastGeneratedLine++;
  45036. lastGeneratedColumn = 0;
  45037. // The remaining code is added without mapping
  45038. } else {
  45039. // There is no new line in between.
  45040. // Associate the code between "lastGeneratedColumn" and
  45041. // "mapping.generatedColumn" with "lastMapping"
  45042. var nextLine = remainingLines[remainingLinesIndex];
  45043. var code = nextLine.substr(0, mapping.generatedColumn -
  45044. lastGeneratedColumn);
  45045. remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn -
  45046. lastGeneratedColumn);
  45047. lastGeneratedColumn = mapping.generatedColumn;
  45048. addMappingWithCode(lastMapping, code);
  45049. // No more remaining code, continue
  45050. lastMapping = mapping;
  45051. return;
  45052. }
  45053. }
  45054. // We add the generated code until the first mapping
  45055. // to the SourceNode without any mapping.
  45056. // Each line is added as separate string.
  45057. while (lastGeneratedLine < mapping.generatedLine) {
  45058. node.add(shiftNextLine());
  45059. lastGeneratedLine++;
  45060. }
  45061. if (lastGeneratedColumn < mapping.generatedColumn) {
  45062. var nextLine = remainingLines[remainingLinesIndex];
  45063. node.add(nextLine.substr(0, mapping.generatedColumn));
  45064. remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);
  45065. lastGeneratedColumn = mapping.generatedColumn;
  45066. }
  45067. lastMapping = mapping;
  45068. }, this);
  45069. // We have processed all mappings.
  45070. if (remainingLinesIndex < remainingLines.length) {
  45071. if (lastMapping) {
  45072. // Associate the remaining code in the current line with "lastMapping"
  45073. addMappingWithCode(lastMapping, shiftNextLine());
  45074. }
  45075. // and add the remaining lines without any mapping
  45076. node.add(remainingLines.splice(remainingLinesIndex).join(""));
  45077. }
  45078. // Copy sourcesContent into SourceNode
  45079. aSourceMapConsumer.sources.forEach(function (sourceFile) {
  45080. var content = aSourceMapConsumer.sourceContentFor(sourceFile);
  45081. if (content != null) {
  45082. if (aRelativePath != null) {
  45083. sourceFile = util.join(aRelativePath, sourceFile);
  45084. }
  45085. node.setSourceContent(sourceFile, content);
  45086. }
  45087. });
  45088. return node;
  45089. function addMappingWithCode(mapping, code) {
  45090. if (mapping === null || mapping.source === undefined) {
  45091. node.add(code);
  45092. } else {
  45093. var source = aRelativePath
  45094. ? util.join(aRelativePath, mapping.source)
  45095. : mapping.source;
  45096. node.add(new SourceNode(mapping.originalLine,
  45097. mapping.originalColumn,
  45098. source,
  45099. code,
  45100. mapping.name));
  45101. }
  45102. }
  45103. };
  45104. /**
  45105. * Add a chunk of generated JS to this source node.
  45106. *
  45107. * @param aChunk A string snippet of generated JS code, another instance of
  45108. * SourceNode, or an array where each member is one of those things.
  45109. */
  45110. SourceNode.prototype.add = function SourceNode_add(aChunk) {
  45111. if (Array.isArray(aChunk)) {
  45112. aChunk.forEach(function (chunk) {
  45113. this.add(chunk);
  45114. }, this);
  45115. }
  45116. else if (aChunk[isSourceNode] || typeof aChunk === "string") {
  45117. if (aChunk) {
  45118. this.children.push(aChunk);
  45119. }
  45120. }
  45121. else {
  45122. throw new TypeError(
  45123. "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
  45124. );
  45125. }
  45126. return this;
  45127. };
  45128. /**
  45129. * Add a chunk of generated JS to the beginning of this source node.
  45130. *
  45131. * @param aChunk A string snippet of generated JS code, another instance of
  45132. * SourceNode, or an array where each member is one of those things.
  45133. */
  45134. SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {
  45135. if (Array.isArray(aChunk)) {
  45136. for (var i = aChunk.length-1; i >= 0; i--) {
  45137. this.prepend(aChunk[i]);
  45138. }
  45139. }
  45140. else if (aChunk[isSourceNode] || typeof aChunk === "string") {
  45141. this.children.unshift(aChunk);
  45142. }
  45143. else {
  45144. throw new TypeError(
  45145. "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
  45146. );
  45147. }
  45148. return this;
  45149. };
  45150. /**
  45151. * Walk over the tree of JS snippets in this node and its children. The
  45152. * walking function is called once for each snippet of JS and is passed that
  45153. * snippet and the its original associated source's line/column location.
  45154. *
  45155. * @param aFn The traversal function.
  45156. */
  45157. SourceNode.prototype.walk = function SourceNode_walk(aFn) {
  45158. var chunk;
  45159. for (var i = 0, len = this.children.length; i < len; i++) {
  45160. chunk = this.children[i];
  45161. if (chunk[isSourceNode]) {
  45162. chunk.walk(aFn);
  45163. }
  45164. else {
  45165. if (chunk !== '') {
  45166. aFn(chunk, { source: this.source,
  45167. line: this.line,
  45168. column: this.column,
  45169. name: this.name });
  45170. }
  45171. }
  45172. }
  45173. };
  45174. /**
  45175. * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between
  45176. * each of `this.children`.
  45177. *
  45178. * @param aSep The separator.
  45179. */
  45180. SourceNode.prototype.join = function SourceNode_join(aSep) {
  45181. var newChildren;
  45182. var i;
  45183. var len = this.children.length;
  45184. if (len > 0) {
  45185. newChildren = [];
  45186. for (i = 0; i < len-1; i++) {
  45187. newChildren.push(this.children[i]);
  45188. newChildren.push(aSep);
  45189. }
  45190. newChildren.push(this.children[i]);
  45191. this.children = newChildren;
  45192. }
  45193. return this;
  45194. };
  45195. /**
  45196. * Call String.prototype.replace on the very right-most source snippet. Useful
  45197. * for trimming whitespace from the end of a source node, etc.
  45198. *
  45199. * @param aPattern The pattern to replace.
  45200. * @param aReplacement The thing to replace the pattern with.
  45201. */
  45202. SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {
  45203. var lastChild = this.children[this.children.length - 1];
  45204. if (lastChild[isSourceNode]) {
  45205. lastChild.replaceRight(aPattern, aReplacement);
  45206. }
  45207. else if (typeof lastChild === 'string') {
  45208. this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
  45209. }
  45210. else {
  45211. this.children.push(''.replace(aPattern, aReplacement));
  45212. }
  45213. return this;
  45214. };
  45215. /**
  45216. * Set the source content for a source file. This will be added to the SourceMapGenerator
  45217. * in the sourcesContent field.
  45218. *
  45219. * @param aSourceFile The filename of the source file
  45220. * @param aSourceContent The content of the source file
  45221. */
  45222. SourceNode.prototype.setSourceContent =
  45223. function SourceNode_setSourceContent(aSourceFile, aSourceContent) {
  45224. this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
  45225. };
  45226. /**
  45227. * Walk over the tree of SourceNodes. The walking function is called for each
  45228. * source file content and is passed the filename and source content.
  45229. *
  45230. * @param aFn The traversal function.
  45231. */
  45232. SourceNode.prototype.walkSourceContents =
  45233. function SourceNode_walkSourceContents(aFn) {
  45234. for (var i = 0, len = this.children.length; i < len; i++) {
  45235. if (this.children[i][isSourceNode]) {
  45236. this.children[i].walkSourceContents(aFn);
  45237. }
  45238. }
  45239. var sources = Object.keys(this.sourceContents);
  45240. for (var i = 0, len = sources.length; i < len; i++) {
  45241. aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
  45242. }
  45243. };
  45244. /**
  45245. * Return the string representation of this source node. Walks over the tree
  45246. * and concatenates all the various snippets together to one string.
  45247. */
  45248. SourceNode.prototype.toString = function SourceNode_toString() {
  45249. var str = "";
  45250. this.walk(function (chunk) {
  45251. str += chunk;
  45252. });
  45253. return str;
  45254. };
  45255. /**
  45256. * Returns the string representation of this source node along with a source
  45257. * map.
  45258. */
  45259. SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
  45260. var generated = {
  45261. code: "",
  45262. line: 1,
  45263. column: 0
  45264. };
  45265. var map = new SourceMapGenerator(aArgs);
  45266. var sourceMappingActive = false;
  45267. var lastOriginalSource = null;
  45268. var lastOriginalLine = null;
  45269. var lastOriginalColumn = null;
  45270. var lastOriginalName = null;
  45271. this.walk(function (chunk, original) {
  45272. generated.code += chunk;
  45273. if (original.source !== null
  45274. && original.line !== null
  45275. && original.column !== null) {
  45276. if(lastOriginalSource !== original.source
  45277. || lastOriginalLine !== original.line
  45278. || lastOriginalColumn !== original.column
  45279. || lastOriginalName !== original.name) {
  45280. map.addMapping({
  45281. source: original.source,
  45282. original: {
  45283. line: original.line,
  45284. column: original.column
  45285. },
  45286. generated: {
  45287. line: generated.line,
  45288. column: generated.column
  45289. },
  45290. name: original.name
  45291. });
  45292. }
  45293. lastOriginalSource = original.source;
  45294. lastOriginalLine = original.line;
  45295. lastOriginalColumn = original.column;
  45296. lastOriginalName = original.name;
  45297. sourceMappingActive = true;
  45298. } else if (sourceMappingActive) {
  45299. map.addMapping({
  45300. generated: {
  45301. line: generated.line,
  45302. column: generated.column
  45303. }
  45304. });
  45305. lastOriginalSource = null;
  45306. sourceMappingActive = false;
  45307. }
  45308. for (var idx = 0, length = chunk.length; idx < length; idx++) {
  45309. if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
  45310. generated.line++;
  45311. generated.column = 0;
  45312. // Mappings end at eol
  45313. if (idx + 1 === length) {
  45314. lastOriginalSource = null;
  45315. sourceMappingActive = false;
  45316. } else if (sourceMappingActive) {
  45317. map.addMapping({
  45318. source: original.source,
  45319. original: {
  45320. line: original.line,
  45321. column: original.column
  45322. },
  45323. generated: {
  45324. line: generated.line,
  45325. column: generated.column
  45326. },
  45327. name: original.name
  45328. });
  45329. }
  45330. } else {
  45331. generated.column++;
  45332. }
  45333. }
  45334. });
  45335. this.walkSourceContents(function (sourceFile, sourceContent) {
  45336. map.setSourceContent(sourceFile, sourceContent);
  45337. });
  45338. return { code: generated.code, map: map };
  45339. };
  45340. exports.SourceNode = SourceNode;
  45341. },{"./source-map-generator":549,"./util":551}],551:[function(require,module,exports){
  45342. /* -*- Mode: js; js-indent-level: 2; -*- */
  45343. /*
  45344. * Copyright 2011 Mozilla Foundation and contributors
  45345. * Licensed under the New BSD license. See LICENSE or:
  45346. * http://opensource.org/licenses/BSD-3-Clause
  45347. */
  45348. /**
  45349. * This is a helper function for getting values from parameter/options
  45350. * objects.
  45351. *
  45352. * @param args The object we are extracting values from
  45353. * @param name The name of the property we are getting.
  45354. * @param defaultValue An optional value to return if the property is missing
  45355. * from the object. If this is not specified and the property is missing, an
  45356. * error will be thrown.
  45357. */
  45358. function getArg(aArgs, aName, aDefaultValue) {
  45359. if (aName in aArgs) {
  45360. return aArgs[aName];
  45361. } else if (arguments.length === 3) {
  45362. return aDefaultValue;
  45363. } else {
  45364. throw new Error('"' + aName + '" is a required argument.');
  45365. }
  45366. }
  45367. exports.getArg = getArg;
  45368. var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/;
  45369. var dataUrlRegexp = /^data:.+\,.+$/;
  45370. function urlParse(aUrl) {
  45371. var match = aUrl.match(urlRegexp);
  45372. if (!match) {
  45373. return null;
  45374. }
  45375. return {
  45376. scheme: match[1],
  45377. auth: match[2],
  45378. host: match[3],
  45379. port: match[4],
  45380. path: match[5]
  45381. };
  45382. }
  45383. exports.urlParse = urlParse;
  45384. function urlGenerate(aParsedUrl) {
  45385. var url = '';
  45386. if (aParsedUrl.scheme) {
  45387. url += aParsedUrl.scheme + ':';
  45388. }
  45389. url += '//';
  45390. if (aParsedUrl.auth) {
  45391. url += aParsedUrl.auth + '@';
  45392. }
  45393. if (aParsedUrl.host) {
  45394. url += aParsedUrl.host;
  45395. }
  45396. if (aParsedUrl.port) {
  45397. url += ":" + aParsedUrl.port
  45398. }
  45399. if (aParsedUrl.path) {
  45400. url += aParsedUrl.path;
  45401. }
  45402. return url;
  45403. }
  45404. exports.urlGenerate = urlGenerate;
  45405. /**
  45406. * Normalizes a path, or the path portion of a URL:
  45407. *
  45408. * - Replaces consecutive slashes with one slash.
  45409. * - Removes unnecessary '.' parts.
  45410. * - Removes unnecessary '<dir>/..' parts.
  45411. *
  45412. * Based on code in the Node.js 'path' core module.
  45413. *
  45414. * @param aPath The path or url to normalize.
  45415. */
  45416. function normalize(aPath) {
  45417. var path = aPath;
  45418. var url = urlParse(aPath);
  45419. if (url) {
  45420. if (!url.path) {
  45421. return aPath;
  45422. }
  45423. path = url.path;
  45424. }
  45425. var isAbsolute = exports.isAbsolute(path);
  45426. var parts = path.split(/\/+/);
  45427. for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
  45428. part = parts[i];
  45429. if (part === '.') {
  45430. parts.splice(i, 1);
  45431. } else if (part === '..') {
  45432. up++;
  45433. } else if (up > 0) {
  45434. if (part === '') {
  45435. // The first part is blank if the path is absolute. Trying to go
  45436. // above the root is a no-op. Therefore we can remove all '..' parts
  45437. // directly after the root.
  45438. parts.splice(i + 1, up);
  45439. up = 0;
  45440. } else {
  45441. parts.splice(i, 2);
  45442. up--;
  45443. }
  45444. }
  45445. }
  45446. path = parts.join('/');
  45447. if (path === '') {
  45448. path = isAbsolute ? '/' : '.';
  45449. }
  45450. if (url) {
  45451. url.path = path;
  45452. return urlGenerate(url);
  45453. }
  45454. return path;
  45455. }
  45456. exports.normalize = normalize;
  45457. /**
  45458. * Joins two paths/URLs.
  45459. *
  45460. * @param aRoot The root path or URL.
  45461. * @param aPath The path or URL to be joined with the root.
  45462. *
  45463. * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
  45464. * scheme-relative URL: Then the scheme of aRoot, if any, is prepended
  45465. * first.
  45466. * - Otherwise aPath is a path. If aRoot is a URL, then its path portion
  45467. * is updated with the result and aRoot is returned. Otherwise the result
  45468. * is returned.
  45469. * - If aPath is absolute, the result is aPath.
  45470. * - Otherwise the two paths are joined with a slash.
  45471. * - Joining for example 'http://' and 'www.example.com' is also supported.
  45472. */
  45473. function join(aRoot, aPath) {
  45474. if (aRoot === "") {
  45475. aRoot = ".";
  45476. }
  45477. if (aPath === "") {
  45478. aPath = ".";
  45479. }
  45480. var aPathUrl = urlParse(aPath);
  45481. var aRootUrl = urlParse(aRoot);
  45482. if (aRootUrl) {
  45483. aRoot = aRootUrl.path || '/';
  45484. }
  45485. // `join(foo, '//www.example.org')`
  45486. if (aPathUrl && !aPathUrl.scheme) {
  45487. if (aRootUrl) {
  45488. aPathUrl.scheme = aRootUrl.scheme;
  45489. }
  45490. return urlGenerate(aPathUrl);
  45491. }
  45492. if (aPathUrl || aPath.match(dataUrlRegexp)) {
  45493. return aPath;
  45494. }
  45495. // `join('http://', 'www.example.com')`
  45496. if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
  45497. aRootUrl.host = aPath;
  45498. return urlGenerate(aRootUrl);
  45499. }
  45500. var joined = aPath.charAt(0) === '/'
  45501. ? aPath
  45502. : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
  45503. if (aRootUrl) {
  45504. aRootUrl.path = joined;
  45505. return urlGenerate(aRootUrl);
  45506. }
  45507. return joined;
  45508. }
  45509. exports.join = join;
  45510. exports.isAbsolute = function (aPath) {
  45511. return aPath.charAt(0) === '/' || !!aPath.match(urlRegexp);
  45512. };
  45513. /**
  45514. * Make a path relative to a URL or another path.
  45515. *
  45516. * @param aRoot The root path or URL.
  45517. * @param aPath The path or URL to be made relative to aRoot.
  45518. */
  45519. function relative(aRoot, aPath) {
  45520. if (aRoot === "") {
  45521. aRoot = ".";
  45522. }
  45523. aRoot = aRoot.replace(/\/$/, '');
  45524. // It is possible for the path to be above the root. In this case, simply
  45525. // checking whether the root is a prefix of the path won't work. Instead, we
  45526. // need to remove components from the root one by one, until either we find
  45527. // a prefix that fits, or we run out of components to remove.
  45528. var level = 0;
  45529. while (aPath.indexOf(aRoot + '/') !== 0) {
  45530. var index = aRoot.lastIndexOf("/");
  45531. if (index < 0) {
  45532. return aPath;
  45533. }
  45534. // If the only part of the root that is left is the scheme (i.e. http://,
  45535. // file:///, etc.), one or more slashes (/), or simply nothing at all, we
  45536. // have exhausted all components, so the path is not relative to the root.
  45537. aRoot = aRoot.slice(0, index);
  45538. if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
  45539. return aPath;
  45540. }
  45541. ++level;
  45542. }
  45543. // Make sure we add a "../" for each component we removed from the root.
  45544. return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
  45545. }
  45546. exports.relative = relative;
  45547. var supportsNullProto = (function () {
  45548. var obj = Object.create(null);
  45549. return !('__proto__' in obj);
  45550. }());
  45551. function identity (s) {
  45552. return s;
  45553. }
  45554. /**
  45555. * Because behavior goes wacky when you set `__proto__` on objects, we
  45556. * have to prefix all the strings in our set with an arbitrary character.
  45557. *
  45558. * See https://github.com/mozilla/source-map/pull/31 and
  45559. * https://github.com/mozilla/source-map/issues/30
  45560. *
  45561. * @param String aStr
  45562. */
  45563. function toSetString(aStr) {
  45564. if (isProtoString(aStr)) {
  45565. return '$' + aStr;
  45566. }
  45567. return aStr;
  45568. }
  45569. exports.toSetString = supportsNullProto ? identity : toSetString;
  45570. function fromSetString(aStr) {
  45571. if (isProtoString(aStr)) {
  45572. return aStr.slice(1);
  45573. }
  45574. return aStr;
  45575. }
  45576. exports.fromSetString = supportsNullProto ? identity : fromSetString;
  45577. function isProtoString(s) {
  45578. if (!s) {
  45579. return false;
  45580. }
  45581. var length = s.length;
  45582. if (length < 9 /* "__proto__".length */) {
  45583. return false;
  45584. }
  45585. if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||
  45586. s.charCodeAt(length - 2) !== 95 /* '_' */ ||
  45587. s.charCodeAt(length - 3) !== 111 /* 'o' */ ||
  45588. s.charCodeAt(length - 4) !== 116 /* 't' */ ||
  45589. s.charCodeAt(length - 5) !== 111 /* 'o' */ ||
  45590. s.charCodeAt(length - 6) !== 114 /* 'r' */ ||
  45591. s.charCodeAt(length - 7) !== 112 /* 'p' */ ||
  45592. s.charCodeAt(length - 8) !== 95 /* '_' */ ||
  45593. s.charCodeAt(length - 9) !== 95 /* '_' */) {
  45594. return false;
  45595. }
  45596. for (var i = length - 10; i >= 0; i--) {
  45597. if (s.charCodeAt(i) !== 36 /* '$' */) {
  45598. return false;
  45599. }
  45600. }
  45601. return true;
  45602. }
  45603. /**
  45604. * Comparator between two mappings where the original positions are compared.
  45605. *
  45606. * Optionally pass in `true` as `onlyCompareGenerated` to consider two
  45607. * mappings with the same original source/line/column, but different generated
  45608. * line and column the same. Useful when searching for a mapping with a
  45609. * stubbed out mapping.
  45610. */
  45611. function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
  45612. var cmp = mappingA.source - mappingB.source;
  45613. if (cmp !== 0) {
  45614. return cmp;
  45615. }
  45616. cmp = mappingA.originalLine - mappingB.originalLine;
  45617. if (cmp !== 0) {
  45618. return cmp;
  45619. }
  45620. cmp = mappingA.originalColumn - mappingB.originalColumn;
  45621. if (cmp !== 0 || onlyCompareOriginal) {
  45622. return cmp;
  45623. }
  45624. cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  45625. if (cmp !== 0) {
  45626. return cmp;
  45627. }
  45628. cmp = mappingA.generatedLine - mappingB.generatedLine;
  45629. if (cmp !== 0) {
  45630. return cmp;
  45631. }
  45632. return mappingA.name - mappingB.name;
  45633. }
  45634. exports.compareByOriginalPositions = compareByOriginalPositions;
  45635. /**
  45636. * Comparator between two mappings with deflated source and name indices where
  45637. * the generated positions are compared.
  45638. *
  45639. * Optionally pass in `true` as `onlyCompareGenerated` to consider two
  45640. * mappings with the same generated line and column, but different
  45641. * source/name/original line and column the same. Useful when searching for a
  45642. * mapping with a stubbed out mapping.
  45643. */
  45644. function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
  45645. var cmp = mappingA.generatedLine - mappingB.generatedLine;
  45646. if (cmp !== 0) {
  45647. return cmp;
  45648. }
  45649. cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  45650. if (cmp !== 0 || onlyCompareGenerated) {
  45651. return cmp;
  45652. }
  45653. cmp = mappingA.source - mappingB.source;
  45654. if (cmp !== 0) {
  45655. return cmp;
  45656. }
  45657. cmp = mappingA.originalLine - mappingB.originalLine;
  45658. if (cmp !== 0) {
  45659. return cmp;
  45660. }
  45661. cmp = mappingA.originalColumn - mappingB.originalColumn;
  45662. if (cmp !== 0) {
  45663. return cmp;
  45664. }
  45665. return mappingA.name - mappingB.name;
  45666. }
  45667. exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
  45668. function strcmp(aStr1, aStr2) {
  45669. if (aStr1 === aStr2) {
  45670. return 0;
  45671. }
  45672. if (aStr1 > aStr2) {
  45673. return 1;
  45674. }
  45675. return -1;
  45676. }
  45677. /**
  45678. * Comparator between two mappings with inflated source and name strings where
  45679. * the generated positions are compared.
  45680. */
  45681. function compareByGeneratedPositionsInflated(mappingA, mappingB) {
  45682. var cmp = mappingA.generatedLine - mappingB.generatedLine;
  45683. if (cmp !== 0) {
  45684. return cmp;
  45685. }
  45686. cmp = mappingA.generatedColumn - mappingB.generatedColumn;
  45687. if (cmp !== 0) {
  45688. return cmp;
  45689. }
  45690. cmp = strcmp(mappingA.source, mappingB.source);
  45691. if (cmp !== 0) {
  45692. return cmp;
  45693. }
  45694. cmp = mappingA.originalLine - mappingB.originalLine;
  45695. if (cmp !== 0) {
  45696. return cmp;
  45697. }
  45698. cmp = mappingA.originalColumn - mappingB.originalColumn;
  45699. if (cmp !== 0) {
  45700. return cmp;
  45701. }
  45702. return strcmp(mappingA.name, mappingB.name);
  45703. }
  45704. exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
  45705. },{}],552:[function(require,module,exports){
  45706. /*
  45707. * Copyright 2009-2011 Mozilla Foundation and contributors
  45708. * Licensed under the New BSD license. See LICENSE.txt or:
  45709. * http://opensource.org/licenses/BSD-3-Clause
  45710. */
  45711. exports.SourceMapGenerator = require('./lib/source-map-generator').SourceMapGenerator;
  45712. exports.SourceMapConsumer = require('./lib/source-map-consumer').SourceMapConsumer;
  45713. exports.SourceNode = require('./lib/source-node').SourceNode;
  45714. },{"./lib/source-map-consumer":548,"./lib/source-map-generator":549,"./lib/source-node":550}],553:[function(require,module,exports){
  45715. 'use strict';
  45716. var ansiRegex = require('ansi-regex')();
  45717. module.exports = function (str) {
  45718. return typeof str === 'string' ? str.replace(ansiRegex, '') : str;
  45719. };
  45720. },{"ansi-regex":1}],554:[function(require,module,exports){
  45721. (function (process){
  45722. 'use strict';
  45723. var argv = process.argv;
  45724. var terminator = argv.indexOf('--');
  45725. var hasFlag = function (flag) {
  45726. flag = '--' + flag;
  45727. var pos = argv.indexOf(flag);
  45728. return pos !== -1 && (terminator !== -1 ? pos < terminator : true);
  45729. };
  45730. module.exports = (function () {
  45731. if ('FORCE_COLOR' in process.env) {
  45732. return true;
  45733. }
  45734. if (hasFlag('no-color') ||
  45735. hasFlag('no-colors') ||
  45736. hasFlag('color=false')) {
  45737. return false;
  45738. }
  45739. if (hasFlag('color') ||
  45740. hasFlag('colors') ||
  45741. hasFlag('color=true') ||
  45742. hasFlag('color=always')) {
  45743. return true;
  45744. }
  45745. if (process.stdout && !process.stdout.isTTY) {
  45746. return false;
  45747. }
  45748. if (process.platform === 'win32') {
  45749. return true;
  45750. }
  45751. if ('COLORTERM' in process.env) {
  45752. return true;
  45753. }
  45754. if (process.env.TERM === 'dumb') {
  45755. return false;
  45756. }
  45757. if (/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(process.env.TERM)) {
  45758. return true;
  45759. }
  45760. return false;
  45761. })();
  45762. }).call(this,require('_process'))
  45763. },{"_process":525}],555:[function(require,module,exports){
  45764. 'use strict';
  45765. module.exports = function toFastproperties(o) {
  45766. function Sub() {}
  45767. Sub.prototype = o;
  45768. var receiver = new Sub(); // create an instance
  45769. function ic() { return typeof receiver.foo; } // perform access
  45770. ic();
  45771. ic();
  45772. return o;
  45773. eval("o" + o); // ensure no dead code elimination
  45774. }
  45775. },{}],556:[function(require,module,exports){
  45776. 'use strict';
  45777. module.exports = function (str) {
  45778. var tail = str.length;
  45779. while (/[\s\uFEFF\u00A0]/.test(str[tail - 1])) {
  45780. tail--;
  45781. }
  45782. return str.slice(0, tail);
  45783. };
  45784. },{}],557:[function(require,module,exports){
  45785. exports.isatty = function () { return false; };
  45786. function ReadStream() {
  45787. throw new Error('tty.ReadStream is not implemented');
  45788. }
  45789. exports.ReadStream = ReadStream;
  45790. function WriteStream() {
  45791. throw new Error('tty.ReadStream is not implemented');
  45792. }
  45793. exports.WriteStream = WriteStream;
  45794. },{}],558:[function(require,module,exports){
  45795. if (typeof Object.create === 'function') {
  45796. // implementation from standard node.js 'util' module
  45797. module.exports = function inherits(ctor, superCtor) {
  45798. ctor.super_ = superCtor
  45799. ctor.prototype = Object.create(superCtor.prototype, {
  45800. constructor: {
  45801. value: ctor,
  45802. enumerable: false,
  45803. writable: true,
  45804. configurable: true
  45805. }
  45806. });
  45807. };
  45808. } else {
  45809. // old school shim for old browsers
  45810. module.exports = function inherits(ctor, superCtor) {
  45811. ctor.super_ = superCtor
  45812. var TempCtor = function () {}
  45813. TempCtor.prototype = superCtor.prototype
  45814. ctor.prototype = new TempCtor()
  45815. ctor.prototype.constructor = ctor
  45816. }
  45817. }
  45818. },{}],559:[function(require,module,exports){
  45819. module.exports = function isBuffer(arg) {
  45820. return arg && typeof arg === 'object'
  45821. && typeof arg.copy === 'function'
  45822. && typeof arg.fill === 'function'
  45823. && typeof arg.readUInt8 === 'function';
  45824. }
  45825. },{}],560:[function(require,module,exports){
  45826. (function (process,global){
  45827. // Copyright Joyent, Inc. and other Node contributors.
  45828. //
  45829. // Permission is hereby granted, free of charge, to any person obtaining a
  45830. // copy of this software and associated documentation files (the
  45831. // "Software"), to deal in the Software without restriction, including
  45832. // without limitation the rights to use, copy, modify, merge, publish,
  45833. // distribute, sublicense, and/or sell copies of the Software, and to permit
  45834. // persons to whom the Software is furnished to do so, subject to the
  45835. // following conditions:
  45836. //
  45837. // The above copyright notice and this permission notice shall be included
  45838. // in all copies or substantial portions of the Software.
  45839. //
  45840. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  45841. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  45842. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  45843. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  45844. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  45845. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  45846. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  45847. var formatRegExp = /%[sdj%]/g;
  45848. exports.format = function(f) {
  45849. if (!isString(f)) {
  45850. var objects = [];
  45851. for (var i = 0; i < arguments.length; i++) {
  45852. objects.push(inspect(arguments[i]));
  45853. }
  45854. return objects.join(' ');
  45855. }
  45856. var i = 1;
  45857. var args = arguments;
  45858. var len = args.length;
  45859. var str = String(f).replace(formatRegExp, function(x) {
  45860. if (x === '%%') return '%';
  45861. if (i >= len) return x;
  45862. switch (x) {
  45863. case '%s': return String(args[i++]);
  45864. case '%d': return Number(args[i++]);
  45865. case '%j':
  45866. try {
  45867. return JSON.stringify(args[i++]);
  45868. } catch (_) {
  45869. return '[Circular]';
  45870. }
  45871. default:
  45872. return x;
  45873. }
  45874. });
  45875. for (var x = args[i]; i < len; x = args[++i]) {
  45876. if (isNull(x) || !isObject(x)) {
  45877. str += ' ' + x;
  45878. } else {
  45879. str += ' ' + inspect(x);
  45880. }
  45881. }
  45882. return str;
  45883. };
  45884. // Mark that a method should not be used.
  45885. // Returns a modified function which warns once by default.
  45886. // If --no-deprecation is set, then it is a no-op.
  45887. exports.deprecate = function(fn, msg) {
  45888. // Allow for deprecating things in the process of starting up.
  45889. if (isUndefined(global.process)) {
  45890. return function() {
  45891. return exports.deprecate(fn, msg).apply(this, arguments);
  45892. };
  45893. }
  45894. if (process.noDeprecation === true) {
  45895. return fn;
  45896. }
  45897. var warned = false;
  45898. function deprecated() {
  45899. if (!warned) {
  45900. if (process.throwDeprecation) {
  45901. throw new Error(msg);
  45902. } else if (process.traceDeprecation) {
  45903. console.trace(msg);
  45904. } else {
  45905. console.error(msg);
  45906. }
  45907. warned = true;
  45908. }
  45909. return fn.apply(this, arguments);
  45910. }
  45911. return deprecated;
  45912. };
  45913. var debugs = {};
  45914. var debugEnviron;
  45915. exports.debuglog = function(set) {
  45916. if (isUndefined(debugEnviron))
  45917. debugEnviron = process.env.NODE_DEBUG || '';
  45918. set = set.toUpperCase();
  45919. if (!debugs[set]) {
  45920. if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
  45921. var pid = process.pid;
  45922. debugs[set] = function() {
  45923. var msg = exports.format.apply(exports, arguments);
  45924. console.error('%s %d: %s', set, pid, msg);
  45925. };
  45926. } else {
  45927. debugs[set] = function() {};
  45928. }
  45929. }
  45930. return debugs[set];
  45931. };
  45932. /**
  45933. * Echos the value of a value. Trys to print the value out
  45934. * in the best way possible given the different types.
  45935. *
  45936. * @param {Object} obj The object to print out.
  45937. * @param {Object} opts Optional options object that alters the output.
  45938. */
  45939. /* legacy: obj, showHidden, depth, colors*/
  45940. function inspect(obj, opts) {
  45941. // default options
  45942. var ctx = {
  45943. seen: [],
  45944. stylize: stylizeNoColor
  45945. };
  45946. // legacy...
  45947. if (arguments.length >= 3) ctx.depth = arguments[2];
  45948. if (arguments.length >= 4) ctx.colors = arguments[3];
  45949. if (isBoolean(opts)) {
  45950. // legacy...
  45951. ctx.showHidden = opts;
  45952. } else if (opts) {
  45953. // got an "options" object
  45954. exports._extend(ctx, opts);
  45955. }
  45956. // set default options
  45957. if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
  45958. if (isUndefined(ctx.depth)) ctx.depth = 2;
  45959. if (isUndefined(ctx.colors)) ctx.colors = false;
  45960. if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
  45961. if (ctx.colors) ctx.stylize = stylizeWithColor;
  45962. return formatValue(ctx, obj, ctx.depth);
  45963. }
  45964. exports.inspect = inspect;
  45965. // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
  45966. inspect.colors = {
  45967. 'bold' : [1, 22],
  45968. 'italic' : [3, 23],
  45969. 'underline' : [4, 24],
  45970. 'inverse' : [7, 27],
  45971. 'white' : [37, 39],
  45972. 'grey' : [90, 39],
  45973. 'black' : [30, 39],
  45974. 'blue' : [34, 39],
  45975. 'cyan' : [36, 39],
  45976. 'green' : [32, 39],
  45977. 'magenta' : [35, 39],
  45978. 'red' : [31, 39],
  45979. 'yellow' : [33, 39]
  45980. };
  45981. // Don't use 'blue' not visible on cmd.exe
  45982. inspect.styles = {
  45983. 'special': 'cyan',
  45984. 'number': 'yellow',
  45985. 'boolean': 'yellow',
  45986. 'undefined': 'grey',
  45987. 'null': 'bold',
  45988. 'string': 'green',
  45989. 'date': 'magenta',
  45990. // "name": intentionally not styling
  45991. 'regexp': 'red'
  45992. };
  45993. function stylizeWithColor(str, styleType) {
  45994. var style = inspect.styles[styleType];
  45995. if (style) {
  45996. return '\u001b[' + inspect.colors[style][0] + 'm' + str +
  45997. '\u001b[' + inspect.colors[style][1] + 'm';
  45998. } else {
  45999. return str;
  46000. }
  46001. }
  46002. function stylizeNoColor(str, styleType) {
  46003. return str;
  46004. }
  46005. function arrayToHash(array) {
  46006. var hash = {};
  46007. array.forEach(function(val, idx) {
  46008. hash[val] = true;
  46009. });
  46010. return hash;
  46011. }
  46012. function formatValue(ctx, value, recurseTimes) {
  46013. // Provide a hook for user-specified inspect functions.
  46014. // Check that value is an object with an inspect function on it
  46015. if (ctx.customInspect &&
  46016. value &&
  46017. isFunction(value.inspect) &&
  46018. // Filter out the util module, it's inspect function is special
  46019. value.inspect !== exports.inspect &&
  46020. // Also filter out any prototype objects using the circular check.
  46021. !(value.constructor && value.constructor.prototype === value)) {
  46022. var ret = value.inspect(recurseTimes, ctx);
  46023. if (!isString(ret)) {
  46024. ret = formatValue(ctx, ret, recurseTimes);
  46025. }
  46026. return ret;
  46027. }
  46028. // Primitive types cannot have properties
  46029. var primitive = formatPrimitive(ctx, value);
  46030. if (primitive) {
  46031. return primitive;
  46032. }
  46033. // Look up the keys of the object.
  46034. var keys = Object.keys(value);
  46035. var visibleKeys = arrayToHash(keys);
  46036. if (ctx.showHidden) {
  46037. keys = Object.getOwnPropertyNames(value);
  46038. }
  46039. // IE doesn't make error fields non-enumerable
  46040. // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
  46041. if (isError(value)
  46042. && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
  46043. return formatError(value);
  46044. }
  46045. // Some type of object without properties can be shortcutted.
  46046. if (keys.length === 0) {
  46047. if (isFunction(value)) {
  46048. var name = value.name ? ': ' + value.name : '';
  46049. return ctx.stylize('[Function' + name + ']', 'special');
  46050. }
  46051. if (isRegExp(value)) {
  46052. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  46053. }
  46054. if (isDate(value)) {
  46055. return ctx.stylize(Date.prototype.toString.call(value), 'date');
  46056. }
  46057. if (isError(value)) {
  46058. return formatError(value);
  46059. }
  46060. }
  46061. var base = '', array = false, braces = ['{', '}'];
  46062. // Make Array say that they are Array
  46063. if (isArray(value)) {
  46064. array = true;
  46065. braces = ['[', ']'];
  46066. }
  46067. // Make functions say that they are functions
  46068. if (isFunction(value)) {
  46069. var n = value.name ? ': ' + value.name : '';
  46070. base = ' [Function' + n + ']';
  46071. }
  46072. // Make RegExps say that they are RegExps
  46073. if (isRegExp(value)) {
  46074. base = ' ' + RegExp.prototype.toString.call(value);
  46075. }
  46076. // Make dates with properties first say the date
  46077. if (isDate(value)) {
  46078. base = ' ' + Date.prototype.toUTCString.call(value);
  46079. }
  46080. // Make error with message first say the error
  46081. if (isError(value)) {
  46082. base = ' ' + formatError(value);
  46083. }
  46084. if (keys.length === 0 && (!array || value.length == 0)) {
  46085. return braces[0] + base + braces[1];
  46086. }
  46087. if (recurseTimes < 0) {
  46088. if (isRegExp(value)) {
  46089. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  46090. } else {
  46091. return ctx.stylize('[Object]', 'special');
  46092. }
  46093. }
  46094. ctx.seen.push(value);
  46095. var output;
  46096. if (array) {
  46097. output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
  46098. } else {
  46099. output = keys.map(function(key) {
  46100. return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
  46101. });
  46102. }
  46103. ctx.seen.pop();
  46104. return reduceToSingleString(output, base, braces);
  46105. }
  46106. function formatPrimitive(ctx, value) {
  46107. if (isUndefined(value))
  46108. return ctx.stylize('undefined', 'undefined');
  46109. if (isString(value)) {
  46110. var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
  46111. .replace(/'/g, "\\'")
  46112. .replace(/\\"/g, '"') + '\'';
  46113. return ctx.stylize(simple, 'string');
  46114. }
  46115. if (isNumber(value))
  46116. return ctx.stylize('' + value, 'number');
  46117. if (isBoolean(value))
  46118. return ctx.stylize('' + value, 'boolean');
  46119. // For some reason typeof null is "object", so special case here.
  46120. if (isNull(value))
  46121. return ctx.stylize('null', 'null');
  46122. }
  46123. function formatError(value) {
  46124. return '[' + Error.prototype.toString.call(value) + ']';
  46125. }
  46126. function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
  46127. var output = [];
  46128. for (var i = 0, l = value.length; i < l; ++i) {
  46129. if (hasOwnProperty(value, String(i))) {
  46130. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  46131. String(i), true));
  46132. } else {
  46133. output.push('');
  46134. }
  46135. }
  46136. keys.forEach(function(key) {
  46137. if (!key.match(/^\d+$/)) {
  46138. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  46139. key, true));
  46140. }
  46141. });
  46142. return output;
  46143. }
  46144. function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
  46145. var name, str, desc;
  46146. desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
  46147. if (desc.get) {
  46148. if (desc.set) {
  46149. str = ctx.stylize('[Getter/Setter]', 'special');
  46150. } else {
  46151. str = ctx.stylize('[Getter]', 'special');
  46152. }
  46153. } else {
  46154. if (desc.set) {
  46155. str = ctx.stylize('[Setter]', 'special');
  46156. }
  46157. }
  46158. if (!hasOwnProperty(visibleKeys, key)) {
  46159. name = '[' + key + ']';
  46160. }
  46161. if (!str) {
  46162. if (ctx.seen.indexOf(desc.value) < 0) {
  46163. if (isNull(recurseTimes)) {
  46164. str = formatValue(ctx, desc.value, null);
  46165. } else {
  46166. str = formatValue(ctx, desc.value, recurseTimes - 1);
  46167. }
  46168. if (str.indexOf('\n') > -1) {
  46169. if (array) {
  46170. str = str.split('\n').map(function(line) {
  46171. return ' ' + line;
  46172. }).join('\n').substr(2);
  46173. } else {
  46174. str = '\n' + str.split('\n').map(function(line) {
  46175. return ' ' + line;
  46176. }).join('\n');
  46177. }
  46178. }
  46179. } else {
  46180. str = ctx.stylize('[Circular]', 'special');
  46181. }
  46182. }
  46183. if (isUndefined(name)) {
  46184. if (array && key.match(/^\d+$/)) {
  46185. return str;
  46186. }
  46187. name = JSON.stringify('' + key);
  46188. if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
  46189. name = name.substr(1, name.length - 2);
  46190. name = ctx.stylize(name, 'name');
  46191. } else {
  46192. name = name.replace(/'/g, "\\'")
  46193. .replace(/\\"/g, '"')
  46194. .replace(/(^"|"$)/g, "'");
  46195. name = ctx.stylize(name, 'string');
  46196. }
  46197. }
  46198. return name + ': ' + str;
  46199. }
  46200. function reduceToSingleString(output, base, braces) {
  46201. var numLinesEst = 0;
  46202. var length = output.reduce(function(prev, cur) {
  46203. numLinesEst++;
  46204. if (cur.indexOf('\n') >= 0) numLinesEst++;
  46205. return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
  46206. }, 0);
  46207. if (length > 60) {
  46208. return braces[0] +
  46209. (base === '' ? '' : base + '\n ') +
  46210. ' ' +
  46211. output.join(',\n ') +
  46212. ' ' +
  46213. braces[1];
  46214. }
  46215. return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
  46216. }
  46217. // NOTE: These type checking functions intentionally don't use `instanceof`
  46218. // because it is fragile and can be easily faked with `Object.create()`.
  46219. function isArray(ar) {
  46220. return Array.isArray(ar);
  46221. }
  46222. exports.isArray = isArray;
  46223. function isBoolean(arg) {
  46224. return typeof arg === 'boolean';
  46225. }
  46226. exports.isBoolean = isBoolean;
  46227. function isNull(arg) {
  46228. return arg === null;
  46229. }
  46230. exports.isNull = isNull;
  46231. function isNullOrUndefined(arg) {
  46232. return arg == null;
  46233. }
  46234. exports.isNullOrUndefined = isNullOrUndefined;
  46235. function isNumber(arg) {
  46236. return typeof arg === 'number';
  46237. }
  46238. exports.isNumber = isNumber;
  46239. function isString(arg) {
  46240. return typeof arg === 'string';
  46241. }
  46242. exports.isString = isString;
  46243. function isSymbol(arg) {
  46244. return typeof arg === 'symbol';
  46245. }
  46246. exports.isSymbol = isSymbol;
  46247. function isUndefined(arg) {
  46248. return arg === void 0;
  46249. }
  46250. exports.isUndefined = isUndefined;
  46251. function isRegExp(re) {
  46252. return isObject(re) && objectToString(re) === '[object RegExp]';
  46253. }
  46254. exports.isRegExp = isRegExp;
  46255. function isObject(arg) {
  46256. return typeof arg === 'object' && arg !== null;
  46257. }
  46258. exports.isObject = isObject;
  46259. function isDate(d) {
  46260. return isObject(d) && objectToString(d) === '[object Date]';
  46261. }
  46262. exports.isDate = isDate;
  46263. function isError(e) {
  46264. return isObject(e) &&
  46265. (objectToString(e) === '[object Error]' || e instanceof Error);
  46266. }
  46267. exports.isError = isError;
  46268. function isFunction(arg) {
  46269. return typeof arg === 'function';
  46270. }
  46271. exports.isFunction = isFunction;
  46272. function isPrimitive(arg) {
  46273. return arg === null ||
  46274. typeof arg === 'boolean' ||
  46275. typeof arg === 'number' ||
  46276. typeof arg === 'string' ||
  46277. typeof arg === 'symbol' || // ES6 symbol
  46278. typeof arg === 'undefined';
  46279. }
  46280. exports.isPrimitive = isPrimitive;
  46281. exports.isBuffer = require('./support/isBuffer');
  46282. function objectToString(o) {
  46283. return Object.prototype.toString.call(o);
  46284. }
  46285. function pad(n) {
  46286. return n < 10 ? '0' + n.toString(10) : n.toString(10);
  46287. }
  46288. var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
  46289. 'Oct', 'Nov', 'Dec'];
  46290. // 26 Feb 16:19:34
  46291. function timestamp() {
  46292. var d = new Date();
  46293. var time = [pad(d.getHours()),
  46294. pad(d.getMinutes()),
  46295. pad(d.getSeconds())].join(':');
  46296. return [d.getDate(), months[d.getMonth()], time].join(' ');
  46297. }
  46298. // log is just a thin wrapper to console.log that prepends a timestamp
  46299. exports.log = function() {
  46300. console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
  46301. };
  46302. /**
  46303. * Inherit the prototype methods from one constructor into another.
  46304. *
  46305. * The Function.prototype.inherits from lang.js rewritten as a standalone
  46306. * function (not on Function.prototype). NOTE: If this file is to be loaded
  46307. * during bootstrapping this function needs to be rewritten using some native
  46308. * functions as prototype setup using normal JavaScript does not work as
  46309. * expected during bootstrapping (see mirror.js in r114903).
  46310. *
  46311. * @param {function} ctor Constructor function which needs to inherit the
  46312. * prototype.
  46313. * @param {function} superCtor Constructor function to inherit prototype from.
  46314. */
  46315. exports.inherits = require('inherits');
  46316. exports._extend = function(origin, add) {
  46317. // Don't do anything if add isn't an object
  46318. if (!add || !isObject(add)) return origin;
  46319. var keys = Object.keys(add);
  46320. var i = keys.length;
  46321. while (i--) {
  46322. origin[keys[i]] = add[keys[i]];
  46323. }
  46324. return origin;
  46325. };
  46326. function hasOwnProperty(obj, prop) {
  46327. return Object.prototype.hasOwnProperty.call(obj, prop);
  46328. }
  46329. }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  46330. },{"./support/isBuffer":559,"_process":525,"inherits":558}],561:[function(require,module,exports){
  46331. /*import { transform as babelTransform } from 'babel-core';
  46332. import babelTransformDynamicImport from 'babel-plugin-syntax-dynamic-import';
  46333. import babelTransformES2015ModulesSystemJS from 'babel-plugin-transform-es2015-modules-systemjs';*/
  46334. // sadly, due to how rollup works, we can't use es6 imports here
  46335. var babelTransform = require('babel-core').transform;
  46336. var babelTransformDynamicImport = require('babel-plugin-syntax-dynamic-import');
  46337. var babelTransformES2015ModulesSystemJS = require('babel-plugin-transform-es2015-modules-systemjs');
  46338. var babelPresetES2015 = require('babel-preset-es2015');
  46339. self.onmessage = function (evt) {
  46340. // transform source with Babel
  46341. var output = babelTransform(evt.data.source, {
  46342. compact: false,
  46343. filename: evt.data.key + '!transpiled',
  46344. sourceFileName: evt.data.key,
  46345. moduleIds: false,
  46346. sourceMaps: 'inline',
  46347. babelrc: false,
  46348. plugins: [babelTransformDynamicImport, babelTransformES2015ModulesSystemJS],
  46349. presets: [babelPresetES2015],
  46350. });
  46351. self.postMessage({key: evt.data.key, code: output.code, source: evt.data.source});
  46352. };
  46353. },{"babel-core":5,"babel-plugin-syntax-dynamic-import":63,"babel-plugin-transform-es2015-modules-systemjs":79,"babel-preset-es2015":94}]},{},[561]);