diff2html.js 225 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280
  1. (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
  2. },{}],2:[function(require,module,exports){
  3. /*!
  4. diff v3.3.1
  5. Software License Agreement (BSD License)
  6. Copyright (c) 2009-2015, Kevin Decker <kpdecker@gmail.com>
  7. All rights reserved.
  8. Redistribution and use of this software in source and binary forms, with or without modification,
  9. are permitted provided that the following conditions are met:
  10. * Redistributions of source code must retain the above
  11. copyright notice, this list of conditions and the
  12. following disclaimer.
  13. * Redistributions in binary form must reproduce the above
  14. copyright notice, this list of conditions and the
  15. following disclaimer in the documentation and/or other
  16. materials provided with the distribution.
  17. * Neither the name of Kevin Decker nor the names of its
  18. contributors may be used to endorse or promote products
  19. derived from this software without specific prior
  20. written permission.
  21. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
  22. IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  23. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  24. CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  25. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  26. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  27. IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  28. OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  29. @license
  30. */
  31. (function webpackUniversalModuleDefinition(root, factory) {
  32. if(typeof exports === 'object' && typeof module === 'object')
  33. module.exports = factory();
  34. else if(typeof define === 'function' && define.amd)
  35. define([], factory);
  36. else if(typeof exports === 'object')
  37. exports["JsDiff"] = factory();
  38. else
  39. root["JsDiff"] = factory();
  40. })(this, function() {
  41. return /******/ (function(modules) { // webpackBootstrap
  42. /******/ // The module cache
  43. /******/ var installedModules = {};
  44. /******/ // The require function
  45. /******/ function __webpack_require__(moduleId) {
  46. /******/ // Check if module is in cache
  47. /******/ if(installedModules[moduleId])
  48. /******/ return installedModules[moduleId].exports;
  49. /******/ // Create a new module (and put it into the cache)
  50. /******/ var module = installedModules[moduleId] = {
  51. /******/ exports: {},
  52. /******/ id: moduleId,
  53. /******/ loaded: false
  54. /******/ };
  55. /******/ // Execute the module function
  56. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  57. /******/ // Flag the module as loaded
  58. /******/ module.loaded = true;
  59. /******/ // Return the exports of the module
  60. /******/ return module.exports;
  61. /******/ }
  62. /******/ // expose the modules object (__webpack_modules__)
  63. /******/ __webpack_require__.m = modules;
  64. /******/ // expose the module cache
  65. /******/ __webpack_require__.c = installedModules;
  66. /******/ // __webpack_public_path__
  67. /******/ __webpack_require__.p = "";
  68. /******/ // Load entry module and return exports
  69. /******/ return __webpack_require__(0);
  70. /******/ })
  71. /************************************************************************/
  72. /******/ ([
  73. /* 0 */
  74. /***/ (function(module, exports, __webpack_require__) {
  75. /*istanbul ignore start*/'use strict';
  76. exports.__esModule = true;
  77. 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;
  78. /*istanbul ignore end*/var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
  79. /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
  80. /*istanbul ignore end*/var /*istanbul ignore start*/_character = __webpack_require__(2) /*istanbul ignore end*/;
  81. var /*istanbul ignore start*/_word = __webpack_require__(3) /*istanbul ignore end*/;
  82. var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/;
  83. var /*istanbul ignore start*/_sentence = __webpack_require__(6) /*istanbul ignore end*/;
  84. var /*istanbul ignore start*/_css = __webpack_require__(7) /*istanbul ignore end*/;
  85. var /*istanbul ignore start*/_json = __webpack_require__(8) /*istanbul ignore end*/;
  86. var /*istanbul ignore start*/_array = __webpack_require__(9) /*istanbul ignore end*/;
  87. var /*istanbul ignore start*/_apply = __webpack_require__(10) /*istanbul ignore end*/;
  88. var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/;
  89. var /*istanbul ignore start*/_merge = __webpack_require__(13) /*istanbul ignore end*/;
  90. var /*istanbul ignore start*/_create = __webpack_require__(14) /*istanbul ignore end*/;
  91. var /*istanbul ignore start*/_dmp = __webpack_require__(16) /*istanbul ignore end*/;
  92. var /*istanbul ignore start*/_xml = __webpack_require__(17) /*istanbul ignore end*/;
  93. /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  94. /* See LICENSE file for terms of use */
  95. /*
  96. * Text diff implementation.
  97. *
  98. * This library supports the following APIS:
  99. * JsDiff.diffChars: Character by character diff
  100. * JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace
  101. * JsDiff.diffLines: Line based diff
  102. *
  103. * JsDiff.diffCss: Diff targeted at CSS content
  104. *
  105. * These methods are based on the implementation proposed in
  106. * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986).
  107. * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927
  108. */
  109. exports. /*istanbul ignore end*/Diff = _base2['default'];
  110. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffChars = _character.diffChars;
  111. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWords = _word.diffWords;
  112. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = _word.diffWordsWithSpace;
  113. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffLines = _line.diffLines;
  114. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = _line.diffTrimmedLines;
  115. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffSentences = _sentence.diffSentences;
  116. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffCss = _css.diffCss;
  117. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffJson = _json.diffJson;
  118. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffArrays = _array.diffArrays;
  119. /*istanbul ignore start*/exports. /*istanbul ignore end*/structuredPatch = _create.structuredPatch;
  120. /*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = _create.createTwoFilesPatch;
  121. /*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = _create.createPatch;
  122. /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatch = _apply.applyPatch;
  123. /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = _apply.applyPatches;
  124. /*istanbul ignore start*/exports. /*istanbul ignore end*/parsePatch = _parse.parsePatch;
  125. /*istanbul ignore start*/exports. /*istanbul ignore end*/merge = _merge.merge;
  126. /*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToDMP = _dmp.convertChangesToDMP;
  127. /*istanbul ignore start*/exports. /*istanbul ignore end*/convertChangesToXML = _xml.convertChangesToXML;
  128. /*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = _json.canonicalize;
  129. /***/ }),
  130. /* 1 */
  131. /***/ (function(module, exports) {
  132. /*istanbul ignore start*/'use strict';
  133. exports.__esModule = true;
  134. exports['default'] = /*istanbul ignore end*/Diff;
  135. function Diff() {}
  136. Diff.prototype = {
  137. /*istanbul ignore start*/ /*istanbul ignore end*/diff: function diff(oldString, newString) {
  138. /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  139. var callback = options.callback;
  140. if (typeof options === 'function') {
  141. callback = options;
  142. options = {};
  143. }
  144. this.options = options;
  145. var self = this;
  146. function done(value) {
  147. if (callback) {
  148. setTimeout(function () {
  149. callback(undefined, value);
  150. }, 0);
  151. return true;
  152. } else {
  153. return value;
  154. }
  155. }
  156. // Allow subclasses to massage the input prior to running
  157. oldString = this.castInput(oldString);
  158. newString = this.castInput(newString);
  159. oldString = this.removeEmpty(this.tokenize(oldString));
  160. newString = this.removeEmpty(this.tokenize(newString));
  161. var newLen = newString.length,
  162. oldLen = oldString.length;
  163. var editLength = 1;
  164. var maxEditLength = newLen + oldLen;
  165. var bestPath = [{ newPos: -1, components: [] }];
  166. // Seed editLength = 0, i.e. the content starts with the same values
  167. var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
  168. if (bestPath[0].newPos + 1 >= newLen && oldPos + 1 >= oldLen) {
  169. // Identity per the equality and tokenizer
  170. return done([{ value: this.join(newString), count: newString.length }]);
  171. }
  172. // Main worker method. checks all permutations of a given edit length for acceptance.
  173. function execEditLength() {
  174. for (var diagonalPath = -1 * editLength; diagonalPath <= editLength; diagonalPath += 2) {
  175. var basePath = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
  176. var addPath = bestPath[diagonalPath - 1],
  177. removePath = bestPath[diagonalPath + 1],
  178. _oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
  179. if (addPath) {
  180. // No one else is going to attempt to use this value, clear it
  181. bestPath[diagonalPath - 1] = undefined;
  182. }
  183. var canAdd = addPath && addPath.newPos + 1 < newLen,
  184. canRemove = removePath && 0 <= _oldPos && _oldPos < oldLen;
  185. if (!canAdd && !canRemove) {
  186. // If this path is a terminal then prune
  187. bestPath[diagonalPath] = undefined;
  188. continue;
  189. }
  190. // Select the diagonal that we want to branch from. We select the prior
  191. // path whose position in the new string is the farthest from the origin
  192. // and does not pass the bounds of the diff graph
  193. if (!canAdd || canRemove && addPath.newPos < removePath.newPos) {
  194. basePath = clonePath(removePath);
  195. self.pushComponent(basePath.components, undefined, true);
  196. } else {
  197. basePath = addPath; // No need to clone, we've pulled it from the list
  198. basePath.newPos++;
  199. self.pushComponent(basePath.components, true, undefined);
  200. }
  201. _oldPos = self.extractCommon(basePath, newString, oldString, diagonalPath);
  202. // If we have hit the end of both strings, then we are done
  203. if (basePath.newPos + 1 >= newLen && _oldPos + 1 >= oldLen) {
  204. return done(buildValues(self, basePath.components, newString, oldString, self.useLongestToken));
  205. } else {
  206. // Otherwise track this path as a potential candidate and continue.
  207. bestPath[diagonalPath] = basePath;
  208. }
  209. }
  210. editLength++;
  211. }
  212. // Performs the length of edit iteration. Is a bit fugly as this has to support the
  213. // sync and async mode which is never fun. Loops over execEditLength until a value
  214. // is produced.
  215. if (callback) {
  216. (function exec() {
  217. setTimeout(function () {
  218. // This should not happen, but we want to be safe.
  219. /* istanbul ignore next */
  220. if (editLength > maxEditLength) {
  221. return callback();
  222. }
  223. if (!execEditLength()) {
  224. exec();
  225. }
  226. }, 0);
  227. })();
  228. } else {
  229. while (editLength <= maxEditLength) {
  230. var ret = execEditLength();
  231. if (ret) {
  232. return ret;
  233. }
  234. }
  235. }
  236. },
  237. /*istanbul ignore start*/ /*istanbul ignore end*/pushComponent: function pushComponent(components, added, removed) {
  238. var last = components[components.length - 1];
  239. if (last && last.added === added && last.removed === removed) {
  240. // We need to clone here as the component clone operation is just
  241. // as shallow array clone
  242. components[components.length - 1] = { count: last.count + 1, added: added, removed: removed };
  243. } else {
  244. components.push({ count: 1, added: added, removed: removed });
  245. }
  246. },
  247. /*istanbul ignore start*/ /*istanbul ignore end*/extractCommon: function extractCommon(basePath, newString, oldString, diagonalPath) {
  248. var newLen = newString.length,
  249. oldLen = oldString.length,
  250. newPos = basePath.newPos,
  251. oldPos = newPos - diagonalPath,
  252. commonCount = 0;
  253. while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(newString[newPos + 1], oldString[oldPos + 1])) {
  254. newPos++;
  255. oldPos++;
  256. commonCount++;
  257. }
  258. if (commonCount) {
  259. basePath.components.push({ count: commonCount });
  260. }
  261. basePath.newPos = newPos;
  262. return oldPos;
  263. },
  264. /*istanbul ignore start*/ /*istanbul ignore end*/equals: function equals(left, right) {
  265. return left === right || this.options.ignoreCase && left.toLowerCase() === right.toLowerCase();
  266. },
  267. /*istanbul ignore start*/ /*istanbul ignore end*/removeEmpty: function removeEmpty(array) {
  268. var ret = [];
  269. for (var i = 0; i < array.length; i++) {
  270. if (array[i]) {
  271. ret.push(array[i]);
  272. }
  273. }
  274. return ret;
  275. },
  276. /*istanbul ignore start*/ /*istanbul ignore end*/castInput: function castInput(value) {
  277. return value;
  278. },
  279. /*istanbul ignore start*/ /*istanbul ignore end*/tokenize: function tokenize(value) {
  280. return value.split('');
  281. },
  282. /*istanbul ignore start*/ /*istanbul ignore end*/join: function join(chars) {
  283. return chars.join('');
  284. }
  285. };
  286. function buildValues(diff, components, newString, oldString, useLongestToken) {
  287. var componentPos = 0,
  288. componentLen = components.length,
  289. newPos = 0,
  290. oldPos = 0;
  291. for (; componentPos < componentLen; componentPos++) {
  292. var component = components[componentPos];
  293. if (!component.removed) {
  294. if (!component.added && useLongestToken) {
  295. var value = newString.slice(newPos, newPos + component.count);
  296. value = value.map(function (value, i) {
  297. var oldValue = oldString[oldPos + i];
  298. return oldValue.length > value.length ? oldValue : value;
  299. });
  300. component.value = diff.join(value);
  301. } else {
  302. component.value = diff.join(newString.slice(newPos, newPos + component.count));
  303. }
  304. newPos += component.count;
  305. // Common case
  306. if (!component.added) {
  307. oldPos += component.count;
  308. }
  309. } else {
  310. component.value = diff.join(oldString.slice(oldPos, oldPos + component.count));
  311. oldPos += component.count;
  312. // Reverse add and remove so removes are output first to match common convention
  313. // The diffing algorithm is tied to add then remove output and this is the simplest
  314. // route to get the desired output with minimal overhead.
  315. if (componentPos && components[componentPos - 1].added) {
  316. var tmp = components[componentPos - 1];
  317. components[componentPos - 1] = components[componentPos];
  318. components[componentPos] = tmp;
  319. }
  320. }
  321. }
  322. // Special case handle for when one terminal is ignored. For this case we merge the
  323. // terminal into the prior string and drop the change.
  324. var lastComponent = components[componentLen - 1];
  325. if (componentLen > 1 && (lastComponent.added || lastComponent.removed) && diff.equals('', lastComponent.value)) {
  326. components[componentLen - 2].value += lastComponent.value;
  327. components.pop();
  328. }
  329. return components;
  330. }
  331. function clonePath(path) {
  332. return { newPos: path.newPos, components: path.components.slice(0) };
  333. }
  334. /***/ }),
  335. /* 2 */
  336. /***/ (function(module, exports, __webpack_require__) {
  337. /*istanbul ignore start*/'use strict';
  338. exports.__esModule = true;
  339. exports.characterDiff = undefined;
  340. exports. /*istanbul ignore end*/diffChars = diffChars;
  341. var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
  342. /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
  343. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  344. /*istanbul ignore end*/var characterDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/characterDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
  345. function diffChars(oldStr, newStr, options) {
  346. return characterDiff.diff(oldStr, newStr, options);
  347. }
  348. /***/ }),
  349. /* 3 */
  350. /***/ (function(module, exports, __webpack_require__) {
  351. /*istanbul ignore start*/'use strict';
  352. exports.__esModule = true;
  353. exports.wordDiff = undefined;
  354. exports. /*istanbul ignore end*/diffWords = diffWords;
  355. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffWordsWithSpace = diffWordsWithSpace;
  356. var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
  357. /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
  358. /*istanbul ignore end*/var /*istanbul ignore start*/_params = __webpack_require__(4) /*istanbul ignore end*/;
  359. /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  360. /*istanbul ignore end*/ // Based on https://en.wikipedia.org/wiki/Latin_script_in_Unicode
  361. //
  362. // Ranges and exceptions:
  363. // Latin-1 Supplement, 0080–00FF
  364. // - U+00D7 × Multiplication sign
  365. // - U+00F7 ÷ Division sign
  366. // Latin Extended-A, 0100–017F
  367. // Latin Extended-B, 0180–024F
  368. // IPA Extensions, 0250–02AF
  369. // Spacing Modifier Letters, 02B0–02FF
  370. // - U+02C7 ˇ &#711; Caron
  371. // - U+02D8 ˘ &#728; Breve
  372. // - U+02D9 ˙ &#729; Dot Above
  373. // - U+02DA ˚ &#730; Ring Above
  374. // - U+02DB ˛ &#731; Ogonek
  375. // - U+02DC ˜ &#732; Small Tilde
  376. // - U+02DD ˝ &#733; Double Acute Accent
  377. // Latin Extended Additional, 1E00–1EFF
  378. var extendedWordChars = /^[A-Za-z\xC0-\u02C6\u02C8-\u02D7\u02DE-\u02FF\u1E00-\u1EFF]+$/;
  379. var reWhitespace = /\S/;
  380. var wordDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/wordDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
  381. wordDiff.equals = function (left, right) {
  382. if (this.options.ignoreCase) {
  383. left = left.toLowerCase();
  384. right = right.toLowerCase();
  385. }
  386. return left === right || this.options.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right);
  387. };
  388. wordDiff.tokenize = function (value) {
  389. var tokens = value.split(/(\s+|\b)/);
  390. // Join the boundary splits that we do not consider to be boundaries. This is primarily the extended Latin character set.
  391. for (var i = 0; i < tokens.length - 1; i++) {
  392. // If we have an empty string in the next field and we have only word chars before and after, merge
  393. if (!tokens[i + 1] && tokens[i + 2] && extendedWordChars.test(tokens[i]) && extendedWordChars.test(tokens[i + 2])) {
  394. tokens[i] += tokens[i + 2];
  395. tokens.splice(i + 1, 2);
  396. i--;
  397. }
  398. }
  399. return tokens;
  400. };
  401. function diffWords(oldStr, newStr, options) {
  402. options = /*istanbul ignore start*/(0, _params.generateOptions) /*istanbul ignore end*/(options, { ignoreWhitespace: true });
  403. return wordDiff.diff(oldStr, newStr, options);
  404. }
  405. function diffWordsWithSpace(oldStr, newStr, options) {
  406. return wordDiff.diff(oldStr, newStr, options);
  407. }
  408. /***/ }),
  409. /* 4 */
  410. /***/ (function(module, exports) {
  411. /*istanbul ignore start*/'use strict';
  412. exports.__esModule = true;
  413. exports. /*istanbul ignore end*/generateOptions = generateOptions;
  414. function generateOptions(options, defaults) {
  415. if (typeof options === 'function') {
  416. defaults.callback = options;
  417. } else if (options) {
  418. for (var name in options) {
  419. /* istanbul ignore else */
  420. if (options.hasOwnProperty(name)) {
  421. defaults[name] = options[name];
  422. }
  423. }
  424. }
  425. return defaults;
  426. }
  427. /***/ }),
  428. /* 5 */
  429. /***/ (function(module, exports, __webpack_require__) {
  430. /*istanbul ignore start*/'use strict';
  431. exports.__esModule = true;
  432. exports.lineDiff = undefined;
  433. exports. /*istanbul ignore end*/diffLines = diffLines;
  434. /*istanbul ignore start*/exports. /*istanbul ignore end*/diffTrimmedLines = diffTrimmedLines;
  435. var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
  436. /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
  437. /*istanbul ignore end*/var /*istanbul ignore start*/_params = __webpack_require__(4) /*istanbul ignore end*/;
  438. /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  439. /*istanbul ignore end*/var lineDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/lineDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
  440. lineDiff.tokenize = function (value) {
  441. var retLines = [],
  442. linesAndNewlines = value.split(/(\n|\r\n)/);
  443. // Ignore the final empty token that occurs if the string ends with a new line
  444. if (!linesAndNewlines[linesAndNewlines.length - 1]) {
  445. linesAndNewlines.pop();
  446. }
  447. // Merge the content and line separators into single tokens
  448. for (var i = 0; i < linesAndNewlines.length; i++) {
  449. var line = linesAndNewlines[i];
  450. if (i % 2 && !this.options.newlineIsToken) {
  451. retLines[retLines.length - 1] += line;
  452. } else {
  453. if (this.options.ignoreWhitespace) {
  454. line = line.trim();
  455. }
  456. retLines.push(line);
  457. }
  458. }
  459. return retLines;
  460. };
  461. function diffLines(oldStr, newStr, callback) {
  462. return lineDiff.diff(oldStr, newStr, callback);
  463. }
  464. function diffTrimmedLines(oldStr, newStr, callback) {
  465. var options = /*istanbul ignore start*/(0, _params.generateOptions) /*istanbul ignore end*/(callback, { ignoreWhitespace: true });
  466. return lineDiff.diff(oldStr, newStr, options);
  467. }
  468. /***/ }),
  469. /* 6 */
  470. /***/ (function(module, exports, __webpack_require__) {
  471. /*istanbul ignore start*/'use strict';
  472. exports.__esModule = true;
  473. exports.sentenceDiff = undefined;
  474. exports. /*istanbul ignore end*/diffSentences = diffSentences;
  475. var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
  476. /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
  477. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  478. /*istanbul ignore end*/var sentenceDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/sentenceDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
  479. sentenceDiff.tokenize = function (value) {
  480. return value.split(/(\S.+?[.!?])(?=\s+|$)/);
  481. };
  482. function diffSentences(oldStr, newStr, callback) {
  483. return sentenceDiff.diff(oldStr, newStr, callback);
  484. }
  485. /***/ }),
  486. /* 7 */
  487. /***/ (function(module, exports, __webpack_require__) {
  488. /*istanbul ignore start*/'use strict';
  489. exports.__esModule = true;
  490. exports.cssDiff = undefined;
  491. exports. /*istanbul ignore end*/diffCss = diffCss;
  492. var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
  493. /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
  494. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  495. /*istanbul ignore end*/var cssDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/cssDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
  496. cssDiff.tokenize = function (value) {
  497. return value.split(/([{}:;,]|\s+)/);
  498. };
  499. function diffCss(oldStr, newStr, callback) {
  500. return cssDiff.diff(oldStr, newStr, callback);
  501. }
  502. /***/ }),
  503. /* 8 */
  504. /***/ (function(module, exports, __webpack_require__) {
  505. /*istanbul ignore start*/'use strict';
  506. exports.__esModule = true;
  507. exports.jsonDiff = undefined;
  508. 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; };
  509. exports. /*istanbul ignore end*/diffJson = diffJson;
  510. /*istanbul ignore start*/exports. /*istanbul ignore end*/canonicalize = canonicalize;
  511. var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
  512. /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
  513. /*istanbul ignore end*/var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/;
  514. /*istanbul ignore start*/function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  515. /*istanbul ignore end*/var objectPrototypeToString = Object.prototype.toString;
  516. var jsonDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/jsonDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
  517. // Discriminate between two lines of pretty-printed, serialized JSON where one of them has a
  518. // dangling comma and the other doesn't. Turns out including the dangling comma yields the nicest output:
  519. jsonDiff.useLongestToken = true;
  520. jsonDiff.tokenize = /*istanbul ignore start*/_line.lineDiff /*istanbul ignore end*/.tokenize;
  521. jsonDiff.castInput = function (value) {
  522. /*istanbul ignore start*/var /*istanbul ignore end*/undefinedReplacement = this.options.undefinedReplacement;
  523. return typeof value === 'string' ? value : JSON.stringify(canonicalize(value), function (k, v) {
  524. if (typeof v === 'undefined') {
  525. return undefinedReplacement;
  526. }
  527. return v;
  528. }, ' ');
  529. };
  530. jsonDiff.equals = function (left, right) {
  531. 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'))
  532. );
  533. };
  534. function diffJson(oldObj, newObj, options) {
  535. return jsonDiff.diff(oldObj, newObj, options);
  536. }
  537. // This function handles the presence of circular references by bailing out when encountering an
  538. // object that is already on the "stack" of items being processed.
  539. function canonicalize(obj, stack, replacementStack) {
  540. stack = stack || [];
  541. replacementStack = replacementStack || [];
  542. var i = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
  543. for (i = 0; i < stack.length; i += 1) {
  544. if (stack[i] === obj) {
  545. return replacementStack[i];
  546. }
  547. }
  548. var canonicalizedObj = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
  549. if ('[object Array]' === objectPrototypeToString.call(obj)) {
  550. stack.push(obj);
  551. canonicalizedObj = new Array(obj.length);
  552. replacementStack.push(canonicalizedObj);
  553. for (i = 0; i < obj.length; i += 1) {
  554. canonicalizedObj[i] = canonicalize(obj[i], stack, replacementStack);
  555. }
  556. stack.pop();
  557. replacementStack.pop();
  558. return canonicalizedObj;
  559. }
  560. if (obj && obj.toJSON) {
  561. obj = obj.toJSON();
  562. }
  563. if ( /*istanbul ignore start*/(typeof /*istanbul ignore end*/obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' && obj !== null) {
  564. stack.push(obj);
  565. canonicalizedObj = {};
  566. replacementStack.push(canonicalizedObj);
  567. var sortedKeys = [],
  568. key = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
  569. for (key in obj) {
  570. /* istanbul ignore else */
  571. if (obj.hasOwnProperty(key)) {
  572. sortedKeys.push(key);
  573. }
  574. }
  575. sortedKeys.sort();
  576. for (i = 0; i < sortedKeys.length; i += 1) {
  577. key = sortedKeys[i];
  578. canonicalizedObj[key] = canonicalize(obj[key], stack, replacementStack);
  579. }
  580. stack.pop();
  581. replacementStack.pop();
  582. } else {
  583. canonicalizedObj = obj;
  584. }
  585. return canonicalizedObj;
  586. }
  587. /***/ }),
  588. /* 9 */
  589. /***/ (function(module, exports, __webpack_require__) {
  590. /*istanbul ignore start*/'use strict';
  591. exports.__esModule = true;
  592. exports.arrayDiff = undefined;
  593. exports. /*istanbul ignore end*/diffArrays = diffArrays;
  594. var /*istanbul ignore start*/_base = __webpack_require__(1) /*istanbul ignore end*/;
  595. /*istanbul ignore start*/var _base2 = _interopRequireDefault(_base);
  596. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  597. /*istanbul ignore end*/var arrayDiff = /*istanbul ignore start*/exports. /*istanbul ignore end*/arrayDiff = new /*istanbul ignore start*/_base2['default'] /*istanbul ignore end*/();
  598. arrayDiff.tokenize = arrayDiff.join = function (value) {
  599. return value.slice();
  600. };
  601. function diffArrays(oldArr, newArr, callback) {
  602. return arrayDiff.diff(oldArr, newArr, callback);
  603. }
  604. /***/ }),
  605. /* 10 */
  606. /***/ (function(module, exports, __webpack_require__) {
  607. /*istanbul ignore start*/'use strict';
  608. exports.__esModule = true;
  609. exports. /*istanbul ignore end*/applyPatch = applyPatch;
  610. /*istanbul ignore start*/exports. /*istanbul ignore end*/applyPatches = applyPatches;
  611. var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/;
  612. var /*istanbul ignore start*/_distanceIterator = __webpack_require__(12) /*istanbul ignore end*/;
  613. /*istanbul ignore start*/var _distanceIterator2 = _interopRequireDefault(_distanceIterator);
  614. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
  615. /*istanbul ignore end*/function applyPatch(source, uniDiff) {
  616. /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  617. if (typeof uniDiff === 'string') {
  618. uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff);
  619. }
  620. if (Array.isArray(uniDiff)) {
  621. if (uniDiff.length > 1) {
  622. throw new Error('applyPatch only works with a single input.');
  623. }
  624. uniDiff = uniDiff[0];
  625. }
  626. // Apply the diff to the input
  627. var lines = source.split(/\r\n|[\n\v\f\r\x85]/),
  628. delimiters = source.match(/\r\n|[\n\v\f\r\x85]/g) || [],
  629. hunks = uniDiff.hunks,
  630. compareLine = options.compareLine || function (lineNumber, line, operation, patchContent) /*istanbul ignore start*/{
  631. return (/*istanbul ignore end*/line === patchContent
  632. );
  633. },
  634. errorCount = 0,
  635. fuzzFactor = options.fuzzFactor || 0,
  636. minLine = 0,
  637. offset = 0,
  638. removeEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/,
  639. addEOFNL = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
  640. /**
  641. * Checks if the hunk exactly fits on the provided location
  642. */
  643. function hunkFits(hunk, toPos) {
  644. for (var j = 0; j < hunk.lines.length; j++) {
  645. var line = hunk.lines[j],
  646. operation = line[0],
  647. content = line.substr(1);
  648. if (operation === ' ' || operation === '-') {
  649. // Context sanity check
  650. if (!compareLine(toPos + 1, lines[toPos], operation, content)) {
  651. errorCount++;
  652. if (errorCount > fuzzFactor) {
  653. return false;
  654. }
  655. }
  656. toPos++;
  657. }
  658. }
  659. return true;
  660. }
  661. // Search best fit offsets for each hunk based on the previous ones
  662. for (var i = 0; i < hunks.length; i++) {
  663. var hunk = hunks[i],
  664. maxLine = lines.length - hunk.oldLines,
  665. localOffset = 0,
  666. toPos = offset + hunk.oldStart - 1;
  667. var iterator = /*istanbul ignore start*/(0, _distanceIterator2['default']) /*istanbul ignore end*/(toPos, minLine, maxLine);
  668. for (; localOffset !== undefined; localOffset = iterator()) {
  669. if (hunkFits(hunk, toPos + localOffset)) {
  670. hunk.offset = offset += localOffset;
  671. break;
  672. }
  673. }
  674. if (localOffset === undefined) {
  675. return false;
  676. }
  677. // Set lower text limit to end of the current hunk, so next ones don't try
  678. // to fit over already patched text
  679. minLine = hunk.offset + hunk.oldStart + hunk.oldLines;
  680. }
  681. // Apply patch hunks
  682. var diffOffset = 0;
  683. for (var _i = 0; _i < hunks.length; _i++) {
  684. var _hunk = hunks[_i],
  685. _toPos = _hunk.oldStart + _hunk.offset + diffOffset - 1;
  686. diffOffset += _hunk.newLines - _hunk.oldLines;
  687. if (_toPos < 0) {
  688. // Creating a new file
  689. _toPos = 0;
  690. }
  691. for (var j = 0; j < _hunk.lines.length; j++) {
  692. var line = _hunk.lines[j],
  693. operation = line[0],
  694. content = line.substr(1),
  695. delimiter = _hunk.linedelimiters[j];
  696. if (operation === ' ') {
  697. _toPos++;
  698. } else if (operation === '-') {
  699. lines.splice(_toPos, 1);
  700. delimiters.splice(_toPos, 1);
  701. /* istanbul ignore else */
  702. } else if (operation === '+') {
  703. lines.splice(_toPos, 0, content);
  704. delimiters.splice(_toPos, 0, delimiter);
  705. _toPos++;
  706. } else if (operation === '\\') {
  707. var previousOperation = _hunk.lines[j - 1] ? _hunk.lines[j - 1][0] : null;
  708. if (previousOperation === '+') {
  709. removeEOFNL = true;
  710. } else if (previousOperation === '-') {
  711. addEOFNL = true;
  712. }
  713. }
  714. }
  715. }
  716. // Handle EOFNL insertion/removal
  717. if (removeEOFNL) {
  718. while (!lines[lines.length - 1]) {
  719. lines.pop();
  720. delimiters.pop();
  721. }
  722. } else if (addEOFNL) {
  723. lines.push('');
  724. delimiters.push('\n');
  725. }
  726. for (var _k = 0; _k < lines.length - 1; _k++) {
  727. lines[_k] = lines[_k] + delimiters[_k];
  728. }
  729. return lines.join('');
  730. }
  731. // Wrapper that supports multiple file patches via callbacks.
  732. function applyPatches(uniDiff, options) {
  733. if (typeof uniDiff === 'string') {
  734. uniDiff = /*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(uniDiff);
  735. }
  736. var currentIndex = 0;
  737. function processIndex() {
  738. var index = uniDiff[currentIndex++];
  739. if (!index) {
  740. return options.complete();
  741. }
  742. options.loadFile(index, function (err, data) {
  743. if (err) {
  744. return options.complete(err);
  745. }
  746. var updatedContent = applyPatch(data, index, options);
  747. options.patched(index, updatedContent, function (err) {
  748. if (err) {
  749. return options.complete(err);
  750. }
  751. processIndex();
  752. });
  753. });
  754. }
  755. processIndex();
  756. }
  757. /***/ }),
  758. /* 11 */
  759. /***/ (function(module, exports) {
  760. /*istanbul ignore start*/'use strict';
  761. exports.__esModule = true;
  762. exports. /*istanbul ignore end*/parsePatch = parsePatch;
  763. function parsePatch(uniDiff) {
  764. /*istanbul ignore start*/var /*istanbul ignore end*/options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  765. var diffstr = uniDiff.split(/\r\n|[\n\v\f\r\x85]/),
  766. delimiters = uniDiff.match(/\r\n|[\n\v\f\r\x85]/g) || [],
  767. list = [],
  768. i = 0;
  769. function parseIndex() {
  770. var index = {};
  771. list.push(index);
  772. // Parse diff metadata
  773. while (i < diffstr.length) {
  774. var line = diffstr[i];
  775. // File header found, end parsing diff metadata
  776. if (/^(\-\-\-|\+\+\+|@@)\s/.test(line)) {
  777. break;
  778. }
  779. // Diff index
  780. var header = /^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(line);
  781. if (header) {
  782. index.index = header[1];
  783. }
  784. i++;
  785. }
  786. // Parse file headers if they are defined. Unified diff requires them, but
  787. // there's no technical issues to have an isolated hunk without file header
  788. parseFileHeader(index);
  789. parseFileHeader(index);
  790. // Parse hunks
  791. index.hunks = [];
  792. while (i < diffstr.length) {
  793. var _line = diffstr[i];
  794. if (/^(Index:|diff|\-\-\-|\+\+\+)\s/.test(_line)) {
  795. break;
  796. } else if (/^@@/.test(_line)) {
  797. index.hunks.push(parseHunk());
  798. } else if (_line && options.strict) {
  799. // Ignore unexpected content unless in strict mode
  800. throw new Error('Unknown line ' + (i + 1) + ' ' + JSON.stringify(_line));
  801. } else {
  802. i++;
  803. }
  804. }
  805. }
  806. // Parses the --- and +++ headers, if none are found, no lines
  807. // are consumed.
  808. function parseFileHeader(index) {
  809. var headerPattern = /^(---|\+\+\+)\s+([\S ]*)(?:\t(.*?)\s*)?$/;
  810. var fileHeader = headerPattern.exec(diffstr[i]);
  811. if (fileHeader) {
  812. var keyPrefix = fileHeader[1] === '---' ? 'old' : 'new';
  813. var fileName = fileHeader[2].replace(/\\\\/g, '\\');
  814. if (/^".*"$/.test(fileName)) {
  815. fileName = fileName.substr(1, fileName.length - 2);
  816. }
  817. index[keyPrefix + 'FileName'] = fileName;
  818. index[keyPrefix + 'Header'] = fileHeader[3];
  819. i++;
  820. }
  821. }
  822. // Parses a hunk
  823. // This assumes that we are at the start of a hunk.
  824. function parseHunk() {
  825. var chunkHeaderIndex = i,
  826. chunkHeaderLine = diffstr[i++],
  827. chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
  828. var hunk = {
  829. oldStart: +chunkHeader[1],
  830. oldLines: +chunkHeader[2] || 1,
  831. newStart: +chunkHeader[3],
  832. newLines: +chunkHeader[4] || 1,
  833. lines: [],
  834. linedelimiters: []
  835. };
  836. var addCount = 0,
  837. removeCount = 0;
  838. for (; i < diffstr.length; i++) {
  839. // Lines starting with '---' could be mistaken for the "remove line" operation
  840. // But they could be the header for the next file. Therefore prune such cases out.
  841. if (diffstr[i].indexOf('--- ') === 0 && i + 2 < diffstr.length && diffstr[i + 1].indexOf('+++ ') === 0 && diffstr[i + 2].indexOf('@@') === 0) {
  842. break;
  843. }
  844. var operation = diffstr[i][0];
  845. if (operation === '+' || operation === '-' || operation === ' ' || operation === '\\') {
  846. hunk.lines.push(diffstr[i]);
  847. hunk.linedelimiters.push(delimiters[i] || '\n');
  848. if (operation === '+') {
  849. addCount++;
  850. } else if (operation === '-') {
  851. removeCount++;
  852. } else if (operation === ' ') {
  853. addCount++;
  854. removeCount++;
  855. }
  856. } else {
  857. break;
  858. }
  859. }
  860. // Handle the empty block count case
  861. if (!addCount && hunk.newLines === 1) {
  862. hunk.newLines = 0;
  863. }
  864. if (!removeCount && hunk.oldLines === 1) {
  865. hunk.oldLines = 0;
  866. }
  867. // Perform optional sanity checking
  868. if (options.strict) {
  869. if (addCount !== hunk.newLines) {
  870. throw new Error('Added line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
  871. }
  872. if (removeCount !== hunk.oldLines) {
  873. throw new Error('Removed line count did not match for hunk at line ' + (chunkHeaderIndex + 1));
  874. }
  875. }
  876. return hunk;
  877. }
  878. while (i < diffstr.length) {
  879. parseIndex();
  880. }
  881. return list;
  882. }
  883. /***/ }),
  884. /* 12 */
  885. /***/ (function(module, exports) {
  886. /*istanbul ignore start*/"use strict";
  887. exports.__esModule = true;
  888. exports["default"] = /*istanbul ignore end*/function (start, minLine, maxLine) {
  889. var wantForward = true,
  890. backwardExhausted = false,
  891. forwardExhausted = false,
  892. localOffset = 1;
  893. return function iterator() {
  894. if (wantForward && !forwardExhausted) {
  895. if (backwardExhausted) {
  896. localOffset++;
  897. } else {
  898. wantForward = false;
  899. }
  900. // Check if trying to fit beyond text length, and if not, check it fits
  901. // after offset location (or desired location on first iteration)
  902. if (start + localOffset <= maxLine) {
  903. return localOffset;
  904. }
  905. forwardExhausted = true;
  906. }
  907. if (!backwardExhausted) {
  908. if (!forwardExhausted) {
  909. wantForward = true;
  910. }
  911. // Check if trying to fit before text beginning, and if not, check it fits
  912. // before offset location
  913. if (minLine <= start - localOffset) {
  914. return -localOffset++;
  915. }
  916. backwardExhausted = true;
  917. return iterator();
  918. }
  919. // We tried to fit hunk before text beginning and beyond text length, then
  920. // hunk can't fit on the text. Return undefined
  921. };
  922. };
  923. /***/ }),
  924. /* 13 */
  925. /***/ (function(module, exports, __webpack_require__) {
  926. /*istanbul ignore start*/'use strict';
  927. exports.__esModule = true;
  928. exports. /*istanbul ignore end*/calcLineCount = calcLineCount;
  929. /*istanbul ignore start*/exports. /*istanbul ignore end*/merge = merge;
  930. var /*istanbul ignore start*/_create = __webpack_require__(14) /*istanbul ignore end*/;
  931. var /*istanbul ignore start*/_parse = __webpack_require__(11) /*istanbul ignore end*/;
  932. var /*istanbul ignore start*/_array = __webpack_require__(15) /*istanbul ignore end*/;
  933. /*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); } }
  934. /*istanbul ignore end*/function calcLineCount(hunk) {
  935. var conflicted = false;
  936. hunk.oldLines = 0;
  937. hunk.newLines = 0;
  938. hunk.lines.forEach(function (line) {
  939. if (typeof line !== 'string') {
  940. conflicted = true;
  941. return;
  942. }
  943. if (line[0] === '+' || line[0] === ' ') {
  944. hunk.newLines++;
  945. }
  946. if (line[0] === '-' || line[0] === ' ') {
  947. hunk.oldLines++;
  948. }
  949. });
  950. if (conflicted) {
  951. delete hunk.oldLines;
  952. delete hunk.newLines;
  953. }
  954. }
  955. function merge(mine, theirs, base) {
  956. mine = loadPatch(mine, base);
  957. theirs = loadPatch(theirs, base);
  958. var ret = {};
  959. // For index we just let it pass through as it doesn't have any necessary meaning.
  960. // Leaving sanity checks on this to the API consumer that may know more about the
  961. // meaning in their own context.
  962. if (mine.index || theirs.index) {
  963. ret.index = mine.index || theirs.index;
  964. }
  965. if (mine.newFileName || theirs.newFileName) {
  966. if (!fileNameChanged(mine)) {
  967. // No header or no change in ours, use theirs (and ours if theirs does not exist)
  968. ret.oldFileName = theirs.oldFileName || mine.oldFileName;
  969. ret.newFileName = theirs.newFileName || mine.newFileName;
  970. ret.oldHeader = theirs.oldHeader || mine.oldHeader;
  971. ret.newHeader = theirs.newHeader || mine.newHeader;
  972. } else if (!fileNameChanged(theirs)) {
  973. // No header or no change in theirs, use ours
  974. ret.oldFileName = mine.oldFileName;
  975. ret.newFileName = mine.newFileName;
  976. ret.oldHeader = mine.oldHeader;
  977. ret.newHeader = mine.newHeader;
  978. } else {
  979. // Both changed... figure it out
  980. ret.oldFileName = selectField(ret, mine.oldFileName, theirs.oldFileName);
  981. ret.newFileName = selectField(ret, mine.newFileName, theirs.newFileName);
  982. ret.oldHeader = selectField(ret, mine.oldHeader, theirs.oldHeader);
  983. ret.newHeader = selectField(ret, mine.newHeader, theirs.newHeader);
  984. }
  985. }
  986. ret.hunks = [];
  987. var mineIndex = 0,
  988. theirsIndex = 0,
  989. mineOffset = 0,
  990. theirsOffset = 0;
  991. while (mineIndex < mine.hunks.length || theirsIndex < theirs.hunks.length) {
  992. var mineCurrent = mine.hunks[mineIndex] || { oldStart: Infinity },
  993. theirsCurrent = theirs.hunks[theirsIndex] || { oldStart: Infinity };
  994. if (hunkBefore(mineCurrent, theirsCurrent)) {
  995. // This patch does not overlap with any of the others, yay.
  996. ret.hunks.push(cloneHunk(mineCurrent, mineOffset));
  997. mineIndex++;
  998. theirsOffset += mineCurrent.newLines - mineCurrent.oldLines;
  999. } else if (hunkBefore(theirsCurrent, mineCurrent)) {
  1000. // This patch does not overlap with any of the others, yay.
  1001. ret.hunks.push(cloneHunk(theirsCurrent, theirsOffset));
  1002. theirsIndex++;
  1003. mineOffset += theirsCurrent.newLines - theirsCurrent.oldLines;
  1004. } else {
  1005. // Overlap, merge as best we can
  1006. var mergedHunk = {
  1007. oldStart: Math.min(mineCurrent.oldStart, theirsCurrent.oldStart),
  1008. oldLines: 0,
  1009. newStart: Math.min(mineCurrent.newStart + mineOffset, theirsCurrent.oldStart + theirsOffset),
  1010. newLines: 0,
  1011. lines: []
  1012. };
  1013. mergeLines(mergedHunk, mineCurrent.oldStart, mineCurrent.lines, theirsCurrent.oldStart, theirsCurrent.lines);
  1014. theirsIndex++;
  1015. mineIndex++;
  1016. ret.hunks.push(mergedHunk);
  1017. }
  1018. }
  1019. return ret;
  1020. }
  1021. function loadPatch(param, base) {
  1022. if (typeof param === 'string') {
  1023. if (/^@@/m.test(param) || /^Index:/m.test(param)) {
  1024. return (/*istanbul ignore start*/(0, _parse.parsePatch) /*istanbul ignore end*/(param)[0]
  1025. );
  1026. }
  1027. if (!base) {
  1028. throw new Error('Must provide a base reference or pass in a patch');
  1029. }
  1030. return (/*istanbul ignore start*/(0, _create.structuredPatch) /*istanbul ignore end*/(undefined, undefined, base, param)
  1031. );
  1032. }
  1033. return param;
  1034. }
  1035. function fileNameChanged(patch) {
  1036. return patch.newFileName && patch.newFileName !== patch.oldFileName;
  1037. }
  1038. function selectField(index, mine, theirs) {
  1039. if (mine === theirs) {
  1040. return mine;
  1041. } else {
  1042. index.conflict = true;
  1043. return { mine: mine, theirs: theirs };
  1044. }
  1045. }
  1046. function hunkBefore(test, check) {
  1047. return test.oldStart < check.oldStart && test.oldStart + test.oldLines < check.oldStart;
  1048. }
  1049. function cloneHunk(hunk, offset) {
  1050. return {
  1051. oldStart: hunk.oldStart, oldLines: hunk.oldLines,
  1052. newStart: hunk.newStart + offset, newLines: hunk.newLines,
  1053. lines: hunk.lines
  1054. };
  1055. }
  1056. function mergeLines(hunk, mineOffset, mineLines, theirOffset, theirLines) {
  1057. // This will generally result in a conflicted hunk, but there are cases where the context
  1058. // is the only overlap where we can successfully merge the content here.
  1059. var mine = { offset: mineOffset, lines: mineLines, index: 0 },
  1060. their = { offset: theirOffset, lines: theirLines, index: 0 };
  1061. // Handle any leading content
  1062. insertLeading(hunk, mine, their);
  1063. insertLeading(hunk, their, mine);
  1064. // Now in the overlap content. Scan through and select the best changes from each.
  1065. while (mine.index < mine.lines.length && their.index < their.lines.length) {
  1066. var mineCurrent = mine.lines[mine.index],
  1067. theirCurrent = their.lines[their.index];
  1068. if ((mineCurrent[0] === '-' || mineCurrent[0] === '+') && (theirCurrent[0] === '-' || theirCurrent[0] === '+')) {
  1069. // Both modified ...
  1070. mutualChange(hunk, mine, their);
  1071. } else if (mineCurrent[0] === '+' && theirCurrent[0] === ' ') {
  1072. /*istanbul ignore start*/var _hunk$lines;
  1073. /*istanbul ignore end*/ // Mine inserted
  1074. /*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)));
  1075. } else if (theirCurrent[0] === '+' && mineCurrent[0] === ' ') {
  1076. /*istanbul ignore start*/var _hunk$lines2;
  1077. /*istanbul ignore end*/ // Theirs inserted
  1078. /*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)));
  1079. } else if (mineCurrent[0] === '-' && theirCurrent[0] === ' ') {
  1080. // Mine removed or edited
  1081. removal(hunk, mine, their);
  1082. } else if (theirCurrent[0] === '-' && mineCurrent[0] === ' ') {
  1083. // Their removed or edited
  1084. removal(hunk, their, mine, true);
  1085. } else if (mineCurrent === theirCurrent) {
  1086. // Context identity
  1087. hunk.lines.push(mineCurrent);
  1088. mine.index++;
  1089. their.index++;
  1090. } else {
  1091. // Context mismatch
  1092. conflict(hunk, collectChange(mine), collectChange(their));
  1093. }
  1094. }
  1095. // Now push anything that may be remaining
  1096. insertTrailing(hunk, mine);
  1097. insertTrailing(hunk, their);
  1098. calcLineCount(hunk);
  1099. }
  1100. function mutualChange(hunk, mine, their) {
  1101. var myChanges = collectChange(mine),
  1102. theirChanges = collectChange(their);
  1103. if (allRemoves(myChanges) && allRemoves(theirChanges)) {
  1104. // Special case for remove changes that are supersets of one another
  1105. if ( /*istanbul ignore start*/(0, _array.arrayStartsWith) /*istanbul ignore end*/(myChanges, theirChanges) && skipRemoveSuperset(their, myChanges, myChanges.length - theirChanges.length)) {
  1106. /*istanbul ignore start*/var _hunk$lines3;
  1107. /*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));
  1108. return;
  1109. } else if ( /*istanbul ignore start*/(0, _array.arrayStartsWith) /*istanbul ignore end*/(theirChanges, myChanges) && skipRemoveSuperset(mine, theirChanges, theirChanges.length - myChanges.length)) {
  1110. /*istanbul ignore start*/var _hunk$lines4;
  1111. /*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));
  1112. return;
  1113. }
  1114. } else if ( /*istanbul ignore start*/(0, _array.arrayEqual) /*istanbul ignore end*/(myChanges, theirChanges)) {
  1115. /*istanbul ignore start*/var _hunk$lines5;
  1116. /*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));
  1117. return;
  1118. }
  1119. conflict(hunk, myChanges, theirChanges);
  1120. }
  1121. function removal(hunk, mine, their, swap) {
  1122. var myChanges = collectChange(mine),
  1123. theirChanges = collectContext(their, myChanges);
  1124. if (theirChanges.merged) {
  1125. /*istanbul ignore start*/var _hunk$lines6;
  1126. /*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));
  1127. } else {
  1128. conflict(hunk, swap ? theirChanges : myChanges, swap ? myChanges : theirChanges);
  1129. }
  1130. }
  1131. function conflict(hunk, mine, their) {
  1132. hunk.conflict = true;
  1133. hunk.lines.push({
  1134. conflict: true,
  1135. mine: mine,
  1136. theirs: their
  1137. });
  1138. }
  1139. function insertLeading(hunk, insert, their) {
  1140. while (insert.offset < their.offset && insert.index < insert.lines.length) {
  1141. var line = insert.lines[insert.index++];
  1142. hunk.lines.push(line);
  1143. insert.offset++;
  1144. }
  1145. }
  1146. function insertTrailing(hunk, insert) {
  1147. while (insert.index < insert.lines.length) {
  1148. var line = insert.lines[insert.index++];
  1149. hunk.lines.push(line);
  1150. }
  1151. }
  1152. function collectChange(state) {
  1153. var ret = [],
  1154. operation = state.lines[state.index][0];
  1155. while (state.index < state.lines.length) {
  1156. var line = state.lines[state.index];
  1157. // Group additions that are immediately after subtractions and treat them as one "atomic" modify change.
  1158. if (operation === '-' && line[0] === '+') {
  1159. operation = '+';
  1160. }
  1161. if (operation === line[0]) {
  1162. ret.push(line);
  1163. state.index++;
  1164. } else {
  1165. break;
  1166. }
  1167. }
  1168. return ret;
  1169. }
  1170. function collectContext(state, matchChanges) {
  1171. var changes = [],
  1172. merged = [],
  1173. matchIndex = 0,
  1174. contextChanges = false,
  1175. conflicted = false;
  1176. while (matchIndex < matchChanges.length && state.index < state.lines.length) {
  1177. var change = state.lines[state.index],
  1178. match = matchChanges[matchIndex];
  1179. // Once we've hit our add, then we are done
  1180. if (match[0] === '+') {
  1181. break;
  1182. }
  1183. contextChanges = contextChanges || change[0] !== ' ';
  1184. merged.push(match);
  1185. matchIndex++;
  1186. // Consume any additions in the other block as a conflict to attempt
  1187. // to pull in the remaining context after this
  1188. if (change[0] === '+') {
  1189. conflicted = true;
  1190. while (change[0] === '+') {
  1191. changes.push(change);
  1192. change = state.lines[++state.index];
  1193. }
  1194. }
  1195. if (match.substr(1) === change.substr(1)) {
  1196. changes.push(change);
  1197. state.index++;
  1198. } else {
  1199. conflicted = true;
  1200. }
  1201. }
  1202. if ((matchChanges[matchIndex] || '')[0] === '+' && contextChanges) {
  1203. conflicted = true;
  1204. }
  1205. if (conflicted) {
  1206. return changes;
  1207. }
  1208. while (matchIndex < matchChanges.length) {
  1209. merged.push(matchChanges[matchIndex++]);
  1210. }
  1211. return {
  1212. merged: merged,
  1213. changes: changes
  1214. };
  1215. }
  1216. function allRemoves(changes) {
  1217. return changes.reduce(function (prev, change) {
  1218. return prev && change[0] === '-';
  1219. }, true);
  1220. }
  1221. function skipRemoveSuperset(state, removeChanges, delta) {
  1222. for (var i = 0; i < delta; i++) {
  1223. var changeContent = removeChanges[removeChanges.length - delta + i].substr(1);
  1224. if (state.lines[state.index + i] !== ' ' + changeContent) {
  1225. return false;
  1226. }
  1227. }
  1228. state.index += delta;
  1229. return true;
  1230. }
  1231. /***/ }),
  1232. /* 14 */
  1233. /***/ (function(module, exports, __webpack_require__) {
  1234. /*istanbul ignore start*/'use strict';
  1235. exports.__esModule = true;
  1236. exports. /*istanbul ignore end*/structuredPatch = structuredPatch;
  1237. /*istanbul ignore start*/exports. /*istanbul ignore end*/createTwoFilesPatch = createTwoFilesPatch;
  1238. /*istanbul ignore start*/exports. /*istanbul ignore end*/createPatch = createPatch;
  1239. var /*istanbul ignore start*/_line = __webpack_require__(5) /*istanbul ignore end*/;
  1240. /*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); } }
  1241. /*istanbul ignore end*/function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
  1242. if (!options) {
  1243. options = {};
  1244. }
  1245. if (typeof options.context === 'undefined') {
  1246. options.context = 4;
  1247. }
  1248. var diff = /*istanbul ignore start*/(0, _line.diffLines) /*istanbul ignore end*/(oldStr, newStr, options);
  1249. diff.push({ value: '', lines: [] }); // Append an empty value to make cleanup easier
  1250. function contextLines(lines) {
  1251. return lines.map(function (entry) {
  1252. return ' ' + entry;
  1253. });
  1254. }
  1255. var hunks = [];
  1256. var oldRangeStart = 0,
  1257. newRangeStart = 0,
  1258. curRange = [],
  1259. oldLine = 1,
  1260. newLine = 1;
  1261. /*istanbul ignore start*/var _loop = function _loop( /*istanbul ignore end*/i) {
  1262. var current = diff[i],
  1263. lines = current.lines || current.value.replace(/\n$/, '').split('\n');
  1264. current.lines = lines;
  1265. if (current.added || current.removed) {
  1266. /*istanbul ignore start*/var _curRange;
  1267. /*istanbul ignore end*/ // If we have previous context, start with that
  1268. if (!oldRangeStart) {
  1269. var prev = diff[i - 1];
  1270. oldRangeStart = oldLine;
  1271. newRangeStart = newLine;
  1272. if (prev) {
  1273. curRange = options.context > 0 ? contextLines(prev.lines.slice(-options.context)) : [];
  1274. oldRangeStart -= curRange.length;
  1275. newRangeStart -= curRange.length;
  1276. }
  1277. }
  1278. // Output our changes
  1279. /*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) {
  1280. return (current.added ? '+' : '-') + entry;
  1281. })));
  1282. // Track the updated file position
  1283. if (current.added) {
  1284. newLine += lines.length;
  1285. } else {
  1286. oldLine += lines.length;
  1287. }
  1288. } else {
  1289. // Identical context lines. Track line changes
  1290. if (oldRangeStart) {
  1291. // Close out any changes that have been output (or join overlapping)
  1292. if (lines.length <= options.context * 2 && i < diff.length - 2) {
  1293. /*istanbul ignore start*/var _curRange2;
  1294. /*istanbul ignore end*/ // Overlapping
  1295. /*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)));
  1296. } else {
  1297. /*istanbul ignore start*/var _curRange3;
  1298. /*istanbul ignore end*/ // end the range and output
  1299. var contextSize = Math.min(lines.length, options.context);
  1300. /*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))));
  1301. var hunk = {
  1302. oldStart: oldRangeStart,
  1303. oldLines: oldLine - oldRangeStart + contextSize,
  1304. newStart: newRangeStart,
  1305. newLines: newLine - newRangeStart + contextSize,
  1306. lines: curRange
  1307. };
  1308. if (i >= diff.length - 2 && lines.length <= options.context) {
  1309. // EOF is inside this hunk
  1310. var oldEOFNewline = /\n$/.test(oldStr);
  1311. var newEOFNewline = /\n$/.test(newStr);
  1312. if (lines.length == 0 && !oldEOFNewline) {
  1313. // special case: old has no eol and no trailing context; no-nl can end up before adds
  1314. curRange.splice(hunk.oldLines, 0, '\\ No newline at end of file');
  1315. } else if (!oldEOFNewline || !newEOFNewline) {
  1316. curRange.push('\\ No newline at end of file');
  1317. }
  1318. }
  1319. hunks.push(hunk);
  1320. oldRangeStart = 0;
  1321. newRangeStart = 0;
  1322. curRange = [];
  1323. }
  1324. }
  1325. oldLine += lines.length;
  1326. newLine += lines.length;
  1327. }
  1328. };
  1329. for (var i = 0; i < diff.length; i++) {
  1330. /*istanbul ignore start*/_loop( /*istanbul ignore end*/i);
  1331. }
  1332. return {
  1333. oldFileName: oldFileName, newFileName: newFileName,
  1334. oldHeader: oldHeader, newHeader: newHeader,
  1335. hunks: hunks
  1336. };
  1337. }
  1338. function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options) {
  1339. var diff = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options);
  1340. var ret = [];
  1341. if (oldFileName == newFileName) {
  1342. ret.push('Index: ' + oldFileName);
  1343. }
  1344. ret.push('===================================================================');
  1345. ret.push('--- ' + diff.oldFileName + (typeof diff.oldHeader === 'undefined' ? '' : '\t' + diff.oldHeader));
  1346. ret.push('+++ ' + diff.newFileName + (typeof diff.newHeader === 'undefined' ? '' : '\t' + diff.newHeader));
  1347. for (var i = 0; i < diff.hunks.length; i++) {
  1348. var hunk = diff.hunks[i];
  1349. ret.push('@@ -' + hunk.oldStart + ',' + hunk.oldLines + ' +' + hunk.newStart + ',' + hunk.newLines + ' @@');
  1350. ret.push.apply(ret, hunk.lines);
  1351. }
  1352. return ret.join('\n') + '\n';
  1353. }
  1354. function createPatch(fileName, oldStr, newStr, oldHeader, newHeader, options) {
  1355. return createTwoFilesPatch(fileName, fileName, oldStr, newStr, oldHeader, newHeader, options);
  1356. }
  1357. /***/ }),
  1358. /* 15 */
  1359. /***/ (function(module, exports) {
  1360. /*istanbul ignore start*/"use strict";
  1361. exports.__esModule = true;
  1362. exports. /*istanbul ignore end*/arrayEqual = arrayEqual;
  1363. /*istanbul ignore start*/exports. /*istanbul ignore end*/arrayStartsWith = arrayStartsWith;
  1364. function arrayEqual(a, b) {
  1365. if (a.length !== b.length) {
  1366. return false;
  1367. }
  1368. return arrayStartsWith(a, b);
  1369. }
  1370. function arrayStartsWith(array, start) {
  1371. if (start.length > array.length) {
  1372. return false;
  1373. }
  1374. for (var i = 0; i < start.length; i++) {
  1375. if (start[i] !== array[i]) {
  1376. return false;
  1377. }
  1378. }
  1379. return true;
  1380. }
  1381. /***/ }),
  1382. /* 16 */
  1383. /***/ (function(module, exports) {
  1384. /*istanbul ignore start*/"use strict";
  1385. exports.__esModule = true;
  1386. exports. /*istanbul ignore end*/convertChangesToDMP = convertChangesToDMP;
  1387. // See: http://code.google.com/p/google-diff-match-patch/wiki/API
  1388. function convertChangesToDMP(changes) {
  1389. var ret = [],
  1390. change = /*istanbul ignore start*/void 0 /*istanbul ignore end*/,
  1391. operation = /*istanbul ignore start*/void 0 /*istanbul ignore end*/;
  1392. for (var i = 0; i < changes.length; i++) {
  1393. change = changes[i];
  1394. if (change.added) {
  1395. operation = 1;
  1396. } else if (change.removed) {
  1397. operation = -1;
  1398. } else {
  1399. operation = 0;
  1400. }
  1401. ret.push([operation, change.value]);
  1402. }
  1403. return ret;
  1404. }
  1405. /***/ }),
  1406. /* 17 */
  1407. /***/ (function(module, exports) {
  1408. /*istanbul ignore start*/'use strict';
  1409. exports.__esModule = true;
  1410. exports. /*istanbul ignore end*/convertChangesToXML = convertChangesToXML;
  1411. function convertChangesToXML(changes) {
  1412. var ret = [];
  1413. for (var i = 0; i < changes.length; i++) {
  1414. var change = changes[i];
  1415. if (change.added) {
  1416. ret.push('<ins>');
  1417. } else if (change.removed) {
  1418. ret.push('<del>');
  1419. }
  1420. ret.push(escapeHTML(change.value));
  1421. if (change.added) {
  1422. ret.push('</ins>');
  1423. } else if (change.removed) {
  1424. ret.push('</del>');
  1425. }
  1426. }
  1427. return ret.join('');
  1428. }
  1429. function escapeHTML(s) {
  1430. var n = s;
  1431. n = n.replace(/&/g, '&amp;');
  1432. n = n.replace(/</g, '&lt;');
  1433. n = n.replace(/>/g, '&gt;');
  1434. n = n.replace(/"/g, '&quot;');
  1435. return n;
  1436. }
  1437. /***/ })
  1438. /******/ ])
  1439. });
  1440. ;
  1441. },{}],3:[function(require,module,exports){
  1442. /*
  1443. * Copyright 2011 Twitter, Inc.
  1444. * Licensed under the Apache License, Version 2.0 (the "License");
  1445. * you may not use this file except in compliance with the License.
  1446. * You may obtain a copy of the License at
  1447. *
  1448. * http://www.apache.org/licenses/LICENSE-2.0
  1449. *
  1450. * Unless required by applicable law or agreed to in writing, software
  1451. * distributed under the License is distributed on an "AS IS" BASIS,
  1452. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  1453. * See the License for the specific language governing permissions and
  1454. * limitations under the License.
  1455. */
  1456. (function (Hogan) {
  1457. // Setup regex assignments
  1458. // remove whitespace according to Mustache spec
  1459. var rIsWhitespace = /\S/,
  1460. rQuot = /\"/g,
  1461. rNewline = /\n/g,
  1462. rCr = /\r/g,
  1463. rSlash = /\\/g,
  1464. rLineSep = /\u2028/,
  1465. rParagraphSep = /\u2029/;
  1466. Hogan.tags = {
  1467. '#': 1, '^': 2, '<': 3, '$': 4,
  1468. '/': 5, '!': 6, '>': 7, '=': 8, '_v': 9,
  1469. '{': 10, '&': 11, '_t': 12
  1470. };
  1471. Hogan.scan = function scan(text, delimiters) {
  1472. var len = text.length,
  1473. IN_TEXT = 0,
  1474. IN_TAG_TYPE = 1,
  1475. IN_TAG = 2,
  1476. state = IN_TEXT,
  1477. tagType = null,
  1478. tag = null,
  1479. buf = '',
  1480. tokens = [],
  1481. seenTag = false,
  1482. i = 0,
  1483. lineStart = 0,
  1484. otag = '{{',
  1485. ctag = '}}';
  1486. function addBuf() {
  1487. if (buf.length > 0) {
  1488. tokens.push({tag: '_t', text: new String(buf)});
  1489. buf = '';
  1490. }
  1491. }
  1492. function lineIsWhitespace() {
  1493. var isAllWhitespace = true;
  1494. for (var j = lineStart; j < tokens.length; j++) {
  1495. isAllWhitespace =
  1496. (Hogan.tags[tokens[j].tag] < Hogan.tags['_v']) ||
  1497. (tokens[j].tag == '_t' && tokens[j].text.match(rIsWhitespace) === null);
  1498. if (!isAllWhitespace) {
  1499. return false;
  1500. }
  1501. }
  1502. return isAllWhitespace;
  1503. }
  1504. function filterLine(haveSeenTag, noNewLine) {
  1505. addBuf();
  1506. if (haveSeenTag && lineIsWhitespace()) {
  1507. for (var j = lineStart, next; j < tokens.length; j++) {
  1508. if (tokens[j].text) {
  1509. if ((next = tokens[j+1]) && next.tag == '>') {
  1510. // set indent to token value
  1511. next.indent = tokens[j].text.toString()
  1512. }
  1513. tokens.splice(j, 1);
  1514. }
  1515. }
  1516. } else if (!noNewLine) {
  1517. tokens.push({tag:'\n'});
  1518. }
  1519. seenTag = false;
  1520. lineStart = tokens.length;
  1521. }
  1522. function changeDelimiters(text, index) {
  1523. var close = '=' + ctag,
  1524. closeIndex = text.indexOf(close, index),
  1525. delimiters = trim(
  1526. text.substring(text.indexOf('=', index) + 1, closeIndex)
  1527. ).split(' ');
  1528. otag = delimiters[0];
  1529. ctag = delimiters[delimiters.length - 1];
  1530. return closeIndex + close.length - 1;
  1531. }
  1532. if (delimiters) {
  1533. delimiters = delimiters.split(' ');
  1534. otag = delimiters[0];
  1535. ctag = delimiters[1];
  1536. }
  1537. for (i = 0; i < len; i++) {
  1538. if (state == IN_TEXT) {
  1539. if (tagChange(otag, text, i)) {
  1540. --i;
  1541. addBuf();
  1542. state = IN_TAG_TYPE;
  1543. } else {
  1544. if (text.charAt(i) == '\n') {
  1545. filterLine(seenTag);
  1546. } else {
  1547. buf += text.charAt(i);
  1548. }
  1549. }
  1550. } else if (state == IN_TAG_TYPE) {
  1551. i += otag.length - 1;
  1552. tag = Hogan.tags[text.charAt(i + 1)];
  1553. tagType = tag ? text.charAt(i + 1) : '_v';
  1554. if (tagType == '=') {
  1555. i = changeDelimiters(text, i);
  1556. state = IN_TEXT;
  1557. } else {
  1558. if (tag) {
  1559. i++;
  1560. }
  1561. state = IN_TAG;
  1562. }
  1563. seenTag = i;
  1564. } else {
  1565. if (tagChange(ctag, text, i)) {
  1566. tokens.push({tag: tagType, n: trim(buf), otag: otag, ctag: ctag,
  1567. i: (tagType == '/') ? seenTag - otag.length : i + ctag.length});
  1568. buf = '';
  1569. i += ctag.length - 1;
  1570. state = IN_TEXT;
  1571. if (tagType == '{') {
  1572. if (ctag == '}}') {
  1573. i++;
  1574. } else {
  1575. cleanTripleStache(tokens[tokens.length - 1]);
  1576. }
  1577. }
  1578. } else {
  1579. buf += text.charAt(i);
  1580. }
  1581. }
  1582. }
  1583. filterLine(seenTag, true);
  1584. return tokens;
  1585. }
  1586. function cleanTripleStache(token) {
  1587. if (token.n.substr(token.n.length - 1) === '}') {
  1588. token.n = token.n.substring(0, token.n.length - 1);
  1589. }
  1590. }
  1591. function trim(s) {
  1592. if (s.trim) {
  1593. return s.trim();
  1594. }
  1595. return s.replace(/^\s*|\s*$/g, '');
  1596. }
  1597. function tagChange(tag, text, index) {
  1598. if (text.charAt(index) != tag.charAt(0)) {
  1599. return false;
  1600. }
  1601. for (var i = 1, l = tag.length; i < l; i++) {
  1602. if (text.charAt(index + i) != tag.charAt(i)) {
  1603. return false;
  1604. }
  1605. }
  1606. return true;
  1607. }
  1608. // the tags allowed inside super templates
  1609. var allowedInSuper = {'_t': true, '\n': true, '$': true, '/': true};
  1610. function buildTree(tokens, kind, stack, customTags) {
  1611. var instructions = [],
  1612. opener = null,
  1613. tail = null,
  1614. token = null;
  1615. tail = stack[stack.length - 1];
  1616. while (tokens.length > 0) {
  1617. token = tokens.shift();
  1618. if (tail && tail.tag == '<' && !(token.tag in allowedInSuper)) {
  1619. throw new Error('Illegal content in < super tag.');
  1620. }
  1621. if (Hogan.tags[token.tag] <= Hogan.tags['$'] || isOpener(token, customTags)) {
  1622. stack.push(token);
  1623. token.nodes = buildTree(tokens, token.tag, stack, customTags);
  1624. } else if (token.tag == '/') {
  1625. if (stack.length === 0) {
  1626. throw new Error('Closing tag without opener: /' + token.n);
  1627. }
  1628. opener = stack.pop();
  1629. if (token.n != opener.n && !isCloser(token.n, opener.n, customTags)) {
  1630. throw new Error('Nesting error: ' + opener.n + ' vs. ' + token.n);
  1631. }
  1632. opener.end = token.i;
  1633. return instructions;
  1634. } else if (token.tag == '\n') {
  1635. token.last = (tokens.length == 0) || (tokens[0].tag == '\n');
  1636. }
  1637. instructions.push(token);
  1638. }
  1639. if (stack.length > 0) {
  1640. throw new Error('missing closing tag: ' + stack.pop().n);
  1641. }
  1642. return instructions;
  1643. }
  1644. function isOpener(token, tags) {
  1645. for (var i = 0, l = tags.length; i < l; i++) {
  1646. if (tags[i].o == token.n) {
  1647. token.tag = '#';
  1648. return true;
  1649. }
  1650. }
  1651. }
  1652. function isCloser(close, open, tags) {
  1653. for (var i = 0, l = tags.length; i < l; i++) {
  1654. if (tags[i].c == close && tags[i].o == open) {
  1655. return true;
  1656. }
  1657. }
  1658. }
  1659. function stringifySubstitutions(obj) {
  1660. var items = [];
  1661. for (var key in obj) {
  1662. items.push('"' + esc(key) + '": function(c,p,t,i) {' + obj[key] + '}');
  1663. }
  1664. return "{ " + items.join(",") + " }";
  1665. }
  1666. function stringifyPartials(codeObj) {
  1667. var partials = [];
  1668. for (var key in codeObj.partials) {
  1669. partials.push('"' + esc(key) + '":{name:"' + esc(codeObj.partials[key].name) + '", ' + stringifyPartials(codeObj.partials[key]) + "}");
  1670. }
  1671. return "partials: {" + partials.join(",") + "}, subs: " + stringifySubstitutions(codeObj.subs);
  1672. }
  1673. Hogan.stringify = function(codeObj, text, options) {
  1674. return "{code: function (c,p,i) { " + Hogan.wrapMain(codeObj.code) + " }," + stringifyPartials(codeObj) + "}";
  1675. }
  1676. var serialNo = 0;
  1677. Hogan.generate = function(tree, text, options) {
  1678. serialNo = 0;
  1679. var context = { code: '', subs: {}, partials: {} };
  1680. Hogan.walk(tree, context);
  1681. if (options.asString) {
  1682. return this.stringify(context, text, options);
  1683. }
  1684. return this.makeTemplate(context, text, options);
  1685. }
  1686. Hogan.wrapMain = function(code) {
  1687. return 'var t=this;t.b(i=i||"");' + code + 'return t.fl();';
  1688. }
  1689. Hogan.template = Hogan.Template;
  1690. Hogan.makeTemplate = function(codeObj, text, options) {
  1691. var template = this.makePartials(codeObj);
  1692. template.code = new Function('c', 'p', 'i', this.wrapMain(codeObj.code));
  1693. return new this.template(template, text, this, options);
  1694. }
  1695. Hogan.makePartials = function(codeObj) {
  1696. var key, template = {subs: {}, partials: codeObj.partials, name: codeObj.name};
  1697. for (key in template.partials) {
  1698. template.partials[key] = this.makePartials(template.partials[key]);
  1699. }
  1700. for (key in codeObj.subs) {
  1701. template.subs[key] = new Function('c', 'p', 't', 'i', codeObj.subs[key]);
  1702. }
  1703. return template;
  1704. }
  1705. function esc(s) {
  1706. return s.replace(rSlash, '\\\\')
  1707. .replace(rQuot, '\\\"')
  1708. .replace(rNewline, '\\n')
  1709. .replace(rCr, '\\r')
  1710. .replace(rLineSep, '\\u2028')
  1711. .replace(rParagraphSep, '\\u2029');
  1712. }
  1713. function chooseMethod(s) {
  1714. return (~s.indexOf('.')) ? 'd' : 'f';
  1715. }
  1716. function createPartial(node, context) {
  1717. var prefix = "<" + (context.prefix || "");
  1718. var sym = prefix + node.n + serialNo++;
  1719. context.partials[sym] = {name: node.n, partials: {}};
  1720. context.code += 't.b(t.rp("' + esc(sym) + '",c,p,"' + (node.indent || '') + '"));';
  1721. return sym;
  1722. }
  1723. Hogan.codegen = {
  1724. '#': function(node, context) {
  1725. context.code += 'if(t.s(t.' + chooseMethod(node.n) + '("' + esc(node.n) + '",c,p,1),' +
  1726. 'c,p,0,' + node.i + ',' + node.end + ',"' + node.otag + " " + node.ctag + '")){' +
  1727. 't.rs(c,p,' + 'function(c,p,t){';
  1728. Hogan.walk(node.nodes, context);
  1729. context.code += '});c.pop();}';
  1730. },
  1731. '^': function(node, context) {
  1732. context.code += 'if(!t.s(t.' + chooseMethod(node.n) + '("' + esc(node.n) + '",c,p,1),c,p,1,0,0,"")){';
  1733. Hogan.walk(node.nodes, context);
  1734. context.code += '};';
  1735. },
  1736. '>': createPartial,
  1737. '<': function(node, context) {
  1738. var ctx = {partials: {}, code: '', subs: {}, inPartial: true};
  1739. Hogan.walk(node.nodes, ctx);
  1740. var template = context.partials[createPartial(node, context)];
  1741. template.subs = ctx.subs;
  1742. template.partials = ctx.partials;
  1743. },
  1744. '$': function(node, context) {
  1745. var ctx = {subs: {}, code: '', partials: context.partials, prefix: node.n};
  1746. Hogan.walk(node.nodes, ctx);
  1747. context.subs[node.n] = ctx.code;
  1748. if (!context.inPartial) {
  1749. context.code += 't.sub("' + esc(node.n) + '",c,p,i);';
  1750. }
  1751. },
  1752. '\n': function(node, context) {
  1753. context.code += write('"\\n"' + (node.last ? '' : ' + i'));
  1754. },
  1755. '_v': function(node, context) {
  1756. context.code += 't.b(t.v(t.' + chooseMethod(node.n) + '("' + esc(node.n) + '",c,p,0)));';
  1757. },
  1758. '_t': function(node, context) {
  1759. context.code += write('"' + esc(node.text) + '"');
  1760. },
  1761. '{': tripleStache,
  1762. '&': tripleStache
  1763. }
  1764. function tripleStache(node, context) {
  1765. context.code += 't.b(t.t(t.' + chooseMethod(node.n) + '("' + esc(node.n) + '",c,p,0)));';
  1766. }
  1767. function write(s) {
  1768. return 't.b(' + s + ');';
  1769. }
  1770. Hogan.walk = function(nodelist, context) {
  1771. var func;
  1772. for (var i = 0, l = nodelist.length; i < l; i++) {
  1773. func = Hogan.codegen[nodelist[i].tag];
  1774. func && func(nodelist[i], context);
  1775. }
  1776. return context;
  1777. }
  1778. Hogan.parse = function(tokens, text, options) {
  1779. options = options || {};
  1780. return buildTree(tokens, '', [], options.sectionTags || []);
  1781. }
  1782. Hogan.cache = {};
  1783. Hogan.cacheKey = function(text, options) {
  1784. return [text, !!options.asString, !!options.disableLambda, options.delimiters, !!options.modelGet].join('||');
  1785. }
  1786. Hogan.compile = function(text, options) {
  1787. options = options || {};
  1788. var key = Hogan.cacheKey(text, options);
  1789. var template = this.cache[key];
  1790. if (template) {
  1791. var partials = template.partials;
  1792. for (var name in partials) {
  1793. delete partials[name].instance;
  1794. }
  1795. return template;
  1796. }
  1797. template = this.generate(this.parse(this.scan(text, options.delimiters), text, options), text, options);
  1798. return this.cache[key] = template;
  1799. }
  1800. })(typeof exports !== 'undefined' ? exports : Hogan);
  1801. },{}],4:[function(require,module,exports){
  1802. /*
  1803. * Copyright 2011 Twitter, Inc.
  1804. * Licensed under the Apache License, Version 2.0 (the "License");
  1805. * you may not use this file except in compliance with the License.
  1806. * You may obtain a copy of the License at
  1807. *
  1808. * http://www.apache.org/licenses/LICENSE-2.0
  1809. *
  1810. * Unless required by applicable law or agreed to in writing, software
  1811. * distributed under the License is distributed on an "AS IS" BASIS,
  1812. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  1813. * See the License for the specific language governing permissions and
  1814. * limitations under the License.
  1815. */
  1816. // This file is for use with Node.js. See dist/ for browser files.
  1817. var Hogan = require('./compiler');
  1818. Hogan.Template = require('./template').Template;
  1819. Hogan.template = Hogan.Template;
  1820. module.exports = Hogan;
  1821. },{"./compiler":3,"./template":5}],5:[function(require,module,exports){
  1822. /*
  1823. * Copyright 2011 Twitter, Inc.
  1824. * Licensed under the Apache License, Version 2.0 (the "License");
  1825. * you may not use this file except in compliance with the License.
  1826. * You may obtain a copy of the License at
  1827. *
  1828. * http://www.apache.org/licenses/LICENSE-2.0
  1829. *
  1830. * Unless required by applicable law or agreed to in writing, software
  1831. * distributed under the License is distributed on an "AS IS" BASIS,
  1832. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  1833. * See the License for the specific language governing permissions and
  1834. * limitations under the License.
  1835. */
  1836. var Hogan = {};
  1837. (function (Hogan) {
  1838. Hogan.Template = function (codeObj, text, compiler, options) {
  1839. codeObj = codeObj || {};
  1840. this.r = codeObj.code || this.r;
  1841. this.c = compiler;
  1842. this.options = options || {};
  1843. this.text = text || '';
  1844. this.partials = codeObj.partials || {};
  1845. this.subs = codeObj.subs || {};
  1846. this.buf = '';
  1847. }
  1848. Hogan.Template.prototype = {
  1849. // render: replaced by generated code.
  1850. r: function (context, partials, indent) { return ''; },
  1851. // variable escaping
  1852. v: hoganEscape,
  1853. // triple stache
  1854. t: coerceToString,
  1855. render: function render(context, partials, indent) {
  1856. return this.ri([context], partials || {}, indent);
  1857. },
  1858. // render internal -- a hook for overrides that catches partials too
  1859. ri: function (context, partials, indent) {
  1860. return this.r(context, partials, indent);
  1861. },
  1862. // ensurePartial
  1863. ep: function(symbol, partials) {
  1864. var partial = this.partials[symbol];
  1865. // check to see that if we've instantiated this partial before
  1866. var template = partials[partial.name];
  1867. if (partial.instance && partial.base == template) {
  1868. return partial.instance;
  1869. }
  1870. if (typeof template == 'string') {
  1871. if (!this.c) {
  1872. throw new Error("No compiler available.");
  1873. }
  1874. template = this.c.compile(template, this.options);
  1875. }
  1876. if (!template) {
  1877. return null;
  1878. }
  1879. // We use this to check whether the partials dictionary has changed
  1880. this.partials[symbol].base = template;
  1881. if (partial.subs) {
  1882. // Make sure we consider parent template now
  1883. if (!partials.stackText) partials.stackText = {};
  1884. for (key in partial.subs) {
  1885. if (!partials.stackText[key]) {
  1886. partials.stackText[key] = (this.activeSub !== undefined && partials.stackText[this.activeSub]) ? partials.stackText[this.activeSub] : this.text;
  1887. }
  1888. }
  1889. template = createSpecializedPartial(template, partial.subs, partial.partials,
  1890. this.stackSubs, this.stackPartials, partials.stackText);
  1891. }
  1892. this.partials[symbol].instance = template;
  1893. return template;
  1894. },
  1895. // tries to find a partial in the current scope and render it
  1896. rp: function(symbol, context, partials, indent) {
  1897. var partial = this.ep(symbol, partials);
  1898. if (!partial) {
  1899. return '';
  1900. }
  1901. return partial.ri(context, partials, indent);
  1902. },
  1903. // render a section
  1904. rs: function(context, partials, section) {
  1905. var tail = context[context.length - 1];
  1906. if (!isArray(tail)) {
  1907. section(context, partials, this);
  1908. return;
  1909. }
  1910. for (var i = 0; i < tail.length; i++) {
  1911. context.push(tail[i]);
  1912. section(context, partials, this);
  1913. context.pop();
  1914. }
  1915. },
  1916. // maybe start a section
  1917. s: function(val, ctx, partials, inverted, start, end, tags) {
  1918. var pass;
  1919. if (isArray(val) && val.length === 0) {
  1920. return false;
  1921. }
  1922. if (typeof val == 'function') {
  1923. val = this.ms(val, ctx, partials, inverted, start, end, tags);
  1924. }
  1925. pass = !!val;
  1926. if (!inverted && pass && ctx) {
  1927. ctx.push((typeof val == 'object') ? val : ctx[ctx.length - 1]);
  1928. }
  1929. return pass;
  1930. },
  1931. // find values with dotted names
  1932. d: function(key, ctx, partials, returnFound) {
  1933. var found,
  1934. names = key.split('.'),
  1935. val = this.f(names[0], ctx, partials, returnFound),
  1936. doModelGet = this.options.modelGet,
  1937. cx = null;
  1938. if (key === '.' && isArray(ctx[ctx.length - 2])) {
  1939. val = ctx[ctx.length - 1];
  1940. } else {
  1941. for (var i = 1; i < names.length; i++) {
  1942. found = findInScope(names[i], val, doModelGet);
  1943. if (found !== undefined) {
  1944. cx = val;
  1945. val = found;
  1946. } else {
  1947. val = '';
  1948. }
  1949. }
  1950. }
  1951. if (returnFound && !val) {
  1952. return false;
  1953. }
  1954. if (!returnFound && typeof val == 'function') {
  1955. ctx.push(cx);
  1956. val = this.mv(val, ctx, partials);
  1957. ctx.pop();
  1958. }
  1959. return val;
  1960. },
  1961. // find values with normal names
  1962. f: function(key, ctx, partials, returnFound) {
  1963. var val = false,
  1964. v = null,
  1965. found = false,
  1966. doModelGet = this.options.modelGet;
  1967. for (var i = ctx.length - 1; i >= 0; i--) {
  1968. v = ctx[i];
  1969. val = findInScope(key, v, doModelGet);
  1970. if (val !== undefined) {
  1971. found = true;
  1972. break;
  1973. }
  1974. }
  1975. if (!found) {
  1976. return (returnFound) ? false : "";
  1977. }
  1978. if (!returnFound && typeof val == 'function') {
  1979. val = this.mv(val, ctx, partials);
  1980. }
  1981. return val;
  1982. },
  1983. // higher order templates
  1984. ls: function(func, cx, partials, text, tags) {
  1985. var oldTags = this.options.delimiters;
  1986. this.options.delimiters = tags;
  1987. this.b(this.ct(coerceToString(func.call(cx, text)), cx, partials));
  1988. this.options.delimiters = oldTags;
  1989. return false;
  1990. },
  1991. // compile text
  1992. ct: function(text, cx, partials) {
  1993. if (this.options.disableLambda) {
  1994. throw new Error('Lambda features disabled.');
  1995. }
  1996. return this.c.compile(text, this.options).render(cx, partials);
  1997. },
  1998. // template result buffering
  1999. b: function(s) { this.buf += s; },
  2000. fl: function() { var r = this.buf; this.buf = ''; return r; },
  2001. // method replace section
  2002. ms: function(func, ctx, partials, inverted, start, end, tags) {
  2003. var textSource,
  2004. cx = ctx[ctx.length - 1],
  2005. result = func.call(cx);
  2006. if (typeof result == 'function') {
  2007. if (inverted) {
  2008. return true;
  2009. } else {
  2010. textSource = (this.activeSub && this.subsText && this.subsText[this.activeSub]) ? this.subsText[this.activeSub] : this.text;
  2011. return this.ls(result, cx, partials, textSource.substring(start, end), tags);
  2012. }
  2013. }
  2014. return result;
  2015. },
  2016. // method replace variable
  2017. mv: function(func, ctx, partials) {
  2018. var cx = ctx[ctx.length - 1];
  2019. var result = func.call(cx);
  2020. if (typeof result == 'function') {
  2021. return this.ct(coerceToString(result.call(cx)), cx, partials);
  2022. }
  2023. return result;
  2024. },
  2025. sub: function(name, context, partials, indent) {
  2026. var f = this.subs[name];
  2027. if (f) {
  2028. this.activeSub = name;
  2029. f(context, partials, this, indent);
  2030. this.activeSub = false;
  2031. }
  2032. }
  2033. };
  2034. //Find a key in an object
  2035. function findInScope(key, scope, doModelGet) {
  2036. var val;
  2037. if (scope && typeof scope == 'object') {
  2038. if (scope[key] !== undefined) {
  2039. val = scope[key];
  2040. // try lookup with get for backbone or similar model data
  2041. } else if (doModelGet && scope.get && typeof scope.get == 'function') {
  2042. val = scope.get(key);
  2043. }
  2044. }
  2045. return val;
  2046. }
  2047. function createSpecializedPartial(instance, subs, partials, stackSubs, stackPartials, stackText) {
  2048. function PartialTemplate() {};
  2049. PartialTemplate.prototype = instance;
  2050. function Substitutions() {};
  2051. Substitutions.prototype = instance.subs;
  2052. var key;
  2053. var partial = new PartialTemplate();
  2054. partial.subs = new Substitutions();
  2055. partial.subsText = {}; //hehe. substext.
  2056. partial.buf = '';
  2057. stackSubs = stackSubs || {};
  2058. partial.stackSubs = stackSubs;
  2059. partial.subsText = stackText;
  2060. for (key in subs) {
  2061. if (!stackSubs[key]) stackSubs[key] = subs[key];
  2062. }
  2063. for (key in stackSubs) {
  2064. partial.subs[key] = stackSubs[key];
  2065. }
  2066. stackPartials = stackPartials || {};
  2067. partial.stackPartials = stackPartials;
  2068. for (key in partials) {
  2069. if (!stackPartials[key]) stackPartials[key] = partials[key];
  2070. }
  2071. for (key in stackPartials) {
  2072. partial.partials[key] = stackPartials[key];
  2073. }
  2074. return partial;
  2075. }
  2076. var rAmp = /&/g,
  2077. rLt = /</g,
  2078. rGt = />/g,
  2079. rApos = /\'/g,
  2080. rQuot = /\"/g,
  2081. hChars = /[&<>\"\']/;
  2082. function coerceToString(val) {
  2083. return String((val === null || val === undefined) ? '' : val);
  2084. }
  2085. function hoganEscape(str) {
  2086. str = coerceToString(str);
  2087. return hChars.test(str) ?
  2088. str
  2089. .replace(rAmp, '&amp;')
  2090. .replace(rLt, '&lt;')
  2091. .replace(rGt, '&gt;')
  2092. .replace(rApos, '&#39;')
  2093. .replace(rQuot, '&quot;') :
  2094. str;
  2095. }
  2096. var isArray = Array.isArray || function(a) {
  2097. return Object.prototype.toString.call(a) === '[object Array]';
  2098. };
  2099. })(typeof exports !== 'undefined' ? exports : Hogan);
  2100. },{}],6:[function(require,module,exports){
  2101. var hashClear = require('./_hashClear'),
  2102. hashDelete = require('./_hashDelete'),
  2103. hashGet = require('./_hashGet'),
  2104. hashHas = require('./_hashHas'),
  2105. hashSet = require('./_hashSet');
  2106. /**
  2107. * Creates a hash object.
  2108. *
  2109. * @private
  2110. * @constructor
  2111. * @param {Array} [entries] The key-value pairs to cache.
  2112. */
  2113. function Hash(entries) {
  2114. var index = -1,
  2115. length = entries == null ? 0 : entries.length;
  2116. this.clear();
  2117. while (++index < length) {
  2118. var entry = entries[index];
  2119. this.set(entry[0], entry[1]);
  2120. }
  2121. }
  2122. // Add methods to `Hash`.
  2123. Hash.prototype.clear = hashClear;
  2124. Hash.prototype['delete'] = hashDelete;
  2125. Hash.prototype.get = hashGet;
  2126. Hash.prototype.has = hashHas;
  2127. Hash.prototype.set = hashSet;
  2128. module.exports = Hash;
  2129. },{"./_hashClear":47,"./_hashDelete":48,"./_hashGet":49,"./_hashHas":50,"./_hashSet":51}],7:[function(require,module,exports){
  2130. var listCacheClear = require('./_listCacheClear'),
  2131. listCacheDelete = require('./_listCacheDelete'),
  2132. listCacheGet = require('./_listCacheGet'),
  2133. listCacheHas = require('./_listCacheHas'),
  2134. listCacheSet = require('./_listCacheSet');
  2135. /**
  2136. * Creates an list cache object.
  2137. *
  2138. * @private
  2139. * @constructor
  2140. * @param {Array} [entries] The key-value pairs to cache.
  2141. */
  2142. function ListCache(entries) {
  2143. var index = -1,
  2144. length = entries == null ? 0 : entries.length;
  2145. this.clear();
  2146. while (++index < length) {
  2147. var entry = entries[index];
  2148. this.set(entry[0], entry[1]);
  2149. }
  2150. }
  2151. // Add methods to `ListCache`.
  2152. ListCache.prototype.clear = listCacheClear;
  2153. ListCache.prototype['delete'] = listCacheDelete;
  2154. ListCache.prototype.get = listCacheGet;
  2155. ListCache.prototype.has = listCacheHas;
  2156. ListCache.prototype.set = listCacheSet;
  2157. module.exports = ListCache;
  2158. },{"./_listCacheClear":58,"./_listCacheDelete":59,"./_listCacheGet":60,"./_listCacheHas":61,"./_listCacheSet":62}],8:[function(require,module,exports){
  2159. var getNative = require('./_getNative'),
  2160. root = require('./_root');
  2161. /* Built-in method references that are verified to be native. */
  2162. var Map = getNative(root, 'Map');
  2163. module.exports = Map;
  2164. },{"./_getNative":43,"./_root":74}],9:[function(require,module,exports){
  2165. var mapCacheClear = require('./_mapCacheClear'),
  2166. mapCacheDelete = require('./_mapCacheDelete'),
  2167. mapCacheGet = require('./_mapCacheGet'),
  2168. mapCacheHas = require('./_mapCacheHas'),
  2169. mapCacheSet = require('./_mapCacheSet');
  2170. /**
  2171. * Creates a map cache object to store key-value pairs.
  2172. *
  2173. * @private
  2174. * @constructor
  2175. * @param {Array} [entries] The key-value pairs to cache.
  2176. */
  2177. function MapCache(entries) {
  2178. var index = -1,
  2179. length = entries == null ? 0 : entries.length;
  2180. this.clear();
  2181. while (++index < length) {
  2182. var entry = entries[index];
  2183. this.set(entry[0], entry[1]);
  2184. }
  2185. }
  2186. // Add methods to `MapCache`.
  2187. MapCache.prototype.clear = mapCacheClear;
  2188. MapCache.prototype['delete'] = mapCacheDelete;
  2189. MapCache.prototype.get = mapCacheGet;
  2190. MapCache.prototype.has = mapCacheHas;
  2191. MapCache.prototype.set = mapCacheSet;
  2192. module.exports = MapCache;
  2193. },{"./_mapCacheClear":63,"./_mapCacheDelete":64,"./_mapCacheGet":65,"./_mapCacheHas":66,"./_mapCacheSet":67}],10:[function(require,module,exports){
  2194. var ListCache = require('./_ListCache'),
  2195. stackClear = require('./_stackClear'),
  2196. stackDelete = require('./_stackDelete'),
  2197. stackGet = require('./_stackGet'),
  2198. stackHas = require('./_stackHas'),
  2199. stackSet = require('./_stackSet');
  2200. /**
  2201. * Creates a stack cache object to store key-value pairs.
  2202. *
  2203. * @private
  2204. * @constructor
  2205. * @param {Array} [entries] The key-value pairs to cache.
  2206. */
  2207. function Stack(entries) {
  2208. var data = this.__data__ = new ListCache(entries);
  2209. this.size = data.size;
  2210. }
  2211. // Add methods to `Stack`.
  2212. Stack.prototype.clear = stackClear;
  2213. Stack.prototype['delete'] = stackDelete;
  2214. Stack.prototype.get = stackGet;
  2215. Stack.prototype.has = stackHas;
  2216. Stack.prototype.set = stackSet;
  2217. module.exports = Stack;
  2218. },{"./_ListCache":7,"./_stackClear":77,"./_stackDelete":78,"./_stackGet":79,"./_stackHas":80,"./_stackSet":81}],11:[function(require,module,exports){
  2219. var root = require('./_root');
  2220. /** Built-in value references. */
  2221. var Symbol = root.Symbol;
  2222. module.exports = Symbol;
  2223. },{"./_root":74}],12:[function(require,module,exports){
  2224. var root = require('./_root');
  2225. /** Built-in value references. */
  2226. var Uint8Array = root.Uint8Array;
  2227. module.exports = Uint8Array;
  2228. },{"./_root":74}],13:[function(require,module,exports){
  2229. /**
  2230. * A faster alternative to `Function#apply`, this function invokes `func`
  2231. * with the `this` binding of `thisArg` and the arguments of `args`.
  2232. *
  2233. * @private
  2234. * @param {Function} func The function to invoke.
  2235. * @param {*} thisArg The `this` binding of `func`.
  2236. * @param {Array} args The arguments to invoke `func` with.
  2237. * @returns {*} Returns the result of `func`.
  2238. */
  2239. function apply(func, thisArg, args) {
  2240. switch (args.length) {
  2241. case 0: return func.call(thisArg);
  2242. case 1: return func.call(thisArg, args[0]);
  2243. case 2: return func.call(thisArg, args[0], args[1]);
  2244. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  2245. }
  2246. return func.apply(thisArg, args);
  2247. }
  2248. module.exports = apply;
  2249. },{}],14:[function(require,module,exports){
  2250. var baseTimes = require('./_baseTimes'),
  2251. isArguments = require('./isArguments'),
  2252. isArray = require('./isArray'),
  2253. isBuffer = require('./isBuffer'),
  2254. isIndex = require('./_isIndex'),
  2255. isTypedArray = require('./isTypedArray');
  2256. /** Used for built-in method references. */
  2257. var objectProto = Object.prototype;
  2258. /** Used to check objects for own properties. */
  2259. var hasOwnProperty = objectProto.hasOwnProperty;
  2260. /**
  2261. * Creates an array of the enumerable property names of the array-like `value`.
  2262. *
  2263. * @private
  2264. * @param {*} value The value to query.
  2265. * @param {boolean} inherited Specify returning inherited property names.
  2266. * @returns {Array} Returns the array of property names.
  2267. */
  2268. function arrayLikeKeys(value, inherited) {
  2269. var isArr = isArray(value),
  2270. isArg = !isArr && isArguments(value),
  2271. isBuff = !isArr && !isArg && isBuffer(value),
  2272. isType = !isArr && !isArg && !isBuff && isTypedArray(value),
  2273. skipIndexes = isArr || isArg || isBuff || isType,
  2274. result = skipIndexes ? baseTimes(value.length, String) : [],
  2275. length = result.length;
  2276. for (var key in value) {
  2277. if ((inherited || hasOwnProperty.call(value, key)) &&
  2278. !(skipIndexes && (
  2279. // Safari 9 has enumerable `arguments.length` in strict mode.
  2280. key == 'length' ||
  2281. // Node.js 0.10 has enumerable non-index properties on buffers.
  2282. (isBuff && (key == 'offset' || key == 'parent')) ||
  2283. // PhantomJS 2 has enumerable non-index properties on typed arrays.
  2284. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
  2285. // Skip index properties.
  2286. isIndex(key, length)
  2287. ))) {
  2288. result.push(key);
  2289. }
  2290. }
  2291. return result;
  2292. }
  2293. module.exports = arrayLikeKeys;
  2294. },{"./_baseTimes":30,"./_isIndex":53,"./isArguments":86,"./isArray":87,"./isBuffer":90,"./isTypedArray":96}],15:[function(require,module,exports){
  2295. var baseAssignValue = require('./_baseAssignValue'),
  2296. eq = require('./eq');
  2297. /**
  2298. * This function is like `assignValue` except that it doesn't assign
  2299. * `undefined` values.
  2300. *
  2301. * @private
  2302. * @param {Object} object The object to modify.
  2303. * @param {string} key The key of the property to assign.
  2304. * @param {*} value The value to assign.
  2305. */
  2306. function assignMergeValue(object, key, value) {
  2307. if ((value !== undefined && !eq(object[key], value)) ||
  2308. (value === undefined && !(key in object))) {
  2309. baseAssignValue(object, key, value);
  2310. }
  2311. }
  2312. module.exports = assignMergeValue;
  2313. },{"./_baseAssignValue":18,"./eq":84}],16:[function(require,module,exports){
  2314. var baseAssignValue = require('./_baseAssignValue'),
  2315. eq = require('./eq');
  2316. /** Used for built-in method references. */
  2317. var objectProto = Object.prototype;
  2318. /** Used to check objects for own properties. */
  2319. var hasOwnProperty = objectProto.hasOwnProperty;
  2320. /**
  2321. * Assigns `value` to `key` of `object` if the existing value is not equivalent
  2322. * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  2323. * for equality comparisons.
  2324. *
  2325. * @private
  2326. * @param {Object} object The object to modify.
  2327. * @param {string} key The key of the property to assign.
  2328. * @param {*} value The value to assign.
  2329. */
  2330. function assignValue(object, key, value) {
  2331. var objValue = object[key];
  2332. if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
  2333. (value === undefined && !(key in object))) {
  2334. baseAssignValue(object, key, value);
  2335. }
  2336. }
  2337. module.exports = assignValue;
  2338. },{"./_baseAssignValue":18,"./eq":84}],17:[function(require,module,exports){
  2339. var eq = require('./eq');
  2340. /**
  2341. * Gets the index at which the `key` is found in `array` of key-value pairs.
  2342. *
  2343. * @private
  2344. * @param {Array} array The array to inspect.
  2345. * @param {*} key The key to search for.
  2346. * @returns {number} Returns the index of the matched value, else `-1`.
  2347. */
  2348. function assocIndexOf(array, key) {
  2349. var length = array.length;
  2350. while (length--) {
  2351. if (eq(array[length][0], key)) {
  2352. return length;
  2353. }
  2354. }
  2355. return -1;
  2356. }
  2357. module.exports = assocIndexOf;
  2358. },{"./eq":84}],18:[function(require,module,exports){
  2359. var defineProperty = require('./_defineProperty');
  2360. /**
  2361. * The base implementation of `assignValue` and `assignMergeValue` without
  2362. * value checks.
  2363. *
  2364. * @private
  2365. * @param {Object} object The object to modify.
  2366. * @param {string} key The key of the property to assign.
  2367. * @param {*} value The value to assign.
  2368. */
  2369. function baseAssignValue(object, key, value) {
  2370. if (key == '__proto__' && defineProperty) {
  2371. defineProperty(object, key, {
  2372. 'configurable': true,
  2373. 'enumerable': true,
  2374. 'value': value,
  2375. 'writable': true
  2376. });
  2377. } else {
  2378. object[key] = value;
  2379. }
  2380. }
  2381. module.exports = baseAssignValue;
  2382. },{"./_defineProperty":40}],19:[function(require,module,exports){
  2383. var isObject = require('./isObject');
  2384. /** Built-in value references. */
  2385. var objectCreate = Object.create;
  2386. /**
  2387. * The base implementation of `_.create` without support for assigning
  2388. * properties to the created object.
  2389. *
  2390. * @private
  2391. * @param {Object} proto The object to inherit from.
  2392. * @returns {Object} Returns the new object.
  2393. */
  2394. var baseCreate = (function() {
  2395. function object() {}
  2396. return function(proto) {
  2397. if (!isObject(proto)) {
  2398. return {};
  2399. }
  2400. if (objectCreate) {
  2401. return objectCreate(proto);
  2402. }
  2403. object.prototype = proto;
  2404. var result = new object;
  2405. object.prototype = undefined;
  2406. return result;
  2407. };
  2408. }());
  2409. module.exports = baseCreate;
  2410. },{"./isObject":93}],20:[function(require,module,exports){
  2411. var createBaseFor = require('./_createBaseFor');
  2412. /**
  2413. * The base implementation of `baseForOwn` which iterates over `object`
  2414. * properties returned by `keysFunc` and invokes `iteratee` for each property.
  2415. * Iteratee functions may exit iteration early by explicitly returning `false`.
  2416. *
  2417. * @private
  2418. * @param {Object} object The object to iterate over.
  2419. * @param {Function} iteratee The function invoked per iteration.
  2420. * @param {Function} keysFunc The function to get the keys of `object`.
  2421. * @returns {Object} Returns `object`.
  2422. */
  2423. var baseFor = createBaseFor();
  2424. module.exports = baseFor;
  2425. },{"./_createBaseFor":39}],21:[function(require,module,exports){
  2426. var Symbol = require('./_Symbol'),
  2427. getRawTag = require('./_getRawTag'),
  2428. objectToString = require('./_objectToString');
  2429. /** `Object#toString` result references. */
  2430. var nullTag = '[object Null]',
  2431. undefinedTag = '[object Undefined]';
  2432. /** Built-in value references. */
  2433. var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  2434. /**
  2435. * The base implementation of `getTag` without fallbacks for buggy environments.
  2436. *
  2437. * @private
  2438. * @param {*} value The value to query.
  2439. * @returns {string} Returns the `toStringTag`.
  2440. */
  2441. function baseGetTag(value) {
  2442. if (value == null) {
  2443. return value === undefined ? undefinedTag : nullTag;
  2444. }
  2445. return (symToStringTag && symToStringTag in Object(value))
  2446. ? getRawTag(value)
  2447. : objectToString(value);
  2448. }
  2449. module.exports = baseGetTag;
  2450. },{"./_Symbol":11,"./_getRawTag":45,"./_objectToString":71}],22:[function(require,module,exports){
  2451. var baseGetTag = require('./_baseGetTag'),
  2452. isObjectLike = require('./isObjectLike');
  2453. /** `Object#toString` result references. */
  2454. var argsTag = '[object Arguments]';
  2455. /**
  2456. * The base implementation of `_.isArguments`.
  2457. *
  2458. * @private
  2459. * @param {*} value The value to check.
  2460. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  2461. */
  2462. function baseIsArguments(value) {
  2463. return isObjectLike(value) && baseGetTag(value) == argsTag;
  2464. }
  2465. module.exports = baseIsArguments;
  2466. },{"./_baseGetTag":21,"./isObjectLike":94}],23:[function(require,module,exports){
  2467. var isFunction = require('./isFunction'),
  2468. isMasked = require('./_isMasked'),
  2469. isObject = require('./isObject'),
  2470. toSource = require('./_toSource');
  2471. /**
  2472. * Used to match `RegExp`
  2473. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  2474. */
  2475. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  2476. /** Used to detect host constructors (Safari). */
  2477. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  2478. /** Used for built-in method references. */
  2479. var funcProto = Function.prototype,
  2480. objectProto = Object.prototype;
  2481. /** Used to resolve the decompiled source of functions. */
  2482. var funcToString = funcProto.toString;
  2483. /** Used to check objects for own properties. */
  2484. var hasOwnProperty = objectProto.hasOwnProperty;
  2485. /** Used to detect if a method is native. */
  2486. var reIsNative = RegExp('^' +
  2487. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  2488. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  2489. );
  2490. /**
  2491. * The base implementation of `_.isNative` without bad shim checks.
  2492. *
  2493. * @private
  2494. * @param {*} value The value to check.
  2495. * @returns {boolean} Returns `true` if `value` is a native function,
  2496. * else `false`.
  2497. */
  2498. function baseIsNative(value) {
  2499. if (!isObject(value) || isMasked(value)) {
  2500. return false;
  2501. }
  2502. var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
  2503. return pattern.test(toSource(value));
  2504. }
  2505. module.exports = baseIsNative;
  2506. },{"./_isMasked":56,"./_toSource":82,"./isFunction":91,"./isObject":93}],24:[function(require,module,exports){
  2507. var baseGetTag = require('./_baseGetTag'),
  2508. isLength = require('./isLength'),
  2509. isObjectLike = require('./isObjectLike');
  2510. /** `Object#toString` result references. */
  2511. var argsTag = '[object Arguments]',
  2512. arrayTag = '[object Array]',
  2513. boolTag = '[object Boolean]',
  2514. dateTag = '[object Date]',
  2515. errorTag = '[object Error]',
  2516. funcTag = '[object Function]',
  2517. mapTag = '[object Map]',
  2518. numberTag = '[object Number]',
  2519. objectTag = '[object Object]',
  2520. regexpTag = '[object RegExp]',
  2521. setTag = '[object Set]',
  2522. stringTag = '[object String]',
  2523. weakMapTag = '[object WeakMap]';
  2524. var arrayBufferTag = '[object ArrayBuffer]',
  2525. dataViewTag = '[object DataView]',
  2526. float32Tag = '[object Float32Array]',
  2527. float64Tag = '[object Float64Array]',
  2528. int8Tag = '[object Int8Array]',
  2529. int16Tag = '[object Int16Array]',
  2530. int32Tag = '[object Int32Array]',
  2531. uint8Tag = '[object Uint8Array]',
  2532. uint8ClampedTag = '[object Uint8ClampedArray]',
  2533. uint16Tag = '[object Uint16Array]',
  2534. uint32Tag = '[object Uint32Array]';
  2535. /** Used to identify `toStringTag` values of typed arrays. */
  2536. var typedArrayTags = {};
  2537. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  2538. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  2539. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  2540. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  2541. typedArrayTags[uint32Tag] = true;
  2542. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  2543. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  2544. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  2545. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  2546. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  2547. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  2548. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  2549. typedArrayTags[weakMapTag] = false;
  2550. /**
  2551. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  2552. *
  2553. * @private
  2554. * @param {*} value The value to check.
  2555. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  2556. */
  2557. function baseIsTypedArray(value) {
  2558. return isObjectLike(value) &&
  2559. isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  2560. }
  2561. module.exports = baseIsTypedArray;
  2562. },{"./_baseGetTag":21,"./isLength":92,"./isObjectLike":94}],25:[function(require,module,exports){
  2563. var isObject = require('./isObject'),
  2564. isPrototype = require('./_isPrototype'),
  2565. nativeKeysIn = require('./_nativeKeysIn');
  2566. /** Used for built-in method references. */
  2567. var objectProto = Object.prototype;
  2568. /** Used to check objects for own properties. */
  2569. var hasOwnProperty = objectProto.hasOwnProperty;
  2570. /**
  2571. * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
  2572. *
  2573. * @private
  2574. * @param {Object} object The object to query.
  2575. * @returns {Array} Returns the array of property names.
  2576. */
  2577. function baseKeysIn(object) {
  2578. if (!isObject(object)) {
  2579. return nativeKeysIn(object);
  2580. }
  2581. var isProto = isPrototype(object),
  2582. result = [];
  2583. for (var key in object) {
  2584. if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {
  2585. result.push(key);
  2586. }
  2587. }
  2588. return result;
  2589. }
  2590. module.exports = baseKeysIn;
  2591. },{"./_isPrototype":57,"./_nativeKeysIn":69,"./isObject":93}],26:[function(require,module,exports){
  2592. var Stack = require('./_Stack'),
  2593. assignMergeValue = require('./_assignMergeValue'),
  2594. baseFor = require('./_baseFor'),
  2595. baseMergeDeep = require('./_baseMergeDeep'),
  2596. isObject = require('./isObject'),
  2597. keysIn = require('./keysIn');
  2598. /**
  2599. * The base implementation of `_.merge` without support for multiple sources.
  2600. *
  2601. * @private
  2602. * @param {Object} object The destination object.
  2603. * @param {Object} source The source object.
  2604. * @param {number} srcIndex The index of `source`.
  2605. * @param {Function} [customizer] The function to customize merged values.
  2606. * @param {Object} [stack] Tracks traversed source values and their merged
  2607. * counterparts.
  2608. */
  2609. function baseMerge(object, source, srcIndex, customizer, stack) {
  2610. if (object === source) {
  2611. return;
  2612. }
  2613. baseFor(source, function(srcValue, key) {
  2614. if (isObject(srcValue)) {
  2615. stack || (stack = new Stack);
  2616. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  2617. }
  2618. else {
  2619. var newValue = customizer
  2620. ? customizer(object[key], srcValue, (key + ''), object, source, stack)
  2621. : undefined;
  2622. if (newValue === undefined) {
  2623. newValue = srcValue;
  2624. }
  2625. assignMergeValue(object, key, newValue);
  2626. }
  2627. }, keysIn);
  2628. }
  2629. module.exports = baseMerge;
  2630. },{"./_Stack":10,"./_assignMergeValue":15,"./_baseFor":20,"./_baseMergeDeep":27,"./isObject":93,"./keysIn":97}],27:[function(require,module,exports){
  2631. var assignMergeValue = require('./_assignMergeValue'),
  2632. cloneBuffer = require('./_cloneBuffer'),
  2633. cloneTypedArray = require('./_cloneTypedArray'),
  2634. copyArray = require('./_copyArray'),
  2635. initCloneObject = require('./_initCloneObject'),
  2636. isArguments = require('./isArguments'),
  2637. isArray = require('./isArray'),
  2638. isArrayLikeObject = require('./isArrayLikeObject'),
  2639. isBuffer = require('./isBuffer'),
  2640. isFunction = require('./isFunction'),
  2641. isObject = require('./isObject'),
  2642. isPlainObject = require('./isPlainObject'),
  2643. isTypedArray = require('./isTypedArray'),
  2644. toPlainObject = require('./toPlainObject');
  2645. /**
  2646. * A specialized version of `baseMerge` for arrays and objects which performs
  2647. * deep merges and tracks traversed objects enabling objects with circular
  2648. * references to be merged.
  2649. *
  2650. * @private
  2651. * @param {Object} object The destination object.
  2652. * @param {Object} source The source object.
  2653. * @param {string} key The key of the value to merge.
  2654. * @param {number} srcIndex The index of `source`.
  2655. * @param {Function} mergeFunc The function to merge values.
  2656. * @param {Function} [customizer] The function to customize assigned values.
  2657. * @param {Object} [stack] Tracks traversed source values and their merged
  2658. * counterparts.
  2659. */
  2660. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  2661. var objValue = object[key],
  2662. srcValue = source[key],
  2663. stacked = stack.get(srcValue);
  2664. if (stacked) {
  2665. assignMergeValue(object, key, stacked);
  2666. return;
  2667. }
  2668. var newValue = customizer
  2669. ? customizer(objValue, srcValue, (key + ''), object, source, stack)
  2670. : undefined;
  2671. var isCommon = newValue === undefined;
  2672. if (isCommon) {
  2673. var isArr = isArray(srcValue),
  2674. isBuff = !isArr && isBuffer(srcValue),
  2675. isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  2676. newValue = srcValue;
  2677. if (isArr || isBuff || isTyped) {
  2678. if (isArray(objValue)) {
  2679. newValue = objValue;
  2680. }
  2681. else if (isArrayLikeObject(objValue)) {
  2682. newValue = copyArray(objValue);
  2683. }
  2684. else if (isBuff) {
  2685. isCommon = false;
  2686. newValue = cloneBuffer(srcValue, true);
  2687. }
  2688. else if (isTyped) {
  2689. isCommon = false;
  2690. newValue = cloneTypedArray(srcValue, true);
  2691. }
  2692. else {
  2693. newValue = [];
  2694. }
  2695. }
  2696. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  2697. newValue = objValue;
  2698. if (isArguments(objValue)) {
  2699. newValue = toPlainObject(objValue);
  2700. }
  2701. else if (!isObject(objValue) || (srcIndex && isFunction(objValue))) {
  2702. newValue = initCloneObject(srcValue);
  2703. }
  2704. }
  2705. else {
  2706. isCommon = false;
  2707. }
  2708. }
  2709. if (isCommon) {
  2710. // Recursively merge objects and arrays (susceptible to call stack limits).
  2711. stack.set(srcValue, newValue);
  2712. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  2713. stack['delete'](srcValue);
  2714. }
  2715. assignMergeValue(object, key, newValue);
  2716. }
  2717. module.exports = baseMergeDeep;
  2718. },{"./_assignMergeValue":15,"./_cloneBuffer":33,"./_cloneTypedArray":34,"./_copyArray":35,"./_initCloneObject":52,"./isArguments":86,"./isArray":87,"./isArrayLikeObject":89,"./isBuffer":90,"./isFunction":91,"./isObject":93,"./isPlainObject":95,"./isTypedArray":96,"./toPlainObject":100}],28:[function(require,module,exports){
  2719. var identity = require('./identity'),
  2720. overRest = require('./_overRest'),
  2721. setToString = require('./_setToString');
  2722. /**
  2723. * The base implementation of `_.rest` which doesn't validate or coerce arguments.
  2724. *
  2725. * @private
  2726. * @param {Function} func The function to apply a rest parameter to.
  2727. * @param {number} [start=func.length-1] The start position of the rest parameter.
  2728. * @returns {Function} Returns the new function.
  2729. */
  2730. function baseRest(func, start) {
  2731. return setToString(overRest(func, start, identity), func + '');
  2732. }
  2733. module.exports = baseRest;
  2734. },{"./_overRest":73,"./_setToString":75,"./identity":85}],29:[function(require,module,exports){
  2735. var constant = require('./constant'),
  2736. defineProperty = require('./_defineProperty'),
  2737. identity = require('./identity');
  2738. /**
  2739. * The base implementation of `setToString` without support for hot loop shorting.
  2740. *
  2741. * @private
  2742. * @param {Function} func The function to modify.
  2743. * @param {Function} string The `toString` result.
  2744. * @returns {Function} Returns `func`.
  2745. */
  2746. var baseSetToString = !defineProperty ? identity : function(func, string) {
  2747. return defineProperty(func, 'toString', {
  2748. 'configurable': true,
  2749. 'enumerable': false,
  2750. 'value': constant(string),
  2751. 'writable': true
  2752. });
  2753. };
  2754. module.exports = baseSetToString;
  2755. },{"./_defineProperty":40,"./constant":83,"./identity":85}],30:[function(require,module,exports){
  2756. /**
  2757. * The base implementation of `_.times` without support for iteratee shorthands
  2758. * or max array length checks.
  2759. *
  2760. * @private
  2761. * @param {number} n The number of times to invoke `iteratee`.
  2762. * @param {Function} iteratee The function invoked per iteration.
  2763. * @returns {Array} Returns the array of results.
  2764. */
  2765. function baseTimes(n, iteratee) {
  2766. var index = -1,
  2767. result = Array(n);
  2768. while (++index < n) {
  2769. result[index] = iteratee(index);
  2770. }
  2771. return result;
  2772. }
  2773. module.exports = baseTimes;
  2774. },{}],31:[function(require,module,exports){
  2775. /**
  2776. * The base implementation of `_.unary` without support for storing metadata.
  2777. *
  2778. * @private
  2779. * @param {Function} func The function to cap arguments for.
  2780. * @returns {Function} Returns the new capped function.
  2781. */
  2782. function baseUnary(func) {
  2783. return function(value) {
  2784. return func(value);
  2785. };
  2786. }
  2787. module.exports = baseUnary;
  2788. },{}],32:[function(require,module,exports){
  2789. var Uint8Array = require('./_Uint8Array');
  2790. /**
  2791. * Creates a clone of `arrayBuffer`.
  2792. *
  2793. * @private
  2794. * @param {ArrayBuffer} arrayBuffer The array buffer to clone.
  2795. * @returns {ArrayBuffer} Returns the cloned array buffer.
  2796. */
  2797. function cloneArrayBuffer(arrayBuffer) {
  2798. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  2799. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  2800. return result;
  2801. }
  2802. module.exports = cloneArrayBuffer;
  2803. },{"./_Uint8Array":12}],33:[function(require,module,exports){
  2804. var root = require('./_root');
  2805. /** Detect free variable `exports`. */
  2806. var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
  2807. /** Detect free variable `module`. */
  2808. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  2809. /** Detect the popular CommonJS extension `module.exports`. */
  2810. var moduleExports = freeModule && freeModule.exports === freeExports;
  2811. /** Built-in value references. */
  2812. var Buffer = moduleExports ? root.Buffer : undefined,
  2813. allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
  2814. /**
  2815. * Creates a clone of `buffer`.
  2816. *
  2817. * @private
  2818. * @param {Buffer} buffer The buffer to clone.
  2819. * @param {boolean} [isDeep] Specify a deep clone.
  2820. * @returns {Buffer} Returns the cloned buffer.
  2821. */
  2822. function cloneBuffer(buffer, isDeep) {
  2823. if (isDeep) {
  2824. return buffer.slice();
  2825. }
  2826. var length = buffer.length,
  2827. result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  2828. buffer.copy(result);
  2829. return result;
  2830. }
  2831. module.exports = cloneBuffer;
  2832. },{"./_root":74}],34:[function(require,module,exports){
  2833. var cloneArrayBuffer = require('./_cloneArrayBuffer');
  2834. /**
  2835. * Creates a clone of `typedArray`.
  2836. *
  2837. * @private
  2838. * @param {Object} typedArray The typed array to clone.
  2839. * @param {boolean} [isDeep] Specify a deep clone.
  2840. * @returns {Object} Returns the cloned typed array.
  2841. */
  2842. function cloneTypedArray(typedArray, isDeep) {
  2843. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  2844. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  2845. }
  2846. module.exports = cloneTypedArray;
  2847. },{"./_cloneArrayBuffer":32}],35:[function(require,module,exports){
  2848. /**
  2849. * Copies the values of `source` to `array`.
  2850. *
  2851. * @private
  2852. * @param {Array} source The array to copy values from.
  2853. * @param {Array} [array=[]] The array to copy values to.
  2854. * @returns {Array} Returns `array`.
  2855. */
  2856. function copyArray(source, array) {
  2857. var index = -1,
  2858. length = source.length;
  2859. array || (array = Array(length));
  2860. while (++index < length) {
  2861. array[index] = source[index];
  2862. }
  2863. return array;
  2864. }
  2865. module.exports = copyArray;
  2866. },{}],36:[function(require,module,exports){
  2867. var assignValue = require('./_assignValue'),
  2868. baseAssignValue = require('./_baseAssignValue');
  2869. /**
  2870. * Copies properties of `source` to `object`.
  2871. *
  2872. * @private
  2873. * @param {Object} source The object to copy properties from.
  2874. * @param {Array} props The property identifiers to copy.
  2875. * @param {Object} [object={}] The object to copy properties to.
  2876. * @param {Function} [customizer] The function to customize copied values.
  2877. * @returns {Object} Returns `object`.
  2878. */
  2879. function copyObject(source, props, object, customizer) {
  2880. var isNew = !object;
  2881. object || (object = {});
  2882. var index = -1,
  2883. length = props.length;
  2884. while (++index < length) {
  2885. var key = props[index];
  2886. var newValue = customizer
  2887. ? customizer(object[key], source[key], key, object, source)
  2888. : undefined;
  2889. if (newValue === undefined) {
  2890. newValue = source[key];
  2891. }
  2892. if (isNew) {
  2893. baseAssignValue(object, key, newValue);
  2894. } else {
  2895. assignValue(object, key, newValue);
  2896. }
  2897. }
  2898. return object;
  2899. }
  2900. module.exports = copyObject;
  2901. },{"./_assignValue":16,"./_baseAssignValue":18}],37:[function(require,module,exports){
  2902. var root = require('./_root');
  2903. /** Used to detect overreaching core-js shims. */
  2904. var coreJsData = root['__core-js_shared__'];
  2905. module.exports = coreJsData;
  2906. },{"./_root":74}],38:[function(require,module,exports){
  2907. var baseRest = require('./_baseRest'),
  2908. isIterateeCall = require('./_isIterateeCall');
  2909. /**
  2910. * Creates a function like `_.assign`.
  2911. *
  2912. * @private
  2913. * @param {Function} assigner The function to assign values.
  2914. * @returns {Function} Returns the new assigner function.
  2915. */
  2916. function createAssigner(assigner) {
  2917. return baseRest(function(object, sources) {
  2918. var index = -1,
  2919. length = sources.length,
  2920. customizer = length > 1 ? sources[length - 1] : undefined,
  2921. guard = length > 2 ? sources[2] : undefined;
  2922. customizer = (assigner.length > 3 && typeof customizer == 'function')
  2923. ? (length--, customizer)
  2924. : undefined;
  2925. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  2926. customizer = length < 3 ? undefined : customizer;
  2927. length = 1;
  2928. }
  2929. object = Object(object);
  2930. while (++index < length) {
  2931. var source = sources[index];
  2932. if (source) {
  2933. assigner(object, source, index, customizer);
  2934. }
  2935. }
  2936. return object;
  2937. });
  2938. }
  2939. module.exports = createAssigner;
  2940. },{"./_baseRest":28,"./_isIterateeCall":54}],39:[function(require,module,exports){
  2941. /**
  2942. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  2943. *
  2944. * @private
  2945. * @param {boolean} [fromRight] Specify iterating from right to left.
  2946. * @returns {Function} Returns the new base function.
  2947. */
  2948. function createBaseFor(fromRight) {
  2949. return function(object, iteratee, keysFunc) {
  2950. var index = -1,
  2951. iterable = Object(object),
  2952. props = keysFunc(object),
  2953. length = props.length;
  2954. while (length--) {
  2955. var key = props[fromRight ? length : ++index];
  2956. if (iteratee(iterable[key], key, iterable) === false) {
  2957. break;
  2958. }
  2959. }
  2960. return object;
  2961. };
  2962. }
  2963. module.exports = createBaseFor;
  2964. },{}],40:[function(require,module,exports){
  2965. var getNative = require('./_getNative');
  2966. var defineProperty = (function() {
  2967. try {
  2968. var func = getNative(Object, 'defineProperty');
  2969. func({}, '', {});
  2970. return func;
  2971. } catch (e) {}
  2972. }());
  2973. module.exports = defineProperty;
  2974. },{"./_getNative":43}],41:[function(require,module,exports){
  2975. (function (global){
  2976. /** Detect free variable `global` from Node.js. */
  2977. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  2978. module.exports = freeGlobal;
  2979. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  2980. },{}],42:[function(require,module,exports){
  2981. var isKeyable = require('./_isKeyable');
  2982. /**
  2983. * Gets the data for `map`.
  2984. *
  2985. * @private
  2986. * @param {Object} map The map to query.
  2987. * @param {string} key The reference key.
  2988. * @returns {*} Returns the map data.
  2989. */
  2990. function getMapData(map, key) {
  2991. var data = map.__data__;
  2992. return isKeyable(key)
  2993. ? data[typeof key == 'string' ? 'string' : 'hash']
  2994. : data.map;
  2995. }
  2996. module.exports = getMapData;
  2997. },{"./_isKeyable":55}],43:[function(require,module,exports){
  2998. var baseIsNative = require('./_baseIsNative'),
  2999. getValue = require('./_getValue');
  3000. /**
  3001. * Gets the native function at `key` of `object`.
  3002. *
  3003. * @private
  3004. * @param {Object} object The object to query.
  3005. * @param {string} key The key of the method to get.
  3006. * @returns {*} Returns the function if it's native, else `undefined`.
  3007. */
  3008. function getNative(object, key) {
  3009. var value = getValue(object, key);
  3010. return baseIsNative(value) ? value : undefined;
  3011. }
  3012. module.exports = getNative;
  3013. },{"./_baseIsNative":23,"./_getValue":46}],44:[function(require,module,exports){
  3014. var overArg = require('./_overArg');
  3015. /** Built-in value references. */
  3016. var getPrototype = overArg(Object.getPrototypeOf, Object);
  3017. module.exports = getPrototype;
  3018. },{"./_overArg":72}],45:[function(require,module,exports){
  3019. var Symbol = require('./_Symbol');
  3020. /** Used for built-in method references. */
  3021. var objectProto = Object.prototype;
  3022. /** Used to check objects for own properties. */
  3023. var hasOwnProperty = objectProto.hasOwnProperty;
  3024. /**
  3025. * Used to resolve the
  3026. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  3027. * of values.
  3028. */
  3029. var nativeObjectToString = objectProto.toString;
  3030. /** Built-in value references. */
  3031. var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
  3032. /**
  3033. * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
  3034. *
  3035. * @private
  3036. * @param {*} value The value to query.
  3037. * @returns {string} Returns the raw `toStringTag`.
  3038. */
  3039. function getRawTag(value) {
  3040. var isOwn = hasOwnProperty.call(value, symToStringTag),
  3041. tag = value[symToStringTag];
  3042. try {
  3043. value[symToStringTag] = undefined;
  3044. var unmasked = true;
  3045. } catch (e) {}
  3046. var result = nativeObjectToString.call(value);
  3047. if (unmasked) {
  3048. if (isOwn) {
  3049. value[symToStringTag] = tag;
  3050. } else {
  3051. delete value[symToStringTag];
  3052. }
  3053. }
  3054. return result;
  3055. }
  3056. module.exports = getRawTag;
  3057. },{"./_Symbol":11}],46:[function(require,module,exports){
  3058. /**
  3059. * Gets the value at `key` of `object`.
  3060. *
  3061. * @private
  3062. * @param {Object} [object] The object to query.
  3063. * @param {string} key The key of the property to get.
  3064. * @returns {*} Returns the property value.
  3065. */
  3066. function getValue(object, key) {
  3067. return object == null ? undefined : object[key];
  3068. }
  3069. module.exports = getValue;
  3070. },{}],47:[function(require,module,exports){
  3071. var nativeCreate = require('./_nativeCreate');
  3072. /**
  3073. * Removes all key-value entries from the hash.
  3074. *
  3075. * @private
  3076. * @name clear
  3077. * @memberOf Hash
  3078. */
  3079. function hashClear() {
  3080. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  3081. this.size = 0;
  3082. }
  3083. module.exports = hashClear;
  3084. },{"./_nativeCreate":68}],48:[function(require,module,exports){
  3085. /**
  3086. * Removes `key` and its value from the hash.
  3087. *
  3088. * @private
  3089. * @name delete
  3090. * @memberOf Hash
  3091. * @param {Object} hash The hash to modify.
  3092. * @param {string} key The key of the value to remove.
  3093. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3094. */
  3095. function hashDelete(key) {
  3096. var result = this.has(key) && delete this.__data__[key];
  3097. this.size -= result ? 1 : 0;
  3098. return result;
  3099. }
  3100. module.exports = hashDelete;
  3101. },{}],49:[function(require,module,exports){
  3102. var nativeCreate = require('./_nativeCreate');
  3103. /** Used to stand-in for `undefined` hash values. */
  3104. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  3105. /** Used for built-in method references. */
  3106. var objectProto = Object.prototype;
  3107. /** Used to check objects for own properties. */
  3108. var hasOwnProperty = objectProto.hasOwnProperty;
  3109. /**
  3110. * Gets the hash value for `key`.
  3111. *
  3112. * @private
  3113. * @name get
  3114. * @memberOf Hash
  3115. * @param {string} key The key of the value to get.
  3116. * @returns {*} Returns the entry value.
  3117. */
  3118. function hashGet(key) {
  3119. var data = this.__data__;
  3120. if (nativeCreate) {
  3121. var result = data[key];
  3122. return result === HASH_UNDEFINED ? undefined : result;
  3123. }
  3124. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  3125. }
  3126. module.exports = hashGet;
  3127. },{"./_nativeCreate":68}],50:[function(require,module,exports){
  3128. var nativeCreate = require('./_nativeCreate');
  3129. /** Used for built-in method references. */
  3130. var objectProto = Object.prototype;
  3131. /** Used to check objects for own properties. */
  3132. var hasOwnProperty = objectProto.hasOwnProperty;
  3133. /**
  3134. * Checks if a hash value for `key` exists.
  3135. *
  3136. * @private
  3137. * @name has
  3138. * @memberOf Hash
  3139. * @param {string} key The key of the entry to check.
  3140. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3141. */
  3142. function hashHas(key) {
  3143. var data = this.__data__;
  3144. return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);
  3145. }
  3146. module.exports = hashHas;
  3147. },{"./_nativeCreate":68}],51:[function(require,module,exports){
  3148. var nativeCreate = require('./_nativeCreate');
  3149. /** Used to stand-in for `undefined` hash values. */
  3150. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  3151. /**
  3152. * Sets the hash `key` to `value`.
  3153. *
  3154. * @private
  3155. * @name set
  3156. * @memberOf Hash
  3157. * @param {string} key The key of the value to set.
  3158. * @param {*} value The value to set.
  3159. * @returns {Object} Returns the hash instance.
  3160. */
  3161. function hashSet(key, value) {
  3162. var data = this.__data__;
  3163. this.size += this.has(key) ? 0 : 1;
  3164. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  3165. return this;
  3166. }
  3167. module.exports = hashSet;
  3168. },{"./_nativeCreate":68}],52:[function(require,module,exports){
  3169. var baseCreate = require('./_baseCreate'),
  3170. getPrototype = require('./_getPrototype'),
  3171. isPrototype = require('./_isPrototype');
  3172. /**
  3173. * Initializes an object clone.
  3174. *
  3175. * @private
  3176. * @param {Object} object The object to clone.
  3177. * @returns {Object} Returns the initialized clone.
  3178. */
  3179. function initCloneObject(object) {
  3180. return (typeof object.constructor == 'function' && !isPrototype(object))
  3181. ? baseCreate(getPrototype(object))
  3182. : {};
  3183. }
  3184. module.exports = initCloneObject;
  3185. },{"./_baseCreate":19,"./_getPrototype":44,"./_isPrototype":57}],53:[function(require,module,exports){
  3186. /** Used as references for various `Number` constants. */
  3187. var MAX_SAFE_INTEGER = 9007199254740991;
  3188. /** Used to detect unsigned integer values. */
  3189. var reIsUint = /^(?:0|[1-9]\d*)$/;
  3190. /**
  3191. * Checks if `value` is a valid array-like index.
  3192. *
  3193. * @private
  3194. * @param {*} value The value to check.
  3195. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  3196. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  3197. */
  3198. function isIndex(value, length) {
  3199. length = length == null ? MAX_SAFE_INTEGER : length;
  3200. return !!length &&
  3201. (typeof value == 'number' || reIsUint.test(value)) &&
  3202. (value > -1 && value % 1 == 0 && value < length);
  3203. }
  3204. module.exports = isIndex;
  3205. },{}],54:[function(require,module,exports){
  3206. var eq = require('./eq'),
  3207. isArrayLike = require('./isArrayLike'),
  3208. isIndex = require('./_isIndex'),
  3209. isObject = require('./isObject');
  3210. /**
  3211. * Checks if the given arguments are from an iteratee call.
  3212. *
  3213. * @private
  3214. * @param {*} value The potential iteratee value argument.
  3215. * @param {*} index The potential iteratee index or key argument.
  3216. * @param {*} object The potential iteratee object argument.
  3217. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  3218. * else `false`.
  3219. */
  3220. function isIterateeCall(value, index, object) {
  3221. if (!isObject(object)) {
  3222. return false;
  3223. }
  3224. var type = typeof index;
  3225. if (type == 'number'
  3226. ? (isArrayLike(object) && isIndex(index, object.length))
  3227. : (type == 'string' && index in object)
  3228. ) {
  3229. return eq(object[index], value);
  3230. }
  3231. return false;
  3232. }
  3233. module.exports = isIterateeCall;
  3234. },{"./_isIndex":53,"./eq":84,"./isArrayLike":88,"./isObject":93}],55:[function(require,module,exports){
  3235. /**
  3236. * Checks if `value` is suitable for use as unique object key.
  3237. *
  3238. * @private
  3239. * @param {*} value The value to check.
  3240. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  3241. */
  3242. function isKeyable(value) {
  3243. var type = typeof value;
  3244. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  3245. ? (value !== '__proto__')
  3246. : (value === null);
  3247. }
  3248. module.exports = isKeyable;
  3249. },{}],56:[function(require,module,exports){
  3250. var coreJsData = require('./_coreJsData');
  3251. /** Used to detect methods masquerading as native. */
  3252. var maskSrcKey = (function() {
  3253. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  3254. return uid ? ('Symbol(src)_1.' + uid) : '';
  3255. }());
  3256. /**
  3257. * Checks if `func` has its source masked.
  3258. *
  3259. * @private
  3260. * @param {Function} func The function to check.
  3261. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  3262. */
  3263. function isMasked(func) {
  3264. return !!maskSrcKey && (maskSrcKey in func);
  3265. }
  3266. module.exports = isMasked;
  3267. },{"./_coreJsData":37}],57:[function(require,module,exports){
  3268. /** Used for built-in method references. */
  3269. var objectProto = Object.prototype;
  3270. /**
  3271. * Checks if `value` is likely a prototype object.
  3272. *
  3273. * @private
  3274. * @param {*} value The value to check.
  3275. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  3276. */
  3277. function isPrototype(value) {
  3278. var Ctor = value && value.constructor,
  3279. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  3280. return value === proto;
  3281. }
  3282. module.exports = isPrototype;
  3283. },{}],58:[function(require,module,exports){
  3284. /**
  3285. * Removes all key-value entries from the list cache.
  3286. *
  3287. * @private
  3288. * @name clear
  3289. * @memberOf ListCache
  3290. */
  3291. function listCacheClear() {
  3292. this.__data__ = [];
  3293. this.size = 0;
  3294. }
  3295. module.exports = listCacheClear;
  3296. },{}],59:[function(require,module,exports){
  3297. var assocIndexOf = require('./_assocIndexOf');
  3298. /** Used for built-in method references. */
  3299. var arrayProto = Array.prototype;
  3300. /** Built-in value references. */
  3301. var splice = arrayProto.splice;
  3302. /**
  3303. * Removes `key` and its value from the list cache.
  3304. *
  3305. * @private
  3306. * @name delete
  3307. * @memberOf ListCache
  3308. * @param {string} key The key of the value to remove.
  3309. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3310. */
  3311. function listCacheDelete(key) {
  3312. var data = this.__data__,
  3313. index = assocIndexOf(data, key);
  3314. if (index < 0) {
  3315. return false;
  3316. }
  3317. var lastIndex = data.length - 1;
  3318. if (index == lastIndex) {
  3319. data.pop();
  3320. } else {
  3321. splice.call(data, index, 1);
  3322. }
  3323. --this.size;
  3324. return true;
  3325. }
  3326. module.exports = listCacheDelete;
  3327. },{"./_assocIndexOf":17}],60:[function(require,module,exports){
  3328. var assocIndexOf = require('./_assocIndexOf');
  3329. /**
  3330. * Gets the list cache value for `key`.
  3331. *
  3332. * @private
  3333. * @name get
  3334. * @memberOf ListCache
  3335. * @param {string} key The key of the value to get.
  3336. * @returns {*} Returns the entry value.
  3337. */
  3338. function listCacheGet(key) {
  3339. var data = this.__data__,
  3340. index = assocIndexOf(data, key);
  3341. return index < 0 ? undefined : data[index][1];
  3342. }
  3343. module.exports = listCacheGet;
  3344. },{"./_assocIndexOf":17}],61:[function(require,module,exports){
  3345. var assocIndexOf = require('./_assocIndexOf');
  3346. /**
  3347. * Checks if a list cache value for `key` exists.
  3348. *
  3349. * @private
  3350. * @name has
  3351. * @memberOf ListCache
  3352. * @param {string} key The key of the entry to check.
  3353. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3354. */
  3355. function listCacheHas(key) {
  3356. return assocIndexOf(this.__data__, key) > -1;
  3357. }
  3358. module.exports = listCacheHas;
  3359. },{"./_assocIndexOf":17}],62:[function(require,module,exports){
  3360. var assocIndexOf = require('./_assocIndexOf');
  3361. /**
  3362. * Sets the list cache `key` to `value`.
  3363. *
  3364. * @private
  3365. * @name set
  3366. * @memberOf ListCache
  3367. * @param {string} key The key of the value to set.
  3368. * @param {*} value The value to set.
  3369. * @returns {Object} Returns the list cache instance.
  3370. */
  3371. function listCacheSet(key, value) {
  3372. var data = this.__data__,
  3373. index = assocIndexOf(data, key);
  3374. if (index < 0) {
  3375. ++this.size;
  3376. data.push([key, value]);
  3377. } else {
  3378. data[index][1] = value;
  3379. }
  3380. return this;
  3381. }
  3382. module.exports = listCacheSet;
  3383. },{"./_assocIndexOf":17}],63:[function(require,module,exports){
  3384. var Hash = require('./_Hash'),
  3385. ListCache = require('./_ListCache'),
  3386. Map = require('./_Map');
  3387. /**
  3388. * Removes all key-value entries from the map.
  3389. *
  3390. * @private
  3391. * @name clear
  3392. * @memberOf MapCache
  3393. */
  3394. function mapCacheClear() {
  3395. this.size = 0;
  3396. this.__data__ = {
  3397. 'hash': new Hash,
  3398. 'map': new (Map || ListCache),
  3399. 'string': new Hash
  3400. };
  3401. }
  3402. module.exports = mapCacheClear;
  3403. },{"./_Hash":6,"./_ListCache":7,"./_Map":8}],64:[function(require,module,exports){
  3404. var getMapData = require('./_getMapData');
  3405. /**
  3406. * Removes `key` and its value from the map.
  3407. *
  3408. * @private
  3409. * @name delete
  3410. * @memberOf MapCache
  3411. * @param {string} key The key of the value to remove.
  3412. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3413. */
  3414. function mapCacheDelete(key) {
  3415. var result = getMapData(this, key)['delete'](key);
  3416. this.size -= result ? 1 : 0;
  3417. return result;
  3418. }
  3419. module.exports = mapCacheDelete;
  3420. },{"./_getMapData":42}],65:[function(require,module,exports){
  3421. var getMapData = require('./_getMapData');
  3422. /**
  3423. * Gets the map value for `key`.
  3424. *
  3425. * @private
  3426. * @name get
  3427. * @memberOf MapCache
  3428. * @param {string} key The key of the value to get.
  3429. * @returns {*} Returns the entry value.
  3430. */
  3431. function mapCacheGet(key) {
  3432. return getMapData(this, key).get(key);
  3433. }
  3434. module.exports = mapCacheGet;
  3435. },{"./_getMapData":42}],66:[function(require,module,exports){
  3436. var getMapData = require('./_getMapData');
  3437. /**
  3438. * Checks if a map value for `key` exists.
  3439. *
  3440. * @private
  3441. * @name has
  3442. * @memberOf MapCache
  3443. * @param {string} key The key of the entry to check.
  3444. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3445. */
  3446. function mapCacheHas(key) {
  3447. return getMapData(this, key).has(key);
  3448. }
  3449. module.exports = mapCacheHas;
  3450. },{"./_getMapData":42}],67:[function(require,module,exports){
  3451. var getMapData = require('./_getMapData');
  3452. /**
  3453. * Sets the map `key` to `value`.
  3454. *
  3455. * @private
  3456. * @name set
  3457. * @memberOf MapCache
  3458. * @param {string} key The key of the value to set.
  3459. * @param {*} value The value to set.
  3460. * @returns {Object} Returns the map cache instance.
  3461. */
  3462. function mapCacheSet(key, value) {
  3463. var data = getMapData(this, key),
  3464. size = data.size;
  3465. data.set(key, value);
  3466. this.size += data.size == size ? 0 : 1;
  3467. return this;
  3468. }
  3469. module.exports = mapCacheSet;
  3470. },{"./_getMapData":42}],68:[function(require,module,exports){
  3471. var getNative = require('./_getNative');
  3472. /* Built-in method references that are verified to be native. */
  3473. var nativeCreate = getNative(Object, 'create');
  3474. module.exports = nativeCreate;
  3475. },{"./_getNative":43}],69:[function(require,module,exports){
  3476. /**
  3477. * This function is like
  3478. * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  3479. * except that it includes inherited enumerable properties.
  3480. *
  3481. * @private
  3482. * @param {Object} object The object to query.
  3483. * @returns {Array} Returns the array of property names.
  3484. */
  3485. function nativeKeysIn(object) {
  3486. var result = [];
  3487. if (object != null) {
  3488. for (var key in Object(object)) {
  3489. result.push(key);
  3490. }
  3491. }
  3492. return result;
  3493. }
  3494. module.exports = nativeKeysIn;
  3495. },{}],70:[function(require,module,exports){
  3496. var freeGlobal = require('./_freeGlobal');
  3497. /** Detect free variable `exports`. */
  3498. var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
  3499. /** Detect free variable `module`. */
  3500. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  3501. /** Detect the popular CommonJS extension `module.exports`. */
  3502. var moduleExports = freeModule && freeModule.exports === freeExports;
  3503. /** Detect free variable `process` from Node.js. */
  3504. var freeProcess = moduleExports && freeGlobal.process;
  3505. /** Used to access faster Node.js helpers. */
  3506. var nodeUtil = (function() {
  3507. try {
  3508. return freeProcess && freeProcess.binding && freeProcess.binding('util');
  3509. } catch (e) {}
  3510. }());
  3511. module.exports = nodeUtil;
  3512. },{"./_freeGlobal":41}],71:[function(require,module,exports){
  3513. /** Used for built-in method references. */
  3514. var objectProto = Object.prototype;
  3515. /**
  3516. * Used to resolve the
  3517. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  3518. * of values.
  3519. */
  3520. var nativeObjectToString = objectProto.toString;
  3521. /**
  3522. * Converts `value` to a string using `Object.prototype.toString`.
  3523. *
  3524. * @private
  3525. * @param {*} value The value to convert.
  3526. * @returns {string} Returns the converted string.
  3527. */
  3528. function objectToString(value) {
  3529. return nativeObjectToString.call(value);
  3530. }
  3531. module.exports = objectToString;
  3532. },{}],72:[function(require,module,exports){
  3533. /**
  3534. * Creates a unary function that invokes `func` with its argument transformed.
  3535. *
  3536. * @private
  3537. * @param {Function} func The function to wrap.
  3538. * @param {Function} transform The argument transform.
  3539. * @returns {Function} Returns the new function.
  3540. */
  3541. function overArg(func, transform) {
  3542. return function(arg) {
  3543. return func(transform(arg));
  3544. };
  3545. }
  3546. module.exports = overArg;
  3547. },{}],73:[function(require,module,exports){
  3548. var apply = require('./_apply');
  3549. /* Built-in method references for those with the same name as other `lodash` methods. */
  3550. var nativeMax = Math.max;
  3551. /**
  3552. * A specialized version of `baseRest` which transforms the rest array.
  3553. *
  3554. * @private
  3555. * @param {Function} func The function to apply a rest parameter to.
  3556. * @param {number} [start=func.length-1] The start position of the rest parameter.
  3557. * @param {Function} transform The rest array transform.
  3558. * @returns {Function} Returns the new function.
  3559. */
  3560. function overRest(func, start, transform) {
  3561. start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
  3562. return function() {
  3563. var args = arguments,
  3564. index = -1,
  3565. length = nativeMax(args.length - start, 0),
  3566. array = Array(length);
  3567. while (++index < length) {
  3568. array[index] = args[start + index];
  3569. }
  3570. index = -1;
  3571. var otherArgs = Array(start + 1);
  3572. while (++index < start) {
  3573. otherArgs[index] = args[index];
  3574. }
  3575. otherArgs[start] = transform(array);
  3576. return apply(func, this, otherArgs);
  3577. };
  3578. }
  3579. module.exports = overRest;
  3580. },{"./_apply":13}],74:[function(require,module,exports){
  3581. var freeGlobal = require('./_freeGlobal');
  3582. /** Detect free variable `self`. */
  3583. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  3584. /** Used as a reference to the global object. */
  3585. var root = freeGlobal || freeSelf || Function('return this')();
  3586. module.exports = root;
  3587. },{"./_freeGlobal":41}],75:[function(require,module,exports){
  3588. var baseSetToString = require('./_baseSetToString'),
  3589. shortOut = require('./_shortOut');
  3590. /**
  3591. * Sets the `toString` method of `func` to return `string`.
  3592. *
  3593. * @private
  3594. * @param {Function} func The function to modify.
  3595. * @param {Function} string The `toString` result.
  3596. * @returns {Function} Returns `func`.
  3597. */
  3598. var setToString = shortOut(baseSetToString);
  3599. module.exports = setToString;
  3600. },{"./_baseSetToString":29,"./_shortOut":76}],76:[function(require,module,exports){
  3601. /** Used to detect hot functions by number of calls within a span of milliseconds. */
  3602. var HOT_COUNT = 800,
  3603. HOT_SPAN = 16;
  3604. /* Built-in method references for those with the same name as other `lodash` methods. */
  3605. var nativeNow = Date.now;
  3606. /**
  3607. * Creates a function that'll short out and invoke `identity` instead
  3608. * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN`
  3609. * milliseconds.
  3610. *
  3611. * @private
  3612. * @param {Function} func The function to restrict.
  3613. * @returns {Function} Returns the new shortable function.
  3614. */
  3615. function shortOut(func) {
  3616. var count = 0,
  3617. lastCalled = 0;
  3618. return function() {
  3619. var stamp = nativeNow(),
  3620. remaining = HOT_SPAN - (stamp - lastCalled);
  3621. lastCalled = stamp;
  3622. if (remaining > 0) {
  3623. if (++count >= HOT_COUNT) {
  3624. return arguments[0];
  3625. }
  3626. } else {
  3627. count = 0;
  3628. }
  3629. return func.apply(undefined, arguments);
  3630. };
  3631. }
  3632. module.exports = shortOut;
  3633. },{}],77:[function(require,module,exports){
  3634. var ListCache = require('./_ListCache');
  3635. /**
  3636. * Removes all key-value entries from the stack.
  3637. *
  3638. * @private
  3639. * @name clear
  3640. * @memberOf Stack
  3641. */
  3642. function stackClear() {
  3643. this.__data__ = new ListCache;
  3644. this.size = 0;
  3645. }
  3646. module.exports = stackClear;
  3647. },{"./_ListCache":7}],78:[function(require,module,exports){
  3648. /**
  3649. * Removes `key` and its value from the stack.
  3650. *
  3651. * @private
  3652. * @name delete
  3653. * @memberOf Stack
  3654. * @param {string} key The key of the value to remove.
  3655. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  3656. */
  3657. function stackDelete(key) {
  3658. var data = this.__data__,
  3659. result = data['delete'](key);
  3660. this.size = data.size;
  3661. return result;
  3662. }
  3663. module.exports = stackDelete;
  3664. },{}],79:[function(require,module,exports){
  3665. /**
  3666. * Gets the stack value for `key`.
  3667. *
  3668. * @private
  3669. * @name get
  3670. * @memberOf Stack
  3671. * @param {string} key The key of the value to get.
  3672. * @returns {*} Returns the entry value.
  3673. */
  3674. function stackGet(key) {
  3675. return this.__data__.get(key);
  3676. }
  3677. module.exports = stackGet;
  3678. },{}],80:[function(require,module,exports){
  3679. /**
  3680. * Checks if a stack value for `key` exists.
  3681. *
  3682. * @private
  3683. * @name has
  3684. * @memberOf Stack
  3685. * @param {string} key The key of the entry to check.
  3686. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  3687. */
  3688. function stackHas(key) {
  3689. return this.__data__.has(key);
  3690. }
  3691. module.exports = stackHas;
  3692. },{}],81:[function(require,module,exports){
  3693. var ListCache = require('./_ListCache'),
  3694. Map = require('./_Map'),
  3695. MapCache = require('./_MapCache');
  3696. /** Used as the size to enable large array optimizations. */
  3697. var LARGE_ARRAY_SIZE = 200;
  3698. /**
  3699. * Sets the stack `key` to `value`.
  3700. *
  3701. * @private
  3702. * @name set
  3703. * @memberOf Stack
  3704. * @param {string} key The key of the value to set.
  3705. * @param {*} value The value to set.
  3706. * @returns {Object} Returns the stack cache instance.
  3707. */
  3708. function stackSet(key, value) {
  3709. var data = this.__data__;
  3710. if (data instanceof ListCache) {
  3711. var pairs = data.__data__;
  3712. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  3713. pairs.push([key, value]);
  3714. this.size = ++data.size;
  3715. return this;
  3716. }
  3717. data = this.__data__ = new MapCache(pairs);
  3718. }
  3719. data.set(key, value);
  3720. this.size = data.size;
  3721. return this;
  3722. }
  3723. module.exports = stackSet;
  3724. },{"./_ListCache":7,"./_Map":8,"./_MapCache":9}],82:[function(require,module,exports){
  3725. /** Used for built-in method references. */
  3726. var funcProto = Function.prototype;
  3727. /** Used to resolve the decompiled source of functions. */
  3728. var funcToString = funcProto.toString;
  3729. /**
  3730. * Converts `func` to its source code.
  3731. *
  3732. * @private
  3733. * @param {Function} func The function to convert.
  3734. * @returns {string} Returns the source code.
  3735. */
  3736. function toSource(func) {
  3737. if (func != null) {
  3738. try {
  3739. return funcToString.call(func);
  3740. } catch (e) {}
  3741. try {
  3742. return (func + '');
  3743. } catch (e) {}
  3744. }
  3745. return '';
  3746. }
  3747. module.exports = toSource;
  3748. },{}],83:[function(require,module,exports){
  3749. /**
  3750. * Creates a function that returns `value`.
  3751. *
  3752. * @static
  3753. * @memberOf _
  3754. * @since 2.4.0
  3755. * @category Util
  3756. * @param {*} value The value to return from the new function.
  3757. * @returns {Function} Returns the new constant function.
  3758. * @example
  3759. *
  3760. * var objects = _.times(2, _.constant({ 'a': 1 }));
  3761. *
  3762. * console.log(objects);
  3763. * // => [{ 'a': 1 }, { 'a': 1 }]
  3764. *
  3765. * console.log(objects[0] === objects[1]);
  3766. * // => true
  3767. */
  3768. function constant(value) {
  3769. return function() {
  3770. return value;
  3771. };
  3772. }
  3773. module.exports = constant;
  3774. },{}],84:[function(require,module,exports){
  3775. /**
  3776. * Performs a
  3777. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  3778. * comparison between two values to determine if they are equivalent.
  3779. *
  3780. * @static
  3781. * @memberOf _
  3782. * @since 4.0.0
  3783. * @category Lang
  3784. * @param {*} value The value to compare.
  3785. * @param {*} other The other value to compare.
  3786. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  3787. * @example
  3788. *
  3789. * var object = { 'a': 1 };
  3790. * var other = { 'a': 1 };
  3791. *
  3792. * _.eq(object, object);
  3793. * // => true
  3794. *
  3795. * _.eq(object, other);
  3796. * // => false
  3797. *
  3798. * _.eq('a', 'a');
  3799. * // => true
  3800. *
  3801. * _.eq('a', Object('a'));
  3802. * // => false
  3803. *
  3804. * _.eq(NaN, NaN);
  3805. * // => true
  3806. */
  3807. function eq(value, other) {
  3808. return value === other || (value !== value && other !== other);
  3809. }
  3810. module.exports = eq;
  3811. },{}],85:[function(require,module,exports){
  3812. /**
  3813. * This method returns the first argument it receives.
  3814. *
  3815. * @static
  3816. * @since 0.1.0
  3817. * @memberOf _
  3818. * @category Util
  3819. * @param {*} value Any value.
  3820. * @returns {*} Returns `value`.
  3821. * @example
  3822. *
  3823. * var object = { 'a': 1 };
  3824. *
  3825. * console.log(_.identity(object) === object);
  3826. * // => true
  3827. */
  3828. function identity(value) {
  3829. return value;
  3830. }
  3831. module.exports = identity;
  3832. },{}],86:[function(require,module,exports){
  3833. var baseIsArguments = require('./_baseIsArguments'),
  3834. isObjectLike = require('./isObjectLike');
  3835. /** Used for built-in method references. */
  3836. var objectProto = Object.prototype;
  3837. /** Used to check objects for own properties. */
  3838. var hasOwnProperty = objectProto.hasOwnProperty;
  3839. /** Built-in value references. */
  3840. var propertyIsEnumerable = objectProto.propertyIsEnumerable;
  3841. /**
  3842. * Checks if `value` is likely an `arguments` object.
  3843. *
  3844. * @static
  3845. * @memberOf _
  3846. * @since 0.1.0
  3847. * @category Lang
  3848. * @param {*} value The value to check.
  3849. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  3850. * else `false`.
  3851. * @example
  3852. *
  3853. * _.isArguments(function() { return arguments; }());
  3854. * // => true
  3855. *
  3856. * _.isArguments([1, 2, 3]);
  3857. * // => false
  3858. */
  3859. var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
  3860. return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
  3861. !propertyIsEnumerable.call(value, 'callee');
  3862. };
  3863. module.exports = isArguments;
  3864. },{"./_baseIsArguments":22,"./isObjectLike":94}],87:[function(require,module,exports){
  3865. /**
  3866. * Checks if `value` is classified as an `Array` object.
  3867. *
  3868. * @static
  3869. * @memberOf _
  3870. * @since 0.1.0
  3871. * @category Lang
  3872. * @param {*} value The value to check.
  3873. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  3874. * @example
  3875. *
  3876. * _.isArray([1, 2, 3]);
  3877. * // => true
  3878. *
  3879. * _.isArray(document.body.children);
  3880. * // => false
  3881. *
  3882. * _.isArray('abc');
  3883. * // => false
  3884. *
  3885. * _.isArray(_.noop);
  3886. * // => false
  3887. */
  3888. var isArray = Array.isArray;
  3889. module.exports = isArray;
  3890. },{}],88:[function(require,module,exports){
  3891. var isFunction = require('./isFunction'),
  3892. isLength = require('./isLength');
  3893. /**
  3894. * Checks if `value` is array-like. A value is considered array-like if it's
  3895. * not a function and has a `value.length` that's an integer greater than or
  3896. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  3897. *
  3898. * @static
  3899. * @memberOf _
  3900. * @since 4.0.0
  3901. * @category Lang
  3902. * @param {*} value The value to check.
  3903. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  3904. * @example
  3905. *
  3906. * _.isArrayLike([1, 2, 3]);
  3907. * // => true
  3908. *
  3909. * _.isArrayLike(document.body.children);
  3910. * // => true
  3911. *
  3912. * _.isArrayLike('abc');
  3913. * // => true
  3914. *
  3915. * _.isArrayLike(_.noop);
  3916. * // => false
  3917. */
  3918. function isArrayLike(value) {
  3919. return value != null && isLength(value.length) && !isFunction(value);
  3920. }
  3921. module.exports = isArrayLike;
  3922. },{"./isFunction":91,"./isLength":92}],89:[function(require,module,exports){
  3923. var isArrayLike = require('./isArrayLike'),
  3924. isObjectLike = require('./isObjectLike');
  3925. /**
  3926. * This method is like `_.isArrayLike` except that it also checks if `value`
  3927. * is an object.
  3928. *
  3929. * @static
  3930. * @memberOf _
  3931. * @since 4.0.0
  3932. * @category Lang
  3933. * @param {*} value The value to check.
  3934. * @returns {boolean} Returns `true` if `value` is an array-like object,
  3935. * else `false`.
  3936. * @example
  3937. *
  3938. * _.isArrayLikeObject([1, 2, 3]);
  3939. * // => true
  3940. *
  3941. * _.isArrayLikeObject(document.body.children);
  3942. * // => true
  3943. *
  3944. * _.isArrayLikeObject('abc');
  3945. * // => false
  3946. *
  3947. * _.isArrayLikeObject(_.noop);
  3948. * // => false
  3949. */
  3950. function isArrayLikeObject(value) {
  3951. return isObjectLike(value) && isArrayLike(value);
  3952. }
  3953. module.exports = isArrayLikeObject;
  3954. },{"./isArrayLike":88,"./isObjectLike":94}],90:[function(require,module,exports){
  3955. var root = require('./_root'),
  3956. stubFalse = require('./stubFalse');
  3957. /** Detect free variable `exports`. */
  3958. var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
  3959. /** Detect free variable `module`. */
  3960. var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
  3961. /** Detect the popular CommonJS extension `module.exports`. */
  3962. var moduleExports = freeModule && freeModule.exports === freeExports;
  3963. /** Built-in value references. */
  3964. var Buffer = moduleExports ? root.Buffer : undefined;
  3965. /* Built-in method references for those with the same name as other `lodash` methods. */
  3966. var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
  3967. /**
  3968. * Checks if `value` is a buffer.
  3969. *
  3970. * @static
  3971. * @memberOf _
  3972. * @since 4.3.0
  3973. * @category Lang
  3974. * @param {*} value The value to check.
  3975. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
  3976. * @example
  3977. *
  3978. * _.isBuffer(new Buffer(2));
  3979. * // => true
  3980. *
  3981. * _.isBuffer(new Uint8Array(2));
  3982. * // => false
  3983. */
  3984. var isBuffer = nativeIsBuffer || stubFalse;
  3985. module.exports = isBuffer;
  3986. },{"./_root":74,"./stubFalse":99}],91:[function(require,module,exports){
  3987. var baseGetTag = require('./_baseGetTag'),
  3988. isObject = require('./isObject');
  3989. /** `Object#toString` result references. */
  3990. var asyncTag = '[object AsyncFunction]',
  3991. funcTag = '[object Function]',
  3992. genTag = '[object GeneratorFunction]',
  3993. proxyTag = '[object Proxy]';
  3994. /**
  3995. * Checks if `value` is classified as a `Function` object.
  3996. *
  3997. * @static
  3998. * @memberOf _
  3999. * @since 0.1.0
  4000. * @category Lang
  4001. * @param {*} value The value to check.
  4002. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  4003. * @example
  4004. *
  4005. * _.isFunction(_);
  4006. * // => true
  4007. *
  4008. * _.isFunction(/abc/);
  4009. * // => false
  4010. */
  4011. function isFunction(value) {
  4012. if (!isObject(value)) {
  4013. return false;
  4014. }
  4015. // The use of `Object#toString` avoids issues with the `typeof` operator
  4016. // in Safari 9 which returns 'object' for typed arrays and other constructors.
  4017. var tag = baseGetTag(value);
  4018. return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
  4019. }
  4020. module.exports = isFunction;
  4021. },{"./_baseGetTag":21,"./isObject":93}],92:[function(require,module,exports){
  4022. /** Used as references for various `Number` constants. */
  4023. var MAX_SAFE_INTEGER = 9007199254740991;
  4024. /**
  4025. * Checks if `value` is a valid array-like length.
  4026. *
  4027. * **Note:** This method is loosely based on
  4028. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  4029. *
  4030. * @static
  4031. * @memberOf _
  4032. * @since 4.0.0
  4033. * @category Lang
  4034. * @param {*} value The value to check.
  4035. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  4036. * @example
  4037. *
  4038. * _.isLength(3);
  4039. * // => true
  4040. *
  4041. * _.isLength(Number.MIN_VALUE);
  4042. * // => false
  4043. *
  4044. * _.isLength(Infinity);
  4045. * // => false
  4046. *
  4047. * _.isLength('3');
  4048. * // => false
  4049. */
  4050. function isLength(value) {
  4051. return typeof value == 'number' &&
  4052. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  4053. }
  4054. module.exports = isLength;
  4055. },{}],93:[function(require,module,exports){
  4056. /**
  4057. * Checks if `value` is the
  4058. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  4059. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  4060. *
  4061. * @static
  4062. * @memberOf _
  4063. * @since 0.1.0
  4064. * @category Lang
  4065. * @param {*} value The value to check.
  4066. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  4067. * @example
  4068. *
  4069. * _.isObject({});
  4070. * // => true
  4071. *
  4072. * _.isObject([1, 2, 3]);
  4073. * // => true
  4074. *
  4075. * _.isObject(_.noop);
  4076. * // => true
  4077. *
  4078. * _.isObject(null);
  4079. * // => false
  4080. */
  4081. function isObject(value) {
  4082. var type = typeof value;
  4083. return value != null && (type == 'object' || type == 'function');
  4084. }
  4085. module.exports = isObject;
  4086. },{}],94:[function(require,module,exports){
  4087. /**
  4088. * Checks if `value` is object-like. A value is object-like if it's not `null`
  4089. * and has a `typeof` result of "object".
  4090. *
  4091. * @static
  4092. * @memberOf _
  4093. * @since 4.0.0
  4094. * @category Lang
  4095. * @param {*} value The value to check.
  4096. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  4097. * @example
  4098. *
  4099. * _.isObjectLike({});
  4100. * // => true
  4101. *
  4102. * _.isObjectLike([1, 2, 3]);
  4103. * // => true
  4104. *
  4105. * _.isObjectLike(_.noop);
  4106. * // => false
  4107. *
  4108. * _.isObjectLike(null);
  4109. * // => false
  4110. */
  4111. function isObjectLike(value) {
  4112. return value != null && typeof value == 'object';
  4113. }
  4114. module.exports = isObjectLike;
  4115. },{}],95:[function(require,module,exports){
  4116. var baseGetTag = require('./_baseGetTag'),
  4117. getPrototype = require('./_getPrototype'),
  4118. isObjectLike = require('./isObjectLike');
  4119. /** `Object#toString` result references. */
  4120. var objectTag = '[object Object]';
  4121. /** Used for built-in method references. */
  4122. var funcProto = Function.prototype,
  4123. objectProto = Object.prototype;
  4124. /** Used to resolve the decompiled source of functions. */
  4125. var funcToString = funcProto.toString;
  4126. /** Used to check objects for own properties. */
  4127. var hasOwnProperty = objectProto.hasOwnProperty;
  4128. /** Used to infer the `Object` constructor. */
  4129. var objectCtorString = funcToString.call(Object);
  4130. /**
  4131. * Checks if `value` is a plain object, that is, an object created by the
  4132. * `Object` constructor or one with a `[[Prototype]]` of `null`.
  4133. *
  4134. * @static
  4135. * @memberOf _
  4136. * @since 0.8.0
  4137. * @category Lang
  4138. * @param {*} value The value to check.
  4139. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.
  4140. * @example
  4141. *
  4142. * function Foo() {
  4143. * this.a = 1;
  4144. * }
  4145. *
  4146. * _.isPlainObject(new Foo);
  4147. * // => false
  4148. *
  4149. * _.isPlainObject([1, 2, 3]);
  4150. * // => false
  4151. *
  4152. * _.isPlainObject({ 'x': 0, 'y': 0 });
  4153. * // => true
  4154. *
  4155. * _.isPlainObject(Object.create(null));
  4156. * // => true
  4157. */
  4158. function isPlainObject(value) {
  4159. if (!isObjectLike(value) || baseGetTag(value) != objectTag) {
  4160. return false;
  4161. }
  4162. var proto = getPrototype(value);
  4163. if (proto === null) {
  4164. return true;
  4165. }
  4166. var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
  4167. return typeof Ctor == 'function' && Ctor instanceof Ctor &&
  4168. funcToString.call(Ctor) == objectCtorString;
  4169. }
  4170. module.exports = isPlainObject;
  4171. },{"./_baseGetTag":21,"./_getPrototype":44,"./isObjectLike":94}],96:[function(require,module,exports){
  4172. var baseIsTypedArray = require('./_baseIsTypedArray'),
  4173. baseUnary = require('./_baseUnary'),
  4174. nodeUtil = require('./_nodeUtil');
  4175. /* Node.js helper references. */
  4176. var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  4177. /**
  4178. * Checks if `value` is classified as a typed array.
  4179. *
  4180. * @static
  4181. * @memberOf _
  4182. * @since 3.0.0
  4183. * @category Lang
  4184. * @param {*} value The value to check.
  4185. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  4186. * @example
  4187. *
  4188. * _.isTypedArray(new Uint8Array);
  4189. * // => true
  4190. *
  4191. * _.isTypedArray([]);
  4192. * // => false
  4193. */
  4194. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  4195. module.exports = isTypedArray;
  4196. },{"./_baseIsTypedArray":24,"./_baseUnary":31,"./_nodeUtil":70}],97:[function(require,module,exports){
  4197. var arrayLikeKeys = require('./_arrayLikeKeys'),
  4198. baseKeysIn = require('./_baseKeysIn'),
  4199. isArrayLike = require('./isArrayLike');
  4200. /**
  4201. * Creates an array of the own and inherited enumerable property names of `object`.
  4202. *
  4203. * **Note:** Non-object values are coerced to objects.
  4204. *
  4205. * @static
  4206. * @memberOf _
  4207. * @since 3.0.0
  4208. * @category Object
  4209. * @param {Object} object The object to query.
  4210. * @returns {Array} Returns the array of property names.
  4211. * @example
  4212. *
  4213. * function Foo() {
  4214. * this.a = 1;
  4215. * this.b = 2;
  4216. * }
  4217. *
  4218. * Foo.prototype.c = 3;
  4219. *
  4220. * _.keysIn(new Foo);
  4221. * // => ['a', 'b', 'c'] (iteration order is not guaranteed)
  4222. */
  4223. function keysIn(object) {
  4224. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  4225. }
  4226. module.exports = keysIn;
  4227. },{"./_arrayLikeKeys":14,"./_baseKeysIn":25,"./isArrayLike":88}],98:[function(require,module,exports){
  4228. var baseMerge = require('./_baseMerge'),
  4229. createAssigner = require('./_createAssigner');
  4230. /**
  4231. * This method is like `_.assign` except that it recursively merges own and
  4232. * inherited enumerable string keyed properties of source objects into the
  4233. * destination object. Source properties that resolve to `undefined` are
  4234. * skipped if a destination value exists. Array and plain object properties
  4235. * are merged recursively. Other objects and value types are overridden by
  4236. * assignment. Source objects are applied from left to right. Subsequent
  4237. * sources overwrite property assignments of previous sources.
  4238. *
  4239. * **Note:** This method mutates `object`.
  4240. *
  4241. * @static
  4242. * @memberOf _
  4243. * @since 0.5.0
  4244. * @category Object
  4245. * @param {Object} object The destination object.
  4246. * @param {...Object} [sources] The source objects.
  4247. * @returns {Object} Returns `object`.
  4248. * @example
  4249. *
  4250. * var object = {
  4251. * 'a': [{ 'b': 2 }, { 'd': 4 }]
  4252. * };
  4253. *
  4254. * var other = {
  4255. * 'a': [{ 'c': 3 }, { 'e': 5 }]
  4256. * };
  4257. *
  4258. * _.merge(object, other);
  4259. * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
  4260. */
  4261. var merge = createAssigner(function(object, source, srcIndex) {
  4262. baseMerge(object, source, srcIndex);
  4263. });
  4264. module.exports = merge;
  4265. },{"./_baseMerge":26,"./_createAssigner":38}],99:[function(require,module,exports){
  4266. /**
  4267. * This method returns `false`.
  4268. *
  4269. * @static
  4270. * @memberOf _
  4271. * @since 4.13.0
  4272. * @category Util
  4273. * @returns {boolean} Returns `false`.
  4274. * @example
  4275. *
  4276. * _.times(2, _.stubFalse);
  4277. * // => [false, false]
  4278. */
  4279. function stubFalse() {
  4280. return false;
  4281. }
  4282. module.exports = stubFalse;
  4283. },{}],100:[function(require,module,exports){
  4284. var copyObject = require('./_copyObject'),
  4285. keysIn = require('./keysIn');
  4286. /**
  4287. * Converts `value` to a plain object flattening inherited enumerable string
  4288. * keyed properties of `value` to own properties of the plain object.
  4289. *
  4290. * @static
  4291. * @memberOf _
  4292. * @since 3.0.0
  4293. * @category Lang
  4294. * @param {*} value The value to convert.
  4295. * @returns {Object} Returns the converted plain object.
  4296. * @example
  4297. *
  4298. * function Foo() {
  4299. * this.b = 2;
  4300. * }
  4301. *
  4302. * Foo.prototype.c = 3;
  4303. *
  4304. * _.assign({ 'a': 1 }, new Foo);
  4305. * // => { 'a': 1, 'b': 2 }
  4306. *
  4307. * _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
  4308. * // => { 'a': 1, 'b': 2, 'c': 3 }
  4309. */
  4310. function toPlainObject(value) {
  4311. return copyObject(value, keysIn(value));
  4312. }
  4313. module.exports = toPlainObject;
  4314. },{"./_copyObject":36,"./keysIn":97}],101:[function(require,module,exports){
  4315. (function (process){
  4316. // Copyright Joyent, Inc. and other Node contributors.
  4317. //
  4318. // Permission is hereby granted, free of charge, to any person obtaining a
  4319. // copy of this software and associated documentation files (the
  4320. // "Software"), to deal in the Software without restriction, including
  4321. // without limitation the rights to use, copy, modify, merge, publish,
  4322. // distribute, sublicense, and/or sell copies of the Software, and to permit
  4323. // persons to whom the Software is furnished to do so, subject to the
  4324. // following conditions:
  4325. //
  4326. // The above copyright notice and this permission notice shall be included
  4327. // in all copies or substantial portions of the Software.
  4328. //
  4329. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  4330. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  4331. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  4332. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  4333. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  4334. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  4335. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  4336. // resolves . and .. elements in a path array with directory names there
  4337. // must be no slashes, empty elements, or device names (c:\) in the array
  4338. // (so also no leading and trailing slashes - it does not distinguish
  4339. // relative and absolute paths)
  4340. function normalizeArray(parts, allowAboveRoot) {
  4341. // if the path tries to go above the root, `up` ends up > 0
  4342. var up = 0;
  4343. for (var i = parts.length - 1; i >= 0; i--) {
  4344. var last = parts[i];
  4345. if (last === '.') {
  4346. parts.splice(i, 1);
  4347. } else if (last === '..') {
  4348. parts.splice(i, 1);
  4349. up++;
  4350. } else if (up) {
  4351. parts.splice(i, 1);
  4352. up--;
  4353. }
  4354. }
  4355. // if the path is allowed to go above the root, restore leading ..s
  4356. if (allowAboveRoot) {
  4357. for (; up--; up) {
  4358. parts.unshift('..');
  4359. }
  4360. }
  4361. return parts;
  4362. }
  4363. // Split a filename into [root, dir, basename, ext], unix version
  4364. // 'root' is just a slash, or nothing.
  4365. var splitPathRe =
  4366. /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
  4367. var splitPath = function(filename) {
  4368. return splitPathRe.exec(filename).slice(1);
  4369. };
  4370. // path.resolve([from ...], to)
  4371. // posix version
  4372. exports.resolve = function() {
  4373. var resolvedPath = '',
  4374. resolvedAbsolute = false;
  4375. for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
  4376. var path = (i >= 0) ? arguments[i] : process.cwd();
  4377. // Skip empty and invalid entries
  4378. if (typeof path !== 'string') {
  4379. throw new TypeError('Arguments to path.resolve must be strings');
  4380. } else if (!path) {
  4381. continue;
  4382. }
  4383. resolvedPath = path + '/' + resolvedPath;
  4384. resolvedAbsolute = path.charAt(0) === '/';
  4385. }
  4386. // At this point the path should be resolved to a full absolute path, but
  4387. // handle relative paths to be safe (might happen when process.cwd() fails)
  4388. // Normalize the path
  4389. resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
  4390. return !!p;
  4391. }), !resolvedAbsolute).join('/');
  4392. return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
  4393. };
  4394. // path.normalize(path)
  4395. // posix version
  4396. exports.normalize = function(path) {
  4397. var isAbsolute = exports.isAbsolute(path),
  4398. trailingSlash = substr(path, -1) === '/';
  4399. // Normalize the path
  4400. path = normalizeArray(filter(path.split('/'), function(p) {
  4401. return !!p;
  4402. }), !isAbsolute).join('/');
  4403. if (!path && !isAbsolute) {
  4404. path = '.';
  4405. }
  4406. if (path && trailingSlash) {
  4407. path += '/';
  4408. }
  4409. return (isAbsolute ? '/' : '') + path;
  4410. };
  4411. // posix version
  4412. exports.isAbsolute = function(path) {
  4413. return path.charAt(0) === '/';
  4414. };
  4415. // posix version
  4416. exports.join = function() {
  4417. var paths = Array.prototype.slice.call(arguments, 0);
  4418. return exports.normalize(filter(paths, function(p, index) {
  4419. if (typeof p !== 'string') {
  4420. throw new TypeError('Arguments to path.join must be strings');
  4421. }
  4422. return p;
  4423. }).join('/'));
  4424. };
  4425. // path.relative(from, to)
  4426. // posix version
  4427. exports.relative = function(from, to) {
  4428. from = exports.resolve(from).substr(1);
  4429. to = exports.resolve(to).substr(1);
  4430. function trim(arr) {
  4431. var start = 0;
  4432. for (; start < arr.length; start++) {
  4433. if (arr[start] !== '') break;
  4434. }
  4435. var end = arr.length - 1;
  4436. for (; end >= 0; end--) {
  4437. if (arr[end] !== '') break;
  4438. }
  4439. if (start > end) return [];
  4440. return arr.slice(start, end - start + 1);
  4441. }
  4442. var fromParts = trim(from.split('/'));
  4443. var toParts = trim(to.split('/'));
  4444. var length = Math.min(fromParts.length, toParts.length);
  4445. var samePartsLength = length;
  4446. for (var i = 0; i < length; i++) {
  4447. if (fromParts[i] !== toParts[i]) {
  4448. samePartsLength = i;
  4449. break;
  4450. }
  4451. }
  4452. var outputParts = [];
  4453. for (var i = samePartsLength; i < fromParts.length; i++) {
  4454. outputParts.push('..');
  4455. }
  4456. outputParts = outputParts.concat(toParts.slice(samePartsLength));
  4457. return outputParts.join('/');
  4458. };
  4459. exports.sep = '/';
  4460. exports.delimiter = ':';
  4461. exports.dirname = function(path) {
  4462. var result = splitPath(path),
  4463. root = result[0],
  4464. dir = result[1];
  4465. if (!root && !dir) {
  4466. // No dirname whatsoever
  4467. return '.';
  4468. }
  4469. if (dir) {
  4470. // It has a dirname, strip trailing slash
  4471. dir = dir.substr(0, dir.length - 1);
  4472. }
  4473. return root + dir;
  4474. };
  4475. exports.basename = function(path, ext) {
  4476. var f = splitPath(path)[2];
  4477. // TODO: make this comparison case-insensitive on windows?
  4478. if (ext && f.substr(-1 * ext.length) === ext) {
  4479. f = f.substr(0, f.length - ext.length);
  4480. }
  4481. return f;
  4482. };
  4483. exports.extname = function(path) {
  4484. return splitPath(path)[3];
  4485. };
  4486. function filter (xs, f) {
  4487. if (xs.filter) return xs.filter(f);
  4488. var res = [];
  4489. for (var i = 0; i < xs.length; i++) {
  4490. if (f(xs[i], i, xs)) res.push(xs[i]);
  4491. }
  4492. return res;
  4493. }
  4494. // String.prototype.substr - negative index don't work in IE8
  4495. var substr = 'ab'.substr(-1) === 'b'
  4496. ? function (str, start, len) { return str.substr(start, len) }
  4497. : function (str, start, len) {
  4498. if (start < 0) start = str.length + start;
  4499. return str.substr(start, len);
  4500. }
  4501. ;
  4502. }).call(this,require('_process'))
  4503. },{"_process":102}],102:[function(require,module,exports){
  4504. // shim for using process in browser
  4505. var process = module.exports = {};
  4506. // cached from whatever global is present so that test runners that stub it
  4507. // don't break things. But we need to wrap it in a try catch in case it is
  4508. // wrapped in strict mode code which doesn't define any globals. It's inside a
  4509. // function because try/catches deoptimize in certain engines.
  4510. var cachedSetTimeout;
  4511. var cachedClearTimeout;
  4512. function defaultSetTimout() {
  4513. throw new Error('setTimeout has not been defined');
  4514. }
  4515. function defaultClearTimeout () {
  4516. throw new Error('clearTimeout has not been defined');
  4517. }
  4518. (function () {
  4519. try {
  4520. if (typeof setTimeout === 'function') {
  4521. cachedSetTimeout = setTimeout;
  4522. } else {
  4523. cachedSetTimeout = defaultSetTimout;
  4524. }
  4525. } catch (e) {
  4526. cachedSetTimeout = defaultSetTimout;
  4527. }
  4528. try {
  4529. if (typeof clearTimeout === 'function') {
  4530. cachedClearTimeout = clearTimeout;
  4531. } else {
  4532. cachedClearTimeout = defaultClearTimeout;
  4533. }
  4534. } catch (e) {
  4535. cachedClearTimeout = defaultClearTimeout;
  4536. }
  4537. } ())
  4538. function runTimeout(fun) {
  4539. if (cachedSetTimeout === setTimeout) {
  4540. //normal enviroments in sane situations
  4541. return setTimeout(fun, 0);
  4542. }
  4543. // if setTimeout wasn't available but was latter defined
  4544. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  4545. cachedSetTimeout = setTimeout;
  4546. return setTimeout(fun, 0);
  4547. }
  4548. try {
  4549. // when when somebody has screwed with setTimeout but no I.E. maddness
  4550. return cachedSetTimeout(fun, 0);
  4551. } catch(e){
  4552. try {
  4553. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  4554. return cachedSetTimeout.call(null, fun, 0);
  4555. } catch(e){
  4556. // 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
  4557. return cachedSetTimeout.call(this, fun, 0);
  4558. }
  4559. }
  4560. }
  4561. function runClearTimeout(marker) {
  4562. if (cachedClearTimeout === clearTimeout) {
  4563. //normal enviroments in sane situations
  4564. return clearTimeout(marker);
  4565. }
  4566. // if clearTimeout wasn't available but was latter defined
  4567. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  4568. cachedClearTimeout = clearTimeout;
  4569. return clearTimeout(marker);
  4570. }
  4571. try {
  4572. // when when somebody has screwed with setTimeout but no I.E. maddness
  4573. return cachedClearTimeout(marker);
  4574. } catch (e){
  4575. try {
  4576. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  4577. return cachedClearTimeout.call(null, marker);
  4578. } catch (e){
  4579. // 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.
  4580. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  4581. return cachedClearTimeout.call(this, marker);
  4582. }
  4583. }
  4584. }
  4585. var queue = [];
  4586. var draining = false;
  4587. var currentQueue;
  4588. var queueIndex = -1;
  4589. function cleanUpNextTick() {
  4590. if (!draining || !currentQueue) {
  4591. return;
  4592. }
  4593. draining = false;
  4594. if (currentQueue.length) {
  4595. queue = currentQueue.concat(queue);
  4596. } else {
  4597. queueIndex = -1;
  4598. }
  4599. if (queue.length) {
  4600. drainQueue();
  4601. }
  4602. }
  4603. function drainQueue() {
  4604. if (draining) {
  4605. return;
  4606. }
  4607. var timeout = runTimeout(cleanUpNextTick);
  4608. draining = true;
  4609. var len = queue.length;
  4610. while(len) {
  4611. currentQueue = queue;
  4612. queue = [];
  4613. while (++queueIndex < len) {
  4614. if (currentQueue) {
  4615. currentQueue[queueIndex].run();
  4616. }
  4617. }
  4618. queueIndex = -1;
  4619. len = queue.length;
  4620. }
  4621. currentQueue = null;
  4622. draining = false;
  4623. runClearTimeout(timeout);
  4624. }
  4625. process.nextTick = function (fun) {
  4626. var args = new Array(arguments.length - 1);
  4627. if (arguments.length > 1) {
  4628. for (var i = 1; i < arguments.length; i++) {
  4629. args[i - 1] = arguments[i];
  4630. }
  4631. }
  4632. queue.push(new Item(fun, args));
  4633. if (queue.length === 1 && !draining) {
  4634. runTimeout(drainQueue);
  4635. }
  4636. };
  4637. // v8 likes predictible objects
  4638. function Item(fun, array) {
  4639. this.fun = fun;
  4640. this.array = array;
  4641. }
  4642. Item.prototype.run = function () {
  4643. this.fun.apply(null, this.array);
  4644. };
  4645. process.title = 'browser';
  4646. process.browser = true;
  4647. process.env = {};
  4648. process.argv = [];
  4649. process.version = ''; // empty string to avoid regexp issues
  4650. process.versions = {};
  4651. function noop() {}
  4652. process.on = noop;
  4653. process.addListener = noop;
  4654. process.once = noop;
  4655. process.off = noop;
  4656. process.removeListener = noop;
  4657. process.removeAllListeners = noop;
  4658. process.emit = noop;
  4659. process.prependListener = noop;
  4660. process.prependOnceListener = noop;
  4661. process.listeners = function (name) { return [] }
  4662. process.binding = function (name) {
  4663. throw new Error('process.binding is not supported');
  4664. };
  4665. process.cwd = function () { return '/' };
  4666. process.chdir = function (dir) {
  4667. throw new Error('process.chdir is not supported');
  4668. };
  4669. process.umask = function() { return 0; };
  4670. },{}],103:[function(require,module,exports){
  4671. /*
  4672. *
  4673. * Diff Parser (diff-parser.js)
  4674. * Author: rtfpessoa
  4675. *
  4676. */
  4677. (function() {
  4678. var utils = require('./utils.js').Utils;
  4679. var LINE_TYPE = {
  4680. INSERTS: 'd2h-ins',
  4681. DELETES: 'd2h-del',
  4682. INSERT_CHANGES: 'd2h-ins d2h-change',
  4683. DELETE_CHANGES: 'd2h-del d2h-change',
  4684. CONTEXT: 'd2h-cntx',
  4685. INFO: 'd2h-info'
  4686. };
  4687. function DiffParser() {
  4688. }
  4689. DiffParser.prototype.LINE_TYPE = LINE_TYPE;
  4690. DiffParser.prototype.generateDiffJson = function(diffInput, configuration) {
  4691. var config = configuration || {};
  4692. var files = [];
  4693. var currentFile = null;
  4694. var currentBlock = null;
  4695. var oldLine = null;
  4696. var oldLine2 = null; // Used for combined diff
  4697. var newLine = null;
  4698. var possibleOldName;
  4699. var possibleNewName;
  4700. /* Diff Header */
  4701. var oldFileNameHeader = '--- ';
  4702. var newFileNameHeader = '+++ ';
  4703. var hunkHeaderPrefix = '@@';
  4704. /* Add previous block(if exists) before start a new file */
  4705. function saveBlock() {
  4706. if (currentBlock) {
  4707. currentFile.blocks.push(currentBlock);
  4708. currentBlock = null;
  4709. }
  4710. }
  4711. /*
  4712. * Add previous file(if exists) before start a new one
  4713. * if it has name (to avoid binary files errors)
  4714. */
  4715. function saveFile() {
  4716. if (currentFile) {
  4717. if (!currentFile.oldName) {
  4718. currentFile.oldName = possibleOldName;
  4719. }
  4720. if (!currentFile.newName) {
  4721. currentFile.newName = possibleNewName;
  4722. }
  4723. if (currentFile.newName) {
  4724. files.push(currentFile);
  4725. currentFile = null;
  4726. }
  4727. }
  4728. possibleOldName = undefined;
  4729. possibleNewName = undefined;
  4730. }
  4731. /* Create file structure */
  4732. function startFile() {
  4733. saveBlock();
  4734. saveFile();
  4735. currentFile = {};
  4736. currentFile.blocks = [];
  4737. currentFile.deletedLines = 0;
  4738. currentFile.addedLines = 0;
  4739. }
  4740. function startBlock(line) {
  4741. saveBlock();
  4742. var values;
  4743. /**
  4744. * From Range:
  4745. * -<start line>[,<number of lines>]
  4746. *
  4747. * To Range:
  4748. * +<start line>[,<number of lines>]
  4749. *
  4750. * @@ from-file-range to-file-range @@
  4751. *
  4752. * @@@ from-file-range from-file-range to-file-range @@@
  4753. *
  4754. * number of lines is optional, if omited consider 0
  4755. */
  4756. if ((values = /^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(line))) {
  4757. currentFile.isCombined = false;
  4758. oldLine = values[1];
  4759. newLine = values[2];
  4760. } else if ((values = /^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(line))) {
  4761. currentFile.isCombined = true;
  4762. oldLine = values[1];
  4763. oldLine2 = values[2];
  4764. newLine = values[3];
  4765. } else {
  4766. if (utils.startsWith(line, hunkHeaderPrefix)) {
  4767. console.error('Failed to parse lines, starting in 0!');
  4768. }
  4769. oldLine = 0;
  4770. newLine = 0;
  4771. currentFile.isCombined = false;
  4772. }
  4773. /* Create block metadata */
  4774. currentBlock = {};
  4775. currentBlock.lines = [];
  4776. currentBlock.oldStartLine = oldLine;
  4777. currentBlock.oldStartLine2 = oldLine2;
  4778. currentBlock.newStartLine = newLine;
  4779. currentBlock.header = line;
  4780. }
  4781. function createLine(line) {
  4782. var currentLine = {};
  4783. currentLine.content = line;
  4784. var newLinePrefixes = !currentFile.isCombined ? ['+'] : ['+', ' +'];
  4785. var delLinePrefixes = !currentFile.isCombined ? ['-'] : ['-', ' -'];
  4786. /* Fill the line data */
  4787. if (utils.startsWith(line, newLinePrefixes)) {
  4788. currentFile.addedLines++;
  4789. currentLine.type = LINE_TYPE.INSERTS;
  4790. currentLine.oldNumber = null;
  4791. currentLine.newNumber = newLine++;
  4792. currentBlock.lines.push(currentLine);
  4793. } else if (utils.startsWith(line, delLinePrefixes)) {
  4794. currentFile.deletedLines++;
  4795. currentLine.type = LINE_TYPE.DELETES;
  4796. currentLine.oldNumber = oldLine++;
  4797. currentLine.newNumber = null;
  4798. currentBlock.lines.push(currentLine);
  4799. } else {
  4800. currentLine.type = LINE_TYPE.CONTEXT;
  4801. currentLine.oldNumber = oldLine++;
  4802. currentLine.newNumber = newLine++;
  4803. currentBlock.lines.push(currentLine);
  4804. }
  4805. }
  4806. /*
  4807. * Checks if there is a hunk header coming before a new file starts
  4808. *
  4809. * Hunk header is a group of three lines started by ( `--- ` , `+++ ` , `@@` )
  4810. */
  4811. function existHunkHeader(line, lineIdx) {
  4812. var idx = lineIdx;
  4813. while (idx < diffLines.length - 3) {
  4814. if (utils.startsWith(line, 'diff')) {
  4815. return false;
  4816. }
  4817. if (
  4818. utils.startsWith(diffLines[idx], oldFileNameHeader) &&
  4819. utils.startsWith(diffLines[idx + 1], newFileNameHeader) &&
  4820. utils.startsWith(diffLines[idx + 2], hunkHeaderPrefix)
  4821. ) {
  4822. return true;
  4823. }
  4824. idx++;
  4825. }
  4826. return false;
  4827. }
  4828. var diffLines =
  4829. diffInput.replace(/\\ No newline at end of file/g, '')
  4830. .replace(/\r\n?/g, '\n')
  4831. .split('\n');
  4832. /* Diff */
  4833. var oldMode = /^old mode (\d{6})/;
  4834. var newMode = /^new mode (\d{6})/;
  4835. var deletedFileMode = /^deleted file mode (\d{6})/;
  4836. var newFileMode = /^new file mode (\d{6})/;
  4837. var copyFrom = /^copy from "?(.+)"?/;
  4838. var copyTo = /^copy to "?(.+)"?/;
  4839. var renameFrom = /^rename from "?(.+)"?/;
  4840. var renameTo = /^rename to "?(.+)"?/;
  4841. var similarityIndex = /^similarity index (\d+)%/;
  4842. var dissimilarityIndex = /^dissimilarity index (\d+)%/;
  4843. var index = /^index ([0-9a-z]+)\.\.([0-9a-z]+)\s*(\d{6})?/;
  4844. var binaryFiles = /^Binary files (.*) and (.*) differ/;
  4845. var binaryDiff = /^GIT binary patch/;
  4846. /* Combined Diff */
  4847. var combinedIndex = /^index ([0-9a-z]+),([0-9a-z]+)\.\.([0-9a-z]+)/;
  4848. var combinedMode = /^mode (\d{6}),(\d{6})\.\.(\d{6})/;
  4849. var combinedNewFile = /^new file mode (\d{6})/;
  4850. var combinedDeletedFile = /^deleted file mode (\d{6}),(\d{6})/;
  4851. diffLines.forEach(function(line, lineIndex) {
  4852. // Unmerged paths, and possibly other non-diffable files
  4853. // https://github.com/scottgonzalez/pretty-diff/issues/11
  4854. // Also, remove some useless lines
  4855. if (!line || utils.startsWith(line, '*')) {
  4856. return;
  4857. }
  4858. // Used to store regex capture groups
  4859. var values;
  4860. var prevLine = diffLines[lineIndex - 1];
  4861. var nxtLine = diffLines[lineIndex + 1];
  4862. var afterNxtLine = diffLines[lineIndex + 2];
  4863. if (utils.startsWith(line, 'diff')) {
  4864. startFile();
  4865. // diff --git a/blocked_delta_results.png b/blocked_delta_results.png
  4866. var gitDiffStart = /^diff --git "?(.+)"? "?(.+)"?/;
  4867. if ((values = gitDiffStart.exec(line))) {
  4868. possibleOldName = _getFilename(null, values[1], config.dstPrefix);
  4869. possibleNewName = _getFilename(null, values[2], config.srcPrefix);
  4870. }
  4871. currentFile.isGitDiff = true;
  4872. return;
  4873. }
  4874. if (!currentFile || // If we do not have a file yet, we should crete one
  4875. (
  4876. !currentFile.isGitDiff && currentFile && // If we already have some file in progress and
  4877. (
  4878. utils.startsWith(line, oldFileNameHeader) && // If we get to an old file path header line
  4879. // And is followed by the new file path header line and the hunk header line
  4880. utils.startsWith(nxtLine, newFileNameHeader) && utils.startsWith(afterNxtLine, hunkHeaderPrefix)
  4881. )
  4882. )
  4883. ) {
  4884. startFile();
  4885. }
  4886. /*
  4887. * We need to make sure that we have the three lines of the header.
  4888. * This avoids cases like the ones described in:
  4889. * - https://github.com/rtfpessoa/diff2html/issues/87
  4890. */
  4891. if (
  4892. (utils.startsWith(line, oldFileNameHeader) &&
  4893. utils.startsWith(nxtLine, newFileNameHeader)) ||
  4894. (utils.startsWith(line, newFileNameHeader) &&
  4895. utils.startsWith(prevLine, oldFileNameHeader))
  4896. ) {
  4897. /*
  4898. * --- Date Timestamp[FractionalSeconds] TimeZone
  4899. * --- 2002-02-21 23:30:39.942229878 -0800
  4900. */
  4901. if (currentFile && !currentFile.oldName &&
  4902. utils.startsWith(line, '--- ') && (values = getSrcFilename(line, config))) {
  4903. currentFile.oldName = values;
  4904. currentFile.language = getExtension(currentFile.oldName, currentFile.language);
  4905. return;
  4906. }
  4907. /*
  4908. * +++ Date Timestamp[FractionalSeconds] TimeZone
  4909. * +++ 2002-02-21 23:30:39.942229878 -0800
  4910. */
  4911. if (currentFile && !currentFile.newName &&
  4912. utils.startsWith(line, '+++ ') && (values = getDstFilename(line, config))) {
  4913. currentFile.newName = values;
  4914. currentFile.language = getExtension(currentFile.newName, currentFile.language);
  4915. return;
  4916. }
  4917. }
  4918. if (
  4919. (currentFile && utils.startsWith(line, hunkHeaderPrefix)) ||
  4920. (currentFile.isGitDiff && currentFile && currentFile.oldName && currentFile.newName && !currentBlock)
  4921. ) {
  4922. startBlock(line);
  4923. return;
  4924. }
  4925. /*
  4926. * There are three types of diff lines. These lines are defined by the way they start.
  4927. * 1. New line starts with: +
  4928. * 2. Old line starts with: -
  4929. * 3. Context line starts with: <SPACE>
  4930. */
  4931. if (currentBlock && (utils.startsWith(line, '+') || utils.startsWith(line, '-') || utils.startsWith(line, ' '))) {
  4932. createLine(line);
  4933. return;
  4934. }
  4935. var doesNotExistHunkHeader = !existHunkHeader(line, lineIndex);
  4936. /*
  4937. * Git diffs provide more information regarding files modes, renames, copies,
  4938. * commits between changes and similarity indexes
  4939. */
  4940. if ((values = oldMode.exec(line))) {
  4941. currentFile.oldMode = values[1];
  4942. } else if ((values = newMode.exec(line))) {
  4943. currentFile.newMode = values[1];
  4944. } else if ((values = deletedFileMode.exec(line))) {
  4945. currentFile.deletedFileMode = values[1];
  4946. currentFile.isDeleted = true;
  4947. } else if ((values = newFileMode.exec(line))) {
  4948. currentFile.newFileMode = values[1];
  4949. currentFile.isNew = true;
  4950. } else if ((values = copyFrom.exec(line))) {
  4951. if (doesNotExistHunkHeader) {
  4952. currentFile.oldName = values[1];
  4953. }
  4954. currentFile.isCopy = true;
  4955. } else if ((values = copyTo.exec(line))) {
  4956. if (doesNotExistHunkHeader) {
  4957. currentFile.newName = values[1];
  4958. }
  4959. currentFile.isCopy = true;
  4960. } else if ((values = renameFrom.exec(line))) {
  4961. if (doesNotExistHunkHeader) {
  4962. currentFile.oldName = values[1];
  4963. }
  4964. currentFile.isRename = true;
  4965. } else if ((values = renameTo.exec(line))) {
  4966. if (doesNotExistHunkHeader) {
  4967. currentFile.newName = values[1];
  4968. }
  4969. currentFile.isRename = true;
  4970. } else if ((values = binaryFiles.exec(line))) {
  4971. currentFile.isBinary = true;
  4972. currentFile.oldName = _getFilename(null, values[1], config.srcPrefix);
  4973. currentFile.newName = _getFilename(null, values[2], config.dstPrefix);
  4974. startBlock('Binary file');
  4975. } else if ((values = binaryDiff.exec(line))) {
  4976. currentFile.isBinary = true;
  4977. startBlock(line);
  4978. } else if ((values = similarityIndex.exec(line))) {
  4979. currentFile.unchangedPercentage = values[1];
  4980. } else if ((values = dissimilarityIndex.exec(line))) {
  4981. currentFile.changedPercentage = values[1];
  4982. } else if ((values = index.exec(line))) {
  4983. currentFile.checksumBefore = values[1];
  4984. currentFile.checksumAfter = values[2];
  4985. values[3] && (currentFile.mode = values[3]);
  4986. } else if ((values = combinedIndex.exec(line))) {
  4987. currentFile.checksumBefore = [values[2], values[3]];
  4988. currentFile.checksumAfter = values[1];
  4989. } else if ((values = combinedMode.exec(line))) {
  4990. currentFile.oldMode = [values[2], values[3]];
  4991. currentFile.newMode = values[1];
  4992. } else if ((values = combinedNewFile.exec(line))) {
  4993. currentFile.newFileMode = values[1];
  4994. currentFile.isNew = true;
  4995. } else if ((values = combinedDeletedFile.exec(line))) {
  4996. currentFile.deletedFileMode = values[1];
  4997. currentFile.isDeleted = true;
  4998. }
  4999. });
  5000. saveBlock();
  5001. saveFile();
  5002. return files;
  5003. };
  5004. function getExtension(filename, language) {
  5005. var nameSplit = filename.split('.');
  5006. if (nameSplit.length > 1) {
  5007. return nameSplit[nameSplit.length - 1];
  5008. }
  5009. return language;
  5010. }
  5011. function getSrcFilename(line, cfg) {
  5012. return _getFilename('---', line, cfg.srcPrefix);
  5013. }
  5014. function getDstFilename(line, cfg) {
  5015. return _getFilename('\\+\\+\\+', line, cfg.dstPrefix);
  5016. }
  5017. function _getFilename(linePrefix, line, extraPrefix) {
  5018. var prefixes = ['a/', 'b/', 'i/', 'w/', 'c/', 'o/'];
  5019. if (extraPrefix) {
  5020. prefixes.push(extraPrefix);
  5021. }
  5022. var FilenameRegExp;
  5023. if (linePrefix) {
  5024. FilenameRegExp = new RegExp('^' + linePrefix + ' "?(.+?)"?$');
  5025. } else {
  5026. FilenameRegExp = new RegExp('^"?(.+?)"?$');
  5027. }
  5028. var filename;
  5029. var values = FilenameRegExp.exec(line);
  5030. if (values && values[1]) {
  5031. filename = values[1];
  5032. var matchingPrefixes = prefixes.filter(function(p) {
  5033. return filename.indexOf(p) === 0;
  5034. });
  5035. if (matchingPrefixes[0]) {
  5036. // Remove prefix if exists
  5037. filename = filename.slice(matchingPrefixes[0].length);
  5038. }
  5039. // Cleanup timestamps generated by the unified diff (diff command) as specified in
  5040. // https://www.gnu.org/software/diffutils/manual/html_node/Detailed-Unified.html
  5041. // Ie: 2016-10-25 11:37:14.000000000 +0200
  5042. filename = filename.replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [-+]\d{4}.*$/, '');
  5043. }
  5044. return filename;
  5045. }
  5046. module.exports.DiffParser = new DiffParser();
  5047. })();
  5048. },{"./utils.js":113}],104:[function(require,module,exports){
  5049. (function (global){
  5050. /*
  5051. *
  5052. * Diff to HTML (diff2html.js)
  5053. * Author: rtfpessoa
  5054. *
  5055. */
  5056. (function() {
  5057. var diffParser = require('./diff-parser.js').DiffParser;
  5058. var htmlPrinter = require('./html-printer.js').HtmlPrinter;
  5059. var utils = require('./utils.js').Utils;
  5060. function Diff2Html() {
  5061. }
  5062. var defaultConfig = {
  5063. wordByWord: true,
  5064. outputFormat: 'line-by-line',
  5065. matching: 'none',
  5066. matchWordsThreshold: 0.25,
  5067. matchingMaxComparisons: 2500,
  5068. maxLineLengthHighlight: 10000
  5069. };
  5070. /*
  5071. * Generates json object from string diff input
  5072. */
  5073. Diff2Html.prototype.getJsonFromDiff = function(diffInput, config) {
  5074. var cfg = utils.safeConfig(config, defaultConfig);
  5075. return diffParser.generateDiffJson(diffInput, cfg);
  5076. };
  5077. /*
  5078. * Generates the html diff. The config parameter configures the output/input formats and other options
  5079. */
  5080. Diff2Html.prototype.getPrettyHtml = function(diffInput, config) {
  5081. var cfg = utils.safeConfig(config, defaultConfig);
  5082. var diffJson = diffInput;
  5083. if (!cfg.inputFormat || cfg.inputFormat === 'diff') {
  5084. diffJson = diffParser.generateDiffJson(diffInput, cfg);
  5085. }
  5086. var fileList = '';
  5087. if (cfg.showFiles === true) {
  5088. fileList = htmlPrinter.generateFileListSummary(diffJson, cfg);
  5089. }
  5090. var diffOutput = '';
  5091. if (cfg.outputFormat === 'side-by-side') {
  5092. diffOutput = htmlPrinter.generateSideBySideJsonHtml(diffJson, cfg);
  5093. } else {
  5094. diffOutput = htmlPrinter.generateLineByLineJsonHtml(diffJson, cfg);
  5095. }
  5096. return fileList + diffOutput;
  5097. };
  5098. /*
  5099. * Deprecated methods - The following methods exist only to maintain compatibility with previous versions
  5100. */
  5101. /*
  5102. * Generates pretty html from string diff input
  5103. */
  5104. Diff2Html.prototype.getPrettyHtmlFromDiff = function(diffInput, config) {
  5105. var cfg = utils.safeConfig(config, defaultConfig);
  5106. cfg.inputFormat = 'diff';
  5107. cfg.outputFormat = 'line-by-line';
  5108. return this.getPrettyHtml(diffInput, cfg);
  5109. };
  5110. /*
  5111. * Generates pretty html from a json object
  5112. */
  5113. Diff2Html.prototype.getPrettyHtmlFromJson = function(diffJson, config) {
  5114. var cfg = utils.safeConfig(config, defaultConfig);
  5115. cfg.inputFormat = 'json';
  5116. cfg.outputFormat = 'line-by-line';
  5117. return this.getPrettyHtml(diffJson, cfg);
  5118. };
  5119. /*
  5120. * Generates pretty side by side html from string diff input
  5121. */
  5122. Diff2Html.prototype.getPrettySideBySideHtmlFromDiff = function(diffInput, config) {
  5123. var cfg = utils.safeConfig(config, defaultConfig);
  5124. cfg.inputFormat = 'diff';
  5125. cfg.outputFormat = 'side-by-side';
  5126. return this.getPrettyHtml(diffInput, cfg);
  5127. };
  5128. /*
  5129. * Generates pretty side by side html from a json object
  5130. */
  5131. Diff2Html.prototype.getPrettySideBySideHtmlFromJson = function(diffJson, config) {
  5132. var cfg = utils.safeConfig(config, defaultConfig);
  5133. cfg.inputFormat = 'json';
  5134. cfg.outputFormat = 'side-by-side';
  5135. return this.getPrettyHtml(diffJson, cfg);
  5136. };
  5137. var diffObject = new Diff2Html();
  5138. module.exports.Diff2Html = diffObject;
  5139. // Expose diff2html in the browser
  5140. global.Diff2Html = diffObject;
  5141. })();
  5142. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  5143. },{"./diff-parser.js":103,"./html-printer.js":107,"./utils.js":113}],105:[function(require,module,exports){
  5144. /*
  5145. *
  5146. * FileListPrinter (file-list-printer.js)
  5147. * Author: nmatpt
  5148. *
  5149. */
  5150. (function() {
  5151. var printerUtils = require('./printer-utils.js').PrinterUtils;
  5152. var hoganUtils;
  5153. var baseTemplatesPath = 'file-summary';
  5154. var iconsBaseTemplatesPath = 'icon';
  5155. function FileListPrinter(config) {
  5156. this.config = config;
  5157. var HoganJsUtils = require('./hoganjs-utils.js').HoganJsUtils;
  5158. hoganUtils = new HoganJsUtils(config);
  5159. }
  5160. FileListPrinter.prototype.generateFileList = function(diffFiles) {
  5161. var lineTemplate = hoganUtils.template(baseTemplatesPath, 'line');
  5162. var files = diffFiles.map(function(file) {
  5163. var fileTypeName = printerUtils.getFileTypeIcon(file);
  5164. var iconTemplate = hoganUtils.template(iconsBaseTemplatesPath, fileTypeName);
  5165. return lineTemplate.render({
  5166. fileHtmlId: printerUtils.getHtmlId(file),
  5167. fileName: printerUtils.getDiffName(file),
  5168. deletedLines: '-' + file.deletedLines,
  5169. addedLines: '+' + file.addedLines
  5170. }, {
  5171. fileIcon: iconTemplate
  5172. });
  5173. }).join('\n');
  5174. return hoganUtils.render(baseTemplatesPath, 'wrapper', {
  5175. filesNumber: diffFiles.length,
  5176. files: files
  5177. });
  5178. };
  5179. module.exports.FileListPrinter = FileListPrinter;
  5180. })();
  5181. },{"./hoganjs-utils.js":106,"./printer-utils.js":109}],106:[function(require,module,exports){
  5182. (function (__dirname){
  5183. /*
  5184. *
  5185. * Utils (hoganjs-utils.js)
  5186. * Author: rtfpessoa
  5187. *
  5188. */
  5189. (function() {
  5190. var fs = require('fs');
  5191. var path = require('path');
  5192. var hogan = require('hogan.js');
  5193. var hoganTemplates = require('./templates/diff2html-templates.js');
  5194. var extraTemplates;
  5195. function HoganJsUtils(configuration) {
  5196. this.config = configuration || {};
  5197. extraTemplates = this.config.templates || {};
  5198. var rawTemplates = this.config.rawTemplates || {};
  5199. for (var templateName in rawTemplates) {
  5200. if (rawTemplates.hasOwnProperty(templateName)) {
  5201. if (!extraTemplates[templateName]) extraTemplates[templateName] = this.compile(rawTemplates[templateName]);
  5202. }
  5203. }
  5204. }
  5205. HoganJsUtils.prototype.render = function(namespace, view, params) {
  5206. var template = this.template(namespace, view);
  5207. if (template) {
  5208. return template.render(params);
  5209. }
  5210. return null;
  5211. };
  5212. HoganJsUtils.prototype.template = function(namespace, view) {
  5213. var templateKey = this._templateKey(namespace, view);
  5214. return this._getTemplate(templateKey);
  5215. };
  5216. HoganJsUtils.prototype._getTemplate = function(templateKey) {
  5217. var template;
  5218. if (!this.config.noCache) {
  5219. template = this._readFromCache(templateKey);
  5220. }
  5221. if (!template) {
  5222. template = this._loadTemplate(templateKey);
  5223. }
  5224. return template;
  5225. };
  5226. HoganJsUtils.prototype._loadTemplate = function(templateKey) {
  5227. var template;
  5228. try {
  5229. if (fs.readFileSync) {
  5230. var templatesPath = path.resolve(__dirname, 'templates');
  5231. var templatePath = path.join(templatesPath, templateKey);
  5232. var templateContent = fs.readFileSync(templatePath + '.mustache', 'utf8');
  5233. template = hogan.compile(templateContent);
  5234. hoganTemplates[templateKey] = template;
  5235. }
  5236. } catch (e) {
  5237. console.error('Failed to read (template: ' + templateKey + ') from fs: ' + e.message);
  5238. }
  5239. return template;
  5240. };
  5241. HoganJsUtils.prototype._readFromCache = function(templateKey) {
  5242. return extraTemplates[templateKey] || hoganTemplates[templateKey];
  5243. };
  5244. HoganJsUtils.prototype._templateKey = function(namespace, view) {
  5245. return namespace + '-' + view;
  5246. };
  5247. HoganJsUtils.prototype.compile = function(templateStr) {
  5248. return hogan.compile(templateStr);
  5249. };
  5250. module.exports.HoganJsUtils = HoganJsUtils;
  5251. })();
  5252. }).call(this,"/src")
  5253. },{"./templates/diff2html-templates.js":112,"fs":1,"hogan.js":4,"path":101}],107:[function(require,module,exports){
  5254. /*
  5255. *
  5256. * HtmlPrinter (html-printer.js)
  5257. * Author: rtfpessoa
  5258. *
  5259. */
  5260. (function() {
  5261. var LineByLinePrinter = require('./line-by-line-printer.js').LineByLinePrinter;
  5262. var SideBySidePrinter = require('./side-by-side-printer.js').SideBySidePrinter;
  5263. var FileListPrinter = require('./file-list-printer.js').FileListPrinter;
  5264. function HtmlPrinter() {
  5265. }
  5266. HtmlPrinter.prototype.generateLineByLineJsonHtml = function(diffFiles, config) {
  5267. var lineByLinePrinter = new LineByLinePrinter(config);
  5268. return lineByLinePrinter.generateLineByLineJsonHtml(diffFiles);
  5269. };
  5270. HtmlPrinter.prototype.generateSideBySideJsonHtml = function(diffFiles, config) {
  5271. var sideBySidePrinter = new SideBySidePrinter(config);
  5272. return sideBySidePrinter.generateSideBySideJsonHtml(diffFiles);
  5273. };
  5274. HtmlPrinter.prototype.generateFileListSummary = function(diffJson, config) {
  5275. var fileListPrinter = new FileListPrinter(config);
  5276. return fileListPrinter.generateFileList(diffJson);
  5277. };
  5278. module.exports.HtmlPrinter = new HtmlPrinter();
  5279. })();
  5280. },{"./file-list-printer.js":105,"./line-by-line-printer.js":108,"./side-by-side-printer.js":111}],108:[function(require,module,exports){
  5281. /*
  5282. *
  5283. * LineByLinePrinter (line-by-line-printer.js)
  5284. * Author: rtfpessoa
  5285. *
  5286. */
  5287. (function() {
  5288. var diffParser = require('./diff-parser.js').DiffParser;
  5289. var printerUtils = require('./printer-utils.js').PrinterUtils;
  5290. var utils = require('./utils.js').Utils;
  5291. var Rematch = require('./rematch.js').Rematch;
  5292. var hoganUtils;
  5293. var genericTemplatesPath = 'generic';
  5294. var baseTemplatesPath = 'line-by-line';
  5295. var iconsBaseTemplatesPath = 'icon';
  5296. var tagsBaseTemplatesPath = 'tag';
  5297. function LineByLinePrinter(config) {
  5298. this.config = config;
  5299. var HoganJsUtils = require('./hoganjs-utils.js').HoganJsUtils;
  5300. hoganUtils = new HoganJsUtils(config);
  5301. }
  5302. LineByLinePrinter.prototype.makeFileDiffHtml = function(file, diffs) {
  5303. var fileDiffTemplate = hoganUtils.template(baseTemplatesPath, 'file-diff');
  5304. var filePathTemplate = hoganUtils.template(genericTemplatesPath, 'file-path');
  5305. var fileIconTemplate = hoganUtils.template(iconsBaseTemplatesPath, 'file');
  5306. var fileTagTemplate = hoganUtils.template(tagsBaseTemplatesPath, printerUtils.getFileTypeIcon(file));
  5307. return fileDiffTemplate.render({
  5308. file: file,
  5309. fileHtmlId: printerUtils.getHtmlId(file),
  5310. diffs: diffs,
  5311. filePath: filePathTemplate.render({
  5312. fileDiffName: printerUtils.getDiffName(file)
  5313. }, {
  5314. fileIcon: fileIconTemplate,
  5315. fileTag: fileTagTemplate
  5316. })
  5317. });
  5318. };
  5319. LineByLinePrinter.prototype.makeLineByLineHtmlWrapper = function(content) {
  5320. return hoganUtils.render(genericTemplatesPath, 'wrapper', {'content': content});
  5321. };
  5322. LineByLinePrinter.prototype.generateLineByLineJsonHtml = function(diffFiles) {
  5323. var that = this;
  5324. var htmlDiffs = diffFiles.map(function(file) {
  5325. var diffs;
  5326. if (file.blocks.length) {
  5327. diffs = that._generateFileHtml(file);
  5328. } else {
  5329. diffs = that._generateEmptyDiff();
  5330. }
  5331. return that.makeFileDiffHtml(file, diffs);
  5332. });
  5333. return this.makeLineByLineHtmlWrapper(htmlDiffs.join('\n'));
  5334. };
  5335. var matcher = Rematch.rematch(function(a, b) {
  5336. var amod = a.content.substr(1);
  5337. var bmod = b.content.substr(1);
  5338. return Rematch.distance(amod, bmod);
  5339. });
  5340. LineByLinePrinter.prototype.makeColumnLineNumberHtml = function(block) {
  5341. return hoganUtils.render(genericTemplatesPath, 'column-line-number', {
  5342. diffParser: diffParser,
  5343. blockHeader: utils.escape(block.header),
  5344. lineClass: 'd2h-code-linenumber',
  5345. contentClass: 'd2h-code-line'
  5346. });
  5347. };
  5348. LineByLinePrinter.prototype._generateFileHtml = function(file) {
  5349. var that = this;
  5350. return file.blocks.map(function(block) {
  5351. var lines = that.makeColumnLineNumberHtml(block);
  5352. var oldLines = [];
  5353. var newLines = [];
  5354. function processChangeBlock() {
  5355. var matches;
  5356. var insertType;
  5357. var deleteType;
  5358. var comparisons = oldLines.length * newLines.length;
  5359. var maxComparisons = that.config.matchingMaxComparisons || 2500;
  5360. var doMatching = comparisons < maxComparisons && (that.config.matching === 'lines' ||
  5361. that.config.matching === 'words');
  5362. if (doMatching) {
  5363. matches = matcher(oldLines, newLines);
  5364. insertType = diffParser.LINE_TYPE.INSERT_CHANGES;
  5365. deleteType = diffParser.LINE_TYPE.DELETE_CHANGES;
  5366. } else {
  5367. matches = [[oldLines, newLines]];
  5368. insertType = diffParser.LINE_TYPE.INSERTS;
  5369. deleteType = diffParser.LINE_TYPE.DELETES;
  5370. }
  5371. matches.forEach(function(match) {
  5372. oldLines = match[0];
  5373. newLines = match[1];
  5374. var processedOldLines = [];
  5375. var processedNewLines = [];
  5376. var common = Math.min(oldLines.length, newLines.length);
  5377. var oldLine, newLine;
  5378. for (var j = 0; j < common; j++) {
  5379. oldLine = oldLines[j];
  5380. newLine = newLines[j];
  5381. that.config.isCombined = file.isCombined;
  5382. var diff = printerUtils.diffHighlight(oldLine.content, newLine.content, that.config);
  5383. processedOldLines +=
  5384. that.makeLineHtml(file.isCombined, deleteType, oldLine.oldNumber, oldLine.newNumber,
  5385. diff.first.line, diff.first.prefix);
  5386. processedNewLines +=
  5387. that.makeLineHtml(file.isCombined, insertType, newLine.oldNumber, newLine.newNumber,
  5388. diff.second.line, diff.second.prefix);
  5389. }
  5390. lines += processedOldLines + processedNewLines;
  5391. lines += that._processLines(file.isCombined, oldLines.slice(common), newLines.slice(common));
  5392. });
  5393. oldLines = [];
  5394. newLines = [];
  5395. }
  5396. for (var i = 0; i < block.lines.length; i++) {
  5397. var line = block.lines[i];
  5398. var escapedLine = utils.escape(line.content);
  5399. if (line.type !== diffParser.LINE_TYPE.INSERTS &&
  5400. (newLines.length > 0 || (line.type !== diffParser.LINE_TYPE.DELETES && oldLines.length > 0))) {
  5401. processChangeBlock();
  5402. }
  5403. if (line.type === diffParser.LINE_TYPE.CONTEXT) {
  5404. lines += that.makeLineHtml(file.isCombined, line.type, line.oldNumber, line.newNumber, escapedLine);
  5405. } else if (line.type === diffParser.LINE_TYPE.INSERTS && !oldLines.length) {
  5406. lines += that.makeLineHtml(file.isCombined, line.type, line.oldNumber, line.newNumber, escapedLine);
  5407. } else if (line.type === diffParser.LINE_TYPE.DELETES) {
  5408. oldLines.push(line);
  5409. } else if (line.type === diffParser.LINE_TYPE.INSERTS && Boolean(oldLines.length)) {
  5410. newLines.push(line);
  5411. } else {
  5412. console.error('Unknown state in html line-by-line generator');
  5413. processChangeBlock();
  5414. }
  5415. }
  5416. processChangeBlock();
  5417. return lines;
  5418. }).join('\n');
  5419. };
  5420. LineByLinePrinter.prototype._processLines = function(isCombined, oldLines, newLines) {
  5421. var lines = '';
  5422. for (var i = 0; i < oldLines.length; i++) {
  5423. var oldLine = oldLines[i];
  5424. var oldEscapedLine = utils.escape(oldLine.content);
  5425. lines += this.makeLineHtml(isCombined, oldLine.type, oldLine.oldNumber, oldLine.newNumber, oldEscapedLine);
  5426. }
  5427. for (var j = 0; j < newLines.length; j++) {
  5428. var newLine = newLines[j];
  5429. var newEscapedLine = utils.escape(newLine.content);
  5430. lines += this.makeLineHtml(isCombined, newLine.type, newLine.oldNumber, newLine.newNumber, newEscapedLine);
  5431. }
  5432. return lines;
  5433. };
  5434. LineByLinePrinter.prototype.makeLineHtml = function(isCombined, type, oldNumber, newNumber, content, possiblePrefix) {
  5435. var lineNumberTemplate = hoganUtils.render(baseTemplatesPath, 'numbers', {
  5436. oldNumber: utils.valueOrEmpty(oldNumber),
  5437. newNumber: utils.valueOrEmpty(newNumber)
  5438. });
  5439. var lineWithoutPrefix = content;
  5440. var prefix = possiblePrefix;
  5441. if (!prefix) {
  5442. var lineWithPrefix = printerUtils.separatePrefix(isCombined, content);
  5443. prefix = lineWithPrefix.prefix;
  5444. lineWithoutPrefix = lineWithPrefix.line;
  5445. }
  5446. return hoganUtils.render(genericTemplatesPath, 'line',
  5447. {
  5448. type: type,
  5449. lineClass: 'd2h-code-linenumber',
  5450. contentClass: 'd2h-code-line',
  5451. prefix: prefix,
  5452. content: lineWithoutPrefix,
  5453. lineNumber: lineNumberTemplate
  5454. });
  5455. };
  5456. LineByLinePrinter.prototype._generateEmptyDiff = function() {
  5457. return hoganUtils.render(genericTemplatesPath, 'empty-diff', {
  5458. contentClass: 'd2h-code-line',
  5459. diffParser: diffParser
  5460. });
  5461. };
  5462. module.exports.LineByLinePrinter = LineByLinePrinter;
  5463. })();
  5464. },{"./diff-parser.js":103,"./hoganjs-utils.js":106,"./printer-utils.js":109,"./rematch.js":110,"./utils.js":113}],109:[function(require,module,exports){
  5465. /*
  5466. *
  5467. * PrinterUtils (printer-utils.js)
  5468. * Author: rtfpessoa
  5469. *
  5470. */
  5471. (function() {
  5472. var jsDiff = require('diff');
  5473. var utils = require('./utils.js').Utils;
  5474. var Rematch = require('./rematch.js').Rematch;
  5475. var separator = '/';
  5476. function PrinterUtils() {
  5477. }
  5478. PrinterUtils.prototype.separatePrefix = function(isCombined, line) {
  5479. var prefix;
  5480. var lineWithoutPrefix;
  5481. if (isCombined) {
  5482. prefix = line.substring(0, 2);
  5483. lineWithoutPrefix = line.substring(2);
  5484. } else {
  5485. prefix = line.substring(0, 1);
  5486. lineWithoutPrefix = line.substring(1);
  5487. }
  5488. return {
  5489. 'prefix': prefix,
  5490. 'line': lineWithoutPrefix
  5491. };
  5492. };
  5493. PrinterUtils.prototype.getHtmlId = function(file) {
  5494. var hashCode = function(text) {
  5495. var i, chr, len;
  5496. var hash = 0;
  5497. for (i = 0, len = text.length; i < len; i++) {
  5498. chr = text.charCodeAt(i);
  5499. hash = ((hash << 5) - hash) + chr;
  5500. hash |= 0; // Convert to 32bit integer
  5501. }
  5502. return hash;
  5503. };
  5504. return 'd2h-' + hashCode(this.getDiffName(file)).toString().slice(-6);
  5505. };
  5506. PrinterUtils.prototype.getDiffName = function(file) {
  5507. var oldFilename = unifyPath(file.oldName);
  5508. var newFilename = unifyPath(file.newName);
  5509. if (oldFilename && newFilename && oldFilename !== newFilename && !isDevNullName(oldFilename) && !isDevNullName(newFilename)) {
  5510. var prefixPaths = [];
  5511. var suffixPaths = [];
  5512. var oldFilenameParts = oldFilename.split(separator);
  5513. var newFilenameParts = newFilename.split(separator);
  5514. var oldFilenamePartsSize = oldFilenameParts.length;
  5515. var newFilenamePartsSize = newFilenameParts.length;
  5516. var i = 0;
  5517. var j = oldFilenamePartsSize - 1;
  5518. var k = newFilenamePartsSize - 1;
  5519. while (i < j && i < k) {
  5520. if (oldFilenameParts[i] === newFilenameParts[i]) {
  5521. prefixPaths.push(newFilenameParts[i]);
  5522. i += 1;
  5523. } else {
  5524. break;
  5525. }
  5526. }
  5527. while (j > i && k > i) {
  5528. if (oldFilenameParts[j] === newFilenameParts[k]) {
  5529. suffixPaths.unshift(newFilenameParts[k]);
  5530. j -= 1;
  5531. k -= 1;
  5532. } else {
  5533. break;
  5534. }
  5535. }
  5536. var finalPrefix = prefixPaths.join(separator);
  5537. var finalSuffix = suffixPaths.join(separator);
  5538. var oldRemainingPath = oldFilenameParts.slice(i, j + 1).join(separator);
  5539. var newRemainingPath = newFilenameParts.slice(i, k + 1).join(separator);
  5540. if (finalPrefix.length && finalSuffix.length) {
  5541. return finalPrefix + separator + '{' + oldRemainingPath + ' → ' + newRemainingPath + '}' + separator + finalSuffix;
  5542. } else if (finalPrefix.length) {
  5543. return finalPrefix + separator + '{' + oldRemainingPath + ' → ' + newRemainingPath + '}';
  5544. } else if (finalSuffix.length) {
  5545. return '{' + oldRemainingPath + ' → ' + newRemainingPath + '}' + separator + finalSuffix;
  5546. }
  5547. return oldFilename + ' → ' + newFilename;
  5548. } else if (newFilename && !isDevNullName(newFilename)) {
  5549. return newFilename;
  5550. } else if (oldFilename) {
  5551. return oldFilename;
  5552. }
  5553. return 'unknown/file/path';
  5554. };
  5555. PrinterUtils.prototype.getFileTypeIcon = function(file) {
  5556. var templateName = 'file-changed';
  5557. if (file.isRename) {
  5558. templateName = 'file-renamed';
  5559. } else if (file.isCopy) {
  5560. templateName = 'file-renamed';
  5561. } else if (file.isNew) {
  5562. templateName = 'file-added';
  5563. } else if (file.isDeleted) {
  5564. templateName = 'file-deleted';
  5565. } else if (file.newName !== file.oldName) {
  5566. // If file is not Added, not Deleted and the names changed it must be a rename :)
  5567. templateName = 'file-renamed';
  5568. }
  5569. return templateName;
  5570. };
  5571. PrinterUtils.prototype.diffHighlight = function(diffLine1, diffLine2, config) {
  5572. var linePrefix1, linePrefix2, unprefixedLine1, unprefixedLine2;
  5573. var prefixSize = 1;
  5574. if (config.isCombined) {
  5575. prefixSize = 2;
  5576. }
  5577. linePrefix1 = diffLine1.substr(0, prefixSize);
  5578. linePrefix2 = diffLine2.substr(0, prefixSize);
  5579. unprefixedLine1 = diffLine1.substr(prefixSize);
  5580. unprefixedLine2 = diffLine2.substr(prefixSize);
  5581. if (unprefixedLine1.length > config.maxLineLengthHighlight ||
  5582. unprefixedLine2.length > config.maxLineLengthHighlight) {
  5583. return {
  5584. first: {
  5585. prefix: linePrefix1,
  5586. line: utils.escape(unprefixedLine1)
  5587. },
  5588. second: {
  5589. prefix: linePrefix2,
  5590. line: utils.escape(unprefixedLine2)
  5591. }
  5592. };
  5593. }
  5594. var diff;
  5595. if (config.charByChar) {
  5596. diff = jsDiff.diffChars(unprefixedLine1, unprefixedLine2);
  5597. } else {
  5598. diff = jsDiff.diffWordsWithSpace(unprefixedLine1, unprefixedLine2);
  5599. }
  5600. var highlightedLine = '';
  5601. var changedWords = [];
  5602. if (!config.charByChar && config.matching === 'words') {
  5603. var treshold = 0.25;
  5604. if (typeof (config.matchWordsThreshold) !== 'undefined') {
  5605. treshold = config.matchWordsThreshold;
  5606. }
  5607. var matcher = Rematch.rematch(function(a, b) {
  5608. var amod = a.value;
  5609. var bmod = b.value;
  5610. return Rematch.distance(amod, bmod);
  5611. });
  5612. var removed = diff.filter(function isRemoved(element) {
  5613. return element.removed;
  5614. });
  5615. var added = diff.filter(function isAdded(element) {
  5616. return element.added;
  5617. });
  5618. var chunks = matcher(added, removed);
  5619. chunks.forEach(function(chunk) {
  5620. if (chunk[0].length === 1 && chunk[1].length === 1) {
  5621. var dist = Rematch.distance(chunk[0][0].value, chunk[1][0].value);
  5622. if (dist < treshold) {
  5623. changedWords.push(chunk[0][0]);
  5624. changedWords.push(chunk[1][0]);
  5625. }
  5626. }
  5627. });
  5628. }
  5629. diff.forEach(function(part) {
  5630. var addClass = changedWords.indexOf(part) > -1 ? ' class="d2h-change"' : '';
  5631. var elemType = part.added ? 'ins' : part.removed ? 'del' : null;
  5632. var escapedValue = utils.escape(part.value);
  5633. if (elemType !== null) {
  5634. highlightedLine += '<' + elemType + addClass + '>' + escapedValue + '</' + elemType + '>';
  5635. } else {
  5636. highlightedLine += escapedValue;
  5637. }
  5638. });
  5639. return {
  5640. first: {
  5641. prefix: linePrefix1,
  5642. line: removeIns(highlightedLine)
  5643. },
  5644. second: {
  5645. prefix: linePrefix2,
  5646. line: removeDel(highlightedLine)
  5647. }
  5648. };
  5649. };
  5650. function unifyPath(path) {
  5651. if (path) {
  5652. return path.replace('\\', '/');
  5653. }
  5654. return path;
  5655. }
  5656. function isDevNullName(name) {
  5657. return name.indexOf('dev/null') !== -1;
  5658. }
  5659. function removeIns(line) {
  5660. return line.replace(/(<ins[^>]*>((.|\n)*?)<\/ins>)/g, '');
  5661. }
  5662. function removeDel(line) {
  5663. return line.replace(/(<del[^>]*>((.|\n)*?)<\/del>)/g, '');
  5664. }
  5665. module.exports.PrinterUtils = new PrinterUtils();
  5666. })();
  5667. },{"./rematch.js":110,"./utils.js":113,"diff":2}],110:[function(require,module,exports){
  5668. /*
  5669. *
  5670. * Rematch (rematch.js)
  5671. * Matching two sequences of objects by similarity
  5672. * Author: W. Illmeyer, Nexxar GmbH
  5673. *
  5674. */
  5675. (function() {
  5676. var Rematch = {};
  5677. /*
  5678. Copyright (c) 2011 Andrei Mackenzie
  5679. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
  5680. documentation files (the "Software"), to deal in the Software without restriction, including without limitation
  5681. the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
  5682. and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
  5683. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
  5684. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  5685. THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  5686. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  5687. TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  5688. */
  5689. function levenshtein(a, b) {
  5690. if (a.length === 0) {
  5691. return b.length;
  5692. }
  5693. if (b.length === 0) {
  5694. return a.length;
  5695. }
  5696. var matrix = [];
  5697. // Increment along the first column of each row
  5698. var i;
  5699. for (i = 0; i <= b.length; i++) {
  5700. matrix[i] = [i];
  5701. }
  5702. // Increment each column in the first row
  5703. var j;
  5704. for (j = 0; j <= a.length; j++) {
  5705. matrix[0][j] = j;
  5706. }
  5707. // Fill in the rest of the matrix
  5708. for (i = 1; i <= b.length; i++) {
  5709. for (j = 1; j <= a.length; j++) {
  5710. if (b.charAt(i - 1) === a.charAt(j - 1)) {
  5711. matrix[i][j] = matrix[i - 1][j - 1];
  5712. } else {
  5713. matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // Substitution
  5714. Math.min(matrix[i][j - 1] + 1, // Insertion
  5715. matrix[i - 1][j] + 1)); // Deletion
  5716. }
  5717. }
  5718. }
  5719. return matrix[b.length][a.length];
  5720. }
  5721. Rematch.levenshtein = levenshtein;
  5722. Rematch.distance = function distance(x, y) {
  5723. x = x.trim();
  5724. y = y.trim();
  5725. var lev = levenshtein(x, y);
  5726. var score = lev / (x.length + y.length);
  5727. return score;
  5728. };
  5729. Rematch.rematch = function rematch(distanceFunction) {
  5730. function findBestMatch(a, b, cache) {
  5731. var bestMatchDist = Infinity;
  5732. var bestMatch;
  5733. for (var i = 0; i < a.length; ++i) {
  5734. for (var j = 0; j < b.length; ++j) {
  5735. var cacheKey = JSON.stringify([a[i], b[j]]);
  5736. var md;
  5737. if (cache.hasOwnProperty(cacheKey)) {
  5738. md = cache[cacheKey];
  5739. } else {
  5740. md = distanceFunction(a[i], b[j]);
  5741. cache[cacheKey] = md;
  5742. }
  5743. if (md < bestMatchDist) {
  5744. bestMatchDist = md;
  5745. bestMatch = {indexA: i, indexB: j, score: bestMatchDist};
  5746. }
  5747. }
  5748. }
  5749. return bestMatch;
  5750. }
  5751. function group(a, b, level, cache) {
  5752. if (typeof (cache) === 'undefined') {
  5753. cache = {};
  5754. }
  5755. var bm = findBestMatch(a, b, cache);
  5756. if (!level) {
  5757. level = 0;
  5758. }
  5759. if (!bm || (a.length + b.length < 3)) {
  5760. return [[a, b]];
  5761. }
  5762. var a1 = a.slice(0, bm.indexA);
  5763. var b1 = b.slice(0, bm.indexB);
  5764. var aMatch = [a[bm.indexA]];
  5765. var bMatch = [b[bm.indexB]];
  5766. var tailA = bm.indexA + 1;
  5767. var tailB = bm.indexB + 1;
  5768. var a2 = a.slice(tailA);
  5769. var b2 = b.slice(tailB);
  5770. var group1 = group(a1, b1, level + 1, cache);
  5771. var groupMatch = group(aMatch, bMatch, level + 1, cache);
  5772. var group2 = group(a2, b2, level + 1, cache);
  5773. var result = groupMatch;
  5774. if (bm.indexA > 0 || bm.indexB > 0) {
  5775. result = group1.concat(result);
  5776. }
  5777. if (a.length > tailA || b.length > tailB) {
  5778. result = result.concat(group2);
  5779. }
  5780. return result;
  5781. }
  5782. return group;
  5783. };
  5784. module.exports.Rematch = Rematch;
  5785. })();
  5786. },{}],111:[function(require,module,exports){
  5787. /*
  5788. *
  5789. * HtmlPrinter (html-printer.js)
  5790. * Author: rtfpessoa
  5791. *
  5792. */
  5793. (function() {
  5794. var diffParser = require('./diff-parser.js').DiffParser;
  5795. var printerUtils = require('./printer-utils.js').PrinterUtils;
  5796. var utils = require('./utils.js').Utils;
  5797. var Rematch = require('./rematch.js').Rematch;
  5798. var hoganUtils;
  5799. var genericTemplatesPath = 'generic';
  5800. var baseTemplatesPath = 'side-by-side';
  5801. var iconsBaseTemplatesPath = 'icon';
  5802. var tagsBaseTemplatesPath = 'tag';
  5803. var matcher = Rematch.rematch(function(a, b) {
  5804. var amod = a.content.substr(1);
  5805. var bmod = b.content.substr(1);
  5806. return Rematch.distance(amod, bmod);
  5807. });
  5808. function SideBySidePrinter(config) {
  5809. this.config = config;
  5810. var HoganJsUtils = require('./hoganjs-utils.js').HoganJsUtils;
  5811. hoganUtils = new HoganJsUtils(config);
  5812. }
  5813. SideBySidePrinter.prototype.makeDiffHtml = function(file, diffs) {
  5814. var fileDiffTemplate = hoganUtils.template(baseTemplatesPath, 'file-diff');
  5815. var filePathTemplate = hoganUtils.template(genericTemplatesPath, 'file-path');
  5816. var fileIconTemplate = hoganUtils.template(iconsBaseTemplatesPath, 'file');
  5817. var fileTagTemplate = hoganUtils.template(tagsBaseTemplatesPath, printerUtils.getFileTypeIcon(file));
  5818. return fileDiffTemplate.render({
  5819. file: file,
  5820. fileHtmlId: printerUtils.getHtmlId(file),
  5821. diffs: diffs,
  5822. filePath: filePathTemplate.render({
  5823. fileDiffName: printerUtils.getDiffName(file)
  5824. }, {
  5825. fileIcon: fileIconTemplate,
  5826. fileTag: fileTagTemplate
  5827. })
  5828. });
  5829. };
  5830. SideBySidePrinter.prototype.generateSideBySideJsonHtml = function(diffFiles) {
  5831. var that = this;
  5832. var content = diffFiles.map(function(file) {
  5833. var diffs;
  5834. if (file.blocks.length) {
  5835. diffs = that.generateSideBySideFileHtml(file);
  5836. } else {
  5837. diffs = that.generateEmptyDiff();
  5838. }
  5839. return that.makeDiffHtml(file, diffs);
  5840. }).join('\n');
  5841. return hoganUtils.render(genericTemplatesPath, 'wrapper', {'content': content});
  5842. };
  5843. SideBySidePrinter.prototype.makeSideHtml = function(blockHeader) {
  5844. return hoganUtils.render(genericTemplatesPath, 'column-line-number', {
  5845. diffParser: diffParser,
  5846. blockHeader: utils.escape(blockHeader),
  5847. lineClass: 'd2h-code-side-linenumber',
  5848. contentClass: 'd2h-code-side-line'
  5849. });
  5850. };
  5851. SideBySidePrinter.prototype.generateSideBySideFileHtml = function(file) {
  5852. var that = this;
  5853. var fileHtml = {};
  5854. fileHtml.left = '';
  5855. fileHtml.right = '';
  5856. file.blocks.forEach(function(block) {
  5857. fileHtml.left += that.makeSideHtml(block.header);
  5858. fileHtml.right += that.makeSideHtml('');
  5859. var oldLines = [];
  5860. var newLines = [];
  5861. function processChangeBlock() {
  5862. var matches;
  5863. var insertType;
  5864. var deleteType;
  5865. var comparisons = oldLines.length * newLines.length;
  5866. var maxComparisons = that.config.matchingMaxComparisons || 2500;
  5867. var doMatching = comparisons < maxComparisons && (that.config.matching === 'lines' ||
  5868. that.config.matching === 'words');
  5869. if (doMatching) {
  5870. matches = matcher(oldLines, newLines);
  5871. insertType = diffParser.LINE_TYPE.INSERT_CHANGES;
  5872. deleteType = diffParser.LINE_TYPE.DELETE_CHANGES;
  5873. } else {
  5874. matches = [[oldLines, newLines]];
  5875. insertType = diffParser.LINE_TYPE.INSERTS;
  5876. deleteType = diffParser.LINE_TYPE.DELETES;
  5877. }
  5878. matches.forEach(function(match) {
  5879. oldLines = match[0];
  5880. newLines = match[1];
  5881. var common = Math.min(oldLines.length, newLines.length);
  5882. var max = Math.max(oldLines.length, newLines.length);
  5883. for (var j = 0; j < common; j++) {
  5884. var oldLine = oldLines[j];
  5885. var newLine = newLines[j];
  5886. that.config.isCombined = file.isCombined;
  5887. var diff = printerUtils.diffHighlight(oldLine.content, newLine.content, that.config);
  5888. fileHtml.left +=
  5889. that.generateSingleLineHtml(file.isCombined, deleteType, oldLine.oldNumber,
  5890. diff.first.line, diff.first.prefix);
  5891. fileHtml.right +=
  5892. that.generateSingleLineHtml(file.isCombined, insertType, newLine.newNumber,
  5893. diff.second.line, diff.second.prefix);
  5894. }
  5895. if (max > common) {
  5896. var oldSlice = oldLines.slice(common);
  5897. var newSlice = newLines.slice(common);
  5898. var tmpHtml = that.processLines(file.isCombined, oldSlice, newSlice);
  5899. fileHtml.left += tmpHtml.left;
  5900. fileHtml.right += tmpHtml.right;
  5901. }
  5902. });
  5903. oldLines = [];
  5904. newLines = [];
  5905. }
  5906. for (var i = 0; i < block.lines.length; i++) {
  5907. var line = block.lines[i];
  5908. var prefix = line.content[0];
  5909. var escapedLine = utils.escape(line.content.substr(1));
  5910. if (line.type !== diffParser.LINE_TYPE.INSERTS &&
  5911. (newLines.length > 0 || (line.type !== diffParser.LINE_TYPE.DELETES && oldLines.length > 0))) {
  5912. processChangeBlock();
  5913. }
  5914. if (line.type === diffParser.LINE_TYPE.CONTEXT) {
  5915. fileHtml.left += that.generateSingleLineHtml(file.isCombined, line.type, line.oldNumber, escapedLine, prefix);
  5916. fileHtml.right += that.generateSingleLineHtml(file.isCombined, line.type, line.newNumber, escapedLine, prefix);
  5917. } else if (line.type === diffParser.LINE_TYPE.INSERTS && !oldLines.length) {
  5918. fileHtml.left += that.generateSingleLineHtml(file.isCombined, diffParser.LINE_TYPE.CONTEXT, '', '', '');
  5919. fileHtml.right += that.generateSingleLineHtml(file.isCombined, line.type, line.newNumber, escapedLine, prefix);
  5920. } else if (line.type === diffParser.LINE_TYPE.DELETES) {
  5921. oldLines.push(line);
  5922. } else if (line.type === diffParser.LINE_TYPE.INSERTS && Boolean(oldLines.length)) {
  5923. newLines.push(line);
  5924. } else {
  5925. console.error('unknown state in html side-by-side generator');
  5926. processChangeBlock();
  5927. }
  5928. }
  5929. processChangeBlock();
  5930. });
  5931. return fileHtml;
  5932. };
  5933. SideBySidePrinter.prototype.processLines = function(isCombined, oldLines, newLines) {
  5934. var that = this;
  5935. var fileHtml = {};
  5936. fileHtml.left = '';
  5937. fileHtml.right = '';
  5938. var maxLinesNumber = Math.max(oldLines.length, newLines.length);
  5939. for (var i = 0; i < maxLinesNumber; i++) {
  5940. var oldLine = oldLines[i];
  5941. var newLine = newLines[i];
  5942. var oldContent;
  5943. var newContent;
  5944. var oldPrefix;
  5945. var newPrefix;
  5946. if (oldLine) {
  5947. oldContent = utils.escape(oldLine.content.substr(1));
  5948. oldPrefix = oldLine.content[0];
  5949. }
  5950. if (newLine) {
  5951. newContent = utils.escape(newLine.content.substr(1));
  5952. newPrefix = newLine.content[0];
  5953. }
  5954. if (oldLine && newLine) {
  5955. fileHtml.left += that.generateSingleLineHtml(isCombined, oldLine.type, oldLine.oldNumber, oldContent, oldPrefix);
  5956. fileHtml.right += that.generateSingleLineHtml(isCombined, newLine.type, newLine.newNumber, newContent, newPrefix);
  5957. } else if (oldLine) {
  5958. fileHtml.left += that.generateSingleLineHtml(isCombined, oldLine.type, oldLine.oldNumber, oldContent, oldPrefix);
  5959. fileHtml.right += that.generateSingleLineHtml(isCombined, diffParser.LINE_TYPE.CONTEXT, '', '', '');
  5960. } else if (newLine) {
  5961. fileHtml.left += that.generateSingleLineHtml(isCombined, diffParser.LINE_TYPE.CONTEXT, '', '', '');
  5962. fileHtml.right += that.generateSingleLineHtml(isCombined, newLine.type, newLine.newNumber, newContent, newPrefix);
  5963. } else {
  5964. console.error('How did it get here?');
  5965. }
  5966. }
  5967. return fileHtml;
  5968. };
  5969. SideBySidePrinter.prototype.generateSingleLineHtml = function(isCombined, type, number, content, possiblePrefix) {
  5970. var lineWithoutPrefix = content;
  5971. var prefix = possiblePrefix;
  5972. if (!prefix) {
  5973. var lineWithPrefix = printerUtils.separatePrefix(isCombined, content);
  5974. prefix = lineWithPrefix.prefix;
  5975. lineWithoutPrefix = lineWithPrefix.line;
  5976. }
  5977. return hoganUtils.render(genericTemplatesPath, 'line',
  5978. {
  5979. type: type,
  5980. lineClass: 'd2h-code-side-linenumber',
  5981. contentClass: 'd2h-code-side-line',
  5982. prefix: prefix,
  5983. content: lineWithoutPrefix,
  5984. lineNumber: number
  5985. });
  5986. };
  5987. SideBySidePrinter.prototype.generateEmptyDiff = function() {
  5988. var fileHtml = {};
  5989. fileHtml.right = '';
  5990. fileHtml.left = hoganUtils.render(genericTemplatesPath, 'empty-diff', {
  5991. contentClass: 'd2h-code-side-line',
  5992. diffParser: diffParser
  5993. });
  5994. return fileHtml;
  5995. };
  5996. module.exports.SideBySidePrinter = SideBySidePrinter;
  5997. })();
  5998. },{"./diff-parser.js":103,"./hoganjs-utils.js":106,"./printer-utils.js":109,"./rematch.js":110,"./utils.js":113}],112:[function(require,module,exports){
  5999. (function (global){
  6000. (function() {
  6001. if (!!!global.browserTemplates) global.browserTemplates = {};
  6002. var Hogan = require("hogan.js");global.browserTemplates["file-summary-line"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<li class=\"d2h-file-list-line\">");t.b("\n" + i);t.b(" <span class=\"d2h-file-name-wrapper\">");t.b("\n" + i);t.b(" <span>");t.b(t.rp("<fileIcon0",c,p,""));t.b("</span>");t.b("\n" + i);t.b(" <a href=\"#");t.b(t.v(t.f("fileHtmlId",c,p,0)));t.b("\" class=\"d2h-file-name\">");t.b(t.v(t.f("fileName",c,p,0)));t.b("</a>");t.b("\n" + i);t.b(" <span class=\"d2h-file-stats\">");t.b("\n" + i);t.b(" <span class=\"d2h-lines-added\">");t.b(t.v(t.f("addedLines",c,p,0)));t.b("</span>");t.b("\n" + i);t.b(" <span class=\"d2h-lines-deleted\">");t.b(t.v(t.f("deletedLines",c,p,0)));t.b("</span>");t.b("\n" + i);t.b(" </span>");t.b("\n" + i);t.b(" </span>");t.b("\n" + i);t.b("</li>");return t.fl(); },partials: {"<fileIcon0":{name:"fileIcon", partials: {}, subs: { }}}, subs: { }});
  6003. global.browserTemplates["file-summary-wrapper"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<div class=\"d2h-file-list-wrapper\">");t.b("\n" + i);t.b(" <div class=\"d2h-file-list-header\">");t.b("\n" + i);t.b(" <span class=\"d2h-file-list-title\">Files changed (");t.b(t.v(t.f("filesNumber",c,p,0)));t.b(")</span>");t.b("\n" + i);t.b(" <a class=\"d2h-file-switch d2h-hide\">hide</a>");t.b("\n" + i);t.b(" <a class=\"d2h-file-switch d2h-show\">show</a>");t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b(" <ol class=\"d2h-file-list\">");t.b("\n" + i);t.b(" ");t.b(t.t(t.f("files",c,p,0)));t.b("\n" + i);t.b(" </ol>");t.b("\n" + i);t.b("</div>");return t.fl(); },partials: {}, subs: { }});
  6004. global.browserTemplates["generic-column-line-number"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<tr>");t.b("\n" + i);t.b(" <td class=\"");t.b(t.v(t.f("lineClass",c,p,0)));t.b(" ");t.b(t.v(t.d("diffParser.LINE_TYPE.INFO",c,p,0)));t.b("\"></td>");t.b("\n" + i);t.b(" <td class=\"");t.b(t.v(t.d("diffParser.LINE_TYPE.INFO",c,p,0)));t.b("\">");t.b("\n" + i);t.b(" <div class=\"");t.b(t.v(t.f("contentClass",c,p,0)));t.b(" ");t.b(t.v(t.d("diffParser.LINE_TYPE.INFO",c,p,0)));t.b("\">");t.b(t.t(t.f("blockHeader",c,p,0)));t.b("</div>");t.b("\n" + i);t.b(" </td>");t.b("\n" + i);t.b("</tr>");return t.fl(); },partials: {}, subs: { }});
  6005. global.browserTemplates["generic-empty-diff"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<tr>");t.b("\n" + i);t.b(" <td class=\"");t.b(t.v(t.d("diffParser.LINE_TYPE.INFO",c,p,0)));t.b("\">");t.b("\n" + i);t.b(" <div class=\"");t.b(t.v(t.f("contentClass",c,p,0)));t.b(" ");t.b(t.v(t.d("diffParser.LINE_TYPE.INFO",c,p,0)));t.b("\">");t.b("\n" + i);t.b(" File without changes");t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b(" </td>");t.b("\n" + i);t.b("</tr>");return t.fl(); },partials: {}, subs: { }});
  6006. global.browserTemplates["generic-file-path"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<span class=\"d2h-file-name-wrapper\">");t.b("\n" + i);t.b(" <span class=\"d2h-icon-wrapper\">");t.b(t.rp("<fileIcon0",c,p,""));t.b("</span>");t.b("\n" + i);t.b(" <span class=\"d2h-file-name\">");t.b(t.v(t.f("fileDiffName",c,p,0)));t.b("</span>");t.b("\n" + i);t.b(t.rp("<fileTag1",c,p," "));t.b("</span>");return t.fl(); },partials: {"<fileIcon0":{name:"fileIcon", partials: {}, subs: { }},"<fileTag1":{name:"fileTag", partials: {}, subs: { }}}, subs: { }});
  6007. global.browserTemplates["generic-line"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<tr>");t.b("\n" + i);t.b(" <td class=\"");t.b(t.v(t.f("lineClass",c,p,0)));t.b(" ");t.b(t.v(t.f("type",c,p,0)));t.b("\">");t.b("\n" + i);t.b(" ");t.b(t.t(t.f("lineNumber",c,p,0)));t.b("\n" + i);t.b(" </td>");t.b("\n" + i);t.b(" <td class=\"");t.b(t.v(t.f("type",c,p,0)));t.b("\">");t.b("\n" + i);t.b(" <div class=\"");t.b(t.v(t.f("contentClass",c,p,0)));t.b(" ");t.b(t.v(t.f("type",c,p,0)));t.b("\">");t.b("\n" + i);if(t.s(t.f("prefix",c,p,1),c,p,0,171,247,"{{ }}")){t.rs(c,p,function(c,p,t){t.b(" <span class=\"d2h-code-line-prefix\">");t.b(t.t(t.f("prefix",c,p,0)));t.b("</span>");t.b("\n" + i);});c.pop();}if(t.s(t.f("content",c,p,1),c,p,0,279,353,"{{ }}")){t.rs(c,p,function(c,p,t){t.b(" <span class=\"d2h-code-line-ctn\">");t.b(t.t(t.f("content",c,p,0)));t.b("</span>");t.b("\n" + i);});c.pop();}t.b(" </div>");t.b("\n" + i);t.b(" </td>");t.b("\n" + i);t.b("</tr>");return t.fl(); },partials: {}, subs: { }});
  6008. global.browserTemplates["generic-wrapper"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<div class=\"d2h-wrapper\">");t.b("\n" + i);t.b(" ");t.b(t.t(t.f("content",c,p,0)));t.b("\n" + i);t.b("</div>");return t.fl(); },partials: {}, subs: { }});
  6009. global.browserTemplates["icon-file-added"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<svg aria-hidden=\"true\" class=\"d2h-icon d2h-added\" height=\"16\" title=\"added\" version=\"1.1\" viewBox=\"0 0 14 16\"");t.b("\n" + i);t.b(" width=\"14\">");t.b("\n" + i);t.b(" <path d=\"M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM6 9H3V7h3V4h2v3h3v2H8v3H6V9z\"></path>");t.b("\n" + i);t.b("</svg>");return t.fl(); },partials: {}, subs: { }});
  6010. global.browserTemplates["icon-file-changed"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<svg aria-hidden=\"true\" class=\"d2h-icon d2h-changed\" height=\"16\" title=\"modified\" version=\"1.1\"");t.b("\n" + i);t.b(" viewBox=\"0 0 14 16\" width=\"14\">");t.b("\n" + i);t.b(" <path d=\"M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM4 8c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3-3-1.34-3-3z\"></path>");t.b("\n" + i);t.b("</svg>");return t.fl(); },partials: {}, subs: { }});
  6011. global.browserTemplates["icon-file-deleted"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<svg aria-hidden=\"true\" class=\"d2h-icon d2h-deleted\" height=\"16\" title=\"removed\" version=\"1.1\"");t.b("\n" + i);t.b(" viewBox=\"0 0 14 16\" width=\"14\">");t.b("\n" + i);t.b(" <path d=\"M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM11 9H3V7h8v2z\"></path>");t.b("\n" + i);t.b("</svg>");return t.fl(); },partials: {}, subs: { }});
  6012. global.browserTemplates["icon-file-renamed"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<svg aria-hidden=\"true\" class=\"d2h-icon d2h-moved\" height=\"16\" title=\"renamed\" version=\"1.1\"");t.b("\n" + i);t.b(" viewBox=\"0 0 14 16\" width=\"14\">");t.b("\n" + i);t.b(" <path d=\"M6 9H3V7h3V4l5 4-5 4V9z m8-7v12c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h12c0.55 0 1 0.45 1 1z m-1 0H1v12h12V2z\"></path>");t.b("\n" + i);t.b("</svg>");return t.fl(); },partials: {}, subs: { }});
  6013. global.browserTemplates["icon-file"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<svg aria-hidden=\"true\" class=\"d2h-icon\" height=\"16\" version=\"1.1\" viewBox=\"0 0 12 16\" width=\"12\">");t.b("\n" + i);t.b(" <path d=\"M6 5H2v-1h4v1zM2 8h7v-1H2v1z m0 2h7v-1H2v1z m0 2h7v-1H2v1z m10-7.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h7.5l3.5 3.5z m-1 0.5L8 2H1v12h10V5z\"></path>");t.b("\n" + i);t.b("</svg>");return t.fl(); },partials: {}, subs: { }});
  6014. global.browserTemplates["line-by-line-file-diff"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<div id=\"");t.b(t.v(t.f("fileHtmlId",c,p,0)));t.b("\" class=\"d2h-file-wrapper\" data-lang=\"");t.b(t.v(t.d("file.language",c,p,0)));t.b("\">");t.b("\n" + i);t.b(" <div class=\"d2h-file-header\">");t.b("\n" + i);t.b(" ");t.b(t.t(t.f("filePath",c,p,0)));t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b(" <div class=\"d2h-file-diff\">");t.b("\n" + i);t.b(" <div class=\"d2h-code-wrapper\">");t.b("\n" + i);t.b(" <table class=\"d2h-diff-table\">");t.b("\n" + i);t.b(" <tbody class=\"d2h-diff-tbody\">");t.b("\n" + i);t.b(" ");t.b(t.t(t.f("diffs",c,p,0)));t.b("\n" + i);t.b(" </tbody>");t.b("\n" + i);t.b(" </table>");t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b("</div>");return t.fl(); },partials: {}, subs: { }});
  6015. global.browserTemplates["line-by-line-numbers"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<div class=\"line-num1\">");t.b(t.v(t.f("oldNumber",c,p,0)));t.b("</div>");t.b("\n" + i);t.b("<div class=\"line-num2\">");t.b(t.v(t.f("newNumber",c,p,0)));t.b("</div>");return t.fl(); },partials: {}, subs: { }});
  6016. global.browserTemplates["side-by-side-file-diff"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<div id=\"");t.b(t.v(t.f("fileHtmlId",c,p,0)));t.b("\" class=\"d2h-file-wrapper\" data-lang=\"");t.b(t.v(t.d("file.language",c,p,0)));t.b("\">");t.b("\n" + i);t.b(" <div class=\"d2h-file-header\">");t.b("\n" + i);t.b(" ");t.b(t.t(t.f("filePath",c,p,0)));t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b(" <div class=\"d2h-files-diff\">");t.b("\n" + i);t.b(" <div class=\"d2h-file-side-diff\">");t.b("\n" + i);t.b(" <div class=\"d2h-code-wrapper\">");t.b("\n" + i);t.b(" <table class=\"d2h-diff-table\">");t.b("\n" + i);t.b(" <tbody class=\"d2h-diff-tbody\">");t.b("\n" + i);t.b(" ");t.b(t.t(t.d("diffs.left",c,p,0)));t.b("\n" + i);t.b(" </tbody>");t.b("\n" + i);t.b(" </table>");t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b(" <div class=\"d2h-file-side-diff\">");t.b("\n" + i);t.b(" <div class=\"d2h-code-wrapper\">");t.b("\n" + i);t.b(" <table class=\"d2h-diff-table\">");t.b("\n" + i);t.b(" <tbody class=\"d2h-diff-tbody\">");t.b("\n" + i);t.b(" ");t.b(t.t(t.d("diffs.right",c,p,0)));t.b("\n" + i);t.b(" </tbody>");t.b("\n" + i);t.b(" </table>");t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b("</div>");return t.fl(); },partials: {}, subs: { }});
  6017. global.browserTemplates["tag-file-added"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<span class=\"d2h-tag d2h-added d2h-added-tag\">ADDED</span>");return t.fl(); },partials: {}, subs: { }});
  6018. global.browserTemplates["tag-file-changed"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<span class=\"d2h-tag d2h-changed d2h-changed-tag\">CHANGED</span>");return t.fl(); },partials: {}, subs: { }});
  6019. global.browserTemplates["tag-file-deleted"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<span class=\"d2h-tag d2h-deleted d2h-deleted-tag\">DELETED</span>");return t.fl(); },partials: {}, subs: { }});
  6020. global.browserTemplates["tag-file-renamed"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<span class=\"d2h-tag d2h-moved d2h-moved-tag\">RENAMED</span>");return t.fl(); },partials: {}, subs: { }});
  6021. module.exports = global.browserTemplates;
  6022. })();
  6023. }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
  6024. },{"hogan.js":4}],113:[function(require,module,exports){
  6025. /*
  6026. *
  6027. * Utils (utils.js)
  6028. * Author: rtfpessoa
  6029. *
  6030. */
  6031. (function() {
  6032. var merge = require('lodash/merge');
  6033. function Utils() {
  6034. }
  6035. Utils.prototype.escape = function(str) {
  6036. return str.slice(0)
  6037. .replace(/&/g, '&amp;')
  6038. .replace(/</g, '&lt;')
  6039. .replace(/>/g, '&gt;')
  6040. .replace(/"/g, '&quot;')
  6041. .replace(/'/g, '&#x27;')
  6042. .replace(/\//g, '&#x2F;')
  6043. .replace(/\t/g, ' ');
  6044. };
  6045. Utils.prototype.startsWith = function(str, start) {
  6046. if (typeof start === 'object') {
  6047. var result = false;
  6048. start.forEach(function(s) {
  6049. if (str.indexOf(s) === 0) {
  6050. result = true;
  6051. }
  6052. });
  6053. return result;
  6054. }
  6055. return str && str.indexOf(start) === 0;
  6056. };
  6057. Utils.prototype.valueOrEmpty = function(value) {
  6058. return value || '';
  6059. };
  6060. Utils.prototype.safeConfig = function(cfg, defaultConfig) {
  6061. var newCfg = {};
  6062. merge(newCfg, defaultConfig, cfg);
  6063. return newCfg;
  6064. };
  6065. module.exports.Utils = new Utils();
  6066. })();
  6067. },{"lodash/merge":98}]},{},[104]);