mocha.js 573 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076
  1. (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
  2. (function (process,global){
  3. 'use strict';
  4. /* eslint no-unused-vars: off */
  5. /* eslint-env commonjs */
  6. /**
  7. * Shim process.stdout.
  8. */
  9. process.stdout = require('browser-stdout')({label: false});
  10. var Mocha = require('./lib/mocha');
  11. /**
  12. * Create a Mocha instance.
  13. *
  14. * @return {undefined}
  15. */
  16. var mocha = new Mocha({reporter: 'html'});
  17. /**
  18. * Save timer references to avoid Sinon interfering (see GH-237).
  19. */
  20. var Date = global.Date;
  21. var setTimeout = global.setTimeout;
  22. var setInterval = global.setInterval;
  23. var clearTimeout = global.clearTimeout;
  24. var clearInterval = global.clearInterval;
  25. var uncaughtExceptionHandlers = [];
  26. var originalOnerrorHandler = global.onerror;
  27. /**
  28. * Remove uncaughtException listener.
  29. * Revert to original onerror handler if previously defined.
  30. */
  31. process.removeListener = function(e, fn) {
  32. if (e === 'uncaughtException') {
  33. if (originalOnerrorHandler) {
  34. global.onerror = originalOnerrorHandler;
  35. } else {
  36. global.onerror = function() {};
  37. }
  38. var i = uncaughtExceptionHandlers.indexOf(fn);
  39. if (i !== -1) {
  40. uncaughtExceptionHandlers.splice(i, 1);
  41. }
  42. }
  43. };
  44. /**
  45. * Implements uncaughtException listener.
  46. */
  47. process.on = function(e, fn) {
  48. if (e === 'uncaughtException') {
  49. global.onerror = function(err, url, line) {
  50. fn(new Error(err + ' (' + url + ':' + line + ')'));
  51. return !mocha.allowUncaught;
  52. };
  53. uncaughtExceptionHandlers.push(fn);
  54. }
  55. };
  56. // The BDD UI is registered by default, but no UI will be functional in the
  57. // browser without an explicit call to the overridden `mocha.ui` (see below).
  58. // Ensure that this default UI does not expose its methods to the global scope.
  59. mocha.suite.removeAllListeners('pre-require');
  60. var immediateQueue = [];
  61. var immediateTimeout;
  62. function timeslice() {
  63. var immediateStart = new Date().getTime();
  64. while (immediateQueue.length && new Date().getTime() - immediateStart < 100) {
  65. immediateQueue.shift()();
  66. }
  67. if (immediateQueue.length) {
  68. immediateTimeout = setTimeout(timeslice, 0);
  69. } else {
  70. immediateTimeout = null;
  71. }
  72. }
  73. /**
  74. * High-performance override of Runner.immediately.
  75. */
  76. Mocha.Runner.immediately = function(callback) {
  77. immediateQueue.push(callback);
  78. if (!immediateTimeout) {
  79. immediateTimeout = setTimeout(timeslice, 0);
  80. }
  81. };
  82. /**
  83. * Function to allow assertion libraries to throw errors directly into mocha.
  84. * This is useful when running tests in a browser because window.onerror will
  85. * only receive the 'message' attribute of the Error.
  86. */
  87. mocha.throwError = function(err) {
  88. uncaughtExceptionHandlers.forEach(function(fn) {
  89. fn(err);
  90. });
  91. throw err;
  92. };
  93. /**
  94. * Override ui to ensure that the ui functions are initialized.
  95. * Normally this would happen in Mocha.prototype.loadFiles.
  96. */
  97. mocha.ui = function(ui) {
  98. Mocha.prototype.ui.call(this, ui);
  99. this.suite.emit('pre-require', global, null, this);
  100. return this;
  101. };
  102. /**
  103. * Setup mocha with the given setting options.
  104. */
  105. mocha.setup = function(opts) {
  106. if (typeof opts === 'string') {
  107. opts = {ui: opts};
  108. }
  109. for (var opt in opts) {
  110. if (opts.hasOwnProperty(opt)) {
  111. this[opt](opts[opt]);
  112. }
  113. }
  114. return this;
  115. };
  116. /**
  117. * Run mocha, returning the Runner.
  118. */
  119. mocha.run = function(fn) {
  120. var options = mocha.options;
  121. mocha.globals('location');
  122. var query = Mocha.utils.parseQuery(global.location.search || '');
  123. if (query.grep) {
  124. mocha.grep(query.grep);
  125. }
  126. if (query.fgrep) {
  127. mocha.fgrep(query.fgrep);
  128. }
  129. if (query.invert) {
  130. mocha.invert();
  131. }
  132. return Mocha.prototype.run.call(mocha, function(err) {
  133. // The DOM Document is not available in Web Workers.
  134. var document = global.document;
  135. if (
  136. document &&
  137. document.getElementById('mocha') &&
  138. options.noHighlighting !== true
  139. ) {
  140. Mocha.utils.highlightTags('code');
  141. }
  142. if (fn) {
  143. fn(err);
  144. }
  145. });
  146. };
  147. /**
  148. * Expose the process shim.
  149. * https://github.com/mochajs/mocha/pull/916
  150. */
  151. Mocha.process = process;
  152. /**
  153. * Expose mocha.
  154. */
  155. global.Mocha = Mocha;
  156. global.mocha = mocha;
  157. // this allows test/acceptance/required-tokens.js to pass; thus,
  158. // you can now do `const describe = require('mocha').describe` in a
  159. // browser context (assuming browserification). should fix #880
  160. module.exports = global;
  161. }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  162. },{"./lib/mocha":14,"_process":69,"browser-stdout":41}],2:[function(require,module,exports){
  163. (function (process,global){
  164. 'use strict';
  165. /**
  166. * Web Notifications module.
  167. * @module Growl
  168. */
  169. /**
  170. * Save timer references to avoid Sinon interfering (see GH-237).
  171. */
  172. var Date = global.Date;
  173. var setTimeout = global.setTimeout;
  174. var EVENT_RUN_END = require('../runner').constants.EVENT_RUN_END;
  175. /**
  176. * Checks if browser notification support exists.
  177. *
  178. * @public
  179. * @see {@link https://caniuse.com/#feat=notifications|Browser support (notifications)}
  180. * @see {@link https://caniuse.com/#feat=promises|Browser support (promises)}
  181. * @see {@link Mocha#growl}
  182. * @see {@link Mocha#isGrowlCapable}
  183. * @return {boolean} whether browser notification support exists
  184. */
  185. exports.isCapable = function() {
  186. var hasNotificationSupport = 'Notification' in window;
  187. var hasPromiseSupport = typeof Promise === 'function';
  188. return process.browser && hasNotificationSupport && hasPromiseSupport;
  189. };
  190. /**
  191. * Implements browser notifications as a pseudo-reporter.
  192. *
  193. * @public
  194. * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/notification|Notification API}
  195. * @see {@link https://developers.google.com/web/fundamentals/push-notifications/display-a-notification|Displaying a Notification}
  196. * @see {@link Growl#isPermitted}
  197. * @see {@link Mocha#_growl}
  198. * @param {Runner} runner - Runner instance.
  199. */
  200. exports.notify = function(runner) {
  201. var promise = isPermitted();
  202. /**
  203. * Attempt notification.
  204. */
  205. var sendNotification = function() {
  206. // If user hasn't responded yet... "No notification for you!" (Seinfeld)
  207. Promise.race([promise, Promise.resolve(undefined)])
  208. .then(canNotify)
  209. .then(function() {
  210. display(runner);
  211. })
  212. .catch(notPermitted);
  213. };
  214. runner.once(EVENT_RUN_END, sendNotification);
  215. };
  216. /**
  217. * Checks if browser notification is permitted by user.
  218. *
  219. * @private
  220. * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Notification/permission|Notification.permission}
  221. * @see {@link Mocha#growl}
  222. * @see {@link Mocha#isGrowlPermitted}
  223. * @returns {Promise<boolean>} promise determining if browser notification
  224. * permissible when fulfilled.
  225. */
  226. function isPermitted() {
  227. var permitted = {
  228. granted: function allow() {
  229. return Promise.resolve(true);
  230. },
  231. denied: function deny() {
  232. return Promise.resolve(false);
  233. },
  234. default: function ask() {
  235. return Notification.requestPermission().then(function(permission) {
  236. return permission === 'granted';
  237. });
  238. }
  239. };
  240. return permitted[Notification.permission]();
  241. }
  242. /**
  243. * @summary
  244. * Determines if notification should proceed.
  245. *
  246. * @description
  247. * Notification shall <strong>not</strong> proceed unless `value` is true.
  248. *
  249. * `value` will equal one of:
  250. * <ul>
  251. * <li><code>true</code> (from `isPermitted`)</li>
  252. * <li><code>false</code> (from `isPermitted`)</li>
  253. * <li><code>undefined</code> (from `Promise.race`)</li>
  254. * </ul>
  255. *
  256. * @private
  257. * @param {boolean|undefined} value - Determines if notification permissible.
  258. * @returns {Promise<undefined>} Notification can proceed
  259. */
  260. function canNotify(value) {
  261. if (!value) {
  262. var why = value === false ? 'blocked' : 'unacknowledged';
  263. var reason = 'not permitted by user (' + why + ')';
  264. return Promise.reject(new Error(reason));
  265. }
  266. return Promise.resolve();
  267. }
  268. /**
  269. * Displays the notification.
  270. *
  271. * @private
  272. * @param {Runner} runner - Runner instance.
  273. */
  274. function display(runner) {
  275. var stats = runner.stats;
  276. var symbol = {
  277. cross: '\u274C',
  278. tick: '\u2705'
  279. };
  280. var logo = require('../../package').notifyLogo;
  281. var _message;
  282. var message;
  283. var title;
  284. if (stats.failures) {
  285. _message = stats.failures + ' of ' + stats.tests + ' tests failed';
  286. message = symbol.cross + ' ' + _message;
  287. title = 'Failed';
  288. } else {
  289. _message = stats.passes + ' tests passed in ' + stats.duration + 'ms';
  290. message = symbol.tick + ' ' + _message;
  291. title = 'Passed';
  292. }
  293. // Send notification
  294. var options = {
  295. badge: logo,
  296. body: message,
  297. dir: 'ltr',
  298. icon: logo,
  299. lang: 'en-US',
  300. name: 'mocha',
  301. requireInteraction: false,
  302. timestamp: Date.now()
  303. };
  304. var notification = new Notification(title, options);
  305. // Autoclose after brief delay (makes various browsers act same)
  306. var FORCE_DURATION = 4000;
  307. setTimeout(notification.close.bind(notification), FORCE_DURATION);
  308. }
  309. /**
  310. * As notifications are tangential to our purpose, just log the error.
  311. *
  312. * @private
  313. * @param {Error} err - Why notification didn't happen.
  314. */
  315. function notPermitted(err) {
  316. console.error('notification error:', err.message);
  317. }
  318. }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  319. },{"../../package":90,"../runner":34,"_process":69}],3:[function(require,module,exports){
  320. 'use strict';
  321. /**
  322. * Expose `Progress`.
  323. */
  324. module.exports = Progress;
  325. /**
  326. * Initialize a new `Progress` indicator.
  327. */
  328. function Progress() {
  329. this.percent = 0;
  330. this.size(0);
  331. this.fontSize(11);
  332. this.font('helvetica, arial, sans-serif');
  333. }
  334. /**
  335. * Set progress size to `size`.
  336. *
  337. * @public
  338. * @param {number} size
  339. * @return {Progress} Progress instance.
  340. */
  341. Progress.prototype.size = function(size) {
  342. this._size = size;
  343. return this;
  344. };
  345. /**
  346. * Set text to `text`.
  347. *
  348. * @public
  349. * @param {string} text
  350. * @return {Progress} Progress instance.
  351. */
  352. Progress.prototype.text = function(text) {
  353. this._text = text;
  354. return this;
  355. };
  356. /**
  357. * Set font size to `size`.
  358. *
  359. * @public
  360. * @param {number} size
  361. * @return {Progress} Progress instance.
  362. */
  363. Progress.prototype.fontSize = function(size) {
  364. this._fontSize = size;
  365. return this;
  366. };
  367. /**
  368. * Set font to `family`.
  369. *
  370. * @param {string} family
  371. * @return {Progress} Progress instance.
  372. */
  373. Progress.prototype.font = function(family) {
  374. this._font = family;
  375. return this;
  376. };
  377. /**
  378. * Update percentage to `n`.
  379. *
  380. * @param {number} n
  381. * @return {Progress} Progress instance.
  382. */
  383. Progress.prototype.update = function(n) {
  384. this.percent = n;
  385. return this;
  386. };
  387. /**
  388. * Draw on `ctx`.
  389. *
  390. * @param {CanvasRenderingContext2d} ctx
  391. * @return {Progress} Progress instance.
  392. */
  393. Progress.prototype.draw = function(ctx) {
  394. try {
  395. var percent = Math.min(this.percent, 100);
  396. var size = this._size;
  397. var half = size / 2;
  398. var x = half;
  399. var y = half;
  400. var rad = half - 1;
  401. var fontSize = this._fontSize;
  402. ctx.font = fontSize + 'px ' + this._font;
  403. var angle = Math.PI * 2 * (percent / 100);
  404. ctx.clearRect(0, 0, size, size);
  405. // outer circle
  406. ctx.strokeStyle = '#9f9f9f';
  407. ctx.beginPath();
  408. ctx.arc(x, y, rad, 0, angle, false);
  409. ctx.stroke();
  410. // inner circle
  411. ctx.strokeStyle = '#eee';
  412. ctx.beginPath();
  413. ctx.arc(x, y, rad - 1, 0, angle, true);
  414. ctx.stroke();
  415. // text
  416. var text = this._text || (percent | 0) + '%';
  417. var w = ctx.measureText(text).width;
  418. ctx.fillText(text, x - w / 2 + 1, y + fontSize / 2 - 1);
  419. } catch (ignore) {
  420. // don't fail if we can't render progress
  421. }
  422. return this;
  423. };
  424. },{}],4:[function(require,module,exports){
  425. (function (global){
  426. 'use strict';
  427. exports.isatty = function isatty() {
  428. return true;
  429. };
  430. exports.getWindowSize = function getWindowSize() {
  431. if ('innerHeight' in global) {
  432. return [global.innerHeight, global.innerWidth];
  433. }
  434. // In a Web Worker, the DOM Window is not available.
  435. return [640, 480];
  436. };
  437. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  438. },{}],5:[function(require,module,exports){
  439. 'use strict';
  440. /**
  441. * @module Context
  442. */
  443. /**
  444. * Expose `Context`.
  445. */
  446. module.exports = Context;
  447. /**
  448. * Initialize a new `Context`.
  449. *
  450. * @private
  451. */
  452. function Context() {}
  453. /**
  454. * Set or get the context `Runnable` to `runnable`.
  455. *
  456. * @private
  457. * @param {Runnable} runnable
  458. * @return {Context} context
  459. */
  460. Context.prototype.runnable = function(runnable) {
  461. if (!arguments.length) {
  462. return this._runnable;
  463. }
  464. this.test = this._runnable = runnable;
  465. return this;
  466. };
  467. /**
  468. * Set or get test timeout `ms`.
  469. *
  470. * @private
  471. * @param {number} ms
  472. * @return {Context} self
  473. */
  474. Context.prototype.timeout = function(ms) {
  475. if (!arguments.length) {
  476. return this.runnable().timeout();
  477. }
  478. this.runnable().timeout(ms);
  479. return this;
  480. };
  481. /**
  482. * Set test timeout `enabled`.
  483. *
  484. * @private
  485. * @param {boolean} enabled
  486. * @return {Context} self
  487. */
  488. Context.prototype.enableTimeouts = function(enabled) {
  489. if (!arguments.length) {
  490. return this.runnable().enableTimeouts();
  491. }
  492. this.runnable().enableTimeouts(enabled);
  493. return this;
  494. };
  495. /**
  496. * Set or get test slowness threshold `ms`.
  497. *
  498. * @private
  499. * @param {number} ms
  500. * @return {Context} self
  501. */
  502. Context.prototype.slow = function(ms) {
  503. if (!arguments.length) {
  504. return this.runnable().slow();
  505. }
  506. this.runnable().slow(ms);
  507. return this;
  508. };
  509. /**
  510. * Mark a test as skipped.
  511. *
  512. * @private
  513. * @throws Pending
  514. */
  515. Context.prototype.skip = function() {
  516. this.runnable().skip();
  517. };
  518. /**
  519. * Set or get a number of allowed retries on failed tests
  520. *
  521. * @private
  522. * @param {number} n
  523. * @return {Context} self
  524. */
  525. Context.prototype.retries = function(n) {
  526. if (!arguments.length) {
  527. return this.runnable().retries();
  528. }
  529. this.runnable().retries(n);
  530. return this;
  531. };
  532. },{}],6:[function(require,module,exports){
  533. 'use strict';
  534. /**
  535. * @module Errors
  536. */
  537. /**
  538. * Factory functions to create throwable error objects
  539. */
  540. /**
  541. * Creates an error object to be thrown when no files to be tested could be found using specified pattern.
  542. *
  543. * @public
  544. * @param {string} message - Error message to be displayed.
  545. * @param {string} pattern - User-specified argument value.
  546. * @returns {Error} instance detailing the error condition
  547. */
  548. function createNoFilesMatchPatternError(message, pattern) {
  549. var err = new Error(message);
  550. err.code = 'ERR_MOCHA_NO_FILES_MATCH_PATTERN';
  551. err.pattern = pattern;
  552. return err;
  553. }
  554. /**
  555. * Creates an error object to be thrown when the reporter specified in the options was not found.
  556. *
  557. * @public
  558. * @param {string} message - Error message to be displayed.
  559. * @param {string} reporter - User-specified reporter value.
  560. * @returns {Error} instance detailing the error condition
  561. */
  562. function createInvalidReporterError(message, reporter) {
  563. var err = new TypeError(message);
  564. err.code = 'ERR_MOCHA_INVALID_REPORTER';
  565. err.reporter = reporter;
  566. return err;
  567. }
  568. /**
  569. * Creates an error object to be thrown when the interface specified in the options was not found.
  570. *
  571. * @public
  572. * @param {string} message - Error message to be displayed.
  573. * @param {string} ui - User-specified interface value.
  574. * @returns {Error} instance detailing the error condition
  575. */
  576. function createInvalidInterfaceError(message, ui) {
  577. var err = new Error(message);
  578. err.code = 'ERR_MOCHA_INVALID_INTERFACE';
  579. err.interface = ui;
  580. return err;
  581. }
  582. /**
  583. * Creates an error object to be thrown when a behavior, option, or parameter is unsupported.
  584. *
  585. * @public
  586. * @param {string} message - Error message to be displayed.
  587. * @returns {Error} instance detailing the error condition
  588. */
  589. function createUnsupportedError(message) {
  590. var err = new Error(message);
  591. err.code = 'ERR_MOCHA_UNSUPPORTED';
  592. return err;
  593. }
  594. /**
  595. * Creates an error object to be thrown when an argument is missing.
  596. *
  597. * @public
  598. * @param {string} message - Error message to be displayed.
  599. * @param {string} argument - Argument name.
  600. * @param {string} expected - Expected argument datatype.
  601. * @returns {Error} instance detailing the error condition
  602. */
  603. function createMissingArgumentError(message, argument, expected) {
  604. return createInvalidArgumentTypeError(message, argument, expected);
  605. }
  606. /**
  607. * Creates an error object to be thrown when an argument did not use the supported type
  608. *
  609. * @public
  610. * @param {string} message - Error message to be displayed.
  611. * @param {string} argument - Argument name.
  612. * @param {string} expected - Expected argument datatype.
  613. * @returns {Error} instance detailing the error condition
  614. */
  615. function createInvalidArgumentTypeError(message, argument, expected) {
  616. var err = new TypeError(message);
  617. err.code = 'ERR_MOCHA_INVALID_ARG_TYPE';
  618. err.argument = argument;
  619. err.expected = expected;
  620. err.actual = typeof argument;
  621. return err;
  622. }
  623. /**
  624. * Creates an error object to be thrown when an argument did not use the supported value
  625. *
  626. * @public
  627. * @param {string} message - Error message to be displayed.
  628. * @param {string} argument - Argument name.
  629. * @param {string} value - Argument value.
  630. * @param {string} [reason] - Why value is invalid.
  631. * @returns {Error} instance detailing the error condition
  632. */
  633. function createInvalidArgumentValueError(message, argument, value, reason) {
  634. var err = new TypeError(message);
  635. err.code = 'ERR_MOCHA_INVALID_ARG_VALUE';
  636. err.argument = argument;
  637. err.value = value;
  638. err.reason = typeof reason !== 'undefined' ? reason : 'is invalid';
  639. return err;
  640. }
  641. /**
  642. * Creates an error object to be thrown when an exception was caught, but the `Error` is falsy or undefined.
  643. *
  644. * @public
  645. * @param {string} message - Error message to be displayed.
  646. * @returns {Error} instance detailing the error condition
  647. */
  648. function createInvalidExceptionError(message, value) {
  649. var err = new Error(message);
  650. err.code = 'ERR_MOCHA_INVALID_EXCEPTION';
  651. err.valueType = typeof value;
  652. err.value = value;
  653. return err;
  654. }
  655. module.exports = {
  656. createInvalidArgumentTypeError: createInvalidArgumentTypeError,
  657. createInvalidArgumentValueError: createInvalidArgumentValueError,
  658. createInvalidExceptionError: createInvalidExceptionError,
  659. createInvalidInterfaceError: createInvalidInterfaceError,
  660. createInvalidReporterError: createInvalidReporterError,
  661. createMissingArgumentError: createMissingArgumentError,
  662. createNoFilesMatchPatternError: createNoFilesMatchPatternError,
  663. createUnsupportedError: createUnsupportedError
  664. };
  665. },{}],7:[function(require,module,exports){
  666. 'use strict';
  667. var Runnable = require('./runnable');
  668. var inherits = require('./utils').inherits;
  669. /**
  670. * Expose `Hook`.
  671. */
  672. module.exports = Hook;
  673. /**
  674. * Initialize a new `Hook` with the given `title` and callback `fn`
  675. *
  676. * @class
  677. * @extends Runnable
  678. * @param {String} title
  679. * @param {Function} fn
  680. */
  681. function Hook(title, fn) {
  682. Runnable.call(this, title, fn);
  683. this.type = 'hook';
  684. }
  685. /**
  686. * Inherit from `Runnable.prototype`.
  687. */
  688. inherits(Hook, Runnable);
  689. /**
  690. * Get or set the test `err`.
  691. *
  692. * @memberof Hook
  693. * @public
  694. * @param {Error} err
  695. * @return {Error}
  696. */
  697. Hook.prototype.error = function(err) {
  698. if (!arguments.length) {
  699. err = this._error;
  700. this._error = null;
  701. return err;
  702. }
  703. this._error = err;
  704. };
  705. },{"./runnable":33,"./utils":38}],8:[function(require,module,exports){
  706. 'use strict';
  707. var Test = require('../test');
  708. var EVENT_FILE_PRE_REQUIRE = require('../suite').constants
  709. .EVENT_FILE_PRE_REQUIRE;
  710. /**
  711. * BDD-style interface:
  712. *
  713. * describe('Array', function() {
  714. * describe('#indexOf()', function() {
  715. * it('should return -1 when not present', function() {
  716. * // ...
  717. * });
  718. *
  719. * it('should return the index when present', function() {
  720. * // ...
  721. * });
  722. * });
  723. * });
  724. *
  725. * @param {Suite} suite Root suite.
  726. */
  727. module.exports = function bddInterface(suite) {
  728. var suites = [suite];
  729. suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
  730. var common = require('./common')(suites, context, mocha);
  731. context.before = common.before;
  732. context.after = common.after;
  733. context.beforeEach = common.beforeEach;
  734. context.afterEach = common.afterEach;
  735. context.run = mocha.options.delay && common.runWithSuite(suite);
  736. /**
  737. * Describe a "suite" with the given `title`
  738. * and callback `fn` containing nested suites
  739. * and/or tests.
  740. */
  741. context.describe = context.context = function(title, fn) {
  742. return common.suite.create({
  743. title: title,
  744. file: file,
  745. fn: fn
  746. });
  747. };
  748. /**
  749. * Pending describe.
  750. */
  751. context.xdescribe = context.xcontext = context.describe.skip = function(
  752. title,
  753. fn
  754. ) {
  755. return common.suite.skip({
  756. title: title,
  757. file: file,
  758. fn: fn
  759. });
  760. };
  761. /**
  762. * Exclusive suite.
  763. */
  764. context.describe.only = function(title, fn) {
  765. return common.suite.only({
  766. title: title,
  767. file: file,
  768. fn: fn
  769. });
  770. };
  771. /**
  772. * Describe a specification or test-case
  773. * with the given `title` and callback `fn`
  774. * acting as a thunk.
  775. */
  776. context.it = context.specify = function(title, fn) {
  777. var suite = suites[0];
  778. if (suite.isPending()) {
  779. fn = null;
  780. }
  781. var test = new Test(title, fn);
  782. test.file = file;
  783. suite.addTest(test);
  784. return test;
  785. };
  786. /**
  787. * Exclusive test-case.
  788. */
  789. context.it.only = function(title, fn) {
  790. return common.test.only(mocha, context.it(title, fn));
  791. };
  792. /**
  793. * Pending test case.
  794. */
  795. context.xit = context.xspecify = context.it.skip = function(title) {
  796. return context.it(title);
  797. };
  798. /**
  799. * Number of attempts to retry.
  800. */
  801. context.it.retries = function(n) {
  802. context.retries(n);
  803. };
  804. });
  805. };
  806. module.exports.description = 'BDD or RSpec style [default]';
  807. },{"../suite":36,"../test":37,"./common":9}],9:[function(require,module,exports){
  808. 'use strict';
  809. var Suite = require('../suite');
  810. var errors = require('../errors');
  811. var createMissingArgumentError = errors.createMissingArgumentError;
  812. /**
  813. * Functions common to more than one interface.
  814. *
  815. * @param {Suite[]} suites
  816. * @param {Context} context
  817. * @param {Mocha} mocha
  818. * @return {Object} An object containing common functions.
  819. */
  820. module.exports = function(suites, context, mocha) {
  821. /**
  822. * Check if the suite should be tested.
  823. *
  824. * @private
  825. * @param {Suite} suite - suite to check
  826. * @returns {boolean}
  827. */
  828. function shouldBeTested(suite) {
  829. return (
  830. !mocha.options.grep ||
  831. (mocha.options.grep &&
  832. mocha.options.grep.test(suite.fullTitle()) &&
  833. !mocha.options.invert)
  834. );
  835. }
  836. return {
  837. /**
  838. * This is only present if flag --delay is passed into Mocha. It triggers
  839. * root suite execution.
  840. *
  841. * @param {Suite} suite The root suite.
  842. * @return {Function} A function which runs the root suite
  843. */
  844. runWithSuite: function runWithSuite(suite) {
  845. return function run() {
  846. suite.run();
  847. };
  848. },
  849. /**
  850. * Execute before running tests.
  851. *
  852. * @param {string} name
  853. * @param {Function} fn
  854. */
  855. before: function(name, fn) {
  856. suites[0].beforeAll(name, fn);
  857. },
  858. /**
  859. * Execute after running tests.
  860. *
  861. * @param {string} name
  862. * @param {Function} fn
  863. */
  864. after: function(name, fn) {
  865. suites[0].afterAll(name, fn);
  866. },
  867. /**
  868. * Execute before each test case.
  869. *
  870. * @param {string} name
  871. * @param {Function} fn
  872. */
  873. beforeEach: function(name, fn) {
  874. suites[0].beforeEach(name, fn);
  875. },
  876. /**
  877. * Execute after each test case.
  878. *
  879. * @param {string} name
  880. * @param {Function} fn
  881. */
  882. afterEach: function(name, fn) {
  883. suites[0].afterEach(name, fn);
  884. },
  885. suite: {
  886. /**
  887. * Create an exclusive Suite; convenience function
  888. * See docstring for create() below.
  889. *
  890. * @param {Object} opts
  891. * @returns {Suite}
  892. */
  893. only: function only(opts) {
  894. opts.isOnly = true;
  895. return this.create(opts);
  896. },
  897. /**
  898. * Create a Suite, but skip it; convenience function
  899. * See docstring for create() below.
  900. *
  901. * @param {Object} opts
  902. * @returns {Suite}
  903. */
  904. skip: function skip(opts) {
  905. opts.pending = true;
  906. return this.create(opts);
  907. },
  908. /**
  909. * Creates a suite.
  910. *
  911. * @param {Object} opts Options
  912. * @param {string} opts.title Title of Suite
  913. * @param {Function} [opts.fn] Suite Function (not always applicable)
  914. * @param {boolean} [opts.pending] Is Suite pending?
  915. * @param {string} [opts.file] Filepath where this Suite resides
  916. * @param {boolean} [opts.isOnly] Is Suite exclusive?
  917. * @returns {Suite}
  918. */
  919. create: function create(opts) {
  920. var suite = Suite.create(suites[0], opts.title);
  921. suite.pending = Boolean(opts.pending);
  922. suite.file = opts.file;
  923. suites.unshift(suite);
  924. if (opts.isOnly) {
  925. if (mocha.options.forbidOnly && shouldBeTested(suite)) {
  926. throw new Error('`.only` forbidden');
  927. }
  928. suite.parent.appendOnlySuite(suite);
  929. }
  930. if (suite.pending) {
  931. if (mocha.options.forbidPending && shouldBeTested(suite)) {
  932. throw new Error('Pending test forbidden');
  933. }
  934. }
  935. if (typeof opts.fn === 'function') {
  936. opts.fn.call(suite);
  937. suites.shift();
  938. } else if (typeof opts.fn === 'undefined' && !suite.pending) {
  939. throw createMissingArgumentError(
  940. 'Suite "' +
  941. suite.fullTitle() +
  942. '" was defined but no callback was supplied. ' +
  943. 'Supply a callback or explicitly skip the suite.',
  944. 'callback',
  945. 'function'
  946. );
  947. } else if (!opts.fn && suite.pending) {
  948. suites.shift();
  949. }
  950. return suite;
  951. }
  952. },
  953. test: {
  954. /**
  955. * Exclusive test-case.
  956. *
  957. * @param {Object} mocha
  958. * @param {Function} test
  959. * @returns {*}
  960. */
  961. only: function(mocha, test) {
  962. test.parent.appendOnlyTest(test);
  963. return test;
  964. },
  965. /**
  966. * Pending test case.
  967. *
  968. * @param {string} title
  969. */
  970. skip: function(title) {
  971. context.test(title);
  972. },
  973. /**
  974. * Number of retry attempts
  975. *
  976. * @param {number} n
  977. */
  978. retries: function(n) {
  979. context.retries(n);
  980. }
  981. }
  982. };
  983. };
  984. },{"../errors":6,"../suite":36}],10:[function(require,module,exports){
  985. 'use strict';
  986. var Suite = require('../suite');
  987. var Test = require('../test');
  988. /**
  989. * Exports-style (as Node.js module) interface:
  990. *
  991. * exports.Array = {
  992. * '#indexOf()': {
  993. * 'should return -1 when the value is not present': function() {
  994. *
  995. * },
  996. *
  997. * 'should return the correct index when the value is present': function() {
  998. *
  999. * }
  1000. * }
  1001. * };
  1002. *
  1003. * @param {Suite} suite Root suite.
  1004. */
  1005. module.exports = function(suite) {
  1006. var suites = [suite];
  1007. suite.on(Suite.constants.EVENT_FILE_REQUIRE, visit);
  1008. function visit(obj, file) {
  1009. var suite;
  1010. for (var key in obj) {
  1011. if (typeof obj[key] === 'function') {
  1012. var fn = obj[key];
  1013. switch (key) {
  1014. case 'before':
  1015. suites[0].beforeAll(fn);
  1016. break;
  1017. case 'after':
  1018. suites[0].afterAll(fn);
  1019. break;
  1020. case 'beforeEach':
  1021. suites[0].beforeEach(fn);
  1022. break;
  1023. case 'afterEach':
  1024. suites[0].afterEach(fn);
  1025. break;
  1026. default:
  1027. var test = new Test(key, fn);
  1028. test.file = file;
  1029. suites[0].addTest(test);
  1030. }
  1031. } else {
  1032. suite = Suite.create(suites[0], key);
  1033. suites.unshift(suite);
  1034. visit(obj[key], file);
  1035. suites.shift();
  1036. }
  1037. }
  1038. }
  1039. };
  1040. module.exports.description = 'Node.js module ("exports") style';
  1041. },{"../suite":36,"../test":37}],11:[function(require,module,exports){
  1042. 'use strict';
  1043. exports.bdd = require('./bdd');
  1044. exports.tdd = require('./tdd');
  1045. exports.qunit = require('./qunit');
  1046. exports.exports = require('./exports');
  1047. },{"./bdd":8,"./exports":10,"./qunit":12,"./tdd":13}],12:[function(require,module,exports){
  1048. 'use strict';
  1049. var Test = require('../test');
  1050. var EVENT_FILE_PRE_REQUIRE = require('../suite').constants
  1051. .EVENT_FILE_PRE_REQUIRE;
  1052. /**
  1053. * QUnit-style interface:
  1054. *
  1055. * suite('Array');
  1056. *
  1057. * test('#length', function() {
  1058. * var arr = [1,2,3];
  1059. * ok(arr.length == 3);
  1060. * });
  1061. *
  1062. * test('#indexOf()', function() {
  1063. * var arr = [1,2,3];
  1064. * ok(arr.indexOf(1) == 0);
  1065. * ok(arr.indexOf(2) == 1);
  1066. * ok(arr.indexOf(3) == 2);
  1067. * });
  1068. *
  1069. * suite('String');
  1070. *
  1071. * test('#length', function() {
  1072. * ok('foo'.length == 3);
  1073. * });
  1074. *
  1075. * @param {Suite} suite Root suite.
  1076. */
  1077. module.exports = function qUnitInterface(suite) {
  1078. var suites = [suite];
  1079. suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
  1080. var common = require('./common')(suites, context, mocha);
  1081. context.before = common.before;
  1082. context.after = common.after;
  1083. context.beforeEach = common.beforeEach;
  1084. context.afterEach = common.afterEach;
  1085. context.run = mocha.options.delay && common.runWithSuite(suite);
  1086. /**
  1087. * Describe a "suite" with the given `title`.
  1088. */
  1089. context.suite = function(title) {
  1090. if (suites.length > 1) {
  1091. suites.shift();
  1092. }
  1093. return common.suite.create({
  1094. title: title,
  1095. file: file,
  1096. fn: false
  1097. });
  1098. };
  1099. /**
  1100. * Exclusive Suite.
  1101. */
  1102. context.suite.only = function(title) {
  1103. if (suites.length > 1) {
  1104. suites.shift();
  1105. }
  1106. return common.suite.only({
  1107. title: title,
  1108. file: file,
  1109. fn: false
  1110. });
  1111. };
  1112. /**
  1113. * Describe a specification or test-case
  1114. * with the given `title` and callback `fn`
  1115. * acting as a thunk.
  1116. */
  1117. context.test = function(title, fn) {
  1118. var test = new Test(title, fn);
  1119. test.file = file;
  1120. suites[0].addTest(test);
  1121. return test;
  1122. };
  1123. /**
  1124. * Exclusive test-case.
  1125. */
  1126. context.test.only = function(title, fn) {
  1127. return common.test.only(mocha, context.test(title, fn));
  1128. };
  1129. context.test.skip = common.test.skip;
  1130. context.test.retries = common.test.retries;
  1131. });
  1132. };
  1133. module.exports.description = 'QUnit style';
  1134. },{"../suite":36,"../test":37,"./common":9}],13:[function(require,module,exports){
  1135. 'use strict';
  1136. var Test = require('../test');
  1137. var EVENT_FILE_PRE_REQUIRE = require('../suite').constants
  1138. .EVENT_FILE_PRE_REQUIRE;
  1139. /**
  1140. * TDD-style interface:
  1141. *
  1142. * suite('Array', function() {
  1143. * suite('#indexOf()', function() {
  1144. * suiteSetup(function() {
  1145. *
  1146. * });
  1147. *
  1148. * test('should return -1 when not present', function() {
  1149. *
  1150. * });
  1151. *
  1152. * test('should return the index when present', function() {
  1153. *
  1154. * });
  1155. *
  1156. * suiteTeardown(function() {
  1157. *
  1158. * });
  1159. * });
  1160. * });
  1161. *
  1162. * @param {Suite} suite Root suite.
  1163. */
  1164. module.exports = function(suite) {
  1165. var suites = [suite];
  1166. suite.on(EVENT_FILE_PRE_REQUIRE, function(context, file, mocha) {
  1167. var common = require('./common')(suites, context, mocha);
  1168. context.setup = common.beforeEach;
  1169. context.teardown = common.afterEach;
  1170. context.suiteSetup = common.before;
  1171. context.suiteTeardown = common.after;
  1172. context.run = mocha.options.delay && common.runWithSuite(suite);
  1173. /**
  1174. * Describe a "suite" with the given `title` and callback `fn` containing
  1175. * nested suites and/or tests.
  1176. */
  1177. context.suite = function(title, fn) {
  1178. return common.suite.create({
  1179. title: title,
  1180. file: file,
  1181. fn: fn
  1182. });
  1183. };
  1184. /**
  1185. * Pending suite.
  1186. */
  1187. context.suite.skip = function(title, fn) {
  1188. return common.suite.skip({
  1189. title: title,
  1190. file: file,
  1191. fn: fn
  1192. });
  1193. };
  1194. /**
  1195. * Exclusive test-case.
  1196. */
  1197. context.suite.only = function(title, fn) {
  1198. return common.suite.only({
  1199. title: title,
  1200. file: file,
  1201. fn: fn
  1202. });
  1203. };
  1204. /**
  1205. * Describe a specification or test-case with the given `title` and
  1206. * callback `fn` acting as a thunk.
  1207. */
  1208. context.test = function(title, fn) {
  1209. var suite = suites[0];
  1210. if (suite.isPending()) {
  1211. fn = null;
  1212. }
  1213. var test = new Test(title, fn);
  1214. test.file = file;
  1215. suite.addTest(test);
  1216. return test;
  1217. };
  1218. /**
  1219. * Exclusive test-case.
  1220. */
  1221. context.test.only = function(title, fn) {
  1222. return common.test.only(mocha, context.test(title, fn));
  1223. };
  1224. context.test.skip = common.test.skip;
  1225. context.test.retries = common.test.retries;
  1226. });
  1227. };
  1228. module.exports.description =
  1229. 'traditional "suite"/"test" instead of BDD\'s "describe"/"it"';
  1230. },{"../suite":36,"../test":37,"./common":9}],14:[function(require,module,exports){
  1231. (function (process,global){
  1232. 'use strict';
  1233. /*!
  1234. * mocha
  1235. * Copyright(c) 2011 TJ Holowaychuk <tj@vision-media.ca>
  1236. * MIT Licensed
  1237. */
  1238. var escapeRe = require('escape-string-regexp');
  1239. var path = require('path');
  1240. var builtinReporters = require('./reporters');
  1241. var growl = require('./growl');
  1242. var utils = require('./utils');
  1243. var mocharc = require('./mocharc.json');
  1244. var errors = require('./errors');
  1245. var Suite = require('./suite');
  1246. var createStatsCollector = require('./stats-collector');
  1247. var createInvalidReporterError = errors.createInvalidReporterError;
  1248. var createInvalidInterfaceError = errors.createInvalidInterfaceError;
  1249. var EVENT_FILE_PRE_REQUIRE = Suite.constants.EVENT_FILE_PRE_REQUIRE;
  1250. var EVENT_FILE_POST_REQUIRE = Suite.constants.EVENT_FILE_POST_REQUIRE;
  1251. var EVENT_FILE_REQUIRE = Suite.constants.EVENT_FILE_REQUIRE;
  1252. var sQuote = utils.sQuote;
  1253. exports = module.exports = Mocha;
  1254. /**
  1255. * To require local UIs and reporters when running in node.
  1256. */
  1257. if (!process.browser) {
  1258. var cwd = process.cwd();
  1259. module.paths.push(cwd, path.join(cwd, 'node_modules'));
  1260. }
  1261. /**
  1262. * Expose internals.
  1263. */
  1264. /**
  1265. * @public
  1266. * @class utils
  1267. * @memberof Mocha
  1268. */
  1269. exports.utils = utils;
  1270. exports.interfaces = require('./interfaces');
  1271. /**
  1272. * @public
  1273. * @memberof Mocha
  1274. */
  1275. exports.reporters = builtinReporters;
  1276. exports.Runnable = require('./runnable');
  1277. exports.Context = require('./context');
  1278. /**
  1279. *
  1280. * @memberof Mocha
  1281. */
  1282. exports.Runner = require('./runner');
  1283. exports.Suite = Suite;
  1284. exports.Hook = require('./hook');
  1285. exports.Test = require('./test');
  1286. /**
  1287. * Constructs a new Mocha instance with `options`.
  1288. *
  1289. * @public
  1290. * @class Mocha
  1291. * @param {Object} [options] - Settings object.
  1292. * @param {boolean} [options.allowUncaught] - Propagate uncaught errors?
  1293. * @param {boolean} [options.asyncOnly] - Force `done` callback or promise?
  1294. * @param {boolean} [options.bail] - Bail after first test failure?
  1295. * @param {boolean} [options.checkLeaks] - If true, check leaks.
  1296. * @param {boolean} [options.delay] - Delay root suite execution?
  1297. * @param {boolean} [options.enableTimeouts] - Enable timeouts?
  1298. * @param {string} [options.fgrep] - Test filter given string.
  1299. * @param {boolean} [options.forbidOnly] - Tests marked `only` fail the suite?
  1300. * @param {boolean} [options.forbidPending] - Pending tests fail the suite?
  1301. * @param {boolean} [options.fullStackTrace] - Full stacktrace upon failure?
  1302. * @param {string[]} [options.global] - Variables expected in global scope.
  1303. * @param {RegExp|string} [options.grep] - Test filter given regular expression.
  1304. * @param {boolean} [options.growl] - Enable desktop notifications?
  1305. * @param {boolean} [options.hideDiff] - Suppress diffs from failures?
  1306. * @param {boolean} [options.ignoreLeaks] - Ignore global leaks?
  1307. * @param {boolean} [options.invert] - Invert test filter matches?
  1308. * @param {boolean} [options.noHighlighting] - Disable syntax highlighting?
  1309. * @param {string} [options.reporter] - Reporter name.
  1310. * @param {Object} [options.reporterOption] - Reporter settings object.
  1311. * @param {number} [options.retries] - Number of times to retry failed tests.
  1312. * @param {number} [options.slow] - Slow threshold value.
  1313. * @param {number|string} [options.timeout] - Timeout threshold value.
  1314. * @param {string} [options.ui] - Interface name.
  1315. * @param {boolean} [options.color] - Color TTY output from reporter?
  1316. * @param {boolean} [options.useInlineDiffs] - Use inline diffs?
  1317. */
  1318. function Mocha(options) {
  1319. options = utils.assign({}, mocharc, options || {});
  1320. this.files = [];
  1321. this.options = options;
  1322. // root suite
  1323. this.suite = new exports.Suite('', new exports.Context(), true);
  1324. if ('useColors' in options) {
  1325. utils.deprecate(
  1326. 'useColors is DEPRECATED and will be removed from a future version of Mocha. Instead, use the "color" option'
  1327. );
  1328. options.color = 'color' in options ? options.color : options.useColors;
  1329. }
  1330. this.grep(options.grep)
  1331. .fgrep(options.fgrep)
  1332. .ui(options.ui)
  1333. .bail(options.bail)
  1334. .reporter(options.reporter, options.reporterOptions)
  1335. .useColors(options.color)
  1336. .slow(options.slow)
  1337. .useInlineDiffs(options.inlineDiffs)
  1338. .globals(options.globals);
  1339. if ('enableTimeouts' in options) {
  1340. utils.deprecate(
  1341. 'enableTimeouts is DEPRECATED and will be removed from a future version of Mocha. Instead, use "timeout: false" to disable timeouts.'
  1342. );
  1343. if (options.enableTimeouts === false) {
  1344. this.timeout(0);
  1345. }
  1346. }
  1347. // this guard exists because Suite#timeout does not consider `undefined` to be valid input
  1348. if (typeof options.timeout !== 'undefined') {
  1349. this.timeout(options.timeout === false ? 0 : options.timeout);
  1350. }
  1351. if ('retries' in options) {
  1352. this.retries(options.retries);
  1353. }
  1354. if ('diff' in options) {
  1355. this.hideDiff(!options.diff);
  1356. }
  1357. [
  1358. 'allowUncaught',
  1359. 'asyncOnly',
  1360. 'checkLeaks',
  1361. 'delay',
  1362. 'forbidOnly',
  1363. 'forbidPending',
  1364. 'fullTrace',
  1365. 'growl',
  1366. 'invert'
  1367. ].forEach(function(opt) {
  1368. if (options[opt]) {
  1369. this[opt]();
  1370. }
  1371. }, this);
  1372. }
  1373. /**
  1374. * Enables or disables bailing on the first failure.
  1375. *
  1376. * @public
  1377. * @see {@link https://mochajs.org/#-b---bail|CLI option}
  1378. * @param {boolean} [bail=true] - Whether to bail on first error.
  1379. * @returns {Mocha} this
  1380. * @chainable
  1381. */
  1382. Mocha.prototype.bail = function(bail) {
  1383. if (!arguments.length) {
  1384. bail = true;
  1385. }
  1386. this.suite.bail(bail);
  1387. return this;
  1388. };
  1389. /**
  1390. * @summary
  1391. * Adds `file` to be loaded for execution.
  1392. *
  1393. * @description
  1394. * Useful for generic setup code that must be included within test suite.
  1395. *
  1396. * @public
  1397. * @see {@link https://mochajs.org/#--file-file|CLI option}
  1398. * @param {string} file - Pathname of file to be loaded.
  1399. * @returns {Mocha} this
  1400. * @chainable
  1401. */
  1402. Mocha.prototype.addFile = function(file) {
  1403. this.files.push(file);
  1404. return this;
  1405. };
  1406. /**
  1407. * Sets reporter to `reporter`, defaults to "spec".
  1408. *
  1409. * @public
  1410. * @see {@link https://mochajs.org/#-r---reporter-name|CLI option}
  1411. * @see {@link https://mochajs.org/#reporters|Reporters}
  1412. * @param {String|Function} reporter - Reporter name or constructor.
  1413. * @param {Object} [reporterOptions] - Options used to configure the reporter.
  1414. * @returns {Mocha} this
  1415. * @chainable
  1416. * @throws {Error} if requested reporter cannot be loaded
  1417. * @example
  1418. *
  1419. * // Use XUnit reporter and direct its output to file
  1420. * mocha.reporter('xunit', { output: '/path/to/testspec.xunit.xml' });
  1421. */
  1422. Mocha.prototype.reporter = function(reporter, reporterOptions) {
  1423. if (typeof reporter === 'function') {
  1424. this._reporter = reporter;
  1425. } else {
  1426. reporter = reporter || 'spec';
  1427. var _reporter;
  1428. // Try to load a built-in reporter.
  1429. if (builtinReporters[reporter]) {
  1430. _reporter = builtinReporters[reporter];
  1431. }
  1432. // Try to load reporters from process.cwd() and node_modules
  1433. if (!_reporter) {
  1434. try {
  1435. _reporter = require(reporter);
  1436. } catch (err) {
  1437. if (
  1438. err.code !== 'MODULE_NOT_FOUND' ||
  1439. err.message.indexOf('Cannot find module') !== -1
  1440. ) {
  1441. // Try to load reporters from a path (absolute or relative)
  1442. try {
  1443. _reporter = require(path.resolve(process.cwd(), reporter));
  1444. } catch (_err) {
  1445. _err.code !== 'MODULE_NOT_FOUND' ||
  1446. _err.message.indexOf('Cannot find module') !== -1
  1447. ? console.warn(sQuote(reporter) + ' reporter not found')
  1448. : console.warn(
  1449. sQuote(reporter) +
  1450. ' reporter blew up with error:\n' +
  1451. err.stack
  1452. );
  1453. }
  1454. } else {
  1455. console.warn(
  1456. sQuote(reporter) + ' reporter blew up with error:\n' + err.stack
  1457. );
  1458. }
  1459. }
  1460. }
  1461. if (!_reporter) {
  1462. throw createInvalidReporterError(
  1463. 'invalid reporter ' + sQuote(reporter),
  1464. reporter
  1465. );
  1466. }
  1467. this._reporter = _reporter;
  1468. }
  1469. this.options.reporterOptions = reporterOptions;
  1470. return this;
  1471. };
  1472. /**
  1473. * Sets test UI `name`, defaults to "bdd".
  1474. *
  1475. * @public
  1476. * @see {@link https://mochajs.org/#-u---ui-name|CLI option}
  1477. * @see {@link https://mochajs.org/#interfaces|Interface DSLs}
  1478. * @param {string|Function} [ui=bdd] - Interface name or class.
  1479. * @returns {Mocha} this
  1480. * @chainable
  1481. * @throws {Error} if requested interface cannot be loaded
  1482. */
  1483. Mocha.prototype.ui = function(ui) {
  1484. var bindInterface;
  1485. if (typeof ui === 'function') {
  1486. bindInterface = ui;
  1487. } else {
  1488. ui = ui || 'bdd';
  1489. bindInterface = exports.interfaces[ui];
  1490. if (!bindInterface) {
  1491. try {
  1492. bindInterface = require(ui);
  1493. } catch (err) {
  1494. throw createInvalidInterfaceError(
  1495. 'invalid interface ' + sQuote(ui),
  1496. ui
  1497. );
  1498. }
  1499. }
  1500. }
  1501. bindInterface(this.suite);
  1502. this.suite.on(EVENT_FILE_PRE_REQUIRE, function(context) {
  1503. exports.afterEach = context.afterEach || context.teardown;
  1504. exports.after = context.after || context.suiteTeardown;
  1505. exports.beforeEach = context.beforeEach || context.setup;
  1506. exports.before = context.before || context.suiteSetup;
  1507. exports.describe = context.describe || context.suite;
  1508. exports.it = context.it || context.test;
  1509. exports.xit = context.xit || (context.test && context.test.skip);
  1510. exports.setup = context.setup || context.beforeEach;
  1511. exports.suiteSetup = context.suiteSetup || context.before;
  1512. exports.suiteTeardown = context.suiteTeardown || context.after;
  1513. exports.suite = context.suite || context.describe;
  1514. exports.teardown = context.teardown || context.afterEach;
  1515. exports.test = context.test || context.it;
  1516. exports.run = context.run;
  1517. });
  1518. return this;
  1519. };
  1520. /**
  1521. * Loads `files` prior to execution.
  1522. *
  1523. * @description
  1524. * The implementation relies on Node's `require` to execute
  1525. * the test interface functions and will be subject to its cache.
  1526. *
  1527. * @private
  1528. * @see {@link Mocha#addFile}
  1529. * @see {@link Mocha#run}
  1530. * @see {@link Mocha#unloadFiles}
  1531. * @param {Function} [fn] - Callback invoked upon completion.
  1532. */
  1533. Mocha.prototype.loadFiles = function(fn) {
  1534. var self = this;
  1535. var suite = this.suite;
  1536. this.files.forEach(function(file) {
  1537. file = path.resolve(file);
  1538. suite.emit(EVENT_FILE_PRE_REQUIRE, global, file, self);
  1539. suite.emit(EVENT_FILE_REQUIRE, require(file), file, self);
  1540. suite.emit(EVENT_FILE_POST_REQUIRE, global, file, self);
  1541. });
  1542. fn && fn();
  1543. };
  1544. /**
  1545. * Removes a previously loaded file from Node's `require` cache.
  1546. *
  1547. * @private
  1548. * @static
  1549. * @see {@link Mocha#unloadFiles}
  1550. * @param {string} file - Pathname of file to be unloaded.
  1551. */
  1552. Mocha.unloadFile = function(file) {
  1553. delete require.cache[require.resolve(file)];
  1554. };
  1555. /**
  1556. * Unloads `files` from Node's `require` cache.
  1557. *
  1558. * @description
  1559. * This allows files to be "freshly" reloaded, providing the ability
  1560. * to reuse a Mocha instance programmatically.
  1561. *
  1562. * <strong>Intended for consumers &mdash; not used internally</strong>
  1563. *
  1564. * @public
  1565. * @see {@link Mocha.unloadFile}
  1566. * @see {@link Mocha#loadFiles}
  1567. * @see {@link Mocha#run}
  1568. * @returns {Mocha} this
  1569. * @chainable
  1570. */
  1571. Mocha.prototype.unloadFiles = function() {
  1572. this.files.forEach(Mocha.unloadFile);
  1573. return this;
  1574. };
  1575. /**
  1576. * Sets `grep` filter after escaping RegExp special characters.
  1577. *
  1578. * @public
  1579. * @see {@link Mocha#grep}
  1580. * @param {string} str - Value to be converted to a regexp.
  1581. * @returns {Mocha} this
  1582. * @chainable
  1583. * @example
  1584. *
  1585. * // Select tests whose full title begins with `"foo"` followed by a period
  1586. * mocha.fgrep('foo.');
  1587. */
  1588. Mocha.prototype.fgrep = function(str) {
  1589. if (!str) {
  1590. return this;
  1591. }
  1592. return this.grep(new RegExp(escapeRe(str)));
  1593. };
  1594. /**
  1595. * @summary
  1596. * Sets `grep` filter used to select specific tests for execution.
  1597. *
  1598. * @description
  1599. * If `re` is a regexp-like string, it will be converted to regexp.
  1600. * The regexp is tested against the full title of each test (i.e., the
  1601. * name of the test preceded by titles of each its ancestral suites).
  1602. * As such, using an <em>exact-match</em> fixed pattern against the
  1603. * test name itself will not yield any matches.
  1604. * <br>
  1605. * <strong>Previous filter value will be overwritten on each call!</strong>
  1606. *
  1607. * @public
  1608. * @see {@link https://mochajs.org/#-g---grep-pattern|CLI option}
  1609. * @see {@link Mocha#fgrep}
  1610. * @see {@link Mocha#invert}
  1611. * @param {RegExp|String} re - Regular expression used to select tests.
  1612. * @return {Mocha} this
  1613. * @chainable
  1614. * @example
  1615. *
  1616. * // Select tests whose full title contains `"match"`, ignoring case
  1617. * mocha.grep(/match/i);
  1618. * @example
  1619. *
  1620. * // Same as above but with regexp-like string argument
  1621. * mocha.grep('/match/i');
  1622. * @example
  1623. *
  1624. * // ## Anti-example
  1625. * // Given embedded test `it('only-this-test')`...
  1626. * mocha.grep('/^only-this-test$/'); // NO! Use `.only()` to do this!
  1627. */
  1628. Mocha.prototype.grep = function(re) {
  1629. if (utils.isString(re)) {
  1630. // extract args if it's regex-like, i.e: [string, pattern, flag]
  1631. var arg = re.match(/^\/(.*)\/(g|i|)$|.*/);
  1632. this.options.grep = new RegExp(arg[1] || arg[0], arg[2]);
  1633. } else {
  1634. this.options.grep = re;
  1635. }
  1636. return this;
  1637. };
  1638. /**
  1639. * Inverts `grep` matches.
  1640. *
  1641. * @public
  1642. * @see {@link Mocha#grep}
  1643. * @return {Mocha} this
  1644. * @chainable
  1645. * @example
  1646. *
  1647. * // Select tests whose full title does *not* contain `"match"`, ignoring case
  1648. * mocha.grep(/match/i).invert();
  1649. */
  1650. Mocha.prototype.invert = function() {
  1651. this.options.invert = true;
  1652. return this;
  1653. };
  1654. /**
  1655. * Enables or disables ignoring global leaks.
  1656. *
  1657. * @public
  1658. * @see {@link Mocha#checkLeaks}
  1659. * @param {boolean} ignoreLeaks - Whether to ignore global leaks.
  1660. * @return {Mocha} this
  1661. * @chainable
  1662. * @example
  1663. *
  1664. * // Ignore global leaks
  1665. * mocha.ignoreLeaks(true);
  1666. */
  1667. Mocha.prototype.ignoreLeaks = function(ignoreLeaks) {
  1668. this.options.ignoreLeaks = Boolean(ignoreLeaks);
  1669. return this;
  1670. };
  1671. /**
  1672. * Enables checking for global variables leaked while running tests.
  1673. *
  1674. * @public
  1675. * @see {@link https://mochajs.org/#--check-leaks|CLI option}
  1676. * @see {@link Mocha#ignoreLeaks}
  1677. * @return {Mocha} this
  1678. * @chainable
  1679. */
  1680. Mocha.prototype.checkLeaks = function() {
  1681. this.options.ignoreLeaks = false;
  1682. return this;
  1683. };
  1684. /**
  1685. * Displays full stack trace upon test failure.
  1686. *
  1687. * @public
  1688. * @return {Mocha} this
  1689. * @chainable
  1690. */
  1691. Mocha.prototype.fullTrace = function() {
  1692. this.options.fullStackTrace = true;
  1693. return this;
  1694. };
  1695. /**
  1696. * Enables desktop notification support if prerequisite software installed.
  1697. *
  1698. * @public
  1699. * @see {@link Mocha#isGrowlCapable}
  1700. * @see {@link Mocha#_growl}
  1701. * @return {Mocha} this
  1702. * @chainable
  1703. */
  1704. Mocha.prototype.growl = function() {
  1705. this.options.growl = this.isGrowlCapable();
  1706. if (!this.options.growl) {
  1707. var detail = process.browser
  1708. ? 'notification support not available in this browser...'
  1709. : 'notification support prerequisites not installed...';
  1710. console.error(detail + ' cannot enable!');
  1711. }
  1712. return this;
  1713. };
  1714. /**
  1715. * @summary
  1716. * Determines if Growl support seems likely.
  1717. *
  1718. * @description
  1719. * <strong>Not available when run in browser.</strong>
  1720. *
  1721. * @private
  1722. * @see {@link Growl#isCapable}
  1723. * @see {@link Mocha#growl}
  1724. * @return {boolean} whether Growl support can be expected
  1725. */
  1726. Mocha.prototype.isGrowlCapable = growl.isCapable;
  1727. /**
  1728. * Implements desktop notifications using a pseudo-reporter.
  1729. *
  1730. * @private
  1731. * @see {@link Mocha#growl}
  1732. * @see {@link Growl#notify}
  1733. * @param {Runner} runner - Runner instance.
  1734. */
  1735. Mocha.prototype._growl = growl.notify;
  1736. /**
  1737. * Specifies whitelist of variable names to be expected in global scope.
  1738. *
  1739. * @public
  1740. * @see {@link https://mochajs.org/#--globals-names|CLI option}
  1741. * @see {@link Mocha#checkLeaks}
  1742. * @param {String[]|String} globals - Accepted global variable name(s).
  1743. * @return {Mocha} this
  1744. * @chainable
  1745. * @example
  1746. *
  1747. * // Specify variables to be expected in global scope
  1748. * mocha.globals(['jQuery', 'MyLib']);
  1749. */
  1750. Mocha.prototype.globals = function(globals) {
  1751. this.options.globals = (this.options.globals || [])
  1752. .concat(globals)
  1753. .filter(Boolean);
  1754. return this;
  1755. };
  1756. /**
  1757. * Enables or disables TTY color output by screen-oriented reporters.
  1758. *
  1759. * @public
  1760. * @param {boolean} colors - Whether to enable color output.
  1761. * @return {Mocha} this
  1762. * @chainable
  1763. */
  1764. Mocha.prototype.useColors = function(colors) {
  1765. if (colors !== undefined) {
  1766. this.options.useColors = colors;
  1767. }
  1768. return this;
  1769. };
  1770. /**
  1771. * Determines if reporter should use inline diffs (rather than +/-)
  1772. * in test failure output.
  1773. *
  1774. * @public
  1775. * @param {boolean} inlineDiffs - Whether to use inline diffs.
  1776. * @return {Mocha} this
  1777. * @chainable
  1778. */
  1779. Mocha.prototype.useInlineDiffs = function(inlineDiffs) {
  1780. this.options.useInlineDiffs = inlineDiffs !== undefined && inlineDiffs;
  1781. return this;
  1782. };
  1783. /**
  1784. * Determines if reporter should include diffs in test failure output.
  1785. *
  1786. * @public
  1787. * @param {boolean} hideDiff - Whether to hide diffs.
  1788. * @return {Mocha} this
  1789. * @chainable
  1790. */
  1791. Mocha.prototype.hideDiff = function(hideDiff) {
  1792. this.options.hideDiff = hideDiff !== undefined && hideDiff;
  1793. return this;
  1794. };
  1795. /**
  1796. * @summary
  1797. * Sets timeout threshold value.
  1798. *
  1799. * @description
  1800. * A string argument can use shorthand (such as "2s") and will be converted.
  1801. * If the value is `0`, timeouts will be disabled.
  1802. *
  1803. * @public
  1804. * @see {@link https://mochajs.org/#-t---timeout-ms|CLI option}
  1805. * @see {@link https://mochajs.org/#--no-timeouts|CLI option}
  1806. * @see {@link https://mochajs.org/#timeouts|Timeouts}
  1807. * @see {@link Mocha#enableTimeouts}
  1808. * @param {number|string} msecs - Timeout threshold value.
  1809. * @return {Mocha} this
  1810. * @chainable
  1811. * @example
  1812. *
  1813. * // Sets timeout to one second
  1814. * mocha.timeout(1000);
  1815. * @example
  1816. *
  1817. * // Same as above but using string argument
  1818. * mocha.timeout('1s');
  1819. */
  1820. Mocha.prototype.timeout = function(msecs) {
  1821. this.suite.timeout(msecs);
  1822. return this;
  1823. };
  1824. /**
  1825. * Sets the number of times to retry failed tests.
  1826. *
  1827. * @public
  1828. * @see {@link https://mochajs.org/#retry-tests|Retry Tests}
  1829. * @param {number} retry - Number of times to retry failed tests.
  1830. * @return {Mocha} this
  1831. * @chainable
  1832. * @example
  1833. *
  1834. * // Allow any failed test to retry one more time
  1835. * mocha.retries(1);
  1836. */
  1837. Mocha.prototype.retries = function(n) {
  1838. this.suite.retries(n);
  1839. return this;
  1840. };
  1841. /**
  1842. * Sets slowness threshold value.
  1843. *
  1844. * @public
  1845. * @see {@link https://mochajs.org/#-s---slow-ms|CLI option}
  1846. * @param {number} msecs - Slowness threshold value.
  1847. * @return {Mocha} this
  1848. * @chainable
  1849. * @example
  1850. *
  1851. * // Sets "slow" threshold to half a second
  1852. * mocha.slow(500);
  1853. * @example
  1854. *
  1855. * // Same as above but using string argument
  1856. * mocha.slow('0.5s');
  1857. */
  1858. Mocha.prototype.slow = function(msecs) {
  1859. this.suite.slow(msecs);
  1860. return this;
  1861. };
  1862. /**
  1863. * Enables or disables timeouts.
  1864. *
  1865. * @public
  1866. * @see {@link https://mochajs.org/#-t---timeout-ms|CLI option}
  1867. * @see {@link https://mochajs.org/#--no-timeouts|CLI option}
  1868. * @param {boolean} enableTimeouts - Whether to enable timeouts.
  1869. * @return {Mocha} this
  1870. * @chainable
  1871. */
  1872. Mocha.prototype.enableTimeouts = function(enableTimeouts) {
  1873. this.suite.enableTimeouts(
  1874. arguments.length && enableTimeouts !== undefined ? enableTimeouts : true
  1875. );
  1876. return this;
  1877. };
  1878. /**
  1879. * Forces all tests to either accept a `done` callback or return a promise.
  1880. *
  1881. * @public
  1882. * @return {Mocha} this
  1883. * @chainable
  1884. */
  1885. Mocha.prototype.asyncOnly = function() {
  1886. this.options.asyncOnly = true;
  1887. return this;
  1888. };
  1889. /**
  1890. * Disables syntax highlighting (in browser).
  1891. *
  1892. * @public
  1893. * @return {Mocha} this
  1894. * @chainable
  1895. */
  1896. Mocha.prototype.noHighlighting = function() {
  1897. this.options.noHighlighting = true;
  1898. return this;
  1899. };
  1900. /**
  1901. * Enables uncaught errors to propagate (in browser).
  1902. *
  1903. * @public
  1904. * @return {Mocha} this
  1905. * @chainable
  1906. */
  1907. Mocha.prototype.allowUncaught = function() {
  1908. this.options.allowUncaught = true;
  1909. return this;
  1910. };
  1911. /**
  1912. * @summary
  1913. * Delays root suite execution.
  1914. *
  1915. * @description
  1916. * Used to perform asynch operations before any suites are run.
  1917. *
  1918. * @public
  1919. * @see {@link https://mochajs.org/#delayed-root-suite|delayed root suite}
  1920. * @returns {Mocha} this
  1921. * @chainable
  1922. */
  1923. Mocha.prototype.delay = function delay() {
  1924. this.options.delay = true;
  1925. return this;
  1926. };
  1927. /**
  1928. * Causes tests marked `only` to fail the suite.
  1929. *
  1930. * @public
  1931. * @returns {Mocha} this
  1932. * @chainable
  1933. */
  1934. Mocha.prototype.forbidOnly = function() {
  1935. this.options.forbidOnly = true;
  1936. return this;
  1937. };
  1938. /**
  1939. * Causes pending tests and tests marked `skip` to fail the suite.
  1940. *
  1941. * @public
  1942. * @returns {Mocha} this
  1943. * @chainable
  1944. */
  1945. Mocha.prototype.forbidPending = function() {
  1946. this.options.forbidPending = true;
  1947. return this;
  1948. };
  1949. /**
  1950. * Mocha version as specified by "package.json".
  1951. *
  1952. * @name Mocha#version
  1953. * @type string
  1954. * @readonly
  1955. */
  1956. Object.defineProperty(Mocha.prototype, 'version', {
  1957. value: require('../package.json').version,
  1958. configurable: false,
  1959. enumerable: true,
  1960. writable: false
  1961. });
  1962. /**
  1963. * Callback to be invoked when test execution is complete.
  1964. *
  1965. * @callback DoneCB
  1966. * @param {number} failures - Number of failures that occurred.
  1967. */
  1968. /**
  1969. * Runs root suite and invokes `fn()` when complete.
  1970. *
  1971. * @description
  1972. * To run tests multiple times (or to run tests in files that are
  1973. * already in the `require` cache), make sure to clear them from
  1974. * the cache first!
  1975. *
  1976. * @public
  1977. * @see {@link Mocha#loadFiles}
  1978. * @see {@link Mocha#unloadFiles}
  1979. * @see {@link Runner#run}
  1980. * @param {DoneCB} [fn] - Callback invoked when test execution completed.
  1981. * @return {Runner} runner instance
  1982. */
  1983. Mocha.prototype.run = function(fn) {
  1984. if (this.files.length) {
  1985. this.loadFiles();
  1986. }
  1987. var suite = this.suite;
  1988. var options = this.options;
  1989. options.files = this.files;
  1990. var runner = new exports.Runner(suite, options.delay);
  1991. createStatsCollector(runner);
  1992. var reporter = new this._reporter(runner, options);
  1993. runner.ignoreLeaks = options.ignoreLeaks !== false;
  1994. runner.fullStackTrace = options.fullStackTrace;
  1995. runner.asyncOnly = options.asyncOnly;
  1996. runner.allowUncaught = options.allowUncaught;
  1997. runner.forbidOnly = options.forbidOnly;
  1998. runner.forbidPending = options.forbidPending;
  1999. if (options.grep) {
  2000. runner.grep(options.grep, options.invert);
  2001. }
  2002. if (options.globals) {
  2003. runner.globals(options.globals);
  2004. }
  2005. if (options.growl) {
  2006. this._growl(runner);
  2007. }
  2008. if (options.useColors !== undefined) {
  2009. exports.reporters.Base.useColors = options.useColors;
  2010. }
  2011. exports.reporters.Base.inlineDiffs = options.useInlineDiffs;
  2012. exports.reporters.Base.hideDiff = options.hideDiff;
  2013. function done(failures) {
  2014. fn = fn || utils.noop;
  2015. if (reporter.done) {
  2016. reporter.done(failures, fn);
  2017. } else {
  2018. fn(failures);
  2019. }
  2020. }
  2021. return runner.run(done);
  2022. };
  2023. }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  2024. },{"../package.json":90,"./context":5,"./errors":6,"./growl":2,"./hook":7,"./interfaces":11,"./mocharc.json":15,"./reporters":21,"./runnable":33,"./runner":34,"./stats-collector":35,"./suite":36,"./test":37,"./utils":38,"_process":69,"escape-string-regexp":49,"path":42}],15:[function(require,module,exports){
  2025. module.exports={
  2026. "diff": true,
  2027. "extension": ["js"],
  2028. "opts": "./test/mocha.opts",
  2029. "package": "./package.json",
  2030. "reporter": "spec",
  2031. "slow": 75,
  2032. "timeout": 2000,
  2033. "ui": "bdd"
  2034. }
  2035. },{}],16:[function(require,module,exports){
  2036. 'use strict';
  2037. module.exports = Pending;
  2038. /**
  2039. * Initialize a new `Pending` error with the given message.
  2040. *
  2041. * @param {string} message
  2042. */
  2043. function Pending(message) {
  2044. this.message = message;
  2045. }
  2046. },{}],17:[function(require,module,exports){
  2047. (function (process){
  2048. 'use strict';
  2049. /**
  2050. * @module Base
  2051. */
  2052. /**
  2053. * Module dependencies.
  2054. */
  2055. var tty = require('tty');
  2056. var diff = require('diff');
  2057. var milliseconds = require('ms');
  2058. var utils = require('../utils');
  2059. var supportsColor = process.browser ? null : require('supports-color');
  2060. var constants = require('../runner').constants;
  2061. var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
  2062. var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
  2063. /**
  2064. * Expose `Base`.
  2065. */
  2066. exports = module.exports = Base;
  2067. /**
  2068. * Check if both stdio streams are associated with a tty.
  2069. */
  2070. var isatty = tty.isatty(1) && tty.isatty(2);
  2071. /**
  2072. * Enable coloring by default, except in the browser interface.
  2073. */
  2074. exports.useColors =
  2075. !process.browser &&
  2076. (supportsColor.stdout || process.env.MOCHA_COLORS !== undefined);
  2077. /**
  2078. * Inline diffs instead of +/-
  2079. */
  2080. exports.inlineDiffs = false;
  2081. /**
  2082. * Default color map.
  2083. */
  2084. exports.colors = {
  2085. pass: 90,
  2086. fail: 31,
  2087. 'bright pass': 92,
  2088. 'bright fail': 91,
  2089. 'bright yellow': 93,
  2090. pending: 36,
  2091. suite: 0,
  2092. 'error title': 0,
  2093. 'error message': 31,
  2094. 'error stack': 90,
  2095. checkmark: 32,
  2096. fast: 90,
  2097. medium: 33,
  2098. slow: 31,
  2099. green: 32,
  2100. light: 90,
  2101. 'diff gutter': 90,
  2102. 'diff added': 32,
  2103. 'diff removed': 31
  2104. };
  2105. /**
  2106. * Default symbol map.
  2107. */
  2108. exports.symbols = {
  2109. ok: '✓',
  2110. err: '✖',
  2111. dot: '․',
  2112. comma: ',',
  2113. bang: '!'
  2114. };
  2115. // With node.js on Windows: use symbols available in terminal default fonts
  2116. if (process.platform === 'win32') {
  2117. exports.symbols.ok = '\u221A';
  2118. exports.symbols.err = '\u00D7';
  2119. exports.symbols.dot = '.';
  2120. }
  2121. /**
  2122. * Color `str` with the given `type`,
  2123. * allowing colors to be disabled,
  2124. * as well as user-defined color
  2125. * schemes.
  2126. *
  2127. * @private
  2128. * @param {string} type
  2129. * @param {string} str
  2130. * @return {string}
  2131. */
  2132. var color = (exports.color = function(type, str) {
  2133. if (!exports.useColors) {
  2134. return String(str);
  2135. }
  2136. return '\u001b[' + exports.colors[type] + 'm' + str + '\u001b[0m';
  2137. });
  2138. /**
  2139. * Expose term window size, with some defaults for when stderr is not a tty.
  2140. */
  2141. exports.window = {
  2142. width: 75
  2143. };
  2144. if (isatty) {
  2145. exports.window.width = process.stdout.getWindowSize
  2146. ? process.stdout.getWindowSize(1)[0]
  2147. : tty.getWindowSize()[1];
  2148. }
  2149. /**
  2150. * Expose some basic cursor interactions that are common among reporters.
  2151. */
  2152. exports.cursor = {
  2153. hide: function() {
  2154. isatty && process.stdout.write('\u001b[?25l');
  2155. },
  2156. show: function() {
  2157. isatty && process.stdout.write('\u001b[?25h');
  2158. },
  2159. deleteLine: function() {
  2160. isatty && process.stdout.write('\u001b[2K');
  2161. },
  2162. beginningOfLine: function() {
  2163. isatty && process.stdout.write('\u001b[0G');
  2164. },
  2165. CR: function() {
  2166. if (isatty) {
  2167. exports.cursor.deleteLine();
  2168. exports.cursor.beginningOfLine();
  2169. } else {
  2170. process.stdout.write('\r');
  2171. }
  2172. }
  2173. };
  2174. function showDiff(err) {
  2175. return (
  2176. err &&
  2177. err.showDiff !== false &&
  2178. sameType(err.actual, err.expected) &&
  2179. err.expected !== undefined
  2180. );
  2181. }
  2182. function stringifyDiffObjs(err) {
  2183. if (!utils.isString(err.actual) || !utils.isString(err.expected)) {
  2184. err.actual = utils.stringify(err.actual);
  2185. err.expected = utils.stringify(err.expected);
  2186. }
  2187. }
  2188. /**
  2189. * Returns a diff between 2 strings with coloured ANSI output.
  2190. *
  2191. * @description
  2192. * The diff will be either inline or unified dependent on the value
  2193. * of `Base.inlineDiff`.
  2194. *
  2195. * @param {string} actual
  2196. * @param {string} expected
  2197. * @return {string} Diff
  2198. */
  2199. var generateDiff = (exports.generateDiff = function(actual, expected) {
  2200. return exports.inlineDiffs
  2201. ? inlineDiff(actual, expected)
  2202. : unifiedDiff(actual, expected);
  2203. });
  2204. /**
  2205. * Outputs the given `failures` as a list.
  2206. *
  2207. * @public
  2208. * @memberof Mocha.reporters.Base
  2209. * @variation 1
  2210. * @param {Object[]} failures - Each is Test instance with corresponding
  2211. * Error property
  2212. */
  2213. exports.list = function(failures) {
  2214. console.log();
  2215. failures.forEach(function(test, i) {
  2216. // format
  2217. var fmt =
  2218. color('error title', ' %s) %s:\n') +
  2219. color('error message', ' %s') +
  2220. color('error stack', '\n%s\n');
  2221. // msg
  2222. var msg;
  2223. var err = test.err;
  2224. var message;
  2225. if (err.message && typeof err.message.toString === 'function') {
  2226. message = err.message + '';
  2227. } else if (typeof err.inspect === 'function') {
  2228. message = err.inspect() + '';
  2229. } else {
  2230. message = '';
  2231. }
  2232. var stack = err.stack || message;
  2233. var index = message ? stack.indexOf(message) : -1;
  2234. if (index === -1) {
  2235. msg = message;
  2236. } else {
  2237. index += message.length;
  2238. msg = stack.slice(0, index);
  2239. // remove msg from stack
  2240. stack = stack.slice(index + 1);
  2241. }
  2242. // uncaught
  2243. if (err.uncaught) {
  2244. msg = 'Uncaught ' + msg;
  2245. }
  2246. // explicitly show diff
  2247. if (!exports.hideDiff && showDiff(err)) {
  2248. stringifyDiffObjs(err);
  2249. fmt =
  2250. color('error title', ' %s) %s:\n%s') + color('error stack', '\n%s\n');
  2251. var match = message.match(/^([^:]+): expected/);
  2252. msg = '\n ' + color('error message', match ? match[1] : msg);
  2253. msg += generateDiff(err.actual, err.expected);
  2254. }
  2255. // indent stack trace
  2256. stack = stack.replace(/^/gm, ' ');
  2257. // indented test title
  2258. var testTitle = '';
  2259. test.titlePath().forEach(function(str, index) {
  2260. if (index !== 0) {
  2261. testTitle += '\n ';
  2262. }
  2263. for (var i = 0; i < index; i++) {
  2264. testTitle += ' ';
  2265. }
  2266. testTitle += str;
  2267. });
  2268. console.log(fmt, i + 1, testTitle, msg, stack);
  2269. });
  2270. };
  2271. /**
  2272. * Constructs a new `Base` reporter instance.
  2273. *
  2274. * @description
  2275. * All other reporters generally inherit from this reporter.
  2276. *
  2277. * @public
  2278. * @class
  2279. * @memberof Mocha.reporters
  2280. * @param {Runner} runner - Instance triggers reporter actions.
  2281. * @param {Object} [options] - runner options
  2282. */
  2283. function Base(runner, options) {
  2284. var failures = (this.failures = []);
  2285. if (!runner) {
  2286. throw new TypeError('Missing runner argument');
  2287. }
  2288. this.options = options || {};
  2289. this.runner = runner;
  2290. this.stats = runner.stats; // assigned so Reporters keep a closer reference
  2291. runner.on(EVENT_TEST_PASS, function(test) {
  2292. if (test.duration > test.slow()) {
  2293. test.speed = 'slow';
  2294. } else if (test.duration > test.slow() / 2) {
  2295. test.speed = 'medium';
  2296. } else {
  2297. test.speed = 'fast';
  2298. }
  2299. });
  2300. runner.on(EVENT_TEST_FAIL, function(test, err) {
  2301. if (showDiff(err)) {
  2302. stringifyDiffObjs(err);
  2303. }
  2304. test.err = err;
  2305. failures.push(test);
  2306. });
  2307. }
  2308. /**
  2309. * Outputs common epilogue used by many of the bundled reporters.
  2310. *
  2311. * @public
  2312. * @memberof Mocha.reporters.Base
  2313. */
  2314. Base.prototype.epilogue = function() {
  2315. var stats = this.stats;
  2316. var fmt;
  2317. console.log();
  2318. // passes
  2319. fmt =
  2320. color('bright pass', ' ') +
  2321. color('green', ' %d passing') +
  2322. color('light', ' (%s)');
  2323. console.log(fmt, stats.passes || 0, milliseconds(stats.duration));
  2324. // pending
  2325. if (stats.pending) {
  2326. fmt = color('pending', ' ') + color('pending', ' %d pending');
  2327. console.log(fmt, stats.pending);
  2328. }
  2329. // failures
  2330. if (stats.failures) {
  2331. fmt = color('fail', ' %d failing');
  2332. console.log(fmt, stats.failures);
  2333. Base.list(this.failures);
  2334. console.log();
  2335. }
  2336. console.log();
  2337. };
  2338. /**
  2339. * Pads the given `str` to `len`.
  2340. *
  2341. * @private
  2342. * @param {string} str
  2343. * @param {string} len
  2344. * @return {string}
  2345. */
  2346. function pad(str, len) {
  2347. str = String(str);
  2348. return Array(len - str.length + 1).join(' ') + str;
  2349. }
  2350. /**
  2351. * Returns inline diff between 2 strings with coloured ANSI output.
  2352. *
  2353. * @private
  2354. * @param {String} actual
  2355. * @param {String} expected
  2356. * @return {string} Diff
  2357. */
  2358. function inlineDiff(actual, expected) {
  2359. var msg = errorDiff(actual, expected);
  2360. // linenos
  2361. var lines = msg.split('\n');
  2362. if (lines.length > 4) {
  2363. var width = String(lines.length).length;
  2364. msg = lines
  2365. .map(function(str, i) {
  2366. return pad(++i, width) + ' |' + ' ' + str;
  2367. })
  2368. .join('\n');
  2369. }
  2370. // legend
  2371. msg =
  2372. '\n' +
  2373. color('diff removed', 'actual') +
  2374. ' ' +
  2375. color('diff added', 'expected') +
  2376. '\n\n' +
  2377. msg +
  2378. '\n';
  2379. // indent
  2380. msg = msg.replace(/^/gm, ' ');
  2381. return msg;
  2382. }
  2383. /**
  2384. * Returns unified diff between two strings with coloured ANSI output.
  2385. *
  2386. * @private
  2387. * @param {String} actual
  2388. * @param {String} expected
  2389. * @return {string} The diff.
  2390. */
  2391. function unifiedDiff(actual, expected) {
  2392. var indent = ' ';
  2393. function cleanUp(line) {
  2394. if (line[0] === '+') {
  2395. return indent + colorLines('diff added', line);
  2396. }
  2397. if (line[0] === '-') {
  2398. return indent + colorLines('diff removed', line);
  2399. }
  2400. if (line.match(/@@/)) {
  2401. return '--';
  2402. }
  2403. if (line.match(/\\ No newline/)) {
  2404. return null;
  2405. }
  2406. return indent + line;
  2407. }
  2408. function notBlank(line) {
  2409. return typeof line !== 'undefined' && line !== null;
  2410. }
  2411. var msg = diff.createPatch('string', actual, expected);
  2412. var lines = msg.split('\n').splice(5);
  2413. return (
  2414. '\n ' +
  2415. colorLines('diff added', '+ expected') +
  2416. ' ' +
  2417. colorLines('diff removed', '- actual') +
  2418. '\n\n' +
  2419. lines
  2420. .map(cleanUp)
  2421. .filter(notBlank)
  2422. .join('\n')
  2423. );
  2424. }
  2425. /**
  2426. * Returns character diff for `err`.
  2427. *
  2428. * @private
  2429. * @param {String} actual
  2430. * @param {String} expected
  2431. * @return {string} the diff
  2432. */
  2433. function errorDiff(actual, expected) {
  2434. return diff
  2435. .diffWordsWithSpace(actual, expected)
  2436. .map(function(str) {
  2437. if (str.added) {
  2438. return colorLines('diff added', str.value);
  2439. }
  2440. if (str.removed) {
  2441. return colorLines('diff removed', str.value);
  2442. }
  2443. return str.value;
  2444. })
  2445. .join('');
  2446. }
  2447. /**
  2448. * Colors lines for `str`, using the color `name`.
  2449. *
  2450. * @private
  2451. * @param {string} name
  2452. * @param {string} str
  2453. * @return {string}
  2454. */
  2455. function colorLines(name, str) {
  2456. return str
  2457. .split('\n')
  2458. .map(function(str) {
  2459. return color(name, str);
  2460. })
  2461. .join('\n');
  2462. }
  2463. /**
  2464. * Object#toString reference.
  2465. */
  2466. var objToString = Object.prototype.toString;
  2467. /**
  2468. * Checks that a / b have the same type.
  2469. *
  2470. * @private
  2471. * @param {Object} a
  2472. * @param {Object} b
  2473. * @return {boolean}
  2474. */
  2475. function sameType(a, b) {
  2476. return objToString.call(a) === objToString.call(b);
  2477. }
  2478. Base.abstract = true;
  2479. }).call(this,require('_process'))
  2480. },{"../runner":34,"../utils":38,"_process":69,"diff":48,"ms":60,"supports-color":42,"tty":4}],18:[function(require,module,exports){
  2481. 'use strict';
  2482. /**
  2483. * @module Doc
  2484. */
  2485. /**
  2486. * Module dependencies.
  2487. */
  2488. var Base = require('./base');
  2489. var utils = require('../utils');
  2490. var constants = require('../runner').constants;
  2491. var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
  2492. var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
  2493. var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
  2494. var EVENT_SUITE_END = constants.EVENT_SUITE_END;
  2495. /**
  2496. * Expose `Doc`.
  2497. */
  2498. exports = module.exports = Doc;
  2499. /**
  2500. * Constructs a new `Doc` reporter instance.
  2501. *
  2502. * @public
  2503. * @class
  2504. * @memberof Mocha.reporters
  2505. * @extends Mocha.reporters.Base
  2506. * @param {Runner} runner - Instance triggers reporter actions.
  2507. * @param {Object} [options] - runner options
  2508. */
  2509. function Doc(runner, options) {
  2510. Base.call(this, runner, options);
  2511. var indents = 2;
  2512. function indent() {
  2513. return Array(indents).join(' ');
  2514. }
  2515. runner.on(EVENT_SUITE_BEGIN, function(suite) {
  2516. if (suite.root) {
  2517. return;
  2518. }
  2519. ++indents;
  2520. console.log('%s<section class="suite">', indent());
  2521. ++indents;
  2522. console.log('%s<h1>%s</h1>', indent(), utils.escape(suite.title));
  2523. console.log('%s<dl>', indent());
  2524. });
  2525. runner.on(EVENT_SUITE_END, function(suite) {
  2526. if (suite.root) {
  2527. return;
  2528. }
  2529. console.log('%s</dl>', indent());
  2530. --indents;
  2531. console.log('%s</section>', indent());
  2532. --indents;
  2533. });
  2534. runner.on(EVENT_TEST_PASS, function(test) {
  2535. console.log('%s <dt>%s</dt>', indent(), utils.escape(test.title));
  2536. var code = utils.escape(utils.clean(test.body));
  2537. console.log('%s <dd><pre><code>%s</code></pre></dd>', indent(), code);
  2538. });
  2539. runner.on(EVENT_TEST_FAIL, function(test, err) {
  2540. console.log(
  2541. '%s <dt class="error">%s</dt>',
  2542. indent(),
  2543. utils.escape(test.title)
  2544. );
  2545. var code = utils.escape(utils.clean(test.body));
  2546. console.log(
  2547. '%s <dd class="error"><pre><code>%s</code></pre></dd>',
  2548. indent(),
  2549. code
  2550. );
  2551. console.log('%s <dd class="error">%s</dd>', indent(), utils.escape(err));
  2552. });
  2553. }
  2554. Doc.description = 'HTML documentation';
  2555. },{"../runner":34,"../utils":38,"./base":17}],19:[function(require,module,exports){
  2556. (function (process){
  2557. 'use strict';
  2558. /**
  2559. * @module Dot
  2560. */
  2561. /**
  2562. * Module dependencies.
  2563. */
  2564. var Base = require('./base');
  2565. var inherits = require('../utils').inherits;
  2566. var constants = require('../runner').constants;
  2567. var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
  2568. var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
  2569. var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
  2570. var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
  2571. var EVENT_RUN_END = constants.EVENT_RUN_END;
  2572. /**
  2573. * Expose `Dot`.
  2574. */
  2575. exports = module.exports = Dot;
  2576. /**
  2577. * Constructs a new `Dot` reporter instance.
  2578. *
  2579. * @public
  2580. * @class
  2581. * @memberof Mocha.reporters
  2582. * @extends Mocha.reporters.Base
  2583. * @param {Runner} runner - Instance triggers reporter actions.
  2584. * @param {Object} [options] - runner options
  2585. */
  2586. function Dot(runner, options) {
  2587. Base.call(this, runner, options);
  2588. var self = this;
  2589. var width = (Base.window.width * 0.75) | 0;
  2590. var n = -1;
  2591. runner.on(EVENT_RUN_BEGIN, function() {
  2592. process.stdout.write('\n');
  2593. });
  2594. runner.on(EVENT_TEST_PENDING, function() {
  2595. if (++n % width === 0) {
  2596. process.stdout.write('\n ');
  2597. }
  2598. process.stdout.write(Base.color('pending', Base.symbols.comma));
  2599. });
  2600. runner.on(EVENT_TEST_PASS, function(test) {
  2601. if (++n % width === 0) {
  2602. process.stdout.write('\n ');
  2603. }
  2604. if (test.speed === 'slow') {
  2605. process.stdout.write(Base.color('bright yellow', Base.symbols.dot));
  2606. } else {
  2607. process.stdout.write(Base.color(test.speed, Base.symbols.dot));
  2608. }
  2609. });
  2610. runner.on(EVENT_TEST_FAIL, function() {
  2611. if (++n % width === 0) {
  2612. process.stdout.write('\n ');
  2613. }
  2614. process.stdout.write(Base.color('fail', Base.symbols.bang));
  2615. });
  2616. runner.once(EVENT_RUN_END, function() {
  2617. console.log();
  2618. self.epilogue();
  2619. });
  2620. }
  2621. /**
  2622. * Inherit from `Base.prototype`.
  2623. */
  2624. inherits(Dot, Base);
  2625. Dot.description = 'dot matrix representation';
  2626. }).call(this,require('_process'))
  2627. },{"../runner":34,"../utils":38,"./base":17,"_process":69}],20:[function(require,module,exports){
  2628. (function (global){
  2629. 'use strict';
  2630. /* eslint-env browser */
  2631. /**
  2632. * @module HTML
  2633. */
  2634. /**
  2635. * Module dependencies.
  2636. */
  2637. var Base = require('./base');
  2638. var utils = require('../utils');
  2639. var Progress = require('../browser/progress');
  2640. var escapeRe = require('escape-string-regexp');
  2641. var constants = require('../runner').constants;
  2642. var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
  2643. var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
  2644. var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
  2645. var EVENT_SUITE_END = constants.EVENT_SUITE_END;
  2646. var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
  2647. var escape = utils.escape;
  2648. /**
  2649. * Save timer references to avoid Sinon interfering (see GH-237).
  2650. */
  2651. var Date = global.Date;
  2652. /**
  2653. * Expose `HTML`.
  2654. */
  2655. exports = module.exports = HTML;
  2656. /**
  2657. * Stats template.
  2658. */
  2659. var statsTemplate =
  2660. '<ul id="mocha-stats">' +
  2661. '<li class="progress"><canvas width="40" height="40"></canvas></li>' +
  2662. '<li class="passes"><a href="javascript:void(0);">passes:</a> <em>0</em></li>' +
  2663. '<li class="failures"><a href="javascript:void(0);">failures:</a> <em>0</em></li>' +
  2664. '<li class="duration">duration: <em>0</em>s</li>' +
  2665. '</ul>';
  2666. var playIcon = '&#x2023;';
  2667. /**
  2668. * Constructs a new `HTML` reporter instance.
  2669. *
  2670. * @public
  2671. * @class
  2672. * @memberof Mocha.reporters
  2673. * @extends Mocha.reporters.Base
  2674. * @param {Runner} runner - Instance triggers reporter actions.
  2675. * @param {Object} [options] - runner options
  2676. */
  2677. function HTML(runner, options) {
  2678. Base.call(this, runner, options);
  2679. var self = this;
  2680. var stats = this.stats;
  2681. var stat = fragment(statsTemplate);
  2682. var items = stat.getElementsByTagName('li');
  2683. var passes = items[1].getElementsByTagName('em')[0];
  2684. var passesLink = items[1].getElementsByTagName('a')[0];
  2685. var failures = items[2].getElementsByTagName('em')[0];
  2686. var failuresLink = items[2].getElementsByTagName('a')[0];
  2687. var duration = items[3].getElementsByTagName('em')[0];
  2688. var canvas = stat.getElementsByTagName('canvas')[0];
  2689. var report = fragment('<ul id="mocha-report"></ul>');
  2690. var stack = [report];
  2691. var progress;
  2692. var ctx;
  2693. var root = document.getElementById('mocha');
  2694. if (canvas.getContext) {
  2695. var ratio = window.devicePixelRatio || 1;
  2696. canvas.style.width = canvas.width;
  2697. canvas.style.height = canvas.height;
  2698. canvas.width *= ratio;
  2699. canvas.height *= ratio;
  2700. ctx = canvas.getContext('2d');
  2701. ctx.scale(ratio, ratio);
  2702. progress = new Progress();
  2703. }
  2704. if (!root) {
  2705. return error('#mocha div missing, add it to your document');
  2706. }
  2707. // pass toggle
  2708. on(passesLink, 'click', function(evt) {
  2709. evt.preventDefault();
  2710. unhide();
  2711. var name = /pass/.test(report.className) ? '' : ' pass';
  2712. report.className = report.className.replace(/fail|pass/g, '') + name;
  2713. if (report.className.trim()) {
  2714. hideSuitesWithout('test pass');
  2715. }
  2716. });
  2717. // failure toggle
  2718. on(failuresLink, 'click', function(evt) {
  2719. evt.preventDefault();
  2720. unhide();
  2721. var name = /fail/.test(report.className) ? '' : ' fail';
  2722. report.className = report.className.replace(/fail|pass/g, '') + name;
  2723. if (report.className.trim()) {
  2724. hideSuitesWithout('test fail');
  2725. }
  2726. });
  2727. root.appendChild(stat);
  2728. root.appendChild(report);
  2729. if (progress) {
  2730. progress.size(40);
  2731. }
  2732. runner.on(EVENT_SUITE_BEGIN, function(suite) {
  2733. if (suite.root) {
  2734. return;
  2735. }
  2736. // suite
  2737. var url = self.suiteURL(suite);
  2738. var el = fragment(
  2739. '<li class="suite"><h1><a href="%s">%s</a></h1></li>',
  2740. url,
  2741. escape(suite.title)
  2742. );
  2743. // container
  2744. stack[0].appendChild(el);
  2745. stack.unshift(document.createElement('ul'));
  2746. el.appendChild(stack[0]);
  2747. });
  2748. runner.on(EVENT_SUITE_END, function(suite) {
  2749. if (suite.root) {
  2750. updateStats();
  2751. return;
  2752. }
  2753. stack.shift();
  2754. });
  2755. runner.on(EVENT_TEST_PASS, function(test) {
  2756. var url = self.testURL(test);
  2757. var markup =
  2758. '<li class="test pass %e"><h2>%e<span class="duration">%ems</span> ' +
  2759. '<a href="%s" class="replay">' +
  2760. playIcon +
  2761. '</a></h2></li>';
  2762. var el = fragment(markup, test.speed, test.title, test.duration, url);
  2763. self.addCodeToggle(el, test.body);
  2764. appendToStack(el);
  2765. updateStats();
  2766. });
  2767. runner.on(EVENT_TEST_FAIL, function(test) {
  2768. var el = fragment(
  2769. '<li class="test fail"><h2>%e <a href="%e" class="replay">' +
  2770. playIcon +
  2771. '</a></h2></li>',
  2772. test.title,
  2773. self.testURL(test)
  2774. );
  2775. var stackString; // Note: Includes leading newline
  2776. var message = test.err.toString();
  2777. // <=IE7 stringifies to [Object Error]. Since it can be overloaded, we
  2778. // check for the result of the stringifying.
  2779. if (message === '[object Error]') {
  2780. message = test.err.message;
  2781. }
  2782. if (test.err.stack) {
  2783. var indexOfMessage = test.err.stack.indexOf(test.err.message);
  2784. if (indexOfMessage === -1) {
  2785. stackString = test.err.stack;
  2786. } else {
  2787. stackString = test.err.stack.substr(
  2788. test.err.message.length + indexOfMessage
  2789. );
  2790. }
  2791. } else if (test.err.sourceURL && test.err.line !== undefined) {
  2792. // Safari doesn't give you a stack. Let's at least provide a source line.
  2793. stackString = '\n(' + test.err.sourceURL + ':' + test.err.line + ')';
  2794. }
  2795. stackString = stackString || '';
  2796. if (test.err.htmlMessage && stackString) {
  2797. el.appendChild(
  2798. fragment(
  2799. '<div class="html-error">%s\n<pre class="error">%e</pre></div>',
  2800. test.err.htmlMessage,
  2801. stackString
  2802. )
  2803. );
  2804. } else if (test.err.htmlMessage) {
  2805. el.appendChild(
  2806. fragment('<div class="html-error">%s</div>', test.err.htmlMessage)
  2807. );
  2808. } else {
  2809. el.appendChild(
  2810. fragment('<pre class="error">%e%e</pre>', message, stackString)
  2811. );
  2812. }
  2813. self.addCodeToggle(el, test.body);
  2814. appendToStack(el);
  2815. updateStats();
  2816. });
  2817. runner.on(EVENT_TEST_PENDING, function(test) {
  2818. var el = fragment(
  2819. '<li class="test pass pending"><h2>%e</h2></li>',
  2820. test.title
  2821. );
  2822. appendToStack(el);
  2823. updateStats();
  2824. });
  2825. function appendToStack(el) {
  2826. // Don't call .appendChild if #mocha-report was already .shift()'ed off the stack.
  2827. if (stack[0]) {
  2828. stack[0].appendChild(el);
  2829. }
  2830. }
  2831. function updateStats() {
  2832. // TODO: add to stats
  2833. var percent = ((stats.tests / runner.total) * 100) | 0;
  2834. if (progress) {
  2835. progress.update(percent).draw(ctx);
  2836. }
  2837. // update stats
  2838. var ms = new Date() - stats.start;
  2839. text(passes, stats.passes);
  2840. text(failures, stats.failures);
  2841. text(duration, (ms / 1000).toFixed(2));
  2842. }
  2843. }
  2844. /**
  2845. * Makes a URL, preserving querystring ("search") parameters.
  2846. *
  2847. * @param {string} s
  2848. * @return {string} A new URL.
  2849. */
  2850. function makeUrl(s) {
  2851. var search = window.location.search;
  2852. // Remove previous grep query parameter if present
  2853. if (search) {
  2854. search = search.replace(/[?&]grep=[^&\s]*/g, '').replace(/^&/, '?');
  2855. }
  2856. return (
  2857. window.location.pathname +
  2858. (search ? search + '&' : '?') +
  2859. 'grep=' +
  2860. encodeURIComponent(escapeRe(s))
  2861. );
  2862. }
  2863. /**
  2864. * Provide suite URL.
  2865. *
  2866. * @param {Object} [suite]
  2867. */
  2868. HTML.prototype.suiteURL = function(suite) {
  2869. return makeUrl(suite.fullTitle());
  2870. };
  2871. /**
  2872. * Provide test URL.
  2873. *
  2874. * @param {Object} [test]
  2875. */
  2876. HTML.prototype.testURL = function(test) {
  2877. return makeUrl(test.fullTitle());
  2878. };
  2879. /**
  2880. * Adds code toggle functionality for the provided test's list element.
  2881. *
  2882. * @param {HTMLLIElement} el
  2883. * @param {string} contents
  2884. */
  2885. HTML.prototype.addCodeToggle = function(el, contents) {
  2886. var h2 = el.getElementsByTagName('h2')[0];
  2887. on(h2, 'click', function() {
  2888. pre.style.display = pre.style.display === 'none' ? 'block' : 'none';
  2889. });
  2890. var pre = fragment('<pre><code>%e</code></pre>', utils.clean(contents));
  2891. el.appendChild(pre);
  2892. pre.style.display = 'none';
  2893. };
  2894. /**
  2895. * Display error `msg`.
  2896. *
  2897. * @param {string} msg
  2898. */
  2899. function error(msg) {
  2900. document.body.appendChild(fragment('<div id="mocha-error">%s</div>', msg));
  2901. }
  2902. /**
  2903. * Return a DOM fragment from `html`.
  2904. *
  2905. * @param {string} html
  2906. */
  2907. function fragment(html) {
  2908. var args = arguments;
  2909. var div = document.createElement('div');
  2910. var i = 1;
  2911. div.innerHTML = html.replace(/%([se])/g, function(_, type) {
  2912. switch (type) {
  2913. case 's':
  2914. return String(args[i++]);
  2915. case 'e':
  2916. return escape(args[i++]);
  2917. // no default
  2918. }
  2919. });
  2920. return div.firstChild;
  2921. }
  2922. /**
  2923. * Check for suites that do not have elements
  2924. * with `classname`, and hide them.
  2925. *
  2926. * @param {text} classname
  2927. */
  2928. function hideSuitesWithout(classname) {
  2929. var suites = document.getElementsByClassName('suite');
  2930. for (var i = 0; i < suites.length; i++) {
  2931. var els = suites[i].getElementsByClassName(classname);
  2932. if (!els.length) {
  2933. suites[i].className += ' hidden';
  2934. }
  2935. }
  2936. }
  2937. /**
  2938. * Unhide .hidden suites.
  2939. */
  2940. function unhide() {
  2941. var els = document.getElementsByClassName('suite hidden');
  2942. for (var i = 0; i < els.length; ++i) {
  2943. els[i].className = els[i].className.replace('suite hidden', 'suite');
  2944. }
  2945. }
  2946. /**
  2947. * Set an element's text contents.
  2948. *
  2949. * @param {HTMLElement} el
  2950. * @param {string} contents
  2951. */
  2952. function text(el, contents) {
  2953. if (el.textContent) {
  2954. el.textContent = contents;
  2955. } else {
  2956. el.innerText = contents;
  2957. }
  2958. }
  2959. /**
  2960. * Listen on `event` with callback `fn`.
  2961. */
  2962. function on(el, event, fn) {
  2963. if (el.addEventListener) {
  2964. el.addEventListener(event, fn, false);
  2965. } else {
  2966. el.attachEvent('on' + event, fn);
  2967. }
  2968. }
  2969. HTML.browserOnly = true;
  2970. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  2971. },{"../browser/progress":3,"../runner":34,"../utils":38,"./base":17,"escape-string-regexp":49}],21:[function(require,module,exports){
  2972. 'use strict';
  2973. // Alias exports to a their normalized format Mocha#reporter to prevent a need
  2974. // for dynamic (try/catch) requires, which Browserify doesn't handle.
  2975. exports.Base = exports.base = require('./base');
  2976. exports.Dot = exports.dot = require('./dot');
  2977. exports.Doc = exports.doc = require('./doc');
  2978. exports.TAP = exports.tap = require('./tap');
  2979. exports.JSON = exports.json = require('./json');
  2980. exports.HTML = exports.html = require('./html');
  2981. exports.List = exports.list = require('./list');
  2982. exports.Min = exports.min = require('./min');
  2983. exports.Spec = exports.spec = require('./spec');
  2984. exports.Nyan = exports.nyan = require('./nyan');
  2985. exports.XUnit = exports.xunit = require('./xunit');
  2986. exports.Markdown = exports.markdown = require('./markdown');
  2987. exports.Progress = exports.progress = require('./progress');
  2988. exports.Landing = exports.landing = require('./landing');
  2989. exports.JSONStream = exports['json-stream'] = require('./json-stream');
  2990. },{"./base":17,"./doc":18,"./dot":19,"./html":20,"./json":23,"./json-stream":22,"./landing":24,"./list":25,"./markdown":26,"./min":27,"./nyan":28,"./progress":29,"./spec":30,"./tap":31,"./xunit":32}],22:[function(require,module,exports){
  2991. (function (process){
  2992. 'use strict';
  2993. /**
  2994. * @module JSONStream
  2995. */
  2996. /**
  2997. * Module dependencies.
  2998. */
  2999. var Base = require('./base');
  3000. var constants = require('../runner').constants;
  3001. var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
  3002. var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
  3003. var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
  3004. var EVENT_RUN_END = constants.EVENT_RUN_END;
  3005. /**
  3006. * Expose `JSONStream`.
  3007. */
  3008. exports = module.exports = JSONStream;
  3009. /**
  3010. * Constructs a new `JSONStream` reporter instance.
  3011. *
  3012. * @public
  3013. * @class
  3014. * @memberof Mocha.reporters
  3015. * @extends Mocha.reporters.Base
  3016. * @param {Runner} runner - Instance triggers reporter actions.
  3017. * @param {Object} [options] - runner options
  3018. */
  3019. function JSONStream(runner, options) {
  3020. Base.call(this, runner, options);
  3021. var self = this;
  3022. var total = runner.total;
  3023. runner.once(EVENT_RUN_BEGIN, function() {
  3024. writeEvent(['start', {total: total}]);
  3025. });
  3026. runner.on(EVENT_TEST_PASS, function(test) {
  3027. writeEvent(['pass', clean(test)]);
  3028. });
  3029. runner.on(EVENT_TEST_FAIL, function(test, err) {
  3030. test = clean(test);
  3031. test.err = err.message;
  3032. test.stack = err.stack || null;
  3033. writeEvent(['fail', test]);
  3034. });
  3035. runner.once(EVENT_RUN_END, function() {
  3036. writeEvent(['end', self.stats]);
  3037. });
  3038. }
  3039. /**
  3040. * Mocha event to be written to the output stream.
  3041. * @typedef {Array} JSONStream~MochaEvent
  3042. */
  3043. /**
  3044. * Writes Mocha event to reporter output stream.
  3045. *
  3046. * @private
  3047. * @param {JSONStream~MochaEvent} event - Mocha event to be output.
  3048. */
  3049. function writeEvent(event) {
  3050. process.stdout.write(JSON.stringify(event) + '\n');
  3051. }
  3052. /**
  3053. * Returns an object literal representation of `test`
  3054. * free of cyclic properties, etc.
  3055. *
  3056. * @private
  3057. * @param {Test} test - Instance used as data source.
  3058. * @return {Object} object containing pared-down test instance data
  3059. */
  3060. function clean(test) {
  3061. return {
  3062. title: test.title,
  3063. fullTitle: test.fullTitle(),
  3064. duration: test.duration,
  3065. currentRetry: test.currentRetry()
  3066. };
  3067. }
  3068. JSONStream.description = 'newline delimited JSON events';
  3069. }).call(this,require('_process'))
  3070. },{"../runner":34,"./base":17,"_process":69}],23:[function(require,module,exports){
  3071. (function (process){
  3072. 'use strict';
  3073. /**
  3074. * @module JSON
  3075. */
  3076. /**
  3077. * Module dependencies.
  3078. */
  3079. var Base = require('./base');
  3080. var constants = require('../runner').constants;
  3081. var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
  3082. var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
  3083. var EVENT_TEST_END = constants.EVENT_TEST_END;
  3084. var EVENT_RUN_END = constants.EVENT_RUN_END;
  3085. var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
  3086. /**
  3087. * Expose `JSON`.
  3088. */
  3089. exports = module.exports = JSONReporter;
  3090. /**
  3091. * Constructs a new `JSON` reporter instance.
  3092. *
  3093. * @public
  3094. * @class JSON
  3095. * @memberof Mocha.reporters
  3096. * @extends Mocha.reporters.Base
  3097. * @param {Runner} runner - Instance triggers reporter actions.
  3098. * @param {Object} [options] - runner options
  3099. */
  3100. function JSONReporter(runner, options) {
  3101. Base.call(this, runner, options);
  3102. var self = this;
  3103. var tests = [];
  3104. var pending = [];
  3105. var failures = [];
  3106. var passes = [];
  3107. runner.on(EVENT_TEST_END, function(test) {
  3108. tests.push(test);
  3109. });
  3110. runner.on(EVENT_TEST_PASS, function(test) {
  3111. passes.push(test);
  3112. });
  3113. runner.on(EVENT_TEST_FAIL, function(test) {
  3114. failures.push(test);
  3115. });
  3116. runner.on(EVENT_TEST_PENDING, function(test) {
  3117. pending.push(test);
  3118. });
  3119. runner.once(EVENT_RUN_END, function() {
  3120. var obj = {
  3121. stats: self.stats,
  3122. tests: tests.map(clean),
  3123. pending: pending.map(clean),
  3124. failures: failures.map(clean),
  3125. passes: passes.map(clean)
  3126. };
  3127. runner.testResults = obj;
  3128. process.stdout.write(JSON.stringify(obj, null, 2));
  3129. });
  3130. }
  3131. /**
  3132. * Return a plain-object representation of `test`
  3133. * free of cyclic properties etc.
  3134. *
  3135. * @private
  3136. * @param {Object} test
  3137. * @return {Object}
  3138. */
  3139. function clean(test) {
  3140. var err = test.err || {};
  3141. if (err instanceof Error) {
  3142. err = errorJSON(err);
  3143. }
  3144. return {
  3145. title: test.title,
  3146. fullTitle: test.fullTitle(),
  3147. duration: test.duration,
  3148. currentRetry: test.currentRetry(),
  3149. err: cleanCycles(err)
  3150. };
  3151. }
  3152. /**
  3153. * Replaces any circular references inside `obj` with '[object Object]'
  3154. *
  3155. * @private
  3156. * @param {Object} obj
  3157. * @return {Object}
  3158. */
  3159. function cleanCycles(obj) {
  3160. var cache = [];
  3161. return JSON.parse(
  3162. JSON.stringify(obj, function(key, value) {
  3163. if (typeof value === 'object' && value !== null) {
  3164. if (cache.indexOf(value) !== -1) {
  3165. // Instead of going in a circle, we'll print [object Object]
  3166. return '' + value;
  3167. }
  3168. cache.push(value);
  3169. }
  3170. return value;
  3171. })
  3172. );
  3173. }
  3174. /**
  3175. * Transform an Error object into a JSON object.
  3176. *
  3177. * @private
  3178. * @param {Error} err
  3179. * @return {Object}
  3180. */
  3181. function errorJSON(err) {
  3182. var res = {};
  3183. Object.getOwnPropertyNames(err).forEach(function(key) {
  3184. res[key] = err[key];
  3185. }, err);
  3186. return res;
  3187. }
  3188. JSONReporter.description = 'single JSON object';
  3189. }).call(this,require('_process'))
  3190. },{"../runner":34,"./base":17,"_process":69}],24:[function(require,module,exports){
  3191. (function (process){
  3192. 'use strict';
  3193. /**
  3194. * @module Landing
  3195. */
  3196. /**
  3197. * Module dependencies.
  3198. */
  3199. var Base = require('./base');
  3200. var inherits = require('../utils').inherits;
  3201. var constants = require('../runner').constants;
  3202. var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
  3203. var EVENT_RUN_END = constants.EVENT_RUN_END;
  3204. var EVENT_TEST_END = constants.EVENT_TEST_END;
  3205. var STATE_FAILED = require('../runnable').constants.STATE_FAILED;
  3206. var cursor = Base.cursor;
  3207. var color = Base.color;
  3208. /**
  3209. * Expose `Landing`.
  3210. */
  3211. exports = module.exports = Landing;
  3212. /**
  3213. * Airplane color.
  3214. */
  3215. Base.colors.plane = 0;
  3216. /**
  3217. * Airplane crash color.
  3218. */
  3219. Base.colors['plane crash'] = 31;
  3220. /**
  3221. * Runway color.
  3222. */
  3223. Base.colors.runway = 90;
  3224. /**
  3225. * Constructs a new `Landing` reporter instance.
  3226. *
  3227. * @public
  3228. * @class
  3229. * @memberof Mocha.reporters
  3230. * @extends Mocha.reporters.Base
  3231. * @param {Runner} runner - Instance triggers reporter actions.
  3232. * @param {Object} [options] - runner options
  3233. */
  3234. function Landing(runner, options) {
  3235. Base.call(this, runner, options);
  3236. var self = this;
  3237. var width = (Base.window.width * 0.75) | 0;
  3238. var total = runner.total;
  3239. var stream = process.stdout;
  3240. var plane = color('plane', '✈');
  3241. var crashed = -1;
  3242. var n = 0;
  3243. function runway() {
  3244. var buf = Array(width).join('-');
  3245. return ' ' + color('runway', buf);
  3246. }
  3247. runner.on(EVENT_RUN_BEGIN, function() {
  3248. stream.write('\n\n\n ');
  3249. cursor.hide();
  3250. });
  3251. runner.on(EVENT_TEST_END, function(test) {
  3252. // check if the plane crashed
  3253. var col = crashed === -1 ? ((width * ++n) / total) | 0 : crashed;
  3254. // show the crash
  3255. if (test.state === STATE_FAILED) {
  3256. plane = color('plane crash', '✈');
  3257. crashed = col;
  3258. }
  3259. // render landing strip
  3260. stream.write('\u001b[' + (width + 1) + 'D\u001b[2A');
  3261. stream.write(runway());
  3262. stream.write('\n ');
  3263. stream.write(color('runway', Array(col).join('⋅')));
  3264. stream.write(plane);
  3265. stream.write(color('runway', Array(width - col).join('⋅') + '\n'));
  3266. stream.write(runway());
  3267. stream.write('\u001b[0m');
  3268. });
  3269. runner.once(EVENT_RUN_END, function() {
  3270. cursor.show();
  3271. console.log();
  3272. self.epilogue();
  3273. });
  3274. }
  3275. /**
  3276. * Inherit from `Base.prototype`.
  3277. */
  3278. inherits(Landing, Base);
  3279. Landing.description = 'Unicode landing strip';
  3280. }).call(this,require('_process'))
  3281. },{"../runnable":33,"../runner":34,"../utils":38,"./base":17,"_process":69}],25:[function(require,module,exports){
  3282. (function (process){
  3283. 'use strict';
  3284. /**
  3285. * @module List
  3286. */
  3287. /**
  3288. * Module dependencies.
  3289. */
  3290. var Base = require('./base');
  3291. var inherits = require('../utils').inherits;
  3292. var constants = require('../runner').constants;
  3293. var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
  3294. var EVENT_RUN_END = constants.EVENT_RUN_END;
  3295. var EVENT_TEST_BEGIN = constants.EVENT_TEST_BEGIN;
  3296. var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
  3297. var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
  3298. var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
  3299. var color = Base.color;
  3300. var cursor = Base.cursor;
  3301. /**
  3302. * Expose `List`.
  3303. */
  3304. exports = module.exports = List;
  3305. /**
  3306. * Constructs a new `List` reporter instance.
  3307. *
  3308. * @public
  3309. * @class
  3310. * @memberof Mocha.reporters
  3311. * @extends Mocha.reporters.Base
  3312. * @param {Runner} runner - Instance triggers reporter actions.
  3313. * @param {Object} [options] - runner options
  3314. */
  3315. function List(runner, options) {
  3316. Base.call(this, runner, options);
  3317. var self = this;
  3318. var n = 0;
  3319. runner.on(EVENT_RUN_BEGIN, function() {
  3320. console.log();
  3321. });
  3322. runner.on(EVENT_TEST_BEGIN, function(test) {
  3323. process.stdout.write(color('pass', ' ' + test.fullTitle() + ': '));
  3324. });
  3325. runner.on(EVENT_TEST_PENDING, function(test) {
  3326. var fmt = color('checkmark', ' -') + color('pending', ' %s');
  3327. console.log(fmt, test.fullTitle());
  3328. });
  3329. runner.on(EVENT_TEST_PASS, function(test) {
  3330. var fmt =
  3331. color('checkmark', ' ' + Base.symbols.ok) +
  3332. color('pass', ' %s: ') +
  3333. color(test.speed, '%dms');
  3334. cursor.CR();
  3335. console.log(fmt, test.fullTitle(), test.duration);
  3336. });
  3337. runner.on(EVENT_TEST_FAIL, function(test) {
  3338. cursor.CR();
  3339. console.log(color('fail', ' %d) %s'), ++n, test.fullTitle());
  3340. });
  3341. runner.once(EVENT_RUN_END, self.epilogue.bind(self));
  3342. }
  3343. /**
  3344. * Inherit from `Base.prototype`.
  3345. */
  3346. inherits(List, Base);
  3347. List.description = 'like "spec" reporter but flat';
  3348. }).call(this,require('_process'))
  3349. },{"../runner":34,"../utils":38,"./base":17,"_process":69}],26:[function(require,module,exports){
  3350. (function (process){
  3351. 'use strict';
  3352. /**
  3353. * @module Markdown
  3354. */
  3355. /**
  3356. * Module dependencies.
  3357. */
  3358. var Base = require('./base');
  3359. var utils = require('../utils');
  3360. var constants = require('../runner').constants;
  3361. var EVENT_RUN_END = constants.EVENT_RUN_END;
  3362. var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
  3363. var EVENT_SUITE_END = constants.EVENT_SUITE_END;
  3364. var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
  3365. /**
  3366. * Constants
  3367. */
  3368. var SUITE_PREFIX = '$';
  3369. /**
  3370. * Expose `Markdown`.
  3371. */
  3372. exports = module.exports = Markdown;
  3373. /**
  3374. * Constructs a new `Markdown` reporter instance.
  3375. *
  3376. * @public
  3377. * @class
  3378. * @memberof Mocha.reporters
  3379. * @extends Mocha.reporters.Base
  3380. * @param {Runner} runner - Instance triggers reporter actions.
  3381. * @param {Object} [options] - runner options
  3382. */
  3383. function Markdown(runner, options) {
  3384. Base.call(this, runner, options);
  3385. var level = 0;
  3386. var buf = '';
  3387. function title(str) {
  3388. return Array(level).join('#') + ' ' + str;
  3389. }
  3390. function mapTOC(suite, obj) {
  3391. var ret = obj;
  3392. var key = SUITE_PREFIX + suite.title;
  3393. obj = obj[key] = obj[key] || {suite: suite};
  3394. suite.suites.forEach(function(suite) {
  3395. mapTOC(suite, obj);
  3396. });
  3397. return ret;
  3398. }
  3399. function stringifyTOC(obj, level) {
  3400. ++level;
  3401. var buf = '';
  3402. var link;
  3403. for (var key in obj) {
  3404. if (key === 'suite') {
  3405. continue;
  3406. }
  3407. if (key !== SUITE_PREFIX) {
  3408. link = ' - [' + key.substring(1) + ']';
  3409. link += '(#' + utils.slug(obj[key].suite.fullTitle()) + ')\n';
  3410. buf += Array(level).join(' ') + link;
  3411. }
  3412. buf += stringifyTOC(obj[key], level);
  3413. }
  3414. return buf;
  3415. }
  3416. function generateTOC(suite) {
  3417. var obj = mapTOC(suite, {});
  3418. return stringifyTOC(obj, 0);
  3419. }
  3420. generateTOC(runner.suite);
  3421. runner.on(EVENT_SUITE_BEGIN, function(suite) {
  3422. ++level;
  3423. var slug = utils.slug(suite.fullTitle());
  3424. buf += '<a name="' + slug + '"></a>' + '\n';
  3425. buf += title(suite.title) + '\n';
  3426. });
  3427. runner.on(EVENT_SUITE_END, function() {
  3428. --level;
  3429. });
  3430. runner.on(EVENT_TEST_PASS, function(test) {
  3431. var code = utils.clean(test.body);
  3432. buf += test.title + '.\n';
  3433. buf += '\n```js\n';
  3434. buf += code + '\n';
  3435. buf += '```\n\n';
  3436. });
  3437. runner.once(EVENT_RUN_END, function() {
  3438. process.stdout.write('# TOC\n');
  3439. process.stdout.write(generateTOC(runner.suite));
  3440. process.stdout.write(buf);
  3441. });
  3442. }
  3443. Markdown.description = 'GitHub Flavored Markdown';
  3444. }).call(this,require('_process'))
  3445. },{"../runner":34,"../utils":38,"./base":17,"_process":69}],27:[function(require,module,exports){
  3446. (function (process){
  3447. 'use strict';
  3448. /**
  3449. * @module Min
  3450. */
  3451. /**
  3452. * Module dependencies.
  3453. */
  3454. var Base = require('./base');
  3455. var inherits = require('../utils').inherits;
  3456. var constants = require('../runner').constants;
  3457. var EVENT_RUN_END = constants.EVENT_RUN_END;
  3458. var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
  3459. /**
  3460. * Expose `Min`.
  3461. */
  3462. exports = module.exports = Min;
  3463. /**
  3464. * Constructs a new `Min` reporter instance.
  3465. *
  3466. * @description
  3467. * This minimal test reporter is best used with '--watch'.
  3468. *
  3469. * @public
  3470. * @class
  3471. * @memberof Mocha.reporters
  3472. * @extends Mocha.reporters.Base
  3473. * @param {Runner} runner - Instance triggers reporter actions.
  3474. * @param {Object} [options] - runner options
  3475. */
  3476. function Min(runner, options) {
  3477. Base.call(this, runner, options);
  3478. runner.on(EVENT_RUN_BEGIN, function() {
  3479. // clear screen
  3480. process.stdout.write('\u001b[2J');
  3481. // set cursor position
  3482. process.stdout.write('\u001b[1;3H');
  3483. });
  3484. runner.once(EVENT_RUN_END, this.epilogue.bind(this));
  3485. }
  3486. /**
  3487. * Inherit from `Base.prototype`.
  3488. */
  3489. inherits(Min, Base);
  3490. Min.description = 'essentially just a summary';
  3491. }).call(this,require('_process'))
  3492. },{"../runner":34,"../utils":38,"./base":17,"_process":69}],28:[function(require,module,exports){
  3493. (function (process){
  3494. 'use strict';
  3495. /**
  3496. * @module Nyan
  3497. */
  3498. /**
  3499. * Module dependencies.
  3500. */
  3501. var Base = require('./base');
  3502. var constants = require('../runner').constants;
  3503. var inherits = require('../utils').inherits;
  3504. var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
  3505. var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
  3506. var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
  3507. var EVENT_RUN_END = constants.EVENT_RUN_END;
  3508. var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
  3509. /**
  3510. * Expose `Dot`.
  3511. */
  3512. exports = module.exports = NyanCat;
  3513. /**
  3514. * Constructs a new `Nyan` reporter instance.
  3515. *
  3516. * @public
  3517. * @class Nyan
  3518. * @memberof Mocha.reporters
  3519. * @extends Mocha.reporters.Base
  3520. * @param {Runner} runner - Instance triggers reporter actions.
  3521. * @param {Object} [options] - runner options
  3522. */
  3523. function NyanCat(runner, options) {
  3524. Base.call(this, runner, options);
  3525. var self = this;
  3526. var width = (Base.window.width * 0.75) | 0;
  3527. var nyanCatWidth = (this.nyanCatWidth = 11);
  3528. this.colorIndex = 0;
  3529. this.numberOfLines = 4;
  3530. this.rainbowColors = self.generateColors();
  3531. this.scoreboardWidth = 5;
  3532. this.tick = 0;
  3533. this.trajectories = [[], [], [], []];
  3534. this.trajectoryWidthMax = width - nyanCatWidth;
  3535. runner.on(EVENT_RUN_BEGIN, function() {
  3536. Base.cursor.hide();
  3537. self.draw();
  3538. });
  3539. runner.on(EVENT_TEST_PENDING, function() {
  3540. self.draw();
  3541. });
  3542. runner.on(EVENT_TEST_PASS, function() {
  3543. self.draw();
  3544. });
  3545. runner.on(EVENT_TEST_FAIL, function() {
  3546. self.draw();
  3547. });
  3548. runner.once(EVENT_RUN_END, function() {
  3549. Base.cursor.show();
  3550. for (var i = 0; i < self.numberOfLines; i++) {
  3551. write('\n');
  3552. }
  3553. self.epilogue();
  3554. });
  3555. }
  3556. /**
  3557. * Inherit from `Base.prototype`.
  3558. */
  3559. inherits(NyanCat, Base);
  3560. /**
  3561. * Draw the nyan cat
  3562. *
  3563. * @private
  3564. */
  3565. NyanCat.prototype.draw = function() {
  3566. this.appendRainbow();
  3567. this.drawScoreboard();
  3568. this.drawRainbow();
  3569. this.drawNyanCat();
  3570. this.tick = !this.tick;
  3571. };
  3572. /**
  3573. * Draw the "scoreboard" showing the number
  3574. * of passes, failures and pending tests.
  3575. *
  3576. * @private
  3577. */
  3578. NyanCat.prototype.drawScoreboard = function() {
  3579. var stats = this.stats;
  3580. function draw(type, n) {
  3581. write(' ');
  3582. write(Base.color(type, n));
  3583. write('\n');
  3584. }
  3585. draw('green', stats.passes);
  3586. draw('fail', stats.failures);
  3587. draw('pending', stats.pending);
  3588. write('\n');
  3589. this.cursorUp(this.numberOfLines);
  3590. };
  3591. /**
  3592. * Append the rainbow.
  3593. *
  3594. * @private
  3595. */
  3596. NyanCat.prototype.appendRainbow = function() {
  3597. var segment = this.tick ? '_' : '-';
  3598. var rainbowified = this.rainbowify(segment);
  3599. for (var index = 0; index < this.numberOfLines; index++) {
  3600. var trajectory = this.trajectories[index];
  3601. if (trajectory.length >= this.trajectoryWidthMax) {
  3602. trajectory.shift();
  3603. }
  3604. trajectory.push(rainbowified);
  3605. }
  3606. };
  3607. /**
  3608. * Draw the rainbow.
  3609. *
  3610. * @private
  3611. */
  3612. NyanCat.prototype.drawRainbow = function() {
  3613. var self = this;
  3614. this.trajectories.forEach(function(line) {
  3615. write('\u001b[' + self.scoreboardWidth + 'C');
  3616. write(line.join(''));
  3617. write('\n');
  3618. });
  3619. this.cursorUp(this.numberOfLines);
  3620. };
  3621. /**
  3622. * Draw the nyan cat
  3623. *
  3624. * @private
  3625. */
  3626. NyanCat.prototype.drawNyanCat = function() {
  3627. var self = this;
  3628. var startWidth = this.scoreboardWidth + this.trajectories[0].length;
  3629. var dist = '\u001b[' + startWidth + 'C';
  3630. var padding = '';
  3631. write(dist);
  3632. write('_,------,');
  3633. write('\n');
  3634. write(dist);
  3635. padding = self.tick ? ' ' : ' ';
  3636. write('_|' + padding + '/\\_/\\ ');
  3637. write('\n');
  3638. write(dist);
  3639. padding = self.tick ? '_' : '__';
  3640. var tail = self.tick ? '~' : '^';
  3641. write(tail + '|' + padding + this.face() + ' ');
  3642. write('\n');
  3643. write(dist);
  3644. padding = self.tick ? ' ' : ' ';
  3645. write(padding + '"" "" ');
  3646. write('\n');
  3647. this.cursorUp(this.numberOfLines);
  3648. };
  3649. /**
  3650. * Draw nyan cat face.
  3651. *
  3652. * @private
  3653. * @return {string}
  3654. */
  3655. NyanCat.prototype.face = function() {
  3656. var stats = this.stats;
  3657. if (stats.failures) {
  3658. return '( x .x)';
  3659. } else if (stats.pending) {
  3660. return '( o .o)';
  3661. } else if (stats.passes) {
  3662. return '( ^ .^)';
  3663. }
  3664. return '( - .-)';
  3665. };
  3666. /**
  3667. * Move cursor up `n`.
  3668. *
  3669. * @private
  3670. * @param {number} n
  3671. */
  3672. NyanCat.prototype.cursorUp = function(n) {
  3673. write('\u001b[' + n + 'A');
  3674. };
  3675. /**
  3676. * Move cursor down `n`.
  3677. *
  3678. * @private
  3679. * @param {number} n
  3680. */
  3681. NyanCat.prototype.cursorDown = function(n) {
  3682. write('\u001b[' + n + 'B');
  3683. };
  3684. /**
  3685. * Generate rainbow colors.
  3686. *
  3687. * @private
  3688. * @return {Array}
  3689. */
  3690. NyanCat.prototype.generateColors = function() {
  3691. var colors = [];
  3692. for (var i = 0; i < 6 * 7; i++) {
  3693. var pi3 = Math.floor(Math.PI / 3);
  3694. var n = i * (1.0 / 6);
  3695. var r = Math.floor(3 * Math.sin(n) + 3);
  3696. var g = Math.floor(3 * Math.sin(n + 2 * pi3) + 3);
  3697. var b = Math.floor(3 * Math.sin(n + 4 * pi3) + 3);
  3698. colors.push(36 * r + 6 * g + b + 16);
  3699. }
  3700. return colors;
  3701. };
  3702. /**
  3703. * Apply rainbow to the given `str`.
  3704. *
  3705. * @private
  3706. * @param {string} str
  3707. * @return {string}
  3708. */
  3709. NyanCat.prototype.rainbowify = function(str) {
  3710. if (!Base.useColors) {
  3711. return str;
  3712. }
  3713. var color = this.rainbowColors[this.colorIndex % this.rainbowColors.length];
  3714. this.colorIndex += 1;
  3715. return '\u001b[38;5;' + color + 'm' + str + '\u001b[0m';
  3716. };
  3717. /**
  3718. * Stdout helper.
  3719. *
  3720. * @param {string} string A message to write to stdout.
  3721. */
  3722. function write(string) {
  3723. process.stdout.write(string);
  3724. }
  3725. NyanCat.description = '"nyan cat"';
  3726. }).call(this,require('_process'))
  3727. },{"../runner":34,"../utils":38,"./base":17,"_process":69}],29:[function(require,module,exports){
  3728. (function (process){
  3729. 'use strict';
  3730. /**
  3731. * @module Progress
  3732. */
  3733. /**
  3734. * Module dependencies.
  3735. */
  3736. var Base = require('./base');
  3737. var constants = require('../runner').constants;
  3738. var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
  3739. var EVENT_TEST_END = constants.EVENT_TEST_END;
  3740. var EVENT_RUN_END = constants.EVENT_RUN_END;
  3741. var inherits = require('../utils').inherits;
  3742. var color = Base.color;
  3743. var cursor = Base.cursor;
  3744. /**
  3745. * Expose `Progress`.
  3746. */
  3747. exports = module.exports = Progress;
  3748. /**
  3749. * General progress bar color.
  3750. */
  3751. Base.colors.progress = 90;
  3752. /**
  3753. * Constructs a new `Progress` reporter instance.
  3754. *
  3755. * @public
  3756. * @class
  3757. * @memberof Mocha.reporters
  3758. * @extends Mocha.reporters.Base
  3759. * @param {Runner} runner - Instance triggers reporter actions.
  3760. * @param {Object} [options] - runner options
  3761. */
  3762. function Progress(runner, options) {
  3763. Base.call(this, runner, options);
  3764. var self = this;
  3765. var width = (Base.window.width * 0.5) | 0;
  3766. var total = runner.total;
  3767. var complete = 0;
  3768. var lastN = -1;
  3769. // default chars
  3770. options = options || {};
  3771. var reporterOptions = options.reporterOptions || {};
  3772. options.open = reporterOptions.open || '[';
  3773. options.complete = reporterOptions.complete || '▬';
  3774. options.incomplete = reporterOptions.incomplete || Base.symbols.dot;
  3775. options.close = reporterOptions.close || ']';
  3776. options.verbose = reporterOptions.verbose || false;
  3777. // tests started
  3778. runner.on(EVENT_RUN_BEGIN, function() {
  3779. console.log();
  3780. cursor.hide();
  3781. });
  3782. // tests complete
  3783. runner.on(EVENT_TEST_END, function() {
  3784. complete++;
  3785. var percent = complete / total;
  3786. var n = (width * percent) | 0;
  3787. var i = width - n;
  3788. if (n === lastN && !options.verbose) {
  3789. // Don't re-render the line if it hasn't changed
  3790. return;
  3791. }
  3792. lastN = n;
  3793. cursor.CR();
  3794. process.stdout.write('\u001b[J');
  3795. process.stdout.write(color('progress', ' ' + options.open));
  3796. process.stdout.write(Array(n).join(options.complete));
  3797. process.stdout.write(Array(i).join(options.incomplete));
  3798. process.stdout.write(color('progress', options.close));
  3799. if (options.verbose) {
  3800. process.stdout.write(color('progress', ' ' + complete + ' of ' + total));
  3801. }
  3802. });
  3803. // tests are complete, output some stats
  3804. // and the failures if any
  3805. runner.once(EVENT_RUN_END, function() {
  3806. cursor.show();
  3807. console.log();
  3808. self.epilogue();
  3809. });
  3810. }
  3811. /**
  3812. * Inherit from `Base.prototype`.
  3813. */
  3814. inherits(Progress, Base);
  3815. Progress.description = 'a progress bar';
  3816. }).call(this,require('_process'))
  3817. },{"../runner":34,"../utils":38,"./base":17,"_process":69}],30:[function(require,module,exports){
  3818. 'use strict';
  3819. /**
  3820. * @module Spec
  3821. */
  3822. /**
  3823. * Module dependencies.
  3824. */
  3825. var Base = require('./base');
  3826. var constants = require('../runner').constants;
  3827. var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
  3828. var EVENT_RUN_END = constants.EVENT_RUN_END;
  3829. var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
  3830. var EVENT_SUITE_END = constants.EVENT_SUITE_END;
  3831. var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
  3832. var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
  3833. var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
  3834. var inherits = require('../utils').inherits;
  3835. var color = Base.color;
  3836. /**
  3837. * Expose `Spec`.
  3838. */
  3839. exports = module.exports = Spec;
  3840. /**
  3841. * Constructs a new `Spec` reporter instance.
  3842. *
  3843. * @public
  3844. * @class
  3845. * @memberof Mocha.reporters
  3846. * @extends Mocha.reporters.Base
  3847. * @param {Runner} runner - Instance triggers reporter actions.
  3848. * @param {Object} [options] - runner options
  3849. */
  3850. function Spec(runner, options) {
  3851. Base.call(this, runner, options);
  3852. var self = this;
  3853. var indents = 0;
  3854. var n = 0;
  3855. function indent() {
  3856. return Array(indents).join(' ');
  3857. }
  3858. runner.on(EVENT_RUN_BEGIN, function() {
  3859. console.log();
  3860. });
  3861. runner.on(EVENT_SUITE_BEGIN, function(suite) {
  3862. ++indents;
  3863. console.log(color('suite', '%s%s'), indent(), suite.title);
  3864. });
  3865. runner.on(EVENT_SUITE_END, function() {
  3866. --indents;
  3867. if (indents === 1) {
  3868. console.log();
  3869. }
  3870. });
  3871. runner.on(EVENT_TEST_PENDING, function(test) {
  3872. var fmt = indent() + color('pending', ' - %s');
  3873. console.log(fmt, test.title);
  3874. });
  3875. runner.on(EVENT_TEST_PASS, function(test) {
  3876. var fmt;
  3877. if (test.speed === 'fast') {
  3878. fmt =
  3879. indent() +
  3880. color('checkmark', ' ' + Base.symbols.ok) +
  3881. color('pass', ' %s');
  3882. console.log(fmt, test.title);
  3883. } else {
  3884. fmt =
  3885. indent() +
  3886. color('checkmark', ' ' + Base.symbols.ok) +
  3887. color('pass', ' %s') +
  3888. color(test.speed, ' (%dms)');
  3889. console.log(fmt, test.title, test.duration);
  3890. }
  3891. });
  3892. runner.on(EVENT_TEST_FAIL, function(test) {
  3893. console.log(indent() + color('fail', ' %d) %s'), ++n, test.title);
  3894. });
  3895. runner.once(EVENT_RUN_END, self.epilogue.bind(self));
  3896. }
  3897. /**
  3898. * Inherit from `Base.prototype`.
  3899. */
  3900. inherits(Spec, Base);
  3901. Spec.description = 'hierarchical & verbose [default]';
  3902. },{"../runner":34,"../utils":38,"./base":17}],31:[function(require,module,exports){
  3903. (function (process){
  3904. 'use strict';
  3905. /**
  3906. * @module TAP
  3907. */
  3908. /**
  3909. * Module dependencies.
  3910. */
  3911. var util = require('util');
  3912. var Base = require('./base');
  3913. var constants = require('../runner').constants;
  3914. var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
  3915. var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
  3916. var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
  3917. var EVENT_RUN_END = constants.EVENT_RUN_END;
  3918. var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
  3919. var EVENT_TEST_END = constants.EVENT_TEST_END;
  3920. var inherits = require('../utils').inherits;
  3921. var sprintf = util.format;
  3922. /**
  3923. * Expose `TAP`.
  3924. */
  3925. exports = module.exports = TAP;
  3926. /**
  3927. * Constructs a new `TAP` reporter instance.
  3928. *
  3929. * @public
  3930. * @class
  3931. * @memberof Mocha.reporters
  3932. * @extends Mocha.reporters.Base
  3933. * @param {Runner} runner - Instance triggers reporter actions.
  3934. * @param {Object} [options] - runner options
  3935. */
  3936. function TAP(runner, options) {
  3937. Base.call(this, runner, options);
  3938. var self = this;
  3939. var n = 1;
  3940. var tapVersion = '12';
  3941. if (options && options.reporterOptions) {
  3942. if (options.reporterOptions.tapVersion) {
  3943. tapVersion = options.reporterOptions.tapVersion.toString();
  3944. }
  3945. }
  3946. this._producer = createProducer(tapVersion);
  3947. runner.once(EVENT_RUN_BEGIN, function() {
  3948. var ntests = runner.grepTotal(runner.suite);
  3949. self._producer.writeVersion();
  3950. self._producer.writePlan(ntests);
  3951. });
  3952. runner.on(EVENT_TEST_END, function() {
  3953. ++n;
  3954. });
  3955. runner.on(EVENT_TEST_PENDING, function(test) {
  3956. self._producer.writePending(n, test);
  3957. });
  3958. runner.on(EVENT_TEST_PASS, function(test) {
  3959. self._producer.writePass(n, test);
  3960. });
  3961. runner.on(EVENT_TEST_FAIL, function(test, err) {
  3962. self._producer.writeFail(n, test, err);
  3963. });
  3964. runner.once(EVENT_RUN_END, function() {
  3965. self._producer.writeEpilogue(runner.stats);
  3966. });
  3967. }
  3968. /**
  3969. * Inherit from `Base.prototype`.
  3970. */
  3971. inherits(TAP, Base);
  3972. /**
  3973. * Returns a TAP-safe title of `test`.
  3974. *
  3975. * @private
  3976. * @param {Test} test - Test instance.
  3977. * @return {String} title with any hash character removed
  3978. */
  3979. function title(test) {
  3980. return test.fullTitle().replace(/#/g, '');
  3981. }
  3982. /**
  3983. * Writes newline-terminated formatted string to reporter output stream.
  3984. *
  3985. * @private
  3986. * @param {string} format - `printf`-like format string
  3987. * @param {...*} [varArgs] - Format string arguments
  3988. */
  3989. function println(format, varArgs) {
  3990. var vargs = Array.from(arguments);
  3991. vargs[0] += '\n';
  3992. process.stdout.write(sprintf.apply(null, vargs));
  3993. }
  3994. /**
  3995. * Returns a `tapVersion`-appropriate TAP producer instance, if possible.
  3996. *
  3997. * @private
  3998. * @param {string} tapVersion - Version of TAP specification to produce.
  3999. * @returns {TAPProducer} specification-appropriate instance
  4000. * @throws {Error} if specification version has no associated producer.
  4001. */
  4002. function createProducer(tapVersion) {
  4003. var producers = {
  4004. '12': new TAP12Producer(),
  4005. '13': new TAP13Producer()
  4006. };
  4007. var producer = producers[tapVersion];
  4008. if (!producer) {
  4009. throw new Error(
  4010. 'invalid or unsupported TAP version: ' + JSON.stringify(tapVersion)
  4011. );
  4012. }
  4013. return producer;
  4014. }
  4015. /**
  4016. * @summary
  4017. * Constructs a new TAPProducer.
  4018. *
  4019. * @description
  4020. * <em>Only</em> to be used as an abstract base class.
  4021. *
  4022. * @private
  4023. * @constructor
  4024. */
  4025. function TAPProducer() {}
  4026. /**
  4027. * Writes the TAP version to reporter output stream.
  4028. *
  4029. * @abstract
  4030. */
  4031. TAPProducer.prototype.writeVersion = function() {};
  4032. /**
  4033. * Writes the plan to reporter output stream.
  4034. *
  4035. * @abstract
  4036. * @param {number} ntests - Number of tests that are planned to run.
  4037. */
  4038. TAPProducer.prototype.writePlan = function(ntests) {
  4039. println('%d..%d', 1, ntests);
  4040. };
  4041. /**
  4042. * Writes that test passed to reporter output stream.
  4043. *
  4044. * @abstract
  4045. * @param {number} n - Index of test that passed.
  4046. * @param {Test} test - Instance containing test information.
  4047. */
  4048. TAPProducer.prototype.writePass = function(n, test) {
  4049. println('ok %d %s', n, title(test));
  4050. };
  4051. /**
  4052. * Writes that test was skipped to reporter output stream.
  4053. *
  4054. * @abstract
  4055. * @param {number} n - Index of test that was skipped.
  4056. * @param {Test} test - Instance containing test information.
  4057. */
  4058. TAPProducer.prototype.writePending = function(n, test) {
  4059. println('ok %d %s # SKIP -', n, title(test));
  4060. };
  4061. /**
  4062. * Writes that test failed to reporter output stream.
  4063. *
  4064. * @abstract
  4065. * @param {number} n - Index of test that failed.
  4066. * @param {Test} test - Instance containing test information.
  4067. * @param {Error} err - Reason the test failed.
  4068. */
  4069. TAPProducer.prototype.writeFail = function(n, test, err) {
  4070. println('not ok %d %s', n, title(test));
  4071. };
  4072. /**
  4073. * Writes the summary epilogue to reporter output stream.
  4074. *
  4075. * @abstract
  4076. * @param {Object} stats - Object containing run statistics.
  4077. */
  4078. TAPProducer.prototype.writeEpilogue = function(stats) {
  4079. // :TBD: Why is this not counting pending tests?
  4080. println('# tests ' + (stats.passes + stats.failures));
  4081. println('# pass ' + stats.passes);
  4082. // :TBD: Why are we not showing pending results?
  4083. println('# fail ' + stats.failures);
  4084. };
  4085. /**
  4086. * @summary
  4087. * Constructs a new TAP12Producer.
  4088. *
  4089. * @description
  4090. * Produces output conforming to the TAP12 specification.
  4091. *
  4092. * @private
  4093. * @constructor
  4094. * @extends TAPProducer
  4095. * @see {@link https://testanything.org/tap-specification.html|Specification}
  4096. */
  4097. function TAP12Producer() {
  4098. /**
  4099. * Writes that test failed to reporter output stream, with error formatting.
  4100. * @override
  4101. */
  4102. this.writeFail = function(n, test, err) {
  4103. TAPProducer.prototype.writeFail.call(this, n, test, err);
  4104. if (err.message) {
  4105. println(err.message.replace(/^/gm, ' '));
  4106. }
  4107. if (err.stack) {
  4108. println(err.stack.replace(/^/gm, ' '));
  4109. }
  4110. };
  4111. }
  4112. /**
  4113. * Inherit from `TAPProducer.prototype`.
  4114. */
  4115. inherits(TAP12Producer, TAPProducer);
  4116. /**
  4117. * @summary
  4118. * Constructs a new TAP13Producer.
  4119. *
  4120. * @description
  4121. * Produces output conforming to the TAP13 specification.
  4122. *
  4123. * @private
  4124. * @constructor
  4125. * @extends TAPProducer
  4126. * @see {@link https://testanything.org/tap-version-13-specification.html|Specification}
  4127. */
  4128. function TAP13Producer() {
  4129. /**
  4130. * Writes the TAP version to reporter output stream.
  4131. * @override
  4132. */
  4133. this.writeVersion = function() {
  4134. println('TAP version 13');
  4135. };
  4136. /**
  4137. * Writes that test failed to reporter output stream, with error formatting.
  4138. * @override
  4139. */
  4140. this.writeFail = function(n, test, err) {
  4141. TAPProducer.prototype.writeFail.call(this, n, test, err);
  4142. var emitYamlBlock = err.message != null || err.stack != null;
  4143. if (emitYamlBlock) {
  4144. println(indent(1) + '---');
  4145. if (err.message) {
  4146. println(indent(2) + 'message: |-');
  4147. println(err.message.replace(/^/gm, indent(3)));
  4148. }
  4149. if (err.stack) {
  4150. println(indent(2) + 'stack: |-');
  4151. println(err.stack.replace(/^/gm, indent(3)));
  4152. }
  4153. println(indent(1) + '...');
  4154. }
  4155. };
  4156. function indent(level) {
  4157. return Array(level + 1).join(' ');
  4158. }
  4159. }
  4160. /**
  4161. * Inherit from `TAPProducer.prototype`.
  4162. */
  4163. inherits(TAP13Producer, TAPProducer);
  4164. TAP.description = 'TAP-compatible output';
  4165. }).call(this,require('_process'))
  4166. },{"../runner":34,"../utils":38,"./base":17,"_process":69,"util":89}],32:[function(require,module,exports){
  4167. (function (process,global){
  4168. 'use strict';
  4169. /**
  4170. * @module XUnit
  4171. */
  4172. /**
  4173. * Module dependencies.
  4174. */
  4175. var Base = require('./base');
  4176. var utils = require('../utils');
  4177. var fs = require('fs');
  4178. var mkdirp = require('mkdirp');
  4179. var path = require('path');
  4180. var errors = require('../errors');
  4181. var createUnsupportedError = errors.createUnsupportedError;
  4182. var constants = require('../runner').constants;
  4183. var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
  4184. var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
  4185. var EVENT_RUN_END = constants.EVENT_RUN_END;
  4186. var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
  4187. var STATE_FAILED = require('../runnable').constants.STATE_FAILED;
  4188. var inherits = utils.inherits;
  4189. var escape = utils.escape;
  4190. /**
  4191. * Save timer references to avoid Sinon interfering (see GH-237).
  4192. */
  4193. var Date = global.Date;
  4194. /**
  4195. * Expose `XUnit`.
  4196. */
  4197. exports = module.exports = XUnit;
  4198. /**
  4199. * Constructs a new `XUnit` reporter instance.
  4200. *
  4201. * @public
  4202. * @class
  4203. * @memberof Mocha.reporters
  4204. * @extends Mocha.reporters.Base
  4205. * @param {Runner} runner - Instance triggers reporter actions.
  4206. * @param {Object} [options] - runner options
  4207. */
  4208. function XUnit(runner, options) {
  4209. Base.call(this, runner, options);
  4210. var stats = this.stats;
  4211. var tests = [];
  4212. var self = this;
  4213. // the name of the test suite, as it will appear in the resulting XML file
  4214. var suiteName;
  4215. // the default name of the test suite if none is provided
  4216. var DEFAULT_SUITE_NAME = 'Mocha Tests';
  4217. if (options && options.reporterOptions) {
  4218. if (options.reporterOptions.output) {
  4219. if (!fs.createWriteStream) {
  4220. throw createUnsupportedError('file output not supported in browser');
  4221. }
  4222. mkdirp.sync(path.dirname(options.reporterOptions.output));
  4223. self.fileStream = fs.createWriteStream(options.reporterOptions.output);
  4224. }
  4225. // get the suite name from the reporter options (if provided)
  4226. suiteName = options.reporterOptions.suiteName;
  4227. }
  4228. // fall back to the default suite name
  4229. suiteName = suiteName || DEFAULT_SUITE_NAME;
  4230. runner.on(EVENT_TEST_PENDING, function(test) {
  4231. tests.push(test);
  4232. });
  4233. runner.on(EVENT_TEST_PASS, function(test) {
  4234. tests.push(test);
  4235. });
  4236. runner.on(EVENT_TEST_FAIL, function(test) {
  4237. tests.push(test);
  4238. });
  4239. runner.once(EVENT_RUN_END, function() {
  4240. self.write(
  4241. tag(
  4242. 'testsuite',
  4243. {
  4244. name: suiteName,
  4245. tests: stats.tests,
  4246. failures: 0,
  4247. errors: stats.failures,
  4248. skipped: stats.tests - stats.failures - stats.passes,
  4249. timestamp: new Date().toUTCString(),
  4250. time: stats.duration / 1000 || 0
  4251. },
  4252. false
  4253. )
  4254. );
  4255. tests.forEach(function(t) {
  4256. self.test(t);
  4257. });
  4258. self.write('</testsuite>');
  4259. });
  4260. }
  4261. /**
  4262. * Inherit from `Base.prototype`.
  4263. */
  4264. inherits(XUnit, Base);
  4265. /**
  4266. * Override done to close the stream (if it's a file).
  4267. *
  4268. * @param failures
  4269. * @param {Function} fn
  4270. */
  4271. XUnit.prototype.done = function(failures, fn) {
  4272. if (this.fileStream) {
  4273. this.fileStream.end(function() {
  4274. fn(failures);
  4275. });
  4276. } else {
  4277. fn(failures);
  4278. }
  4279. };
  4280. /**
  4281. * Write out the given line.
  4282. *
  4283. * @param {string} line
  4284. */
  4285. XUnit.prototype.write = function(line) {
  4286. if (this.fileStream) {
  4287. this.fileStream.write(line + '\n');
  4288. } else if (typeof process === 'object' && process.stdout) {
  4289. process.stdout.write(line + '\n');
  4290. } else {
  4291. console.log(line);
  4292. }
  4293. };
  4294. /**
  4295. * Output tag for the given `test.`
  4296. *
  4297. * @param {Test} test
  4298. */
  4299. XUnit.prototype.test = function(test) {
  4300. Base.useColors = false;
  4301. var attrs = {
  4302. classname: test.parent.fullTitle(),
  4303. name: test.title,
  4304. time: test.duration / 1000 || 0
  4305. };
  4306. if (test.state === STATE_FAILED) {
  4307. var err = test.err;
  4308. var diff =
  4309. Base.hideDiff || !err.actual || !err.expected
  4310. ? ''
  4311. : '\n' + Base.generateDiff(err.actual, err.expected);
  4312. this.write(
  4313. tag(
  4314. 'testcase',
  4315. attrs,
  4316. false,
  4317. tag(
  4318. 'failure',
  4319. {},
  4320. false,
  4321. escape(err.message) + escape(diff) + '\n' + escape(err.stack)
  4322. )
  4323. )
  4324. );
  4325. } else if (test.isPending()) {
  4326. this.write(tag('testcase', attrs, false, tag('skipped', {}, true)));
  4327. } else {
  4328. this.write(tag('testcase', attrs, true));
  4329. }
  4330. };
  4331. /**
  4332. * HTML tag helper.
  4333. *
  4334. * @param name
  4335. * @param attrs
  4336. * @param close
  4337. * @param content
  4338. * @return {string}
  4339. */
  4340. function tag(name, attrs, close, content) {
  4341. var end = close ? '/>' : '>';
  4342. var pairs = [];
  4343. var tag;
  4344. for (var key in attrs) {
  4345. if (Object.prototype.hasOwnProperty.call(attrs, key)) {
  4346. pairs.push(key + '="' + escape(attrs[key]) + '"');
  4347. }
  4348. }
  4349. tag = '<' + name + (pairs.length ? ' ' + pairs.join(' ') : '') + end;
  4350. if (content) {
  4351. tag += content + '</' + name + end;
  4352. }
  4353. return tag;
  4354. }
  4355. XUnit.description = 'XUnit-compatible XML output';
  4356. }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  4357. },{"../errors":6,"../runnable":33,"../runner":34,"../utils":38,"./base":17,"_process":69,"fs":42,"mkdirp":59,"path":42}],33:[function(require,module,exports){
  4358. (function (global){
  4359. 'use strict';
  4360. var EventEmitter = require('events').EventEmitter;
  4361. var Pending = require('./pending');
  4362. var debug = require('debug')('mocha:runnable');
  4363. var milliseconds = require('ms');
  4364. var utils = require('./utils');
  4365. var createInvalidExceptionError = require('./errors')
  4366. .createInvalidExceptionError;
  4367. /**
  4368. * Save timer references to avoid Sinon interfering (see GH-237).
  4369. */
  4370. var Date = global.Date;
  4371. var setTimeout = global.setTimeout;
  4372. var clearTimeout = global.clearTimeout;
  4373. var toString = Object.prototype.toString;
  4374. module.exports = Runnable;
  4375. /**
  4376. * Initialize a new `Runnable` with the given `title` and callback `fn`.
  4377. *
  4378. * @class
  4379. * @extends external:EventEmitter
  4380. * @public
  4381. * @param {String} title
  4382. * @param {Function} fn
  4383. */
  4384. function Runnable(title, fn) {
  4385. this.title = title;
  4386. this.fn = fn;
  4387. this.body = (fn || '').toString();
  4388. this.async = fn && fn.length;
  4389. this.sync = !this.async;
  4390. this._timeout = 2000;
  4391. this._slow = 75;
  4392. this._enableTimeouts = true;
  4393. this.timedOut = false;
  4394. this._retries = -1;
  4395. this._currentRetry = 0;
  4396. this.pending = false;
  4397. }
  4398. /**
  4399. * Inherit from `EventEmitter.prototype`.
  4400. */
  4401. utils.inherits(Runnable, EventEmitter);
  4402. /**
  4403. * Get current timeout value in msecs.
  4404. *
  4405. * @private
  4406. * @returns {number} current timeout threshold value
  4407. */
  4408. /**
  4409. * @summary
  4410. * Set timeout threshold value (msecs).
  4411. *
  4412. * @description
  4413. * A string argument can use shorthand (e.g., "2s") and will be converted.
  4414. * The value will be clamped to range [<code>0</code>, <code>2^<sup>31</sup>-1</code>].
  4415. * If clamped value matches either range endpoint, timeouts will be disabled.
  4416. *
  4417. * @private
  4418. * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout#Maximum_delay_value}
  4419. * @param {number|string} ms - Timeout threshold value.
  4420. * @returns {Runnable} this
  4421. * @chainable
  4422. */
  4423. Runnable.prototype.timeout = function(ms) {
  4424. if (!arguments.length) {
  4425. return this._timeout;
  4426. }
  4427. if (typeof ms === 'string') {
  4428. ms = milliseconds(ms);
  4429. }
  4430. // Clamp to range
  4431. var INT_MAX = Math.pow(2, 31) - 1;
  4432. var range = [0, INT_MAX];
  4433. ms = utils.clamp(ms, range);
  4434. // see #1652 for reasoning
  4435. if (ms === range[0] || ms === range[1]) {
  4436. this._enableTimeouts = false;
  4437. }
  4438. debug('timeout %d', ms);
  4439. this._timeout = ms;
  4440. if (this.timer) {
  4441. this.resetTimeout();
  4442. }
  4443. return this;
  4444. };
  4445. /**
  4446. * Set or get slow `ms`.
  4447. *
  4448. * @private
  4449. * @param {number|string} ms
  4450. * @return {Runnable|number} ms or Runnable instance.
  4451. */
  4452. Runnable.prototype.slow = function(ms) {
  4453. if (!arguments.length || typeof ms === 'undefined') {
  4454. return this._slow;
  4455. }
  4456. if (typeof ms === 'string') {
  4457. ms = milliseconds(ms);
  4458. }
  4459. debug('slow %d', ms);
  4460. this._slow = ms;
  4461. return this;
  4462. };
  4463. /**
  4464. * Set and get whether timeout is `enabled`.
  4465. *
  4466. * @private
  4467. * @param {boolean} enabled
  4468. * @return {Runnable|boolean} enabled or Runnable instance.
  4469. */
  4470. Runnable.prototype.enableTimeouts = function(enabled) {
  4471. if (!arguments.length) {
  4472. return this._enableTimeouts;
  4473. }
  4474. debug('enableTimeouts %s', enabled);
  4475. this._enableTimeouts = enabled;
  4476. return this;
  4477. };
  4478. /**
  4479. * Halt and mark as pending.
  4480. *
  4481. * @memberof Mocha.Runnable
  4482. * @public
  4483. */
  4484. Runnable.prototype.skip = function() {
  4485. throw new Pending('sync skip');
  4486. };
  4487. /**
  4488. * Check if this runnable or its parent suite is marked as pending.
  4489. *
  4490. * @private
  4491. */
  4492. Runnable.prototype.isPending = function() {
  4493. return this.pending || (this.parent && this.parent.isPending());
  4494. };
  4495. /**
  4496. * Return `true` if this Runnable has failed.
  4497. * @return {boolean}
  4498. * @private
  4499. */
  4500. Runnable.prototype.isFailed = function() {
  4501. return !this.isPending() && this.state === constants.STATE_FAILED;
  4502. };
  4503. /**
  4504. * Return `true` if this Runnable has passed.
  4505. * @return {boolean}
  4506. * @private
  4507. */
  4508. Runnable.prototype.isPassed = function() {
  4509. return !this.isPending() && this.state === constants.STATE_PASSED;
  4510. };
  4511. /**
  4512. * Set or get number of retries.
  4513. *
  4514. * @private
  4515. */
  4516. Runnable.prototype.retries = function(n) {
  4517. if (!arguments.length) {
  4518. return this._retries;
  4519. }
  4520. this._retries = n;
  4521. };
  4522. /**
  4523. * Set or get current retry
  4524. *
  4525. * @private
  4526. */
  4527. Runnable.prototype.currentRetry = function(n) {
  4528. if (!arguments.length) {
  4529. return this._currentRetry;
  4530. }
  4531. this._currentRetry = n;
  4532. };
  4533. /**
  4534. * Return the full title generated by recursively concatenating the parent's
  4535. * full title.
  4536. *
  4537. * @memberof Mocha.Runnable
  4538. * @public
  4539. * @return {string}
  4540. */
  4541. Runnable.prototype.fullTitle = function() {
  4542. return this.titlePath().join(' ');
  4543. };
  4544. /**
  4545. * Return the title path generated by concatenating the parent's title path with the title.
  4546. *
  4547. * @memberof Mocha.Runnable
  4548. * @public
  4549. * @return {string}
  4550. */
  4551. Runnable.prototype.titlePath = function() {
  4552. return this.parent.titlePath().concat([this.title]);
  4553. };
  4554. /**
  4555. * Clear the timeout.
  4556. *
  4557. * @private
  4558. */
  4559. Runnable.prototype.clearTimeout = function() {
  4560. clearTimeout(this.timer);
  4561. };
  4562. /**
  4563. * Inspect the runnable void of private properties.
  4564. *
  4565. * @private
  4566. * @return {string}
  4567. */
  4568. Runnable.prototype.inspect = function() {
  4569. return JSON.stringify(
  4570. this,
  4571. function(key, val) {
  4572. if (key[0] === '_') {
  4573. return;
  4574. }
  4575. if (key === 'parent') {
  4576. return '#<Suite>';
  4577. }
  4578. if (key === 'ctx') {
  4579. return '#<Context>';
  4580. }
  4581. return val;
  4582. },
  4583. 2
  4584. );
  4585. };
  4586. /**
  4587. * Reset the timeout.
  4588. *
  4589. * @private
  4590. */
  4591. Runnable.prototype.resetTimeout = function() {
  4592. var self = this;
  4593. var ms = this.timeout() || 1e9;
  4594. if (!this._enableTimeouts) {
  4595. return;
  4596. }
  4597. this.clearTimeout();
  4598. this.timer = setTimeout(function() {
  4599. if (!self._enableTimeouts) {
  4600. return;
  4601. }
  4602. self.callback(self._timeoutError(ms));
  4603. self.timedOut = true;
  4604. }, ms);
  4605. };
  4606. /**
  4607. * Set or get a list of whitelisted globals for this test run.
  4608. *
  4609. * @private
  4610. * @param {string[]} globals
  4611. */
  4612. Runnable.prototype.globals = function(globals) {
  4613. if (!arguments.length) {
  4614. return this._allowedGlobals;
  4615. }
  4616. this._allowedGlobals = globals;
  4617. };
  4618. /**
  4619. * Run the test and invoke `fn(err)`.
  4620. *
  4621. * @param {Function} fn
  4622. * @private
  4623. */
  4624. Runnable.prototype.run = function(fn) {
  4625. var self = this;
  4626. var start = new Date();
  4627. var ctx = this.ctx;
  4628. var finished;
  4629. var emitted;
  4630. // Sometimes the ctx exists, but it is not runnable
  4631. if (ctx && ctx.runnable) {
  4632. ctx.runnable(this);
  4633. }
  4634. // called multiple times
  4635. function multiple(err) {
  4636. if (emitted) {
  4637. return;
  4638. }
  4639. emitted = true;
  4640. var msg = 'done() called multiple times';
  4641. if (err && err.message) {
  4642. err.message += " (and Mocha's " + msg + ')';
  4643. self.emit('error', err);
  4644. } else {
  4645. self.emit('error', new Error(msg));
  4646. }
  4647. }
  4648. // finished
  4649. function done(err) {
  4650. var ms = self.timeout();
  4651. if (self.timedOut) {
  4652. return;
  4653. }
  4654. if (finished) {
  4655. return multiple(err);
  4656. }
  4657. self.clearTimeout();
  4658. self.duration = new Date() - start;
  4659. finished = true;
  4660. if (!err && self.duration > ms && self._enableTimeouts) {
  4661. err = self._timeoutError(ms);
  4662. }
  4663. fn(err);
  4664. }
  4665. // for .resetTimeout()
  4666. this.callback = done;
  4667. // explicit async with `done` argument
  4668. if (this.async) {
  4669. this.resetTimeout();
  4670. // allows skip() to be used in an explicit async context
  4671. this.skip = function asyncSkip() {
  4672. done(new Pending('async skip call'));
  4673. // halt execution. the Runnable will be marked pending
  4674. // by the previous call, and the uncaught handler will ignore
  4675. // the failure.
  4676. throw new Pending('async skip; aborting execution');
  4677. };
  4678. if (this.allowUncaught) {
  4679. return callFnAsync(this.fn);
  4680. }
  4681. try {
  4682. callFnAsync(this.fn);
  4683. } catch (err) {
  4684. emitted = true;
  4685. done(Runnable.toValueOrError(err));
  4686. }
  4687. return;
  4688. }
  4689. if (this.allowUncaught) {
  4690. if (this.isPending()) {
  4691. done();
  4692. } else {
  4693. callFn(this.fn);
  4694. }
  4695. return;
  4696. }
  4697. // sync or promise-returning
  4698. try {
  4699. if (this.isPending()) {
  4700. done();
  4701. } else {
  4702. callFn(this.fn);
  4703. }
  4704. } catch (err) {
  4705. emitted = true;
  4706. done(Runnable.toValueOrError(err));
  4707. }
  4708. function callFn(fn) {
  4709. var result = fn.call(ctx);
  4710. if (result && typeof result.then === 'function') {
  4711. self.resetTimeout();
  4712. result.then(
  4713. function() {
  4714. done();
  4715. // Return null so libraries like bluebird do not warn about
  4716. // subsequently constructed Promises.
  4717. return null;
  4718. },
  4719. function(reason) {
  4720. done(reason || new Error('Promise rejected with no or falsy reason'));
  4721. }
  4722. );
  4723. } else {
  4724. if (self.asyncOnly) {
  4725. return done(
  4726. new Error(
  4727. '--async-only option in use without declaring `done()` or returning a promise'
  4728. )
  4729. );
  4730. }
  4731. done();
  4732. }
  4733. }
  4734. function callFnAsync(fn) {
  4735. var result = fn.call(ctx, function(err) {
  4736. if (err instanceof Error || toString.call(err) === '[object Error]') {
  4737. return done(err);
  4738. }
  4739. if (err) {
  4740. if (Object.prototype.toString.call(err) === '[object Object]') {
  4741. return done(
  4742. new Error('done() invoked with non-Error: ' + JSON.stringify(err))
  4743. );
  4744. }
  4745. return done(new Error('done() invoked with non-Error: ' + err));
  4746. }
  4747. if (result && utils.isPromise(result)) {
  4748. return done(
  4749. new Error(
  4750. 'Resolution method is overspecified. Specify a callback *or* return a Promise; not both.'
  4751. )
  4752. );
  4753. }
  4754. done();
  4755. });
  4756. }
  4757. };
  4758. /**
  4759. * Instantiates a "timeout" error
  4760. *
  4761. * @param {number} ms - Timeout (in milliseconds)
  4762. * @returns {Error} a "timeout" error
  4763. * @private
  4764. */
  4765. Runnable.prototype._timeoutError = function(ms) {
  4766. var msg =
  4767. 'Timeout of ' +
  4768. ms +
  4769. 'ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.';
  4770. if (this.file) {
  4771. msg += ' (' + this.file + ')';
  4772. }
  4773. return new Error(msg);
  4774. };
  4775. var constants = utils.defineConstants(
  4776. /**
  4777. * {@link Runnable}-related constants.
  4778. * @public
  4779. * @memberof Runnable
  4780. * @readonly
  4781. * @static
  4782. * @alias constants
  4783. * @enum {string}
  4784. */
  4785. {
  4786. /**
  4787. * Value of `state` prop when a `Runnable` has failed
  4788. */
  4789. STATE_FAILED: 'failed',
  4790. /**
  4791. * Value of `state` prop when a `Runnable` has passed
  4792. */
  4793. STATE_PASSED: 'passed'
  4794. }
  4795. );
  4796. /**
  4797. * Given `value`, return identity if truthy, otherwise create an "invalid exception" error and return that.
  4798. * @param {*} [value] - Value to return, if present
  4799. * @returns {*|Error} `value`, otherwise an `Error`
  4800. * @private
  4801. */
  4802. Runnable.toValueOrError = function(value) {
  4803. return (
  4804. value ||
  4805. createInvalidExceptionError(
  4806. 'Runnable failed with falsy or undefined exception. Please throw an Error instead.',
  4807. value
  4808. )
  4809. );
  4810. };
  4811. Runnable.constants = constants;
  4812. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  4813. },{"./errors":6,"./pending":16,"./utils":38,"debug":45,"events":50,"ms":60}],34:[function(require,module,exports){
  4814. (function (process,global){
  4815. 'use strict';
  4816. /**
  4817. * Module dependencies.
  4818. */
  4819. var util = require('util');
  4820. var EventEmitter = require('events').EventEmitter;
  4821. var Pending = require('./pending');
  4822. var utils = require('./utils');
  4823. var inherits = utils.inherits;
  4824. var debug = require('debug')('mocha:runner');
  4825. var Runnable = require('./runnable');
  4826. var Suite = require('./suite');
  4827. var HOOK_TYPE_BEFORE_EACH = Suite.constants.HOOK_TYPE_BEFORE_EACH;
  4828. var HOOK_TYPE_AFTER_EACH = Suite.constants.HOOK_TYPE_AFTER_EACH;
  4829. var HOOK_TYPE_AFTER_ALL = Suite.constants.HOOK_TYPE_AFTER_ALL;
  4830. var HOOK_TYPE_BEFORE_ALL = Suite.constants.HOOK_TYPE_BEFORE_ALL;
  4831. var EVENT_ROOT_SUITE_RUN = Suite.constants.EVENT_ROOT_SUITE_RUN;
  4832. var STATE_FAILED = Runnable.constants.STATE_FAILED;
  4833. var STATE_PASSED = Runnable.constants.STATE_PASSED;
  4834. var dQuote = utils.dQuote;
  4835. var ngettext = utils.ngettext;
  4836. var sQuote = utils.sQuote;
  4837. var stackFilter = utils.stackTraceFilter();
  4838. var stringify = utils.stringify;
  4839. var type = utils.type;
  4840. var createInvalidExceptionError = require('./errors')
  4841. .createInvalidExceptionError;
  4842. /**
  4843. * Non-enumerable globals.
  4844. * @readonly
  4845. */
  4846. var globals = [
  4847. 'setTimeout',
  4848. 'clearTimeout',
  4849. 'setInterval',
  4850. 'clearInterval',
  4851. 'XMLHttpRequest',
  4852. 'Date',
  4853. 'setImmediate',
  4854. 'clearImmediate'
  4855. ];
  4856. var constants = utils.defineConstants(
  4857. /**
  4858. * {@link Runner}-related constants.
  4859. * @public
  4860. * @memberof Runner
  4861. * @readonly
  4862. * @alias constants
  4863. * @static
  4864. * @enum {string}
  4865. */
  4866. {
  4867. /**
  4868. * Emitted when {@link Hook} execution begins
  4869. */
  4870. EVENT_HOOK_BEGIN: 'hook',
  4871. /**
  4872. * Emitted when {@link Hook} execution ends
  4873. */
  4874. EVENT_HOOK_END: 'hook end',
  4875. /**
  4876. * Emitted when Root {@link Suite} execution begins (all files have been parsed and hooks/tests are ready for execution)
  4877. */
  4878. EVENT_RUN_BEGIN: 'start',
  4879. /**
  4880. * Emitted when Root {@link Suite} execution has been delayed via `delay` option
  4881. */
  4882. EVENT_DELAY_BEGIN: 'waiting',
  4883. /**
  4884. * Emitted when delayed Root {@link Suite} execution is triggered by user via `global.run()`
  4885. */
  4886. EVENT_DELAY_END: 'ready',
  4887. /**
  4888. * Emitted when Root {@link Suite} execution ends
  4889. */
  4890. EVENT_RUN_END: 'end',
  4891. /**
  4892. * Emitted when {@link Suite} execution begins
  4893. */
  4894. EVENT_SUITE_BEGIN: 'suite',
  4895. /**
  4896. * Emitted when {@link Suite} execution ends
  4897. */
  4898. EVENT_SUITE_END: 'suite end',
  4899. /**
  4900. * Emitted when {@link Test} execution begins
  4901. */
  4902. EVENT_TEST_BEGIN: 'test',
  4903. /**
  4904. * Emitted when {@link Test} execution ends
  4905. */
  4906. EVENT_TEST_END: 'test end',
  4907. /**
  4908. * Emitted when {@link Test} execution fails
  4909. */
  4910. EVENT_TEST_FAIL: 'fail',
  4911. /**
  4912. * Emitted when {@link Test} execution succeeds
  4913. */
  4914. EVENT_TEST_PASS: 'pass',
  4915. /**
  4916. * Emitted when {@link Test} becomes pending
  4917. */
  4918. EVENT_TEST_PENDING: 'pending',
  4919. /**
  4920. * Emitted when {@link Test} execution has failed, but will retry
  4921. */
  4922. EVENT_TEST_RETRY: 'retry'
  4923. }
  4924. );
  4925. module.exports = Runner;
  4926. /**
  4927. * Initialize a `Runner` at the Root {@link Suite}, which represents a hierarchy of {@link Suite|Suites} and {@link Test|Tests}.
  4928. *
  4929. * @extends external:EventEmitter
  4930. * @public
  4931. * @class
  4932. * @param {Suite} suite Root suite
  4933. * @param {boolean} [delay] Whether or not to delay execution of root suite
  4934. * until ready.
  4935. */
  4936. function Runner(suite, delay) {
  4937. var self = this;
  4938. this._globals = [];
  4939. this._abort = false;
  4940. this._delay = delay;
  4941. this.suite = suite;
  4942. this.started = false;
  4943. this.total = suite.total();
  4944. this.failures = 0;
  4945. this.on(constants.EVENT_TEST_END, function(test) {
  4946. self.checkGlobals(test);
  4947. });
  4948. this.on(constants.EVENT_HOOK_END, function(hook) {
  4949. self.checkGlobals(hook);
  4950. });
  4951. this._defaultGrep = /.*/;
  4952. this.grep(this._defaultGrep);
  4953. this.globals(this.globalProps().concat(extraGlobals()));
  4954. }
  4955. /**
  4956. * Wrapper for setImmediate, process.nextTick, or browser polyfill.
  4957. *
  4958. * @param {Function} fn
  4959. * @private
  4960. */
  4961. Runner.immediately = global.setImmediate || process.nextTick;
  4962. /**
  4963. * Inherit from `EventEmitter.prototype`.
  4964. */
  4965. inherits(Runner, EventEmitter);
  4966. /**
  4967. * Run tests with full titles matching `re`. Updates runner.total
  4968. * with number of tests matched.
  4969. *
  4970. * @public
  4971. * @memberof Runner
  4972. * @param {RegExp} re
  4973. * @param {boolean} invert
  4974. * @return {Runner} Runner instance.
  4975. */
  4976. Runner.prototype.grep = function(re, invert) {
  4977. debug('grep %s', re);
  4978. this._grep = re;
  4979. this._invert = invert;
  4980. this.total = this.grepTotal(this.suite);
  4981. return this;
  4982. };
  4983. /**
  4984. * Returns the number of tests matching the grep search for the
  4985. * given suite.
  4986. *
  4987. * @memberof Runner
  4988. * @public
  4989. * @param {Suite} suite
  4990. * @return {number}
  4991. */
  4992. Runner.prototype.grepTotal = function(suite) {
  4993. var self = this;
  4994. var total = 0;
  4995. suite.eachTest(function(test) {
  4996. var match = self._grep.test(test.fullTitle());
  4997. if (self._invert) {
  4998. match = !match;
  4999. }
  5000. if (match) {
  5001. total++;
  5002. }
  5003. });
  5004. return total;
  5005. };
  5006. /**
  5007. * Return a list of global properties.
  5008. *
  5009. * @return {Array}
  5010. * @private
  5011. */
  5012. Runner.prototype.globalProps = function() {
  5013. var props = Object.keys(global);
  5014. // non-enumerables
  5015. for (var i = 0; i < globals.length; ++i) {
  5016. if (~props.indexOf(globals[i])) {
  5017. continue;
  5018. }
  5019. props.push(globals[i]);
  5020. }
  5021. return props;
  5022. };
  5023. /**
  5024. * Allow the given `arr` of globals.
  5025. *
  5026. * @public
  5027. * @memberof Runner
  5028. * @param {Array} arr
  5029. * @return {Runner} Runner instance.
  5030. */
  5031. Runner.prototype.globals = function(arr) {
  5032. if (!arguments.length) {
  5033. return this._globals;
  5034. }
  5035. debug('globals %j', arr);
  5036. this._globals = this._globals.concat(arr);
  5037. return this;
  5038. };
  5039. /**
  5040. * Check for global variable leaks.
  5041. *
  5042. * @private
  5043. */
  5044. Runner.prototype.checkGlobals = function(test) {
  5045. if (this.ignoreLeaks) {
  5046. return;
  5047. }
  5048. var ok = this._globals;
  5049. var globals = this.globalProps();
  5050. var leaks;
  5051. if (test) {
  5052. ok = ok.concat(test._allowedGlobals || []);
  5053. }
  5054. if (this.prevGlobalsLength === globals.length) {
  5055. return;
  5056. }
  5057. this.prevGlobalsLength = globals.length;
  5058. leaks = filterLeaks(ok, globals);
  5059. this._globals = this._globals.concat(leaks);
  5060. if (leaks.length) {
  5061. var format = ngettext(
  5062. leaks.length,
  5063. 'global leak detected: %s',
  5064. 'global leaks detected: %s'
  5065. );
  5066. var error = new Error(util.format(format, leaks.map(sQuote).join(', ')));
  5067. this.fail(test, error);
  5068. }
  5069. };
  5070. /**
  5071. * Fail the given `test`.
  5072. *
  5073. * @private
  5074. * @param {Test} test
  5075. * @param {Error} err
  5076. */
  5077. Runner.prototype.fail = function(test, err) {
  5078. if (test.isPending()) {
  5079. return;
  5080. }
  5081. ++this.failures;
  5082. test.state = STATE_FAILED;
  5083. if (!isError(err)) {
  5084. err = thrown2Error(err);
  5085. }
  5086. try {
  5087. err.stack =
  5088. this.fullStackTrace || !err.stack ? err.stack : stackFilter(err.stack);
  5089. } catch (ignore) {
  5090. // some environments do not take kindly to monkeying with the stack
  5091. }
  5092. this.emit(constants.EVENT_TEST_FAIL, test, err);
  5093. };
  5094. /**
  5095. * Fail the given `hook` with `err`.
  5096. *
  5097. * Hook failures work in the following pattern:
  5098. * - If bail, run corresponding `after each` and `after` hooks,
  5099. * then exit
  5100. * - Failed `before` hook skips all tests in a suite and subsuites,
  5101. * but jumps to corresponding `after` hook
  5102. * - Failed `before each` hook skips remaining tests in a
  5103. * suite and jumps to corresponding `after each` hook,
  5104. * which is run only once
  5105. * - Failed `after` hook does not alter
  5106. * execution order
  5107. * - Failed `after each` hook skips remaining tests in a
  5108. * suite and subsuites, but executes other `after each`
  5109. * hooks
  5110. *
  5111. * @private
  5112. * @param {Hook} hook
  5113. * @param {Error} err
  5114. */
  5115. Runner.prototype.failHook = function(hook, err) {
  5116. hook.originalTitle = hook.originalTitle || hook.title;
  5117. if (hook.ctx && hook.ctx.currentTest) {
  5118. hook.title =
  5119. hook.originalTitle + ' for ' + dQuote(hook.ctx.currentTest.title);
  5120. } else {
  5121. var parentTitle;
  5122. if (hook.parent.title) {
  5123. parentTitle = hook.parent.title;
  5124. } else {
  5125. parentTitle = hook.parent.root ? '{root}' : '';
  5126. }
  5127. hook.title = hook.originalTitle + ' in ' + dQuote(parentTitle);
  5128. }
  5129. this.fail(hook, err);
  5130. };
  5131. /**
  5132. * Run hook `name` callbacks and then invoke `fn()`.
  5133. *
  5134. * @private
  5135. * @param {string} name
  5136. * @param {Function} fn
  5137. */
  5138. Runner.prototype.hook = function(name, fn) {
  5139. var suite = this.suite;
  5140. var hooks = suite.getHooks(name);
  5141. var self = this;
  5142. function next(i) {
  5143. var hook = hooks[i];
  5144. if (!hook) {
  5145. return fn();
  5146. }
  5147. self.currentRunnable = hook;
  5148. if (name === HOOK_TYPE_BEFORE_ALL) {
  5149. hook.ctx.currentTest = hook.parent.tests[0];
  5150. } else if (name === HOOK_TYPE_AFTER_ALL) {
  5151. hook.ctx.currentTest = hook.parent.tests[hook.parent.tests.length - 1];
  5152. } else {
  5153. hook.ctx.currentTest = self.test;
  5154. }
  5155. hook.allowUncaught = self.allowUncaught;
  5156. self.emit(constants.EVENT_HOOK_BEGIN, hook);
  5157. if (!hook.listeners('error').length) {
  5158. hook.on('error', function(err) {
  5159. self.failHook(hook, err);
  5160. });
  5161. }
  5162. hook.run(function(err) {
  5163. var testError = hook.error();
  5164. if (testError) {
  5165. self.fail(self.test, testError);
  5166. }
  5167. if (err) {
  5168. if (err instanceof Pending) {
  5169. if (name === HOOK_TYPE_AFTER_ALL) {
  5170. utils.deprecate(
  5171. 'Skipping a test within an "after all" hook is DEPRECATED and will throw an exception in a future version of Mocha. ' +
  5172. 'Use a return statement or other means to abort hook execution.'
  5173. );
  5174. }
  5175. if (name === HOOK_TYPE_BEFORE_EACH || name === HOOK_TYPE_AFTER_EACH) {
  5176. if (self.test) {
  5177. self.test.pending = true;
  5178. }
  5179. } else {
  5180. suite.tests.forEach(function(test) {
  5181. test.pending = true;
  5182. });
  5183. suite.suites.forEach(function(suite) {
  5184. suite.pending = true;
  5185. });
  5186. // a pending hook won't be executed twice.
  5187. hook.pending = true;
  5188. }
  5189. } else {
  5190. self.failHook(hook, err);
  5191. // stop executing hooks, notify callee of hook err
  5192. return fn(err);
  5193. }
  5194. }
  5195. self.emit(constants.EVENT_HOOK_END, hook);
  5196. delete hook.ctx.currentTest;
  5197. next(++i);
  5198. });
  5199. }
  5200. Runner.immediately(function() {
  5201. next(0);
  5202. });
  5203. };
  5204. /**
  5205. * Run hook `name` for the given array of `suites`
  5206. * in order, and callback `fn(err, errSuite)`.
  5207. *
  5208. * @private
  5209. * @param {string} name
  5210. * @param {Array} suites
  5211. * @param {Function} fn
  5212. */
  5213. Runner.prototype.hooks = function(name, suites, fn) {
  5214. var self = this;
  5215. var orig = this.suite;
  5216. function next(suite) {
  5217. self.suite = suite;
  5218. if (!suite) {
  5219. self.suite = orig;
  5220. return fn();
  5221. }
  5222. self.hook(name, function(err) {
  5223. if (err) {
  5224. var errSuite = self.suite;
  5225. self.suite = orig;
  5226. return fn(err, errSuite);
  5227. }
  5228. next(suites.pop());
  5229. });
  5230. }
  5231. next(suites.pop());
  5232. };
  5233. /**
  5234. * Run hooks from the top level down.
  5235. *
  5236. * @param {String} name
  5237. * @param {Function} fn
  5238. * @private
  5239. */
  5240. Runner.prototype.hookUp = function(name, fn) {
  5241. var suites = [this.suite].concat(this.parents()).reverse();
  5242. this.hooks(name, suites, fn);
  5243. };
  5244. /**
  5245. * Run hooks from the bottom up.
  5246. *
  5247. * @param {String} name
  5248. * @param {Function} fn
  5249. * @private
  5250. */
  5251. Runner.prototype.hookDown = function(name, fn) {
  5252. var suites = [this.suite].concat(this.parents());
  5253. this.hooks(name, suites, fn);
  5254. };
  5255. /**
  5256. * Return an array of parent Suites from
  5257. * closest to furthest.
  5258. *
  5259. * @return {Array}
  5260. * @private
  5261. */
  5262. Runner.prototype.parents = function() {
  5263. var suite = this.suite;
  5264. var suites = [];
  5265. while (suite.parent) {
  5266. suite = suite.parent;
  5267. suites.push(suite);
  5268. }
  5269. return suites;
  5270. };
  5271. /**
  5272. * Run the current test and callback `fn(err)`.
  5273. *
  5274. * @param {Function} fn
  5275. * @private
  5276. */
  5277. Runner.prototype.runTest = function(fn) {
  5278. var self = this;
  5279. var test = this.test;
  5280. if (!test) {
  5281. return;
  5282. }
  5283. var suite = this.parents().reverse()[0] || this.suite;
  5284. if (this.forbidOnly && suite.hasOnly()) {
  5285. fn(new Error('`.only` forbidden'));
  5286. return;
  5287. }
  5288. if (this.asyncOnly) {
  5289. test.asyncOnly = true;
  5290. }
  5291. test.on('error', function(err) {
  5292. self.fail(test, err);
  5293. });
  5294. if (this.allowUncaught) {
  5295. test.allowUncaught = true;
  5296. return test.run(fn);
  5297. }
  5298. try {
  5299. test.run(fn);
  5300. } catch (err) {
  5301. fn(err);
  5302. }
  5303. };
  5304. /**
  5305. * Run tests in the given `suite` and invoke the callback `fn()` when complete.
  5306. *
  5307. * @private
  5308. * @param {Suite} suite
  5309. * @param {Function} fn
  5310. */
  5311. Runner.prototype.runTests = function(suite, fn) {
  5312. var self = this;
  5313. var tests = suite.tests.slice();
  5314. var test;
  5315. function hookErr(_, errSuite, after) {
  5316. // before/after Each hook for errSuite failed:
  5317. var orig = self.suite;
  5318. // for failed 'after each' hook start from errSuite parent,
  5319. // otherwise start from errSuite itself
  5320. self.suite = after ? errSuite.parent : errSuite;
  5321. if (self.suite) {
  5322. // call hookUp afterEach
  5323. self.hookUp(HOOK_TYPE_AFTER_EACH, function(err2, errSuite2) {
  5324. self.suite = orig;
  5325. // some hooks may fail even now
  5326. if (err2) {
  5327. return hookErr(err2, errSuite2, true);
  5328. }
  5329. // report error suite
  5330. fn(errSuite);
  5331. });
  5332. } else {
  5333. // there is no need calling other 'after each' hooks
  5334. self.suite = orig;
  5335. fn(errSuite);
  5336. }
  5337. }
  5338. function next(err, errSuite) {
  5339. // if we bail after first err
  5340. if (self.failures && suite._bail) {
  5341. tests = [];
  5342. }
  5343. if (self._abort) {
  5344. return fn();
  5345. }
  5346. if (err) {
  5347. return hookErr(err, errSuite, true);
  5348. }
  5349. // next test
  5350. test = tests.shift();
  5351. // all done
  5352. if (!test) {
  5353. return fn();
  5354. }
  5355. // grep
  5356. var match = self._grep.test(test.fullTitle());
  5357. if (self._invert) {
  5358. match = !match;
  5359. }
  5360. if (!match) {
  5361. // Run immediately only if we have defined a grep. When we
  5362. // define a grep — It can cause maximum callstack error if
  5363. // the grep is doing a large recursive loop by neglecting
  5364. // all tests. The run immediately function also comes with
  5365. // a performance cost. So we don't want to run immediately
  5366. // if we run the whole test suite, because running the whole
  5367. // test suite don't do any immediate recursive loops. Thus,
  5368. // allowing a JS runtime to breathe.
  5369. if (self._grep !== self._defaultGrep) {
  5370. Runner.immediately(next);
  5371. } else {
  5372. next();
  5373. }
  5374. return;
  5375. }
  5376. if (test.isPending()) {
  5377. if (self.forbidPending) {
  5378. test.isPending = alwaysFalse;
  5379. self.fail(test, new Error('Pending test forbidden'));
  5380. delete test.isPending;
  5381. } else {
  5382. self.emit(constants.EVENT_TEST_PENDING, test);
  5383. }
  5384. self.emit(constants.EVENT_TEST_END, test);
  5385. return next();
  5386. }
  5387. // execute test and hook(s)
  5388. self.emit(constants.EVENT_TEST_BEGIN, (self.test = test));
  5389. self.hookDown(HOOK_TYPE_BEFORE_EACH, function(err, errSuite) {
  5390. if (test.isPending()) {
  5391. if (self.forbidPending) {
  5392. test.isPending = alwaysFalse;
  5393. self.fail(test, new Error('Pending test forbidden'));
  5394. delete test.isPending;
  5395. } else {
  5396. self.emit(constants.EVENT_TEST_PENDING, test);
  5397. }
  5398. self.emit(constants.EVENT_TEST_END, test);
  5399. return next();
  5400. }
  5401. if (err) {
  5402. return hookErr(err, errSuite, false);
  5403. }
  5404. self.currentRunnable = self.test;
  5405. self.runTest(function(err) {
  5406. test = self.test;
  5407. if (err) {
  5408. var retry = test.currentRetry();
  5409. if (err instanceof Pending && self.forbidPending) {
  5410. self.fail(test, new Error('Pending test forbidden'));
  5411. } else if (err instanceof Pending) {
  5412. test.pending = true;
  5413. self.emit(constants.EVENT_TEST_PENDING, test);
  5414. } else if (retry < test.retries()) {
  5415. var clonedTest = test.clone();
  5416. clonedTest.currentRetry(retry + 1);
  5417. tests.unshift(clonedTest);
  5418. self.emit(constants.EVENT_TEST_RETRY, test, err);
  5419. // Early return + hook trigger so that it doesn't
  5420. // increment the count wrong
  5421. return self.hookUp(HOOK_TYPE_AFTER_EACH, next);
  5422. } else {
  5423. self.fail(test, err);
  5424. }
  5425. self.emit(constants.EVENT_TEST_END, test);
  5426. if (err instanceof Pending) {
  5427. return next();
  5428. }
  5429. return self.hookUp(HOOK_TYPE_AFTER_EACH, next);
  5430. }
  5431. test.state = STATE_PASSED;
  5432. self.emit(constants.EVENT_TEST_PASS, test);
  5433. self.emit(constants.EVENT_TEST_END, test);
  5434. self.hookUp(HOOK_TYPE_AFTER_EACH, next);
  5435. });
  5436. });
  5437. }
  5438. this.next = next;
  5439. this.hookErr = hookErr;
  5440. next();
  5441. };
  5442. function alwaysFalse() {
  5443. return false;
  5444. }
  5445. /**
  5446. * Run the given `suite` and invoke the callback `fn()` when complete.
  5447. *
  5448. * @private
  5449. * @param {Suite} suite
  5450. * @param {Function} fn
  5451. */
  5452. Runner.prototype.runSuite = function(suite, fn) {
  5453. var i = 0;
  5454. var self = this;
  5455. var total = this.grepTotal(suite);
  5456. var afterAllHookCalled = false;
  5457. debug('run suite %s', suite.fullTitle());
  5458. if (!total || (self.failures && suite._bail)) {
  5459. return fn();
  5460. }
  5461. this.emit(constants.EVENT_SUITE_BEGIN, (this.suite = suite));
  5462. function next(errSuite) {
  5463. if (errSuite) {
  5464. // current suite failed on a hook from errSuite
  5465. if (errSuite === suite) {
  5466. // if errSuite is current suite
  5467. // continue to the next sibling suite
  5468. return done();
  5469. }
  5470. // errSuite is among the parents of current suite
  5471. // stop execution of errSuite and all sub-suites
  5472. return done(errSuite);
  5473. }
  5474. if (self._abort) {
  5475. return done();
  5476. }
  5477. var curr = suite.suites[i++];
  5478. if (!curr) {
  5479. return done();
  5480. }
  5481. // Avoid grep neglecting large number of tests causing a
  5482. // huge recursive loop and thus a maximum call stack error.
  5483. // See comment in `this.runTests()` for more information.
  5484. if (self._grep !== self._defaultGrep) {
  5485. Runner.immediately(function() {
  5486. self.runSuite(curr, next);
  5487. });
  5488. } else {
  5489. self.runSuite(curr, next);
  5490. }
  5491. }
  5492. function done(errSuite) {
  5493. self.suite = suite;
  5494. self.nextSuite = next;
  5495. if (afterAllHookCalled) {
  5496. fn(errSuite);
  5497. } else {
  5498. // mark that the afterAll block has been called once
  5499. // and so can be skipped if there is an error in it.
  5500. afterAllHookCalled = true;
  5501. // remove reference to test
  5502. delete self.test;
  5503. self.hook(HOOK_TYPE_AFTER_ALL, function() {
  5504. self.emit(constants.EVENT_SUITE_END, suite);
  5505. fn(errSuite);
  5506. });
  5507. }
  5508. }
  5509. this.nextSuite = next;
  5510. this.hook(HOOK_TYPE_BEFORE_ALL, function(err) {
  5511. if (err) {
  5512. return done();
  5513. }
  5514. self.runTests(suite, next);
  5515. });
  5516. };
  5517. /**
  5518. * Handle uncaught exceptions.
  5519. *
  5520. * @param {Error} err
  5521. * @private
  5522. */
  5523. Runner.prototype.uncaught = function(err) {
  5524. if (err instanceof Pending) {
  5525. return;
  5526. }
  5527. if (err) {
  5528. debug('uncaught exception %O', err);
  5529. } else {
  5530. debug('uncaught undefined/falsy exception');
  5531. err = createInvalidExceptionError(
  5532. 'Caught falsy/undefined exception which would otherwise be uncaught. No stack trace found; try a debugger',
  5533. err
  5534. );
  5535. }
  5536. if (!isError(err)) {
  5537. err = thrown2Error(err);
  5538. }
  5539. err.uncaught = true;
  5540. var runnable = this.currentRunnable;
  5541. if (!runnable) {
  5542. runnable = new Runnable('Uncaught error outside test suite');
  5543. runnable.parent = this.suite;
  5544. if (this.started) {
  5545. this.fail(runnable, err);
  5546. } else {
  5547. // Can't recover from this failure
  5548. this.emit(constants.EVENT_RUN_BEGIN);
  5549. this.fail(runnable, err);
  5550. this.emit(constants.EVENT_RUN_END);
  5551. }
  5552. return;
  5553. }
  5554. runnable.clearTimeout();
  5555. // Ignore errors if already failed or pending
  5556. // See #3226
  5557. if (runnable.isFailed() || runnable.isPending()) {
  5558. return;
  5559. }
  5560. // we cannot recover gracefully if a Runnable has already passed
  5561. // then fails asynchronously
  5562. var alreadyPassed = runnable.isPassed();
  5563. // this will change the state to "failed" regardless of the current value
  5564. this.fail(runnable, err);
  5565. if (!alreadyPassed) {
  5566. // recover from test
  5567. if (runnable.type === constants.EVENT_TEST_BEGIN) {
  5568. this.emit(constants.EVENT_TEST_END, runnable);
  5569. this.hookUp(HOOK_TYPE_AFTER_EACH, this.next);
  5570. return;
  5571. }
  5572. debug(runnable);
  5573. // recover from hooks
  5574. var errSuite = this.suite;
  5575. // XXX how about a less awful way to determine this?
  5576. // if hook failure is in afterEach block
  5577. if (runnable.fullTitle().indexOf('after each') > -1) {
  5578. return this.hookErr(err, errSuite, true);
  5579. }
  5580. // if hook failure is in beforeEach block
  5581. if (runnable.fullTitle().indexOf('before each') > -1) {
  5582. return this.hookErr(err, errSuite, false);
  5583. }
  5584. // if hook failure is in after or before blocks
  5585. return this.nextSuite(errSuite);
  5586. }
  5587. // bail
  5588. this.emit(constants.EVENT_RUN_END);
  5589. };
  5590. /**
  5591. * Run the root suite and invoke `fn(failures)`
  5592. * on completion.
  5593. *
  5594. * @public
  5595. * @memberof Runner
  5596. * @param {Function} fn
  5597. * @return {Runner} Runner instance.
  5598. */
  5599. Runner.prototype.run = function(fn) {
  5600. var self = this;
  5601. var rootSuite = this.suite;
  5602. fn = fn || function() {};
  5603. function uncaught(err) {
  5604. self.uncaught(err);
  5605. }
  5606. function start() {
  5607. // If there is an `only` filter
  5608. if (rootSuite.hasOnly()) {
  5609. rootSuite.filterOnly();
  5610. }
  5611. self.started = true;
  5612. if (self._delay) {
  5613. self.emit(constants.EVENT_DELAY_END);
  5614. }
  5615. self.emit(constants.EVENT_RUN_BEGIN);
  5616. self.runSuite(rootSuite, function() {
  5617. debug('finished running');
  5618. self.emit(constants.EVENT_RUN_END);
  5619. });
  5620. }
  5621. debug(constants.EVENT_RUN_BEGIN);
  5622. // references cleanup to avoid memory leaks
  5623. this.on(constants.EVENT_SUITE_END, function(suite) {
  5624. suite.cleanReferences();
  5625. });
  5626. // callback
  5627. this.on(constants.EVENT_RUN_END, function() {
  5628. debug(constants.EVENT_RUN_END);
  5629. process.removeListener('uncaughtException', uncaught);
  5630. fn(self.failures);
  5631. });
  5632. // uncaught exception
  5633. process.on('uncaughtException', uncaught);
  5634. if (this._delay) {
  5635. // for reporters, I guess.
  5636. // might be nice to debounce some dots while we wait.
  5637. this.emit(constants.EVENT_DELAY_BEGIN, rootSuite);
  5638. rootSuite.once(EVENT_ROOT_SUITE_RUN, start);
  5639. } else {
  5640. start();
  5641. }
  5642. return this;
  5643. };
  5644. /**
  5645. * Cleanly abort execution.
  5646. *
  5647. * @memberof Runner
  5648. * @public
  5649. * @return {Runner} Runner instance.
  5650. */
  5651. Runner.prototype.abort = function() {
  5652. debug('aborting');
  5653. this._abort = true;
  5654. return this;
  5655. };
  5656. /**
  5657. * Filter leaks with the given globals flagged as `ok`.
  5658. *
  5659. * @private
  5660. * @param {Array} ok
  5661. * @param {Array} globals
  5662. * @return {Array}
  5663. */
  5664. function filterLeaks(ok, globals) {
  5665. return globals.filter(function(key) {
  5666. // Firefox and Chrome exposes iframes as index inside the window object
  5667. if (/^\d+/.test(key)) {
  5668. return false;
  5669. }
  5670. // in firefox
  5671. // if runner runs in an iframe, this iframe's window.getInterface method
  5672. // not init at first it is assigned in some seconds
  5673. if (global.navigator && /^getInterface/.test(key)) {
  5674. return false;
  5675. }
  5676. // an iframe could be approached by window[iframeIndex]
  5677. // in ie6,7,8 and opera, iframeIndex is enumerable, this could cause leak
  5678. if (global.navigator && /^\d+/.test(key)) {
  5679. return false;
  5680. }
  5681. // Opera and IE expose global variables for HTML element IDs (issue #243)
  5682. if (/^mocha-/.test(key)) {
  5683. return false;
  5684. }
  5685. var matched = ok.filter(function(ok) {
  5686. if (~ok.indexOf('*')) {
  5687. return key.indexOf(ok.split('*')[0]) === 0;
  5688. }
  5689. return key === ok;
  5690. });
  5691. return !matched.length && (!global.navigator || key !== 'onerror');
  5692. });
  5693. }
  5694. /**
  5695. * Check if argument is an instance of Error object or a duck-typed equivalent.
  5696. *
  5697. * @private
  5698. * @param {Object} err - object to check
  5699. * @param {string} err.message - error message
  5700. * @returns {boolean}
  5701. */
  5702. function isError(err) {
  5703. return err instanceof Error || (err && typeof err.message === 'string');
  5704. }
  5705. /**
  5706. *
  5707. * Converts thrown non-extensible type into proper Error.
  5708. *
  5709. * @private
  5710. * @param {*} thrown - Non-extensible type thrown by code
  5711. * @return {Error}
  5712. */
  5713. function thrown2Error(err) {
  5714. return new Error(
  5715. 'the ' + type(err) + ' ' + stringify(err) + ' was thrown, throw an Error :)'
  5716. );
  5717. }
  5718. /**
  5719. * Array of globals dependent on the environment.
  5720. *
  5721. * @return {Array}
  5722. * @deprecated
  5723. * @todo remove; long since unsupported
  5724. * @private
  5725. */
  5726. function extraGlobals() {
  5727. if (typeof process === 'object' && typeof process.version === 'string') {
  5728. var parts = process.version.split('.');
  5729. var nodeVersion = parts.reduce(function(a, v) {
  5730. return (a << 8) | v;
  5731. });
  5732. // 'errno' was renamed to process._errno in v0.9.11.
  5733. if (nodeVersion < 0x00090b) {
  5734. return ['errno'];
  5735. }
  5736. }
  5737. return [];
  5738. }
  5739. Runner.constants = constants;
  5740. /**
  5741. * Node.js' `EventEmitter`
  5742. * @external EventEmitter
  5743. * @see {@link https://nodejs.org/api/events.html#events_class_eventemitter}
  5744. */
  5745. }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  5746. },{"./errors":6,"./pending":16,"./runnable":33,"./suite":36,"./utils":38,"_process":69,"debug":45,"events":50,"util":89}],35:[function(require,module,exports){
  5747. (function (global){
  5748. 'use strict';
  5749. /**
  5750. * Provides a factory function for a {@link StatsCollector} object.
  5751. * @module
  5752. */
  5753. var constants = require('./runner').constants;
  5754. var EVENT_TEST_PASS = constants.EVENT_TEST_PASS;
  5755. var EVENT_TEST_FAIL = constants.EVENT_TEST_FAIL;
  5756. var EVENT_SUITE_BEGIN = constants.EVENT_SUITE_BEGIN;
  5757. var EVENT_RUN_BEGIN = constants.EVENT_RUN_BEGIN;
  5758. var EVENT_TEST_PENDING = constants.EVENT_TEST_PENDING;
  5759. var EVENT_RUN_END = constants.EVENT_RUN_END;
  5760. var EVENT_TEST_END = constants.EVENT_TEST_END;
  5761. /**
  5762. * Test statistics collector.
  5763. *
  5764. * @public
  5765. * @typedef {Object} StatsCollector
  5766. * @property {number} suites - integer count of suites run.
  5767. * @property {number} tests - integer count of tests run.
  5768. * @property {number} passes - integer count of passing tests.
  5769. * @property {number} pending - integer count of pending tests.
  5770. * @property {number} failures - integer count of failed tests.
  5771. * @property {Date} start - time when testing began.
  5772. * @property {Date} end - time when testing concluded.
  5773. * @property {number} duration - number of msecs that testing took.
  5774. */
  5775. var Date = global.Date;
  5776. /**
  5777. * Provides stats such as test duration, number of tests passed / failed etc., by listening for events emitted by `runner`.
  5778. *
  5779. * @private
  5780. * @param {Runner} runner - Runner instance
  5781. * @throws {TypeError} If falsy `runner`
  5782. */
  5783. function createStatsCollector(runner) {
  5784. /**
  5785. * @type StatsCollector
  5786. */
  5787. var stats = {
  5788. suites: 0,
  5789. tests: 0,
  5790. passes: 0,
  5791. pending: 0,
  5792. failures: 0
  5793. };
  5794. if (!runner) {
  5795. throw new TypeError('Missing runner argument');
  5796. }
  5797. runner.stats = stats;
  5798. runner.once(EVENT_RUN_BEGIN, function() {
  5799. stats.start = new Date();
  5800. });
  5801. runner.on(EVENT_SUITE_BEGIN, function(suite) {
  5802. suite.root || stats.suites++;
  5803. });
  5804. runner.on(EVENT_TEST_PASS, function() {
  5805. stats.passes++;
  5806. });
  5807. runner.on(EVENT_TEST_FAIL, function() {
  5808. stats.failures++;
  5809. });
  5810. runner.on(EVENT_TEST_PENDING, function() {
  5811. stats.pending++;
  5812. });
  5813. runner.on(EVENT_TEST_END, function() {
  5814. stats.tests++;
  5815. });
  5816. runner.once(EVENT_RUN_END, function() {
  5817. stats.end = new Date();
  5818. stats.duration = stats.end - stats.start;
  5819. });
  5820. }
  5821. module.exports = createStatsCollector;
  5822. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  5823. },{"./runner":34}],36:[function(require,module,exports){
  5824. 'use strict';
  5825. /**
  5826. * Module dependencies.
  5827. */
  5828. var EventEmitter = require('events').EventEmitter;
  5829. var Hook = require('./hook');
  5830. var utils = require('./utils');
  5831. var inherits = utils.inherits;
  5832. var debug = require('debug')('mocha:suite');
  5833. var milliseconds = require('ms');
  5834. var errors = require('./errors');
  5835. var createInvalidArgumentTypeError = errors.createInvalidArgumentTypeError;
  5836. /**
  5837. * Expose `Suite`.
  5838. */
  5839. exports = module.exports = Suite;
  5840. /**
  5841. * Create a new `Suite` with the given `title` and parent `Suite`.
  5842. *
  5843. * @public
  5844. * @param {Suite} parent - Parent suite (required!)
  5845. * @param {string} title - Title
  5846. * @return {Suite}
  5847. */
  5848. Suite.create = function(parent, title) {
  5849. var suite = new Suite(title, parent.ctx);
  5850. suite.parent = parent;
  5851. title = suite.fullTitle();
  5852. parent.addSuite(suite);
  5853. return suite;
  5854. };
  5855. /**
  5856. * Constructs a new `Suite` instance with the given `title`, `ctx`, and `isRoot`.
  5857. *
  5858. * @public
  5859. * @class
  5860. * @extends EventEmitter
  5861. * @see {@link https://nodejs.org/api/events.html#events_class_eventemitter|EventEmitter}
  5862. * @param {string} title - Suite title.
  5863. * @param {Context} parentContext - Parent context instance.
  5864. * @param {boolean} [isRoot=false] - Whether this is the root suite.
  5865. */
  5866. function Suite(title, parentContext, isRoot) {
  5867. if (!utils.isString(title)) {
  5868. throw createInvalidArgumentTypeError(
  5869. 'Suite argument "title" must be a string. Received type "' +
  5870. typeof title +
  5871. '"',
  5872. 'title',
  5873. 'string'
  5874. );
  5875. }
  5876. this.title = title;
  5877. function Context() {}
  5878. Context.prototype = parentContext;
  5879. this.ctx = new Context();
  5880. this.suites = [];
  5881. this.tests = [];
  5882. this.pending = false;
  5883. this._beforeEach = [];
  5884. this._beforeAll = [];
  5885. this._afterEach = [];
  5886. this._afterAll = [];
  5887. this.root = isRoot === true;
  5888. this._timeout = 2000;
  5889. this._enableTimeouts = true;
  5890. this._slow = 75;
  5891. this._bail = false;
  5892. this._retries = -1;
  5893. this._onlyTests = [];
  5894. this._onlySuites = [];
  5895. this.delayed = false;
  5896. this.on('newListener', function(event) {
  5897. if (deprecatedEvents[event]) {
  5898. utils.deprecate(
  5899. 'Event "' +
  5900. event +
  5901. '" is deprecated. Please let the Mocha team know about your use case: https://git.io/v6Lwm'
  5902. );
  5903. }
  5904. });
  5905. }
  5906. /**
  5907. * Inherit from `EventEmitter.prototype`.
  5908. */
  5909. inherits(Suite, EventEmitter);
  5910. /**
  5911. * Return a clone of this `Suite`.
  5912. *
  5913. * @private
  5914. * @return {Suite}
  5915. */
  5916. Suite.prototype.clone = function() {
  5917. var suite = new Suite(this.title);
  5918. debug('clone');
  5919. suite.ctx = this.ctx;
  5920. suite.root = this.root;
  5921. suite.timeout(this.timeout());
  5922. suite.retries(this.retries());
  5923. suite.enableTimeouts(this.enableTimeouts());
  5924. suite.slow(this.slow());
  5925. suite.bail(this.bail());
  5926. return suite;
  5927. };
  5928. /**
  5929. * Set or get timeout `ms` or short-hand such as "2s".
  5930. *
  5931. * @private
  5932. * @todo Do not attempt to set value if `ms` is undefined
  5933. * @param {number|string} ms
  5934. * @return {Suite|number} for chaining
  5935. */
  5936. Suite.prototype.timeout = function(ms) {
  5937. if (!arguments.length) {
  5938. return this._timeout;
  5939. }
  5940. if (ms.toString() === '0') {
  5941. this._enableTimeouts = false;
  5942. }
  5943. if (typeof ms === 'string') {
  5944. ms = milliseconds(ms);
  5945. }
  5946. debug('timeout %d', ms);
  5947. this._timeout = parseInt(ms, 10);
  5948. return this;
  5949. };
  5950. /**
  5951. * Set or get number of times to retry a failed test.
  5952. *
  5953. * @private
  5954. * @param {number|string} n
  5955. * @return {Suite|number} for chaining
  5956. */
  5957. Suite.prototype.retries = function(n) {
  5958. if (!arguments.length) {
  5959. return this._retries;
  5960. }
  5961. debug('retries %d', n);
  5962. this._retries = parseInt(n, 10) || 0;
  5963. return this;
  5964. };
  5965. /**
  5966. * Set or get timeout to `enabled`.
  5967. *
  5968. * @private
  5969. * @param {boolean} enabled
  5970. * @return {Suite|boolean} self or enabled
  5971. */
  5972. Suite.prototype.enableTimeouts = function(enabled) {
  5973. if (!arguments.length) {
  5974. return this._enableTimeouts;
  5975. }
  5976. debug('enableTimeouts %s', enabled);
  5977. this._enableTimeouts = enabled;
  5978. return this;
  5979. };
  5980. /**
  5981. * Set or get slow `ms` or short-hand such as "2s".
  5982. *
  5983. * @private
  5984. * @param {number|string} ms
  5985. * @return {Suite|number} for chaining
  5986. */
  5987. Suite.prototype.slow = function(ms) {
  5988. if (!arguments.length) {
  5989. return this._slow;
  5990. }
  5991. if (typeof ms === 'string') {
  5992. ms = milliseconds(ms);
  5993. }
  5994. debug('slow %d', ms);
  5995. this._slow = ms;
  5996. return this;
  5997. };
  5998. /**
  5999. * Set or get whether to bail after first error.
  6000. *
  6001. * @private
  6002. * @param {boolean} bail
  6003. * @return {Suite|number} for chaining
  6004. */
  6005. Suite.prototype.bail = function(bail) {
  6006. if (!arguments.length) {
  6007. return this._bail;
  6008. }
  6009. debug('bail %s', bail);
  6010. this._bail = bail;
  6011. return this;
  6012. };
  6013. /**
  6014. * Check if this suite or its parent suite is marked as pending.
  6015. *
  6016. * @private
  6017. */
  6018. Suite.prototype.isPending = function() {
  6019. return this.pending || (this.parent && this.parent.isPending());
  6020. };
  6021. /**
  6022. * Generic hook-creator.
  6023. * @private
  6024. * @param {string} title - Title of hook
  6025. * @param {Function} fn - Hook callback
  6026. * @returns {Hook} A new hook
  6027. */
  6028. Suite.prototype._createHook = function(title, fn) {
  6029. var hook = new Hook(title, fn);
  6030. hook.parent = this;
  6031. hook.timeout(this.timeout());
  6032. hook.retries(this.retries());
  6033. hook.enableTimeouts(this.enableTimeouts());
  6034. hook.slow(this.slow());
  6035. hook.ctx = this.ctx;
  6036. hook.file = this.file;
  6037. return hook;
  6038. };
  6039. /**
  6040. * Run `fn(test[, done])` before running tests.
  6041. *
  6042. * @private
  6043. * @param {string} title
  6044. * @param {Function} fn
  6045. * @return {Suite} for chaining
  6046. */
  6047. Suite.prototype.beforeAll = function(title, fn) {
  6048. if (this.isPending()) {
  6049. return this;
  6050. }
  6051. if (typeof title === 'function') {
  6052. fn = title;
  6053. title = fn.name;
  6054. }
  6055. title = '"before all" hook' + (title ? ': ' + title : '');
  6056. var hook = this._createHook(title, fn);
  6057. this._beforeAll.push(hook);
  6058. this.emit(constants.EVENT_SUITE_ADD_HOOK_BEFORE_ALL, hook);
  6059. return this;
  6060. };
  6061. /**
  6062. * Run `fn(test[, done])` after running tests.
  6063. *
  6064. * @private
  6065. * @param {string} title
  6066. * @param {Function} fn
  6067. * @return {Suite} for chaining
  6068. */
  6069. Suite.prototype.afterAll = function(title, fn) {
  6070. if (this.isPending()) {
  6071. return this;
  6072. }
  6073. if (typeof title === 'function') {
  6074. fn = title;
  6075. title = fn.name;
  6076. }
  6077. title = '"after all" hook' + (title ? ': ' + title : '');
  6078. var hook = this._createHook(title, fn);
  6079. this._afterAll.push(hook);
  6080. this.emit(constants.EVENT_SUITE_ADD_HOOK_AFTER_ALL, hook);
  6081. return this;
  6082. };
  6083. /**
  6084. * Run `fn(test[, done])` before each test case.
  6085. *
  6086. * @private
  6087. * @param {string} title
  6088. * @param {Function} fn
  6089. * @return {Suite} for chaining
  6090. */
  6091. Suite.prototype.beforeEach = function(title, fn) {
  6092. if (this.isPending()) {
  6093. return this;
  6094. }
  6095. if (typeof title === 'function') {
  6096. fn = title;
  6097. title = fn.name;
  6098. }
  6099. title = '"before each" hook' + (title ? ': ' + title : '');
  6100. var hook = this._createHook(title, fn);
  6101. this._beforeEach.push(hook);
  6102. this.emit(constants.EVENT_SUITE_ADD_HOOK_BEFORE_EACH, hook);
  6103. return this;
  6104. };
  6105. /**
  6106. * Run `fn(test[, done])` after each test case.
  6107. *
  6108. * @private
  6109. * @param {string} title
  6110. * @param {Function} fn
  6111. * @return {Suite} for chaining
  6112. */
  6113. Suite.prototype.afterEach = function(title, fn) {
  6114. if (this.isPending()) {
  6115. return this;
  6116. }
  6117. if (typeof title === 'function') {
  6118. fn = title;
  6119. title = fn.name;
  6120. }
  6121. title = '"after each" hook' + (title ? ': ' + title : '');
  6122. var hook = this._createHook(title, fn);
  6123. this._afterEach.push(hook);
  6124. this.emit(constants.EVENT_SUITE_ADD_HOOK_AFTER_EACH, hook);
  6125. return this;
  6126. };
  6127. /**
  6128. * Add a test `suite`.
  6129. *
  6130. * @private
  6131. * @param {Suite} suite
  6132. * @return {Suite} for chaining
  6133. */
  6134. Suite.prototype.addSuite = function(suite) {
  6135. suite.parent = this;
  6136. suite.root = false;
  6137. suite.timeout(this.timeout());
  6138. suite.retries(this.retries());
  6139. suite.enableTimeouts(this.enableTimeouts());
  6140. suite.slow(this.slow());
  6141. suite.bail(this.bail());
  6142. this.suites.push(suite);
  6143. this.emit(constants.EVENT_SUITE_ADD_SUITE, suite);
  6144. return this;
  6145. };
  6146. /**
  6147. * Add a `test` to this suite.
  6148. *
  6149. * @private
  6150. * @param {Test} test
  6151. * @return {Suite} for chaining
  6152. */
  6153. Suite.prototype.addTest = function(test) {
  6154. test.parent = this;
  6155. test.timeout(this.timeout());
  6156. test.retries(this.retries());
  6157. test.enableTimeouts(this.enableTimeouts());
  6158. test.slow(this.slow());
  6159. test.ctx = this.ctx;
  6160. this.tests.push(test);
  6161. this.emit(constants.EVENT_SUITE_ADD_TEST, test);
  6162. return this;
  6163. };
  6164. /**
  6165. * Return the full title generated by recursively concatenating the parent's
  6166. * full title.
  6167. *
  6168. * @memberof Suite
  6169. * @public
  6170. * @return {string}
  6171. */
  6172. Suite.prototype.fullTitle = function() {
  6173. return this.titlePath().join(' ');
  6174. };
  6175. /**
  6176. * Return the title path generated by recursively concatenating the parent's
  6177. * title path.
  6178. *
  6179. * @memberof Suite
  6180. * @public
  6181. * @return {string}
  6182. */
  6183. Suite.prototype.titlePath = function() {
  6184. var result = [];
  6185. if (this.parent) {
  6186. result = result.concat(this.parent.titlePath());
  6187. }
  6188. if (!this.root) {
  6189. result.push(this.title);
  6190. }
  6191. return result;
  6192. };
  6193. /**
  6194. * Return the total number of tests.
  6195. *
  6196. * @memberof Suite
  6197. * @public
  6198. * @return {number}
  6199. */
  6200. Suite.prototype.total = function() {
  6201. return (
  6202. this.suites.reduce(function(sum, suite) {
  6203. return sum + suite.total();
  6204. }, 0) + this.tests.length
  6205. );
  6206. };
  6207. /**
  6208. * Iterates through each suite recursively to find all tests. Applies a
  6209. * function in the format `fn(test)`.
  6210. *
  6211. * @private
  6212. * @param {Function} fn
  6213. * @return {Suite}
  6214. */
  6215. Suite.prototype.eachTest = function(fn) {
  6216. this.tests.forEach(fn);
  6217. this.suites.forEach(function(suite) {
  6218. suite.eachTest(fn);
  6219. });
  6220. return this;
  6221. };
  6222. /**
  6223. * This will run the root suite if we happen to be running in delayed mode.
  6224. * @private
  6225. */
  6226. Suite.prototype.run = function run() {
  6227. if (this.root) {
  6228. this.emit(constants.EVENT_ROOT_SUITE_RUN);
  6229. }
  6230. };
  6231. /**
  6232. * Determines whether a suite has an `only` test or suite as a descendant.
  6233. *
  6234. * @private
  6235. * @returns {Boolean}
  6236. */
  6237. Suite.prototype.hasOnly = function hasOnly() {
  6238. return (
  6239. this._onlyTests.length > 0 ||
  6240. this._onlySuites.length > 0 ||
  6241. this.suites.some(function(suite) {
  6242. return suite.hasOnly();
  6243. })
  6244. );
  6245. };
  6246. /**
  6247. * Filter suites based on `isOnly` logic.
  6248. *
  6249. * @private
  6250. * @returns {Boolean}
  6251. */
  6252. Suite.prototype.filterOnly = function filterOnly() {
  6253. if (this._onlyTests.length) {
  6254. // If the suite contains `only` tests, run those and ignore any nested suites.
  6255. this.tests = this._onlyTests;
  6256. this.suites = [];
  6257. } else {
  6258. // Otherwise, do not run any of the tests in this suite.
  6259. this.tests = [];
  6260. this._onlySuites.forEach(function(onlySuite) {
  6261. // If there are other `only` tests/suites nested in the current `only` suite, then filter that `only` suite.
  6262. // Otherwise, all of the tests on this `only` suite should be run, so don't filter it.
  6263. if (onlySuite.hasOnly()) {
  6264. onlySuite.filterOnly();
  6265. }
  6266. });
  6267. // Run the `only` suites, as well as any other suites that have `only` tests/suites as descendants.
  6268. var onlySuites = this._onlySuites;
  6269. this.suites = this.suites.filter(function(childSuite) {
  6270. return onlySuites.indexOf(childSuite) !== -1 || childSuite.filterOnly();
  6271. });
  6272. }
  6273. // Keep the suite only if there is something to run
  6274. return this.tests.length > 0 || this.suites.length > 0;
  6275. };
  6276. /**
  6277. * Adds a suite to the list of subsuites marked `only`.
  6278. *
  6279. * @private
  6280. * @param {Suite} suite
  6281. */
  6282. Suite.prototype.appendOnlySuite = function(suite) {
  6283. this._onlySuites.push(suite);
  6284. };
  6285. /**
  6286. * Adds a test to the list of tests marked `only`.
  6287. *
  6288. * @private
  6289. * @param {Test} test
  6290. */
  6291. Suite.prototype.appendOnlyTest = function(test) {
  6292. this._onlyTests.push(test);
  6293. };
  6294. /**
  6295. * Returns the array of hooks by hook name; see `HOOK_TYPE_*` constants.
  6296. * @private
  6297. */
  6298. Suite.prototype.getHooks = function getHooks(name) {
  6299. return this['_' + name];
  6300. };
  6301. /**
  6302. * Cleans up the references to all the deferred functions
  6303. * (before/after/beforeEach/afterEach) and tests of a Suite.
  6304. * These must be deleted otherwise a memory leak can happen,
  6305. * as those functions may reference variables from closures,
  6306. * thus those variables can never be garbage collected as long
  6307. * as the deferred functions exist.
  6308. *
  6309. * @private
  6310. */
  6311. Suite.prototype.cleanReferences = function cleanReferences() {
  6312. function cleanArrReferences(arr) {
  6313. for (var i = 0; i < arr.length; i++) {
  6314. delete arr[i].fn;
  6315. }
  6316. }
  6317. if (Array.isArray(this._beforeAll)) {
  6318. cleanArrReferences(this._beforeAll);
  6319. }
  6320. if (Array.isArray(this._beforeEach)) {
  6321. cleanArrReferences(this._beforeEach);
  6322. }
  6323. if (Array.isArray(this._afterAll)) {
  6324. cleanArrReferences(this._afterAll);
  6325. }
  6326. if (Array.isArray(this._afterEach)) {
  6327. cleanArrReferences(this._afterEach);
  6328. }
  6329. for (var i = 0; i < this.tests.length; i++) {
  6330. delete this.tests[i].fn;
  6331. }
  6332. };
  6333. var constants = utils.defineConstants(
  6334. /**
  6335. * {@link Suite}-related constants.
  6336. * @public
  6337. * @memberof Suite
  6338. * @alias constants
  6339. * @readonly
  6340. * @static
  6341. * @enum {string}
  6342. */
  6343. {
  6344. /**
  6345. * Event emitted after a test file has been loaded Not emitted in browser.
  6346. */
  6347. EVENT_FILE_POST_REQUIRE: 'post-require',
  6348. /**
  6349. * Event emitted before a test file has been loaded. In browser, this is emitted once an interface has been selected.
  6350. */
  6351. EVENT_FILE_PRE_REQUIRE: 'pre-require',
  6352. /**
  6353. * Event emitted immediately after a test file has been loaded. Not emitted in browser.
  6354. */
  6355. EVENT_FILE_REQUIRE: 'require',
  6356. /**
  6357. * Event emitted when `global.run()` is called (use with `delay` option)
  6358. */
  6359. EVENT_ROOT_SUITE_RUN: 'run',
  6360. /**
  6361. * Namespace for collection of a `Suite`'s "after all" hooks
  6362. */
  6363. HOOK_TYPE_AFTER_ALL: 'afterAll',
  6364. /**
  6365. * Namespace for collection of a `Suite`'s "after each" hooks
  6366. */
  6367. HOOK_TYPE_AFTER_EACH: 'afterEach',
  6368. /**
  6369. * Namespace for collection of a `Suite`'s "before all" hooks
  6370. */
  6371. HOOK_TYPE_BEFORE_ALL: 'beforeAll',
  6372. /**
  6373. * Namespace for collection of a `Suite`'s "before all" hooks
  6374. */
  6375. HOOK_TYPE_BEFORE_EACH: 'beforeEach',
  6376. // the following events are all deprecated
  6377. /**
  6378. * Emitted after an "after all" `Hook` has been added to a `Suite`. Deprecated
  6379. */
  6380. EVENT_SUITE_ADD_HOOK_AFTER_ALL: 'afterAll',
  6381. /**
  6382. * Emitted after an "after each" `Hook` has been added to a `Suite` Deprecated
  6383. */
  6384. EVENT_SUITE_ADD_HOOK_AFTER_EACH: 'afterEach',
  6385. /**
  6386. * Emitted after an "before all" `Hook` has been added to a `Suite` Deprecated
  6387. */
  6388. EVENT_SUITE_ADD_HOOK_BEFORE_ALL: 'beforeAll',
  6389. /**
  6390. * Emitted after an "before each" `Hook` has been added to a `Suite` Deprecated
  6391. */
  6392. EVENT_SUITE_ADD_HOOK_BEFORE_EACH: 'beforeEach',
  6393. /**
  6394. * Emitted after a child `Suite` has been added to a `Suite`. Deprecated
  6395. */
  6396. EVENT_SUITE_ADD_SUITE: 'suite',
  6397. /**
  6398. * Emitted after a `Test` has been added to a `Suite`. Deprecated
  6399. */
  6400. EVENT_SUITE_ADD_TEST: 'test'
  6401. }
  6402. );
  6403. /**
  6404. * @summary There are no known use cases for these events.
  6405. * @desc This is a `Set`-like object having all keys being the constant's string value and the value being `true`.
  6406. * @todo Remove eventually
  6407. * @type {Object<string,boolean>}
  6408. * @ignore
  6409. */
  6410. var deprecatedEvents = Object.keys(constants)
  6411. .filter(function(constant) {
  6412. return constant.substring(0, 15) === 'EVENT_SUITE_ADD';
  6413. })
  6414. .reduce(function(acc, constant) {
  6415. acc[constants[constant]] = true;
  6416. return acc;
  6417. }, utils.createMap());
  6418. Suite.constants = constants;
  6419. },{"./errors":6,"./hook":7,"./utils":38,"debug":45,"events":50,"ms":60}],37:[function(require,module,exports){
  6420. 'use strict';
  6421. var Runnable = require('./runnable');
  6422. var utils = require('./utils');
  6423. var errors = require('./errors');
  6424. var createInvalidArgumentTypeError = errors.createInvalidArgumentTypeError;
  6425. var isString = utils.isString;
  6426. module.exports = Test;
  6427. /**
  6428. * Initialize a new `Test` with the given `title` and callback `fn`.
  6429. *
  6430. * @public
  6431. * @class
  6432. * @extends Runnable
  6433. * @param {String} title - Test title (required)
  6434. * @param {Function} [fn] - Test callback. If omitted, the Test is considered "pending"
  6435. */
  6436. function Test(title, fn) {
  6437. if (!isString(title)) {
  6438. throw createInvalidArgumentTypeError(
  6439. 'Test argument "title" should be a string. Received type "' +
  6440. typeof title +
  6441. '"',
  6442. 'title',
  6443. 'string'
  6444. );
  6445. }
  6446. Runnable.call(this, title, fn);
  6447. this.pending = !fn;
  6448. this.type = 'test';
  6449. }
  6450. /**
  6451. * Inherit from `Runnable.prototype`.
  6452. */
  6453. utils.inherits(Test, Runnable);
  6454. Test.prototype.clone = function() {
  6455. var test = new Test(this.title, this.fn);
  6456. test.timeout(this.timeout());
  6457. test.slow(this.slow());
  6458. test.enableTimeouts(this.enableTimeouts());
  6459. test.retries(this.retries());
  6460. test.currentRetry(this.currentRetry());
  6461. test.globals(this.globals());
  6462. test.parent = this.parent;
  6463. test.file = this.file;
  6464. test.ctx = this.ctx;
  6465. return test;
  6466. };
  6467. },{"./errors":6,"./runnable":33,"./utils":38}],38:[function(require,module,exports){
  6468. (function (process,Buffer){
  6469. 'use strict';
  6470. /**
  6471. * Various utility functions used throughout Mocha's codebase.
  6472. * @module utils
  6473. */
  6474. /**
  6475. * Module dependencies.
  6476. */
  6477. var fs = require('fs');
  6478. var path = require('path');
  6479. var util = require('util');
  6480. var glob = require('glob');
  6481. var he = require('he');
  6482. var errors = require('./errors');
  6483. var createNoFilesMatchPatternError = errors.createNoFilesMatchPatternError;
  6484. var createMissingArgumentError = errors.createMissingArgumentError;
  6485. var assign = (exports.assign = require('object.assign').getPolyfill());
  6486. /**
  6487. * Inherit the prototype methods from one constructor into another.
  6488. *
  6489. * @param {function} ctor - Constructor function which needs to inherit the
  6490. * prototype.
  6491. * @param {function} superCtor - Constructor function to inherit prototype from.
  6492. * @throws {TypeError} if either constructor is null, or if super constructor
  6493. * lacks a prototype.
  6494. */
  6495. exports.inherits = util.inherits;
  6496. /**
  6497. * Escape special characters in the given string of html.
  6498. *
  6499. * @private
  6500. * @param {string} html
  6501. * @return {string}
  6502. */
  6503. exports.escape = function(html) {
  6504. return he.encode(String(html), {useNamedReferences: false});
  6505. };
  6506. /**
  6507. * Test if the given obj is type of string.
  6508. *
  6509. * @private
  6510. * @param {Object} obj
  6511. * @return {boolean}
  6512. */
  6513. exports.isString = function(obj) {
  6514. return typeof obj === 'string';
  6515. };
  6516. /**
  6517. * Watch the given `files` for changes
  6518. * and invoke `fn(file)` on modification.
  6519. *
  6520. * @private
  6521. * @param {Array} files
  6522. * @param {Function} fn
  6523. */
  6524. exports.watch = function(files, fn) {
  6525. var options = {interval: 100};
  6526. var debug = require('debug')('mocha:watch');
  6527. files.forEach(function(file) {
  6528. debug('file %s', file);
  6529. fs.watchFile(file, options, function(curr, prev) {
  6530. if (prev.mtime < curr.mtime) {
  6531. fn(file);
  6532. }
  6533. });
  6534. });
  6535. };
  6536. /**
  6537. * Predicate to screen `pathname` for further consideration.
  6538. *
  6539. * @description
  6540. * Returns <code>false</code> for pathname referencing:
  6541. * <ul>
  6542. * <li>'npm' package installation directory
  6543. * <li>'git' version control directory
  6544. * </ul>
  6545. *
  6546. * @private
  6547. * @param {string} pathname - File or directory name to screen
  6548. * @return {boolean} whether pathname should be further considered
  6549. * @example
  6550. * ['node_modules', 'test.js'].filter(considerFurther); // => ['test.js']
  6551. */
  6552. function considerFurther(pathname) {
  6553. var ignore = ['node_modules', '.git'];
  6554. return !~ignore.indexOf(pathname);
  6555. }
  6556. /**
  6557. * Lookup files in the given `dir`.
  6558. *
  6559. * @description
  6560. * Filenames are returned in _traversal_ order by the OS/filesystem.
  6561. * **Make no assumption that the names will be sorted in any fashion.**
  6562. *
  6563. * @private
  6564. * @param {string} dir
  6565. * @param {string[]} [exts=['js']]
  6566. * @param {Array} [ret=[]]
  6567. * @return {Array}
  6568. */
  6569. exports.files = function(dir, exts, ret) {
  6570. ret = ret || [];
  6571. exts = exts || ['js'];
  6572. fs.readdirSync(dir)
  6573. .filter(considerFurther)
  6574. .forEach(function(dirent) {
  6575. var pathname = path.join(dir, dirent);
  6576. if (fs.lstatSync(pathname).isDirectory()) {
  6577. exports.files(pathname, exts, ret);
  6578. } else if (hasMatchingExtname(pathname, exts)) {
  6579. ret.push(pathname);
  6580. }
  6581. });
  6582. return ret;
  6583. };
  6584. /**
  6585. * Compute a slug from the given `str`.
  6586. *
  6587. * @private
  6588. * @param {string} str
  6589. * @return {string}
  6590. */
  6591. exports.slug = function(str) {
  6592. return str
  6593. .toLowerCase()
  6594. .replace(/ +/g, '-')
  6595. .replace(/[^-\w]/g, '');
  6596. };
  6597. /**
  6598. * Strip the function definition from `str`, and re-indent for pre whitespace.
  6599. *
  6600. * @param {string} str
  6601. * @return {string}
  6602. */
  6603. exports.clean = function(str) {
  6604. str = str
  6605. .replace(/\r\n?|[\n\u2028\u2029]/g, '\n')
  6606. .replace(/^\uFEFF/, '')
  6607. // (traditional)-> space/name parameters body (lambda)-> parameters body multi-statement/single keep body content
  6608. .replace(
  6609. /^function(?:\s*|\s+[^(]*)\([^)]*\)\s*\{((?:.|\n)*?)\s*\}$|^\([^)]*\)\s*=>\s*(?:\{((?:.|\n)*?)\s*\}|((?:.|\n)*))$/,
  6610. '$1$2$3'
  6611. );
  6612. var spaces = str.match(/^\n?( *)/)[1].length;
  6613. var tabs = str.match(/^\n?(\t*)/)[1].length;
  6614. var re = new RegExp(
  6615. '^\n?' + (tabs ? '\t' : ' ') + '{' + (tabs || spaces) + '}',
  6616. 'gm'
  6617. );
  6618. str = str.replace(re, '');
  6619. return str.trim();
  6620. };
  6621. /**
  6622. * Parse the given `qs`.
  6623. *
  6624. * @private
  6625. * @param {string} qs
  6626. * @return {Object}
  6627. */
  6628. exports.parseQuery = function(qs) {
  6629. return qs
  6630. .replace('?', '')
  6631. .split('&')
  6632. .reduce(function(obj, pair) {
  6633. var i = pair.indexOf('=');
  6634. var key = pair.slice(0, i);
  6635. var val = pair.slice(++i);
  6636. // Due to how the URLSearchParams API treats spaces
  6637. obj[key] = decodeURIComponent(val.replace(/\+/g, '%20'));
  6638. return obj;
  6639. }, {});
  6640. };
  6641. /**
  6642. * Highlight the given string of `js`.
  6643. *
  6644. * @private
  6645. * @param {string} js
  6646. * @return {string}
  6647. */
  6648. function highlight(js) {
  6649. return js
  6650. .replace(/</g, '&lt;')
  6651. .replace(/>/g, '&gt;')
  6652. .replace(/\/\/(.*)/gm, '<span class="comment">//$1</span>')
  6653. .replace(/('.*?')/gm, '<span class="string">$1</span>')
  6654. .replace(/(\d+\.\d+)/gm, '<span class="number">$1</span>')
  6655. .replace(/(\d+)/gm, '<span class="number">$1</span>')
  6656. .replace(
  6657. /\bnew[ \t]+(\w+)/gm,
  6658. '<span class="keyword">new</span> <span class="init">$1</span>'
  6659. )
  6660. .replace(
  6661. /\b(function|new|throw|return|var|if|else)\b/gm,
  6662. '<span class="keyword">$1</span>'
  6663. );
  6664. }
  6665. /**
  6666. * Highlight the contents of tag `name`.
  6667. *
  6668. * @private
  6669. * @param {string} name
  6670. */
  6671. exports.highlightTags = function(name) {
  6672. var code = document.getElementById('mocha').getElementsByTagName(name);
  6673. for (var i = 0, len = code.length; i < len; ++i) {
  6674. code[i].innerHTML = highlight(code[i].innerHTML);
  6675. }
  6676. };
  6677. /**
  6678. * If a value could have properties, and has none, this function is called,
  6679. * which returns a string representation of the empty value.
  6680. *
  6681. * Functions w/ no properties return `'[Function]'`
  6682. * Arrays w/ length === 0 return `'[]'`
  6683. * Objects w/ no properties return `'{}'`
  6684. * All else: return result of `value.toString()`
  6685. *
  6686. * @private
  6687. * @param {*} value The value to inspect.
  6688. * @param {string} typeHint The type of the value
  6689. * @returns {string}
  6690. */
  6691. function emptyRepresentation(value, typeHint) {
  6692. switch (typeHint) {
  6693. case 'function':
  6694. return '[Function]';
  6695. case 'object':
  6696. return '{}';
  6697. case 'array':
  6698. return '[]';
  6699. default:
  6700. return value.toString();
  6701. }
  6702. }
  6703. /**
  6704. * Takes some variable and asks `Object.prototype.toString()` what it thinks it
  6705. * is.
  6706. *
  6707. * @private
  6708. * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString
  6709. * @param {*} value The value to test.
  6710. * @returns {string} Computed type
  6711. * @example
  6712. * type({}) // 'object'
  6713. * type([]) // 'array'
  6714. * type(1) // 'number'
  6715. * type(false) // 'boolean'
  6716. * type(Infinity) // 'number'
  6717. * type(null) // 'null'
  6718. * type(new Date()) // 'date'
  6719. * type(/foo/) // 'regexp'
  6720. * type('type') // 'string'
  6721. * type(global) // 'global'
  6722. * type(new String('foo') // 'object'
  6723. */
  6724. var type = (exports.type = function type(value) {
  6725. if (value === undefined) {
  6726. return 'undefined';
  6727. } else if (value === null) {
  6728. return 'null';
  6729. } else if (Buffer.isBuffer(value)) {
  6730. return 'buffer';
  6731. }
  6732. return Object.prototype.toString
  6733. .call(value)
  6734. .replace(/^\[.+\s(.+?)]$/, '$1')
  6735. .toLowerCase();
  6736. });
  6737. /**
  6738. * Stringify `value`. Different behavior depending on type of value:
  6739. *
  6740. * - If `value` is undefined or null, return `'[undefined]'` or `'[null]'`, respectively.
  6741. * - If `value` is not an object, function or array, return result of `value.toString()` wrapped in double-quotes.
  6742. * - If `value` is an *empty* object, function, or array, return result of function
  6743. * {@link emptyRepresentation}.
  6744. * - If `value` has properties, call {@link exports.canonicalize} on it, then return result of
  6745. * JSON.stringify().
  6746. *
  6747. * @private
  6748. * @see exports.type
  6749. * @param {*} value
  6750. * @return {string}
  6751. */
  6752. exports.stringify = function(value) {
  6753. var typeHint = type(value);
  6754. if (!~['object', 'array', 'function'].indexOf(typeHint)) {
  6755. if (typeHint === 'buffer') {
  6756. var json = Buffer.prototype.toJSON.call(value);
  6757. // Based on the toJSON result
  6758. return jsonStringify(
  6759. json.data && json.type ? json.data : json,
  6760. 2
  6761. ).replace(/,(\n|$)/g, '$1');
  6762. }
  6763. // IE7/IE8 has a bizarre String constructor; needs to be coerced
  6764. // into an array and back to obj.
  6765. if (typeHint === 'string' && typeof value === 'object') {
  6766. value = value.split('').reduce(function(acc, char, idx) {
  6767. acc[idx] = char;
  6768. return acc;
  6769. }, {});
  6770. typeHint = 'object';
  6771. } else {
  6772. return jsonStringify(value);
  6773. }
  6774. }
  6775. for (var prop in value) {
  6776. if (Object.prototype.hasOwnProperty.call(value, prop)) {
  6777. return jsonStringify(
  6778. exports.canonicalize(value, null, typeHint),
  6779. 2
  6780. ).replace(/,(\n|$)/g, '$1');
  6781. }
  6782. }
  6783. return emptyRepresentation(value, typeHint);
  6784. };
  6785. /**
  6786. * like JSON.stringify but more sense.
  6787. *
  6788. * @private
  6789. * @param {Object} object
  6790. * @param {number=} spaces
  6791. * @param {number=} depth
  6792. * @returns {*}
  6793. */
  6794. function jsonStringify(object, spaces, depth) {
  6795. if (typeof spaces === 'undefined') {
  6796. // primitive types
  6797. return _stringify(object);
  6798. }
  6799. depth = depth || 1;
  6800. var space = spaces * depth;
  6801. var str = Array.isArray(object) ? '[' : '{';
  6802. var end = Array.isArray(object) ? ']' : '}';
  6803. var length =
  6804. typeof object.length === 'number'
  6805. ? object.length
  6806. : Object.keys(object).length;
  6807. // `.repeat()` polyfill
  6808. function repeat(s, n) {
  6809. return new Array(n).join(s);
  6810. }
  6811. function _stringify(val) {
  6812. switch (type(val)) {
  6813. case 'null':
  6814. case 'undefined':
  6815. val = '[' + val + ']';
  6816. break;
  6817. case 'array':
  6818. case 'object':
  6819. val = jsonStringify(val, spaces, depth + 1);
  6820. break;
  6821. case 'boolean':
  6822. case 'regexp':
  6823. case 'symbol':
  6824. case 'number':
  6825. val =
  6826. val === 0 && 1 / val === -Infinity // `-0`
  6827. ? '-0'
  6828. : val.toString();
  6829. break;
  6830. case 'date':
  6831. var sDate = isNaN(val.getTime()) ? val.toString() : val.toISOString();
  6832. val = '[Date: ' + sDate + ']';
  6833. break;
  6834. case 'buffer':
  6835. var json = val.toJSON();
  6836. // Based on the toJSON result
  6837. json = json.data && json.type ? json.data : json;
  6838. val = '[Buffer: ' + jsonStringify(json, 2, depth + 1) + ']';
  6839. break;
  6840. default:
  6841. val =
  6842. val === '[Function]' || val === '[Circular]'
  6843. ? val
  6844. : JSON.stringify(val); // string
  6845. }
  6846. return val;
  6847. }
  6848. for (var i in object) {
  6849. if (!Object.prototype.hasOwnProperty.call(object, i)) {
  6850. continue; // not my business
  6851. }
  6852. --length;
  6853. str +=
  6854. '\n ' +
  6855. repeat(' ', space) +
  6856. (Array.isArray(object) ? '' : '"' + i + '": ') + // key
  6857. _stringify(object[i]) + // value
  6858. (length ? ',' : ''); // comma
  6859. }
  6860. return (
  6861. str +
  6862. // [], {}
  6863. (str.length !== 1 ? '\n' + repeat(' ', --space) + end : end)
  6864. );
  6865. }
  6866. /**
  6867. * Return a new Thing that has the keys in sorted order. Recursive.
  6868. *
  6869. * If the Thing...
  6870. * - has already been seen, return string `'[Circular]'`
  6871. * - is `undefined`, return string `'[undefined]'`
  6872. * - is `null`, return value `null`
  6873. * - is some other primitive, return the value
  6874. * - is not a primitive or an `Array`, `Object`, or `Function`, return the value of the Thing's `toString()` method
  6875. * - is a non-empty `Array`, `Object`, or `Function`, return the result of calling this function again.
  6876. * - is an empty `Array`, `Object`, or `Function`, return the result of calling `emptyRepresentation()`
  6877. *
  6878. * @private
  6879. * @see {@link exports.stringify}
  6880. * @param {*} value Thing to inspect. May or may not have properties.
  6881. * @param {Array} [stack=[]] Stack of seen values
  6882. * @param {string} [typeHint] Type hint
  6883. * @return {(Object|Array|Function|string|undefined)}
  6884. */
  6885. exports.canonicalize = function canonicalize(value, stack, typeHint) {
  6886. var canonicalizedObj;
  6887. /* eslint-disable no-unused-vars */
  6888. var prop;
  6889. /* eslint-enable no-unused-vars */
  6890. typeHint = typeHint || type(value);
  6891. function withStack(value, fn) {
  6892. stack.push(value);
  6893. fn();
  6894. stack.pop();
  6895. }
  6896. stack = stack || [];
  6897. if (stack.indexOf(value) !== -1) {
  6898. return '[Circular]';
  6899. }
  6900. switch (typeHint) {
  6901. case 'undefined':
  6902. case 'buffer':
  6903. case 'null':
  6904. canonicalizedObj = value;
  6905. break;
  6906. case 'array':
  6907. withStack(value, function() {
  6908. canonicalizedObj = value.map(function(item) {
  6909. return exports.canonicalize(item, stack);
  6910. });
  6911. });
  6912. break;
  6913. case 'function':
  6914. /* eslint-disable guard-for-in */
  6915. for (prop in value) {
  6916. canonicalizedObj = {};
  6917. break;
  6918. }
  6919. /* eslint-enable guard-for-in */
  6920. if (!canonicalizedObj) {
  6921. canonicalizedObj = emptyRepresentation(value, typeHint);
  6922. break;
  6923. }
  6924. /* falls through */
  6925. case 'object':
  6926. canonicalizedObj = canonicalizedObj || {};
  6927. withStack(value, function() {
  6928. Object.keys(value)
  6929. .sort()
  6930. .forEach(function(key) {
  6931. canonicalizedObj[key] = exports.canonicalize(value[key], stack);
  6932. });
  6933. });
  6934. break;
  6935. case 'date':
  6936. case 'number':
  6937. case 'regexp':
  6938. case 'boolean':
  6939. case 'symbol':
  6940. canonicalizedObj = value;
  6941. break;
  6942. default:
  6943. canonicalizedObj = value + '';
  6944. }
  6945. return canonicalizedObj;
  6946. };
  6947. /**
  6948. * Determines if pathname has a matching file extension.
  6949. *
  6950. * @private
  6951. * @param {string} pathname - Pathname to check for match.
  6952. * @param {string[]} exts - List of file extensions (sans period).
  6953. * @return {boolean} whether file extension matches.
  6954. * @example
  6955. * hasMatchingExtname('foo.html', ['js', 'css']); // => false
  6956. */
  6957. function hasMatchingExtname(pathname, exts) {
  6958. var suffix = path.extname(pathname).slice(1);
  6959. return exts.some(function(element) {
  6960. return suffix === element;
  6961. });
  6962. }
  6963. /**
  6964. * Determines if pathname would be a "hidden" file (or directory) on UN*X.
  6965. *
  6966. * @description
  6967. * On UN*X, pathnames beginning with a full stop (aka dot) are hidden during
  6968. * typical usage. Dotfiles, plain-text configuration files, are prime examples.
  6969. *
  6970. * @see {@link http://xahlee.info/UnixResource_dir/writ/unix_origin_of_dot_filename.html|Origin of Dot File Names}
  6971. *
  6972. * @private
  6973. * @param {string} pathname - Pathname to check for match.
  6974. * @return {boolean} whether pathname would be considered a hidden file.
  6975. * @example
  6976. * isHiddenOnUnix('.profile'); // => true
  6977. */
  6978. function isHiddenOnUnix(pathname) {
  6979. return path.basename(pathname)[0] === '.';
  6980. }
  6981. /**
  6982. * Lookup file names at the given `path`.
  6983. *
  6984. * @description
  6985. * Filenames are returned in _traversal_ order by the OS/filesystem.
  6986. * **Make no assumption that the names will be sorted in any fashion.**
  6987. *
  6988. * @public
  6989. * @memberof Mocha.utils
  6990. * @todo Fix extension handling
  6991. * @param {string} filepath - Base path to start searching from.
  6992. * @param {string[]} extensions - File extensions to look for.
  6993. * @param {boolean} recursive - Whether to recurse into subdirectories.
  6994. * @return {string[]} An array of paths.
  6995. * @throws {Error} if no files match pattern.
  6996. * @throws {TypeError} if `filepath` is directory and `extensions` not provided.
  6997. */
  6998. exports.lookupFiles = function lookupFiles(filepath, extensions, recursive) {
  6999. var files = [];
  7000. var stat;
  7001. if (!fs.existsSync(filepath)) {
  7002. if (fs.existsSync(filepath + '.js')) {
  7003. filepath += '.js';
  7004. } else {
  7005. // Handle glob
  7006. files = glob.sync(filepath);
  7007. if (!files.length) {
  7008. throw createNoFilesMatchPatternError(
  7009. 'Cannot find any files matching pattern ' + exports.dQuote(filepath),
  7010. filepath
  7011. );
  7012. }
  7013. return files;
  7014. }
  7015. }
  7016. // Handle file
  7017. try {
  7018. stat = fs.statSync(filepath);
  7019. if (stat.isFile()) {
  7020. return filepath;
  7021. }
  7022. } catch (err) {
  7023. // ignore error
  7024. return;
  7025. }
  7026. // Handle directory
  7027. fs.readdirSync(filepath).forEach(function(dirent) {
  7028. var pathname = path.join(filepath, dirent);
  7029. var stat;
  7030. try {
  7031. stat = fs.statSync(pathname);
  7032. if (stat.isDirectory()) {
  7033. if (recursive) {
  7034. files = files.concat(lookupFiles(pathname, extensions, recursive));
  7035. }
  7036. return;
  7037. }
  7038. } catch (err) {
  7039. // ignore error
  7040. return;
  7041. }
  7042. if (!extensions) {
  7043. throw createMissingArgumentError(
  7044. util.format(
  7045. 'Argument %s required when argument %s is a directory',
  7046. exports.sQuote('extensions'),
  7047. exports.sQuote('filepath')
  7048. ),
  7049. 'extensions',
  7050. 'array'
  7051. );
  7052. }
  7053. if (
  7054. !stat.isFile() ||
  7055. !hasMatchingExtname(pathname, extensions) ||
  7056. isHiddenOnUnix(pathname)
  7057. ) {
  7058. return;
  7059. }
  7060. files.push(pathname);
  7061. });
  7062. return files;
  7063. };
  7064. /**
  7065. * process.emitWarning or a polyfill
  7066. * @see https://nodejs.org/api/process.html#process_process_emitwarning_warning_options
  7067. * @ignore
  7068. */
  7069. function emitWarning(msg, type) {
  7070. if (process.emitWarning) {
  7071. process.emitWarning(msg, type);
  7072. } else {
  7073. process.nextTick(function() {
  7074. console.warn(type + ': ' + msg);
  7075. });
  7076. }
  7077. }
  7078. /**
  7079. * Show a deprecation warning. Each distinct message is only displayed once.
  7080. * Ignores empty messages.
  7081. *
  7082. * @param {string} [msg] - Warning to print
  7083. * @private
  7084. */
  7085. exports.deprecate = function deprecate(msg) {
  7086. msg = String(msg);
  7087. if (msg && !deprecate.cache[msg]) {
  7088. deprecate.cache[msg] = true;
  7089. emitWarning(msg, 'DeprecationWarning');
  7090. }
  7091. };
  7092. exports.deprecate.cache = {};
  7093. /**
  7094. * Show a generic warning.
  7095. * Ignores empty messages.
  7096. *
  7097. * @param {string} [msg] - Warning to print
  7098. * @private
  7099. */
  7100. exports.warn = function warn(msg) {
  7101. if (msg) {
  7102. emitWarning(msg);
  7103. }
  7104. };
  7105. /**
  7106. * @summary
  7107. * This Filter based on `mocha-clean` module.(see: `github.com/rstacruz/mocha-clean`)
  7108. * @description
  7109. * When invoking this function you get a filter function that get the Error.stack as an input,
  7110. * and return a prettify output.
  7111. * (i.e: strip Mocha and internal node functions from stack trace).
  7112. * @returns {Function}
  7113. */
  7114. exports.stackTraceFilter = function() {
  7115. // TODO: Replace with `process.browser`
  7116. var is = typeof document === 'undefined' ? {node: true} : {browser: true};
  7117. var slash = path.sep;
  7118. var cwd;
  7119. if (is.node) {
  7120. cwd = process.cwd() + slash;
  7121. } else {
  7122. cwd = (typeof location === 'undefined'
  7123. ? window.location
  7124. : location
  7125. ).href.replace(/\/[^/]*$/, '/');
  7126. slash = '/';
  7127. }
  7128. function isMochaInternal(line) {
  7129. return (
  7130. ~line.indexOf('node_modules' + slash + 'mocha' + slash) ||
  7131. ~line.indexOf(slash + 'mocha.js')
  7132. );
  7133. }
  7134. function isNodeInternal(line) {
  7135. return (
  7136. ~line.indexOf('(timers.js:') ||
  7137. ~line.indexOf('(events.js:') ||
  7138. ~line.indexOf('(node.js:') ||
  7139. ~line.indexOf('(module.js:') ||
  7140. ~line.indexOf('GeneratorFunctionPrototype.next (native)') ||
  7141. false
  7142. );
  7143. }
  7144. return function(stack) {
  7145. stack = stack.split('\n');
  7146. stack = stack.reduce(function(list, line) {
  7147. if (isMochaInternal(line)) {
  7148. return list;
  7149. }
  7150. if (is.node && isNodeInternal(line)) {
  7151. return list;
  7152. }
  7153. // Clean up cwd(absolute)
  7154. if (/:\d+:\d+\)?$/.test(line)) {
  7155. line = line.replace('(' + cwd, '(');
  7156. }
  7157. list.push(line);
  7158. return list;
  7159. }, []);
  7160. return stack.join('\n');
  7161. };
  7162. };
  7163. /**
  7164. * Crude, but effective.
  7165. * @public
  7166. * @param {*} value
  7167. * @returns {boolean} Whether or not `value` is a Promise
  7168. */
  7169. exports.isPromise = function isPromise(value) {
  7170. return (
  7171. typeof value === 'object' &&
  7172. value !== null &&
  7173. typeof value.then === 'function'
  7174. );
  7175. };
  7176. /**
  7177. * Clamps a numeric value to an inclusive range.
  7178. *
  7179. * @param {number} value - Value to be clamped.
  7180. * @param {numer[]} range - Two element array specifying [min, max] range.
  7181. * @returns {number} clamped value
  7182. */
  7183. exports.clamp = function clamp(value, range) {
  7184. return Math.min(Math.max(value, range[0]), range[1]);
  7185. };
  7186. /**
  7187. * Single quote text by combining with undirectional ASCII quotation marks.
  7188. *
  7189. * @description
  7190. * Provides a simple means of markup for quoting text to be used in output.
  7191. * Use this to quote names of variables, methods, and packages.
  7192. *
  7193. * <samp>package 'foo' cannot be found</samp>
  7194. *
  7195. * @private
  7196. * @param {string} str - Value to be quoted.
  7197. * @returns {string} quoted value
  7198. * @example
  7199. * sQuote('n') // => 'n'
  7200. */
  7201. exports.sQuote = function(str) {
  7202. return "'" + str + "'";
  7203. };
  7204. /**
  7205. * Double quote text by combining with undirectional ASCII quotation marks.
  7206. *
  7207. * @description
  7208. * Provides a simple means of markup for quoting text to be used in output.
  7209. * Use this to quote names of datatypes, classes, pathnames, and strings.
  7210. *
  7211. * <samp>argument 'value' must be "string" or "number"</samp>
  7212. *
  7213. * @private
  7214. * @param {string} str - Value to be quoted.
  7215. * @returns {string} quoted value
  7216. * @example
  7217. * dQuote('number') // => "number"
  7218. */
  7219. exports.dQuote = function(str) {
  7220. return '"' + str + '"';
  7221. };
  7222. /**
  7223. * Provides simplistic message translation for dealing with plurality.
  7224. *
  7225. * @description
  7226. * Use this to create messages which need to be singular or plural.
  7227. * Some languages have several plural forms, so _complete_ message clauses
  7228. * are preferable to generating the message on the fly.
  7229. *
  7230. * @private
  7231. * @param {number} n - Non-negative integer
  7232. * @param {string} msg1 - Message to be used in English for `n = 1`
  7233. * @param {string} msg2 - Message to be used in English for `n = 0, 2, 3, ...`
  7234. * @returns {string} message corresponding to value of `n`
  7235. * @example
  7236. * var sprintf = require('util').format;
  7237. * var pkgs = ['one', 'two'];
  7238. * var msg = sprintf(
  7239. * ngettext(
  7240. * pkgs.length,
  7241. * 'cannot load package: %s',
  7242. * 'cannot load packages: %s'
  7243. * ),
  7244. * pkgs.map(sQuote).join(', ')
  7245. * );
  7246. * console.log(msg); // => cannot load packages: 'one', 'two'
  7247. */
  7248. exports.ngettext = function(n, msg1, msg2) {
  7249. if (typeof n === 'number' && n >= 0) {
  7250. return n === 1 ? msg1 : msg2;
  7251. }
  7252. };
  7253. /**
  7254. * It's a noop.
  7255. * @public
  7256. */
  7257. exports.noop = function() {};
  7258. /**
  7259. * Creates a map-like object.
  7260. *
  7261. * @description
  7262. * A "map" is an object with no prototype, for our purposes. In some cases
  7263. * this would be more appropriate than a `Map`, especially if your environment
  7264. * doesn't support it. Recommended for use in Mocha's public APIs.
  7265. *
  7266. * @public
  7267. * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map|MDN:Map}
  7268. * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create#Custom_and_Null_objects|MDN:Object.create - Custom objects}
  7269. * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign|MDN:Object.assign}
  7270. * @param {...*} [obj] - Arguments to `Object.assign()`.
  7271. * @returns {Object} An object with no prototype, having `...obj` properties
  7272. */
  7273. exports.createMap = function(obj) {
  7274. return assign.apply(
  7275. null,
  7276. [Object.create(null)].concat(Array.prototype.slice.call(arguments))
  7277. );
  7278. };
  7279. /**
  7280. * Creates a read-only map-like object.
  7281. *
  7282. * @description
  7283. * This differs from {@link module:utils.createMap createMap} only in that
  7284. * the argument must be non-empty, because the result is frozen.
  7285. *
  7286. * @see {@link module:utils.createMap createMap}
  7287. * @param {...*} [obj] - Arguments to `Object.assign()`.
  7288. * @returns {Object} A frozen object with no prototype, having `...obj` properties
  7289. * @throws {TypeError} if argument is not a non-empty object.
  7290. */
  7291. exports.defineConstants = function(obj) {
  7292. if (type(obj) !== 'object' || !Object.keys(obj).length) {
  7293. throw new TypeError('Invalid argument; expected a non-empty object');
  7294. }
  7295. return Object.freeze(exports.createMap(obj));
  7296. };
  7297. }).call(this,require('_process'),require("buffer").Buffer)
  7298. },{"./errors":6,"_process":69,"buffer":43,"debug":45,"fs":42,"glob":42,"he":54,"object.assign":65,"path":42,"util":89}],39:[function(require,module,exports){
  7299. 'use strict'
  7300. exports.byteLength = byteLength
  7301. exports.toByteArray = toByteArray
  7302. exports.fromByteArray = fromByteArray
  7303. var lookup = []
  7304. var revLookup = []
  7305. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  7306. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  7307. for (var i = 0, len = code.length; i < len; ++i) {
  7308. lookup[i] = code[i]
  7309. revLookup[code.charCodeAt(i)] = i
  7310. }
  7311. // Support decoding URL-safe base64 strings, as Node.js does.
  7312. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  7313. revLookup['-'.charCodeAt(0)] = 62
  7314. revLookup['_'.charCodeAt(0)] = 63
  7315. function getLens (b64) {
  7316. var len = b64.length
  7317. if (len % 4 > 0) {
  7318. throw new Error('Invalid string. Length must be a multiple of 4')
  7319. }
  7320. // Trim off extra bytes after placeholder bytes are found
  7321. // See: https://github.com/beatgammit/base64-js/issues/42
  7322. var validLen = b64.indexOf('=')
  7323. if (validLen === -1) validLen = len
  7324. var placeHoldersLen = validLen === len
  7325. ? 0
  7326. : 4 - (validLen % 4)
  7327. return [validLen, placeHoldersLen]
  7328. }
  7329. // base64 is 4/3 + up to two characters of the original data
  7330. function byteLength (b64) {
  7331. var lens = getLens(b64)
  7332. var validLen = lens[0]
  7333. var placeHoldersLen = lens[1]
  7334. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  7335. }
  7336. function _byteLength (b64, validLen, placeHoldersLen) {
  7337. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  7338. }
  7339. function toByteArray (b64) {
  7340. var tmp
  7341. var lens = getLens(b64)
  7342. var validLen = lens[0]
  7343. var placeHoldersLen = lens[1]
  7344. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  7345. var curByte = 0
  7346. // if there are placeholders, only get up to the last complete 4 chars
  7347. var len = placeHoldersLen > 0
  7348. ? validLen - 4
  7349. : validLen
  7350. for (var i = 0; i < len; i += 4) {
  7351. tmp =
  7352. (revLookup[b64.charCodeAt(i)] << 18) |
  7353. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  7354. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  7355. revLookup[b64.charCodeAt(i + 3)]
  7356. arr[curByte++] = (tmp >> 16) & 0xFF
  7357. arr[curByte++] = (tmp >> 8) & 0xFF
  7358. arr[curByte++] = tmp & 0xFF
  7359. }
  7360. if (placeHoldersLen === 2) {
  7361. tmp =
  7362. (revLookup[b64.charCodeAt(i)] << 2) |
  7363. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  7364. arr[curByte++] = tmp & 0xFF
  7365. }
  7366. if (placeHoldersLen === 1) {
  7367. tmp =
  7368. (revLookup[b64.charCodeAt(i)] << 10) |
  7369. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  7370. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  7371. arr[curByte++] = (tmp >> 8) & 0xFF
  7372. arr[curByte++] = tmp & 0xFF
  7373. }
  7374. return arr
  7375. }
  7376. function tripletToBase64 (num) {
  7377. return lookup[num >> 18 & 0x3F] +
  7378. lookup[num >> 12 & 0x3F] +
  7379. lookup[num >> 6 & 0x3F] +
  7380. lookup[num & 0x3F]
  7381. }
  7382. function encodeChunk (uint8, start, end) {
  7383. var tmp
  7384. var output = []
  7385. for (var i = start; i < end; i += 3) {
  7386. tmp =
  7387. ((uint8[i] << 16) & 0xFF0000) +
  7388. ((uint8[i + 1] << 8) & 0xFF00) +
  7389. (uint8[i + 2] & 0xFF)
  7390. output.push(tripletToBase64(tmp))
  7391. }
  7392. return output.join('')
  7393. }
  7394. function fromByteArray (uint8) {
  7395. var tmp
  7396. var len = uint8.length
  7397. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  7398. var parts = []
  7399. var maxChunkLength = 16383 // must be multiple of 3
  7400. // go through the array every three bytes, we'll deal with trailing stuff later
  7401. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  7402. parts.push(encodeChunk(
  7403. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  7404. ))
  7405. }
  7406. // pad the end with zeros, but make sure to not forget the extra bytes
  7407. if (extraBytes === 1) {
  7408. tmp = uint8[len - 1]
  7409. parts.push(
  7410. lookup[tmp >> 2] +
  7411. lookup[(tmp << 4) & 0x3F] +
  7412. '=='
  7413. )
  7414. } else if (extraBytes === 2) {
  7415. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  7416. parts.push(
  7417. lookup[tmp >> 10] +
  7418. lookup[(tmp >> 4) & 0x3F] +
  7419. lookup[(tmp << 2) & 0x3F] +
  7420. '='
  7421. )
  7422. }
  7423. return parts.join('')
  7424. }
  7425. },{}],40:[function(require,module,exports){
  7426. },{}],41:[function(require,module,exports){
  7427. (function (process){
  7428. var WritableStream = require('stream').Writable
  7429. var inherits = require('util').inherits
  7430. module.exports = BrowserStdout
  7431. inherits(BrowserStdout, WritableStream)
  7432. function BrowserStdout(opts) {
  7433. if (!(this instanceof BrowserStdout)) return new BrowserStdout(opts)
  7434. opts = opts || {}
  7435. WritableStream.call(this, opts)
  7436. this.label = (opts.label !== undefined) ? opts.label : 'stdout'
  7437. }
  7438. BrowserStdout.prototype._write = function(chunks, encoding, cb) {
  7439. var output = chunks.toString ? chunks.toString() : chunks
  7440. if (this.label === false) {
  7441. console.log(output)
  7442. } else {
  7443. console.log(this.label+':', output)
  7444. }
  7445. process.nextTick(cb)
  7446. }
  7447. }).call(this,require('_process'))
  7448. },{"_process":69,"stream":84,"util":89}],42:[function(require,module,exports){
  7449. arguments[4][40][0].apply(exports,arguments)
  7450. },{"dup":40}],43:[function(require,module,exports){
  7451. (function (Buffer){
  7452. /*!
  7453. * The buffer module from node.js, for the browser.
  7454. *
  7455. * @author Feross Aboukhadijeh <https://feross.org>
  7456. * @license MIT
  7457. */
  7458. /* eslint-disable no-proto */
  7459. 'use strict'
  7460. var base64 = require('base64-js')
  7461. var ieee754 = require('ieee754')
  7462. exports.Buffer = Buffer
  7463. exports.SlowBuffer = SlowBuffer
  7464. exports.INSPECT_MAX_BYTES = 50
  7465. var K_MAX_LENGTH = 0x7fffffff
  7466. exports.kMaxLength = K_MAX_LENGTH
  7467. /**
  7468. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  7469. * === true Use Uint8Array implementation (fastest)
  7470. * === false Print warning and recommend using `buffer` v4.x which has an Object
  7471. * implementation (most compatible, even IE6)
  7472. *
  7473. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  7474. * Opera 11.6+, iOS 4.2+.
  7475. *
  7476. * We report that the browser does not support typed arrays if the are not subclassable
  7477. * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`
  7478. * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support
  7479. * for __proto__ and has a buggy typed array implementation.
  7480. */
  7481. Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport()
  7482. if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&
  7483. typeof console.error === 'function') {
  7484. console.error(
  7485. 'This browser lacks typed array (Uint8Array) support which is required by ' +
  7486. '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'
  7487. )
  7488. }
  7489. function typedArraySupport () {
  7490. // Can typed array instances can be augmented?
  7491. try {
  7492. var arr = new Uint8Array(1)
  7493. arr.__proto__ = { __proto__: Uint8Array.prototype, foo: function () { return 42 } }
  7494. return arr.foo() === 42
  7495. } catch (e) {
  7496. return false
  7497. }
  7498. }
  7499. Object.defineProperty(Buffer.prototype, 'parent', {
  7500. enumerable: true,
  7501. get: function () {
  7502. if (!Buffer.isBuffer(this)) return undefined
  7503. return this.buffer
  7504. }
  7505. })
  7506. Object.defineProperty(Buffer.prototype, 'offset', {
  7507. enumerable: true,
  7508. get: function () {
  7509. if (!Buffer.isBuffer(this)) return undefined
  7510. return this.byteOffset
  7511. }
  7512. })
  7513. function createBuffer (length) {
  7514. if (length > K_MAX_LENGTH) {
  7515. throw new RangeError('The value "' + length + '" is invalid for option "size"')
  7516. }
  7517. // Return an augmented `Uint8Array` instance
  7518. var buf = new Uint8Array(length)
  7519. buf.__proto__ = Buffer.prototype
  7520. return buf
  7521. }
  7522. /**
  7523. * The Buffer constructor returns instances of `Uint8Array` that have their
  7524. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  7525. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  7526. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  7527. * returns a single octet.
  7528. *
  7529. * The `Uint8Array` prototype remains unmodified.
  7530. */
  7531. function Buffer (arg, encodingOrOffset, length) {
  7532. // Common case.
  7533. if (typeof arg === 'number') {
  7534. if (typeof encodingOrOffset === 'string') {
  7535. throw new TypeError(
  7536. 'The "string" argument must be of type string. Received type number'
  7537. )
  7538. }
  7539. return allocUnsafe(arg)
  7540. }
  7541. return from(arg, encodingOrOffset, length)
  7542. }
  7543. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  7544. if (typeof Symbol !== 'undefined' && Symbol.species != null &&
  7545. Buffer[Symbol.species] === Buffer) {
  7546. Object.defineProperty(Buffer, Symbol.species, {
  7547. value: null,
  7548. configurable: true,
  7549. enumerable: false,
  7550. writable: false
  7551. })
  7552. }
  7553. Buffer.poolSize = 8192 // not used by this implementation
  7554. function from (value, encodingOrOffset, length) {
  7555. if (typeof value === 'string') {
  7556. return fromString(value, encodingOrOffset)
  7557. }
  7558. if (ArrayBuffer.isView(value)) {
  7559. return fromArrayLike(value)
  7560. }
  7561. if (value == null) {
  7562. throw TypeError(
  7563. 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
  7564. 'or Array-like Object. Received type ' + (typeof value)
  7565. )
  7566. }
  7567. if (isInstance(value, ArrayBuffer) ||
  7568. (value && isInstance(value.buffer, ArrayBuffer))) {
  7569. return fromArrayBuffer(value, encodingOrOffset, length)
  7570. }
  7571. if (typeof value === 'number') {
  7572. throw new TypeError(
  7573. 'The "value" argument must not be of type number. Received type number'
  7574. )
  7575. }
  7576. var valueOf = value.valueOf && value.valueOf()
  7577. if (valueOf != null && valueOf !== value) {
  7578. return Buffer.from(valueOf, encodingOrOffset, length)
  7579. }
  7580. var b = fromObject(value)
  7581. if (b) return b
  7582. if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&
  7583. typeof value[Symbol.toPrimitive] === 'function') {
  7584. return Buffer.from(
  7585. value[Symbol.toPrimitive]('string'), encodingOrOffset, length
  7586. )
  7587. }
  7588. throw new TypeError(
  7589. 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +
  7590. 'or Array-like Object. Received type ' + (typeof value)
  7591. )
  7592. }
  7593. /**
  7594. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  7595. * if value is a number.
  7596. * Buffer.from(str[, encoding])
  7597. * Buffer.from(array)
  7598. * Buffer.from(buffer)
  7599. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  7600. **/
  7601. Buffer.from = function (value, encodingOrOffset, length) {
  7602. return from(value, encodingOrOffset, length)
  7603. }
  7604. // Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:
  7605. // https://github.com/feross/buffer/pull/148
  7606. Buffer.prototype.__proto__ = Uint8Array.prototype
  7607. Buffer.__proto__ = Uint8Array
  7608. function assertSize (size) {
  7609. if (typeof size !== 'number') {
  7610. throw new TypeError('"size" argument must be of type number')
  7611. } else if (size < 0) {
  7612. throw new RangeError('The value "' + size + '" is invalid for option "size"')
  7613. }
  7614. }
  7615. function alloc (size, fill, encoding) {
  7616. assertSize(size)
  7617. if (size <= 0) {
  7618. return createBuffer(size)
  7619. }
  7620. if (fill !== undefined) {
  7621. // Only pay attention to encoding if it's a string. This
  7622. // prevents accidentally sending in a number that would
  7623. // be interpretted as a start offset.
  7624. return typeof encoding === 'string'
  7625. ? createBuffer(size).fill(fill, encoding)
  7626. : createBuffer(size).fill(fill)
  7627. }
  7628. return createBuffer(size)
  7629. }
  7630. /**
  7631. * Creates a new filled Buffer instance.
  7632. * alloc(size[, fill[, encoding]])
  7633. **/
  7634. Buffer.alloc = function (size, fill, encoding) {
  7635. return alloc(size, fill, encoding)
  7636. }
  7637. function allocUnsafe (size) {
  7638. assertSize(size)
  7639. return createBuffer(size < 0 ? 0 : checked(size) | 0)
  7640. }
  7641. /**
  7642. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  7643. * */
  7644. Buffer.allocUnsafe = function (size) {
  7645. return allocUnsafe(size)
  7646. }
  7647. /**
  7648. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  7649. */
  7650. Buffer.allocUnsafeSlow = function (size) {
  7651. return allocUnsafe(size)
  7652. }
  7653. function fromString (string, encoding) {
  7654. if (typeof encoding !== 'string' || encoding === '') {
  7655. encoding = 'utf8'
  7656. }
  7657. if (!Buffer.isEncoding(encoding)) {
  7658. throw new TypeError('Unknown encoding: ' + encoding)
  7659. }
  7660. var length = byteLength(string, encoding) | 0
  7661. var buf = createBuffer(length)
  7662. var actual = buf.write(string, encoding)
  7663. if (actual !== length) {
  7664. // Writing a hex string, for example, that contains invalid characters will
  7665. // cause everything after the first invalid character to be ignored. (e.g.
  7666. // 'abxxcd' will be treated as 'ab')
  7667. buf = buf.slice(0, actual)
  7668. }
  7669. return buf
  7670. }
  7671. function fromArrayLike (array) {
  7672. var length = array.length < 0 ? 0 : checked(array.length) | 0
  7673. var buf = createBuffer(length)
  7674. for (var i = 0; i < length; i += 1) {
  7675. buf[i] = array[i] & 255
  7676. }
  7677. return buf
  7678. }
  7679. function fromArrayBuffer (array, byteOffset, length) {
  7680. if (byteOffset < 0 || array.byteLength < byteOffset) {
  7681. throw new RangeError('"offset" is outside of buffer bounds')
  7682. }
  7683. if (array.byteLength < byteOffset + (length || 0)) {
  7684. throw new RangeError('"length" is outside of buffer bounds')
  7685. }
  7686. var buf
  7687. if (byteOffset === undefined && length === undefined) {
  7688. buf = new Uint8Array(array)
  7689. } else if (length === undefined) {
  7690. buf = new Uint8Array(array, byteOffset)
  7691. } else {
  7692. buf = new Uint8Array(array, byteOffset, length)
  7693. }
  7694. // Return an augmented `Uint8Array` instance
  7695. buf.__proto__ = Buffer.prototype
  7696. return buf
  7697. }
  7698. function fromObject (obj) {
  7699. if (Buffer.isBuffer(obj)) {
  7700. var len = checked(obj.length) | 0
  7701. var buf = createBuffer(len)
  7702. if (buf.length === 0) {
  7703. return buf
  7704. }
  7705. obj.copy(buf, 0, 0, len)
  7706. return buf
  7707. }
  7708. if (obj.length !== undefined) {
  7709. if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {
  7710. return createBuffer(0)
  7711. }
  7712. return fromArrayLike(obj)
  7713. }
  7714. if (obj.type === 'Buffer' && Array.isArray(obj.data)) {
  7715. return fromArrayLike(obj.data)
  7716. }
  7717. }
  7718. function checked (length) {
  7719. // Note: cannot use `length < K_MAX_LENGTH` here because that fails when
  7720. // length is NaN (which is otherwise coerced to zero.)
  7721. if (length >= K_MAX_LENGTH) {
  7722. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  7723. 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')
  7724. }
  7725. return length | 0
  7726. }
  7727. function SlowBuffer (length) {
  7728. if (+length != length) { // eslint-disable-line eqeqeq
  7729. length = 0
  7730. }
  7731. return Buffer.alloc(+length)
  7732. }
  7733. Buffer.isBuffer = function isBuffer (b) {
  7734. return b != null && b._isBuffer === true &&
  7735. b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false
  7736. }
  7737. Buffer.compare = function compare (a, b) {
  7738. if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)
  7739. if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)
  7740. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  7741. throw new TypeError(
  7742. 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array'
  7743. )
  7744. }
  7745. if (a === b) return 0
  7746. var x = a.length
  7747. var y = b.length
  7748. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  7749. if (a[i] !== b[i]) {
  7750. x = a[i]
  7751. y = b[i]
  7752. break
  7753. }
  7754. }
  7755. if (x < y) return -1
  7756. if (y < x) return 1
  7757. return 0
  7758. }
  7759. Buffer.isEncoding = function isEncoding (encoding) {
  7760. switch (String(encoding).toLowerCase()) {
  7761. case 'hex':
  7762. case 'utf8':
  7763. case 'utf-8':
  7764. case 'ascii':
  7765. case 'latin1':
  7766. case 'binary':
  7767. case 'base64':
  7768. case 'ucs2':
  7769. case 'ucs-2':
  7770. case 'utf16le':
  7771. case 'utf-16le':
  7772. return true
  7773. default:
  7774. return false
  7775. }
  7776. }
  7777. Buffer.concat = function concat (list, length) {
  7778. if (!Array.isArray(list)) {
  7779. throw new TypeError('"list" argument must be an Array of Buffers')
  7780. }
  7781. if (list.length === 0) {
  7782. return Buffer.alloc(0)
  7783. }
  7784. var i
  7785. if (length === undefined) {
  7786. length = 0
  7787. for (i = 0; i < list.length; ++i) {
  7788. length += list[i].length
  7789. }
  7790. }
  7791. var buffer = Buffer.allocUnsafe(length)
  7792. var pos = 0
  7793. for (i = 0; i < list.length; ++i) {
  7794. var buf = list[i]
  7795. if (isInstance(buf, Uint8Array)) {
  7796. buf = Buffer.from(buf)
  7797. }
  7798. if (!Buffer.isBuffer(buf)) {
  7799. throw new TypeError('"list" argument must be an Array of Buffers')
  7800. }
  7801. buf.copy(buffer, pos)
  7802. pos += buf.length
  7803. }
  7804. return buffer
  7805. }
  7806. function byteLength (string, encoding) {
  7807. if (Buffer.isBuffer(string)) {
  7808. return string.length
  7809. }
  7810. if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {
  7811. return string.byteLength
  7812. }
  7813. if (typeof string !== 'string') {
  7814. throw new TypeError(
  7815. 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' +
  7816. 'Received type ' + typeof string
  7817. )
  7818. }
  7819. var len = string.length
  7820. var mustMatch = (arguments.length > 2 && arguments[2] === true)
  7821. if (!mustMatch && len === 0) return 0
  7822. // Use a for loop to avoid recursion
  7823. var loweredCase = false
  7824. for (;;) {
  7825. switch (encoding) {
  7826. case 'ascii':
  7827. case 'latin1':
  7828. case 'binary':
  7829. return len
  7830. case 'utf8':
  7831. case 'utf-8':
  7832. return utf8ToBytes(string).length
  7833. case 'ucs2':
  7834. case 'ucs-2':
  7835. case 'utf16le':
  7836. case 'utf-16le':
  7837. return len * 2
  7838. case 'hex':
  7839. return len >>> 1
  7840. case 'base64':
  7841. return base64ToBytes(string).length
  7842. default:
  7843. if (loweredCase) {
  7844. return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8
  7845. }
  7846. encoding = ('' + encoding).toLowerCase()
  7847. loweredCase = true
  7848. }
  7849. }
  7850. }
  7851. Buffer.byteLength = byteLength
  7852. function slowToString (encoding, start, end) {
  7853. var loweredCase = false
  7854. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  7855. // property of a typed array.
  7856. // This behaves neither like String nor Uint8Array in that we set start/end
  7857. // to their upper/lower bounds if the value passed is out of range.
  7858. // undefined is handled specially as per ECMA-262 6th Edition,
  7859. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  7860. if (start === undefined || start < 0) {
  7861. start = 0
  7862. }
  7863. // Return early if start > this.length. Done here to prevent potential uint32
  7864. // coercion fail below.
  7865. if (start > this.length) {
  7866. return ''
  7867. }
  7868. if (end === undefined || end > this.length) {
  7869. end = this.length
  7870. }
  7871. if (end <= 0) {
  7872. return ''
  7873. }
  7874. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  7875. end >>>= 0
  7876. start >>>= 0
  7877. if (end <= start) {
  7878. return ''
  7879. }
  7880. if (!encoding) encoding = 'utf8'
  7881. while (true) {
  7882. switch (encoding) {
  7883. case 'hex':
  7884. return hexSlice(this, start, end)
  7885. case 'utf8':
  7886. case 'utf-8':
  7887. return utf8Slice(this, start, end)
  7888. case 'ascii':
  7889. return asciiSlice(this, start, end)
  7890. case 'latin1':
  7891. case 'binary':
  7892. return latin1Slice(this, start, end)
  7893. case 'base64':
  7894. return base64Slice(this, start, end)
  7895. case 'ucs2':
  7896. case 'ucs-2':
  7897. case 'utf16le':
  7898. case 'utf-16le':
  7899. return utf16leSlice(this, start, end)
  7900. default:
  7901. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  7902. encoding = (encoding + '').toLowerCase()
  7903. loweredCase = true
  7904. }
  7905. }
  7906. }
  7907. // This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)
  7908. // to detect a Buffer instance. It's not possible to use `instanceof Buffer`
  7909. // reliably in a browserify context because there could be multiple different
  7910. // copies of the 'buffer' package in use. This method works even for Buffer
  7911. // instances that were created from another copy of the `buffer` package.
  7912. // See: https://github.com/feross/buffer/issues/154
  7913. Buffer.prototype._isBuffer = true
  7914. function swap (b, n, m) {
  7915. var i = b[n]
  7916. b[n] = b[m]
  7917. b[m] = i
  7918. }
  7919. Buffer.prototype.swap16 = function swap16 () {
  7920. var len = this.length
  7921. if (len % 2 !== 0) {
  7922. throw new RangeError('Buffer size must be a multiple of 16-bits')
  7923. }
  7924. for (var i = 0; i < len; i += 2) {
  7925. swap(this, i, i + 1)
  7926. }
  7927. return this
  7928. }
  7929. Buffer.prototype.swap32 = function swap32 () {
  7930. var len = this.length
  7931. if (len % 4 !== 0) {
  7932. throw new RangeError('Buffer size must be a multiple of 32-bits')
  7933. }
  7934. for (var i = 0; i < len; i += 4) {
  7935. swap(this, i, i + 3)
  7936. swap(this, i + 1, i + 2)
  7937. }
  7938. return this
  7939. }
  7940. Buffer.prototype.swap64 = function swap64 () {
  7941. var len = this.length
  7942. if (len % 8 !== 0) {
  7943. throw new RangeError('Buffer size must be a multiple of 64-bits')
  7944. }
  7945. for (var i = 0; i < len; i += 8) {
  7946. swap(this, i, i + 7)
  7947. swap(this, i + 1, i + 6)
  7948. swap(this, i + 2, i + 5)
  7949. swap(this, i + 3, i + 4)
  7950. }
  7951. return this
  7952. }
  7953. Buffer.prototype.toString = function toString () {
  7954. var length = this.length
  7955. if (length === 0) return ''
  7956. if (arguments.length === 0) return utf8Slice(this, 0, length)
  7957. return slowToString.apply(this, arguments)
  7958. }
  7959. Buffer.prototype.toLocaleString = Buffer.prototype.toString
  7960. Buffer.prototype.equals = function equals (b) {
  7961. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  7962. if (this === b) return true
  7963. return Buffer.compare(this, b) === 0
  7964. }
  7965. Buffer.prototype.inspect = function inspect () {
  7966. var str = ''
  7967. var max = exports.INSPECT_MAX_BYTES
  7968. str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()
  7969. if (this.length > max) str += ' ... '
  7970. return '<Buffer ' + str + '>'
  7971. }
  7972. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  7973. if (isInstance(target, Uint8Array)) {
  7974. target = Buffer.from(target, target.offset, target.byteLength)
  7975. }
  7976. if (!Buffer.isBuffer(target)) {
  7977. throw new TypeError(
  7978. 'The "target" argument must be one of type Buffer or Uint8Array. ' +
  7979. 'Received type ' + (typeof target)
  7980. )
  7981. }
  7982. if (start === undefined) {
  7983. start = 0
  7984. }
  7985. if (end === undefined) {
  7986. end = target ? target.length : 0
  7987. }
  7988. if (thisStart === undefined) {
  7989. thisStart = 0
  7990. }
  7991. if (thisEnd === undefined) {
  7992. thisEnd = this.length
  7993. }
  7994. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  7995. throw new RangeError('out of range index')
  7996. }
  7997. if (thisStart >= thisEnd && start >= end) {
  7998. return 0
  7999. }
  8000. if (thisStart >= thisEnd) {
  8001. return -1
  8002. }
  8003. if (start >= end) {
  8004. return 1
  8005. }
  8006. start >>>= 0
  8007. end >>>= 0
  8008. thisStart >>>= 0
  8009. thisEnd >>>= 0
  8010. if (this === target) return 0
  8011. var x = thisEnd - thisStart
  8012. var y = end - start
  8013. var len = Math.min(x, y)
  8014. var thisCopy = this.slice(thisStart, thisEnd)
  8015. var targetCopy = target.slice(start, end)
  8016. for (var i = 0; i < len; ++i) {
  8017. if (thisCopy[i] !== targetCopy[i]) {
  8018. x = thisCopy[i]
  8019. y = targetCopy[i]
  8020. break
  8021. }
  8022. }
  8023. if (x < y) return -1
  8024. if (y < x) return 1
  8025. return 0
  8026. }
  8027. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  8028. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  8029. //
  8030. // Arguments:
  8031. // - buffer - a Buffer to search
  8032. // - val - a string, Buffer, or number
  8033. // - byteOffset - an index into `buffer`; will be clamped to an int32
  8034. // - encoding - an optional encoding, relevant is val is a string
  8035. // - dir - true for indexOf, false for lastIndexOf
  8036. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  8037. // Empty buffer means no match
  8038. if (buffer.length === 0) return -1
  8039. // Normalize byteOffset
  8040. if (typeof byteOffset === 'string') {
  8041. encoding = byteOffset
  8042. byteOffset = 0
  8043. } else if (byteOffset > 0x7fffffff) {
  8044. byteOffset = 0x7fffffff
  8045. } else if (byteOffset < -0x80000000) {
  8046. byteOffset = -0x80000000
  8047. }
  8048. byteOffset = +byteOffset // Coerce to Number.
  8049. if (numberIsNaN(byteOffset)) {
  8050. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  8051. byteOffset = dir ? 0 : (buffer.length - 1)
  8052. }
  8053. // Normalize byteOffset: negative offsets start from the end of the buffer
  8054. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  8055. if (byteOffset >= buffer.length) {
  8056. if (dir) return -1
  8057. else byteOffset = buffer.length - 1
  8058. } else if (byteOffset < 0) {
  8059. if (dir) byteOffset = 0
  8060. else return -1
  8061. }
  8062. // Normalize val
  8063. if (typeof val === 'string') {
  8064. val = Buffer.from(val, encoding)
  8065. }
  8066. // Finally, search either indexOf (if dir is true) or lastIndexOf
  8067. if (Buffer.isBuffer(val)) {
  8068. // Special case: looking for empty string/buffer always fails
  8069. if (val.length === 0) {
  8070. return -1
  8071. }
  8072. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  8073. } else if (typeof val === 'number') {
  8074. val = val & 0xFF // Search for a byte value [0-255]
  8075. if (typeof Uint8Array.prototype.indexOf === 'function') {
  8076. if (dir) {
  8077. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  8078. } else {
  8079. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  8080. }
  8081. }
  8082. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  8083. }
  8084. throw new TypeError('val must be string, number or Buffer')
  8085. }
  8086. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  8087. var indexSize = 1
  8088. var arrLength = arr.length
  8089. var valLength = val.length
  8090. if (encoding !== undefined) {
  8091. encoding = String(encoding).toLowerCase()
  8092. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  8093. encoding === 'utf16le' || encoding === 'utf-16le') {
  8094. if (arr.length < 2 || val.length < 2) {
  8095. return -1
  8096. }
  8097. indexSize = 2
  8098. arrLength /= 2
  8099. valLength /= 2
  8100. byteOffset /= 2
  8101. }
  8102. }
  8103. function read (buf, i) {
  8104. if (indexSize === 1) {
  8105. return buf[i]
  8106. } else {
  8107. return buf.readUInt16BE(i * indexSize)
  8108. }
  8109. }
  8110. var i
  8111. if (dir) {
  8112. var foundIndex = -1
  8113. for (i = byteOffset; i < arrLength; i++) {
  8114. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  8115. if (foundIndex === -1) foundIndex = i
  8116. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  8117. } else {
  8118. if (foundIndex !== -1) i -= i - foundIndex
  8119. foundIndex = -1
  8120. }
  8121. }
  8122. } else {
  8123. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  8124. for (i = byteOffset; i >= 0; i--) {
  8125. var found = true
  8126. for (var j = 0; j < valLength; j++) {
  8127. if (read(arr, i + j) !== read(val, j)) {
  8128. found = false
  8129. break
  8130. }
  8131. }
  8132. if (found) return i
  8133. }
  8134. }
  8135. return -1
  8136. }
  8137. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  8138. return this.indexOf(val, byteOffset, encoding) !== -1
  8139. }
  8140. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  8141. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  8142. }
  8143. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  8144. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  8145. }
  8146. function hexWrite (buf, string, offset, length) {
  8147. offset = Number(offset) || 0
  8148. var remaining = buf.length - offset
  8149. if (!length) {
  8150. length = remaining
  8151. } else {
  8152. length = Number(length)
  8153. if (length > remaining) {
  8154. length = remaining
  8155. }
  8156. }
  8157. var strLen = string.length
  8158. if (length > strLen / 2) {
  8159. length = strLen / 2
  8160. }
  8161. for (var i = 0; i < length; ++i) {
  8162. var parsed = parseInt(string.substr(i * 2, 2), 16)
  8163. if (numberIsNaN(parsed)) return i
  8164. buf[offset + i] = parsed
  8165. }
  8166. return i
  8167. }
  8168. function utf8Write (buf, string, offset, length) {
  8169. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  8170. }
  8171. function asciiWrite (buf, string, offset, length) {
  8172. return blitBuffer(asciiToBytes(string), buf, offset, length)
  8173. }
  8174. function latin1Write (buf, string, offset, length) {
  8175. return asciiWrite(buf, string, offset, length)
  8176. }
  8177. function base64Write (buf, string, offset, length) {
  8178. return blitBuffer(base64ToBytes(string), buf, offset, length)
  8179. }
  8180. function ucs2Write (buf, string, offset, length) {
  8181. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  8182. }
  8183. Buffer.prototype.write = function write (string, offset, length, encoding) {
  8184. // Buffer#write(string)
  8185. if (offset === undefined) {
  8186. encoding = 'utf8'
  8187. length = this.length
  8188. offset = 0
  8189. // Buffer#write(string, encoding)
  8190. } else if (length === undefined && typeof offset === 'string') {
  8191. encoding = offset
  8192. length = this.length
  8193. offset = 0
  8194. // Buffer#write(string, offset[, length][, encoding])
  8195. } else if (isFinite(offset)) {
  8196. offset = offset >>> 0
  8197. if (isFinite(length)) {
  8198. length = length >>> 0
  8199. if (encoding === undefined) encoding = 'utf8'
  8200. } else {
  8201. encoding = length
  8202. length = undefined
  8203. }
  8204. } else {
  8205. throw new Error(
  8206. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  8207. )
  8208. }
  8209. var remaining = this.length - offset
  8210. if (length === undefined || length > remaining) length = remaining
  8211. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  8212. throw new RangeError('Attempt to write outside buffer bounds')
  8213. }
  8214. if (!encoding) encoding = 'utf8'
  8215. var loweredCase = false
  8216. for (;;) {
  8217. switch (encoding) {
  8218. case 'hex':
  8219. return hexWrite(this, string, offset, length)
  8220. case 'utf8':
  8221. case 'utf-8':
  8222. return utf8Write(this, string, offset, length)
  8223. case 'ascii':
  8224. return asciiWrite(this, string, offset, length)
  8225. case 'latin1':
  8226. case 'binary':
  8227. return latin1Write(this, string, offset, length)
  8228. case 'base64':
  8229. // Warning: maxLength not taken into account in base64Write
  8230. return base64Write(this, string, offset, length)
  8231. case 'ucs2':
  8232. case 'ucs-2':
  8233. case 'utf16le':
  8234. case 'utf-16le':
  8235. return ucs2Write(this, string, offset, length)
  8236. default:
  8237. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  8238. encoding = ('' + encoding).toLowerCase()
  8239. loweredCase = true
  8240. }
  8241. }
  8242. }
  8243. Buffer.prototype.toJSON = function toJSON () {
  8244. return {
  8245. type: 'Buffer',
  8246. data: Array.prototype.slice.call(this._arr || this, 0)
  8247. }
  8248. }
  8249. function base64Slice (buf, start, end) {
  8250. if (start === 0 && end === buf.length) {
  8251. return base64.fromByteArray(buf)
  8252. } else {
  8253. return base64.fromByteArray(buf.slice(start, end))
  8254. }
  8255. }
  8256. function utf8Slice (buf, start, end) {
  8257. end = Math.min(buf.length, end)
  8258. var res = []
  8259. var i = start
  8260. while (i < end) {
  8261. var firstByte = buf[i]
  8262. var codePoint = null
  8263. var bytesPerSequence = (firstByte > 0xEF) ? 4
  8264. : (firstByte > 0xDF) ? 3
  8265. : (firstByte > 0xBF) ? 2
  8266. : 1
  8267. if (i + bytesPerSequence <= end) {
  8268. var secondByte, thirdByte, fourthByte, tempCodePoint
  8269. switch (bytesPerSequence) {
  8270. case 1:
  8271. if (firstByte < 0x80) {
  8272. codePoint = firstByte
  8273. }
  8274. break
  8275. case 2:
  8276. secondByte = buf[i + 1]
  8277. if ((secondByte & 0xC0) === 0x80) {
  8278. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  8279. if (tempCodePoint > 0x7F) {
  8280. codePoint = tempCodePoint
  8281. }
  8282. }
  8283. break
  8284. case 3:
  8285. secondByte = buf[i + 1]
  8286. thirdByte = buf[i + 2]
  8287. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  8288. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  8289. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  8290. codePoint = tempCodePoint
  8291. }
  8292. }
  8293. break
  8294. case 4:
  8295. secondByte = buf[i + 1]
  8296. thirdByte = buf[i + 2]
  8297. fourthByte = buf[i + 3]
  8298. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  8299. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  8300. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  8301. codePoint = tempCodePoint
  8302. }
  8303. }
  8304. }
  8305. }
  8306. if (codePoint === null) {
  8307. // we did not generate a valid codePoint so insert a
  8308. // replacement char (U+FFFD) and advance only 1 byte
  8309. codePoint = 0xFFFD
  8310. bytesPerSequence = 1
  8311. } else if (codePoint > 0xFFFF) {
  8312. // encode to utf16 (surrogate pair dance)
  8313. codePoint -= 0x10000
  8314. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  8315. codePoint = 0xDC00 | codePoint & 0x3FF
  8316. }
  8317. res.push(codePoint)
  8318. i += bytesPerSequence
  8319. }
  8320. return decodeCodePointsArray(res)
  8321. }
  8322. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  8323. // the lowest limit is Chrome, with 0x10000 args.
  8324. // We go 1 magnitude less, for safety
  8325. var MAX_ARGUMENTS_LENGTH = 0x1000
  8326. function decodeCodePointsArray (codePoints) {
  8327. var len = codePoints.length
  8328. if (len <= MAX_ARGUMENTS_LENGTH) {
  8329. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  8330. }
  8331. // Decode in chunks to avoid "call stack size exceeded".
  8332. var res = ''
  8333. var i = 0
  8334. while (i < len) {
  8335. res += String.fromCharCode.apply(
  8336. String,
  8337. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  8338. )
  8339. }
  8340. return res
  8341. }
  8342. function asciiSlice (buf, start, end) {
  8343. var ret = ''
  8344. end = Math.min(buf.length, end)
  8345. for (var i = start; i < end; ++i) {
  8346. ret += String.fromCharCode(buf[i] & 0x7F)
  8347. }
  8348. return ret
  8349. }
  8350. function latin1Slice (buf, start, end) {
  8351. var ret = ''
  8352. end = Math.min(buf.length, end)
  8353. for (var i = start; i < end; ++i) {
  8354. ret += String.fromCharCode(buf[i])
  8355. }
  8356. return ret
  8357. }
  8358. function hexSlice (buf, start, end) {
  8359. var len = buf.length
  8360. if (!start || start < 0) start = 0
  8361. if (!end || end < 0 || end > len) end = len
  8362. var out = ''
  8363. for (var i = start; i < end; ++i) {
  8364. out += toHex(buf[i])
  8365. }
  8366. return out
  8367. }
  8368. function utf16leSlice (buf, start, end) {
  8369. var bytes = buf.slice(start, end)
  8370. var res = ''
  8371. for (var i = 0; i < bytes.length; i += 2) {
  8372. res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))
  8373. }
  8374. return res
  8375. }
  8376. Buffer.prototype.slice = function slice (start, end) {
  8377. var len = this.length
  8378. start = ~~start
  8379. end = end === undefined ? len : ~~end
  8380. if (start < 0) {
  8381. start += len
  8382. if (start < 0) start = 0
  8383. } else if (start > len) {
  8384. start = len
  8385. }
  8386. if (end < 0) {
  8387. end += len
  8388. if (end < 0) end = 0
  8389. } else if (end > len) {
  8390. end = len
  8391. }
  8392. if (end < start) end = start
  8393. var newBuf = this.subarray(start, end)
  8394. // Return an augmented `Uint8Array` instance
  8395. newBuf.__proto__ = Buffer.prototype
  8396. return newBuf
  8397. }
  8398. /*
  8399. * Need to make sure that buffer isn't trying to write out of bounds.
  8400. */
  8401. function checkOffset (offset, ext, length) {
  8402. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  8403. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  8404. }
  8405. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  8406. offset = offset >>> 0
  8407. byteLength = byteLength >>> 0
  8408. if (!noAssert) checkOffset(offset, byteLength, this.length)
  8409. var val = this[offset]
  8410. var mul = 1
  8411. var i = 0
  8412. while (++i < byteLength && (mul *= 0x100)) {
  8413. val += this[offset + i] * mul
  8414. }
  8415. return val
  8416. }
  8417. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  8418. offset = offset >>> 0
  8419. byteLength = byteLength >>> 0
  8420. if (!noAssert) {
  8421. checkOffset(offset, byteLength, this.length)
  8422. }
  8423. var val = this[offset + --byteLength]
  8424. var mul = 1
  8425. while (byteLength > 0 && (mul *= 0x100)) {
  8426. val += this[offset + --byteLength] * mul
  8427. }
  8428. return val
  8429. }
  8430. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  8431. offset = offset >>> 0
  8432. if (!noAssert) checkOffset(offset, 1, this.length)
  8433. return this[offset]
  8434. }
  8435. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  8436. offset = offset >>> 0
  8437. if (!noAssert) checkOffset(offset, 2, this.length)
  8438. return this[offset] | (this[offset + 1] << 8)
  8439. }
  8440. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  8441. offset = offset >>> 0
  8442. if (!noAssert) checkOffset(offset, 2, this.length)
  8443. return (this[offset] << 8) | this[offset + 1]
  8444. }
  8445. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  8446. offset = offset >>> 0
  8447. if (!noAssert) checkOffset(offset, 4, this.length)
  8448. return ((this[offset]) |
  8449. (this[offset + 1] << 8) |
  8450. (this[offset + 2] << 16)) +
  8451. (this[offset + 3] * 0x1000000)
  8452. }
  8453. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  8454. offset = offset >>> 0
  8455. if (!noAssert) checkOffset(offset, 4, this.length)
  8456. return (this[offset] * 0x1000000) +
  8457. ((this[offset + 1] << 16) |
  8458. (this[offset + 2] << 8) |
  8459. this[offset + 3])
  8460. }
  8461. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  8462. offset = offset >>> 0
  8463. byteLength = byteLength >>> 0
  8464. if (!noAssert) checkOffset(offset, byteLength, this.length)
  8465. var val = this[offset]
  8466. var mul = 1
  8467. var i = 0
  8468. while (++i < byteLength && (mul *= 0x100)) {
  8469. val += this[offset + i] * mul
  8470. }
  8471. mul *= 0x80
  8472. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  8473. return val
  8474. }
  8475. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  8476. offset = offset >>> 0
  8477. byteLength = byteLength >>> 0
  8478. if (!noAssert) checkOffset(offset, byteLength, this.length)
  8479. var i = byteLength
  8480. var mul = 1
  8481. var val = this[offset + --i]
  8482. while (i > 0 && (mul *= 0x100)) {
  8483. val += this[offset + --i] * mul
  8484. }
  8485. mul *= 0x80
  8486. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  8487. return val
  8488. }
  8489. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  8490. offset = offset >>> 0
  8491. if (!noAssert) checkOffset(offset, 1, this.length)
  8492. if (!(this[offset] & 0x80)) return (this[offset])
  8493. return ((0xff - this[offset] + 1) * -1)
  8494. }
  8495. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  8496. offset = offset >>> 0
  8497. if (!noAssert) checkOffset(offset, 2, this.length)
  8498. var val = this[offset] | (this[offset + 1] << 8)
  8499. return (val & 0x8000) ? val | 0xFFFF0000 : val
  8500. }
  8501. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  8502. offset = offset >>> 0
  8503. if (!noAssert) checkOffset(offset, 2, this.length)
  8504. var val = this[offset + 1] | (this[offset] << 8)
  8505. return (val & 0x8000) ? val | 0xFFFF0000 : val
  8506. }
  8507. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  8508. offset = offset >>> 0
  8509. if (!noAssert) checkOffset(offset, 4, this.length)
  8510. return (this[offset]) |
  8511. (this[offset + 1] << 8) |
  8512. (this[offset + 2] << 16) |
  8513. (this[offset + 3] << 24)
  8514. }
  8515. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  8516. offset = offset >>> 0
  8517. if (!noAssert) checkOffset(offset, 4, this.length)
  8518. return (this[offset] << 24) |
  8519. (this[offset + 1] << 16) |
  8520. (this[offset + 2] << 8) |
  8521. (this[offset + 3])
  8522. }
  8523. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  8524. offset = offset >>> 0
  8525. if (!noAssert) checkOffset(offset, 4, this.length)
  8526. return ieee754.read(this, offset, true, 23, 4)
  8527. }
  8528. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  8529. offset = offset >>> 0
  8530. if (!noAssert) checkOffset(offset, 4, this.length)
  8531. return ieee754.read(this, offset, false, 23, 4)
  8532. }
  8533. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  8534. offset = offset >>> 0
  8535. if (!noAssert) checkOffset(offset, 8, this.length)
  8536. return ieee754.read(this, offset, true, 52, 8)
  8537. }
  8538. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  8539. offset = offset >>> 0
  8540. if (!noAssert) checkOffset(offset, 8, this.length)
  8541. return ieee754.read(this, offset, false, 52, 8)
  8542. }
  8543. function checkInt (buf, value, offset, ext, max, min) {
  8544. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  8545. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  8546. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  8547. }
  8548. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  8549. value = +value
  8550. offset = offset >>> 0
  8551. byteLength = byteLength >>> 0
  8552. if (!noAssert) {
  8553. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  8554. checkInt(this, value, offset, byteLength, maxBytes, 0)
  8555. }
  8556. var mul = 1
  8557. var i = 0
  8558. this[offset] = value & 0xFF
  8559. while (++i < byteLength && (mul *= 0x100)) {
  8560. this[offset + i] = (value / mul) & 0xFF
  8561. }
  8562. return offset + byteLength
  8563. }
  8564. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  8565. value = +value
  8566. offset = offset >>> 0
  8567. byteLength = byteLength >>> 0
  8568. if (!noAssert) {
  8569. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  8570. checkInt(this, value, offset, byteLength, maxBytes, 0)
  8571. }
  8572. var i = byteLength - 1
  8573. var mul = 1
  8574. this[offset + i] = value & 0xFF
  8575. while (--i >= 0 && (mul *= 0x100)) {
  8576. this[offset + i] = (value / mul) & 0xFF
  8577. }
  8578. return offset + byteLength
  8579. }
  8580. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  8581. value = +value
  8582. offset = offset >>> 0
  8583. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  8584. this[offset] = (value & 0xff)
  8585. return offset + 1
  8586. }
  8587. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  8588. value = +value
  8589. offset = offset >>> 0
  8590. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  8591. this[offset] = (value & 0xff)
  8592. this[offset + 1] = (value >>> 8)
  8593. return offset + 2
  8594. }
  8595. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  8596. value = +value
  8597. offset = offset >>> 0
  8598. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  8599. this[offset] = (value >>> 8)
  8600. this[offset + 1] = (value & 0xff)
  8601. return offset + 2
  8602. }
  8603. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  8604. value = +value
  8605. offset = offset >>> 0
  8606. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  8607. this[offset + 3] = (value >>> 24)
  8608. this[offset + 2] = (value >>> 16)
  8609. this[offset + 1] = (value >>> 8)
  8610. this[offset] = (value & 0xff)
  8611. return offset + 4
  8612. }
  8613. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  8614. value = +value
  8615. offset = offset >>> 0
  8616. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  8617. this[offset] = (value >>> 24)
  8618. this[offset + 1] = (value >>> 16)
  8619. this[offset + 2] = (value >>> 8)
  8620. this[offset + 3] = (value & 0xff)
  8621. return offset + 4
  8622. }
  8623. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  8624. value = +value
  8625. offset = offset >>> 0
  8626. if (!noAssert) {
  8627. var limit = Math.pow(2, (8 * byteLength) - 1)
  8628. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  8629. }
  8630. var i = 0
  8631. var mul = 1
  8632. var sub = 0
  8633. this[offset] = value & 0xFF
  8634. while (++i < byteLength && (mul *= 0x100)) {
  8635. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  8636. sub = 1
  8637. }
  8638. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  8639. }
  8640. return offset + byteLength
  8641. }
  8642. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  8643. value = +value
  8644. offset = offset >>> 0
  8645. if (!noAssert) {
  8646. var limit = Math.pow(2, (8 * byteLength) - 1)
  8647. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  8648. }
  8649. var i = byteLength - 1
  8650. var mul = 1
  8651. var sub = 0
  8652. this[offset + i] = value & 0xFF
  8653. while (--i >= 0 && (mul *= 0x100)) {
  8654. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  8655. sub = 1
  8656. }
  8657. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  8658. }
  8659. return offset + byteLength
  8660. }
  8661. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  8662. value = +value
  8663. offset = offset >>> 0
  8664. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  8665. if (value < 0) value = 0xff + value + 1
  8666. this[offset] = (value & 0xff)
  8667. return offset + 1
  8668. }
  8669. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  8670. value = +value
  8671. offset = offset >>> 0
  8672. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  8673. this[offset] = (value & 0xff)
  8674. this[offset + 1] = (value >>> 8)
  8675. return offset + 2
  8676. }
  8677. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  8678. value = +value
  8679. offset = offset >>> 0
  8680. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  8681. this[offset] = (value >>> 8)
  8682. this[offset + 1] = (value & 0xff)
  8683. return offset + 2
  8684. }
  8685. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  8686. value = +value
  8687. offset = offset >>> 0
  8688. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  8689. this[offset] = (value & 0xff)
  8690. this[offset + 1] = (value >>> 8)
  8691. this[offset + 2] = (value >>> 16)
  8692. this[offset + 3] = (value >>> 24)
  8693. return offset + 4
  8694. }
  8695. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  8696. value = +value
  8697. offset = offset >>> 0
  8698. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  8699. if (value < 0) value = 0xffffffff + value + 1
  8700. this[offset] = (value >>> 24)
  8701. this[offset + 1] = (value >>> 16)
  8702. this[offset + 2] = (value >>> 8)
  8703. this[offset + 3] = (value & 0xff)
  8704. return offset + 4
  8705. }
  8706. function checkIEEE754 (buf, value, offset, ext, max, min) {
  8707. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  8708. if (offset < 0) throw new RangeError('Index out of range')
  8709. }
  8710. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  8711. value = +value
  8712. offset = offset >>> 0
  8713. if (!noAssert) {
  8714. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  8715. }
  8716. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  8717. return offset + 4
  8718. }
  8719. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  8720. return writeFloat(this, value, offset, true, noAssert)
  8721. }
  8722. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  8723. return writeFloat(this, value, offset, false, noAssert)
  8724. }
  8725. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  8726. value = +value
  8727. offset = offset >>> 0
  8728. if (!noAssert) {
  8729. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  8730. }
  8731. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  8732. return offset + 8
  8733. }
  8734. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  8735. return writeDouble(this, value, offset, true, noAssert)
  8736. }
  8737. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  8738. return writeDouble(this, value, offset, false, noAssert)
  8739. }
  8740. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  8741. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  8742. if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')
  8743. if (!start) start = 0
  8744. if (!end && end !== 0) end = this.length
  8745. if (targetStart >= target.length) targetStart = target.length
  8746. if (!targetStart) targetStart = 0
  8747. if (end > 0 && end < start) end = start
  8748. // Copy 0 bytes; we're done
  8749. if (end === start) return 0
  8750. if (target.length === 0 || this.length === 0) return 0
  8751. // Fatal error conditions
  8752. if (targetStart < 0) {
  8753. throw new RangeError('targetStart out of bounds')
  8754. }
  8755. if (start < 0 || start >= this.length) throw new RangeError('Index out of range')
  8756. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  8757. // Are we oob?
  8758. if (end > this.length) end = this.length
  8759. if (target.length - targetStart < end - start) {
  8760. end = target.length - targetStart + start
  8761. }
  8762. var len = end - start
  8763. if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {
  8764. // Use built-in when available, missing from IE11
  8765. this.copyWithin(targetStart, start, end)
  8766. } else if (this === target && start < targetStart && targetStart < end) {
  8767. // descending copy from end
  8768. for (var i = len - 1; i >= 0; --i) {
  8769. target[i + targetStart] = this[i + start]
  8770. }
  8771. } else {
  8772. Uint8Array.prototype.set.call(
  8773. target,
  8774. this.subarray(start, end),
  8775. targetStart
  8776. )
  8777. }
  8778. return len
  8779. }
  8780. // Usage:
  8781. // buffer.fill(number[, offset[, end]])
  8782. // buffer.fill(buffer[, offset[, end]])
  8783. // buffer.fill(string[, offset[, end]][, encoding])
  8784. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  8785. // Handle string cases:
  8786. if (typeof val === 'string') {
  8787. if (typeof start === 'string') {
  8788. encoding = start
  8789. start = 0
  8790. end = this.length
  8791. } else if (typeof end === 'string') {
  8792. encoding = end
  8793. end = this.length
  8794. }
  8795. if (encoding !== undefined && typeof encoding !== 'string') {
  8796. throw new TypeError('encoding must be a string')
  8797. }
  8798. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  8799. throw new TypeError('Unknown encoding: ' + encoding)
  8800. }
  8801. if (val.length === 1) {
  8802. var code = val.charCodeAt(0)
  8803. if ((encoding === 'utf8' && code < 128) ||
  8804. encoding === 'latin1') {
  8805. // Fast path: If `val` fits into a single byte, use that numeric value.
  8806. val = code
  8807. }
  8808. }
  8809. } else if (typeof val === 'number') {
  8810. val = val & 255
  8811. }
  8812. // Invalid ranges are not set to a default, so can range check early.
  8813. if (start < 0 || this.length < start || this.length < end) {
  8814. throw new RangeError('Out of range index')
  8815. }
  8816. if (end <= start) {
  8817. return this
  8818. }
  8819. start = start >>> 0
  8820. end = end === undefined ? this.length : end >>> 0
  8821. if (!val) val = 0
  8822. var i
  8823. if (typeof val === 'number') {
  8824. for (i = start; i < end; ++i) {
  8825. this[i] = val
  8826. }
  8827. } else {
  8828. var bytes = Buffer.isBuffer(val)
  8829. ? val
  8830. : Buffer.from(val, encoding)
  8831. var len = bytes.length
  8832. if (len === 0) {
  8833. throw new TypeError('The value "' + val +
  8834. '" is invalid for argument "value"')
  8835. }
  8836. for (i = 0; i < end - start; ++i) {
  8837. this[i + start] = bytes[i % len]
  8838. }
  8839. }
  8840. return this
  8841. }
  8842. // HELPER FUNCTIONS
  8843. // ================
  8844. var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g
  8845. function base64clean (str) {
  8846. // Node takes equal signs as end of the Base64 encoding
  8847. str = str.split('=')[0]
  8848. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  8849. str = str.trim().replace(INVALID_BASE64_RE, '')
  8850. // Node converts strings with length < 2 to ''
  8851. if (str.length < 2) return ''
  8852. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  8853. while (str.length % 4 !== 0) {
  8854. str = str + '='
  8855. }
  8856. return str
  8857. }
  8858. function toHex (n) {
  8859. if (n < 16) return '0' + n.toString(16)
  8860. return n.toString(16)
  8861. }
  8862. function utf8ToBytes (string, units) {
  8863. units = units || Infinity
  8864. var codePoint
  8865. var length = string.length
  8866. var leadSurrogate = null
  8867. var bytes = []
  8868. for (var i = 0; i < length; ++i) {
  8869. codePoint = string.charCodeAt(i)
  8870. // is surrogate component
  8871. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  8872. // last char was a lead
  8873. if (!leadSurrogate) {
  8874. // no lead yet
  8875. if (codePoint > 0xDBFF) {
  8876. // unexpected trail
  8877. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8878. continue
  8879. } else if (i + 1 === length) {
  8880. // unpaired lead
  8881. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8882. continue
  8883. }
  8884. // valid lead
  8885. leadSurrogate = codePoint
  8886. continue
  8887. }
  8888. // 2 leads in a row
  8889. if (codePoint < 0xDC00) {
  8890. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8891. leadSurrogate = codePoint
  8892. continue
  8893. }
  8894. // valid surrogate pair
  8895. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  8896. } else if (leadSurrogate) {
  8897. // valid bmp char, but last char was a lead
  8898. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  8899. }
  8900. leadSurrogate = null
  8901. // encode utf8
  8902. if (codePoint < 0x80) {
  8903. if ((units -= 1) < 0) break
  8904. bytes.push(codePoint)
  8905. } else if (codePoint < 0x800) {
  8906. if ((units -= 2) < 0) break
  8907. bytes.push(
  8908. codePoint >> 0x6 | 0xC0,
  8909. codePoint & 0x3F | 0x80
  8910. )
  8911. } else if (codePoint < 0x10000) {
  8912. if ((units -= 3) < 0) break
  8913. bytes.push(
  8914. codePoint >> 0xC | 0xE0,
  8915. codePoint >> 0x6 & 0x3F | 0x80,
  8916. codePoint & 0x3F | 0x80
  8917. )
  8918. } else if (codePoint < 0x110000) {
  8919. if ((units -= 4) < 0) break
  8920. bytes.push(
  8921. codePoint >> 0x12 | 0xF0,
  8922. codePoint >> 0xC & 0x3F | 0x80,
  8923. codePoint >> 0x6 & 0x3F | 0x80,
  8924. codePoint & 0x3F | 0x80
  8925. )
  8926. } else {
  8927. throw new Error('Invalid code point')
  8928. }
  8929. }
  8930. return bytes
  8931. }
  8932. function asciiToBytes (str) {
  8933. var byteArray = []
  8934. for (var i = 0; i < str.length; ++i) {
  8935. // Node's code seems to be doing this and not & 0x7F..
  8936. byteArray.push(str.charCodeAt(i) & 0xFF)
  8937. }
  8938. return byteArray
  8939. }
  8940. function utf16leToBytes (str, units) {
  8941. var c, hi, lo
  8942. var byteArray = []
  8943. for (var i = 0; i < str.length; ++i) {
  8944. if ((units -= 2) < 0) break
  8945. c = str.charCodeAt(i)
  8946. hi = c >> 8
  8947. lo = c % 256
  8948. byteArray.push(lo)
  8949. byteArray.push(hi)
  8950. }
  8951. return byteArray
  8952. }
  8953. function base64ToBytes (str) {
  8954. return base64.toByteArray(base64clean(str))
  8955. }
  8956. function blitBuffer (src, dst, offset, length) {
  8957. for (var i = 0; i < length; ++i) {
  8958. if ((i + offset >= dst.length) || (i >= src.length)) break
  8959. dst[i + offset] = src[i]
  8960. }
  8961. return i
  8962. }
  8963. // ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass
  8964. // the `instanceof` check but they should be treated as of that type.
  8965. // See: https://github.com/feross/buffer/issues/166
  8966. function isInstance (obj, type) {
  8967. return obj instanceof type ||
  8968. (obj != null && obj.constructor != null && obj.constructor.name != null &&
  8969. obj.constructor.name === type.name)
  8970. }
  8971. function numberIsNaN (obj) {
  8972. // For IE11 support
  8973. return obj !== obj // eslint-disable-line no-self-compare
  8974. }
  8975. }).call(this,require("buffer").Buffer)
  8976. },{"base64-js":39,"buffer":43,"ieee754":55}],44:[function(require,module,exports){
  8977. (function (Buffer){
  8978. // Copyright Joyent, Inc. and other Node contributors.
  8979. //
  8980. // Permission is hereby granted, free of charge, to any person obtaining a
  8981. // copy of this software and associated documentation files (the
  8982. // "Software"), to deal in the Software without restriction, including
  8983. // without limitation the rights to use, copy, modify, merge, publish,
  8984. // distribute, sublicense, and/or sell copies of the Software, and to permit
  8985. // persons to whom the Software is furnished to do so, subject to the
  8986. // following conditions:
  8987. //
  8988. // The above copyright notice and this permission notice shall be included
  8989. // in all copies or substantial portions of the Software.
  8990. //
  8991. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  8992. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  8993. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  8994. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  8995. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  8996. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  8997. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  8998. // NOTE: These type checking functions intentionally don't use `instanceof`
  8999. // because it is fragile and can be easily faked with `Object.create()`.
  9000. function isArray(arg) {
  9001. if (Array.isArray) {
  9002. return Array.isArray(arg);
  9003. }
  9004. return objectToString(arg) === '[object Array]';
  9005. }
  9006. exports.isArray = isArray;
  9007. function isBoolean(arg) {
  9008. return typeof arg === 'boolean';
  9009. }
  9010. exports.isBoolean = isBoolean;
  9011. function isNull(arg) {
  9012. return arg === null;
  9013. }
  9014. exports.isNull = isNull;
  9015. function isNullOrUndefined(arg) {
  9016. return arg == null;
  9017. }
  9018. exports.isNullOrUndefined = isNullOrUndefined;
  9019. function isNumber(arg) {
  9020. return typeof arg === 'number';
  9021. }
  9022. exports.isNumber = isNumber;
  9023. function isString(arg) {
  9024. return typeof arg === 'string';
  9025. }
  9026. exports.isString = isString;
  9027. function isSymbol(arg) {
  9028. return typeof arg === 'symbol';
  9029. }
  9030. exports.isSymbol = isSymbol;
  9031. function isUndefined(arg) {
  9032. return arg === void 0;
  9033. }
  9034. exports.isUndefined = isUndefined;
  9035. function isRegExp(re) {
  9036. return objectToString(re) === '[object RegExp]';
  9037. }
  9038. exports.isRegExp = isRegExp;
  9039. function isObject(arg) {
  9040. return typeof arg === 'object' && arg !== null;
  9041. }
  9042. exports.isObject = isObject;
  9043. function isDate(d) {
  9044. return objectToString(d) === '[object Date]';
  9045. }
  9046. exports.isDate = isDate;
  9047. function isError(e) {
  9048. return (objectToString(e) === '[object Error]' || e instanceof Error);
  9049. }
  9050. exports.isError = isError;
  9051. function isFunction(arg) {
  9052. return typeof arg === 'function';
  9053. }
  9054. exports.isFunction = isFunction;
  9055. function isPrimitive(arg) {
  9056. return arg === null ||
  9057. typeof arg === 'boolean' ||
  9058. typeof arg === 'number' ||
  9059. typeof arg === 'string' ||
  9060. typeof arg === 'symbol' || // ES6 symbol
  9061. typeof arg === 'undefined';
  9062. }
  9063. exports.isPrimitive = isPrimitive;
  9064. exports.isBuffer = Buffer.isBuffer;
  9065. function objectToString(o) {
  9066. return Object.prototype.toString.call(o);
  9067. }
  9068. }).call(this,{"isBuffer":require("../../is-buffer/index.js")})
  9069. },{"../../is-buffer/index.js":57}],45:[function(require,module,exports){
  9070. (function (process){
  9071. "use strict";
  9072. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  9073. /* eslint-env browser */
  9074. /**
  9075. * This is the web browser implementation of `debug()`.
  9076. */
  9077. exports.log = log;
  9078. exports.formatArgs = formatArgs;
  9079. exports.save = save;
  9080. exports.load = load;
  9081. exports.useColors = useColors;
  9082. exports.storage = localstorage();
  9083. /**
  9084. * Colors.
  9085. */
  9086. exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'];
  9087. /**
  9088. * Currently only WebKit-based Web Inspectors, Firefox >= v31,
  9089. * and the Firebug extension (any Firefox version) are known
  9090. * to support "%c" CSS customizations.
  9091. *
  9092. * TODO: add a `localStorage` variable to explicitly enable/disable colors
  9093. */
  9094. // eslint-disable-next-line complexity
  9095. function useColors() {
  9096. // NB: In an Electron preload script, document will be defined but not fully
  9097. // initialized. Since we know we're in Chrome, we'll just detect this case
  9098. // explicitly
  9099. if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
  9100. return true;
  9101. } // Internet Explorer and Edge do not support colors.
  9102. if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
  9103. return false;
  9104. } // Is webkit? http://stackoverflow.com/a/16459606/376773
  9105. // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
  9106. return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
  9107. typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
  9108. // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
  9109. typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
  9110. typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
  9111. }
  9112. /**
  9113. * Colorize log arguments if enabled.
  9114. *
  9115. * @api public
  9116. */
  9117. function formatArgs(args) {
  9118. args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
  9119. if (!this.useColors) {
  9120. return;
  9121. }
  9122. var c = 'color: ' + this.color;
  9123. args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be other
  9124. // arguments passed either before or after the %c, so we need to
  9125. // figure out the correct index to insert the CSS into
  9126. var index = 0;
  9127. var lastC = 0;
  9128. args[0].replace(/%[a-zA-Z%]/g, function (match) {
  9129. if (match === '%%') {
  9130. return;
  9131. }
  9132. index++;
  9133. if (match === '%c') {
  9134. // We only are interested in the *last* %c
  9135. // (the user may have provided their own)
  9136. lastC = index;
  9137. }
  9138. });
  9139. args.splice(lastC, 0, c);
  9140. }
  9141. /**
  9142. * Invokes `console.log()` when available.
  9143. * No-op when `console.log` is not a "function".
  9144. *
  9145. * @api public
  9146. */
  9147. function log() {
  9148. var _console;
  9149. // This hackery is required for IE8/9, where
  9150. // the `console.log` function doesn't have 'apply'
  9151. return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);
  9152. }
  9153. /**
  9154. * Save `namespaces`.
  9155. *
  9156. * @param {String} namespaces
  9157. * @api private
  9158. */
  9159. function save(namespaces) {
  9160. try {
  9161. if (namespaces) {
  9162. exports.storage.setItem('debug', namespaces);
  9163. } else {
  9164. exports.storage.removeItem('debug');
  9165. }
  9166. } catch (error) {// Swallow
  9167. // XXX (@Qix-) should we be logging these?
  9168. }
  9169. }
  9170. /**
  9171. * Load `namespaces`.
  9172. *
  9173. * @return {String} returns the previously persisted debug modes
  9174. * @api private
  9175. */
  9176. function load() {
  9177. var r;
  9178. try {
  9179. r = exports.storage.getItem('debug');
  9180. } catch (error) {} // Swallow
  9181. // XXX (@Qix-) should we be logging these?
  9182. // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
  9183. if (!r && typeof process !== 'undefined' && 'env' in process) {
  9184. r = process.env.DEBUG;
  9185. }
  9186. return r;
  9187. }
  9188. /**
  9189. * Localstorage attempts to return the localstorage.
  9190. *
  9191. * This is necessary because safari throws
  9192. * when a user disables cookies/localstorage
  9193. * and you attempt to access it.
  9194. *
  9195. * @return {LocalStorage}
  9196. * @api private
  9197. */
  9198. function localstorage() {
  9199. try {
  9200. // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
  9201. // The Browser also has localStorage in the global context.
  9202. return localStorage;
  9203. } catch (error) {// Swallow
  9204. // XXX (@Qix-) should we be logging these?
  9205. }
  9206. }
  9207. module.exports = require('./common')(exports);
  9208. var formatters = module.exports.formatters;
  9209. /**
  9210. * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
  9211. */
  9212. formatters.j = function (v) {
  9213. try {
  9214. return JSON.stringify(v);
  9215. } catch (error) {
  9216. return '[UnexpectedJSONParseError]: ' + error.message;
  9217. }
  9218. };
  9219. }).call(this,require('_process'))
  9220. },{"./common":46,"_process":69}],46:[function(require,module,exports){
  9221. "use strict";
  9222. /**
  9223. * This is the common logic for both the Node.js and web browser
  9224. * implementations of `debug()`.
  9225. */
  9226. function setup(env) {
  9227. createDebug.debug = createDebug;
  9228. createDebug.default = createDebug;
  9229. createDebug.coerce = coerce;
  9230. createDebug.disable = disable;
  9231. createDebug.enable = enable;
  9232. createDebug.enabled = enabled;
  9233. createDebug.humanize = require('ms');
  9234. Object.keys(env).forEach(function (key) {
  9235. createDebug[key] = env[key];
  9236. });
  9237. /**
  9238. * Active `debug` instances.
  9239. */
  9240. createDebug.instances = [];
  9241. /**
  9242. * The currently active debug mode names, and names to skip.
  9243. */
  9244. createDebug.names = [];
  9245. createDebug.skips = [];
  9246. /**
  9247. * Map of special "%n" handling functions, for the debug "format" argument.
  9248. *
  9249. * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
  9250. */
  9251. createDebug.formatters = {};
  9252. /**
  9253. * Selects a color for a debug namespace
  9254. * @param {String} namespace The namespace string for the for the debug instance to be colored
  9255. * @return {Number|String} An ANSI color code for the given namespace
  9256. * @api private
  9257. */
  9258. function selectColor(namespace) {
  9259. var hash = 0;
  9260. for (var i = 0; i < namespace.length; i++) {
  9261. hash = (hash << 5) - hash + namespace.charCodeAt(i);
  9262. hash |= 0; // Convert to 32bit integer
  9263. }
  9264. return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
  9265. }
  9266. createDebug.selectColor = selectColor;
  9267. /**
  9268. * Create a debugger with the given `namespace`.
  9269. *
  9270. * @param {String} namespace
  9271. * @return {Function}
  9272. * @api public
  9273. */
  9274. function createDebug(namespace) {
  9275. var prevTime;
  9276. function debug() {
  9277. // Disabled?
  9278. if (!debug.enabled) {
  9279. return;
  9280. }
  9281. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  9282. args[_key] = arguments[_key];
  9283. }
  9284. var self = debug; // Set `diff` timestamp
  9285. var curr = Number(new Date());
  9286. var ms = curr - (prevTime || curr);
  9287. self.diff = ms;
  9288. self.prev = prevTime;
  9289. self.curr = curr;
  9290. prevTime = curr;
  9291. args[0] = createDebug.coerce(args[0]);
  9292. if (typeof args[0] !== 'string') {
  9293. // Anything else let's inspect with %O
  9294. args.unshift('%O');
  9295. } // Apply any `formatters` transformations
  9296. var index = 0;
  9297. args[0] = args[0].replace(/%([a-zA-Z%])/g, function (match, format) {
  9298. // If we encounter an escaped % then don't increase the array index
  9299. if (match === '%%') {
  9300. return match;
  9301. }
  9302. index++;
  9303. var formatter = createDebug.formatters[format];
  9304. if (typeof formatter === 'function') {
  9305. var val = args[index];
  9306. match = formatter.call(self, val); // Now we need to remove `args[index]` since it's inlined in the `format`
  9307. args.splice(index, 1);
  9308. index--;
  9309. }
  9310. return match;
  9311. }); // Apply env-specific formatting (colors, etc.)
  9312. createDebug.formatArgs.call(self, args);
  9313. var logFn = self.log || createDebug.log;
  9314. logFn.apply(self, args);
  9315. }
  9316. debug.namespace = namespace;
  9317. debug.enabled = createDebug.enabled(namespace);
  9318. debug.useColors = createDebug.useColors();
  9319. debug.color = selectColor(namespace);
  9320. debug.destroy = destroy;
  9321. debug.extend = extend; // Debug.formatArgs = formatArgs;
  9322. // debug.rawLog = rawLog;
  9323. // env-specific initialization logic for debug instances
  9324. if (typeof createDebug.init === 'function') {
  9325. createDebug.init(debug);
  9326. }
  9327. createDebug.instances.push(debug);
  9328. return debug;
  9329. }
  9330. function destroy() {
  9331. var index = createDebug.instances.indexOf(this);
  9332. if (index !== -1) {
  9333. createDebug.instances.splice(index, 1);
  9334. return true;
  9335. }
  9336. return false;
  9337. }
  9338. function extend(namespace, delimiter) {
  9339. return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
  9340. }
  9341. /**
  9342. * Enables a debug mode by namespaces. This can include modes
  9343. * separated by a colon and wildcards.
  9344. *
  9345. * @param {String} namespaces
  9346. * @api public
  9347. */
  9348. function enable(namespaces) {
  9349. createDebug.save(namespaces);
  9350. createDebug.names = [];
  9351. createDebug.skips = [];
  9352. var i;
  9353. var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
  9354. var len = split.length;
  9355. for (i = 0; i < len; i++) {
  9356. if (!split[i]) {
  9357. // ignore empty strings
  9358. continue;
  9359. }
  9360. namespaces = split[i].replace(/\*/g, '.*?');
  9361. if (namespaces[0] === '-') {
  9362. createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
  9363. } else {
  9364. createDebug.names.push(new RegExp('^' + namespaces + '$'));
  9365. }
  9366. }
  9367. for (i = 0; i < createDebug.instances.length; i++) {
  9368. var instance = createDebug.instances[i];
  9369. instance.enabled = createDebug.enabled(instance.namespace);
  9370. }
  9371. }
  9372. /**
  9373. * Disable debug output.
  9374. *
  9375. * @api public
  9376. */
  9377. function disable() {
  9378. createDebug.enable('');
  9379. }
  9380. /**
  9381. * Returns true if the given mode name is enabled, false otherwise.
  9382. *
  9383. * @param {String} name
  9384. * @return {Boolean}
  9385. * @api public
  9386. */
  9387. function enabled(name) {
  9388. if (name[name.length - 1] === '*') {
  9389. return true;
  9390. }
  9391. var i;
  9392. var len;
  9393. for (i = 0, len = createDebug.skips.length; i < len; i++) {
  9394. if (createDebug.skips[i].test(name)) {
  9395. return false;
  9396. }
  9397. }
  9398. for (i = 0, len = createDebug.names.length; i < len; i++) {
  9399. if (createDebug.names[i].test(name)) {
  9400. return true;
  9401. }
  9402. }
  9403. return false;
  9404. }
  9405. /**
  9406. * Coerce `val`.
  9407. *
  9408. * @param {Mixed} val
  9409. * @return {Mixed}
  9410. * @api private
  9411. */
  9412. function coerce(val) {
  9413. if (val instanceof Error) {
  9414. return val.stack || val.message;
  9415. }
  9416. return val;
  9417. }
  9418. createDebug.enable(createDebug.load());
  9419. return createDebug;
  9420. }
  9421. module.exports = setup;
  9422. },{"ms":60}],47:[function(require,module,exports){
  9423. 'use strict';
  9424. var keys = require('object-keys');
  9425. var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
  9426. var toStr = Object.prototype.toString;
  9427. var concat = Array.prototype.concat;
  9428. var origDefineProperty = Object.defineProperty;
  9429. var isFunction = function (fn) {
  9430. return typeof fn === 'function' && toStr.call(fn) === '[object Function]';
  9431. };
  9432. var arePropertyDescriptorsSupported = function () {
  9433. var obj = {};
  9434. try {
  9435. origDefineProperty(obj, 'x', { enumerable: false, value: obj });
  9436. // eslint-disable-next-line no-unused-vars, no-restricted-syntax
  9437. for (var _ in obj) { // jscs:ignore disallowUnusedVariables
  9438. return false;
  9439. }
  9440. return obj.x === obj;
  9441. } catch (e) { /* this is IE 8. */
  9442. return false;
  9443. }
  9444. };
  9445. var supportsDescriptors = origDefineProperty && arePropertyDescriptorsSupported();
  9446. var defineProperty = function (object, name, value, predicate) {
  9447. if (name in object && (!isFunction(predicate) || !predicate())) {
  9448. return;
  9449. }
  9450. if (supportsDescriptors) {
  9451. origDefineProperty(object, name, {
  9452. configurable: true,
  9453. enumerable: false,
  9454. value: value,
  9455. writable: true
  9456. });
  9457. } else {
  9458. object[name] = value;
  9459. }
  9460. };
  9461. var defineProperties = function (object, map) {
  9462. var predicates = arguments.length > 2 ? arguments[2] : {};
  9463. var props = keys(map);
  9464. if (hasSymbols) {
  9465. props = concat.call(props, Object.getOwnPropertySymbols(map));
  9466. }
  9467. for (var i = 0; i < props.length; i += 1) {
  9468. defineProperty(object, props[i], map[props[i]], predicates[props[i]]);
  9469. }
  9470. };
  9471. defineProperties.supportsDescriptors = !!supportsDescriptors;
  9472. module.exports = defineProperties;
  9473. },{"object-keys":62}],48:[function(require,module,exports){
  9474. /*!
  9475. diff v3.5.0
  9476. Software License Agreement (BSD License)
  9477. Copyright (c) 2009-2015, Kevin Decker <kpdecker@gmail.com>
  9478. All rights reserved.
  9479. Redistribution and use of this software in source and binary forms, with or without modification,
  9480. are permitted provided that the following conditions are met:
  9481. * Redistributions of source code must retain the above
  9482. copyright notice, this list of conditions and the
  9483. following disclaimer.
  9484. * Redistributions in binary form must reproduce the above
  9485. copyright notice, this list of conditions and the
  9486. following disclaimer in the documentation and/or other
  9487. materials provided with the distribution.
  9488. * Neither the name of Kevin Decker nor the names of its
  9489. contributors may be used to endorse or promote products
  9490. derived from this software without specific prior
  9491. written permission.
  9492. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
  9493. IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  9494. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  9495. CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  9496. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  9497. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  9498. IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  9499. OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  9500. @license
  9501. */
  9502. (function webpackUniversalModuleDefinition(root, factory) {
  9503. if(typeof exports === 'object' && typeof module === 'object')
  9504. module.exports = factory();
  9505. else if(false)
  9506. define([], factory);
  9507. else if(typeof exports === 'object')
  9508. exports["JsDiff"] = factory();
  9509. else
  9510. root["JsDiff"] = factory();
  9511. })(this, function() {
  9512. return /******/ (function(modules) { // webpackBootstrap
  9513. /******/ // The module cache
  9514. /******/ var installedModules = {};
  9515. /******/ // The require function
  9516. /******/ function __webpack_require__(moduleId) {
  9517. /******/ // Check if module is in cache
  9518. /******/ if(installedModules[moduleId])
  9519. /******/ return installedModules[moduleId].exports;
  9520. /******/ // Create a new module (and put it into the cache)
  9521. /******/ var module = installedModules[moduleId] = {
  9522. /******/ exports: {},
  9523. /******/ id: moduleId,
  9524. /******/ loaded: false
  9525. /******/ };
  9526. /******/ // Execute the module function
  9527. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  9528. /******/ // Flag the module as loaded
  9529. /******/ module.loaded = true;
  9530. /******/ // Return the exports of the module
  9531. /******/ return module.exports;
  9532. /******/ }
  9533. /******/ // expose the modules object (__webpack_modules__)
  9534. /******/ __webpack_require__.m = modules;
  9535. /******/ // expose the module cache
  9536. /******/ __webpack_require__.c = installedModules;
  9537. /******/ // __webpack_public_path__
  9538. /******/ __webpack_require__.p = "";
  9539. /******/ // Load entry module and return exports
  9540. /******/ return __webpack_require__(0);
  9541. /******/ })
  9542. /************************************************************************/
  9543. /******/ ([
  9544. /* 0 */
  9545. /***/ (function(module, exports, __webpack_require__) {
  9546. /*istanbul ignore start*/'use strict';
  9547. exports.__esModule = true;
  9548. exports.canonicalize = exports.convertChangesToXML = exports.convertChangesToDMP = exports.merge = exports.parsePatch = exports.applyPatches = exports.applyPatch = exports.createPatch = exports.createTwoFilesPatch = exports.structuredPatch = exports.diffArrays = exports.diffJson = exports.diffCss = exports.diffSentences = exports.diffTrimmedLines = exports.diffLines = exports.diffWordsWithSpace = exports.diffWords = exports.diffChars = exports.Diff = undefined;
  9549. /*istanbul ignore end*/var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
  9550. /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
  9551. /*istanbul ignore end*/var /*istanbul ignore start*/_character = __webpack_require__(2) /*istanbul ignore end*/;
  9552. var /*istanbul ignore start*/_word = __webpack_require__(3) /*istanbul ignore end*/;
  9553. var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/;
  9554. var /*istanbul ignore start*/_sentence = __webpack_require__(6) /*istanbul ignore end*/;
  9555. var /*istanbul ignore start*/_css = __webpack_require__(7) /*istanbul ignore end*/;
  9556. var /*istanbul ignore start*/_json = __webpack_require__(8) /*istanbul ignore end*/;
  9557. var /*istanbul ignore start*/_array = __webpack_require__(9) /*istanbul ignore end*/;
  9558. var /*istanbul ignore start*/_apply = __webpack_require__(10) /*istanbul ignore end*/;
  9559. var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/;
  9560. var /*istanbul ignore start*/_merge = __webpack_require__(13) /*istanbul ignore end*/;
  9561. var /*istanbul ignore start*/_create = __webpack_require__(14) /*istanbul ignore end*/;
  9562. var /*istanbul ignore start*/_dmp = __webpack_require__(16) /*istanbul ignore end*/;
  9563. var /*istanbul ignore start*/_xml = __webpack_require__(17) /*istanbul ignore end*/;
  9564. /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  9565. /* See LICENSE file for terms of use */
  9566. /*
  9567. * Text diff implementation.
  9568. *
  9569. * This library supports the following APIS:
  9570. * JsDiff.diffChars: Character by character diff
  9571. * JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace
  9572. * JsDiff.diffLines: Line based diff
  9573. *
  9574. * JsDiff.diffCss: Diff targeted at CSS content
  9575. *
  9576. * These methods are based on the implementation proposed in
  9577. * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986).
  9578. * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927
  9579. */
  9580. exports. /*istanbul ignore end*/Diff = _base2['default'];
  9581. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffChars = _character.diffChars;
  9582. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWords = _word.diffWords;
  9583. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = _word.diffWordsWithSpace;
  9584. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffLines = _line.diffLines;
  9585. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = _line.diffTrimmedLines;
  9586. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffSentences = _sentence.diffSentences;
  9587. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffCss = _css.diffCss;
  9588. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffJson = _json.diffJson;
  9589. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffArrays = _array.diffArrays;
  9590. /*istanbul ignore start*/exports. /*istanbul ignore end*/structuredPatch = _create.structuredPatch;
  9591. /*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = _create.createTwoFilesPatch;
  9592. /*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = _create.createPatch;
  9593. /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatch = _apply.applyPatch;
  9594. /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = _apply.applyPatches;
  9595. /*istanbul ignore start*/exports. /*istanbul ignore end*/parsePatch = _parse.parsePatch;
  9596. /*istanbul ignore start*/exports. /*istanbul ignore end*/merge = _merge.merge;
  9597. /*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToDMP = _dmp.convertChangesToDMP;
  9598. /*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToXML = _xml.convertChangesToXML;
  9599. /*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = _json.canonicalize;
  9600. /***/ }),
  9601. /* 1 */
  9602. /***/ (function(module, exports) {
  9603. /*istanbul ignore start*/'use strict';
  9604. exports.__esModule = true;
  9605. exports['default'] = /*istanbul ignore end*/Diff;
  9606. function Diff() {}
  9607. Diff.prototype = {
  9608. /*istanbul ignore start*/ /*istanbul ignore end*/diff: function diff(oldString, newString) {
  9609. /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  9610. var callback = options.callback;
  9611. if (typeof options === 'function') {
  9612. callback = options;
  9613. options = {};
  9614. }
  9615. this.options = options;
  9616. var self = this;
  9617. function done(value) {
  9618. if (callback) {
  9619. setTimeout(function () {
  9620. callback(undefined, value);
  9621. }, 0);
  9622. return true;
  9623. } else {
  9624. return value;
  9625. }
  9626. }
  9627. // Allow subclasses to massage the input prior to running
  9628. oldString = this.castInput(oldString);
  9629. newString = this.castInput(newString);
  9630. oldString = this.removeEmpty(this.tokenize(oldString));
  9631. newString = this.removeEmpty(this.tokenize(newString));
  9632. var newLen = newString.length,
  9633. oldLen = oldString.length;
  9634. var editLength = 1;
  9635. var maxEditLength = newLen + oldLen;
  9636. var bestPath = [{ newPos: -1, components: [] }];
  9637. // Seed editLength = 0, i.e. the content starts with the same values
  9638. var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
  9639. if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
  9640. // Identity per the equality and tokenizer
  9641. return done([{ value: this.join(newString), count: newString.length }]);
  9642. }
  9643. // Main worker method. checks all permutations of a given edit length for acceptance.
  9644. function execEditLength() {
  9645. for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
  9646. var basePath = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
  9647. var addPath = bestPath[diagonalPath - 1],
  9648. removePath = bestPath[diagonalPath + 1],
  9649. _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
  9650. if (addPath) {
  9651. // No one else is going to attempt to use this value, clear it
  9652. bestPath[diagonalPath - 1] = undefined;
  9653. }
  9654. var canAdd = addPath && addPath.newPos + 1 < newLen,
  9655. canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
  9656. if (!canAdd && !canRemove) {
  9657. // If this path is a terminal then prune
  9658. bestPath[diagonalPath] = undefined;
  9659. continue;
  9660. }
  9661. // Select the diagonal that we want to branch from. We select the prior
  9662. // path whose position in the new string is the farthest from the origin
  9663. // and does not pass the bounds of the diff graph
  9664. if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
  9665. basePath = clonePath(removePath);
  9666. self.pushComponent(basePath.components, undefined, true);
  9667. } else {
  9668. basePath = addPath; // No need to clone, we've pulled it from the list
  9669. basePath.newPos++;
  9670. self.pushComponent(basePath.components, true, undefined);
  9671. }
  9672. _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath);
  9673. // If we have hit the end of both strings, then we are done
  9674. if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
  9675. return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
  9676. } else {
  9677. // Otherwise track this path as a potential candidate and continue.
  9678. bestPath[diagonalPath] = basePath;
  9679. }
  9680. }
  9681. editLength++;
  9682. }
  9683. // Performs the length of edit iteration. Is a bit fugly as this has to support the
  9684. // sync and async mode which is never fun. Loops over execEditLength until a value
  9685. // is produced.
  9686. if (callback) {
  9687. (function exec() {
  9688. setTimeout(function () {
  9689. // This should not happen, but we want to be safe.
  9690. /* istanbul ignore next */
  9691. if (editLength > maxEditLength) {
  9692. return callback();
  9693. }
  9694. if (!execEditLength()) {
  9695. exec();
  9696. }
  9697. }, 0);
  9698. })();
  9699. } else {
  9700. while (editLength <= maxEditLength) {
  9701. var ret = execEditLength();
  9702. if (ret) {
  9703. return ret;
  9704. }
  9705. }
  9706. }
  9707. },
  9708. /*istanbul ignore start*/ /*istanbul ignore end*/pushComponent: function pushComponent(components, added, removed) {
  9709. var last = components[components.length - 1];
  9710. if (last && last.added === added && last.removed === removed) {
  9711. // We need to clone here as the component clone operation is just
  9712. // as shallow array clone
  9713. components[components.length - 1] = { count: last.count + 1, added: added, removed: removed };
  9714. } else {
  9715. components.push({ count: 1, added: added, removed: removed });
  9716. }
  9717. },
  9718. /*istanbul ignore start*/ /*istanbul ignore end*/extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
  9719. var newLen = newString.length,
  9720. oldLen = oldString.length,
  9721. newPos = basePath.newPos,
  9722. oldPos = newPos - diagonalPath,
  9723. commonCount = 0;
  9724. while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
  9725. newPos++;
  9726. oldPos++;
  9727. commonCount++;
  9728. }
  9729. if (commonCount) {
  9730. basePath.components.push({ count: commonCount });
  9731. }
  9732. basePath.newPos = newPos;
  9733. return oldPos;
  9734. },
  9735. /*istanbul ignore start*/ /*istanbul ignore end*/equals: function equals(left, right) {
  9736. if (this.options.comparator) {
  9737. return this.options.comparator(left, right);
  9738. } else {
  9739. return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
  9740. }
  9741. },
  9742. /*istanbul ignore start*/ /*istanbul ignore end*/removeEmpty: function removeEmpty(array) {
  9743. var ret = [];
  9744. for (var i = 0; i < array.length; i++) {
  9745. if (array[i]) {
  9746. ret.push(array[i]);
  9747. }
  9748. }
  9749. return ret;
  9750. },
  9751. /*istanbul ignore start*/ /*istanbul ignore end*/castInput: function castInput(value) {
  9752. return value;
  9753. },
  9754. /*istanbul ignore start*/ /*istanbul ignore end*/tokenize: function tokenize(value) {
  9755. return value.split('');
  9756. },
  9757. /*istanbul ignore start*/ /*istanbul ignore end*/join: function join(chars) {
  9758. return chars.join('');
  9759. }
  9760. };
  9761. function buildValues(diff, components, newString, oldString, useLongestToken) {
  9762. var componentPos = 0,
  9763. componentLen = components.length,
  9764. newPos = 0,
  9765. oldPos = 0;
  9766. for (; componentPos < componentLen; componentPos++) {
  9767. var component = components[componentPos];
  9768. if (!component.removed) {
  9769. if (!component.added && useLongestToken) {
  9770. var value = newString.slice(newPos, newPos + component.count);
  9771. value = value.map(function (value, i) {
  9772. var oldValue = oldString[oldPos + i];
  9773. return oldValue.length > value.length ? oldValue : value;
  9774. });
  9775. component.value = diff.join(value);
  9776. } else {
  9777. component.value = diff.join(newString.slice(newPos, newPos + component.count));
  9778. }
  9779. newPos += component.count;
  9780. // Common case
  9781. if (!component.added) {
  9782. oldPos += component.count;
  9783. }
  9784. } else {
  9785. component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
  9786. oldPos += component.count;
  9787. // Reverse add and remove so removes are output first to match common convention
  9788. // The diffing algorithm is tied to add then remove output and this is the simplest
  9789. // route to get the desired output with minimal overhead.
  9790. if (componentPos && components[componentPos - 1].added) {
  9791. var tmp = components[componentPos - 1];
  9792. components[componentPos - 1] = components[componentPos];
  9793. components[componentPos] = tmp;
  9794. }
  9795. }
  9796. }
  9797. // Special case handle for when one terminal is ignored (i.e. whitespace).
  9798. // For this case we merge the terminal into the prior string and drop the change.
  9799. // This is only available for string mode.
  9800. var lastComponent = components[componentLen - 1];
  9801. if (componentLen > 1 && typeof lastComponent.value === 'string' && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
  9802. components[componentLen - 2].value += lastComponent.value;
  9803. components.pop();
  9804. }
  9805. return components;
  9806. }
  9807. function clonePath(path) {
  9808. return { newPos: path.newPos, components: path.components.slice(0) };
  9809. }
  9810. /***/ }),
  9811. /* 2 */
  9812. /***/ (function(module, exports, __webpack_require__) {
  9813. /*istanbul ignore start*/'use strict';
  9814. exports.__esModule = true;
  9815. exports.characterDiff = undefined;
  9816. exports. /*istanbul ignore end*/diffChars = diffChars;
  9817. var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
  9818. /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
  9819. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  9820. /*istanbul ignore end*/var characterDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/characterDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
  9821. function diffChars(oldStr, newStr, options) {
  9822. return characterDiff.diff(oldStr, newStr, options);
  9823. }
  9824. /***/ }),
  9825. /* 3 */
  9826. /***/ (function(module, exports, __webpack_require__) {
  9827. /*istanbul ignore start*/'use strict';
  9828. exports.__esModule = true;
  9829. exports.wordDiff = undefined;
  9830. exports. /*istanbul ignore end*/diffWords = diffWords;
  9831. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = diffWordsWithSpace;
  9832. var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
  9833. /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
  9834. /*istanbul ignore end*/var /*istanbul ignore start*/_params = __webpack_require__(4) /*istanbul ignore end*/;
  9835. /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  9836. /*istanbul ignore end*/ // Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode
  9837. //
  9838. // Ranges and exceptions:
  9839. // Latin-1 Supplement, 0080–00FF
  9840. // - U+00D7 × Multiplication sign
  9841. // - U+00F7 ÷ Division sign
  9842. // Latin Extended-A, 0100–017F
  9843. // Latin Extended-B, 0180–024F
  9844. // IPA Extensions, 0250–02AF
  9845. // Spacing Modifier Letters, 02B0–02FF
  9846. // - U+02C7 ˇ &#711; Caron
  9847. // - U+02D8 ˘ &#728; Breve
  9848. // - U+02D9 ˙ &#729; Dot Above
  9849. // - U+02DA ˚ &#730; Ring Above
  9850. // - U+02DB ˛ &#731; Ogonek
  9851. // - U+02DC ˜ &#732; Small Tilde
  9852. // - U+02DD ˝ &#733; Double Acute Accent
  9853. // Latin Extended Additional, 1E00–1EFF
  9854. var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/;
  9855. var reWhitespace = /\S/;
  9856. var wordDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/wordDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
  9857. wordDiff.equals = function (left, right) {
  9858. if (this.options.ignoreCase) {
  9859. left = left.toLowerCase();
  9860. right = right.toLowerCase();
  9861. }
  9862. return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right);
  9863. };
  9864. wordDiff.tokenize = function (value) {
  9865. var tokens = value.split(/(\s+|\b)/);
  9866. // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set.
  9867. for (var i = 0; i < tokens.length - 1; i++) {
  9868. // If we have an empty string in the next field and we have only word chars before and after, merge
  9869. if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) {
  9870. tokens[i] += tokens[i + 2];
  9871. tokens.splice(i + 1, 2);
  9872. i--;
  9873. }
  9874. }
  9875. return tokens;
  9876. };
  9877. function diffWords(oldStr, newStr, options) {
  9878. options = /*istanbul ignore start*/(0, _params.generateOptions) /*istanbul ignore end*/(options, { ignoreWhitespace: true });
  9879. return wordDiff.diff(oldStr, newStr, options);
  9880. }
  9881. function diffWordsWithSpace(oldStr, newStr, options) {
  9882. return wordDiff.diff(oldStr, newStr, options);
  9883. }
  9884. /***/ }),
  9885. /* 4 */
  9886. /***/ (function(module, exports) {
  9887. /*istanbul ignore start*/'use strict';
  9888. exports.__esModule = true;
  9889. exports. /*istanbul ignore end*/generateOptions = generateOptions;
  9890. function generateOptions(options, defaults) {
  9891. if (typeof options === 'function') {
  9892. defaults.callback = options;
  9893. } else if (options) {
  9894. for (var name in options) {
  9895. /* istanbul ignore else */
  9896. if (options.hasOwnProperty(name)) {
  9897. defaults[name] = options[name];
  9898. }
  9899. }
  9900. }
  9901. return defaults;
  9902. }
  9903. /***/ }),
  9904. /* 5 */
  9905. /***/ (function(module, exports, __webpack_require__) {
  9906. /*istanbul ignore start*/'use strict';
  9907. exports.__esModule = true;
  9908. exports.lineDiff = undefined;
  9909. exports. /*istanbul ignore end*/diffLines = diffLines;
  9910. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = diffTrimmedLines;
  9911. var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
  9912. /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
  9913. /*istanbul ignore end*/var /*istanbul ignore start*/_params = __webpack_require__(4) /*istanbul ignore end*/;
  9914. /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  9915. /*istanbul ignore end*/var lineDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/lineDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
  9916. lineDiff.tokenize = function (value) {
  9917. var retLines = [],
  9918. linesAndNewlines = value.split(/(\n|\r\n)/);
  9919. // Ignore the final empty token that occurs if the string ends with a new line
  9920. if (!linesAndNewlines[linesAndNewlines.length - 1]) {
  9921. linesAndNewlines.pop();
  9922. }
  9923. // Merge the content and line separators into single tokens
  9924. for (var i = 0; i < linesAndNewlines.length; i++) {
  9925. var line = linesAndNewlines[i];
  9926. if (i % 2 && !this.options.newlineIsToken) {
  9927. retLines[retLines.length - 1] += line;
  9928. } else {
  9929. if (this.options.ignoreWhitespace) {
  9930. line = line.trim();
  9931. }
  9932. retLines.push(line);
  9933. }
  9934. }
  9935. return retLines;
  9936. };
  9937. function diffLines(oldStr, newStr, callback) {
  9938. return lineDiff.diff(oldStr, newStr, callback);
  9939. }
  9940. function diffTrimmedLines(oldStr, newStr, callback) {
  9941. var options = /*istanbul ignore start*/(0, _params.generateOptions) /*istanbul ignore end*/(callback, { ignoreWhitespace: true });
  9942. return lineDiff.diff(oldStr, newStr, options);
  9943. }
  9944. /***/ }),
  9945. /* 6 */
  9946. /***/ (function(module, exports, __webpack_require__) {
  9947. /*istanbul ignore start*/'use strict';
  9948. exports.__esModule = true;
  9949. exports.sentenceDiff = undefined;
  9950. exports. /*istanbul ignore end*/diffSentences = diffSentences;
  9951. var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
  9952. /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
  9953. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  9954. /*istanbul ignore end*/var sentenceDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/sentenceDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
  9955. sentenceDiff.tokenize = function (value) {
  9956. return value.split(/(\S.+?[.!?])(?=\s+|$)/);
  9957. };
  9958. function diffSentences(oldStr, newStr, callback) {
  9959. return sentenceDiff.diff(oldStr, newStr, callback);
  9960. }
  9961. /***/ }),
  9962. /* 7 */
  9963. /***/ (function(module, exports, __webpack_require__) {
  9964. /*istanbul ignore start*/'use strict';
  9965. exports.__esModule = true;
  9966. exports.cssDiff = undefined;
  9967. exports. /*istanbul ignore end*/diffCss = diffCss;
  9968. var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
  9969. /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
  9970. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  9971. /*istanbul ignore end*/var cssDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/cssDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
  9972. cssDiff.tokenize = function (value) {
  9973. return value.split(/([{}:;,]|\s+)/);
  9974. };
  9975. function diffCss(oldStr, newStr, callback) {
  9976. return cssDiff.diff(oldStr, newStr, callback);
  9977. }
  9978. /***/ }),
  9979. /* 8 */
  9980. /***/ (function(module, exports, __webpack_require__) {
  9981. /*istanbul ignore start*/'use strict';
  9982. exports.__esModule = true;
  9983. exports.jsonDiff = undefined;
  9984. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  9985. exports. /*istanbul ignore end*/diffJson = diffJson;
  9986. /*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = canonicalize;
  9987. var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
  9988. /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
  9989. /*istanbul ignore end*/var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/;
  9990. /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  9991. /*istanbul ignore end*/var objectPrototypeToString = Object.prototype.toString;
  9992. var jsonDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/jsonDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
  9993. // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a
  9994. // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:
  9995. jsonDiff.useLongestToken = true;
  9996. jsonDiff.tokenize = /*istanbul ignore start*/_line.lineDiff /*istanbul ignore end*/.tokenize;
  9997. jsonDiff.castInput = function (value) {
  9998. /*istanbul ignore start*/var _options = /*istanbul ignore end*/this.options,
  9999. undefinedReplacement = _options.undefinedReplacement,
  10000. _options$stringifyRep = _options.stringifyReplacer,
  10001. stringifyReplacer = _options$stringifyRep === undefined ? function (k, v) /*istanbul ignore start*/{
  10002. return (/*istanbul ignore end*/typeof v === 'undefined' ? undefinedReplacement : v
  10003. );
  10004. } : _options$stringifyRep;
  10005. return typeof value === 'string' ? value : JSON.stringify(canonicalize(value, null, null, stringifyReplacer), stringifyReplacer, ' ');
  10006. };
  10007. jsonDiff.equals = function (left, right) {
  10008. return (/*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/.prototype.equals.call(jsonDiff, left.replace(/,([\r\n])/g, '$1'), right.replace(/,([\r\n])/g, '$1'))
  10009. );
  10010. };
  10011. function diffJson(oldObj, newObj, options) {
  10012. return jsonDiff.diff(oldObj, newObj, options);
  10013. }
  10014. // This function handles the presence of circular references by bailing out when encountering an
  10015. // object that is already on the "stack" of items being processed. Accepts an optional replacer
  10016. function canonicalize(obj, stack, replacementStack, replacer, key) {
  10017. stack = stack || [];
  10018. replacementStack = replacementStack || [];
  10019. if (replacer) {
  10020. obj = replacer(key, obj);
  10021. }
  10022. var i = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
  10023. for (i = 0; i < stack.length; i += 1) {
  10024. if (stack[i] === obj) {
  10025. return replacementStack[i];
  10026. }
  10027. }
  10028. var canonicalizedObj = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
  10029. if ('[object Array]' === objectPrototypeToString.call(obj)) {
  10030. stack.push(obj);
  10031. canonicalizedObj = new Array(obj.length);
  10032. replacementStack.push(canonicalizedObj);
  10033. for (i = 0; i < obj.length; i += 1) {
  10034. canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack, replacer, key);
  10035. }
  10036. stack.pop();
  10037. replacementStack.pop();
  10038. return canonicalizedObj;
  10039. }
  10040. if (obj && obj.toJSON) {
  10041. obj = obj.toJSON();
  10042. }
  10043. if ( /*istanbul ignore start*/(typeof /*istanbul ignore end*/obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' && obj !== null) {
  10044. stack.push(obj);
  10045. canonicalizedObj = {};
  10046. replacementStack.push(canonicalizedObj);
  10047. var sortedKeys = [],
  10048. _key = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
  10049. for (_key in obj) {
  10050. /* istanbul ignore else */
  10051. if (obj.hasOwnProperty(_key)) {
  10052. sortedKeys.push(_key);
  10053. }
  10054. }
  10055. sortedKeys.sort();
  10056. for (i = 0; i < sortedKeys.length; i += 1) {
  10057. _key = sortedKeys[i];
  10058. canonicalizedObj[_key] = canonicalize(obj[_key], stack, replacementStack, replacer, _key);
  10059. }
  10060. stack.pop();
  10061. replacementStack.pop();
  10062. } else {
  10063. canonicalizedObj = obj;
  10064. }
  10065. return canonicalizedObj;
  10066. }
  10067. /***/ }),
  10068. /* 9 */
  10069. /***/ (function(module, exports, __webpack_require__) {
  10070. /*istanbul ignore start*/'use strict';
  10071. exports.__esModule = true;
  10072. exports.arrayDiff = undefined;
  10073. exports. /*istanbul ignore end*/diffArrays = diffArrays;
  10074. var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
  10075. /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
  10076. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  10077. /*istanbul ignore end*/var arrayDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/arrayDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
  10078. arrayDiff.tokenize = function (value) {
  10079. return value.slice();
  10080. };
  10081. arrayDiff.join = arrayDiff.removeEmpty = function (value) {
  10082. return value;
  10083. };
  10084. function diffArrays(oldArr, newArr, callback) {
  10085. return arrayDiff.diff(oldArr, newArr, callback);
  10086. }
  10087. /***/ }),
  10088. /* 10 */
  10089. /***/ (function(module, exports, __webpack_require__) {
  10090. /*istanbul ignore start*/'use strict';
  10091. exports.__esModule = true;
  10092. exports. /*istanbul ignore end*/applyPatch = applyPatch;
  10093. /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = applyPatches;
  10094. var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/;
  10095. var /*istanbul ignore start*/_distanceIterator = __webpack_require__(12) /*istanbul ignore end*/;
  10096. /*istanbul ignore start*/var _distanceIterator2 = _interopRequireDefault(_distanceIterator);
  10097. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  10098. /*istanbul ignore end*/function applyPatch(source, uniDiff) {
  10099. /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  10100. if (typeof uniDiff === 'string') {
  10101. uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff);
  10102. }
  10103. if (Array.isArray(uniDiff)) {
  10104. if (uniDiff.length > 1) {
  10105. throw new Error('applyPatch only works with a single input.');
  10106. }
  10107. uniDiff = uniDiff[0];
  10108. }
  10109. // Apply the diff to the input
  10110. var lines = source.split(/\r\n|[\n\v\f\r\x85]/),
  10111. delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [],
  10112. hunks = uniDiff.hunks,
  10113. compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) /*istanbul ignore start*/{
  10114. return (/*istanbul ignore end*/line === patchContent
  10115. );
  10116. },
  10117. errorCount = 0,
  10118. fuzzFactor = options.fuzzFactor || 0,
  10119. minLine = 0,
  10120. offset = 0,
  10121. removeEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/,
  10122. addEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
  10123. /**
  10124. * Checks if the hunk exactly fits on the provided location
  10125. */
  10126. function hunkFits(hunk, toPos) {
  10127. for (var j = 0; j < hunk.lines.length; j++) {
  10128. var line = hunk.lines[j],
  10129. operation = line.length > 0 ? line[0] : ' ',
  10130. content = line.length > 0 ? line.substr(1) : line;
  10131. if (operation === ' ' || operation === '-') {
  10132. // Context sanity check
  10133. if (!compareLine(toPos + 1, lines[toPos], operation, content)) {
  10134. errorCount++;
  10135. if (errorCount > fuzzFactor) {
  10136. return false;
  10137. }
  10138. }
  10139. toPos++;
  10140. }
  10141. }
  10142. return true;
  10143. }
  10144. // Search best fit offsets for each hunk based on the previous ones
  10145. for (var i = 0; i < hunks.length; i++) {
  10146. var hunk = hunks[i],
  10147. maxLine = lines.length - hunk.oldLines,
  10148. localOffset = 0,
  10149. toPos = offset + hunk.oldStart - 1;
  10150. var iterator = /*istanbul ignore start*/(0, _distanceIterator2['default']) /*istanbul ignore end*/(toPos, minLine, maxLine);
  10151. for (; localOffset !== undefined; localOffset = iterator()) {
  10152. if (hunkFits(hunk, toPos + localOffset)) {
  10153. hunk.offset = offset += localOffset;
  10154. break;
  10155. }
  10156. }
  10157. if (localOffset === undefined) {
  10158. return false;
  10159. }
  10160. // Set lower text limit to end of the current hunk, so next ones don't try
  10161. // to fit over already patched text
  10162. minLine = hunk.offset + hunk.oldStart + hunk.oldLines;
  10163. }
  10164. // Apply patch hunks
  10165. var diffOffset = 0;
  10166. for (var _i = 0; _i < hunks.length; _i++) {
  10167. var _hunk = hunks[_i],
  10168. _toPos = _hunk.oldStart + _hunk.offset + diffOffset - 1;
  10169. diffOffset += _hunk.newLines - _hunk.oldLines;
  10170. if (_toPos < 0) {
  10171. // Creating a new file
  10172. _toPos = 0;
  10173. }
  10174. for (var j = 0; j < _hunk.lines.length; j++) {
  10175. var line = _hunk.lines[j],
  10176. operation = line.length > 0 ? line[0] : ' ',
  10177. content = line.length > 0 ? line.substr(1) : line,
  10178. delimiter = _hunk.linedelimiters[j];
  10179. if (operation === ' ') {
  10180. _toPos++;
  10181. } else if (operation === '-') {
  10182. lines.splice(_toPos, 1);
  10183. delimiters.splice(_toPos, 1);
  10184. /* istanbul ignore else */
  10185. } else if (operation === '+') {
  10186. lines.splice(_toPos, 0, content);
  10187. delimiters.splice(_toPos, 0, delimiter);
  10188. _toPos++;
  10189. } else if (operation === '\\') {
  10190. var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null;
  10191. if (previousOperation === '+') {
  10192. removeEOFNL = true;
  10193. } else if (previousOperation === '-') {
  10194. addEOFNL = true;
  10195. }
  10196. }
  10197. }
  10198. }
  10199. // Handle EOFNL insertion/removal
  10200. if (removeEOFNL) {
  10201. while (!lines[lines.length - 1]) {
  10202. lines.pop();
  10203. delimiters.pop();
  10204. }
  10205. } else if (addEOFNL) {
  10206. lines.push('');
  10207. delimiters.push('\n');
  10208. }
  10209. for (var _k = 0; _k < lines.length - 1; _k++) {
  10210. lines[_k] = lines[_k] + delimiters[_k];
  10211. }
  10212. return lines.join('');
  10213. }
  10214. // Wrapper that supports multiple file patches via callbacks.
  10215. function applyPatches(uniDiff, options) {
  10216. if (typeof uniDiff === 'string') {
  10217. uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff);
  10218. }
  10219. var currentIndex = 0;
  10220. function processIndex() {
  10221. var index = uniDiff[currentIndex++];
  10222. if (!index) {
  10223. return options.complete();
  10224. }
  10225. options.loadFile(index, function (err, data) {
  10226. if (err) {
  10227. return options.complete(err);
  10228. }
  10229. var updatedContent = applyPatch(data, index, options);
  10230. options.patched(index, updatedContent, function (err) {
  10231. if (err) {
  10232. return options.complete(err);
  10233. }
  10234. processIndex();
  10235. });
  10236. });
  10237. }
  10238. processIndex();
  10239. }
  10240. /***/ }),
  10241. /* 11 */
  10242. /***/ (function(module, exports) {
  10243. /*istanbul ignore start*/'use strict';
  10244. exports.__esModule = true;
  10245. exports. /*istanbul ignore end*/parsePatch = parsePatch;
  10246. function parsePatch(uniDiff) {
  10247. /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  10248. var diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/),
  10249. delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [],
  10250. list = [],
  10251. i = 0;
  10252. function parseIndex() {
  10253. var index = {};
  10254. list.push(index);
  10255. // Parse diff metadata
  10256. while (i < diffstr.length) {
  10257. var line = diffstr[i];
  10258. // File header found, end parsing diff metadata
  10259. if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) {
  10260. break;
  10261. }
  10262. // Diff index
  10263. var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line);
  10264. if (header) {
  10265. index.index = header[1];
  10266. }
  10267. i++;
  10268. }
  10269. // Parse file headers if they are defined. Unified diff requires them, but
  10270. // there's no technical issues to have an isolated hunk without file header
  10271. parseFileHeader(index);
  10272. parseFileHeader(index);
  10273. // Parse hunks
  10274. index.hunks = [];
  10275. while (i < diffstr.length) {
  10276. var _line = diffstr[i];
  10277. if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) {
  10278. break;
  10279. } else if (/^@@/.test(_line)) {
  10280. index.hunks.push(parseHunk());
  10281. } else if (_line && options.strict) {
  10282. // Ignore unexpected content unless in strict mode
  10283. throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line));
  10284. } else {
  10285. i++;
  10286. }
  10287. }
  10288. }
  10289. // Parses the --- and +++ headers, if none are found, no lines
  10290. // are consumed.
  10291. function parseFileHeader(index) {
  10292. var fileHeader = /^(---|\+\+\+)\s+(.*)$/.exec(diffstr[i]);
  10293. if (fileHeader) {
  10294. var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new';
  10295. var data = fileHeader[2].split('\t', 2);
  10296. var fileName = data[0].replace(/\\\\/g, '\\');
  10297. if (/^".*"$/.test(fileName)) {
  10298. fileName = fileName.substr(1, fileName.length - 2);
  10299. }
  10300. index[keyPrefix + 'FileName'] = fileName;
  10301. index[keyPrefix + 'Header'] = (data[1] || '').trim();
  10302. i++;
  10303. }
  10304. }
  10305. // Parses a hunk
  10306. // This assumes that we are at the start of a hunk.
  10307. function parseHunk() {
  10308. var chunkHeaderIndex = i,
  10309. chunkHeaderLine = diffstr[i++],
  10310. chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
  10311. var hunk = {
  10312. oldStart: +chunkHeader[1],
  10313. oldLines: +chunkHeader[2] || 1,
  10314. newStart: +chunkHeader[3],
  10315. newLines: +chunkHeader[4] || 1,
  10316. lines: [],
  10317. linedelimiters: []
  10318. };
  10319. var addCount = 0,
  10320. removeCount = 0;
  10321. for (; i < diffstr.length; i++) {
  10322. // Lines starting with '---' could be mistaken for the "remove line" operation
  10323. // But they could be the header for the next file. Therefore prune such cases out.
  10324. if (diffstr[i].indexOf('--- ') === 0 && i + 2 < diffstr.length && diffstr[i + 1].indexOf('+++ ') === 0 && diffstr[i + 2].indexOf('@@') === 0) {
  10325. break;
  10326. }
  10327. var operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? ' ' : diffstr[i][0];
  10328. if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') {
  10329. hunk.lines.push(diffstr[i]);
  10330. hunk.linedelimiters.push(delimiters[i] || '\n');
  10331. if (operation === '+') {
  10332. addCount++;
  10333. } else if (operation === '-') {
  10334. removeCount++;
  10335. } else if (operation === ' ') {
  10336. addCount++;
  10337. removeCount++;
  10338. }
  10339. } else {
  10340. break;
  10341. }
  10342. }
  10343. // Handle the empty block count case
  10344. if (!addCount && hunk.newLines === 1) {
  10345. hunk.newLines = 0;
  10346. }
  10347. if (!removeCount && hunk.oldLines === 1) {
  10348. hunk.oldLines = 0;
  10349. }
  10350. // Perform optional sanity checking
  10351. if (options.strict) {
  10352. if (addCount !== hunk.newLines) {
  10353. throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
  10354. }
  10355. if (removeCount !== hunk.oldLines) {
  10356. throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
  10357. }
  10358. }
  10359. return hunk;
  10360. }
  10361. while (i < diffstr.length) {
  10362. parseIndex();
  10363. }
  10364. return list;
  10365. }
  10366. /***/ }),
  10367. /* 12 */
  10368. /***/ (function(module, exports) {
  10369. /*istanbul ignore start*/"use strict";
  10370. exports.__esModule = true;
  10371. exports["default"] = /*istanbul ignore end*/function (start, minLine, maxLine) {
  10372. var wantForward = true,
  10373. backwardExhausted = false,
  10374. forwardExhausted = false,
  10375. localOffset = 1;
  10376. return function iterator() {
  10377. if (wantForward && !forwardExhausted) {
  10378. if (backwardExhausted) {
  10379. localOffset++;
  10380. } else {
  10381. wantForward = false;
  10382. }
  10383. // Check if trying to fit beyond text length, and if not, check it fits
  10384. // after offset location (or desired location on first iteration)
  10385. if (start + localOffset <= maxLine) {
  10386. return localOffset;
  10387. }
  10388. forwardExhausted = true;
  10389. }
  10390. if (!backwardExhausted) {
  10391. if (!forwardExhausted) {
  10392. wantForward = true;
  10393. }
  10394. // Check if trying to fit before text beginning, and if not, check it fits
  10395. // before offset location
  10396. if (minLine <= start - localOffset) {
  10397. return -localOffset++;
  10398. }
  10399. backwardExhausted = true;
  10400. return iterator();
  10401. }
  10402. // We tried to fit hunk before text beginning and beyond text length, then
  10403. // hunk can't fit on the text. Return undefined
  10404. };
  10405. };
  10406. /***/ }),
  10407. /* 13 */
  10408. /***/ (function(module, exports, __webpack_require__) {
  10409. /*istanbul ignore start*/'use strict';
  10410. exports.__esModule = true;
  10411. exports. /*istanbul ignore end*/calcLineCount = calcLineCount;
  10412. /*istanbul ignore start*/exports. /*istanbul ignore end*/merge = merge;
  10413. var /*istanbul ignore start*/_create = __webpack_require__(14) /*istanbul ignore end*/;
  10414. var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/;
  10415. var /*istanbul ignore start*/_array = __webpack_require__(15) /*istanbul ignore end*/;
  10416. /*istanbul ignore start*/function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
  10417. /*istanbul ignore end*/function calcLineCount(hunk) {
  10418. /*istanbul ignore start*/var _calcOldNewLineCount = /*istanbul ignore end*/calcOldNewLineCount(hunk.lines),
  10419. oldLines = _calcOldNewLineCount.oldLines,
  10420. newLines = _calcOldNewLineCount.newLines;
  10421. if (oldLines !== undefined) {
  10422. hunk.oldLines = oldLines;
  10423. } else {
  10424. delete hunk.oldLines;
  10425. }
  10426. if (newLines !== undefined) {
  10427. hunk.newLines = newLines;
  10428. } else {
  10429. delete hunk.newLines;
  10430. }
  10431. }
  10432. function merge(mine, theirs, base) {
  10433. mine = loadPatch(mine, base);
  10434. theirs = loadPatch(theirs, base);
  10435. var ret = {};
  10436. // For index we just let it pass through as it doesn't have any necessary meaning.
  10437. // Leaving sanity checks on this to the API consumer that may know more about the
  10438. // meaning in their own context.
  10439. if (mine.index || theirs.index) {
  10440. ret.index = mine.index || theirs.index;
  10441. }
  10442. if (mine.newFileName || theirs.newFileName) {
  10443. if (!fileNameChanged(mine)) {
  10444. // No header or no change in ours, use theirs (and ours if theirs does not exist)
  10445. ret.oldFileName = theirs.oldFileName || mine.oldFileName;
  10446. ret.newFileName = theirs.newFileName || mine.newFileName;
  10447. ret.oldHeader = theirs.oldHeader || mine.oldHeader;
  10448. ret.newHeader = theirs.newHeader || mine.newHeader;
  10449. } else if (!fileNameChanged(theirs)) {
  10450. // No header or no change in theirs, use ours
  10451. ret.oldFileName = mine.oldFileName;
  10452. ret.newFileName = mine.newFileName;
  10453. ret.oldHeader = mine.oldHeader;
  10454. ret.newHeader = mine.newHeader;
  10455. } else {
  10456. // Both changed... figure it out
  10457. ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName);
  10458. ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName);
  10459. ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader);
  10460. ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader);
  10461. }
  10462. }
  10463. ret.hunks = [];
  10464. var mineIndex = 0,
  10465. theirsIndex = 0,
  10466. mineOffset = 0,
  10467. theirsOffset = 0;
  10468. while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) {
  10469. var mineCurrent = mine.hunks[mineIndex] || { oldStart: Infinity },
  10470. theirsCurrent = theirs.hunks[theirsIndex] || { oldStart: Infinity };
  10471. if (hunkBefore(mineCurrent, theirsCurrent)) {
  10472. // This patch does not overlap with any of the others, yay.
  10473. ret.hunks.push(cloneHunk(mineCurrent, mineOffset));
  10474. mineIndex++;
  10475. theirsOffset += mineCurrent.newLines - mineCurrent.oldLines;
  10476. } else if (hunkBefore(theirsCurrent, mineCurrent)) {
  10477. // This patch does not overlap with any of the others, yay.
  10478. ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset));
  10479. theirsIndex++;
  10480. mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines;
  10481. } else {
  10482. // Overlap, merge as best we can
  10483. var mergedHunk = {
  10484. oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart),
  10485. oldLines: 0,
  10486. newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset),
  10487. newLines: 0,
  10488. lines: []
  10489. };
  10490. mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines);
  10491. theirsIndex++;
  10492. mineIndex++;
  10493. ret.hunks.push(mergedHunk);
  10494. }
  10495. }
  10496. return ret;
  10497. }
  10498. function loadPatch(param, base) {
  10499. if (typeof param === 'string') {
  10500. if (/^@@/m.test(param) || /^Index:/m.test(param)) {
  10501. return (/*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(param)[0]
  10502. );
  10503. }
  10504. if (!base) {
  10505. throw new Error('Must provide a base reference or pass in a patch');
  10506. }
  10507. return (/*istanbul ignore start*/(0, _create.structuredPatch) /*istanbul ignore end*/(undefined, undefined, base, param)
  10508. );
  10509. }
  10510. return param;
  10511. }
  10512. function fileNameChanged(patch) {
  10513. return patch.newFileName && patch.newFileName !== patch.oldFileName;
  10514. }
  10515. function selectField(index, mine, theirs) {
  10516. if (mine === theirs) {
  10517. return mine;
  10518. } else {
  10519. index.conflict = true;
  10520. return { mine: mine, theirs: theirs };
  10521. }
  10522. }
  10523. function hunkBefore(test, check) {
  10524. return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart;
  10525. }
  10526. function cloneHunk(hunk, offset) {
  10527. return {
  10528. oldStart: hunk.oldStart, oldLines: hunk.oldLines,
  10529. newStart: hunk.newStart + offset, newLines: hunk.newLines,
  10530. lines: hunk.lines
  10531. };
  10532. }
  10533. function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) {
  10534. // This will generally result in a conflicted hunk, but there are cases where the context
  10535. // is the only overlap where we can successfully merge the content here.
  10536. var mine = { offset: mineOffset, lines: mineLines, index: 0 },
  10537. their = { offset: theirOffset, lines: theirLines, index: 0 };
  10538. // Handle any leading content
  10539. insertLeading(hunk, mine, their);
  10540. insertLeading(hunk, their, mine);
  10541. // Now in the overlap content. Scan through and select the best changes from each.
  10542. while (mine.index < mine.lines.length && their.index < their.lines.length) {
  10543. var mineCurrent = mine.lines[mine.index],
  10544. theirCurrent = their.lines[their.index];
  10545. if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) {
  10546. // Both modified ...
  10547. mutualChange(hunk, mine, their);
  10548. } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') {
  10549. /*istanbul ignore start*/var _hunk$lines;
  10550. /*istanbul ignore end*/ // Mine inserted
  10551. /*istanbul ignore start*/(_hunk$lines = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/collectChange(mine)));
  10552. } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') {
  10553. /*istanbul ignore start*/var _hunk$lines2;
  10554. /*istanbul ignore end*/ // Theirs inserted
  10555. /*istanbul ignore start*/(_hunk$lines2 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines2 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/collectChange(their)));
  10556. } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') {
  10557. // Mine removed or edited
  10558. removal(hunk, mine, their);
  10559. } else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') {
  10560. // Their removed or edited
  10561. removal(hunk, their, mine, true);
  10562. } else if (mineCurrent === theirCurrent) {
  10563. // Context identity
  10564. hunk.lines.push(mineCurrent);
  10565. mine.index++;
  10566. their.index++;
  10567. } else {
  10568. // Context mismatch
  10569. conflict(hunk, collectChange(mine), collectChange(their));
  10570. }
  10571. }
  10572. // Now push anything that may be remaining
  10573. insertTrailing(hunk, mine);
  10574. insertTrailing(hunk, their);
  10575. calcLineCount(hunk);
  10576. }
  10577. function mutualChange(hunk, mine, their) {
  10578. var myChanges = collectChange(mine),
  10579. theirChanges = collectChange(their);
  10580. if (allRemoves(myChanges) && allRemoves(theirChanges)) {
  10581. // Special case for remove changes that are supersets of one another
  10582. if ( /*istanbul ignore start*/(0, _array.arrayStartsWith) /*istanbul ignore end*/(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) {
  10583. /*istanbul ignore start*/var _hunk$lines3;
  10584. /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines3 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines3 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/myChanges));
  10585. return;
  10586. } else if ( /*istanbul ignore start*/(0, _array.arrayStartsWith) /*istanbul ignore end*/(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) {
  10587. /*istanbul ignore start*/var _hunk$lines4;
  10588. /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines4 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines4 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/theirChanges));
  10589. return;
  10590. }
  10591. } else if ( /*istanbul ignore start*/(0, _array.arrayEqual) /*istanbul ignore end*/(myChanges, theirChanges)) {
  10592. /*istanbul ignore start*/var _hunk$lines5;
  10593. /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines5 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines5 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/myChanges));
  10594. return;
  10595. }
  10596. conflict(hunk, myChanges, theirChanges);
  10597. }
  10598. function removal(hunk, mine, their, swap) {
  10599. var myChanges = collectChange(mine),
  10600. theirChanges = collectContext(their, myChanges);
  10601. if (theirChanges.merged) {
  10602. /*istanbul ignore start*/var _hunk$lines6;
  10603. /*istanbul ignore end*/ /*istanbul ignore start*/(_hunk$lines6 = /*istanbul ignore end*/hunk.lines).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_hunk$lines6 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/theirChanges.merged));
  10604. } else {
  10605. conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges);
  10606. }
  10607. }
  10608. function conflict(hunk, mine, their) {
  10609. hunk.conflict = true;
  10610. hunk.lines.push({
  10611. conflict: true,
  10612. mine: mine,
  10613. theirs: their
  10614. });
  10615. }
  10616. function insertLeading(hunk, insert, their) {
  10617. while (insert.offset < their.offset && insert.index < insert.lines.length) {
  10618. var line = insert.lines[insert.index++];
  10619. hunk.lines.push(line);
  10620. insert.offset++;
  10621. }
  10622. }
  10623. function insertTrailing(hunk, insert) {
  10624. while (insert.index < insert.lines.length) {
  10625. var line = insert.lines[insert.index++];
  10626. hunk.lines.push(line);
  10627. }
  10628. }
  10629. function collectChange(state) {
  10630. var ret = [],
  10631. operation = state.lines[state.index][0];
  10632. while (state.index < state.lines.length) {
  10633. var line = state.lines[state.index];
  10634. // Group additions that are immediately after subtractions and treat them as one "atomic" modify change.
  10635. if (operation === '-' && line[0] === '+') {
  10636. operation = '+';
  10637. }
  10638. if (operation === line[0]) {
  10639. ret.push(line);
  10640. state.index++;
  10641. } else {
  10642. break;
  10643. }
  10644. }
  10645. return ret;
  10646. }
  10647. function collectContext(state, matchChanges) {
  10648. var changes = [],
  10649. merged = [],
  10650. matchIndex = 0,
  10651. contextChanges = false,
  10652. conflicted = false;
  10653. while (matchIndex < matchChanges.length && state.index < state.lines.length) {
  10654. var change = state.lines[state.index],
  10655. match = matchChanges[matchIndex];
  10656. // Once we've hit our add, then we are done
  10657. if (match[0] === '+') {
  10658. break;
  10659. }
  10660. contextChanges = contextChanges || change[0] !== ' ';
  10661. merged.push(match);
  10662. matchIndex++;
  10663. // Consume any additions in the other block as a conflict to attempt
  10664. // to pull in the remaining context after this
  10665. if (change[0] === '+') {
  10666. conflicted = true;
  10667. while (change[0] === '+') {
  10668. changes.push(change);
  10669. change = state.lines[++state.index];
  10670. }
  10671. }
  10672. if (match.substr(1) === change.substr(1)) {
  10673. changes.push(change);
  10674. state.index++;
  10675. } else {
  10676. conflicted = true;
  10677. }
  10678. }
  10679. if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) {
  10680. conflicted = true;
  10681. }
  10682. if (conflicted) {
  10683. return changes;
  10684. }
  10685. while (matchIndex < matchChanges.length) {
  10686. merged.push(matchChanges[matchIndex++]);
  10687. }
  10688. return {
  10689. merged: merged,
  10690. changes: changes
  10691. };
  10692. }
  10693. function allRemoves(changes) {
  10694. return changes.reduce(function (prev, change) {
  10695. return prev && change[0] === '-';
  10696. }, true);
  10697. }
  10698. function skipRemoveSuperset(state, removeChanges, delta) {
  10699. for (var i = 0; i < delta; i++) {
  10700. var changeContent = removeChanges[removeChanges.length - delta + i].substr(1);
  10701. if (state.lines[state.index + i] !== ' ' + changeContent) {
  10702. return false;
  10703. }
  10704. }
  10705. state.index += delta;
  10706. return true;
  10707. }
  10708. function calcOldNewLineCount(lines) {
  10709. var oldLines = 0;
  10710. var newLines = 0;
  10711. lines.forEach(function (line) {
  10712. if (typeof line !== 'string') {
  10713. var myCount = calcOldNewLineCount(line.mine);
  10714. var theirCount = calcOldNewLineCount(line.theirs);
  10715. if (oldLines !== undefined) {
  10716. if (myCount.oldLines === theirCount.oldLines) {
  10717. oldLines += myCount.oldLines;
  10718. } else {
  10719. oldLines = undefined;
  10720. }
  10721. }
  10722. if (newLines !== undefined) {
  10723. if (myCount.newLines === theirCount.newLines) {
  10724. newLines += myCount.newLines;
  10725. } else {
  10726. newLines = undefined;
  10727. }
  10728. }
  10729. } else {
  10730. if (newLines !== undefined && (line[0] === '+' || line[0] === ' ')) {
  10731. newLines++;
  10732. }
  10733. if (oldLines !== undefined && (line[0] === '-' || line[0] === ' ')) {
  10734. oldLines++;
  10735. }
  10736. }
  10737. });
  10738. return { oldLines: oldLines, newLines: newLines };
  10739. }
  10740. /***/ }),
  10741. /* 14 */
  10742. /***/ (function(module, exports, __webpack_require__) {
  10743. /*istanbul ignore start*/'use strict';
  10744. exports.__esModule = true;
  10745. exports. /*istanbul ignore end*/structuredPatch = structuredPatch;
  10746. /*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = createTwoFilesPatch;
  10747. /*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = createPatch;
  10748. var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/;
  10749. /*istanbul ignore start*/function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
  10750. /*istanbul ignore end*/function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
  10751. if (!options) {
  10752. options = {};
  10753. }
  10754. if (typeof options.context === 'undefined') {
  10755. options.context = 4;
  10756. }
  10757. var diff = /*istanbul ignore start*/(0, _line.diffLines) /*istanbul ignore end*/(oldStr, newStr, options);
  10758. diff.push({ value: '', lines: [] }); // Append an empty value to make cleanup easier
  10759. function contextLines(lines) {
  10760. return lines.map(function (entry) {
  10761. return ' ' + entry;
  10762. });
  10763. }
  10764. var hunks = [];
  10765. var oldRangeStart = 0,
  10766. newRangeStart = 0,
  10767. curRange = [],
  10768. oldLine = 1,
  10769. newLine = 1;
  10770. /*istanbul ignore start*/var _loop = function _loop( /*istanbul ignore end*/i) {
  10771. var current = diff[i],
  10772. lines = current.lines || current.value.replace(/\n$/, '').split('\n');
  10773. current.lines = lines;
  10774. if (current.added || current.removed) {
  10775. /*istanbul ignore start*/var _curRange;
  10776. /*istanbul ignore end*/ // If we have previous context, start with that
  10777. if (!oldRangeStart) {
  10778. var prev = diff[i - 1];
  10779. oldRangeStart = oldLine;
  10780. newRangeStart = newLine;
  10781. if (prev) {
  10782. curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];
  10783. oldRangeStart -= curRange.length;
  10784. newRangeStart -= curRange.length;
  10785. }
  10786. }
  10787. // Output our changes
  10788. /*istanbul ignore start*/(_curRange = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/lines.map(function (entry) {
  10789. return (current.added ? '+' : '-') + entry;
  10790. })));
  10791. // Track the updated file position
  10792. if (current.added) {
  10793. newLine += lines.length;
  10794. } else {
  10795. oldLine += lines.length;
  10796. }
  10797. } else {
  10798. // Identical context lines. Track line changes
  10799. if (oldRangeStart) {
  10800. // Close out any changes that have been output (or join overlapping)
  10801. if (lines.length <= options.context * 2 && i < diff.length - 2) {
  10802. /*istanbul ignore start*/var _curRange2;
  10803. /*istanbul ignore end*/ // Overlapping
  10804. /*istanbul ignore start*/(_curRange2 = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange2 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/contextLines(lines)));
  10805. } else {
  10806. /*istanbul ignore start*/var _curRange3;
  10807. /*istanbul ignore end*/ // end the range and output
  10808. var contextSize = Math.min(lines.length, options.context);
  10809. /*istanbul ignore start*/(_curRange3 = /*istanbul ignore end*/curRange).push. /*istanbul ignore start*/apply /*istanbul ignore end*/( /*istanbul ignore start*/_curRange3 /*istanbul ignore end*/, /*istanbul ignore start*/_toConsumableArray( /*istanbul ignore end*/contextLines(lines.slice(0, contextSize))));
  10810. var hunk = {
  10811. oldStart: oldRangeStart,
  10812. oldLines: oldLine - oldRangeStart + contextSize,
  10813. newStart: newRangeStart,
  10814. newLines: newLine - newRangeStart + contextSize,
  10815. lines: curRange
  10816. };
  10817. if (i >= diff.length - 2 && lines.length <= options.context) {
  10818. // EOF is inside this hunk
  10819. var oldEOFNewline = /\n$/.test(oldStr);
  10820. var newEOFNewline = /\n$/.test(newStr);
  10821. if (lines.length == 0 && !oldEOFNewline) {
  10822. // special case: old has no eol and no trailing context; no-nl can end up before adds
  10823. curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file');
  10824. } else if (!oldEOFNewline || !newEOFNewline) {
  10825. curRange.push('\\ No newline at end of file');
  10826. }
  10827. }
  10828. hunks.push(hunk);
  10829. oldRangeStart = 0;
  10830. newRangeStart = 0;
  10831. curRange = [];
  10832. }
  10833. }
  10834. oldLine += lines.length;
  10835. newLine += lines.length;
  10836. }
  10837. };
  10838. for (var i = 0; i < diff.length; i++) {
  10839. /*istanbul ignore start*/_loop( /*istanbul ignore end*/i);
  10840. }
  10841. return {
  10842. oldFileName: oldFileName, newFileName: newFileName,
  10843. oldHeader: oldHeader, newHeader: newHeader,
  10844. hunks: hunks
  10845. };
  10846. }
  10847. function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
  10848. var diff = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options);
  10849. var ret = [];
  10850. if (oldFileName == newFileName) {
  10851. ret.push('Index: ' + oldFileName);
  10852. }
  10853. ret.push('===================================================================');
  10854. ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader));
  10855. ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader));
  10856. for (var i = 0; i < diff.hunks.length; i++) {
  10857. var hunk = diff.hunks[i];
  10858. ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@');
  10859. ret.push.apply(ret, hunk.lines);
  10860. }
  10861. return ret.join('\n') + '\n';
  10862. }
  10863. function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {
  10864. return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);
  10865. }
  10866. /***/ }),
  10867. /* 15 */
  10868. /***/ (function(module, exports) {
  10869. /*istanbul ignore start*/"use strict";
  10870. exports.__esModule = true;
  10871. exports. /*istanbul ignore end*/arrayEqual = arrayEqual;
  10872. /*istanbul ignore start*/exports. /*istanbul ignore end*/arrayStartsWith = arrayStartsWith;
  10873. function arrayEqual(a, b) {
  10874. if (a.length !== b.length) {
  10875. return false;
  10876. }
  10877. return arrayStartsWith(a, b);
  10878. }
  10879. function arrayStartsWith(array, start) {
  10880. if (start.length > array.length) {
  10881. return false;
  10882. }
  10883. for (var i = 0; i < start.length; i++) {
  10884. if (start[i] !== array[i]) {
  10885. return false;
  10886. }
  10887. }
  10888. return true;
  10889. }
  10890. /***/ }),
  10891. /* 16 */
  10892. /***/ (function(module, exports) {
  10893. /*istanbul ignore start*/"use strict";
  10894. exports.__esModule = true;
  10895. exports. /*istanbul ignore end*/convertChangesToDMP = convertChangesToDMP;
  10896. // See: http://code.google.com/p/google-diff-match-patch/wiki/API
  10897. function convertChangesToDMP(changes) {
  10898. var ret = [],
  10899. change = /*istanbul ignore start*/void 0 /*istanbul ignore end*/,
  10900. operation = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
  10901. for (var i = 0; i < changes.length; i++) {
  10902. change = changes[i];
  10903. if (change.added) {
  10904. operation = 1;
  10905. } else if (change.removed) {
  10906. operation = -1;
  10907. } else {
  10908. operation = 0;
  10909. }
  10910. ret.push([operation, change.value]);
  10911. }
  10912. return ret;
  10913. }
  10914. /***/ }),
  10915. /* 17 */
  10916. /***/ (function(module, exports) {
  10917. /*istanbul ignore start*/'use strict';
  10918. exports.__esModule = true;
  10919. exports. /*istanbul ignore end*/convertChangesToXML = convertChangesToXML;
  10920. function convertChangesToXML(changes) {
  10921. var ret = [];
  10922. for (var i = 0; i < changes.length; i++) {
  10923. var change = changes[i];
  10924. if (change.added) {
  10925. ret.push('<ins>');
  10926. } else if (change.removed) {
  10927. ret.push('<del>');
  10928. }
  10929. ret.push(escapeHTML(change.value));
  10930. if (change.added) {
  10931. ret.push('</ins>');
  10932. } else if (change.removed) {
  10933. ret.push('</del>');
  10934. }
  10935. }
  10936. return ret.join('');
  10937. }
  10938. function escapeHTML(s) {
  10939. var n = s;
  10940. n = n.replace(/&/g, '&amp;');
  10941. n = n.replace(/</g, '&lt;');
  10942. n = n.replace(/>/g, '&gt;');
  10943. n = n.replace(/"/g, '&quot;');
  10944. return n;
  10945. }
  10946. /***/ })
  10947. /******/ ])
  10948. });
  10949. ;
  10950. },{}],49:[function(require,module,exports){
  10951. 'use strict';
  10952. var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
  10953. module.exports = function (str) {
  10954. if (typeof str !== 'string') {
  10955. throw new TypeError('Expected a string');
  10956. }
  10957. return str.replace(matchOperatorsRe, '\\$&');
  10958. };
  10959. },{}],50:[function(require,module,exports){
  10960. // Copyright Joyent, Inc. and other Node contributors.
  10961. //
  10962. // Permission is hereby granted, free of charge, to any person obtaining a
  10963. // copy of this software and associated documentation files (the
  10964. // "Software"), to deal in the Software without restriction, including
  10965. // without limitation the rights to use, copy, modify, merge, publish,
  10966. // distribute, sublicense, and/or sell copies of the Software, and to permit
  10967. // persons to whom the Software is furnished to do so, subject to the
  10968. // following conditions:
  10969. //
  10970. // The above copyright notice and this permission notice shall be included
  10971. // in all copies or substantial portions of the Software.
  10972. //
  10973. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  10974. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  10975. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  10976. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  10977. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  10978. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  10979. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  10980. var objectCreate = Object.create || objectCreatePolyfill
  10981. var objectKeys = Object.keys || objectKeysPolyfill
  10982. var bind = Function.prototype.bind || functionBindPolyfill
  10983. function EventEmitter() {
  10984. if (!this._events || !Object.prototype.hasOwnProperty.call(this, '_events')) {
  10985. this._events = objectCreate(null);
  10986. this._eventsCount = 0;
  10987. }
  10988. this._maxListeners = this._maxListeners || undefined;
  10989. }
  10990. module.exports = EventEmitter;
  10991. // Backwards-compat with node 0.10.x
  10992. EventEmitter.EventEmitter = EventEmitter;
  10993. EventEmitter.prototype._events = undefined;
  10994. EventEmitter.prototype._maxListeners = undefined;
  10995. // By default EventEmitters will print a warning if more than 10 listeners are
  10996. // added to it. This is a useful default which helps finding memory leaks.
  10997. var defaultMaxListeners = 10;
  10998. var hasDefineProperty;
  10999. try {
  11000. var o = {};
  11001. if (Object.defineProperty) Object.defineProperty(o, 'x', { value: 0 });
  11002. hasDefineProperty = o.x === 0;
  11003. } catch (err) { hasDefineProperty = false }
  11004. if (hasDefineProperty) {
  11005. Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
  11006. enumerable: true,
  11007. get: function() {
  11008. return defaultMaxListeners;
  11009. },
  11010. set: function(arg) {
  11011. // check whether the input is a positive number (whose value is zero or
  11012. // greater and not a NaN).
  11013. if (typeof arg !== 'number' || arg < 0 || arg !== arg)
  11014. throw new TypeError('"defaultMaxListeners" must be a positive number');
  11015. defaultMaxListeners = arg;
  11016. }
  11017. });
  11018. } else {
  11019. EventEmitter.defaultMaxListeners = defaultMaxListeners;
  11020. }
  11021. // Obviously not all Emitters should be limited to 10. This function allows
  11022. // that to be increased. Set to zero for unlimited.
  11023. EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
  11024. if (typeof n !== 'number' || n < 0 || isNaN(n))
  11025. throw new TypeError('"n" argument must be a positive number');
  11026. this._maxListeners = n;
  11027. return this;
  11028. };
  11029. function $getMaxListeners(that) {
  11030. if (that._maxListeners === undefined)
  11031. return EventEmitter.defaultMaxListeners;
  11032. return that._maxListeners;
  11033. }
  11034. EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
  11035. return $getMaxListeners(this);
  11036. };
  11037. // These standalone emit* functions are used to optimize calling of event
  11038. // handlers for fast cases because emit() itself often has a variable number of
  11039. // arguments and can be deoptimized because of that. These functions always have
  11040. // the same number of arguments and thus do not get deoptimized, so the code
  11041. // inside them can execute faster.
  11042. function emitNone(handler, isFn, self) {
  11043. if (isFn)
  11044. handler.call(self);
  11045. else {
  11046. var len = handler.length;
  11047. var listeners = arrayClone(handler, len);
  11048. for (var i = 0; i < len; ++i)
  11049. listeners[i].call(self);
  11050. }
  11051. }
  11052. function emitOne(handler, isFn, self, arg1) {
  11053. if (isFn)
  11054. handler.call(self, arg1);
  11055. else {
  11056. var len = handler.length;
  11057. var listeners = arrayClone(handler, len);
  11058. for (var i = 0; i < len; ++i)
  11059. listeners[i].call(self, arg1);
  11060. }
  11061. }
  11062. function emitTwo(handler, isFn, self, arg1, arg2) {
  11063. if (isFn)
  11064. handler.call(self, arg1, arg2);
  11065. else {
  11066. var len = handler.length;
  11067. var listeners = arrayClone(handler, len);
  11068. for (var i = 0; i < len; ++i)
  11069. listeners[i].call(self, arg1, arg2);
  11070. }
  11071. }
  11072. function emitThree(handler, isFn, self, arg1, arg2, arg3) {
  11073. if (isFn)
  11074. handler.call(self, arg1, arg2, arg3);
  11075. else {
  11076. var len = handler.length;
  11077. var listeners = arrayClone(handler, len);
  11078. for (var i = 0; i < len; ++i)
  11079. listeners[i].call(self, arg1, arg2, arg3);
  11080. }
  11081. }
  11082. function emitMany(handler, isFn, self, args) {
  11083. if (isFn)
  11084. handler.apply(self, args);
  11085. else {
  11086. var len = handler.length;
  11087. var listeners = arrayClone(handler, len);
  11088. for (var i = 0; i < len; ++i)
  11089. listeners[i].apply(self, args);
  11090. }
  11091. }
  11092. EventEmitter.prototype.emit = function emit(type) {
  11093. var er, handler, len, args, i, events;
  11094. var doError = (type === 'error');
  11095. events = this._events;
  11096. if (events)
  11097. doError = (doError && events.error == null);
  11098. else if (!doError)
  11099. return false;
  11100. // If there is no 'error' event listener then throw.
  11101. if (doError) {
  11102. if (arguments.length > 1)
  11103. er = arguments[1];
  11104. if (er instanceof Error) {
  11105. throw er; // Unhandled 'error' event
  11106. } else {
  11107. // At least give some kind of context to the user
  11108. var err = new Error('Unhandled "error" event. (' + er + ')');
  11109. err.context = er;
  11110. throw err;
  11111. }
  11112. return false;
  11113. }
  11114. handler = events[type];
  11115. if (!handler)
  11116. return false;
  11117. var isFn = typeof handler === 'function';
  11118. len = arguments.length;
  11119. switch (len) {
  11120. // fast cases
  11121. case 1:
  11122. emitNone(handler, isFn, this);
  11123. break;
  11124. case 2:
  11125. emitOne(handler, isFn, this, arguments[1]);
  11126. break;
  11127. case 3:
  11128. emitTwo(handler, isFn, this, arguments[1], arguments[2]);
  11129. break;
  11130. case 4:
  11131. emitThree(handler, isFn, this, arguments[1], arguments[2], arguments[3]);
  11132. break;
  11133. // slower
  11134. default:
  11135. args = new Array(len - 1);
  11136. for (i = 1; i < len; i++)
  11137. args[i - 1] = arguments[i];
  11138. emitMany(handler, isFn, this, args);
  11139. }
  11140. return true;
  11141. };
  11142. function _addListener(target, type, listener, prepend) {
  11143. var m;
  11144. var events;
  11145. var existing;
  11146. if (typeof listener !== 'function')
  11147. throw new TypeError('"listener" argument must be a function');
  11148. events = target._events;
  11149. if (!events) {
  11150. events = target._events = objectCreate(null);
  11151. target._eventsCount = 0;
  11152. } else {
  11153. // To avoid recursion in the case that type === "newListener"! Before
  11154. // adding it to the listeners, first emit "newListener".
  11155. if (events.newListener) {
  11156. target.emit('newListener', type,
  11157. listener.listener ? listener.listener : listener);
  11158. // Re-assign `events` because a newListener handler could have caused the
  11159. // this._events to be assigned to a new object
  11160. events = target._events;
  11161. }
  11162. existing = events[type];
  11163. }
  11164. if (!existing) {
  11165. // Optimize the case of one listener. Don't need the extra array object.
  11166. existing = events[type] = listener;
  11167. ++target._eventsCount;
  11168. } else {
  11169. if (typeof existing === 'function') {
  11170. // Adding the second element, need to change to array.
  11171. existing = events[type] =
  11172. prepend ? [listener, existing] : [existing, listener];
  11173. } else {
  11174. // If we've already got an array, just append.
  11175. if (prepend) {
  11176. existing.unshift(listener);
  11177. } else {
  11178. existing.push(listener);
  11179. }
  11180. }
  11181. // Check for listener leak
  11182. if (!existing.warned) {
  11183. m = $getMaxListeners(target);
  11184. if (m && m > 0 && existing.length > m) {
  11185. existing.warned = true;
  11186. var w = new Error('Possible EventEmitter memory leak detected. ' +
  11187. existing.length + ' "' + String(type) + '" listeners ' +
  11188. 'added. Use emitter.setMaxListeners() to ' +
  11189. 'increase limit.');
  11190. w.name = 'MaxListenersExceededWarning';
  11191. w.emitter = target;
  11192. w.type = type;
  11193. w.count = existing.length;
  11194. if (typeof console === 'object' && console.warn) {
  11195. console.warn('%s: %s', w.name, w.message);
  11196. }
  11197. }
  11198. }
  11199. }
  11200. return target;
  11201. }
  11202. EventEmitter.prototype.addListener = function addListener(type, listener) {
  11203. return _addListener(this, type, listener, false);
  11204. };
  11205. EventEmitter.prototype.on = EventEmitter.prototype.addListener;
  11206. EventEmitter.prototype.prependListener =
  11207. function prependListener(type, listener) {
  11208. return _addListener(this, type, listener, true);
  11209. };
  11210. function onceWrapper() {
  11211. if (!this.fired) {
  11212. this.target.removeListener(this.type, this.wrapFn);
  11213. this.fired = true;
  11214. switch (arguments.length) {
  11215. case 0:
  11216. return this.listener.call(this.target);
  11217. case 1:
  11218. return this.listener.call(this.target, arguments[0]);
  11219. case 2:
  11220. return this.listener.call(this.target, arguments[0], arguments[1]);
  11221. case 3:
  11222. return this.listener.call(this.target, arguments[0], arguments[1],
  11223. arguments[2]);
  11224. default:
  11225. var args = new Array(arguments.length);
  11226. for (var i = 0; i < args.length; ++i)
  11227. args[i] = arguments[i];
  11228. this.listener.apply(this.target, args);
  11229. }
  11230. }
  11231. }
  11232. function _onceWrap(target, type, listener) {
  11233. var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
  11234. var wrapped = bind.call(onceWrapper, state);
  11235. wrapped.listener = listener;
  11236. state.wrapFn = wrapped;
  11237. return wrapped;
  11238. }
  11239. EventEmitter.prototype.once = function once(type, listener) {
  11240. if (typeof listener !== 'function')
  11241. throw new TypeError('"listener" argument must be a function');
  11242. this.on(type, _onceWrap(this, type, listener));
  11243. return this;
  11244. };
  11245. EventEmitter.prototype.prependOnceListener =
  11246. function prependOnceListener(type, listener) {
  11247. if (typeof listener !== 'function')
  11248. throw new TypeError('"listener" argument must be a function');
  11249. this.prependListener(type, _onceWrap(this, type, listener));
  11250. return this;
  11251. };
  11252. // Emits a 'removeListener' event if and only if the listener was removed.
  11253. EventEmitter.prototype.removeListener =
  11254. function removeListener(type, listener) {
  11255. var list, events, position, i, originalListener;
  11256. if (typeof listener !== 'function')
  11257. throw new TypeError('"listener" argument must be a function');
  11258. events = this._events;
  11259. if (!events)
  11260. return this;
  11261. list = events[type];
  11262. if (!list)
  11263. return this;
  11264. if (list === listener || list.listener === listener) {
  11265. if (--this._eventsCount === 0)
  11266. this._events = objectCreate(null);
  11267. else {
  11268. delete events[type];
  11269. if (events.removeListener)
  11270. this.emit('removeListener', type, list.listener || listener);
  11271. }
  11272. } else if (typeof list !== 'function') {
  11273. position = -1;
  11274. for (i = list.length - 1; i >= 0; i--) {
  11275. if (list[i] === listener || list[i].listener === listener) {
  11276. originalListener = list[i].listener;
  11277. position = i;
  11278. break;
  11279. }
  11280. }
  11281. if (position < 0)
  11282. return this;
  11283. if (position === 0)
  11284. list.shift();
  11285. else
  11286. spliceOne(list, position);
  11287. if (list.length === 1)
  11288. events[type] = list[0];
  11289. if (events.removeListener)
  11290. this.emit('removeListener', type, originalListener || listener);
  11291. }
  11292. return this;
  11293. };
  11294. EventEmitter.prototype.removeAllListeners =
  11295. function removeAllListeners(type) {
  11296. var listeners, events, i;
  11297. events = this._events;
  11298. if (!events)
  11299. return this;
  11300. // not listening for removeListener, no need to emit
  11301. if (!events.removeListener) {
  11302. if (arguments.length === 0) {
  11303. this._events = objectCreate(null);
  11304. this._eventsCount = 0;
  11305. } else if (events[type]) {
  11306. if (--this._eventsCount === 0)
  11307. this._events = objectCreate(null);
  11308. else
  11309. delete events[type];
  11310. }
  11311. return this;
  11312. }
  11313. // emit removeListener for all listeners on all events
  11314. if (arguments.length === 0) {
  11315. var keys = objectKeys(events);
  11316. var key;
  11317. for (i = 0; i < keys.length; ++i) {
  11318. key = keys[i];
  11319. if (key === 'removeListener') continue;
  11320. this.removeAllListeners(key);
  11321. }
  11322. this.removeAllListeners('removeListener');
  11323. this._events = objectCreate(null);
  11324. this._eventsCount = 0;
  11325. return this;
  11326. }
  11327. listeners = events[type];
  11328. if (typeof listeners === 'function') {
  11329. this.removeListener(type, listeners);
  11330. } else if (listeners) {
  11331. // LIFO order
  11332. for (i = listeners.length - 1; i >= 0; i--) {
  11333. this.removeListener(type, listeners[i]);
  11334. }
  11335. }
  11336. return this;
  11337. };
  11338. function _listeners(target, type, unwrap) {
  11339. var events = target._events;
  11340. if (!events)
  11341. return [];
  11342. var evlistener = events[type];
  11343. if (!evlistener)
  11344. return [];
  11345. if (typeof evlistener === 'function')
  11346. return unwrap ? [evlistener.listener || evlistener] : [evlistener];
  11347. return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
  11348. }
  11349. EventEmitter.prototype.listeners = function listeners(type) {
  11350. return _listeners(this, type, true);
  11351. };
  11352. EventEmitter.prototype.rawListeners = function rawListeners(type) {
  11353. return _listeners(this, type, false);
  11354. };
  11355. EventEmitter.listenerCount = function(emitter, type) {
  11356. if (typeof emitter.listenerCount === 'function') {
  11357. return emitter.listenerCount(type);
  11358. } else {
  11359. return listenerCount.call(emitter, type);
  11360. }
  11361. };
  11362. EventEmitter.prototype.listenerCount = listenerCount;
  11363. function listenerCount(type) {
  11364. var events = this._events;
  11365. if (events) {
  11366. var evlistener = events[type];
  11367. if (typeof evlistener === 'function') {
  11368. return 1;
  11369. } else if (evlistener) {
  11370. return evlistener.length;
  11371. }
  11372. }
  11373. return 0;
  11374. }
  11375. EventEmitter.prototype.eventNames = function eventNames() {
  11376. return this._eventsCount > 0 ? Reflect.ownKeys(this._events) : [];
  11377. };
  11378. // About 1.5x faster than the two-arg version of Array#splice().
  11379. function spliceOne(list, index) {
  11380. for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1)
  11381. list[i] = list[k];
  11382. list.pop();
  11383. }
  11384. function arrayClone(arr, n) {
  11385. var copy = new Array(n);
  11386. for (var i = 0; i < n; ++i)
  11387. copy[i] = arr[i];
  11388. return copy;
  11389. }
  11390. function unwrapListeners(arr) {
  11391. var ret = new Array(arr.length);
  11392. for (var i = 0; i < ret.length; ++i) {
  11393. ret[i] = arr[i].listener || arr[i];
  11394. }
  11395. return ret;
  11396. }
  11397. function objectCreatePolyfill(proto) {
  11398. var F = function() {};
  11399. F.prototype = proto;
  11400. return new F;
  11401. }
  11402. function objectKeysPolyfill(obj) {
  11403. var keys = [];
  11404. for (var k in obj) if (Object.prototype.hasOwnProperty.call(obj, k)) {
  11405. keys.push(k);
  11406. }
  11407. return k;
  11408. }
  11409. function functionBindPolyfill(context) {
  11410. var fn = this;
  11411. return function () {
  11412. return fn.apply(context, arguments);
  11413. };
  11414. }
  11415. },{}],51:[function(require,module,exports){
  11416. 'use strict';
  11417. /* eslint no-invalid-this: 1 */
  11418. var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
  11419. var slice = Array.prototype.slice;
  11420. var toStr = Object.prototype.toString;
  11421. var funcType = '[object Function]';
  11422. module.exports = function bind(that) {
  11423. var target = this;
  11424. if (typeof target !== 'function' || toStr.call(target) !== funcType) {
  11425. throw new TypeError(ERROR_MESSAGE + target);
  11426. }
  11427. var args = slice.call(arguments, 1);
  11428. var bound;
  11429. var binder = function () {
  11430. if (this instanceof bound) {
  11431. var result = target.apply(
  11432. this,
  11433. args.concat(slice.call(arguments))
  11434. );
  11435. if (Object(result) === result) {
  11436. return result;
  11437. }
  11438. return this;
  11439. } else {
  11440. return target.apply(
  11441. that,
  11442. args.concat(slice.call(arguments))
  11443. );
  11444. }
  11445. };
  11446. var boundLength = Math.max(0, target.length - args.length);
  11447. var boundArgs = [];
  11448. for (var i = 0; i < boundLength; i++) {
  11449. boundArgs.push('$' + i);
  11450. }
  11451. bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
  11452. if (target.prototype) {
  11453. var Empty = function Empty() {};
  11454. Empty.prototype = target.prototype;
  11455. bound.prototype = new Empty();
  11456. Empty.prototype = null;
  11457. }
  11458. return bound;
  11459. };
  11460. },{}],52:[function(require,module,exports){
  11461. 'use strict';
  11462. var implementation = require('./implementation');
  11463. module.exports = Function.prototype.bind || implementation;
  11464. },{"./implementation":51}],53:[function(require,module,exports){
  11465. 'use strict';
  11466. /* eslint complexity: [2, 17], max-statements: [2, 33] */
  11467. module.exports = function hasSymbols() {
  11468. if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
  11469. if (typeof Symbol.iterator === 'symbol') { return true; }
  11470. var obj = {};
  11471. var sym = Symbol('test');
  11472. var symObj = Object(sym);
  11473. if (typeof sym === 'string') { return false; }
  11474. if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
  11475. if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
  11476. // temp disabled per https://github.com/ljharb/object.assign/issues/17
  11477. // if (sym instanceof Symbol) { return false; }
  11478. // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
  11479. // if (!(symObj instanceof Symbol)) { return false; }
  11480. // if (typeof Symbol.prototype.toString !== 'function') { return false; }
  11481. // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
  11482. var symVal = 42;
  11483. obj[sym] = symVal;
  11484. for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax
  11485. if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
  11486. if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
  11487. var syms = Object.getOwnPropertySymbols(obj);
  11488. if (syms.length !== 1 || syms[0] !== sym) { return false; }
  11489. if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
  11490. if (typeof Object.getOwnPropertyDescriptor === 'function') {
  11491. var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
  11492. if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
  11493. }
  11494. return true;
  11495. };
  11496. },{}],54:[function(require,module,exports){
  11497. (function (global){
  11498. /*! https://mths.be/he v1.2.0 by @mathias | MIT license */
  11499. ;(function(root) {
  11500. // Detect free variables `exports`.
  11501. var freeExports = typeof exports == 'object' && exports;
  11502. // Detect free variable `module`.
  11503. var freeModule = typeof module == 'object' && module &&
  11504. module.exports == freeExports && module;
  11505. // Detect free variable `global`, from Node.js or Browserified code,
  11506. // and use it as `root`.
  11507. var freeGlobal = typeof global == 'object' && global;
  11508. if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
  11509. root = freeGlobal;
  11510. }
  11511. /*--------------------------------------------------------------------------*/
  11512. // All astral symbols.
  11513. var regexAstralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
  11514. // All ASCII symbols (not just printable ASCII) except those listed in the
  11515. // first column of the overrides table.
  11516. // https://html.spec.whatwg.org/multipage/syntax.html#table-charref-overrides
  11517. var regexAsciiWhitelist = /[\x01-\x7F]/g;
  11518. // All BMP symbols that are not ASCII newlines, printable ASCII symbols, or
  11519. // code points listed in the first column of the overrides table on
  11520. // https://html.spec.whatwg.org/multipage/syntax.html#table-charref-overrides.
  11521. var regexBmpWhitelist = /[\x01-\t\x0B\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g;
  11522. var regexEncodeNonAscii = /<\u20D2|=\u20E5|>\u20D2|\u205F\u200A|\u219D\u0338|\u2202\u0338|\u2220\u20D2|\u2229\uFE00|\u222A\uFE00|\u223C\u20D2|\u223D\u0331|\u223E\u0333|\u2242\u0338|\u224B\u0338|\u224D\u20D2|\u224E\u0338|\u224F\u0338|\u2250\u0338|\u2261\u20E5|\u2264\u20D2|\u2265\u20D2|\u2266\u0338|\u2267\u0338|\u2268\uFE00|\u2269\uFE00|\u226A\u0338|\u226A\u20D2|\u226B\u0338|\u226B\u20D2|\u227F\u0338|\u2282\u20D2|\u2283\u20D2|\u228A\uFE00|\u228B\uFE00|\u228F\u0338|\u2290\u0338|\u2293\uFE00|\u2294\uFE00|\u22B4\u20D2|\u22B5\u20D2|\u22D8\u0338|\u22D9\u0338|\u22DA\uFE00|\u22DB\uFE00|\u22F5\u0338|\u22F9\u0338|\u2933\u0338|\u29CF\u0338|\u29D0\u0338|\u2A6D\u0338|\u2A70\u0338|\u2A7D\u0338|\u2A7E\u0338|\u2AA1\u0338|\u2AA2\u0338|\u2AAC\uFE00|\u2AAD\uFE00|\u2AAF\u0338|\u2AB0\u0338|\u2AC5\u0338|\u2AC6\u0338|\u2ACB\uFE00|\u2ACC\uFE00|\u2AFD\u20E5|[\xA0-\u0113\u0116-\u0122\u0124-\u012B\u012E-\u014D\u0150-\u017E\u0192\u01B5\u01F5\u0237\u02C6\u02C7\u02D8-\u02DD\u0311\u0391-\u03A1\u03A3-\u03A9\u03B1-\u03C9\u03D1\u03D2\u03D5\u03D6\u03DC\u03DD\u03F0\u03F1\u03F5\u03F6\u0401-\u040C\u040E-\u044F\u0451-\u045C\u045E\u045F\u2002-\u2005\u2007-\u2010\u2013-\u2016\u2018-\u201A\u201C-\u201E\u2020-\u2022\u2025\u2026\u2030-\u2035\u2039\u203A\u203E\u2041\u2043\u2044\u204F\u2057\u205F-\u2063\u20AC\u20DB\u20DC\u2102\u2105\u210A-\u2113\u2115-\u211E\u2122\u2124\u2127-\u2129\u212C\u212D\u212F-\u2131\u2133-\u2138\u2145-\u2148\u2153-\u215E\u2190-\u219B\u219D-\u21A7\u21A9-\u21AE\u21B0-\u21B3\u21B5-\u21B7\u21BA-\u21DB\u21DD\u21E4\u21E5\u21F5\u21FD-\u2205\u2207-\u2209\u220B\u220C\u220F-\u2214\u2216-\u2218\u221A\u221D-\u2238\u223A-\u2257\u2259\u225A\u225C\u225F-\u2262\u2264-\u228B\u228D-\u229B\u229D-\u22A5\u22A7-\u22B0\u22B2-\u22BB\u22BD-\u22DB\u22DE-\u22E3\u22E6-\u22F7\u22F9-\u22FE\u2305\u2306\u2308-\u2310\u2312\u2313\u2315\u2316\u231C-\u231F\u2322\u2323\u232D\u232E\u2336\u233D\u233F\u237C\u23B0\u23B1\u23B4-\u23B6\u23DC-\u23DF\u23E2\u23E7\u2423\u24C8\u2500\u2502\u250C\u2510\u2514\u2518\u251C\u2524\u252C\u2534\u253C\u2550-\u256C\u2580\u2584\u2588\u2591-\u2593\u25A1\u25AA\u25AB\u25AD\u25AE\u25B1\u25B3-\u25B5\u25B8\u25B9\u25BD-\u25BF\u25C2\u25C3\u25CA\u25CB\u25EC\u25EF\u25F8-\u25FC\u2605\u2606\u260E\u2640\u2642\u2660\u2663\u2665\u2666\u266A\u266D-\u266F\u2713\u2717\u2720\u2736\u2758\u2772\u2773\u27C8\u27C9\u27E6-\u27ED\u27F5-\u27FA\u27FC\u27FF\u2902-\u2905\u290C-\u2913\u2916\u2919-\u2920\u2923-\u292A\u2933\u2935-\u2939\u293C\u293D\u2945\u2948-\u294B\u294E-\u2976\u2978\u2979\u297B-\u297F\u2985\u2986\u298B-\u2996\u299A\u299C\u299D\u29A4-\u29B7\u29B9\u29BB\u29BC\u29BE-\u29C5\u29C9\u29CD-\u29D0\u29DC-\u29DE\u29E3-\u29E5\u29EB\u29F4\u29F6\u2A00-\u2A02\u2A04\u2A06\u2A0C\u2A0D\u2A10-\u2A17\u2A22-\u2A27\u2A29\u2A2A\u2A2D-\u2A31\u2A33-\u2A3C\u2A3F\u2A40\u2A42-\u2A4D\u2A50\u2A53-\u2A58\u2A5A-\u2A5D\u2A5F\u2A66\u2A6A\u2A6D-\u2A75\u2A77-\u2A9A\u2A9D-\u2AA2\u2AA4-\u2AB0\u2AB3-\u2AC8\u2ACB\u2ACC\u2ACF-\u2ADB\u2AE4\u2AE6-\u2AE9\u2AEB-\u2AF3\u2AFD\uFB00-\uFB04]|\uD835[\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDCCF\uDD04\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDD6B]/g;
  11523. var encodeMap = {'\xAD':'shy','\u200C':'zwnj','\u200D':'zwj','\u200E':'lrm','\u2063':'ic','\u2062':'it','\u2061':'af','\u200F':'rlm','\u200B':'ZeroWidthSpace','\u2060':'NoBreak','\u0311':'DownBreve','\u20DB':'tdot','\u20DC':'DotDot','\t':'Tab','\n':'NewLine','\u2008':'puncsp','\u205F':'MediumSpace','\u2009':'thinsp','\u200A':'hairsp','\u2004':'emsp13','\u2002':'ensp','\u2005':'emsp14','\u2003':'emsp','\u2007':'numsp','\xA0':'nbsp','\u205F\u200A':'ThickSpace','\u203E':'oline','_':'lowbar','\u2010':'dash','\u2013':'ndash','\u2014':'mdash','\u2015':'horbar',',':'comma',';':'semi','\u204F':'bsemi',':':'colon','\u2A74':'Colone','!':'excl','\xA1':'iexcl','?':'quest','\xBF':'iquest','.':'period','\u2025':'nldr','\u2026':'mldr','\xB7':'middot','\'':'apos','\u2018':'lsquo','\u2019':'rsquo','\u201A':'sbquo','\u2039':'lsaquo','\u203A':'rsaquo','"':'quot','\u201C':'ldquo','\u201D':'rdquo','\u201E':'bdquo','\xAB':'laquo','\xBB':'raquo','(':'lpar',')':'rpar','[':'lsqb',']':'rsqb','{':'lcub','}':'rcub','\u2308':'lceil','\u2309':'rceil','\u230A':'lfloor','\u230B':'rfloor','\u2985':'lopar','\u2986':'ropar','\u298B':'lbrke','\u298C':'rbrke','\u298D':'lbrkslu','\u298E':'rbrksld','\u298F':'lbrksld','\u2990':'rbrkslu','\u2991':'langd','\u2992':'rangd','\u2993':'lparlt','\u2994':'rpargt','\u2995':'gtlPar','\u2996':'ltrPar','\u27E6':'lobrk','\u27E7':'robrk','\u27E8':'lang','\u27E9':'rang','\u27EA':'Lang','\u27EB':'Rang','\u27EC':'loang','\u27ED':'roang','\u2772':'lbbrk','\u2773':'rbbrk','\u2016':'Vert','\xA7':'sect','\xB6':'para','@':'commat','*':'ast','/':'sol','undefined':null,'&':'amp','#':'num','%':'percnt','\u2030':'permil','\u2031':'pertenk','\u2020':'dagger','\u2021':'Dagger','\u2022':'bull','\u2043':'hybull','\u2032':'prime','\u2033':'Prime','\u2034':'tprime','\u2057':'qprime','\u2035':'bprime','\u2041':'caret','`':'grave','\xB4':'acute','\u02DC':'tilde','^':'Hat','\xAF':'macr','\u02D8':'breve','\u02D9':'dot','\xA8':'die','\u02DA':'ring','\u02DD':'dblac','\xB8':'cedil','\u02DB':'ogon','\u02C6':'circ','\u02C7':'caron','\xB0':'deg','\xA9':'copy','\xAE':'reg','\u2117':'copysr','\u2118':'wp','\u211E':'rx','\u2127':'mho','\u2129':'iiota','\u2190':'larr','\u219A':'nlarr','\u2192':'rarr','\u219B':'nrarr','\u2191':'uarr','\u2193':'darr','\u2194':'harr','\u21AE':'nharr','\u2195':'varr','\u2196':'nwarr','\u2197':'nearr','\u2198':'searr','\u2199':'swarr','\u219D':'rarrw','\u219D\u0338':'nrarrw','\u219E':'Larr','\u219F':'Uarr','\u21A0':'Rarr','\u21A1':'Darr','\u21A2':'larrtl','\u21A3':'rarrtl','\u21A4':'mapstoleft','\u21A5':'mapstoup','\u21A6':'map','\u21A7':'mapstodown','\u21A9':'larrhk','\u21AA':'rarrhk','\u21AB':'larrlp','\u21AC':'rarrlp','\u21AD':'harrw','\u21B0':'lsh','\u21B1':'rsh','\u21B2':'ldsh','\u21B3':'rdsh','\u21B5':'crarr','\u21B6':'cularr','\u21B7':'curarr','\u21BA':'olarr','\u21BB':'orarr','\u21BC':'lharu','\u21BD':'lhard','\u21BE':'uharr','\u21BF':'uharl','\u21C0':'rharu','\u21C1':'rhard','\u21C2':'dharr','\u21C3':'dharl','\u21C4':'rlarr','\u21C5':'udarr','\u21C6':'lrarr','\u21C7':'llarr','\u21C8':'uuarr','\u21C9':'rrarr','\u21CA':'ddarr','\u21CB':'lrhar','\u21CC':'rlhar','\u21D0':'lArr','\u21CD':'nlArr','\u21D1':'uArr','\u21D2':'rArr','\u21CF':'nrArr','\u21D3':'dArr','\u21D4':'iff','\u21CE':'nhArr','\u21D5':'vArr','\u21D6':'nwArr','\u21D7':'neArr','\u21D8':'seArr','\u21D9':'swArr','\u21DA':'lAarr','\u21DB':'rAarr','\u21DD':'zigrarr','\u21E4':'larrb','\u21E5':'rarrb','\u21F5':'duarr','\u21FD':'loarr','\u21FE':'roarr','\u21FF':'hoarr','\u2200':'forall','\u2201':'comp','\u2202':'part','\u2202\u0338':'npart','\u2203':'exist','\u2204':'nexist','\u2205':'empty','\u2207':'Del','\u2208':'in','\u2209':'notin','\u220B':'ni','\u220C':'notni','\u03F6':'bepsi','\u220F':'prod','\u2210':'coprod','\u2211':'sum','+':'plus','\xB1':'pm','\xF7':'div','\xD7':'times','<':'lt','\u226E':'nlt','<\u20D2':'nvlt','=':'equals','\u2260':'ne','=\u20E5':'bne','\u2A75':'Equal','>':'gt','\u226F':'ngt','>\u20D2':'nvgt','\xAC':'not','|':'vert','\xA6':'brvbar','\u2212':'minus','\u2213':'mp','\u2214':'plusdo','\u2044':'frasl','\u2216':'setmn','\u2217':'lowast','\u2218':'compfn','\u221A':'Sqrt','\u221D':'prop','\u221E':'infin','\u221F':'angrt','\u2220':'ang','\u2220\u20D2':'nang','\u2221':'angmsd','\u2222':'angsph','\u2223':'mid','\u2224':'nmid','\u2225':'par','\u2226':'npar','\u2227':'and','\u2228':'or','\u2229':'cap','\u2229\uFE00':'caps','\u222A':'cup','\u222A\uFE00':'cups','\u222B':'int','\u222C':'Int','\u222D':'tint','\u2A0C':'qint','\u222E':'oint','\u222F':'Conint','\u2230':'Cconint','\u2231':'cwint','\u2232':'cwconint','\u2233':'awconint','\u2234':'there4','\u2235':'becaus','\u2236':'ratio','\u2237':'Colon','\u2238':'minusd','\u223A':'mDDot','\u223B':'homtht','\u223C':'sim','\u2241':'nsim','\u223C\u20D2':'nvsim','\u223D':'bsim','\u223D\u0331':'race','\u223E':'ac','\u223E\u0333':'acE','\u223F':'acd','\u2240':'wr','\u2242':'esim','\u2242\u0338':'nesim','\u2243':'sime','\u2244':'nsime','\u2245':'cong','\u2247':'ncong','\u2246':'simne','\u2248':'ap','\u2249':'nap','\u224A':'ape','\u224B':'apid','\u224B\u0338':'napid','\u224C':'bcong','\u224D':'CupCap','\u226D':'NotCupCap','\u224D\u20D2':'nvap','\u224E':'bump','\u224E\u0338':'nbump','\u224F':'bumpe','\u224F\u0338':'nbumpe','\u2250':'doteq','\u2250\u0338':'nedot','\u2251':'eDot','\u2252':'efDot','\u2253':'erDot','\u2254':'colone','\u2255':'ecolon','\u2256':'ecir','\u2257':'cire','\u2259':'wedgeq','\u225A':'veeeq','\u225C':'trie','\u225F':'equest','\u2261':'equiv','\u2262':'nequiv','\u2261\u20E5':'bnequiv','\u2264':'le','\u2270':'nle','\u2264\u20D2':'nvle','\u2265':'ge','\u2271':'nge','\u2265\u20D2':'nvge','\u2266':'lE','\u2266\u0338':'nlE','\u2267':'gE','\u2267\u0338':'ngE','\u2268\uFE00':'lvnE','\u2268':'lnE','\u2269':'gnE','\u2269\uFE00':'gvnE','\u226A':'ll','\u226A\u0338':'nLtv','\u226A\u20D2':'nLt','\u226B':'gg','\u226B\u0338':'nGtv','\u226B\u20D2':'nGt','\u226C':'twixt','\u2272':'lsim','\u2274':'nlsim','\u2273':'gsim','\u2275':'ngsim','\u2276':'lg','\u2278':'ntlg','\u2277':'gl','\u2279':'ntgl','\u227A':'pr','\u2280':'npr','\u227B':'sc','\u2281':'nsc','\u227C':'prcue','\u22E0':'nprcue','\u227D':'sccue','\u22E1':'nsccue','\u227E':'prsim','\u227F':'scsim','\u227F\u0338':'NotSucceedsTilde','\u2282':'sub','\u2284':'nsub','\u2282\u20D2':'vnsub','\u2283':'sup','\u2285':'nsup','\u2283\u20D2':'vnsup','\u2286':'sube','\u2288':'nsube','\u2287':'supe','\u2289':'nsupe','\u228A\uFE00':'vsubne','\u228A':'subne','\u228B\uFE00':'vsupne','\u228B':'supne','\u228D':'cupdot','\u228E':'uplus','\u228F':'sqsub','\u228F\u0338':'NotSquareSubset','\u2290':'sqsup','\u2290\u0338':'NotSquareSuperset','\u2291':'sqsube','\u22E2':'nsqsube','\u2292':'sqsupe','\u22E3':'nsqsupe','\u2293':'sqcap','\u2293\uFE00':'sqcaps','\u2294':'sqcup','\u2294\uFE00':'sqcups','\u2295':'oplus','\u2296':'ominus','\u2297':'otimes','\u2298':'osol','\u2299':'odot','\u229A':'ocir','\u229B':'oast','\u229D':'odash','\u229E':'plusb','\u229F':'minusb','\u22A0':'timesb','\u22A1':'sdotb','\u22A2':'vdash','\u22AC':'nvdash','\u22A3':'dashv','\u22A4':'top','\u22A5':'bot','\u22A7':'models','\u22A8':'vDash','\u22AD':'nvDash','\u22A9':'Vdash','\u22AE':'nVdash','\u22AA':'Vvdash','\u22AB':'VDash','\u22AF':'nVDash','\u22B0':'prurel','\u22B2':'vltri','\u22EA':'nltri','\u22B3':'vrtri','\u22EB':'nrtri','\u22B4':'ltrie','\u22EC':'nltrie','\u22B4\u20D2':'nvltrie','\u22B5':'rtrie','\u22ED':'nrtrie','\u22B5\u20D2':'nvrtrie','\u22B6':'origof','\u22B7':'imof','\u22B8':'mumap','\u22B9':'hercon','\u22BA':'intcal','\u22BB':'veebar','\u22BD':'barvee','\u22BE':'angrtvb','\u22BF':'lrtri','\u22C0':'Wedge','\u22C1':'Vee','\u22C2':'xcap','\u22C3':'xcup','\u22C4':'diam','\u22C5':'sdot','\u22C6':'Star','\u22C7':'divonx','\u22C8':'bowtie','\u22C9':'ltimes','\u22CA':'rtimes','\u22CB':'lthree','\u22CC':'rthree','\u22CD':'bsime','\u22CE':'cuvee','\u22CF':'cuwed','\u22D0':'Sub','\u22D1':'Sup','\u22D2':'Cap','\u22D3':'Cup','\u22D4':'fork','\u22D5':'epar','\u22D6':'ltdot','\u22D7':'gtdot','\u22D8':'Ll','\u22D8\u0338':'nLl','\u22D9':'Gg','\u22D9\u0338':'nGg','\u22DA\uFE00':'lesg','\u22DA':'leg','\u22DB':'gel','\u22DB\uFE00':'gesl','\u22DE':'cuepr','\u22DF':'cuesc','\u22E6':'lnsim','\u22E7':'gnsim','\u22E8':'prnsim','\u22E9':'scnsim','\u22EE':'vellip','\u22EF':'ctdot','\u22F0':'utdot','\u22F1':'dtdot','\u22F2':'disin','\u22F3':'isinsv','\u22F4':'isins','\u22F5':'isindot','\u22F5\u0338':'notindot','\u22F6':'notinvc','\u22F7':'notinvb','\u22F9':'isinE','\u22F9\u0338':'notinE','\u22FA':'nisd','\u22FB':'xnis','\u22FC':'nis','\u22FD':'notnivc','\u22FE':'notnivb','\u2305':'barwed','\u2306':'Barwed','\u230C':'drcrop','\u230D':'dlcrop','\u230E':'urcrop','\u230F':'ulcrop','\u2310':'bnot','\u2312':'profline','\u2313':'profsurf','\u2315':'telrec','\u2316':'target','\u231C':'ulcorn','\u231D':'urcorn','\u231E':'dlcorn','\u231F':'drcorn','\u2322':'frown','\u2323':'smile','\u232D':'cylcty','\u232E':'profalar','\u2336':'topbot','\u233D':'ovbar','\u233F':'solbar','\u237C':'angzarr','\u23B0':'lmoust','\u23B1':'rmoust','\u23B4':'tbrk','\u23B5':'bbrk','\u23B6':'bbrktbrk','\u23DC':'OverParenthesis','\u23DD':'UnderParenthesis','\u23DE':'OverBrace','\u23DF':'UnderBrace','\u23E2':'trpezium','\u23E7':'elinters','\u2423':'blank','\u2500':'boxh','\u2502':'boxv','\u250C':'boxdr','\u2510':'boxdl','\u2514':'boxur','\u2518':'boxul','\u251C':'boxvr','\u2524':'boxvl','\u252C':'boxhd','\u2534':'boxhu','\u253C':'boxvh','\u2550':'boxH','\u2551':'boxV','\u2552':'boxdR','\u2553':'boxDr','\u2554':'boxDR','\u2555':'boxdL','\u2556':'boxDl','\u2557':'boxDL','\u2558':'boxuR','\u2559':'boxUr','\u255A':'boxUR','\u255B':'boxuL','\u255C':'boxUl','\u255D':'boxUL','\u255E':'boxvR','\u255F':'boxVr','\u2560':'boxVR','\u2561':'boxvL','\u2562':'boxVl','\u2563':'boxVL','\u2564':'boxHd','\u2565':'boxhD','\u2566':'boxHD','\u2567':'boxHu','\u2568':'boxhU','\u2569':'boxHU','\u256A':'boxvH','\u256B':'boxVh','\u256C':'boxVH','\u2580':'uhblk','\u2584':'lhblk','\u2588':'block','\u2591':'blk14','\u2592':'blk12','\u2593':'blk34','\u25A1':'squ','\u25AA':'squf','\u25AB':'EmptyVerySmallSquare','\u25AD':'rect','\u25AE':'marker','\u25B1':'fltns','\u25B3':'xutri','\u25B4':'utrif','\u25B5':'utri','\u25B8':'rtrif','\u25B9':'rtri','\u25BD':'xdtri','\u25BE':'dtrif','\u25BF':'dtri','\u25C2':'ltrif','\u25C3':'ltri','\u25CA':'loz','\u25CB':'cir','\u25EC':'tridot','\u25EF':'xcirc','\u25F8':'ultri','\u25F9':'urtri','\u25FA':'lltri','\u25FB':'EmptySmallSquare','\u25FC':'FilledSmallSquare','\u2605':'starf','\u2606':'star','\u260E':'phone','\u2640':'female','\u2642':'male','\u2660':'spades','\u2663':'clubs','\u2665':'hearts','\u2666':'diams','\u266A':'sung','\u2713':'check','\u2717':'cross','\u2720':'malt','\u2736':'sext','\u2758':'VerticalSeparator','\u27C8':'bsolhsub','\u27C9':'suphsol','\u27F5':'xlarr','\u27F6':'xrarr','\u27F7':'xharr','\u27F8':'xlArr','\u27F9':'xrArr','\u27FA':'xhArr','\u27FC':'xmap','\u27FF':'dzigrarr','\u2902':'nvlArr','\u2903':'nvrArr','\u2904':'nvHarr','\u2905':'Map','\u290C':'lbarr','\u290D':'rbarr','\u290E':'lBarr','\u290F':'rBarr','\u2910':'RBarr','\u2911':'DDotrahd','\u2912':'UpArrowBar','\u2913':'DownArrowBar','\u2916':'Rarrtl','\u2919':'latail','\u291A':'ratail','\u291B':'lAtail','\u291C':'rAtail','\u291D':'larrfs','\u291E':'rarrfs','\u291F':'larrbfs','\u2920':'rarrbfs','\u2923':'nwarhk','\u2924':'nearhk','\u2925':'searhk','\u2926':'swarhk','\u2927':'nwnear','\u2928':'toea','\u2929':'tosa','\u292A':'swnwar','\u2933':'rarrc','\u2933\u0338':'nrarrc','\u2935':'cudarrr','\u2936':'ldca','\u2937':'rdca','\u2938':'cudarrl','\u2939':'larrpl','\u293C':'curarrm','\u293D':'cularrp','\u2945':'rarrpl','\u2948':'harrcir','\u2949':'Uarrocir','\u294A':'lurdshar','\u294B':'ldrushar','\u294E':'LeftRightVector','\u294F':'RightUpDownVector','\u2950':'DownLeftRightVector','\u2951':'LeftUpDownVector','\u2952':'LeftVectorBar','\u2953':'RightVectorBar','\u2954':'RightUpVectorBar','\u2955':'RightDownVectorBar','\u2956':'DownLeftVectorBar','\u2957':'DownRightVectorBar','\u2958':'LeftUpVectorBar','\u2959':'LeftDownVectorBar','\u295A':'LeftTeeVector','\u295B':'RightTeeVector','\u295C':'RightUpTeeVector','\u295D':'RightDownTeeVector','\u295E':'DownLeftTeeVector','\u295F':'DownRightTeeVector','\u2960':'LeftUpTeeVector','\u2961':'LeftDownTeeVector','\u2962':'lHar','\u2963':'uHar','\u2964':'rHar','\u2965':'dHar','\u2966':'luruhar','\u2967':'ldrdhar','\u2968':'ruluhar','\u2969':'rdldhar','\u296A':'lharul','\u296B':'llhard','\u296C':'rharul','\u296D':'lrhard','\u296E':'udhar','\u296F':'duhar','\u2970':'RoundImplies','\u2971':'erarr','\u2972':'simrarr','\u2973':'larrsim','\u2974':'rarrsim','\u2975':'rarrap','\u2976':'ltlarr','\u2978':'gtrarr','\u2979':'subrarr','\u297B':'suplarr','\u297C':'lfisht','\u297D':'rfisht','\u297E':'ufisht','\u297F':'dfisht','\u299A':'vzigzag','\u299C':'vangrt','\u299D':'angrtvbd','\u29A4':'ange','\u29A5':'range','\u29A6':'dwangle','\u29A7':'uwangle','\u29A8':'angmsdaa','\u29A9':'angmsdab','\u29AA':'angmsdac','\u29AB':'angmsdad','\u29AC':'angmsdae','\u29AD':'angmsdaf','\u29AE':'angmsdag','\u29AF':'angmsdah','\u29B0':'bemptyv','\u29B1':'demptyv','\u29B2':'cemptyv','\u29B3':'raemptyv','\u29B4':'laemptyv','\u29B5':'ohbar','\u29B6':'omid','\u29B7':'opar','\u29B9':'operp','\u29BB':'olcross','\u29BC':'odsold','\u29BE':'olcir','\u29BF':'ofcir','\u29C0':'olt','\u29C1':'ogt','\u29C2':'cirscir','\u29C3':'cirE','\u29C4':'solb','\u29C5':'bsolb','\u29C9':'boxbox','\u29CD':'trisb','\u29CE':'rtriltri','\u29CF':'LeftTriangleBar','\u29CF\u0338':'NotLeftTriangleBar','\u29D0':'RightTriangleBar','\u29D0\u0338':'NotRightTriangleBar','\u29DC':'iinfin','\u29DD':'infintie','\u29DE':'nvinfin','\u29E3':'eparsl','\u29E4':'smeparsl','\u29E5':'eqvparsl','\u29EB':'lozf','\u29F4':'RuleDelayed','\u29F6':'dsol','\u2A00':'xodot','\u2A01':'xoplus','\u2A02':'xotime','\u2A04':'xuplus','\u2A06':'xsqcup','\u2A0D':'fpartint','\u2A10':'cirfnint','\u2A11':'awint','\u2A12':'rppolint','\u2A13':'scpolint','\u2A14':'npolint','\u2A15':'pointint','\u2A16':'quatint','\u2A17':'intlarhk','\u2A22':'pluscir','\u2A23':'plusacir','\u2A24':'simplus','\u2A25':'plusdu','\u2A26':'plussim','\u2A27':'plustwo','\u2A29':'mcomma','\u2A2A':'minusdu','\u2A2D':'loplus','\u2A2E':'roplus','\u2A2F':'Cross','\u2A30':'timesd','\u2A31':'timesbar','\u2A33':'smashp','\u2A34':'lotimes','\u2A35':'rotimes','\u2A36':'otimesas','\u2A37':'Otimes','\u2A38':'odiv','\u2A39':'triplus','\u2A3A':'triminus','\u2A3B':'tritime','\u2A3C':'iprod','\u2A3F':'amalg','\u2A40':'capdot','\u2A42':'ncup','\u2A43':'ncap','\u2A44':'capand','\u2A45':'cupor','\u2A46':'cupcap','\u2A47':'capcup','\u2A48':'cupbrcap','\u2A49':'capbrcup','\u2A4A':'cupcup','\u2A4B':'capcap','\u2A4C':'ccups','\u2A4D':'ccaps','\u2A50':'ccupssm','\u2A53':'And','\u2A54':'Or','\u2A55':'andand','\u2A56':'oror','\u2A57':'orslope','\u2A58':'andslope','\u2A5A':'andv','\u2A5B':'orv','\u2A5C':'andd','\u2A5D':'ord','\u2A5F':'wedbar','\u2A66':'sdote','\u2A6A':'simdot','\u2A6D':'congdot','\u2A6D\u0338':'ncongdot','\u2A6E':'easter','\u2A6F':'apacir','\u2A70':'apE','\u2A70\u0338':'napE','\u2A71':'eplus','\u2A72':'pluse','\u2A73':'Esim','\u2A77':'eDDot','\u2A78':'equivDD','\u2A79':'ltcir','\u2A7A':'gtcir','\u2A7B':'ltquest','\u2A7C':'gtquest','\u2A7D':'les','\u2A7D\u0338':'nles','\u2A7E':'ges','\u2A7E\u0338':'nges','\u2A7F':'lesdot','\u2A80':'gesdot','\u2A81':'lesdoto','\u2A82':'gesdoto','\u2A83':'lesdotor','\u2A84':'gesdotol','\u2A85':'lap','\u2A86':'gap','\u2A87':'lne','\u2A88':'gne','\u2A89':'lnap','\u2A8A':'gnap','\u2A8B':'lEg','\u2A8C':'gEl','\u2A8D':'lsime','\u2A8E':'gsime','\u2A8F':'lsimg','\u2A90':'gsiml','\u2A91':'lgE','\u2A92':'glE','\u2A93':'lesges','\u2A94':'gesles','\u2A95':'els','\u2A96':'egs','\u2A97':'elsdot','\u2A98':'egsdot','\u2A99':'el','\u2A9A':'eg','\u2A9D':'siml','\u2A9E':'simg','\u2A9F':'simlE','\u2AA0':'simgE','\u2AA1':'LessLess','\u2AA1\u0338':'NotNestedLessLess','\u2AA2':'GreaterGreater','\u2AA2\u0338':'NotNestedGreaterGreater','\u2AA4':'glj','\u2AA5':'gla','\u2AA6':'ltcc','\u2AA7':'gtcc','\u2AA8':'lescc','\u2AA9':'gescc','\u2AAA':'smt','\u2AAB':'lat','\u2AAC':'smte','\u2AAC\uFE00':'smtes','\u2AAD':'late','\u2AAD\uFE00':'lates','\u2AAE':'bumpE','\u2AAF':'pre','\u2AAF\u0338':'npre','\u2AB0':'sce','\u2AB0\u0338':'nsce','\u2AB3':'prE','\u2AB4':'scE','\u2AB5':'prnE','\u2AB6':'scnE','\u2AB7':'prap','\u2AB8':'scap','\u2AB9':'prnap','\u2ABA':'scnap','\u2ABB':'Pr','\u2ABC':'Sc','\u2ABD':'subdot','\u2ABE':'supdot','\u2ABF':'subplus','\u2AC0':'supplus','\u2AC1':'submult','\u2AC2':'supmult','\u2AC3':'subedot','\u2AC4':'supedot','\u2AC5':'subE','\u2AC5\u0338':'nsubE','\u2AC6':'supE','\u2AC6\u0338':'nsupE','\u2AC7':'subsim','\u2AC8':'supsim','\u2ACB\uFE00':'vsubnE','\u2ACB':'subnE','\u2ACC\uFE00':'vsupnE','\u2ACC':'supnE','\u2ACF':'csub','\u2AD0':'csup','\u2AD1':'csube','\u2AD2':'csupe','\u2AD3':'subsup','\u2AD4':'supsub','\u2AD5':'subsub','\u2AD6':'supsup','\u2AD7':'suphsub','\u2AD8':'supdsub','\u2AD9':'forkv','\u2ADA':'topfork','\u2ADB':'mlcp','\u2AE4':'Dashv','\u2AE6':'Vdashl','\u2AE7':'Barv','\u2AE8':'vBar','\u2AE9':'vBarv','\u2AEB':'Vbar','\u2AEC':'Not','\u2AED':'bNot','\u2AEE':'rnmid','\u2AEF':'cirmid','\u2AF0':'midcir','\u2AF1':'topcir','\u2AF2':'nhpar','\u2AF3':'parsim','\u2AFD':'parsl','\u2AFD\u20E5':'nparsl','\u266D':'flat','\u266E':'natur','\u266F':'sharp','\xA4':'curren','\xA2':'cent','$':'dollar','\xA3':'pound','\xA5':'yen','\u20AC':'euro','\xB9':'sup1','\xBD':'half','\u2153':'frac13','\xBC':'frac14','\u2155':'frac15','\u2159':'frac16','\u215B':'frac18','\xB2':'sup2','\u2154':'frac23','\u2156':'frac25','\xB3':'sup3','\xBE':'frac34','\u2157':'frac35','\u215C':'frac38','\u2158':'frac45','\u215A':'frac56','\u215D':'frac58','\u215E':'frac78','\uD835\uDCB6':'ascr','\uD835\uDD52':'aopf','\uD835\uDD1E':'afr','\uD835\uDD38':'Aopf','\uD835\uDD04':'Afr','\uD835\uDC9C':'Ascr','\xAA':'ordf','\xE1':'aacute','\xC1':'Aacute','\xE0':'agrave','\xC0':'Agrave','\u0103':'abreve','\u0102':'Abreve','\xE2':'acirc','\xC2':'Acirc','\xE5':'aring','\xC5':'angst','\xE4':'auml','\xC4':'Auml','\xE3':'atilde','\xC3':'Atilde','\u0105':'aogon','\u0104':'Aogon','\u0101':'amacr','\u0100':'Amacr','\xE6':'aelig','\xC6':'AElig','\uD835\uDCB7':'bscr','\uD835\uDD53':'bopf','\uD835\uDD1F':'bfr','\uD835\uDD39':'Bopf','\u212C':'Bscr','\uD835\uDD05':'Bfr','\uD835\uDD20':'cfr','\uD835\uDCB8':'cscr','\uD835\uDD54':'copf','\u212D':'Cfr','\uD835\uDC9E':'Cscr','\u2102':'Copf','\u0107':'cacute','\u0106':'Cacute','\u0109':'ccirc','\u0108':'Ccirc','\u010D':'ccaron','\u010C':'Ccaron','\u010B':'cdot','\u010A':'Cdot','\xE7':'ccedil','\xC7':'Ccedil','\u2105':'incare','\uD835\uDD21':'dfr','\u2146':'dd','\uD835\uDD55':'dopf','\uD835\uDCB9':'dscr','\uD835\uDC9F':'Dscr','\uD835\uDD07':'Dfr','\u2145':'DD','\uD835\uDD3B':'Dopf','\u010F':'dcaron','\u010E':'Dcaron','\u0111':'dstrok','\u0110':'Dstrok','\xF0':'eth','\xD0':'ETH','\u2147':'ee','\u212F':'escr','\uD835\uDD22':'efr','\uD835\uDD56':'eopf','\u2130':'Escr','\uD835\uDD08':'Efr','\uD835\uDD3C':'Eopf','\xE9':'eacute','\xC9':'Eacute','\xE8':'egrave','\xC8':'Egrave','\xEA':'ecirc','\xCA':'Ecirc','\u011B':'ecaron','\u011A':'Ecaron','\xEB':'euml','\xCB':'Euml','\u0117':'edot','\u0116':'Edot','\u0119':'eogon','\u0118':'Eogon','\u0113':'emacr','\u0112':'Emacr','\uD835\uDD23':'ffr','\uD835\uDD57':'fopf','\uD835\uDCBB':'fscr','\uD835\uDD09':'Ffr','\uD835\uDD3D':'Fopf','\u2131':'Fscr','\uFB00':'fflig','\uFB03':'ffilig','\uFB04':'ffllig','\uFB01':'filig','fj':'fjlig','\uFB02':'fllig','\u0192':'fnof','\u210A':'gscr','\uD835\uDD58':'gopf','\uD835\uDD24':'gfr','\uD835\uDCA2':'Gscr','\uD835\uDD3E':'Gopf','\uD835\uDD0A':'Gfr','\u01F5':'gacute','\u011F':'gbreve','\u011E':'Gbreve','\u011D':'gcirc','\u011C':'Gcirc','\u0121':'gdot','\u0120':'Gdot','\u0122':'Gcedil','\uD835\uDD25':'hfr','\u210E':'planckh','\uD835\uDCBD':'hscr','\uD835\uDD59':'hopf','\u210B':'Hscr','\u210C':'Hfr','\u210D':'Hopf','\u0125':'hcirc','\u0124':'Hcirc','\u210F':'hbar','\u0127':'hstrok','\u0126':'Hstrok','\uD835\uDD5A':'iopf','\uD835\uDD26':'ifr','\uD835\uDCBE':'iscr','\u2148':'ii','\uD835\uDD40':'Iopf','\u2110':'Iscr','\u2111':'Im','\xED':'iacute','\xCD':'Iacute','\xEC':'igrave','\xCC':'Igrave','\xEE':'icirc','\xCE':'Icirc','\xEF':'iuml','\xCF':'Iuml','\u0129':'itilde','\u0128':'Itilde','\u0130':'Idot','\u012F':'iogon','\u012E':'Iogon','\u012B':'imacr','\u012A':'Imacr','\u0133':'ijlig','\u0132':'IJlig','\u0131':'imath','\uD835\uDCBF':'jscr','\uD835\uDD5B':'jopf','\uD835\uDD27':'jfr','\uD835\uDCA5':'Jscr','\uD835\uDD0D':'Jfr','\uD835\uDD41':'Jopf','\u0135':'jcirc','\u0134':'Jcirc','\u0237':'jmath','\uD835\uDD5C':'kopf','\uD835\uDCC0':'kscr','\uD835\uDD28':'kfr','\uD835\uDCA6':'Kscr','\uD835\uDD42':'Kopf','\uD835\uDD0E':'Kfr','\u0137':'kcedil','\u0136':'Kcedil','\uD835\uDD29':'lfr','\uD835\uDCC1':'lscr','\u2113':'ell','\uD835\uDD5D':'lopf','\u2112':'Lscr','\uD835\uDD0F':'Lfr','\uD835\uDD43':'Lopf','\u013A':'lacute','\u0139':'Lacute','\u013E':'lcaron','\u013D':'Lcaron','\u013C':'lcedil','\u013B':'Lcedil','\u0142':'lstrok','\u0141':'Lstrok','\u0140':'lmidot','\u013F':'Lmidot','\uD835\uDD2A':'mfr','\uD835\uDD5E':'mopf','\uD835\uDCC2':'mscr','\uD835\uDD10':'Mfr','\uD835\uDD44':'Mopf','\u2133':'Mscr','\uD835\uDD2B':'nfr','\uD835\uDD5F':'nopf','\uD835\uDCC3':'nscr','\u2115':'Nopf','\uD835\uDCA9':'Nscr','\uD835\uDD11':'Nfr','\u0144':'nacute','\u0143':'Nacute','\u0148':'ncaron','\u0147':'Ncaron','\xF1':'ntilde','\xD1':'Ntilde','\u0146':'ncedil','\u0145':'Ncedil','\u2116':'numero','\u014B':'eng','\u014A':'ENG','\uD835\uDD60':'oopf','\uD835\uDD2C':'ofr','\u2134':'oscr','\uD835\uDCAA':'Oscr','\uD835\uDD12':'Ofr','\uD835\uDD46':'Oopf','\xBA':'ordm','\xF3':'oacute','\xD3':'Oacute','\xF2':'ograve','\xD2':'Ograve','\xF4':'ocirc','\xD4':'Ocirc','\xF6':'ouml','\xD6':'Ouml','\u0151':'odblac','\u0150':'Odblac','\xF5':'otilde','\xD5':'Otilde','\xF8':'oslash','\xD8':'Oslash','\u014D':'omacr','\u014C':'Omacr','\u0153':'oelig','\u0152':'OElig','\uD835\uDD2D':'pfr','\uD835\uDCC5':'pscr','\uD835\uDD61':'popf','\u2119':'Popf','\uD835\uDD13':'Pfr','\uD835\uDCAB':'Pscr','\uD835\uDD62':'qopf','\uD835\uDD2E':'qfr','\uD835\uDCC6':'qscr','\uD835\uDCAC':'Qscr','\uD835\uDD14':'Qfr','\u211A':'Qopf','\u0138':'kgreen','\uD835\uDD2F':'rfr','\uD835\uDD63':'ropf','\uD835\uDCC7':'rscr','\u211B':'Rscr','\u211C':'Re','\u211D':'Ropf','\u0155':'racute','\u0154':'Racute','\u0159':'rcaron','\u0158':'Rcaron','\u0157':'rcedil','\u0156':'Rcedil','\uD835\uDD64':'sopf','\uD835\uDCC8':'sscr','\uD835\uDD30':'sfr','\uD835\uDD4A':'Sopf','\uD835\uDD16':'Sfr','\uD835\uDCAE':'Sscr','\u24C8':'oS','\u015B':'sacute','\u015A':'Sacute','\u015D':'scirc','\u015C':'Scirc','\u0161':'scaron','\u0160':'Scaron','\u015F':'scedil','\u015E':'Scedil','\xDF':'szlig','\uD835\uDD31':'tfr','\uD835\uDCC9':'tscr','\uD835\uDD65':'topf','\uD835\uDCAF':'Tscr','\uD835\uDD17':'Tfr','\uD835\uDD4B':'Topf','\u0165':'tcaron','\u0164':'Tcaron','\u0163':'tcedil','\u0162':'Tcedil','\u2122':'trade','\u0167':'tstrok','\u0166':'Tstrok','\uD835\uDCCA':'uscr','\uD835\uDD66':'uopf','\uD835\uDD32':'ufr','\uD835\uDD4C':'Uopf','\uD835\uDD18':'Ufr','\uD835\uDCB0':'Uscr','\xFA':'uacute','\xDA':'Uacute','\xF9':'ugrave','\xD9':'Ugrave','\u016D':'ubreve','\u016C':'Ubreve','\xFB':'ucirc','\xDB':'Ucirc','\u016F':'uring','\u016E':'Uring','\xFC':'uuml','\xDC':'Uuml','\u0171':'udblac','\u0170':'Udblac','\u0169':'utilde','\u0168':'Utilde','\u0173':'uogon','\u0172':'Uogon','\u016B':'umacr','\u016A':'Umacr','\uD835\uDD33':'vfr','\uD835\uDD67':'vopf','\uD835\uDCCB':'vscr','\uD835\uDD19':'Vfr','\uD835\uDD4D':'Vopf','\uD835\uDCB1':'Vscr','\uD835\uDD68':'wopf','\uD835\uDCCC':'wscr','\uD835\uDD34':'wfr','\uD835\uDCB2':'Wscr','\uD835\uDD4E':'Wopf','\uD835\uDD1A':'Wfr','\u0175':'wcirc','\u0174':'Wcirc','\uD835\uDD35':'xfr','\uD835\uDCCD':'xscr','\uD835\uDD69':'xopf','\uD835\uDD4F':'Xopf','\uD835\uDD1B':'Xfr','\uD835\uDCB3':'Xscr','\uD835\uDD36':'yfr','\uD835\uDCCE':'yscr','\uD835\uDD6A':'yopf','\uD835\uDCB4':'Yscr','\uD835\uDD1C':'Yfr','\uD835\uDD50':'Yopf','\xFD':'yacute','\xDD':'Yacute','\u0177':'ycirc','\u0176':'Ycirc','\xFF':'yuml','\u0178':'Yuml','\uD835\uDCCF':'zscr','\uD835\uDD37':'zfr','\uD835\uDD6B':'zopf','\u2128':'Zfr','\u2124':'Zopf','\uD835\uDCB5':'Zscr','\u017A':'zacute','\u0179':'Zacute','\u017E':'zcaron','\u017D':'Zcaron','\u017C':'zdot','\u017B':'Zdot','\u01B5':'imped','\xFE':'thorn','\xDE':'THORN','\u0149':'napos','\u03B1':'alpha','\u0391':'Alpha','\u03B2':'beta','\u0392':'Beta','\u03B3':'gamma','\u0393':'Gamma','\u03B4':'delta','\u0394':'Delta','\u03B5':'epsi','\u03F5':'epsiv','\u0395':'Epsilon','\u03DD':'gammad','\u03DC':'Gammad','\u03B6':'zeta','\u0396':'Zeta','\u03B7':'eta','\u0397':'Eta','\u03B8':'theta','\u03D1':'thetav','\u0398':'Theta','\u03B9':'iota','\u0399':'Iota','\u03BA':'kappa','\u03F0':'kappav','\u039A':'Kappa','\u03BB':'lambda','\u039B':'Lambda','\u03BC':'mu','\xB5':'micro','\u039C':'Mu','\u03BD':'nu','\u039D':'Nu','\u03BE':'xi','\u039E':'Xi','\u03BF':'omicron','\u039F':'Omicron','\u03C0':'pi','\u03D6':'piv','\u03A0':'Pi','\u03C1':'rho','\u03F1':'rhov','\u03A1':'Rho','\u03C3':'sigma','\u03A3':'Sigma','\u03C2':'sigmaf','\u03C4':'tau','\u03A4':'Tau','\u03C5':'upsi','\u03A5':'Upsilon','\u03D2':'Upsi','\u03C6':'phi','\u03D5':'phiv','\u03A6':'Phi','\u03C7':'chi','\u03A7':'Chi','\u03C8':'psi','\u03A8':'Psi','\u03C9':'omega','\u03A9':'ohm','\u0430':'acy','\u0410':'Acy','\u0431':'bcy','\u0411':'Bcy','\u0432':'vcy','\u0412':'Vcy','\u0433':'gcy','\u0413':'Gcy','\u0453':'gjcy','\u0403':'GJcy','\u0434':'dcy','\u0414':'Dcy','\u0452':'djcy','\u0402':'DJcy','\u0435':'iecy','\u0415':'IEcy','\u0451':'iocy','\u0401':'IOcy','\u0454':'jukcy','\u0404':'Jukcy','\u0436':'zhcy','\u0416':'ZHcy','\u0437':'zcy','\u0417':'Zcy','\u0455':'dscy','\u0405':'DScy','\u0438':'icy','\u0418':'Icy','\u0456':'iukcy','\u0406':'Iukcy','\u0457':'yicy','\u0407':'YIcy','\u0439':'jcy','\u0419':'Jcy','\u0458':'jsercy','\u0408':'Jsercy','\u043A':'kcy','\u041A':'Kcy','\u045C':'kjcy','\u040C':'KJcy','\u043B':'lcy','\u041B':'Lcy','\u0459':'ljcy','\u0409':'LJcy','\u043C':'mcy','\u041C':'Mcy','\u043D':'ncy','\u041D':'Ncy','\u045A':'njcy','\u040A':'NJcy','\u043E':'ocy','\u041E':'Ocy','\u043F':'pcy','\u041F':'Pcy','\u0440':'rcy','\u0420':'Rcy','\u0441':'scy','\u0421':'Scy','\u0442':'tcy','\u0422':'Tcy','\u045B':'tshcy','\u040B':'TSHcy','\u0443':'ucy','\u0423':'Ucy','\u045E':'ubrcy','\u040E':'Ubrcy','\u0444':'fcy','\u0424':'Fcy','\u0445':'khcy','\u0425':'KHcy','\u0446':'tscy','\u0426':'TScy','\u0447':'chcy','\u0427':'CHcy','\u045F':'dzcy','\u040F':'DZcy','\u0448':'shcy','\u0428':'SHcy','\u0449':'shchcy','\u0429':'SHCHcy','\u044A':'hardcy','\u042A':'HARDcy','\u044B':'ycy','\u042B':'Ycy','\u044C':'softcy','\u042C':'SOFTcy','\u044D':'ecy','\u042D':'Ecy','\u044E':'yucy','\u042E':'YUcy','\u044F':'yacy','\u042F':'YAcy','\u2135':'aleph','\u2136':'beth','\u2137':'gimel','\u2138':'daleth'};
  11524. var regexEscape = /["&'<>`]/g;
  11525. var escapeMap = {
  11526. '"': '&quot;',
  11527. '&': '&amp;',
  11528. '\'': '&#x27;',
  11529. '<': '&lt;',
  11530. // See https://mathiasbynens.be/notes/ambiguous-ampersands: in HTML, the
  11531. // following is not strictly necessary unless it’s part of a tag or an
  11532. // unquoted attribute value. We’re only escaping it to support those
  11533. // situations, and for XML support.
  11534. '>': '&gt;',
  11535. // In Internet Explorer ≤ 8, the backtick character can be used
  11536. // to break out of (un)quoted attribute values or HTML comments.
  11537. // See http://html5sec.org/#102, http://html5sec.org/#108, and
  11538. // http://html5sec.org/#133.
  11539. '`': '&#x60;'
  11540. };
  11541. var regexInvalidEntity = /&#(?:[xX][^a-fA-F0-9]|[^0-9xX])/;
  11542. var regexInvalidRawCodePoint = /[\0-\x08\x0B\x0E-\x1F\x7F-\x9F\uFDD0-\uFDEF\uFFFE\uFFFF]|[\uD83F\uD87F\uD8BF\uD8FF\uD93F\uD97F\uD9BF\uD9FF\uDA3F\uDA7F\uDABF\uDAFF\uDB3F\uDB7F\uDBBF\uDBFF][\uDFFE\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
  11543. var regexDecode = /&(CounterClockwiseContourIntegral|DoubleLongLeftRightArrow|ClockwiseContourIntegral|NotNestedGreaterGreater|NotSquareSupersetEqual|DiacriticalDoubleAcute|NotRightTriangleEqual|NotSucceedsSlantEqual|NotPrecedesSlantEqual|CloseCurlyDoubleQuote|NegativeVeryThinSpace|DoubleContourIntegral|FilledVerySmallSquare|CapitalDifferentialD|OpenCurlyDoubleQuote|EmptyVerySmallSquare|NestedGreaterGreater|DoubleLongRightArrow|NotLeftTriangleEqual|NotGreaterSlantEqual|ReverseUpEquilibrium|DoubleLeftRightArrow|NotSquareSubsetEqual|NotDoubleVerticalBar|RightArrowLeftArrow|NotGreaterFullEqual|NotRightTriangleBar|SquareSupersetEqual|DownLeftRightVector|DoubleLongLeftArrow|leftrightsquigarrow|LeftArrowRightArrow|NegativeMediumSpace|blacktriangleright|RightDownVectorBar|PrecedesSlantEqual|RightDoubleBracket|SucceedsSlantEqual|NotLeftTriangleBar|RightTriangleEqual|SquareIntersection|RightDownTeeVector|ReverseEquilibrium|NegativeThickSpace|longleftrightarrow|Longleftrightarrow|LongLeftRightArrow|DownRightTeeVector|DownRightVectorBar|GreaterSlantEqual|SquareSubsetEqual|LeftDownVectorBar|LeftDoubleBracket|VerticalSeparator|rightleftharpoons|NotGreaterGreater|NotSquareSuperset|blacktriangleleft|blacktriangledown|NegativeThinSpace|LeftDownTeeVector|NotLessSlantEqual|leftrightharpoons|DoubleUpDownArrow|DoubleVerticalBar|LeftTriangleEqual|FilledSmallSquare|twoheadrightarrow|NotNestedLessLess|DownLeftTeeVector|DownLeftVectorBar|RightAngleBracket|NotTildeFullEqual|NotReverseElement|RightUpDownVector|DiacriticalTilde|NotSucceedsTilde|circlearrowright|NotPrecedesEqual|rightharpoondown|DoubleRightArrow|NotSucceedsEqual|NonBreakingSpace|NotRightTriangle|LessEqualGreater|RightUpTeeVector|LeftAngleBracket|GreaterFullEqual|DownArrowUpArrow|RightUpVectorBar|twoheadleftarrow|GreaterEqualLess|downharpoonright|RightTriangleBar|ntrianglerighteq|NotSupersetEqual|LeftUpDownVector|DiacriticalAcute|rightrightarrows|vartriangleright|UpArrowDownArrow|DiacriticalGrave|UnderParenthesis|EmptySmallSquare|LeftUpVectorBar|leftrightarrows|DownRightVector|downharpoonleft|trianglerighteq|ShortRightArrow|OverParenthesis|DoubleLeftArrow|DoubleDownArrow|NotSquareSubset|bigtriangledown|ntrianglelefteq|UpperRightArrow|curvearrowright|vartriangleleft|NotLeftTriangle|nleftrightarrow|LowerRightArrow|NotHumpDownHump|NotGreaterTilde|rightthreetimes|LeftUpTeeVector|NotGreaterEqual|straightepsilon|LeftTriangleBar|rightsquigarrow|ContourIntegral|rightleftarrows|CloseCurlyQuote|RightDownVector|LeftRightVector|nLeftrightarrow|leftharpoondown|circlearrowleft|SquareSuperset|OpenCurlyQuote|hookrightarrow|HorizontalLine|DiacriticalDot|NotLessGreater|ntriangleright|DoubleRightTee|InvisibleComma|InvisibleTimes|LowerLeftArrow|DownLeftVector|NotSubsetEqual|curvearrowleft|trianglelefteq|NotVerticalBar|TildeFullEqual|downdownarrows|NotGreaterLess|RightTeeVector|ZeroWidthSpace|looparrowright|LongRightArrow|doublebarwedge|ShortLeftArrow|ShortDownArrow|RightVectorBar|GreaterGreater|ReverseElement|rightharpoonup|LessSlantEqual|leftthreetimes|upharpoonright|rightarrowtail|LeftDownVector|Longrightarrow|NestedLessLess|UpperLeftArrow|nshortparallel|leftleftarrows|leftrightarrow|Leftrightarrow|LeftRightArrow|longrightarrow|upharpoonleft|RightArrowBar|ApplyFunction|LeftTeeVector|leftarrowtail|NotEqualTilde|varsubsetneqq|varsupsetneqq|RightTeeArrow|SucceedsEqual|SucceedsTilde|LeftVectorBar|SupersetEqual|hookleftarrow|DifferentialD|VerticalTilde|VeryThinSpace|blacktriangle|bigtriangleup|LessFullEqual|divideontimes|leftharpoonup|UpEquilibrium|ntriangleleft|RightTriangle|measuredangle|shortparallel|longleftarrow|Longleftarrow|LongLeftArrow|DoubleLeftTee|Poincareplane|PrecedesEqual|triangleright|DoubleUpArrow|RightUpVector|fallingdotseq|looparrowleft|PrecedesTilde|NotTildeEqual|NotTildeTilde|smallsetminus|Proportional|triangleleft|triangledown|UnderBracket|NotHumpEqual|exponentiale|ExponentialE|NotLessTilde|HilbertSpace|RightCeiling|blacklozenge|varsupsetneq|HumpDownHump|GreaterEqual|VerticalLine|LeftTeeArrow|NotLessEqual|DownTeeArrow|LeftTriangle|varsubsetneq|Intersection|NotCongruent|DownArrowBar|LeftUpVector|LeftArrowBar|risingdotseq|GreaterTilde|RoundImplies|SquareSubset|ShortUpArrow|NotSuperset|quaternions|precnapprox|backepsilon|preccurlyeq|OverBracket|blacksquare|MediumSpace|VerticalBar|circledcirc|circleddash|CircleMinus|CircleTimes|LessGreater|curlyeqprec|curlyeqsucc|diamondsuit|UpDownArrow|Updownarrow|RuleDelayed|Rrightarrow|updownarrow|RightVector|nRightarrow|nrightarrow|eqslantless|LeftCeiling|Equilibrium|SmallCircle|expectation|NotSucceeds|thickapprox|GreaterLess|SquareUnion|NotPrecedes|NotLessLess|straightphi|succnapprox|succcurlyeq|SubsetEqual|sqsupseteq|Proportion|Laplacetrf|ImaginaryI|supsetneqq|NotGreater|gtreqqless|NotElement|ThickSpace|TildeEqual|TildeTilde|Fouriertrf|rmoustache|EqualTilde|eqslantgtr|UnderBrace|LeftVector|UpArrowBar|nLeftarrow|nsubseteqq|subsetneqq|nsupseteqq|nleftarrow|succapprox|lessapprox|UpTeeArrow|upuparrows|curlywedge|lesseqqgtr|varepsilon|varnothing|RightFloor|complement|CirclePlus|sqsubseteq|Lleftarrow|circledast|RightArrow|Rightarrow|rightarrow|lmoustache|Bernoullis|precapprox|mapstoleft|mapstodown|longmapsto|dotsquare|downarrow|DoubleDot|nsubseteq|supsetneq|leftarrow|nsupseteq|subsetneq|ThinSpace|ngeqslant|subseteqq|HumpEqual|NotSubset|triangleq|NotCupCap|lesseqgtr|heartsuit|TripleDot|Leftarrow|Coproduct|Congruent|varpropto|complexes|gvertneqq|LeftArrow|LessTilde|supseteqq|MinusPlus|CircleDot|nleqslant|NotExists|gtreqless|nparallel|UnionPlus|LeftFloor|checkmark|CenterDot|centerdot|Mellintrf|gtrapprox|bigotimes|OverBrace|spadesuit|therefore|pitchfork|rationals|PlusMinus|Backslash|Therefore|DownBreve|backsimeq|backprime|DownArrow|nshortmid|Downarrow|lvertneqq|eqvparsl|imagline|imagpart|infintie|integers|Integral|intercal|LessLess|Uarrocir|intlarhk|sqsupset|angmsdaf|sqsubset|llcorner|vartheta|cupbrcap|lnapprox|Superset|SuchThat|succnsim|succneqq|angmsdag|biguplus|curlyvee|trpezium|Succeeds|NotTilde|bigwedge|angmsdah|angrtvbd|triminus|cwconint|fpartint|lrcorner|smeparsl|subseteq|urcorner|lurdshar|laemptyv|DDotrahd|approxeq|ldrushar|awconint|mapstoup|backcong|shortmid|triangle|geqslant|gesdotol|timesbar|circledR|circledS|setminus|multimap|naturals|scpolint|ncongdot|RightTee|boxminus|gnapprox|boxtimes|andslope|thicksim|angmsdaa|varsigma|cirfnint|rtriltri|angmsdab|rppolint|angmsdac|barwedge|drbkarow|clubsuit|thetasym|bsolhsub|capbrcup|dzigrarr|doteqdot|DotEqual|dotminus|UnderBar|NotEqual|realpart|otimesas|ulcorner|hksearow|hkswarow|parallel|PartialD|elinters|emptyset|plusacir|bbrktbrk|angmsdad|pointint|bigoplus|angmsdae|Precedes|bigsqcup|varkappa|notindot|supseteq|precneqq|precnsim|profalar|profline|profsurf|leqslant|lesdotor|raemptyv|subplus|notnivb|notnivc|subrarr|zigrarr|vzigzag|submult|subedot|Element|between|cirscir|larrbfs|larrsim|lotimes|lbrksld|lbrkslu|lozenge|ldrdhar|dbkarow|bigcirc|epsilon|simrarr|simplus|ltquest|Epsilon|luruhar|gtquest|maltese|npolint|eqcolon|npreceq|bigodot|ddagger|gtrless|bnequiv|harrcir|ddotseq|equivDD|backsim|demptyv|nsqsube|nsqsupe|Upsilon|nsubset|upsilon|minusdu|nsucceq|swarrow|nsupset|coloneq|searrow|boxplus|napprox|natural|asympeq|alefsym|congdot|nearrow|bigstar|diamond|supplus|tritime|LeftTee|nvinfin|triplus|NewLine|nvltrie|nvrtrie|nwarrow|nexists|Diamond|ruluhar|Implies|supmult|angzarr|suplarr|suphsub|questeq|because|digamma|Because|olcross|bemptyv|omicron|Omicron|rotimes|NoBreak|intprod|angrtvb|orderof|uwangle|suphsol|lesdoto|orslope|DownTee|realine|cudarrl|rdldhar|OverBar|supedot|lessdot|supdsub|topfork|succsim|rbrkslu|rbrksld|pertenk|cudarrr|isindot|planckh|lessgtr|pluscir|gesdoto|plussim|plustwo|lesssim|cularrp|rarrsim|Cayleys|notinva|notinvb|notinvc|UpArrow|Uparrow|uparrow|NotLess|dwangle|precsim|Product|curarrm|Cconint|dotplus|rarrbfs|ccupssm|Cedilla|cemptyv|notniva|quatint|frac35|frac38|frac45|frac56|frac58|frac78|tridot|xoplus|gacute|gammad|Gammad|lfisht|lfloor|bigcup|sqsupe|gbreve|Gbreve|lharul|sqsube|sqcups|Gcedil|apacir|llhard|lmidot|Lmidot|lmoust|andand|sqcaps|approx|Abreve|spades|circeq|tprime|divide|topcir|Assign|topbot|gesdot|divonx|xuplus|timesd|gesles|atilde|solbar|SOFTcy|loplus|timesb|lowast|lowbar|dlcorn|dlcrop|softcy|dollar|lparlt|thksim|lrhard|Atilde|lsaquo|smashp|bigvee|thinsp|wreath|bkarow|lsquor|lstrok|Lstrok|lthree|ltimes|ltlarr|DotDot|simdot|ltrPar|weierp|xsqcup|angmsd|sigmav|sigmaf|zeetrf|Zcaron|zcaron|mapsto|vsupne|thetav|cirmid|marker|mcomma|Zacute|vsubnE|there4|gtlPar|vsubne|bottom|gtrarr|SHCHcy|shchcy|midast|midcir|middot|minusb|minusd|gtrdot|bowtie|sfrown|mnplus|models|colone|seswar|Colone|mstpos|searhk|gtrsim|nacute|Nacute|boxbox|telrec|hairsp|Tcedil|nbumpe|scnsim|ncaron|Ncaron|ncedil|Ncedil|hamilt|Scedil|nearhk|hardcy|HARDcy|tcedil|Tcaron|commat|nequiv|nesear|tcaron|target|hearts|nexist|varrho|scedil|Scaron|scaron|hellip|Sacute|sacute|hercon|swnwar|compfn|rtimes|rthree|rsquor|rsaquo|zacute|wedgeq|homtht|barvee|barwed|Barwed|rpargt|horbar|conint|swarhk|roplus|nltrie|hslash|hstrok|Hstrok|rmoust|Conint|bprime|hybull|hyphen|iacute|Iacute|supsup|supsub|supsim|varphi|coprod|brvbar|agrave|Supset|supset|igrave|Igrave|notinE|Agrave|iiiint|iinfin|copysr|wedbar|Verbar|vangrt|becaus|incare|verbar|inodot|bullet|drcorn|intcal|drcrop|cularr|vellip|Utilde|bumpeq|cupcap|dstrok|Dstrok|CupCap|cupcup|cupdot|eacute|Eacute|supdot|iquest|easter|ecaron|Ecaron|ecolon|isinsv|utilde|itilde|Itilde|curarr|succeq|Bumpeq|cacute|ulcrop|nparsl|Cacute|nprcue|egrave|Egrave|nrarrc|nrarrw|subsup|subsub|nrtrie|jsercy|nsccue|Jsercy|kappav|kcedil|Kcedil|subsim|ulcorn|nsimeq|egsdot|veebar|kgreen|capand|elsdot|Subset|subset|curren|aacute|lacute|Lacute|emptyv|ntilde|Ntilde|lagran|lambda|Lambda|capcap|Ugrave|langle|subdot|emsp13|numero|emsp14|nvdash|nvDash|nVdash|nVDash|ugrave|ufisht|nvHarr|larrfs|nvlArr|larrhk|larrlp|larrpl|nvrArr|Udblac|nwarhk|larrtl|nwnear|oacute|Oacute|latail|lAtail|sstarf|lbrace|odblac|Odblac|lbrack|udblac|odsold|eparsl|lcaron|Lcaron|ograve|Ograve|lcedil|Lcedil|Aacute|ssmile|ssetmn|squarf|ldquor|capcup|ominus|cylcty|rharul|eqcirc|dagger|rfloor|rfisht|Dagger|daleth|equals|origof|capdot|equest|dcaron|Dcaron|rdquor|oslash|Oslash|otilde|Otilde|otimes|Otimes|urcrop|Ubreve|ubreve|Yacute|Uacute|uacute|Rcedil|rcedil|urcorn|parsim|Rcaron|Vdashl|rcaron|Tstrok|percnt|period|permil|Exists|yacute|rbrack|rbrace|phmmat|ccaron|Ccaron|planck|ccedil|plankv|tstrok|female|plusdo|plusdu|ffilig|plusmn|ffllig|Ccedil|rAtail|dfisht|bernou|ratail|Rarrtl|rarrtl|angsph|rarrpl|rarrlp|rarrhk|xwedge|xotime|forall|ForAll|Vvdash|vsupnE|preceq|bigcap|frac12|frac13|frac14|primes|rarrfs|prnsim|frac15|Square|frac16|square|lesdot|frac18|frac23|propto|prurel|rarrap|rangle|puncsp|frac25|Racute|qprime|racute|lesges|frac34|abreve|AElig|eqsim|utdot|setmn|urtri|Equal|Uring|seArr|uring|searr|dashv|Dashv|mumap|nabla|iogon|Iogon|sdote|sdotb|scsim|napid|napos|equiv|natur|Acirc|dblac|erarr|nbump|iprod|erDot|ucirc|awint|esdot|angrt|ncong|isinE|scnap|Scirc|scirc|ndash|isins|Ubrcy|nearr|neArr|isinv|nedot|ubrcy|acute|Ycirc|iukcy|Iukcy|xutri|nesim|caret|jcirc|Jcirc|caron|twixt|ddarr|sccue|exist|jmath|sbquo|ngeqq|angst|ccaps|lceil|ngsim|UpTee|delta|Delta|rtrif|nharr|nhArr|nhpar|rtrie|jukcy|Jukcy|kappa|rsquo|Kappa|nlarr|nlArr|TSHcy|rrarr|aogon|Aogon|fflig|xrarr|tshcy|ccirc|nleqq|filig|upsih|nless|dharl|nlsim|fjlig|ropar|nltri|dharr|robrk|roarr|fllig|fltns|roang|rnmid|subnE|subne|lAarr|trisb|Ccirc|acirc|ccups|blank|VDash|forkv|Vdash|langd|cedil|blk12|blk14|laquo|strns|diams|notin|vDash|larrb|blk34|block|disin|uplus|vdash|vBarv|aelig|starf|Wedge|check|xrArr|lates|lbarr|lBarr|notni|lbbrk|bcong|frasl|lbrke|frown|vrtri|vprop|vnsup|gamma|Gamma|wedge|xodot|bdquo|srarr|doteq|ldquo|boxdl|boxdL|gcirc|Gcirc|boxDl|boxDL|boxdr|boxdR|boxDr|TRADE|trade|rlhar|boxDR|vnsub|npart|vltri|rlarr|boxhd|boxhD|nprec|gescc|nrarr|nrArr|boxHd|boxHD|boxhu|boxhU|nrtri|boxHu|clubs|boxHU|times|colon|Colon|gimel|xlArr|Tilde|nsime|tilde|nsmid|nspar|THORN|thorn|xlarr|nsube|nsubE|thkap|xhArr|comma|nsucc|boxul|boxuL|nsupe|nsupE|gneqq|gnsim|boxUl|boxUL|grave|boxur|boxuR|boxUr|boxUR|lescc|angle|bepsi|boxvh|varpi|boxvH|numsp|Theta|gsime|gsiml|theta|boxVh|boxVH|boxvl|gtcir|gtdot|boxvL|boxVl|boxVL|crarr|cross|Cross|nvsim|boxvr|nwarr|nwArr|sqsup|dtdot|Uogon|lhard|lharu|dtrif|ocirc|Ocirc|lhblk|duarr|odash|sqsub|Hacek|sqcup|llarr|duhar|oelig|OElig|ofcir|boxvR|uogon|lltri|boxVr|csube|uuarr|ohbar|csupe|ctdot|olarr|olcir|harrw|oline|sqcap|omacr|Omacr|omega|Omega|boxVR|aleph|lneqq|lnsim|loang|loarr|rharu|lobrk|hcirc|operp|oplus|rhard|Hcirc|orarr|Union|order|ecirc|Ecirc|cuepr|szlig|cuesc|breve|reals|eDDot|Breve|hoarr|lopar|utrif|rdquo|Umacr|umacr|efDot|swArr|ultri|alpha|rceil|ovbar|swarr|Wcirc|wcirc|smtes|smile|bsemi|lrarr|aring|parsl|lrhar|bsime|uhblk|lrtri|cupor|Aring|uharr|uharl|slarr|rbrke|bsolb|lsime|rbbrk|RBarr|lsimg|phone|rBarr|rbarr|icirc|lsquo|Icirc|emacr|Emacr|ratio|simne|plusb|simlE|simgE|simeq|pluse|ltcir|ltdot|empty|xharr|xdtri|iexcl|Alpha|ltrie|rarrw|pound|ltrif|xcirc|bumpe|prcue|bumpE|asymp|amacr|cuvee|Sigma|sigma|iiint|udhar|iiota|ijlig|IJlig|supnE|imacr|Imacr|prime|Prime|image|prnap|eogon|Eogon|rarrc|mdash|mDDot|cuwed|imath|supne|imped|Amacr|udarr|prsim|micro|rarrb|cwint|raquo|infin|eplus|range|rangd|Ucirc|radic|minus|amalg|veeeq|rAarr|epsiv|ycirc|quest|sharp|quot|zwnj|Qscr|race|qscr|Qopf|qopf|qint|rang|Rang|Zscr|zscr|Zopf|zopf|rarr|rArr|Rarr|Pscr|pscr|prop|prod|prnE|prec|ZHcy|zhcy|prap|Zeta|zeta|Popf|popf|Zdot|plus|zdot|Yuml|yuml|phiv|YUcy|yucy|Yscr|yscr|perp|Yopf|yopf|part|para|YIcy|Ouml|rcub|yicy|YAcy|rdca|ouml|osol|Oscr|rdsh|yacy|real|oscr|xvee|andd|rect|andv|Xscr|oror|ordm|ordf|xscr|ange|aopf|Aopf|rHar|Xopf|opar|Oopf|xopf|xnis|rhov|oopf|omid|xmap|oint|apid|apos|ogon|ascr|Ascr|odot|odiv|xcup|xcap|ocir|oast|nvlt|nvle|nvgt|nvge|nvap|Wscr|wscr|auml|ntlg|ntgl|nsup|nsub|nsim|Nscr|nscr|nsce|Wopf|ring|npre|wopf|npar|Auml|Barv|bbrk|Nopf|nopf|nmid|nLtv|beta|ropf|Ropf|Beta|beth|nles|rpar|nleq|bnot|bNot|nldr|NJcy|rscr|Rscr|Vscr|vscr|rsqb|njcy|bopf|nisd|Bopf|rtri|Vopf|nGtv|ngtr|vopf|boxh|boxH|boxv|nges|ngeq|boxV|bscr|scap|Bscr|bsim|Vert|vert|bsol|bull|bump|caps|cdot|ncup|scnE|ncap|nbsp|napE|Cdot|cent|sdot|Vbar|nang|vBar|chcy|Mscr|mscr|sect|semi|CHcy|Mopf|mopf|sext|circ|cire|mldr|mlcp|cirE|comp|shcy|SHcy|vArr|varr|cong|copf|Copf|copy|COPY|malt|male|macr|lvnE|cscr|ltri|sime|ltcc|simg|Cscr|siml|csub|Uuml|lsqb|lsim|uuml|csup|Lscr|lscr|utri|smid|lpar|cups|smte|lozf|darr|Lopf|Uscr|solb|lopf|sopf|Sopf|lneq|uscr|spar|dArr|lnap|Darr|dash|Sqrt|LJcy|ljcy|lHar|dHar|Upsi|upsi|diam|lesg|djcy|DJcy|leqq|dopf|Dopf|dscr|Dscr|dscy|ldsh|ldca|squf|DScy|sscr|Sscr|dsol|lcub|late|star|Star|Uopf|Larr|lArr|larr|uopf|dtri|dzcy|sube|subE|Lang|lang|Kscr|kscr|Kopf|kopf|KJcy|kjcy|KHcy|khcy|DZcy|ecir|edot|eDot|Jscr|jscr|succ|Jopf|jopf|Edot|uHar|emsp|ensp|Iuml|iuml|eopf|isin|Iscr|iscr|Eopf|epar|sung|epsi|escr|sup1|sup2|sup3|Iota|iota|supe|supE|Iopf|iopf|IOcy|iocy|Escr|esim|Esim|imof|Uarr|QUOT|uArr|uarr|euml|IEcy|iecy|Idot|Euml|euro|excl|Hscr|hscr|Hopf|hopf|TScy|tscy|Tscr|hbar|tscr|flat|tbrk|fnof|hArr|harr|half|fopf|Fopf|tdot|gvnE|fork|trie|gtcc|fscr|Fscr|gdot|gsim|Gscr|gscr|Gopf|gopf|gneq|Gdot|tosa|gnap|Topf|topf|geqq|toea|GJcy|gjcy|tint|gesl|mid|Sfr|ggg|top|ges|gla|glE|glj|geq|gne|gEl|gel|gnE|Gcy|gcy|gap|Tfr|tfr|Tcy|tcy|Hat|Tau|Ffr|tau|Tab|hfr|Hfr|ffr|Fcy|fcy|icy|Icy|iff|ETH|eth|ifr|Ifr|Eta|eta|int|Int|Sup|sup|ucy|Ucy|Sum|sum|jcy|ENG|ufr|Ufr|eng|Jcy|jfr|els|ell|egs|Efr|efr|Jfr|uml|kcy|Kcy|Ecy|ecy|kfr|Kfr|lap|Sub|sub|lat|lcy|Lcy|leg|Dot|dot|lEg|leq|les|squ|div|die|lfr|Lfr|lgE|Dfr|dfr|Del|deg|Dcy|dcy|lne|lnE|sol|loz|smt|Cup|lrm|cup|lsh|Lsh|sim|shy|map|Map|mcy|Mcy|mfr|Mfr|mho|gfr|Gfr|sfr|cir|Chi|chi|nap|Cfr|vcy|Vcy|cfr|Scy|scy|ncy|Ncy|vee|Vee|Cap|cap|nfr|scE|sce|Nfr|nge|ngE|nGg|vfr|Vfr|ngt|bot|nGt|nis|niv|Rsh|rsh|nle|nlE|bne|Bfr|bfr|nLl|nlt|nLt|Bcy|bcy|not|Not|rlm|wfr|Wfr|npr|nsc|num|ocy|ast|Ocy|ofr|xfr|Xfr|Ofr|ogt|ohm|apE|olt|Rho|ape|rho|Rfr|rfr|ord|REG|ang|reg|orv|And|and|AMP|Rcy|amp|Afr|ycy|Ycy|yen|yfr|Yfr|rcy|par|pcy|Pcy|pfr|Pfr|phi|Phi|afr|Acy|acy|zcy|Zcy|piv|acE|acd|zfr|Zfr|pre|prE|psi|Psi|qfr|Qfr|zwj|Or|ge|Gg|gt|gg|el|oS|lt|Lt|LT|Re|lg|gl|eg|ne|Im|it|le|DD|wp|wr|nu|Nu|dd|lE|Sc|sc|pi|Pi|ee|af|ll|Ll|rx|gE|xi|pm|Xi|ic|pr|Pr|in|ni|mp|mu|ac|Mu|or|ap|Gt|GT|ii);|&(Aacute|Agrave|Atilde|Ccedil|Eacute|Egrave|Iacute|Igrave|Ntilde|Oacute|Ograve|Oslash|Otilde|Uacute|Ugrave|Yacute|aacute|agrave|atilde|brvbar|ccedil|curren|divide|eacute|egrave|frac12|frac14|frac34|iacute|igrave|iquest|middot|ntilde|oacute|ograve|oslash|otilde|plusmn|uacute|ugrave|yacute|AElig|Acirc|Aring|Ecirc|Icirc|Ocirc|THORN|Ucirc|acirc|acute|aelig|aring|cedil|ecirc|icirc|iexcl|laquo|micro|ocirc|pound|raquo|szlig|thorn|times|ucirc|Auml|COPY|Euml|Iuml|Ouml|QUOT|Uuml|auml|cent|copy|euml|iuml|macr|nbsp|ordf|ordm|ouml|para|quot|sect|sup1|sup2|sup3|uuml|yuml|AMP|ETH|REG|amp|deg|eth|not|reg|shy|uml|yen|GT|LT|gt|lt)(?!;)([=a-zA-Z0-9]?)|&#([0-9]+)(;?)|&#[xX]([a-fA-F0-9]+)(;?)|&([0-9a-zA-Z]+)/g;
  11544. var decodeMap = {'aacute':'\xE1','Aacute':'\xC1','abreve':'\u0103','Abreve':'\u0102','ac':'\u223E','acd':'\u223F','acE':'\u223E\u0333','acirc':'\xE2','Acirc':'\xC2','acute':'\xB4','acy':'\u0430','Acy':'\u0410','aelig':'\xE6','AElig':'\xC6','af':'\u2061','afr':'\uD835\uDD1E','Afr':'\uD835\uDD04','agrave':'\xE0','Agrave':'\xC0','alefsym':'\u2135','aleph':'\u2135','alpha':'\u03B1','Alpha':'\u0391','amacr':'\u0101','Amacr':'\u0100','amalg':'\u2A3F','amp':'&','AMP':'&','and':'\u2227','And':'\u2A53','andand':'\u2A55','andd':'\u2A5C','andslope':'\u2A58','andv':'\u2A5A','ang':'\u2220','ange':'\u29A4','angle':'\u2220','angmsd':'\u2221','angmsdaa':'\u29A8','angmsdab':'\u29A9','angmsdac':'\u29AA','angmsdad':'\u29AB','angmsdae':'\u29AC','angmsdaf':'\u29AD','angmsdag':'\u29AE','angmsdah':'\u29AF','angrt':'\u221F','angrtvb':'\u22BE','angrtvbd':'\u299D','angsph':'\u2222','angst':'\xC5','angzarr':'\u237C','aogon':'\u0105','Aogon':'\u0104','aopf':'\uD835\uDD52','Aopf':'\uD835\uDD38','ap':'\u2248','apacir':'\u2A6F','ape':'\u224A','apE':'\u2A70','apid':'\u224B','apos':'\'','ApplyFunction':'\u2061','approx':'\u2248','approxeq':'\u224A','aring':'\xE5','Aring':'\xC5','ascr':'\uD835\uDCB6','Ascr':'\uD835\uDC9C','Assign':'\u2254','ast':'*','asymp':'\u2248','asympeq':'\u224D','atilde':'\xE3','Atilde':'\xC3','auml':'\xE4','Auml':'\xC4','awconint':'\u2233','awint':'\u2A11','backcong':'\u224C','backepsilon':'\u03F6','backprime':'\u2035','backsim':'\u223D','backsimeq':'\u22CD','Backslash':'\u2216','Barv':'\u2AE7','barvee':'\u22BD','barwed':'\u2305','Barwed':'\u2306','barwedge':'\u2305','bbrk':'\u23B5','bbrktbrk':'\u23B6','bcong':'\u224C','bcy':'\u0431','Bcy':'\u0411','bdquo':'\u201E','becaus':'\u2235','because':'\u2235','Because':'\u2235','bemptyv':'\u29B0','bepsi':'\u03F6','bernou':'\u212C','Bernoullis':'\u212C','beta':'\u03B2','Beta':'\u0392','beth':'\u2136','between':'\u226C','bfr':'\uD835\uDD1F','Bfr':'\uD835\uDD05','bigcap':'\u22C2','bigcirc':'\u25EF','bigcup':'\u22C3','bigodot':'\u2A00','bigoplus':'\u2A01','bigotimes':'\u2A02','bigsqcup':'\u2A06','bigstar':'\u2605','bigtriangledown':'\u25BD','bigtriangleup':'\u25B3','biguplus':'\u2A04','bigvee':'\u22C1','bigwedge':'\u22C0','bkarow':'\u290D','blacklozenge':'\u29EB','blacksquare':'\u25AA','blacktriangle':'\u25B4','blacktriangledown':'\u25BE','blacktriangleleft':'\u25C2','blacktriangleright':'\u25B8','blank':'\u2423','blk12':'\u2592','blk14':'\u2591','blk34':'\u2593','block':'\u2588','bne':'=\u20E5','bnequiv':'\u2261\u20E5','bnot':'\u2310','bNot':'\u2AED','bopf':'\uD835\uDD53','Bopf':'\uD835\uDD39','bot':'\u22A5','bottom':'\u22A5','bowtie':'\u22C8','boxbox':'\u29C9','boxdl':'\u2510','boxdL':'\u2555','boxDl':'\u2556','boxDL':'\u2557','boxdr':'\u250C','boxdR':'\u2552','boxDr':'\u2553','boxDR':'\u2554','boxh':'\u2500','boxH':'\u2550','boxhd':'\u252C','boxhD':'\u2565','boxHd':'\u2564','boxHD':'\u2566','boxhu':'\u2534','boxhU':'\u2568','boxHu':'\u2567','boxHU':'\u2569','boxminus':'\u229F','boxplus':'\u229E','boxtimes':'\u22A0','boxul':'\u2518','boxuL':'\u255B','boxUl':'\u255C','boxUL':'\u255D','boxur':'\u2514','boxuR':'\u2558','boxUr':'\u2559','boxUR':'\u255A','boxv':'\u2502','boxV':'\u2551','boxvh':'\u253C','boxvH':'\u256A','boxVh':'\u256B','boxVH':'\u256C','boxvl':'\u2524','boxvL':'\u2561','boxVl':'\u2562','boxVL':'\u2563','boxvr':'\u251C','boxvR':'\u255E','boxVr':'\u255F','boxVR':'\u2560','bprime':'\u2035','breve':'\u02D8','Breve':'\u02D8','brvbar':'\xA6','bscr':'\uD835\uDCB7','Bscr':'\u212C','bsemi':'\u204F','bsim':'\u223D','bsime':'\u22CD','bsol':'\\','bsolb':'\u29C5','bsolhsub':'\u27C8','bull':'\u2022','bullet':'\u2022','bump':'\u224E','bumpe':'\u224F','bumpE':'\u2AAE','bumpeq':'\u224F','Bumpeq':'\u224E','cacute':'\u0107','Cacute':'\u0106','cap':'\u2229','Cap':'\u22D2','capand':'\u2A44','capbrcup':'\u2A49','capcap':'\u2A4B','capcup':'\u2A47','capdot':'\u2A40','CapitalDifferentialD':'\u2145','caps':'\u2229\uFE00','caret':'\u2041','caron':'\u02C7','Cayleys':'\u212D','ccaps':'\u2A4D','ccaron':'\u010D','Ccaron':'\u010C','ccedil':'\xE7','Ccedil':'\xC7','ccirc':'\u0109','Ccirc':'\u0108','Cconint':'\u2230','ccups':'\u2A4C','ccupssm':'\u2A50','cdot':'\u010B','Cdot':'\u010A','cedil':'\xB8','Cedilla':'\xB8','cemptyv':'\u29B2','cent':'\xA2','centerdot':'\xB7','CenterDot':'\xB7','cfr':'\uD835\uDD20','Cfr':'\u212D','chcy':'\u0447','CHcy':'\u0427','check':'\u2713','checkmark':'\u2713','chi':'\u03C7','Chi':'\u03A7','cir':'\u25CB','circ':'\u02C6','circeq':'\u2257','circlearrowleft':'\u21BA','circlearrowright':'\u21BB','circledast':'\u229B','circledcirc':'\u229A','circleddash':'\u229D','CircleDot':'\u2299','circledR':'\xAE','circledS':'\u24C8','CircleMinus':'\u2296','CirclePlus':'\u2295','CircleTimes':'\u2297','cire':'\u2257','cirE':'\u29C3','cirfnint':'\u2A10','cirmid':'\u2AEF','cirscir':'\u29C2','ClockwiseContourIntegral':'\u2232','CloseCurlyDoubleQuote':'\u201D','CloseCurlyQuote':'\u2019','clubs':'\u2663','clubsuit':'\u2663','colon':':','Colon':'\u2237','colone':'\u2254','Colone':'\u2A74','coloneq':'\u2254','comma':',','commat':'@','comp':'\u2201','compfn':'\u2218','complement':'\u2201','complexes':'\u2102','cong':'\u2245','congdot':'\u2A6D','Congruent':'\u2261','conint':'\u222E','Conint':'\u222F','ContourIntegral':'\u222E','copf':'\uD835\uDD54','Copf':'\u2102','coprod':'\u2210','Coproduct':'\u2210','copy':'\xA9','COPY':'\xA9','copysr':'\u2117','CounterClockwiseContourIntegral':'\u2233','crarr':'\u21B5','cross':'\u2717','Cross':'\u2A2F','cscr':'\uD835\uDCB8','Cscr':'\uD835\uDC9E','csub':'\u2ACF','csube':'\u2AD1','csup':'\u2AD0','csupe':'\u2AD2','ctdot':'\u22EF','cudarrl':'\u2938','cudarrr':'\u2935','cuepr':'\u22DE','cuesc':'\u22DF','cularr':'\u21B6','cularrp':'\u293D','cup':'\u222A','Cup':'\u22D3','cupbrcap':'\u2A48','cupcap':'\u2A46','CupCap':'\u224D','cupcup':'\u2A4A','cupdot':'\u228D','cupor':'\u2A45','cups':'\u222A\uFE00','curarr':'\u21B7','curarrm':'\u293C','curlyeqprec':'\u22DE','curlyeqsucc':'\u22DF','curlyvee':'\u22CE','curlywedge':'\u22CF','curren':'\xA4','curvearrowleft':'\u21B6','curvearrowright':'\u21B7','cuvee':'\u22CE','cuwed':'\u22CF','cwconint':'\u2232','cwint':'\u2231','cylcty':'\u232D','dagger':'\u2020','Dagger':'\u2021','daleth':'\u2138','darr':'\u2193','dArr':'\u21D3','Darr':'\u21A1','dash':'\u2010','dashv':'\u22A3','Dashv':'\u2AE4','dbkarow':'\u290F','dblac':'\u02DD','dcaron':'\u010F','Dcaron':'\u010E','dcy':'\u0434','Dcy':'\u0414','dd':'\u2146','DD':'\u2145','ddagger':'\u2021','ddarr':'\u21CA','DDotrahd':'\u2911','ddotseq':'\u2A77','deg':'\xB0','Del':'\u2207','delta':'\u03B4','Delta':'\u0394','demptyv':'\u29B1','dfisht':'\u297F','dfr':'\uD835\uDD21','Dfr':'\uD835\uDD07','dHar':'\u2965','dharl':'\u21C3','dharr':'\u21C2','DiacriticalAcute':'\xB4','DiacriticalDot':'\u02D9','DiacriticalDoubleAcute':'\u02DD','DiacriticalGrave':'`','DiacriticalTilde':'\u02DC','diam':'\u22C4','diamond':'\u22C4','Diamond':'\u22C4','diamondsuit':'\u2666','diams':'\u2666','die':'\xA8','DifferentialD':'\u2146','digamma':'\u03DD','disin':'\u22F2','div':'\xF7','divide':'\xF7','divideontimes':'\u22C7','divonx':'\u22C7','djcy':'\u0452','DJcy':'\u0402','dlcorn':'\u231E','dlcrop':'\u230D','dollar':'$','dopf':'\uD835\uDD55','Dopf':'\uD835\uDD3B','dot':'\u02D9','Dot':'\xA8','DotDot':'\u20DC','doteq':'\u2250','doteqdot':'\u2251','DotEqual':'\u2250','dotminus':'\u2238','dotplus':'\u2214','dotsquare':'\u22A1','doublebarwedge':'\u2306','DoubleContourIntegral':'\u222F','DoubleDot':'\xA8','DoubleDownArrow':'\u21D3','DoubleLeftArrow':'\u21D0','DoubleLeftRightArrow':'\u21D4','DoubleLeftTee':'\u2AE4','DoubleLongLeftArrow':'\u27F8','DoubleLongLeftRightArrow':'\u27FA','DoubleLongRightArrow':'\u27F9','DoubleRightArrow':'\u21D2','DoubleRightTee':'\u22A8','DoubleUpArrow':'\u21D1','DoubleUpDownArrow':'\u21D5','DoubleVerticalBar':'\u2225','downarrow':'\u2193','Downarrow':'\u21D3','DownArrow':'\u2193','DownArrowBar':'\u2913','DownArrowUpArrow':'\u21F5','DownBreve':'\u0311','downdownarrows':'\u21CA','downharpoonleft':'\u21C3','downharpoonright':'\u21C2','DownLeftRightVector':'\u2950','DownLeftTeeVector':'\u295E','DownLeftVector':'\u21BD','DownLeftVectorBar':'\u2956','DownRightTeeVector':'\u295F','DownRightVector':'\u21C1','DownRightVectorBar':'\u2957','DownTee':'\u22A4','DownTeeArrow':'\u21A7','drbkarow':'\u2910','drcorn':'\u231F','drcrop':'\u230C','dscr':'\uD835\uDCB9','Dscr':'\uD835\uDC9F','dscy':'\u0455','DScy':'\u0405','dsol':'\u29F6','dstrok':'\u0111','Dstrok':'\u0110','dtdot':'\u22F1','dtri':'\u25BF','dtrif':'\u25BE','duarr':'\u21F5','duhar':'\u296F','dwangle':'\u29A6','dzcy':'\u045F','DZcy':'\u040F','dzigrarr':'\u27FF','eacute':'\xE9','Eacute':'\xC9','easter':'\u2A6E','ecaron':'\u011B','Ecaron':'\u011A','ecir':'\u2256','ecirc':'\xEA','Ecirc':'\xCA','ecolon':'\u2255','ecy':'\u044D','Ecy':'\u042D','eDDot':'\u2A77','edot':'\u0117','eDot':'\u2251','Edot':'\u0116','ee':'\u2147','efDot':'\u2252','efr':'\uD835\uDD22','Efr':'\uD835\uDD08','eg':'\u2A9A','egrave':'\xE8','Egrave':'\xC8','egs':'\u2A96','egsdot':'\u2A98','el':'\u2A99','Element':'\u2208','elinters':'\u23E7','ell':'\u2113','els':'\u2A95','elsdot':'\u2A97','emacr':'\u0113','Emacr':'\u0112','empty':'\u2205','emptyset':'\u2205','EmptySmallSquare':'\u25FB','emptyv':'\u2205','EmptyVerySmallSquare':'\u25AB','emsp':'\u2003','emsp13':'\u2004','emsp14':'\u2005','eng':'\u014B','ENG':'\u014A','ensp':'\u2002','eogon':'\u0119','Eogon':'\u0118','eopf':'\uD835\uDD56','Eopf':'\uD835\uDD3C','epar':'\u22D5','eparsl':'\u29E3','eplus':'\u2A71','epsi':'\u03B5','epsilon':'\u03B5','Epsilon':'\u0395','epsiv':'\u03F5','eqcirc':'\u2256','eqcolon':'\u2255','eqsim':'\u2242','eqslantgtr':'\u2A96','eqslantless':'\u2A95','Equal':'\u2A75','equals':'=','EqualTilde':'\u2242','equest':'\u225F','Equilibrium':'\u21CC','equiv':'\u2261','equivDD':'\u2A78','eqvparsl':'\u29E5','erarr':'\u2971','erDot':'\u2253','escr':'\u212F','Escr':'\u2130','esdot':'\u2250','esim':'\u2242','Esim':'\u2A73','eta':'\u03B7','Eta':'\u0397','eth':'\xF0','ETH':'\xD0','euml':'\xEB','Euml':'\xCB','euro':'\u20AC','excl':'!','exist':'\u2203','Exists':'\u2203','expectation':'\u2130','exponentiale':'\u2147','ExponentialE':'\u2147','fallingdotseq':'\u2252','fcy':'\u0444','Fcy':'\u0424','female':'\u2640','ffilig':'\uFB03','fflig':'\uFB00','ffllig':'\uFB04','ffr':'\uD835\uDD23','Ffr':'\uD835\uDD09','filig':'\uFB01','FilledSmallSquare':'\u25FC','FilledVerySmallSquare':'\u25AA','fjlig':'fj','flat':'\u266D','fllig':'\uFB02','fltns':'\u25B1','fnof':'\u0192','fopf':'\uD835\uDD57','Fopf':'\uD835\uDD3D','forall':'\u2200','ForAll':'\u2200','fork':'\u22D4','forkv':'\u2AD9','Fouriertrf':'\u2131','fpartint':'\u2A0D','frac12':'\xBD','frac13':'\u2153','frac14':'\xBC','frac15':'\u2155','frac16':'\u2159','frac18':'\u215B','frac23':'\u2154','frac25':'\u2156','frac34':'\xBE','frac35':'\u2157','frac38':'\u215C','frac45':'\u2158','frac56':'\u215A','frac58':'\u215D','frac78':'\u215E','frasl':'\u2044','frown':'\u2322','fscr':'\uD835\uDCBB','Fscr':'\u2131','gacute':'\u01F5','gamma':'\u03B3','Gamma':'\u0393','gammad':'\u03DD','Gammad':'\u03DC','gap':'\u2A86','gbreve':'\u011F','Gbreve':'\u011E','Gcedil':'\u0122','gcirc':'\u011D','Gcirc':'\u011C','gcy':'\u0433','Gcy':'\u0413','gdot':'\u0121','Gdot':'\u0120','ge':'\u2265','gE':'\u2267','gel':'\u22DB','gEl':'\u2A8C','geq':'\u2265','geqq':'\u2267','geqslant':'\u2A7E','ges':'\u2A7E','gescc':'\u2AA9','gesdot':'\u2A80','gesdoto':'\u2A82','gesdotol':'\u2A84','gesl':'\u22DB\uFE00','gesles':'\u2A94','gfr':'\uD835\uDD24','Gfr':'\uD835\uDD0A','gg':'\u226B','Gg':'\u22D9','ggg':'\u22D9','gimel':'\u2137','gjcy':'\u0453','GJcy':'\u0403','gl':'\u2277','gla':'\u2AA5','glE':'\u2A92','glj':'\u2AA4','gnap':'\u2A8A','gnapprox':'\u2A8A','gne':'\u2A88','gnE':'\u2269','gneq':'\u2A88','gneqq':'\u2269','gnsim':'\u22E7','gopf':'\uD835\uDD58','Gopf':'\uD835\uDD3E','grave':'`','GreaterEqual':'\u2265','GreaterEqualLess':'\u22DB','GreaterFullEqual':'\u2267','GreaterGreater':'\u2AA2','GreaterLess':'\u2277','GreaterSlantEqual':'\u2A7E','GreaterTilde':'\u2273','gscr':'\u210A','Gscr':'\uD835\uDCA2','gsim':'\u2273','gsime':'\u2A8E','gsiml':'\u2A90','gt':'>','Gt':'\u226B','GT':'>','gtcc':'\u2AA7','gtcir':'\u2A7A','gtdot':'\u22D7','gtlPar':'\u2995','gtquest':'\u2A7C','gtrapprox':'\u2A86','gtrarr':'\u2978','gtrdot':'\u22D7','gtreqless':'\u22DB','gtreqqless':'\u2A8C','gtrless':'\u2277','gtrsim':'\u2273','gvertneqq':'\u2269\uFE00','gvnE':'\u2269\uFE00','Hacek':'\u02C7','hairsp':'\u200A','half':'\xBD','hamilt':'\u210B','hardcy':'\u044A','HARDcy':'\u042A','harr':'\u2194','hArr':'\u21D4','harrcir':'\u2948','harrw':'\u21AD','Hat':'^','hbar':'\u210F','hcirc':'\u0125','Hcirc':'\u0124','hearts':'\u2665','heartsuit':'\u2665','hellip':'\u2026','hercon':'\u22B9','hfr':'\uD835\uDD25','Hfr':'\u210C','HilbertSpace':'\u210B','hksearow':'\u2925','hkswarow':'\u2926','hoarr':'\u21FF','homtht':'\u223B','hookleftarrow':'\u21A9','hookrightarrow':'\u21AA','hopf':'\uD835\uDD59','Hopf':'\u210D','horbar':'\u2015','HorizontalLine':'\u2500','hscr':'\uD835\uDCBD','Hscr':'\u210B','hslash':'\u210F','hstrok':'\u0127','Hstrok':'\u0126','HumpDownHump':'\u224E','HumpEqual':'\u224F','hybull':'\u2043','hyphen':'\u2010','iacute':'\xED','Iacute':'\xCD','ic':'\u2063','icirc':'\xEE','Icirc':'\xCE','icy':'\u0438','Icy':'\u0418','Idot':'\u0130','iecy':'\u0435','IEcy':'\u0415','iexcl':'\xA1','iff':'\u21D4','ifr':'\uD835\uDD26','Ifr':'\u2111','igrave':'\xEC','Igrave':'\xCC','ii':'\u2148','iiiint':'\u2A0C','iiint':'\u222D','iinfin':'\u29DC','iiota':'\u2129','ijlig':'\u0133','IJlig':'\u0132','Im':'\u2111','imacr':'\u012B','Imacr':'\u012A','image':'\u2111','ImaginaryI':'\u2148','imagline':'\u2110','imagpart':'\u2111','imath':'\u0131','imof':'\u22B7','imped':'\u01B5','Implies':'\u21D2','in':'\u2208','incare':'\u2105','infin':'\u221E','infintie':'\u29DD','inodot':'\u0131','int':'\u222B','Int':'\u222C','intcal':'\u22BA','integers':'\u2124','Integral':'\u222B','intercal':'\u22BA','Intersection':'\u22C2','intlarhk':'\u2A17','intprod':'\u2A3C','InvisibleComma':'\u2063','InvisibleTimes':'\u2062','iocy':'\u0451','IOcy':'\u0401','iogon':'\u012F','Iogon':'\u012E','iopf':'\uD835\uDD5A','Iopf':'\uD835\uDD40','iota':'\u03B9','Iota':'\u0399','iprod':'\u2A3C','iquest':'\xBF','iscr':'\uD835\uDCBE','Iscr':'\u2110','isin':'\u2208','isindot':'\u22F5','isinE':'\u22F9','isins':'\u22F4','isinsv':'\u22F3','isinv':'\u2208','it':'\u2062','itilde':'\u0129','Itilde':'\u0128','iukcy':'\u0456','Iukcy':'\u0406','iuml':'\xEF','Iuml':'\xCF','jcirc':'\u0135','Jcirc':'\u0134','jcy':'\u0439','Jcy':'\u0419','jfr':'\uD835\uDD27','Jfr':'\uD835\uDD0D','jmath':'\u0237','jopf':'\uD835\uDD5B','Jopf':'\uD835\uDD41','jscr':'\uD835\uDCBF','Jscr':'\uD835\uDCA5','jsercy':'\u0458','Jsercy':'\u0408','jukcy':'\u0454','Jukcy':'\u0404','kappa':'\u03BA','Kappa':'\u039A','kappav':'\u03F0','kcedil':'\u0137','Kcedil':'\u0136','kcy':'\u043A','Kcy':'\u041A','kfr':'\uD835\uDD28','Kfr':'\uD835\uDD0E','kgreen':'\u0138','khcy':'\u0445','KHcy':'\u0425','kjcy':'\u045C','KJcy':'\u040C','kopf':'\uD835\uDD5C','Kopf':'\uD835\uDD42','kscr':'\uD835\uDCC0','Kscr':'\uD835\uDCA6','lAarr':'\u21DA','lacute':'\u013A','Lacute':'\u0139','laemptyv':'\u29B4','lagran':'\u2112','lambda':'\u03BB','Lambda':'\u039B','lang':'\u27E8','Lang':'\u27EA','langd':'\u2991','langle':'\u27E8','lap':'\u2A85','Laplacetrf':'\u2112','laquo':'\xAB','larr':'\u2190','lArr':'\u21D0','Larr':'\u219E','larrb':'\u21E4','larrbfs':'\u291F','larrfs':'\u291D','larrhk':'\u21A9','larrlp':'\u21AB','larrpl':'\u2939','larrsim':'\u2973','larrtl':'\u21A2','lat':'\u2AAB','latail':'\u2919','lAtail':'\u291B','late':'\u2AAD','lates':'\u2AAD\uFE00','lbarr':'\u290C','lBarr':'\u290E','lbbrk':'\u2772','lbrace':'{','lbrack':'[','lbrke':'\u298B','lbrksld':'\u298F','lbrkslu':'\u298D','lcaron':'\u013E','Lcaron':'\u013D','lcedil':'\u013C','Lcedil':'\u013B','lceil':'\u2308','lcub':'{','lcy':'\u043B','Lcy':'\u041B','ldca':'\u2936','ldquo':'\u201C','ldquor':'\u201E','ldrdhar':'\u2967','ldrushar':'\u294B','ldsh':'\u21B2','le':'\u2264','lE':'\u2266','LeftAngleBracket':'\u27E8','leftarrow':'\u2190','Leftarrow':'\u21D0','LeftArrow':'\u2190','LeftArrowBar':'\u21E4','LeftArrowRightArrow':'\u21C6','leftarrowtail':'\u21A2','LeftCeiling':'\u2308','LeftDoubleBracket':'\u27E6','LeftDownTeeVector':'\u2961','LeftDownVector':'\u21C3','LeftDownVectorBar':'\u2959','LeftFloor':'\u230A','leftharpoondown':'\u21BD','leftharpoonup':'\u21BC','leftleftarrows':'\u21C7','leftrightarrow':'\u2194','Leftrightarrow':'\u21D4','LeftRightArrow':'\u2194','leftrightarrows':'\u21C6','leftrightharpoons':'\u21CB','leftrightsquigarrow':'\u21AD','LeftRightVector':'\u294E','LeftTee':'\u22A3','LeftTeeArrow':'\u21A4','LeftTeeVector':'\u295A','leftthreetimes':'\u22CB','LeftTriangle':'\u22B2','LeftTriangleBar':'\u29CF','LeftTriangleEqual':'\u22B4','LeftUpDownVector':'\u2951','LeftUpTeeVector':'\u2960','LeftUpVector':'\u21BF','LeftUpVectorBar':'\u2958','LeftVector':'\u21BC','LeftVectorBar':'\u2952','leg':'\u22DA','lEg':'\u2A8B','leq':'\u2264','leqq':'\u2266','leqslant':'\u2A7D','les':'\u2A7D','lescc':'\u2AA8','lesdot':'\u2A7F','lesdoto':'\u2A81','lesdotor':'\u2A83','lesg':'\u22DA\uFE00','lesges':'\u2A93','lessapprox':'\u2A85','lessdot':'\u22D6','lesseqgtr':'\u22DA','lesseqqgtr':'\u2A8B','LessEqualGreater':'\u22DA','LessFullEqual':'\u2266','LessGreater':'\u2276','lessgtr':'\u2276','LessLess':'\u2AA1','lesssim':'\u2272','LessSlantEqual':'\u2A7D','LessTilde':'\u2272','lfisht':'\u297C','lfloor':'\u230A','lfr':'\uD835\uDD29','Lfr':'\uD835\uDD0F','lg':'\u2276','lgE':'\u2A91','lHar':'\u2962','lhard':'\u21BD','lharu':'\u21BC','lharul':'\u296A','lhblk':'\u2584','ljcy':'\u0459','LJcy':'\u0409','ll':'\u226A','Ll':'\u22D8','llarr':'\u21C7','llcorner':'\u231E','Lleftarrow':'\u21DA','llhard':'\u296B','lltri':'\u25FA','lmidot':'\u0140','Lmidot':'\u013F','lmoust':'\u23B0','lmoustache':'\u23B0','lnap':'\u2A89','lnapprox':'\u2A89','lne':'\u2A87','lnE':'\u2268','lneq':'\u2A87','lneqq':'\u2268','lnsim':'\u22E6','loang':'\u27EC','loarr':'\u21FD','lobrk':'\u27E6','longleftarrow':'\u27F5','Longleftarrow':'\u27F8','LongLeftArrow':'\u27F5','longleftrightarrow':'\u27F7','Longleftrightarrow':'\u27FA','LongLeftRightArrow':'\u27F7','longmapsto':'\u27FC','longrightarrow':'\u27F6','Longrightarrow':'\u27F9','LongRightArrow':'\u27F6','looparrowleft':'\u21AB','looparrowright':'\u21AC','lopar':'\u2985','lopf':'\uD835\uDD5D','Lopf':'\uD835\uDD43','loplus':'\u2A2D','lotimes':'\u2A34','lowast':'\u2217','lowbar':'_','LowerLeftArrow':'\u2199','LowerRightArrow':'\u2198','loz':'\u25CA','lozenge':'\u25CA','lozf':'\u29EB','lpar':'(','lparlt':'\u2993','lrarr':'\u21C6','lrcorner':'\u231F','lrhar':'\u21CB','lrhard':'\u296D','lrm':'\u200E','lrtri':'\u22BF','lsaquo':'\u2039','lscr':'\uD835\uDCC1','Lscr':'\u2112','lsh':'\u21B0','Lsh':'\u21B0','lsim':'\u2272','lsime':'\u2A8D','lsimg':'\u2A8F','lsqb':'[','lsquo':'\u2018','lsquor':'\u201A','lstrok':'\u0142','Lstrok':'\u0141','lt':'<','Lt':'\u226A','LT':'<','ltcc':'\u2AA6','ltcir':'\u2A79','ltdot':'\u22D6','lthree':'\u22CB','ltimes':'\u22C9','ltlarr':'\u2976','ltquest':'\u2A7B','ltri':'\u25C3','ltrie':'\u22B4','ltrif':'\u25C2','ltrPar':'\u2996','lurdshar':'\u294A','luruhar':'\u2966','lvertneqq':'\u2268\uFE00','lvnE':'\u2268\uFE00','macr':'\xAF','male':'\u2642','malt':'\u2720','maltese':'\u2720','map':'\u21A6','Map':'\u2905','mapsto':'\u21A6','mapstodown':'\u21A7','mapstoleft':'\u21A4','mapstoup':'\u21A5','marker':'\u25AE','mcomma':'\u2A29','mcy':'\u043C','Mcy':'\u041C','mdash':'\u2014','mDDot':'\u223A','measuredangle':'\u2221','MediumSpace':'\u205F','Mellintrf':'\u2133','mfr':'\uD835\uDD2A','Mfr':'\uD835\uDD10','mho':'\u2127','micro':'\xB5','mid':'\u2223','midast':'*','midcir':'\u2AF0','middot':'\xB7','minus':'\u2212','minusb':'\u229F','minusd':'\u2238','minusdu':'\u2A2A','MinusPlus':'\u2213','mlcp':'\u2ADB','mldr':'\u2026','mnplus':'\u2213','models':'\u22A7','mopf':'\uD835\uDD5E','Mopf':'\uD835\uDD44','mp':'\u2213','mscr':'\uD835\uDCC2','Mscr':'\u2133','mstpos':'\u223E','mu':'\u03BC','Mu':'\u039C','multimap':'\u22B8','mumap':'\u22B8','nabla':'\u2207','nacute':'\u0144','Nacute':'\u0143','nang':'\u2220\u20D2','nap':'\u2249','napE':'\u2A70\u0338','napid':'\u224B\u0338','napos':'\u0149','napprox':'\u2249','natur':'\u266E','natural':'\u266E','naturals':'\u2115','nbsp':'\xA0','nbump':'\u224E\u0338','nbumpe':'\u224F\u0338','ncap':'\u2A43','ncaron':'\u0148','Ncaron':'\u0147','ncedil':'\u0146','Ncedil':'\u0145','ncong':'\u2247','ncongdot':'\u2A6D\u0338','ncup':'\u2A42','ncy':'\u043D','Ncy':'\u041D','ndash':'\u2013','ne':'\u2260','nearhk':'\u2924','nearr':'\u2197','neArr':'\u21D7','nearrow':'\u2197','nedot':'\u2250\u0338','NegativeMediumSpace':'\u200B','NegativeThickSpace':'\u200B','NegativeThinSpace':'\u200B','NegativeVeryThinSpace':'\u200B','nequiv':'\u2262','nesear':'\u2928','nesim':'\u2242\u0338','NestedGreaterGreater':'\u226B','NestedLessLess':'\u226A','NewLine':'\n','nexist':'\u2204','nexists':'\u2204','nfr':'\uD835\uDD2B','Nfr':'\uD835\uDD11','nge':'\u2271','ngE':'\u2267\u0338','ngeq':'\u2271','ngeqq':'\u2267\u0338','ngeqslant':'\u2A7E\u0338','nges':'\u2A7E\u0338','nGg':'\u22D9\u0338','ngsim':'\u2275','ngt':'\u226F','nGt':'\u226B\u20D2','ngtr':'\u226F','nGtv':'\u226B\u0338','nharr':'\u21AE','nhArr':'\u21CE','nhpar':'\u2AF2','ni':'\u220B','nis':'\u22FC','nisd':'\u22FA','niv':'\u220B','njcy':'\u045A','NJcy':'\u040A','nlarr':'\u219A','nlArr':'\u21CD','nldr':'\u2025','nle':'\u2270','nlE':'\u2266\u0338','nleftarrow':'\u219A','nLeftarrow':'\u21CD','nleftrightarrow':'\u21AE','nLeftrightarrow':'\u21CE','nleq':'\u2270','nleqq':'\u2266\u0338','nleqslant':'\u2A7D\u0338','nles':'\u2A7D\u0338','nless':'\u226E','nLl':'\u22D8\u0338','nlsim':'\u2274','nlt':'\u226E','nLt':'\u226A\u20D2','nltri':'\u22EA','nltrie':'\u22EC','nLtv':'\u226A\u0338','nmid':'\u2224','NoBreak':'\u2060','NonBreakingSpace':'\xA0','nopf':'\uD835\uDD5F','Nopf':'\u2115','not':'\xAC','Not':'\u2AEC','NotCongruent':'\u2262','NotCupCap':'\u226D','NotDoubleVerticalBar':'\u2226','NotElement':'\u2209','NotEqual':'\u2260','NotEqualTilde':'\u2242\u0338','NotExists':'\u2204','NotGreater':'\u226F','NotGreaterEqual':'\u2271','NotGreaterFullEqual':'\u2267\u0338','NotGreaterGreater':'\u226B\u0338','NotGreaterLess':'\u2279','NotGreaterSlantEqual':'\u2A7E\u0338','NotGreaterTilde':'\u2275','NotHumpDownHump':'\u224E\u0338','NotHumpEqual':'\u224F\u0338','notin':'\u2209','notindot':'\u22F5\u0338','notinE':'\u22F9\u0338','notinva':'\u2209','notinvb':'\u22F7','notinvc':'\u22F6','NotLeftTriangle':'\u22EA','NotLeftTriangleBar':'\u29CF\u0338','NotLeftTriangleEqual':'\u22EC','NotLess':'\u226E','NotLessEqual':'\u2270','NotLessGreater':'\u2278','NotLessLess':'\u226A\u0338','NotLessSlantEqual':'\u2A7D\u0338','NotLessTilde':'\u2274','NotNestedGreaterGreater':'\u2AA2\u0338','NotNestedLessLess':'\u2AA1\u0338','notni':'\u220C','notniva':'\u220C','notnivb':'\u22FE','notnivc':'\u22FD','NotPrecedes':'\u2280','NotPrecedesEqual':'\u2AAF\u0338','NotPrecedesSlantEqual':'\u22E0','NotReverseElement':'\u220C','NotRightTriangle':'\u22EB','NotRightTriangleBar':'\u29D0\u0338','NotRightTriangleEqual':'\u22ED','NotSquareSubset':'\u228F\u0338','NotSquareSubsetEqual':'\u22E2','NotSquareSuperset':'\u2290\u0338','NotSquareSupersetEqual':'\u22E3','NotSubset':'\u2282\u20D2','NotSubsetEqual':'\u2288','NotSucceeds':'\u2281','NotSucceedsEqual':'\u2AB0\u0338','NotSucceedsSlantEqual':'\u22E1','NotSucceedsTilde':'\u227F\u0338','NotSuperset':'\u2283\u20D2','NotSupersetEqual':'\u2289','NotTilde':'\u2241','NotTildeEqual':'\u2244','NotTildeFullEqual':'\u2247','NotTildeTilde':'\u2249','NotVerticalBar':'\u2224','npar':'\u2226','nparallel':'\u2226','nparsl':'\u2AFD\u20E5','npart':'\u2202\u0338','npolint':'\u2A14','npr':'\u2280','nprcue':'\u22E0','npre':'\u2AAF\u0338','nprec':'\u2280','npreceq':'\u2AAF\u0338','nrarr':'\u219B','nrArr':'\u21CF','nrarrc':'\u2933\u0338','nrarrw':'\u219D\u0338','nrightarrow':'\u219B','nRightarrow':'\u21CF','nrtri':'\u22EB','nrtrie':'\u22ED','nsc':'\u2281','nsccue':'\u22E1','nsce':'\u2AB0\u0338','nscr':'\uD835\uDCC3','Nscr':'\uD835\uDCA9','nshortmid':'\u2224','nshortparallel':'\u2226','nsim':'\u2241','nsime':'\u2244','nsimeq':'\u2244','nsmid':'\u2224','nspar':'\u2226','nsqsube':'\u22E2','nsqsupe':'\u22E3','nsub':'\u2284','nsube':'\u2288','nsubE':'\u2AC5\u0338','nsubset':'\u2282\u20D2','nsubseteq':'\u2288','nsubseteqq':'\u2AC5\u0338','nsucc':'\u2281','nsucceq':'\u2AB0\u0338','nsup':'\u2285','nsupe':'\u2289','nsupE':'\u2AC6\u0338','nsupset':'\u2283\u20D2','nsupseteq':'\u2289','nsupseteqq':'\u2AC6\u0338','ntgl':'\u2279','ntilde':'\xF1','Ntilde':'\xD1','ntlg':'\u2278','ntriangleleft':'\u22EA','ntrianglelefteq':'\u22EC','ntriangleright':'\u22EB','ntrianglerighteq':'\u22ED','nu':'\u03BD','Nu':'\u039D','num':'#','numero':'\u2116','numsp':'\u2007','nvap':'\u224D\u20D2','nvdash':'\u22AC','nvDash':'\u22AD','nVdash':'\u22AE','nVDash':'\u22AF','nvge':'\u2265\u20D2','nvgt':'>\u20D2','nvHarr':'\u2904','nvinfin':'\u29DE','nvlArr':'\u2902','nvle':'\u2264\u20D2','nvlt':'<\u20D2','nvltrie':'\u22B4\u20D2','nvrArr':'\u2903','nvrtrie':'\u22B5\u20D2','nvsim':'\u223C\u20D2','nwarhk':'\u2923','nwarr':'\u2196','nwArr':'\u21D6','nwarrow':'\u2196','nwnear':'\u2927','oacute':'\xF3','Oacute':'\xD3','oast':'\u229B','ocir':'\u229A','ocirc':'\xF4','Ocirc':'\xD4','ocy':'\u043E','Ocy':'\u041E','odash':'\u229D','odblac':'\u0151','Odblac':'\u0150','odiv':'\u2A38','odot':'\u2299','odsold':'\u29BC','oelig':'\u0153','OElig':'\u0152','ofcir':'\u29BF','ofr':'\uD835\uDD2C','Ofr':'\uD835\uDD12','ogon':'\u02DB','ograve':'\xF2','Ograve':'\xD2','ogt':'\u29C1','ohbar':'\u29B5','ohm':'\u03A9','oint':'\u222E','olarr':'\u21BA','olcir':'\u29BE','olcross':'\u29BB','oline':'\u203E','olt':'\u29C0','omacr':'\u014D','Omacr':'\u014C','omega':'\u03C9','Omega':'\u03A9','omicron':'\u03BF','Omicron':'\u039F','omid':'\u29B6','ominus':'\u2296','oopf':'\uD835\uDD60','Oopf':'\uD835\uDD46','opar':'\u29B7','OpenCurlyDoubleQuote':'\u201C','OpenCurlyQuote':'\u2018','operp':'\u29B9','oplus':'\u2295','or':'\u2228','Or':'\u2A54','orarr':'\u21BB','ord':'\u2A5D','order':'\u2134','orderof':'\u2134','ordf':'\xAA','ordm':'\xBA','origof':'\u22B6','oror':'\u2A56','orslope':'\u2A57','orv':'\u2A5B','oS':'\u24C8','oscr':'\u2134','Oscr':'\uD835\uDCAA','oslash':'\xF8','Oslash':'\xD8','osol':'\u2298','otilde':'\xF5','Otilde':'\xD5','otimes':'\u2297','Otimes':'\u2A37','otimesas':'\u2A36','ouml':'\xF6','Ouml':'\xD6','ovbar':'\u233D','OverBar':'\u203E','OverBrace':'\u23DE','OverBracket':'\u23B4','OverParenthesis':'\u23DC','par':'\u2225','para':'\xB6','parallel':'\u2225','parsim':'\u2AF3','parsl':'\u2AFD','part':'\u2202','PartialD':'\u2202','pcy':'\u043F','Pcy':'\u041F','percnt':'%','period':'.','permil':'\u2030','perp':'\u22A5','pertenk':'\u2031','pfr':'\uD835\uDD2D','Pfr':'\uD835\uDD13','phi':'\u03C6','Phi':'\u03A6','phiv':'\u03D5','phmmat':'\u2133','phone':'\u260E','pi':'\u03C0','Pi':'\u03A0','pitchfork':'\u22D4','piv':'\u03D6','planck':'\u210F','planckh':'\u210E','plankv':'\u210F','plus':'+','plusacir':'\u2A23','plusb':'\u229E','pluscir':'\u2A22','plusdo':'\u2214','plusdu':'\u2A25','pluse':'\u2A72','PlusMinus':'\xB1','plusmn':'\xB1','plussim':'\u2A26','plustwo':'\u2A27','pm':'\xB1','Poincareplane':'\u210C','pointint':'\u2A15','popf':'\uD835\uDD61','Popf':'\u2119','pound':'\xA3','pr':'\u227A','Pr':'\u2ABB','prap':'\u2AB7','prcue':'\u227C','pre':'\u2AAF','prE':'\u2AB3','prec':'\u227A','precapprox':'\u2AB7','preccurlyeq':'\u227C','Precedes':'\u227A','PrecedesEqual':'\u2AAF','PrecedesSlantEqual':'\u227C','PrecedesTilde':'\u227E','preceq':'\u2AAF','precnapprox':'\u2AB9','precneqq':'\u2AB5','precnsim':'\u22E8','precsim':'\u227E','prime':'\u2032','Prime':'\u2033','primes':'\u2119','prnap':'\u2AB9','prnE':'\u2AB5','prnsim':'\u22E8','prod':'\u220F','Product':'\u220F','profalar':'\u232E','profline':'\u2312','profsurf':'\u2313','prop':'\u221D','Proportion':'\u2237','Proportional':'\u221D','propto':'\u221D','prsim':'\u227E','prurel':'\u22B0','pscr':'\uD835\uDCC5','Pscr':'\uD835\uDCAB','psi':'\u03C8','Psi':'\u03A8','puncsp':'\u2008','qfr':'\uD835\uDD2E','Qfr':'\uD835\uDD14','qint':'\u2A0C','qopf':'\uD835\uDD62','Qopf':'\u211A','qprime':'\u2057','qscr':'\uD835\uDCC6','Qscr':'\uD835\uDCAC','quaternions':'\u210D','quatint':'\u2A16','quest':'?','questeq':'\u225F','quot':'"','QUOT':'"','rAarr':'\u21DB','race':'\u223D\u0331','racute':'\u0155','Racute':'\u0154','radic':'\u221A','raemptyv':'\u29B3','rang':'\u27E9','Rang':'\u27EB','rangd':'\u2992','range':'\u29A5','rangle':'\u27E9','raquo':'\xBB','rarr':'\u2192','rArr':'\u21D2','Rarr':'\u21A0','rarrap':'\u2975','rarrb':'\u21E5','rarrbfs':'\u2920','rarrc':'\u2933','rarrfs':'\u291E','rarrhk':'\u21AA','rarrlp':'\u21AC','rarrpl':'\u2945','rarrsim':'\u2974','rarrtl':'\u21A3','Rarrtl':'\u2916','rarrw':'\u219D','ratail':'\u291A','rAtail':'\u291C','ratio':'\u2236','rationals':'\u211A','rbarr':'\u290D','rBarr':'\u290F','RBarr':'\u2910','rbbrk':'\u2773','rbrace':'}','rbrack':']','rbrke':'\u298C','rbrksld':'\u298E','rbrkslu':'\u2990','rcaron':'\u0159','Rcaron':'\u0158','rcedil':'\u0157','Rcedil':'\u0156','rceil':'\u2309','rcub':'}','rcy':'\u0440','Rcy':'\u0420','rdca':'\u2937','rdldhar':'\u2969','rdquo':'\u201D','rdquor':'\u201D','rdsh':'\u21B3','Re':'\u211C','real':'\u211C','realine':'\u211B','realpart':'\u211C','reals':'\u211D','rect':'\u25AD','reg':'\xAE','REG':'\xAE','ReverseElement':'\u220B','ReverseEquilibrium':'\u21CB','ReverseUpEquilibrium':'\u296F','rfisht':'\u297D','rfloor':'\u230B','rfr':'\uD835\uDD2F','Rfr':'\u211C','rHar':'\u2964','rhard':'\u21C1','rharu':'\u21C0','rharul':'\u296C','rho':'\u03C1','Rho':'\u03A1','rhov':'\u03F1','RightAngleBracket':'\u27E9','rightarrow':'\u2192','Rightarrow':'\u21D2','RightArrow':'\u2192','RightArrowBar':'\u21E5','RightArrowLeftArrow':'\u21C4','rightarrowtail':'\u21A3','RightCeiling':'\u2309','RightDoubleBracket':'\u27E7','RightDownTeeVector':'\u295D','RightDownVector':'\u21C2','RightDownVectorBar':'\u2955','RightFloor':'\u230B','rightharpoondown':'\u21C1','rightharpoonup':'\u21C0','rightleftarrows':'\u21C4','rightleftharpoons':'\u21CC','rightrightarrows':'\u21C9','rightsquigarrow':'\u219D','RightTee':'\u22A2','RightTeeArrow':'\u21A6','RightTeeVector':'\u295B','rightthreetimes':'\u22CC','RightTriangle':'\u22B3','RightTriangleBar':'\u29D0','RightTriangleEqual':'\u22B5','RightUpDownVector':'\u294F','RightUpTeeVector':'\u295C','RightUpVector':'\u21BE','RightUpVectorBar':'\u2954','RightVector':'\u21C0','RightVectorBar':'\u2953','ring':'\u02DA','risingdotseq':'\u2253','rlarr':'\u21C4','rlhar':'\u21CC','rlm':'\u200F','rmoust':'\u23B1','rmoustache':'\u23B1','rnmid':'\u2AEE','roang':'\u27ED','roarr':'\u21FE','robrk':'\u27E7','ropar':'\u2986','ropf':'\uD835\uDD63','Ropf':'\u211D','roplus':'\u2A2E','rotimes':'\u2A35','RoundImplies':'\u2970','rpar':')','rpargt':'\u2994','rppolint':'\u2A12','rrarr':'\u21C9','Rrightarrow':'\u21DB','rsaquo':'\u203A','rscr':'\uD835\uDCC7','Rscr':'\u211B','rsh':'\u21B1','Rsh':'\u21B1','rsqb':']','rsquo':'\u2019','rsquor':'\u2019','rthree':'\u22CC','rtimes':'\u22CA','rtri':'\u25B9','rtrie':'\u22B5','rtrif':'\u25B8','rtriltri':'\u29CE','RuleDelayed':'\u29F4','ruluhar':'\u2968','rx':'\u211E','sacute':'\u015B','Sacute':'\u015A','sbquo':'\u201A','sc':'\u227B','Sc':'\u2ABC','scap':'\u2AB8','scaron':'\u0161','Scaron':'\u0160','sccue':'\u227D','sce':'\u2AB0','scE':'\u2AB4','scedil':'\u015F','Scedil':'\u015E','scirc':'\u015D','Scirc':'\u015C','scnap':'\u2ABA','scnE':'\u2AB6','scnsim':'\u22E9','scpolint':'\u2A13','scsim':'\u227F','scy':'\u0441','Scy':'\u0421','sdot':'\u22C5','sdotb':'\u22A1','sdote':'\u2A66','searhk':'\u2925','searr':'\u2198','seArr':'\u21D8','searrow':'\u2198','sect':'\xA7','semi':';','seswar':'\u2929','setminus':'\u2216','setmn':'\u2216','sext':'\u2736','sfr':'\uD835\uDD30','Sfr':'\uD835\uDD16','sfrown':'\u2322','sharp':'\u266F','shchcy':'\u0449','SHCHcy':'\u0429','shcy':'\u0448','SHcy':'\u0428','ShortDownArrow':'\u2193','ShortLeftArrow':'\u2190','shortmid':'\u2223','shortparallel':'\u2225','ShortRightArrow':'\u2192','ShortUpArrow':'\u2191','shy':'\xAD','sigma':'\u03C3','Sigma':'\u03A3','sigmaf':'\u03C2','sigmav':'\u03C2','sim':'\u223C','simdot':'\u2A6A','sime':'\u2243','simeq':'\u2243','simg':'\u2A9E','simgE':'\u2AA0','siml':'\u2A9D','simlE':'\u2A9F','simne':'\u2246','simplus':'\u2A24','simrarr':'\u2972','slarr':'\u2190','SmallCircle':'\u2218','smallsetminus':'\u2216','smashp':'\u2A33','smeparsl':'\u29E4','smid':'\u2223','smile':'\u2323','smt':'\u2AAA','smte':'\u2AAC','smtes':'\u2AAC\uFE00','softcy':'\u044C','SOFTcy':'\u042C','sol':'/','solb':'\u29C4','solbar':'\u233F','sopf':'\uD835\uDD64','Sopf':'\uD835\uDD4A','spades':'\u2660','spadesuit':'\u2660','spar':'\u2225','sqcap':'\u2293','sqcaps':'\u2293\uFE00','sqcup':'\u2294','sqcups':'\u2294\uFE00','Sqrt':'\u221A','sqsub':'\u228F','sqsube':'\u2291','sqsubset':'\u228F','sqsubseteq':'\u2291','sqsup':'\u2290','sqsupe':'\u2292','sqsupset':'\u2290','sqsupseteq':'\u2292','squ':'\u25A1','square':'\u25A1','Square':'\u25A1','SquareIntersection':'\u2293','SquareSubset':'\u228F','SquareSubsetEqual':'\u2291','SquareSuperset':'\u2290','SquareSupersetEqual':'\u2292','SquareUnion':'\u2294','squarf':'\u25AA','squf':'\u25AA','srarr':'\u2192','sscr':'\uD835\uDCC8','Sscr':'\uD835\uDCAE','ssetmn':'\u2216','ssmile':'\u2323','sstarf':'\u22C6','star':'\u2606','Star':'\u22C6','starf':'\u2605','straightepsilon':'\u03F5','straightphi':'\u03D5','strns':'\xAF','sub':'\u2282','Sub':'\u22D0','subdot':'\u2ABD','sube':'\u2286','subE':'\u2AC5','subedot':'\u2AC3','submult':'\u2AC1','subne':'\u228A','subnE':'\u2ACB','subplus':'\u2ABF','subrarr':'\u2979','subset':'\u2282','Subset':'\u22D0','subseteq':'\u2286','subseteqq':'\u2AC5','SubsetEqual':'\u2286','subsetneq':'\u228A','subsetneqq':'\u2ACB','subsim':'\u2AC7','subsub':'\u2AD5','subsup':'\u2AD3','succ':'\u227B','succapprox':'\u2AB8','succcurlyeq':'\u227D','Succeeds':'\u227B','SucceedsEqual':'\u2AB0','SucceedsSlantEqual':'\u227D','SucceedsTilde':'\u227F','succeq':'\u2AB0','succnapprox':'\u2ABA','succneqq':'\u2AB6','succnsim':'\u22E9','succsim':'\u227F','SuchThat':'\u220B','sum':'\u2211','Sum':'\u2211','sung':'\u266A','sup':'\u2283','Sup':'\u22D1','sup1':'\xB9','sup2':'\xB2','sup3':'\xB3','supdot':'\u2ABE','supdsub':'\u2AD8','supe':'\u2287','supE':'\u2AC6','supedot':'\u2AC4','Superset':'\u2283','SupersetEqual':'\u2287','suphsol':'\u27C9','suphsub':'\u2AD7','suplarr':'\u297B','supmult':'\u2AC2','supne':'\u228B','supnE':'\u2ACC','supplus':'\u2AC0','supset':'\u2283','Supset':'\u22D1','supseteq':'\u2287','supseteqq':'\u2AC6','supsetneq':'\u228B','supsetneqq':'\u2ACC','supsim':'\u2AC8','supsub':'\u2AD4','supsup':'\u2AD6','swarhk':'\u2926','swarr':'\u2199','swArr':'\u21D9','swarrow':'\u2199','swnwar':'\u292A','szlig':'\xDF','Tab':'\t','target':'\u2316','tau':'\u03C4','Tau':'\u03A4','tbrk':'\u23B4','tcaron':'\u0165','Tcaron':'\u0164','tcedil':'\u0163','Tcedil':'\u0162','tcy':'\u0442','Tcy':'\u0422','tdot':'\u20DB','telrec':'\u2315','tfr':'\uD835\uDD31','Tfr':'\uD835\uDD17','there4':'\u2234','therefore':'\u2234','Therefore':'\u2234','theta':'\u03B8','Theta':'\u0398','thetasym':'\u03D1','thetav':'\u03D1','thickapprox':'\u2248','thicksim':'\u223C','ThickSpace':'\u205F\u200A','thinsp':'\u2009','ThinSpace':'\u2009','thkap':'\u2248','thksim':'\u223C','thorn':'\xFE','THORN':'\xDE','tilde':'\u02DC','Tilde':'\u223C','TildeEqual':'\u2243','TildeFullEqual':'\u2245','TildeTilde':'\u2248','times':'\xD7','timesb':'\u22A0','timesbar':'\u2A31','timesd':'\u2A30','tint':'\u222D','toea':'\u2928','top':'\u22A4','topbot':'\u2336','topcir':'\u2AF1','topf':'\uD835\uDD65','Topf':'\uD835\uDD4B','topfork':'\u2ADA','tosa':'\u2929','tprime':'\u2034','trade':'\u2122','TRADE':'\u2122','triangle':'\u25B5','triangledown':'\u25BF','triangleleft':'\u25C3','trianglelefteq':'\u22B4','triangleq':'\u225C','triangleright':'\u25B9','trianglerighteq':'\u22B5','tridot':'\u25EC','trie':'\u225C','triminus':'\u2A3A','TripleDot':'\u20DB','triplus':'\u2A39','trisb':'\u29CD','tritime':'\u2A3B','trpezium':'\u23E2','tscr':'\uD835\uDCC9','Tscr':'\uD835\uDCAF','tscy':'\u0446','TScy':'\u0426','tshcy':'\u045B','TSHcy':'\u040B','tstrok':'\u0167','Tstrok':'\u0166','twixt':'\u226C','twoheadleftarrow':'\u219E','twoheadrightarrow':'\u21A0','uacute':'\xFA','Uacute':'\xDA','uarr':'\u2191','uArr':'\u21D1','Uarr':'\u219F','Uarrocir':'\u2949','ubrcy':'\u045E','Ubrcy':'\u040E','ubreve':'\u016D','Ubreve':'\u016C','ucirc':'\xFB','Ucirc':'\xDB','ucy':'\u0443','Ucy':'\u0423','udarr':'\u21C5','udblac':'\u0171','Udblac':'\u0170','udhar':'\u296E','ufisht':'\u297E','ufr':'\uD835\uDD32','Ufr':'\uD835\uDD18','ugrave':'\xF9','Ugrave':'\xD9','uHar':'\u2963','uharl':'\u21BF','uharr':'\u21BE','uhblk':'\u2580','ulcorn':'\u231C','ulcorner':'\u231C','ulcrop':'\u230F','ultri':'\u25F8','umacr':'\u016B','Umacr':'\u016A','uml':'\xA8','UnderBar':'_','UnderBrace':'\u23DF','UnderBracket':'\u23B5','UnderParenthesis':'\u23DD','Union':'\u22C3','UnionPlus':'\u228E','uogon':'\u0173','Uogon':'\u0172','uopf':'\uD835\uDD66','Uopf':'\uD835\uDD4C','uparrow':'\u2191','Uparrow':'\u21D1','UpArrow':'\u2191','UpArrowBar':'\u2912','UpArrowDownArrow':'\u21C5','updownarrow':'\u2195','Updownarrow':'\u21D5','UpDownArrow':'\u2195','UpEquilibrium':'\u296E','upharpoonleft':'\u21BF','upharpoonright':'\u21BE','uplus':'\u228E','UpperLeftArrow':'\u2196','UpperRightArrow':'\u2197','upsi':'\u03C5','Upsi':'\u03D2','upsih':'\u03D2','upsilon':'\u03C5','Upsilon':'\u03A5','UpTee':'\u22A5','UpTeeArrow':'\u21A5','upuparrows':'\u21C8','urcorn':'\u231D','urcorner':'\u231D','urcrop':'\u230E','uring':'\u016F','Uring':'\u016E','urtri':'\u25F9','uscr':'\uD835\uDCCA','Uscr':'\uD835\uDCB0','utdot':'\u22F0','utilde':'\u0169','Utilde':'\u0168','utri':'\u25B5','utrif':'\u25B4','uuarr':'\u21C8','uuml':'\xFC','Uuml':'\xDC','uwangle':'\u29A7','vangrt':'\u299C','varepsilon':'\u03F5','varkappa':'\u03F0','varnothing':'\u2205','varphi':'\u03D5','varpi':'\u03D6','varpropto':'\u221D','varr':'\u2195','vArr':'\u21D5','varrho':'\u03F1','varsigma':'\u03C2','varsubsetneq':'\u228A\uFE00','varsubsetneqq':'\u2ACB\uFE00','varsupsetneq':'\u228B\uFE00','varsupsetneqq':'\u2ACC\uFE00','vartheta':'\u03D1','vartriangleleft':'\u22B2','vartriangleright':'\u22B3','vBar':'\u2AE8','Vbar':'\u2AEB','vBarv':'\u2AE9','vcy':'\u0432','Vcy':'\u0412','vdash':'\u22A2','vDash':'\u22A8','Vdash':'\u22A9','VDash':'\u22AB','Vdashl':'\u2AE6','vee':'\u2228','Vee':'\u22C1','veebar':'\u22BB','veeeq':'\u225A','vellip':'\u22EE','verbar':'|','Verbar':'\u2016','vert':'|','Vert':'\u2016','VerticalBar':'\u2223','VerticalLine':'|','VerticalSeparator':'\u2758','VerticalTilde':'\u2240','VeryThinSpace':'\u200A','vfr':'\uD835\uDD33','Vfr':'\uD835\uDD19','vltri':'\u22B2','vnsub':'\u2282\u20D2','vnsup':'\u2283\u20D2','vopf':'\uD835\uDD67','Vopf':'\uD835\uDD4D','vprop':'\u221D','vrtri':'\u22B3','vscr':'\uD835\uDCCB','Vscr':'\uD835\uDCB1','vsubne':'\u228A\uFE00','vsubnE':'\u2ACB\uFE00','vsupne':'\u228B\uFE00','vsupnE':'\u2ACC\uFE00','Vvdash':'\u22AA','vzigzag':'\u299A','wcirc':'\u0175','Wcirc':'\u0174','wedbar':'\u2A5F','wedge':'\u2227','Wedge':'\u22C0','wedgeq':'\u2259','weierp':'\u2118','wfr':'\uD835\uDD34','Wfr':'\uD835\uDD1A','wopf':'\uD835\uDD68','Wopf':'\uD835\uDD4E','wp':'\u2118','wr':'\u2240','wreath':'\u2240','wscr':'\uD835\uDCCC','Wscr':'\uD835\uDCB2','xcap':'\u22C2','xcirc':'\u25EF','xcup':'\u22C3','xdtri':'\u25BD','xfr':'\uD835\uDD35','Xfr':'\uD835\uDD1B','xharr':'\u27F7','xhArr':'\u27FA','xi':'\u03BE','Xi':'\u039E','xlarr':'\u27F5','xlArr':'\u27F8','xmap':'\u27FC','xnis':'\u22FB','xodot':'\u2A00','xopf':'\uD835\uDD69','Xopf':'\uD835\uDD4F','xoplus':'\u2A01','xotime':'\u2A02','xrarr':'\u27F6','xrArr':'\u27F9','xscr':'\uD835\uDCCD','Xscr':'\uD835\uDCB3','xsqcup':'\u2A06','xuplus':'\u2A04','xutri':'\u25B3','xvee':'\u22C1','xwedge':'\u22C0','yacute':'\xFD','Yacute':'\xDD','yacy':'\u044F','YAcy':'\u042F','ycirc':'\u0177','Ycirc':'\u0176','ycy':'\u044B','Ycy':'\u042B','yen':'\xA5','yfr':'\uD835\uDD36','Yfr':'\uD835\uDD1C','yicy':'\u0457','YIcy':'\u0407','yopf':'\uD835\uDD6A','Yopf':'\uD835\uDD50','yscr':'\uD835\uDCCE','Yscr':'\uD835\uDCB4','yucy':'\u044E','YUcy':'\u042E','yuml':'\xFF','Yuml':'\u0178','zacute':'\u017A','Zacute':'\u0179','zcaron':'\u017E','Zcaron':'\u017D','zcy':'\u0437','Zcy':'\u0417','zdot':'\u017C','Zdot':'\u017B','zeetrf':'\u2128','ZeroWidthSpace':'\u200B','zeta':'\u03B6','Zeta':'\u0396','zfr':'\uD835\uDD37','Zfr':'\u2128','zhcy':'\u0436','ZHcy':'\u0416','zigrarr':'\u21DD','zopf':'\uD835\uDD6B','Zopf':'\u2124','zscr':'\uD835\uDCCF','Zscr':'\uD835\uDCB5','zwj':'\u200D','zwnj':'\u200C'};
  11545. var decodeMapLegacy = {'aacute':'\xE1','Aacute':'\xC1','acirc':'\xE2','Acirc':'\xC2','acute':'\xB4','aelig':'\xE6','AElig':'\xC6','agrave':'\xE0','Agrave':'\xC0','amp':'&','AMP':'&','aring':'\xE5','Aring':'\xC5','atilde':'\xE3','Atilde':'\xC3','auml':'\xE4','Auml':'\xC4','brvbar':'\xA6','ccedil':'\xE7','Ccedil':'\xC7','cedil':'\xB8','cent':'\xA2','copy':'\xA9','COPY':'\xA9','curren':'\xA4','deg':'\xB0','divide':'\xF7','eacute':'\xE9','Eacute':'\xC9','ecirc':'\xEA','Ecirc':'\xCA','egrave':'\xE8','Egrave':'\xC8','eth':'\xF0','ETH':'\xD0','euml':'\xEB','Euml':'\xCB','frac12':'\xBD','frac14':'\xBC','frac34':'\xBE','gt':'>','GT':'>','iacute':'\xED','Iacute':'\xCD','icirc':'\xEE','Icirc':'\xCE','iexcl':'\xA1','igrave':'\xEC','Igrave':'\xCC','iquest':'\xBF','iuml':'\xEF','Iuml':'\xCF','laquo':'\xAB','lt':'<','LT':'<','macr':'\xAF','micro':'\xB5','middot':'\xB7','nbsp':'\xA0','not':'\xAC','ntilde':'\xF1','Ntilde':'\xD1','oacute':'\xF3','Oacute':'\xD3','ocirc':'\xF4','Ocirc':'\xD4','ograve':'\xF2','Ograve':'\xD2','ordf':'\xAA','ordm':'\xBA','oslash':'\xF8','Oslash':'\xD8','otilde':'\xF5','Otilde':'\xD5','ouml':'\xF6','Ouml':'\xD6','para':'\xB6','plusmn':'\xB1','pound':'\xA3','quot':'"','QUOT':'"','raquo':'\xBB','reg':'\xAE','REG':'\xAE','sect':'\xA7','shy':'\xAD','sup1':'\xB9','sup2':'\xB2','sup3':'\xB3','szlig':'\xDF','thorn':'\xFE','THORN':'\xDE','times':'\xD7','uacute':'\xFA','Uacute':'\xDA','ucirc':'\xFB','Ucirc':'\xDB','ugrave':'\xF9','Ugrave':'\xD9','uml':'\xA8','uuml':'\xFC','Uuml':'\xDC','yacute':'\xFD','Yacute':'\xDD','yen':'\xA5','yuml':'\xFF'};
  11546. var decodeMapNumeric = {'0':'\uFFFD','128':'\u20AC','130':'\u201A','131':'\u0192','132':'\u201E','133':'\u2026','134':'\u2020','135':'\u2021','136':'\u02C6','137':'\u2030','138':'\u0160','139':'\u2039','140':'\u0152','142':'\u017D','145':'\u2018','146':'\u2019','147':'\u201C','148':'\u201D','149':'\u2022','150':'\u2013','151':'\u2014','152':'\u02DC','153':'\u2122','154':'\u0161','155':'\u203A','156':'\u0153','158':'\u017E','159':'\u0178'};
  11547. var invalidReferenceCodePoints = [1,2,3,4,5,6,7,8,11,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,64976,64977,64978,64979,64980,64981,64982,64983,64984,64985,64986,64987,64988,64989,64990,64991,64992,64993,64994,64995,64996,64997,64998,64999,65000,65001,65002,65003,65004,65005,65006,65007,65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111];
  11548. /*--------------------------------------------------------------------------*/
  11549. var stringFromCharCode = String.fromCharCode;
  11550. var object = {};
  11551. var hasOwnProperty = object.hasOwnProperty;
  11552. var has = function(object, propertyName) {
  11553. return hasOwnProperty.call(object, propertyName);
  11554. };
  11555. var contains = function(array, value) {
  11556. var index = -1;
  11557. var length = array.length;
  11558. while (++index < length) {
  11559. if (array[index] == value) {
  11560. return true;
  11561. }
  11562. }
  11563. return false;
  11564. };
  11565. var merge = function(options, defaults) {
  11566. if (!options) {
  11567. return defaults;
  11568. }
  11569. var result = {};
  11570. var key;
  11571. for (key in defaults) {
  11572. // A `hasOwnProperty` check is not needed here, since only recognized
  11573. // option names are used anyway. Any others are ignored.
  11574. result[key] = has(options, key) ? options[key] : defaults[key];
  11575. }
  11576. return result;
  11577. };
  11578. // Modified version of `ucs2encode`; see https://mths.be/punycode.
  11579. var codePointToSymbol = function(codePoint, strict) {
  11580. var output = '';
  11581. if ((codePoint >= 0xD800 && codePoint <= 0xDFFF) || codePoint > 0x10FFFF) {
  11582. // See issue #4:
  11583. // “Otherwise, if the number is in the range 0xD800 to 0xDFFF or is
  11584. // greater than 0x10FFFF, then this is a parse error. Return a U+FFFD
  11585. // REPLACEMENT CHARACTER.”
  11586. if (strict) {
  11587. parseError('character reference outside the permissible Unicode range');
  11588. }
  11589. return '\uFFFD';
  11590. }
  11591. if (has(decodeMapNumeric, codePoint)) {
  11592. if (strict) {
  11593. parseError('disallowed character reference');
  11594. }
  11595. return decodeMapNumeric[codePoint];
  11596. }
  11597. if (strict && contains(invalidReferenceCodePoints, codePoint)) {
  11598. parseError('disallowed character reference');
  11599. }
  11600. if (codePoint > 0xFFFF) {
  11601. codePoint -= 0x10000;
  11602. output += stringFromCharCode(codePoint >>> 10 & 0x3FF | 0xD800);
  11603. codePoint = 0xDC00 | codePoint & 0x3FF;
  11604. }
  11605. output += stringFromCharCode(codePoint);
  11606. return output;
  11607. };
  11608. var hexEscape = function(codePoint) {
  11609. return '&#x' + codePoint.toString(16).toUpperCase() + ';';
  11610. };
  11611. var decEscape = function(codePoint) {
  11612. return '&#' + codePoint + ';';
  11613. };
  11614. var parseError = function(message) {
  11615. throw Error('Parse error: ' + message);
  11616. };
  11617. /*--------------------------------------------------------------------------*/
  11618. var encode = function(string, options) {
  11619. options = merge(options, encode.options);
  11620. var strict = options.strict;
  11621. if (strict && regexInvalidRawCodePoint.test(string)) {
  11622. parseError('forbidden code point');
  11623. }
  11624. var encodeEverything = options.encodeEverything;
  11625. var useNamedReferences = options.useNamedReferences;
  11626. var allowUnsafeSymbols = options.allowUnsafeSymbols;
  11627. var escapeCodePoint = options.decimal ? decEscape : hexEscape;
  11628. var escapeBmpSymbol = function(symbol) {
  11629. return escapeCodePoint(symbol.charCodeAt(0));
  11630. };
  11631. if (encodeEverything) {
  11632. // Encode ASCII symbols.
  11633. string = string.replace(regexAsciiWhitelist, function(symbol) {
  11634. // Use named references if requested & possible.
  11635. if (useNamedReferences && has(encodeMap, symbol)) {
  11636. return '&' + encodeMap[symbol] + ';';
  11637. }
  11638. return escapeBmpSymbol(symbol);
  11639. });
  11640. // Shorten a few escapes that represent two symbols, of which at least one
  11641. // is within the ASCII range.
  11642. if (useNamedReferences) {
  11643. string = string
  11644. .replace(/&gt;\u20D2/g, '&nvgt;')
  11645. .replace(/&lt;\u20D2/g, '&nvlt;')
  11646. .replace(/&#x66;&#x6A;/g, '&fjlig;');
  11647. }
  11648. // Encode non-ASCII symbols.
  11649. if (useNamedReferences) {
  11650. // Encode non-ASCII symbols that can be replaced with a named reference.
  11651. string = string.replace(regexEncodeNonAscii, function(string) {
  11652. // Note: there is no need to check `has(encodeMap, string)` here.
  11653. return '&' + encodeMap[string] + ';';
  11654. });
  11655. }
  11656. // Note: any remaining non-ASCII symbols are handled outside of the `if`.
  11657. } else if (useNamedReferences) {
  11658. // Apply named character references.
  11659. // Encode `<>"'&` using named character references.
  11660. if (!allowUnsafeSymbols) {
  11661. string = string.replace(regexEscape, function(string) {
  11662. return '&' + encodeMap[string] + ';'; // no need to check `has()` here
  11663. });
  11664. }
  11665. // Shorten escapes that represent two symbols, of which at least one is
  11666. // `<>"'&`.
  11667. string = string
  11668. .replace(/&gt;\u20D2/g, '&nvgt;')
  11669. .replace(/&lt;\u20D2/g, '&nvlt;');
  11670. // Encode non-ASCII symbols that can be replaced with a named reference.
  11671. string = string.replace(regexEncodeNonAscii, function(string) {
  11672. // Note: there is no need to check `has(encodeMap, string)` here.
  11673. return '&' + encodeMap[string] + ';';
  11674. });
  11675. } else if (!allowUnsafeSymbols) {
  11676. // Encode `<>"'&` using hexadecimal escapes, now that they’re not handled
  11677. // using named character references.
  11678. string = string.replace(regexEscape, escapeBmpSymbol);
  11679. }
  11680. return string
  11681. // Encode astral symbols.
  11682. .replace(regexAstralSymbols, function($0) {
  11683. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  11684. var high = $0.charCodeAt(0);
  11685. var low = $0.charCodeAt(1);
  11686. var codePoint = (high - 0xD800) * 0x400 + low - 0xDC00 + 0x10000;
  11687. return escapeCodePoint(codePoint);
  11688. })
  11689. // Encode any remaining BMP symbols that are not printable ASCII symbols
  11690. // using a hexadecimal escape.
  11691. .replace(regexBmpWhitelist, escapeBmpSymbol);
  11692. };
  11693. // Expose default options (so they can be overridden globally).
  11694. encode.options = {
  11695. 'allowUnsafeSymbols': false,
  11696. 'encodeEverything': false,
  11697. 'strict': false,
  11698. 'useNamedReferences': false,
  11699. 'decimal' : false
  11700. };
  11701. var decode = function(html, options) {
  11702. options = merge(options, decode.options);
  11703. var strict = options.strict;
  11704. if (strict && regexInvalidEntity.test(html)) {
  11705. parseError('malformed character reference');
  11706. }
  11707. return html.replace(regexDecode, function($0, $1, $2, $3, $4, $5, $6, $7, $8) {
  11708. var codePoint;
  11709. var semicolon;
  11710. var decDigits;
  11711. var hexDigits;
  11712. var reference;
  11713. var next;
  11714. if ($1) {
  11715. reference = $1;
  11716. // Note: there is no need to check `has(decodeMap, reference)`.
  11717. return decodeMap[reference];
  11718. }
  11719. if ($2) {
  11720. // Decode named character references without trailing `;`, e.g. `&amp`.
  11721. // This is only a parse error if it gets converted to `&`, or if it is
  11722. // followed by `=` in an attribute context.
  11723. reference = $2;
  11724. next = $3;
  11725. if (next && options.isAttributeValue) {
  11726. if (strict && next == '=') {
  11727. parseError('`&` did not start a character reference');
  11728. }
  11729. return $0;
  11730. } else {
  11731. if (strict) {
  11732. parseError(
  11733. 'named character reference was not terminated by a semicolon'
  11734. );
  11735. }
  11736. // Note: there is no need to check `has(decodeMapLegacy, reference)`.
  11737. return decodeMapLegacy[reference] + (next || '');
  11738. }
  11739. }
  11740. if ($4) {
  11741. // Decode decimal escapes, e.g. `&#119558;`.
  11742. decDigits = $4;
  11743. semicolon = $5;
  11744. if (strict && !semicolon) {
  11745. parseError('character reference was not terminated by a semicolon');
  11746. }
  11747. codePoint = parseInt(decDigits, 10);
  11748. return codePointToSymbol(codePoint, strict);
  11749. }
  11750. if ($6) {
  11751. // Decode hexadecimal escapes, e.g. `&#x1D306;`.
  11752. hexDigits = $6;
  11753. semicolon = $7;
  11754. if (strict && !semicolon) {
  11755. parseError('character reference was not terminated by a semicolon');
  11756. }
  11757. codePoint = parseInt(hexDigits, 16);
  11758. return codePointToSymbol(codePoint, strict);
  11759. }
  11760. // If we’re still here, `if ($7)` is implied; it’s an ambiguous
  11761. // ampersand for sure. https://mths.be/notes/ambiguous-ampersands
  11762. if (strict) {
  11763. parseError(
  11764. 'named character reference was not terminated by a semicolon'
  11765. );
  11766. }
  11767. return $0;
  11768. });
  11769. };
  11770. // Expose default options (so they can be overridden globally).
  11771. decode.options = {
  11772. 'isAttributeValue': false,
  11773. 'strict': false
  11774. };
  11775. var escape = function(string) {
  11776. return string.replace(regexEscape, function($0) {
  11777. // Note: there is no need to check `has(escapeMap, $0)` here.
  11778. return escapeMap[$0];
  11779. });
  11780. };
  11781. /*--------------------------------------------------------------------------*/
  11782. var he = {
  11783. 'version': '1.2.0',
  11784. 'encode': encode,
  11785. 'decode': decode,
  11786. 'escape': escape,
  11787. 'unescape': decode
  11788. };
  11789. // Some AMD build optimizers, like r.js, check for specific condition patterns
  11790. // like the following:
  11791. if (
  11792. false
  11793. ) {
  11794. define(function() {
  11795. return he;
  11796. });
  11797. } else if (freeExports && !freeExports.nodeType) {
  11798. if (freeModule) { // in Node.js, io.js, or RingoJS v0.8.0+
  11799. freeModule.exports = he;
  11800. } else { // in Narwhal or RingoJS v0.7.0-
  11801. for (var key in he) {
  11802. has(he, key) && (freeExports[key] = he[key]);
  11803. }
  11804. }
  11805. } else { // in Rhino or a web browser
  11806. root.he = he;
  11807. }
  11808. }(this));
  11809. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  11810. },{}],55:[function(require,module,exports){
  11811. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  11812. var e, m
  11813. var eLen = (nBytes * 8) - mLen - 1
  11814. var eMax = (1 << eLen) - 1
  11815. var eBias = eMax >> 1
  11816. var nBits = -7
  11817. var i = isLE ? (nBytes - 1) : 0
  11818. var d = isLE ? -1 : 1
  11819. var s = buffer[offset + i]
  11820. i += d
  11821. e = s & ((1 << (-nBits)) - 1)
  11822. s >>= (-nBits)
  11823. nBits += eLen
  11824. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  11825. m = e & ((1 << (-nBits)) - 1)
  11826. e >>= (-nBits)
  11827. nBits += mLen
  11828. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  11829. if (e === 0) {
  11830. e = 1 - eBias
  11831. } else if (e === eMax) {
  11832. return m ? NaN : ((s ? -1 : 1) * Infinity)
  11833. } else {
  11834. m = m + Math.pow(2, mLen)
  11835. e = e - eBias
  11836. }
  11837. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  11838. }
  11839. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  11840. var e, m, c
  11841. var eLen = (nBytes * 8) - mLen - 1
  11842. var eMax = (1 << eLen) - 1
  11843. var eBias = eMax >> 1
  11844. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  11845. var i = isLE ? 0 : (nBytes - 1)
  11846. var d = isLE ? 1 : -1
  11847. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  11848. value = Math.abs(value)
  11849. if (isNaN(value) || value === Infinity) {
  11850. m = isNaN(value) ? 1 : 0
  11851. e = eMax
  11852. } else {
  11853. e = Math.floor(Math.log(value) / Math.LN2)
  11854. if (value * (c = Math.pow(2, -e)) < 1) {
  11855. e--
  11856. c *= 2
  11857. }
  11858. if (e + eBias >= 1) {
  11859. value += rt / c
  11860. } else {
  11861. value += rt * Math.pow(2, 1 - eBias)
  11862. }
  11863. if (value * c >= 2) {
  11864. e++
  11865. c /= 2
  11866. }
  11867. if (e + eBias >= eMax) {
  11868. m = 0
  11869. e = eMax
  11870. } else if (e + eBias >= 1) {
  11871. m = ((value * c) - 1) * Math.pow(2, mLen)
  11872. e = e + eBias
  11873. } else {
  11874. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  11875. e = 0
  11876. }
  11877. }
  11878. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  11879. e = (e << mLen) | m
  11880. eLen += mLen
  11881. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  11882. buffer[offset + i - d] |= s * 128
  11883. }
  11884. },{}],56:[function(require,module,exports){
  11885. if (typeof Object.create === 'function') {
  11886. // implementation from standard node.js 'util' module
  11887. module.exports = function inherits(ctor, superCtor) {
  11888. ctor.super_ = superCtor
  11889. ctor.prototype = Object.create(superCtor.prototype, {
  11890. constructor: {
  11891. value: ctor,
  11892. enumerable: false,
  11893. writable: true,
  11894. configurable: true
  11895. }
  11896. });
  11897. };
  11898. } else {
  11899. // old school shim for old browsers
  11900. module.exports = function inherits(ctor, superCtor) {
  11901. ctor.super_ = superCtor
  11902. var TempCtor = function () {}
  11903. TempCtor.prototype = superCtor.prototype
  11904. ctor.prototype = new TempCtor()
  11905. ctor.prototype.constructor = ctor
  11906. }
  11907. }
  11908. },{}],57:[function(require,module,exports){
  11909. /*!
  11910. * Determine if an object is a Buffer
  11911. *
  11912. * @author Feross Aboukhadijeh <https://feross.org>
  11913. * @license MIT
  11914. */
  11915. // The _isBuffer check is for Safari 5-7 support, because it's missing
  11916. // Object.prototype.constructor. Remove this eventually
  11917. module.exports = function (obj) {
  11918. return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
  11919. }
  11920. function isBuffer (obj) {
  11921. return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
  11922. }
  11923. // For Node v0.10 support. Remove this eventually.
  11924. function isSlowBuffer (obj) {
  11925. return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
  11926. }
  11927. },{}],58:[function(require,module,exports){
  11928. var toString = {}.toString;
  11929. module.exports = Array.isArray || function (arr) {
  11930. return toString.call(arr) == '[object Array]';
  11931. };
  11932. },{}],59:[function(require,module,exports){
  11933. (function (process){
  11934. var path = require('path');
  11935. var fs = require('fs');
  11936. var _0777 = parseInt('0777', 8);
  11937. module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
  11938. function mkdirP (p, opts, f, made) {
  11939. if (typeof opts === 'function') {
  11940. f = opts;
  11941. opts = {};
  11942. }
  11943. else if (!opts || typeof opts !== 'object') {
  11944. opts = { mode: opts };
  11945. }
  11946. var mode = opts.mode;
  11947. var xfs = opts.fs || fs;
  11948. if (mode === undefined) {
  11949. mode = _0777 & (~process.umask());
  11950. }
  11951. if (!made) made = null;
  11952. var cb = f || function () {};
  11953. p = path.resolve(p);
  11954. xfs.mkdir(p, mode, function (er) {
  11955. if (!er) {
  11956. made = made || p;
  11957. return cb(null, made);
  11958. }
  11959. switch (er.code) {
  11960. case 'ENOENT':
  11961. mkdirP(path.dirname(p), opts, function (er, made) {
  11962. if (er) cb(er, made);
  11963. else mkdirP(p, opts, cb, made);
  11964. });
  11965. break;
  11966. // In the case of any other error, just see if there's a dir
  11967. // there already. If so, then hooray! If not, then something
  11968. // is borked.
  11969. default:
  11970. xfs.stat(p, function (er2, stat) {
  11971. // if the stat fails, then that's super weird.
  11972. // let the original error be the failure reason.
  11973. if (er2 || !stat.isDirectory()) cb(er, made)
  11974. else cb(null, made);
  11975. });
  11976. break;
  11977. }
  11978. });
  11979. }
  11980. mkdirP.sync = function sync (p, opts, made) {
  11981. if (!opts || typeof opts !== 'object') {
  11982. opts = { mode: opts };
  11983. }
  11984. var mode = opts.mode;
  11985. var xfs = opts.fs || fs;
  11986. if (mode === undefined) {
  11987. mode = _0777 & (~process.umask());
  11988. }
  11989. if (!made) made = null;
  11990. p = path.resolve(p);
  11991. try {
  11992. xfs.mkdirSync(p, mode);
  11993. made = made || p;
  11994. }
  11995. catch (err0) {
  11996. switch (err0.code) {
  11997. case 'ENOENT' :
  11998. made = sync(path.dirname(p), opts, made);
  11999. sync(p, opts, made);
  12000. break;
  12001. // In the case of any other error, just see if there's a dir
  12002. // there already. If so, then hooray! If not, then something
  12003. // is borked.
  12004. default:
  12005. var stat;
  12006. try {
  12007. stat = xfs.statSync(p);
  12008. }
  12009. catch (err1) {
  12010. throw err0;
  12011. }
  12012. if (!stat.isDirectory()) throw err0;
  12013. break;
  12014. }
  12015. }
  12016. return made;
  12017. };
  12018. }).call(this,require('_process'))
  12019. },{"_process":69,"fs":42,"path":42}],60:[function(require,module,exports){
  12020. /**
  12021. * Helpers.
  12022. */
  12023. var s = 1000;
  12024. var m = s * 60;
  12025. var h = m * 60;
  12026. var d = h * 24;
  12027. var w = d * 7;
  12028. var y = d * 365.25;
  12029. /**
  12030. * Parse or format the given `val`.
  12031. *
  12032. * Options:
  12033. *
  12034. * - `long` verbose formatting [false]
  12035. *
  12036. * @param {String|Number} val
  12037. * @param {Object} [options]
  12038. * @throws {Error} throw an error if val is not a non-empty string or a number
  12039. * @return {String|Number}
  12040. * @api public
  12041. */
  12042. module.exports = function(val, options) {
  12043. options = options || {};
  12044. var type = typeof val;
  12045. if (type === 'string' && val.length > 0) {
  12046. return parse(val);
  12047. } else if (type === 'number' && isNaN(val) === false) {
  12048. return options.long ? fmtLong(val) : fmtShort(val);
  12049. }
  12050. throw new Error(
  12051. 'val is not a non-empty string or a valid number. val=' +
  12052. JSON.stringify(val)
  12053. );
  12054. };
  12055. /**
  12056. * Parse the given `str` and return milliseconds.
  12057. *
  12058. * @param {String} str
  12059. * @return {Number}
  12060. * @api private
  12061. */
  12062. function parse(str) {
  12063. str = String(str);
  12064. if (str.length > 100) {
  12065. return;
  12066. }
  12067. var match = /^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
  12068. str
  12069. );
  12070. if (!match) {
  12071. return;
  12072. }
  12073. var n = parseFloat(match[1]);
  12074. var type = (match[2] || 'ms').toLowerCase();
  12075. switch (type) {
  12076. case 'years':
  12077. case 'year':
  12078. case 'yrs':
  12079. case 'yr':
  12080. case 'y':
  12081. return n * y;
  12082. case 'weeks':
  12083. case 'week':
  12084. case 'w':
  12085. return n * w;
  12086. case 'days':
  12087. case 'day':
  12088. case 'd':
  12089. return n * d;
  12090. case 'hours':
  12091. case 'hour':
  12092. case 'hrs':
  12093. case 'hr':
  12094. case 'h':
  12095. return n * h;
  12096. case 'minutes':
  12097. case 'minute':
  12098. case 'mins':
  12099. case 'min':
  12100. case 'm':
  12101. return n * m;
  12102. case 'seconds':
  12103. case 'second':
  12104. case 'secs':
  12105. case 'sec':
  12106. case 's':
  12107. return n * s;
  12108. case 'milliseconds':
  12109. case 'millisecond':
  12110. case 'msecs':
  12111. case 'msec':
  12112. case 'ms':
  12113. return n;
  12114. default:
  12115. return undefined;
  12116. }
  12117. }
  12118. /**
  12119. * Short format for `ms`.
  12120. *
  12121. * @param {Number} ms
  12122. * @return {String}
  12123. * @api private
  12124. */
  12125. function fmtShort(ms) {
  12126. var msAbs = Math.abs(ms);
  12127. if (msAbs >= d) {
  12128. return Math.round(ms / d) + 'd';
  12129. }
  12130. if (msAbs >= h) {
  12131. return Math.round(ms / h) + 'h';
  12132. }
  12133. if (msAbs >= m) {
  12134. return Math.round(ms / m) + 'm';
  12135. }
  12136. if (msAbs >= s) {
  12137. return Math.round(ms / s) + 's';
  12138. }
  12139. return ms + 'ms';
  12140. }
  12141. /**
  12142. * Long format for `ms`.
  12143. *
  12144. * @param {Number} ms
  12145. * @return {String}
  12146. * @api private
  12147. */
  12148. function fmtLong(ms) {
  12149. var msAbs = Math.abs(ms);
  12150. if (msAbs >= d) {
  12151. return plural(ms, msAbs, d, 'day');
  12152. }
  12153. if (msAbs >= h) {
  12154. return plural(ms, msAbs, h, 'hour');
  12155. }
  12156. if (msAbs >= m) {
  12157. return plural(ms, msAbs, m, 'minute');
  12158. }
  12159. if (msAbs >= s) {
  12160. return plural(ms, msAbs, s, 'second');
  12161. }
  12162. return ms + ' ms';
  12163. }
  12164. /**
  12165. * Pluralization helper.
  12166. */
  12167. function plural(ms, msAbs, n, name) {
  12168. var isPlural = msAbs >= n * 1.5;
  12169. return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
  12170. }
  12171. },{}],61:[function(require,module,exports){
  12172. 'use strict';
  12173. var keysShim;
  12174. if (!Object.keys) {
  12175. // modified from https://github.com/es-shims/es5-shim
  12176. var has = Object.prototype.hasOwnProperty;
  12177. var toStr = Object.prototype.toString;
  12178. var isArgs = require('./isArguments'); // eslint-disable-line global-require
  12179. var isEnumerable = Object.prototype.propertyIsEnumerable;
  12180. var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
  12181. var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
  12182. var dontEnums = [
  12183. 'toString',
  12184. 'toLocaleString',
  12185. 'valueOf',
  12186. 'hasOwnProperty',
  12187. 'isPrototypeOf',
  12188. 'propertyIsEnumerable',
  12189. 'constructor'
  12190. ];
  12191. var equalsConstructorPrototype = function (o) {
  12192. var ctor = o.constructor;
  12193. return ctor && ctor.prototype === o;
  12194. };
  12195. var excludedKeys = {
  12196. $applicationCache: true,
  12197. $console: true,
  12198. $external: true,
  12199. $frame: true,
  12200. $frameElement: true,
  12201. $frames: true,
  12202. $innerHeight: true,
  12203. $innerWidth: true,
  12204. $outerHeight: true,
  12205. $outerWidth: true,
  12206. $pageXOffset: true,
  12207. $pageYOffset: true,
  12208. $parent: true,
  12209. $scrollLeft: true,
  12210. $scrollTop: true,
  12211. $scrollX: true,
  12212. $scrollY: true,
  12213. $self: true,
  12214. $webkitIndexedDB: true,
  12215. $webkitStorageInfo: true,
  12216. $window: true
  12217. };
  12218. var hasAutomationEqualityBug = (function () {
  12219. /* global window */
  12220. if (typeof window === 'undefined') { return false; }
  12221. for (var k in window) {
  12222. try {
  12223. if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
  12224. try {
  12225. equalsConstructorPrototype(window[k]);
  12226. } catch (e) {
  12227. return true;
  12228. }
  12229. }
  12230. } catch (e) {
  12231. return true;
  12232. }
  12233. }
  12234. return false;
  12235. }());
  12236. var equalsConstructorPrototypeIfNotBuggy = function (o) {
  12237. /* global window */
  12238. if (typeof window === 'undefined' || !hasAutomationEqualityBug) {
  12239. return equalsConstructorPrototype(o);
  12240. }
  12241. try {
  12242. return equalsConstructorPrototype(o);
  12243. } catch (e) {
  12244. return false;
  12245. }
  12246. };
  12247. keysShim = function keys(object) {
  12248. var isObject = object !== null && typeof object === 'object';
  12249. var isFunction = toStr.call(object) === '[object Function]';
  12250. var isArguments = isArgs(object);
  12251. var isString = isObject && toStr.call(object) === '[object String]';
  12252. var theKeys = [];
  12253. if (!isObject && !isFunction && !isArguments) {
  12254. throw new TypeError('Object.keys called on a non-object');
  12255. }
  12256. var skipProto = hasProtoEnumBug && isFunction;
  12257. if (isString && object.length > 0 && !has.call(object, 0)) {
  12258. for (var i = 0; i < object.length; ++i) {
  12259. theKeys.push(String(i));
  12260. }
  12261. }
  12262. if (isArguments && object.length > 0) {
  12263. for (var j = 0; j < object.length; ++j) {
  12264. theKeys.push(String(j));
  12265. }
  12266. } else {
  12267. for (var name in object) {
  12268. if (!(skipProto && name === 'prototype') && has.call(object, name)) {
  12269. theKeys.push(String(name));
  12270. }
  12271. }
  12272. }
  12273. if (hasDontEnumBug) {
  12274. var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
  12275. for (var k = 0; k < dontEnums.length; ++k) {
  12276. if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
  12277. theKeys.push(dontEnums[k]);
  12278. }
  12279. }
  12280. }
  12281. return theKeys;
  12282. };
  12283. }
  12284. module.exports = keysShim;
  12285. },{"./isArguments":63}],62:[function(require,module,exports){
  12286. 'use strict';
  12287. var slice = Array.prototype.slice;
  12288. var isArgs = require('./isArguments');
  12289. var origKeys = Object.keys;
  12290. var keysShim = origKeys ? function keys(o) { return origKeys(o); } : require('./implementation');
  12291. var originalKeys = Object.keys;
  12292. keysShim.shim = function shimObjectKeys() {
  12293. if (Object.keys) {
  12294. var keysWorksWithArguments = (function () {
  12295. // Safari 5.0 bug
  12296. var args = Object.keys(arguments);
  12297. return args && args.length === arguments.length;
  12298. }(1, 2));
  12299. if (!keysWorksWithArguments) {
  12300. Object.keys = function keys(object) { // eslint-disable-line func-name-matching
  12301. if (isArgs(object)) {
  12302. return originalKeys(slice.call(object));
  12303. }
  12304. return originalKeys(object);
  12305. };
  12306. }
  12307. } else {
  12308. Object.keys = keysShim;
  12309. }
  12310. return Object.keys || keysShim;
  12311. };
  12312. module.exports = keysShim;
  12313. },{"./implementation":61,"./isArguments":63}],63:[function(require,module,exports){
  12314. 'use strict';
  12315. var toStr = Object.prototype.toString;
  12316. module.exports = function isArguments(value) {
  12317. var str = toStr.call(value);
  12318. var isArgs = str === '[object Arguments]';
  12319. if (!isArgs) {
  12320. isArgs = str !== '[object Array]' &&
  12321. value !== null &&
  12322. typeof value === 'object' &&
  12323. typeof value.length === 'number' &&
  12324. value.length >= 0 &&
  12325. toStr.call(value.callee) === '[object Function]';
  12326. }
  12327. return isArgs;
  12328. };
  12329. },{}],64:[function(require,module,exports){
  12330. 'use strict';
  12331. // modified from https://github.com/es-shims/es6-shim
  12332. var keys = require('object-keys');
  12333. var bind = require('function-bind');
  12334. var canBeObject = function (obj) {
  12335. return typeof obj !== 'undefined' && obj !== null;
  12336. };
  12337. var hasSymbols = require('has-symbols/shams')();
  12338. var toObject = Object;
  12339. var push = bind.call(Function.call, Array.prototype.push);
  12340. var propIsEnumerable = bind.call(Function.call, Object.prototype.propertyIsEnumerable);
  12341. var originalGetSymbols = hasSymbols ? Object.getOwnPropertySymbols : null;
  12342. module.exports = function assign(target, source1) {
  12343. if (!canBeObject(target)) { throw new TypeError('target must be an object'); }
  12344. var objTarget = toObject(target);
  12345. var s, source, i, props, syms, value, key;
  12346. for (s = 1; s < arguments.length; ++s) {
  12347. source = toObject(arguments[s]);
  12348. props = keys(source);
  12349. var getSymbols = hasSymbols && (Object.getOwnPropertySymbols || originalGetSymbols);
  12350. if (getSymbols) {
  12351. syms = getSymbols(source);
  12352. for (i = 0; i < syms.length; ++i) {
  12353. key = syms[i];
  12354. if (propIsEnumerable(source, key)) {
  12355. push(props, key);
  12356. }
  12357. }
  12358. }
  12359. for (i = 0; i < props.length; ++i) {
  12360. key = props[i];
  12361. value = source[key];
  12362. if (propIsEnumerable(source, key)) {
  12363. objTarget[key] = value;
  12364. }
  12365. }
  12366. }
  12367. return objTarget;
  12368. };
  12369. },{"function-bind":52,"has-symbols/shams":53,"object-keys":62}],65:[function(require,module,exports){
  12370. 'use strict';
  12371. var defineProperties = require('define-properties');
  12372. var implementation = require('./implementation');
  12373. var getPolyfill = require('./polyfill');
  12374. var shim = require('./shim');
  12375. var polyfill = getPolyfill();
  12376. defineProperties(polyfill, {
  12377. getPolyfill: getPolyfill,
  12378. implementation: implementation,
  12379. shim: shim
  12380. });
  12381. module.exports = polyfill;
  12382. },{"./implementation":64,"./polyfill":66,"./shim":67,"define-properties":47}],66:[function(require,module,exports){
  12383. 'use strict';
  12384. var implementation = require('./implementation');
  12385. var lacksProperEnumerationOrder = function () {
  12386. if (!Object.assign) {
  12387. return false;
  12388. }
  12389. // v8, specifically in node 4.x, has a bug with incorrect property enumeration order
  12390. // note: this does not detect the bug unless there's 20 characters
  12391. var str = 'abcdefghijklmnopqrst';
  12392. var letters = str.split('');
  12393. var map = {};
  12394. for (var i = 0; i < letters.length; ++i) {
  12395. map[letters[i]] = letters[i];
  12396. }
  12397. var obj = Object.assign({}, map);
  12398. var actual = '';
  12399. for (var k in obj) {
  12400. actual += k;
  12401. }
  12402. return str !== actual;
  12403. };
  12404. var assignHasPendingExceptions = function () {
  12405. if (!Object.assign || !Object.preventExtensions) {
  12406. return false;
  12407. }
  12408. // Firefox 37 still has "pending exception" logic in its Object.assign implementation,
  12409. // which is 72% slower than our shim, and Firefox 40's native implementation.
  12410. var thrower = Object.preventExtensions({ 1: 2 });
  12411. try {
  12412. Object.assign(thrower, 'xy');
  12413. } catch (e) {
  12414. return thrower[1] === 'y';
  12415. }
  12416. return false;
  12417. };
  12418. module.exports = function getPolyfill() {
  12419. if (!Object.assign) {
  12420. return implementation;
  12421. }
  12422. if (lacksProperEnumerationOrder()) {
  12423. return implementation;
  12424. }
  12425. if (assignHasPendingExceptions()) {
  12426. return implementation;
  12427. }
  12428. return Object.assign;
  12429. };
  12430. },{"./implementation":64}],67:[function(require,module,exports){
  12431. 'use strict';
  12432. var define = require('define-properties');
  12433. var getPolyfill = require('./polyfill');
  12434. module.exports = function shimAssign() {
  12435. var polyfill = getPolyfill();
  12436. define(
  12437. Object,
  12438. { assign: polyfill },
  12439. { assign: function () { return Object.assign !== polyfill; } }
  12440. );
  12441. return polyfill;
  12442. };
  12443. },{"./polyfill":66,"define-properties":47}],68:[function(require,module,exports){
  12444. (function (process){
  12445. 'use strict';
  12446. if (!process.version ||
  12447. process.version.indexOf('v0.') === 0 ||
  12448. process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
  12449. module.exports = { nextTick: nextTick };
  12450. } else {
  12451. module.exports = process
  12452. }
  12453. function nextTick(fn, arg1, arg2, arg3) {
  12454. if (typeof fn !== 'function') {
  12455. throw new TypeError('"callback" argument must be a function');
  12456. }
  12457. var len = arguments.length;
  12458. var args, i;
  12459. switch (len) {
  12460. case 0:
  12461. case 1:
  12462. return process.nextTick(fn);
  12463. case 2:
  12464. return process.nextTick(function afterTickOne() {
  12465. fn.call(null, arg1);
  12466. });
  12467. case 3:
  12468. return process.nextTick(function afterTickTwo() {
  12469. fn.call(null, arg1, arg2);
  12470. });
  12471. case 4:
  12472. return process.nextTick(function afterTickThree() {
  12473. fn.call(null, arg1, arg2, arg3);
  12474. });
  12475. default:
  12476. args = new Array(len - 1);
  12477. i = 0;
  12478. while (i < args.length) {
  12479. args[i++] = arguments[i];
  12480. }
  12481. return process.nextTick(function afterTick() {
  12482. fn.apply(null, args);
  12483. });
  12484. }
  12485. }
  12486. }).call(this,require('_process'))
  12487. },{"_process":69}],69:[function(require,module,exports){
  12488. // shim for using process in browser
  12489. var process = module.exports = {};
  12490. // cached from whatever global is present so that test runners that stub it
  12491. // don't break things. But we need to wrap it in a try catch in case it is
  12492. // wrapped in strict mode code which doesn't define any globals. It's inside a
  12493. // function because try/catches deoptimize in certain engines.
  12494. var cachedSetTimeout;
  12495. var cachedClearTimeout;
  12496. function defaultSetTimout() {
  12497. throw new Error('setTimeout has not been defined');
  12498. }
  12499. function defaultClearTimeout () {
  12500. throw new Error('clearTimeout has not been defined');
  12501. }
  12502. (function () {
  12503. try {
  12504. if (typeof setTimeout === 'function') {
  12505. cachedSetTimeout = setTimeout;
  12506. } else {
  12507. cachedSetTimeout = defaultSetTimout;
  12508. }
  12509. } catch (e) {
  12510. cachedSetTimeout = defaultSetTimout;
  12511. }
  12512. try {
  12513. if (typeof clearTimeout === 'function') {
  12514. cachedClearTimeout = clearTimeout;
  12515. } else {
  12516. cachedClearTimeout = defaultClearTimeout;
  12517. }
  12518. } catch (e) {
  12519. cachedClearTimeout = defaultClearTimeout;
  12520. }
  12521. } ())
  12522. function runTimeout(fun) {
  12523. if (cachedSetTimeout === setTimeout) {
  12524. //normal enviroments in sane situations
  12525. return setTimeout(fun, 0);
  12526. }
  12527. // if setTimeout wasn't available but was latter defined
  12528. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  12529. cachedSetTimeout = setTimeout;
  12530. return setTimeout(fun, 0);
  12531. }
  12532. try {
  12533. // when when somebody has screwed with setTimeout but no I.E. maddness
  12534. return cachedSetTimeout(fun, 0);
  12535. } catch(e){
  12536. try {
  12537. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  12538. return cachedSetTimeout.call(null, fun, 0);
  12539. } catch(e){
  12540. // 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
  12541. return cachedSetTimeout.call(this, fun, 0);
  12542. }
  12543. }
  12544. }
  12545. function runClearTimeout(marker) {
  12546. if (cachedClearTimeout === clearTimeout) {
  12547. //normal enviroments in sane situations
  12548. return clearTimeout(marker);
  12549. }
  12550. // if clearTimeout wasn't available but was latter defined
  12551. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  12552. cachedClearTimeout = clearTimeout;
  12553. return clearTimeout(marker);
  12554. }
  12555. try {
  12556. // when when somebody has screwed with setTimeout but no I.E. maddness
  12557. return cachedClearTimeout(marker);
  12558. } catch (e){
  12559. try {
  12560. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  12561. return cachedClearTimeout.call(null, marker);
  12562. } catch (e){
  12563. // 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.
  12564. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  12565. return cachedClearTimeout.call(this, marker);
  12566. }
  12567. }
  12568. }
  12569. var queue = [];
  12570. var draining = false;
  12571. var currentQueue;
  12572. var queueIndex = -1;
  12573. function cleanUpNextTick() {
  12574. if (!draining || !currentQueue) {
  12575. return;
  12576. }
  12577. draining = false;
  12578. if (currentQueue.length) {
  12579. queue = currentQueue.concat(queue);
  12580. } else {
  12581. queueIndex = -1;
  12582. }
  12583. if (queue.length) {
  12584. drainQueue();
  12585. }
  12586. }
  12587. function drainQueue() {
  12588. if (draining) {
  12589. return;
  12590. }
  12591. var timeout = runTimeout(cleanUpNextTick);
  12592. draining = true;
  12593. var len = queue.length;
  12594. while(len) {
  12595. currentQueue = queue;
  12596. queue = [];
  12597. while (++queueIndex < len) {
  12598. if (currentQueue) {
  12599. currentQueue[queueIndex].run();
  12600. }
  12601. }
  12602. queueIndex = -1;
  12603. len = queue.length;
  12604. }
  12605. currentQueue = null;
  12606. draining = false;
  12607. runClearTimeout(timeout);
  12608. }
  12609. process.nextTick = function (fun) {
  12610. var args = new Array(arguments.length - 1);
  12611. if (arguments.length > 1) {
  12612. for (var i = 1; i < arguments.length; i++) {
  12613. args[i - 1] = arguments[i];
  12614. }
  12615. }
  12616. queue.push(new Item(fun, args));
  12617. if (queue.length === 1 && !draining) {
  12618. runTimeout(drainQueue);
  12619. }
  12620. };
  12621. // v8 likes predictible objects
  12622. function Item(fun, array) {
  12623. this.fun = fun;
  12624. this.array = array;
  12625. }
  12626. Item.prototype.run = function () {
  12627. this.fun.apply(null, this.array);
  12628. };
  12629. process.title = 'browser';
  12630. process.browser = true;
  12631. process.env = {};
  12632. process.argv = [];
  12633. process.version = ''; // empty string to avoid regexp issues
  12634. process.versions = {};
  12635. function noop() {}
  12636. process.on = noop;
  12637. process.addListener = noop;
  12638. process.once = noop;
  12639. process.off = noop;
  12640. process.removeListener = noop;
  12641. process.removeAllListeners = noop;
  12642. process.emit = noop;
  12643. process.prependListener = noop;
  12644. process.prependOnceListener = noop;
  12645. process.listeners = function (name) { return [] }
  12646. process.binding = function (name) {
  12647. throw new Error('process.binding is not supported');
  12648. };
  12649. process.cwd = function () { return '/' };
  12650. process.chdir = function (dir) {
  12651. throw new Error('process.chdir is not supported');
  12652. };
  12653. process.umask = function() { return 0; };
  12654. },{}],70:[function(require,module,exports){
  12655. module.exports = require('./lib/_stream_duplex.js');
  12656. },{"./lib/_stream_duplex.js":71}],71:[function(require,module,exports){
  12657. // Copyright Joyent, Inc. and other Node contributors.
  12658. //
  12659. // Permission is hereby granted, free of charge, to any person obtaining a
  12660. // copy of this software and associated documentation files (the
  12661. // "Software"), to deal in the Software without restriction, including
  12662. // without limitation the rights to use, copy, modify, merge, publish,
  12663. // distribute, sublicense, and/or sell copies of the Software, and to permit
  12664. // persons to whom the Software is furnished to do so, subject to the
  12665. // following conditions:
  12666. //
  12667. // The above copyright notice and this permission notice shall be included
  12668. // in all copies or substantial portions of the Software.
  12669. //
  12670. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  12671. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  12672. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  12673. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  12674. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  12675. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  12676. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  12677. // a duplex stream is just a stream that is both readable and writable.
  12678. // Since JS doesn't have multiple prototypal inheritance, this class
  12679. // prototypally inherits from Readable, and then parasitically from
  12680. // Writable.
  12681. 'use strict';
  12682. /*<replacement>*/
  12683. var pna = require('process-nextick-args');
  12684. /*</replacement>*/
  12685. /*<replacement>*/
  12686. var objectKeys = Object.keys || function (obj) {
  12687. var keys = [];
  12688. for (var key in obj) {
  12689. keys.push(key);
  12690. }return keys;
  12691. };
  12692. /*</replacement>*/
  12693. module.exports = Duplex;
  12694. /*<replacement>*/
  12695. var util = require('core-util-is');
  12696. util.inherits = require('inherits');
  12697. /*</replacement>*/
  12698. var Readable = require('./_stream_readable');
  12699. var Writable = require('./_stream_writable');
  12700. util.inherits(Duplex, Readable);
  12701. {
  12702. // avoid scope creep, the keys array can then be collected
  12703. var keys = objectKeys(Writable.prototype);
  12704. for (var v = 0; v < keys.length; v++) {
  12705. var method = keys[v];
  12706. if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
  12707. }
  12708. }
  12709. function Duplex(options) {
  12710. if (!(this instanceof Duplex)) return new Duplex(options);
  12711. Readable.call(this, options);
  12712. Writable.call(this, options);
  12713. if (options && options.readable === false) this.readable = false;
  12714. if (options && options.writable === false) this.writable = false;
  12715. this.allowHalfOpen = true;
  12716. if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
  12717. this.once('end', onend);
  12718. }
  12719. Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
  12720. // making it explicit this property is not enumerable
  12721. // because otherwise some prototype manipulation in
  12722. // userland will fail
  12723. enumerable: false,
  12724. get: function () {
  12725. return this._writableState.highWaterMark;
  12726. }
  12727. });
  12728. // the no-half-open enforcer
  12729. function onend() {
  12730. // if we allow half-open state, or if the writable side ended,
  12731. // then we're ok.
  12732. if (this.allowHalfOpen || this._writableState.ended) return;
  12733. // no more data can be written.
  12734. // But allow more writes to happen in this tick.
  12735. pna.nextTick(onEndNT, this);
  12736. }
  12737. function onEndNT(self) {
  12738. self.end();
  12739. }
  12740. Object.defineProperty(Duplex.prototype, 'destroyed', {
  12741. get: function () {
  12742. if (this._readableState === undefined || this._writableState === undefined) {
  12743. return false;
  12744. }
  12745. return this._readableState.destroyed && this._writableState.destroyed;
  12746. },
  12747. set: function (value) {
  12748. // we ignore the value if the stream
  12749. // has not been initialized yet
  12750. if (this._readableState === undefined || this._writableState === undefined) {
  12751. return;
  12752. }
  12753. // backward compatibility, the user is explicitly
  12754. // managing destroyed
  12755. this._readableState.destroyed = value;
  12756. this._writableState.destroyed = value;
  12757. }
  12758. });
  12759. Duplex.prototype._destroy = function (err, cb) {
  12760. this.push(null);
  12761. this.end();
  12762. pna.nextTick(cb, err);
  12763. };
  12764. },{"./_stream_readable":73,"./_stream_writable":75,"core-util-is":44,"inherits":56,"process-nextick-args":68}],72:[function(require,module,exports){
  12765. // Copyright Joyent, Inc. and other Node contributors.
  12766. //
  12767. // Permission is hereby granted, free of charge, to any person obtaining a
  12768. // copy of this software and associated documentation files (the
  12769. // "Software"), to deal in the Software without restriction, including
  12770. // without limitation the rights to use, copy, modify, merge, publish,
  12771. // distribute, sublicense, and/or sell copies of the Software, and to permit
  12772. // persons to whom the Software is furnished to do so, subject to the
  12773. // following conditions:
  12774. //
  12775. // The above copyright notice and this permission notice shall be included
  12776. // in all copies or substantial portions of the Software.
  12777. //
  12778. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  12779. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  12780. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  12781. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  12782. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  12783. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  12784. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  12785. // a passthrough stream.
  12786. // basically just the most minimal sort of Transform stream.
  12787. // Every written chunk gets output as-is.
  12788. 'use strict';
  12789. module.exports = PassThrough;
  12790. var Transform = require('./_stream_transform');
  12791. /*<replacement>*/
  12792. var util = require('core-util-is');
  12793. util.inherits = require('inherits');
  12794. /*</replacement>*/
  12795. util.inherits(PassThrough, Transform);
  12796. function PassThrough(options) {
  12797. if (!(this instanceof PassThrough)) return new PassThrough(options);
  12798. Transform.call(this, options);
  12799. }
  12800. PassThrough.prototype._transform = function (chunk, encoding, cb) {
  12801. cb(null, chunk);
  12802. };
  12803. },{"./_stream_transform":74,"core-util-is":44,"inherits":56}],73:[function(require,module,exports){
  12804. (function (process,global){
  12805. // Copyright Joyent, Inc. and other Node contributors.
  12806. //
  12807. // Permission is hereby granted, free of charge, to any person obtaining a
  12808. // copy of this software and associated documentation files (the
  12809. // "Software"), to deal in the Software without restriction, including
  12810. // without limitation the rights to use, copy, modify, merge, publish,
  12811. // distribute, sublicense, and/or sell copies of the Software, and to permit
  12812. // persons to whom the Software is furnished to do so, subject to the
  12813. // following conditions:
  12814. //
  12815. // The above copyright notice and this permission notice shall be included
  12816. // in all copies or substantial portions of the Software.
  12817. //
  12818. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  12819. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  12820. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  12821. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  12822. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  12823. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  12824. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  12825. 'use strict';
  12826. /*<replacement>*/
  12827. var pna = require('process-nextick-args');
  12828. /*</replacement>*/
  12829. module.exports = Readable;
  12830. /*<replacement>*/
  12831. var isArray = require('isarray');
  12832. /*</replacement>*/
  12833. /*<replacement>*/
  12834. var Duplex;
  12835. /*</replacement>*/
  12836. Readable.ReadableState = ReadableState;
  12837. /*<replacement>*/
  12838. var EE = require('events').EventEmitter;
  12839. var EElistenerCount = function (emitter, type) {
  12840. return emitter.listeners(type).length;
  12841. };
  12842. /*</replacement>*/
  12843. /*<replacement>*/
  12844. var Stream = require('./internal/streams/stream');
  12845. /*</replacement>*/
  12846. /*<replacement>*/
  12847. var Buffer = require('safe-buffer').Buffer;
  12848. var OurUint8Array = global.Uint8Array || function () {};
  12849. function _uint8ArrayToBuffer(chunk) {
  12850. return Buffer.from(chunk);
  12851. }
  12852. function _isUint8Array(obj) {
  12853. return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
  12854. }
  12855. /*</replacement>*/
  12856. /*<replacement>*/
  12857. var util = require('core-util-is');
  12858. util.inherits = require('inherits');
  12859. /*</replacement>*/
  12860. /*<replacement>*/
  12861. var debugUtil = require('util');
  12862. var debug = void 0;
  12863. if (debugUtil && debugUtil.debuglog) {
  12864. debug = debugUtil.debuglog('stream');
  12865. } else {
  12866. debug = function () {};
  12867. }
  12868. /*</replacement>*/
  12869. var BufferList = require('./internal/streams/BufferList');
  12870. var destroyImpl = require('./internal/streams/destroy');
  12871. var StringDecoder;
  12872. util.inherits(Readable, Stream);
  12873. var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
  12874. function prependListener(emitter, event, fn) {
  12875. // Sadly this is not cacheable as some libraries bundle their own
  12876. // event emitter implementation with them.
  12877. if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
  12878. // This is a hack to make sure that our error handler is attached before any
  12879. // userland ones. NEVER DO THIS. This is here only because this code needs
  12880. // to continue to work with older versions of Node.js that do not include
  12881. // the prependListener() method. The goal is to eventually remove this hack.
  12882. if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
  12883. }
  12884. function ReadableState(options, stream) {
  12885. Duplex = Duplex || require('./_stream_duplex');
  12886. options = options || {};
  12887. // Duplex streams are both readable and writable, but share
  12888. // the same options object.
  12889. // However, some cases require setting options to different
  12890. // values for the readable and the writable sides of the duplex stream.
  12891. // These options can be provided separately as readableXXX and writableXXX.
  12892. var isDuplex = stream instanceof Duplex;
  12893. // object stream flag. Used to make read(n) ignore n and to
  12894. // make all the buffer merging and length checks go away
  12895. this.objectMode = !!options.objectMode;
  12896. if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
  12897. // the point at which it stops calling _read() to fill the buffer
  12898. // Note: 0 is a valid value, means "don't call _read preemptively ever"
  12899. var hwm = options.highWaterMark;
  12900. var readableHwm = options.readableHighWaterMark;
  12901. var defaultHwm = this.objectMode ? 16 : 16 * 1024;
  12902. if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;
  12903. // cast to ints.
  12904. this.highWaterMark = Math.floor(this.highWaterMark);
  12905. // A linked list is used to store data chunks instead of an array because the
  12906. // linked list can remove elements from the beginning faster than
  12907. // array.shift()
  12908. this.buffer = new BufferList();
  12909. this.length = 0;
  12910. this.pipes = null;
  12911. this.pipesCount = 0;
  12912. this.flowing = null;
  12913. this.ended = false;
  12914. this.endEmitted = false;
  12915. this.reading = false;
  12916. // a flag to be able to tell if the event 'readable'/'data' is emitted
  12917. // immediately, or on a later tick. We set this to true at first, because
  12918. // any actions that shouldn't happen until "later" should generally also
  12919. // not happen before the first read call.
  12920. this.sync = true;
  12921. // whenever we return null, then we set a flag to say
  12922. // that we're awaiting a 'readable' event emission.
  12923. this.needReadable = false;
  12924. this.emittedReadable = false;
  12925. this.readableListening = false;
  12926. this.resumeScheduled = false;
  12927. // has it been destroyed
  12928. this.destroyed = false;
  12929. // Crypto is kind of old and crusty. Historically, its default string
  12930. // encoding is 'binary' so we have to make this configurable.
  12931. // Everything else in the universe uses 'utf8', though.
  12932. this.defaultEncoding = options.defaultEncoding || 'utf8';
  12933. // the number of writers that are awaiting a drain event in .pipe()s
  12934. this.awaitDrain = 0;
  12935. // if true, a maybeReadMore has been scheduled
  12936. this.readingMore = false;
  12937. this.decoder = null;
  12938. this.encoding = null;
  12939. if (options.encoding) {
  12940. if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
  12941. this.decoder = new StringDecoder(options.encoding);
  12942. this.encoding = options.encoding;
  12943. }
  12944. }
  12945. function Readable(options) {
  12946. Duplex = Duplex || require('./_stream_duplex');
  12947. if (!(this instanceof Readable)) return new Readable(options);
  12948. this._readableState = new ReadableState(options, this);
  12949. // legacy
  12950. this.readable = true;
  12951. if (options) {
  12952. if (typeof options.read === 'function') this._read = options.read;
  12953. if (typeof options.destroy === 'function') this._destroy = options.destroy;
  12954. }
  12955. Stream.call(this);
  12956. }
  12957. Object.defineProperty(Readable.prototype, 'destroyed', {
  12958. get: function () {
  12959. if (this._readableState === undefined) {
  12960. return false;
  12961. }
  12962. return this._readableState.destroyed;
  12963. },
  12964. set: function (value) {
  12965. // we ignore the value if the stream
  12966. // has not been initialized yet
  12967. if (!this._readableState) {
  12968. return;
  12969. }
  12970. // backward compatibility, the user is explicitly
  12971. // managing destroyed
  12972. this._readableState.destroyed = value;
  12973. }
  12974. });
  12975. Readable.prototype.destroy = destroyImpl.destroy;
  12976. Readable.prototype._undestroy = destroyImpl.undestroy;
  12977. Readable.prototype._destroy = function (err, cb) {
  12978. this.push(null);
  12979. cb(err);
  12980. };
  12981. // Manually shove something into the read() buffer.
  12982. // This returns true if the highWaterMark has not been hit yet,
  12983. // similar to how Writable.write() returns true if you should
  12984. // write() some more.
  12985. Readable.prototype.push = function (chunk, encoding) {
  12986. var state = this._readableState;
  12987. var skipChunkCheck;
  12988. if (!state.objectMode) {
  12989. if (typeof chunk === 'string') {
  12990. encoding = encoding || state.defaultEncoding;
  12991. if (encoding !== state.encoding) {
  12992. chunk = Buffer.from(chunk, encoding);
  12993. encoding = '';
  12994. }
  12995. skipChunkCheck = true;
  12996. }
  12997. } else {
  12998. skipChunkCheck = true;
  12999. }
  13000. return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
  13001. };
  13002. // Unshift should *always* be something directly out of read()
  13003. Readable.prototype.unshift = function (chunk) {
  13004. return readableAddChunk(this, chunk, null, true, false);
  13005. };
  13006. function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
  13007. var state = stream._readableState;
  13008. if (chunk === null) {
  13009. state.reading = false;
  13010. onEofChunk(stream, state);
  13011. } else {
  13012. var er;
  13013. if (!skipChunkCheck) er = chunkInvalid(state, chunk);
  13014. if (er) {
  13015. stream.emit('error', er);
  13016. } else if (state.objectMode || chunk && chunk.length > 0) {
  13017. if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
  13018. chunk = _uint8ArrayToBuffer(chunk);
  13019. }
  13020. if (addToFront) {
  13021. if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);
  13022. } else if (state.ended) {
  13023. stream.emit('error', new Error('stream.push() after EOF'));
  13024. } else {
  13025. state.reading = false;
  13026. if (state.decoder && !encoding) {
  13027. chunk = state.decoder.write(chunk);
  13028. if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
  13029. } else {
  13030. addChunk(stream, state, chunk, false);
  13031. }
  13032. }
  13033. } else if (!addToFront) {
  13034. state.reading = false;
  13035. }
  13036. }
  13037. return needMoreData(state);
  13038. }
  13039. function addChunk(stream, state, chunk, addToFront) {
  13040. if (state.flowing && state.length === 0 && !state.sync) {
  13041. stream.emit('data', chunk);
  13042. stream.read(0);
  13043. } else {
  13044. // update the buffer info.
  13045. state.length += state.objectMode ? 1 : chunk.length;
  13046. if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
  13047. if (state.needReadable) emitReadable(stream);
  13048. }
  13049. maybeReadMore(stream, state);
  13050. }
  13051. function chunkInvalid(state, chunk) {
  13052. var er;
  13053. if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
  13054. er = new TypeError('Invalid non-string/buffer chunk');
  13055. }
  13056. return er;
  13057. }
  13058. // if it's past the high water mark, we can push in some more.
  13059. // Also, if we have no data yet, we can stand some
  13060. // more bytes. This is to work around cases where hwm=0,
  13061. // such as the repl. Also, if the push() triggered a
  13062. // readable event, and the user called read(largeNumber) such that
  13063. // needReadable was set, then we ought to push more, so that another
  13064. // 'readable' event will be triggered.
  13065. function needMoreData(state) {
  13066. return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
  13067. }
  13068. Readable.prototype.isPaused = function () {
  13069. return this._readableState.flowing === false;
  13070. };
  13071. // backwards compatibility.
  13072. Readable.prototype.setEncoding = function (enc) {
  13073. if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
  13074. this._readableState.decoder = new StringDecoder(enc);
  13075. this._readableState.encoding = enc;
  13076. return this;
  13077. };
  13078. // Don't raise the hwm > 8MB
  13079. var MAX_HWM = 0x800000;
  13080. function computeNewHighWaterMark(n) {
  13081. if (n >= MAX_HWM) {
  13082. n = MAX_HWM;
  13083. } else {
  13084. // Get the next highest power of 2 to prevent increasing hwm excessively in
  13085. // tiny amounts
  13086. n--;
  13087. n |= n >>> 1;
  13088. n |= n >>> 2;
  13089. n |= n >>> 4;
  13090. n |= n >>> 8;
  13091. n |= n >>> 16;
  13092. n++;
  13093. }
  13094. return n;
  13095. }
  13096. // This function is designed to be inlinable, so please take care when making
  13097. // changes to the function body.
  13098. function howMuchToRead(n, state) {
  13099. if (n <= 0 || state.length === 0 && state.ended) return 0;
  13100. if (state.objectMode) return 1;
  13101. if (n !== n) {
  13102. // Only flow one buffer at a time
  13103. if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
  13104. }
  13105. // If we're asking for more than the current hwm, then raise the hwm.
  13106. if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
  13107. if (n <= state.length) return n;
  13108. // Don't have enough
  13109. if (!state.ended) {
  13110. state.needReadable = true;
  13111. return 0;
  13112. }
  13113. return state.length;
  13114. }
  13115. // you can override either this method, or the async _read(n) below.
  13116. Readable.prototype.read = function (n) {
  13117. debug('read', n);
  13118. n = parseInt(n, 10);
  13119. var state = this._readableState;
  13120. var nOrig = n;
  13121. if (n !== 0) state.emittedReadable = false;
  13122. // if we're doing read(0) to trigger a readable event, but we
  13123. // already have a bunch of data in the buffer, then just trigger
  13124. // the 'readable' event and move on.
  13125. if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
  13126. debug('read: emitReadable', state.length, state.ended);
  13127. if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
  13128. return null;
  13129. }
  13130. n = howMuchToRead(n, state);
  13131. // if we've ended, and we're now clear, then finish it up.
  13132. if (n === 0 && state.ended) {
  13133. if (state.length === 0) endReadable(this);
  13134. return null;
  13135. }
  13136. // All the actual chunk generation logic needs to be
  13137. // *below* the call to _read. The reason is that in certain
  13138. // synthetic stream cases, such as passthrough streams, _read
  13139. // may be a completely synchronous operation which may change
  13140. // the state of the read buffer, providing enough data when
  13141. // before there was *not* enough.
  13142. //
  13143. // So, the steps are:
  13144. // 1. Figure out what the state of things will be after we do
  13145. // a read from the buffer.
  13146. //
  13147. // 2. If that resulting state will trigger a _read, then call _read.
  13148. // Note that this may be asynchronous, or synchronous. Yes, it is
  13149. // deeply ugly to write APIs this way, but that still doesn't mean
  13150. // that the Readable class should behave improperly, as streams are
  13151. // designed to be sync/async agnostic.
  13152. // Take note if the _read call is sync or async (ie, if the read call
  13153. // has returned yet), so that we know whether or not it's safe to emit
  13154. // 'readable' etc.
  13155. //
  13156. // 3. Actually pull the requested chunks out of the buffer and return.
  13157. // if we need a readable event, then we need to do some reading.
  13158. var doRead = state.needReadable;
  13159. debug('need readable', doRead);
  13160. // if we currently have less than the highWaterMark, then also read some
  13161. if (state.length === 0 || state.length - n < state.highWaterMark) {
  13162. doRead = true;
  13163. debug('length less than watermark', doRead);
  13164. }
  13165. // however, if we've ended, then there's no point, and if we're already
  13166. // reading, then it's unnecessary.
  13167. if (state.ended || state.reading) {
  13168. doRead = false;
  13169. debug('reading or ended', doRead);
  13170. } else if (doRead) {
  13171. debug('do read');
  13172. state.reading = true;
  13173. state.sync = true;
  13174. // if the length is currently zero, then we *need* a readable event.
  13175. if (state.length === 0) state.needReadable = true;
  13176. // call internal read method
  13177. this._read(state.highWaterMark);
  13178. state.sync = false;
  13179. // If _read pushed data synchronously, then `reading` will be false,
  13180. // and we need to re-evaluate how much data we can return to the user.
  13181. if (!state.reading) n = howMuchToRead(nOrig, state);
  13182. }
  13183. var ret;
  13184. if (n > 0) ret = fromList(n, state);else ret = null;
  13185. if (ret === null) {
  13186. state.needReadable = true;
  13187. n = 0;
  13188. } else {
  13189. state.length -= n;
  13190. }
  13191. if (state.length === 0) {
  13192. // If we have nothing in the buffer, then we want to know
  13193. // as soon as we *do* get something into the buffer.
  13194. if (!state.ended) state.needReadable = true;
  13195. // If we tried to read() past the EOF, then emit end on the next tick.
  13196. if (nOrig !== n && state.ended) endReadable(this);
  13197. }
  13198. if (ret !== null) this.emit('data', ret);
  13199. return ret;
  13200. };
  13201. function onEofChunk(stream, state) {
  13202. if (state.ended) return;
  13203. if (state.decoder) {
  13204. var chunk = state.decoder.end();
  13205. if (chunk && chunk.length) {
  13206. state.buffer.push(chunk);
  13207. state.length += state.objectMode ? 1 : chunk.length;
  13208. }
  13209. }
  13210. state.ended = true;
  13211. // emit 'readable' now to make sure it gets picked up.
  13212. emitReadable(stream);
  13213. }
  13214. // Don't emit readable right away in sync mode, because this can trigger
  13215. // another read() call => stack overflow. This way, it might trigger
  13216. // a nextTick recursion warning, but that's not so bad.
  13217. function emitReadable(stream) {
  13218. var state = stream._readableState;
  13219. state.needReadable = false;
  13220. if (!state.emittedReadable) {
  13221. debug('emitReadable', state.flowing);
  13222. state.emittedReadable = true;
  13223. if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);
  13224. }
  13225. }
  13226. function emitReadable_(stream) {
  13227. debug('emit readable');
  13228. stream.emit('readable');
  13229. flow(stream);
  13230. }
  13231. // at this point, the user has presumably seen the 'readable' event,
  13232. // and called read() to consume some data. that may have triggered
  13233. // in turn another _read(n) call, in which case reading = true if
  13234. // it's in progress.
  13235. // However, if we're not ended, or reading, and the length < hwm,
  13236. // then go ahead and try to read some more preemptively.
  13237. function maybeReadMore(stream, state) {
  13238. if (!state.readingMore) {
  13239. state.readingMore = true;
  13240. pna.nextTick(maybeReadMore_, stream, state);
  13241. }
  13242. }
  13243. function maybeReadMore_(stream, state) {
  13244. var len = state.length;
  13245. while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
  13246. debug('maybeReadMore read 0');
  13247. stream.read(0);
  13248. if (len === state.length)
  13249. // didn't get any data, stop spinning.
  13250. break;else len = state.length;
  13251. }
  13252. state.readingMore = false;
  13253. }
  13254. // abstract method. to be overridden in specific implementation classes.
  13255. // call cb(er, data) where data is <= n in length.
  13256. // for virtual (non-string, non-buffer) streams, "length" is somewhat
  13257. // arbitrary, and perhaps not very meaningful.
  13258. Readable.prototype._read = function (n) {
  13259. this.emit('error', new Error('_read() is not implemented'));
  13260. };
  13261. Readable.prototype.pipe = function (dest, pipeOpts) {
  13262. var src = this;
  13263. var state = this._readableState;
  13264. switch (state.pipesCount) {
  13265. case 0:
  13266. state.pipes = dest;
  13267. break;
  13268. case 1:
  13269. state.pipes = [state.pipes, dest];
  13270. break;
  13271. default:
  13272. state.pipes.push(dest);
  13273. break;
  13274. }
  13275. state.pipesCount += 1;
  13276. debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
  13277. var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
  13278. var endFn = doEnd ? onend : unpipe;
  13279. if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);
  13280. dest.on('unpipe', onunpipe);
  13281. function onunpipe(readable, unpipeInfo) {
  13282. debug('onunpipe');
  13283. if (readable === src) {
  13284. if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
  13285. unpipeInfo.hasUnpiped = true;
  13286. cleanup();
  13287. }
  13288. }
  13289. }
  13290. function onend() {
  13291. debug('onend');
  13292. dest.end();
  13293. }
  13294. // when the dest drains, it reduces the awaitDrain counter
  13295. // on the source. This would be more elegant with a .once()
  13296. // handler in flow(), but adding and removing repeatedly is
  13297. // too slow.
  13298. var ondrain = pipeOnDrain(src);
  13299. dest.on('drain', ondrain);
  13300. var cleanedUp = false;
  13301. function cleanup() {
  13302. debug('cleanup');
  13303. // cleanup event handlers once the pipe is broken
  13304. dest.removeListener('close', onclose);
  13305. dest.removeListener('finish', onfinish);
  13306. dest.removeListener('drain', ondrain);
  13307. dest.removeListener('error', onerror);
  13308. dest.removeListener('unpipe', onunpipe);
  13309. src.removeListener('end', onend);
  13310. src.removeListener('end', unpipe);
  13311. src.removeListener('data', ondata);
  13312. cleanedUp = true;
  13313. // if the reader is waiting for a drain event from this
  13314. // specific writer, then it would cause it to never start
  13315. // flowing again.
  13316. // So, if this is awaiting a drain, then we just call it now.
  13317. // If we don't know, then assume that we are waiting for one.
  13318. if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
  13319. }
  13320. // If the user pushes more data while we're writing to dest then we'll end up
  13321. // in ondata again. However, we only want to increase awaitDrain once because
  13322. // dest will only emit one 'drain' event for the multiple writes.
  13323. // => Introduce a guard on increasing awaitDrain.
  13324. var increasedAwaitDrain = false;
  13325. src.on('data', ondata);
  13326. function ondata(chunk) {
  13327. debug('ondata');
  13328. increasedAwaitDrain = false;
  13329. var ret = dest.write(chunk);
  13330. if (false === ret && !increasedAwaitDrain) {
  13331. // If the user unpiped during `dest.write()`, it is possible
  13332. // to get stuck in a permanently paused state if that write
  13333. // also returned false.
  13334. // => Check whether `dest` is still a piping destination.
  13335. if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
  13336. debug('false write response, pause', src._readableState.awaitDrain);
  13337. src._readableState.awaitDrain++;
  13338. increasedAwaitDrain = true;
  13339. }
  13340. src.pause();
  13341. }
  13342. }
  13343. // if the dest has an error, then stop piping into it.
  13344. // however, don't suppress the throwing behavior for this.
  13345. function onerror(er) {
  13346. debug('onerror', er);
  13347. unpipe();
  13348. dest.removeListener('error', onerror);
  13349. if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
  13350. }
  13351. // Make sure our error handler is attached before userland ones.
  13352. prependListener(dest, 'error', onerror);
  13353. // Both close and finish should trigger unpipe, but only once.
  13354. function onclose() {
  13355. dest.removeListener('finish', onfinish);
  13356. unpipe();
  13357. }
  13358. dest.once('close', onclose);
  13359. function onfinish() {
  13360. debug('onfinish');
  13361. dest.removeListener('close', onclose);
  13362. unpipe();
  13363. }
  13364. dest.once('finish', onfinish);
  13365. function unpipe() {
  13366. debug('unpipe');
  13367. src.unpipe(dest);
  13368. }
  13369. // tell the dest that it's being piped to
  13370. dest.emit('pipe', src);
  13371. // start the flow if it hasn't been started already.
  13372. if (!state.flowing) {
  13373. debug('pipe resume');
  13374. src.resume();
  13375. }
  13376. return dest;
  13377. };
  13378. function pipeOnDrain(src) {
  13379. return function () {
  13380. var state = src._readableState;
  13381. debug('pipeOnDrain', state.awaitDrain);
  13382. if (state.awaitDrain) state.awaitDrain--;
  13383. if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
  13384. state.flowing = true;
  13385. flow(src);
  13386. }
  13387. };
  13388. }
  13389. Readable.prototype.unpipe = function (dest) {
  13390. var state = this._readableState;
  13391. var unpipeInfo = { hasUnpiped: false };
  13392. // if we're not piping anywhere, then do nothing.
  13393. if (state.pipesCount === 0) return this;
  13394. // just one destination. most common case.
  13395. if (state.pipesCount === 1) {
  13396. // passed in one, but it's not the right one.
  13397. if (dest && dest !== state.pipes) return this;
  13398. if (!dest) dest = state.pipes;
  13399. // got a match.
  13400. state.pipes = null;
  13401. state.pipesCount = 0;
  13402. state.flowing = false;
  13403. if (dest) dest.emit('unpipe', this, unpipeInfo);
  13404. return this;
  13405. }
  13406. // slow case. multiple pipe destinations.
  13407. if (!dest) {
  13408. // remove all.
  13409. var dests = state.pipes;
  13410. var len = state.pipesCount;
  13411. state.pipes = null;
  13412. state.pipesCount = 0;
  13413. state.flowing = false;
  13414. for (var i = 0; i < len; i++) {
  13415. dests[i].emit('unpipe', this, unpipeInfo);
  13416. }return this;
  13417. }
  13418. // try to find the right one.
  13419. var index = indexOf(state.pipes, dest);
  13420. if (index === -1) return this;
  13421. state.pipes.splice(index, 1);
  13422. state.pipesCount -= 1;
  13423. if (state.pipesCount === 1) state.pipes = state.pipes[0];
  13424. dest.emit('unpipe', this, unpipeInfo);
  13425. return this;
  13426. };
  13427. // set up data events if they are asked for
  13428. // Ensure readable listeners eventually get something
  13429. Readable.prototype.on = function (ev, fn) {
  13430. var res = Stream.prototype.on.call(this, ev, fn);
  13431. if (ev === 'data') {
  13432. // Start flowing on next tick if stream isn't explicitly paused
  13433. if (this._readableState.flowing !== false) this.resume();
  13434. } else if (ev === 'readable') {
  13435. var state = this._readableState;
  13436. if (!state.endEmitted && !state.readableListening) {
  13437. state.readableListening = state.needReadable = true;
  13438. state.emittedReadable = false;
  13439. if (!state.reading) {
  13440. pna.nextTick(nReadingNextTick, this);
  13441. } else if (state.length) {
  13442. emitReadable(this);
  13443. }
  13444. }
  13445. }
  13446. return res;
  13447. };
  13448. Readable.prototype.addListener = Readable.prototype.on;
  13449. function nReadingNextTick(self) {
  13450. debug('readable nexttick read 0');
  13451. self.read(0);
  13452. }
  13453. // pause() and resume() are remnants of the legacy readable stream API
  13454. // If the user uses them, then switch into old mode.
  13455. Readable.prototype.resume = function () {
  13456. var state = this._readableState;
  13457. if (!state.flowing) {
  13458. debug('resume');
  13459. state.flowing = true;
  13460. resume(this, state);
  13461. }
  13462. return this;
  13463. };
  13464. function resume(stream, state) {
  13465. if (!state.resumeScheduled) {
  13466. state.resumeScheduled = true;
  13467. pna.nextTick(resume_, stream, state);
  13468. }
  13469. }
  13470. function resume_(stream, state) {
  13471. if (!state.reading) {
  13472. debug('resume read 0');
  13473. stream.read(0);
  13474. }
  13475. state.resumeScheduled = false;
  13476. state.awaitDrain = 0;
  13477. stream.emit('resume');
  13478. flow(stream);
  13479. if (state.flowing && !state.reading) stream.read(0);
  13480. }
  13481. Readable.prototype.pause = function () {
  13482. debug('call pause flowing=%j', this._readableState.flowing);
  13483. if (false !== this._readableState.flowing) {
  13484. debug('pause');
  13485. this._readableState.flowing = false;
  13486. this.emit('pause');
  13487. }
  13488. return this;
  13489. };
  13490. function flow(stream) {
  13491. var state = stream._readableState;
  13492. debug('flow', state.flowing);
  13493. while (state.flowing && stream.read() !== null) {}
  13494. }
  13495. // wrap an old-style stream as the async data source.
  13496. // This is *not* part of the readable stream interface.
  13497. // It is an ugly unfortunate mess of history.
  13498. Readable.prototype.wrap = function (stream) {
  13499. var _this = this;
  13500. var state = this._readableState;
  13501. var paused = false;
  13502. stream.on('end', function () {
  13503. debug('wrapped end');
  13504. if (state.decoder && !state.ended) {
  13505. var chunk = state.decoder.end();
  13506. if (chunk && chunk.length) _this.push(chunk);
  13507. }
  13508. _this.push(null);
  13509. });
  13510. stream.on('data', function (chunk) {
  13511. debug('wrapped data');
  13512. if (state.decoder) chunk = state.decoder.write(chunk);
  13513. // don't skip over falsy values in objectMode
  13514. if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
  13515. var ret = _this.push(chunk);
  13516. if (!ret) {
  13517. paused = true;
  13518. stream.pause();
  13519. }
  13520. });
  13521. // proxy all the other methods.
  13522. // important when wrapping filters and duplexes.
  13523. for (var i in stream) {
  13524. if (this[i] === undefined && typeof stream[i] === 'function') {
  13525. this[i] = function (method) {
  13526. return function () {
  13527. return stream[method].apply(stream, arguments);
  13528. };
  13529. }(i);
  13530. }
  13531. }
  13532. // proxy certain important events.
  13533. for (var n = 0; n < kProxyEvents.length; n++) {
  13534. stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
  13535. }
  13536. // when we try to consume some more bytes, simply unpause the
  13537. // underlying stream.
  13538. this._read = function (n) {
  13539. debug('wrapped _read', n);
  13540. if (paused) {
  13541. paused = false;
  13542. stream.resume();
  13543. }
  13544. };
  13545. return this;
  13546. };
  13547. Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
  13548. // making it explicit this property is not enumerable
  13549. // because otherwise some prototype manipulation in
  13550. // userland will fail
  13551. enumerable: false,
  13552. get: function () {
  13553. return this._readableState.highWaterMark;
  13554. }
  13555. });
  13556. // exposed for testing purposes only.
  13557. Readable._fromList = fromList;
  13558. // Pluck off n bytes from an array of buffers.
  13559. // Length is the combined lengths of all the buffers in the list.
  13560. // This function is designed to be inlinable, so please take care when making
  13561. // changes to the function body.
  13562. function fromList(n, state) {
  13563. // nothing buffered
  13564. if (state.length === 0) return null;
  13565. var ret;
  13566. if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
  13567. // read it all, truncate the list
  13568. if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
  13569. state.buffer.clear();
  13570. } else {
  13571. // read part of list
  13572. ret = fromListPartial(n, state.buffer, state.decoder);
  13573. }
  13574. return ret;
  13575. }
  13576. // Extracts only enough buffered data to satisfy the amount requested.
  13577. // This function is designed to be inlinable, so please take care when making
  13578. // changes to the function body.
  13579. function fromListPartial(n, list, hasStrings) {
  13580. var ret;
  13581. if (n < list.head.data.length) {
  13582. // slice is the same for buffers and strings
  13583. ret = list.head.data.slice(0, n);
  13584. list.head.data = list.head.data.slice(n);
  13585. } else if (n === list.head.data.length) {
  13586. // first chunk is a perfect match
  13587. ret = list.shift();
  13588. } else {
  13589. // result spans more than one buffer
  13590. ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
  13591. }
  13592. return ret;
  13593. }
  13594. // Copies a specified amount of characters from the list of buffered data
  13595. // chunks.
  13596. // This function is designed to be inlinable, so please take care when making
  13597. // changes to the function body.
  13598. function copyFromBufferString(n, list) {
  13599. var p = list.head;
  13600. var c = 1;
  13601. var ret = p.data;
  13602. n -= ret.length;
  13603. while (p = p.next) {
  13604. var str = p.data;
  13605. var nb = n > str.length ? str.length : n;
  13606. if (nb === str.length) ret += str;else ret += str.slice(0, n);
  13607. n -= nb;
  13608. if (n === 0) {
  13609. if (nb === str.length) {
  13610. ++c;
  13611. if (p.next) list.head = p.next;else list.head = list.tail = null;
  13612. } else {
  13613. list.head = p;
  13614. p.data = str.slice(nb);
  13615. }
  13616. break;
  13617. }
  13618. ++c;
  13619. }
  13620. list.length -= c;
  13621. return ret;
  13622. }
  13623. // Copies a specified amount of bytes from the list of buffered data chunks.
  13624. // This function is designed to be inlinable, so please take care when making
  13625. // changes to the function body.
  13626. function copyFromBuffer(n, list) {
  13627. var ret = Buffer.allocUnsafe(n);
  13628. var p = list.head;
  13629. var c = 1;
  13630. p.data.copy(ret);
  13631. n -= p.data.length;
  13632. while (p = p.next) {
  13633. var buf = p.data;
  13634. var nb = n > buf.length ? buf.length : n;
  13635. buf.copy(ret, ret.length - n, 0, nb);
  13636. n -= nb;
  13637. if (n === 0) {
  13638. if (nb === buf.length) {
  13639. ++c;
  13640. if (p.next) list.head = p.next;else list.head = list.tail = null;
  13641. } else {
  13642. list.head = p;
  13643. p.data = buf.slice(nb);
  13644. }
  13645. break;
  13646. }
  13647. ++c;
  13648. }
  13649. list.length -= c;
  13650. return ret;
  13651. }
  13652. function endReadable(stream) {
  13653. var state = stream._readableState;
  13654. // If we get here before consuming all the bytes, then that is a
  13655. // bug in node. Should never happen.
  13656. if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
  13657. if (!state.endEmitted) {
  13658. state.ended = true;
  13659. pna.nextTick(endReadableNT, state, stream);
  13660. }
  13661. }
  13662. function endReadableNT(state, stream) {
  13663. // Check that we didn't get one last unshift.
  13664. if (!state.endEmitted && state.length === 0) {
  13665. state.endEmitted = true;
  13666. stream.readable = false;
  13667. stream.emit('end');
  13668. }
  13669. }
  13670. function indexOf(xs, x) {
  13671. for (var i = 0, l = xs.length; i < l; i++) {
  13672. if (xs[i] === x) return i;
  13673. }
  13674. return -1;
  13675. }
  13676. }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  13677. },{"./_stream_duplex":71,"./internal/streams/BufferList":76,"./internal/streams/destroy":77,"./internal/streams/stream":78,"_process":69,"core-util-is":44,"events":50,"inherits":56,"isarray":58,"process-nextick-args":68,"safe-buffer":83,"string_decoder/":85,"util":40}],74:[function(require,module,exports){
  13678. // Copyright Joyent, Inc. and other Node contributors.
  13679. //
  13680. // Permission is hereby granted, free of charge, to any person obtaining a
  13681. // copy of this software and associated documentation files (the
  13682. // "Software"), to deal in the Software without restriction, including
  13683. // without limitation the rights to use, copy, modify, merge, publish,
  13684. // distribute, sublicense, and/or sell copies of the Software, and to permit
  13685. // persons to whom the Software is furnished to do so, subject to the
  13686. // following conditions:
  13687. //
  13688. // The above copyright notice and this permission notice shall be included
  13689. // in all copies or substantial portions of the Software.
  13690. //
  13691. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  13692. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  13693. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  13694. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  13695. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  13696. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  13697. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  13698. // a transform stream is a readable/writable stream where you do
  13699. // something with the data. Sometimes it's called a "filter",
  13700. // but that's not a great name for it, since that implies a thing where
  13701. // some bits pass through, and others are simply ignored. (That would
  13702. // be a valid example of a transform, of course.)
  13703. //
  13704. // While the output is causally related to the input, it's not a
  13705. // necessarily symmetric or synchronous transformation. For example,
  13706. // a zlib stream might take multiple plain-text writes(), and then
  13707. // emit a single compressed chunk some time in the future.
  13708. //
  13709. // Here's how this works:
  13710. //
  13711. // The Transform stream has all the aspects of the readable and writable
  13712. // stream classes. When you write(chunk), that calls _write(chunk,cb)
  13713. // internally, and returns false if there's a lot of pending writes
  13714. // buffered up. When you call read(), that calls _read(n) until
  13715. // there's enough pending readable data buffered up.
  13716. //
  13717. // In a transform stream, the written data is placed in a buffer. When
  13718. // _read(n) is called, it transforms the queued up data, calling the
  13719. // buffered _write cb's as it consumes chunks. If consuming a single
  13720. // written chunk would result in multiple output chunks, then the first
  13721. // outputted bit calls the readcb, and subsequent chunks just go into
  13722. // the read buffer, and will cause it to emit 'readable' if necessary.
  13723. //
  13724. // This way, back-pressure is actually determined by the reading side,
  13725. // since _read has to be called to start processing a new chunk. However,
  13726. // a pathological inflate type of transform can cause excessive buffering
  13727. // here. For example, imagine a stream where every byte of input is
  13728. // interpreted as an integer from 0-255, and then results in that many
  13729. // bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
  13730. // 1kb of data being output. In this case, you could write a very small
  13731. // amount of input, and end up with a very large amount of output. In
  13732. // such a pathological inflating mechanism, there'd be no way to tell
  13733. // the system to stop doing the transform. A single 4MB write could
  13734. // cause the system to run out of memory.
  13735. //
  13736. // However, even in such a pathological case, only a single written chunk
  13737. // would be consumed, and then the rest would wait (un-transformed) until
  13738. // the results of the previous transformed chunk were consumed.
  13739. 'use strict';
  13740. module.exports = Transform;
  13741. var Duplex = require('./_stream_duplex');
  13742. /*<replacement>*/
  13743. var util = require('core-util-is');
  13744. util.inherits = require('inherits');
  13745. /*</replacement>*/
  13746. util.inherits(Transform, Duplex);
  13747. function afterTransform(er, data) {
  13748. var ts = this._transformState;
  13749. ts.transforming = false;
  13750. var cb = ts.writecb;
  13751. if (!cb) {
  13752. return this.emit('error', new Error('write callback called multiple times'));
  13753. }
  13754. ts.writechunk = null;
  13755. ts.writecb = null;
  13756. if (data != null) // single equals check for both `null` and `undefined`
  13757. this.push(data);
  13758. cb(er);
  13759. var rs = this._readableState;
  13760. rs.reading = false;
  13761. if (rs.needReadable || rs.length < rs.highWaterMark) {
  13762. this._read(rs.highWaterMark);
  13763. }
  13764. }
  13765. function Transform(options) {
  13766. if (!(this instanceof Transform)) return new Transform(options);
  13767. Duplex.call(this, options);
  13768. this._transformState = {
  13769. afterTransform: afterTransform.bind(this),
  13770. needTransform: false,
  13771. transforming: false,
  13772. writecb: null,
  13773. writechunk: null,
  13774. writeencoding: null
  13775. };
  13776. // start out asking for a readable event once data is transformed.
  13777. this._readableState.needReadable = true;
  13778. // we have implemented the _read method, and done the other things
  13779. // that Readable wants before the first _read call, so unset the
  13780. // sync guard flag.
  13781. this._readableState.sync = false;
  13782. if (options) {
  13783. if (typeof options.transform === 'function') this._transform = options.transform;
  13784. if (typeof options.flush === 'function') this._flush = options.flush;
  13785. }
  13786. // When the writable side finishes, then flush out anything remaining.
  13787. this.on('prefinish', prefinish);
  13788. }
  13789. function prefinish() {
  13790. var _this = this;
  13791. if (typeof this._flush === 'function') {
  13792. this._flush(function (er, data) {
  13793. done(_this, er, data);
  13794. });
  13795. } else {
  13796. done(this, null, null);
  13797. }
  13798. }
  13799. Transform.prototype.push = function (chunk, encoding) {
  13800. this._transformState.needTransform = false;
  13801. return Duplex.prototype.push.call(this, chunk, encoding);
  13802. };
  13803. // This is the part where you do stuff!
  13804. // override this function in implementation classes.
  13805. // 'chunk' is an input chunk.
  13806. //
  13807. // Call `push(newChunk)` to pass along transformed output
  13808. // to the readable side. You may call 'push' zero or more times.
  13809. //
  13810. // Call `cb(err)` when you are done with this chunk. If you pass
  13811. // an error, then that'll put the hurt on the whole operation. If you
  13812. // never call cb(), then you'll never get another chunk.
  13813. Transform.prototype._transform = function (chunk, encoding, cb) {
  13814. throw new Error('_transform() is not implemented');
  13815. };
  13816. Transform.prototype._write = function (chunk, encoding, cb) {
  13817. var ts = this._transformState;
  13818. ts.writecb = cb;
  13819. ts.writechunk = chunk;
  13820. ts.writeencoding = encoding;
  13821. if (!ts.transforming) {
  13822. var rs = this._readableState;
  13823. if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
  13824. }
  13825. };
  13826. // Doesn't matter what the args are here.
  13827. // _transform does all the work.
  13828. // That we got here means that the readable side wants more data.
  13829. Transform.prototype._read = function (n) {
  13830. var ts = this._transformState;
  13831. if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
  13832. ts.transforming = true;
  13833. this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
  13834. } else {
  13835. // mark that we need a transform, so that any data that comes in
  13836. // will get processed, now that we've asked for it.
  13837. ts.needTransform = true;
  13838. }
  13839. };
  13840. Transform.prototype._destroy = function (err, cb) {
  13841. var _this2 = this;
  13842. Duplex.prototype._destroy.call(this, err, function (err2) {
  13843. cb(err2);
  13844. _this2.emit('close');
  13845. });
  13846. };
  13847. function done(stream, er, data) {
  13848. if (er) return stream.emit('error', er);
  13849. if (data != null) // single equals check for both `null` and `undefined`
  13850. stream.push(data);
  13851. // if there's nothing in the write buffer, then that means
  13852. // that nothing more will ever be provided
  13853. if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');
  13854. if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');
  13855. return stream.push(null);
  13856. }
  13857. },{"./_stream_duplex":71,"core-util-is":44,"inherits":56}],75:[function(require,module,exports){
  13858. (function (process,global,setImmediate){
  13859. // Copyright Joyent, Inc. and other Node contributors.
  13860. //
  13861. // Permission is hereby granted, free of charge, to any person obtaining a
  13862. // copy of this software and associated documentation files (the
  13863. // "Software"), to deal in the Software without restriction, including
  13864. // without limitation the rights to use, copy, modify, merge, publish,
  13865. // distribute, sublicense, and/or sell copies of the Software, and to permit
  13866. // persons to whom the Software is furnished to do so, subject to the
  13867. // following conditions:
  13868. //
  13869. // The above copyright notice and this permission notice shall be included
  13870. // in all copies or substantial portions of the Software.
  13871. //
  13872. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  13873. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  13874. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  13875. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  13876. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  13877. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  13878. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  13879. // A bit simpler than readable streams.
  13880. // Implement an async ._write(chunk, encoding, cb), and it'll handle all
  13881. // the drain event emission and buffering.
  13882. 'use strict';
  13883. /*<replacement>*/
  13884. var pna = require('process-nextick-args');
  13885. /*</replacement>*/
  13886. module.exports = Writable;
  13887. /* <replacement> */
  13888. function WriteReq(chunk, encoding, cb) {
  13889. this.chunk = chunk;
  13890. this.encoding = encoding;
  13891. this.callback = cb;
  13892. this.next = null;
  13893. }
  13894. // It seems a linked list but it is not
  13895. // there will be only 2 of these for each stream
  13896. function CorkedRequest(state) {
  13897. var _this = this;
  13898. this.next = null;
  13899. this.entry = null;
  13900. this.finish = function () {
  13901. onCorkedFinish(_this, state);
  13902. };
  13903. }
  13904. /* </replacement> */
  13905. /*<replacement>*/
  13906. var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
  13907. /*</replacement>*/
  13908. /*<replacement>*/
  13909. var Duplex;
  13910. /*</replacement>*/
  13911. Writable.WritableState = WritableState;
  13912. /*<replacement>*/
  13913. var util = require('core-util-is');
  13914. util.inherits = require('inherits');
  13915. /*</replacement>*/
  13916. /*<replacement>*/
  13917. var internalUtil = {
  13918. deprecate: require('util-deprecate')
  13919. };
  13920. /*</replacement>*/
  13921. /*<replacement>*/
  13922. var Stream = require('./internal/streams/stream');
  13923. /*</replacement>*/
  13924. /*<replacement>*/
  13925. var Buffer = require('safe-buffer').Buffer;
  13926. var OurUint8Array = global.Uint8Array || function () {};
  13927. function _uint8ArrayToBuffer(chunk) {
  13928. return Buffer.from(chunk);
  13929. }
  13930. function _isUint8Array(obj) {
  13931. return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
  13932. }
  13933. /*</replacement>*/
  13934. var destroyImpl = require('./internal/streams/destroy');
  13935. util.inherits(Writable, Stream);
  13936. function nop() {}
  13937. function WritableState(options, stream) {
  13938. Duplex = Duplex || require('./_stream_duplex');
  13939. options = options || {};
  13940. // Duplex streams are both readable and writable, but share
  13941. // the same options object.
  13942. // However, some cases require setting options to different
  13943. // values for the readable and the writable sides of the duplex stream.
  13944. // These options can be provided separately as readableXXX and writableXXX.
  13945. var isDuplex = stream instanceof Duplex;
  13946. // object stream flag to indicate whether or not this stream
  13947. // contains buffers or objects.
  13948. this.objectMode = !!options.objectMode;
  13949. if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
  13950. // the point at which write() starts returning false
  13951. // Note: 0 is a valid value, means that we always return false if
  13952. // the entire buffer is not flushed immediately on write()
  13953. var hwm = options.highWaterMark;
  13954. var writableHwm = options.writableHighWaterMark;
  13955. var defaultHwm = this.objectMode ? 16 : 16 * 1024;
  13956. if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;
  13957. // cast to ints.
  13958. this.highWaterMark = Math.floor(this.highWaterMark);
  13959. // if _final has been called
  13960. this.finalCalled = false;
  13961. // drain event flag.
  13962. this.needDrain = false;
  13963. // at the start of calling end()
  13964. this.ending = false;
  13965. // when end() has been called, and returned
  13966. this.ended = false;
  13967. // when 'finish' is emitted
  13968. this.finished = false;
  13969. // has it been destroyed
  13970. this.destroyed = false;
  13971. // should we decode strings into buffers before passing to _write?
  13972. // this is here so that some node-core streams can optimize string
  13973. // handling at a lower level.
  13974. var noDecode = options.decodeStrings === false;
  13975. this.decodeStrings = !noDecode;
  13976. // Crypto is kind of old and crusty. Historically, its default string
  13977. // encoding is 'binary' so we have to make this configurable.
  13978. // Everything else in the universe uses 'utf8', though.
  13979. this.defaultEncoding = options.defaultEncoding || 'utf8';
  13980. // not an actual buffer we keep track of, but a measurement
  13981. // of how much we're waiting to get pushed to some underlying
  13982. // socket or file.
  13983. this.length = 0;
  13984. // a flag to see when we're in the middle of a write.
  13985. this.writing = false;
  13986. // when true all writes will be buffered until .uncork() call
  13987. this.corked = 0;
  13988. // a flag to be able to tell if the onwrite cb is called immediately,
  13989. // or on a later tick. We set this to true at first, because any
  13990. // actions that shouldn't happen until "later" should generally also
  13991. // not happen before the first write call.
  13992. this.sync = true;
  13993. // a flag to know if we're processing previously buffered items, which
  13994. // may call the _write() callback in the same tick, so that we don't
  13995. // end up in an overlapped onwrite situation.
  13996. this.bufferProcessing = false;
  13997. // the callback that's passed to _write(chunk,cb)
  13998. this.onwrite = function (er) {
  13999. onwrite(stream, er);
  14000. };
  14001. // the callback that the user supplies to write(chunk,encoding,cb)
  14002. this.writecb = null;
  14003. // the amount that is being written when _write is called.
  14004. this.writelen = 0;
  14005. this.bufferedRequest = null;
  14006. this.lastBufferedRequest = null;
  14007. // number of pending user-supplied write callbacks
  14008. // this must be 0 before 'finish' can be emitted
  14009. this.pendingcb = 0;
  14010. // emit prefinish if the only thing we're waiting for is _write cbs
  14011. // This is relevant for synchronous Transform streams
  14012. this.prefinished = false;
  14013. // True if the error was already emitted and should not be thrown again
  14014. this.errorEmitted = false;
  14015. // count buffered requests
  14016. this.bufferedRequestCount = 0;
  14017. // allocate the first CorkedRequest, there is always
  14018. // one allocated and free to use, and we maintain at most two
  14019. this.corkedRequestsFree = new CorkedRequest(this);
  14020. }
  14021. WritableState.prototype.getBuffer = function getBuffer() {
  14022. var current = this.bufferedRequest;
  14023. var out = [];
  14024. while (current) {
  14025. out.push(current);
  14026. current = current.next;
  14027. }
  14028. return out;
  14029. };
  14030. (function () {
  14031. try {
  14032. Object.defineProperty(WritableState.prototype, 'buffer', {
  14033. get: internalUtil.deprecate(function () {
  14034. return this.getBuffer();
  14035. }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
  14036. });
  14037. } catch (_) {}
  14038. })();
  14039. // Test _writableState for inheritance to account for Duplex streams,
  14040. // whose prototype chain only points to Readable.
  14041. var realHasInstance;
  14042. if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
  14043. realHasInstance = Function.prototype[Symbol.hasInstance];
  14044. Object.defineProperty(Writable, Symbol.hasInstance, {
  14045. value: function (object) {
  14046. if (realHasInstance.call(this, object)) return true;
  14047. if (this !== Writable) return false;
  14048. return object && object._writableState instanceof WritableState;
  14049. }
  14050. });
  14051. } else {
  14052. realHasInstance = function (object) {
  14053. return object instanceof this;
  14054. };
  14055. }
  14056. function Writable(options) {
  14057. Duplex = Duplex || require('./_stream_duplex');
  14058. // Writable ctor is applied to Duplexes, too.
  14059. // `realHasInstance` is necessary because using plain `instanceof`
  14060. // would return false, as no `_writableState` property is attached.
  14061. // Trying to use the custom `instanceof` for Writable here will also break the
  14062. // Node.js LazyTransform implementation, which has a non-trivial getter for
  14063. // `_writableState` that would lead to infinite recursion.
  14064. if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {
  14065. return new Writable(options);
  14066. }
  14067. this._writableState = new WritableState(options, this);
  14068. // legacy.
  14069. this.writable = true;
  14070. if (options) {
  14071. if (typeof options.write === 'function') this._write = options.write;
  14072. if (typeof options.writev === 'function') this._writev = options.writev;
  14073. if (typeof options.destroy === 'function') this._destroy = options.destroy;
  14074. if (typeof options.final === 'function') this._final = options.final;
  14075. }
  14076. Stream.call(this);
  14077. }
  14078. // Otherwise people can pipe Writable streams, which is just wrong.
  14079. Writable.prototype.pipe = function () {
  14080. this.emit('error', new Error('Cannot pipe, not readable'));
  14081. };
  14082. function writeAfterEnd(stream, cb) {
  14083. var er = new Error('write after end');
  14084. // TODO: defer error events consistently everywhere, not just the cb
  14085. stream.emit('error', er);
  14086. pna.nextTick(cb, er);
  14087. }
  14088. // Checks that a user-supplied chunk is valid, especially for the particular
  14089. // mode the stream is in. Currently this means that `null` is never accepted
  14090. // and undefined/non-string values are only allowed in object mode.
  14091. function validChunk(stream, state, chunk, cb) {
  14092. var valid = true;
  14093. var er = false;
  14094. if (chunk === null) {
  14095. er = new TypeError('May not write null values to stream');
  14096. } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
  14097. er = new TypeError('Invalid non-string/buffer chunk');
  14098. }
  14099. if (er) {
  14100. stream.emit('error', er);
  14101. pna.nextTick(cb, er);
  14102. valid = false;
  14103. }
  14104. return valid;
  14105. }
  14106. Writable.prototype.write = function (chunk, encoding, cb) {
  14107. var state = this._writableState;
  14108. var ret = false;
  14109. var isBuf = !state.objectMode && _isUint8Array(chunk);
  14110. if (isBuf && !Buffer.isBuffer(chunk)) {
  14111. chunk = _uint8ArrayToBuffer(chunk);
  14112. }
  14113. if (typeof encoding === 'function') {
  14114. cb = encoding;
  14115. encoding = null;
  14116. }
  14117. if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
  14118. if (typeof cb !== 'function') cb = nop;
  14119. if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
  14120. state.pendingcb++;
  14121. ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);
  14122. }
  14123. return ret;
  14124. };
  14125. Writable.prototype.cork = function () {
  14126. var state = this._writableState;
  14127. state.corked++;
  14128. };
  14129. Writable.prototype.uncork = function () {
  14130. var state = this._writableState;
  14131. if (state.corked) {
  14132. state.corked--;
  14133. if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
  14134. }
  14135. };
  14136. Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
  14137. // node::ParseEncoding() requires lower case.
  14138. if (typeof encoding === 'string') encoding = encoding.toLowerCase();
  14139. if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
  14140. this._writableState.defaultEncoding = encoding;
  14141. return this;
  14142. };
  14143. function decodeChunk(state, chunk, encoding) {
  14144. if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
  14145. chunk = Buffer.from(chunk, encoding);
  14146. }
  14147. return chunk;
  14148. }
  14149. Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
  14150. // making it explicit this property is not enumerable
  14151. // because otherwise some prototype manipulation in
  14152. // userland will fail
  14153. enumerable: false,
  14154. get: function () {
  14155. return this._writableState.highWaterMark;
  14156. }
  14157. });
  14158. // if we're already writing something, then just put this
  14159. // in the queue, and wait our turn. Otherwise, call _write
  14160. // If we return false, then we need a drain event, so set that flag.
  14161. function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
  14162. if (!isBuf) {
  14163. var newChunk = decodeChunk(state, chunk, encoding);
  14164. if (chunk !== newChunk) {
  14165. isBuf = true;
  14166. encoding = 'buffer';
  14167. chunk = newChunk;
  14168. }
  14169. }
  14170. var len = state.objectMode ? 1 : chunk.length;
  14171. state.length += len;
  14172. var ret = state.length < state.highWaterMark;
  14173. // we must ensure that previous needDrain will not be reset to false.
  14174. if (!ret) state.needDrain = true;
  14175. if (state.writing || state.corked) {
  14176. var last = state.lastBufferedRequest;
  14177. state.lastBufferedRequest = {
  14178. chunk: chunk,
  14179. encoding: encoding,
  14180. isBuf: isBuf,
  14181. callback: cb,
  14182. next: null
  14183. };
  14184. if (last) {
  14185. last.next = state.lastBufferedRequest;
  14186. } else {
  14187. state.bufferedRequest = state.lastBufferedRequest;
  14188. }
  14189. state.bufferedRequestCount += 1;
  14190. } else {
  14191. doWrite(stream, state, false, len, chunk, encoding, cb);
  14192. }
  14193. return ret;
  14194. }
  14195. function doWrite(stream, state, writev, len, chunk, encoding, cb) {
  14196. state.writelen = len;
  14197. state.writecb = cb;
  14198. state.writing = true;
  14199. state.sync = true;
  14200. if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
  14201. state.sync = false;
  14202. }
  14203. function onwriteError(stream, state, sync, er, cb) {
  14204. --state.pendingcb;
  14205. if (sync) {
  14206. // defer the callback if we are being called synchronously
  14207. // to avoid piling up things on the stack
  14208. pna.nextTick(cb, er);
  14209. // this can emit finish, and it will always happen
  14210. // after error
  14211. pna.nextTick(finishMaybe, stream, state);
  14212. stream._writableState.errorEmitted = true;
  14213. stream.emit('error', er);
  14214. } else {
  14215. // the caller expect this to happen before if
  14216. // it is async
  14217. cb(er);
  14218. stream._writableState.errorEmitted = true;
  14219. stream.emit('error', er);
  14220. // this can emit finish, but finish must
  14221. // always follow error
  14222. finishMaybe(stream, state);
  14223. }
  14224. }
  14225. function onwriteStateUpdate(state) {
  14226. state.writing = false;
  14227. state.writecb = null;
  14228. state.length -= state.writelen;
  14229. state.writelen = 0;
  14230. }
  14231. function onwrite(stream, er) {
  14232. var state = stream._writableState;
  14233. var sync = state.sync;
  14234. var cb = state.writecb;
  14235. onwriteStateUpdate(state);
  14236. if (er) onwriteError(stream, state, sync, er, cb);else {
  14237. // Check if we're actually ready to finish, but don't emit yet
  14238. var finished = needFinish(state);
  14239. if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
  14240. clearBuffer(stream, state);
  14241. }
  14242. if (sync) {
  14243. /*<replacement>*/
  14244. asyncWrite(afterWrite, stream, state, finished, cb);
  14245. /*</replacement>*/
  14246. } else {
  14247. afterWrite(stream, state, finished, cb);
  14248. }
  14249. }
  14250. }
  14251. function afterWrite(stream, state, finished, cb) {
  14252. if (!finished) onwriteDrain(stream, state);
  14253. state.pendingcb--;
  14254. cb();
  14255. finishMaybe(stream, state);
  14256. }
  14257. // Must force callback to be called on nextTick, so that we don't
  14258. // emit 'drain' before the write() consumer gets the 'false' return
  14259. // value, and has a chance to attach a 'drain' listener.
  14260. function onwriteDrain(stream, state) {
  14261. if (state.length === 0 && state.needDrain) {
  14262. state.needDrain = false;
  14263. stream.emit('drain');
  14264. }
  14265. }
  14266. // if there's something in the buffer waiting, then process it
  14267. function clearBuffer(stream, state) {
  14268. state.bufferProcessing = true;
  14269. var entry = state.bufferedRequest;
  14270. if (stream._writev && entry && entry.next) {
  14271. // Fast case, write everything using _writev()
  14272. var l = state.bufferedRequestCount;
  14273. var buffer = new Array(l);
  14274. var holder = state.corkedRequestsFree;
  14275. holder.entry = entry;
  14276. var count = 0;
  14277. var allBuffers = true;
  14278. while (entry) {
  14279. buffer[count] = entry;
  14280. if (!entry.isBuf) allBuffers = false;
  14281. entry = entry.next;
  14282. count += 1;
  14283. }
  14284. buffer.allBuffers = allBuffers;
  14285. doWrite(stream, state, true, state.length, buffer, '', holder.finish);
  14286. // doWrite is almost always async, defer these to save a bit of time
  14287. // as the hot path ends with doWrite
  14288. state.pendingcb++;
  14289. state.lastBufferedRequest = null;
  14290. if (holder.next) {
  14291. state.corkedRequestsFree = holder.next;
  14292. holder.next = null;
  14293. } else {
  14294. state.corkedRequestsFree = new CorkedRequest(state);
  14295. }
  14296. state.bufferedRequestCount = 0;
  14297. } else {
  14298. // Slow case, write chunks one-by-one
  14299. while (entry) {
  14300. var chunk = entry.chunk;
  14301. var encoding = entry.encoding;
  14302. var cb = entry.callback;
  14303. var len = state.objectMode ? 1 : chunk.length;
  14304. doWrite(stream, state, false, len, chunk, encoding, cb);
  14305. entry = entry.next;
  14306. state.bufferedRequestCount--;
  14307. // if we didn't call the onwrite immediately, then
  14308. // it means that we need to wait until it does.
  14309. // also, that means that the chunk and cb are currently
  14310. // being processed, so move the buffer counter past them.
  14311. if (state.writing) {
  14312. break;
  14313. }
  14314. }
  14315. if (entry === null) state.lastBufferedRequest = null;
  14316. }
  14317. state.bufferedRequest = entry;
  14318. state.bufferProcessing = false;
  14319. }
  14320. Writable.prototype._write = function (chunk, encoding, cb) {
  14321. cb(new Error('_write() is not implemented'));
  14322. };
  14323. Writable.prototype._writev = null;
  14324. Writable.prototype.end = function (chunk, encoding, cb) {
  14325. var state = this._writableState;
  14326. if (typeof chunk === 'function') {
  14327. cb = chunk;
  14328. chunk = null;
  14329. encoding = null;
  14330. } else if (typeof encoding === 'function') {
  14331. cb = encoding;
  14332. encoding = null;
  14333. }
  14334. if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
  14335. // .end() fully uncorks
  14336. if (state.corked) {
  14337. state.corked = 1;
  14338. this.uncork();
  14339. }
  14340. // ignore unnecessary end() calls.
  14341. if (!state.ending && !state.finished) endWritable(this, state, cb);
  14342. };
  14343. function needFinish(state) {
  14344. return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
  14345. }
  14346. function callFinal(stream, state) {
  14347. stream._final(function (err) {
  14348. state.pendingcb--;
  14349. if (err) {
  14350. stream.emit('error', err);
  14351. }
  14352. state.prefinished = true;
  14353. stream.emit('prefinish');
  14354. finishMaybe(stream, state);
  14355. });
  14356. }
  14357. function prefinish(stream, state) {
  14358. if (!state.prefinished && !state.finalCalled) {
  14359. if (typeof stream._final === 'function') {
  14360. state.pendingcb++;
  14361. state.finalCalled = true;
  14362. pna.nextTick(callFinal, stream, state);
  14363. } else {
  14364. state.prefinished = true;
  14365. stream.emit('prefinish');
  14366. }
  14367. }
  14368. }
  14369. function finishMaybe(stream, state) {
  14370. var need = needFinish(state);
  14371. if (need) {
  14372. prefinish(stream, state);
  14373. if (state.pendingcb === 0) {
  14374. state.finished = true;
  14375. stream.emit('finish');
  14376. }
  14377. }
  14378. return need;
  14379. }
  14380. function endWritable(stream, state, cb) {
  14381. state.ending = true;
  14382. finishMaybe(stream, state);
  14383. if (cb) {
  14384. if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);
  14385. }
  14386. state.ended = true;
  14387. stream.writable = false;
  14388. }
  14389. function onCorkedFinish(corkReq, state, err) {
  14390. var entry = corkReq.entry;
  14391. corkReq.entry = null;
  14392. while (entry) {
  14393. var cb = entry.callback;
  14394. state.pendingcb--;
  14395. cb(err);
  14396. entry = entry.next;
  14397. }
  14398. if (state.corkedRequestsFree) {
  14399. state.corkedRequestsFree.next = corkReq;
  14400. } else {
  14401. state.corkedRequestsFree = corkReq;
  14402. }
  14403. }
  14404. Object.defineProperty(Writable.prototype, 'destroyed', {
  14405. get: function () {
  14406. if (this._writableState === undefined) {
  14407. return false;
  14408. }
  14409. return this._writableState.destroyed;
  14410. },
  14411. set: function (value) {
  14412. // we ignore the value if the stream
  14413. // has not been initialized yet
  14414. if (!this._writableState) {
  14415. return;
  14416. }
  14417. // backward compatibility, the user is explicitly
  14418. // managing destroyed
  14419. this._writableState.destroyed = value;
  14420. }
  14421. });
  14422. Writable.prototype.destroy = destroyImpl.destroy;
  14423. Writable.prototype._undestroy = destroyImpl.undestroy;
  14424. Writable.prototype._destroy = function (err, cb) {
  14425. this.end();
  14426. cb(err);
  14427. };
  14428. }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").setImmediate)
  14429. },{"./_stream_duplex":71,"./internal/streams/destroy":77,"./internal/streams/stream":78,"_process":69,"core-util-is":44,"inherits":56,"process-nextick-args":68,"safe-buffer":83,"timers":86,"util-deprecate":87}],76:[function(require,module,exports){
  14430. 'use strict';
  14431. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14432. var Buffer = require('safe-buffer').Buffer;
  14433. var util = require('util');
  14434. function copyBuffer(src, target, offset) {
  14435. src.copy(target, offset);
  14436. }
  14437. module.exports = function () {
  14438. function BufferList() {
  14439. _classCallCheck(this, BufferList);
  14440. this.head = null;
  14441. this.tail = null;
  14442. this.length = 0;
  14443. }
  14444. BufferList.prototype.push = function push(v) {
  14445. var entry = { data: v, next: null };
  14446. if (this.length > 0) this.tail.next = entry;else this.head = entry;
  14447. this.tail = entry;
  14448. ++this.length;
  14449. };
  14450. BufferList.prototype.unshift = function unshift(v) {
  14451. var entry = { data: v, next: this.head };
  14452. if (this.length === 0) this.tail = entry;
  14453. this.head = entry;
  14454. ++this.length;
  14455. };
  14456. BufferList.prototype.shift = function shift() {
  14457. if (this.length === 0) return;
  14458. var ret = this.head.data;
  14459. if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
  14460. --this.length;
  14461. return ret;
  14462. };
  14463. BufferList.prototype.clear = function clear() {
  14464. this.head = this.tail = null;
  14465. this.length = 0;
  14466. };
  14467. BufferList.prototype.join = function join(s) {
  14468. if (this.length === 0) return '';
  14469. var p = this.head;
  14470. var ret = '' + p.data;
  14471. while (p = p.next) {
  14472. ret += s + p.data;
  14473. }return ret;
  14474. };
  14475. BufferList.prototype.concat = function concat(n) {
  14476. if (this.length === 0) return Buffer.alloc(0);
  14477. if (this.length === 1) return this.head.data;
  14478. var ret = Buffer.allocUnsafe(n >>> 0);
  14479. var p = this.head;
  14480. var i = 0;
  14481. while (p) {
  14482. copyBuffer(p.data, ret, i);
  14483. i += p.data.length;
  14484. p = p.next;
  14485. }
  14486. return ret;
  14487. };
  14488. return BufferList;
  14489. }();
  14490. if (util && util.inspect && util.inspect.custom) {
  14491. module.exports.prototype[util.inspect.custom] = function () {
  14492. var obj = util.inspect({ length: this.length });
  14493. return this.constructor.name + ' ' + obj;
  14494. };
  14495. }
  14496. },{"safe-buffer":83,"util":40}],77:[function(require,module,exports){
  14497. 'use strict';
  14498. /*<replacement>*/
  14499. var pna = require('process-nextick-args');
  14500. /*</replacement>*/
  14501. // undocumented cb() API, needed for core, not for public API
  14502. function destroy(err, cb) {
  14503. var _this = this;
  14504. var readableDestroyed = this._readableState && this._readableState.destroyed;
  14505. var writableDestroyed = this._writableState && this._writableState.destroyed;
  14506. if (readableDestroyed || writableDestroyed) {
  14507. if (cb) {
  14508. cb(err);
  14509. } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
  14510. pna.nextTick(emitErrorNT, this, err);
  14511. }
  14512. return this;
  14513. }
  14514. // we set destroyed to true before firing error callbacks in order
  14515. // to make it re-entrance safe in case destroy() is called within callbacks
  14516. if (this._readableState) {
  14517. this._readableState.destroyed = true;
  14518. }
  14519. // if this is a duplex stream mark the writable part as destroyed as well
  14520. if (this._writableState) {
  14521. this._writableState.destroyed = true;
  14522. }
  14523. this._destroy(err || null, function (err) {
  14524. if (!cb && err) {
  14525. pna.nextTick(emitErrorNT, _this, err);
  14526. if (_this._writableState) {
  14527. _this._writableState.errorEmitted = true;
  14528. }
  14529. } else if (cb) {
  14530. cb(err);
  14531. }
  14532. });
  14533. return this;
  14534. }
  14535. function undestroy() {
  14536. if (this._readableState) {
  14537. this._readableState.destroyed = false;
  14538. this._readableState.reading = false;
  14539. this._readableState.ended = false;
  14540. this._readableState.endEmitted = false;
  14541. }
  14542. if (this._writableState) {
  14543. this._writableState.destroyed = false;
  14544. this._writableState.ended = false;
  14545. this._writableState.ending = false;
  14546. this._writableState.finished = false;
  14547. this._writableState.errorEmitted = false;
  14548. }
  14549. }
  14550. function emitErrorNT(self, err) {
  14551. self.emit('error', err);
  14552. }
  14553. module.exports = {
  14554. destroy: destroy,
  14555. undestroy: undestroy
  14556. };
  14557. },{"process-nextick-args":68}],78:[function(require,module,exports){
  14558. module.exports = require('events').EventEmitter;
  14559. },{"events":50}],79:[function(require,module,exports){
  14560. module.exports = require('./readable').PassThrough
  14561. },{"./readable":80}],80:[function(require,module,exports){
  14562. exports = module.exports = require('./lib/_stream_readable.js');
  14563. exports.Stream = exports;
  14564. exports.Readable = exports;
  14565. exports.Writable = require('./lib/_stream_writable.js');
  14566. exports.Duplex = require('./lib/_stream_duplex.js');
  14567. exports.Transform = require('./lib/_stream_transform.js');
  14568. exports.PassThrough = require('./lib/_stream_passthrough.js');
  14569. },{"./lib/_stream_duplex.js":71,"./lib/_stream_passthrough.js":72,"./lib/_stream_readable.js":73,"./lib/_stream_transform.js":74,"./lib/_stream_writable.js":75}],81:[function(require,module,exports){
  14570. module.exports = require('./readable').Transform
  14571. },{"./readable":80}],82:[function(require,module,exports){
  14572. module.exports = require('./lib/_stream_writable.js');
  14573. },{"./lib/_stream_writable.js":75}],83:[function(require,module,exports){
  14574. /* eslint-disable node/no-deprecated-api */
  14575. var buffer = require('buffer')
  14576. var Buffer = buffer.Buffer
  14577. // alternative to using Object.keys for old browsers
  14578. function copyProps (src, dst) {
  14579. for (var key in src) {
  14580. dst[key] = src[key]
  14581. }
  14582. }
  14583. if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
  14584. module.exports = buffer
  14585. } else {
  14586. // Copy properties from require('buffer')
  14587. copyProps(buffer, exports)
  14588. exports.Buffer = SafeBuffer
  14589. }
  14590. function SafeBuffer (arg, encodingOrOffset, length) {
  14591. return Buffer(arg, encodingOrOffset, length)
  14592. }
  14593. // Copy static methods from Buffer
  14594. copyProps(Buffer, SafeBuffer)
  14595. SafeBuffer.from = function (arg, encodingOrOffset, length) {
  14596. if (typeof arg === 'number') {
  14597. throw new TypeError('Argument must not be a number')
  14598. }
  14599. return Buffer(arg, encodingOrOffset, length)
  14600. }
  14601. SafeBuffer.alloc = function (size, fill, encoding) {
  14602. if (typeof size !== 'number') {
  14603. throw new TypeError('Argument must be a number')
  14604. }
  14605. var buf = Buffer(size)
  14606. if (fill !== undefined) {
  14607. if (typeof encoding === 'string') {
  14608. buf.fill(fill, encoding)
  14609. } else {
  14610. buf.fill(fill)
  14611. }
  14612. } else {
  14613. buf.fill(0)
  14614. }
  14615. return buf
  14616. }
  14617. SafeBuffer.allocUnsafe = function (size) {
  14618. if (typeof size !== 'number') {
  14619. throw new TypeError('Argument must be a number')
  14620. }
  14621. return Buffer(size)
  14622. }
  14623. SafeBuffer.allocUnsafeSlow = function (size) {
  14624. if (typeof size !== 'number') {
  14625. throw new TypeError('Argument must be a number')
  14626. }
  14627. return buffer.SlowBuffer(size)
  14628. }
  14629. },{"buffer":43}],84:[function(require,module,exports){
  14630. // Copyright Joyent, Inc. and other Node contributors.
  14631. //
  14632. // Permission is hereby granted, free of charge, to any person obtaining a
  14633. // copy of this software and associated documentation files (the
  14634. // "Software"), to deal in the Software without restriction, including
  14635. // without limitation the rights to use, copy, modify, merge, publish,
  14636. // distribute, sublicense, and/or sell copies of the Software, and to permit
  14637. // persons to whom the Software is furnished to do so, subject to the
  14638. // following conditions:
  14639. //
  14640. // The above copyright notice and this permission notice shall be included
  14641. // in all copies or substantial portions of the Software.
  14642. //
  14643. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  14644. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  14645. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  14646. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  14647. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  14648. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  14649. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  14650. module.exports = Stream;
  14651. var EE = require('events').EventEmitter;
  14652. var inherits = require('inherits');
  14653. inherits(Stream, EE);
  14654. Stream.Readable = require('readable-stream/readable.js');
  14655. Stream.Writable = require('readable-stream/writable.js');
  14656. Stream.Duplex = require('readable-stream/duplex.js');
  14657. Stream.Transform = require('readable-stream/transform.js');
  14658. Stream.PassThrough = require('readable-stream/passthrough.js');
  14659. // Backwards-compat with node 0.4.x
  14660. Stream.Stream = Stream;
  14661. // old-style streams. Note that the pipe method (the only relevant
  14662. // part of this class) is overridden in the Readable class.
  14663. function Stream() {
  14664. EE.call(this);
  14665. }
  14666. Stream.prototype.pipe = function(dest, options) {
  14667. var source = this;
  14668. function ondata(chunk) {
  14669. if (dest.writable) {
  14670. if (false === dest.write(chunk) && source.pause) {
  14671. source.pause();
  14672. }
  14673. }
  14674. }
  14675. source.on('data', ondata);
  14676. function ondrain() {
  14677. if (source.readable && source.resume) {
  14678. source.resume();
  14679. }
  14680. }
  14681. dest.on('drain', ondrain);
  14682. // If the 'end' option is not supplied, dest.end() will be called when
  14683. // source gets the 'end' or 'close' events. Only dest.end() once.
  14684. if (!dest._isStdio && (!options || options.end !== false)) {
  14685. source.on('end', onend);
  14686. source.on('close', onclose);
  14687. }
  14688. var didOnEnd = false;
  14689. function onend() {
  14690. if (didOnEnd) return;
  14691. didOnEnd = true;
  14692. dest.end();
  14693. }
  14694. function onclose() {
  14695. if (didOnEnd) return;
  14696. didOnEnd = true;
  14697. if (typeof dest.destroy === 'function') dest.destroy();
  14698. }
  14699. // don't leave dangling pipes when there are errors.
  14700. function onerror(er) {
  14701. cleanup();
  14702. if (EE.listenerCount(this, 'error') === 0) {
  14703. throw er; // Unhandled stream error in pipe.
  14704. }
  14705. }
  14706. source.on('error', onerror);
  14707. dest.on('error', onerror);
  14708. // remove all the event listeners that were added.
  14709. function cleanup() {
  14710. source.removeListener('data', ondata);
  14711. dest.removeListener('drain', ondrain);
  14712. source.removeListener('end', onend);
  14713. source.removeListener('close', onclose);
  14714. source.removeListener('error', onerror);
  14715. dest.removeListener('error', onerror);
  14716. source.removeListener('end', cleanup);
  14717. source.removeListener('close', cleanup);
  14718. dest.removeListener('close', cleanup);
  14719. }
  14720. source.on('end', cleanup);
  14721. source.on('close', cleanup);
  14722. dest.on('close', cleanup);
  14723. dest.emit('pipe', source);
  14724. // Allow for unix-like usage: A.pipe(B).pipe(C)
  14725. return dest;
  14726. };
  14727. },{"events":50,"inherits":56,"readable-stream/duplex.js":70,"readable-stream/passthrough.js":79,"readable-stream/readable.js":80,"readable-stream/transform.js":81,"readable-stream/writable.js":82}],85:[function(require,module,exports){
  14728. // Copyright Joyent, Inc. and other Node contributors.
  14729. //
  14730. // Permission is hereby granted, free of charge, to any person obtaining a
  14731. // copy of this software and associated documentation files (the
  14732. // "Software"), to deal in the Software without restriction, including
  14733. // without limitation the rights to use, copy, modify, merge, publish,
  14734. // distribute, sublicense, and/or sell copies of the Software, and to permit
  14735. // persons to whom the Software is furnished to do so, subject to the
  14736. // following conditions:
  14737. //
  14738. // The above copyright notice and this permission notice shall be included
  14739. // in all copies or substantial portions of the Software.
  14740. //
  14741. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  14742. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  14743. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  14744. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  14745. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  14746. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  14747. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  14748. 'use strict';
  14749. /*<replacement>*/
  14750. var Buffer = require('safe-buffer').Buffer;
  14751. /*</replacement>*/
  14752. var isEncoding = Buffer.isEncoding || function (encoding) {
  14753. encoding = '' + encoding;
  14754. switch (encoding && encoding.toLowerCase()) {
  14755. case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':
  14756. return true;
  14757. default:
  14758. return false;
  14759. }
  14760. };
  14761. function _normalizeEncoding(enc) {
  14762. if (!enc) return 'utf8';
  14763. var retried;
  14764. while (true) {
  14765. switch (enc) {
  14766. case 'utf8':
  14767. case 'utf-8':
  14768. return 'utf8';
  14769. case 'ucs2':
  14770. case 'ucs-2':
  14771. case 'utf16le':
  14772. case 'utf-16le':
  14773. return 'utf16le';
  14774. case 'latin1':
  14775. case 'binary':
  14776. return 'latin1';
  14777. case 'base64':
  14778. case 'ascii':
  14779. case 'hex':
  14780. return enc;
  14781. default:
  14782. if (retried) return; // undefined
  14783. enc = ('' + enc).toLowerCase();
  14784. retried = true;
  14785. }
  14786. }
  14787. };
  14788. // Do not cache `Buffer.isEncoding` when checking encoding names as some
  14789. // modules monkey-patch it to support additional encodings
  14790. function normalizeEncoding(enc) {
  14791. var nenc = _normalizeEncoding(enc);
  14792. if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
  14793. return nenc || enc;
  14794. }
  14795. // StringDecoder provides an interface for efficiently splitting a series of
  14796. // buffers into a series of JS strings without breaking apart multi-byte
  14797. // characters.
  14798. exports.StringDecoder = StringDecoder;
  14799. function StringDecoder(encoding) {
  14800. this.encoding = normalizeEncoding(encoding);
  14801. var nb;
  14802. switch (this.encoding) {
  14803. case 'utf16le':
  14804. this.text = utf16Text;
  14805. this.end = utf16End;
  14806. nb = 4;
  14807. break;
  14808. case 'utf8':
  14809. this.fillLast = utf8FillLast;
  14810. nb = 4;
  14811. break;
  14812. case 'base64':
  14813. this.text = base64Text;
  14814. this.end = base64End;
  14815. nb = 3;
  14816. break;
  14817. default:
  14818. this.write = simpleWrite;
  14819. this.end = simpleEnd;
  14820. return;
  14821. }
  14822. this.lastNeed = 0;
  14823. this.lastTotal = 0;
  14824. this.lastChar = Buffer.allocUnsafe(nb);
  14825. }
  14826. StringDecoder.prototype.write = function (buf) {
  14827. if (buf.length === 0) return '';
  14828. var r;
  14829. var i;
  14830. if (this.lastNeed) {
  14831. r = this.fillLast(buf);
  14832. if (r === undefined) return '';
  14833. i = this.lastNeed;
  14834. this.lastNeed = 0;
  14835. } else {
  14836. i = 0;
  14837. }
  14838. if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
  14839. return r || '';
  14840. };
  14841. StringDecoder.prototype.end = utf8End;
  14842. // Returns only complete characters in a Buffer
  14843. StringDecoder.prototype.text = utf8Text;
  14844. // Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
  14845. StringDecoder.prototype.fillLast = function (buf) {
  14846. if (this.lastNeed <= buf.length) {
  14847. buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
  14848. return this.lastChar.toString(this.encoding, 0, this.lastTotal);
  14849. }
  14850. buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
  14851. this.lastNeed -= buf.length;
  14852. };
  14853. // Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
  14854. // continuation byte. If an invalid byte is detected, -2 is returned.
  14855. function utf8CheckByte(byte) {
  14856. if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;
  14857. return byte >> 6 === 0x02 ? -1 : -2;
  14858. }
  14859. // Checks at most 3 bytes at the end of a Buffer in order to detect an
  14860. // incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
  14861. // needed to complete the UTF-8 character (if applicable) are returned.
  14862. function utf8CheckIncomplete(self, buf, i) {
  14863. var j = buf.length - 1;
  14864. if (j < i) return 0;
  14865. var nb = utf8CheckByte(buf[j]);
  14866. if (nb >= 0) {
  14867. if (nb > 0) self.lastNeed = nb - 1;
  14868. return nb;
  14869. }
  14870. if (--j < i || nb === -2) return 0;
  14871. nb = utf8CheckByte(buf[j]);
  14872. if (nb >= 0) {
  14873. if (nb > 0) self.lastNeed = nb - 2;
  14874. return nb;
  14875. }
  14876. if (--j < i || nb === -2) return 0;
  14877. nb = utf8CheckByte(buf[j]);
  14878. if (nb >= 0) {
  14879. if (nb > 0) {
  14880. if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
  14881. }
  14882. return nb;
  14883. }
  14884. return 0;
  14885. }
  14886. // Validates as many continuation bytes for a multi-byte UTF-8 character as
  14887. // needed or are available. If we see a non-continuation byte where we expect
  14888. // one, we "replace" the validated continuation bytes we've seen so far with
  14889. // a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding
  14890. // behavior. The continuation byte check is included three times in the case
  14891. // where all of the continuation bytes for a character exist in the same buffer.
  14892. // It is also done this way as a slight performance increase instead of using a
  14893. // loop.
  14894. function utf8CheckExtraBytes(self, buf, p) {
  14895. if ((buf[0] & 0xC0) !== 0x80) {
  14896. self.lastNeed = 0;
  14897. return '\ufffd';
  14898. }
  14899. if (self.lastNeed > 1 && buf.length > 1) {
  14900. if ((buf[1] & 0xC0) !== 0x80) {
  14901. self.lastNeed = 1;
  14902. return '\ufffd';
  14903. }
  14904. if (self.lastNeed > 2 && buf.length > 2) {
  14905. if ((buf[2] & 0xC0) !== 0x80) {
  14906. self.lastNeed = 2;
  14907. return '\ufffd';
  14908. }
  14909. }
  14910. }
  14911. }
  14912. // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
  14913. function utf8FillLast(buf) {
  14914. var p = this.lastTotal - this.lastNeed;
  14915. var r = utf8CheckExtraBytes(this, buf, p);
  14916. if (r !== undefined) return r;
  14917. if (this.lastNeed <= buf.length) {
  14918. buf.copy(this.lastChar, p, 0, this.lastNeed);
  14919. return this.lastChar.toString(this.encoding, 0, this.lastTotal);
  14920. }
  14921. buf.copy(this.lastChar, p, 0, buf.length);
  14922. this.lastNeed -= buf.length;
  14923. }
  14924. // Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
  14925. // partial character, the character's bytes are buffered until the required
  14926. // number of bytes are available.
  14927. function utf8Text(buf, i) {
  14928. var total = utf8CheckIncomplete(this, buf, i);
  14929. if (!this.lastNeed) return buf.toString('utf8', i);
  14930. this.lastTotal = total;
  14931. var end = buf.length - (total - this.lastNeed);
  14932. buf.copy(this.lastChar, 0, end);
  14933. return buf.toString('utf8', i, end);
  14934. }
  14935. // For UTF-8, a replacement character is added when ending on a partial
  14936. // character.
  14937. function utf8End(buf) {
  14938. var r = buf && buf.length ? this.write(buf) : '';
  14939. if (this.lastNeed) return r + '\ufffd';
  14940. return r;
  14941. }
  14942. // UTF-16LE typically needs two bytes per character, but even if we have an even
  14943. // number of bytes available, we need to check if we end on a leading/high
  14944. // surrogate. In that case, we need to wait for the next two bytes in order to
  14945. // decode the last character properly.
  14946. function utf16Text(buf, i) {
  14947. if ((buf.length - i) % 2 === 0) {
  14948. var r = buf.toString('utf16le', i);
  14949. if (r) {
  14950. var c = r.charCodeAt(r.length - 1);
  14951. if (c >= 0xD800 && c <= 0xDBFF) {
  14952. this.lastNeed = 2;
  14953. this.lastTotal = 4;
  14954. this.lastChar[0] = buf[buf.length - 2];
  14955. this.lastChar[1] = buf[buf.length - 1];
  14956. return r.slice(0, -1);
  14957. }
  14958. }
  14959. return r;
  14960. }
  14961. this.lastNeed = 1;
  14962. this.lastTotal = 2;
  14963. this.lastChar[0] = buf[buf.length - 1];
  14964. return buf.toString('utf16le', i, buf.length - 1);
  14965. }
  14966. // For UTF-16LE we do not explicitly append special replacement characters if we
  14967. // end on a partial character, we simply let v8 handle that.
  14968. function utf16End(buf) {
  14969. var r = buf && buf.length ? this.write(buf) : '';
  14970. if (this.lastNeed) {
  14971. var end = this.lastTotal - this.lastNeed;
  14972. return r + this.lastChar.toString('utf16le', 0, end);
  14973. }
  14974. return r;
  14975. }
  14976. function base64Text(buf, i) {
  14977. var n = (buf.length - i) % 3;
  14978. if (n === 0) return buf.toString('base64', i);
  14979. this.lastNeed = 3 - n;
  14980. this.lastTotal = 3;
  14981. if (n === 1) {
  14982. this.lastChar[0] = buf[buf.length - 1];
  14983. } else {
  14984. this.lastChar[0] = buf[buf.length - 2];
  14985. this.lastChar[1] = buf[buf.length - 1];
  14986. }
  14987. return buf.toString('base64', i, buf.length - n);
  14988. }
  14989. function base64End(buf) {
  14990. var r = buf && buf.length ? this.write(buf) : '';
  14991. if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
  14992. return r;
  14993. }
  14994. // Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
  14995. function simpleWrite(buf) {
  14996. return buf.toString(this.encoding);
  14997. }
  14998. function simpleEnd(buf) {
  14999. return buf && buf.length ? this.write(buf) : '';
  15000. }
  15001. },{"safe-buffer":83}],86:[function(require,module,exports){
  15002. (function (setImmediate,clearImmediate){
  15003. var nextTick = require('process/browser.js').nextTick;
  15004. var apply = Function.prototype.apply;
  15005. var slice = Array.prototype.slice;
  15006. var immediateIds = {};
  15007. var nextImmediateId = 0;
  15008. // DOM APIs, for completeness
  15009. exports.setTimeout = function() {
  15010. return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
  15011. };
  15012. exports.setInterval = function() {
  15013. return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
  15014. };
  15015. exports.clearTimeout =
  15016. exports.clearInterval = function(timeout) { timeout.close(); };
  15017. function Timeout(id, clearFn) {
  15018. this._id = id;
  15019. this._clearFn = clearFn;
  15020. }
  15021. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  15022. Timeout.prototype.close = function() {
  15023. this._clearFn.call(window, this._id);
  15024. };
  15025. // Does not start the time, just sets up the members needed.
  15026. exports.enroll = function(item, msecs) {
  15027. clearTimeout(item._idleTimeoutId);
  15028. item._idleTimeout = msecs;
  15029. };
  15030. exports.unenroll = function(item) {
  15031. clearTimeout(item._idleTimeoutId);
  15032. item._idleTimeout = -1;
  15033. };
  15034. exports._unrefActive = exports.active = function(item) {
  15035. clearTimeout(item._idleTimeoutId);
  15036. var msecs = item._idleTimeout;
  15037. if (msecs >= 0) {
  15038. item._idleTimeoutId = setTimeout(function onTimeout() {
  15039. if (item._onTimeout)
  15040. item._onTimeout();
  15041. }, msecs);
  15042. }
  15043. };
  15044. // That's not how node.js implements it but the exposed api is the same.
  15045. exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) {
  15046. var id = nextImmediateId++;
  15047. var args = arguments.length < 2 ? false : slice.call(arguments, 1);
  15048. immediateIds[id] = true;
  15049. nextTick(function onNextTick() {
  15050. if (immediateIds[id]) {
  15051. // fn.call() is faster so we optimize for the common use-case
  15052. // @see http://jsperf.com/call-apply-segu
  15053. if (args) {
  15054. fn.apply(null, args);
  15055. } else {
  15056. fn.call(null);
  15057. }
  15058. // Prevent ids from leaking
  15059. exports.clearImmediate(id);
  15060. }
  15061. });
  15062. return id;
  15063. };
  15064. exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) {
  15065. delete immediateIds[id];
  15066. };
  15067. }).call(this,require("timers").setImmediate,require("timers").clearImmediate)
  15068. },{"process/browser.js":69,"timers":86}],87:[function(require,module,exports){
  15069. (function (global){
  15070. /**
  15071. * Module exports.
  15072. */
  15073. module.exports = deprecate;
  15074. /**
  15075. * Mark that a method should not be used.
  15076. * Returns a modified function which warns once by default.
  15077. *
  15078. * If `localStorage.noDeprecation = true` is set, then it is a no-op.
  15079. *
  15080. * If `localStorage.throwDeprecation = true` is set, then deprecated functions
  15081. * will throw an Error when invoked.
  15082. *
  15083. * If `localStorage.traceDeprecation = true` is set, then deprecated functions
  15084. * will invoke `console.trace()` instead of `console.error()`.
  15085. *
  15086. * @param {Function} fn - the function to deprecate
  15087. * @param {String} msg - the string to print to the console when `fn` is invoked
  15088. * @returns {Function} a new "deprecated" version of `fn`
  15089. * @api public
  15090. */
  15091. function deprecate (fn, msg) {
  15092. if (config('noDeprecation')) {
  15093. return fn;
  15094. }
  15095. var warned = false;
  15096. function deprecated() {
  15097. if (!warned) {
  15098. if (config('throwDeprecation')) {
  15099. throw new Error(msg);
  15100. } else if (config('traceDeprecation')) {
  15101. console.trace(msg);
  15102. } else {
  15103. console.warn(msg);
  15104. }
  15105. warned = true;
  15106. }
  15107. return fn.apply(this, arguments);
  15108. }
  15109. return deprecated;
  15110. }
  15111. /**
  15112. * Checks `localStorage` for boolean values for the given `name`.
  15113. *
  15114. * @param {String} name
  15115. * @returns {Boolean}
  15116. * @api private
  15117. */
  15118. function config (name) {
  15119. // accessing global.localStorage can trigger a DOMException in sandboxed iframes
  15120. try {
  15121. if (!global.localStorage) return false;
  15122. } catch (_) {
  15123. return false;
  15124. }
  15125. var val = global.localStorage[name];
  15126. if (null == val) return false;
  15127. return String(val).toLowerCase() === 'true';
  15128. }
  15129. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  15130. },{}],88:[function(require,module,exports){
  15131. module.exports = function isBuffer(arg) {
  15132. return arg && typeof arg === 'object'
  15133. && typeof arg.copy === 'function'
  15134. && typeof arg.fill === 'function'
  15135. && typeof arg.readUInt8 === 'function';
  15136. }
  15137. },{}],89:[function(require,module,exports){
  15138. (function (process,global){
  15139. // Copyright Joyent, Inc. and other Node contributors.
  15140. //
  15141. // Permission is hereby granted, free of charge, to any person obtaining a
  15142. // copy of this software and associated documentation files (the
  15143. // "Software"), to deal in the Software without restriction, including
  15144. // without limitation the rights to use, copy, modify, merge, publish,
  15145. // distribute, sublicense, and/or sell copies of the Software, and to permit
  15146. // persons to whom the Software is furnished to do so, subject to the
  15147. // following conditions:
  15148. //
  15149. // The above copyright notice and this permission notice shall be included
  15150. // in all copies or substantial portions of the Software.
  15151. //
  15152. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  15153. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  15154. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  15155. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  15156. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  15157. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  15158. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  15159. var formatRegExp = /%[sdj%]/g;
  15160. exports.format = function(f) {
  15161. if (!isString(f)) {
  15162. var objects = [];
  15163. for (var i = 0; i < arguments.length; i++) {
  15164. objects.push(inspect(arguments[i]));
  15165. }
  15166. return objects.join(' ');
  15167. }
  15168. var i = 1;
  15169. var args = arguments;
  15170. var len = args.length;
  15171. var str = String(f).replace(formatRegExp, function(x) {
  15172. if (x === '%%') return '%';
  15173. if (i >= len) return x;
  15174. switch (x) {
  15175. case '%s': return String(args[i++]);
  15176. case '%d': return Number(args[i++]);
  15177. case '%j':
  15178. try {
  15179. return JSON.stringify(args[i++]);
  15180. } catch (_) {
  15181. return '[Circular]';
  15182. }
  15183. default:
  15184. return x;
  15185. }
  15186. });
  15187. for (var x = args[i]; i < len; x = args[++i]) {
  15188. if (isNull(x) || !isObject(x)) {
  15189. str += ' ' + x;
  15190. } else {
  15191. str += ' ' + inspect(x);
  15192. }
  15193. }
  15194. return str;
  15195. };
  15196. // Mark that a method should not be used.
  15197. // Returns a modified function which warns once by default.
  15198. // If --no-deprecation is set, then it is a no-op.
  15199. exports.deprecate = function(fn, msg) {
  15200. // Allow for deprecating things in the process of starting up.
  15201. if (isUndefined(global.process)) {
  15202. return function() {
  15203. return exports.deprecate(fn, msg).apply(this, arguments);
  15204. };
  15205. }
  15206. if (process.noDeprecation === true) {
  15207. return fn;
  15208. }
  15209. var warned = false;
  15210. function deprecated() {
  15211. if (!warned) {
  15212. if (process.throwDeprecation) {
  15213. throw new Error(msg);
  15214. } else if (process.traceDeprecation) {
  15215. console.trace(msg);
  15216. } else {
  15217. console.error(msg);
  15218. }
  15219. warned = true;
  15220. }
  15221. return fn.apply(this, arguments);
  15222. }
  15223. return deprecated;
  15224. };
  15225. var debugs = {};
  15226. var debugEnviron;
  15227. exports.debuglog = function(set) {
  15228. if (isUndefined(debugEnviron))
  15229. debugEnviron = process.env.NODE_DEBUG || '';
  15230. set = set.toUpperCase();
  15231. if (!debugs[set]) {
  15232. if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
  15233. var pid = process.pid;
  15234. debugs[set] = function() {
  15235. var msg = exports.format.apply(exports, arguments);
  15236. console.error('%s %d: %s', set, pid, msg);
  15237. };
  15238. } else {
  15239. debugs[set] = function() {};
  15240. }
  15241. }
  15242. return debugs[set];
  15243. };
  15244. /**
  15245. * Echos the value of a value. Trys to print the value out
  15246. * in the best way possible given the different types.
  15247. *
  15248. * @param {Object} obj The object to print out.
  15249. * @param {Object} opts Optional options object that alters the output.
  15250. */
  15251. /* legacy: obj, showHidden, depth, colors*/
  15252. function inspect(obj, opts) {
  15253. // default options
  15254. var ctx = {
  15255. seen: [],
  15256. stylize: stylizeNoColor
  15257. };
  15258. // legacy...
  15259. if (arguments.length >= 3) ctx.depth = arguments[2];
  15260. if (arguments.length >= 4) ctx.colors = arguments[3];
  15261. if (isBoolean(opts)) {
  15262. // legacy...
  15263. ctx.showHidden = opts;
  15264. } else if (opts) {
  15265. // got an "options" object
  15266. exports._extend(ctx, opts);
  15267. }
  15268. // set default options
  15269. if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
  15270. if (isUndefined(ctx.depth)) ctx.depth = 2;
  15271. if (isUndefined(ctx.colors)) ctx.colors = false;
  15272. if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
  15273. if (ctx.colors) ctx.stylize = stylizeWithColor;
  15274. return formatValue(ctx, obj, ctx.depth);
  15275. }
  15276. exports.inspect = inspect;
  15277. // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
  15278. inspect.colors = {
  15279. 'bold' : [1, 22],
  15280. 'italic' : [3, 23],
  15281. 'underline' : [4, 24],
  15282. 'inverse' : [7, 27],
  15283. 'white' : [37, 39],
  15284. 'grey' : [90, 39],
  15285. 'black' : [30, 39],
  15286. 'blue' : [34, 39],
  15287. 'cyan' : [36, 39],
  15288. 'green' : [32, 39],
  15289. 'magenta' : [35, 39],
  15290. 'red' : [31, 39],
  15291. 'yellow' : [33, 39]
  15292. };
  15293. // Don't use 'blue' not visible on cmd.exe
  15294. inspect.styles = {
  15295. 'special': 'cyan',
  15296. 'number': 'yellow',
  15297. 'boolean': 'yellow',
  15298. 'undefined': 'grey',
  15299. 'null': 'bold',
  15300. 'string': 'green',
  15301. 'date': 'magenta',
  15302. // "name": intentionally not styling
  15303. 'regexp': 'red'
  15304. };
  15305. function stylizeWithColor(str, styleType) {
  15306. var style = inspect.styles[styleType];
  15307. if (style) {
  15308. return '\u001b[' + inspect.colors[style][0] + 'm' + str +
  15309. '\u001b[' + inspect.colors[style][1] + 'm';
  15310. } else {
  15311. return str;
  15312. }
  15313. }
  15314. function stylizeNoColor(str, styleType) {
  15315. return str;
  15316. }
  15317. function arrayToHash(array) {
  15318. var hash = {};
  15319. array.forEach(function(val, idx) {
  15320. hash[val] = true;
  15321. });
  15322. return hash;
  15323. }
  15324. function formatValue(ctx, value, recurseTimes) {
  15325. // Provide a hook for user-specified inspect functions.
  15326. // Check that value is an object with an inspect function on it
  15327. if (ctx.customInspect &&
  15328. value &&
  15329. isFunction(value.inspect) &&
  15330. // Filter out the util module, it's inspect function is special
  15331. value.inspect !== exports.inspect &&
  15332. // Also filter out any prototype objects using the circular check.
  15333. !(value.constructor && value.constructor.prototype === value)) {
  15334. var ret = value.inspect(recurseTimes, ctx);
  15335. if (!isString(ret)) {
  15336. ret = formatValue(ctx, ret, recurseTimes);
  15337. }
  15338. return ret;
  15339. }
  15340. // Primitive types cannot have properties
  15341. var primitive = formatPrimitive(ctx, value);
  15342. if (primitive) {
  15343. return primitive;
  15344. }
  15345. // Look up the keys of the object.
  15346. var keys = Object.keys(value);
  15347. var visibleKeys = arrayToHash(keys);
  15348. if (ctx.showHidden) {
  15349. keys = Object.getOwnPropertyNames(value);
  15350. }
  15351. // IE doesn't make error fields non-enumerable
  15352. // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
  15353. if (isError(value)
  15354. && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
  15355. return formatError(value);
  15356. }
  15357. // Some type of object without properties can be shortcutted.
  15358. if (keys.length === 0) {
  15359. if (isFunction(value)) {
  15360. var name = value.name ? ': ' + value.name : '';
  15361. return ctx.stylize('[Function' + name + ']', 'special');
  15362. }
  15363. if (isRegExp(value)) {
  15364. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  15365. }
  15366. if (isDate(value)) {
  15367. return ctx.stylize(Date.prototype.toString.call(value), 'date');
  15368. }
  15369. if (isError(value)) {
  15370. return formatError(value);
  15371. }
  15372. }
  15373. var base = '', array = false, braces = ['{', '}'];
  15374. // Make Array say that they are Array
  15375. if (isArray(value)) {
  15376. array = true;
  15377. braces = ['[', ']'];
  15378. }
  15379. // Make functions say that they are functions
  15380. if (isFunction(value)) {
  15381. var n = value.name ? ': ' + value.name : '';
  15382. base = ' [Function' + n + ']';
  15383. }
  15384. // Make RegExps say that they are RegExps
  15385. if (isRegExp(value)) {
  15386. base = ' ' + RegExp.prototype.toString.call(value);
  15387. }
  15388. // Make dates with properties first say the date
  15389. if (isDate(value)) {
  15390. base = ' ' + Date.prototype.toUTCString.call(value);
  15391. }
  15392. // Make error with message first say the error
  15393. if (isError(value)) {
  15394. base = ' ' + formatError(value);
  15395. }
  15396. if (keys.length === 0 && (!array || value.length == 0)) {
  15397. return braces[0] + base + braces[1];
  15398. }
  15399. if (recurseTimes < 0) {
  15400. if (isRegExp(value)) {
  15401. return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
  15402. } else {
  15403. return ctx.stylize('[Object]', 'special');
  15404. }
  15405. }
  15406. ctx.seen.push(value);
  15407. var output;
  15408. if (array) {
  15409. output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
  15410. } else {
  15411. output = keys.map(function(key) {
  15412. return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
  15413. });
  15414. }
  15415. ctx.seen.pop();
  15416. return reduceToSingleString(output, base, braces);
  15417. }
  15418. function formatPrimitive(ctx, value) {
  15419. if (isUndefined(value))
  15420. return ctx.stylize('undefined', 'undefined');
  15421. if (isString(value)) {
  15422. var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
  15423. .replace(/'/g, "\\'")
  15424. .replace(/\\"/g, '"') + '\'';
  15425. return ctx.stylize(simple, 'string');
  15426. }
  15427. if (isNumber(value))
  15428. return ctx.stylize('' + value, 'number');
  15429. if (isBoolean(value))
  15430. return ctx.stylize('' + value, 'boolean');
  15431. // For some reason typeof null is "object", so special case here.
  15432. if (isNull(value))
  15433. return ctx.stylize('null', 'null');
  15434. }
  15435. function formatError(value) {
  15436. return '[' + Error.prototype.toString.call(value) + ']';
  15437. }
  15438. function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
  15439. var output = [];
  15440. for (var i = 0, l = value.length; i < l; ++i) {
  15441. if (hasOwnProperty(value, String(i))) {
  15442. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  15443. String(i), true));
  15444. } else {
  15445. output.push('');
  15446. }
  15447. }
  15448. keys.forEach(function(key) {
  15449. if (!key.match(/^\d+$/)) {
  15450. output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
  15451. key, true));
  15452. }
  15453. });
  15454. return output;
  15455. }
  15456. function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
  15457. var name, str, desc;
  15458. desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
  15459. if (desc.get) {
  15460. if (desc.set) {
  15461. str = ctx.stylize('[Getter/Setter]', 'special');
  15462. } else {
  15463. str = ctx.stylize('[Getter]', 'special');
  15464. }
  15465. } else {
  15466. if (desc.set) {
  15467. str = ctx.stylize('[Setter]', 'special');
  15468. }
  15469. }
  15470. if (!hasOwnProperty(visibleKeys, key)) {
  15471. name = '[' + key + ']';
  15472. }
  15473. if (!str) {
  15474. if (ctx.seen.indexOf(desc.value) < 0) {
  15475. if (isNull(recurseTimes)) {
  15476. str = formatValue(ctx, desc.value, null);
  15477. } else {
  15478. str = formatValue(ctx, desc.value, recurseTimes - 1);
  15479. }
  15480. if (str.indexOf('\n') > -1) {
  15481. if (array) {
  15482. str = str.split('\n').map(function(line) {
  15483. return ' ' + line;
  15484. }).join('\n').substr(2);
  15485. } else {
  15486. str = '\n' + str.split('\n').map(function(line) {
  15487. return ' ' + line;
  15488. }).join('\n');
  15489. }
  15490. }
  15491. } else {
  15492. str = ctx.stylize('[Circular]', 'special');
  15493. }
  15494. }
  15495. if (isUndefined(name)) {
  15496. if (array && key.match(/^\d+$/)) {
  15497. return str;
  15498. }
  15499. name = JSON.stringify('' + key);
  15500. if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
  15501. name = name.substr(1, name.length - 2);
  15502. name = ctx.stylize(name, 'name');
  15503. } else {
  15504. name = name.replace(/'/g, "\\'")
  15505. .replace(/\\"/g, '"')
  15506. .replace(/(^"|"$)/g, "'");
  15507. name = ctx.stylize(name, 'string');
  15508. }
  15509. }
  15510. return name + ': ' + str;
  15511. }
  15512. function reduceToSingleString(output, base, braces) {
  15513. var numLinesEst = 0;
  15514. var length = output.reduce(function(prev, cur) {
  15515. numLinesEst++;
  15516. if (cur.indexOf('\n') >= 0) numLinesEst++;
  15517. return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
  15518. }, 0);
  15519. if (length > 60) {
  15520. return braces[0] +
  15521. (base === '' ? '' : base + '\n ') +
  15522. ' ' +
  15523. output.join(',\n ') +
  15524. ' ' +
  15525. braces[1];
  15526. }
  15527. return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
  15528. }
  15529. // NOTE: These type checking functions intentionally don't use `instanceof`
  15530. // because it is fragile and can be easily faked with `Object.create()`.
  15531. function isArray(ar) {
  15532. return Array.isArray(ar);
  15533. }
  15534. exports.isArray = isArray;
  15535. function isBoolean(arg) {
  15536. return typeof arg === 'boolean';
  15537. }
  15538. exports.isBoolean = isBoolean;
  15539. function isNull(arg) {
  15540. return arg === null;
  15541. }
  15542. exports.isNull = isNull;
  15543. function isNullOrUndefined(arg) {
  15544. return arg == null;
  15545. }
  15546. exports.isNullOrUndefined = isNullOrUndefined;
  15547. function isNumber(arg) {
  15548. return typeof arg === 'number';
  15549. }
  15550. exports.isNumber = isNumber;
  15551. function isString(arg) {
  15552. return typeof arg === 'string';
  15553. }
  15554. exports.isString = isString;
  15555. function isSymbol(arg) {
  15556. return typeof arg === 'symbol';
  15557. }
  15558. exports.isSymbol = isSymbol;
  15559. function isUndefined(arg) {
  15560. return arg === void 0;
  15561. }
  15562. exports.isUndefined = isUndefined;
  15563. function isRegExp(re) {
  15564. return isObject(re) && objectToString(re) === '[object RegExp]';
  15565. }
  15566. exports.isRegExp = isRegExp;
  15567. function isObject(arg) {
  15568. return typeof arg === 'object' && arg !== null;
  15569. }
  15570. exports.isObject = isObject;
  15571. function isDate(d) {
  15572. return isObject(d) && objectToString(d) === '[object Date]';
  15573. }
  15574. exports.isDate = isDate;
  15575. function isError(e) {
  15576. return isObject(e) &&
  15577. (objectToString(e) === '[object Error]' || e instanceof Error);
  15578. }
  15579. exports.isError = isError;
  15580. function isFunction(arg) {
  15581. return typeof arg === 'function';
  15582. }
  15583. exports.isFunction = isFunction;
  15584. function isPrimitive(arg) {
  15585. return arg === null ||
  15586. typeof arg === 'boolean' ||
  15587. typeof arg === 'number' ||
  15588. typeof arg === 'string' ||
  15589. typeof arg === 'symbol' || // ES6 symbol
  15590. typeof arg === 'undefined';
  15591. }
  15592. exports.isPrimitive = isPrimitive;
  15593. exports.isBuffer = require('./support/isBuffer');
  15594. function objectToString(o) {
  15595. return Object.prototype.toString.call(o);
  15596. }
  15597. function pad(n) {
  15598. return n < 10 ? '0' + n.toString(10) : n.toString(10);
  15599. }
  15600. var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
  15601. 'Oct', 'Nov', 'Dec'];
  15602. // 26 Feb 16:19:34
  15603. function timestamp() {
  15604. var d = new Date();
  15605. var time = [pad(d.getHours()),
  15606. pad(d.getMinutes()),
  15607. pad(d.getSeconds())].join(':');
  15608. return [d.getDate(), months[d.getMonth()], time].join(' ');
  15609. }
  15610. // log is just a thin wrapper to console.log that prepends a timestamp
  15611. exports.log = function() {
  15612. console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
  15613. };
  15614. /**
  15615. * Inherit the prototype methods from one constructor into another.
  15616. *
  15617. * The Function.prototype.inherits from lang.js rewritten as a standalone
  15618. * function (not on Function.prototype). NOTE: If this file is to be loaded
  15619. * during bootstrapping this function needs to be rewritten using some native
  15620. * functions as prototype setup using normal JavaScript does not work as
  15621. * expected during bootstrapping (see mirror.js in r114903).
  15622. *
  15623. * @param {function} ctor Constructor function which needs to inherit the
  15624. * prototype.
  15625. * @param {function} superCtor Constructor function to inherit prototype from.
  15626. */
  15627. exports.inherits = require('inherits');
  15628. exports._extend = function(origin, add) {
  15629. // Don't do anything if add isn't an object
  15630. if (!add || !isObject(add)) return origin;
  15631. var keys = Object.keys(add);
  15632. var i = keys.length;
  15633. while (i--) {
  15634. origin[keys[i]] = add[keys[i]];
  15635. }
  15636. return origin;
  15637. };
  15638. function hasOwnProperty(obj, prop) {
  15639. return Object.prototype.hasOwnProperty.call(obj, prop);
  15640. }
  15641. }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  15642. },{"./support/isBuffer":88,"_process":69,"inherits":56}],90:[function(require,module,exports){
  15643. module.exports={
  15644. "name": "mocha",
  15645. "version": "6.1.4",
  15646. "homepage": "https://mochajs.org/",
  15647. "notifyLogo": "https://ibin.co/4QuRuGjXvl36.png"
  15648. }
  15649. },{}]},{},[1]);