index.js 558 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046
  1. /******/ (function(modules) { // webpackBootstrap
  2. /******/ // The module cache
  3. /******/ var installedModules = {};
  4. /******/
  5. /******/ // The require function
  6. /******/ function __webpack_require__(moduleId) {
  7. /******/
  8. /******/ // Check if module is in cache
  9. /******/ if(installedModules[moduleId]) {
  10. /******/ return installedModules[moduleId].exports;
  11. /******/ }
  12. /******/ // Create a new module (and put it into the cache)
  13. /******/ var module = installedModules[moduleId] = {
  14. /******/ i: moduleId,
  15. /******/ l: false,
  16. /******/ exports: {}
  17. /******/ };
  18. /******/
  19. /******/ // Execute the module function
  20. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  21. /******/
  22. /******/ // Flag the module as loaded
  23. /******/ module.l = true;
  24. /******/
  25. /******/ // Return the exports of the module
  26. /******/ return module.exports;
  27. /******/ }
  28. /******/
  29. /******/
  30. /******/ // expose the modules object (__webpack_modules__)
  31. /******/ __webpack_require__.m = modules;
  32. /******/
  33. /******/ // expose the module cache
  34. /******/ __webpack_require__.c = installedModules;
  35. /******/
  36. /******/ // define getter function for harmony exports
  37. /******/ __webpack_require__.d = function(exports, name, getter) {
  38. /******/ if(!__webpack_require__.o(exports, name)) {
  39. /******/ Object.defineProperty(exports, name, {
  40. /******/ configurable: false,
  41. /******/ enumerable: true,
  42. /******/ get: getter
  43. /******/ });
  44. /******/ }
  45. /******/ };
  46. /******/
  47. /******/ // getDefaultExport function for compatibility with non-harmony modules
  48. /******/ __webpack_require__.n = function(module) {
  49. /******/ var getter = module && module.__esModule ?
  50. /******/ function getDefault() { return module['default']; } :
  51. /******/ function getModuleExports() { return module; };
  52. /******/ __webpack_require__.d(getter, 'a', getter);
  53. /******/ return getter;
  54. /******/ };
  55. /******/
  56. /******/ // Object.prototype.hasOwnProperty.call
  57. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  58. /******/
  59. /******/ // __webpack_public_path__
  60. /******/ __webpack_require__.p = "";
  61. /******/
  62. /******/ // Load entry module and return exports
  63. /******/ return __webpack_require__(__webpack_require__.s = 98);
  64. /******/ })
  65. /************************************************************************/
  66. /******/ ([
  67. /* 0 */
  68. /***/ (function(module, exports, __webpack_require__) {
  69. "use strict";
  70. var __extends = (this && this.__extends) || function (d, b) {
  71. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  72. function __() { this.constructor = d; }
  73. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  74. };
  75. var OuterSubscriber_1 = __webpack_require__(29);
  76. var subscribeToResult_1 = __webpack_require__(30);
  77. /* tslint:enable:max-line-length */
  78. /**
  79. * Combines the source Observable with other Observables to create an Observable
  80. * whose values are calculated from the latest values of each, only when the
  81. * source emits.
  82. *
  83. * <span class="informal">Whenever the source Observable emits a value, it
  84. * computes a formula using that value plus the latest values from other input
  85. * Observables, then emits the output of that formula.</span>
  86. *
  87. * <img src="./img/withLatestFrom.png" width="100%">
  88. *
  89. * `withLatestFrom` combines each value from the source Observable (the
  90. * instance) with the latest values from the other input Observables only when
  91. * the source emits a value, optionally using a `project` function to determine
  92. * the value to be emitted on the output Observable. All input Observables must
  93. * emit at least one value before the output Observable will emit a value.
  94. *
  95. * @example <caption>On every click event, emit an array with the latest timer event plus the click event</caption>
  96. * var clicks = Rx.Observable.fromEvent(document, 'click');
  97. * var timer = Rx.Observable.interval(1000);
  98. * var result = clicks.withLatestFrom(timer);
  99. * result.subscribe(x => console.log(x));
  100. *
  101. * @see {@link combineLatest}
  102. *
  103. * @param {ObservableInput} other An input Observable to combine with the source
  104. * Observable. More than one input Observables may be given as argument.
  105. * @param {Function} [project] Projection function for combining values
  106. * together. Receives all values in order of the Observables passed, where the
  107. * first parameter is a value from the source Observable. (e.g.
  108. * `a.withLatestFrom(b, c, (a1, b1, c1) => a1 + b1 + c1)`). If this is not
  109. * passed, arrays will be emitted on the output Observable.
  110. * @return {Observable} An Observable of projected values from the most recent
  111. * values from each input Observable, or an array of the most recent values from
  112. * each input Observable.
  113. * @method withLatestFrom
  114. * @owner Observable
  115. */
  116. function withLatestFrom() {
  117. var args = [];
  118. for (var _i = 0; _i < arguments.length; _i++) {
  119. args[_i - 0] = arguments[_i];
  120. }
  121. return function (source) {
  122. var project;
  123. if (typeof args[args.length - 1] === 'function') {
  124. project = args.pop();
  125. }
  126. var observables = args;
  127. return source.lift(new WithLatestFromOperator(observables, project));
  128. };
  129. }
  130. exports.withLatestFrom = withLatestFrom;
  131. var WithLatestFromOperator = (function () {
  132. function WithLatestFromOperator(observables, project) {
  133. this.observables = observables;
  134. this.project = project;
  135. }
  136. WithLatestFromOperator.prototype.call = function (subscriber, source) {
  137. return source.subscribe(new WithLatestFromSubscriber(subscriber, this.observables, this.project));
  138. };
  139. return WithLatestFromOperator;
  140. }());
  141. /**
  142. * We need this JSDoc comment for affecting ESDoc.
  143. * @ignore
  144. * @extends {Ignored}
  145. */
  146. var WithLatestFromSubscriber = (function (_super) {
  147. __extends(WithLatestFromSubscriber, _super);
  148. function WithLatestFromSubscriber(destination, observables, project) {
  149. _super.call(this, destination);
  150. this.observables = observables;
  151. this.project = project;
  152. this.toRespond = [];
  153. var len = observables.length;
  154. this.values = new Array(len);
  155. for (var i = 0; i < len; i++) {
  156. this.toRespond.push(i);
  157. }
  158. for (var i = 0; i < len; i++) {
  159. var observable = observables[i];
  160. this.add(subscribeToResult_1.subscribeToResult(this, observable, observable, i));
  161. }
  162. }
  163. WithLatestFromSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  164. this.values[outerIndex] = innerValue;
  165. var toRespond = this.toRespond;
  166. if (toRespond.length > 0) {
  167. var found = toRespond.indexOf(outerIndex);
  168. if (found !== -1) {
  169. toRespond.splice(found, 1);
  170. }
  171. }
  172. };
  173. WithLatestFromSubscriber.prototype.notifyComplete = function () {
  174. // noop
  175. };
  176. WithLatestFromSubscriber.prototype._next = function (value) {
  177. if (this.toRespond.length === 0) {
  178. var args = [value].concat(this.values);
  179. if (this.project) {
  180. this._tryProject(args);
  181. }
  182. else {
  183. this.destination.next(args);
  184. }
  185. }
  186. };
  187. WithLatestFromSubscriber.prototype._tryProject = function (args) {
  188. var result;
  189. try {
  190. result = this.project.apply(this, args);
  191. }
  192. catch (err) {
  193. this.destination.error(err);
  194. return;
  195. }
  196. this.destination.next(result);
  197. };
  198. return WithLatestFromSubscriber;
  199. }(OuterSubscriber_1.OuterSubscriber));
  200. //# sourceMappingURL=withLatestFrom.js.map
  201. /***/ }),
  202. /* 1 */
  203. /***/ (function(module, exports, __webpack_require__) {
  204. "use strict";
  205. var root_1 = __webpack_require__(8);
  206. var toSubscriber_1 = __webpack_require__(102);
  207. var observable_1 = __webpack_require__(45);
  208. var pipe_1 = __webpack_require__(104);
  209. /**
  210. * A representation of any set of values over any amount of time. This is the most basic building block
  211. * of RxJS.
  212. *
  213. * @class Observable<T>
  214. */
  215. var Observable = (function () {
  216. /**
  217. * @constructor
  218. * @param {Function} subscribe the function that is called when the Observable is
  219. * initially subscribed to. This function is given a Subscriber, to which new values
  220. * can be `next`ed, or an `error` method can be called to raise an error, or
  221. * `complete` can be called to notify of a successful completion.
  222. */
  223. function Observable(subscribe) {
  224. this._isScalar = false;
  225. if (subscribe) {
  226. this._subscribe = subscribe;
  227. }
  228. }
  229. /**
  230. * Creates a new Observable, with this Observable as the source, and the passed
  231. * operator defined as the new observable's operator.
  232. * @method lift
  233. * @param {Operator} operator the operator defining the operation to take on the observable
  234. * @return {Observable} a new observable with the Operator applied
  235. */
  236. Observable.prototype.lift = function (operator) {
  237. var observable = new Observable();
  238. observable.source = this;
  239. observable.operator = operator;
  240. return observable;
  241. };
  242. /**
  243. * Invokes an execution of an Observable and registers Observer handlers for notifications it will emit.
  244. *
  245. * <span class="informal">Use it when you have all these Observables, but still nothing is happening.</span>
  246. *
  247. * `subscribe` is not a regular operator, but a method that calls Observable's internal `subscribe` function. It
  248. * might be for example a function that you passed to a {@link create} static factory, but most of the time it is
  249. * a library implementation, which defines what and when will be emitted by an Observable. This means that calling
  250. * `subscribe` is actually the moment when Observable starts its work, not when it is created, as it is often
  251. * thought.
  252. *
  253. * Apart from starting the execution of an Observable, this method allows you to listen for values
  254. * that an Observable emits, as well as for when it completes or errors. You can achieve this in two
  255. * following ways.
  256. *
  257. * The first way is creating an object that implements {@link Observer} interface. It should have methods
  258. * defined by that interface, but note that it should be just a regular JavaScript object, which you can create
  259. * yourself in any way you want (ES6 class, classic function constructor, object literal etc.). In particular do
  260. * not attempt to use any RxJS implementation details to create Observers - you don't need them. Remember also
  261. * that your object does not have to implement all methods. If you find yourself creating a method that doesn't
  262. * do anything, you can simply omit it. Note however, that if `error` method is not provided, all errors will
  263. * be left uncaught.
  264. *
  265. * The second way is to give up on Observer object altogether and simply provide callback functions in place of its methods.
  266. * This means you can provide three functions as arguments to `subscribe`, where first function is equivalent
  267. * of a `next` method, second of an `error` method and third of a `complete` method. Just as in case of Observer,
  268. * if you do not need to listen for something, you can omit a function, preferably by passing `undefined` or `null`,
  269. * since `subscribe` recognizes these functions by where they were placed in function call. When it comes
  270. * to `error` function, just as before, if not provided, errors emitted by an Observable will be thrown.
  271. *
  272. * Whatever style of calling `subscribe` you use, in both cases it returns a Subscription object.
  273. * This object allows you to call `unsubscribe` on it, which in turn will stop work that an Observable does and will clean
  274. * up all resources that an Observable used. Note that cancelling a subscription will not call `complete` callback
  275. * provided to `subscribe` function, which is reserved for a regular completion signal that comes from an Observable.
  276. *
  277. * Remember that callbacks provided to `subscribe` are not guaranteed to be called asynchronously.
  278. * It is an Observable itself that decides when these functions will be called. For example {@link of}
  279. * by default emits all its values synchronously. Always check documentation for how given Observable
  280. * will behave when subscribed and if its default behavior can be modified with a {@link Scheduler}.
  281. *
  282. * @example <caption>Subscribe with an Observer</caption>
  283. * const sumObserver = {
  284. * sum: 0,
  285. * next(value) {
  286. * console.log('Adding: ' + value);
  287. * this.sum = this.sum + value;
  288. * },
  289. * error() { // We actually could just remove this method,
  290. * }, // since we do not really care about errors right now.
  291. * complete() {
  292. * console.log('Sum equals: ' + this.sum);
  293. * }
  294. * };
  295. *
  296. * Rx.Observable.of(1, 2, 3) // Synchronously emits 1, 2, 3 and then completes.
  297. * .subscribe(sumObserver);
  298. *
  299. * // Logs:
  300. * // "Adding: 1"
  301. * // "Adding: 2"
  302. * // "Adding: 3"
  303. * // "Sum equals: 6"
  304. *
  305. *
  306. * @example <caption>Subscribe with functions</caption>
  307. * let sum = 0;
  308. *
  309. * Rx.Observable.of(1, 2, 3)
  310. * .subscribe(
  311. * function(value) {
  312. * console.log('Adding: ' + value);
  313. * sum = sum + value;
  314. * },
  315. * undefined,
  316. * function() {
  317. * console.log('Sum equals: ' + sum);
  318. * }
  319. * );
  320. *
  321. * // Logs:
  322. * // "Adding: 1"
  323. * // "Adding: 2"
  324. * // "Adding: 3"
  325. * // "Sum equals: 6"
  326. *
  327. *
  328. * @example <caption>Cancel a subscription</caption>
  329. * const subscription = Rx.Observable.interval(1000).subscribe(
  330. * num => console.log(num),
  331. * undefined,
  332. * () => console.log('completed!') // Will not be called, even
  333. * ); // when cancelling subscription
  334. *
  335. *
  336. * setTimeout(() => {
  337. * subscription.unsubscribe();
  338. * console.log('unsubscribed!');
  339. * }, 2500);
  340. *
  341. * // Logs:
  342. * // 0 after 1s
  343. * // 1 after 2s
  344. * // "unsubscribed!" after 2.5s
  345. *
  346. *
  347. * @param {Observer|Function} observerOrNext (optional) Either an observer with methods to be called,
  348. * or the first of three possible handlers, which is the handler for each value emitted from the subscribed
  349. * Observable.
  350. * @param {Function} error (optional) A handler for a terminal event resulting from an error. If no error handler is provided,
  351. * the error will be thrown as unhandled.
  352. * @param {Function} complete (optional) A handler for a terminal event resulting from successful completion.
  353. * @return {ISubscription} a subscription reference to the registered handlers
  354. * @method subscribe
  355. */
  356. Observable.prototype.subscribe = function (observerOrNext, error, complete) {
  357. var operator = this.operator;
  358. var sink = toSubscriber_1.toSubscriber(observerOrNext, error, complete);
  359. if (operator) {
  360. operator.call(sink, this.source);
  361. }
  362. else {
  363. sink.add(this.source || !sink.syncErrorThrowable ? this._subscribe(sink) : this._trySubscribe(sink));
  364. }
  365. if (sink.syncErrorThrowable) {
  366. sink.syncErrorThrowable = false;
  367. if (sink.syncErrorThrown) {
  368. throw sink.syncErrorValue;
  369. }
  370. }
  371. return sink;
  372. };
  373. Observable.prototype._trySubscribe = function (sink) {
  374. try {
  375. return this._subscribe(sink);
  376. }
  377. catch (err) {
  378. sink.syncErrorThrown = true;
  379. sink.syncErrorValue = err;
  380. sink.error(err);
  381. }
  382. };
  383. /**
  384. * @method forEach
  385. * @param {Function} next a handler for each value emitted by the observable
  386. * @param {PromiseConstructor} [PromiseCtor] a constructor function used to instantiate the Promise
  387. * @return {Promise} a promise that either resolves on observable completion or
  388. * rejects with the handled error
  389. */
  390. Observable.prototype.forEach = function (next, PromiseCtor) {
  391. var _this = this;
  392. if (!PromiseCtor) {
  393. if (root_1.root.Rx && root_1.root.Rx.config && root_1.root.Rx.config.Promise) {
  394. PromiseCtor = root_1.root.Rx.config.Promise;
  395. }
  396. else if (root_1.root.Promise) {
  397. PromiseCtor = root_1.root.Promise;
  398. }
  399. }
  400. if (!PromiseCtor) {
  401. throw new Error('no Promise impl found');
  402. }
  403. return new PromiseCtor(function (resolve, reject) {
  404. // Must be declared in a separate statement to avoid a RefernceError when
  405. // accessing subscription below in the closure due to Temporal Dead Zone.
  406. var subscription;
  407. subscription = _this.subscribe(function (value) {
  408. if (subscription) {
  409. // if there is a subscription, then we can surmise
  410. // the next handling is asynchronous. Any errors thrown
  411. // need to be rejected explicitly and unsubscribe must be
  412. // called manually
  413. try {
  414. next(value);
  415. }
  416. catch (err) {
  417. reject(err);
  418. subscription.unsubscribe();
  419. }
  420. }
  421. else {
  422. // if there is NO subscription, then we're getting a nexted
  423. // value synchronously during subscription. We can just call it.
  424. // If it errors, Observable's `subscribe` will ensure the
  425. // unsubscription logic is called, then synchronously rethrow the error.
  426. // After that, Promise will trap the error and send it
  427. // down the rejection path.
  428. next(value);
  429. }
  430. }, reject, resolve);
  431. });
  432. };
  433. /** @deprecated internal use only */ Observable.prototype._subscribe = function (subscriber) {
  434. return this.source.subscribe(subscriber);
  435. };
  436. /**
  437. * An interop point defined by the es7-observable spec https://github.com/zenparsing/es-observable
  438. * @method Symbol.observable
  439. * @return {Observable} this instance of the observable
  440. */
  441. Observable.prototype[observable_1.observable] = function () {
  442. return this;
  443. };
  444. /* tslint:enable:max-line-length */
  445. /**
  446. * Used to stitch together functional operators into a chain.
  447. * @method pipe
  448. * @return {Observable} the Observable result of all of the operators having
  449. * been called in the order they were passed in.
  450. *
  451. * @example
  452. *
  453. * import { map, filter, scan } from 'rxjs/operators';
  454. *
  455. * Rx.Observable.interval(1000)
  456. * .pipe(
  457. * filter(x => x % 2 === 0),
  458. * map(x => x + x),
  459. * scan((acc, x) => acc + x)
  460. * )
  461. * .subscribe(x => console.log(x))
  462. */
  463. Observable.prototype.pipe = function () {
  464. var operations = [];
  465. for (var _i = 0; _i < arguments.length; _i++) {
  466. operations[_i - 0] = arguments[_i];
  467. }
  468. if (operations.length === 0) {
  469. return this;
  470. }
  471. return pipe_1.pipeFromArray(operations)(this);
  472. };
  473. /* tslint:enable:max-line-length */
  474. Observable.prototype.toPromise = function (PromiseCtor) {
  475. var _this = this;
  476. if (!PromiseCtor) {
  477. if (root_1.root.Rx && root_1.root.Rx.config && root_1.root.Rx.config.Promise) {
  478. PromiseCtor = root_1.root.Rx.config.Promise;
  479. }
  480. else if (root_1.root.Promise) {
  481. PromiseCtor = root_1.root.Promise;
  482. }
  483. }
  484. if (!PromiseCtor) {
  485. throw new Error('no Promise impl found');
  486. }
  487. return new PromiseCtor(function (resolve, reject) {
  488. var value;
  489. _this.subscribe(function (x) { return value = x; }, function (err) { return reject(err); }, function () { return resolve(value); });
  490. });
  491. };
  492. // HACK: Since TypeScript inherits static properties too, we have to
  493. // fight against TypeScript here so Subject can have a different static create signature
  494. /**
  495. * Creates a new cold Observable by calling the Observable constructor
  496. * @static true
  497. * @owner Observable
  498. * @method create
  499. * @param {Function} subscribe? the subscriber function to be passed to the Observable constructor
  500. * @return {Observable} a new cold observable
  501. */
  502. Observable.create = function (subscribe) {
  503. return new Observable(subscribe);
  504. };
  505. return Observable;
  506. }());
  507. exports.Observable = Observable;
  508. //# sourceMappingURL=Observable.js.map
  509. /***/ }),
  510. /* 2 */
  511. /***/ (function(module, exports, __webpack_require__) {
  512. "use strict";
  513. var __extends = (this && this.__extends) || function (d, b) {
  514. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  515. function __() { this.constructor = d; }
  516. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  517. };
  518. var Subscriber_1 = __webpack_require__(4);
  519. /**
  520. * Applies a given `project` function to each value emitted by the source
  521. * Observable, and emits the resulting values as an Observable.
  522. *
  523. * <span class="informal">Like [Array.prototype.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map),
  524. * it passes each source value through a transformation function to get
  525. * corresponding output values.</span>
  526. *
  527. * <img src="./img/map.png" width="100%">
  528. *
  529. * Similar to the well known `Array.prototype.map` function, this operator
  530. * applies a projection to each value and emits that projection in the output
  531. * Observable.
  532. *
  533. * @example <caption>Map every click to the clientX position of that click</caption>
  534. * var clicks = Rx.Observable.fromEvent(document, 'click');
  535. * var positions = clicks.map(ev => ev.clientX);
  536. * positions.subscribe(x => console.log(x));
  537. *
  538. * @see {@link mapTo}
  539. * @see {@link pluck}
  540. *
  541. * @param {function(value: T, index: number): R} project The function to apply
  542. * to each `value` emitted by the source Observable. The `index` parameter is
  543. * the number `i` for the i-th emission that has happened since the
  544. * subscription, starting from the number `0`.
  545. * @param {any} [thisArg] An optional argument to define what `this` is in the
  546. * `project` function.
  547. * @return {Observable<R>} An Observable that emits the values from the source
  548. * Observable transformed by the given `project` function.
  549. * @method map
  550. * @owner Observable
  551. */
  552. function map(project, thisArg) {
  553. return function mapOperation(source) {
  554. if (typeof project !== 'function') {
  555. throw new TypeError('argument is not a function. Are you looking for `mapTo()`?');
  556. }
  557. return source.lift(new MapOperator(project, thisArg));
  558. };
  559. }
  560. exports.map = map;
  561. var MapOperator = (function () {
  562. function MapOperator(project, thisArg) {
  563. this.project = project;
  564. this.thisArg = thisArg;
  565. }
  566. MapOperator.prototype.call = function (subscriber, source) {
  567. return source.subscribe(new MapSubscriber(subscriber, this.project, this.thisArg));
  568. };
  569. return MapOperator;
  570. }());
  571. exports.MapOperator = MapOperator;
  572. /**
  573. * We need this JSDoc comment for affecting ESDoc.
  574. * @ignore
  575. * @extends {Ignored}
  576. */
  577. var MapSubscriber = (function (_super) {
  578. __extends(MapSubscriber, _super);
  579. function MapSubscriber(destination, project, thisArg) {
  580. _super.call(this, destination);
  581. this.project = project;
  582. this.count = 0;
  583. this.thisArg = thisArg || this;
  584. }
  585. // NOTE: This looks unoptimized, but it's actually purposefully NOT
  586. // using try/catch optimizations.
  587. MapSubscriber.prototype._next = function (value) {
  588. var result;
  589. try {
  590. result = this.project.call(this.thisArg, value, this.count++);
  591. }
  592. catch (err) {
  593. this.destination.error(err);
  594. return;
  595. }
  596. this.destination.next(result);
  597. };
  598. return MapSubscriber;
  599. }(Subscriber_1.Subscriber));
  600. //# sourceMappingURL=map.js.map
  601. /***/ }),
  602. /* 3 */
  603. /***/ (function(module, exports) {
  604. var g;
  605. // This works in non-strict mode
  606. g = (function() {
  607. return this;
  608. })();
  609. try {
  610. // This works if eval is allowed (see CSP)
  611. g = g || Function("return this")() || (1,eval)("this");
  612. } catch(e) {
  613. // This works if the window reference is available
  614. if(typeof window === "object")
  615. g = window;
  616. }
  617. // g can still be undefined, but nothing to do about it...
  618. // We return undefined, instead of nothing here, so it's
  619. // easier to handle this case. if(!global) { ...}
  620. module.exports = g;
  621. /***/ }),
  622. /* 4 */
  623. /***/ (function(module, exports, __webpack_require__) {
  624. "use strict";
  625. var __extends = (this && this.__extends) || function (d, b) {
  626. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  627. function __() { this.constructor = d; }
  628. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  629. };
  630. var isFunction_1 = __webpack_require__(42);
  631. var Subscription_1 = __webpack_require__(13);
  632. var Observer_1 = __webpack_require__(56);
  633. var rxSubscriber_1 = __webpack_require__(44);
  634. /**
  635. * Implements the {@link Observer} interface and extends the
  636. * {@link Subscription} class. While the {@link Observer} is the public API for
  637. * consuming the values of an {@link Observable}, all Observers get converted to
  638. * a Subscriber, in order to provide Subscription-like capabilities such as
  639. * `unsubscribe`. Subscriber is a common type in RxJS, and crucial for
  640. * implementing operators, but it is rarely used as a public API.
  641. *
  642. * @class Subscriber<T>
  643. */
  644. var Subscriber = (function (_super) {
  645. __extends(Subscriber, _super);
  646. /**
  647. * @param {Observer|function(value: T): void} [destinationOrNext] A partially
  648. * defined Observer or a `next` callback function.
  649. * @param {function(e: ?any): void} [error] The `error` callback of an
  650. * Observer.
  651. * @param {function(): void} [complete] The `complete` callback of an
  652. * Observer.
  653. */
  654. function Subscriber(destinationOrNext, error, complete) {
  655. _super.call(this);
  656. this.syncErrorValue = null;
  657. this.syncErrorThrown = false;
  658. this.syncErrorThrowable = false;
  659. this.isStopped = false;
  660. switch (arguments.length) {
  661. case 0:
  662. this.destination = Observer_1.empty;
  663. break;
  664. case 1:
  665. if (!destinationOrNext) {
  666. this.destination = Observer_1.empty;
  667. break;
  668. }
  669. if (typeof destinationOrNext === 'object') {
  670. // HACK(benlesh): To resolve an issue where Node users may have multiple
  671. // copies of rxjs in their node_modules directory.
  672. if (isTrustedSubscriber(destinationOrNext)) {
  673. var trustedSubscriber = destinationOrNext[rxSubscriber_1.rxSubscriber]();
  674. this.syncErrorThrowable = trustedSubscriber.syncErrorThrowable;
  675. this.destination = trustedSubscriber;
  676. trustedSubscriber.add(this);
  677. }
  678. else {
  679. this.syncErrorThrowable = true;
  680. this.destination = new SafeSubscriber(this, destinationOrNext);
  681. }
  682. break;
  683. }
  684. default:
  685. this.syncErrorThrowable = true;
  686. this.destination = new SafeSubscriber(this, destinationOrNext, error, complete);
  687. break;
  688. }
  689. }
  690. Subscriber.prototype[rxSubscriber_1.rxSubscriber] = function () { return this; };
  691. /**
  692. * A static factory for a Subscriber, given a (potentially partial) definition
  693. * of an Observer.
  694. * @param {function(x: ?T): void} [next] The `next` callback of an Observer.
  695. * @param {function(e: ?any): void} [error] The `error` callback of an
  696. * Observer.
  697. * @param {function(): void} [complete] The `complete` callback of an
  698. * Observer.
  699. * @return {Subscriber<T>} A Subscriber wrapping the (partially defined)
  700. * Observer represented by the given arguments.
  701. */
  702. Subscriber.create = function (next, error, complete) {
  703. var subscriber = new Subscriber(next, error, complete);
  704. subscriber.syncErrorThrowable = false;
  705. return subscriber;
  706. };
  707. /**
  708. * The {@link Observer} callback to receive notifications of type `next` from
  709. * the Observable, with a value. The Observable may call this method 0 or more
  710. * times.
  711. * @param {T} [value] The `next` value.
  712. * @return {void}
  713. */
  714. Subscriber.prototype.next = function (value) {
  715. if (!this.isStopped) {
  716. this._next(value);
  717. }
  718. };
  719. /**
  720. * The {@link Observer} callback to receive notifications of type `error` from
  721. * the Observable, with an attached {@link Error}. Notifies the Observer that
  722. * the Observable has experienced an error condition.
  723. * @param {any} [err] The `error` exception.
  724. * @return {void}
  725. */
  726. Subscriber.prototype.error = function (err) {
  727. if (!this.isStopped) {
  728. this.isStopped = true;
  729. this._error(err);
  730. }
  731. };
  732. /**
  733. * The {@link Observer} callback to receive a valueless notification of type
  734. * `complete` from the Observable. Notifies the Observer that the Observable
  735. * has finished sending push-based notifications.
  736. * @return {void}
  737. */
  738. Subscriber.prototype.complete = function () {
  739. if (!this.isStopped) {
  740. this.isStopped = true;
  741. this._complete();
  742. }
  743. };
  744. Subscriber.prototype.unsubscribe = function () {
  745. if (this.closed) {
  746. return;
  747. }
  748. this.isStopped = true;
  749. _super.prototype.unsubscribe.call(this);
  750. };
  751. Subscriber.prototype._next = function (value) {
  752. this.destination.next(value);
  753. };
  754. Subscriber.prototype._error = function (err) {
  755. this.destination.error(err);
  756. this.unsubscribe();
  757. };
  758. Subscriber.prototype._complete = function () {
  759. this.destination.complete();
  760. this.unsubscribe();
  761. };
  762. /** @deprecated internal use only */ Subscriber.prototype._unsubscribeAndRecycle = function () {
  763. var _a = this, _parent = _a._parent, _parents = _a._parents;
  764. this._parent = null;
  765. this._parents = null;
  766. this.unsubscribe();
  767. this.closed = false;
  768. this.isStopped = false;
  769. this._parent = _parent;
  770. this._parents = _parents;
  771. return this;
  772. };
  773. return Subscriber;
  774. }(Subscription_1.Subscription));
  775. exports.Subscriber = Subscriber;
  776. /**
  777. * We need this JSDoc comment for affecting ESDoc.
  778. * @ignore
  779. * @extends {Ignored}
  780. */
  781. var SafeSubscriber = (function (_super) {
  782. __extends(SafeSubscriber, _super);
  783. function SafeSubscriber(_parentSubscriber, observerOrNext, error, complete) {
  784. _super.call(this);
  785. this._parentSubscriber = _parentSubscriber;
  786. var next;
  787. var context = this;
  788. if (isFunction_1.isFunction(observerOrNext)) {
  789. next = observerOrNext;
  790. }
  791. else if (observerOrNext) {
  792. next = observerOrNext.next;
  793. error = observerOrNext.error;
  794. complete = observerOrNext.complete;
  795. if (observerOrNext !== Observer_1.empty) {
  796. context = Object.create(observerOrNext);
  797. if (isFunction_1.isFunction(context.unsubscribe)) {
  798. this.add(context.unsubscribe.bind(context));
  799. }
  800. context.unsubscribe = this.unsubscribe.bind(this);
  801. }
  802. }
  803. this._context = context;
  804. this._next = next;
  805. this._error = error;
  806. this._complete = complete;
  807. }
  808. SafeSubscriber.prototype.next = function (value) {
  809. if (!this.isStopped && this._next) {
  810. var _parentSubscriber = this._parentSubscriber;
  811. if (!_parentSubscriber.syncErrorThrowable) {
  812. this.__tryOrUnsub(this._next, value);
  813. }
  814. else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) {
  815. this.unsubscribe();
  816. }
  817. }
  818. };
  819. SafeSubscriber.prototype.error = function (err) {
  820. if (!this.isStopped) {
  821. var _parentSubscriber = this._parentSubscriber;
  822. if (this._error) {
  823. if (!_parentSubscriber.syncErrorThrowable) {
  824. this.__tryOrUnsub(this._error, err);
  825. this.unsubscribe();
  826. }
  827. else {
  828. this.__tryOrSetError(_parentSubscriber, this._error, err);
  829. this.unsubscribe();
  830. }
  831. }
  832. else if (!_parentSubscriber.syncErrorThrowable) {
  833. this.unsubscribe();
  834. throw err;
  835. }
  836. else {
  837. _parentSubscriber.syncErrorValue = err;
  838. _parentSubscriber.syncErrorThrown = true;
  839. this.unsubscribe();
  840. }
  841. }
  842. };
  843. SafeSubscriber.prototype.complete = function () {
  844. var _this = this;
  845. if (!this.isStopped) {
  846. var _parentSubscriber = this._parentSubscriber;
  847. if (this._complete) {
  848. var wrappedComplete = function () { return _this._complete.call(_this._context); };
  849. if (!_parentSubscriber.syncErrorThrowable) {
  850. this.__tryOrUnsub(wrappedComplete);
  851. this.unsubscribe();
  852. }
  853. else {
  854. this.__tryOrSetError(_parentSubscriber, wrappedComplete);
  855. this.unsubscribe();
  856. }
  857. }
  858. else {
  859. this.unsubscribe();
  860. }
  861. }
  862. };
  863. SafeSubscriber.prototype.__tryOrUnsub = function (fn, value) {
  864. try {
  865. fn.call(this._context, value);
  866. }
  867. catch (err) {
  868. this.unsubscribe();
  869. throw err;
  870. }
  871. };
  872. SafeSubscriber.prototype.__tryOrSetError = function (parent, fn, value) {
  873. try {
  874. fn.call(this._context, value);
  875. }
  876. catch (err) {
  877. parent.syncErrorValue = err;
  878. parent.syncErrorThrown = true;
  879. return true;
  880. }
  881. return false;
  882. };
  883. /** @deprecated internal use only */ SafeSubscriber.prototype._unsubscribe = function () {
  884. var _parentSubscriber = this._parentSubscriber;
  885. this._context = null;
  886. this._parentSubscriber = null;
  887. _parentSubscriber.unsubscribe();
  888. };
  889. return SafeSubscriber;
  890. }(Subscriber));
  891. function isTrustedSubscriber(obj) {
  892. return obj instanceof Subscriber || ('syncErrorThrowable' in obj && obj[rxSubscriber_1.rxSubscriber]);
  893. }
  894. //# sourceMappingURL=Subscriber.js.map
  895. /***/ }),
  896. /* 5 */
  897. /***/ (function(module, exports, __webpack_require__) {
  898. "use strict";
  899. var __extends = (this && this.__extends) || function (d, b) {
  900. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  901. function __() { this.constructor = d; }
  902. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  903. };
  904. var Subscriber_1 = __webpack_require__(4);
  905. /* tslint:enable:max-line-length */
  906. /**
  907. * Filter items emitted by the source Observable by only emitting those that
  908. * satisfy a specified predicate.
  909. *
  910. * <span class="informal">Like
  911. * [Array.prototype.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter),
  912. * it only emits a value from the source if it passes a criterion function.</span>
  913. *
  914. * <img src="./img/filter.png" width="100%">
  915. *
  916. * Similar to the well-known `Array.prototype.filter` method, this operator
  917. * takes values from the source Observable, passes them through a `predicate`
  918. * function and only emits those values that yielded `true`.
  919. *
  920. * @example <caption>Emit only click events whose target was a DIV element</caption>
  921. * var clicks = Rx.Observable.fromEvent(document, 'click');
  922. * var clicksOnDivs = clicks.filter(ev => ev.target.tagName === 'DIV');
  923. * clicksOnDivs.subscribe(x => console.log(x));
  924. *
  925. * @see {@link distinct}
  926. * @see {@link distinctUntilChanged}
  927. * @see {@link distinctUntilKeyChanged}
  928. * @see {@link ignoreElements}
  929. * @see {@link partition}
  930. * @see {@link skip}
  931. *
  932. * @param {function(value: T, index: number): boolean} predicate A function that
  933. * evaluates each value emitted by the source Observable. If it returns `true`,
  934. * the value is emitted, if `false` the value is not passed to the output
  935. * Observable. The `index` parameter is the number `i` for the i-th source
  936. * emission that has happened since the subscription, starting from the number
  937. * `0`.
  938. * @param {any} [thisArg] An optional argument to determine the value of `this`
  939. * in the `predicate` function.
  940. * @return {Observable} An Observable of values from the source that were
  941. * allowed by the `predicate` function.
  942. * @method filter
  943. * @owner Observable
  944. */
  945. function filter(predicate, thisArg) {
  946. return function filterOperatorFunction(source) {
  947. return source.lift(new FilterOperator(predicate, thisArg));
  948. };
  949. }
  950. exports.filter = filter;
  951. var FilterOperator = (function () {
  952. function FilterOperator(predicate, thisArg) {
  953. this.predicate = predicate;
  954. this.thisArg = thisArg;
  955. }
  956. FilterOperator.prototype.call = function (subscriber, source) {
  957. return source.subscribe(new FilterSubscriber(subscriber, this.predicate, this.thisArg));
  958. };
  959. return FilterOperator;
  960. }());
  961. /**
  962. * We need this JSDoc comment for affecting ESDoc.
  963. * @ignore
  964. * @extends {Ignored}
  965. */
  966. var FilterSubscriber = (function (_super) {
  967. __extends(FilterSubscriber, _super);
  968. function FilterSubscriber(destination, predicate, thisArg) {
  969. _super.call(this, destination);
  970. this.predicate = predicate;
  971. this.thisArg = thisArg;
  972. this.count = 0;
  973. }
  974. // the try catch block below is left specifically for
  975. // optimization and perf reasons. a tryCatcher is not necessary here.
  976. FilterSubscriber.prototype._next = function (value) {
  977. var result;
  978. try {
  979. result = this.predicate.call(this.thisArg, value, this.count++);
  980. }
  981. catch (err) {
  982. this.destination.error(err);
  983. return;
  984. }
  985. if (result) {
  986. this.destination.next(value);
  987. }
  988. };
  989. return FilterSubscriber;
  990. }(Subscriber_1.Subscriber));
  991. //# sourceMappingURL=filter.js.map
  992. /***/ }),
  993. /* 6 */
  994. /***/ (function(module, exports, __webpack_require__) {
  995. "use strict";
  996. var __extends = (this && this.__extends) || function (d, b) {
  997. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  998. function __() { this.constructor = d; }
  999. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1000. };
  1001. var Subscriber_1 = __webpack_require__(4);
  1002. /* tslint:enable:max-line-length */
  1003. /**
  1004. * Perform a side effect for every emission on the source Observable, but return
  1005. * an Observable that is identical to the source.
  1006. *
  1007. * <span class="informal">Intercepts each emission on the source and runs a
  1008. * function, but returns an output which is identical to the source as long as errors don't occur.</span>
  1009. *
  1010. * <img src="./img/do.png" width="100%">
  1011. *
  1012. * Returns a mirrored Observable of the source Observable, but modified so that
  1013. * the provided Observer is called to perform a side effect for every value,
  1014. * error, and completion emitted by the source. Any errors that are thrown in
  1015. * the aforementioned Observer or handlers are safely sent down the error path
  1016. * of the output Observable.
  1017. *
  1018. * This operator is useful for debugging your Observables for the correct values
  1019. * or performing other side effects.
  1020. *
  1021. * Note: this is different to a `subscribe` on the Observable. If the Observable
  1022. * returned by `do` is not subscribed, the side effects specified by the
  1023. * Observer will never happen. `do` therefore simply spies on existing
  1024. * execution, it does not trigger an execution to happen like `subscribe` does.
  1025. *
  1026. * @example <caption>Map every click to the clientX position of that click, while also logging the click event</caption>
  1027. * var clicks = Rx.Observable.fromEvent(document, 'click');
  1028. * var positions = clicks
  1029. * .do(ev => console.log(ev))
  1030. * .map(ev => ev.clientX);
  1031. * positions.subscribe(x => console.log(x));
  1032. *
  1033. * @see {@link map}
  1034. * @see {@link subscribe}
  1035. *
  1036. * @param {Observer|function} [nextOrObserver] A normal Observer object or a
  1037. * callback for `next`.
  1038. * @param {function} [error] Callback for errors in the source.
  1039. * @param {function} [complete] Callback for the completion of the source.
  1040. * @return {Observable} An Observable identical to the source, but runs the
  1041. * specified Observer or callback(s) for each item.
  1042. * @name tap
  1043. */
  1044. function tap(nextOrObserver, error, complete) {
  1045. return function tapOperatorFunction(source) {
  1046. return source.lift(new DoOperator(nextOrObserver, error, complete));
  1047. };
  1048. }
  1049. exports.tap = tap;
  1050. var DoOperator = (function () {
  1051. function DoOperator(nextOrObserver, error, complete) {
  1052. this.nextOrObserver = nextOrObserver;
  1053. this.error = error;
  1054. this.complete = complete;
  1055. }
  1056. DoOperator.prototype.call = function (subscriber, source) {
  1057. return source.subscribe(new DoSubscriber(subscriber, this.nextOrObserver, this.error, this.complete));
  1058. };
  1059. return DoOperator;
  1060. }());
  1061. /**
  1062. * We need this JSDoc comment for affecting ESDoc.
  1063. * @ignore
  1064. * @extends {Ignored}
  1065. */
  1066. var DoSubscriber = (function (_super) {
  1067. __extends(DoSubscriber, _super);
  1068. function DoSubscriber(destination, nextOrObserver, error, complete) {
  1069. _super.call(this, destination);
  1070. var safeSubscriber = new Subscriber_1.Subscriber(nextOrObserver, error, complete);
  1071. safeSubscriber.syncErrorThrowable = true;
  1072. this.add(safeSubscriber);
  1073. this.safeSubscriber = safeSubscriber;
  1074. }
  1075. DoSubscriber.prototype._next = function (value) {
  1076. var safeSubscriber = this.safeSubscriber;
  1077. safeSubscriber.next(value);
  1078. if (safeSubscriber.syncErrorThrown) {
  1079. this.destination.error(safeSubscriber.syncErrorValue);
  1080. }
  1081. else {
  1082. this.destination.next(value);
  1083. }
  1084. };
  1085. DoSubscriber.prototype._error = function (err) {
  1086. var safeSubscriber = this.safeSubscriber;
  1087. safeSubscriber.error(err);
  1088. if (safeSubscriber.syncErrorThrown) {
  1089. this.destination.error(safeSubscriber.syncErrorValue);
  1090. }
  1091. else {
  1092. this.destination.error(err);
  1093. }
  1094. };
  1095. DoSubscriber.prototype._complete = function () {
  1096. var safeSubscriber = this.safeSubscriber;
  1097. safeSubscriber.complete();
  1098. if (safeSubscriber.syncErrorThrown) {
  1099. this.destination.error(safeSubscriber.syncErrorValue);
  1100. }
  1101. else {
  1102. this.destination.complete();
  1103. }
  1104. };
  1105. return DoSubscriber;
  1106. }(Subscriber_1.Subscriber));
  1107. //# sourceMappingURL=tap.js.map
  1108. /***/ }),
  1109. /* 7 */
  1110. /***/ (function(module, exports, __webpack_require__) {
  1111. "use strict";
  1112. var map_1 = __webpack_require__(2);
  1113. /**
  1114. * Maps each source value (an object) to its specified nested property.
  1115. *
  1116. * <span class="informal">Like {@link map}, but meant only for picking one of
  1117. * the nested properties of every emitted object.</span>
  1118. *
  1119. * <img src="./img/pluck.png" width="100%">
  1120. *
  1121. * Given a list of strings describing a path to an object property, retrieves
  1122. * the value of a specified nested property from all values in the source
  1123. * Observable. If a property can't be resolved, it will return `undefined` for
  1124. * that value.
  1125. *
  1126. * @example <caption>Map every click to the tagName of the clicked target element</caption>
  1127. * var clicks = Rx.Observable.fromEvent(document, 'click');
  1128. * var tagNames = clicks.pluck('target', 'tagName');
  1129. * tagNames.subscribe(x => console.log(x));
  1130. *
  1131. * @see {@link map}
  1132. *
  1133. * @param {...string} properties The nested properties to pluck from each source
  1134. * value (an object).
  1135. * @return {Observable} A new Observable of property values from the source values.
  1136. * @method pluck
  1137. * @owner Observable
  1138. */
  1139. function pluck() {
  1140. var properties = [];
  1141. for (var _i = 0; _i < arguments.length; _i++) {
  1142. properties[_i - 0] = arguments[_i];
  1143. }
  1144. var length = properties.length;
  1145. if (length === 0) {
  1146. throw new Error('list of properties cannot be empty.');
  1147. }
  1148. return function (source) { return map_1.map(plucker(properties, length))(source); };
  1149. }
  1150. exports.pluck = pluck;
  1151. function plucker(props, length) {
  1152. var mapper = function (x) {
  1153. var currentProp = x;
  1154. for (var i = 0; i < length; i++) {
  1155. var p = currentProp[props[i]];
  1156. if (typeof p !== 'undefined') {
  1157. currentProp = p;
  1158. }
  1159. else {
  1160. return undefined;
  1161. }
  1162. }
  1163. return currentProp;
  1164. };
  1165. return mapper;
  1166. }
  1167. //# sourceMappingURL=pluck.js.map
  1168. /***/ }),
  1169. /* 8 */
  1170. /***/ (function(module, exports, __webpack_require__) {
  1171. "use strict";
  1172. /* WEBPACK VAR INJECTION */(function(global) {
  1173. // CommonJS / Node have global context exposed as "global" variable.
  1174. // We don't want to include the whole node.d.ts this this compilation unit so we'll just fake
  1175. // the global "global" var for now.
  1176. var __window = typeof window !== 'undefined' && window;
  1177. var __self = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' &&
  1178. self instanceof WorkerGlobalScope && self;
  1179. var __global = typeof global !== 'undefined' && global;
  1180. var _root = __window || __global || __self;
  1181. exports.root = _root;
  1182. // Workaround Closure Compiler restriction: The body of a goog.module cannot use throw.
  1183. // This is needed when used with angular/tsickle which inserts a goog.module statement.
  1184. // Wrap in IIFE
  1185. (function () {
  1186. if (!_root) {
  1187. throw new Error('RxJS could not find any global context (window, self, global)');
  1188. }
  1189. })();
  1190. //# sourceMappingURL=root.js.map
  1191. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
  1192. /***/ }),
  1193. /* 9 */
  1194. /***/ (function(module, exports, __webpack_require__) {
  1195. "use strict";
  1196. Object.defineProperty(exports, "__esModule", { value: true });
  1197. var _a;
  1198. var BehaviorSubject_1 = __webpack_require__(14);
  1199. var set_options_effect_1 = __webpack_require__(52);
  1200. var file_reload_effect_1 = __webpack_require__(85);
  1201. var browser_set_location_effect_1 = __webpack_require__(88);
  1202. var simulate_click_effect_1 = __webpack_require__(89);
  1203. var set_element_value_effect_1 = __webpack_require__(90);
  1204. var set_element_toggle_value_effect_1 = __webpack_require__(91);
  1205. var set_scroll_1 = __webpack_require__(154);
  1206. var browser_reload_effect_1 = __webpack_require__(92);
  1207. var EffectNames;
  1208. (function (EffectNames) {
  1209. EffectNames["FileReload"] = "@@FileReload";
  1210. EffectNames["PreBrowserReload"] = "@@PreBrowserReload";
  1211. EffectNames["BrowserReload"] = "@@BrowserReload";
  1212. EffectNames["BrowserSetLocation"] = "@@BrowserSetLocation";
  1213. EffectNames["BrowserSetScroll"] = "@@BrowserSetScroll";
  1214. EffectNames["SetOptions"] = "@@SetOptions";
  1215. EffectNames["SimulateClick"] = "@@SimulateClick";
  1216. EffectNames["SetElementValue"] = "@@SetElementValue";
  1217. EffectNames["SetElementToggleValue"] = "@@SetElementToggleValue";
  1218. })(EffectNames = exports.EffectNames || (exports.EffectNames = {}));
  1219. exports.effectOutputHandlers$ = new BehaviorSubject_1.BehaviorSubject((_a = {},
  1220. _a[EffectNames.SetOptions] = set_options_effect_1.setOptionsEffect,
  1221. _a[EffectNames.FileReload] = file_reload_effect_1.fileReloadEffect,
  1222. _a[EffectNames.BrowserReload] = browser_reload_effect_1.browserReloadEffect,
  1223. _a[EffectNames.BrowserSetLocation] = browser_set_location_effect_1.browserSetLocationEffect,
  1224. _a[EffectNames.SimulateClick] = simulate_click_effect_1.simulateClickEffect,
  1225. _a[EffectNames.SetElementValue] = set_element_value_effect_1.setElementValueEffect,
  1226. _a[EffectNames.SetElementToggleValue] = set_element_toggle_value_effect_1.setElementToggleValueEffect,
  1227. _a[EffectNames.BrowserSetScroll] = set_scroll_1.setScrollEffect,
  1228. _a));
  1229. /***/ }),
  1230. /* 10 */
  1231. /***/ (function(module, exports, __webpack_require__) {
  1232. "use strict";
  1233. var ArrayObservable_1 = __webpack_require__(24);
  1234. exports.of = ArrayObservable_1.ArrayObservable.of;
  1235. //# sourceMappingURL=of.js.map
  1236. /***/ }),
  1237. /* 11 */
  1238. /***/ (function(module, exports, __webpack_require__) {
  1239. "use strict";
  1240. var __assign = (this && this.__assign) || function () {
  1241. __assign = Object.assign || function(t) {
  1242. for (var s, i = 1, n = arguments.length; i < n; i++) {
  1243. s = arguments[i];
  1244. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
  1245. t[p] = s[p];
  1246. }
  1247. return t;
  1248. };
  1249. return __assign.apply(this, arguments);
  1250. };
  1251. Object.defineProperty(exports, "__esModule", { value: true });
  1252. var _a;
  1253. var BehaviorSubject_1 = __webpack_require__(14);
  1254. var withLatestFrom_1 = __webpack_require__(0);
  1255. var ignoreElements_1 = __webpack_require__(12);
  1256. var tap_1 = __webpack_require__(6);
  1257. var pluck_1 = __webpack_require__(7);
  1258. var ScrollEvent_1 = __webpack_require__(84);
  1259. var ClickEvent_1 = __webpack_require__(93);
  1260. var KeyupEvent_1 = __webpack_require__(94);
  1261. var BrowserNotify_1 = __webpack_require__(157);
  1262. var BrowserLocation_1 = __webpack_require__(158);
  1263. var BrowserReload_1 = __webpack_require__(95);
  1264. var FileReload_1 = __webpack_require__(166);
  1265. var Connection_1 = __webpack_require__(167);
  1266. var Disconnect_1 = __webpack_require__(168);
  1267. var FormToggleEvent_1 = __webpack_require__(97);
  1268. var OptionsSet_1 = __webpack_require__(169);
  1269. var IncomingSocketNames;
  1270. (function (IncomingSocketNames) {
  1271. IncomingSocketNames["Connection"] = "connection";
  1272. IncomingSocketNames["Disconnect"] = "disconnect";
  1273. IncomingSocketNames["FileReload"] = "file:reload";
  1274. IncomingSocketNames["BrowserReload"] = "browser:reload";
  1275. IncomingSocketNames["BrowserLocation"] = "browser:location";
  1276. IncomingSocketNames["BrowserNotify"] = "browser:notify";
  1277. IncomingSocketNames["Scroll"] = "scroll";
  1278. IncomingSocketNames["Click"] = "click";
  1279. IncomingSocketNames["Keyup"] = "input:text";
  1280. IncomingSocketNames["InputToggle"] = "input:toggles";
  1281. IncomingSocketNames["OptionsSet"] = "options:set";
  1282. })(IncomingSocketNames = exports.IncomingSocketNames || (exports.IncomingSocketNames = {}));
  1283. var OutgoingSocketEvents;
  1284. (function (OutgoingSocketEvents) {
  1285. OutgoingSocketEvents["Scroll"] = "@@outgoing/scroll";
  1286. OutgoingSocketEvents["Click"] = "@@outgoing/click";
  1287. OutgoingSocketEvents["Keyup"] = "@@outgoing/keyup";
  1288. OutgoingSocketEvents["InputToggle"] = "@@outgoing/Toggle";
  1289. })(OutgoingSocketEvents = exports.OutgoingSocketEvents || (exports.OutgoingSocketEvents = {}));
  1290. exports.socketHandlers$ = new BehaviorSubject_1.BehaviorSubject((_a = {},
  1291. _a[IncomingSocketNames.Connection] = Connection_1.incomingConnection,
  1292. _a[IncomingSocketNames.Disconnect] = Disconnect_1.incomingDisconnect,
  1293. _a[IncomingSocketNames.FileReload] = FileReload_1.incomingFileReload,
  1294. _a[IncomingSocketNames.BrowserReload] = BrowserReload_1.incomingBrowserReload,
  1295. _a[IncomingSocketNames.BrowserLocation] = BrowserLocation_1.incomingBrowserLocation,
  1296. _a[IncomingSocketNames.BrowserNotify] = BrowserNotify_1.incomingBrowserNotify,
  1297. _a[IncomingSocketNames.Scroll] = ScrollEvent_1.incomingScrollHandler,
  1298. _a[IncomingSocketNames.Click] = ClickEvent_1.incomingHandler$,
  1299. _a[IncomingSocketNames.Keyup] = KeyupEvent_1.incomingKeyupHandler,
  1300. _a[IncomingSocketNames.InputToggle] = FormToggleEvent_1.incomingInputsToggles,
  1301. _a[IncomingSocketNames.OptionsSet] = OptionsSet_1.incomingOptionsSet,
  1302. _a[OutgoingSocketEvents.Scroll] = emitWithPathname(IncomingSocketNames.Scroll),
  1303. _a[OutgoingSocketEvents.Click] = emitWithPathname(IncomingSocketNames.Click),
  1304. _a[OutgoingSocketEvents.Keyup] = emitWithPathname(IncomingSocketNames.Keyup),
  1305. _a[OutgoingSocketEvents.InputToggle] = emitWithPathname(IncomingSocketNames.InputToggle),
  1306. _a));
  1307. function emitWithPathname(name) {
  1308. return function (xs, inputs) {
  1309. return xs.pipe(withLatestFrom_1.withLatestFrom(inputs.io$, inputs.window$.pipe(pluck_1.pluck("location", "pathname"))), tap_1.tap(function (_a) {
  1310. var event = _a[0], io = _a[1], pathname = _a[2];
  1311. return io.emit(name, __assign({}, event, { pathname: pathname }));
  1312. }), ignoreElements_1.ignoreElements());
  1313. };
  1314. }
  1315. /***/ }),
  1316. /* 12 */
  1317. /***/ (function(module, exports, __webpack_require__) {
  1318. "use strict";
  1319. var __extends = (this && this.__extends) || function (d, b) {
  1320. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  1321. function __() { this.constructor = d; }
  1322. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1323. };
  1324. var Subscriber_1 = __webpack_require__(4);
  1325. var noop_1 = __webpack_require__(57);
  1326. /**
  1327. * Ignores all items emitted by the source Observable and only passes calls of `complete` or `error`.
  1328. *
  1329. * <img src="./img/ignoreElements.png" width="100%">
  1330. *
  1331. * @return {Observable} An empty Observable that only calls `complete`
  1332. * or `error`, based on which one is called by the source Observable.
  1333. * @method ignoreElements
  1334. * @owner Observable
  1335. */
  1336. function ignoreElements() {
  1337. return function ignoreElementsOperatorFunction(source) {
  1338. return source.lift(new IgnoreElementsOperator());
  1339. };
  1340. }
  1341. exports.ignoreElements = ignoreElements;
  1342. var IgnoreElementsOperator = (function () {
  1343. function IgnoreElementsOperator() {
  1344. }
  1345. IgnoreElementsOperator.prototype.call = function (subscriber, source) {
  1346. return source.subscribe(new IgnoreElementsSubscriber(subscriber));
  1347. };
  1348. return IgnoreElementsOperator;
  1349. }());
  1350. /**
  1351. * We need this JSDoc comment for affecting ESDoc.
  1352. * @ignore
  1353. * @extends {Ignored}
  1354. */
  1355. var IgnoreElementsSubscriber = (function (_super) {
  1356. __extends(IgnoreElementsSubscriber, _super);
  1357. function IgnoreElementsSubscriber() {
  1358. _super.apply(this, arguments);
  1359. }
  1360. IgnoreElementsSubscriber.prototype._next = function (unused) {
  1361. noop_1.noop();
  1362. };
  1363. return IgnoreElementsSubscriber;
  1364. }(Subscriber_1.Subscriber));
  1365. //# sourceMappingURL=ignoreElements.js.map
  1366. /***/ }),
  1367. /* 13 */
  1368. /***/ (function(module, exports, __webpack_require__) {
  1369. "use strict";
  1370. var isArray_1 = __webpack_require__(26);
  1371. var isObject_1 = __webpack_require__(55);
  1372. var isFunction_1 = __webpack_require__(42);
  1373. var tryCatch_1 = __webpack_require__(43);
  1374. var errorObject_1 = __webpack_require__(27);
  1375. var UnsubscriptionError_1 = __webpack_require__(103);
  1376. /**
  1377. * Represents a disposable resource, such as the execution of an Observable. A
  1378. * Subscription has one important method, `unsubscribe`, that takes no argument
  1379. * and just disposes the resource held by the subscription.
  1380. *
  1381. * Additionally, subscriptions may be grouped together through the `add()`
  1382. * method, which will attach a child Subscription to the current Subscription.
  1383. * When a Subscription is unsubscribed, all its children (and its grandchildren)
  1384. * will be unsubscribed as well.
  1385. *
  1386. * @class Subscription
  1387. */
  1388. var Subscription = (function () {
  1389. /**
  1390. * @param {function(): void} [unsubscribe] A function describing how to
  1391. * perform the disposal of resources when the `unsubscribe` method is called.
  1392. */
  1393. function Subscription(unsubscribe) {
  1394. /**
  1395. * A flag to indicate whether this Subscription has already been unsubscribed.
  1396. * @type {boolean}
  1397. */
  1398. this.closed = false;
  1399. this._parent = null;
  1400. this._parents = null;
  1401. this._subscriptions = null;
  1402. if (unsubscribe) {
  1403. this._unsubscribe = unsubscribe;
  1404. }
  1405. }
  1406. /**
  1407. * Disposes the resources held by the subscription. May, for instance, cancel
  1408. * an ongoing Observable execution or cancel any other type of work that
  1409. * started when the Subscription was created.
  1410. * @return {void}
  1411. */
  1412. Subscription.prototype.unsubscribe = function () {
  1413. var hasErrors = false;
  1414. var errors;
  1415. if (this.closed) {
  1416. return;
  1417. }
  1418. var _a = this, _parent = _a._parent, _parents = _a._parents, _unsubscribe = _a._unsubscribe, _subscriptions = _a._subscriptions;
  1419. this.closed = true;
  1420. this._parent = null;
  1421. this._parents = null;
  1422. // null out _subscriptions first so any child subscriptions that attempt
  1423. // to remove themselves from this subscription will noop
  1424. this._subscriptions = null;
  1425. var index = -1;
  1426. var len = _parents ? _parents.length : 0;
  1427. // if this._parent is null, then so is this._parents, and we
  1428. // don't have to remove ourselves from any parent subscriptions.
  1429. while (_parent) {
  1430. _parent.remove(this);
  1431. // if this._parents is null or index >= len,
  1432. // then _parent is set to null, and the loop exits
  1433. _parent = ++index < len && _parents[index] || null;
  1434. }
  1435. if (isFunction_1.isFunction(_unsubscribe)) {
  1436. var trial = tryCatch_1.tryCatch(_unsubscribe).call(this);
  1437. if (trial === errorObject_1.errorObject) {
  1438. hasErrors = true;
  1439. errors = errors || (errorObject_1.errorObject.e instanceof UnsubscriptionError_1.UnsubscriptionError ?
  1440. flattenUnsubscriptionErrors(errorObject_1.errorObject.e.errors) : [errorObject_1.errorObject.e]);
  1441. }
  1442. }
  1443. if (isArray_1.isArray(_subscriptions)) {
  1444. index = -1;
  1445. len = _subscriptions.length;
  1446. while (++index < len) {
  1447. var sub = _subscriptions[index];
  1448. if (isObject_1.isObject(sub)) {
  1449. var trial = tryCatch_1.tryCatch(sub.unsubscribe).call(sub);
  1450. if (trial === errorObject_1.errorObject) {
  1451. hasErrors = true;
  1452. errors = errors || [];
  1453. var err = errorObject_1.errorObject.e;
  1454. if (err instanceof UnsubscriptionError_1.UnsubscriptionError) {
  1455. errors = errors.concat(flattenUnsubscriptionErrors(err.errors));
  1456. }
  1457. else {
  1458. errors.push(err);
  1459. }
  1460. }
  1461. }
  1462. }
  1463. }
  1464. if (hasErrors) {
  1465. throw new UnsubscriptionError_1.UnsubscriptionError(errors);
  1466. }
  1467. };
  1468. /**
  1469. * Adds a tear down to be called during the unsubscribe() of this
  1470. * Subscription.
  1471. *
  1472. * If the tear down being added is a subscription that is already
  1473. * unsubscribed, is the same reference `add` is being called on, or is
  1474. * `Subscription.EMPTY`, it will not be added.
  1475. *
  1476. * If this subscription is already in an `closed` state, the passed
  1477. * tear down logic will be executed immediately.
  1478. *
  1479. * @param {TeardownLogic} teardown The additional logic to execute on
  1480. * teardown.
  1481. * @return {Subscription} Returns the Subscription used or created to be
  1482. * added to the inner subscriptions list. This Subscription can be used with
  1483. * `remove()` to remove the passed teardown logic from the inner subscriptions
  1484. * list.
  1485. */
  1486. Subscription.prototype.add = function (teardown) {
  1487. if (!teardown || (teardown === Subscription.EMPTY)) {
  1488. return Subscription.EMPTY;
  1489. }
  1490. if (teardown === this) {
  1491. return this;
  1492. }
  1493. var subscription = teardown;
  1494. switch (typeof teardown) {
  1495. case 'function':
  1496. subscription = new Subscription(teardown);
  1497. case 'object':
  1498. if (subscription.closed || typeof subscription.unsubscribe !== 'function') {
  1499. return subscription;
  1500. }
  1501. else if (this.closed) {
  1502. subscription.unsubscribe();
  1503. return subscription;
  1504. }
  1505. else if (typeof subscription._addParent !== 'function' /* quack quack */) {
  1506. var tmp = subscription;
  1507. subscription = new Subscription();
  1508. subscription._subscriptions = [tmp];
  1509. }
  1510. break;
  1511. default:
  1512. throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.');
  1513. }
  1514. var subscriptions = this._subscriptions || (this._subscriptions = []);
  1515. subscriptions.push(subscription);
  1516. subscription._addParent(this);
  1517. return subscription;
  1518. };
  1519. /**
  1520. * Removes a Subscription from the internal list of subscriptions that will
  1521. * unsubscribe during the unsubscribe process of this Subscription.
  1522. * @param {Subscription} subscription The subscription to remove.
  1523. * @return {void}
  1524. */
  1525. Subscription.prototype.remove = function (subscription) {
  1526. var subscriptions = this._subscriptions;
  1527. if (subscriptions) {
  1528. var subscriptionIndex = subscriptions.indexOf(subscription);
  1529. if (subscriptionIndex !== -1) {
  1530. subscriptions.splice(subscriptionIndex, 1);
  1531. }
  1532. }
  1533. };
  1534. Subscription.prototype._addParent = function (parent) {
  1535. var _a = this, _parent = _a._parent, _parents = _a._parents;
  1536. if (!_parent || _parent === parent) {
  1537. // If we don't have a parent, or the new parent is the same as the
  1538. // current parent, then set this._parent to the new parent.
  1539. this._parent = parent;
  1540. }
  1541. else if (!_parents) {
  1542. // If there's already one parent, but not multiple, allocate an Array to
  1543. // store the rest of the parent Subscriptions.
  1544. this._parents = [parent];
  1545. }
  1546. else if (_parents.indexOf(parent) === -1) {
  1547. // Only add the new parent to the _parents list if it's not already there.
  1548. _parents.push(parent);
  1549. }
  1550. };
  1551. Subscription.EMPTY = (function (empty) {
  1552. empty.closed = true;
  1553. return empty;
  1554. }(new Subscription()));
  1555. return Subscription;
  1556. }());
  1557. exports.Subscription = Subscription;
  1558. function flattenUnsubscriptionErrors(errors) {
  1559. return errors.reduce(function (errs, err) { return errs.concat((err instanceof UnsubscriptionError_1.UnsubscriptionError) ? err.errors : err); }, []);
  1560. }
  1561. //# sourceMappingURL=Subscription.js.map
  1562. /***/ }),
  1563. /* 14 */
  1564. /***/ (function(module, exports, __webpack_require__) {
  1565. "use strict";
  1566. var __extends = (this && this.__extends) || function (d, b) {
  1567. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  1568. function __() { this.constructor = d; }
  1569. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1570. };
  1571. var Subject_1 = __webpack_require__(37);
  1572. var ObjectUnsubscribedError_1 = __webpack_require__(72);
  1573. /**
  1574. * @class BehaviorSubject<T>
  1575. */
  1576. var BehaviorSubject = (function (_super) {
  1577. __extends(BehaviorSubject, _super);
  1578. function BehaviorSubject(_value) {
  1579. _super.call(this);
  1580. this._value = _value;
  1581. }
  1582. Object.defineProperty(BehaviorSubject.prototype, "value", {
  1583. get: function () {
  1584. return this.getValue();
  1585. },
  1586. enumerable: true,
  1587. configurable: true
  1588. });
  1589. /** @deprecated internal use only */ BehaviorSubject.prototype._subscribe = function (subscriber) {
  1590. var subscription = _super.prototype._subscribe.call(this, subscriber);
  1591. if (subscription && !subscription.closed) {
  1592. subscriber.next(this._value);
  1593. }
  1594. return subscription;
  1595. };
  1596. BehaviorSubject.prototype.getValue = function () {
  1597. if (this.hasError) {
  1598. throw this.thrownError;
  1599. }
  1600. else if (this.closed) {
  1601. throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError();
  1602. }
  1603. else {
  1604. return this._value;
  1605. }
  1606. };
  1607. BehaviorSubject.prototype.next = function (value) {
  1608. _super.prototype.next.call(this, this._value = value);
  1609. };
  1610. return BehaviorSubject;
  1611. }(Subject_1.Subject));
  1612. exports.BehaviorSubject = BehaviorSubject;
  1613. //# sourceMappingURL=BehaviorSubject.js.map
  1614. /***/ }),
  1615. /* 15 */
  1616. /***/ (function(module, exports, __webpack_require__) {
  1617. "use strict";
  1618. Object.defineProperty(exports, "__esModule", { value: true });
  1619. var _a;
  1620. var BehaviorSubject_1 = __webpack_require__(14);
  1621. var timer_1 = __webpack_require__(51);
  1622. var of_1 = __webpack_require__(10);
  1623. var logger_1 = __webpack_require__(143);
  1624. var filter_1 = __webpack_require__(5);
  1625. var tap_1 = __webpack_require__(6);
  1626. var withLatestFrom_1 = __webpack_require__(0);
  1627. var switchMap_1 = __webpack_require__(21);
  1628. var pluck_1 = __webpack_require__(7);
  1629. function initLogger(options) {
  1630. var log = new logger_1.Nanologger(options.logPrefix || "", {
  1631. colors: { magenta: "#0F2634" }
  1632. });
  1633. return of_1.of(log);
  1634. }
  1635. exports.initLogger = initLogger;
  1636. var LogNames;
  1637. (function (LogNames) {
  1638. LogNames["Log"] = "@@Log";
  1639. LogNames["Info"] = "@@Log.info";
  1640. LogNames["Debug"] = "@@Log.debug";
  1641. })(LogNames = exports.LogNames || (exports.LogNames = {}));
  1642. var Overlay;
  1643. (function (Overlay) {
  1644. Overlay["Info"] = "@@Overlay.info";
  1645. })(Overlay = exports.Overlay || (exports.Overlay = {}));
  1646. function consoleInfo() {
  1647. var args = [];
  1648. for (var _i = 0; _i < arguments.length; _i++) {
  1649. args[_i] = arguments[_i];
  1650. }
  1651. return [LogNames.Log, [LogNames.Info, args]];
  1652. }
  1653. exports.consoleInfo = consoleInfo;
  1654. function consoleDebug() {
  1655. var args = [];
  1656. for (var _i = 0; _i < arguments.length; _i++) {
  1657. args[_i] = arguments[_i];
  1658. }
  1659. return [LogNames.Log, [LogNames.Debug, args]];
  1660. }
  1661. exports.consoleDebug = consoleDebug;
  1662. function overlayInfo(message, timeout) {
  1663. if (timeout === void 0) { timeout = 2000; }
  1664. return [Overlay.Info, [message, timeout]];
  1665. }
  1666. exports.overlayInfo = overlayInfo;
  1667. exports.logHandler$ = new BehaviorSubject_1.BehaviorSubject((_a = {},
  1668. _a[LogNames.Log] = function (xs, inputs) {
  1669. return xs.pipe(
  1670. /**
  1671. * access injectNotification from the options stream
  1672. */
  1673. withLatestFrom_1.withLatestFrom(inputs.logInstance$, inputs.option$.pipe(pluck_1.pluck("injectNotification"))),
  1674. /**
  1675. * only accept messages if injectNotification !== console
  1676. */
  1677. filter_1.filter(function (_a) {
  1678. var injectNotification = _a[2];
  1679. return injectNotification === "console";
  1680. }), tap_1.tap(function (_a) {
  1681. var event = _a[0], log = _a[1];
  1682. switch (event[0]) {
  1683. case LogNames.Info: {
  1684. return log.info.apply(log, event[1]);
  1685. }
  1686. case LogNames.Debug: {
  1687. return log.debug.apply(log, event[1]);
  1688. }
  1689. }
  1690. }));
  1691. },
  1692. _a[Overlay.Info] = function (xs, inputs) {
  1693. return xs.pipe(withLatestFrom_1.withLatestFrom(inputs.option$, inputs.notifyElement$, inputs.document$),
  1694. /**
  1695. * Reject all notifications if notify: false
  1696. */
  1697. filter_1.filter(function (_a) {
  1698. var options = _a[1];
  1699. return Boolean(options.notify);
  1700. }),
  1701. /**
  1702. * Set the HTML of the notify element
  1703. */
  1704. tap_1.tap(function (_a) {
  1705. var event = _a[0], options = _a[1], element = _a[2], document = _a[3];
  1706. element.innerHTML = event[0];
  1707. element.style.display = "block";
  1708. document.body.appendChild(element);
  1709. }),
  1710. /**
  1711. * Now remove the element after the given timeout
  1712. */
  1713. switchMap_1.switchMap(function (_a) {
  1714. var event = _a[0], options = _a[1], element = _a[2], document = _a[3];
  1715. return timer_1.timer(event[1] || 2000).pipe(tap_1.tap(function () {
  1716. element.style.display = "none";
  1717. if (element.parentNode) {
  1718. document.body.removeChild(element);
  1719. }
  1720. }));
  1721. }));
  1722. },
  1723. _a));
  1724. /***/ }),
  1725. /* 16 */
  1726. /***/ (function(module, exports, __webpack_require__) {
  1727. "use strict";
  1728. var __extends = (this && this.__extends) || function (d, b) {
  1729. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  1730. function __() { this.constructor = d; }
  1731. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1732. };
  1733. var subscribeToResult_1 = __webpack_require__(30);
  1734. var OuterSubscriber_1 = __webpack_require__(29);
  1735. /* tslint:enable:max-line-length */
  1736. /**
  1737. * Projects each source value to an Observable which is merged in the output
  1738. * Observable.
  1739. *
  1740. * <span class="informal">Maps each value to an Observable, then flattens all of
  1741. * these inner Observables using {@link mergeAll}.</span>
  1742. *
  1743. * <img src="./img/mergeMap.png" width="100%">
  1744. *
  1745. * Returns an Observable that emits items based on applying a function that you
  1746. * supply to each item emitted by the source Observable, where that function
  1747. * returns an Observable, and then merging those resulting Observables and
  1748. * emitting the results of this merger.
  1749. *
  1750. * @example <caption>Map and flatten each letter to an Observable ticking every 1 second</caption>
  1751. * var letters = Rx.Observable.of('a', 'b', 'c');
  1752. * var result = letters.mergeMap(x =>
  1753. * Rx.Observable.interval(1000).map(i => x+i)
  1754. * );
  1755. * result.subscribe(x => console.log(x));
  1756. *
  1757. * // Results in the following:
  1758. * // a0
  1759. * // b0
  1760. * // c0
  1761. * // a1
  1762. * // b1
  1763. * // c1
  1764. * // continues to list a,b,c with respective ascending integers
  1765. *
  1766. * @see {@link concatMap}
  1767. * @see {@link exhaustMap}
  1768. * @see {@link merge}
  1769. * @see {@link mergeAll}
  1770. * @see {@link mergeMapTo}
  1771. * @see {@link mergeScan}
  1772. * @see {@link switchMap}
  1773. *
  1774. * @param {function(value: T, ?index: number): ObservableInput} project A function
  1775. * that, when applied to an item emitted by the source Observable, returns an
  1776. * Observable.
  1777. * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector]
  1778. * A function to produce the value on the output Observable based on the values
  1779. * and the indices of the source (outer) emission and the inner Observable
  1780. * emission. The arguments passed to this function are:
  1781. * - `outerValue`: the value that came from the source
  1782. * - `innerValue`: the value that came from the projected Observable
  1783. * - `outerIndex`: the "index" of the value that came from the source
  1784. * - `innerIndex`: the "index" of the value from the projected Observable
  1785. * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input
  1786. * Observables being subscribed to concurrently.
  1787. * @return {Observable} An Observable that emits the result of applying the
  1788. * projection function (and the optional `resultSelector`) to each item emitted
  1789. * by the source Observable and merging the results of the Observables obtained
  1790. * from this transformation.
  1791. * @method mergeMap
  1792. * @owner Observable
  1793. */
  1794. function mergeMap(project, resultSelector, concurrent) {
  1795. if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
  1796. return function mergeMapOperatorFunction(source) {
  1797. if (typeof resultSelector === 'number') {
  1798. concurrent = resultSelector;
  1799. resultSelector = null;
  1800. }
  1801. return source.lift(new MergeMapOperator(project, resultSelector, concurrent));
  1802. };
  1803. }
  1804. exports.mergeMap = mergeMap;
  1805. var MergeMapOperator = (function () {
  1806. function MergeMapOperator(project, resultSelector, concurrent) {
  1807. if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
  1808. this.project = project;
  1809. this.resultSelector = resultSelector;
  1810. this.concurrent = concurrent;
  1811. }
  1812. MergeMapOperator.prototype.call = function (observer, source) {
  1813. return source.subscribe(new MergeMapSubscriber(observer, this.project, this.resultSelector, this.concurrent));
  1814. };
  1815. return MergeMapOperator;
  1816. }());
  1817. exports.MergeMapOperator = MergeMapOperator;
  1818. /**
  1819. * We need this JSDoc comment for affecting ESDoc.
  1820. * @ignore
  1821. * @extends {Ignored}
  1822. */
  1823. var MergeMapSubscriber = (function (_super) {
  1824. __extends(MergeMapSubscriber, _super);
  1825. function MergeMapSubscriber(destination, project, resultSelector, concurrent) {
  1826. if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
  1827. _super.call(this, destination);
  1828. this.project = project;
  1829. this.resultSelector = resultSelector;
  1830. this.concurrent = concurrent;
  1831. this.hasCompleted = false;
  1832. this.buffer = [];
  1833. this.active = 0;
  1834. this.index = 0;
  1835. }
  1836. MergeMapSubscriber.prototype._next = function (value) {
  1837. if (this.active < this.concurrent) {
  1838. this._tryNext(value);
  1839. }
  1840. else {
  1841. this.buffer.push(value);
  1842. }
  1843. };
  1844. MergeMapSubscriber.prototype._tryNext = function (value) {
  1845. var result;
  1846. var index = this.index++;
  1847. try {
  1848. result = this.project(value, index);
  1849. }
  1850. catch (err) {
  1851. this.destination.error(err);
  1852. return;
  1853. }
  1854. this.active++;
  1855. this._innerSub(result, value, index);
  1856. };
  1857. MergeMapSubscriber.prototype._innerSub = function (ish, value, index) {
  1858. this.add(subscribeToResult_1.subscribeToResult(this, ish, value, index));
  1859. };
  1860. MergeMapSubscriber.prototype._complete = function () {
  1861. this.hasCompleted = true;
  1862. if (this.active === 0 && this.buffer.length === 0) {
  1863. this.destination.complete();
  1864. }
  1865. };
  1866. MergeMapSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  1867. if (this.resultSelector) {
  1868. this._notifyResultSelector(outerValue, innerValue, outerIndex, innerIndex);
  1869. }
  1870. else {
  1871. this.destination.next(innerValue);
  1872. }
  1873. };
  1874. MergeMapSubscriber.prototype._notifyResultSelector = function (outerValue, innerValue, outerIndex, innerIndex) {
  1875. var result;
  1876. try {
  1877. result = this.resultSelector(outerValue, innerValue, outerIndex, innerIndex);
  1878. }
  1879. catch (err) {
  1880. this.destination.error(err);
  1881. return;
  1882. }
  1883. this.destination.next(result);
  1884. };
  1885. MergeMapSubscriber.prototype.notifyComplete = function (innerSub) {
  1886. var buffer = this.buffer;
  1887. this.remove(innerSub);
  1888. this.active--;
  1889. if (buffer.length > 0) {
  1890. this._next(buffer.shift());
  1891. }
  1892. else if (this.active === 0 && this.hasCompleted) {
  1893. this.destination.complete();
  1894. }
  1895. };
  1896. return MergeMapSubscriber;
  1897. }(OuterSubscriber_1.OuterSubscriber));
  1898. exports.MergeMapSubscriber = MergeMapSubscriber;
  1899. //# sourceMappingURL=mergeMap.js.map
  1900. /***/ }),
  1901. /* 17 */
  1902. /***/ (function(module, exports, __webpack_require__) {
  1903. "use strict";
  1904. var EmptyObservable_1 = __webpack_require__(28);
  1905. exports.empty = EmptyObservable_1.EmptyObservable.create;
  1906. //# sourceMappingURL=empty.js.map
  1907. /***/ }),
  1908. /* 18 */
  1909. /***/ (function(module, exports, __webpack_require__) {
  1910. /**
  1911. * Expose `Emitter`.
  1912. */
  1913. if (true) {
  1914. module.exports = Emitter;
  1915. }
  1916. /**
  1917. * Initialize a new `Emitter`.
  1918. *
  1919. * @api public
  1920. */
  1921. function Emitter(obj) {
  1922. if (obj) return mixin(obj);
  1923. };
  1924. /**
  1925. * Mixin the emitter properties.
  1926. *
  1927. * @param {Object} obj
  1928. * @return {Object}
  1929. * @api private
  1930. */
  1931. function mixin(obj) {
  1932. for (var key in Emitter.prototype) {
  1933. obj[key] = Emitter.prototype[key];
  1934. }
  1935. return obj;
  1936. }
  1937. /**
  1938. * Listen on the given `event` with `fn`.
  1939. *
  1940. * @param {String} event
  1941. * @param {Function} fn
  1942. * @return {Emitter}
  1943. * @api public
  1944. */
  1945. Emitter.prototype.on =
  1946. Emitter.prototype.addEventListener = function(event, fn){
  1947. this._callbacks = this._callbacks || {};
  1948. (this._callbacks['$' + event] = this._callbacks['$' + event] || [])
  1949. .push(fn);
  1950. return this;
  1951. };
  1952. /**
  1953. * Adds an `event` listener that will be invoked a single
  1954. * time then automatically removed.
  1955. *
  1956. * @param {String} event
  1957. * @param {Function} fn
  1958. * @return {Emitter}
  1959. * @api public
  1960. */
  1961. Emitter.prototype.once = function(event, fn){
  1962. function on() {
  1963. this.off(event, on);
  1964. fn.apply(this, arguments);
  1965. }
  1966. on.fn = fn;
  1967. this.on(event, on);
  1968. return this;
  1969. };
  1970. /**
  1971. * Remove the given callback for `event` or all
  1972. * registered callbacks.
  1973. *
  1974. * @param {String} event
  1975. * @param {Function} fn
  1976. * @return {Emitter}
  1977. * @api public
  1978. */
  1979. Emitter.prototype.off =
  1980. Emitter.prototype.removeListener =
  1981. Emitter.prototype.removeAllListeners =
  1982. Emitter.prototype.removeEventListener = function(event, fn){
  1983. this._callbacks = this._callbacks || {};
  1984. // all
  1985. if (0 == arguments.length) {
  1986. this._callbacks = {};
  1987. return this;
  1988. }
  1989. // specific event
  1990. var callbacks = this._callbacks['$' + event];
  1991. if (!callbacks) return this;
  1992. // remove all handlers
  1993. if (1 == arguments.length) {
  1994. delete this._callbacks['$' + event];
  1995. return this;
  1996. }
  1997. // remove specific handler
  1998. var cb;
  1999. for (var i = 0; i < callbacks.length; i++) {
  2000. cb = callbacks[i];
  2001. if (cb === fn || cb.fn === fn) {
  2002. callbacks.splice(i, 1);
  2003. break;
  2004. }
  2005. }
  2006. return this;
  2007. };
  2008. /**
  2009. * Emit `event` with the given args.
  2010. *
  2011. * @param {String} event
  2012. * @param {Mixed} ...
  2013. * @return {Emitter}
  2014. */
  2015. Emitter.prototype.emit = function(event){
  2016. this._callbacks = this._callbacks || {};
  2017. var args = [].slice.call(arguments, 1)
  2018. , callbacks = this._callbacks['$' + event];
  2019. if (callbacks) {
  2020. callbacks = callbacks.slice(0);
  2021. for (var i = 0, len = callbacks.length; i < len; ++i) {
  2022. callbacks[i].apply(this, args);
  2023. }
  2024. }
  2025. return this;
  2026. };
  2027. /**
  2028. * Return array of callbacks for `event`.
  2029. *
  2030. * @param {String} event
  2031. * @return {Array}
  2032. * @api public
  2033. */
  2034. Emitter.prototype.listeners = function(event){
  2035. this._callbacks = this._callbacks || {};
  2036. return this._callbacks['$' + event] || [];
  2037. };
  2038. /**
  2039. * Check if this emitter has `event` handlers.
  2040. *
  2041. * @param {String} event
  2042. * @return {Boolean}
  2043. * @api public
  2044. */
  2045. Emitter.prototype.hasListeners = function(event){
  2046. return !! this.listeners(event).length;
  2047. };
  2048. /***/ }),
  2049. /* 19 */
  2050. /***/ (function(module, exports, __webpack_require__) {
  2051. /* WEBPACK VAR INJECTION */(function(global) {/**
  2052. * Module dependencies.
  2053. */
  2054. var keys = __webpack_require__(117);
  2055. var hasBinary = __webpack_require__(66);
  2056. var sliceBuffer = __webpack_require__(123);
  2057. var after = __webpack_require__(124);
  2058. var utf8 = __webpack_require__(125);
  2059. var base64encoder;
  2060. if (global && global.ArrayBuffer) {
  2061. base64encoder = __webpack_require__(127);
  2062. }
  2063. /**
  2064. * Check if we are running an android browser. That requires us to use
  2065. * ArrayBuffer with polling transports...
  2066. *
  2067. * http://ghinda.net/jpeg-blob-ajax-android/
  2068. */
  2069. var isAndroid = typeof navigator !== 'undefined' && /Android/i.test(navigator.userAgent);
  2070. /**
  2071. * Check if we are running in PhantomJS.
  2072. * Uploading a Blob with PhantomJS does not work correctly, as reported here:
  2073. * https://github.com/ariya/phantomjs/issues/11395
  2074. * @type boolean
  2075. */
  2076. var isPhantomJS = typeof navigator !== 'undefined' && /PhantomJS/i.test(navigator.userAgent);
  2077. /**
  2078. * When true, avoids using Blobs to encode payloads.
  2079. * @type boolean
  2080. */
  2081. var dontSendBlobs = isAndroid || isPhantomJS;
  2082. /**
  2083. * Current protocol version.
  2084. */
  2085. exports.protocol = 3;
  2086. /**
  2087. * Packet types.
  2088. */
  2089. var packets = exports.packets = {
  2090. open: 0 // non-ws
  2091. , close: 1 // non-ws
  2092. , ping: 2
  2093. , pong: 3
  2094. , message: 4
  2095. , upgrade: 5
  2096. , noop: 6
  2097. };
  2098. var packetslist = keys(packets);
  2099. /**
  2100. * Premade error packet.
  2101. */
  2102. var err = { type: 'error', data: 'parser error' };
  2103. /**
  2104. * Create a blob api even for blob builder when vendor prefixes exist
  2105. */
  2106. var Blob = __webpack_require__(128);
  2107. /**
  2108. * Encodes a packet.
  2109. *
  2110. * <packet type id> [ <data> ]
  2111. *
  2112. * Example:
  2113. *
  2114. * 5hello world
  2115. * 3
  2116. * 4
  2117. *
  2118. * Binary is encoded in an identical principle
  2119. *
  2120. * @api private
  2121. */
  2122. exports.encodePacket = function (packet, supportsBinary, utf8encode, callback) {
  2123. if (typeof supportsBinary === 'function') {
  2124. callback = supportsBinary;
  2125. supportsBinary = false;
  2126. }
  2127. if (typeof utf8encode === 'function') {
  2128. callback = utf8encode;
  2129. utf8encode = null;
  2130. }
  2131. var data = (packet.data === undefined)
  2132. ? undefined
  2133. : packet.data.buffer || packet.data;
  2134. if (global.ArrayBuffer && data instanceof ArrayBuffer) {
  2135. return encodeArrayBuffer(packet, supportsBinary, callback);
  2136. } else if (Blob && data instanceof global.Blob) {
  2137. return encodeBlob(packet, supportsBinary, callback);
  2138. }
  2139. // might be an object with { base64: true, data: dataAsBase64String }
  2140. if (data && data.base64) {
  2141. return encodeBase64Object(packet, callback);
  2142. }
  2143. // Sending data as a utf-8 string
  2144. var encoded = packets[packet.type];
  2145. // data fragment is optional
  2146. if (undefined !== packet.data) {
  2147. encoded += utf8encode ? utf8.encode(String(packet.data), { strict: false }) : String(packet.data);
  2148. }
  2149. return callback('' + encoded);
  2150. };
  2151. function encodeBase64Object(packet, callback) {
  2152. // packet data is an object { base64: true, data: dataAsBase64String }
  2153. var message = 'b' + exports.packets[packet.type] + packet.data.data;
  2154. return callback(message);
  2155. }
  2156. /**
  2157. * Encode packet helpers for binary types
  2158. */
  2159. function encodeArrayBuffer(packet, supportsBinary, callback) {
  2160. if (!supportsBinary) {
  2161. return exports.encodeBase64Packet(packet, callback);
  2162. }
  2163. var data = packet.data;
  2164. var contentArray = new Uint8Array(data);
  2165. var resultBuffer = new Uint8Array(1 + data.byteLength);
  2166. resultBuffer[0] = packets[packet.type];
  2167. for (var i = 0; i < contentArray.length; i++) {
  2168. resultBuffer[i+1] = contentArray[i];
  2169. }
  2170. return callback(resultBuffer.buffer);
  2171. }
  2172. function encodeBlobAsArrayBuffer(packet, supportsBinary, callback) {
  2173. if (!supportsBinary) {
  2174. return exports.encodeBase64Packet(packet, callback);
  2175. }
  2176. var fr = new FileReader();
  2177. fr.onload = function() {
  2178. packet.data = fr.result;
  2179. exports.encodePacket(packet, supportsBinary, true, callback);
  2180. };
  2181. return fr.readAsArrayBuffer(packet.data);
  2182. }
  2183. function encodeBlob(packet, supportsBinary, callback) {
  2184. if (!supportsBinary) {
  2185. return exports.encodeBase64Packet(packet, callback);
  2186. }
  2187. if (dontSendBlobs) {
  2188. return encodeBlobAsArrayBuffer(packet, supportsBinary, callback);
  2189. }
  2190. var length = new Uint8Array(1);
  2191. length[0] = packets[packet.type];
  2192. var blob = new Blob([length.buffer, packet.data]);
  2193. return callback(blob);
  2194. }
  2195. /**
  2196. * Encodes a packet with binary data in a base64 string
  2197. *
  2198. * @param {Object} packet, has `type` and `data`
  2199. * @return {String} base64 encoded message
  2200. */
  2201. exports.encodeBase64Packet = function(packet, callback) {
  2202. var message = 'b' + exports.packets[packet.type];
  2203. if (Blob && packet.data instanceof global.Blob) {
  2204. var fr = new FileReader();
  2205. fr.onload = function() {
  2206. var b64 = fr.result.split(',')[1];
  2207. callback(message + b64);
  2208. };
  2209. return fr.readAsDataURL(packet.data);
  2210. }
  2211. var b64data;
  2212. try {
  2213. b64data = String.fromCharCode.apply(null, new Uint8Array(packet.data));
  2214. } catch (e) {
  2215. // iPhone Safari doesn't let you apply with typed arrays
  2216. var typed = new Uint8Array(packet.data);
  2217. var basic = new Array(typed.length);
  2218. for (var i = 0; i < typed.length; i++) {
  2219. basic[i] = typed[i];
  2220. }
  2221. b64data = String.fromCharCode.apply(null, basic);
  2222. }
  2223. message += global.btoa(b64data);
  2224. return callback(message);
  2225. };
  2226. /**
  2227. * Decodes a packet. Changes format to Blob if requested.
  2228. *
  2229. * @return {Object} with `type` and `data` (if any)
  2230. * @api private
  2231. */
  2232. exports.decodePacket = function (data, binaryType, utf8decode) {
  2233. if (data === undefined) {
  2234. return err;
  2235. }
  2236. // String data
  2237. if (typeof data === 'string') {
  2238. if (data.charAt(0) === 'b') {
  2239. return exports.decodeBase64Packet(data.substr(1), binaryType);
  2240. }
  2241. if (utf8decode) {
  2242. data = tryDecode(data);
  2243. if (data === false) {
  2244. return err;
  2245. }
  2246. }
  2247. var type = data.charAt(0);
  2248. if (Number(type) != type || !packetslist[type]) {
  2249. return err;
  2250. }
  2251. if (data.length > 1) {
  2252. return { type: packetslist[type], data: data.substring(1) };
  2253. } else {
  2254. return { type: packetslist[type] };
  2255. }
  2256. }
  2257. var asArray = new Uint8Array(data);
  2258. var type = asArray[0];
  2259. var rest = sliceBuffer(data, 1);
  2260. if (Blob && binaryType === 'blob') {
  2261. rest = new Blob([rest]);
  2262. }
  2263. return { type: packetslist[type], data: rest };
  2264. };
  2265. function tryDecode(data) {
  2266. try {
  2267. data = utf8.decode(data, { strict: false });
  2268. } catch (e) {
  2269. return false;
  2270. }
  2271. return data;
  2272. }
  2273. /**
  2274. * Decodes a packet encoded in a base64 string
  2275. *
  2276. * @param {String} base64 encoded message
  2277. * @return {Object} with `type` and `data` (if any)
  2278. */
  2279. exports.decodeBase64Packet = function(msg, binaryType) {
  2280. var type = packetslist[msg.charAt(0)];
  2281. if (!base64encoder) {
  2282. return { type: type, data: { base64: true, data: msg.substr(1) } };
  2283. }
  2284. var data = base64encoder.decode(msg.substr(1));
  2285. if (binaryType === 'blob' && Blob) {
  2286. data = new Blob([data]);
  2287. }
  2288. return { type: type, data: data };
  2289. };
  2290. /**
  2291. * Encodes multiple messages (payload).
  2292. *
  2293. * <length>:data
  2294. *
  2295. * Example:
  2296. *
  2297. * 11:hello world2:hi
  2298. *
  2299. * If any contents are binary, they will be encoded as base64 strings. Base64
  2300. * encoded strings are marked with a b before the length specifier
  2301. *
  2302. * @param {Array} packets
  2303. * @api private
  2304. */
  2305. exports.encodePayload = function (packets, supportsBinary, callback) {
  2306. if (typeof supportsBinary === 'function') {
  2307. callback = supportsBinary;
  2308. supportsBinary = null;
  2309. }
  2310. var isBinary = hasBinary(packets);
  2311. if (supportsBinary && isBinary) {
  2312. if (Blob && !dontSendBlobs) {
  2313. return exports.encodePayloadAsBlob(packets, callback);
  2314. }
  2315. return exports.encodePayloadAsArrayBuffer(packets, callback);
  2316. }
  2317. if (!packets.length) {
  2318. return callback('0:');
  2319. }
  2320. function setLengthHeader(message) {
  2321. return message.length + ':' + message;
  2322. }
  2323. function encodeOne(packet, doneCallback) {
  2324. exports.encodePacket(packet, !isBinary ? false : supportsBinary, false, function(message) {
  2325. doneCallback(null, setLengthHeader(message));
  2326. });
  2327. }
  2328. map(packets, encodeOne, function(err, results) {
  2329. return callback(results.join(''));
  2330. });
  2331. };
  2332. /**
  2333. * Async array map using after
  2334. */
  2335. function map(ary, each, done) {
  2336. var result = new Array(ary.length);
  2337. var next = after(ary.length, done);
  2338. var eachWithIndex = function(i, el, cb) {
  2339. each(el, function(error, msg) {
  2340. result[i] = msg;
  2341. cb(error, result);
  2342. });
  2343. };
  2344. for (var i = 0; i < ary.length; i++) {
  2345. eachWithIndex(i, ary[i], next);
  2346. }
  2347. }
  2348. /*
  2349. * Decodes data when a payload is maybe expected. Possible binary contents are
  2350. * decoded from their base64 representation
  2351. *
  2352. * @param {String} data, callback method
  2353. * @api public
  2354. */
  2355. exports.decodePayload = function (data, binaryType, callback) {
  2356. if (typeof data !== 'string') {
  2357. return exports.decodePayloadAsBinary(data, binaryType, callback);
  2358. }
  2359. if (typeof binaryType === 'function') {
  2360. callback = binaryType;
  2361. binaryType = null;
  2362. }
  2363. var packet;
  2364. if (data === '') {
  2365. // parser error - ignoring payload
  2366. return callback(err, 0, 1);
  2367. }
  2368. var length = '', n, msg;
  2369. for (var i = 0, l = data.length; i < l; i++) {
  2370. var chr = data.charAt(i);
  2371. if (chr !== ':') {
  2372. length += chr;
  2373. continue;
  2374. }
  2375. if (length === '' || (length != (n = Number(length)))) {
  2376. // parser error - ignoring payload
  2377. return callback(err, 0, 1);
  2378. }
  2379. msg = data.substr(i + 1, n);
  2380. if (length != msg.length) {
  2381. // parser error - ignoring payload
  2382. return callback(err, 0, 1);
  2383. }
  2384. if (msg.length) {
  2385. packet = exports.decodePacket(msg, binaryType, false);
  2386. if (err.type === packet.type && err.data === packet.data) {
  2387. // parser error in individual packet - ignoring payload
  2388. return callback(err, 0, 1);
  2389. }
  2390. var ret = callback(packet, i + n, l);
  2391. if (false === ret) return;
  2392. }
  2393. // advance cursor
  2394. i += n;
  2395. length = '';
  2396. }
  2397. if (length !== '') {
  2398. // parser error - ignoring payload
  2399. return callback(err, 0, 1);
  2400. }
  2401. };
  2402. /**
  2403. * Encodes multiple messages (payload) as binary.
  2404. *
  2405. * <1 = binary, 0 = string><number from 0-9><number from 0-9>[...]<number
  2406. * 255><data>
  2407. *
  2408. * Example:
  2409. * 1 3 255 1 2 3, if the binary contents are interpreted as 8 bit integers
  2410. *
  2411. * @param {Array} packets
  2412. * @return {ArrayBuffer} encoded payload
  2413. * @api private
  2414. */
  2415. exports.encodePayloadAsArrayBuffer = function(packets, callback) {
  2416. if (!packets.length) {
  2417. return callback(new ArrayBuffer(0));
  2418. }
  2419. function encodeOne(packet, doneCallback) {
  2420. exports.encodePacket(packet, true, true, function(data) {
  2421. return doneCallback(null, data);
  2422. });
  2423. }
  2424. map(packets, encodeOne, function(err, encodedPackets) {
  2425. var totalLength = encodedPackets.reduce(function(acc, p) {
  2426. var len;
  2427. if (typeof p === 'string'){
  2428. len = p.length;
  2429. } else {
  2430. len = p.byteLength;
  2431. }
  2432. return acc + len.toString().length + len + 2; // string/binary identifier + separator = 2
  2433. }, 0);
  2434. var resultArray = new Uint8Array(totalLength);
  2435. var bufferIndex = 0;
  2436. encodedPackets.forEach(function(p) {
  2437. var isString = typeof p === 'string';
  2438. var ab = p;
  2439. if (isString) {
  2440. var view = new Uint8Array(p.length);
  2441. for (var i = 0; i < p.length; i++) {
  2442. view[i] = p.charCodeAt(i);
  2443. }
  2444. ab = view.buffer;
  2445. }
  2446. if (isString) { // not true binary
  2447. resultArray[bufferIndex++] = 0;
  2448. } else { // true binary
  2449. resultArray[bufferIndex++] = 1;
  2450. }
  2451. var lenStr = ab.byteLength.toString();
  2452. for (var i = 0; i < lenStr.length; i++) {
  2453. resultArray[bufferIndex++] = parseInt(lenStr[i]);
  2454. }
  2455. resultArray[bufferIndex++] = 255;
  2456. var view = new Uint8Array(ab);
  2457. for (var i = 0; i < view.length; i++) {
  2458. resultArray[bufferIndex++] = view[i];
  2459. }
  2460. });
  2461. return callback(resultArray.buffer);
  2462. });
  2463. };
  2464. /**
  2465. * Encode as Blob
  2466. */
  2467. exports.encodePayloadAsBlob = function(packets, callback) {
  2468. function encodeOne(packet, doneCallback) {
  2469. exports.encodePacket(packet, true, true, function(encoded) {
  2470. var binaryIdentifier = new Uint8Array(1);
  2471. binaryIdentifier[0] = 1;
  2472. if (typeof encoded === 'string') {
  2473. var view = new Uint8Array(encoded.length);
  2474. for (var i = 0; i < encoded.length; i++) {
  2475. view[i] = encoded.charCodeAt(i);
  2476. }
  2477. encoded = view.buffer;
  2478. binaryIdentifier[0] = 0;
  2479. }
  2480. var len = (encoded instanceof ArrayBuffer)
  2481. ? encoded.byteLength
  2482. : encoded.size;
  2483. var lenStr = len.toString();
  2484. var lengthAry = new Uint8Array(lenStr.length + 1);
  2485. for (var i = 0; i < lenStr.length; i++) {
  2486. lengthAry[i] = parseInt(lenStr[i]);
  2487. }
  2488. lengthAry[lenStr.length] = 255;
  2489. if (Blob) {
  2490. var blob = new Blob([binaryIdentifier.buffer, lengthAry.buffer, encoded]);
  2491. doneCallback(null, blob);
  2492. }
  2493. });
  2494. }
  2495. map(packets, encodeOne, function(err, results) {
  2496. return callback(new Blob(results));
  2497. });
  2498. };
  2499. /*
  2500. * Decodes data when a payload is maybe expected. Strings are decoded by
  2501. * interpreting each byte as a key code for entries marked to start with 0. See
  2502. * description of encodePayloadAsBinary
  2503. *
  2504. * @param {ArrayBuffer} data, callback method
  2505. * @api public
  2506. */
  2507. exports.decodePayloadAsBinary = function (data, binaryType, callback) {
  2508. if (typeof binaryType === 'function') {
  2509. callback = binaryType;
  2510. binaryType = null;
  2511. }
  2512. var bufferTail = data;
  2513. var buffers = [];
  2514. while (bufferTail.byteLength > 0) {
  2515. var tailArray = new Uint8Array(bufferTail);
  2516. var isString = tailArray[0] === 0;
  2517. var msgLength = '';
  2518. for (var i = 1; ; i++) {
  2519. if (tailArray[i] === 255) break;
  2520. // 310 = char length of Number.MAX_VALUE
  2521. if (msgLength.length > 310) {
  2522. return callback(err, 0, 1);
  2523. }
  2524. msgLength += tailArray[i];
  2525. }
  2526. bufferTail = sliceBuffer(bufferTail, 2 + msgLength.length);
  2527. msgLength = parseInt(msgLength);
  2528. var msg = sliceBuffer(bufferTail, 0, msgLength);
  2529. if (isString) {
  2530. try {
  2531. msg = String.fromCharCode.apply(null, new Uint8Array(msg));
  2532. } catch (e) {
  2533. // iPhone Safari doesn't let you apply to typed arrays
  2534. var typed = new Uint8Array(msg);
  2535. msg = '';
  2536. for (var i = 0; i < typed.length; i++) {
  2537. msg += String.fromCharCode(typed[i]);
  2538. }
  2539. }
  2540. }
  2541. buffers.push(msg);
  2542. bufferTail = sliceBuffer(bufferTail, msgLength);
  2543. }
  2544. var total = buffers.length;
  2545. buffers.forEach(function(buffer, i) {
  2546. callback(exports.decodePacket(buffer, binaryType, true), i, total);
  2547. });
  2548. };
  2549. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
  2550. /***/ }),
  2551. /* 20 */
  2552. /***/ (function(module, exports, __webpack_require__) {
  2553. "use strict";
  2554. Object.defineProperty(exports, "__esModule", { value: true });
  2555. var _a;
  2556. var BehaviorSubject_1 = __webpack_require__(14);
  2557. var prop_set_dom_effect_1 = __webpack_require__(75);
  2558. var style_set_dom_effect_1 = __webpack_require__(80);
  2559. var link_replace_dom_effect_1 = __webpack_require__(81);
  2560. var set_scroll_dom_effect_1 = __webpack_require__(82);
  2561. var set_window_name_dom_effect_1 = __webpack_require__(83);
  2562. var Events;
  2563. (function (Events) {
  2564. Events["PropSet"] = "@@BSDOM.Events.PropSet";
  2565. Events["StyleSet"] = "@@BSDOM.Events.StyleSet";
  2566. Events["LinkReplace"] = "@@BSDOM.Events.LinkReplace";
  2567. Events["SetScroll"] = "@@BSDOM.Events.SetScroll";
  2568. Events["SetWindowName"] = "@@BSDOM.Events.SetWindowName";
  2569. })(Events = exports.Events || (exports.Events = {}));
  2570. exports.domHandlers$ = new BehaviorSubject_1.BehaviorSubject((_a = {},
  2571. _a[Events.PropSet] = prop_set_dom_effect_1.propSetDomEffect,
  2572. _a[Events.StyleSet] = style_set_dom_effect_1.styleSetDomEffect,
  2573. _a[Events.LinkReplace] = link_replace_dom_effect_1.linkReplaceDomEffect,
  2574. _a[Events.SetScroll] = set_scroll_dom_effect_1.setScrollDomEffect,
  2575. _a[Events.SetWindowName] = set_window_name_dom_effect_1.setWindowNameDomEffect,
  2576. _a));
  2577. /***/ }),
  2578. /* 21 */
  2579. /***/ (function(module, exports, __webpack_require__) {
  2580. "use strict";
  2581. var __extends = (this && this.__extends) || function (d, b) {
  2582. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  2583. function __() { this.constructor = d; }
  2584. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  2585. };
  2586. var OuterSubscriber_1 = __webpack_require__(29);
  2587. var subscribeToResult_1 = __webpack_require__(30);
  2588. /* tslint:enable:max-line-length */
  2589. /**
  2590. * Projects each source value to an Observable which is merged in the output
  2591. * Observable, emitting values only from the most recently projected Observable.
  2592. *
  2593. * <span class="informal">Maps each value to an Observable, then flattens all of
  2594. * these inner Observables using {@link switch}.</span>
  2595. *
  2596. * <img src="./img/switchMap.png" width="100%">
  2597. *
  2598. * Returns an Observable that emits items based on applying a function that you
  2599. * supply to each item emitted by the source Observable, where that function
  2600. * returns an (so-called "inner") Observable. Each time it observes one of these
  2601. * inner Observables, the output Observable begins emitting the items emitted by
  2602. * that inner Observable. When a new inner Observable is emitted, `switchMap`
  2603. * stops emitting items from the earlier-emitted inner Observable and begins
  2604. * emitting items from the new one. It continues to behave like this for
  2605. * subsequent inner Observables.
  2606. *
  2607. * @example <caption>Rerun an interval Observable on every click event</caption>
  2608. * var clicks = Rx.Observable.fromEvent(document, 'click');
  2609. * var result = clicks.switchMap((ev) => Rx.Observable.interval(1000));
  2610. * result.subscribe(x => console.log(x));
  2611. *
  2612. * @see {@link concatMap}
  2613. * @see {@link exhaustMap}
  2614. * @see {@link mergeMap}
  2615. * @see {@link switch}
  2616. * @see {@link switchMapTo}
  2617. *
  2618. * @param {function(value: T, ?index: number): ObservableInput} project A function
  2619. * that, when applied to an item emitted by the source Observable, returns an
  2620. * Observable.
  2621. * @param {function(outerValue: T, innerValue: I, outerIndex: number, innerIndex: number): any} [resultSelector]
  2622. * A function to produce the value on the output Observable based on the values
  2623. * and the indices of the source (outer) emission and the inner Observable
  2624. * emission. The arguments passed to this function are:
  2625. * - `outerValue`: the value that came from the source
  2626. * - `innerValue`: the value that came from the projected Observable
  2627. * - `outerIndex`: the "index" of the value that came from the source
  2628. * - `innerIndex`: the "index" of the value from the projected Observable
  2629. * @return {Observable} An Observable that emits the result of applying the
  2630. * projection function (and the optional `resultSelector`) to each item emitted
  2631. * by the source Observable and taking only the values from the most recently
  2632. * projected inner Observable.
  2633. * @method switchMap
  2634. * @owner Observable
  2635. */
  2636. function switchMap(project, resultSelector) {
  2637. return function switchMapOperatorFunction(source) {
  2638. return source.lift(new SwitchMapOperator(project, resultSelector));
  2639. };
  2640. }
  2641. exports.switchMap = switchMap;
  2642. var SwitchMapOperator = (function () {
  2643. function SwitchMapOperator(project, resultSelector) {
  2644. this.project = project;
  2645. this.resultSelector = resultSelector;
  2646. }
  2647. SwitchMapOperator.prototype.call = function (subscriber, source) {
  2648. return source.subscribe(new SwitchMapSubscriber(subscriber, this.project, this.resultSelector));
  2649. };
  2650. return SwitchMapOperator;
  2651. }());
  2652. /**
  2653. * We need this JSDoc comment for affecting ESDoc.
  2654. * @ignore
  2655. * @extends {Ignored}
  2656. */
  2657. var SwitchMapSubscriber = (function (_super) {
  2658. __extends(SwitchMapSubscriber, _super);
  2659. function SwitchMapSubscriber(destination, project, resultSelector) {
  2660. _super.call(this, destination);
  2661. this.project = project;
  2662. this.resultSelector = resultSelector;
  2663. this.index = 0;
  2664. }
  2665. SwitchMapSubscriber.prototype._next = function (value) {
  2666. var result;
  2667. var index = this.index++;
  2668. try {
  2669. result = this.project(value, index);
  2670. }
  2671. catch (error) {
  2672. this.destination.error(error);
  2673. return;
  2674. }
  2675. this._innerSub(result, value, index);
  2676. };
  2677. SwitchMapSubscriber.prototype._innerSub = function (result, value, index) {
  2678. var innerSubscription = this.innerSubscription;
  2679. if (innerSubscription) {
  2680. innerSubscription.unsubscribe();
  2681. }
  2682. this.add(this.innerSubscription = subscribeToResult_1.subscribeToResult(this, result, value, index));
  2683. };
  2684. SwitchMapSubscriber.prototype._complete = function () {
  2685. var innerSubscription = this.innerSubscription;
  2686. if (!innerSubscription || innerSubscription.closed) {
  2687. _super.prototype._complete.call(this);
  2688. }
  2689. };
  2690. /** @deprecated internal use only */ SwitchMapSubscriber.prototype._unsubscribe = function () {
  2691. this.innerSubscription = null;
  2692. };
  2693. SwitchMapSubscriber.prototype.notifyComplete = function (innerSub) {
  2694. this.remove(innerSub);
  2695. this.innerSubscription = null;
  2696. if (this.isStopped) {
  2697. _super.prototype._complete.call(this);
  2698. }
  2699. };
  2700. SwitchMapSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  2701. if (this.resultSelector) {
  2702. this._tryNotifyNext(outerValue, innerValue, outerIndex, innerIndex);
  2703. }
  2704. else {
  2705. this.destination.next(innerValue);
  2706. }
  2707. };
  2708. SwitchMapSubscriber.prototype._tryNotifyNext = function (outerValue, innerValue, outerIndex, innerIndex) {
  2709. var result;
  2710. try {
  2711. result = this.resultSelector(outerValue, innerValue, outerIndex, innerIndex);
  2712. }
  2713. catch (err) {
  2714. this.destination.error(err);
  2715. return;
  2716. }
  2717. this.destination.next(result);
  2718. };
  2719. return SwitchMapSubscriber;
  2720. }(OuterSubscriber_1.OuterSubscriber));
  2721. //# sourceMappingURL=switchMap.js.map
  2722. /***/ }),
  2723. /* 22 */
  2724. /***/ (function(module, exports, __webpack_require__) {
  2725. "use strict";
  2726. Object.defineProperty(exports, "__esModule", { value: true });
  2727. var concat_1 = __webpack_require__(53);
  2728. var timer_1 = __webpack_require__(51);
  2729. var of_1 = __webpack_require__(10);
  2730. var switchMap_1 = __webpack_require__(21);
  2731. var startWith_1 = __webpack_require__(153);
  2732. var mapTo_1 = __webpack_require__(87);
  2733. function each(incoming) {
  2734. return [].slice.call(incoming || []);
  2735. }
  2736. exports.each = each;
  2737. exports.splitUrl = function (url) {
  2738. var hash, index, params;
  2739. if ((index = url.indexOf("#")) >= 0) {
  2740. hash = url.slice(index);
  2741. url = url.slice(0, index);
  2742. }
  2743. else {
  2744. hash = "";
  2745. }
  2746. if ((index = url.indexOf("?")) >= 0) {
  2747. params = url.slice(index);
  2748. url = url.slice(0, index);
  2749. }
  2750. else {
  2751. params = "";
  2752. }
  2753. return { url: url, params: params, hash: hash };
  2754. };
  2755. exports.pathFromUrl = function (url) {
  2756. var path;
  2757. (url = exports.splitUrl(url).url);
  2758. if (url.indexOf("file://") === 0) {
  2759. path = url.replace(new RegExp("^file://(localhost)?"), "");
  2760. }
  2761. else {
  2762. // http : // hostname :8080 /
  2763. path = url.replace(new RegExp("^([^:]+:)?//([^:/]+)(:\\d*)?/"), "/");
  2764. }
  2765. // decodeURI has special handling of stuff like semicolons, so use decodeURIComponent
  2766. return decodeURIComponent(path);
  2767. };
  2768. exports.pickBestMatch = function (path, objects, pathFunc) {
  2769. var score;
  2770. var bestMatch = { score: 0, object: null };
  2771. objects.forEach(function (object) {
  2772. score = exports.numberOfMatchingSegments(path, pathFunc(object));
  2773. if (score > bestMatch.score) {
  2774. bestMatch = { object: object, score: score };
  2775. }
  2776. });
  2777. if (bestMatch.score > 0) {
  2778. return bestMatch;
  2779. }
  2780. else {
  2781. return null;
  2782. }
  2783. };
  2784. exports.numberOfMatchingSegments = function (path1, path2) {
  2785. path1 = normalisePath(path1);
  2786. path2 = normalisePath(path2);
  2787. if (path1 === path2) {
  2788. return 10000;
  2789. }
  2790. var comps1 = path1.split("/").reverse();
  2791. var comps2 = path2.split("/").reverse();
  2792. var len = Math.min(comps1.length, comps2.length);
  2793. var eqCount = 0;
  2794. while (eqCount < len && comps1[eqCount] === comps2[eqCount]) {
  2795. ++eqCount;
  2796. }
  2797. return eqCount;
  2798. };
  2799. exports.pathsMatch = function (path1, path2) {
  2800. return exports.numberOfMatchingSegments(path1, path2) > 0;
  2801. };
  2802. function getLocation(url) {
  2803. var location = document.createElement("a");
  2804. location.href = url;
  2805. if (location.host === "") {
  2806. location.href = location.href;
  2807. }
  2808. return location;
  2809. }
  2810. exports.getLocation = getLocation;
  2811. /**
  2812. * @param {string} search
  2813. * @param {string} key
  2814. * @param {string} suffix
  2815. */
  2816. function updateSearch(search, key, suffix) {
  2817. if (search === "") {
  2818. return "?" + suffix;
  2819. }
  2820. return ("?" +
  2821. search
  2822. .slice(1)
  2823. .split("&")
  2824. .map(function (item) {
  2825. return item.split("=");
  2826. })
  2827. .filter(function (tuple) {
  2828. return tuple[0] !== key;
  2829. })
  2830. .map(function (item) {
  2831. return [item[0], item[1]].join("=");
  2832. })
  2833. .concat(suffix)
  2834. .join("&"));
  2835. }
  2836. exports.updateSearch = updateSearch;
  2837. var blacklist = [
  2838. // never allow .map files through
  2839. function (incoming) {
  2840. return incoming.ext === "map";
  2841. }
  2842. ];
  2843. /**
  2844. * @param incoming
  2845. * @returns {boolean}
  2846. */
  2847. function isBlacklisted(incoming) {
  2848. return blacklist.some(function (fn) {
  2849. return fn(incoming);
  2850. });
  2851. }
  2852. exports.isBlacklisted = isBlacklisted;
  2853. function createTimedBooleanSwitch(source$, timeout) {
  2854. if (timeout === void 0) { timeout = 1000; }
  2855. return source$.pipe(switchMap_1.switchMap(function () {
  2856. return concat_1.concat(of_1.of(false), timer_1.timer(timeout).pipe(mapTo_1.mapTo(true)));
  2857. }), startWith_1.startWith(true));
  2858. }
  2859. exports.createTimedBooleanSwitch = createTimedBooleanSwitch;
  2860. function array(incoming) {
  2861. return [].slice.call(incoming);
  2862. }
  2863. exports.array = array;
  2864. function normalisePath(path) {
  2865. return path
  2866. .replace(/^\/+/, "")
  2867. .replace(/\\/g, "/")
  2868. .toLowerCase();
  2869. }
  2870. exports.normalisePath = normalisePath;
  2871. /***/ }),
  2872. /* 23 */
  2873. /***/ (function(module, exports, __webpack_require__) {
  2874. "use strict";
  2875. Object.defineProperty(exports, "__esModule", { value: true });
  2876. function getWindow() {
  2877. return window;
  2878. }
  2879. exports.getWindow = getWindow;
  2880. /**
  2881. * @returns {HTMLDocument}
  2882. */
  2883. function getDocument() {
  2884. return document;
  2885. }
  2886. exports.getDocument = getDocument;
  2887. /**
  2888. * Get the current x/y position crossbow
  2889. * @returns {{x: *, y: *}}
  2890. */
  2891. function getBrowserScrollPosition(window, document) {
  2892. var scrollX;
  2893. var scrollY;
  2894. var dElement = document.documentElement;
  2895. var dBody = document.body;
  2896. if (window.pageYOffset !== undefined) {
  2897. scrollX = window.pageXOffset;
  2898. scrollY = window.pageYOffset;
  2899. }
  2900. else {
  2901. scrollX = dElement.scrollLeft || dBody.scrollLeft || 0;
  2902. scrollY = dElement.scrollTop || dBody.scrollTop || 0;
  2903. }
  2904. return {
  2905. x: scrollX,
  2906. y: scrollY
  2907. };
  2908. }
  2909. exports.getBrowserScrollPosition = getBrowserScrollPosition;
  2910. /**
  2911. * @returns {{x: number, y: number}}
  2912. */
  2913. function getDocumentScrollSpace(document) {
  2914. var dElement = document.documentElement;
  2915. var dBody = document.body;
  2916. return {
  2917. x: dBody.scrollHeight - dElement.clientWidth,
  2918. y: dBody.scrollHeight - dElement.clientHeight
  2919. };
  2920. }
  2921. exports.getDocumentScrollSpace = getDocumentScrollSpace;
  2922. /**
  2923. * Saves scroll position into cookies
  2924. */
  2925. function saveScrollPosition(window, document) {
  2926. var pos = getBrowserScrollPosition(window, document);
  2927. document.cookie = "bs_scroll_pos=" + [pos.x, pos.y].join(",");
  2928. }
  2929. exports.saveScrollPosition = saveScrollPosition;
  2930. /**
  2931. * Restores scroll position from cookies
  2932. */
  2933. function restoreScrollPosition() {
  2934. var pos = getDocument()
  2935. .cookie.replace(/(?:(?:^|.*;\s*)bs_scroll_pos\s*\=\s*([^;]*).*$)|^.*$/, "$1")
  2936. .split(",");
  2937. getWindow().scrollTo(Number(pos[0]), Number(pos[1]));
  2938. }
  2939. exports.restoreScrollPosition = restoreScrollPosition;
  2940. /**
  2941. * @param tagName
  2942. * @param elem
  2943. * @returns {*|number}
  2944. */
  2945. function getElementIndex(tagName, elem) {
  2946. var allElems = getDocument().getElementsByTagName(tagName);
  2947. return Array.prototype.indexOf.call(allElems, elem);
  2948. }
  2949. exports.getElementIndex = getElementIndex;
  2950. /**
  2951. * Force Change event on radio & checkboxes (IE)
  2952. */
  2953. function forceChange(elem) {
  2954. elem.blur();
  2955. elem.focus();
  2956. }
  2957. exports.forceChange = forceChange;
  2958. /**
  2959. * @param elem
  2960. * @returns {{tagName: (elem.tagName|*), index: *}}
  2961. */
  2962. function getElementData(elem) {
  2963. var tagName = elem.tagName;
  2964. var index = getElementIndex(tagName, elem);
  2965. return {
  2966. tagName: tagName,
  2967. index: index
  2968. };
  2969. }
  2970. exports.getElementData = getElementData;
  2971. /**
  2972. * @param {string} tagName
  2973. * @param {number} index
  2974. */
  2975. function getSingleElement(tagName, index) {
  2976. var elems = getDocument().getElementsByTagName(tagName);
  2977. return elems[index];
  2978. }
  2979. exports.getSingleElement = getSingleElement;
  2980. /**
  2981. * Get the body element
  2982. */
  2983. function getBody() {
  2984. return getDocument().getElementsByTagName("body")[0];
  2985. }
  2986. exports.getBody = getBody;
  2987. /**
  2988. * @param {{x: number, y: number}} pos
  2989. */
  2990. function setScroll(pos) {
  2991. getWindow().scrollTo(pos.x, pos.y);
  2992. }
  2993. exports.setScroll = setScroll;
  2994. /**
  2995. * Hard reload
  2996. */
  2997. function reloadBrowser() {
  2998. getWindow().location.reload(true);
  2999. }
  3000. exports.reloadBrowser = reloadBrowser;
  3001. /**
  3002. * Foreach polyfill
  3003. * @param coll
  3004. * @param fn
  3005. */
  3006. function forEach(coll, fn) {
  3007. for (var i = 0, n = coll.length; i < n; i += 1) {
  3008. fn(coll[i], i, coll);
  3009. }
  3010. }
  3011. exports.forEach = forEach;
  3012. /**
  3013. * Are we dealing with old IE?
  3014. * @returns {boolean}
  3015. */
  3016. function isOldIe() {
  3017. return typeof getWindow().attachEvent !== "undefined";
  3018. }
  3019. exports.isOldIe = isOldIe;
  3020. /**
  3021. * Split the URL information
  3022. * @returns {object}
  3023. */
  3024. function getLocation(url) {
  3025. var location = getDocument().createElement("a");
  3026. location.href = url;
  3027. if (location.host === "") {
  3028. location.href = location.href;
  3029. }
  3030. return location;
  3031. }
  3032. exports.getLocation = getLocation;
  3033. /**
  3034. * @param {String} val
  3035. * @returns {boolean}
  3036. */
  3037. function isUndefined(val) {
  3038. return "undefined" === typeof val;
  3039. }
  3040. exports.isUndefined = isUndefined;
  3041. /**
  3042. * @param obj
  3043. * @param path
  3044. */
  3045. function getByPath(obj, path) {
  3046. for (var i = 0, tempPath = path.split("."), len = tempPath.length; i < len; i++) {
  3047. if (!obj || typeof obj !== "object") {
  3048. return false;
  3049. }
  3050. obj = obj[tempPath[i]];
  3051. }
  3052. if (typeof obj === "undefined") {
  3053. return false;
  3054. }
  3055. return obj;
  3056. }
  3057. exports.getByPath = getByPath;
  3058. function getScrollPosition(window, document) {
  3059. var pos = getBrowserScrollPosition(window, document);
  3060. return {
  3061. raw: pos,
  3062. proportional: getScrollTopPercentage(pos, document) // Get % of y axis of scroll
  3063. };
  3064. }
  3065. exports.getScrollPosition = getScrollPosition;
  3066. function getScrollPositionForElement(element) {
  3067. var raw = {
  3068. x: element.scrollLeft,
  3069. y: element.scrollTop
  3070. };
  3071. var scrollSpace = {
  3072. x: element.scrollWidth,
  3073. y: element.scrollHeight
  3074. };
  3075. return {
  3076. raw: raw,
  3077. proportional: getScrollPercentage(scrollSpace, raw).y // Get % of y axis of scroll
  3078. };
  3079. }
  3080. exports.getScrollPositionForElement = getScrollPositionForElement;
  3081. function getScrollTopPercentage(pos, document) {
  3082. var scrollSpace = getDocumentScrollSpace(document);
  3083. var percentage = getScrollPercentage(scrollSpace, pos);
  3084. return percentage.y;
  3085. }
  3086. exports.getScrollTopPercentage = getScrollTopPercentage;
  3087. function getScrollPercentage(scrollSpace, scrollPosition) {
  3088. var x = scrollPosition.x / scrollSpace.x;
  3089. var y = scrollPosition.y / scrollSpace.y;
  3090. return {
  3091. x: x || 0,
  3092. y: y
  3093. };
  3094. }
  3095. exports.getScrollPercentage = getScrollPercentage;
  3096. /***/ }),
  3097. /* 24 */
  3098. /***/ (function(module, exports, __webpack_require__) {
  3099. "use strict";
  3100. var __extends = (this && this.__extends) || function (d, b) {
  3101. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  3102. function __() { this.constructor = d; }
  3103. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3104. };
  3105. var Observable_1 = __webpack_require__(1);
  3106. var ScalarObservable_1 = __webpack_require__(46);
  3107. var EmptyObservable_1 = __webpack_require__(28);
  3108. var isScheduler_1 = __webpack_require__(25);
  3109. /**
  3110. * We need this JSDoc comment for affecting ESDoc.
  3111. * @extends {Ignored}
  3112. * @hide true
  3113. */
  3114. var ArrayObservable = (function (_super) {
  3115. __extends(ArrayObservable, _super);
  3116. function ArrayObservable(array, scheduler) {
  3117. _super.call(this);
  3118. this.array = array;
  3119. this.scheduler = scheduler;
  3120. if (!scheduler && array.length === 1) {
  3121. this._isScalar = true;
  3122. this.value = array[0];
  3123. }
  3124. }
  3125. ArrayObservable.create = function (array, scheduler) {
  3126. return new ArrayObservable(array, scheduler);
  3127. };
  3128. /**
  3129. * Creates an Observable that emits some values you specify as arguments,
  3130. * immediately one after the other, and then emits a complete notification.
  3131. *
  3132. * <span class="informal">Emits the arguments you provide, then completes.
  3133. * </span>
  3134. *
  3135. * <img src="./img/of.png" width="100%">
  3136. *
  3137. * This static operator is useful for creating a simple Observable that only
  3138. * emits the arguments given, and the complete notification thereafter. It can
  3139. * be used for composing with other Observables, such as with {@link concat}.
  3140. * By default, it uses a `null` IScheduler, which means the `next`
  3141. * notifications are sent synchronously, although with a different IScheduler
  3142. * it is possible to determine when those notifications will be delivered.
  3143. *
  3144. * @example <caption>Emit 10, 20, 30, then 'a', 'b', 'c', then start ticking every second.</caption>
  3145. * var numbers = Rx.Observable.of(10, 20, 30);
  3146. * var letters = Rx.Observable.of('a', 'b', 'c');
  3147. * var interval = Rx.Observable.interval(1000);
  3148. * var result = numbers.concat(letters).concat(interval);
  3149. * result.subscribe(x => console.log(x));
  3150. *
  3151. * @see {@link create}
  3152. * @see {@link empty}
  3153. * @see {@link never}
  3154. * @see {@link throw}
  3155. *
  3156. * @param {...T} values Arguments that represent `next` values to be emitted.
  3157. * @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling
  3158. * the emissions of the `next` notifications.
  3159. * @return {Observable<T>} An Observable that emits each given input value.
  3160. * @static true
  3161. * @name of
  3162. * @owner Observable
  3163. */
  3164. ArrayObservable.of = function () {
  3165. var array = [];
  3166. for (var _i = 0; _i < arguments.length; _i++) {
  3167. array[_i - 0] = arguments[_i];
  3168. }
  3169. var scheduler = array[array.length - 1];
  3170. if (isScheduler_1.isScheduler(scheduler)) {
  3171. array.pop();
  3172. }
  3173. else {
  3174. scheduler = null;
  3175. }
  3176. var len = array.length;
  3177. if (len > 1) {
  3178. return new ArrayObservable(array, scheduler);
  3179. }
  3180. else if (len === 1) {
  3181. return new ScalarObservable_1.ScalarObservable(array[0], scheduler);
  3182. }
  3183. else {
  3184. return new EmptyObservable_1.EmptyObservable(scheduler);
  3185. }
  3186. };
  3187. ArrayObservable.dispatch = function (state) {
  3188. var array = state.array, index = state.index, count = state.count, subscriber = state.subscriber;
  3189. if (index >= count) {
  3190. subscriber.complete();
  3191. return;
  3192. }
  3193. subscriber.next(array[index]);
  3194. if (subscriber.closed) {
  3195. return;
  3196. }
  3197. state.index = index + 1;
  3198. this.schedule(state);
  3199. };
  3200. /** @deprecated internal use only */ ArrayObservable.prototype._subscribe = function (subscriber) {
  3201. var index = 0;
  3202. var array = this.array;
  3203. var count = array.length;
  3204. var scheduler = this.scheduler;
  3205. if (scheduler) {
  3206. return scheduler.schedule(ArrayObservable.dispatch, 0, {
  3207. array: array, index: index, count: count, subscriber: subscriber
  3208. });
  3209. }
  3210. else {
  3211. for (var i = 0; i < count && !subscriber.closed; i++) {
  3212. subscriber.next(array[i]);
  3213. }
  3214. subscriber.complete();
  3215. }
  3216. };
  3217. return ArrayObservable;
  3218. }(Observable_1.Observable));
  3219. exports.ArrayObservable = ArrayObservable;
  3220. //# sourceMappingURL=ArrayObservable.js.map
  3221. /***/ }),
  3222. /* 25 */
  3223. /***/ (function(module, exports, __webpack_require__) {
  3224. "use strict";
  3225. function isScheduler(value) {
  3226. return value && typeof value.schedule === 'function';
  3227. }
  3228. exports.isScheduler = isScheduler;
  3229. //# sourceMappingURL=isScheduler.js.map
  3230. /***/ }),
  3231. /* 26 */
  3232. /***/ (function(module, exports, __webpack_require__) {
  3233. "use strict";
  3234. exports.isArray = Array.isArray || (function (x) { return x && typeof x.length === 'number'; });
  3235. //# sourceMappingURL=isArray.js.map
  3236. /***/ }),
  3237. /* 27 */
  3238. /***/ (function(module, exports, __webpack_require__) {
  3239. "use strict";
  3240. // typeof any so that it we don't have to cast when comparing a result to the error object
  3241. exports.errorObject = { e: {} };
  3242. //# sourceMappingURL=errorObject.js.map
  3243. /***/ }),
  3244. /* 28 */
  3245. /***/ (function(module, exports, __webpack_require__) {
  3246. "use strict";
  3247. var __extends = (this && this.__extends) || function (d, b) {
  3248. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  3249. function __() { this.constructor = d; }
  3250. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3251. };
  3252. var Observable_1 = __webpack_require__(1);
  3253. /**
  3254. * We need this JSDoc comment for affecting ESDoc.
  3255. * @extends {Ignored}
  3256. * @hide true
  3257. */
  3258. var EmptyObservable = (function (_super) {
  3259. __extends(EmptyObservable, _super);
  3260. function EmptyObservable(scheduler) {
  3261. _super.call(this);
  3262. this.scheduler = scheduler;
  3263. }
  3264. /**
  3265. * Creates an Observable that emits no items to the Observer and immediately
  3266. * emits a complete notification.
  3267. *
  3268. * <span class="informal">Just emits 'complete', and nothing else.
  3269. * </span>
  3270. *
  3271. * <img src="./img/empty.png" width="100%">
  3272. *
  3273. * This static operator is useful for creating a simple Observable that only
  3274. * emits the complete notification. It can be used for composing with other
  3275. * Observables, such as in a {@link mergeMap}.
  3276. *
  3277. * @example <caption>Emit the number 7, then complete.</caption>
  3278. * var result = Rx.Observable.empty().startWith(7);
  3279. * result.subscribe(x => console.log(x));
  3280. *
  3281. * @example <caption>Map and flatten only odd numbers to the sequence 'a', 'b', 'c'</caption>
  3282. * var interval = Rx.Observable.interval(1000);
  3283. * var result = interval.mergeMap(x =>
  3284. * x % 2 === 1 ? Rx.Observable.of('a', 'b', 'c') : Rx.Observable.empty()
  3285. * );
  3286. * result.subscribe(x => console.log(x));
  3287. *
  3288. * // Results in the following to the console:
  3289. * // x is equal to the count on the interval eg(0,1,2,3,...)
  3290. * // x will occur every 1000ms
  3291. * // if x % 2 is equal to 1 print abc
  3292. * // if x % 2 is not equal to 1 nothing will be output
  3293. *
  3294. * @see {@link create}
  3295. * @see {@link never}
  3296. * @see {@link of}
  3297. * @see {@link throw}
  3298. *
  3299. * @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling
  3300. * the emission of the complete notification.
  3301. * @return {Observable} An "empty" Observable: emits only the complete
  3302. * notification.
  3303. * @static true
  3304. * @name empty
  3305. * @owner Observable
  3306. */
  3307. EmptyObservable.create = function (scheduler) {
  3308. return new EmptyObservable(scheduler);
  3309. };
  3310. EmptyObservable.dispatch = function (arg) {
  3311. var subscriber = arg.subscriber;
  3312. subscriber.complete();
  3313. };
  3314. /** @deprecated internal use only */ EmptyObservable.prototype._subscribe = function (subscriber) {
  3315. var scheduler = this.scheduler;
  3316. if (scheduler) {
  3317. return scheduler.schedule(EmptyObservable.dispatch, 0, { subscriber: subscriber });
  3318. }
  3319. else {
  3320. subscriber.complete();
  3321. }
  3322. };
  3323. return EmptyObservable;
  3324. }(Observable_1.Observable));
  3325. exports.EmptyObservable = EmptyObservable;
  3326. //# sourceMappingURL=EmptyObservable.js.map
  3327. /***/ }),
  3328. /* 29 */
  3329. /***/ (function(module, exports, __webpack_require__) {
  3330. "use strict";
  3331. var __extends = (this && this.__extends) || function (d, b) {
  3332. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  3333. function __() { this.constructor = d; }
  3334. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3335. };
  3336. var Subscriber_1 = __webpack_require__(4);
  3337. /**
  3338. * We need this JSDoc comment for affecting ESDoc.
  3339. * @ignore
  3340. * @extends {Ignored}
  3341. */
  3342. var OuterSubscriber = (function (_super) {
  3343. __extends(OuterSubscriber, _super);
  3344. function OuterSubscriber() {
  3345. _super.apply(this, arguments);
  3346. }
  3347. OuterSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  3348. this.destination.next(innerValue);
  3349. };
  3350. OuterSubscriber.prototype.notifyError = function (error, innerSub) {
  3351. this.destination.error(error);
  3352. };
  3353. OuterSubscriber.prototype.notifyComplete = function (innerSub) {
  3354. this.destination.complete();
  3355. };
  3356. return OuterSubscriber;
  3357. }(Subscriber_1.Subscriber));
  3358. exports.OuterSubscriber = OuterSubscriber;
  3359. //# sourceMappingURL=OuterSubscriber.js.map
  3360. /***/ }),
  3361. /* 30 */
  3362. /***/ (function(module, exports, __webpack_require__) {
  3363. "use strict";
  3364. var root_1 = __webpack_require__(8);
  3365. var isArrayLike_1 = __webpack_require__(58);
  3366. var isPromise_1 = __webpack_require__(59);
  3367. var isObject_1 = __webpack_require__(55);
  3368. var Observable_1 = __webpack_require__(1);
  3369. var iterator_1 = __webpack_require__(31);
  3370. var InnerSubscriber_1 = __webpack_require__(105);
  3371. var observable_1 = __webpack_require__(45);
  3372. function subscribeToResult(outerSubscriber, result, outerValue, outerIndex) {
  3373. var destination = new InnerSubscriber_1.InnerSubscriber(outerSubscriber, outerValue, outerIndex);
  3374. if (destination.closed) {
  3375. return null;
  3376. }
  3377. if (result instanceof Observable_1.Observable) {
  3378. if (result._isScalar) {
  3379. destination.next(result.value);
  3380. destination.complete();
  3381. return null;
  3382. }
  3383. else {
  3384. destination.syncErrorThrowable = true;
  3385. return result.subscribe(destination);
  3386. }
  3387. }
  3388. else if (isArrayLike_1.isArrayLike(result)) {
  3389. for (var i = 0, len = result.length; i < len && !destination.closed; i++) {
  3390. destination.next(result[i]);
  3391. }
  3392. if (!destination.closed) {
  3393. destination.complete();
  3394. }
  3395. }
  3396. else if (isPromise_1.isPromise(result)) {
  3397. result.then(function (value) {
  3398. if (!destination.closed) {
  3399. destination.next(value);
  3400. destination.complete();
  3401. }
  3402. }, function (err) { return destination.error(err); })
  3403. .then(null, function (err) {
  3404. // Escaping the Promise trap: globally throw unhandled errors
  3405. root_1.root.setTimeout(function () { throw err; });
  3406. });
  3407. return destination;
  3408. }
  3409. else if (result && typeof result[iterator_1.iterator] === 'function') {
  3410. var iterator = result[iterator_1.iterator]();
  3411. do {
  3412. var item = iterator.next();
  3413. if (item.done) {
  3414. destination.complete();
  3415. break;
  3416. }
  3417. destination.next(item.value);
  3418. if (destination.closed) {
  3419. break;
  3420. }
  3421. } while (true);
  3422. }
  3423. else if (result && typeof result[observable_1.observable] === 'function') {
  3424. var obs = result[observable_1.observable]();
  3425. if (typeof obs.subscribe !== 'function') {
  3426. destination.error(new TypeError('Provided object does not correctly implement Symbol.observable'));
  3427. }
  3428. else {
  3429. return obs.subscribe(new InnerSubscriber_1.InnerSubscriber(outerSubscriber, outerValue, outerIndex));
  3430. }
  3431. }
  3432. else {
  3433. var value = isObject_1.isObject(result) ? 'an invalid object' : "'" + result + "'";
  3434. var msg = ("You provided " + value + " where a stream was expected.")
  3435. + ' You can provide an Observable, Promise, Array, or Iterable.';
  3436. destination.error(new TypeError(msg));
  3437. }
  3438. return null;
  3439. }
  3440. exports.subscribeToResult = subscribeToResult;
  3441. //# sourceMappingURL=subscribeToResult.js.map
  3442. /***/ }),
  3443. /* 31 */
  3444. /***/ (function(module, exports, __webpack_require__) {
  3445. "use strict";
  3446. var root_1 = __webpack_require__(8);
  3447. function symbolIteratorPonyfill(root) {
  3448. var Symbol = root.Symbol;
  3449. if (typeof Symbol === 'function') {
  3450. if (!Symbol.iterator) {
  3451. Symbol.iterator = Symbol('iterator polyfill');
  3452. }
  3453. return Symbol.iterator;
  3454. }
  3455. else {
  3456. // [for Mozilla Gecko 27-35:](https://mzl.la/2ewE1zC)
  3457. var Set_1 = root.Set;
  3458. if (Set_1 && typeof new Set_1()['@@iterator'] === 'function') {
  3459. return '@@iterator';
  3460. }
  3461. var Map_1 = root.Map;
  3462. // required for compatability with es6-shim
  3463. if (Map_1) {
  3464. var keys = Object.getOwnPropertyNames(Map_1.prototype);
  3465. for (var i = 0; i < keys.length; ++i) {
  3466. var key = keys[i];
  3467. // according to spec, Map.prototype[@@iterator] and Map.orototype.entries must be equal.
  3468. if (key !== 'entries' && key !== 'size' && Map_1.prototype[key] === Map_1.prototype['entries']) {
  3469. return key;
  3470. }
  3471. }
  3472. }
  3473. return '@@iterator';
  3474. }
  3475. }
  3476. exports.symbolIteratorPonyfill = symbolIteratorPonyfill;
  3477. exports.iterator = symbolIteratorPonyfill(root_1.root);
  3478. /**
  3479. * @deprecated use iterator instead
  3480. */
  3481. exports.$$iterator = exports.iterator;
  3482. //# sourceMappingURL=iterator.js.map
  3483. /***/ }),
  3484. /* 32 */
  3485. /***/ (function(module, exports, __webpack_require__) {
  3486. /* WEBPACK VAR INJECTION */(function(process) {/**
  3487. * This is the web browser implementation of `debug()`.
  3488. *
  3489. * Expose `debug()` as the module.
  3490. */
  3491. exports = module.exports = __webpack_require__(109);
  3492. exports.log = log;
  3493. exports.formatArgs = formatArgs;
  3494. exports.save = save;
  3495. exports.load = load;
  3496. exports.useColors = useColors;
  3497. exports.storage = 'undefined' != typeof chrome
  3498. && 'undefined' != typeof chrome.storage
  3499. ? chrome.storage.local
  3500. : localstorage();
  3501. /**
  3502. * Colors.
  3503. */
  3504. exports.colors = [
  3505. '#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC',
  3506. '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF',
  3507. '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC',
  3508. '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF',
  3509. '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC',
  3510. '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033',
  3511. '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366',
  3512. '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933',
  3513. '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC',
  3514. '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF',
  3515. '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'
  3516. ];
  3517. /**
  3518. * Currently only WebKit-based Web Inspectors, Firefox >= v31,
  3519. * and the Firebug extension (any Firefox version) are known
  3520. * to support "%c" CSS customizations.
  3521. *
  3522. * TODO: add a `localStorage` variable to explicitly enable/disable colors
  3523. */
  3524. function useColors() {
  3525. // NB: In an Electron preload script, document will be defined but not fully
  3526. // initialized. Since we know we're in Chrome, we'll just detect this case
  3527. // explicitly
  3528. if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {
  3529. return true;
  3530. }
  3531. // Internet Explorer and Edge do not support colors.
  3532. if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
  3533. return false;
  3534. }
  3535. // is webkit? http://stackoverflow.com/a/16459606/376773
  3536. // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
  3537. return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
  3538. // is firebug? http://stackoverflow.com/a/398120/376773
  3539. (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
  3540. // is firefox >= v31?
  3541. // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
  3542. (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
  3543. // double check webkit in userAgent just in case we are in a worker
  3544. (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
  3545. }
  3546. /**
  3547. * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
  3548. */
  3549. exports.formatters.j = function(v) {
  3550. try {
  3551. return JSON.stringify(v);
  3552. } catch (err) {
  3553. return '[UnexpectedJSONParseError]: ' + err.message;
  3554. }
  3555. };
  3556. /**
  3557. * Colorize log arguments if enabled.
  3558. *
  3559. * @api public
  3560. */
  3561. function formatArgs(args) {
  3562. var useColors = this.useColors;
  3563. args[0] = (useColors ? '%c' : '')
  3564. + this.namespace
  3565. + (useColors ? ' %c' : ' ')
  3566. + args[0]
  3567. + (useColors ? '%c ' : ' ')
  3568. + '+' + exports.humanize(this.diff);
  3569. if (!useColors) return;
  3570. var c = 'color: ' + this.color;
  3571. args.splice(1, 0, c, 'color: inherit')
  3572. // the final "%c" is somewhat tricky, because there could be other
  3573. // arguments passed either before or after the %c, so we need to
  3574. // figure out the correct index to insert the CSS into
  3575. var index = 0;
  3576. var lastC = 0;
  3577. args[0].replace(/%[a-zA-Z%]/g, function(match) {
  3578. if ('%%' === match) return;
  3579. index++;
  3580. if ('%c' === match) {
  3581. // we only are interested in the *last* %c
  3582. // (the user may have provided their own)
  3583. lastC = index;
  3584. }
  3585. });
  3586. args.splice(lastC, 0, c);
  3587. }
  3588. /**
  3589. * Invokes `console.log()` when available.
  3590. * No-op when `console.log` is not a "function".
  3591. *
  3592. * @api public
  3593. */
  3594. function log() {
  3595. // this hackery is required for IE8/9, where
  3596. // the `console.log` function doesn't have 'apply'
  3597. return 'object' === typeof console
  3598. && console.log
  3599. && Function.prototype.apply.call(console.log, console, arguments);
  3600. }
  3601. /**
  3602. * Save `namespaces`.
  3603. *
  3604. * @param {String} namespaces
  3605. * @api private
  3606. */
  3607. function save(namespaces) {
  3608. try {
  3609. if (null == namespaces) {
  3610. exports.storage.removeItem('debug');
  3611. } else {
  3612. exports.storage.debug = namespaces;
  3613. }
  3614. } catch(e) {}
  3615. }
  3616. /**
  3617. * Load `namespaces`.
  3618. *
  3619. * @return {String} returns the previously persisted debug modes
  3620. * @api private
  3621. */
  3622. function load() {
  3623. var r;
  3624. try {
  3625. r = exports.storage.debug;
  3626. } catch(e) {}
  3627. // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
  3628. if (!r && typeof process !== 'undefined' && 'env' in process) {
  3629. r = process.env.DEBUG;
  3630. }
  3631. return r;
  3632. }
  3633. /**
  3634. * Enable namespaces listed in `localStorage.debug` initially.
  3635. */
  3636. exports.enable(load());
  3637. /**
  3638. * Localstorage attempts to return the localstorage.
  3639. *
  3640. * This is necessary because safari throws
  3641. * when a user disables cookies/localstorage
  3642. * and you attempt to access it.
  3643. *
  3644. * @return {LocalStorage}
  3645. * @api private
  3646. */
  3647. function localstorage() {
  3648. try {
  3649. return window.localStorage;
  3650. } catch (e) {}
  3651. }
  3652. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(33)))
  3653. /***/ }),
  3654. /* 33 */
  3655. /***/ (function(module, exports) {
  3656. // shim for using process in browser
  3657. var process = module.exports = {};
  3658. // cached from whatever global is present so that test runners that stub it
  3659. // don't break things. But we need to wrap it in a try catch in case it is
  3660. // wrapped in strict mode code which doesn't define any globals. It's inside a
  3661. // function because try/catches deoptimize in certain engines.
  3662. var cachedSetTimeout;
  3663. var cachedClearTimeout;
  3664. function defaultSetTimout() {
  3665. throw new Error('setTimeout has not been defined');
  3666. }
  3667. function defaultClearTimeout () {
  3668. throw new Error('clearTimeout has not been defined');
  3669. }
  3670. (function () {
  3671. try {
  3672. if (typeof setTimeout === 'function') {
  3673. cachedSetTimeout = setTimeout;
  3674. } else {
  3675. cachedSetTimeout = defaultSetTimout;
  3676. }
  3677. } catch (e) {
  3678. cachedSetTimeout = defaultSetTimout;
  3679. }
  3680. try {
  3681. if (typeof clearTimeout === 'function') {
  3682. cachedClearTimeout = clearTimeout;
  3683. } else {
  3684. cachedClearTimeout = defaultClearTimeout;
  3685. }
  3686. } catch (e) {
  3687. cachedClearTimeout = defaultClearTimeout;
  3688. }
  3689. } ())
  3690. function runTimeout(fun) {
  3691. if (cachedSetTimeout === setTimeout) {
  3692. //normal enviroments in sane situations
  3693. return setTimeout(fun, 0);
  3694. }
  3695. // if setTimeout wasn't available but was latter defined
  3696. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  3697. cachedSetTimeout = setTimeout;
  3698. return setTimeout(fun, 0);
  3699. }
  3700. try {
  3701. // when when somebody has screwed with setTimeout but no I.E. maddness
  3702. return cachedSetTimeout(fun, 0);
  3703. } catch(e){
  3704. try {
  3705. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  3706. return cachedSetTimeout.call(null, fun, 0);
  3707. } catch(e){
  3708. // 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
  3709. return cachedSetTimeout.call(this, fun, 0);
  3710. }
  3711. }
  3712. }
  3713. function runClearTimeout(marker) {
  3714. if (cachedClearTimeout === clearTimeout) {
  3715. //normal enviroments in sane situations
  3716. return clearTimeout(marker);
  3717. }
  3718. // if clearTimeout wasn't available but was latter defined
  3719. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  3720. cachedClearTimeout = clearTimeout;
  3721. return clearTimeout(marker);
  3722. }
  3723. try {
  3724. // when when somebody has screwed with setTimeout but no I.E. maddness
  3725. return cachedClearTimeout(marker);
  3726. } catch (e){
  3727. try {
  3728. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  3729. return cachedClearTimeout.call(null, marker);
  3730. } catch (e){
  3731. // 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.
  3732. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  3733. return cachedClearTimeout.call(this, marker);
  3734. }
  3735. }
  3736. }
  3737. var queue = [];
  3738. var draining = false;
  3739. var currentQueue;
  3740. var queueIndex = -1;
  3741. function cleanUpNextTick() {
  3742. if (!draining || !currentQueue) {
  3743. return;
  3744. }
  3745. draining = false;
  3746. if (currentQueue.length) {
  3747. queue = currentQueue.concat(queue);
  3748. } else {
  3749. queueIndex = -1;
  3750. }
  3751. if (queue.length) {
  3752. drainQueue();
  3753. }
  3754. }
  3755. function drainQueue() {
  3756. if (draining) {
  3757. return;
  3758. }
  3759. var timeout = runTimeout(cleanUpNextTick);
  3760. draining = true;
  3761. var len = queue.length;
  3762. while(len) {
  3763. currentQueue = queue;
  3764. queue = [];
  3765. while (++queueIndex < len) {
  3766. if (currentQueue) {
  3767. currentQueue[queueIndex].run();
  3768. }
  3769. }
  3770. queueIndex = -1;
  3771. len = queue.length;
  3772. }
  3773. currentQueue = null;
  3774. draining = false;
  3775. runClearTimeout(timeout);
  3776. }
  3777. process.nextTick = function (fun) {
  3778. var args = new Array(arguments.length - 1);
  3779. if (arguments.length > 1) {
  3780. for (var i = 1; i < arguments.length; i++) {
  3781. args[i - 1] = arguments[i];
  3782. }
  3783. }
  3784. queue.push(new Item(fun, args));
  3785. if (queue.length === 1 && !draining) {
  3786. runTimeout(drainQueue);
  3787. }
  3788. };
  3789. // v8 likes predictible objects
  3790. function Item(fun, array) {
  3791. this.fun = fun;
  3792. this.array = array;
  3793. }
  3794. Item.prototype.run = function () {
  3795. this.fun.apply(null, this.array);
  3796. };
  3797. process.title = 'browser';
  3798. process.browser = true;
  3799. process.env = {};
  3800. process.argv = [];
  3801. process.version = ''; // empty string to avoid regexp issues
  3802. process.versions = {};
  3803. function noop() {}
  3804. process.on = noop;
  3805. process.addListener = noop;
  3806. process.once = noop;
  3807. process.off = noop;
  3808. process.removeListener = noop;
  3809. process.removeAllListeners = noop;
  3810. process.emit = noop;
  3811. process.prependListener = noop;
  3812. process.prependOnceListener = noop;
  3813. process.listeners = function (name) { return [] }
  3814. process.binding = function (name) {
  3815. throw new Error('process.binding is not supported');
  3816. };
  3817. process.cwd = function () { return '/' };
  3818. process.chdir = function (dir) {
  3819. throw new Error('process.chdir is not supported');
  3820. };
  3821. process.umask = function() { return 0; };
  3822. /***/ }),
  3823. /* 34 */
  3824. /***/ (function(module, exports) {
  3825. /**
  3826. * Compiles a querystring
  3827. * Returns string representation of the object
  3828. *
  3829. * @param {Object}
  3830. * @api private
  3831. */
  3832. exports.encode = function (obj) {
  3833. var str = '';
  3834. for (var i in obj) {
  3835. if (obj.hasOwnProperty(i)) {
  3836. if (str.length) str += '&';
  3837. str += encodeURIComponent(i) + '=' + encodeURIComponent(obj[i]);
  3838. }
  3839. }
  3840. return str;
  3841. };
  3842. /**
  3843. * Parses a simple querystring into an object
  3844. *
  3845. * @param {String} qs
  3846. * @api private
  3847. */
  3848. exports.decode = function(qs){
  3849. var qry = {};
  3850. var pairs = qs.split('&');
  3851. for (var i = 0, l = pairs.length; i < l; i++) {
  3852. var pair = pairs[i].split('=');
  3853. qry[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
  3854. }
  3855. return qry;
  3856. };
  3857. /***/ }),
  3858. /* 35 */
  3859. /***/ (function(module, exports) {
  3860. module.exports = function(a, b){
  3861. var fn = function(){};
  3862. fn.prototype = b.prototype;
  3863. a.prototype = new fn;
  3864. a.prototype.constructor = a;
  3865. };
  3866. /***/ }),
  3867. /* 36 */
  3868. /***/ (function(module, exports, __webpack_require__) {
  3869. /* WEBPACK VAR INJECTION */(function(process) {/**
  3870. * This is the web browser implementation of `debug()`.
  3871. *
  3872. * Expose `debug()` as the module.
  3873. */
  3874. exports = module.exports = __webpack_require__(129);
  3875. exports.log = log;
  3876. exports.formatArgs = formatArgs;
  3877. exports.save = save;
  3878. exports.load = load;
  3879. exports.useColors = useColors;
  3880. exports.storage = 'undefined' != typeof chrome
  3881. && 'undefined' != typeof chrome.storage
  3882. ? chrome.storage.local
  3883. : localstorage();
  3884. /**
  3885. * Colors.
  3886. */
  3887. exports.colors = [
  3888. '#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC',
  3889. '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF',
  3890. '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC',
  3891. '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF',
  3892. '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC',
  3893. '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033',
  3894. '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366',
  3895. '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933',
  3896. '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC',
  3897. '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF',
  3898. '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'
  3899. ];
  3900. /**
  3901. * Currently only WebKit-based Web Inspectors, Firefox >= v31,
  3902. * and the Firebug extension (any Firefox version) are known
  3903. * to support "%c" CSS customizations.
  3904. *
  3905. * TODO: add a `localStorage` variable to explicitly enable/disable colors
  3906. */
  3907. function useColors() {
  3908. // NB: In an Electron preload script, document will be defined but not fully
  3909. // initialized. Since we know we're in Chrome, we'll just detect this case
  3910. // explicitly
  3911. if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {
  3912. return true;
  3913. }
  3914. // Internet Explorer and Edge do not support colors.
  3915. if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
  3916. return false;
  3917. }
  3918. // is webkit? http://stackoverflow.com/a/16459606/376773
  3919. // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
  3920. return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
  3921. // is firebug? http://stackoverflow.com/a/398120/376773
  3922. (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
  3923. // is firefox >= v31?
  3924. // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
  3925. (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
  3926. // double check webkit in userAgent just in case we are in a worker
  3927. (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
  3928. }
  3929. /**
  3930. * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
  3931. */
  3932. exports.formatters.j = function(v) {
  3933. try {
  3934. return JSON.stringify(v);
  3935. } catch (err) {
  3936. return '[UnexpectedJSONParseError]: ' + err.message;
  3937. }
  3938. };
  3939. /**
  3940. * Colorize log arguments if enabled.
  3941. *
  3942. * @api public
  3943. */
  3944. function formatArgs(args) {
  3945. var useColors = this.useColors;
  3946. args[0] = (useColors ? '%c' : '')
  3947. + this.namespace
  3948. + (useColors ? ' %c' : ' ')
  3949. + args[0]
  3950. + (useColors ? '%c ' : ' ')
  3951. + '+' + exports.humanize(this.diff);
  3952. if (!useColors) return;
  3953. var c = 'color: ' + this.color;
  3954. args.splice(1, 0, c, 'color: inherit')
  3955. // the final "%c" is somewhat tricky, because there could be other
  3956. // arguments passed either before or after the %c, so we need to
  3957. // figure out the correct index to insert the CSS into
  3958. var index = 0;
  3959. var lastC = 0;
  3960. args[0].replace(/%[a-zA-Z%]/g, function(match) {
  3961. if ('%%' === match) return;
  3962. index++;
  3963. if ('%c' === match) {
  3964. // we only are interested in the *last* %c
  3965. // (the user may have provided their own)
  3966. lastC = index;
  3967. }
  3968. });
  3969. args.splice(lastC, 0, c);
  3970. }
  3971. /**
  3972. * Invokes `console.log()` when available.
  3973. * No-op when `console.log` is not a "function".
  3974. *
  3975. * @api public
  3976. */
  3977. function log() {
  3978. // this hackery is required for IE8/9, where
  3979. // the `console.log` function doesn't have 'apply'
  3980. return 'object' === typeof console
  3981. && console.log
  3982. && Function.prototype.apply.call(console.log, console, arguments);
  3983. }
  3984. /**
  3985. * Save `namespaces`.
  3986. *
  3987. * @param {String} namespaces
  3988. * @api private
  3989. */
  3990. function save(namespaces) {
  3991. try {
  3992. if (null == namespaces) {
  3993. exports.storage.removeItem('debug');
  3994. } else {
  3995. exports.storage.debug = namespaces;
  3996. }
  3997. } catch(e) {}
  3998. }
  3999. /**
  4000. * Load `namespaces`.
  4001. *
  4002. * @return {String} returns the previously persisted debug modes
  4003. * @api private
  4004. */
  4005. function load() {
  4006. var r;
  4007. try {
  4008. r = exports.storage.debug;
  4009. } catch(e) {}
  4010. // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
  4011. if (!r && typeof process !== 'undefined' && 'env' in process) {
  4012. r = process.env.DEBUG;
  4013. }
  4014. return r;
  4015. }
  4016. /**
  4017. * Enable namespaces listed in `localStorage.debug` initially.
  4018. */
  4019. exports.enable(load());
  4020. /**
  4021. * Localstorage attempts to return the localstorage.
  4022. *
  4023. * This is necessary because safari throws
  4024. * when a user disables cookies/localstorage
  4025. * and you attempt to access it.
  4026. *
  4027. * @return {LocalStorage}
  4028. * @api private
  4029. */
  4030. function localstorage() {
  4031. try {
  4032. return window.localStorage;
  4033. } catch (e) {}
  4034. }
  4035. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(33)))
  4036. /***/ }),
  4037. /* 37 */
  4038. /***/ (function(module, exports, __webpack_require__) {
  4039. "use strict";
  4040. var __extends = (this && this.__extends) || function (d, b) {
  4041. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  4042. function __() { this.constructor = d; }
  4043. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  4044. };
  4045. var Observable_1 = __webpack_require__(1);
  4046. var Subscriber_1 = __webpack_require__(4);
  4047. var Subscription_1 = __webpack_require__(13);
  4048. var ObjectUnsubscribedError_1 = __webpack_require__(72);
  4049. var SubjectSubscription_1 = __webpack_require__(135);
  4050. var rxSubscriber_1 = __webpack_require__(44);
  4051. /**
  4052. * @class SubjectSubscriber<T>
  4053. */
  4054. var SubjectSubscriber = (function (_super) {
  4055. __extends(SubjectSubscriber, _super);
  4056. function SubjectSubscriber(destination) {
  4057. _super.call(this, destination);
  4058. this.destination = destination;
  4059. }
  4060. return SubjectSubscriber;
  4061. }(Subscriber_1.Subscriber));
  4062. exports.SubjectSubscriber = SubjectSubscriber;
  4063. /**
  4064. * @class Subject<T>
  4065. */
  4066. var Subject = (function (_super) {
  4067. __extends(Subject, _super);
  4068. function Subject() {
  4069. _super.call(this);
  4070. this.observers = [];
  4071. this.closed = false;
  4072. this.isStopped = false;
  4073. this.hasError = false;
  4074. this.thrownError = null;
  4075. }
  4076. Subject.prototype[rxSubscriber_1.rxSubscriber] = function () {
  4077. return new SubjectSubscriber(this);
  4078. };
  4079. Subject.prototype.lift = function (operator) {
  4080. var subject = new AnonymousSubject(this, this);
  4081. subject.operator = operator;
  4082. return subject;
  4083. };
  4084. Subject.prototype.next = function (value) {
  4085. if (this.closed) {
  4086. throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError();
  4087. }
  4088. if (!this.isStopped) {
  4089. var observers = this.observers;
  4090. var len = observers.length;
  4091. var copy = observers.slice();
  4092. for (var i = 0; i < len; i++) {
  4093. copy[i].next(value);
  4094. }
  4095. }
  4096. };
  4097. Subject.prototype.error = function (err) {
  4098. if (this.closed) {
  4099. throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError();
  4100. }
  4101. this.hasError = true;
  4102. this.thrownError = err;
  4103. this.isStopped = true;
  4104. var observers = this.observers;
  4105. var len = observers.length;
  4106. var copy = observers.slice();
  4107. for (var i = 0; i < len; i++) {
  4108. copy[i].error(err);
  4109. }
  4110. this.observers.length = 0;
  4111. };
  4112. Subject.prototype.complete = function () {
  4113. if (this.closed) {
  4114. throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError();
  4115. }
  4116. this.isStopped = true;
  4117. var observers = this.observers;
  4118. var len = observers.length;
  4119. var copy = observers.slice();
  4120. for (var i = 0; i < len; i++) {
  4121. copy[i].complete();
  4122. }
  4123. this.observers.length = 0;
  4124. };
  4125. Subject.prototype.unsubscribe = function () {
  4126. this.isStopped = true;
  4127. this.closed = true;
  4128. this.observers = null;
  4129. };
  4130. Subject.prototype._trySubscribe = function (subscriber) {
  4131. if (this.closed) {
  4132. throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError();
  4133. }
  4134. else {
  4135. return _super.prototype._trySubscribe.call(this, subscriber);
  4136. }
  4137. };
  4138. /** @deprecated internal use only */ Subject.prototype._subscribe = function (subscriber) {
  4139. if (this.closed) {
  4140. throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError();
  4141. }
  4142. else if (this.hasError) {
  4143. subscriber.error(this.thrownError);
  4144. return Subscription_1.Subscription.EMPTY;
  4145. }
  4146. else if (this.isStopped) {
  4147. subscriber.complete();
  4148. return Subscription_1.Subscription.EMPTY;
  4149. }
  4150. else {
  4151. this.observers.push(subscriber);
  4152. return new SubjectSubscription_1.SubjectSubscription(this, subscriber);
  4153. }
  4154. };
  4155. Subject.prototype.asObservable = function () {
  4156. var observable = new Observable_1.Observable();
  4157. observable.source = this;
  4158. return observable;
  4159. };
  4160. Subject.create = function (destination, source) {
  4161. return new AnonymousSubject(destination, source);
  4162. };
  4163. return Subject;
  4164. }(Observable_1.Observable));
  4165. exports.Subject = Subject;
  4166. /**
  4167. * @class AnonymousSubject<T>
  4168. */
  4169. var AnonymousSubject = (function (_super) {
  4170. __extends(AnonymousSubject, _super);
  4171. function AnonymousSubject(destination, source) {
  4172. _super.call(this);
  4173. this.destination = destination;
  4174. this.source = source;
  4175. }
  4176. AnonymousSubject.prototype.next = function (value) {
  4177. var destination = this.destination;
  4178. if (destination && destination.next) {
  4179. destination.next(value);
  4180. }
  4181. };
  4182. AnonymousSubject.prototype.error = function (err) {
  4183. var destination = this.destination;
  4184. if (destination && destination.error) {
  4185. this.destination.error(err);
  4186. }
  4187. };
  4188. AnonymousSubject.prototype.complete = function () {
  4189. var destination = this.destination;
  4190. if (destination && destination.complete) {
  4191. this.destination.complete();
  4192. }
  4193. };
  4194. /** @deprecated internal use only */ AnonymousSubject.prototype._subscribe = function (subscriber) {
  4195. var source = this.source;
  4196. if (source) {
  4197. return this.source.subscribe(subscriber);
  4198. }
  4199. else {
  4200. return Subscription_1.Subscription.EMPTY;
  4201. }
  4202. };
  4203. return AnonymousSubject;
  4204. }(Subject));
  4205. exports.AnonymousSubject = AnonymousSubject;
  4206. //# sourceMappingURL=Subject.js.map
  4207. /***/ }),
  4208. /* 38 */
  4209. /***/ (function(module, exports, __webpack_require__) {
  4210. "use strict";
  4211. var Observable_1 = __webpack_require__(1);
  4212. var ArrayObservable_1 = __webpack_require__(24);
  4213. var isScheduler_1 = __webpack_require__(25);
  4214. var mergeAll_1 = __webpack_require__(54);
  4215. /* tslint:enable:max-line-length */
  4216. /**
  4217. * Creates an output Observable which concurrently emits all values from every
  4218. * given input Observable.
  4219. *
  4220. * <span class="informal">Flattens multiple Observables together by blending
  4221. * their values into one Observable.</span>
  4222. *
  4223. * <img src="./img/merge.png" width="100%">
  4224. *
  4225. * `merge` subscribes to each given input Observable (as arguments), and simply
  4226. * forwards (without doing any transformation) all the values from all the input
  4227. * Observables to the output Observable. The output Observable only completes
  4228. * once all input Observables have completed. Any error delivered by an input
  4229. * Observable will be immediately emitted on the output Observable.
  4230. *
  4231. * @example <caption>Merge together two Observables: 1s interval and clicks</caption>
  4232. * var clicks = Rx.Observable.fromEvent(document, 'click');
  4233. * var timer = Rx.Observable.interval(1000);
  4234. * var clicksOrTimer = Rx.Observable.merge(clicks, timer);
  4235. * clicksOrTimer.subscribe(x => console.log(x));
  4236. *
  4237. * // Results in the following:
  4238. * // timer will emit ascending values, one every second(1000ms) to console
  4239. * // clicks logs MouseEvents to console everytime the "document" is clicked
  4240. * // Since the two streams are merged you see these happening
  4241. * // as they occur.
  4242. *
  4243. * @example <caption>Merge together 3 Observables, but only 2 run concurrently</caption>
  4244. * var timer1 = Rx.Observable.interval(1000).take(10);
  4245. * var timer2 = Rx.Observable.interval(2000).take(6);
  4246. * var timer3 = Rx.Observable.interval(500).take(10);
  4247. * var concurrent = 2; // the argument
  4248. * var merged = Rx.Observable.merge(timer1, timer2, timer3, concurrent);
  4249. * merged.subscribe(x => console.log(x));
  4250. *
  4251. * // Results in the following:
  4252. * // - First timer1 and timer2 will run concurrently
  4253. * // - timer1 will emit a value every 1000ms for 10 iterations
  4254. * // - timer2 will emit a value every 2000ms for 6 iterations
  4255. * // - after timer1 hits it's max iteration, timer2 will
  4256. * // continue, and timer3 will start to run concurrently with timer2
  4257. * // - when timer2 hits it's max iteration it terminates, and
  4258. * // timer3 will continue to emit a value every 500ms until it is complete
  4259. *
  4260. * @see {@link mergeAll}
  4261. * @see {@link mergeMap}
  4262. * @see {@link mergeMapTo}
  4263. * @see {@link mergeScan}
  4264. *
  4265. * @param {...ObservableInput} observables Input Observables to merge together.
  4266. * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of input
  4267. * Observables being subscribed to concurrently.
  4268. * @param {Scheduler} [scheduler=null] The IScheduler to use for managing
  4269. * concurrency of input Observables.
  4270. * @return {Observable} an Observable that emits items that are the result of
  4271. * every input Observable.
  4272. * @static true
  4273. * @name merge
  4274. * @owner Observable
  4275. */
  4276. function merge() {
  4277. var observables = [];
  4278. for (var _i = 0; _i < arguments.length; _i++) {
  4279. observables[_i - 0] = arguments[_i];
  4280. }
  4281. var concurrent = Number.POSITIVE_INFINITY;
  4282. var scheduler = null;
  4283. var last = observables[observables.length - 1];
  4284. if (isScheduler_1.isScheduler(last)) {
  4285. scheduler = observables.pop();
  4286. if (observables.length > 1 && typeof observables[observables.length - 1] === 'number') {
  4287. concurrent = observables.pop();
  4288. }
  4289. }
  4290. else if (typeof last === 'number') {
  4291. concurrent = observables.pop();
  4292. }
  4293. if (scheduler === null && observables.length === 1 && observables[0] instanceof Observable_1.Observable) {
  4294. return observables[0];
  4295. }
  4296. return mergeAll_1.mergeAll(concurrent)(new ArrayObservable_1.ArrayObservable(observables, scheduler));
  4297. }
  4298. exports.merge = merge;
  4299. //# sourceMappingURL=merge.js.map
  4300. /***/ }),
  4301. /* 39 */
  4302. /***/ (function(module, exports, __webpack_require__) {
  4303. "use strict";
  4304. var __extends = (this && this.__extends) || function (d, b) {
  4305. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  4306. function __() { this.constructor = d; }
  4307. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  4308. };
  4309. var Subscriber_1 = __webpack_require__(4);
  4310. /**
  4311. * Returns an Observable that skips the first `count` items emitted by the source Observable.
  4312. *
  4313. * <img src="./img/skip.png" width="100%">
  4314. *
  4315. * @param {Number} count - The number of times, items emitted by source Observable should be skipped.
  4316. * @return {Observable} An Observable that skips values emitted by the source Observable.
  4317. *
  4318. * @method skip
  4319. * @owner Observable
  4320. */
  4321. function skip(count) {
  4322. return function (source) { return source.lift(new SkipOperator(count)); };
  4323. }
  4324. exports.skip = skip;
  4325. var SkipOperator = (function () {
  4326. function SkipOperator(total) {
  4327. this.total = total;
  4328. }
  4329. SkipOperator.prototype.call = function (subscriber, source) {
  4330. return source.subscribe(new SkipSubscriber(subscriber, this.total));
  4331. };
  4332. return SkipOperator;
  4333. }());
  4334. /**
  4335. * We need this JSDoc comment for affecting ESDoc.
  4336. * @ignore
  4337. * @extends {Ignored}
  4338. */
  4339. var SkipSubscriber = (function (_super) {
  4340. __extends(SkipSubscriber, _super);
  4341. function SkipSubscriber(destination, total) {
  4342. _super.call(this, destination);
  4343. this.total = total;
  4344. this.count = 0;
  4345. }
  4346. SkipSubscriber.prototype._next = function (x) {
  4347. if (++this.count > this.total) {
  4348. this.destination.next(x);
  4349. }
  4350. };
  4351. return SkipSubscriber;
  4352. }(Subscriber_1.Subscriber));
  4353. //# sourceMappingURL=skip.js.map
  4354. /***/ }),
  4355. /* 40 */
  4356. /***/ (function(module, exports, __webpack_require__) {
  4357. "use strict";
  4358. var __extends = (this && this.__extends) || function (d, b) {
  4359. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  4360. function __() { this.constructor = d; }
  4361. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  4362. };
  4363. var Subscriber_1 = __webpack_require__(4);
  4364. var tryCatch_1 = __webpack_require__(43);
  4365. var errorObject_1 = __webpack_require__(27);
  4366. /* tslint:enable:max-line-length */
  4367. /**
  4368. * Returns an Observable that emits all items emitted by the source Observable that are distinct by comparison from the previous item.
  4369. *
  4370. * If a comparator function is provided, then it will be called for each item to test for whether or not that value should be emitted.
  4371. *
  4372. * If a comparator function is not provided, an equality check is used by default.
  4373. *
  4374. * @example <caption>A simple example with numbers</caption>
  4375. * Observable.of(1, 1, 2, 2, 2, 1, 1, 2, 3, 3, 4)
  4376. * .distinctUntilChanged()
  4377. * .subscribe(x => console.log(x)); // 1, 2, 1, 2, 3, 4
  4378. *
  4379. * @example <caption>An example using a compare function</caption>
  4380. * interface Person {
  4381. * age: number,
  4382. * name: string
  4383. * }
  4384. *
  4385. * Observable.of<Person>(
  4386. * { age: 4, name: 'Foo'},
  4387. * { age: 7, name: 'Bar'},
  4388. * { age: 5, name: 'Foo'})
  4389. * { age: 6, name: 'Foo'})
  4390. * .distinctUntilChanged((p: Person, q: Person) => p.name === q.name)
  4391. * .subscribe(x => console.log(x));
  4392. *
  4393. * // displays:
  4394. * // { age: 4, name: 'Foo' }
  4395. * // { age: 7, name: 'Bar' }
  4396. * // { age: 5, name: 'Foo' }
  4397. *
  4398. * @see {@link distinct}
  4399. * @see {@link distinctUntilKeyChanged}
  4400. *
  4401. * @param {function} [compare] Optional comparison function called to test if an item is distinct from the previous item in the source.
  4402. * @return {Observable} An Observable that emits items from the source Observable with distinct values.
  4403. * @method distinctUntilChanged
  4404. * @owner Observable
  4405. */
  4406. function distinctUntilChanged(compare, keySelector) {
  4407. return function (source) { return source.lift(new DistinctUntilChangedOperator(compare, keySelector)); };
  4408. }
  4409. exports.distinctUntilChanged = distinctUntilChanged;
  4410. var DistinctUntilChangedOperator = (function () {
  4411. function DistinctUntilChangedOperator(compare, keySelector) {
  4412. this.compare = compare;
  4413. this.keySelector = keySelector;
  4414. }
  4415. DistinctUntilChangedOperator.prototype.call = function (subscriber, source) {
  4416. return source.subscribe(new DistinctUntilChangedSubscriber(subscriber, this.compare, this.keySelector));
  4417. };
  4418. return DistinctUntilChangedOperator;
  4419. }());
  4420. /**
  4421. * We need this JSDoc comment for affecting ESDoc.
  4422. * @ignore
  4423. * @extends {Ignored}
  4424. */
  4425. var DistinctUntilChangedSubscriber = (function (_super) {
  4426. __extends(DistinctUntilChangedSubscriber, _super);
  4427. function DistinctUntilChangedSubscriber(destination, compare, keySelector) {
  4428. _super.call(this, destination);
  4429. this.keySelector = keySelector;
  4430. this.hasKey = false;
  4431. if (typeof compare === 'function') {
  4432. this.compare = compare;
  4433. }
  4434. }
  4435. DistinctUntilChangedSubscriber.prototype.compare = function (x, y) {
  4436. return x === y;
  4437. };
  4438. DistinctUntilChangedSubscriber.prototype._next = function (value) {
  4439. var keySelector = this.keySelector;
  4440. var key = value;
  4441. if (keySelector) {
  4442. key = tryCatch_1.tryCatch(this.keySelector)(value);
  4443. if (key === errorObject_1.errorObject) {
  4444. return this.destination.error(errorObject_1.errorObject.e);
  4445. }
  4446. }
  4447. var result = false;
  4448. if (this.hasKey) {
  4449. result = tryCatch_1.tryCatch(this.compare)(this.key, key);
  4450. if (result === errorObject_1.errorObject) {
  4451. return this.destination.error(errorObject_1.errorObject.e);
  4452. }
  4453. }
  4454. else {
  4455. this.hasKey = true;
  4456. }
  4457. if (Boolean(result) === false) {
  4458. this.key = key;
  4459. this.destination.next(value);
  4460. }
  4461. };
  4462. return DistinctUntilChangedSubscriber;
  4463. }(Subscriber_1.Subscriber));
  4464. //# sourceMappingURL=distinctUntilChanged.js.map
  4465. /***/ }),
  4466. /* 41 */
  4467. /***/ (function(module, exports, __webpack_require__) {
  4468. "use strict";
  4469. var FromEventObservable_1 = __webpack_require__(173);
  4470. exports.fromEvent = FromEventObservable_1.FromEventObservable.create;
  4471. //# sourceMappingURL=fromEvent.js.map
  4472. /***/ }),
  4473. /* 42 */
  4474. /***/ (function(module, exports, __webpack_require__) {
  4475. "use strict";
  4476. function isFunction(x) {
  4477. return typeof x === 'function';
  4478. }
  4479. exports.isFunction = isFunction;
  4480. //# sourceMappingURL=isFunction.js.map
  4481. /***/ }),
  4482. /* 43 */
  4483. /***/ (function(module, exports, __webpack_require__) {
  4484. "use strict";
  4485. var errorObject_1 = __webpack_require__(27);
  4486. var tryCatchTarget;
  4487. function tryCatcher() {
  4488. try {
  4489. return tryCatchTarget.apply(this, arguments);
  4490. }
  4491. catch (e) {
  4492. errorObject_1.errorObject.e = e;
  4493. return errorObject_1.errorObject;
  4494. }
  4495. }
  4496. function tryCatch(fn) {
  4497. tryCatchTarget = fn;
  4498. return tryCatcher;
  4499. }
  4500. exports.tryCatch = tryCatch;
  4501. ;
  4502. //# sourceMappingURL=tryCatch.js.map
  4503. /***/ }),
  4504. /* 44 */
  4505. /***/ (function(module, exports, __webpack_require__) {
  4506. "use strict";
  4507. var root_1 = __webpack_require__(8);
  4508. var Symbol = root_1.root.Symbol;
  4509. exports.rxSubscriber = (typeof Symbol === 'function' && typeof Symbol.for === 'function') ?
  4510. Symbol.for('rxSubscriber') : '@@rxSubscriber';
  4511. /**
  4512. * @deprecated use rxSubscriber instead
  4513. */
  4514. exports.$$rxSubscriber = exports.rxSubscriber;
  4515. //# sourceMappingURL=rxSubscriber.js.map
  4516. /***/ }),
  4517. /* 45 */
  4518. /***/ (function(module, exports, __webpack_require__) {
  4519. "use strict";
  4520. var root_1 = __webpack_require__(8);
  4521. function getSymbolObservable(context) {
  4522. var $$observable;
  4523. var Symbol = context.Symbol;
  4524. if (typeof Symbol === 'function') {
  4525. if (Symbol.observable) {
  4526. $$observable = Symbol.observable;
  4527. }
  4528. else {
  4529. $$observable = Symbol('observable');
  4530. Symbol.observable = $$observable;
  4531. }
  4532. }
  4533. else {
  4534. $$observable = '@@observable';
  4535. }
  4536. return $$observable;
  4537. }
  4538. exports.getSymbolObservable = getSymbolObservable;
  4539. exports.observable = getSymbolObservable(root_1.root);
  4540. /**
  4541. * @deprecated use observable instead
  4542. */
  4543. exports.$$observable = exports.observable;
  4544. //# sourceMappingURL=observable.js.map
  4545. /***/ }),
  4546. /* 46 */
  4547. /***/ (function(module, exports, __webpack_require__) {
  4548. "use strict";
  4549. var __extends = (this && this.__extends) || function (d, b) {
  4550. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  4551. function __() { this.constructor = d; }
  4552. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  4553. };
  4554. var Observable_1 = __webpack_require__(1);
  4555. /**
  4556. * We need this JSDoc comment for affecting ESDoc.
  4557. * @extends {Ignored}
  4558. * @hide true
  4559. */
  4560. var ScalarObservable = (function (_super) {
  4561. __extends(ScalarObservable, _super);
  4562. function ScalarObservable(value, scheduler) {
  4563. _super.call(this);
  4564. this.value = value;
  4565. this.scheduler = scheduler;
  4566. this._isScalar = true;
  4567. if (scheduler) {
  4568. this._isScalar = false;
  4569. }
  4570. }
  4571. ScalarObservable.create = function (value, scheduler) {
  4572. return new ScalarObservable(value, scheduler);
  4573. };
  4574. ScalarObservable.dispatch = function (state) {
  4575. var done = state.done, value = state.value, subscriber = state.subscriber;
  4576. if (done) {
  4577. subscriber.complete();
  4578. return;
  4579. }
  4580. subscriber.next(value);
  4581. if (subscriber.closed) {
  4582. return;
  4583. }
  4584. state.done = true;
  4585. this.schedule(state);
  4586. };
  4587. /** @deprecated internal use only */ ScalarObservable.prototype._subscribe = function (subscriber) {
  4588. var value = this.value;
  4589. var scheduler = this.scheduler;
  4590. if (scheduler) {
  4591. return scheduler.schedule(ScalarObservable.dispatch, 0, {
  4592. done: false, value: value, subscriber: subscriber
  4593. });
  4594. }
  4595. else {
  4596. subscriber.next(value);
  4597. if (!subscriber.closed) {
  4598. subscriber.complete();
  4599. }
  4600. }
  4601. };
  4602. return ScalarObservable;
  4603. }(Observable_1.Observable));
  4604. exports.ScalarObservable = ScalarObservable;
  4605. //# sourceMappingURL=ScalarObservable.js.map
  4606. /***/ }),
  4607. /* 47 */
  4608. /***/ (function(module, exports) {
  4609. /**
  4610. * Helpers.
  4611. */
  4612. var s = 1000;
  4613. var m = s * 60;
  4614. var h = m * 60;
  4615. var d = h * 24;
  4616. var y = d * 365.25;
  4617. /**
  4618. * Parse or format the given `val`.
  4619. *
  4620. * Options:
  4621. *
  4622. * - `long` verbose formatting [false]
  4623. *
  4624. * @param {String|Number} val
  4625. * @param {Object} [options]
  4626. * @throws {Error} throw an error if val is not a non-empty string or a number
  4627. * @return {String|Number}
  4628. * @api public
  4629. */
  4630. module.exports = function(val, options) {
  4631. options = options || {};
  4632. var type = typeof val;
  4633. if (type === 'string' && val.length > 0) {
  4634. return parse(val);
  4635. } else if (type === 'number' && isNaN(val) === false) {
  4636. return options.long ? fmtLong(val) : fmtShort(val);
  4637. }
  4638. throw new Error(
  4639. 'val is not a non-empty string or a valid number. val=' +
  4640. JSON.stringify(val)
  4641. );
  4642. };
  4643. /**
  4644. * Parse the given `str` and return milliseconds.
  4645. *
  4646. * @param {String} str
  4647. * @return {Number}
  4648. * @api private
  4649. */
  4650. function parse(str) {
  4651. str = String(str);
  4652. if (str.length > 100) {
  4653. return;
  4654. }
  4655. var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(
  4656. str
  4657. );
  4658. if (!match) {
  4659. return;
  4660. }
  4661. var n = parseFloat(match[1]);
  4662. var type = (match[2] || 'ms').toLowerCase();
  4663. switch (type) {
  4664. case 'years':
  4665. case 'year':
  4666. case 'yrs':
  4667. case 'yr':
  4668. case 'y':
  4669. return n * y;
  4670. case 'days':
  4671. case 'day':
  4672. case 'd':
  4673. return n * d;
  4674. case 'hours':
  4675. case 'hour':
  4676. case 'hrs':
  4677. case 'hr':
  4678. case 'h':
  4679. return n * h;
  4680. case 'minutes':
  4681. case 'minute':
  4682. case 'mins':
  4683. case 'min':
  4684. case 'm':
  4685. return n * m;
  4686. case 'seconds':
  4687. case 'second':
  4688. case 'secs':
  4689. case 'sec':
  4690. case 's':
  4691. return n * s;
  4692. case 'milliseconds':
  4693. case 'millisecond':
  4694. case 'msecs':
  4695. case 'msec':
  4696. case 'ms':
  4697. return n;
  4698. default:
  4699. return undefined;
  4700. }
  4701. }
  4702. /**
  4703. * Short format for `ms`.
  4704. *
  4705. * @param {Number} ms
  4706. * @return {String}
  4707. * @api private
  4708. */
  4709. function fmtShort(ms) {
  4710. if (ms >= d) {
  4711. return Math.round(ms / d) + 'd';
  4712. }
  4713. if (ms >= h) {
  4714. return Math.round(ms / h) + 'h';
  4715. }
  4716. if (ms >= m) {
  4717. return Math.round(ms / m) + 'm';
  4718. }
  4719. if (ms >= s) {
  4720. return Math.round(ms / s) + 's';
  4721. }
  4722. return ms + 'ms';
  4723. }
  4724. /**
  4725. * Long format for `ms`.
  4726. *
  4727. * @param {Number} ms
  4728. * @return {String}
  4729. * @api private
  4730. */
  4731. function fmtLong(ms) {
  4732. return plural(ms, d, 'day') ||
  4733. plural(ms, h, 'hour') ||
  4734. plural(ms, m, 'minute') ||
  4735. plural(ms, s, 'second') ||
  4736. ms + ' ms';
  4737. }
  4738. /**
  4739. * Pluralization helper.
  4740. */
  4741. function plural(ms, n, name) {
  4742. if (ms < n) {
  4743. return;
  4744. }
  4745. if (ms < n * 1.5) {
  4746. return Math.floor(ms / n) + ' ' + name;
  4747. }
  4748. return Math.ceil(ms / n) + ' ' + name + 's';
  4749. }
  4750. /***/ }),
  4751. /* 48 */
  4752. /***/ (function(module, exports, __webpack_require__) {
  4753. /**
  4754. * Module dependencies.
  4755. */
  4756. var debug = __webpack_require__(110)('socket.io-parser');
  4757. var Emitter = __webpack_require__(18);
  4758. var binary = __webpack_require__(112);
  4759. var isArray = __webpack_require__(61);
  4760. var isBuf = __webpack_require__(62);
  4761. /**
  4762. * Protocol version.
  4763. *
  4764. * @api public
  4765. */
  4766. exports.protocol = 4;
  4767. /**
  4768. * Packet types.
  4769. *
  4770. * @api public
  4771. */
  4772. exports.types = [
  4773. 'CONNECT',
  4774. 'DISCONNECT',
  4775. 'EVENT',
  4776. 'ACK',
  4777. 'ERROR',
  4778. 'BINARY_EVENT',
  4779. 'BINARY_ACK'
  4780. ];
  4781. /**
  4782. * Packet type `connect`.
  4783. *
  4784. * @api public
  4785. */
  4786. exports.CONNECT = 0;
  4787. /**
  4788. * Packet type `disconnect`.
  4789. *
  4790. * @api public
  4791. */
  4792. exports.DISCONNECT = 1;
  4793. /**
  4794. * Packet type `event`.
  4795. *
  4796. * @api public
  4797. */
  4798. exports.EVENT = 2;
  4799. /**
  4800. * Packet type `ack`.
  4801. *
  4802. * @api public
  4803. */
  4804. exports.ACK = 3;
  4805. /**
  4806. * Packet type `error`.
  4807. *
  4808. * @api public
  4809. */
  4810. exports.ERROR = 4;
  4811. /**
  4812. * Packet type 'binary event'
  4813. *
  4814. * @api public
  4815. */
  4816. exports.BINARY_EVENT = 5;
  4817. /**
  4818. * Packet type `binary ack`. For acks with binary arguments.
  4819. *
  4820. * @api public
  4821. */
  4822. exports.BINARY_ACK = 6;
  4823. /**
  4824. * Encoder constructor.
  4825. *
  4826. * @api public
  4827. */
  4828. exports.Encoder = Encoder;
  4829. /**
  4830. * Decoder constructor.
  4831. *
  4832. * @api public
  4833. */
  4834. exports.Decoder = Decoder;
  4835. /**
  4836. * A socket.io Encoder instance
  4837. *
  4838. * @api public
  4839. */
  4840. function Encoder() {}
  4841. var ERROR_PACKET = exports.ERROR + '"encode error"';
  4842. /**
  4843. * Encode a packet as a single string if non-binary, or as a
  4844. * buffer sequence, depending on packet type.
  4845. *
  4846. * @param {Object} obj - packet object
  4847. * @param {Function} callback - function to handle encodings (likely engine.write)
  4848. * @return Calls callback with Array of encodings
  4849. * @api public
  4850. */
  4851. Encoder.prototype.encode = function(obj, callback){
  4852. debug('encoding packet %j', obj);
  4853. if (exports.BINARY_EVENT === obj.type || exports.BINARY_ACK === obj.type) {
  4854. encodeAsBinary(obj, callback);
  4855. } else {
  4856. var encoding = encodeAsString(obj);
  4857. callback([encoding]);
  4858. }
  4859. };
  4860. /**
  4861. * Encode packet as string.
  4862. *
  4863. * @param {Object} packet
  4864. * @return {String} encoded
  4865. * @api private
  4866. */
  4867. function encodeAsString(obj) {
  4868. // first is type
  4869. var str = '' + obj.type;
  4870. // attachments if we have them
  4871. if (exports.BINARY_EVENT === obj.type || exports.BINARY_ACK === obj.type) {
  4872. str += obj.attachments + '-';
  4873. }
  4874. // if we have a namespace other than `/`
  4875. // we append it followed by a comma `,`
  4876. if (obj.nsp && '/' !== obj.nsp) {
  4877. str += obj.nsp + ',';
  4878. }
  4879. // immediately followed by the id
  4880. if (null != obj.id) {
  4881. str += obj.id;
  4882. }
  4883. // json data
  4884. if (null != obj.data) {
  4885. var payload = tryStringify(obj.data);
  4886. if (payload !== false) {
  4887. str += payload;
  4888. } else {
  4889. return ERROR_PACKET;
  4890. }
  4891. }
  4892. debug('encoded %j as %s', obj, str);
  4893. return str;
  4894. }
  4895. function tryStringify(str) {
  4896. try {
  4897. return JSON.stringify(str);
  4898. } catch(e){
  4899. return false;
  4900. }
  4901. }
  4902. /**
  4903. * Encode packet as 'buffer sequence' by removing blobs, and
  4904. * deconstructing packet into object with placeholders and
  4905. * a list of buffers.
  4906. *
  4907. * @param {Object} packet
  4908. * @return {Buffer} encoded
  4909. * @api private
  4910. */
  4911. function encodeAsBinary(obj, callback) {
  4912. function writeEncoding(bloblessData) {
  4913. var deconstruction = binary.deconstructPacket(bloblessData);
  4914. var pack = encodeAsString(deconstruction.packet);
  4915. var buffers = deconstruction.buffers;
  4916. buffers.unshift(pack); // add packet info to beginning of data list
  4917. callback(buffers); // write all the buffers
  4918. }
  4919. binary.removeBlobs(obj, writeEncoding);
  4920. }
  4921. /**
  4922. * A socket.io Decoder instance
  4923. *
  4924. * @return {Object} decoder
  4925. * @api public
  4926. */
  4927. function Decoder() {
  4928. this.reconstructor = null;
  4929. }
  4930. /**
  4931. * Mix in `Emitter` with Decoder.
  4932. */
  4933. Emitter(Decoder.prototype);
  4934. /**
  4935. * Decodes an ecoded packet string into packet JSON.
  4936. *
  4937. * @param {String} obj - encoded packet
  4938. * @return {Object} packet
  4939. * @api public
  4940. */
  4941. Decoder.prototype.add = function(obj) {
  4942. var packet;
  4943. if (typeof obj === 'string') {
  4944. packet = decodeString(obj);
  4945. if (exports.BINARY_EVENT === packet.type || exports.BINARY_ACK === packet.type) { // binary packet's json
  4946. this.reconstructor = new BinaryReconstructor(packet);
  4947. // no attachments, labeled binary but no binary data to follow
  4948. if (this.reconstructor.reconPack.attachments === 0) {
  4949. this.emit('decoded', packet);
  4950. }
  4951. } else { // non-binary full packet
  4952. this.emit('decoded', packet);
  4953. }
  4954. }
  4955. else if (isBuf(obj) || obj.base64) { // raw binary data
  4956. if (!this.reconstructor) {
  4957. throw new Error('got binary data when not reconstructing a packet');
  4958. } else {
  4959. packet = this.reconstructor.takeBinaryData(obj);
  4960. if (packet) { // received final buffer
  4961. this.reconstructor = null;
  4962. this.emit('decoded', packet);
  4963. }
  4964. }
  4965. }
  4966. else {
  4967. throw new Error('Unknown type: ' + obj);
  4968. }
  4969. };
  4970. /**
  4971. * Decode a packet String (JSON data)
  4972. *
  4973. * @param {String} str
  4974. * @return {Object} packet
  4975. * @api private
  4976. */
  4977. function decodeString(str) {
  4978. var i = 0;
  4979. // look up type
  4980. var p = {
  4981. type: Number(str.charAt(0))
  4982. };
  4983. if (null == exports.types[p.type]) {
  4984. return error('unknown packet type ' + p.type);
  4985. }
  4986. // look up attachments if type binary
  4987. if (exports.BINARY_EVENT === p.type || exports.BINARY_ACK === p.type) {
  4988. var buf = '';
  4989. while (str.charAt(++i) !== '-') {
  4990. buf += str.charAt(i);
  4991. if (i == str.length) break;
  4992. }
  4993. if (buf != Number(buf) || str.charAt(i) !== '-') {
  4994. throw new Error('Illegal attachments');
  4995. }
  4996. p.attachments = Number(buf);
  4997. }
  4998. // look up namespace (if any)
  4999. if ('/' === str.charAt(i + 1)) {
  5000. p.nsp = '';
  5001. while (++i) {
  5002. var c = str.charAt(i);
  5003. if (',' === c) break;
  5004. p.nsp += c;
  5005. if (i === str.length) break;
  5006. }
  5007. } else {
  5008. p.nsp = '/';
  5009. }
  5010. // look up id
  5011. var next = str.charAt(i + 1);
  5012. if ('' !== next && Number(next) == next) {
  5013. p.id = '';
  5014. while (++i) {
  5015. var c = str.charAt(i);
  5016. if (null == c || Number(c) != c) {
  5017. --i;
  5018. break;
  5019. }
  5020. p.id += str.charAt(i);
  5021. if (i === str.length) break;
  5022. }
  5023. p.id = Number(p.id);
  5024. }
  5025. // look up json data
  5026. if (str.charAt(++i)) {
  5027. var payload = tryParse(str.substr(i));
  5028. var isPayloadValid = payload !== false && (p.type === exports.ERROR || isArray(payload));
  5029. if (isPayloadValid) {
  5030. p.data = payload;
  5031. } else {
  5032. return error('invalid payload');
  5033. }
  5034. }
  5035. debug('decoded %s as %j', str, p);
  5036. return p;
  5037. }
  5038. function tryParse(str) {
  5039. try {
  5040. return JSON.parse(str);
  5041. } catch(e){
  5042. return false;
  5043. }
  5044. }
  5045. /**
  5046. * Deallocates a parser's resources
  5047. *
  5048. * @api public
  5049. */
  5050. Decoder.prototype.destroy = function() {
  5051. if (this.reconstructor) {
  5052. this.reconstructor.finishedReconstruction();
  5053. }
  5054. };
  5055. /**
  5056. * A manager of a binary event's 'buffer sequence'. Should
  5057. * be constructed whenever a packet of type BINARY_EVENT is
  5058. * decoded.
  5059. *
  5060. * @param {Object} packet
  5061. * @return {BinaryReconstructor} initialized reconstructor
  5062. * @api private
  5063. */
  5064. function BinaryReconstructor(packet) {
  5065. this.reconPack = packet;
  5066. this.buffers = [];
  5067. }
  5068. /**
  5069. * Method to be called when binary data received from connection
  5070. * after a BINARY_EVENT packet.
  5071. *
  5072. * @param {Buffer | ArrayBuffer} binData - the raw binary data received
  5073. * @return {null | Object} returns null if more binary data is expected or
  5074. * a reconstructed packet object if all buffers have been received.
  5075. * @api private
  5076. */
  5077. BinaryReconstructor.prototype.takeBinaryData = function(binData) {
  5078. this.buffers.push(binData);
  5079. if (this.buffers.length === this.reconPack.attachments) { // done with buffer list
  5080. var packet = binary.reconstructPacket(this.reconPack, this.buffers);
  5081. this.finishedReconstruction();
  5082. return packet;
  5083. }
  5084. return null;
  5085. };
  5086. /**
  5087. * Cleans up binary packet reconstruction variables.
  5088. *
  5089. * @api private
  5090. */
  5091. BinaryReconstructor.prototype.finishedReconstruction = function() {
  5092. this.reconPack = null;
  5093. this.buffers = [];
  5094. };
  5095. function error(msg) {
  5096. return {
  5097. type: exports.ERROR,
  5098. data: 'parser error: ' + msg
  5099. };
  5100. }
  5101. /***/ }),
  5102. /* 49 */
  5103. /***/ (function(module, exports, __webpack_require__) {
  5104. /* WEBPACK VAR INJECTION */(function(global) {// browser shim for xmlhttprequest module
  5105. var hasCORS = __webpack_require__(115);
  5106. module.exports = function (opts) {
  5107. var xdomain = opts.xdomain;
  5108. // scheme must be same when usign XDomainRequest
  5109. // http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx
  5110. var xscheme = opts.xscheme;
  5111. // XDomainRequest has a flow of not sending cookie, therefore it should be disabled as a default.
  5112. // https://github.com/Automattic/engine.io-client/pull/217
  5113. var enablesXDR = opts.enablesXDR;
  5114. // XMLHttpRequest can be disabled on IE
  5115. try {
  5116. if ('undefined' !== typeof XMLHttpRequest && (!xdomain || hasCORS)) {
  5117. return new XMLHttpRequest();
  5118. }
  5119. } catch (e) { }
  5120. // Use XDomainRequest for IE8 if enablesXDR is true
  5121. // because loading bar keeps flashing when using jsonp-polling
  5122. // https://github.com/yujiosaka/socke.io-ie8-loading-example
  5123. try {
  5124. if ('undefined' !== typeof XDomainRequest && !xscheme && enablesXDR) {
  5125. return new XDomainRequest();
  5126. }
  5127. } catch (e) { }
  5128. if (!xdomain) {
  5129. try {
  5130. return new global[['Active'].concat('Object').join('X')]('Microsoft.XMLHTTP');
  5131. } catch (e) { }
  5132. }
  5133. };
  5134. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
  5135. /***/ }),
  5136. /* 50 */
  5137. /***/ (function(module, exports, __webpack_require__) {
  5138. /**
  5139. * Module dependencies.
  5140. */
  5141. var parser = __webpack_require__(19);
  5142. var Emitter = __webpack_require__(18);
  5143. /**
  5144. * Module exports.
  5145. */
  5146. module.exports = Transport;
  5147. /**
  5148. * Transport abstract constructor.
  5149. *
  5150. * @param {Object} options.
  5151. * @api private
  5152. */
  5153. function Transport (opts) {
  5154. this.path = opts.path;
  5155. this.hostname = opts.hostname;
  5156. this.port = opts.port;
  5157. this.secure = opts.secure;
  5158. this.query = opts.query;
  5159. this.timestampParam = opts.timestampParam;
  5160. this.timestampRequests = opts.timestampRequests;
  5161. this.readyState = '';
  5162. this.agent = opts.agent || false;
  5163. this.socket = opts.socket;
  5164. this.enablesXDR = opts.enablesXDR;
  5165. // SSL options for Node.js client
  5166. this.pfx = opts.pfx;
  5167. this.key = opts.key;
  5168. this.passphrase = opts.passphrase;
  5169. this.cert = opts.cert;
  5170. this.ca = opts.ca;
  5171. this.ciphers = opts.ciphers;
  5172. this.rejectUnauthorized = opts.rejectUnauthorized;
  5173. this.forceNode = opts.forceNode;
  5174. // other options for Node.js client
  5175. this.extraHeaders = opts.extraHeaders;
  5176. this.localAddress = opts.localAddress;
  5177. }
  5178. /**
  5179. * Mix in `Emitter`.
  5180. */
  5181. Emitter(Transport.prototype);
  5182. /**
  5183. * Emits an error.
  5184. *
  5185. * @param {String} str
  5186. * @return {Transport} for chaining
  5187. * @api public
  5188. */
  5189. Transport.prototype.onError = function (msg, desc) {
  5190. var err = new Error(msg);
  5191. err.type = 'TransportError';
  5192. err.description = desc;
  5193. this.emit('error', err);
  5194. return this;
  5195. };
  5196. /**
  5197. * Opens the transport.
  5198. *
  5199. * @api public
  5200. */
  5201. Transport.prototype.open = function () {
  5202. if ('closed' === this.readyState || '' === this.readyState) {
  5203. this.readyState = 'opening';
  5204. this.doOpen();
  5205. }
  5206. return this;
  5207. };
  5208. /**
  5209. * Closes the transport.
  5210. *
  5211. * @api private
  5212. */
  5213. Transport.prototype.close = function () {
  5214. if ('opening' === this.readyState || 'open' === this.readyState) {
  5215. this.doClose();
  5216. this.onClose();
  5217. }
  5218. return this;
  5219. };
  5220. /**
  5221. * Sends multiple packets.
  5222. *
  5223. * @param {Array} packets
  5224. * @api private
  5225. */
  5226. Transport.prototype.send = function (packets) {
  5227. if ('open' === this.readyState) {
  5228. this.write(packets);
  5229. } else {
  5230. throw new Error('Transport not open');
  5231. }
  5232. };
  5233. /**
  5234. * Called upon open
  5235. *
  5236. * @api private
  5237. */
  5238. Transport.prototype.onOpen = function () {
  5239. this.readyState = 'open';
  5240. this.writable = true;
  5241. this.emit('open');
  5242. };
  5243. /**
  5244. * Called with data.
  5245. *
  5246. * @param {String} data
  5247. * @api private
  5248. */
  5249. Transport.prototype.onData = function (data) {
  5250. var packet = parser.decodePacket(data, this.socket.binaryType);
  5251. this.onPacket(packet);
  5252. };
  5253. /**
  5254. * Called with a decoded packet.
  5255. */
  5256. Transport.prototype.onPacket = function (packet) {
  5257. this.emit('packet', packet);
  5258. };
  5259. /**
  5260. * Called upon close.
  5261. *
  5262. * @api private
  5263. */
  5264. Transport.prototype.onClose = function () {
  5265. this.readyState = 'closed';
  5266. this.emit('close');
  5267. };
  5268. /***/ }),
  5269. /* 51 */
  5270. /***/ (function(module, exports, __webpack_require__) {
  5271. "use strict";
  5272. var TimerObservable_1 = __webpack_require__(139);
  5273. exports.timer = TimerObservable_1.TimerObservable.create;
  5274. //# sourceMappingURL=timer.js.map
  5275. /***/ }),
  5276. /* 52 */
  5277. /***/ (function(module, exports, __webpack_require__) {
  5278. "use strict";
  5279. Object.defineProperty(exports, "__esModule", { value: true });
  5280. var ignoreElements_1 = __webpack_require__(12);
  5281. var tap_1 = __webpack_require__(6);
  5282. var effects_1 = __webpack_require__(9);
  5283. /**
  5284. * Set the local client options
  5285. * @param xs
  5286. * @param inputs
  5287. */
  5288. function setOptionsEffect(xs, inputs) {
  5289. return xs.pipe(tap_1.tap(function (options) { return inputs.option$.next(options); }),
  5290. // map(() => consoleInfo('set options'))
  5291. ignoreElements_1.ignoreElements());
  5292. }
  5293. exports.setOptionsEffect = setOptionsEffect;
  5294. function setOptions(options) {
  5295. return [effects_1.EffectNames.SetOptions, options];
  5296. }
  5297. exports.setOptions = setOptions;
  5298. /***/ }),
  5299. /* 53 */
  5300. /***/ (function(module, exports, __webpack_require__) {
  5301. "use strict";
  5302. var isScheduler_1 = __webpack_require__(25);
  5303. var of_1 = __webpack_require__(10);
  5304. var from_1 = __webpack_require__(86);
  5305. var concatAll_1 = __webpack_require__(151);
  5306. /* tslint:enable:max-line-length */
  5307. /**
  5308. * Creates an output Observable which sequentially emits all values from given
  5309. * Observable and then moves on to the next.
  5310. *
  5311. * <span class="informal">Concatenates multiple Observables together by
  5312. * sequentially emitting their values, one Observable after the other.</span>
  5313. *
  5314. * <img src="./img/concat.png" width="100%">
  5315. *
  5316. * `concat` joins multiple Observables together, by subscribing to them one at a time and
  5317. * merging their results into the output Observable. You can pass either an array of
  5318. * Observables, or put them directly as arguments. Passing an empty array will result
  5319. * in Observable that completes immediately.
  5320. *
  5321. * `concat` will subscribe to first input Observable and emit all its values, without
  5322. * changing or affecting them in any way. When that Observable completes, it will
  5323. * subscribe to then next Observable passed and, again, emit its values. This will be
  5324. * repeated, until the operator runs out of Observables. When last input Observable completes,
  5325. * `concat` will complete as well. At any given moment only one Observable passed to operator
  5326. * emits values. If you would like to emit values from passed Observables concurrently, check out
  5327. * {@link merge} instead, especially with optional `concurrent` parameter. As a matter of fact,
  5328. * `concat` is an equivalent of `merge` operator with `concurrent` parameter set to `1`.
  5329. *
  5330. * Note that if some input Observable never completes, `concat` will also never complete
  5331. * and Observables following the one that did not complete will never be subscribed. On the other
  5332. * hand, if some Observable simply completes immediately after it is subscribed, it will be
  5333. * invisible for `concat`, which will just move on to the next Observable.
  5334. *
  5335. * If any Observable in chain errors, instead of passing control to the next Observable,
  5336. * `concat` will error immediately as well. Observables that would be subscribed after
  5337. * the one that emitted error, never will.
  5338. *
  5339. * If you pass to `concat` the same Observable many times, its stream of values
  5340. * will be "replayed" on every subscription, which means you can repeat given Observable
  5341. * as many times as you like. If passing the same Observable to `concat` 1000 times becomes tedious,
  5342. * you can always use {@link repeat}.
  5343. *
  5344. * @example <caption>Concatenate a timer counting from 0 to 3 with a synchronous sequence from 1 to 10</caption>
  5345. * var timer = Rx.Observable.interval(1000).take(4);
  5346. * var sequence = Rx.Observable.range(1, 10);
  5347. * var result = Rx.Observable.concat(timer, sequence);
  5348. * result.subscribe(x => console.log(x));
  5349. *
  5350. * // results in:
  5351. * // 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3 -immediate-> 1 ... 10
  5352. *
  5353. *
  5354. * @example <caption>Concatenate an array of 3 Observables</caption>
  5355. * var timer1 = Rx.Observable.interval(1000).take(10);
  5356. * var timer2 = Rx.Observable.interval(2000).take(6);
  5357. * var timer3 = Rx.Observable.interval(500).take(10);
  5358. * var result = Rx.Observable.concat([timer1, timer2, timer3]); // note that array is passed
  5359. * result.subscribe(x => console.log(x));
  5360. *
  5361. * // results in the following:
  5362. * // (Prints to console sequentially)
  5363. * // -1000ms-> 0 -1000ms-> 1 -1000ms-> ... 9
  5364. * // -2000ms-> 0 -2000ms-> 1 -2000ms-> ... 5
  5365. * // -500ms-> 0 -500ms-> 1 -500ms-> ... 9
  5366. *
  5367. *
  5368. * @example <caption>Concatenate the same Observable to repeat it</caption>
  5369. * const timer = Rx.Observable.interval(1000).take(2);
  5370. *
  5371. * Rx.Observable.concat(timer, timer) // concating the same Observable!
  5372. * .subscribe(
  5373. * value => console.log(value),
  5374. * err => {},
  5375. * () => console.log('...and it is done!')
  5376. * );
  5377. *
  5378. * // Logs:
  5379. * // 0 after 1s
  5380. * // 1 after 2s
  5381. * // 0 after 3s
  5382. * // 1 after 4s
  5383. * // "...and it is done!" also after 4s
  5384. *
  5385. * @see {@link concatAll}
  5386. * @see {@link concatMap}
  5387. * @see {@link concatMapTo}
  5388. *
  5389. * @param {ObservableInput} input1 An input Observable to concatenate with others.
  5390. * @param {ObservableInput} input2 An input Observable to concatenate with others.
  5391. * More than one input Observables may be given as argument.
  5392. * @param {Scheduler} [scheduler=null] An optional IScheduler to schedule each
  5393. * Observable subscription on.
  5394. * @return {Observable} All values of each passed Observable merged into a
  5395. * single Observable, in order, in serial fashion.
  5396. * @static true
  5397. * @name concat
  5398. * @owner Observable
  5399. */
  5400. function concat() {
  5401. var observables = [];
  5402. for (var _i = 0; _i < arguments.length; _i++) {
  5403. observables[_i - 0] = arguments[_i];
  5404. }
  5405. if (observables.length === 1 || (observables.length === 2 && isScheduler_1.isScheduler(observables[1]))) {
  5406. return from_1.from(observables[0]);
  5407. }
  5408. return concatAll_1.concatAll()(of_1.of.apply(void 0, observables));
  5409. }
  5410. exports.concat = concat;
  5411. //# sourceMappingURL=concat.js.map
  5412. /***/ }),
  5413. /* 54 */
  5414. /***/ (function(module, exports, __webpack_require__) {
  5415. "use strict";
  5416. var mergeMap_1 = __webpack_require__(16);
  5417. var identity_1 = __webpack_require__(152);
  5418. /**
  5419. * Converts a higher-order Observable into a first-order Observable which
  5420. * concurrently delivers all values that are emitted on the inner Observables.
  5421. *
  5422. * <span class="informal">Flattens an Observable-of-Observables.</span>
  5423. *
  5424. * <img src="./img/mergeAll.png" width="100%">
  5425. *
  5426. * `mergeAll` subscribes to an Observable that emits Observables, also known as
  5427. * a higher-order Observable. Each time it observes one of these emitted inner
  5428. * Observables, it subscribes to that and delivers all the values from the
  5429. * inner Observable on the output Observable. The output Observable only
  5430. * completes once all inner Observables have completed. Any error delivered by
  5431. * a inner Observable will be immediately emitted on the output Observable.
  5432. *
  5433. * @example <caption>Spawn a new interval Observable for each click event, and blend their outputs as one Observable</caption>
  5434. * var clicks = Rx.Observable.fromEvent(document, 'click');
  5435. * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000));
  5436. * var firstOrder = higherOrder.mergeAll();
  5437. * firstOrder.subscribe(x => console.log(x));
  5438. *
  5439. * @example <caption>Count from 0 to 9 every second for each click, but only allow 2 concurrent timers</caption>
  5440. * var clicks = Rx.Observable.fromEvent(document, 'click');
  5441. * var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000).take(10));
  5442. * var firstOrder = higherOrder.mergeAll(2);
  5443. * firstOrder.subscribe(x => console.log(x));
  5444. *
  5445. * @see {@link combineAll}
  5446. * @see {@link concatAll}
  5447. * @see {@link exhaust}
  5448. * @see {@link merge}
  5449. * @see {@link mergeMap}
  5450. * @see {@link mergeMapTo}
  5451. * @see {@link mergeScan}
  5452. * @see {@link switch}
  5453. * @see {@link zipAll}
  5454. *
  5455. * @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of inner
  5456. * Observables being subscribed to concurrently.
  5457. * @return {Observable} An Observable that emits values coming from all the
  5458. * inner Observables emitted by the source Observable.
  5459. * @method mergeAll
  5460. * @owner Observable
  5461. */
  5462. function mergeAll(concurrent) {
  5463. if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; }
  5464. return mergeMap_1.mergeMap(identity_1.identity, null, concurrent);
  5465. }
  5466. exports.mergeAll = mergeAll;
  5467. //# sourceMappingURL=mergeAll.js.map
  5468. /***/ }),
  5469. /* 55 */
  5470. /***/ (function(module, exports, __webpack_require__) {
  5471. "use strict";
  5472. function isObject(x) {
  5473. return x != null && typeof x === 'object';
  5474. }
  5475. exports.isObject = isObject;
  5476. //# sourceMappingURL=isObject.js.map
  5477. /***/ }),
  5478. /* 56 */
  5479. /***/ (function(module, exports, __webpack_require__) {
  5480. "use strict";
  5481. exports.empty = {
  5482. closed: true,
  5483. next: function (value) { },
  5484. error: function (err) { throw err; },
  5485. complete: function () { }
  5486. };
  5487. //# sourceMappingURL=Observer.js.map
  5488. /***/ }),
  5489. /* 57 */
  5490. /***/ (function(module, exports, __webpack_require__) {
  5491. "use strict";
  5492. /* tslint:disable:no-empty */
  5493. function noop() { }
  5494. exports.noop = noop;
  5495. //# sourceMappingURL=noop.js.map
  5496. /***/ }),
  5497. /* 58 */
  5498. /***/ (function(module, exports, __webpack_require__) {
  5499. "use strict";
  5500. exports.isArrayLike = (function (x) { return x && typeof x.length === 'number'; });
  5501. //# sourceMappingURL=isArrayLike.js.map
  5502. /***/ }),
  5503. /* 59 */
  5504. /***/ (function(module, exports, __webpack_require__) {
  5505. "use strict";
  5506. function isPromise(value) {
  5507. return value && typeof value.subscribe !== 'function' && typeof value.then === 'function';
  5508. }
  5509. exports.isPromise = isPromise;
  5510. //# sourceMappingURL=isPromise.js.map
  5511. /***/ }),
  5512. /* 60 */
  5513. /***/ (function(module, exports) {
  5514. /**
  5515. * Parses an URI
  5516. *
  5517. * @author Steven Levithan <stevenlevithan.com> (MIT license)
  5518. * @api private
  5519. */
  5520. var re = /^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;
  5521. var parts = [
  5522. 'source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'anchor'
  5523. ];
  5524. module.exports = function parseuri(str) {
  5525. var src = str,
  5526. b = str.indexOf('['),
  5527. e = str.indexOf(']');
  5528. if (b != -1 && e != -1) {
  5529. str = str.substring(0, b) + str.substring(b, e).replace(/:/g, ';') + str.substring(e, str.length);
  5530. }
  5531. var m = re.exec(str || ''),
  5532. uri = {},
  5533. i = 14;
  5534. while (i--) {
  5535. uri[parts[i]] = m[i] || '';
  5536. }
  5537. if (b != -1 && e != -1) {
  5538. uri.source = src;
  5539. uri.host = uri.host.substring(1, uri.host.length - 1).replace(/;/g, ':');
  5540. uri.authority = uri.authority.replace('[', '').replace(']', '').replace(/;/g, ':');
  5541. uri.ipv6uri = true;
  5542. }
  5543. return uri;
  5544. };
  5545. /***/ }),
  5546. /* 61 */
  5547. /***/ (function(module, exports) {
  5548. var toString = {}.toString;
  5549. module.exports = Array.isArray || function (arr) {
  5550. return toString.call(arr) == '[object Array]';
  5551. };
  5552. /***/ }),
  5553. /* 62 */
  5554. /***/ (function(module, exports, __webpack_require__) {
  5555. /* WEBPACK VAR INJECTION */(function(global) {
  5556. module.exports = isBuf;
  5557. var withNativeBuffer = typeof global.Buffer === 'function' && typeof global.Buffer.isBuffer === 'function';
  5558. var withNativeArrayBuffer = typeof global.ArrayBuffer === 'function';
  5559. var isView = (function () {
  5560. if (withNativeArrayBuffer && typeof global.ArrayBuffer.isView === 'function') {
  5561. return global.ArrayBuffer.isView;
  5562. } else {
  5563. return function (obj) { return obj.buffer instanceof global.ArrayBuffer; };
  5564. }
  5565. })();
  5566. /**
  5567. * Returns true if obj is a buffer or an arraybuffer.
  5568. *
  5569. * @api private
  5570. */
  5571. function isBuf(obj) {
  5572. return (withNativeBuffer && global.Buffer.isBuffer(obj)) ||
  5573. (withNativeArrayBuffer && (obj instanceof global.ArrayBuffer || isView(obj)));
  5574. }
  5575. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
  5576. /***/ }),
  5577. /* 63 */
  5578. /***/ (function(module, exports, __webpack_require__) {
  5579. /**
  5580. * Module dependencies.
  5581. */
  5582. var eio = __webpack_require__(113);
  5583. var Socket = __webpack_require__(69);
  5584. var Emitter = __webpack_require__(18);
  5585. var parser = __webpack_require__(48);
  5586. var on = __webpack_require__(70);
  5587. var bind = __webpack_require__(71);
  5588. var debug = __webpack_require__(32)('socket.io-client:manager');
  5589. var indexOf = __webpack_require__(68);
  5590. var Backoff = __webpack_require__(134);
  5591. /**
  5592. * IE6+ hasOwnProperty
  5593. */
  5594. var has = Object.prototype.hasOwnProperty;
  5595. /**
  5596. * Module exports
  5597. */
  5598. module.exports = Manager;
  5599. /**
  5600. * `Manager` constructor.
  5601. *
  5602. * @param {String} engine instance or engine uri/opts
  5603. * @param {Object} options
  5604. * @api public
  5605. */
  5606. function Manager (uri, opts) {
  5607. if (!(this instanceof Manager)) return new Manager(uri, opts);
  5608. if (uri && ('object' === typeof uri)) {
  5609. opts = uri;
  5610. uri = undefined;
  5611. }
  5612. opts = opts || {};
  5613. opts.path = opts.path || '/socket.io';
  5614. this.nsps = {};
  5615. this.subs = [];
  5616. this.opts = opts;
  5617. this.reconnection(opts.reconnection !== false);
  5618. this.reconnectionAttempts(opts.reconnectionAttempts || Infinity);
  5619. this.reconnectionDelay(opts.reconnectionDelay || 1000);
  5620. this.reconnectionDelayMax(opts.reconnectionDelayMax || 5000);
  5621. this.randomizationFactor(opts.randomizationFactor || 0.5);
  5622. this.backoff = new Backoff({
  5623. min: this.reconnectionDelay(),
  5624. max: this.reconnectionDelayMax(),
  5625. jitter: this.randomizationFactor()
  5626. });
  5627. this.timeout(null == opts.timeout ? 20000 : opts.timeout);
  5628. this.readyState = 'closed';
  5629. this.uri = uri;
  5630. this.connecting = [];
  5631. this.lastPing = null;
  5632. this.encoding = false;
  5633. this.packetBuffer = [];
  5634. var _parser = opts.parser || parser;
  5635. this.encoder = new _parser.Encoder();
  5636. this.decoder = new _parser.Decoder();
  5637. this.autoConnect = opts.autoConnect !== false;
  5638. if (this.autoConnect) this.open();
  5639. }
  5640. /**
  5641. * Propagate given event to sockets and emit on `this`
  5642. *
  5643. * @api private
  5644. */
  5645. Manager.prototype.emitAll = function () {
  5646. this.emit.apply(this, arguments);
  5647. for (var nsp in this.nsps) {
  5648. if (has.call(this.nsps, nsp)) {
  5649. this.nsps[nsp].emit.apply(this.nsps[nsp], arguments);
  5650. }
  5651. }
  5652. };
  5653. /**
  5654. * Update `socket.id` of all sockets
  5655. *
  5656. * @api private
  5657. */
  5658. Manager.prototype.updateSocketIds = function () {
  5659. for (var nsp in this.nsps) {
  5660. if (has.call(this.nsps, nsp)) {
  5661. this.nsps[nsp].id = this.generateId(nsp);
  5662. }
  5663. }
  5664. };
  5665. /**
  5666. * generate `socket.id` for the given `nsp`
  5667. *
  5668. * @param {String} nsp
  5669. * @return {String}
  5670. * @api private
  5671. */
  5672. Manager.prototype.generateId = function (nsp) {
  5673. return (nsp === '/' ? '' : (nsp + '#')) + this.engine.id;
  5674. };
  5675. /**
  5676. * Mix in `Emitter`.
  5677. */
  5678. Emitter(Manager.prototype);
  5679. /**
  5680. * Sets the `reconnection` config.
  5681. *
  5682. * @param {Boolean} true/false if it should automatically reconnect
  5683. * @return {Manager} self or value
  5684. * @api public
  5685. */
  5686. Manager.prototype.reconnection = function (v) {
  5687. if (!arguments.length) return this._reconnection;
  5688. this._reconnection = !!v;
  5689. return this;
  5690. };
  5691. /**
  5692. * Sets the reconnection attempts config.
  5693. *
  5694. * @param {Number} max reconnection attempts before giving up
  5695. * @return {Manager} self or value
  5696. * @api public
  5697. */
  5698. Manager.prototype.reconnectionAttempts = function (v) {
  5699. if (!arguments.length) return this._reconnectionAttempts;
  5700. this._reconnectionAttempts = v;
  5701. return this;
  5702. };
  5703. /**
  5704. * Sets the delay between reconnections.
  5705. *
  5706. * @param {Number} delay
  5707. * @return {Manager} self or value
  5708. * @api public
  5709. */
  5710. Manager.prototype.reconnectionDelay = function (v) {
  5711. if (!arguments.length) return this._reconnectionDelay;
  5712. this._reconnectionDelay = v;
  5713. this.backoff && this.backoff.setMin(v);
  5714. return this;
  5715. };
  5716. Manager.prototype.randomizationFactor = function (v) {
  5717. if (!arguments.length) return this._randomizationFactor;
  5718. this._randomizationFactor = v;
  5719. this.backoff && this.backoff.setJitter(v);
  5720. return this;
  5721. };
  5722. /**
  5723. * Sets the maximum delay between reconnections.
  5724. *
  5725. * @param {Number} delay
  5726. * @return {Manager} self or value
  5727. * @api public
  5728. */
  5729. Manager.prototype.reconnectionDelayMax = function (v) {
  5730. if (!arguments.length) return this._reconnectionDelayMax;
  5731. this._reconnectionDelayMax = v;
  5732. this.backoff && this.backoff.setMax(v);
  5733. return this;
  5734. };
  5735. /**
  5736. * Sets the connection timeout. `false` to disable
  5737. *
  5738. * @return {Manager} self or value
  5739. * @api public
  5740. */
  5741. Manager.prototype.timeout = function (v) {
  5742. if (!arguments.length) return this._timeout;
  5743. this._timeout = v;
  5744. return this;
  5745. };
  5746. /**
  5747. * Starts trying to reconnect if reconnection is enabled and we have not
  5748. * started reconnecting yet
  5749. *
  5750. * @api private
  5751. */
  5752. Manager.prototype.maybeReconnectOnOpen = function () {
  5753. // Only try to reconnect if it's the first time we're connecting
  5754. if (!this.reconnecting && this._reconnection && this.backoff.attempts === 0) {
  5755. // keeps reconnection from firing twice for the same reconnection loop
  5756. this.reconnect();
  5757. }
  5758. };
  5759. /**
  5760. * Sets the current transport `socket`.
  5761. *
  5762. * @param {Function} optional, callback
  5763. * @return {Manager} self
  5764. * @api public
  5765. */
  5766. Manager.prototype.open =
  5767. Manager.prototype.connect = function (fn, opts) {
  5768. debug('readyState %s', this.readyState);
  5769. if (~this.readyState.indexOf('open')) return this;
  5770. debug('opening %s', this.uri);
  5771. this.engine = eio(this.uri, this.opts);
  5772. var socket = this.engine;
  5773. var self = this;
  5774. this.readyState = 'opening';
  5775. this.skipReconnect = false;
  5776. // emit `open`
  5777. var openSub = on(socket, 'open', function () {
  5778. self.onopen();
  5779. fn && fn();
  5780. });
  5781. // emit `connect_error`
  5782. var errorSub = on(socket, 'error', function (data) {
  5783. debug('connect_error');
  5784. self.cleanup();
  5785. self.readyState = 'closed';
  5786. self.emitAll('connect_error', data);
  5787. if (fn) {
  5788. var err = new Error('Connection error');
  5789. err.data = data;
  5790. fn(err);
  5791. } else {
  5792. // Only do this if there is no fn to handle the error
  5793. self.maybeReconnectOnOpen();
  5794. }
  5795. });
  5796. // emit `connect_timeout`
  5797. if (false !== this._timeout) {
  5798. var timeout = this._timeout;
  5799. debug('connect attempt will timeout after %d', timeout);
  5800. // set timer
  5801. var timer = setTimeout(function () {
  5802. debug('connect attempt timed out after %d', timeout);
  5803. openSub.destroy();
  5804. socket.close();
  5805. socket.emit('error', 'timeout');
  5806. self.emitAll('connect_timeout', timeout);
  5807. }, timeout);
  5808. this.subs.push({
  5809. destroy: function () {
  5810. clearTimeout(timer);
  5811. }
  5812. });
  5813. }
  5814. this.subs.push(openSub);
  5815. this.subs.push(errorSub);
  5816. return this;
  5817. };
  5818. /**
  5819. * Called upon transport open.
  5820. *
  5821. * @api private
  5822. */
  5823. Manager.prototype.onopen = function () {
  5824. debug('open');
  5825. // clear old subs
  5826. this.cleanup();
  5827. // mark as open
  5828. this.readyState = 'open';
  5829. this.emit('open');
  5830. // add new subs
  5831. var socket = this.engine;
  5832. this.subs.push(on(socket, 'data', bind(this, 'ondata')));
  5833. this.subs.push(on(socket, 'ping', bind(this, 'onping')));
  5834. this.subs.push(on(socket, 'pong', bind(this, 'onpong')));
  5835. this.subs.push(on(socket, 'error', bind(this, 'onerror')));
  5836. this.subs.push(on(socket, 'close', bind(this, 'onclose')));
  5837. this.subs.push(on(this.decoder, 'decoded', bind(this, 'ondecoded')));
  5838. };
  5839. /**
  5840. * Called upon a ping.
  5841. *
  5842. * @api private
  5843. */
  5844. Manager.prototype.onping = function () {
  5845. this.lastPing = new Date();
  5846. this.emitAll('ping');
  5847. };
  5848. /**
  5849. * Called upon a packet.
  5850. *
  5851. * @api private
  5852. */
  5853. Manager.prototype.onpong = function () {
  5854. this.emitAll('pong', new Date() - this.lastPing);
  5855. };
  5856. /**
  5857. * Called with data.
  5858. *
  5859. * @api private
  5860. */
  5861. Manager.prototype.ondata = function (data) {
  5862. this.decoder.add(data);
  5863. };
  5864. /**
  5865. * Called when parser fully decodes a packet.
  5866. *
  5867. * @api private
  5868. */
  5869. Manager.prototype.ondecoded = function (packet) {
  5870. this.emit('packet', packet);
  5871. };
  5872. /**
  5873. * Called upon socket error.
  5874. *
  5875. * @api private
  5876. */
  5877. Manager.prototype.onerror = function (err) {
  5878. debug('error', err);
  5879. this.emitAll('error', err);
  5880. };
  5881. /**
  5882. * Creates a new socket for the given `nsp`.
  5883. *
  5884. * @return {Socket}
  5885. * @api public
  5886. */
  5887. Manager.prototype.socket = function (nsp, opts) {
  5888. var socket = this.nsps[nsp];
  5889. if (!socket) {
  5890. socket = new Socket(this, nsp, opts);
  5891. this.nsps[nsp] = socket;
  5892. var self = this;
  5893. socket.on('connecting', onConnecting);
  5894. socket.on('connect', function () {
  5895. socket.id = self.generateId(nsp);
  5896. });
  5897. if (this.autoConnect) {
  5898. // manually call here since connecting event is fired before listening
  5899. onConnecting();
  5900. }
  5901. }
  5902. function onConnecting () {
  5903. if (!~indexOf(self.connecting, socket)) {
  5904. self.connecting.push(socket);
  5905. }
  5906. }
  5907. return socket;
  5908. };
  5909. /**
  5910. * Called upon a socket close.
  5911. *
  5912. * @param {Socket} socket
  5913. */
  5914. Manager.prototype.destroy = function (socket) {
  5915. var index = indexOf(this.connecting, socket);
  5916. if (~index) this.connecting.splice(index, 1);
  5917. if (this.connecting.length) return;
  5918. this.close();
  5919. };
  5920. /**
  5921. * Writes a packet.
  5922. *
  5923. * @param {Object} packet
  5924. * @api private
  5925. */
  5926. Manager.prototype.packet = function (packet) {
  5927. debug('writing packet %j', packet);
  5928. var self = this;
  5929. if (packet.query && packet.type === 0) packet.nsp += '?' + packet.query;
  5930. if (!self.encoding) {
  5931. // encode, then write to engine with result
  5932. self.encoding = true;
  5933. this.encoder.encode(packet, function (encodedPackets) {
  5934. for (var i = 0; i < encodedPackets.length; i++) {
  5935. self.engine.write(encodedPackets[i], packet.options);
  5936. }
  5937. self.encoding = false;
  5938. self.processPacketQueue();
  5939. });
  5940. } else { // add packet to the queue
  5941. self.packetBuffer.push(packet);
  5942. }
  5943. };
  5944. /**
  5945. * If packet buffer is non-empty, begins encoding the
  5946. * next packet in line.
  5947. *
  5948. * @api private
  5949. */
  5950. Manager.prototype.processPacketQueue = function () {
  5951. if (this.packetBuffer.length > 0 && !this.encoding) {
  5952. var pack = this.packetBuffer.shift();
  5953. this.packet(pack);
  5954. }
  5955. };
  5956. /**
  5957. * Clean up transport subscriptions and packet buffer.
  5958. *
  5959. * @api private
  5960. */
  5961. Manager.prototype.cleanup = function () {
  5962. debug('cleanup');
  5963. var subsLength = this.subs.length;
  5964. for (var i = 0; i < subsLength; i++) {
  5965. var sub = this.subs.shift();
  5966. sub.destroy();
  5967. }
  5968. this.packetBuffer = [];
  5969. this.encoding = false;
  5970. this.lastPing = null;
  5971. this.decoder.destroy();
  5972. };
  5973. /**
  5974. * Close the current socket.
  5975. *
  5976. * @api private
  5977. */
  5978. Manager.prototype.close =
  5979. Manager.prototype.disconnect = function () {
  5980. debug('disconnect');
  5981. this.skipReconnect = true;
  5982. this.reconnecting = false;
  5983. if ('opening' === this.readyState) {
  5984. // `onclose` will not fire because
  5985. // an open event never happened
  5986. this.cleanup();
  5987. }
  5988. this.backoff.reset();
  5989. this.readyState = 'closed';
  5990. if (this.engine) this.engine.close();
  5991. };
  5992. /**
  5993. * Called upon engine close.
  5994. *
  5995. * @api private
  5996. */
  5997. Manager.prototype.onclose = function (reason) {
  5998. debug('onclose');
  5999. this.cleanup();
  6000. this.backoff.reset();
  6001. this.readyState = 'closed';
  6002. this.emit('close', reason);
  6003. if (this._reconnection && !this.skipReconnect) {
  6004. this.reconnect();
  6005. }
  6006. };
  6007. /**
  6008. * Attempt a reconnection.
  6009. *
  6010. * @api private
  6011. */
  6012. Manager.prototype.reconnect = function () {
  6013. if (this.reconnecting || this.skipReconnect) return this;
  6014. var self = this;
  6015. if (this.backoff.attempts >= this._reconnectionAttempts) {
  6016. debug('reconnect failed');
  6017. this.backoff.reset();
  6018. this.emitAll('reconnect_failed');
  6019. this.reconnecting = false;
  6020. } else {
  6021. var delay = this.backoff.duration();
  6022. debug('will wait %dms before reconnect attempt', delay);
  6023. this.reconnecting = true;
  6024. var timer = setTimeout(function () {
  6025. if (self.skipReconnect) return;
  6026. debug('attempting reconnect');
  6027. self.emitAll('reconnect_attempt', self.backoff.attempts);
  6028. self.emitAll('reconnecting', self.backoff.attempts);
  6029. // check again for the case socket closed in above events
  6030. if (self.skipReconnect) return;
  6031. self.open(function (err) {
  6032. if (err) {
  6033. debug('reconnect attempt error');
  6034. self.reconnecting = false;
  6035. self.reconnect();
  6036. self.emitAll('reconnect_error', err.data);
  6037. } else {
  6038. debug('reconnect success');
  6039. self.onreconnect();
  6040. }
  6041. });
  6042. }, delay);
  6043. this.subs.push({
  6044. destroy: function () {
  6045. clearTimeout(timer);
  6046. }
  6047. });
  6048. }
  6049. };
  6050. /**
  6051. * Called upon successful reconnect.
  6052. *
  6053. * @api private
  6054. */
  6055. Manager.prototype.onreconnect = function () {
  6056. var attempt = this.backoff.attempts;
  6057. this.reconnecting = false;
  6058. this.backoff.reset();
  6059. this.updateSocketIds();
  6060. this.emitAll('reconnect', attempt);
  6061. };
  6062. /***/ }),
  6063. /* 64 */
  6064. /***/ (function(module, exports, __webpack_require__) {
  6065. /* WEBPACK VAR INJECTION */(function(global) {/**
  6066. * Module dependencies
  6067. */
  6068. var XMLHttpRequest = __webpack_require__(49);
  6069. var XHR = __webpack_require__(116);
  6070. var JSONP = __webpack_require__(130);
  6071. var websocket = __webpack_require__(131);
  6072. /**
  6073. * Export transports.
  6074. */
  6075. exports.polling = polling;
  6076. exports.websocket = websocket;
  6077. /**
  6078. * Polling transport polymorphic constructor.
  6079. * Decides on xhr vs jsonp based on feature detection.
  6080. *
  6081. * @api private
  6082. */
  6083. function polling (opts) {
  6084. var xhr;
  6085. var xd = false;
  6086. var xs = false;
  6087. var jsonp = false !== opts.jsonp;
  6088. if (global.location) {
  6089. var isSSL = 'https:' === location.protocol;
  6090. var port = location.port;
  6091. // some user agents have empty `location.port`
  6092. if (!port) {
  6093. port = isSSL ? 443 : 80;
  6094. }
  6095. xd = opts.hostname !== location.hostname || port !== opts.port;
  6096. xs = opts.secure !== isSSL;
  6097. }
  6098. opts.xdomain = xd;
  6099. opts.xscheme = xs;
  6100. xhr = new XMLHttpRequest(opts);
  6101. if ('open' in xhr && !opts.forceJSONP) {
  6102. return new XHR(opts);
  6103. } else {
  6104. if (!jsonp) throw new Error('JSONP disabled');
  6105. return new JSONP(opts);
  6106. }
  6107. }
  6108. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
  6109. /***/ }),
  6110. /* 65 */
  6111. /***/ (function(module, exports, __webpack_require__) {
  6112. /**
  6113. * Module dependencies.
  6114. */
  6115. var Transport = __webpack_require__(50);
  6116. var parseqs = __webpack_require__(34);
  6117. var parser = __webpack_require__(19);
  6118. var inherit = __webpack_require__(35);
  6119. var yeast = __webpack_require__(67);
  6120. var debug = __webpack_require__(36)('engine.io-client:polling');
  6121. /**
  6122. * Module exports.
  6123. */
  6124. module.exports = Polling;
  6125. /**
  6126. * Is XHR2 supported?
  6127. */
  6128. var hasXHR2 = (function () {
  6129. var XMLHttpRequest = __webpack_require__(49);
  6130. var xhr = new XMLHttpRequest({ xdomain: false });
  6131. return null != xhr.responseType;
  6132. })();
  6133. /**
  6134. * Polling interface.
  6135. *
  6136. * @param {Object} opts
  6137. * @api private
  6138. */
  6139. function Polling (opts) {
  6140. var forceBase64 = (opts && opts.forceBase64);
  6141. if (!hasXHR2 || forceBase64) {
  6142. this.supportsBinary = false;
  6143. }
  6144. Transport.call(this, opts);
  6145. }
  6146. /**
  6147. * Inherits from Transport.
  6148. */
  6149. inherit(Polling, Transport);
  6150. /**
  6151. * Transport name.
  6152. */
  6153. Polling.prototype.name = 'polling';
  6154. /**
  6155. * Opens the socket (triggers polling). We write a PING message to determine
  6156. * when the transport is open.
  6157. *
  6158. * @api private
  6159. */
  6160. Polling.prototype.doOpen = function () {
  6161. this.poll();
  6162. };
  6163. /**
  6164. * Pauses polling.
  6165. *
  6166. * @param {Function} callback upon buffers are flushed and transport is paused
  6167. * @api private
  6168. */
  6169. Polling.prototype.pause = function (onPause) {
  6170. var self = this;
  6171. this.readyState = 'pausing';
  6172. function pause () {
  6173. debug('paused');
  6174. self.readyState = 'paused';
  6175. onPause();
  6176. }
  6177. if (this.polling || !this.writable) {
  6178. var total = 0;
  6179. if (this.polling) {
  6180. debug('we are currently polling - waiting to pause');
  6181. total++;
  6182. this.once('pollComplete', function () {
  6183. debug('pre-pause polling complete');
  6184. --total || pause();
  6185. });
  6186. }
  6187. if (!this.writable) {
  6188. debug('we are currently writing - waiting to pause');
  6189. total++;
  6190. this.once('drain', function () {
  6191. debug('pre-pause writing complete');
  6192. --total || pause();
  6193. });
  6194. }
  6195. } else {
  6196. pause();
  6197. }
  6198. };
  6199. /**
  6200. * Starts polling cycle.
  6201. *
  6202. * @api public
  6203. */
  6204. Polling.prototype.poll = function () {
  6205. debug('polling');
  6206. this.polling = true;
  6207. this.doPoll();
  6208. this.emit('poll');
  6209. };
  6210. /**
  6211. * Overloads onData to detect payloads.
  6212. *
  6213. * @api private
  6214. */
  6215. Polling.prototype.onData = function (data) {
  6216. var self = this;
  6217. debug('polling got data %s', data);
  6218. var callback = function (packet, index, total) {
  6219. // if its the first message we consider the transport open
  6220. if ('opening' === self.readyState) {
  6221. self.onOpen();
  6222. }
  6223. // if its a close packet, we close the ongoing requests
  6224. if ('close' === packet.type) {
  6225. self.onClose();
  6226. return false;
  6227. }
  6228. // otherwise bypass onData and handle the message
  6229. self.onPacket(packet);
  6230. };
  6231. // decode payload
  6232. parser.decodePayload(data, this.socket.binaryType, callback);
  6233. // if an event did not trigger closing
  6234. if ('closed' !== this.readyState) {
  6235. // if we got data we're not polling
  6236. this.polling = false;
  6237. this.emit('pollComplete');
  6238. if ('open' === this.readyState) {
  6239. this.poll();
  6240. } else {
  6241. debug('ignoring poll - transport state "%s"', this.readyState);
  6242. }
  6243. }
  6244. };
  6245. /**
  6246. * For polling, send a close packet.
  6247. *
  6248. * @api private
  6249. */
  6250. Polling.prototype.doClose = function () {
  6251. var self = this;
  6252. function close () {
  6253. debug('writing close packet');
  6254. self.write([{ type: 'close' }]);
  6255. }
  6256. if ('open' === this.readyState) {
  6257. debug('transport open - closing');
  6258. close();
  6259. } else {
  6260. // in case we're trying to close while
  6261. // handshaking is in progress (GH-164)
  6262. debug('transport not open - deferring close');
  6263. this.once('open', close);
  6264. }
  6265. };
  6266. /**
  6267. * Writes a packets payload.
  6268. *
  6269. * @param {Array} data packets
  6270. * @param {Function} drain callback
  6271. * @api private
  6272. */
  6273. Polling.prototype.write = function (packets) {
  6274. var self = this;
  6275. this.writable = false;
  6276. var callbackfn = function () {
  6277. self.writable = true;
  6278. self.emit('drain');
  6279. };
  6280. parser.encodePayload(packets, this.supportsBinary, function (data) {
  6281. self.doWrite(data, callbackfn);
  6282. });
  6283. };
  6284. /**
  6285. * Generates uri for connection.
  6286. *
  6287. * @api private
  6288. */
  6289. Polling.prototype.uri = function () {
  6290. var query = this.query || {};
  6291. var schema = this.secure ? 'https' : 'http';
  6292. var port = '';
  6293. // cache busting is forced
  6294. if (false !== this.timestampRequests) {
  6295. query[this.timestampParam] = yeast();
  6296. }
  6297. if (!this.supportsBinary && !query.sid) {
  6298. query.b64 = 1;
  6299. }
  6300. query = parseqs.encode(query);
  6301. // avoid port if default for schema
  6302. if (this.port && (('https' === schema && Number(this.port) !== 443) ||
  6303. ('http' === schema && Number(this.port) !== 80))) {
  6304. port = ':' + this.port;
  6305. }
  6306. // prepend ? to query
  6307. if (query.length) {
  6308. query = '?' + query;
  6309. }
  6310. var ipv6 = this.hostname.indexOf(':') !== -1;
  6311. return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query;
  6312. };
  6313. /***/ }),
  6314. /* 66 */
  6315. /***/ (function(module, exports, __webpack_require__) {
  6316. /* WEBPACK VAR INJECTION */(function(Buffer) {/* global Blob File */
  6317. /*
  6318. * Module requirements.
  6319. */
  6320. var isArray = __webpack_require__(122);
  6321. var toString = Object.prototype.toString;
  6322. var withNativeBlob = typeof Blob === 'function' ||
  6323. typeof Blob !== 'undefined' && toString.call(Blob) === '[object BlobConstructor]';
  6324. var withNativeFile = typeof File === 'function' ||
  6325. typeof File !== 'undefined' && toString.call(File) === '[object FileConstructor]';
  6326. /**
  6327. * Module exports.
  6328. */
  6329. module.exports = hasBinary;
  6330. /**
  6331. * Checks for binary data.
  6332. *
  6333. * Supports Buffer, ArrayBuffer, Blob and File.
  6334. *
  6335. * @param {Object} anything
  6336. * @api public
  6337. */
  6338. function hasBinary (obj) {
  6339. if (!obj || typeof obj !== 'object') {
  6340. return false;
  6341. }
  6342. if (isArray(obj)) {
  6343. for (var i = 0, l = obj.length; i < l; i++) {
  6344. if (hasBinary(obj[i])) {
  6345. return true;
  6346. }
  6347. }
  6348. return false;
  6349. }
  6350. if ((typeof Buffer === 'function' && Buffer.isBuffer && Buffer.isBuffer(obj)) ||
  6351. (typeof ArrayBuffer === 'function' && obj instanceof ArrayBuffer) ||
  6352. (withNativeBlob && obj instanceof Blob) ||
  6353. (withNativeFile && obj instanceof File)
  6354. ) {
  6355. return true;
  6356. }
  6357. // see: https://github.com/Automattic/has-binary/pull/4
  6358. if (obj.toJSON && typeof obj.toJSON === 'function' && arguments.length === 1) {
  6359. return hasBinary(obj.toJSON(), true);
  6360. }
  6361. for (var key in obj) {
  6362. if (Object.prototype.hasOwnProperty.call(obj, key) && hasBinary(obj[key])) {
  6363. return true;
  6364. }
  6365. }
  6366. return false;
  6367. }
  6368. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(118).Buffer))
  6369. /***/ }),
  6370. /* 67 */
  6371. /***/ (function(module, exports, __webpack_require__) {
  6372. "use strict";
  6373. var alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'.split('')
  6374. , length = 64
  6375. , map = {}
  6376. , seed = 0
  6377. , i = 0
  6378. , prev;
  6379. /**
  6380. * Return a string representing the specified number.
  6381. *
  6382. * @param {Number} num The number to convert.
  6383. * @returns {String} The string representation of the number.
  6384. * @api public
  6385. */
  6386. function encode(num) {
  6387. var encoded = '';
  6388. do {
  6389. encoded = alphabet[num % length] + encoded;
  6390. num = Math.floor(num / length);
  6391. } while (num > 0);
  6392. return encoded;
  6393. }
  6394. /**
  6395. * Return the integer value specified by the given string.
  6396. *
  6397. * @param {String} str The string to convert.
  6398. * @returns {Number} The integer value represented by the string.
  6399. * @api public
  6400. */
  6401. function decode(str) {
  6402. var decoded = 0;
  6403. for (i = 0; i < str.length; i++) {
  6404. decoded = decoded * length + map[str.charAt(i)];
  6405. }
  6406. return decoded;
  6407. }
  6408. /**
  6409. * Yeast: A tiny growing id generator.
  6410. *
  6411. * @returns {String} A unique id.
  6412. * @api public
  6413. */
  6414. function yeast() {
  6415. var now = encode(+new Date());
  6416. if (now !== prev) return seed = 0, prev = now;
  6417. return now +'.'+ encode(seed++);
  6418. }
  6419. //
  6420. // Map each character to its index.
  6421. //
  6422. for (; i < length; i++) map[alphabet[i]] = i;
  6423. //
  6424. // Expose the `yeast`, `encode` and `decode` functions.
  6425. //
  6426. yeast.encode = encode;
  6427. yeast.decode = decode;
  6428. module.exports = yeast;
  6429. /***/ }),
  6430. /* 68 */
  6431. /***/ (function(module, exports) {
  6432. var indexOf = [].indexOf;
  6433. module.exports = function(arr, obj){
  6434. if (indexOf) return arr.indexOf(obj);
  6435. for (var i = 0; i < arr.length; ++i) {
  6436. if (arr[i] === obj) return i;
  6437. }
  6438. return -1;
  6439. };
  6440. /***/ }),
  6441. /* 69 */
  6442. /***/ (function(module, exports, __webpack_require__) {
  6443. /**
  6444. * Module dependencies.
  6445. */
  6446. var parser = __webpack_require__(48);
  6447. var Emitter = __webpack_require__(18);
  6448. var toArray = __webpack_require__(133);
  6449. var on = __webpack_require__(70);
  6450. var bind = __webpack_require__(71);
  6451. var debug = __webpack_require__(32)('socket.io-client:socket');
  6452. var parseqs = __webpack_require__(34);
  6453. var hasBin = __webpack_require__(66);
  6454. /**
  6455. * Module exports.
  6456. */
  6457. module.exports = exports = Socket;
  6458. /**
  6459. * Internal events (blacklisted).
  6460. * These events can't be emitted by the user.
  6461. *
  6462. * @api private
  6463. */
  6464. var events = {
  6465. connect: 1,
  6466. connect_error: 1,
  6467. connect_timeout: 1,
  6468. connecting: 1,
  6469. disconnect: 1,
  6470. error: 1,
  6471. reconnect: 1,
  6472. reconnect_attempt: 1,
  6473. reconnect_failed: 1,
  6474. reconnect_error: 1,
  6475. reconnecting: 1,
  6476. ping: 1,
  6477. pong: 1
  6478. };
  6479. /**
  6480. * Shortcut to `Emitter#emit`.
  6481. */
  6482. var emit = Emitter.prototype.emit;
  6483. /**
  6484. * `Socket` constructor.
  6485. *
  6486. * @api public
  6487. */
  6488. function Socket (io, nsp, opts) {
  6489. this.io = io;
  6490. this.nsp = nsp;
  6491. this.json = this; // compat
  6492. this.ids = 0;
  6493. this.acks = {};
  6494. this.receiveBuffer = [];
  6495. this.sendBuffer = [];
  6496. this.connected = false;
  6497. this.disconnected = true;
  6498. this.flags = {};
  6499. if (opts && opts.query) {
  6500. this.query = opts.query;
  6501. }
  6502. if (this.io.autoConnect) this.open();
  6503. }
  6504. /**
  6505. * Mix in `Emitter`.
  6506. */
  6507. Emitter(Socket.prototype);
  6508. /**
  6509. * Subscribe to open, close and packet events
  6510. *
  6511. * @api private
  6512. */
  6513. Socket.prototype.subEvents = function () {
  6514. if (this.subs) return;
  6515. var io = this.io;
  6516. this.subs = [
  6517. on(io, 'open', bind(this, 'onopen')),
  6518. on(io, 'packet', bind(this, 'onpacket')),
  6519. on(io, 'close', bind(this, 'onclose'))
  6520. ];
  6521. };
  6522. /**
  6523. * "Opens" the socket.
  6524. *
  6525. * @api public
  6526. */
  6527. Socket.prototype.open =
  6528. Socket.prototype.connect = function () {
  6529. if (this.connected) return this;
  6530. this.subEvents();
  6531. this.io.open(); // ensure open
  6532. if ('open' === this.io.readyState) this.onopen();
  6533. this.emit('connecting');
  6534. return this;
  6535. };
  6536. /**
  6537. * Sends a `message` event.
  6538. *
  6539. * @return {Socket} self
  6540. * @api public
  6541. */
  6542. Socket.prototype.send = function () {
  6543. var args = toArray(arguments);
  6544. args.unshift('message');
  6545. this.emit.apply(this, args);
  6546. return this;
  6547. };
  6548. /**
  6549. * Override `emit`.
  6550. * If the event is in `events`, it's emitted normally.
  6551. *
  6552. * @param {String} event name
  6553. * @return {Socket} self
  6554. * @api public
  6555. */
  6556. Socket.prototype.emit = function (ev) {
  6557. if (events.hasOwnProperty(ev)) {
  6558. emit.apply(this, arguments);
  6559. return this;
  6560. }
  6561. var args = toArray(arguments);
  6562. var packet = {
  6563. type: (this.flags.binary !== undefined ? this.flags.binary : hasBin(args)) ? parser.BINARY_EVENT : parser.EVENT,
  6564. data: args
  6565. };
  6566. packet.options = {};
  6567. packet.options.compress = !this.flags || false !== this.flags.compress;
  6568. // event ack callback
  6569. if ('function' === typeof args[args.length - 1]) {
  6570. debug('emitting packet with ack id %d', this.ids);
  6571. this.acks[this.ids] = args.pop();
  6572. packet.id = this.ids++;
  6573. }
  6574. if (this.connected) {
  6575. this.packet(packet);
  6576. } else {
  6577. this.sendBuffer.push(packet);
  6578. }
  6579. this.flags = {};
  6580. return this;
  6581. };
  6582. /**
  6583. * Sends a packet.
  6584. *
  6585. * @param {Object} packet
  6586. * @api private
  6587. */
  6588. Socket.prototype.packet = function (packet) {
  6589. packet.nsp = this.nsp;
  6590. this.io.packet(packet);
  6591. };
  6592. /**
  6593. * Called upon engine `open`.
  6594. *
  6595. * @api private
  6596. */
  6597. Socket.prototype.onopen = function () {
  6598. debug('transport is open - connecting');
  6599. // write connect packet if necessary
  6600. if ('/' !== this.nsp) {
  6601. if (this.query) {
  6602. var query = typeof this.query === 'object' ? parseqs.encode(this.query) : this.query;
  6603. debug('sending connect packet with query %s', query);
  6604. this.packet({type: parser.CONNECT, query: query});
  6605. } else {
  6606. this.packet({type: parser.CONNECT});
  6607. }
  6608. }
  6609. };
  6610. /**
  6611. * Called upon engine `close`.
  6612. *
  6613. * @param {String} reason
  6614. * @api private
  6615. */
  6616. Socket.prototype.onclose = function (reason) {
  6617. debug('close (%s)', reason);
  6618. this.connected = false;
  6619. this.disconnected = true;
  6620. delete this.id;
  6621. this.emit('disconnect', reason);
  6622. };
  6623. /**
  6624. * Called with socket packet.
  6625. *
  6626. * @param {Object} packet
  6627. * @api private
  6628. */
  6629. Socket.prototype.onpacket = function (packet) {
  6630. var sameNamespace = packet.nsp === this.nsp;
  6631. var rootNamespaceError = packet.type === parser.ERROR && packet.nsp === '/';
  6632. if (!sameNamespace && !rootNamespaceError) return;
  6633. switch (packet.type) {
  6634. case parser.CONNECT:
  6635. this.onconnect();
  6636. break;
  6637. case parser.EVENT:
  6638. this.onevent(packet);
  6639. break;
  6640. case parser.BINARY_EVENT:
  6641. this.onevent(packet);
  6642. break;
  6643. case parser.ACK:
  6644. this.onack(packet);
  6645. break;
  6646. case parser.BINARY_ACK:
  6647. this.onack(packet);
  6648. break;
  6649. case parser.DISCONNECT:
  6650. this.ondisconnect();
  6651. break;
  6652. case parser.ERROR:
  6653. this.emit('error', packet.data);
  6654. break;
  6655. }
  6656. };
  6657. /**
  6658. * Called upon a server event.
  6659. *
  6660. * @param {Object} packet
  6661. * @api private
  6662. */
  6663. Socket.prototype.onevent = function (packet) {
  6664. var args = packet.data || [];
  6665. debug('emitting event %j', args);
  6666. if (null != packet.id) {
  6667. debug('attaching ack callback to event');
  6668. args.push(this.ack(packet.id));
  6669. }
  6670. if (this.connected) {
  6671. emit.apply(this, args);
  6672. } else {
  6673. this.receiveBuffer.push(args);
  6674. }
  6675. };
  6676. /**
  6677. * Produces an ack callback to emit with an event.
  6678. *
  6679. * @api private
  6680. */
  6681. Socket.prototype.ack = function (id) {
  6682. var self = this;
  6683. var sent = false;
  6684. return function () {
  6685. // prevent double callbacks
  6686. if (sent) return;
  6687. sent = true;
  6688. var args = toArray(arguments);
  6689. debug('sending ack %j', args);
  6690. self.packet({
  6691. type: hasBin(args) ? parser.BINARY_ACK : parser.ACK,
  6692. id: id,
  6693. data: args
  6694. });
  6695. };
  6696. };
  6697. /**
  6698. * Called upon a server acknowlegement.
  6699. *
  6700. * @param {Object} packet
  6701. * @api private
  6702. */
  6703. Socket.prototype.onack = function (packet) {
  6704. var ack = this.acks[packet.id];
  6705. if ('function' === typeof ack) {
  6706. debug('calling ack %s with %j', packet.id, packet.data);
  6707. ack.apply(this, packet.data);
  6708. delete this.acks[packet.id];
  6709. } else {
  6710. debug('bad ack %s', packet.id);
  6711. }
  6712. };
  6713. /**
  6714. * Called upon server connect.
  6715. *
  6716. * @api private
  6717. */
  6718. Socket.prototype.onconnect = function () {
  6719. this.connected = true;
  6720. this.disconnected = false;
  6721. this.emit('connect');
  6722. this.emitBuffered();
  6723. };
  6724. /**
  6725. * Emit buffered events (received and emitted).
  6726. *
  6727. * @api private
  6728. */
  6729. Socket.prototype.emitBuffered = function () {
  6730. var i;
  6731. for (i = 0; i < this.receiveBuffer.length; i++) {
  6732. emit.apply(this, this.receiveBuffer[i]);
  6733. }
  6734. this.receiveBuffer = [];
  6735. for (i = 0; i < this.sendBuffer.length; i++) {
  6736. this.packet(this.sendBuffer[i]);
  6737. }
  6738. this.sendBuffer = [];
  6739. };
  6740. /**
  6741. * Called upon server disconnect.
  6742. *
  6743. * @api private
  6744. */
  6745. Socket.prototype.ondisconnect = function () {
  6746. debug('server disconnect (%s)', this.nsp);
  6747. this.destroy();
  6748. this.onclose('io server disconnect');
  6749. };
  6750. /**
  6751. * Called upon forced client/server side disconnections,
  6752. * this method ensures the manager stops tracking us and
  6753. * that reconnections don't get triggered for this.
  6754. *
  6755. * @api private.
  6756. */
  6757. Socket.prototype.destroy = function () {
  6758. if (this.subs) {
  6759. // clean subscriptions to avoid reconnections
  6760. for (var i = 0; i < this.subs.length; i++) {
  6761. this.subs[i].destroy();
  6762. }
  6763. this.subs = null;
  6764. }
  6765. this.io.destroy(this);
  6766. };
  6767. /**
  6768. * Disconnects the socket manually.
  6769. *
  6770. * @return {Socket} self
  6771. * @api public
  6772. */
  6773. Socket.prototype.close =
  6774. Socket.prototype.disconnect = function () {
  6775. if (this.connected) {
  6776. debug('performing disconnect (%s)', this.nsp);
  6777. this.packet({ type: parser.DISCONNECT });
  6778. }
  6779. // remove socket from pool
  6780. this.destroy();
  6781. if (this.connected) {
  6782. // fire events
  6783. this.onclose('io client disconnect');
  6784. }
  6785. return this;
  6786. };
  6787. /**
  6788. * Sets the compress flag.
  6789. *
  6790. * @param {Boolean} if `true`, compresses the sending data
  6791. * @return {Socket} self
  6792. * @api public
  6793. */
  6794. Socket.prototype.compress = function (compress) {
  6795. this.flags.compress = compress;
  6796. return this;
  6797. };
  6798. /**
  6799. * Sets the binary flag
  6800. *
  6801. * @param {Boolean} whether the emitted data contains binary
  6802. * @return {Socket} self
  6803. * @api public
  6804. */
  6805. Socket.prototype.binary = function (binary) {
  6806. this.flags.binary = binary;
  6807. return this;
  6808. };
  6809. /***/ }),
  6810. /* 70 */
  6811. /***/ (function(module, exports) {
  6812. /**
  6813. * Module exports.
  6814. */
  6815. module.exports = on;
  6816. /**
  6817. * Helper for subscriptions.
  6818. *
  6819. * @param {Object|EventEmitter} obj with `Emitter` mixin or `EventEmitter`
  6820. * @param {String} event name
  6821. * @param {Function} callback
  6822. * @api public
  6823. */
  6824. function on (obj, ev, fn) {
  6825. obj.on(ev, fn);
  6826. return {
  6827. destroy: function () {
  6828. obj.removeListener(ev, fn);
  6829. }
  6830. };
  6831. }
  6832. /***/ }),
  6833. /* 71 */
  6834. /***/ (function(module, exports) {
  6835. /**
  6836. * Slice reference.
  6837. */
  6838. var slice = [].slice;
  6839. /**
  6840. * Bind `obj` to `fn`.
  6841. *
  6842. * @param {Object} obj
  6843. * @param {Function|String} fn or string
  6844. * @return {Function}
  6845. * @api public
  6846. */
  6847. module.exports = function(obj, fn){
  6848. if ('string' == typeof fn) fn = obj[fn];
  6849. if ('function' != typeof fn) throw new Error('bind() requires a function');
  6850. var args = slice.call(arguments, 2);
  6851. return function(){
  6852. return fn.apply(obj, args.concat(slice.call(arguments)));
  6853. }
  6854. };
  6855. /***/ }),
  6856. /* 72 */
  6857. /***/ (function(module, exports, __webpack_require__) {
  6858. "use strict";
  6859. var __extends = (this && this.__extends) || function (d, b) {
  6860. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  6861. function __() { this.constructor = d; }
  6862. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6863. };
  6864. /**
  6865. * An error thrown when an action is invalid because the object has been
  6866. * unsubscribed.
  6867. *
  6868. * @see {@link Subject}
  6869. * @see {@link BehaviorSubject}
  6870. *
  6871. * @class ObjectUnsubscribedError
  6872. */
  6873. var ObjectUnsubscribedError = (function (_super) {
  6874. __extends(ObjectUnsubscribedError, _super);
  6875. function ObjectUnsubscribedError() {
  6876. var err = _super.call(this, 'object unsubscribed');
  6877. this.name = err.name = 'ObjectUnsubscribedError';
  6878. this.stack = err.stack;
  6879. this.message = err.message;
  6880. }
  6881. return ObjectUnsubscribedError;
  6882. }(Error));
  6883. exports.ObjectUnsubscribedError = ObjectUnsubscribedError;
  6884. //# sourceMappingURL=ObjectUnsubscribedError.js.map
  6885. /***/ }),
  6886. /* 73 */
  6887. /***/ (function(module, exports, __webpack_require__) {
  6888. "use strict";
  6889. var multicast_1 = __webpack_require__(136);
  6890. var refCount_1 = __webpack_require__(74);
  6891. var Subject_1 = __webpack_require__(37);
  6892. function shareSubjectFactory() {
  6893. return new Subject_1.Subject();
  6894. }
  6895. /**
  6896. * Returns a new Observable that multicasts (shares) the original Observable. As long as there is at least one
  6897. * Subscriber this Observable will be subscribed and emitting data. When all subscribers have unsubscribed it will
  6898. * unsubscribe from the source Observable. Because the Observable is multicasting it makes the stream `hot`.
  6899. * This is an alias for .multicast(() => new Subject()).refCount().
  6900. *
  6901. * <img src="./img/share.png" width="100%">
  6902. *
  6903. * @return {Observable<T>} An Observable that upon connection causes the source Observable to emit items to its Observers.
  6904. * @method share
  6905. * @owner Observable
  6906. */
  6907. function share() {
  6908. return function (source) { return refCount_1.refCount()(multicast_1.multicast(shareSubjectFactory)(source)); };
  6909. }
  6910. exports.share = share;
  6911. ;
  6912. //# sourceMappingURL=share.js.map
  6913. /***/ }),
  6914. /* 74 */
  6915. /***/ (function(module, exports, __webpack_require__) {
  6916. "use strict";
  6917. var __extends = (this && this.__extends) || function (d, b) {
  6918. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  6919. function __() { this.constructor = d; }
  6920. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6921. };
  6922. var Subscriber_1 = __webpack_require__(4);
  6923. function refCount() {
  6924. return function refCountOperatorFunction(source) {
  6925. return source.lift(new RefCountOperator(source));
  6926. };
  6927. }
  6928. exports.refCount = refCount;
  6929. var RefCountOperator = (function () {
  6930. function RefCountOperator(connectable) {
  6931. this.connectable = connectable;
  6932. }
  6933. RefCountOperator.prototype.call = function (subscriber, source) {
  6934. var connectable = this.connectable;
  6935. connectable._refCount++;
  6936. var refCounter = new RefCountSubscriber(subscriber, connectable);
  6937. var subscription = source.subscribe(refCounter);
  6938. if (!refCounter.closed) {
  6939. refCounter.connection = connectable.connect();
  6940. }
  6941. return subscription;
  6942. };
  6943. return RefCountOperator;
  6944. }());
  6945. var RefCountSubscriber = (function (_super) {
  6946. __extends(RefCountSubscriber, _super);
  6947. function RefCountSubscriber(destination, connectable) {
  6948. _super.call(this, destination);
  6949. this.connectable = connectable;
  6950. }
  6951. /** @deprecated internal use only */ RefCountSubscriber.prototype._unsubscribe = function () {
  6952. var connectable = this.connectable;
  6953. if (!connectable) {
  6954. this.connection = null;
  6955. return;
  6956. }
  6957. this.connectable = null;
  6958. var refCount = connectable._refCount;
  6959. if (refCount <= 0) {
  6960. this.connection = null;
  6961. return;
  6962. }
  6963. connectable._refCount = refCount - 1;
  6964. if (refCount > 1) {
  6965. this.connection = null;
  6966. return;
  6967. }
  6968. ///
  6969. // Compare the local RefCountSubscriber's connection Subscription to the
  6970. // connection Subscription on the shared ConnectableObservable. In cases
  6971. // where the ConnectableObservable source synchronously emits values, and
  6972. // the RefCountSubscriber's downstream Observers synchronously unsubscribe,
  6973. // execution continues to here before the RefCountOperator has a chance to
  6974. // supply the RefCountSubscriber with the shared connection Subscription.
  6975. // For example:
  6976. // ```
  6977. // Observable.range(0, 10)
  6978. // .publish()
  6979. // .refCount()
  6980. // .take(5)
  6981. // .subscribe();
  6982. // ```
  6983. // In order to account for this case, RefCountSubscriber should only dispose
  6984. // the ConnectableObservable's shared connection Subscription if the
  6985. // connection Subscription exists, *and* either:
  6986. // a. RefCountSubscriber doesn't have a reference to the shared connection
  6987. // Subscription yet, or,
  6988. // b. RefCountSubscriber's connection Subscription reference is identical
  6989. // to the shared connection Subscription
  6990. ///
  6991. var connection = this.connection;
  6992. var sharedConnection = connectable._connection;
  6993. this.connection = null;
  6994. if (sharedConnection && (!connection || sharedConnection === connection)) {
  6995. sharedConnection.unsubscribe();
  6996. }
  6997. };
  6998. return RefCountSubscriber;
  6999. }(Subscriber_1.Subscriber));
  7000. //# sourceMappingURL=refCount.js.map
  7001. /***/ }),
  7002. /* 75 */
  7003. /***/ (function(module, exports, __webpack_require__) {
  7004. "use strict";
  7005. Object.defineProperty(exports, "__esModule", { value: true });
  7006. var map_1 = __webpack_require__(2);
  7007. var tap_1 = __webpack_require__(6);
  7008. var dom_effects_1 = __webpack_require__(20);
  7009. var Log = __webpack_require__(15);
  7010. function propSetDomEffect(xs) {
  7011. return xs.pipe(tap_1.tap(function (event) {
  7012. var target = event.target, prop = event.prop, value = event.value;
  7013. target[prop] = value;
  7014. }), map_1.map(function (e) {
  7015. return Log.consoleInfo("[PropSet]", e.target, e.prop + " = " + e.pathname);
  7016. }));
  7017. }
  7018. exports.propSetDomEffect = propSetDomEffect;
  7019. function propSet(incoming) {
  7020. return [dom_effects_1.Events.PropSet, incoming];
  7021. }
  7022. exports.propSet = propSet;
  7023. /***/ }),
  7024. /* 76 */
  7025. /***/ (function(module, exports, __webpack_require__) {
  7026. "use strict";
  7027. var isArray_1 = __webpack_require__(26);
  7028. function isNumeric(val) {
  7029. // parseFloat NaNs numeric-cast false positives (null|true|false|"")
  7030. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  7031. // subtraction forces infinities to NaN
  7032. // adding 1 corrects loss of precision from parseFloat (#15100)
  7033. return !isArray_1.isArray(val) && (val - parseFloat(val) + 1) >= 0;
  7034. }
  7035. exports.isNumeric = isNumeric;
  7036. ;
  7037. //# sourceMappingURL=isNumeric.js.map
  7038. /***/ }),
  7039. /* 77 */
  7040. /***/ (function(module, exports, __webpack_require__) {
  7041. "use strict";
  7042. var AsyncAction_1 = __webpack_require__(78);
  7043. var AsyncScheduler_1 = __webpack_require__(79);
  7044. /**
  7045. *
  7046. * Async Scheduler
  7047. *
  7048. * <span class="informal">Schedule task as if you used setTimeout(task, duration)</span>
  7049. *
  7050. * `async` scheduler schedules tasks asynchronously, by putting them on the JavaScript
  7051. * event loop queue. It is best used to delay tasks in time or to schedule tasks repeating
  7052. * in intervals.
  7053. *
  7054. * If you just want to "defer" task, that is to perform it right after currently
  7055. * executing synchronous code ends (commonly achieved by `setTimeout(deferredTask, 0)`),
  7056. * better choice will be the {@link asap} scheduler.
  7057. *
  7058. * @example <caption>Use async scheduler to delay task</caption>
  7059. * const task = () => console.log('it works!');
  7060. *
  7061. * Rx.Scheduler.async.schedule(task, 2000);
  7062. *
  7063. * // After 2 seconds logs:
  7064. * // "it works!"
  7065. *
  7066. *
  7067. * @example <caption>Use async scheduler to repeat task in intervals</caption>
  7068. * function task(state) {
  7069. * console.log(state);
  7070. * this.schedule(state + 1, 1000); // `this` references currently executing Action,
  7071. * // which we reschedule with new state and delay
  7072. * }
  7073. *
  7074. * Rx.Scheduler.async.schedule(task, 3000, 0);
  7075. *
  7076. * // Logs:
  7077. * // 0 after 3s
  7078. * // 1 after 4s
  7079. * // 2 after 5s
  7080. * // 3 after 6s
  7081. *
  7082. * @static true
  7083. * @name async
  7084. * @owner Scheduler
  7085. */
  7086. exports.async = new AsyncScheduler_1.AsyncScheduler(AsyncAction_1.AsyncAction);
  7087. //# sourceMappingURL=async.js.map
  7088. /***/ }),
  7089. /* 78 */
  7090. /***/ (function(module, exports, __webpack_require__) {
  7091. "use strict";
  7092. var __extends = (this && this.__extends) || function (d, b) {
  7093. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  7094. function __() { this.constructor = d; }
  7095. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  7096. };
  7097. var root_1 = __webpack_require__(8);
  7098. var Action_1 = __webpack_require__(140);
  7099. /**
  7100. * We need this JSDoc comment for affecting ESDoc.
  7101. * @ignore
  7102. * @extends {Ignored}
  7103. */
  7104. var AsyncAction = (function (_super) {
  7105. __extends(AsyncAction, _super);
  7106. function AsyncAction(scheduler, work) {
  7107. _super.call(this, scheduler, work);
  7108. this.scheduler = scheduler;
  7109. this.pending = false;
  7110. this.work = work;
  7111. }
  7112. AsyncAction.prototype.schedule = function (state, delay) {
  7113. if (delay === void 0) { delay = 0; }
  7114. if (this.closed) {
  7115. return this;
  7116. }
  7117. // Always replace the current state with the new state.
  7118. this.state = state;
  7119. // Set the pending flag indicating that this action has been scheduled, or
  7120. // has recursively rescheduled itself.
  7121. this.pending = true;
  7122. var id = this.id;
  7123. var scheduler = this.scheduler;
  7124. //
  7125. // Important implementation note:
  7126. //
  7127. // Actions only execute once by default, unless rescheduled from within the
  7128. // scheduled callback. This allows us to implement single and repeat
  7129. // actions via the same code path, without adding API surface area, as well
  7130. // as mimic traditional recursion but across asynchronous boundaries.
  7131. //
  7132. // However, JS runtimes and timers distinguish between intervals achieved by
  7133. // serial `setTimeout` calls vs. a single `setInterval` call. An interval of
  7134. // serial `setTimeout` calls can be individually delayed, which delays
  7135. // scheduling the next `setTimeout`, and so on. `setInterval` attempts to
  7136. // guarantee the interval callback will be invoked more precisely to the
  7137. // interval period, regardless of load.
  7138. //
  7139. // Therefore, we use `setInterval` to schedule single and repeat actions.
  7140. // If the action reschedules itself with the same delay, the interval is not
  7141. // canceled. If the action doesn't reschedule, or reschedules with a
  7142. // different delay, the interval will be canceled after scheduled callback
  7143. // execution.
  7144. //
  7145. if (id != null) {
  7146. this.id = this.recycleAsyncId(scheduler, id, delay);
  7147. }
  7148. this.delay = delay;
  7149. // If this action has already an async Id, don't request a new one.
  7150. this.id = this.id || this.requestAsyncId(scheduler, this.id, delay);
  7151. return this;
  7152. };
  7153. AsyncAction.prototype.requestAsyncId = function (scheduler, id, delay) {
  7154. if (delay === void 0) { delay = 0; }
  7155. return root_1.root.setInterval(scheduler.flush.bind(scheduler, this), delay);
  7156. };
  7157. AsyncAction.prototype.recycleAsyncId = function (scheduler, id, delay) {
  7158. if (delay === void 0) { delay = 0; }
  7159. // If this action is rescheduled with the same delay time, don't clear the interval id.
  7160. if (delay !== null && this.delay === delay && this.pending === false) {
  7161. return id;
  7162. }
  7163. // Otherwise, if the action's delay time is different from the current delay,
  7164. // or the action has been rescheduled before it's executed, clear the interval id
  7165. return root_1.root.clearInterval(id) && undefined || undefined;
  7166. };
  7167. /**
  7168. * Immediately executes this action and the `work` it contains.
  7169. * @return {any}
  7170. */
  7171. AsyncAction.prototype.execute = function (state, delay) {
  7172. if (this.closed) {
  7173. return new Error('executing a cancelled action');
  7174. }
  7175. this.pending = false;
  7176. var error = this._execute(state, delay);
  7177. if (error) {
  7178. return error;
  7179. }
  7180. else if (this.pending === false && this.id != null) {
  7181. // Dequeue if the action didn't reschedule itself. Don't call
  7182. // unsubscribe(), because the action could reschedule later.
  7183. // For example:
  7184. // ```
  7185. // scheduler.schedule(function doWork(counter) {
  7186. // /* ... I'm a busy worker bee ... */
  7187. // var originalAction = this;
  7188. // /* wait 100ms before rescheduling the action */
  7189. // setTimeout(function () {
  7190. // originalAction.schedule(counter + 1);
  7191. // }, 100);
  7192. // }, 1000);
  7193. // ```
  7194. this.id = this.recycleAsyncId(this.scheduler, this.id, null);
  7195. }
  7196. };
  7197. AsyncAction.prototype._execute = function (state, delay) {
  7198. var errored = false;
  7199. var errorValue = undefined;
  7200. try {
  7201. this.work(state);
  7202. }
  7203. catch (e) {
  7204. errored = true;
  7205. errorValue = !!e && e || new Error(e);
  7206. }
  7207. if (errored) {
  7208. this.unsubscribe();
  7209. return errorValue;
  7210. }
  7211. };
  7212. /** @deprecated internal use only */ AsyncAction.prototype._unsubscribe = function () {
  7213. var id = this.id;
  7214. var scheduler = this.scheduler;
  7215. var actions = scheduler.actions;
  7216. var index = actions.indexOf(this);
  7217. this.work = null;
  7218. this.state = null;
  7219. this.pending = false;
  7220. this.scheduler = null;
  7221. if (index !== -1) {
  7222. actions.splice(index, 1);
  7223. }
  7224. if (id != null) {
  7225. this.id = this.recycleAsyncId(scheduler, id, null);
  7226. }
  7227. this.delay = null;
  7228. };
  7229. return AsyncAction;
  7230. }(Action_1.Action));
  7231. exports.AsyncAction = AsyncAction;
  7232. //# sourceMappingURL=AsyncAction.js.map
  7233. /***/ }),
  7234. /* 79 */
  7235. /***/ (function(module, exports, __webpack_require__) {
  7236. "use strict";
  7237. var __extends = (this && this.__extends) || function (d, b) {
  7238. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  7239. function __() { this.constructor = d; }
  7240. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  7241. };
  7242. var Scheduler_1 = __webpack_require__(141);
  7243. var AsyncScheduler = (function (_super) {
  7244. __extends(AsyncScheduler, _super);
  7245. function AsyncScheduler() {
  7246. _super.apply(this, arguments);
  7247. this.actions = [];
  7248. /**
  7249. * A flag to indicate whether the Scheduler is currently executing a batch of
  7250. * queued actions.
  7251. * @type {boolean}
  7252. */
  7253. this.active = false;
  7254. /**
  7255. * An internal ID used to track the latest asynchronous task such as those
  7256. * coming from `setTimeout`, `setInterval`, `requestAnimationFrame`, and
  7257. * others.
  7258. * @type {any}
  7259. */
  7260. this.scheduled = undefined;
  7261. }
  7262. AsyncScheduler.prototype.flush = function (action) {
  7263. var actions = this.actions;
  7264. if (this.active) {
  7265. actions.push(action);
  7266. return;
  7267. }
  7268. var error;
  7269. this.active = true;
  7270. do {
  7271. if (error = action.execute(action.state, action.delay)) {
  7272. break;
  7273. }
  7274. } while (action = actions.shift()); // exhaust the scheduler queue
  7275. this.active = false;
  7276. if (error) {
  7277. while (action = actions.shift()) {
  7278. action.unsubscribe();
  7279. }
  7280. throw error;
  7281. }
  7282. };
  7283. return AsyncScheduler;
  7284. }(Scheduler_1.Scheduler));
  7285. exports.AsyncScheduler = AsyncScheduler;
  7286. //# sourceMappingURL=AsyncScheduler.js.map
  7287. /***/ }),
  7288. /* 80 */
  7289. /***/ (function(module, exports, __webpack_require__) {
  7290. "use strict";
  7291. Object.defineProperty(exports, "__esModule", { value: true });
  7292. var map_1 = __webpack_require__(2);
  7293. var dom_effects_1 = __webpack_require__(20);
  7294. var tap_1 = __webpack_require__(6);
  7295. var Log = __webpack_require__(15);
  7296. function styleSetDomEffect(xs) {
  7297. return xs.pipe(tap_1.tap(function (event) {
  7298. var style = event.style, styleName = event.styleName, newValue = event.newValue;
  7299. style[styleName] = newValue;
  7300. }), map_1.map(function (e) { return Log.consoleInfo("[StyleSet] " + e.styleName + " = " + e.pathName); }));
  7301. }
  7302. exports.styleSetDomEffect = styleSetDomEffect;
  7303. function styleSet(incoming) {
  7304. return [dom_effects_1.Events.StyleSet, incoming];
  7305. }
  7306. exports.styleSet = styleSet;
  7307. /***/ }),
  7308. /* 81 */
  7309. /***/ (function(module, exports, __webpack_require__) {
  7310. "use strict";
  7311. Object.defineProperty(exports, "__esModule", { value: true });
  7312. var map_1 = __webpack_require__(2);
  7313. var filter_1 = __webpack_require__(5);
  7314. var withLatestFrom_1 = __webpack_require__(0);
  7315. var Log = __webpack_require__(15);
  7316. var pluck_1 = __webpack_require__(7);
  7317. var dom_effects_1 = __webpack_require__(20);
  7318. function linkReplaceDomEffect(xs, inputs) {
  7319. return xs.pipe(withLatestFrom_1.withLatestFrom(inputs.option$.pipe(pluck_1.pluck("injectNotification"))), filter_1.filter(function (_a) {
  7320. var inject = _a[1];
  7321. return inject;
  7322. }), map_1.map(function (_a) {
  7323. var incoming = _a[0], inject = _a[1];
  7324. var message = "[LinkReplace] " + incoming.basename;
  7325. if (inject === "overlay") {
  7326. return Log.overlayInfo(message);
  7327. }
  7328. return Log.consoleInfo(message);
  7329. }));
  7330. }
  7331. exports.linkReplaceDomEffect = linkReplaceDomEffect;
  7332. function linkReplace(incoming) {
  7333. return [dom_effects_1.Events.LinkReplace, incoming];
  7334. }
  7335. exports.linkReplace = linkReplace;
  7336. /***/ }),
  7337. /* 82 */
  7338. /***/ (function(module, exports, __webpack_require__) {
  7339. "use strict";
  7340. Object.defineProperty(exports, "__esModule", { value: true });
  7341. var ignoreElements_1 = __webpack_require__(12);
  7342. var withLatestFrom_1 = __webpack_require__(0);
  7343. var tap_1 = __webpack_require__(6);
  7344. var dom_effects_1 = __webpack_require__(20);
  7345. function setScroll(x, y) {
  7346. return [dom_effects_1.Events.SetScroll, { x: x, y: y }];
  7347. }
  7348. exports.setScroll = setScroll;
  7349. function setScrollDomEffect(xs, inputs) {
  7350. return xs.pipe(withLatestFrom_1.withLatestFrom(inputs.window$), tap_1.tap(function (_a) {
  7351. var event = _a[0], window = _a[1];
  7352. return window.scrollTo(event.x, event.y);
  7353. }), ignoreElements_1.ignoreElements());
  7354. }
  7355. exports.setScrollDomEffect = setScrollDomEffect;
  7356. /***/ }),
  7357. /* 83 */
  7358. /***/ (function(module, exports, __webpack_require__) {
  7359. "use strict";
  7360. Object.defineProperty(exports, "__esModule", { value: true });
  7361. var ignoreElements_1 = __webpack_require__(12);
  7362. var withLatestFrom_1 = __webpack_require__(0);
  7363. var tap_1 = __webpack_require__(6);
  7364. var dom_effects_1 = __webpack_require__(20);
  7365. function setWindowNameDomEffect(xs, inputs) {
  7366. return xs.pipe(withLatestFrom_1.withLatestFrom(inputs.window$), tap_1.tap(function (_a) {
  7367. var value = _a[0], window = _a[1];
  7368. return (window.name = value);
  7369. }), ignoreElements_1.ignoreElements());
  7370. }
  7371. exports.setWindowNameDomEffect = setWindowNameDomEffect;
  7372. function setWindowName(incoming) {
  7373. return [dom_effects_1.Events.SetWindowName, incoming];
  7374. }
  7375. exports.setWindowName = setWindowName;
  7376. /***/ }),
  7377. /* 84 */
  7378. /***/ (function(module, exports, __webpack_require__) {
  7379. "use strict";
  7380. Object.defineProperty(exports, "__esModule", { value: true });
  7381. var socket_messages_1 = __webpack_require__(11);
  7382. var pluck_1 = __webpack_require__(7);
  7383. var filter_1 = __webpack_require__(5);
  7384. var map_1 = __webpack_require__(2);
  7385. var withLatestFrom_1 = __webpack_require__(0);
  7386. var effects_1 = __webpack_require__(9);
  7387. function outgoing(data, tagName, index, mappingIndex) {
  7388. if (mappingIndex === void 0) { mappingIndex = -1; }
  7389. return [
  7390. socket_messages_1.OutgoingSocketEvents.Scroll,
  7391. { position: data, tagName: tagName, index: index, mappingIndex: mappingIndex }
  7392. ];
  7393. }
  7394. exports.outgoing = outgoing;
  7395. function incomingScrollHandler(xs, inputs) {
  7396. return xs.pipe(withLatestFrom_1.withLatestFrom(inputs.option$.pipe(pluck_1.pluck("ghostMode", "scroll")), inputs.window$.pipe(pluck_1.pluck("location", "pathname"))), filter_1.filter(function (_a) {
  7397. var event = _a[0], canScroll = _a[1], pathname = _a[2];
  7398. return canScroll && event.pathname === pathname;
  7399. }), map_1.map(function (_a) {
  7400. var event = _a[0];
  7401. return [effects_1.EffectNames.BrowserSetScroll, event];
  7402. }));
  7403. }
  7404. exports.incomingScrollHandler = incomingScrollHandler;
  7405. /***/ }),
  7406. /* 85 */
  7407. /***/ (function(module, exports, __webpack_require__) {
  7408. "use strict";
  7409. Object.defineProperty(exports, "__esModule", { value: true });
  7410. var effects_1 = __webpack_require__(9);
  7411. var Reloader_1 = __webpack_require__(144);
  7412. var withLatestFrom_1 = __webpack_require__(0);
  7413. var mergeMap_1 = __webpack_require__(16);
  7414. function fileReload(event) {
  7415. return [effects_1.EffectNames.FileReload, event];
  7416. }
  7417. exports.fileReload = fileReload;
  7418. /**
  7419. * Attempt to reload files in place
  7420. * @param xs
  7421. * @param inputs
  7422. */
  7423. function fileReloadEffect(xs, inputs) {
  7424. return xs.pipe(withLatestFrom_1.withLatestFrom(inputs.option$, inputs.document$, inputs.navigator$), mergeMap_1.mergeMap(function (_a) {
  7425. var event = _a[0], options = _a[1], document = _a[2], navigator = _a[3];
  7426. return Reloader_1.reload(document, navigator)(event, {
  7427. tagNames: options.tagNames,
  7428. liveCSS: true,
  7429. liveImg: true
  7430. });
  7431. }));
  7432. }
  7433. exports.fileReloadEffect = fileReloadEffect;
  7434. /***/ }),
  7435. /* 86 */
  7436. /***/ (function(module, exports, __webpack_require__) {
  7437. "use strict";
  7438. var FromObservable_1 = __webpack_require__(145);
  7439. exports.from = FromObservable_1.FromObservable.create;
  7440. //# sourceMappingURL=from.js.map
  7441. /***/ }),
  7442. /* 87 */
  7443. /***/ (function(module, exports, __webpack_require__) {
  7444. "use strict";
  7445. var __extends = (this && this.__extends) || function (d, b) {
  7446. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  7447. function __() { this.constructor = d; }
  7448. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  7449. };
  7450. var Subscriber_1 = __webpack_require__(4);
  7451. /**
  7452. * Emits the given constant value on the output Observable every time the source
  7453. * Observable emits a value.
  7454. *
  7455. * <span class="informal">Like {@link map}, but it maps every source value to
  7456. * the same output value every time.</span>
  7457. *
  7458. * <img src="./img/mapTo.png" width="100%">
  7459. *
  7460. * Takes a constant `value` as argument, and emits that whenever the source
  7461. * Observable emits a value. In other words, ignores the actual source value,
  7462. * and simply uses the emission moment to know when to emit the given `value`.
  7463. *
  7464. * @example <caption>Map every click to the string 'Hi'</caption>
  7465. * var clicks = Rx.Observable.fromEvent(document, 'click');
  7466. * var greetings = clicks.mapTo('Hi');
  7467. * greetings.subscribe(x => console.log(x));
  7468. *
  7469. * @see {@link map}
  7470. *
  7471. * @param {any} value The value to map each source value to.
  7472. * @return {Observable} An Observable that emits the given `value` every time
  7473. * the source Observable emits something.
  7474. * @method mapTo
  7475. * @owner Observable
  7476. */
  7477. function mapTo(value) {
  7478. return function (source) { return source.lift(new MapToOperator(value)); };
  7479. }
  7480. exports.mapTo = mapTo;
  7481. var MapToOperator = (function () {
  7482. function MapToOperator(value) {
  7483. this.value = value;
  7484. }
  7485. MapToOperator.prototype.call = function (subscriber, source) {
  7486. return source.subscribe(new MapToSubscriber(subscriber, this.value));
  7487. };
  7488. return MapToOperator;
  7489. }());
  7490. /**
  7491. * We need this JSDoc comment for affecting ESDoc.
  7492. * @ignore
  7493. * @extends {Ignored}
  7494. */
  7495. var MapToSubscriber = (function (_super) {
  7496. __extends(MapToSubscriber, _super);
  7497. function MapToSubscriber(destination, value) {
  7498. _super.call(this, destination);
  7499. this.value = value;
  7500. }
  7501. MapToSubscriber.prototype._next = function (x) {
  7502. this.destination.next(this.value);
  7503. };
  7504. return MapToSubscriber;
  7505. }(Subscriber_1.Subscriber));
  7506. //# sourceMappingURL=mapTo.js.map
  7507. /***/ }),
  7508. /* 88 */
  7509. /***/ (function(module, exports, __webpack_require__) {
  7510. "use strict";
  7511. Object.defineProperty(exports, "__esModule", { value: true });
  7512. var ignoreElements_1 = __webpack_require__(12);
  7513. var tap_1 = __webpack_require__(6);
  7514. var withLatestFrom_1 = __webpack_require__(0);
  7515. var effects_1 = __webpack_require__(9);
  7516. function browserSetLocationEffect(xs, inputs) {
  7517. return xs.pipe(withLatestFrom_1.withLatestFrom(inputs.window$), tap_1.tap(function (_a) {
  7518. var event = _a[0], window = _a[1];
  7519. if (event.path) {
  7520. return (window.location =
  7521. window.location.protocol +
  7522. "//" +
  7523. window.location.host +
  7524. event.path);
  7525. }
  7526. if (event.url) {
  7527. return (window.location = event.url);
  7528. }
  7529. }), ignoreElements_1.ignoreElements());
  7530. }
  7531. exports.browserSetLocationEffect = browserSetLocationEffect;
  7532. function browserSetLocation(input) {
  7533. return [effects_1.EffectNames.BrowserSetLocation, input];
  7534. }
  7535. exports.browserSetLocation = browserSetLocation;
  7536. /***/ }),
  7537. /* 89 */
  7538. /***/ (function(module, exports, __webpack_require__) {
  7539. "use strict";
  7540. Object.defineProperty(exports, "__esModule", { value: true });
  7541. var ignoreElements_1 = __webpack_require__(12);
  7542. var tap_1 = __webpack_require__(6);
  7543. var withLatestFrom_1 = __webpack_require__(0);
  7544. var effects_1 = __webpack_require__(9);
  7545. function simulateClickEffect(xs, inputs) {
  7546. return xs.pipe(withLatestFrom_1.withLatestFrom(inputs.window$, inputs.document$), tap_1.tap(function (_a) {
  7547. var event = _a[0], window = _a[1], document = _a[2];
  7548. var elems = document.getElementsByTagName(event.tagName);
  7549. var match = elems[event.index];
  7550. if (match) {
  7551. if (document.createEvent) {
  7552. window.setTimeout(function () {
  7553. var evObj = document.createEvent("MouseEvents");
  7554. evObj.initEvent("click", true, true);
  7555. match.dispatchEvent(evObj);
  7556. }, 0);
  7557. }
  7558. else {
  7559. window.setTimeout(function () {
  7560. if (document.createEventObject) {
  7561. var evObj = document.createEventObject();
  7562. evObj.cancelBubble = true;
  7563. match.fireEvent("on" + "click", evObj);
  7564. }
  7565. }, 0);
  7566. }
  7567. }
  7568. }), ignoreElements_1.ignoreElements());
  7569. }
  7570. exports.simulateClickEffect = simulateClickEffect;
  7571. function simulateClick(event) {
  7572. return [effects_1.EffectNames.SimulateClick, event];
  7573. }
  7574. exports.simulateClick = simulateClick;
  7575. /***/ }),
  7576. /* 90 */
  7577. /***/ (function(module, exports, __webpack_require__) {
  7578. "use strict";
  7579. Object.defineProperty(exports, "__esModule", { value: true });
  7580. var tap_1 = __webpack_require__(6);
  7581. var withLatestFrom_1 = __webpack_require__(0);
  7582. var effects_1 = __webpack_require__(9);
  7583. function setElementValueEffect(xs, inputs) {
  7584. return xs.pipe(withLatestFrom_1.withLatestFrom(inputs.document$), tap_1.tap(function (_a) {
  7585. var event = _a[0], document = _a[1];
  7586. var elems = document.getElementsByTagName(event.tagName);
  7587. var match = elems[event.index];
  7588. if (match) {
  7589. match.value = event.value;
  7590. }
  7591. }));
  7592. }
  7593. exports.setElementValueEffect = setElementValueEffect;
  7594. function setElementValue(event) {
  7595. return [effects_1.EffectNames.SetElementValue, event];
  7596. }
  7597. exports.setElementValue = setElementValue;
  7598. /***/ }),
  7599. /* 91 */
  7600. /***/ (function(module, exports, __webpack_require__) {
  7601. "use strict";
  7602. Object.defineProperty(exports, "__esModule", { value: true });
  7603. var tap_1 = __webpack_require__(6);
  7604. var withLatestFrom_1 = __webpack_require__(0);
  7605. var effects_1 = __webpack_require__(9);
  7606. function setElementToggleValueEffect(xs, inputs) {
  7607. return xs.pipe(withLatestFrom_1.withLatestFrom(inputs.document$), tap_1.tap(function (_a) {
  7608. var event = _a[0], document = _a[1];
  7609. var elems = document.getElementsByTagName(event.tagName);
  7610. var match = elems[event.index];
  7611. if (match) {
  7612. if (event.type === "radio") {
  7613. match.checked = true;
  7614. }
  7615. if (event.type === "checkbox") {
  7616. match.checked = event.checked;
  7617. }
  7618. if (event.tagName === "SELECT") {
  7619. match.value = event.value;
  7620. }
  7621. }
  7622. }));
  7623. }
  7624. exports.setElementToggleValueEffect = setElementToggleValueEffect;
  7625. function setElementToggleValue(event) {
  7626. return [effects_1.EffectNames.SetElementToggleValue, event];
  7627. }
  7628. exports.setElementToggleValue = setElementToggleValue;
  7629. /***/ }),
  7630. /* 92 */
  7631. /***/ (function(module, exports, __webpack_require__) {
  7632. "use strict";
  7633. Object.defineProperty(exports, "__esModule", { value: true });
  7634. var effects_1 = __webpack_require__(9);
  7635. var tap_1 = __webpack_require__(6);
  7636. var withLatestFrom_1 = __webpack_require__(0);
  7637. function browserReload() {
  7638. return [effects_1.EffectNames.BrowserReload];
  7639. }
  7640. exports.browserReload = browserReload;
  7641. function preBrowserReload() {
  7642. return [effects_1.EffectNames.PreBrowserReload];
  7643. }
  7644. exports.preBrowserReload = preBrowserReload;
  7645. function browserReloadEffect(xs, inputs) {
  7646. return xs.pipe(withLatestFrom_1.withLatestFrom(inputs.window$), tap_1.tap(function (_a) {
  7647. var window = _a[1];
  7648. return window.location.reload(true);
  7649. }));
  7650. }
  7651. exports.browserReloadEffect = browserReloadEffect;
  7652. /***/ }),
  7653. /* 93 */
  7654. /***/ (function(module, exports, __webpack_require__) {
  7655. "use strict";
  7656. Object.defineProperty(exports, "__esModule", { value: true });
  7657. var socket_messages_1 = __webpack_require__(11);
  7658. var pluck_1 = __webpack_require__(7);
  7659. var filter_1 = __webpack_require__(5);
  7660. var map_1 = __webpack_require__(2);
  7661. var withLatestFrom_1 = __webpack_require__(0);
  7662. var simulate_click_effect_1 = __webpack_require__(89);
  7663. function outgoing(data) {
  7664. return [socket_messages_1.OutgoingSocketEvents.Click, data];
  7665. }
  7666. exports.outgoing = outgoing;
  7667. function incomingHandler$(xs, inputs) {
  7668. return xs.pipe(withLatestFrom_1.withLatestFrom(inputs.option$.pipe(pluck_1.pluck("ghostMode", "clicks")), inputs.window$.pipe(pluck_1.pluck("location", "pathname"))), filter_1.filter(function (_a) {
  7669. var event = _a[0], canClick = _a[1], pathname = _a[2];
  7670. return canClick && event.pathname === pathname;
  7671. }), map_1.map(function (_a) {
  7672. var event = _a[0];
  7673. return simulate_click_effect_1.simulateClick(event);
  7674. }));
  7675. }
  7676. exports.incomingHandler$ = incomingHandler$;
  7677. /***/ }),
  7678. /* 94 */
  7679. /***/ (function(module, exports, __webpack_require__) {
  7680. "use strict";
  7681. var __assign = (this && this.__assign) || function () {
  7682. __assign = Object.assign || function(t) {
  7683. for (var s, i = 1, n = arguments.length; i < n; i++) {
  7684. s = arguments[i];
  7685. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
  7686. t[p] = s[p];
  7687. }
  7688. return t;
  7689. };
  7690. return __assign.apply(this, arguments);
  7691. };
  7692. Object.defineProperty(exports, "__esModule", { value: true });
  7693. var socket_messages_1 = __webpack_require__(11);
  7694. var pluck_1 = __webpack_require__(7);
  7695. var filter_1 = __webpack_require__(5);
  7696. var map_1 = __webpack_require__(2);
  7697. var withLatestFrom_1 = __webpack_require__(0);
  7698. var set_element_value_effect_1 = __webpack_require__(90);
  7699. function outgoing(element, value) {
  7700. return [
  7701. socket_messages_1.OutgoingSocketEvents.Keyup,
  7702. __assign({}, element, { value: value })
  7703. ];
  7704. }
  7705. exports.outgoing = outgoing;
  7706. function incomingKeyupHandler(xs, inputs) {
  7707. return xs.pipe(withLatestFrom_1.withLatestFrom(inputs.option$.pipe(pluck_1.pluck("ghostMode", "forms", "inputs")), inputs.window$.pipe(pluck_1.pluck("location", "pathname"))), filter_1.filter(function (_a) {
  7708. var event = _a[0], canKeyup = _a[1], pathname = _a[2];
  7709. return canKeyup && event.pathname === pathname;
  7710. }), map_1.map(function (_a) {
  7711. var event = _a[0];
  7712. return set_element_value_effect_1.setElementValue(event);
  7713. }));
  7714. }
  7715. exports.incomingKeyupHandler = incomingKeyupHandler;
  7716. /***/ }),
  7717. /* 95 */
  7718. /***/ (function(module, exports, __webpack_require__) {
  7719. "use strict";
  7720. Object.defineProperty(exports, "__esModule", { value: true });
  7721. var filter_1 = __webpack_require__(5);
  7722. var withLatestFrom_1 = __webpack_require__(0);
  7723. var mergeMap_1 = __webpack_require__(16);
  7724. var concat_1 = __webpack_require__(53);
  7725. var of_1 = __webpack_require__(10);
  7726. var browser_reload_effect_1 = __webpack_require__(92);
  7727. var subscribeOn_1 = __webpack_require__(159);
  7728. var async_1 = __webpack_require__(77);
  7729. function incomingBrowserReload(xs, inputs) {
  7730. return xs.pipe(withLatestFrom_1.withLatestFrom(inputs.option$), filter_1.filter(function (_a) {
  7731. var event = _a[0], options = _a[1];
  7732. return options.codeSync;
  7733. }), mergeMap_1.mergeMap(reloadBrowserSafe));
  7734. }
  7735. exports.incomingBrowserReload = incomingBrowserReload;
  7736. function reloadBrowserSafe() {
  7737. return concat_1.concat(
  7738. /**
  7739. * Emit a warning message allowing others to do some work
  7740. */
  7741. of_1.of(browser_reload_effect_1.preBrowserReload()),
  7742. /**
  7743. * On the next tick, perform the reload
  7744. */
  7745. of_1.of(browser_reload_effect_1.browserReload()).pipe(subscribeOn_1.subscribeOn(async_1.async)));
  7746. }
  7747. exports.reloadBrowserSafe = reloadBrowserSafe;
  7748. /***/ }),
  7749. /* 96 */
  7750. /***/ (function(module, exports, __webpack_require__) {
  7751. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  7752. (typeof self !== "undefined" && self) ||
  7753. window;
  7754. var apply = Function.prototype.apply;
  7755. // DOM APIs, for completeness
  7756. exports.setTimeout = function() {
  7757. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  7758. };
  7759. exports.setInterval = function() {
  7760. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  7761. };
  7762. exports.clearTimeout =
  7763. exports.clearInterval = function(timeout) {
  7764. if (timeout) {
  7765. timeout.close();
  7766. }
  7767. };
  7768. function Timeout(id, clearFn) {
  7769. this._id = id;
  7770. this._clearFn = clearFn;
  7771. }
  7772. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  7773. Timeout.prototype.close = function() {
  7774. this._clearFn.call(scope, this._id);
  7775. };
  7776. // Does not start the time, just sets up the members needed.
  7777. exports.enroll = function(item, msecs) {
  7778. clearTimeout(item._idleTimeoutId);
  7779. item._idleTimeout = msecs;
  7780. };
  7781. exports.unenroll = function(item) {
  7782. clearTimeout(item._idleTimeoutId);
  7783. item._idleTimeout = -1;
  7784. };
  7785. exports._unrefActive = exports.active = function(item) {
  7786. clearTimeout(item._idleTimeoutId);
  7787. var msecs = item._idleTimeout;
  7788. if (msecs >= 0) {
  7789. item._idleTimeoutId = setTimeout(function onTimeout() {
  7790. if (item._onTimeout)
  7791. item._onTimeout();
  7792. }, msecs);
  7793. }
  7794. };
  7795. // setimmediate attaches itself to the global object
  7796. __webpack_require__(164);
  7797. // On some exotic environments, it's not clear which object `setimmediate` was
  7798. // able to install onto. Search each possibility in the same order as the
  7799. // `setimmediate` library.
  7800. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  7801. (typeof global !== "undefined" && global.setImmediate) ||
  7802. (this && this.setImmediate);
  7803. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  7804. (typeof global !== "undefined" && global.clearImmediate) ||
  7805. (this && this.clearImmediate);
  7806. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
  7807. /***/ }),
  7808. /* 97 */
  7809. /***/ (function(module, exports, __webpack_require__) {
  7810. "use strict";
  7811. var __assign = (this && this.__assign) || function () {
  7812. __assign = Object.assign || function(t) {
  7813. for (var s, i = 1, n = arguments.length; i < n; i++) {
  7814. s = arguments[i];
  7815. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
  7816. t[p] = s[p];
  7817. }
  7818. return t;
  7819. };
  7820. return __assign.apply(this, arguments);
  7821. };
  7822. Object.defineProperty(exports, "__esModule", { value: true });
  7823. var socket_messages_1 = __webpack_require__(11);
  7824. var pluck_1 = __webpack_require__(7);
  7825. var filter_1 = __webpack_require__(5);
  7826. var map_1 = __webpack_require__(2);
  7827. var withLatestFrom_1 = __webpack_require__(0);
  7828. var set_element_toggle_value_effect_1 = __webpack_require__(91);
  7829. function outgoing(element, props) {
  7830. return [
  7831. socket_messages_1.OutgoingSocketEvents.InputToggle,
  7832. __assign({}, element, props)
  7833. ];
  7834. }
  7835. exports.outgoing = outgoing;
  7836. function incomingInputsToggles(xs, inputs) {
  7837. return xs.pipe(withLatestFrom_1.withLatestFrom(inputs.option$.pipe(pluck_1.pluck("ghostMode", "forms", "toggles")), inputs.window$.pipe(pluck_1.pluck("location", "pathname"))), filter_1.filter(function (_a) {
  7838. var toggles = _a[1];
  7839. return toggles === true;
  7840. }), map_1.map(function (_a) {
  7841. var event = _a[0];
  7842. return set_element_toggle_value_effect_1.setElementToggleValue(event);
  7843. }));
  7844. }
  7845. exports.incomingInputsToggles = incomingInputsToggles;
  7846. /***/ }),
  7847. /* 98 */
  7848. /***/ (function(module, exports, __webpack_require__) {
  7849. module.exports = __webpack_require__(99);
  7850. /***/ }),
  7851. /* 99 */
  7852. /***/ (function(module, exports, __webpack_require__) {
  7853. "use strict";
  7854. var __assign = (this && this.__assign) || function () {
  7855. __assign = Object.assign || function(t) {
  7856. for (var s, i = 1, n = arguments.length; i < n; i++) {
  7857. s = arguments[i];
  7858. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
  7859. t[p] = s[p];
  7860. }
  7861. return t;
  7862. };
  7863. return __assign.apply(this, arguments);
  7864. };
  7865. Object.defineProperty(exports, "__esModule", { value: true });
  7866. var zip_1 = __webpack_require__(100);
  7867. var socket_1 = __webpack_require__(106);
  7868. var notify_1 = __webpack_require__(138);
  7869. var dom_effects_1 = __webpack_require__(20);
  7870. var socket_messages_1 = __webpack_require__(11);
  7871. var merge_1 = __webpack_require__(38);
  7872. var log_1 = __webpack_require__(15);
  7873. var effects_1 = __webpack_require__(9);
  7874. var scroll_restore_1 = __webpack_require__(170);
  7875. var listeners_1 = __webpack_require__(171);
  7876. var groupBy_1 = __webpack_require__(177);
  7877. var withLatestFrom_1 = __webpack_require__(0);
  7878. var mergeMap_1 = __webpack_require__(16);
  7879. var share_1 = __webpack_require__(73);
  7880. var filter_1 = __webpack_require__(5);
  7881. var pluck_1 = __webpack_require__(7);
  7882. var of_1 = __webpack_require__(10);
  7883. var window$ = socket_1.initWindow();
  7884. var document$ = socket_1.initDocument();
  7885. var names$ = scroll_restore_1.initWindowName(window);
  7886. var _a = socket_1.initSocket(), socket$ = _a.socket$, io$ = _a.io$;
  7887. var option$ = socket_1.initOptions();
  7888. var navigator$ = of_1.of(navigator);
  7889. var notifyElement$ = notify_1.initNotify(option$.getValue());
  7890. var logInstance$ = log_1.initLogger(option$.getValue());
  7891. var outgoing$ = listeners_1.initListeners(window, document, socket$, option$);
  7892. var inputs = {
  7893. window$: window$,
  7894. document$: document$,
  7895. socket$: socket$,
  7896. option$: option$,
  7897. navigator$: navigator$,
  7898. notifyElement$: notifyElement$,
  7899. logInstance$: logInstance$,
  7900. io$: io$,
  7901. outgoing$: outgoing$
  7902. };
  7903. function getStream(name, inputs) {
  7904. return function (handlers$, inputStream$) {
  7905. return inputStream$.pipe(groupBy_1.groupBy(function (_a) {
  7906. var keyName = _a[0];
  7907. return keyName;
  7908. }), withLatestFrom_1.withLatestFrom(handlers$), filter_1.filter(function (_a) {
  7909. var x = _a[0], handlers = _a[1];
  7910. return typeof handlers[x.key] === "function";
  7911. }), mergeMap_1.mergeMap(function (_a) {
  7912. var x = _a[0], handlers = _a[1];
  7913. return handlers[x.key](x.pipe(pluck_1.pluck(String(1))), inputs);
  7914. }), share_1.share());
  7915. };
  7916. }
  7917. var combinedEffectHandler$ = zip_1.zip(effects_1.effectOutputHandlers$, scroll_restore_1.scrollRestoreHandlers$, function () {
  7918. var args = [];
  7919. for (var _i = 0; _i < arguments.length; _i++) {
  7920. args[_i] = arguments[_i];
  7921. }
  7922. return args.reduce(function (acc, item) { return (__assign({}, acc, item)); }, {});
  7923. });
  7924. var output$ = getStream("[socket]", inputs)(socket_messages_1.socketHandlers$, merge_1.merge(inputs.socket$, outgoing$));
  7925. var effect$ = getStream("[effect]", inputs)(combinedEffectHandler$, output$);
  7926. var dom$ = getStream("[dom-effect]", inputs)(dom_effects_1.domHandlers$, merge_1.merge(effect$, names$));
  7927. var merged$ = merge_1.merge(output$, effect$, dom$);
  7928. var log$ = getStream("[log]", inputs)(log_1.logHandler$, merged$);
  7929. log$.subscribe();
  7930. // resume$.next(true);
  7931. // var socket = require("./socket");
  7932. // var shims = require("./client-shims");
  7933. // var notify = require("./notify");
  7934. // // var codeSync = require("./code-sync");
  7935. // const { BrowserSync } = require("./browser-sync");
  7936. // var ghostMode = require("./ghostmode");
  7937. // var events = require("./events");
  7938. // var utils = require("./browser.utils");
  7939. //
  7940. // const mitt = require("mitt").default;
  7941. //
  7942. // var shouldReload = false;
  7943. // var initialised = false;
  7944. //
  7945. // /**
  7946. // * @param options
  7947. // */
  7948. // function init(options: bs.InitOptions) {
  7949. // if (shouldReload && options.reloadOnRestart) {
  7950. // utils.reloadBrowser();
  7951. // }
  7952. //
  7953. // var BS = window.___browserSync___ || {};
  7954. // var emitter = mitt();
  7955. //
  7956. // if (!BS.client) {
  7957. // BS.client = true;
  7958. //
  7959. // var browserSync = new BrowserSync({ options, emitter, socket });
  7960. //
  7961. // // codeSync.init(browserSync);
  7962. //
  7963. // // // Always init on page load
  7964. // // ghostMode.init(browserSync);
  7965. // //
  7966. // // notify.init(browserSync);
  7967. // //
  7968. // // if (options.notify) {
  7969. // // notify.flash("Connected to BrowserSync");
  7970. // // }
  7971. // }
  7972. //
  7973. // // if (!initialised) {
  7974. // // socket.on("disconnect", function() {
  7975. // // if (options.notify) {
  7976. // // notify.flash("Disconnected from BrowserSync");
  7977. // // }
  7978. // // shouldReload = true;
  7979. // // });
  7980. // // initialised = true;
  7981. // // }
  7982. // }
  7983. //
  7984. // /**
  7985. // * Handle individual socket connections
  7986. // */
  7987. // socket.on("connection", init);
  7988. /***/ }),
  7989. /* 100 */
  7990. /***/ (function(module, exports, __webpack_require__) {
  7991. "use strict";
  7992. var zip_1 = __webpack_require__(101);
  7993. exports.zip = zip_1.zipStatic;
  7994. //# sourceMappingURL=zip.js.map
  7995. /***/ }),
  7996. /* 101 */
  7997. /***/ (function(module, exports, __webpack_require__) {
  7998. "use strict";
  7999. var __extends = (this && this.__extends) || function (d, b) {
  8000. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  8001. function __() { this.constructor = d; }
  8002. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8003. };
  8004. var ArrayObservable_1 = __webpack_require__(24);
  8005. var isArray_1 = __webpack_require__(26);
  8006. var Subscriber_1 = __webpack_require__(4);
  8007. var OuterSubscriber_1 = __webpack_require__(29);
  8008. var subscribeToResult_1 = __webpack_require__(30);
  8009. var iterator_1 = __webpack_require__(31);
  8010. /* tslint:enable:max-line-length */
  8011. /**
  8012. * @param observables
  8013. * @return {Observable<R>}
  8014. * @method zip
  8015. * @owner Observable
  8016. */
  8017. function zip() {
  8018. var observables = [];
  8019. for (var _i = 0; _i < arguments.length; _i++) {
  8020. observables[_i - 0] = arguments[_i];
  8021. }
  8022. return function zipOperatorFunction(source) {
  8023. return source.lift.call(zipStatic.apply(void 0, [source].concat(observables)));
  8024. };
  8025. }
  8026. exports.zip = zip;
  8027. /* tslint:enable:max-line-length */
  8028. /**
  8029. * Combines multiple Observables to create an Observable whose values are calculated from the values, in order, of each
  8030. * of its input Observables.
  8031. *
  8032. * If the latest parameter is a function, this function is used to compute the created value from the input values.
  8033. * Otherwise, an array of the input values is returned.
  8034. *
  8035. * @example <caption>Combine age and name from different sources</caption>
  8036. *
  8037. * let age$ = Observable.of<number>(27, 25, 29);
  8038. * let name$ = Observable.of<string>('Foo', 'Bar', 'Beer');
  8039. * let isDev$ = Observable.of<boolean>(true, true, false);
  8040. *
  8041. * Observable
  8042. * .zip(age$,
  8043. * name$,
  8044. * isDev$,
  8045. * (age: number, name: string, isDev: boolean) => ({ age, name, isDev }))
  8046. * .subscribe(x => console.log(x));
  8047. *
  8048. * // outputs
  8049. * // { age: 27, name: 'Foo', isDev: true }
  8050. * // { age: 25, name: 'Bar', isDev: true }
  8051. * // { age: 29, name: 'Beer', isDev: false }
  8052. *
  8053. * @param observables
  8054. * @return {Observable<R>}
  8055. * @static true
  8056. * @name zip
  8057. * @owner Observable
  8058. */
  8059. function zipStatic() {
  8060. var observables = [];
  8061. for (var _i = 0; _i < arguments.length; _i++) {
  8062. observables[_i - 0] = arguments[_i];
  8063. }
  8064. var project = observables[observables.length - 1];
  8065. if (typeof project === 'function') {
  8066. observables.pop();
  8067. }
  8068. return new ArrayObservable_1.ArrayObservable(observables).lift(new ZipOperator(project));
  8069. }
  8070. exports.zipStatic = zipStatic;
  8071. var ZipOperator = (function () {
  8072. function ZipOperator(project) {
  8073. this.project = project;
  8074. }
  8075. ZipOperator.prototype.call = function (subscriber, source) {
  8076. return source.subscribe(new ZipSubscriber(subscriber, this.project));
  8077. };
  8078. return ZipOperator;
  8079. }());
  8080. exports.ZipOperator = ZipOperator;
  8081. /**
  8082. * We need this JSDoc comment for affecting ESDoc.
  8083. * @ignore
  8084. * @extends {Ignored}
  8085. */
  8086. var ZipSubscriber = (function (_super) {
  8087. __extends(ZipSubscriber, _super);
  8088. function ZipSubscriber(destination, project, values) {
  8089. if (values === void 0) { values = Object.create(null); }
  8090. _super.call(this, destination);
  8091. this.iterators = [];
  8092. this.active = 0;
  8093. this.project = (typeof project === 'function') ? project : null;
  8094. this.values = values;
  8095. }
  8096. ZipSubscriber.prototype._next = function (value) {
  8097. var iterators = this.iterators;
  8098. if (isArray_1.isArray(value)) {
  8099. iterators.push(new StaticArrayIterator(value));
  8100. }
  8101. else if (typeof value[iterator_1.iterator] === 'function') {
  8102. iterators.push(new StaticIterator(value[iterator_1.iterator]()));
  8103. }
  8104. else {
  8105. iterators.push(new ZipBufferIterator(this.destination, this, value));
  8106. }
  8107. };
  8108. ZipSubscriber.prototype._complete = function () {
  8109. var iterators = this.iterators;
  8110. var len = iterators.length;
  8111. if (len === 0) {
  8112. this.destination.complete();
  8113. return;
  8114. }
  8115. this.active = len;
  8116. for (var i = 0; i < len; i++) {
  8117. var iterator = iterators[i];
  8118. if (iterator.stillUnsubscribed) {
  8119. this.add(iterator.subscribe(iterator, i));
  8120. }
  8121. else {
  8122. this.active--; // not an observable
  8123. }
  8124. }
  8125. };
  8126. ZipSubscriber.prototype.notifyInactive = function () {
  8127. this.active--;
  8128. if (this.active === 0) {
  8129. this.destination.complete();
  8130. }
  8131. };
  8132. ZipSubscriber.prototype.checkIterators = function () {
  8133. var iterators = this.iterators;
  8134. var len = iterators.length;
  8135. var destination = this.destination;
  8136. // abort if not all of them have values
  8137. for (var i = 0; i < len; i++) {
  8138. var iterator = iterators[i];
  8139. if (typeof iterator.hasValue === 'function' && !iterator.hasValue()) {
  8140. return;
  8141. }
  8142. }
  8143. var shouldComplete = false;
  8144. var args = [];
  8145. for (var i = 0; i < len; i++) {
  8146. var iterator = iterators[i];
  8147. var result = iterator.next();
  8148. // check to see if it's completed now that you've gotten
  8149. // the next value.
  8150. if (iterator.hasCompleted()) {
  8151. shouldComplete = true;
  8152. }
  8153. if (result.done) {
  8154. destination.complete();
  8155. return;
  8156. }
  8157. args.push(result.value);
  8158. }
  8159. if (this.project) {
  8160. this._tryProject(args);
  8161. }
  8162. else {
  8163. destination.next(args);
  8164. }
  8165. if (shouldComplete) {
  8166. destination.complete();
  8167. }
  8168. };
  8169. ZipSubscriber.prototype._tryProject = function (args) {
  8170. var result;
  8171. try {
  8172. result = this.project.apply(this, args);
  8173. }
  8174. catch (err) {
  8175. this.destination.error(err);
  8176. return;
  8177. }
  8178. this.destination.next(result);
  8179. };
  8180. return ZipSubscriber;
  8181. }(Subscriber_1.Subscriber));
  8182. exports.ZipSubscriber = ZipSubscriber;
  8183. var StaticIterator = (function () {
  8184. function StaticIterator(iterator) {
  8185. this.iterator = iterator;
  8186. this.nextResult = iterator.next();
  8187. }
  8188. StaticIterator.prototype.hasValue = function () {
  8189. return true;
  8190. };
  8191. StaticIterator.prototype.next = function () {
  8192. var result = this.nextResult;
  8193. this.nextResult = this.iterator.next();
  8194. return result;
  8195. };
  8196. StaticIterator.prototype.hasCompleted = function () {
  8197. var nextResult = this.nextResult;
  8198. return nextResult && nextResult.done;
  8199. };
  8200. return StaticIterator;
  8201. }());
  8202. var StaticArrayIterator = (function () {
  8203. function StaticArrayIterator(array) {
  8204. this.array = array;
  8205. this.index = 0;
  8206. this.length = 0;
  8207. this.length = array.length;
  8208. }
  8209. StaticArrayIterator.prototype[iterator_1.iterator] = function () {
  8210. return this;
  8211. };
  8212. StaticArrayIterator.prototype.next = function (value) {
  8213. var i = this.index++;
  8214. var array = this.array;
  8215. return i < this.length ? { value: array[i], done: false } : { value: null, done: true };
  8216. };
  8217. StaticArrayIterator.prototype.hasValue = function () {
  8218. return this.array.length > this.index;
  8219. };
  8220. StaticArrayIterator.prototype.hasCompleted = function () {
  8221. return this.array.length === this.index;
  8222. };
  8223. return StaticArrayIterator;
  8224. }());
  8225. /**
  8226. * We need this JSDoc comment for affecting ESDoc.
  8227. * @ignore
  8228. * @extends {Ignored}
  8229. */
  8230. var ZipBufferIterator = (function (_super) {
  8231. __extends(ZipBufferIterator, _super);
  8232. function ZipBufferIterator(destination, parent, observable) {
  8233. _super.call(this, destination);
  8234. this.parent = parent;
  8235. this.observable = observable;
  8236. this.stillUnsubscribed = true;
  8237. this.buffer = [];
  8238. this.isComplete = false;
  8239. }
  8240. ZipBufferIterator.prototype[iterator_1.iterator] = function () {
  8241. return this;
  8242. };
  8243. // NOTE: there is actually a name collision here with Subscriber.next and Iterator.next
  8244. // this is legit because `next()` will never be called by a subscription in this case.
  8245. ZipBufferIterator.prototype.next = function () {
  8246. var buffer = this.buffer;
  8247. if (buffer.length === 0 && this.isComplete) {
  8248. return { value: null, done: true };
  8249. }
  8250. else {
  8251. return { value: buffer.shift(), done: false };
  8252. }
  8253. };
  8254. ZipBufferIterator.prototype.hasValue = function () {
  8255. return this.buffer.length > 0;
  8256. };
  8257. ZipBufferIterator.prototype.hasCompleted = function () {
  8258. return this.buffer.length === 0 && this.isComplete;
  8259. };
  8260. ZipBufferIterator.prototype.notifyComplete = function () {
  8261. if (this.buffer.length > 0) {
  8262. this.isComplete = true;
  8263. this.parent.notifyInactive();
  8264. }
  8265. else {
  8266. this.destination.complete();
  8267. }
  8268. };
  8269. ZipBufferIterator.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  8270. this.buffer.push(innerValue);
  8271. this.parent.checkIterators();
  8272. };
  8273. ZipBufferIterator.prototype.subscribe = function (value, index) {
  8274. return subscribeToResult_1.subscribeToResult(this, this.observable, this, index);
  8275. };
  8276. return ZipBufferIterator;
  8277. }(OuterSubscriber_1.OuterSubscriber));
  8278. //# sourceMappingURL=zip.js.map
  8279. /***/ }),
  8280. /* 102 */
  8281. /***/ (function(module, exports, __webpack_require__) {
  8282. "use strict";
  8283. var Subscriber_1 = __webpack_require__(4);
  8284. var rxSubscriber_1 = __webpack_require__(44);
  8285. var Observer_1 = __webpack_require__(56);
  8286. function toSubscriber(nextOrObserver, error, complete) {
  8287. if (nextOrObserver) {
  8288. if (nextOrObserver instanceof Subscriber_1.Subscriber) {
  8289. return nextOrObserver;
  8290. }
  8291. if (nextOrObserver[rxSubscriber_1.rxSubscriber]) {
  8292. return nextOrObserver[rxSubscriber_1.rxSubscriber]();
  8293. }
  8294. }
  8295. if (!nextOrObserver && !error && !complete) {
  8296. return new Subscriber_1.Subscriber(Observer_1.empty);
  8297. }
  8298. return new Subscriber_1.Subscriber(nextOrObserver, error, complete);
  8299. }
  8300. exports.toSubscriber = toSubscriber;
  8301. //# sourceMappingURL=toSubscriber.js.map
  8302. /***/ }),
  8303. /* 103 */
  8304. /***/ (function(module, exports, __webpack_require__) {
  8305. "use strict";
  8306. var __extends = (this && this.__extends) || function (d, b) {
  8307. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  8308. function __() { this.constructor = d; }
  8309. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8310. };
  8311. /**
  8312. * An error thrown when one or more errors have occurred during the
  8313. * `unsubscribe` of a {@link Subscription}.
  8314. */
  8315. var UnsubscriptionError = (function (_super) {
  8316. __extends(UnsubscriptionError, _super);
  8317. function UnsubscriptionError(errors) {
  8318. _super.call(this);
  8319. this.errors = errors;
  8320. var err = Error.call(this, errors ?
  8321. errors.length + " errors occurred during unsubscription:\n " + errors.map(function (err, i) { return ((i + 1) + ") " + err.toString()); }).join('\n ') : '');
  8322. this.name = err.name = 'UnsubscriptionError';
  8323. this.stack = err.stack;
  8324. this.message = err.message;
  8325. }
  8326. return UnsubscriptionError;
  8327. }(Error));
  8328. exports.UnsubscriptionError = UnsubscriptionError;
  8329. //# sourceMappingURL=UnsubscriptionError.js.map
  8330. /***/ }),
  8331. /* 104 */
  8332. /***/ (function(module, exports, __webpack_require__) {
  8333. "use strict";
  8334. var noop_1 = __webpack_require__(57);
  8335. /* tslint:enable:max-line-length */
  8336. function pipe() {
  8337. var fns = [];
  8338. for (var _i = 0; _i < arguments.length; _i++) {
  8339. fns[_i - 0] = arguments[_i];
  8340. }
  8341. return pipeFromArray(fns);
  8342. }
  8343. exports.pipe = pipe;
  8344. /* @internal */
  8345. function pipeFromArray(fns) {
  8346. if (!fns) {
  8347. return noop_1.noop;
  8348. }
  8349. if (fns.length === 1) {
  8350. return fns[0];
  8351. }
  8352. return function piped(input) {
  8353. return fns.reduce(function (prev, fn) { return fn(prev); }, input);
  8354. };
  8355. }
  8356. exports.pipeFromArray = pipeFromArray;
  8357. //# sourceMappingURL=pipe.js.map
  8358. /***/ }),
  8359. /* 105 */
  8360. /***/ (function(module, exports, __webpack_require__) {
  8361. "use strict";
  8362. var __extends = (this && this.__extends) || function (d, b) {
  8363. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  8364. function __() { this.constructor = d; }
  8365. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8366. };
  8367. var Subscriber_1 = __webpack_require__(4);
  8368. /**
  8369. * We need this JSDoc comment for affecting ESDoc.
  8370. * @ignore
  8371. * @extends {Ignored}
  8372. */
  8373. var InnerSubscriber = (function (_super) {
  8374. __extends(InnerSubscriber, _super);
  8375. function InnerSubscriber(parent, outerValue, outerIndex) {
  8376. _super.call(this);
  8377. this.parent = parent;
  8378. this.outerValue = outerValue;
  8379. this.outerIndex = outerIndex;
  8380. this.index = 0;
  8381. }
  8382. InnerSubscriber.prototype._next = function (value) {
  8383. this.parent.notifyNext(this.outerValue, value, this.outerIndex, this.index++, this);
  8384. };
  8385. InnerSubscriber.prototype._error = function (error) {
  8386. this.parent.notifyError(error, this);
  8387. this.unsubscribe();
  8388. };
  8389. InnerSubscriber.prototype._complete = function () {
  8390. this.parent.notifyComplete(this);
  8391. this.unsubscribe();
  8392. };
  8393. return InnerSubscriber;
  8394. }(Subscriber_1.Subscriber));
  8395. exports.InnerSubscriber = InnerSubscriber;
  8396. //# sourceMappingURL=InnerSubscriber.js.map
  8397. /***/ }),
  8398. /* 106 */
  8399. /***/ (function(module, exports, __webpack_require__) {
  8400. "use strict";
  8401. Object.defineProperty(exports, "__esModule", { value: true });
  8402. var socket = __webpack_require__(107);
  8403. var Observable_1 = __webpack_require__(1);
  8404. var BehaviorSubject_1 = __webpack_require__(14);
  8405. var of_1 = __webpack_require__(10);
  8406. var share_1 = __webpack_require__(73);
  8407. /**
  8408. * Alias for socket.emit
  8409. * @param name
  8410. * @param data
  8411. */
  8412. // export function emit(name, data) {
  8413. // if (io && io.emit) {
  8414. // // send relative path of where the event is sent
  8415. // data.url = window.location.pathname;
  8416. // io.emit(name, data);
  8417. // }
  8418. // }
  8419. //
  8420. // /**
  8421. // * Alias for socket.on
  8422. // * @param name
  8423. // * @param func
  8424. // */
  8425. // export function on(name, func) {
  8426. // io.on(name, func);
  8427. // }
  8428. function initWindow() {
  8429. return of_1.of(window);
  8430. }
  8431. exports.initWindow = initWindow;
  8432. function initDocument() {
  8433. return of_1.of(document);
  8434. }
  8435. exports.initDocument = initDocument;
  8436. function initNavigator() {
  8437. return of_1.of(navigator);
  8438. }
  8439. exports.initNavigator = initNavigator;
  8440. function initOptions() {
  8441. return new BehaviorSubject_1.BehaviorSubject(window.___browserSync___.options);
  8442. }
  8443. exports.initOptions = initOptions;
  8444. function initSocket() {
  8445. /**
  8446. * @type {{emit: emit, on: on}}
  8447. */
  8448. var socketConfig = window.___browserSync___.socketConfig;
  8449. var socketUrl = window.___browserSync___.socketUrl;
  8450. var io = socket(socketUrl, socketConfig);
  8451. var onevent = io.onevent;
  8452. var socket$ = Observable_1.Observable.create(function (obs) {
  8453. io.onevent = function (packet) {
  8454. onevent.call(this, packet);
  8455. obs.next(packet.data);
  8456. };
  8457. }).pipe(share_1.share());
  8458. var io$ = new BehaviorSubject_1.BehaviorSubject(io);
  8459. /**
  8460. * *****BACK-COMPAT*******
  8461. * Scripts that come after Browsersync may rely on the previous window.___browserSync___.socket
  8462. */
  8463. window.___browserSync___.socket = io;
  8464. return { socket$: socket$, io$: io$ };
  8465. }
  8466. exports.initSocket = initSocket;
  8467. /***/ }),
  8468. /* 107 */
  8469. /***/ (function(module, exports, __webpack_require__) {
  8470. /**
  8471. * Module dependencies.
  8472. */
  8473. var url = __webpack_require__(108);
  8474. var parser = __webpack_require__(48);
  8475. var Manager = __webpack_require__(63);
  8476. var debug = __webpack_require__(32)('socket.io-client');
  8477. /**
  8478. * Module exports.
  8479. */
  8480. module.exports = exports = lookup;
  8481. /**
  8482. * Managers cache.
  8483. */
  8484. var cache = exports.managers = {};
  8485. /**
  8486. * Looks up an existing `Manager` for multiplexing.
  8487. * If the user summons:
  8488. *
  8489. * `io('http://localhost/a');`
  8490. * `io('http://localhost/b');`
  8491. *
  8492. * We reuse the existing instance based on same scheme/port/host,
  8493. * and we initialize sockets for each namespace.
  8494. *
  8495. * @api public
  8496. */
  8497. function lookup (uri, opts) {
  8498. if (typeof uri === 'object') {
  8499. opts = uri;
  8500. uri = undefined;
  8501. }
  8502. opts = opts || {};
  8503. var parsed = url(uri);
  8504. var source = parsed.source;
  8505. var id = parsed.id;
  8506. var path = parsed.path;
  8507. var sameNamespace = cache[id] && path in cache[id].nsps;
  8508. var newConnection = opts.forceNew || opts['force new connection'] ||
  8509. false === opts.multiplex || sameNamespace;
  8510. var io;
  8511. if (newConnection) {
  8512. debug('ignoring socket cache for %s', source);
  8513. io = Manager(source, opts);
  8514. } else {
  8515. if (!cache[id]) {
  8516. debug('new io instance for %s', source);
  8517. cache[id] = Manager(source, opts);
  8518. }
  8519. io = cache[id];
  8520. }
  8521. if (parsed.query && !opts.query) {
  8522. opts.query = parsed.query;
  8523. }
  8524. return io.socket(parsed.path, opts);
  8525. }
  8526. /**
  8527. * Protocol version.
  8528. *
  8529. * @api public
  8530. */
  8531. exports.protocol = parser.protocol;
  8532. /**
  8533. * `connect`.
  8534. *
  8535. * @param {String} uri
  8536. * @api public
  8537. */
  8538. exports.connect = lookup;
  8539. /**
  8540. * Expose constructors for standalone build.
  8541. *
  8542. * @api public
  8543. */
  8544. exports.Manager = __webpack_require__(63);
  8545. exports.Socket = __webpack_require__(69);
  8546. /***/ }),
  8547. /* 108 */
  8548. /***/ (function(module, exports, __webpack_require__) {
  8549. /* WEBPACK VAR INJECTION */(function(global) {
  8550. /**
  8551. * Module dependencies.
  8552. */
  8553. var parseuri = __webpack_require__(60);
  8554. var debug = __webpack_require__(32)('socket.io-client:url');
  8555. /**
  8556. * Module exports.
  8557. */
  8558. module.exports = url;
  8559. /**
  8560. * URL parser.
  8561. *
  8562. * @param {String} url
  8563. * @param {Object} An object meant to mimic window.location.
  8564. * Defaults to window.location.
  8565. * @api public
  8566. */
  8567. function url (uri, loc) {
  8568. var obj = uri;
  8569. // default to window.location
  8570. loc = loc || global.location;
  8571. if (null == uri) uri = loc.protocol + '//' + loc.host;
  8572. // relative path support
  8573. if ('string' === typeof uri) {
  8574. if ('/' === uri.charAt(0)) {
  8575. if ('/' === uri.charAt(1)) {
  8576. uri = loc.protocol + uri;
  8577. } else {
  8578. uri = loc.host + uri;
  8579. }
  8580. }
  8581. if (!/^(https?|wss?):\/\//.test(uri)) {
  8582. debug('protocol-less url %s', uri);
  8583. if ('undefined' !== typeof loc) {
  8584. uri = loc.protocol + '//' + uri;
  8585. } else {
  8586. uri = 'https://' + uri;
  8587. }
  8588. }
  8589. // parse
  8590. debug('parse %s', uri);
  8591. obj = parseuri(uri);
  8592. }
  8593. // make sure we treat `localhost:80` and `localhost` equally
  8594. if (!obj.port) {
  8595. if (/^(http|ws)$/.test(obj.protocol)) {
  8596. obj.port = '80';
  8597. } else if (/^(http|ws)s$/.test(obj.protocol)) {
  8598. obj.port = '443';
  8599. }
  8600. }
  8601. obj.path = obj.path || '/';
  8602. var ipv6 = obj.host.indexOf(':') !== -1;
  8603. var host = ipv6 ? '[' + obj.host + ']' : obj.host;
  8604. // define unique id
  8605. obj.id = obj.protocol + '://' + host + ':' + obj.port;
  8606. // define href
  8607. obj.href = obj.protocol + '://' + host + (loc && loc.port === obj.port ? '' : (':' + obj.port));
  8608. return obj;
  8609. }
  8610. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
  8611. /***/ }),
  8612. /* 109 */
  8613. /***/ (function(module, exports, __webpack_require__) {
  8614. /**
  8615. * This is the common logic for both the Node.js and web browser
  8616. * implementations of `debug()`.
  8617. *
  8618. * Expose `debug()` as the module.
  8619. */
  8620. exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
  8621. exports.coerce = coerce;
  8622. exports.disable = disable;
  8623. exports.enable = enable;
  8624. exports.enabled = enabled;
  8625. exports.humanize = __webpack_require__(47);
  8626. /**
  8627. * Active `debug` instances.
  8628. */
  8629. exports.instances = [];
  8630. /**
  8631. * The currently active debug mode names, and names to skip.
  8632. */
  8633. exports.names = [];
  8634. exports.skips = [];
  8635. /**
  8636. * Map of special "%n" handling functions, for the debug "format" argument.
  8637. *
  8638. * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
  8639. */
  8640. exports.formatters = {};
  8641. /**
  8642. * Select a color.
  8643. * @param {String} namespace
  8644. * @return {Number}
  8645. * @api private
  8646. */
  8647. function selectColor(namespace) {
  8648. var hash = 0, i;
  8649. for (i in namespace) {
  8650. hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
  8651. hash |= 0; // Convert to 32bit integer
  8652. }
  8653. return exports.colors[Math.abs(hash) % exports.colors.length];
  8654. }
  8655. /**
  8656. * Create a debugger with the given `namespace`.
  8657. *
  8658. * @param {String} namespace
  8659. * @return {Function}
  8660. * @api public
  8661. */
  8662. function createDebug(namespace) {
  8663. var prevTime;
  8664. function debug() {
  8665. // disabled?
  8666. if (!debug.enabled) return;
  8667. var self = debug;
  8668. // set `diff` timestamp
  8669. var curr = +new Date();
  8670. var ms = curr - (prevTime || curr);
  8671. self.diff = ms;
  8672. self.prev = prevTime;
  8673. self.curr = curr;
  8674. prevTime = curr;
  8675. // turn the `arguments` into a proper Array
  8676. var args = new Array(arguments.length);
  8677. for (var i = 0; i < args.length; i++) {
  8678. args[i] = arguments[i];
  8679. }
  8680. args[0] = exports.coerce(args[0]);
  8681. if ('string' !== typeof args[0]) {
  8682. // anything else let's inspect with %O
  8683. args.unshift('%O');
  8684. }
  8685. // apply any `formatters` transformations
  8686. var index = 0;
  8687. args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
  8688. // if we encounter an escaped % then don't increase the array index
  8689. if (match === '%%') return match;
  8690. index++;
  8691. var formatter = exports.formatters[format];
  8692. if ('function' === typeof formatter) {
  8693. var val = args[index];
  8694. match = formatter.call(self, val);
  8695. // now we need to remove `args[index]` since it's inlined in the `format`
  8696. args.splice(index, 1);
  8697. index--;
  8698. }
  8699. return match;
  8700. });
  8701. // apply env-specific formatting (colors, etc.)
  8702. exports.formatArgs.call(self, args);
  8703. var logFn = debug.log || exports.log || console.log.bind(console);
  8704. logFn.apply(self, args);
  8705. }
  8706. debug.namespace = namespace;
  8707. debug.enabled = exports.enabled(namespace);
  8708. debug.useColors = exports.useColors();
  8709. debug.color = selectColor(namespace);
  8710. debug.destroy = destroy;
  8711. // env-specific initialization logic for debug instances
  8712. if ('function' === typeof exports.init) {
  8713. exports.init(debug);
  8714. }
  8715. exports.instances.push(debug);
  8716. return debug;
  8717. }
  8718. function destroy () {
  8719. var index = exports.instances.indexOf(this);
  8720. if (index !== -1) {
  8721. exports.instances.splice(index, 1);
  8722. return true;
  8723. } else {
  8724. return false;
  8725. }
  8726. }
  8727. /**
  8728. * Enables a debug mode by namespaces. This can include modes
  8729. * separated by a colon and wildcards.
  8730. *
  8731. * @param {String} namespaces
  8732. * @api public
  8733. */
  8734. function enable(namespaces) {
  8735. exports.save(namespaces);
  8736. exports.names = [];
  8737. exports.skips = [];
  8738. var i;
  8739. var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
  8740. var len = split.length;
  8741. for (i = 0; i < len; i++) {
  8742. if (!split[i]) continue; // ignore empty strings
  8743. namespaces = split[i].replace(/\*/g, '.*?');
  8744. if (namespaces[0] === '-') {
  8745. exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
  8746. } else {
  8747. exports.names.push(new RegExp('^' + namespaces + '$'));
  8748. }
  8749. }
  8750. for (i = 0; i < exports.instances.length; i++) {
  8751. var instance = exports.instances[i];
  8752. instance.enabled = exports.enabled(instance.namespace);
  8753. }
  8754. }
  8755. /**
  8756. * Disable debug output.
  8757. *
  8758. * @api public
  8759. */
  8760. function disable() {
  8761. exports.enable('');
  8762. }
  8763. /**
  8764. * Returns true if the given mode name is enabled, false otherwise.
  8765. *
  8766. * @param {String} name
  8767. * @return {Boolean}
  8768. * @api public
  8769. */
  8770. function enabled(name) {
  8771. if (name[name.length - 1] === '*') {
  8772. return true;
  8773. }
  8774. var i, len;
  8775. for (i = 0, len = exports.skips.length; i < len; i++) {
  8776. if (exports.skips[i].test(name)) {
  8777. return false;
  8778. }
  8779. }
  8780. for (i = 0, len = exports.names.length; i < len; i++) {
  8781. if (exports.names[i].test(name)) {
  8782. return true;
  8783. }
  8784. }
  8785. return false;
  8786. }
  8787. /**
  8788. * Coerce `val`.
  8789. *
  8790. * @param {Mixed} val
  8791. * @return {Mixed}
  8792. * @api private
  8793. */
  8794. function coerce(val) {
  8795. if (val instanceof Error) return val.stack || val.message;
  8796. return val;
  8797. }
  8798. /***/ }),
  8799. /* 110 */
  8800. /***/ (function(module, exports, __webpack_require__) {
  8801. /* WEBPACK VAR INJECTION */(function(process) {/**
  8802. * This is the web browser implementation of `debug()`.
  8803. *
  8804. * Expose `debug()` as the module.
  8805. */
  8806. exports = module.exports = __webpack_require__(111);
  8807. exports.log = log;
  8808. exports.formatArgs = formatArgs;
  8809. exports.save = save;
  8810. exports.load = load;
  8811. exports.useColors = useColors;
  8812. exports.storage = 'undefined' != typeof chrome
  8813. && 'undefined' != typeof chrome.storage
  8814. ? chrome.storage.local
  8815. : localstorage();
  8816. /**
  8817. * Colors.
  8818. */
  8819. exports.colors = [
  8820. '#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC',
  8821. '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF',
  8822. '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC',
  8823. '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF',
  8824. '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC',
  8825. '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033',
  8826. '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366',
  8827. '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933',
  8828. '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC',
  8829. '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF',
  8830. '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'
  8831. ];
  8832. /**
  8833. * Currently only WebKit-based Web Inspectors, Firefox >= v31,
  8834. * and the Firebug extension (any Firefox version) are known
  8835. * to support "%c" CSS customizations.
  8836. *
  8837. * TODO: add a `localStorage` variable to explicitly enable/disable colors
  8838. */
  8839. function useColors() {
  8840. // NB: In an Electron preload script, document will be defined but not fully
  8841. // initialized. Since we know we're in Chrome, we'll just detect this case
  8842. // explicitly
  8843. if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') {
  8844. return true;
  8845. }
  8846. // Internet Explorer and Edge do not support colors.
  8847. if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
  8848. return false;
  8849. }
  8850. // is webkit? http://stackoverflow.com/a/16459606/376773
  8851. // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
  8852. return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
  8853. // is firebug? http://stackoverflow.com/a/398120/376773
  8854. (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
  8855. // is firefox >= v31?
  8856. // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
  8857. (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) ||
  8858. // double check webkit in userAgent just in case we are in a worker
  8859. (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
  8860. }
  8861. /**
  8862. * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
  8863. */
  8864. exports.formatters.j = function(v) {
  8865. try {
  8866. return JSON.stringify(v);
  8867. } catch (err) {
  8868. return '[UnexpectedJSONParseError]: ' + err.message;
  8869. }
  8870. };
  8871. /**
  8872. * Colorize log arguments if enabled.
  8873. *
  8874. * @api public
  8875. */
  8876. function formatArgs(args) {
  8877. var useColors = this.useColors;
  8878. args[0] = (useColors ? '%c' : '')
  8879. + this.namespace
  8880. + (useColors ? ' %c' : ' ')
  8881. + args[0]
  8882. + (useColors ? '%c ' : ' ')
  8883. + '+' + exports.humanize(this.diff);
  8884. if (!useColors) return;
  8885. var c = 'color: ' + this.color;
  8886. args.splice(1, 0, c, 'color: inherit')
  8887. // the final "%c" is somewhat tricky, because there could be other
  8888. // arguments passed either before or after the %c, so we need to
  8889. // figure out the correct index to insert the CSS into
  8890. var index = 0;
  8891. var lastC = 0;
  8892. args[0].replace(/%[a-zA-Z%]/g, function(match) {
  8893. if ('%%' === match) return;
  8894. index++;
  8895. if ('%c' === match) {
  8896. // we only are interested in the *last* %c
  8897. // (the user may have provided their own)
  8898. lastC = index;
  8899. }
  8900. });
  8901. args.splice(lastC, 0, c);
  8902. }
  8903. /**
  8904. * Invokes `console.log()` when available.
  8905. * No-op when `console.log` is not a "function".
  8906. *
  8907. * @api public
  8908. */
  8909. function log() {
  8910. // this hackery is required for IE8/9, where
  8911. // the `console.log` function doesn't have 'apply'
  8912. return 'object' === typeof console
  8913. && console.log
  8914. && Function.prototype.apply.call(console.log, console, arguments);
  8915. }
  8916. /**
  8917. * Save `namespaces`.
  8918. *
  8919. * @param {String} namespaces
  8920. * @api private
  8921. */
  8922. function save(namespaces) {
  8923. try {
  8924. if (null == namespaces) {
  8925. exports.storage.removeItem('debug');
  8926. } else {
  8927. exports.storage.debug = namespaces;
  8928. }
  8929. } catch(e) {}
  8930. }
  8931. /**
  8932. * Load `namespaces`.
  8933. *
  8934. * @return {String} returns the previously persisted debug modes
  8935. * @api private
  8936. */
  8937. function load() {
  8938. var r;
  8939. try {
  8940. r = exports.storage.debug;
  8941. } catch(e) {}
  8942. // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
  8943. if (!r && typeof process !== 'undefined' && 'env' in process) {
  8944. r = process.env.DEBUG;
  8945. }
  8946. return r;
  8947. }
  8948. /**
  8949. * Enable namespaces listed in `localStorage.debug` initially.
  8950. */
  8951. exports.enable(load());
  8952. /**
  8953. * Localstorage attempts to return the localstorage.
  8954. *
  8955. * This is necessary because safari throws
  8956. * when a user disables cookies/localstorage
  8957. * and you attempt to access it.
  8958. *
  8959. * @return {LocalStorage}
  8960. * @api private
  8961. */
  8962. function localstorage() {
  8963. try {
  8964. return window.localStorage;
  8965. } catch (e) {}
  8966. }
  8967. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(33)))
  8968. /***/ }),
  8969. /* 111 */
  8970. /***/ (function(module, exports, __webpack_require__) {
  8971. /**
  8972. * This is the common logic for both the Node.js and web browser
  8973. * implementations of `debug()`.
  8974. *
  8975. * Expose `debug()` as the module.
  8976. */
  8977. exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
  8978. exports.coerce = coerce;
  8979. exports.disable = disable;
  8980. exports.enable = enable;
  8981. exports.enabled = enabled;
  8982. exports.humanize = __webpack_require__(47);
  8983. /**
  8984. * Active `debug` instances.
  8985. */
  8986. exports.instances = [];
  8987. /**
  8988. * The currently active debug mode names, and names to skip.
  8989. */
  8990. exports.names = [];
  8991. exports.skips = [];
  8992. /**
  8993. * Map of special "%n" handling functions, for the debug "format" argument.
  8994. *
  8995. * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
  8996. */
  8997. exports.formatters = {};
  8998. /**
  8999. * Select a color.
  9000. * @param {String} namespace
  9001. * @return {Number}
  9002. * @api private
  9003. */
  9004. function selectColor(namespace) {
  9005. var hash = 0, i;
  9006. for (i in namespace) {
  9007. hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
  9008. hash |= 0; // Convert to 32bit integer
  9009. }
  9010. return exports.colors[Math.abs(hash) % exports.colors.length];
  9011. }
  9012. /**
  9013. * Create a debugger with the given `namespace`.
  9014. *
  9015. * @param {String} namespace
  9016. * @return {Function}
  9017. * @api public
  9018. */
  9019. function createDebug(namespace) {
  9020. var prevTime;
  9021. function debug() {
  9022. // disabled?
  9023. if (!debug.enabled) return;
  9024. var self = debug;
  9025. // set `diff` timestamp
  9026. var curr = +new Date();
  9027. var ms = curr - (prevTime || curr);
  9028. self.diff = ms;
  9029. self.prev = prevTime;
  9030. self.curr = curr;
  9031. prevTime = curr;
  9032. // turn the `arguments` into a proper Array
  9033. var args = new Array(arguments.length);
  9034. for (var i = 0; i < args.length; i++) {
  9035. args[i] = arguments[i];
  9036. }
  9037. args[0] = exports.coerce(args[0]);
  9038. if ('string' !== typeof args[0]) {
  9039. // anything else let's inspect with %O
  9040. args.unshift('%O');
  9041. }
  9042. // apply any `formatters` transformations
  9043. var index = 0;
  9044. args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
  9045. // if we encounter an escaped % then don't increase the array index
  9046. if (match === '%%') return match;
  9047. index++;
  9048. var formatter = exports.formatters[format];
  9049. if ('function' === typeof formatter) {
  9050. var val = args[index];
  9051. match = formatter.call(self, val);
  9052. // now we need to remove `args[index]` since it's inlined in the `format`
  9053. args.splice(index, 1);
  9054. index--;
  9055. }
  9056. return match;
  9057. });
  9058. // apply env-specific formatting (colors, etc.)
  9059. exports.formatArgs.call(self, args);
  9060. var logFn = debug.log || exports.log || console.log.bind(console);
  9061. logFn.apply(self, args);
  9062. }
  9063. debug.namespace = namespace;
  9064. debug.enabled = exports.enabled(namespace);
  9065. debug.useColors = exports.useColors();
  9066. debug.color = selectColor(namespace);
  9067. debug.destroy = destroy;
  9068. // env-specific initialization logic for debug instances
  9069. if ('function' === typeof exports.init) {
  9070. exports.init(debug);
  9071. }
  9072. exports.instances.push(debug);
  9073. return debug;
  9074. }
  9075. function destroy () {
  9076. var index = exports.instances.indexOf(this);
  9077. if (index !== -1) {
  9078. exports.instances.splice(index, 1);
  9079. return true;
  9080. } else {
  9081. return false;
  9082. }
  9083. }
  9084. /**
  9085. * Enables a debug mode by namespaces. This can include modes
  9086. * separated by a colon and wildcards.
  9087. *
  9088. * @param {String} namespaces
  9089. * @api public
  9090. */
  9091. function enable(namespaces) {
  9092. exports.save(namespaces);
  9093. exports.names = [];
  9094. exports.skips = [];
  9095. var i;
  9096. var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
  9097. var len = split.length;
  9098. for (i = 0; i < len; i++) {
  9099. if (!split[i]) continue; // ignore empty strings
  9100. namespaces = split[i].replace(/\*/g, '.*?');
  9101. if (namespaces[0] === '-') {
  9102. exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
  9103. } else {
  9104. exports.names.push(new RegExp('^' + namespaces + '$'));
  9105. }
  9106. }
  9107. for (i = 0; i < exports.instances.length; i++) {
  9108. var instance = exports.instances[i];
  9109. instance.enabled = exports.enabled(instance.namespace);
  9110. }
  9111. }
  9112. /**
  9113. * Disable debug output.
  9114. *
  9115. * @api public
  9116. */
  9117. function disable() {
  9118. exports.enable('');
  9119. }
  9120. /**
  9121. * Returns true if the given mode name is enabled, false otherwise.
  9122. *
  9123. * @param {String} name
  9124. * @return {Boolean}
  9125. * @api public
  9126. */
  9127. function enabled(name) {
  9128. if (name[name.length - 1] === '*') {
  9129. return true;
  9130. }
  9131. var i, len;
  9132. for (i = 0, len = exports.skips.length; i < len; i++) {
  9133. if (exports.skips[i].test(name)) {
  9134. return false;
  9135. }
  9136. }
  9137. for (i = 0, len = exports.names.length; i < len; i++) {
  9138. if (exports.names[i].test(name)) {
  9139. return true;
  9140. }
  9141. }
  9142. return false;
  9143. }
  9144. /**
  9145. * Coerce `val`.
  9146. *
  9147. * @param {Mixed} val
  9148. * @return {Mixed}
  9149. * @api private
  9150. */
  9151. function coerce(val) {
  9152. if (val instanceof Error) return val.stack || val.message;
  9153. return val;
  9154. }
  9155. /***/ }),
  9156. /* 112 */
  9157. /***/ (function(module, exports, __webpack_require__) {
  9158. /* WEBPACK VAR INJECTION */(function(global) {/*global Blob,File*/
  9159. /**
  9160. * Module requirements
  9161. */
  9162. var isArray = __webpack_require__(61);
  9163. var isBuf = __webpack_require__(62);
  9164. var toString = Object.prototype.toString;
  9165. var withNativeBlob = typeof global.Blob === 'function' || toString.call(global.Blob) === '[object BlobConstructor]';
  9166. var withNativeFile = typeof global.File === 'function' || toString.call(global.File) === '[object FileConstructor]';
  9167. /**
  9168. * Replaces every Buffer | ArrayBuffer in packet with a numbered placeholder.
  9169. * Anything with blobs or files should be fed through removeBlobs before coming
  9170. * here.
  9171. *
  9172. * @param {Object} packet - socket.io event packet
  9173. * @return {Object} with deconstructed packet and list of buffers
  9174. * @api public
  9175. */
  9176. exports.deconstructPacket = function(packet) {
  9177. var buffers = [];
  9178. var packetData = packet.data;
  9179. var pack = packet;
  9180. pack.data = _deconstructPacket(packetData, buffers);
  9181. pack.attachments = buffers.length; // number of binary 'attachments'
  9182. return {packet: pack, buffers: buffers};
  9183. };
  9184. function _deconstructPacket(data, buffers) {
  9185. if (!data) return data;
  9186. if (isBuf(data)) {
  9187. var placeholder = { _placeholder: true, num: buffers.length };
  9188. buffers.push(data);
  9189. return placeholder;
  9190. } else if (isArray(data)) {
  9191. var newData = new Array(data.length);
  9192. for (var i = 0; i < data.length; i++) {
  9193. newData[i] = _deconstructPacket(data[i], buffers);
  9194. }
  9195. return newData;
  9196. } else if (typeof data === 'object' && !(data instanceof Date)) {
  9197. var newData = {};
  9198. for (var key in data) {
  9199. newData[key] = _deconstructPacket(data[key], buffers);
  9200. }
  9201. return newData;
  9202. }
  9203. return data;
  9204. }
  9205. /**
  9206. * Reconstructs a binary packet from its placeholder packet and buffers
  9207. *
  9208. * @param {Object} packet - event packet with placeholders
  9209. * @param {Array} buffers - binary buffers to put in placeholder positions
  9210. * @return {Object} reconstructed packet
  9211. * @api public
  9212. */
  9213. exports.reconstructPacket = function(packet, buffers) {
  9214. packet.data = _reconstructPacket(packet.data, buffers);
  9215. packet.attachments = undefined; // no longer useful
  9216. return packet;
  9217. };
  9218. function _reconstructPacket(data, buffers) {
  9219. if (!data) return data;
  9220. if (data && data._placeholder) {
  9221. return buffers[data.num]; // appropriate buffer (should be natural order anyway)
  9222. } else if (isArray(data)) {
  9223. for (var i = 0; i < data.length; i++) {
  9224. data[i] = _reconstructPacket(data[i], buffers);
  9225. }
  9226. } else if (typeof data === 'object') {
  9227. for (var key in data) {
  9228. data[key] = _reconstructPacket(data[key], buffers);
  9229. }
  9230. }
  9231. return data;
  9232. }
  9233. /**
  9234. * Asynchronously removes Blobs or Files from data via
  9235. * FileReader's readAsArrayBuffer method. Used before encoding
  9236. * data as msgpack. Calls callback with the blobless data.
  9237. *
  9238. * @param {Object} data
  9239. * @param {Function} callback
  9240. * @api private
  9241. */
  9242. exports.removeBlobs = function(data, callback) {
  9243. function _removeBlobs(obj, curKey, containingObject) {
  9244. if (!obj) return obj;
  9245. // convert any blob
  9246. if ((withNativeBlob && obj instanceof Blob) ||
  9247. (withNativeFile && obj instanceof File)) {
  9248. pendingBlobs++;
  9249. // async filereader
  9250. var fileReader = new FileReader();
  9251. fileReader.onload = function() { // this.result == arraybuffer
  9252. if (containingObject) {
  9253. containingObject[curKey] = this.result;
  9254. }
  9255. else {
  9256. bloblessData = this.result;
  9257. }
  9258. // if nothing pending its callback time
  9259. if(! --pendingBlobs) {
  9260. callback(bloblessData);
  9261. }
  9262. };
  9263. fileReader.readAsArrayBuffer(obj); // blob -> arraybuffer
  9264. } else if (isArray(obj)) { // handle array
  9265. for (var i = 0; i < obj.length; i++) {
  9266. _removeBlobs(obj[i], i, obj);
  9267. }
  9268. } else if (typeof obj === 'object' && !isBuf(obj)) { // and object
  9269. for (var key in obj) {
  9270. _removeBlobs(obj[key], key, obj);
  9271. }
  9272. }
  9273. }
  9274. var pendingBlobs = 0;
  9275. var bloblessData = data;
  9276. _removeBlobs(bloblessData);
  9277. if (!pendingBlobs) {
  9278. callback(bloblessData);
  9279. }
  9280. };
  9281. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
  9282. /***/ }),
  9283. /* 113 */
  9284. /***/ (function(module, exports, __webpack_require__) {
  9285. module.exports = __webpack_require__(114);
  9286. /**
  9287. * Exports parser
  9288. *
  9289. * @api public
  9290. *
  9291. */
  9292. module.exports.parser = __webpack_require__(19);
  9293. /***/ }),
  9294. /* 114 */
  9295. /***/ (function(module, exports, __webpack_require__) {
  9296. /* WEBPACK VAR INJECTION */(function(global) {/**
  9297. * Module dependencies.
  9298. */
  9299. var transports = __webpack_require__(64);
  9300. var Emitter = __webpack_require__(18);
  9301. var debug = __webpack_require__(36)('engine.io-client:socket');
  9302. var index = __webpack_require__(68);
  9303. var parser = __webpack_require__(19);
  9304. var parseuri = __webpack_require__(60);
  9305. var parseqs = __webpack_require__(34);
  9306. /**
  9307. * Module exports.
  9308. */
  9309. module.exports = Socket;
  9310. /**
  9311. * Socket constructor.
  9312. *
  9313. * @param {String|Object} uri or options
  9314. * @param {Object} options
  9315. * @api public
  9316. */
  9317. function Socket (uri, opts) {
  9318. if (!(this instanceof Socket)) return new Socket(uri, opts);
  9319. opts = opts || {};
  9320. if (uri && 'object' === typeof uri) {
  9321. opts = uri;
  9322. uri = null;
  9323. }
  9324. if (uri) {
  9325. uri = parseuri(uri);
  9326. opts.hostname = uri.host;
  9327. opts.secure = uri.protocol === 'https' || uri.protocol === 'wss';
  9328. opts.port = uri.port;
  9329. if (uri.query) opts.query = uri.query;
  9330. } else if (opts.host) {
  9331. opts.hostname = parseuri(opts.host).host;
  9332. }
  9333. this.secure = null != opts.secure ? opts.secure
  9334. : (global.location && 'https:' === location.protocol);
  9335. if (opts.hostname && !opts.port) {
  9336. // if no port is specified manually, use the protocol default
  9337. opts.port = this.secure ? '443' : '80';
  9338. }
  9339. this.agent = opts.agent || false;
  9340. this.hostname = opts.hostname ||
  9341. (global.location ? location.hostname : 'localhost');
  9342. this.port = opts.port || (global.location && location.port
  9343. ? location.port
  9344. : (this.secure ? 443 : 80));
  9345. this.query = opts.query || {};
  9346. if ('string' === typeof this.query) this.query = parseqs.decode(this.query);
  9347. this.upgrade = false !== opts.upgrade;
  9348. this.path = (opts.path || '/engine.io').replace(/\/$/, '') + '/';
  9349. this.forceJSONP = !!opts.forceJSONP;
  9350. this.jsonp = false !== opts.jsonp;
  9351. this.forceBase64 = !!opts.forceBase64;
  9352. this.enablesXDR = !!opts.enablesXDR;
  9353. this.timestampParam = opts.timestampParam || 't';
  9354. this.timestampRequests = opts.timestampRequests;
  9355. this.transports = opts.transports || ['polling', 'websocket'];
  9356. this.transportOptions = opts.transportOptions || {};
  9357. this.readyState = '';
  9358. this.writeBuffer = [];
  9359. this.prevBufferLen = 0;
  9360. this.policyPort = opts.policyPort || 843;
  9361. this.rememberUpgrade = opts.rememberUpgrade || false;
  9362. this.binaryType = null;
  9363. this.onlyBinaryUpgrades = opts.onlyBinaryUpgrades;
  9364. this.perMessageDeflate = false !== opts.perMessageDeflate ? (opts.perMessageDeflate || {}) : false;
  9365. if (true === this.perMessageDeflate) this.perMessageDeflate = {};
  9366. if (this.perMessageDeflate && null == this.perMessageDeflate.threshold) {
  9367. this.perMessageDeflate.threshold = 1024;
  9368. }
  9369. // SSL options for Node.js client
  9370. this.pfx = opts.pfx || null;
  9371. this.key = opts.key || null;
  9372. this.passphrase = opts.passphrase || null;
  9373. this.cert = opts.cert || null;
  9374. this.ca = opts.ca || null;
  9375. this.ciphers = opts.ciphers || null;
  9376. this.rejectUnauthorized = opts.rejectUnauthorized === undefined ? true : opts.rejectUnauthorized;
  9377. this.forceNode = !!opts.forceNode;
  9378. // other options for Node.js client
  9379. var freeGlobal = typeof global === 'object' && global;
  9380. if (freeGlobal.global === freeGlobal) {
  9381. if (opts.extraHeaders && Object.keys(opts.extraHeaders).length > 0) {
  9382. this.extraHeaders = opts.extraHeaders;
  9383. }
  9384. if (opts.localAddress) {
  9385. this.localAddress = opts.localAddress;
  9386. }
  9387. }
  9388. // set on handshake
  9389. this.id = null;
  9390. this.upgrades = null;
  9391. this.pingInterval = null;
  9392. this.pingTimeout = null;
  9393. // set on heartbeat
  9394. this.pingIntervalTimer = null;
  9395. this.pingTimeoutTimer = null;
  9396. this.open();
  9397. }
  9398. Socket.priorWebsocketSuccess = false;
  9399. /**
  9400. * Mix in `Emitter`.
  9401. */
  9402. Emitter(Socket.prototype);
  9403. /**
  9404. * Protocol version.
  9405. *
  9406. * @api public
  9407. */
  9408. Socket.protocol = parser.protocol; // this is an int
  9409. /**
  9410. * Expose deps for legacy compatibility
  9411. * and standalone browser access.
  9412. */
  9413. Socket.Socket = Socket;
  9414. Socket.Transport = __webpack_require__(50);
  9415. Socket.transports = __webpack_require__(64);
  9416. Socket.parser = __webpack_require__(19);
  9417. /**
  9418. * Creates transport of the given type.
  9419. *
  9420. * @param {String} transport name
  9421. * @return {Transport}
  9422. * @api private
  9423. */
  9424. Socket.prototype.createTransport = function (name) {
  9425. debug('creating transport "%s"', name);
  9426. var query = clone(this.query);
  9427. // append engine.io protocol identifier
  9428. query.EIO = parser.protocol;
  9429. // transport name
  9430. query.transport = name;
  9431. // per-transport options
  9432. var options = this.transportOptions[name] || {};
  9433. // session id if we already have one
  9434. if (this.id) query.sid = this.id;
  9435. var transport = new transports[name]({
  9436. query: query,
  9437. socket: this,
  9438. agent: options.agent || this.agent,
  9439. hostname: options.hostname || this.hostname,
  9440. port: options.port || this.port,
  9441. secure: options.secure || this.secure,
  9442. path: options.path || this.path,
  9443. forceJSONP: options.forceJSONP || this.forceJSONP,
  9444. jsonp: options.jsonp || this.jsonp,
  9445. forceBase64: options.forceBase64 || this.forceBase64,
  9446. enablesXDR: options.enablesXDR || this.enablesXDR,
  9447. timestampRequests: options.timestampRequests || this.timestampRequests,
  9448. timestampParam: options.timestampParam || this.timestampParam,
  9449. policyPort: options.policyPort || this.policyPort,
  9450. pfx: options.pfx || this.pfx,
  9451. key: options.key || this.key,
  9452. passphrase: options.passphrase || this.passphrase,
  9453. cert: options.cert || this.cert,
  9454. ca: options.ca || this.ca,
  9455. ciphers: options.ciphers || this.ciphers,
  9456. rejectUnauthorized: options.rejectUnauthorized || this.rejectUnauthorized,
  9457. perMessageDeflate: options.perMessageDeflate || this.perMessageDeflate,
  9458. extraHeaders: options.extraHeaders || this.extraHeaders,
  9459. forceNode: options.forceNode || this.forceNode,
  9460. localAddress: options.localAddress || this.localAddress,
  9461. requestTimeout: options.requestTimeout || this.requestTimeout,
  9462. protocols: options.protocols || void (0)
  9463. });
  9464. return transport;
  9465. };
  9466. function clone (obj) {
  9467. var o = {};
  9468. for (var i in obj) {
  9469. if (obj.hasOwnProperty(i)) {
  9470. o[i] = obj[i];
  9471. }
  9472. }
  9473. return o;
  9474. }
  9475. /**
  9476. * Initializes transport to use and starts probe.
  9477. *
  9478. * @api private
  9479. */
  9480. Socket.prototype.open = function () {
  9481. var transport;
  9482. if (this.rememberUpgrade && Socket.priorWebsocketSuccess && this.transports.indexOf('websocket') !== -1) {
  9483. transport = 'websocket';
  9484. } else if (0 === this.transports.length) {
  9485. // Emit error on next tick so it can be listened to
  9486. var self = this;
  9487. setTimeout(function () {
  9488. self.emit('error', 'No transports available');
  9489. }, 0);
  9490. return;
  9491. } else {
  9492. transport = this.transports[0];
  9493. }
  9494. this.readyState = 'opening';
  9495. // Retry with the next transport if the transport is disabled (jsonp: false)
  9496. try {
  9497. transport = this.createTransport(transport);
  9498. } catch (e) {
  9499. this.transports.shift();
  9500. this.open();
  9501. return;
  9502. }
  9503. transport.open();
  9504. this.setTransport(transport);
  9505. };
  9506. /**
  9507. * Sets the current transport. Disables the existing one (if any).
  9508. *
  9509. * @api private
  9510. */
  9511. Socket.prototype.setTransport = function (transport) {
  9512. debug('setting transport %s', transport.name);
  9513. var self = this;
  9514. if (this.transport) {
  9515. debug('clearing existing transport %s', this.transport.name);
  9516. this.transport.removeAllListeners();
  9517. }
  9518. // set up transport
  9519. this.transport = transport;
  9520. // set up transport listeners
  9521. transport
  9522. .on('drain', function () {
  9523. self.onDrain();
  9524. })
  9525. .on('packet', function (packet) {
  9526. self.onPacket(packet);
  9527. })
  9528. .on('error', function (e) {
  9529. self.onError(e);
  9530. })
  9531. .on('close', function () {
  9532. self.onClose('transport close');
  9533. });
  9534. };
  9535. /**
  9536. * Probes a transport.
  9537. *
  9538. * @param {String} transport name
  9539. * @api private
  9540. */
  9541. Socket.prototype.probe = function (name) {
  9542. debug('probing transport "%s"', name);
  9543. var transport = this.createTransport(name, { probe: 1 });
  9544. var failed = false;
  9545. var self = this;
  9546. Socket.priorWebsocketSuccess = false;
  9547. function onTransportOpen () {
  9548. if (self.onlyBinaryUpgrades) {
  9549. var upgradeLosesBinary = !this.supportsBinary && self.transport.supportsBinary;
  9550. failed = failed || upgradeLosesBinary;
  9551. }
  9552. if (failed) return;
  9553. debug('probe transport "%s" opened', name);
  9554. transport.send([{ type: 'ping', data: 'probe' }]);
  9555. transport.once('packet', function (msg) {
  9556. if (failed) return;
  9557. if ('pong' === msg.type && 'probe' === msg.data) {
  9558. debug('probe transport "%s" pong', name);
  9559. self.upgrading = true;
  9560. self.emit('upgrading', transport);
  9561. if (!transport) return;
  9562. Socket.priorWebsocketSuccess = 'websocket' === transport.name;
  9563. debug('pausing current transport "%s"', self.transport.name);
  9564. self.transport.pause(function () {
  9565. if (failed) return;
  9566. if ('closed' === self.readyState) return;
  9567. debug('changing transport and sending upgrade packet');
  9568. cleanup();
  9569. self.setTransport(transport);
  9570. transport.send([{ type: 'upgrade' }]);
  9571. self.emit('upgrade', transport);
  9572. transport = null;
  9573. self.upgrading = false;
  9574. self.flush();
  9575. });
  9576. } else {
  9577. debug('probe transport "%s" failed', name);
  9578. var err = new Error('probe error');
  9579. err.transport = transport.name;
  9580. self.emit('upgradeError', err);
  9581. }
  9582. });
  9583. }
  9584. function freezeTransport () {
  9585. if (failed) return;
  9586. // Any callback called by transport should be ignored since now
  9587. failed = true;
  9588. cleanup();
  9589. transport.close();
  9590. transport = null;
  9591. }
  9592. // Handle any error that happens while probing
  9593. function onerror (err) {
  9594. var error = new Error('probe error: ' + err);
  9595. error.transport = transport.name;
  9596. freezeTransport();
  9597. debug('probe transport "%s" failed because of error: %s', name, err);
  9598. self.emit('upgradeError', error);
  9599. }
  9600. function onTransportClose () {
  9601. onerror('transport closed');
  9602. }
  9603. // When the socket is closed while we're probing
  9604. function onclose () {
  9605. onerror('socket closed');
  9606. }
  9607. // When the socket is upgraded while we're probing
  9608. function onupgrade (to) {
  9609. if (transport && to.name !== transport.name) {
  9610. debug('"%s" works - aborting "%s"', to.name, transport.name);
  9611. freezeTransport();
  9612. }
  9613. }
  9614. // Remove all listeners on the transport and on self
  9615. function cleanup () {
  9616. transport.removeListener('open', onTransportOpen);
  9617. transport.removeListener('error', onerror);
  9618. transport.removeListener('close', onTransportClose);
  9619. self.removeListener('close', onclose);
  9620. self.removeListener('upgrading', onupgrade);
  9621. }
  9622. transport.once('open', onTransportOpen);
  9623. transport.once('error', onerror);
  9624. transport.once('close', onTransportClose);
  9625. this.once('close', onclose);
  9626. this.once('upgrading', onupgrade);
  9627. transport.open();
  9628. };
  9629. /**
  9630. * Called when connection is deemed open.
  9631. *
  9632. * @api public
  9633. */
  9634. Socket.prototype.onOpen = function () {
  9635. debug('socket open');
  9636. this.readyState = 'open';
  9637. Socket.priorWebsocketSuccess = 'websocket' === this.transport.name;
  9638. this.emit('open');
  9639. this.flush();
  9640. // we check for `readyState` in case an `open`
  9641. // listener already closed the socket
  9642. if ('open' === this.readyState && this.upgrade && this.transport.pause) {
  9643. debug('starting upgrade probes');
  9644. for (var i = 0, l = this.upgrades.length; i < l; i++) {
  9645. this.probe(this.upgrades[i]);
  9646. }
  9647. }
  9648. };
  9649. /**
  9650. * Handles a packet.
  9651. *
  9652. * @api private
  9653. */
  9654. Socket.prototype.onPacket = function (packet) {
  9655. if ('opening' === this.readyState || 'open' === this.readyState ||
  9656. 'closing' === this.readyState) {
  9657. debug('socket receive: type "%s", data "%s"', packet.type, packet.data);
  9658. this.emit('packet', packet);
  9659. // Socket is live - any packet counts
  9660. this.emit('heartbeat');
  9661. switch (packet.type) {
  9662. case 'open':
  9663. this.onHandshake(JSON.parse(packet.data));
  9664. break;
  9665. case 'pong':
  9666. this.setPing();
  9667. this.emit('pong');
  9668. break;
  9669. case 'error':
  9670. var err = new Error('server error');
  9671. err.code = packet.data;
  9672. this.onError(err);
  9673. break;
  9674. case 'message':
  9675. this.emit('data', packet.data);
  9676. this.emit('message', packet.data);
  9677. break;
  9678. }
  9679. } else {
  9680. debug('packet received with socket readyState "%s"', this.readyState);
  9681. }
  9682. };
  9683. /**
  9684. * Called upon handshake completion.
  9685. *
  9686. * @param {Object} handshake obj
  9687. * @api private
  9688. */
  9689. Socket.prototype.onHandshake = function (data) {
  9690. this.emit('handshake', data);
  9691. this.id = data.sid;
  9692. this.transport.query.sid = data.sid;
  9693. this.upgrades = this.filterUpgrades(data.upgrades);
  9694. this.pingInterval = data.pingInterval;
  9695. this.pingTimeout = data.pingTimeout;
  9696. this.onOpen();
  9697. // In case open handler closes socket
  9698. if ('closed' === this.readyState) return;
  9699. this.setPing();
  9700. // Prolong liveness of socket on heartbeat
  9701. this.removeListener('heartbeat', this.onHeartbeat);
  9702. this.on('heartbeat', this.onHeartbeat);
  9703. };
  9704. /**
  9705. * Resets ping timeout.
  9706. *
  9707. * @api private
  9708. */
  9709. Socket.prototype.onHeartbeat = function (timeout) {
  9710. clearTimeout(this.pingTimeoutTimer);
  9711. var self = this;
  9712. self.pingTimeoutTimer = setTimeout(function () {
  9713. if ('closed' === self.readyState) return;
  9714. self.onClose('ping timeout');
  9715. }, timeout || (self.pingInterval + self.pingTimeout));
  9716. };
  9717. /**
  9718. * Pings server every `this.pingInterval` and expects response
  9719. * within `this.pingTimeout` or closes connection.
  9720. *
  9721. * @api private
  9722. */
  9723. Socket.prototype.setPing = function () {
  9724. var self = this;
  9725. clearTimeout(self.pingIntervalTimer);
  9726. self.pingIntervalTimer = setTimeout(function () {
  9727. debug('writing ping packet - expecting pong within %sms', self.pingTimeout);
  9728. self.ping();
  9729. self.onHeartbeat(self.pingTimeout);
  9730. }, self.pingInterval);
  9731. };
  9732. /**
  9733. * Sends a ping packet.
  9734. *
  9735. * @api private
  9736. */
  9737. Socket.prototype.ping = function () {
  9738. var self = this;
  9739. this.sendPacket('ping', function () {
  9740. self.emit('ping');
  9741. });
  9742. };
  9743. /**
  9744. * Called on `drain` event
  9745. *
  9746. * @api private
  9747. */
  9748. Socket.prototype.onDrain = function () {
  9749. this.writeBuffer.splice(0, this.prevBufferLen);
  9750. // setting prevBufferLen = 0 is very important
  9751. // for example, when upgrading, upgrade packet is sent over,
  9752. // and a nonzero prevBufferLen could cause problems on `drain`
  9753. this.prevBufferLen = 0;
  9754. if (0 === this.writeBuffer.length) {
  9755. this.emit('drain');
  9756. } else {
  9757. this.flush();
  9758. }
  9759. };
  9760. /**
  9761. * Flush write buffers.
  9762. *
  9763. * @api private
  9764. */
  9765. Socket.prototype.flush = function () {
  9766. if ('closed' !== this.readyState && this.transport.writable &&
  9767. !this.upgrading && this.writeBuffer.length) {
  9768. debug('flushing %d packets in socket', this.writeBuffer.length);
  9769. this.transport.send(this.writeBuffer);
  9770. // keep track of current length of writeBuffer
  9771. // splice writeBuffer and callbackBuffer on `drain`
  9772. this.prevBufferLen = this.writeBuffer.length;
  9773. this.emit('flush');
  9774. }
  9775. };
  9776. /**
  9777. * Sends a message.
  9778. *
  9779. * @param {String} message.
  9780. * @param {Function} callback function.
  9781. * @param {Object} options.
  9782. * @return {Socket} for chaining.
  9783. * @api public
  9784. */
  9785. Socket.prototype.write =
  9786. Socket.prototype.send = function (msg, options, fn) {
  9787. this.sendPacket('message', msg, options, fn);
  9788. return this;
  9789. };
  9790. /**
  9791. * Sends a packet.
  9792. *
  9793. * @param {String} packet type.
  9794. * @param {String} data.
  9795. * @param {Object} options.
  9796. * @param {Function} callback function.
  9797. * @api private
  9798. */
  9799. Socket.prototype.sendPacket = function (type, data, options, fn) {
  9800. if ('function' === typeof data) {
  9801. fn = data;
  9802. data = undefined;
  9803. }
  9804. if ('function' === typeof options) {
  9805. fn = options;
  9806. options = null;
  9807. }
  9808. if ('closing' === this.readyState || 'closed' === this.readyState) {
  9809. return;
  9810. }
  9811. options = options || {};
  9812. options.compress = false !== options.compress;
  9813. var packet = {
  9814. type: type,
  9815. data: data,
  9816. options: options
  9817. };
  9818. this.emit('packetCreate', packet);
  9819. this.writeBuffer.push(packet);
  9820. if (fn) this.once('flush', fn);
  9821. this.flush();
  9822. };
  9823. /**
  9824. * Closes the connection.
  9825. *
  9826. * @api private
  9827. */
  9828. Socket.prototype.close = function () {
  9829. if ('opening' === this.readyState || 'open' === this.readyState) {
  9830. this.readyState = 'closing';
  9831. var self = this;
  9832. if (this.writeBuffer.length) {
  9833. this.once('drain', function () {
  9834. if (this.upgrading) {
  9835. waitForUpgrade();
  9836. } else {
  9837. close();
  9838. }
  9839. });
  9840. } else if (this.upgrading) {
  9841. waitForUpgrade();
  9842. } else {
  9843. close();
  9844. }
  9845. }
  9846. function close () {
  9847. self.onClose('forced close');
  9848. debug('socket closing - telling transport to close');
  9849. self.transport.close();
  9850. }
  9851. function cleanupAndClose () {
  9852. self.removeListener('upgrade', cleanupAndClose);
  9853. self.removeListener('upgradeError', cleanupAndClose);
  9854. close();
  9855. }
  9856. function waitForUpgrade () {
  9857. // wait for upgrade to finish since we can't send packets while pausing a transport
  9858. self.once('upgrade', cleanupAndClose);
  9859. self.once('upgradeError', cleanupAndClose);
  9860. }
  9861. return this;
  9862. };
  9863. /**
  9864. * Called upon transport error
  9865. *
  9866. * @api private
  9867. */
  9868. Socket.prototype.onError = function (err) {
  9869. debug('socket error %j', err);
  9870. Socket.priorWebsocketSuccess = false;
  9871. this.emit('error', err);
  9872. this.onClose('transport error', err);
  9873. };
  9874. /**
  9875. * Called upon transport close.
  9876. *
  9877. * @api private
  9878. */
  9879. Socket.prototype.onClose = function (reason, desc) {
  9880. if ('opening' === this.readyState || 'open' === this.readyState || 'closing' === this.readyState) {
  9881. debug('socket close with reason: "%s"', reason);
  9882. var self = this;
  9883. // clear timers
  9884. clearTimeout(this.pingIntervalTimer);
  9885. clearTimeout(this.pingTimeoutTimer);
  9886. // stop event from firing again for transport
  9887. this.transport.removeAllListeners('close');
  9888. // ensure transport won't stay open
  9889. this.transport.close();
  9890. // ignore further transport communication
  9891. this.transport.removeAllListeners();
  9892. // set ready state
  9893. this.readyState = 'closed';
  9894. // clear session id
  9895. this.id = null;
  9896. // emit close event
  9897. this.emit('close', reason, desc);
  9898. // clean buffers after, so users can still
  9899. // grab the buffers on `close` event
  9900. self.writeBuffer = [];
  9901. self.prevBufferLen = 0;
  9902. }
  9903. };
  9904. /**
  9905. * Filters upgrades, returning only those matching client transports.
  9906. *
  9907. * @param {Array} server upgrades
  9908. * @api private
  9909. *
  9910. */
  9911. Socket.prototype.filterUpgrades = function (upgrades) {
  9912. var filteredUpgrades = [];
  9913. for (var i = 0, j = upgrades.length; i < j; i++) {
  9914. if (~index(this.transports, upgrades[i])) filteredUpgrades.push(upgrades[i]);
  9915. }
  9916. return filteredUpgrades;
  9917. };
  9918. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
  9919. /***/ }),
  9920. /* 115 */
  9921. /***/ (function(module, exports) {
  9922. /**
  9923. * Module exports.
  9924. *
  9925. * Logic borrowed from Modernizr:
  9926. *
  9927. * - https://github.com/Modernizr/Modernizr/blob/master/feature-detects/cors.js
  9928. */
  9929. try {
  9930. module.exports = typeof XMLHttpRequest !== 'undefined' &&
  9931. 'withCredentials' in new XMLHttpRequest();
  9932. } catch (err) {
  9933. // if XMLHttp support is disabled in IE then it will throw
  9934. // when trying to create
  9935. module.exports = false;
  9936. }
  9937. /***/ }),
  9938. /* 116 */
  9939. /***/ (function(module, exports, __webpack_require__) {
  9940. /* WEBPACK VAR INJECTION */(function(global) {/**
  9941. * Module requirements.
  9942. */
  9943. var XMLHttpRequest = __webpack_require__(49);
  9944. var Polling = __webpack_require__(65);
  9945. var Emitter = __webpack_require__(18);
  9946. var inherit = __webpack_require__(35);
  9947. var debug = __webpack_require__(36)('engine.io-client:polling-xhr');
  9948. /**
  9949. * Module exports.
  9950. */
  9951. module.exports = XHR;
  9952. module.exports.Request = Request;
  9953. /**
  9954. * Empty function
  9955. */
  9956. function empty () {}
  9957. /**
  9958. * XHR Polling constructor.
  9959. *
  9960. * @param {Object} opts
  9961. * @api public
  9962. */
  9963. function XHR (opts) {
  9964. Polling.call(this, opts);
  9965. this.requestTimeout = opts.requestTimeout;
  9966. this.extraHeaders = opts.extraHeaders;
  9967. if (global.location) {
  9968. var isSSL = 'https:' === location.protocol;
  9969. var port = location.port;
  9970. // some user agents have empty `location.port`
  9971. if (!port) {
  9972. port = isSSL ? 443 : 80;
  9973. }
  9974. this.xd = opts.hostname !== global.location.hostname ||
  9975. port !== opts.port;
  9976. this.xs = opts.secure !== isSSL;
  9977. }
  9978. }
  9979. /**
  9980. * Inherits from Polling.
  9981. */
  9982. inherit(XHR, Polling);
  9983. /**
  9984. * XHR supports binary
  9985. */
  9986. XHR.prototype.supportsBinary = true;
  9987. /**
  9988. * Creates a request.
  9989. *
  9990. * @param {String} method
  9991. * @api private
  9992. */
  9993. XHR.prototype.request = function (opts) {
  9994. opts = opts || {};
  9995. opts.uri = this.uri();
  9996. opts.xd = this.xd;
  9997. opts.xs = this.xs;
  9998. opts.agent = this.agent || false;
  9999. opts.supportsBinary = this.supportsBinary;
  10000. opts.enablesXDR = this.enablesXDR;
  10001. // SSL options for Node.js client
  10002. opts.pfx = this.pfx;
  10003. opts.key = this.key;
  10004. opts.passphrase = this.passphrase;
  10005. opts.cert = this.cert;
  10006. opts.ca = this.ca;
  10007. opts.ciphers = this.ciphers;
  10008. opts.rejectUnauthorized = this.rejectUnauthorized;
  10009. opts.requestTimeout = this.requestTimeout;
  10010. // other options for Node.js client
  10011. opts.extraHeaders = this.extraHeaders;
  10012. return new Request(opts);
  10013. };
  10014. /**
  10015. * Sends data.
  10016. *
  10017. * @param {String} data to send.
  10018. * @param {Function} called upon flush.
  10019. * @api private
  10020. */
  10021. XHR.prototype.doWrite = function (data, fn) {
  10022. var isBinary = typeof data !== 'string' && data !== undefined;
  10023. var req = this.request({ method: 'POST', data: data, isBinary: isBinary });
  10024. var self = this;
  10025. req.on('success', fn);
  10026. req.on('error', function (err) {
  10027. self.onError('xhr post error', err);
  10028. });
  10029. this.sendXhr = req;
  10030. };
  10031. /**
  10032. * Starts a poll cycle.
  10033. *
  10034. * @api private
  10035. */
  10036. XHR.prototype.doPoll = function () {
  10037. debug('xhr poll');
  10038. var req = this.request();
  10039. var self = this;
  10040. req.on('data', function (data) {
  10041. self.onData(data);
  10042. });
  10043. req.on('error', function (err) {
  10044. self.onError('xhr poll error', err);
  10045. });
  10046. this.pollXhr = req;
  10047. };
  10048. /**
  10049. * Request constructor
  10050. *
  10051. * @param {Object} options
  10052. * @api public
  10053. */
  10054. function Request (opts) {
  10055. this.method = opts.method || 'GET';
  10056. this.uri = opts.uri;
  10057. this.xd = !!opts.xd;
  10058. this.xs = !!opts.xs;
  10059. this.async = false !== opts.async;
  10060. this.data = undefined !== opts.data ? opts.data : null;
  10061. this.agent = opts.agent;
  10062. this.isBinary = opts.isBinary;
  10063. this.supportsBinary = opts.supportsBinary;
  10064. this.enablesXDR = opts.enablesXDR;
  10065. this.requestTimeout = opts.requestTimeout;
  10066. // SSL options for Node.js client
  10067. this.pfx = opts.pfx;
  10068. this.key = opts.key;
  10069. this.passphrase = opts.passphrase;
  10070. this.cert = opts.cert;
  10071. this.ca = opts.ca;
  10072. this.ciphers = opts.ciphers;
  10073. this.rejectUnauthorized = opts.rejectUnauthorized;
  10074. // other options for Node.js client
  10075. this.extraHeaders = opts.extraHeaders;
  10076. this.create();
  10077. }
  10078. /**
  10079. * Mix in `Emitter`.
  10080. */
  10081. Emitter(Request.prototype);
  10082. /**
  10083. * Creates the XHR object and sends the request.
  10084. *
  10085. * @api private
  10086. */
  10087. Request.prototype.create = function () {
  10088. var opts = { agent: this.agent, xdomain: this.xd, xscheme: this.xs, enablesXDR: this.enablesXDR };
  10089. // SSL options for Node.js client
  10090. opts.pfx = this.pfx;
  10091. opts.key = this.key;
  10092. opts.passphrase = this.passphrase;
  10093. opts.cert = this.cert;
  10094. opts.ca = this.ca;
  10095. opts.ciphers = this.ciphers;
  10096. opts.rejectUnauthorized = this.rejectUnauthorized;
  10097. var xhr = this.xhr = new XMLHttpRequest(opts);
  10098. var self = this;
  10099. try {
  10100. debug('xhr open %s: %s', this.method, this.uri);
  10101. xhr.open(this.method, this.uri, this.async);
  10102. try {
  10103. if (this.extraHeaders) {
  10104. xhr.setDisableHeaderCheck && xhr.setDisableHeaderCheck(true);
  10105. for (var i in this.extraHeaders) {
  10106. if (this.extraHeaders.hasOwnProperty(i)) {
  10107. xhr.setRequestHeader(i, this.extraHeaders[i]);
  10108. }
  10109. }
  10110. }
  10111. } catch (e) {}
  10112. if ('POST' === this.method) {
  10113. try {
  10114. if (this.isBinary) {
  10115. xhr.setRequestHeader('Content-type', 'application/octet-stream');
  10116. } else {
  10117. xhr.setRequestHeader('Content-type', 'text/plain;charset=UTF-8');
  10118. }
  10119. } catch (e) {}
  10120. }
  10121. try {
  10122. xhr.setRequestHeader('Accept', '*/*');
  10123. } catch (e) {}
  10124. // ie6 check
  10125. if ('withCredentials' in xhr) {
  10126. xhr.withCredentials = true;
  10127. }
  10128. if (this.requestTimeout) {
  10129. xhr.timeout = this.requestTimeout;
  10130. }
  10131. if (this.hasXDR()) {
  10132. xhr.onload = function () {
  10133. self.onLoad();
  10134. };
  10135. xhr.onerror = function () {
  10136. self.onError(xhr.responseText);
  10137. };
  10138. } else {
  10139. xhr.onreadystatechange = function () {
  10140. if (xhr.readyState === 2) {
  10141. try {
  10142. var contentType = xhr.getResponseHeader('Content-Type');
  10143. if (self.supportsBinary && contentType === 'application/octet-stream') {
  10144. xhr.responseType = 'arraybuffer';
  10145. }
  10146. } catch (e) {}
  10147. }
  10148. if (4 !== xhr.readyState) return;
  10149. if (200 === xhr.status || 1223 === xhr.status) {
  10150. self.onLoad();
  10151. } else {
  10152. // make sure the `error` event handler that's user-set
  10153. // does not throw in the same tick and gets caught here
  10154. setTimeout(function () {
  10155. self.onError(xhr.status);
  10156. }, 0);
  10157. }
  10158. };
  10159. }
  10160. debug('xhr data %s', this.data);
  10161. xhr.send(this.data);
  10162. } catch (e) {
  10163. // Need to defer since .create() is called directly fhrom the constructor
  10164. // and thus the 'error' event can only be only bound *after* this exception
  10165. // occurs. Therefore, also, we cannot throw here at all.
  10166. setTimeout(function () {
  10167. self.onError(e);
  10168. }, 0);
  10169. return;
  10170. }
  10171. if (global.document) {
  10172. this.index = Request.requestsCount++;
  10173. Request.requests[this.index] = this;
  10174. }
  10175. };
  10176. /**
  10177. * Called upon successful response.
  10178. *
  10179. * @api private
  10180. */
  10181. Request.prototype.onSuccess = function () {
  10182. this.emit('success');
  10183. this.cleanup();
  10184. };
  10185. /**
  10186. * Called if we have data.
  10187. *
  10188. * @api private
  10189. */
  10190. Request.prototype.onData = function (data) {
  10191. this.emit('data', data);
  10192. this.onSuccess();
  10193. };
  10194. /**
  10195. * Called upon error.
  10196. *
  10197. * @api private
  10198. */
  10199. Request.prototype.onError = function (err) {
  10200. this.emit('error', err);
  10201. this.cleanup(true);
  10202. };
  10203. /**
  10204. * Cleans up house.
  10205. *
  10206. * @api private
  10207. */
  10208. Request.prototype.cleanup = function (fromError) {
  10209. if ('undefined' === typeof this.xhr || null === this.xhr) {
  10210. return;
  10211. }
  10212. // xmlhttprequest
  10213. if (this.hasXDR()) {
  10214. this.xhr.onload = this.xhr.onerror = empty;
  10215. } else {
  10216. this.xhr.onreadystatechange = empty;
  10217. }
  10218. if (fromError) {
  10219. try {
  10220. this.xhr.abort();
  10221. } catch (e) {}
  10222. }
  10223. if (global.document) {
  10224. delete Request.requests[this.index];
  10225. }
  10226. this.xhr = null;
  10227. };
  10228. /**
  10229. * Called upon load.
  10230. *
  10231. * @api private
  10232. */
  10233. Request.prototype.onLoad = function () {
  10234. var data;
  10235. try {
  10236. var contentType;
  10237. try {
  10238. contentType = this.xhr.getResponseHeader('Content-Type');
  10239. } catch (e) {}
  10240. if (contentType === 'application/octet-stream') {
  10241. data = this.xhr.response || this.xhr.responseText;
  10242. } else {
  10243. data = this.xhr.responseText;
  10244. }
  10245. } catch (e) {
  10246. this.onError(e);
  10247. }
  10248. if (null != data) {
  10249. this.onData(data);
  10250. }
  10251. };
  10252. /**
  10253. * Check if it has XDomainRequest.
  10254. *
  10255. * @api private
  10256. */
  10257. Request.prototype.hasXDR = function () {
  10258. return 'undefined' !== typeof global.XDomainRequest && !this.xs && this.enablesXDR;
  10259. };
  10260. /**
  10261. * Aborts the request.
  10262. *
  10263. * @api public
  10264. */
  10265. Request.prototype.abort = function () {
  10266. this.cleanup();
  10267. };
  10268. /**
  10269. * Aborts pending requests when unloading the window. This is needed to prevent
  10270. * memory leaks (e.g. when using IE) and to ensure that no spurious error is
  10271. * emitted.
  10272. */
  10273. Request.requestsCount = 0;
  10274. Request.requests = {};
  10275. if (global.document) {
  10276. if (global.attachEvent) {
  10277. global.attachEvent('onunload', unloadHandler);
  10278. } else if (global.addEventListener) {
  10279. global.addEventListener('beforeunload', unloadHandler, false);
  10280. }
  10281. }
  10282. function unloadHandler () {
  10283. for (var i in Request.requests) {
  10284. if (Request.requests.hasOwnProperty(i)) {
  10285. Request.requests[i].abort();
  10286. }
  10287. }
  10288. }
  10289. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
  10290. /***/ }),
  10291. /* 117 */
  10292. /***/ (function(module, exports) {
  10293. /**
  10294. * Gets the keys for an object.
  10295. *
  10296. * @return {Array} keys
  10297. * @api private
  10298. */
  10299. module.exports = Object.keys || function keys (obj){
  10300. var arr = [];
  10301. var has = Object.prototype.hasOwnProperty;
  10302. for (var i in obj) {
  10303. if (has.call(obj, i)) {
  10304. arr.push(i);
  10305. }
  10306. }
  10307. return arr;
  10308. };
  10309. /***/ }),
  10310. /* 118 */
  10311. /***/ (function(module, exports, __webpack_require__) {
  10312. "use strict";
  10313. /* WEBPACK VAR INJECTION */(function(global) {/*!
  10314. * The buffer module from node.js, for the browser.
  10315. *
  10316. * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
  10317. * @license MIT
  10318. */
  10319. /* eslint-disable no-proto */
  10320. var base64 = __webpack_require__(119)
  10321. var ieee754 = __webpack_require__(120)
  10322. var isArray = __webpack_require__(121)
  10323. exports.Buffer = Buffer
  10324. exports.SlowBuffer = SlowBuffer
  10325. exports.INSPECT_MAX_BYTES = 50
  10326. /**
  10327. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  10328. * === true Use Uint8Array implementation (fastest)
  10329. * === false Use Object implementation (most compatible, even IE6)
  10330. *
  10331. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  10332. * Opera 11.6+, iOS 4.2+.
  10333. *
  10334. * Due to various browser bugs, sometimes the Object implementation will be used even
  10335. * when the browser supports typed arrays.
  10336. *
  10337. * Note:
  10338. *
  10339. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  10340. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  10341. *
  10342. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  10343. *
  10344. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  10345. * incorrect length in some situations.
  10346. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  10347. * get the Object implementation, which is slower but behaves correctly.
  10348. */
  10349. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  10350. ? global.TYPED_ARRAY_SUPPORT
  10351. : typedArraySupport()
  10352. /*
  10353. * Export kMaxLength after typed array support is determined.
  10354. */
  10355. exports.kMaxLength = kMaxLength()
  10356. function typedArraySupport () {
  10357. try {
  10358. var arr = new Uint8Array(1)
  10359. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  10360. return arr.foo() === 42 && // typed array instances can be augmented
  10361. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  10362. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  10363. } catch (e) {
  10364. return false
  10365. }
  10366. }
  10367. function kMaxLength () {
  10368. return Buffer.TYPED_ARRAY_SUPPORT
  10369. ? 0x7fffffff
  10370. : 0x3fffffff
  10371. }
  10372. function createBuffer (that, length) {
  10373. if (kMaxLength() < length) {
  10374. throw new RangeError('Invalid typed array length')
  10375. }
  10376. if (Buffer.TYPED_ARRAY_SUPPORT) {
  10377. // Return an augmented `Uint8Array` instance, for best performance
  10378. that = new Uint8Array(length)
  10379. that.__proto__ = Buffer.prototype
  10380. } else {
  10381. // Fallback: Return an object instance of the Buffer class
  10382. if (that === null) {
  10383. that = new Buffer(length)
  10384. }
  10385. that.length = length
  10386. }
  10387. return that
  10388. }
  10389. /**
  10390. * The Buffer constructor returns instances of `Uint8Array` that have their
  10391. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  10392. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  10393. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  10394. * returns a single octet.
  10395. *
  10396. * The `Uint8Array` prototype remains unmodified.
  10397. */
  10398. function Buffer (arg, encodingOrOffset, length) {
  10399. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  10400. return new Buffer(arg, encodingOrOffset, length)
  10401. }
  10402. // Common case.
  10403. if (typeof arg === 'number') {
  10404. if (typeof encodingOrOffset === 'string') {
  10405. throw new Error(
  10406. 'If encoding is specified then the first argument must be a string'
  10407. )
  10408. }
  10409. return allocUnsafe(this, arg)
  10410. }
  10411. return from(this, arg, encodingOrOffset, length)
  10412. }
  10413. Buffer.poolSize = 8192 // not used by this implementation
  10414. // TODO: Legacy, not needed anymore. Remove in next major version.
  10415. Buffer._augment = function (arr) {
  10416. arr.__proto__ = Buffer.prototype
  10417. return arr
  10418. }
  10419. function from (that, value, encodingOrOffset, length) {
  10420. if (typeof value === 'number') {
  10421. throw new TypeError('"value" argument must not be a number')
  10422. }
  10423. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  10424. return fromArrayBuffer(that, value, encodingOrOffset, length)
  10425. }
  10426. if (typeof value === 'string') {
  10427. return fromString(that, value, encodingOrOffset)
  10428. }
  10429. return fromObject(that, value)
  10430. }
  10431. /**
  10432. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  10433. * if value is a number.
  10434. * Buffer.from(str[, encoding])
  10435. * Buffer.from(array)
  10436. * Buffer.from(buffer)
  10437. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  10438. **/
  10439. Buffer.from = function (value, encodingOrOffset, length) {
  10440. return from(null, value, encodingOrOffset, length)
  10441. }
  10442. if (Buffer.TYPED_ARRAY_SUPPORT) {
  10443. Buffer.prototype.__proto__ = Uint8Array.prototype
  10444. Buffer.__proto__ = Uint8Array
  10445. if (typeof Symbol !== 'undefined' && Symbol.species &&
  10446. Buffer[Symbol.species] === Buffer) {
  10447. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  10448. Object.defineProperty(Buffer, Symbol.species, {
  10449. value: null,
  10450. configurable: true
  10451. })
  10452. }
  10453. }
  10454. function assertSize (size) {
  10455. if (typeof size !== 'number') {
  10456. throw new TypeError('"size" argument must be a number')
  10457. } else if (size < 0) {
  10458. throw new RangeError('"size" argument must not be negative')
  10459. }
  10460. }
  10461. function alloc (that, size, fill, encoding) {
  10462. assertSize(size)
  10463. if (size <= 0) {
  10464. return createBuffer(that, size)
  10465. }
  10466. if (fill !== undefined) {
  10467. // Only pay attention to encoding if it's a string. This
  10468. // prevents accidentally sending in a number that would
  10469. // be interpretted as a start offset.
  10470. return typeof encoding === 'string'
  10471. ? createBuffer(that, size).fill(fill, encoding)
  10472. : createBuffer(that, size).fill(fill)
  10473. }
  10474. return createBuffer(that, size)
  10475. }
  10476. /**
  10477. * Creates a new filled Buffer instance.
  10478. * alloc(size[, fill[, encoding]])
  10479. **/
  10480. Buffer.alloc = function (size, fill, encoding) {
  10481. return alloc(null, size, fill, encoding)
  10482. }
  10483. function allocUnsafe (that, size) {
  10484. assertSize(size)
  10485. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  10486. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  10487. for (var i = 0; i < size; ++i) {
  10488. that[i] = 0
  10489. }
  10490. }
  10491. return that
  10492. }
  10493. /**
  10494. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  10495. * */
  10496. Buffer.allocUnsafe = function (size) {
  10497. return allocUnsafe(null, size)
  10498. }
  10499. /**
  10500. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  10501. */
  10502. Buffer.allocUnsafeSlow = function (size) {
  10503. return allocUnsafe(null, size)
  10504. }
  10505. function fromString (that, string, encoding) {
  10506. if (typeof encoding !== 'string' || encoding === '') {
  10507. encoding = 'utf8'
  10508. }
  10509. if (!Buffer.isEncoding(encoding)) {
  10510. throw new TypeError('"encoding" must be a valid string encoding')
  10511. }
  10512. var length = byteLength(string, encoding) | 0
  10513. that = createBuffer(that, length)
  10514. var actual = that.write(string, encoding)
  10515. if (actual !== length) {
  10516. // Writing a hex string, for example, that contains invalid characters will
  10517. // cause everything after the first invalid character to be ignored. (e.g.
  10518. // 'abxxcd' will be treated as 'ab')
  10519. that = that.slice(0, actual)
  10520. }
  10521. return that
  10522. }
  10523. function fromArrayLike (that, array) {
  10524. var length = array.length < 0 ? 0 : checked(array.length) | 0
  10525. that = createBuffer(that, length)
  10526. for (var i = 0; i < length; i += 1) {
  10527. that[i] = array[i] & 255
  10528. }
  10529. return that
  10530. }
  10531. function fromArrayBuffer (that, array, byteOffset, length) {
  10532. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  10533. if (byteOffset < 0 || array.byteLength < byteOffset) {
  10534. throw new RangeError('\'offset\' is out of bounds')
  10535. }
  10536. if (array.byteLength < byteOffset + (length || 0)) {
  10537. throw new RangeError('\'length\' is out of bounds')
  10538. }
  10539. if (byteOffset === undefined && length === undefined) {
  10540. array = new Uint8Array(array)
  10541. } else if (length === undefined) {
  10542. array = new Uint8Array(array, byteOffset)
  10543. } else {
  10544. array = new Uint8Array(array, byteOffset, length)
  10545. }
  10546. if (Buffer.TYPED_ARRAY_SUPPORT) {
  10547. // Return an augmented `Uint8Array` instance, for best performance
  10548. that = array
  10549. that.__proto__ = Buffer.prototype
  10550. } else {
  10551. // Fallback: Return an object instance of the Buffer class
  10552. that = fromArrayLike(that, array)
  10553. }
  10554. return that
  10555. }
  10556. function fromObject (that, obj) {
  10557. if (Buffer.isBuffer(obj)) {
  10558. var len = checked(obj.length) | 0
  10559. that = createBuffer(that, len)
  10560. if (that.length === 0) {
  10561. return that
  10562. }
  10563. obj.copy(that, 0, 0, len)
  10564. return that
  10565. }
  10566. if (obj) {
  10567. if ((typeof ArrayBuffer !== 'undefined' &&
  10568. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  10569. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  10570. return createBuffer(that, 0)
  10571. }
  10572. return fromArrayLike(that, obj)
  10573. }
  10574. if (obj.type === 'Buffer' && isArray(obj.data)) {
  10575. return fromArrayLike(that, obj.data)
  10576. }
  10577. }
  10578. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  10579. }
  10580. function checked (length) {
  10581. // Note: cannot use `length < kMaxLength()` here because that fails when
  10582. // length is NaN (which is otherwise coerced to zero.)
  10583. if (length >= kMaxLength()) {
  10584. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  10585. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  10586. }
  10587. return length | 0
  10588. }
  10589. function SlowBuffer (length) {
  10590. if (+length != length) { // eslint-disable-line eqeqeq
  10591. length = 0
  10592. }
  10593. return Buffer.alloc(+length)
  10594. }
  10595. Buffer.isBuffer = function isBuffer (b) {
  10596. return !!(b != null && b._isBuffer)
  10597. }
  10598. Buffer.compare = function compare (a, b) {
  10599. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  10600. throw new TypeError('Arguments must be Buffers')
  10601. }
  10602. if (a === b) return 0
  10603. var x = a.length
  10604. var y = b.length
  10605. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  10606. if (a[i] !== b[i]) {
  10607. x = a[i]
  10608. y = b[i]
  10609. break
  10610. }
  10611. }
  10612. if (x < y) return -1
  10613. if (y < x) return 1
  10614. return 0
  10615. }
  10616. Buffer.isEncoding = function isEncoding (encoding) {
  10617. switch (String(encoding).toLowerCase()) {
  10618. case 'hex':
  10619. case 'utf8':
  10620. case 'utf-8':
  10621. case 'ascii':
  10622. case 'latin1':
  10623. case 'binary':
  10624. case 'base64':
  10625. case 'ucs2':
  10626. case 'ucs-2':
  10627. case 'utf16le':
  10628. case 'utf-16le':
  10629. return true
  10630. default:
  10631. return false
  10632. }
  10633. }
  10634. Buffer.concat = function concat (list, length) {
  10635. if (!isArray(list)) {
  10636. throw new TypeError('"list" argument must be an Array of Buffers')
  10637. }
  10638. if (list.length === 0) {
  10639. return Buffer.alloc(0)
  10640. }
  10641. var i
  10642. if (length === undefined) {
  10643. length = 0
  10644. for (i = 0; i < list.length; ++i) {
  10645. length += list[i].length
  10646. }
  10647. }
  10648. var buffer = Buffer.allocUnsafe(length)
  10649. var pos = 0
  10650. for (i = 0; i < list.length; ++i) {
  10651. var buf = list[i]
  10652. if (!Buffer.isBuffer(buf)) {
  10653. throw new TypeError('"list" argument must be an Array of Buffers')
  10654. }
  10655. buf.copy(buffer, pos)
  10656. pos += buf.length
  10657. }
  10658. return buffer
  10659. }
  10660. function byteLength (string, encoding) {
  10661. if (Buffer.isBuffer(string)) {
  10662. return string.length
  10663. }
  10664. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  10665. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  10666. return string.byteLength
  10667. }
  10668. if (typeof string !== 'string') {
  10669. string = '' + string
  10670. }
  10671. var len = string.length
  10672. if (len === 0) return 0
  10673. // Use a for loop to avoid recursion
  10674. var loweredCase = false
  10675. for (;;) {
  10676. switch (encoding) {
  10677. case 'ascii':
  10678. case 'latin1':
  10679. case 'binary':
  10680. return len
  10681. case 'utf8':
  10682. case 'utf-8':
  10683. case undefined:
  10684. return utf8ToBytes(string).length
  10685. case 'ucs2':
  10686. case 'ucs-2':
  10687. case 'utf16le':
  10688. case 'utf-16le':
  10689. return len * 2
  10690. case 'hex':
  10691. return len >>> 1
  10692. case 'base64':
  10693. return base64ToBytes(string).length
  10694. default:
  10695. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  10696. encoding = ('' + encoding).toLowerCase()
  10697. loweredCase = true
  10698. }
  10699. }
  10700. }
  10701. Buffer.byteLength = byteLength
  10702. function slowToString (encoding, start, end) {
  10703. var loweredCase = false
  10704. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  10705. // property of a typed array.
  10706. // This behaves neither like String nor Uint8Array in that we set start/end
  10707. // to their upper/lower bounds if the value passed is out of range.
  10708. // undefined is handled specially as per ECMA-262 6th Edition,
  10709. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  10710. if (start === undefined || start < 0) {
  10711. start = 0
  10712. }
  10713. // Return early if start > this.length. Done here to prevent potential uint32
  10714. // coercion fail below.
  10715. if (start > this.length) {
  10716. return ''
  10717. }
  10718. if (end === undefined || end > this.length) {
  10719. end = this.length
  10720. }
  10721. if (end <= 0) {
  10722. return ''
  10723. }
  10724. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  10725. end >>>= 0
  10726. start >>>= 0
  10727. if (end <= start) {
  10728. return ''
  10729. }
  10730. if (!encoding) encoding = 'utf8'
  10731. while (true) {
  10732. switch (encoding) {
  10733. case 'hex':
  10734. return hexSlice(this, start, end)
  10735. case 'utf8':
  10736. case 'utf-8':
  10737. return utf8Slice(this, start, end)
  10738. case 'ascii':
  10739. return asciiSlice(this, start, end)
  10740. case 'latin1':
  10741. case 'binary':
  10742. return latin1Slice(this, start, end)
  10743. case 'base64':
  10744. return base64Slice(this, start, end)
  10745. case 'ucs2':
  10746. case 'ucs-2':
  10747. case 'utf16le':
  10748. case 'utf-16le':
  10749. return utf16leSlice(this, start, end)
  10750. default:
  10751. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  10752. encoding = (encoding + '').toLowerCase()
  10753. loweredCase = true
  10754. }
  10755. }
  10756. }
  10757. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  10758. // Buffer instances.
  10759. Buffer.prototype._isBuffer = true
  10760. function swap (b, n, m) {
  10761. var i = b[n]
  10762. b[n] = b[m]
  10763. b[m] = i
  10764. }
  10765. Buffer.prototype.swap16 = function swap16 () {
  10766. var len = this.length
  10767. if (len % 2 !== 0) {
  10768. throw new RangeError('Buffer size must be a multiple of 16-bits')
  10769. }
  10770. for (var i = 0; i < len; i += 2) {
  10771. swap(this, i, i + 1)
  10772. }
  10773. return this
  10774. }
  10775. Buffer.prototype.swap32 = function swap32 () {
  10776. var len = this.length
  10777. if (len % 4 !== 0) {
  10778. throw new RangeError('Buffer size must be a multiple of 32-bits')
  10779. }
  10780. for (var i = 0; i < len; i += 4) {
  10781. swap(this, i, i + 3)
  10782. swap(this, i + 1, i + 2)
  10783. }
  10784. return this
  10785. }
  10786. Buffer.prototype.swap64 = function swap64 () {
  10787. var len = this.length
  10788. if (len % 8 !== 0) {
  10789. throw new RangeError('Buffer size must be a multiple of 64-bits')
  10790. }
  10791. for (var i = 0; i < len; i += 8) {
  10792. swap(this, i, i + 7)
  10793. swap(this, i + 1, i + 6)
  10794. swap(this, i + 2, i + 5)
  10795. swap(this, i + 3, i + 4)
  10796. }
  10797. return this
  10798. }
  10799. Buffer.prototype.toString = function toString () {
  10800. var length = this.length | 0
  10801. if (length === 0) return ''
  10802. if (arguments.length === 0) return utf8Slice(this, 0, length)
  10803. return slowToString.apply(this, arguments)
  10804. }
  10805. Buffer.prototype.equals = function equals (b) {
  10806. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  10807. if (this === b) return true
  10808. return Buffer.compare(this, b) === 0
  10809. }
  10810. Buffer.prototype.inspect = function inspect () {
  10811. var str = ''
  10812. var max = exports.INSPECT_MAX_BYTES
  10813. if (this.length > 0) {
  10814. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  10815. if (this.length > max) str += ' ... '
  10816. }
  10817. return '<Buffer ' + str + '>'
  10818. }
  10819. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  10820. if (!Buffer.isBuffer(target)) {
  10821. throw new TypeError('Argument must be a Buffer')
  10822. }
  10823. if (start === undefined) {
  10824. start = 0
  10825. }
  10826. if (end === undefined) {
  10827. end = target ? target.length : 0
  10828. }
  10829. if (thisStart === undefined) {
  10830. thisStart = 0
  10831. }
  10832. if (thisEnd === undefined) {
  10833. thisEnd = this.length
  10834. }
  10835. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  10836. throw new RangeError('out of range index')
  10837. }
  10838. if (thisStart >= thisEnd && start >= end) {
  10839. return 0
  10840. }
  10841. if (thisStart >= thisEnd) {
  10842. return -1
  10843. }
  10844. if (start >= end) {
  10845. return 1
  10846. }
  10847. start >>>= 0
  10848. end >>>= 0
  10849. thisStart >>>= 0
  10850. thisEnd >>>= 0
  10851. if (this === target) return 0
  10852. var x = thisEnd - thisStart
  10853. var y = end - start
  10854. var len = Math.min(x, y)
  10855. var thisCopy = this.slice(thisStart, thisEnd)
  10856. var targetCopy = target.slice(start, end)
  10857. for (var i = 0; i < len; ++i) {
  10858. if (thisCopy[i] !== targetCopy[i]) {
  10859. x = thisCopy[i]
  10860. y = targetCopy[i]
  10861. break
  10862. }
  10863. }
  10864. if (x < y) return -1
  10865. if (y < x) return 1
  10866. return 0
  10867. }
  10868. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  10869. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  10870. //
  10871. // Arguments:
  10872. // - buffer - a Buffer to search
  10873. // - val - a string, Buffer, or number
  10874. // - byteOffset - an index into `buffer`; will be clamped to an int32
  10875. // - encoding - an optional encoding, relevant is val is a string
  10876. // - dir - true for indexOf, false for lastIndexOf
  10877. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  10878. // Empty buffer means no match
  10879. if (buffer.length === 0) return -1
  10880. // Normalize byteOffset
  10881. if (typeof byteOffset === 'string') {
  10882. encoding = byteOffset
  10883. byteOffset = 0
  10884. } else if (byteOffset > 0x7fffffff) {
  10885. byteOffset = 0x7fffffff
  10886. } else if (byteOffset < -0x80000000) {
  10887. byteOffset = -0x80000000
  10888. }
  10889. byteOffset = +byteOffset // Coerce to Number.
  10890. if (isNaN(byteOffset)) {
  10891. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  10892. byteOffset = dir ? 0 : (buffer.length - 1)
  10893. }
  10894. // Normalize byteOffset: negative offsets start from the end of the buffer
  10895. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  10896. if (byteOffset >= buffer.length) {
  10897. if (dir) return -1
  10898. else byteOffset = buffer.length - 1
  10899. } else if (byteOffset < 0) {
  10900. if (dir) byteOffset = 0
  10901. else return -1
  10902. }
  10903. // Normalize val
  10904. if (typeof val === 'string') {
  10905. val = Buffer.from(val, encoding)
  10906. }
  10907. // Finally, search either indexOf (if dir is true) or lastIndexOf
  10908. if (Buffer.isBuffer(val)) {
  10909. // Special case: looking for empty string/buffer always fails
  10910. if (val.length === 0) {
  10911. return -1
  10912. }
  10913. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  10914. } else if (typeof val === 'number') {
  10915. val = val & 0xFF // Search for a byte value [0-255]
  10916. if (Buffer.TYPED_ARRAY_SUPPORT &&
  10917. typeof Uint8Array.prototype.indexOf === 'function') {
  10918. if (dir) {
  10919. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  10920. } else {
  10921. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  10922. }
  10923. }
  10924. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  10925. }
  10926. throw new TypeError('val must be string, number or Buffer')
  10927. }
  10928. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  10929. var indexSize = 1
  10930. var arrLength = arr.length
  10931. var valLength = val.length
  10932. if (encoding !== undefined) {
  10933. encoding = String(encoding).toLowerCase()
  10934. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  10935. encoding === 'utf16le' || encoding === 'utf-16le') {
  10936. if (arr.length < 2 || val.length < 2) {
  10937. return -1
  10938. }
  10939. indexSize = 2
  10940. arrLength /= 2
  10941. valLength /= 2
  10942. byteOffset /= 2
  10943. }
  10944. }
  10945. function read (buf, i) {
  10946. if (indexSize === 1) {
  10947. return buf[i]
  10948. } else {
  10949. return buf.readUInt16BE(i * indexSize)
  10950. }
  10951. }
  10952. var i
  10953. if (dir) {
  10954. var foundIndex = -1
  10955. for (i = byteOffset; i < arrLength; i++) {
  10956. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  10957. if (foundIndex === -1) foundIndex = i
  10958. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  10959. } else {
  10960. if (foundIndex !== -1) i -= i - foundIndex
  10961. foundIndex = -1
  10962. }
  10963. }
  10964. } else {
  10965. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  10966. for (i = byteOffset; i >= 0; i--) {
  10967. var found = true
  10968. for (var j = 0; j < valLength; j++) {
  10969. if (read(arr, i + j) !== read(val, j)) {
  10970. found = false
  10971. break
  10972. }
  10973. }
  10974. if (found) return i
  10975. }
  10976. }
  10977. return -1
  10978. }
  10979. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  10980. return this.indexOf(val, byteOffset, encoding) !== -1
  10981. }
  10982. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  10983. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  10984. }
  10985. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  10986. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  10987. }
  10988. function hexWrite (buf, string, offset, length) {
  10989. offset = Number(offset) || 0
  10990. var remaining = buf.length - offset
  10991. if (!length) {
  10992. length = remaining
  10993. } else {
  10994. length = Number(length)
  10995. if (length > remaining) {
  10996. length = remaining
  10997. }
  10998. }
  10999. // must be an even number of digits
  11000. var strLen = string.length
  11001. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  11002. if (length > strLen / 2) {
  11003. length = strLen / 2
  11004. }
  11005. for (var i = 0; i < length; ++i) {
  11006. var parsed = parseInt(string.substr(i * 2, 2), 16)
  11007. if (isNaN(parsed)) return i
  11008. buf[offset + i] = parsed
  11009. }
  11010. return i
  11011. }
  11012. function utf8Write (buf, string, offset, length) {
  11013. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  11014. }
  11015. function asciiWrite (buf, string, offset, length) {
  11016. return blitBuffer(asciiToBytes(string), buf, offset, length)
  11017. }
  11018. function latin1Write (buf, string, offset, length) {
  11019. return asciiWrite(buf, string, offset, length)
  11020. }
  11021. function base64Write (buf, string, offset, length) {
  11022. return blitBuffer(base64ToBytes(string), buf, offset, length)
  11023. }
  11024. function ucs2Write (buf, string, offset, length) {
  11025. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  11026. }
  11027. Buffer.prototype.write = function write (string, offset, length, encoding) {
  11028. // Buffer#write(string)
  11029. if (offset === undefined) {
  11030. encoding = 'utf8'
  11031. length = this.length
  11032. offset = 0
  11033. // Buffer#write(string, encoding)
  11034. } else if (length === undefined && typeof offset === 'string') {
  11035. encoding = offset
  11036. length = this.length
  11037. offset = 0
  11038. // Buffer#write(string, offset[, length][, encoding])
  11039. } else if (isFinite(offset)) {
  11040. offset = offset | 0
  11041. if (isFinite(length)) {
  11042. length = length | 0
  11043. if (encoding === undefined) encoding = 'utf8'
  11044. } else {
  11045. encoding = length
  11046. length = undefined
  11047. }
  11048. // legacy write(string, encoding, offset, length) - remove in v0.13
  11049. } else {
  11050. throw new Error(
  11051. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  11052. )
  11053. }
  11054. var remaining = this.length - offset
  11055. if (length === undefined || length > remaining) length = remaining
  11056. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  11057. throw new RangeError('Attempt to write outside buffer bounds')
  11058. }
  11059. if (!encoding) encoding = 'utf8'
  11060. var loweredCase = false
  11061. for (;;) {
  11062. switch (encoding) {
  11063. case 'hex':
  11064. return hexWrite(this, string, offset, length)
  11065. case 'utf8':
  11066. case 'utf-8':
  11067. return utf8Write(this, string, offset, length)
  11068. case 'ascii':
  11069. return asciiWrite(this, string, offset, length)
  11070. case 'latin1':
  11071. case 'binary':
  11072. return latin1Write(this, string, offset, length)
  11073. case 'base64':
  11074. // Warning: maxLength not taken into account in base64Write
  11075. return base64Write(this, string, offset, length)
  11076. case 'ucs2':
  11077. case 'ucs-2':
  11078. case 'utf16le':
  11079. case 'utf-16le':
  11080. return ucs2Write(this, string, offset, length)
  11081. default:
  11082. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  11083. encoding = ('' + encoding).toLowerCase()
  11084. loweredCase = true
  11085. }
  11086. }
  11087. }
  11088. Buffer.prototype.toJSON = function toJSON () {
  11089. return {
  11090. type: 'Buffer',
  11091. data: Array.prototype.slice.call(this._arr || this, 0)
  11092. }
  11093. }
  11094. function base64Slice (buf, start, end) {
  11095. if (start === 0 && end === buf.length) {
  11096. return base64.fromByteArray(buf)
  11097. } else {
  11098. return base64.fromByteArray(buf.slice(start, end))
  11099. }
  11100. }
  11101. function utf8Slice (buf, start, end) {
  11102. end = Math.min(buf.length, end)
  11103. var res = []
  11104. var i = start
  11105. while (i < end) {
  11106. var firstByte = buf[i]
  11107. var codePoint = null
  11108. var bytesPerSequence = (firstByte > 0xEF) ? 4
  11109. : (firstByte > 0xDF) ? 3
  11110. : (firstByte > 0xBF) ? 2
  11111. : 1
  11112. if (i + bytesPerSequence <= end) {
  11113. var secondByte, thirdByte, fourthByte, tempCodePoint
  11114. switch (bytesPerSequence) {
  11115. case 1:
  11116. if (firstByte < 0x80) {
  11117. codePoint = firstByte
  11118. }
  11119. break
  11120. case 2:
  11121. secondByte = buf[i + 1]
  11122. if ((secondByte & 0xC0) === 0x80) {
  11123. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  11124. if (tempCodePoint > 0x7F) {
  11125. codePoint = tempCodePoint
  11126. }
  11127. }
  11128. break
  11129. case 3:
  11130. secondByte = buf[i + 1]
  11131. thirdByte = buf[i + 2]
  11132. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  11133. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  11134. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  11135. codePoint = tempCodePoint
  11136. }
  11137. }
  11138. break
  11139. case 4:
  11140. secondByte = buf[i + 1]
  11141. thirdByte = buf[i + 2]
  11142. fourthByte = buf[i + 3]
  11143. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  11144. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  11145. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  11146. codePoint = tempCodePoint
  11147. }
  11148. }
  11149. }
  11150. }
  11151. if (codePoint === null) {
  11152. // we did not generate a valid codePoint so insert a
  11153. // replacement char (U+FFFD) and advance only 1 byte
  11154. codePoint = 0xFFFD
  11155. bytesPerSequence = 1
  11156. } else if (codePoint > 0xFFFF) {
  11157. // encode to utf16 (surrogate pair dance)
  11158. codePoint -= 0x10000
  11159. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  11160. codePoint = 0xDC00 | codePoint & 0x3FF
  11161. }
  11162. res.push(codePoint)
  11163. i += bytesPerSequence
  11164. }
  11165. return decodeCodePointsArray(res)
  11166. }
  11167. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  11168. // the lowest limit is Chrome, with 0x10000 args.
  11169. // We go 1 magnitude less, for safety
  11170. var MAX_ARGUMENTS_LENGTH = 0x1000
  11171. function decodeCodePointsArray (codePoints) {
  11172. var len = codePoints.length
  11173. if (len <= MAX_ARGUMENTS_LENGTH) {
  11174. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  11175. }
  11176. // Decode in chunks to avoid "call stack size exceeded".
  11177. var res = ''
  11178. var i = 0
  11179. while (i < len) {
  11180. res += String.fromCharCode.apply(
  11181. String,
  11182. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  11183. )
  11184. }
  11185. return res
  11186. }
  11187. function asciiSlice (buf, start, end) {
  11188. var ret = ''
  11189. end = Math.min(buf.length, end)
  11190. for (var i = start; i < end; ++i) {
  11191. ret += String.fromCharCode(buf[i] & 0x7F)
  11192. }
  11193. return ret
  11194. }
  11195. function latin1Slice (buf, start, end) {
  11196. var ret = ''
  11197. end = Math.min(buf.length, end)
  11198. for (var i = start; i < end; ++i) {
  11199. ret += String.fromCharCode(buf[i])
  11200. }
  11201. return ret
  11202. }
  11203. function hexSlice (buf, start, end) {
  11204. var len = buf.length
  11205. if (!start || start < 0) start = 0
  11206. if (!end || end < 0 || end > len) end = len
  11207. var out = ''
  11208. for (var i = start; i < end; ++i) {
  11209. out += toHex(buf[i])
  11210. }
  11211. return out
  11212. }
  11213. function utf16leSlice (buf, start, end) {
  11214. var bytes = buf.slice(start, end)
  11215. var res = ''
  11216. for (var i = 0; i < bytes.length; i += 2) {
  11217. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  11218. }
  11219. return res
  11220. }
  11221. Buffer.prototype.slice = function slice (start, end) {
  11222. var len = this.length
  11223. start = ~~start
  11224. end = end === undefined ? len : ~~end
  11225. if (start < 0) {
  11226. start += len
  11227. if (start < 0) start = 0
  11228. } else if (start > len) {
  11229. start = len
  11230. }
  11231. if (end < 0) {
  11232. end += len
  11233. if (end < 0) end = 0
  11234. } else if (end > len) {
  11235. end = len
  11236. }
  11237. if (end < start) end = start
  11238. var newBuf
  11239. if (Buffer.TYPED_ARRAY_SUPPORT) {
  11240. newBuf = this.subarray(start, end)
  11241. newBuf.__proto__ = Buffer.prototype
  11242. } else {
  11243. var sliceLen = end - start
  11244. newBuf = new Buffer(sliceLen, undefined)
  11245. for (var i = 0; i < sliceLen; ++i) {
  11246. newBuf[i] = this[i + start]
  11247. }
  11248. }
  11249. return newBuf
  11250. }
  11251. /*
  11252. * Need to make sure that buffer isn't trying to write out of bounds.
  11253. */
  11254. function checkOffset (offset, ext, length) {
  11255. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  11256. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  11257. }
  11258. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  11259. offset = offset | 0
  11260. byteLength = byteLength | 0
  11261. if (!noAssert) checkOffset(offset, byteLength, this.length)
  11262. var val = this[offset]
  11263. var mul = 1
  11264. var i = 0
  11265. while (++i < byteLength && (mul *= 0x100)) {
  11266. val += this[offset + i] * mul
  11267. }
  11268. return val
  11269. }
  11270. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  11271. offset = offset | 0
  11272. byteLength = byteLength | 0
  11273. if (!noAssert) {
  11274. checkOffset(offset, byteLength, this.length)
  11275. }
  11276. var val = this[offset + --byteLength]
  11277. var mul = 1
  11278. while (byteLength > 0 && (mul *= 0x100)) {
  11279. val += this[offset + --byteLength] * mul
  11280. }
  11281. return val
  11282. }
  11283. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  11284. if (!noAssert) checkOffset(offset, 1, this.length)
  11285. return this[offset]
  11286. }
  11287. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  11288. if (!noAssert) checkOffset(offset, 2, this.length)
  11289. return this[offset] | (this[offset + 1] << 8)
  11290. }
  11291. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  11292. if (!noAssert) checkOffset(offset, 2, this.length)
  11293. return (this[offset] << 8) | this[offset + 1]
  11294. }
  11295. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  11296. if (!noAssert) checkOffset(offset, 4, this.length)
  11297. return ((this[offset]) |
  11298. (this[offset + 1] << 8) |
  11299. (this[offset + 2] << 16)) +
  11300. (this[offset + 3] * 0x1000000)
  11301. }
  11302. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  11303. if (!noAssert) checkOffset(offset, 4, this.length)
  11304. return (this[offset] * 0x1000000) +
  11305. ((this[offset + 1] << 16) |
  11306. (this[offset + 2] << 8) |
  11307. this[offset + 3])
  11308. }
  11309. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  11310. offset = offset | 0
  11311. byteLength = byteLength | 0
  11312. if (!noAssert) checkOffset(offset, byteLength, this.length)
  11313. var val = this[offset]
  11314. var mul = 1
  11315. var i = 0
  11316. while (++i < byteLength && (mul *= 0x100)) {
  11317. val += this[offset + i] * mul
  11318. }
  11319. mul *= 0x80
  11320. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  11321. return val
  11322. }
  11323. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  11324. offset = offset | 0
  11325. byteLength = byteLength | 0
  11326. if (!noAssert) checkOffset(offset, byteLength, this.length)
  11327. var i = byteLength
  11328. var mul = 1
  11329. var val = this[offset + --i]
  11330. while (i > 0 && (mul *= 0x100)) {
  11331. val += this[offset + --i] * mul
  11332. }
  11333. mul *= 0x80
  11334. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  11335. return val
  11336. }
  11337. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  11338. if (!noAssert) checkOffset(offset, 1, this.length)
  11339. if (!(this[offset] & 0x80)) return (this[offset])
  11340. return ((0xff - this[offset] + 1) * -1)
  11341. }
  11342. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  11343. if (!noAssert) checkOffset(offset, 2, this.length)
  11344. var val = this[offset] | (this[offset + 1] << 8)
  11345. return (val & 0x8000) ? val | 0xFFFF0000 : val
  11346. }
  11347. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  11348. if (!noAssert) checkOffset(offset, 2, this.length)
  11349. var val = this[offset + 1] | (this[offset] << 8)
  11350. return (val & 0x8000) ? val | 0xFFFF0000 : val
  11351. }
  11352. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  11353. if (!noAssert) checkOffset(offset, 4, this.length)
  11354. return (this[offset]) |
  11355. (this[offset + 1] << 8) |
  11356. (this[offset + 2] << 16) |
  11357. (this[offset + 3] << 24)
  11358. }
  11359. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  11360. if (!noAssert) checkOffset(offset, 4, this.length)
  11361. return (this[offset] << 24) |
  11362. (this[offset + 1] << 16) |
  11363. (this[offset + 2] << 8) |
  11364. (this[offset + 3])
  11365. }
  11366. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  11367. if (!noAssert) checkOffset(offset, 4, this.length)
  11368. return ieee754.read(this, offset, true, 23, 4)
  11369. }
  11370. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  11371. if (!noAssert) checkOffset(offset, 4, this.length)
  11372. return ieee754.read(this, offset, false, 23, 4)
  11373. }
  11374. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  11375. if (!noAssert) checkOffset(offset, 8, this.length)
  11376. return ieee754.read(this, offset, true, 52, 8)
  11377. }
  11378. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  11379. if (!noAssert) checkOffset(offset, 8, this.length)
  11380. return ieee754.read(this, offset, false, 52, 8)
  11381. }
  11382. function checkInt (buf, value, offset, ext, max, min) {
  11383. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  11384. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  11385. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  11386. }
  11387. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  11388. value = +value
  11389. offset = offset | 0
  11390. byteLength = byteLength | 0
  11391. if (!noAssert) {
  11392. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  11393. checkInt(this, value, offset, byteLength, maxBytes, 0)
  11394. }
  11395. var mul = 1
  11396. var i = 0
  11397. this[offset] = value & 0xFF
  11398. while (++i < byteLength && (mul *= 0x100)) {
  11399. this[offset + i] = (value / mul) & 0xFF
  11400. }
  11401. return offset + byteLength
  11402. }
  11403. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  11404. value = +value
  11405. offset = offset | 0
  11406. byteLength = byteLength | 0
  11407. if (!noAssert) {
  11408. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  11409. checkInt(this, value, offset, byteLength, maxBytes, 0)
  11410. }
  11411. var i = byteLength - 1
  11412. var mul = 1
  11413. this[offset + i] = value & 0xFF
  11414. while (--i >= 0 && (mul *= 0x100)) {
  11415. this[offset + i] = (value / mul) & 0xFF
  11416. }
  11417. return offset + byteLength
  11418. }
  11419. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  11420. value = +value
  11421. offset = offset | 0
  11422. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  11423. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  11424. this[offset] = (value & 0xff)
  11425. return offset + 1
  11426. }
  11427. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  11428. if (value < 0) value = 0xffff + value + 1
  11429. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  11430. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  11431. (littleEndian ? i : 1 - i) * 8
  11432. }
  11433. }
  11434. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  11435. value = +value
  11436. offset = offset | 0
  11437. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  11438. if (Buffer.TYPED_ARRAY_SUPPORT) {
  11439. this[offset] = (value & 0xff)
  11440. this[offset + 1] = (value >>> 8)
  11441. } else {
  11442. objectWriteUInt16(this, value, offset, true)
  11443. }
  11444. return offset + 2
  11445. }
  11446. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  11447. value = +value
  11448. offset = offset | 0
  11449. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  11450. if (Buffer.TYPED_ARRAY_SUPPORT) {
  11451. this[offset] = (value >>> 8)
  11452. this[offset + 1] = (value & 0xff)
  11453. } else {
  11454. objectWriteUInt16(this, value, offset, false)
  11455. }
  11456. return offset + 2
  11457. }
  11458. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  11459. if (value < 0) value = 0xffffffff + value + 1
  11460. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  11461. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  11462. }
  11463. }
  11464. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  11465. value = +value
  11466. offset = offset | 0
  11467. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  11468. if (Buffer.TYPED_ARRAY_SUPPORT) {
  11469. this[offset + 3] = (value >>> 24)
  11470. this[offset + 2] = (value >>> 16)
  11471. this[offset + 1] = (value >>> 8)
  11472. this[offset] = (value & 0xff)
  11473. } else {
  11474. objectWriteUInt32(this, value, offset, true)
  11475. }
  11476. return offset + 4
  11477. }
  11478. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  11479. value = +value
  11480. offset = offset | 0
  11481. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  11482. if (Buffer.TYPED_ARRAY_SUPPORT) {
  11483. this[offset] = (value >>> 24)
  11484. this[offset + 1] = (value >>> 16)
  11485. this[offset + 2] = (value >>> 8)
  11486. this[offset + 3] = (value & 0xff)
  11487. } else {
  11488. objectWriteUInt32(this, value, offset, false)
  11489. }
  11490. return offset + 4
  11491. }
  11492. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  11493. value = +value
  11494. offset = offset | 0
  11495. if (!noAssert) {
  11496. var limit = Math.pow(2, 8 * byteLength - 1)
  11497. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  11498. }
  11499. var i = 0
  11500. var mul = 1
  11501. var sub = 0
  11502. this[offset] = value & 0xFF
  11503. while (++i < byteLength && (mul *= 0x100)) {
  11504. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  11505. sub = 1
  11506. }
  11507. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  11508. }
  11509. return offset + byteLength
  11510. }
  11511. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  11512. value = +value
  11513. offset = offset | 0
  11514. if (!noAssert) {
  11515. var limit = Math.pow(2, 8 * byteLength - 1)
  11516. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  11517. }
  11518. var i = byteLength - 1
  11519. var mul = 1
  11520. var sub = 0
  11521. this[offset + i] = value & 0xFF
  11522. while (--i >= 0 && (mul *= 0x100)) {
  11523. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  11524. sub = 1
  11525. }
  11526. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  11527. }
  11528. return offset + byteLength
  11529. }
  11530. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  11531. value = +value
  11532. offset = offset | 0
  11533. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  11534. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  11535. if (value < 0) value = 0xff + value + 1
  11536. this[offset] = (value & 0xff)
  11537. return offset + 1
  11538. }
  11539. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  11540. value = +value
  11541. offset = offset | 0
  11542. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  11543. if (Buffer.TYPED_ARRAY_SUPPORT) {
  11544. this[offset] = (value & 0xff)
  11545. this[offset + 1] = (value >>> 8)
  11546. } else {
  11547. objectWriteUInt16(this, value, offset, true)
  11548. }
  11549. return offset + 2
  11550. }
  11551. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  11552. value = +value
  11553. offset = offset | 0
  11554. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  11555. if (Buffer.TYPED_ARRAY_SUPPORT) {
  11556. this[offset] = (value >>> 8)
  11557. this[offset + 1] = (value & 0xff)
  11558. } else {
  11559. objectWriteUInt16(this, value, offset, false)
  11560. }
  11561. return offset + 2
  11562. }
  11563. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  11564. value = +value
  11565. offset = offset | 0
  11566. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  11567. if (Buffer.TYPED_ARRAY_SUPPORT) {
  11568. this[offset] = (value & 0xff)
  11569. this[offset + 1] = (value >>> 8)
  11570. this[offset + 2] = (value >>> 16)
  11571. this[offset + 3] = (value >>> 24)
  11572. } else {
  11573. objectWriteUInt32(this, value, offset, true)
  11574. }
  11575. return offset + 4
  11576. }
  11577. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  11578. value = +value
  11579. offset = offset | 0
  11580. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  11581. if (value < 0) value = 0xffffffff + value + 1
  11582. if (Buffer.TYPED_ARRAY_SUPPORT) {
  11583. this[offset] = (value >>> 24)
  11584. this[offset + 1] = (value >>> 16)
  11585. this[offset + 2] = (value >>> 8)
  11586. this[offset + 3] = (value & 0xff)
  11587. } else {
  11588. objectWriteUInt32(this, value, offset, false)
  11589. }
  11590. return offset + 4
  11591. }
  11592. function checkIEEE754 (buf, value, offset, ext, max, min) {
  11593. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  11594. if (offset < 0) throw new RangeError('Index out of range')
  11595. }
  11596. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  11597. if (!noAssert) {
  11598. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  11599. }
  11600. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  11601. return offset + 4
  11602. }
  11603. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  11604. return writeFloat(this, value, offset, true, noAssert)
  11605. }
  11606. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  11607. return writeFloat(this, value, offset, false, noAssert)
  11608. }
  11609. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  11610. if (!noAssert) {
  11611. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  11612. }
  11613. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  11614. return offset + 8
  11615. }
  11616. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  11617. return writeDouble(this, value, offset, true, noAssert)
  11618. }
  11619. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  11620. return writeDouble(this, value, offset, false, noAssert)
  11621. }
  11622. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  11623. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  11624. if (!start) start = 0
  11625. if (!end && end !== 0) end = this.length
  11626. if (targetStart >= target.length) targetStart = target.length
  11627. if (!targetStart) targetStart = 0
  11628. if (end > 0 && end < start) end = start
  11629. // Copy 0 bytes; we're done
  11630. if (end === start) return 0
  11631. if (target.length === 0 || this.length === 0) return 0
  11632. // Fatal error conditions
  11633. if (targetStart < 0) {
  11634. throw new RangeError('targetStart out of bounds')
  11635. }
  11636. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  11637. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  11638. // Are we oob?
  11639. if (end > this.length) end = this.length
  11640. if (target.length - targetStart < end - start) {
  11641. end = target.length - targetStart + start
  11642. }
  11643. var len = end - start
  11644. var i
  11645. if (this === target && start < targetStart && targetStart < end) {
  11646. // descending copy from end
  11647. for (i = len - 1; i >= 0; --i) {
  11648. target[i + targetStart] = this[i + start]
  11649. }
  11650. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  11651. // ascending copy from start
  11652. for (i = 0; i < len; ++i) {
  11653. target[i + targetStart] = this[i + start]
  11654. }
  11655. } else {
  11656. Uint8Array.prototype.set.call(
  11657. target,
  11658. this.subarray(start, start + len),
  11659. targetStart
  11660. )
  11661. }
  11662. return len
  11663. }
  11664. // Usage:
  11665. // buffer.fill(number[, offset[, end]])
  11666. // buffer.fill(buffer[, offset[, end]])
  11667. // buffer.fill(string[, offset[, end]][, encoding])
  11668. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  11669. // Handle string cases:
  11670. if (typeof val === 'string') {
  11671. if (typeof start === 'string') {
  11672. encoding = start
  11673. start = 0
  11674. end = this.length
  11675. } else if (typeof end === 'string') {
  11676. encoding = end
  11677. end = this.length
  11678. }
  11679. if (val.length === 1) {
  11680. var code = val.charCodeAt(0)
  11681. if (code < 256) {
  11682. val = code
  11683. }
  11684. }
  11685. if (encoding !== undefined && typeof encoding !== 'string') {
  11686. throw new TypeError('encoding must be a string')
  11687. }
  11688. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  11689. throw new TypeError('Unknown encoding: ' + encoding)
  11690. }
  11691. } else if (typeof val === 'number') {
  11692. val = val & 255
  11693. }
  11694. // Invalid ranges are not set to a default, so can range check early.
  11695. if (start < 0 || this.length < start || this.length < end) {
  11696. throw new RangeError('Out of range index')
  11697. }
  11698. if (end <= start) {
  11699. return this
  11700. }
  11701. start = start >>> 0
  11702. end = end === undefined ? this.length : end >>> 0
  11703. if (!val) val = 0
  11704. var i
  11705. if (typeof val === 'number') {
  11706. for (i = start; i < end; ++i) {
  11707. this[i] = val
  11708. }
  11709. } else {
  11710. var bytes = Buffer.isBuffer(val)
  11711. ? val
  11712. : utf8ToBytes(new Buffer(val, encoding).toString())
  11713. var len = bytes.length
  11714. for (i = 0; i < end - start; ++i) {
  11715. this[i + start] = bytes[i % len]
  11716. }
  11717. }
  11718. return this
  11719. }
  11720. // HELPER FUNCTIONS
  11721. // ================
  11722. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  11723. function base64clean (str) {
  11724. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  11725. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  11726. // Node converts strings with length < 2 to ''
  11727. if (str.length < 2) return ''
  11728. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  11729. while (str.length % 4 !== 0) {
  11730. str = str + '='
  11731. }
  11732. return str
  11733. }
  11734. function stringtrim (str) {
  11735. if (str.trim) return str.trim()
  11736. return str.replace(/^\s+|\s+$/g, '')
  11737. }
  11738. function toHex (n) {
  11739. if (n < 16) return '0' + n.toString(16)
  11740. return n.toString(16)
  11741. }
  11742. function utf8ToBytes (string, units) {
  11743. units = units || Infinity
  11744. var codePoint
  11745. var length = string.length
  11746. var leadSurrogate = null
  11747. var bytes = []
  11748. for (var i = 0; i < length; ++i) {
  11749. codePoint = string.charCodeAt(i)
  11750. // is surrogate component
  11751. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  11752. // last char was a lead
  11753. if (!leadSurrogate) {
  11754. // no lead yet
  11755. if (codePoint > 0xDBFF) {
  11756. // unexpected trail
  11757. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  11758. continue
  11759. } else if (i + 1 === length) {
  11760. // unpaired lead
  11761. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  11762. continue
  11763. }
  11764. // valid lead
  11765. leadSurrogate = codePoint
  11766. continue
  11767. }
  11768. // 2 leads in a row
  11769. if (codePoint < 0xDC00) {
  11770. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  11771. leadSurrogate = codePoint
  11772. continue
  11773. }
  11774. // valid surrogate pair
  11775. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  11776. } else if (leadSurrogate) {
  11777. // valid bmp char, but last char was a lead
  11778. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  11779. }
  11780. leadSurrogate = null
  11781. // encode utf8
  11782. if (codePoint < 0x80) {
  11783. if ((units -= 1) < 0) break
  11784. bytes.push(codePoint)
  11785. } else if (codePoint < 0x800) {
  11786. if ((units -= 2) < 0) break
  11787. bytes.push(
  11788. codePoint >> 0x6 | 0xC0,
  11789. codePoint & 0x3F | 0x80
  11790. )
  11791. } else if (codePoint < 0x10000) {
  11792. if ((units -= 3) < 0) break
  11793. bytes.push(
  11794. codePoint >> 0xC | 0xE0,
  11795. codePoint >> 0x6 & 0x3F | 0x80,
  11796. codePoint & 0x3F | 0x80
  11797. )
  11798. } else if (codePoint < 0x110000) {
  11799. if ((units -= 4) < 0) break
  11800. bytes.push(
  11801. codePoint >> 0x12 | 0xF0,
  11802. codePoint >> 0xC & 0x3F | 0x80,
  11803. codePoint >> 0x6 & 0x3F | 0x80,
  11804. codePoint & 0x3F | 0x80
  11805. )
  11806. } else {
  11807. throw new Error('Invalid code point')
  11808. }
  11809. }
  11810. return bytes
  11811. }
  11812. function asciiToBytes (str) {
  11813. var byteArray = []
  11814. for (var i = 0; i < str.length; ++i) {
  11815. // Node's code seems to be doing this and not & 0x7F..
  11816. byteArray.push(str.charCodeAt(i) & 0xFF)
  11817. }
  11818. return byteArray
  11819. }
  11820. function utf16leToBytes (str, units) {
  11821. var c, hi, lo
  11822. var byteArray = []
  11823. for (var i = 0; i < str.length; ++i) {
  11824. if ((units -= 2) < 0) break
  11825. c = str.charCodeAt(i)
  11826. hi = c >> 8
  11827. lo = c % 256
  11828. byteArray.push(lo)
  11829. byteArray.push(hi)
  11830. }
  11831. return byteArray
  11832. }
  11833. function base64ToBytes (str) {
  11834. return base64.toByteArray(base64clean(str))
  11835. }
  11836. function blitBuffer (src, dst, offset, length) {
  11837. for (var i = 0; i < length; ++i) {
  11838. if ((i + offset >= dst.length) || (i >= src.length)) break
  11839. dst[i + offset] = src[i]
  11840. }
  11841. return i
  11842. }
  11843. function isnan (val) {
  11844. return val !== val // eslint-disable-line no-self-compare
  11845. }
  11846. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
  11847. /***/ }),
  11848. /* 119 */
  11849. /***/ (function(module, exports, __webpack_require__) {
  11850. "use strict";
  11851. exports.byteLength = byteLength
  11852. exports.toByteArray = toByteArray
  11853. exports.fromByteArray = fromByteArray
  11854. var lookup = []
  11855. var revLookup = []
  11856. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  11857. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  11858. for (var i = 0, len = code.length; i < len; ++i) {
  11859. lookup[i] = code[i]
  11860. revLookup[code.charCodeAt(i)] = i
  11861. }
  11862. // Support decoding URL-safe base64 strings, as Node.js does.
  11863. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  11864. revLookup['-'.charCodeAt(0)] = 62
  11865. revLookup['_'.charCodeAt(0)] = 63
  11866. function getLens (b64) {
  11867. var len = b64.length
  11868. if (len % 4 > 0) {
  11869. throw new Error('Invalid string. Length must be a multiple of 4')
  11870. }
  11871. // Trim off extra bytes after placeholder bytes are found
  11872. // See: https://github.com/beatgammit/base64-js/issues/42
  11873. var validLen = b64.indexOf('=')
  11874. if (validLen === -1) validLen = len
  11875. var placeHoldersLen = validLen === len
  11876. ? 0
  11877. : 4 - (validLen % 4)
  11878. return [validLen, placeHoldersLen]
  11879. }
  11880. // base64 is 4/3 + up to two characters of the original data
  11881. function byteLength (b64) {
  11882. var lens = getLens(b64)
  11883. var validLen = lens[0]
  11884. var placeHoldersLen = lens[1]
  11885. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  11886. }
  11887. function _byteLength (b64, validLen, placeHoldersLen) {
  11888. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  11889. }
  11890. function toByteArray (b64) {
  11891. var tmp
  11892. var lens = getLens(b64)
  11893. var validLen = lens[0]
  11894. var placeHoldersLen = lens[1]
  11895. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  11896. var curByte = 0
  11897. // if there are placeholders, only get up to the last complete 4 chars
  11898. var len = placeHoldersLen > 0
  11899. ? validLen - 4
  11900. : validLen
  11901. for (var i = 0; i < len; i += 4) {
  11902. tmp =
  11903. (revLookup[b64.charCodeAt(i)] << 18) |
  11904. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  11905. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  11906. revLookup[b64.charCodeAt(i + 3)]
  11907. arr[curByte++] = (tmp >> 16) & 0xFF
  11908. arr[curByte++] = (tmp >> 8) & 0xFF
  11909. arr[curByte++] = tmp & 0xFF
  11910. }
  11911. if (placeHoldersLen === 2) {
  11912. tmp =
  11913. (revLookup[b64.charCodeAt(i)] << 2) |
  11914. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  11915. arr[curByte++] = tmp & 0xFF
  11916. }
  11917. if (placeHoldersLen === 1) {
  11918. tmp =
  11919. (revLookup[b64.charCodeAt(i)] << 10) |
  11920. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  11921. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  11922. arr[curByte++] = (tmp >> 8) & 0xFF
  11923. arr[curByte++] = tmp & 0xFF
  11924. }
  11925. return arr
  11926. }
  11927. function tripletToBase64 (num) {
  11928. return lookup[num >> 18 & 0x3F] +
  11929. lookup[num >> 12 & 0x3F] +
  11930. lookup[num >> 6 & 0x3F] +
  11931. lookup[num & 0x3F]
  11932. }
  11933. function encodeChunk (uint8, start, end) {
  11934. var tmp
  11935. var output = []
  11936. for (var i = start; i < end; i += 3) {
  11937. tmp =
  11938. ((uint8[i] << 16) & 0xFF0000) +
  11939. ((uint8[i + 1] << 8) & 0xFF00) +
  11940. (uint8[i + 2] & 0xFF)
  11941. output.push(tripletToBase64(tmp))
  11942. }
  11943. return output.join('')
  11944. }
  11945. function fromByteArray (uint8) {
  11946. var tmp
  11947. var len = uint8.length
  11948. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  11949. var parts = []
  11950. var maxChunkLength = 16383 // must be multiple of 3
  11951. // go through the array every three bytes, we'll deal with trailing stuff later
  11952. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  11953. parts.push(encodeChunk(
  11954. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  11955. ))
  11956. }
  11957. // pad the end with zeros, but make sure to not forget the extra bytes
  11958. if (extraBytes === 1) {
  11959. tmp = uint8[len - 1]
  11960. parts.push(
  11961. lookup[tmp >> 2] +
  11962. lookup[(tmp << 4) & 0x3F] +
  11963. '=='
  11964. )
  11965. } else if (extraBytes === 2) {
  11966. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  11967. parts.push(
  11968. lookup[tmp >> 10] +
  11969. lookup[(tmp >> 4) & 0x3F] +
  11970. lookup[(tmp << 2) & 0x3F] +
  11971. '='
  11972. )
  11973. }
  11974. return parts.join('')
  11975. }
  11976. /***/ }),
  11977. /* 120 */
  11978. /***/ (function(module, exports) {
  11979. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  11980. var e, m
  11981. var eLen = (nBytes * 8) - mLen - 1
  11982. var eMax = (1 << eLen) - 1
  11983. var eBias = eMax >> 1
  11984. var nBits = -7
  11985. var i = isLE ? (nBytes - 1) : 0
  11986. var d = isLE ? -1 : 1
  11987. var s = buffer[offset + i]
  11988. i += d
  11989. e = s & ((1 << (-nBits)) - 1)
  11990. s >>= (-nBits)
  11991. nBits += eLen
  11992. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  11993. m = e & ((1 << (-nBits)) - 1)
  11994. e >>= (-nBits)
  11995. nBits += mLen
  11996. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  11997. if (e === 0) {
  11998. e = 1 - eBias
  11999. } else if (e === eMax) {
  12000. return m ? NaN : ((s ? -1 : 1) * Infinity)
  12001. } else {
  12002. m = m + Math.pow(2, mLen)
  12003. e = e - eBias
  12004. }
  12005. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  12006. }
  12007. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  12008. var e, m, c
  12009. var eLen = (nBytes * 8) - mLen - 1
  12010. var eMax = (1 << eLen) - 1
  12011. var eBias = eMax >> 1
  12012. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  12013. var i = isLE ? 0 : (nBytes - 1)
  12014. var d = isLE ? 1 : -1
  12015. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  12016. value = Math.abs(value)
  12017. if (isNaN(value) || value === Infinity) {
  12018. m = isNaN(value) ? 1 : 0
  12019. e = eMax
  12020. } else {
  12021. e = Math.floor(Math.log(value) / Math.LN2)
  12022. if (value * (c = Math.pow(2, -e)) < 1) {
  12023. e--
  12024. c *= 2
  12025. }
  12026. if (e + eBias >= 1) {
  12027. value += rt / c
  12028. } else {
  12029. value += rt * Math.pow(2, 1 - eBias)
  12030. }
  12031. if (value * c >= 2) {
  12032. e++
  12033. c /= 2
  12034. }
  12035. if (e + eBias >= eMax) {
  12036. m = 0
  12037. e = eMax
  12038. } else if (e + eBias >= 1) {
  12039. m = ((value * c) - 1) * Math.pow(2, mLen)
  12040. e = e + eBias
  12041. } else {
  12042. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  12043. e = 0
  12044. }
  12045. }
  12046. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  12047. e = (e << mLen) | m
  12048. eLen += mLen
  12049. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  12050. buffer[offset + i - d] |= s * 128
  12051. }
  12052. /***/ }),
  12053. /* 121 */
  12054. /***/ (function(module, exports) {
  12055. var toString = {}.toString;
  12056. module.exports = Array.isArray || function (arr) {
  12057. return toString.call(arr) == '[object Array]';
  12058. };
  12059. /***/ }),
  12060. /* 122 */
  12061. /***/ (function(module, exports) {
  12062. var toString = {}.toString;
  12063. module.exports = Array.isArray || function (arr) {
  12064. return toString.call(arr) == '[object Array]';
  12065. };
  12066. /***/ }),
  12067. /* 123 */
  12068. /***/ (function(module, exports) {
  12069. /**
  12070. * An abstraction for slicing an arraybuffer even when
  12071. * ArrayBuffer.prototype.slice is not supported
  12072. *
  12073. * @api public
  12074. */
  12075. module.exports = function(arraybuffer, start, end) {
  12076. var bytes = arraybuffer.byteLength;
  12077. start = start || 0;
  12078. end = end || bytes;
  12079. if (arraybuffer.slice) { return arraybuffer.slice(start, end); }
  12080. if (start < 0) { start += bytes; }
  12081. if (end < 0) { end += bytes; }
  12082. if (end > bytes) { end = bytes; }
  12083. if (start >= bytes || start >= end || bytes === 0) {
  12084. return new ArrayBuffer(0);
  12085. }
  12086. var abv = new Uint8Array(arraybuffer);
  12087. var result = new Uint8Array(end - start);
  12088. for (var i = start, ii = 0; i < end; i++, ii++) {
  12089. result[ii] = abv[i];
  12090. }
  12091. return result.buffer;
  12092. };
  12093. /***/ }),
  12094. /* 124 */
  12095. /***/ (function(module, exports) {
  12096. module.exports = after
  12097. function after(count, callback, err_cb) {
  12098. var bail = false
  12099. err_cb = err_cb || noop
  12100. proxy.count = count
  12101. return (count === 0) ? callback() : proxy
  12102. function proxy(err, result) {
  12103. if (proxy.count <= 0) {
  12104. throw new Error('after called too many times')
  12105. }
  12106. --proxy.count
  12107. // after first error, rest are passed to err_cb
  12108. if (err) {
  12109. bail = true
  12110. callback(err)
  12111. // future error callbacks will go to error handler
  12112. callback = err_cb
  12113. } else if (proxy.count === 0 && !bail) {
  12114. callback(null, result)
  12115. }
  12116. }
  12117. }
  12118. function noop() {}
  12119. /***/ }),
  12120. /* 125 */
  12121. /***/ (function(module, exports, __webpack_require__) {
  12122. /* WEBPACK VAR INJECTION */(function(module, global) {var __WEBPACK_AMD_DEFINE_RESULT__;/*! https://mths.be/utf8js v2.1.2 by @mathias */
  12123. ;(function(root) {
  12124. // Detect free variables `exports`
  12125. var freeExports = typeof exports == 'object' && exports;
  12126. // Detect free variable `module`
  12127. var freeModule = typeof module == 'object' && module &&
  12128. module.exports == freeExports && module;
  12129. // Detect free variable `global`, from Node.js or Browserified code,
  12130. // and use it as `root`
  12131. var freeGlobal = typeof global == 'object' && global;
  12132. if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
  12133. root = freeGlobal;
  12134. }
  12135. /*--------------------------------------------------------------------------*/
  12136. var stringFromCharCode = String.fromCharCode;
  12137. // Taken from https://mths.be/punycode
  12138. function ucs2decode(string) {
  12139. var output = [];
  12140. var counter = 0;
  12141. var length = string.length;
  12142. var value;
  12143. var extra;
  12144. while (counter < length) {
  12145. value = string.charCodeAt(counter++);
  12146. if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
  12147. // high surrogate, and there is a next character
  12148. extra = string.charCodeAt(counter++);
  12149. if ((extra & 0xFC00) == 0xDC00) { // low surrogate
  12150. output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
  12151. } else {
  12152. // unmatched surrogate; only append this code unit, in case the next
  12153. // code unit is the high surrogate of a surrogate pair
  12154. output.push(value);
  12155. counter--;
  12156. }
  12157. } else {
  12158. output.push(value);
  12159. }
  12160. }
  12161. return output;
  12162. }
  12163. // Taken from https://mths.be/punycode
  12164. function ucs2encode(array) {
  12165. var length = array.length;
  12166. var index = -1;
  12167. var value;
  12168. var output = '';
  12169. while (++index < length) {
  12170. value = array[index];
  12171. if (value > 0xFFFF) {
  12172. value -= 0x10000;
  12173. output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
  12174. value = 0xDC00 | value & 0x3FF;
  12175. }
  12176. output += stringFromCharCode(value);
  12177. }
  12178. return output;
  12179. }
  12180. function checkScalarValue(codePoint, strict) {
  12181. if (codePoint >= 0xD800 && codePoint <= 0xDFFF) {
  12182. if (strict) {
  12183. throw Error(
  12184. 'Lone surrogate U+' + codePoint.toString(16).toUpperCase() +
  12185. ' is not a scalar value'
  12186. );
  12187. }
  12188. return false;
  12189. }
  12190. return true;
  12191. }
  12192. /*--------------------------------------------------------------------------*/
  12193. function createByte(codePoint, shift) {
  12194. return stringFromCharCode(((codePoint >> shift) & 0x3F) | 0x80);
  12195. }
  12196. function encodeCodePoint(codePoint, strict) {
  12197. if ((codePoint & 0xFFFFFF80) == 0) { // 1-byte sequence
  12198. return stringFromCharCode(codePoint);
  12199. }
  12200. var symbol = '';
  12201. if ((codePoint & 0xFFFFF800) == 0) { // 2-byte sequence
  12202. symbol = stringFromCharCode(((codePoint >> 6) & 0x1F) | 0xC0);
  12203. }
  12204. else if ((codePoint & 0xFFFF0000) == 0) { // 3-byte sequence
  12205. if (!checkScalarValue(codePoint, strict)) {
  12206. codePoint = 0xFFFD;
  12207. }
  12208. symbol = stringFromCharCode(((codePoint >> 12) & 0x0F) | 0xE0);
  12209. symbol += createByte(codePoint, 6);
  12210. }
  12211. else if ((codePoint & 0xFFE00000) == 0) { // 4-byte sequence
  12212. symbol = stringFromCharCode(((codePoint >> 18) & 0x07) | 0xF0);
  12213. symbol += createByte(codePoint, 12);
  12214. symbol += createByte(codePoint, 6);
  12215. }
  12216. symbol += stringFromCharCode((codePoint & 0x3F) | 0x80);
  12217. return symbol;
  12218. }
  12219. function utf8encode(string, opts) {
  12220. opts = opts || {};
  12221. var strict = false !== opts.strict;
  12222. var codePoints = ucs2decode(string);
  12223. var length = codePoints.length;
  12224. var index = -1;
  12225. var codePoint;
  12226. var byteString = '';
  12227. while (++index < length) {
  12228. codePoint = codePoints[index];
  12229. byteString += encodeCodePoint(codePoint, strict);
  12230. }
  12231. return byteString;
  12232. }
  12233. /*--------------------------------------------------------------------------*/
  12234. function readContinuationByte() {
  12235. if (byteIndex >= byteCount) {
  12236. throw Error('Invalid byte index');
  12237. }
  12238. var continuationByte = byteArray[byteIndex] & 0xFF;
  12239. byteIndex++;
  12240. if ((continuationByte & 0xC0) == 0x80) {
  12241. return continuationByte & 0x3F;
  12242. }
  12243. // If we end up here, it’s not a continuation byte
  12244. throw Error('Invalid continuation byte');
  12245. }
  12246. function decodeSymbol(strict) {
  12247. var byte1;
  12248. var byte2;
  12249. var byte3;
  12250. var byte4;
  12251. var codePoint;
  12252. if (byteIndex > byteCount) {
  12253. throw Error('Invalid byte index');
  12254. }
  12255. if (byteIndex == byteCount) {
  12256. return false;
  12257. }
  12258. // Read first byte
  12259. byte1 = byteArray[byteIndex] & 0xFF;
  12260. byteIndex++;
  12261. // 1-byte sequence (no continuation bytes)
  12262. if ((byte1 & 0x80) == 0) {
  12263. return byte1;
  12264. }
  12265. // 2-byte sequence
  12266. if ((byte1 & 0xE0) == 0xC0) {
  12267. byte2 = readContinuationByte();
  12268. codePoint = ((byte1 & 0x1F) << 6) | byte2;
  12269. if (codePoint >= 0x80) {
  12270. return codePoint;
  12271. } else {
  12272. throw Error('Invalid continuation byte');
  12273. }
  12274. }
  12275. // 3-byte sequence (may include unpaired surrogates)
  12276. if ((byte1 & 0xF0) == 0xE0) {
  12277. byte2 = readContinuationByte();
  12278. byte3 = readContinuationByte();
  12279. codePoint = ((byte1 & 0x0F) << 12) | (byte2 << 6) | byte3;
  12280. if (codePoint >= 0x0800) {
  12281. return checkScalarValue(codePoint, strict) ? codePoint : 0xFFFD;
  12282. } else {
  12283. throw Error('Invalid continuation byte');
  12284. }
  12285. }
  12286. // 4-byte sequence
  12287. if ((byte1 & 0xF8) == 0xF0) {
  12288. byte2 = readContinuationByte();
  12289. byte3 = readContinuationByte();
  12290. byte4 = readContinuationByte();
  12291. codePoint = ((byte1 & 0x07) << 0x12) | (byte2 << 0x0C) |
  12292. (byte3 << 0x06) | byte4;
  12293. if (codePoint >= 0x010000 && codePoint <= 0x10FFFF) {
  12294. return codePoint;
  12295. }
  12296. }
  12297. throw Error('Invalid UTF-8 detected');
  12298. }
  12299. var byteArray;
  12300. var byteCount;
  12301. var byteIndex;
  12302. function utf8decode(byteString, opts) {
  12303. opts = opts || {};
  12304. var strict = false !== opts.strict;
  12305. byteArray = ucs2decode(byteString);
  12306. byteCount = byteArray.length;
  12307. byteIndex = 0;
  12308. var codePoints = [];
  12309. var tmp;
  12310. while ((tmp = decodeSymbol(strict)) !== false) {
  12311. codePoints.push(tmp);
  12312. }
  12313. return ucs2encode(codePoints);
  12314. }
  12315. /*--------------------------------------------------------------------------*/
  12316. var utf8 = {
  12317. 'version': '2.1.2',
  12318. 'encode': utf8encode,
  12319. 'decode': utf8decode
  12320. };
  12321. // Some AMD build optimizers, like r.js, check for specific condition patterns
  12322. // like the following:
  12323. if (
  12324. true
  12325. ) {
  12326. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  12327. return utf8;
  12328. }).call(exports, __webpack_require__, exports, module),
  12329. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  12330. } else if (freeExports && !freeExports.nodeType) {
  12331. if (freeModule) { // in Node.js or RingoJS v0.8.0+
  12332. freeModule.exports = utf8;
  12333. } else { // in Narwhal or RingoJS v0.7.0-
  12334. var object = {};
  12335. var hasOwnProperty = object.hasOwnProperty;
  12336. for (var key in utf8) {
  12337. hasOwnProperty.call(utf8, key) && (freeExports[key] = utf8[key]);
  12338. }
  12339. }
  12340. } else { // in Rhino or a web browser
  12341. root.utf8 = utf8;
  12342. }
  12343. }(this));
  12344. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(126)(module), __webpack_require__(3)))
  12345. /***/ }),
  12346. /* 126 */
  12347. /***/ (function(module, exports) {
  12348. module.exports = function(module) {
  12349. if(!module.webpackPolyfill) {
  12350. module.deprecate = function() {};
  12351. module.paths = [];
  12352. // module.parent = undefined by default
  12353. if(!module.children) module.children = [];
  12354. Object.defineProperty(module, "loaded", {
  12355. enumerable: true,
  12356. get: function() {
  12357. return module.l;
  12358. }
  12359. });
  12360. Object.defineProperty(module, "id", {
  12361. enumerable: true,
  12362. get: function() {
  12363. return module.i;
  12364. }
  12365. });
  12366. module.webpackPolyfill = 1;
  12367. }
  12368. return module;
  12369. };
  12370. /***/ }),
  12371. /* 127 */
  12372. /***/ (function(module, exports) {
  12373. /*
  12374. * base64-arraybuffer
  12375. * https://github.com/niklasvh/base64-arraybuffer
  12376. *
  12377. * Copyright (c) 2012 Niklas von Hertzen
  12378. * Licensed under the MIT license.
  12379. */
  12380. (function(){
  12381. "use strict";
  12382. var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  12383. // Use a lookup table to find the index.
  12384. var lookup = new Uint8Array(256);
  12385. for (var i = 0; i < chars.length; i++) {
  12386. lookup[chars.charCodeAt(i)] = i;
  12387. }
  12388. exports.encode = function(arraybuffer) {
  12389. var bytes = new Uint8Array(arraybuffer),
  12390. i, len = bytes.length, base64 = "";
  12391. for (i = 0; i < len; i+=3) {
  12392. base64 += chars[bytes[i] >> 2];
  12393. base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
  12394. base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
  12395. base64 += chars[bytes[i + 2] & 63];
  12396. }
  12397. if ((len % 3) === 2) {
  12398. base64 = base64.substring(0, base64.length - 1) + "=";
  12399. } else if (len % 3 === 1) {
  12400. base64 = base64.substring(0, base64.length - 2) + "==";
  12401. }
  12402. return base64;
  12403. };
  12404. exports.decode = function(base64) {
  12405. var bufferLength = base64.length * 0.75,
  12406. len = base64.length, i, p = 0,
  12407. encoded1, encoded2, encoded3, encoded4;
  12408. if (base64[base64.length - 1] === "=") {
  12409. bufferLength--;
  12410. if (base64[base64.length - 2] === "=") {
  12411. bufferLength--;
  12412. }
  12413. }
  12414. var arraybuffer = new ArrayBuffer(bufferLength),
  12415. bytes = new Uint8Array(arraybuffer);
  12416. for (i = 0; i < len; i+=4) {
  12417. encoded1 = lookup[base64.charCodeAt(i)];
  12418. encoded2 = lookup[base64.charCodeAt(i+1)];
  12419. encoded3 = lookup[base64.charCodeAt(i+2)];
  12420. encoded4 = lookup[base64.charCodeAt(i+3)];
  12421. bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
  12422. bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
  12423. bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
  12424. }
  12425. return arraybuffer;
  12426. };
  12427. })();
  12428. /***/ }),
  12429. /* 128 */
  12430. /***/ (function(module, exports, __webpack_require__) {
  12431. /* WEBPACK VAR INJECTION */(function(global) {/**
  12432. * Create a blob builder even when vendor prefixes exist
  12433. */
  12434. var BlobBuilder = global.BlobBuilder
  12435. || global.WebKitBlobBuilder
  12436. || global.MSBlobBuilder
  12437. || global.MozBlobBuilder;
  12438. /**
  12439. * Check if Blob constructor is supported
  12440. */
  12441. var blobSupported = (function() {
  12442. try {
  12443. var a = new Blob(['hi']);
  12444. return a.size === 2;
  12445. } catch(e) {
  12446. return false;
  12447. }
  12448. })();
  12449. /**
  12450. * Check if Blob constructor supports ArrayBufferViews
  12451. * Fails in Safari 6, so we need to map to ArrayBuffers there.
  12452. */
  12453. var blobSupportsArrayBufferView = blobSupported && (function() {
  12454. try {
  12455. var b = new Blob([new Uint8Array([1,2])]);
  12456. return b.size === 2;
  12457. } catch(e) {
  12458. return false;
  12459. }
  12460. })();
  12461. /**
  12462. * Check if BlobBuilder is supported
  12463. */
  12464. var blobBuilderSupported = BlobBuilder
  12465. && BlobBuilder.prototype.append
  12466. && BlobBuilder.prototype.getBlob;
  12467. /**
  12468. * Helper function that maps ArrayBufferViews to ArrayBuffers
  12469. * Used by BlobBuilder constructor and old browsers that didn't
  12470. * support it in the Blob constructor.
  12471. */
  12472. function mapArrayBufferViews(ary) {
  12473. for (var i = 0; i < ary.length; i++) {
  12474. var chunk = ary[i];
  12475. if (chunk.buffer instanceof ArrayBuffer) {
  12476. var buf = chunk.buffer;
  12477. // if this is a subarray, make a copy so we only
  12478. // include the subarray region from the underlying buffer
  12479. if (chunk.byteLength !== buf.byteLength) {
  12480. var copy = new Uint8Array(chunk.byteLength);
  12481. copy.set(new Uint8Array(buf, chunk.byteOffset, chunk.byteLength));
  12482. buf = copy.buffer;
  12483. }
  12484. ary[i] = buf;
  12485. }
  12486. }
  12487. }
  12488. function BlobBuilderConstructor(ary, options) {
  12489. options = options || {};
  12490. var bb = new BlobBuilder();
  12491. mapArrayBufferViews(ary);
  12492. for (var i = 0; i < ary.length; i++) {
  12493. bb.append(ary[i]);
  12494. }
  12495. return (options.type) ? bb.getBlob(options.type) : bb.getBlob();
  12496. };
  12497. function BlobConstructor(ary, options) {
  12498. mapArrayBufferViews(ary);
  12499. return new Blob(ary, options || {});
  12500. };
  12501. module.exports = (function() {
  12502. if (blobSupported) {
  12503. return blobSupportsArrayBufferView ? global.Blob : BlobConstructor;
  12504. } else if (blobBuilderSupported) {
  12505. return BlobBuilderConstructor;
  12506. } else {
  12507. return undefined;
  12508. }
  12509. })();
  12510. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
  12511. /***/ }),
  12512. /* 129 */
  12513. /***/ (function(module, exports, __webpack_require__) {
  12514. /**
  12515. * This is the common logic for both the Node.js and web browser
  12516. * implementations of `debug()`.
  12517. *
  12518. * Expose `debug()` as the module.
  12519. */
  12520. exports = module.exports = createDebug.debug = createDebug['default'] = createDebug;
  12521. exports.coerce = coerce;
  12522. exports.disable = disable;
  12523. exports.enable = enable;
  12524. exports.enabled = enabled;
  12525. exports.humanize = __webpack_require__(47);
  12526. /**
  12527. * Active `debug` instances.
  12528. */
  12529. exports.instances = [];
  12530. /**
  12531. * The currently active debug mode names, and names to skip.
  12532. */
  12533. exports.names = [];
  12534. exports.skips = [];
  12535. /**
  12536. * Map of special "%n" handling functions, for the debug "format" argument.
  12537. *
  12538. * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
  12539. */
  12540. exports.formatters = {};
  12541. /**
  12542. * Select a color.
  12543. * @param {String} namespace
  12544. * @return {Number}
  12545. * @api private
  12546. */
  12547. function selectColor(namespace) {
  12548. var hash = 0, i;
  12549. for (i in namespace) {
  12550. hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
  12551. hash |= 0; // Convert to 32bit integer
  12552. }
  12553. return exports.colors[Math.abs(hash) % exports.colors.length];
  12554. }
  12555. /**
  12556. * Create a debugger with the given `namespace`.
  12557. *
  12558. * @param {String} namespace
  12559. * @return {Function}
  12560. * @api public
  12561. */
  12562. function createDebug(namespace) {
  12563. var prevTime;
  12564. function debug() {
  12565. // disabled?
  12566. if (!debug.enabled) return;
  12567. var self = debug;
  12568. // set `diff` timestamp
  12569. var curr = +new Date();
  12570. var ms = curr - (prevTime || curr);
  12571. self.diff = ms;
  12572. self.prev = prevTime;
  12573. self.curr = curr;
  12574. prevTime = curr;
  12575. // turn the `arguments` into a proper Array
  12576. var args = new Array(arguments.length);
  12577. for (var i = 0; i < args.length; i++) {
  12578. args[i] = arguments[i];
  12579. }
  12580. args[0] = exports.coerce(args[0]);
  12581. if ('string' !== typeof args[0]) {
  12582. // anything else let's inspect with %O
  12583. args.unshift('%O');
  12584. }
  12585. // apply any `formatters` transformations
  12586. var index = 0;
  12587. args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) {
  12588. // if we encounter an escaped % then don't increase the array index
  12589. if (match === '%%') return match;
  12590. index++;
  12591. var formatter = exports.formatters[format];
  12592. if ('function' === typeof formatter) {
  12593. var val = args[index];
  12594. match = formatter.call(self, val);
  12595. // now we need to remove `args[index]` since it's inlined in the `format`
  12596. args.splice(index, 1);
  12597. index--;
  12598. }
  12599. return match;
  12600. });
  12601. // apply env-specific formatting (colors, etc.)
  12602. exports.formatArgs.call(self, args);
  12603. var logFn = debug.log || exports.log || console.log.bind(console);
  12604. logFn.apply(self, args);
  12605. }
  12606. debug.namespace = namespace;
  12607. debug.enabled = exports.enabled(namespace);
  12608. debug.useColors = exports.useColors();
  12609. debug.color = selectColor(namespace);
  12610. debug.destroy = destroy;
  12611. // env-specific initialization logic for debug instances
  12612. if ('function' === typeof exports.init) {
  12613. exports.init(debug);
  12614. }
  12615. exports.instances.push(debug);
  12616. return debug;
  12617. }
  12618. function destroy () {
  12619. var index = exports.instances.indexOf(this);
  12620. if (index !== -1) {
  12621. exports.instances.splice(index, 1);
  12622. return true;
  12623. } else {
  12624. return false;
  12625. }
  12626. }
  12627. /**
  12628. * Enables a debug mode by namespaces. This can include modes
  12629. * separated by a colon and wildcards.
  12630. *
  12631. * @param {String} namespaces
  12632. * @api public
  12633. */
  12634. function enable(namespaces) {
  12635. exports.save(namespaces);
  12636. exports.names = [];
  12637. exports.skips = [];
  12638. var i;
  12639. var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/);
  12640. var len = split.length;
  12641. for (i = 0; i < len; i++) {
  12642. if (!split[i]) continue; // ignore empty strings
  12643. namespaces = split[i].replace(/\*/g, '.*?');
  12644. if (namespaces[0] === '-') {
  12645. exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));
  12646. } else {
  12647. exports.names.push(new RegExp('^' + namespaces + '$'));
  12648. }
  12649. }
  12650. for (i = 0; i < exports.instances.length; i++) {
  12651. var instance = exports.instances[i];
  12652. instance.enabled = exports.enabled(instance.namespace);
  12653. }
  12654. }
  12655. /**
  12656. * Disable debug output.
  12657. *
  12658. * @api public
  12659. */
  12660. function disable() {
  12661. exports.enable('');
  12662. }
  12663. /**
  12664. * Returns true if the given mode name is enabled, false otherwise.
  12665. *
  12666. * @param {String} name
  12667. * @return {Boolean}
  12668. * @api public
  12669. */
  12670. function enabled(name) {
  12671. if (name[name.length - 1] === '*') {
  12672. return true;
  12673. }
  12674. var i, len;
  12675. for (i = 0, len = exports.skips.length; i < len; i++) {
  12676. if (exports.skips[i].test(name)) {
  12677. return false;
  12678. }
  12679. }
  12680. for (i = 0, len = exports.names.length; i < len; i++) {
  12681. if (exports.names[i].test(name)) {
  12682. return true;
  12683. }
  12684. }
  12685. return false;
  12686. }
  12687. /**
  12688. * Coerce `val`.
  12689. *
  12690. * @param {Mixed} val
  12691. * @return {Mixed}
  12692. * @api private
  12693. */
  12694. function coerce(val) {
  12695. if (val instanceof Error) return val.stack || val.message;
  12696. return val;
  12697. }
  12698. /***/ }),
  12699. /* 130 */
  12700. /***/ (function(module, exports, __webpack_require__) {
  12701. /* WEBPACK VAR INJECTION */(function(global) {
  12702. /**
  12703. * Module requirements.
  12704. */
  12705. var Polling = __webpack_require__(65);
  12706. var inherit = __webpack_require__(35);
  12707. /**
  12708. * Module exports.
  12709. */
  12710. module.exports = JSONPPolling;
  12711. /**
  12712. * Cached regular expressions.
  12713. */
  12714. var rNewline = /\n/g;
  12715. var rEscapedNewline = /\\n/g;
  12716. /**
  12717. * Global JSONP callbacks.
  12718. */
  12719. var callbacks;
  12720. /**
  12721. * Noop.
  12722. */
  12723. function empty () { }
  12724. /**
  12725. * JSONP Polling constructor.
  12726. *
  12727. * @param {Object} opts.
  12728. * @api public
  12729. */
  12730. function JSONPPolling (opts) {
  12731. Polling.call(this, opts);
  12732. this.query = this.query || {};
  12733. // define global callbacks array if not present
  12734. // we do this here (lazily) to avoid unneeded global pollution
  12735. if (!callbacks) {
  12736. // we need to consider multiple engines in the same page
  12737. if (!global.___eio) global.___eio = [];
  12738. callbacks = global.___eio;
  12739. }
  12740. // callback identifier
  12741. this.index = callbacks.length;
  12742. // add callback to jsonp global
  12743. var self = this;
  12744. callbacks.push(function (msg) {
  12745. self.onData(msg);
  12746. });
  12747. // append to query string
  12748. this.query.j = this.index;
  12749. // prevent spurious errors from being emitted when the window is unloaded
  12750. if (global.document && global.addEventListener) {
  12751. global.addEventListener('beforeunload', function () {
  12752. if (self.script) self.script.onerror = empty;
  12753. }, false);
  12754. }
  12755. }
  12756. /**
  12757. * Inherits from Polling.
  12758. */
  12759. inherit(JSONPPolling, Polling);
  12760. /*
  12761. * JSONP only supports binary as base64 encoded strings
  12762. */
  12763. JSONPPolling.prototype.supportsBinary = false;
  12764. /**
  12765. * Closes the socket.
  12766. *
  12767. * @api private
  12768. */
  12769. JSONPPolling.prototype.doClose = function () {
  12770. if (this.script) {
  12771. this.script.parentNode.removeChild(this.script);
  12772. this.script = null;
  12773. }
  12774. if (this.form) {
  12775. this.form.parentNode.removeChild(this.form);
  12776. this.form = null;
  12777. this.iframe = null;
  12778. }
  12779. Polling.prototype.doClose.call(this);
  12780. };
  12781. /**
  12782. * Starts a poll cycle.
  12783. *
  12784. * @api private
  12785. */
  12786. JSONPPolling.prototype.doPoll = function () {
  12787. var self = this;
  12788. var script = document.createElement('script');
  12789. if (this.script) {
  12790. this.script.parentNode.removeChild(this.script);
  12791. this.script = null;
  12792. }
  12793. script.async = true;
  12794. script.src = this.uri();
  12795. script.onerror = function (e) {
  12796. self.onError('jsonp poll error', e);
  12797. };
  12798. var insertAt = document.getElementsByTagName('script')[0];
  12799. if (insertAt) {
  12800. insertAt.parentNode.insertBefore(script, insertAt);
  12801. } else {
  12802. (document.head || document.body).appendChild(script);
  12803. }
  12804. this.script = script;
  12805. var isUAgecko = 'undefined' !== typeof navigator && /gecko/i.test(navigator.userAgent);
  12806. if (isUAgecko) {
  12807. setTimeout(function () {
  12808. var iframe = document.createElement('iframe');
  12809. document.body.appendChild(iframe);
  12810. document.body.removeChild(iframe);
  12811. }, 100);
  12812. }
  12813. };
  12814. /**
  12815. * Writes with a hidden iframe.
  12816. *
  12817. * @param {String} data to send
  12818. * @param {Function} called upon flush.
  12819. * @api private
  12820. */
  12821. JSONPPolling.prototype.doWrite = function (data, fn) {
  12822. var self = this;
  12823. if (!this.form) {
  12824. var form = document.createElement('form');
  12825. var area = document.createElement('textarea');
  12826. var id = this.iframeId = 'eio_iframe_' + this.index;
  12827. var iframe;
  12828. form.className = 'socketio';
  12829. form.style.position = 'absolute';
  12830. form.style.top = '-1000px';
  12831. form.style.left = '-1000px';
  12832. form.target = id;
  12833. form.method = 'POST';
  12834. form.setAttribute('accept-charset', 'utf-8');
  12835. area.name = 'd';
  12836. form.appendChild(area);
  12837. document.body.appendChild(form);
  12838. this.form = form;
  12839. this.area = area;
  12840. }
  12841. this.form.action = this.uri();
  12842. function complete () {
  12843. initIframe();
  12844. fn();
  12845. }
  12846. function initIframe () {
  12847. if (self.iframe) {
  12848. try {
  12849. self.form.removeChild(self.iframe);
  12850. } catch (e) {
  12851. self.onError('jsonp polling iframe removal error', e);
  12852. }
  12853. }
  12854. try {
  12855. // ie6 dynamic iframes with target="" support (thanks Chris Lambacher)
  12856. var html = '<iframe src="javascript:0" name="' + self.iframeId + '">';
  12857. iframe = document.createElement(html);
  12858. } catch (e) {
  12859. iframe = document.createElement('iframe');
  12860. iframe.name = self.iframeId;
  12861. iframe.src = 'javascript:0';
  12862. }
  12863. iframe.id = self.iframeId;
  12864. self.form.appendChild(iframe);
  12865. self.iframe = iframe;
  12866. }
  12867. initIframe();
  12868. // escape \n to prevent it from being converted into \r\n by some UAs
  12869. // double escaping is required for escaped new lines because unescaping of new lines can be done safely on server-side
  12870. data = data.replace(rEscapedNewline, '\\\n');
  12871. this.area.value = data.replace(rNewline, '\\n');
  12872. try {
  12873. this.form.submit();
  12874. } catch (e) {}
  12875. if (this.iframe.attachEvent) {
  12876. this.iframe.onreadystatechange = function () {
  12877. if (self.iframe.readyState === 'complete') {
  12878. complete();
  12879. }
  12880. };
  12881. } else {
  12882. this.iframe.onload = complete;
  12883. }
  12884. };
  12885. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
  12886. /***/ }),
  12887. /* 131 */
  12888. /***/ (function(module, exports, __webpack_require__) {
  12889. /* WEBPACK VAR INJECTION */(function(global) {/**
  12890. * Module dependencies.
  12891. */
  12892. var Transport = __webpack_require__(50);
  12893. var parser = __webpack_require__(19);
  12894. var parseqs = __webpack_require__(34);
  12895. var inherit = __webpack_require__(35);
  12896. var yeast = __webpack_require__(67);
  12897. var debug = __webpack_require__(36)('engine.io-client:websocket');
  12898. var BrowserWebSocket = global.WebSocket || global.MozWebSocket;
  12899. var NodeWebSocket;
  12900. if (typeof window === 'undefined') {
  12901. try {
  12902. NodeWebSocket = __webpack_require__(132);
  12903. } catch (e) { }
  12904. }
  12905. /**
  12906. * Get either the `WebSocket` or `MozWebSocket` globals
  12907. * in the browser or try to resolve WebSocket-compatible
  12908. * interface exposed by `ws` for Node-like environment.
  12909. */
  12910. var WebSocket = BrowserWebSocket;
  12911. if (!WebSocket && typeof window === 'undefined') {
  12912. WebSocket = NodeWebSocket;
  12913. }
  12914. /**
  12915. * Module exports.
  12916. */
  12917. module.exports = WS;
  12918. /**
  12919. * WebSocket transport constructor.
  12920. *
  12921. * @api {Object} connection options
  12922. * @api public
  12923. */
  12924. function WS (opts) {
  12925. var forceBase64 = (opts && opts.forceBase64);
  12926. if (forceBase64) {
  12927. this.supportsBinary = false;
  12928. }
  12929. this.perMessageDeflate = opts.perMessageDeflate;
  12930. this.usingBrowserWebSocket = BrowserWebSocket && !opts.forceNode;
  12931. this.protocols = opts.protocols;
  12932. if (!this.usingBrowserWebSocket) {
  12933. WebSocket = NodeWebSocket;
  12934. }
  12935. Transport.call(this, opts);
  12936. }
  12937. /**
  12938. * Inherits from Transport.
  12939. */
  12940. inherit(WS, Transport);
  12941. /**
  12942. * Transport name.
  12943. *
  12944. * @api public
  12945. */
  12946. WS.prototype.name = 'websocket';
  12947. /*
  12948. * WebSockets support binary
  12949. */
  12950. WS.prototype.supportsBinary = true;
  12951. /**
  12952. * Opens socket.
  12953. *
  12954. * @api private
  12955. */
  12956. WS.prototype.doOpen = function () {
  12957. if (!this.check()) {
  12958. // let probe timeout
  12959. return;
  12960. }
  12961. var uri = this.uri();
  12962. var protocols = this.protocols;
  12963. var opts = {
  12964. agent: this.agent,
  12965. perMessageDeflate: this.perMessageDeflate
  12966. };
  12967. // SSL options for Node.js client
  12968. opts.pfx = this.pfx;
  12969. opts.key = this.key;
  12970. opts.passphrase = this.passphrase;
  12971. opts.cert = this.cert;
  12972. opts.ca = this.ca;
  12973. opts.ciphers = this.ciphers;
  12974. opts.rejectUnauthorized = this.rejectUnauthorized;
  12975. if (this.extraHeaders) {
  12976. opts.headers = this.extraHeaders;
  12977. }
  12978. if (this.localAddress) {
  12979. opts.localAddress = this.localAddress;
  12980. }
  12981. try {
  12982. this.ws = this.usingBrowserWebSocket ? (protocols ? new WebSocket(uri, protocols) : new WebSocket(uri)) : new WebSocket(uri, protocols, opts);
  12983. } catch (err) {
  12984. return this.emit('error', err);
  12985. }
  12986. if (this.ws.binaryType === undefined) {
  12987. this.supportsBinary = false;
  12988. }
  12989. if (this.ws.supports && this.ws.supports.binary) {
  12990. this.supportsBinary = true;
  12991. this.ws.binaryType = 'nodebuffer';
  12992. } else {
  12993. this.ws.binaryType = 'arraybuffer';
  12994. }
  12995. this.addEventListeners();
  12996. };
  12997. /**
  12998. * Adds event listeners to the socket
  12999. *
  13000. * @api private
  13001. */
  13002. WS.prototype.addEventListeners = function () {
  13003. var self = this;
  13004. this.ws.onopen = function () {
  13005. self.onOpen();
  13006. };
  13007. this.ws.onclose = function () {
  13008. self.onClose();
  13009. };
  13010. this.ws.onmessage = function (ev) {
  13011. self.onData(ev.data);
  13012. };
  13013. this.ws.onerror = function (e) {
  13014. self.onError('websocket error', e);
  13015. };
  13016. };
  13017. /**
  13018. * Writes data to socket.
  13019. *
  13020. * @param {Array} array of packets.
  13021. * @api private
  13022. */
  13023. WS.prototype.write = function (packets) {
  13024. var self = this;
  13025. this.writable = false;
  13026. // encodePacket efficient as it uses WS framing
  13027. // no need for encodePayload
  13028. var total = packets.length;
  13029. for (var i = 0, l = total; i < l; i++) {
  13030. (function (packet) {
  13031. parser.encodePacket(packet, self.supportsBinary, function (data) {
  13032. if (!self.usingBrowserWebSocket) {
  13033. // always create a new object (GH-437)
  13034. var opts = {};
  13035. if (packet.options) {
  13036. opts.compress = packet.options.compress;
  13037. }
  13038. if (self.perMessageDeflate) {
  13039. var len = 'string' === typeof data ? global.Buffer.byteLength(data) : data.length;
  13040. if (len < self.perMessageDeflate.threshold) {
  13041. opts.compress = false;
  13042. }
  13043. }
  13044. }
  13045. // Sometimes the websocket has already been closed but the browser didn't
  13046. // have a chance of informing us about it yet, in that case send will
  13047. // throw an error
  13048. try {
  13049. if (self.usingBrowserWebSocket) {
  13050. // TypeError is thrown when passing the second argument on Safari
  13051. self.ws.send(data);
  13052. } else {
  13053. self.ws.send(data, opts);
  13054. }
  13055. } catch (e) {
  13056. debug('websocket closed before onclose event');
  13057. }
  13058. --total || done();
  13059. });
  13060. })(packets[i]);
  13061. }
  13062. function done () {
  13063. self.emit('flush');
  13064. // fake drain
  13065. // defer to next tick to allow Socket to clear writeBuffer
  13066. setTimeout(function () {
  13067. self.writable = true;
  13068. self.emit('drain');
  13069. }, 0);
  13070. }
  13071. };
  13072. /**
  13073. * Called upon close
  13074. *
  13075. * @api private
  13076. */
  13077. WS.prototype.onClose = function () {
  13078. Transport.prototype.onClose.call(this);
  13079. };
  13080. /**
  13081. * Closes socket.
  13082. *
  13083. * @api private
  13084. */
  13085. WS.prototype.doClose = function () {
  13086. if (typeof this.ws !== 'undefined') {
  13087. this.ws.close();
  13088. }
  13089. };
  13090. /**
  13091. * Generates uri for connection.
  13092. *
  13093. * @api private
  13094. */
  13095. WS.prototype.uri = function () {
  13096. var query = this.query || {};
  13097. var schema = this.secure ? 'wss' : 'ws';
  13098. var port = '';
  13099. // avoid port if default for schema
  13100. if (this.port && (('wss' === schema && Number(this.port) !== 443) ||
  13101. ('ws' === schema && Number(this.port) !== 80))) {
  13102. port = ':' + this.port;
  13103. }
  13104. // append timestamp to URI
  13105. if (this.timestampRequests) {
  13106. query[this.timestampParam] = yeast();
  13107. }
  13108. // communicate binary support capabilities
  13109. if (!this.supportsBinary) {
  13110. query.b64 = 1;
  13111. }
  13112. query = parseqs.encode(query);
  13113. // prepend ? to query
  13114. if (query.length) {
  13115. query = '?' + query;
  13116. }
  13117. var ipv6 = this.hostname.indexOf(':') !== -1;
  13118. return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query;
  13119. };
  13120. /**
  13121. * Feature detection for WebSocket.
  13122. *
  13123. * @return {Boolean} whether this transport is available.
  13124. * @api public
  13125. */
  13126. WS.prototype.check = function () {
  13127. return !!WebSocket && !('__initialize' in WebSocket && this.name === WS.prototype.name);
  13128. };
  13129. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)))
  13130. /***/ }),
  13131. /* 132 */
  13132. /***/ (function(module, exports) {
  13133. /* (ignored) */
  13134. /***/ }),
  13135. /* 133 */
  13136. /***/ (function(module, exports) {
  13137. module.exports = toArray
  13138. function toArray(list, index) {
  13139. var array = []
  13140. index = index || 0
  13141. for (var i = index || 0; i < list.length; i++) {
  13142. array[i - index] = list[i]
  13143. }
  13144. return array
  13145. }
  13146. /***/ }),
  13147. /* 134 */
  13148. /***/ (function(module, exports) {
  13149. /**
  13150. * Expose `Backoff`.
  13151. */
  13152. module.exports = Backoff;
  13153. /**
  13154. * Initialize backoff timer with `opts`.
  13155. *
  13156. * - `min` initial timeout in milliseconds [100]
  13157. * - `max` max timeout [10000]
  13158. * - `jitter` [0]
  13159. * - `factor` [2]
  13160. *
  13161. * @param {Object} opts
  13162. * @api public
  13163. */
  13164. function Backoff(opts) {
  13165. opts = opts || {};
  13166. this.ms = opts.min || 100;
  13167. this.max = opts.max || 10000;
  13168. this.factor = opts.factor || 2;
  13169. this.jitter = opts.jitter > 0 && opts.jitter <= 1 ? opts.jitter : 0;
  13170. this.attempts = 0;
  13171. }
  13172. /**
  13173. * Return the backoff duration.
  13174. *
  13175. * @return {Number}
  13176. * @api public
  13177. */
  13178. Backoff.prototype.duration = function(){
  13179. var ms = this.ms * Math.pow(this.factor, this.attempts++);
  13180. if (this.jitter) {
  13181. var rand = Math.random();
  13182. var deviation = Math.floor(rand * this.jitter * ms);
  13183. ms = (Math.floor(rand * 10) & 1) == 0 ? ms - deviation : ms + deviation;
  13184. }
  13185. return Math.min(ms, this.max) | 0;
  13186. };
  13187. /**
  13188. * Reset the number of attempts.
  13189. *
  13190. * @api public
  13191. */
  13192. Backoff.prototype.reset = function(){
  13193. this.attempts = 0;
  13194. };
  13195. /**
  13196. * Set the minimum duration
  13197. *
  13198. * @api public
  13199. */
  13200. Backoff.prototype.setMin = function(min){
  13201. this.ms = min;
  13202. };
  13203. /**
  13204. * Set the maximum duration
  13205. *
  13206. * @api public
  13207. */
  13208. Backoff.prototype.setMax = function(max){
  13209. this.max = max;
  13210. };
  13211. /**
  13212. * Set the jitter
  13213. *
  13214. * @api public
  13215. */
  13216. Backoff.prototype.setJitter = function(jitter){
  13217. this.jitter = jitter;
  13218. };
  13219. /***/ }),
  13220. /* 135 */
  13221. /***/ (function(module, exports, __webpack_require__) {
  13222. "use strict";
  13223. var __extends = (this && this.__extends) || function (d, b) {
  13224. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  13225. function __() { this.constructor = d; }
  13226. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13227. };
  13228. var Subscription_1 = __webpack_require__(13);
  13229. /**
  13230. * We need this JSDoc comment for affecting ESDoc.
  13231. * @ignore
  13232. * @extends {Ignored}
  13233. */
  13234. var SubjectSubscription = (function (_super) {
  13235. __extends(SubjectSubscription, _super);
  13236. function SubjectSubscription(subject, subscriber) {
  13237. _super.call(this);
  13238. this.subject = subject;
  13239. this.subscriber = subscriber;
  13240. this.closed = false;
  13241. }
  13242. SubjectSubscription.prototype.unsubscribe = function () {
  13243. if (this.closed) {
  13244. return;
  13245. }
  13246. this.closed = true;
  13247. var subject = this.subject;
  13248. var observers = subject.observers;
  13249. this.subject = null;
  13250. if (!observers || observers.length === 0 || subject.isStopped || subject.closed) {
  13251. return;
  13252. }
  13253. var subscriberIndex = observers.indexOf(this.subscriber);
  13254. if (subscriberIndex !== -1) {
  13255. observers.splice(subscriberIndex, 1);
  13256. }
  13257. };
  13258. return SubjectSubscription;
  13259. }(Subscription_1.Subscription));
  13260. exports.SubjectSubscription = SubjectSubscription;
  13261. //# sourceMappingURL=SubjectSubscription.js.map
  13262. /***/ }),
  13263. /* 136 */
  13264. /***/ (function(module, exports, __webpack_require__) {
  13265. "use strict";
  13266. var ConnectableObservable_1 = __webpack_require__(137);
  13267. /* tslint:enable:max-line-length */
  13268. /**
  13269. * Returns an Observable that emits the results of invoking a specified selector on items
  13270. * emitted by a ConnectableObservable that shares a single subscription to the underlying stream.
  13271. *
  13272. * <img src="./img/multicast.png" width="100%">
  13273. *
  13274. * @param {Function|Subject} subjectOrSubjectFactory - Factory function to create an intermediate subject through
  13275. * which the source sequence's elements will be multicast to the selector function
  13276. * or Subject to push source elements into.
  13277. * @param {Function} [selector] - Optional selector function that can use the multicasted source stream
  13278. * as many times as needed, without causing multiple subscriptions to the source stream.
  13279. * Subscribers to the given source will receive all notifications of the source from the
  13280. * time of the subscription forward.
  13281. * @return {Observable} An Observable that emits the results of invoking the selector
  13282. * on the items emitted by a `ConnectableObservable` that shares a single subscription to
  13283. * the underlying stream.
  13284. * @method multicast
  13285. * @owner Observable
  13286. */
  13287. function multicast(subjectOrSubjectFactory, selector) {
  13288. return function multicastOperatorFunction(source) {
  13289. var subjectFactory;
  13290. if (typeof subjectOrSubjectFactory === 'function') {
  13291. subjectFactory = subjectOrSubjectFactory;
  13292. }
  13293. else {
  13294. subjectFactory = function subjectFactory() {
  13295. return subjectOrSubjectFactory;
  13296. };
  13297. }
  13298. if (typeof selector === 'function') {
  13299. return source.lift(new MulticastOperator(subjectFactory, selector));
  13300. }
  13301. var connectable = Object.create(source, ConnectableObservable_1.connectableObservableDescriptor);
  13302. connectable.source = source;
  13303. connectable.subjectFactory = subjectFactory;
  13304. return connectable;
  13305. };
  13306. }
  13307. exports.multicast = multicast;
  13308. var MulticastOperator = (function () {
  13309. function MulticastOperator(subjectFactory, selector) {
  13310. this.subjectFactory = subjectFactory;
  13311. this.selector = selector;
  13312. }
  13313. MulticastOperator.prototype.call = function (subscriber, source) {
  13314. var selector = this.selector;
  13315. var subject = this.subjectFactory();
  13316. var subscription = selector(subject).subscribe(subscriber);
  13317. subscription.add(source.subscribe(subject));
  13318. return subscription;
  13319. };
  13320. return MulticastOperator;
  13321. }());
  13322. exports.MulticastOperator = MulticastOperator;
  13323. //# sourceMappingURL=multicast.js.map
  13324. /***/ }),
  13325. /* 137 */
  13326. /***/ (function(module, exports, __webpack_require__) {
  13327. "use strict";
  13328. var __extends = (this && this.__extends) || function (d, b) {
  13329. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  13330. function __() { this.constructor = d; }
  13331. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13332. };
  13333. var Subject_1 = __webpack_require__(37);
  13334. var Observable_1 = __webpack_require__(1);
  13335. var Subscriber_1 = __webpack_require__(4);
  13336. var Subscription_1 = __webpack_require__(13);
  13337. var refCount_1 = __webpack_require__(74);
  13338. /**
  13339. * @class ConnectableObservable<T>
  13340. */
  13341. var ConnectableObservable = (function (_super) {
  13342. __extends(ConnectableObservable, _super);
  13343. function ConnectableObservable(/** @deprecated internal use only */ source,
  13344. /** @deprecated internal use only */ subjectFactory) {
  13345. _super.call(this);
  13346. this.source = source;
  13347. this.subjectFactory = subjectFactory;
  13348. /** @deprecated internal use only */ this._refCount = 0;
  13349. this._isComplete = false;
  13350. }
  13351. /** @deprecated internal use only */ ConnectableObservable.prototype._subscribe = function (subscriber) {
  13352. return this.getSubject().subscribe(subscriber);
  13353. };
  13354. /** @deprecated internal use only */ ConnectableObservable.prototype.getSubject = function () {
  13355. var subject = this._subject;
  13356. if (!subject || subject.isStopped) {
  13357. this._subject = this.subjectFactory();
  13358. }
  13359. return this._subject;
  13360. };
  13361. ConnectableObservable.prototype.connect = function () {
  13362. var connection = this._connection;
  13363. if (!connection) {
  13364. this._isComplete = false;
  13365. connection = this._connection = new Subscription_1.Subscription();
  13366. connection.add(this.source
  13367. .subscribe(new ConnectableSubscriber(this.getSubject(), this)));
  13368. if (connection.closed) {
  13369. this._connection = null;
  13370. connection = Subscription_1.Subscription.EMPTY;
  13371. }
  13372. else {
  13373. this._connection = connection;
  13374. }
  13375. }
  13376. return connection;
  13377. };
  13378. ConnectableObservable.prototype.refCount = function () {
  13379. return refCount_1.refCount()(this);
  13380. };
  13381. return ConnectableObservable;
  13382. }(Observable_1.Observable));
  13383. exports.ConnectableObservable = ConnectableObservable;
  13384. var connectableProto = ConnectableObservable.prototype;
  13385. exports.connectableObservableDescriptor = {
  13386. operator: { value: null },
  13387. _refCount: { value: 0, writable: true },
  13388. _subject: { value: null, writable: true },
  13389. _connection: { value: null, writable: true },
  13390. _subscribe: { value: connectableProto._subscribe },
  13391. _isComplete: { value: connectableProto._isComplete, writable: true },
  13392. getSubject: { value: connectableProto.getSubject },
  13393. connect: { value: connectableProto.connect },
  13394. refCount: { value: connectableProto.refCount }
  13395. };
  13396. var ConnectableSubscriber = (function (_super) {
  13397. __extends(ConnectableSubscriber, _super);
  13398. function ConnectableSubscriber(destination, connectable) {
  13399. _super.call(this, destination);
  13400. this.connectable = connectable;
  13401. }
  13402. ConnectableSubscriber.prototype._error = function (err) {
  13403. this._unsubscribe();
  13404. _super.prototype._error.call(this, err);
  13405. };
  13406. ConnectableSubscriber.prototype._complete = function () {
  13407. this.connectable._isComplete = true;
  13408. this._unsubscribe();
  13409. _super.prototype._complete.call(this);
  13410. };
  13411. /** @deprecated internal use only */ ConnectableSubscriber.prototype._unsubscribe = function () {
  13412. var connectable = this.connectable;
  13413. if (connectable) {
  13414. this.connectable = null;
  13415. var connection = connectable._connection;
  13416. connectable._refCount = 0;
  13417. connectable._subject = null;
  13418. connectable._connection = null;
  13419. if (connection) {
  13420. connection.unsubscribe();
  13421. }
  13422. }
  13423. };
  13424. return ConnectableSubscriber;
  13425. }(Subject_1.SubjectSubscriber));
  13426. var RefCountOperator = (function () {
  13427. function RefCountOperator(connectable) {
  13428. this.connectable = connectable;
  13429. }
  13430. RefCountOperator.prototype.call = function (subscriber, source) {
  13431. var connectable = this.connectable;
  13432. connectable._refCount++;
  13433. var refCounter = new RefCountSubscriber(subscriber, connectable);
  13434. var subscription = source.subscribe(refCounter);
  13435. if (!refCounter.closed) {
  13436. refCounter.connection = connectable.connect();
  13437. }
  13438. return subscription;
  13439. };
  13440. return RefCountOperator;
  13441. }());
  13442. var RefCountSubscriber = (function (_super) {
  13443. __extends(RefCountSubscriber, _super);
  13444. function RefCountSubscriber(destination, connectable) {
  13445. _super.call(this, destination);
  13446. this.connectable = connectable;
  13447. }
  13448. /** @deprecated internal use only */ RefCountSubscriber.prototype._unsubscribe = function () {
  13449. var connectable = this.connectable;
  13450. if (!connectable) {
  13451. this.connection = null;
  13452. return;
  13453. }
  13454. this.connectable = null;
  13455. var refCount = connectable._refCount;
  13456. if (refCount <= 0) {
  13457. this.connection = null;
  13458. return;
  13459. }
  13460. connectable._refCount = refCount - 1;
  13461. if (refCount > 1) {
  13462. this.connection = null;
  13463. return;
  13464. }
  13465. ///
  13466. // Compare the local RefCountSubscriber's connection Subscription to the
  13467. // connection Subscription on the shared ConnectableObservable. In cases
  13468. // where the ConnectableObservable source synchronously emits values, and
  13469. // the RefCountSubscriber's downstream Observers synchronously unsubscribe,
  13470. // execution continues to here before the RefCountOperator has a chance to
  13471. // supply the RefCountSubscriber with the shared connection Subscription.
  13472. // For example:
  13473. // ```
  13474. // Observable.range(0, 10)
  13475. // .publish()
  13476. // .refCount()
  13477. // .take(5)
  13478. // .subscribe();
  13479. // ```
  13480. // In order to account for this case, RefCountSubscriber should only dispose
  13481. // the ConnectableObservable's shared connection Subscription if the
  13482. // connection Subscription exists, *and* either:
  13483. // a. RefCountSubscriber doesn't have a reference to the shared connection
  13484. // Subscription yet, or,
  13485. // b. RefCountSubscriber's connection Subscription reference is identical
  13486. // to the shared connection Subscription
  13487. ///
  13488. var connection = this.connection;
  13489. var sharedConnection = connectable._connection;
  13490. this.connection = null;
  13491. if (sharedConnection && (!connection || sharedConnection === connection)) {
  13492. sharedConnection.unsubscribe();
  13493. }
  13494. };
  13495. return RefCountSubscriber;
  13496. }(Subscriber_1.Subscriber));
  13497. //# sourceMappingURL=ConnectableObservable.js.map
  13498. /***/ }),
  13499. /* 138 */
  13500. /***/ (function(module, exports, __webpack_require__) {
  13501. "use strict";
  13502. Object.defineProperty(exports, "__esModule", { value: true });
  13503. var BehaviorSubject_1 = __webpack_require__(14);
  13504. var styles = {
  13505. display: "none",
  13506. padding: "15px",
  13507. fontFamily: "sans-serif",
  13508. position: "fixed",
  13509. fontSize: "0.9em",
  13510. zIndex: 9999,
  13511. right: 0,
  13512. top: 0,
  13513. borderBottomLeftRadius: "5px",
  13514. backgroundColor: "#1B2032",
  13515. margin: 0,
  13516. color: "white",
  13517. textAlign: "center",
  13518. pointerEvents: "none"
  13519. };
  13520. /**
  13521. * @param {IBrowserSyncOptions} options
  13522. * @returns {BehaviorSubject<any>}
  13523. */
  13524. function initNotify(options) {
  13525. var cssStyles = styles;
  13526. var elem;
  13527. if (options.notify.styles) {
  13528. if (Object.prototype.toString.call(options.notify.styles) ===
  13529. "[object Array]") {
  13530. // handle original array behavior, replace all styles with a joined copy
  13531. cssStyles = options.notify.styles.join(";");
  13532. }
  13533. else {
  13534. for (var key in options.notify.styles) {
  13535. if (options.notify.styles.hasOwnProperty(key)) {
  13536. cssStyles[key] = options.notify.styles[key];
  13537. }
  13538. }
  13539. }
  13540. }
  13541. elem = document.createElement("DIV");
  13542. elem.id = "__bs_notify__";
  13543. if (typeof cssStyles === "string") {
  13544. elem.style.cssText = cssStyles;
  13545. }
  13546. else {
  13547. for (var rule in cssStyles) {
  13548. elem.style[rule] = cssStyles[rule];
  13549. }
  13550. }
  13551. return new BehaviorSubject_1.BehaviorSubject(elem);
  13552. }
  13553. exports.initNotify = initNotify;
  13554. /***/ }),
  13555. /* 139 */
  13556. /***/ (function(module, exports, __webpack_require__) {
  13557. "use strict";
  13558. var __extends = (this && this.__extends) || function (d, b) {
  13559. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  13560. function __() { this.constructor = d; }
  13561. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13562. };
  13563. var isNumeric_1 = __webpack_require__(76);
  13564. var Observable_1 = __webpack_require__(1);
  13565. var async_1 = __webpack_require__(77);
  13566. var isScheduler_1 = __webpack_require__(25);
  13567. var isDate_1 = __webpack_require__(142);
  13568. /**
  13569. * We need this JSDoc comment for affecting ESDoc.
  13570. * @extends {Ignored}
  13571. * @hide true
  13572. */
  13573. var TimerObservable = (function (_super) {
  13574. __extends(TimerObservable, _super);
  13575. function TimerObservable(dueTime, period, scheduler) {
  13576. if (dueTime === void 0) { dueTime = 0; }
  13577. _super.call(this);
  13578. this.period = -1;
  13579. this.dueTime = 0;
  13580. if (isNumeric_1.isNumeric(period)) {
  13581. this.period = Number(period) < 1 && 1 || Number(period);
  13582. }
  13583. else if (isScheduler_1.isScheduler(period)) {
  13584. scheduler = period;
  13585. }
  13586. if (!isScheduler_1.isScheduler(scheduler)) {
  13587. scheduler = async_1.async;
  13588. }
  13589. this.scheduler = scheduler;
  13590. this.dueTime = isDate_1.isDate(dueTime) ?
  13591. (+dueTime - this.scheduler.now()) :
  13592. dueTime;
  13593. }
  13594. /**
  13595. * Creates an Observable that starts emitting after an `initialDelay` and
  13596. * emits ever increasing numbers after each `period` of time thereafter.
  13597. *
  13598. * <span class="informal">Its like {@link interval}, but you can specify when
  13599. * should the emissions start.</span>
  13600. *
  13601. * <img src="./img/timer.png" width="100%">
  13602. *
  13603. * `timer` returns an Observable that emits an infinite sequence of ascending
  13604. * integers, with a constant interval of time, `period` of your choosing
  13605. * between those emissions. The first emission happens after the specified
  13606. * `initialDelay`. The initial delay may be a {@link Date}. By default, this
  13607. * operator uses the `async` IScheduler to provide a notion of time, but you
  13608. * may pass any IScheduler to it. If `period` is not specified, the output
  13609. * Observable emits only one value, `0`. Otherwise, it emits an infinite
  13610. * sequence.
  13611. *
  13612. * @example <caption>Emits ascending numbers, one every second (1000ms), starting after 3 seconds</caption>
  13613. * var numbers = Rx.Observable.timer(3000, 1000);
  13614. * numbers.subscribe(x => console.log(x));
  13615. *
  13616. * @example <caption>Emits one number after five seconds</caption>
  13617. * var numbers = Rx.Observable.timer(5000);
  13618. * numbers.subscribe(x => console.log(x));
  13619. *
  13620. * @see {@link interval}
  13621. * @see {@link delay}
  13622. *
  13623. * @param {number|Date} initialDelay The initial delay time to wait before
  13624. * emitting the first value of `0`.
  13625. * @param {number} [period] The period of time between emissions of the
  13626. * subsequent numbers.
  13627. * @param {Scheduler} [scheduler=async] The IScheduler to use for scheduling
  13628. * the emission of values, and providing a notion of "time".
  13629. * @return {Observable} An Observable that emits a `0` after the
  13630. * `initialDelay` and ever increasing numbers after each `period` of time
  13631. * thereafter.
  13632. * @static true
  13633. * @name timer
  13634. * @owner Observable
  13635. */
  13636. TimerObservable.create = function (initialDelay, period, scheduler) {
  13637. if (initialDelay === void 0) { initialDelay = 0; }
  13638. return new TimerObservable(initialDelay, period, scheduler);
  13639. };
  13640. TimerObservable.dispatch = function (state) {
  13641. var index = state.index, period = state.period, subscriber = state.subscriber;
  13642. var action = this;
  13643. subscriber.next(index);
  13644. if (subscriber.closed) {
  13645. return;
  13646. }
  13647. else if (period === -1) {
  13648. return subscriber.complete();
  13649. }
  13650. state.index = index + 1;
  13651. action.schedule(state, period);
  13652. };
  13653. /** @deprecated internal use only */ TimerObservable.prototype._subscribe = function (subscriber) {
  13654. var index = 0;
  13655. var _a = this, period = _a.period, dueTime = _a.dueTime, scheduler = _a.scheduler;
  13656. return scheduler.schedule(TimerObservable.dispatch, dueTime, {
  13657. index: index, period: period, subscriber: subscriber
  13658. });
  13659. };
  13660. return TimerObservable;
  13661. }(Observable_1.Observable));
  13662. exports.TimerObservable = TimerObservable;
  13663. //# sourceMappingURL=TimerObservable.js.map
  13664. /***/ }),
  13665. /* 140 */
  13666. /***/ (function(module, exports, __webpack_require__) {
  13667. "use strict";
  13668. var __extends = (this && this.__extends) || function (d, b) {
  13669. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  13670. function __() { this.constructor = d; }
  13671. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13672. };
  13673. var Subscription_1 = __webpack_require__(13);
  13674. /**
  13675. * A unit of work to be executed in a {@link Scheduler}. An action is typically
  13676. * created from within a Scheduler and an RxJS user does not need to concern
  13677. * themselves about creating and manipulating an Action.
  13678. *
  13679. * ```ts
  13680. * class Action<T> extends Subscription {
  13681. * new (scheduler: Scheduler, work: (state?: T) => void);
  13682. * schedule(state?: T, delay: number = 0): Subscription;
  13683. * }
  13684. * ```
  13685. *
  13686. * @class Action<T>
  13687. */
  13688. var Action = (function (_super) {
  13689. __extends(Action, _super);
  13690. function Action(scheduler, work) {
  13691. _super.call(this);
  13692. }
  13693. /**
  13694. * Schedules this action on its parent Scheduler for execution. May be passed
  13695. * some context object, `state`. May happen at some point in the future,
  13696. * according to the `delay` parameter, if specified.
  13697. * @param {T} [state] Some contextual data that the `work` function uses when
  13698. * called by the Scheduler.
  13699. * @param {number} [delay] Time to wait before executing the work, where the
  13700. * time unit is implicit and defined by the Scheduler.
  13701. * @return {void}
  13702. */
  13703. Action.prototype.schedule = function (state, delay) {
  13704. if (delay === void 0) { delay = 0; }
  13705. return this;
  13706. };
  13707. return Action;
  13708. }(Subscription_1.Subscription));
  13709. exports.Action = Action;
  13710. //# sourceMappingURL=Action.js.map
  13711. /***/ }),
  13712. /* 141 */
  13713. /***/ (function(module, exports, __webpack_require__) {
  13714. "use strict";
  13715. /**
  13716. * An execution context and a data structure to order tasks and schedule their
  13717. * execution. Provides a notion of (potentially virtual) time, through the
  13718. * `now()` getter method.
  13719. *
  13720. * Each unit of work in a Scheduler is called an {@link Action}.
  13721. *
  13722. * ```ts
  13723. * class Scheduler {
  13724. * now(): number;
  13725. * schedule(work, delay?, state?): Subscription;
  13726. * }
  13727. * ```
  13728. *
  13729. * @class Scheduler
  13730. */
  13731. var Scheduler = (function () {
  13732. function Scheduler(SchedulerAction, now) {
  13733. if (now === void 0) { now = Scheduler.now; }
  13734. this.SchedulerAction = SchedulerAction;
  13735. this.now = now;
  13736. }
  13737. /**
  13738. * Schedules a function, `work`, for execution. May happen at some point in
  13739. * the future, according to the `delay` parameter, if specified. May be passed
  13740. * some context object, `state`, which will be passed to the `work` function.
  13741. *
  13742. * The given arguments will be processed an stored as an Action object in a
  13743. * queue of actions.
  13744. *
  13745. * @param {function(state: ?T): ?Subscription} work A function representing a
  13746. * task, or some unit of work to be executed by the Scheduler.
  13747. * @param {number} [delay] Time to wait before executing the work, where the
  13748. * time unit is implicit and defined by the Scheduler itself.
  13749. * @param {T} [state] Some contextual data that the `work` function uses when
  13750. * called by the Scheduler.
  13751. * @return {Subscription} A subscription in order to be able to unsubscribe
  13752. * the scheduled work.
  13753. */
  13754. Scheduler.prototype.schedule = function (work, delay, state) {
  13755. if (delay === void 0) { delay = 0; }
  13756. return new this.SchedulerAction(this, work).schedule(state, delay);
  13757. };
  13758. Scheduler.now = Date.now ? Date.now : function () { return +new Date(); };
  13759. return Scheduler;
  13760. }());
  13761. exports.Scheduler = Scheduler;
  13762. //# sourceMappingURL=Scheduler.js.map
  13763. /***/ }),
  13764. /* 142 */
  13765. /***/ (function(module, exports, __webpack_require__) {
  13766. "use strict";
  13767. function isDate(value) {
  13768. return value instanceof Date && !isNaN(+value);
  13769. }
  13770. exports.isDate = isDate;
  13771. //# sourceMappingURL=isDate.js.map
  13772. /***/ }),
  13773. /* 143 */
  13774. /***/ (function(module, exports, __webpack_require__) {
  13775. "use strict";
  13776. var __assign = (this && this.__assign) || function () {
  13777. __assign = Object.assign || function(t) {
  13778. for (var s, i = 1, n = arguments.length; i < n; i++) {
  13779. s = arguments[i];
  13780. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
  13781. t[p] = s[p];
  13782. }
  13783. return t;
  13784. };
  13785. return __assign.apply(this, arguments);
  13786. };
  13787. Object.defineProperty(exports, "__esModule", { value: true });
  13788. var emojis = {
  13789. trace: '🔍',
  13790. debug: '🐛',
  13791. info: '✨',
  13792. warn: '⚠️',
  13793. error: '🚨',
  13794. fatal: '💀'
  13795. };
  13796. var levels = {
  13797. trace: 10,
  13798. debug: 20,
  13799. info: 30,
  13800. warn: 40,
  13801. error: 50,
  13802. fatal: 60
  13803. };
  13804. var defaultColors = {
  13805. foreground: '#d3c0c8',
  13806. background: '#2d2d2d',
  13807. black: '#2d2d2d',
  13808. red: '#f2777a',
  13809. green: '#99cc99',
  13810. yellow: '#ffcc66',
  13811. blue: '#6699cc',
  13812. magenta: '#cc99cc',
  13813. cyan: '#66cccc',
  13814. white: '#d3d0c8',
  13815. brightBlack: '#747369'
  13816. };
  13817. var Nanologger = /** @class */ (function () {
  13818. function Nanologger(name, opts) {
  13819. this.name = name;
  13820. this.opts = opts;
  13821. this._name = name || '';
  13822. this._colors = __assign({}, defaultColors, (opts.colors || {}));
  13823. try {
  13824. this.logLevel = window.localStorage.getItem('logLevel') || 'info';
  13825. }
  13826. catch (e) {
  13827. this.logLevel = 'info';
  13828. }
  13829. this._logLevel = levels[this.logLevel];
  13830. }
  13831. Nanologger.prototype.trace = function () {
  13832. var args = ['trace'];
  13833. for (var i = 0, len = arguments.length; i < len; i++)
  13834. args.push(arguments[i]);
  13835. this._print.apply(this, args);
  13836. };
  13837. Nanologger.prototype.debug = function () {
  13838. var args = ['debug'];
  13839. for (var i = 0, len = arguments.length; i < len; i++)
  13840. args.push(arguments[i]);
  13841. this._print.apply(this, args);
  13842. };
  13843. Nanologger.prototype.info = function () {
  13844. var args = ['info'];
  13845. for (var i = 0, len = arguments.length; i < len; i++)
  13846. args.push(arguments[i]);
  13847. this._print.apply(this, args);
  13848. };
  13849. Nanologger.prototype.warn = function () {
  13850. var args = ['warn'];
  13851. for (var i = 0, len = arguments.length; i < len; i++)
  13852. args.push(arguments[i]);
  13853. this._print.apply(this, args);
  13854. };
  13855. Nanologger.prototype.error = function () {
  13856. var args = ['error'];
  13857. for (var i = 0, len = arguments.length; i < len; i++)
  13858. args.push(arguments[i]);
  13859. this._print.apply(this, args);
  13860. };
  13861. Nanologger.prototype.fatal = function () {
  13862. var args = ['fatal'];
  13863. for (var i = 0, len = arguments.length; i < len; i++)
  13864. args.push(arguments[i]);
  13865. this._print.apply(this, args);
  13866. };
  13867. Nanologger.prototype._print = function (level) {
  13868. if (levels[level] < this._logLevel)
  13869. return;
  13870. // var time = getTimeStamp()
  13871. var emoji = emojis[level];
  13872. var name = this._name || 'unknown';
  13873. var msgColor = (level === 'error' || level.fatal)
  13874. ? this._colors.red
  13875. : level === 'warn'
  13876. ? this._colors.yellow
  13877. : this._colors.green;
  13878. var objs = [];
  13879. var args = [null];
  13880. var msg = emoji + ' %c%s';
  13881. // args.push(color(this._colors.brightBlack), time)
  13882. args.push(color(this._colors.magenta), name);
  13883. for (var i = 1, len = arguments.length; i < len; i++) {
  13884. var arg = arguments[i];
  13885. if (typeof arg === 'string') {
  13886. if (i === 1) {
  13887. // first string argument is in color
  13888. msg += ' %c%s';
  13889. args.push(color(msgColor));
  13890. args.push(arg);
  13891. }
  13892. else if (/ms$/.test(arg)) {
  13893. // arguments finishing with 'ms', grey out
  13894. msg += ' %c%s';
  13895. args.push(color(this._colors.brightBlack));
  13896. args.push(arg);
  13897. }
  13898. else {
  13899. // normal colors
  13900. msg += ' %c%s';
  13901. args.push(color(this._colors.white));
  13902. args.push(arg);
  13903. }
  13904. }
  13905. else if (typeof arg === 'number') {
  13906. msg += ' %c%d';
  13907. args.push(color(this._colors.magenta));
  13908. args.push(arg);
  13909. }
  13910. else {
  13911. objs.push(arg);
  13912. }
  13913. }
  13914. args[0] = msg;
  13915. objs.forEach(function (obj) {
  13916. args.push(obj);
  13917. });
  13918. // In IE/Edge console functions don't inherit from Function.prototype
  13919. // so this is necessary to get all the args applied.
  13920. Function.prototype.apply.apply(console.log, [console, args]);
  13921. };
  13922. return Nanologger;
  13923. }());
  13924. exports.Nanologger = Nanologger;
  13925. function color(color) {
  13926. return 'color: ' + color + ';';
  13927. }
  13928. function getTimeStamp() {
  13929. var date = new Date();
  13930. var hours = pad(date.getHours().toString());
  13931. var minutes = pad(date.getMinutes().toString());
  13932. var seconds = pad(date.getSeconds().toString());
  13933. return hours + ':' + minutes + ':' + seconds;
  13934. }
  13935. function pad(str) {
  13936. return str.length !== 2 ? 0 + str : str;
  13937. }
  13938. /***/ }),
  13939. /* 144 */
  13940. /***/ (function(module, exports, __webpack_require__) {
  13941. "use strict";
  13942. Object.defineProperty(exports, "__esModule", { value: true });
  13943. /**
  13944. *
  13945. * With thanks to https://github.com/livereload/livereload-js
  13946. * :) :) :)
  13947. *
  13948. */
  13949. var utils_1 = __webpack_require__(22);
  13950. var empty_1 = __webpack_require__(17);
  13951. var Observable_1 = __webpack_require__(1);
  13952. var merge_1 = __webpack_require__(38);
  13953. var timer_1 = __webpack_require__(51);
  13954. var from_1 = __webpack_require__(86);
  13955. var filter_1 = __webpack_require__(5);
  13956. var map_1 = __webpack_require__(2);
  13957. var mergeMap_1 = __webpack_require__(16);
  13958. var tap_1 = __webpack_require__(6);
  13959. var mapTo_1 = __webpack_require__(87);
  13960. var prop_set_dom_effect_1 = __webpack_require__(75);
  13961. var style_set_dom_effect_1 = __webpack_require__(80);
  13962. var link_replace_dom_effect_1 = __webpack_require__(81);
  13963. var mergeAll_1 = __webpack_require__(54);
  13964. var hiddenElem;
  13965. var IMAGE_STYLES = [
  13966. { selector: 'background', styleNames: ['backgroundImage'] },
  13967. { selector: 'border', styleNames: ['borderImage', 'webkitBorderImage', 'MozBorderImage'] }
  13968. ];
  13969. var attrs = {
  13970. link: "href",
  13971. img: "src",
  13972. script: "src"
  13973. };
  13974. function reload(document, navigator) {
  13975. return function (data, options) {
  13976. var path = data.path;
  13977. if (options.liveCSS) {
  13978. if (path.match(/\.css$/i)) {
  13979. return reloadStylesheet(path, document, navigator);
  13980. }
  13981. }
  13982. if (options.liveImg) {
  13983. if (path.match(/\.(jpe?g|png|gif)$/i)) {
  13984. return reloadImages(path, document);
  13985. }
  13986. }
  13987. /**
  13988. * LEGACY
  13989. */
  13990. var domData = getElems(data.ext, options, document);
  13991. var elems = getMatches(domData.elems, data.basename, domData.attr);
  13992. for (var i = 0, n = elems.length; i < n; i += 1) {
  13993. swapFile(elems[i], domData, options, document, navigator);
  13994. }
  13995. return empty_1.empty();
  13996. };
  13997. function getMatches(elems, url, attr) {
  13998. if (url[0] === "*") {
  13999. return elems;
  14000. }
  14001. var matches = [];
  14002. var urlMatcher = new RegExp("(^|/)" + url);
  14003. for (var i = 0, len = elems.length; i < len; i += 1) {
  14004. if (urlMatcher.test(elems[i][attr])) {
  14005. matches.push(elems[i]);
  14006. }
  14007. }
  14008. return matches;
  14009. }
  14010. function getElems(fileExtension, options, document) {
  14011. var tagName = options.tagNames[fileExtension];
  14012. var attr = attrs[tagName];
  14013. return {
  14014. attr: attr,
  14015. tagName: tagName,
  14016. elems: document.getElementsByTagName(tagName)
  14017. };
  14018. }
  14019. function reloadImages(path, document) {
  14020. var expando = generateUniqueString(Date.now());
  14021. return merge_1.merge(from_1.from([].slice.call(document.images))
  14022. .pipe(filter_1.filter(function (img) { return utils_1.pathsMatch(path, utils_1.pathFromUrl(img.src)); }), map_1.map(function (img) {
  14023. var payload = {
  14024. target: img,
  14025. prop: 'src',
  14026. value: generateCacheBustUrl(img.src, expando),
  14027. pathname: utils_1.getLocation(img.src).pathname
  14028. };
  14029. return prop_set_dom_effect_1.propSet(payload);
  14030. })), from_1.from(IMAGE_STYLES)
  14031. .pipe(mergeMap_1.mergeMap(function (_a) {
  14032. var selector = _a.selector, styleNames = _a.styleNames;
  14033. return from_1.from(document.querySelectorAll("[style*=" + selector + "]")).pipe(mergeMap_1.mergeMap(function (img) {
  14034. return reloadStyleImages(img.style, styleNames, path, expando);
  14035. }));
  14036. })));
  14037. // if (document.styleSheets) {
  14038. // return [].slice.call(document.styleSheets)
  14039. // .map((styleSheet) => {
  14040. // return reloadStylesheetImages(styleSheet, path, expando);
  14041. // });
  14042. // }
  14043. }
  14044. function reloadStylesheetImages(styleSheet, path, expando) {
  14045. var rules;
  14046. try {
  14047. rules = styleSheet != null ? styleSheet.cssRules : undefined;
  14048. }
  14049. catch (e) { }
  14050. //
  14051. if (!rules) {
  14052. return;
  14053. }
  14054. [].slice.call(rules).forEach(function (rule) {
  14055. switch (rule.type) {
  14056. case CSSRule.IMPORT_RULE:
  14057. reloadStylesheetImages(rule.styleSheet, path, expando);
  14058. break;
  14059. case CSSRule.STYLE_RULE:
  14060. [].slice.call(IMAGE_STYLES).forEach(function (_a) {
  14061. var styleNames = _a.styleNames;
  14062. reloadStyleImages(rule.style, styleNames, path, expando);
  14063. });
  14064. break;
  14065. case CSSRule.MEDIA_RULE:
  14066. reloadStylesheetImages(rule, path, expando);
  14067. break;
  14068. }
  14069. });
  14070. }
  14071. function reloadStyleImages(style, styleNames, path, expando) {
  14072. return from_1.from(styleNames).pipe(filter_1.filter(function (styleName) { return typeof style[styleName] === 'string'; }), map_1.map(function (styleName) {
  14073. var pathName;
  14074. var value = style[styleName];
  14075. var newValue = value.replace(new RegExp("\\burl\\s*\\(([^)]*)\\)"), function (match, src) {
  14076. var _src = src;
  14077. if (src[0] === '"' && src[src.length - 1] === '"') {
  14078. _src = src.slice(1, -1);
  14079. }
  14080. pathName = utils_1.getLocation(_src).pathname;
  14081. if (utils_1.pathsMatch(path, utils_1.pathFromUrl(_src))) {
  14082. return "url(" + generateCacheBustUrl(_src, expando) + ")";
  14083. }
  14084. else {
  14085. return match;
  14086. }
  14087. });
  14088. return [
  14089. style,
  14090. styleName,
  14091. value,
  14092. newValue,
  14093. pathName
  14094. ];
  14095. }), filter_1.filter(function (_a) {
  14096. var style = _a[0], styleName = _a[1], value = _a[2], newValue = _a[3];
  14097. return newValue !== value;
  14098. }), map_1.map(function (_a) {
  14099. var style = _a[0], styleName = _a[1], value = _a[2], newValue = _a[3], pathName = _a[4];
  14100. return style_set_dom_effect_1.styleSet({ style: style, styleName: styleName, value: value, newValue: newValue, pathName: pathName });
  14101. }));
  14102. }
  14103. function swapFile(elem, domData, options, document, navigator) {
  14104. var attr = domData.attr;
  14105. var currentValue = elem[attr];
  14106. var timeStamp = new Date().getTime();
  14107. var key = "browsersync-legacy";
  14108. var suffix = key + "=" + timeStamp;
  14109. var anchor = utils_1.getLocation(currentValue);
  14110. var search = utils_1.updateSearch(anchor.search, key, suffix);
  14111. switch (domData.tagName) {
  14112. case 'link': {
  14113. // this.logger.trace(`replacing LINK ${attr}`);
  14114. reloadStylesheet(currentValue, document, navigator);
  14115. break;
  14116. }
  14117. case 'img': {
  14118. reloadImages(currentValue, document);
  14119. break;
  14120. }
  14121. default: {
  14122. if (options.timestamps === false) {
  14123. elem[attr] = anchor.href;
  14124. }
  14125. else {
  14126. elem[attr] = anchor.href.split("?")[0] + search;
  14127. }
  14128. // this.logger.info(`reloading ${elem[attr]}`);
  14129. setTimeout(function () {
  14130. if (!hiddenElem) {
  14131. hiddenElem = document.createElement("DIV");
  14132. document.body.appendChild(hiddenElem);
  14133. }
  14134. else {
  14135. hiddenElem.style.display = "none";
  14136. hiddenElem.style.display = "block";
  14137. }
  14138. }, 200);
  14139. }
  14140. }
  14141. return {
  14142. elem: elem,
  14143. timeStamp: timeStamp
  14144. };
  14145. }
  14146. function reattachStylesheetLink(link, document, navigator) {
  14147. // ignore LINKs that will be removed by LR soon
  14148. var clone;
  14149. if (link.__LiveReload_pendingRemoval) {
  14150. return empty_1.empty();
  14151. }
  14152. link.__LiveReload_pendingRemoval = true;
  14153. if (link.tagName === 'STYLE') {
  14154. // prefixfree
  14155. clone = document.createElement('link');
  14156. clone.rel = 'stylesheet';
  14157. clone.media = link.media;
  14158. clone.disabled = link.disabled;
  14159. }
  14160. else {
  14161. clone = link.cloneNode(false);
  14162. }
  14163. var prevHref = link.href;
  14164. var nextHref = generateCacheBustUrl(linkHref(link));
  14165. clone.href = nextHref;
  14166. var pathname = utils_1.getLocation(nextHref).pathname;
  14167. var basename = pathname.split('/').slice(-1)[0];
  14168. // insert the new LINK before the old one
  14169. var parent = link.parentNode;
  14170. if (parent.lastChild === link) {
  14171. parent.appendChild(clone);
  14172. }
  14173. else {
  14174. parent.insertBefore(clone, link.nextSibling);
  14175. }
  14176. var additionalWaitingTime;
  14177. if (/AppleWebKit/.test(navigator.userAgent)) {
  14178. additionalWaitingTime = 5;
  14179. }
  14180. else {
  14181. additionalWaitingTime = 200;
  14182. }
  14183. return Observable_1.Observable.create(function (obs) {
  14184. clone.onload = function () {
  14185. obs.next(true);
  14186. obs.complete();
  14187. };
  14188. })
  14189. .pipe(mergeMap_1.mergeMap(function () {
  14190. return timer_1.timer(additionalWaitingTime)
  14191. .pipe(tap_1.tap(function () {
  14192. if (link && !link.parentNode) {
  14193. return;
  14194. }
  14195. link.parentNode.removeChild(link);
  14196. clone.onreadystatechange = null;
  14197. }), mapTo_1.mapTo(link_replace_dom_effect_1.linkReplace({ target: clone, nextHref: nextHref, prevHref: prevHref, pathname: pathname, basename: basename })));
  14198. }));
  14199. }
  14200. function reattachImportedRule(_a, document) {
  14201. var rule = _a.rule, index = _a.index, link = _a.link;
  14202. var parent = rule.parentStyleSheet;
  14203. var href = generateCacheBustUrl(rule.href);
  14204. var media = rule.media.length ? [].join.call(rule.media, ', ') : '';
  14205. var newRule = "@import url(\"" + href + "\") " + media + ";";
  14206. // used to detect if reattachImportedRule has been called again on the same rule
  14207. rule.__LiveReload_newHref = href;
  14208. // WORKAROUND FOR WEBKIT BUG: WebKit resets all styles if we add @import'ed
  14209. // stylesheet that hasn't been cached yet. Workaround is to pre-cache the
  14210. // stylesheet by temporarily adding it as a LINK tag.
  14211. var tempLink = document.createElement("link");
  14212. tempLink.rel = 'stylesheet';
  14213. tempLink.href = href;
  14214. tempLink.__LiveReload_pendingRemoval = true; // exclude from path matching
  14215. if (link.parentNode) {
  14216. link.parentNode.insertBefore(tempLink, link);
  14217. }
  14218. return timer_1.timer(200)
  14219. .pipe(tap_1.tap(function () {
  14220. if (tempLink.parentNode) {
  14221. tempLink.parentNode.removeChild(tempLink);
  14222. }
  14223. // if another reattachImportedRule call is in progress, abandon this one
  14224. if (rule.__LiveReload_newHref !== href) {
  14225. return;
  14226. }
  14227. parent.insertRule(newRule, index);
  14228. parent.deleteRule(index + 1);
  14229. // save the new rule, so that we can detect another reattachImportedRule call
  14230. rule = parent.cssRules[index];
  14231. rule.__LiveReload_newHref = href;
  14232. }), mergeMap_1.mergeMap(function () {
  14233. return timer_1.timer(200).pipe(tap_1.tap(function () {
  14234. // if another reattachImportedRule call is in progress, abandon this one
  14235. if (rule.__LiveReload_newHref !== href) {
  14236. return;
  14237. }
  14238. parent.insertRule(newRule, index);
  14239. return parent.deleteRule(index + 1);
  14240. }));
  14241. }));
  14242. }
  14243. function generateCacheBustUrl(url, expando) {
  14244. if (expando === void 0) { expando = generateUniqueString(Date.now()); }
  14245. var _a;
  14246. var hash, oldParams;
  14247. (_a = utils_1.splitUrl(url), url = _a.url, hash = _a.hash, oldParams = _a.params);
  14248. // if (this.options.overrideURL) {
  14249. // if (url.indexOf(this.options.serverURL) < 0) {
  14250. // const originalUrl = url;
  14251. // url = this.options.serverURL + this.options.overrideURL + "?url=" + encodeURIComponent(url);
  14252. // this.logger.debug(`overriding source URL ${originalUrl} with ${url}`);
  14253. // }
  14254. // }
  14255. var params = oldParams.replace(/(\?|&)browsersync=(\d+)/, function (match, sep) { return "" + sep + expando; });
  14256. if (params === oldParams) {
  14257. if (oldParams.length === 0) {
  14258. params = "?" + expando;
  14259. }
  14260. else {
  14261. params = oldParams + "&" + expando;
  14262. }
  14263. }
  14264. return url + params + hash;
  14265. }
  14266. function reloadStylesheet(path, document, navigator) {
  14267. // has to be a real array, because DOMNodeList will be modified
  14268. var links = utils_1.array(document.getElementsByTagName('link'))
  14269. .filter(function (link) {
  14270. return link.rel.match(/^stylesheet$/i)
  14271. && !link.__LiveReload_pendingRemoval;
  14272. });
  14273. /**
  14274. * Find imported style sheets in <style> tags
  14275. * @type {any[]}
  14276. */
  14277. var styleImported = utils_1.array(document.getElementsByTagName('style'))
  14278. .filter(function (style) { return Boolean(style.sheet); })
  14279. .reduce(function (acc, style) {
  14280. return acc.concat(collectImportedStylesheets(style, style.sheet));
  14281. }, []);
  14282. /**
  14283. * Find imported style sheets in <link> tags
  14284. * @type {any[]}
  14285. */
  14286. var linksImported = links
  14287. .reduce(function (acc, link) {
  14288. return acc.concat(collectImportedStylesheets(link, link.sheet));
  14289. }, []);
  14290. /**
  14291. * Combine all links + sheets
  14292. */
  14293. var allRules = links.concat(styleImported, linksImported);
  14294. /**
  14295. * Which href best matches the incoming href?
  14296. */
  14297. var match = utils_1.pickBestMatch(path, allRules, function (l) { return utils_1.pathFromUrl(linkHref(l)); });
  14298. if (match) {
  14299. if (match.object && match.object.rule) {
  14300. return reattachImportedRule(match.object, document);
  14301. }
  14302. return reattachStylesheetLink(match.object, document, navigator);
  14303. }
  14304. else {
  14305. if (links.length) {
  14306. // no <link> elements matched, so was the path including '*'?
  14307. var _a = path.split('.'), first = _a[0], rest = _a.slice(1);
  14308. if (first === '*') {
  14309. return from_1.from(links.map(function (link) { return reattachStylesheetLink(link, document, navigator); }))
  14310. .pipe(mergeAll_1.mergeAll());
  14311. }
  14312. }
  14313. }
  14314. return empty_1.empty();
  14315. }
  14316. function collectImportedStylesheets(link, styleSheet) {
  14317. // in WebKit, styleSheet.cssRules is null for inaccessible stylesheets;
  14318. // Firefox/Opera may throw exceptions
  14319. var output = [];
  14320. collect(link, makeRules(styleSheet));
  14321. return output;
  14322. function makeRules(styleSheet) {
  14323. var rules;
  14324. try {
  14325. rules = styleSheet != null ? styleSheet.cssRules : undefined;
  14326. }
  14327. catch (e) { }
  14328. return rules;
  14329. }
  14330. function collect(link, rules) {
  14331. if (rules && rules.length) {
  14332. for (var index = 0; index < rules.length; index++) {
  14333. var rule = rules[index];
  14334. switch (rule.type) {
  14335. case CSSRule.CHARSET_RULE:
  14336. break;
  14337. case CSSRule.IMPORT_RULE:
  14338. output.push({ link: link, rule: rule, index: index, href: rule.href });
  14339. collect(link, makeRules(rule.styleSheet));
  14340. break;
  14341. default:
  14342. break; // import rules can only be preceded by charset rules
  14343. }
  14344. }
  14345. }
  14346. }
  14347. }
  14348. function linkHref(link) {
  14349. // prefixfree uses data-href when it turns LINK into STYLE
  14350. return link.href || link.getAttribute('data-href');
  14351. }
  14352. function generateUniqueString(value) {
  14353. return "browsersync=" + value;
  14354. }
  14355. }
  14356. exports.reload = reload;
  14357. /***/ }),
  14358. /* 145 */
  14359. /***/ (function(module, exports, __webpack_require__) {
  14360. "use strict";
  14361. var __extends = (this && this.__extends) || function (d, b) {
  14362. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  14363. function __() { this.constructor = d; }
  14364. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14365. };
  14366. var isArray_1 = __webpack_require__(26);
  14367. var isArrayLike_1 = __webpack_require__(58);
  14368. var isPromise_1 = __webpack_require__(59);
  14369. var PromiseObservable_1 = __webpack_require__(146);
  14370. var IteratorObservable_1 = __webpack_require__(147);
  14371. var ArrayObservable_1 = __webpack_require__(24);
  14372. var ArrayLikeObservable_1 = __webpack_require__(148);
  14373. var iterator_1 = __webpack_require__(31);
  14374. var Observable_1 = __webpack_require__(1);
  14375. var observeOn_1 = __webpack_require__(149);
  14376. var observable_1 = __webpack_require__(45);
  14377. /**
  14378. * We need this JSDoc comment for affecting ESDoc.
  14379. * @extends {Ignored}
  14380. * @hide true
  14381. */
  14382. var FromObservable = (function (_super) {
  14383. __extends(FromObservable, _super);
  14384. function FromObservable(ish, scheduler) {
  14385. _super.call(this, null);
  14386. this.ish = ish;
  14387. this.scheduler = scheduler;
  14388. }
  14389. /**
  14390. * Creates an Observable from an Array, an array-like object, a Promise, an
  14391. * iterable object, or an Observable-like object.
  14392. *
  14393. * <span class="informal">Converts almost anything to an Observable.</span>
  14394. *
  14395. * <img src="./img/from.png" width="100%">
  14396. *
  14397. * Convert various other objects and data types into Observables. `from`
  14398. * converts a Promise or an array-like or an
  14399. * [iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#iterable)
  14400. * object into an Observable that emits the items in that promise or array or
  14401. * iterable. A String, in this context, is treated as an array of characters.
  14402. * Observable-like objects (contains a function named with the ES2015 Symbol
  14403. * for Observable) can also be converted through this operator.
  14404. *
  14405. * @example <caption>Converts an array to an Observable</caption>
  14406. * var array = [10, 20, 30];
  14407. * var result = Rx.Observable.from(array);
  14408. * result.subscribe(x => console.log(x));
  14409. *
  14410. * // Results in the following:
  14411. * // 10 20 30
  14412. *
  14413. * @example <caption>Convert an infinite iterable (from a generator) to an Observable</caption>
  14414. * function* generateDoubles(seed) {
  14415. * var i = seed;
  14416. * while (true) {
  14417. * yield i;
  14418. * i = 2 * i; // double it
  14419. * }
  14420. * }
  14421. *
  14422. * var iterator = generateDoubles(3);
  14423. * var result = Rx.Observable.from(iterator).take(10);
  14424. * result.subscribe(x => console.log(x));
  14425. *
  14426. * // Results in the following:
  14427. * // 3 6 12 24 48 96 192 384 768 1536
  14428. *
  14429. * @see {@link create}
  14430. * @see {@link fromEvent}
  14431. * @see {@link fromEventPattern}
  14432. * @see {@link fromPromise}
  14433. *
  14434. * @param {ObservableInput<T>} ish A subscribable object, a Promise, an
  14435. * Observable-like, an Array, an iterable or an array-like object to be
  14436. * converted.
  14437. * @param {Scheduler} [scheduler] The scheduler on which to schedule the
  14438. * emissions of values.
  14439. * @return {Observable<T>} The Observable whose values are originally from the
  14440. * input object that was converted.
  14441. * @static true
  14442. * @name from
  14443. * @owner Observable
  14444. */
  14445. FromObservable.create = function (ish, scheduler) {
  14446. if (ish != null) {
  14447. if (typeof ish[observable_1.observable] === 'function') {
  14448. if (ish instanceof Observable_1.Observable && !scheduler) {
  14449. return ish;
  14450. }
  14451. return new FromObservable(ish, scheduler);
  14452. }
  14453. else if (isArray_1.isArray(ish)) {
  14454. return new ArrayObservable_1.ArrayObservable(ish, scheduler);
  14455. }
  14456. else if (isPromise_1.isPromise(ish)) {
  14457. return new PromiseObservable_1.PromiseObservable(ish, scheduler);
  14458. }
  14459. else if (typeof ish[iterator_1.iterator] === 'function' || typeof ish === 'string') {
  14460. return new IteratorObservable_1.IteratorObservable(ish, scheduler);
  14461. }
  14462. else if (isArrayLike_1.isArrayLike(ish)) {
  14463. return new ArrayLikeObservable_1.ArrayLikeObservable(ish, scheduler);
  14464. }
  14465. }
  14466. throw new TypeError((ish !== null && typeof ish || ish) + ' is not observable');
  14467. };
  14468. /** @deprecated internal use only */ FromObservable.prototype._subscribe = function (subscriber) {
  14469. var ish = this.ish;
  14470. var scheduler = this.scheduler;
  14471. if (scheduler == null) {
  14472. return ish[observable_1.observable]().subscribe(subscriber);
  14473. }
  14474. else {
  14475. return ish[observable_1.observable]().subscribe(new observeOn_1.ObserveOnSubscriber(subscriber, scheduler, 0));
  14476. }
  14477. };
  14478. return FromObservable;
  14479. }(Observable_1.Observable));
  14480. exports.FromObservable = FromObservable;
  14481. //# sourceMappingURL=FromObservable.js.map
  14482. /***/ }),
  14483. /* 146 */
  14484. /***/ (function(module, exports, __webpack_require__) {
  14485. "use strict";
  14486. var __extends = (this && this.__extends) || function (d, b) {
  14487. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  14488. function __() { this.constructor = d; }
  14489. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14490. };
  14491. var root_1 = __webpack_require__(8);
  14492. var Observable_1 = __webpack_require__(1);
  14493. /**
  14494. * We need this JSDoc comment for affecting ESDoc.
  14495. * @extends {Ignored}
  14496. * @hide true
  14497. */
  14498. var PromiseObservable = (function (_super) {
  14499. __extends(PromiseObservable, _super);
  14500. function PromiseObservable(promise, scheduler) {
  14501. _super.call(this);
  14502. this.promise = promise;
  14503. this.scheduler = scheduler;
  14504. }
  14505. /**
  14506. * Converts a Promise to an Observable.
  14507. *
  14508. * <span class="informal">Returns an Observable that just emits the Promise's
  14509. * resolved value, then completes.</span>
  14510. *
  14511. * Converts an ES2015 Promise or a Promises/A+ spec compliant Promise to an
  14512. * Observable. If the Promise resolves with a value, the output Observable
  14513. * emits that resolved value as a `next`, and then completes. If the Promise
  14514. * is rejected, then the output Observable emits the corresponding Error.
  14515. *
  14516. * @example <caption>Convert the Promise returned by Fetch to an Observable</caption>
  14517. * var result = Rx.Observable.fromPromise(fetch('http://myserver.com/'));
  14518. * result.subscribe(x => console.log(x), e => console.error(e));
  14519. *
  14520. * @see {@link bindCallback}
  14521. * @see {@link from}
  14522. *
  14523. * @param {PromiseLike<T>} promise The promise to be converted.
  14524. * @param {Scheduler} [scheduler] An optional IScheduler to use for scheduling
  14525. * the delivery of the resolved value (or the rejection).
  14526. * @return {Observable<T>} An Observable which wraps the Promise.
  14527. * @static true
  14528. * @name fromPromise
  14529. * @owner Observable
  14530. */
  14531. PromiseObservable.create = function (promise, scheduler) {
  14532. return new PromiseObservable(promise, scheduler);
  14533. };
  14534. /** @deprecated internal use only */ PromiseObservable.prototype._subscribe = function (subscriber) {
  14535. var _this = this;
  14536. var promise = this.promise;
  14537. var scheduler = this.scheduler;
  14538. if (scheduler == null) {
  14539. if (this._isScalar) {
  14540. if (!subscriber.closed) {
  14541. subscriber.next(this.value);
  14542. subscriber.complete();
  14543. }
  14544. }
  14545. else {
  14546. promise.then(function (value) {
  14547. _this.value = value;
  14548. _this._isScalar = true;
  14549. if (!subscriber.closed) {
  14550. subscriber.next(value);
  14551. subscriber.complete();
  14552. }
  14553. }, function (err) {
  14554. if (!subscriber.closed) {
  14555. subscriber.error(err);
  14556. }
  14557. })
  14558. .then(null, function (err) {
  14559. // escape the promise trap, throw unhandled errors
  14560. root_1.root.setTimeout(function () { throw err; });
  14561. });
  14562. }
  14563. }
  14564. else {
  14565. if (this._isScalar) {
  14566. if (!subscriber.closed) {
  14567. return scheduler.schedule(dispatchNext, 0, { value: this.value, subscriber: subscriber });
  14568. }
  14569. }
  14570. else {
  14571. promise.then(function (value) {
  14572. _this.value = value;
  14573. _this._isScalar = true;
  14574. if (!subscriber.closed) {
  14575. subscriber.add(scheduler.schedule(dispatchNext, 0, { value: value, subscriber: subscriber }));
  14576. }
  14577. }, function (err) {
  14578. if (!subscriber.closed) {
  14579. subscriber.add(scheduler.schedule(dispatchError, 0, { err: err, subscriber: subscriber }));
  14580. }
  14581. })
  14582. .then(null, function (err) {
  14583. // escape the promise trap, throw unhandled errors
  14584. root_1.root.setTimeout(function () { throw err; });
  14585. });
  14586. }
  14587. }
  14588. };
  14589. return PromiseObservable;
  14590. }(Observable_1.Observable));
  14591. exports.PromiseObservable = PromiseObservable;
  14592. function dispatchNext(arg) {
  14593. var value = arg.value, subscriber = arg.subscriber;
  14594. if (!subscriber.closed) {
  14595. subscriber.next(value);
  14596. subscriber.complete();
  14597. }
  14598. }
  14599. function dispatchError(arg) {
  14600. var err = arg.err, subscriber = arg.subscriber;
  14601. if (!subscriber.closed) {
  14602. subscriber.error(err);
  14603. }
  14604. }
  14605. //# sourceMappingURL=PromiseObservable.js.map
  14606. /***/ }),
  14607. /* 147 */
  14608. /***/ (function(module, exports, __webpack_require__) {
  14609. "use strict";
  14610. var __extends = (this && this.__extends) || function (d, b) {
  14611. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  14612. function __() { this.constructor = d; }
  14613. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14614. };
  14615. var root_1 = __webpack_require__(8);
  14616. var Observable_1 = __webpack_require__(1);
  14617. var iterator_1 = __webpack_require__(31);
  14618. /**
  14619. * We need this JSDoc comment for affecting ESDoc.
  14620. * @extends {Ignored}
  14621. * @hide true
  14622. */
  14623. var IteratorObservable = (function (_super) {
  14624. __extends(IteratorObservable, _super);
  14625. function IteratorObservable(iterator, scheduler) {
  14626. _super.call(this);
  14627. this.scheduler = scheduler;
  14628. if (iterator == null) {
  14629. throw new Error('iterator cannot be null.');
  14630. }
  14631. this.iterator = getIterator(iterator);
  14632. }
  14633. IteratorObservable.create = function (iterator, scheduler) {
  14634. return new IteratorObservable(iterator, scheduler);
  14635. };
  14636. IteratorObservable.dispatch = function (state) {
  14637. var index = state.index, hasError = state.hasError, iterator = state.iterator, subscriber = state.subscriber;
  14638. if (hasError) {
  14639. subscriber.error(state.error);
  14640. return;
  14641. }
  14642. var result = iterator.next();
  14643. if (result.done) {
  14644. subscriber.complete();
  14645. return;
  14646. }
  14647. subscriber.next(result.value);
  14648. state.index = index + 1;
  14649. if (subscriber.closed) {
  14650. if (typeof iterator.return === 'function') {
  14651. iterator.return();
  14652. }
  14653. return;
  14654. }
  14655. this.schedule(state);
  14656. };
  14657. /** @deprecated internal use only */ IteratorObservable.prototype._subscribe = function (subscriber) {
  14658. var index = 0;
  14659. var _a = this, iterator = _a.iterator, scheduler = _a.scheduler;
  14660. if (scheduler) {
  14661. return scheduler.schedule(IteratorObservable.dispatch, 0, {
  14662. index: index, iterator: iterator, subscriber: subscriber
  14663. });
  14664. }
  14665. else {
  14666. do {
  14667. var result = iterator.next();
  14668. if (result.done) {
  14669. subscriber.complete();
  14670. break;
  14671. }
  14672. else {
  14673. subscriber.next(result.value);
  14674. }
  14675. if (subscriber.closed) {
  14676. if (typeof iterator.return === 'function') {
  14677. iterator.return();
  14678. }
  14679. break;
  14680. }
  14681. } while (true);
  14682. }
  14683. };
  14684. return IteratorObservable;
  14685. }(Observable_1.Observable));
  14686. exports.IteratorObservable = IteratorObservable;
  14687. var StringIterator = (function () {
  14688. function StringIterator(str, idx, len) {
  14689. if (idx === void 0) { idx = 0; }
  14690. if (len === void 0) { len = str.length; }
  14691. this.str = str;
  14692. this.idx = idx;
  14693. this.len = len;
  14694. }
  14695. StringIterator.prototype[iterator_1.iterator] = function () { return (this); };
  14696. StringIterator.prototype.next = function () {
  14697. return this.idx < this.len ? {
  14698. done: false,
  14699. value: this.str.charAt(this.idx++)
  14700. } : {
  14701. done: true,
  14702. value: undefined
  14703. };
  14704. };
  14705. return StringIterator;
  14706. }());
  14707. var ArrayIterator = (function () {
  14708. function ArrayIterator(arr, idx, len) {
  14709. if (idx === void 0) { idx = 0; }
  14710. if (len === void 0) { len = toLength(arr); }
  14711. this.arr = arr;
  14712. this.idx = idx;
  14713. this.len = len;
  14714. }
  14715. ArrayIterator.prototype[iterator_1.iterator] = function () { return this; };
  14716. ArrayIterator.prototype.next = function () {
  14717. return this.idx < this.len ? {
  14718. done: false,
  14719. value: this.arr[this.idx++]
  14720. } : {
  14721. done: true,
  14722. value: undefined
  14723. };
  14724. };
  14725. return ArrayIterator;
  14726. }());
  14727. function getIterator(obj) {
  14728. var i = obj[iterator_1.iterator];
  14729. if (!i && typeof obj === 'string') {
  14730. return new StringIterator(obj);
  14731. }
  14732. if (!i && obj.length !== undefined) {
  14733. return new ArrayIterator(obj);
  14734. }
  14735. if (!i) {
  14736. throw new TypeError('object is not iterable');
  14737. }
  14738. return obj[iterator_1.iterator]();
  14739. }
  14740. var maxSafeInteger = Math.pow(2, 53) - 1;
  14741. function toLength(o) {
  14742. var len = +o.length;
  14743. if (isNaN(len)) {
  14744. return 0;
  14745. }
  14746. if (len === 0 || !numberIsFinite(len)) {
  14747. return len;
  14748. }
  14749. len = sign(len) * Math.floor(Math.abs(len));
  14750. if (len <= 0) {
  14751. return 0;
  14752. }
  14753. if (len > maxSafeInteger) {
  14754. return maxSafeInteger;
  14755. }
  14756. return len;
  14757. }
  14758. function numberIsFinite(value) {
  14759. return typeof value === 'number' && root_1.root.isFinite(value);
  14760. }
  14761. function sign(value) {
  14762. var valueAsNumber = +value;
  14763. if (valueAsNumber === 0) {
  14764. return valueAsNumber;
  14765. }
  14766. if (isNaN(valueAsNumber)) {
  14767. return valueAsNumber;
  14768. }
  14769. return valueAsNumber < 0 ? -1 : 1;
  14770. }
  14771. //# sourceMappingURL=IteratorObservable.js.map
  14772. /***/ }),
  14773. /* 148 */
  14774. /***/ (function(module, exports, __webpack_require__) {
  14775. "use strict";
  14776. var __extends = (this && this.__extends) || function (d, b) {
  14777. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  14778. function __() { this.constructor = d; }
  14779. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14780. };
  14781. var Observable_1 = __webpack_require__(1);
  14782. var ScalarObservable_1 = __webpack_require__(46);
  14783. var EmptyObservable_1 = __webpack_require__(28);
  14784. /**
  14785. * We need this JSDoc comment for affecting ESDoc.
  14786. * @extends {Ignored}
  14787. * @hide true
  14788. */
  14789. var ArrayLikeObservable = (function (_super) {
  14790. __extends(ArrayLikeObservable, _super);
  14791. function ArrayLikeObservable(arrayLike, scheduler) {
  14792. _super.call(this);
  14793. this.arrayLike = arrayLike;
  14794. this.scheduler = scheduler;
  14795. if (!scheduler && arrayLike.length === 1) {
  14796. this._isScalar = true;
  14797. this.value = arrayLike[0];
  14798. }
  14799. }
  14800. ArrayLikeObservable.create = function (arrayLike, scheduler) {
  14801. var length = arrayLike.length;
  14802. if (length === 0) {
  14803. return new EmptyObservable_1.EmptyObservable();
  14804. }
  14805. else if (length === 1) {
  14806. return new ScalarObservable_1.ScalarObservable(arrayLike[0], scheduler);
  14807. }
  14808. else {
  14809. return new ArrayLikeObservable(arrayLike, scheduler);
  14810. }
  14811. };
  14812. ArrayLikeObservable.dispatch = function (state) {
  14813. var arrayLike = state.arrayLike, index = state.index, length = state.length, subscriber = state.subscriber;
  14814. if (subscriber.closed) {
  14815. return;
  14816. }
  14817. if (index >= length) {
  14818. subscriber.complete();
  14819. return;
  14820. }
  14821. subscriber.next(arrayLike[index]);
  14822. state.index = index + 1;
  14823. this.schedule(state);
  14824. };
  14825. /** @deprecated internal use only */ ArrayLikeObservable.prototype._subscribe = function (subscriber) {
  14826. var index = 0;
  14827. var _a = this, arrayLike = _a.arrayLike, scheduler = _a.scheduler;
  14828. var length = arrayLike.length;
  14829. if (scheduler) {
  14830. return scheduler.schedule(ArrayLikeObservable.dispatch, 0, {
  14831. arrayLike: arrayLike, index: index, length: length, subscriber: subscriber
  14832. });
  14833. }
  14834. else {
  14835. for (var i = 0; i < length && !subscriber.closed; i++) {
  14836. subscriber.next(arrayLike[i]);
  14837. }
  14838. subscriber.complete();
  14839. }
  14840. };
  14841. return ArrayLikeObservable;
  14842. }(Observable_1.Observable));
  14843. exports.ArrayLikeObservable = ArrayLikeObservable;
  14844. //# sourceMappingURL=ArrayLikeObservable.js.map
  14845. /***/ }),
  14846. /* 149 */
  14847. /***/ (function(module, exports, __webpack_require__) {
  14848. "use strict";
  14849. var __extends = (this && this.__extends) || function (d, b) {
  14850. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  14851. function __() { this.constructor = d; }
  14852. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14853. };
  14854. var Subscriber_1 = __webpack_require__(4);
  14855. var Notification_1 = __webpack_require__(150);
  14856. /**
  14857. *
  14858. * Re-emits all notifications from source Observable with specified scheduler.
  14859. *
  14860. * <span class="informal">Ensure a specific scheduler is used, from outside of an Observable.</span>
  14861. *
  14862. * `observeOn` is an operator that accepts a scheduler as a first parameter, which will be used to reschedule
  14863. * notifications emitted by the source Observable. It might be useful, if you do not have control over
  14864. * internal scheduler of a given Observable, but want to control when its values are emitted nevertheless.
  14865. *
  14866. * Returned Observable emits the same notifications (nexted values, complete and error events) as the source Observable,
  14867. * but rescheduled with provided scheduler. Note that this doesn't mean that source Observables internal
  14868. * scheduler will be replaced in any way. Original scheduler still will be used, but when the source Observable emits
  14869. * notification, it will be immediately scheduled again - this time with scheduler passed to `observeOn`.
  14870. * An anti-pattern would be calling `observeOn` on Observable that emits lots of values synchronously, to split
  14871. * that emissions into asynchronous chunks. For this to happen, scheduler would have to be passed into the source
  14872. * Observable directly (usually into the operator that creates it). `observeOn` simply delays notifications a
  14873. * little bit more, to ensure that they are emitted at expected moments.
  14874. *
  14875. * As a matter of fact, `observeOn` accepts second parameter, which specifies in milliseconds with what delay notifications
  14876. * will be emitted. The main difference between {@link delay} operator and `observeOn` is that `observeOn`
  14877. * will delay all notifications - including error notifications - while `delay` will pass through error
  14878. * from source Observable immediately when it is emitted. In general it is highly recommended to use `delay` operator
  14879. * for any kind of delaying of values in the stream, while using `observeOn` to specify which scheduler should be used
  14880. * for notification emissions in general.
  14881. *
  14882. * @example <caption>Ensure values in subscribe are called just before browser repaint.</caption>
  14883. * const intervals = Rx.Observable.interval(10); // Intervals are scheduled
  14884. * // with async scheduler by default...
  14885. *
  14886. * intervals
  14887. * .observeOn(Rx.Scheduler.animationFrame) // ...but we will observe on animationFrame
  14888. * .subscribe(val => { // scheduler to ensure smooth animation.
  14889. * someDiv.style.height = val + 'px';
  14890. * });
  14891. *
  14892. * @see {@link delay}
  14893. *
  14894. * @param {IScheduler} scheduler Scheduler that will be used to reschedule notifications from source Observable.
  14895. * @param {number} [delay] Number of milliseconds that states with what delay every notification should be rescheduled.
  14896. * @return {Observable<T>} Observable that emits the same notifications as the source Observable,
  14897. * but with provided scheduler.
  14898. *
  14899. * @method observeOn
  14900. * @owner Observable
  14901. */
  14902. function observeOn(scheduler, delay) {
  14903. if (delay === void 0) { delay = 0; }
  14904. return function observeOnOperatorFunction(source) {
  14905. return source.lift(new ObserveOnOperator(scheduler, delay));
  14906. };
  14907. }
  14908. exports.observeOn = observeOn;
  14909. var ObserveOnOperator = (function () {
  14910. function ObserveOnOperator(scheduler, delay) {
  14911. if (delay === void 0) { delay = 0; }
  14912. this.scheduler = scheduler;
  14913. this.delay = delay;
  14914. }
  14915. ObserveOnOperator.prototype.call = function (subscriber, source) {
  14916. return source.subscribe(new ObserveOnSubscriber(subscriber, this.scheduler, this.delay));
  14917. };
  14918. return ObserveOnOperator;
  14919. }());
  14920. exports.ObserveOnOperator = ObserveOnOperator;
  14921. /**
  14922. * We need this JSDoc comment for affecting ESDoc.
  14923. * @ignore
  14924. * @extends {Ignored}
  14925. */
  14926. var ObserveOnSubscriber = (function (_super) {
  14927. __extends(ObserveOnSubscriber, _super);
  14928. function ObserveOnSubscriber(destination, scheduler, delay) {
  14929. if (delay === void 0) { delay = 0; }
  14930. _super.call(this, destination);
  14931. this.scheduler = scheduler;
  14932. this.delay = delay;
  14933. }
  14934. ObserveOnSubscriber.dispatch = function (arg) {
  14935. var notification = arg.notification, destination = arg.destination;
  14936. notification.observe(destination);
  14937. this.unsubscribe();
  14938. };
  14939. ObserveOnSubscriber.prototype.scheduleMessage = function (notification) {
  14940. this.add(this.scheduler.schedule(ObserveOnSubscriber.dispatch, this.delay, new ObserveOnMessage(notification, this.destination)));
  14941. };
  14942. ObserveOnSubscriber.prototype._next = function (value) {
  14943. this.scheduleMessage(Notification_1.Notification.createNext(value));
  14944. };
  14945. ObserveOnSubscriber.prototype._error = function (err) {
  14946. this.scheduleMessage(Notification_1.Notification.createError(err));
  14947. };
  14948. ObserveOnSubscriber.prototype._complete = function () {
  14949. this.scheduleMessage(Notification_1.Notification.createComplete());
  14950. };
  14951. return ObserveOnSubscriber;
  14952. }(Subscriber_1.Subscriber));
  14953. exports.ObserveOnSubscriber = ObserveOnSubscriber;
  14954. var ObserveOnMessage = (function () {
  14955. function ObserveOnMessage(notification, destination) {
  14956. this.notification = notification;
  14957. this.destination = destination;
  14958. }
  14959. return ObserveOnMessage;
  14960. }());
  14961. exports.ObserveOnMessage = ObserveOnMessage;
  14962. //# sourceMappingURL=observeOn.js.map
  14963. /***/ }),
  14964. /* 150 */
  14965. /***/ (function(module, exports, __webpack_require__) {
  14966. "use strict";
  14967. var Observable_1 = __webpack_require__(1);
  14968. /**
  14969. * Represents a push-based event or value that an {@link Observable} can emit.
  14970. * This class is particularly useful for operators that manage notifications,
  14971. * like {@link materialize}, {@link dematerialize}, {@link observeOn}, and
  14972. * others. Besides wrapping the actual delivered value, it also annotates it
  14973. * with metadata of, for instance, what type of push message it is (`next`,
  14974. * `error`, or `complete`).
  14975. *
  14976. * @see {@link materialize}
  14977. * @see {@link dematerialize}
  14978. * @see {@link observeOn}
  14979. *
  14980. * @class Notification<T>
  14981. */
  14982. var Notification = (function () {
  14983. function Notification(kind, value, error) {
  14984. this.kind = kind;
  14985. this.value = value;
  14986. this.error = error;
  14987. this.hasValue = kind === 'N';
  14988. }
  14989. /**
  14990. * Delivers to the given `observer` the value wrapped by this Notification.
  14991. * @param {Observer} observer
  14992. * @return
  14993. */
  14994. Notification.prototype.observe = function (observer) {
  14995. switch (this.kind) {
  14996. case 'N':
  14997. return observer.next && observer.next(this.value);
  14998. case 'E':
  14999. return observer.error && observer.error(this.error);
  15000. case 'C':
  15001. return observer.complete && observer.complete();
  15002. }
  15003. };
  15004. /**
  15005. * Given some {@link Observer} callbacks, deliver the value represented by the
  15006. * current Notification to the correctly corresponding callback.
  15007. * @param {function(value: T): void} next An Observer `next` callback.
  15008. * @param {function(err: any): void} [error] An Observer `error` callback.
  15009. * @param {function(): void} [complete] An Observer `complete` callback.
  15010. * @return {any}
  15011. */
  15012. Notification.prototype.do = function (next, error, complete) {
  15013. var kind = this.kind;
  15014. switch (kind) {
  15015. case 'N':
  15016. return next && next(this.value);
  15017. case 'E':
  15018. return error && error(this.error);
  15019. case 'C':
  15020. return complete && complete();
  15021. }
  15022. };
  15023. /**
  15024. * Takes an Observer or its individual callback functions, and calls `observe`
  15025. * or `do` methods accordingly.
  15026. * @param {Observer|function(value: T): void} nextOrObserver An Observer or
  15027. * the `next` callback.
  15028. * @param {function(err: any): void} [error] An Observer `error` callback.
  15029. * @param {function(): void} [complete] An Observer `complete` callback.
  15030. * @return {any}
  15031. */
  15032. Notification.prototype.accept = function (nextOrObserver, error, complete) {
  15033. if (nextOrObserver && typeof nextOrObserver.next === 'function') {
  15034. return this.observe(nextOrObserver);
  15035. }
  15036. else {
  15037. return this.do(nextOrObserver, error, complete);
  15038. }
  15039. };
  15040. /**
  15041. * Returns a simple Observable that just delivers the notification represented
  15042. * by this Notification instance.
  15043. * @return {any}
  15044. */
  15045. Notification.prototype.toObservable = function () {
  15046. var kind = this.kind;
  15047. switch (kind) {
  15048. case 'N':
  15049. return Observable_1.Observable.of(this.value);
  15050. case 'E':
  15051. return Observable_1.Observable.throw(this.error);
  15052. case 'C':
  15053. return Observable_1.Observable.empty();
  15054. }
  15055. throw new Error('unexpected notification kind value');
  15056. };
  15057. /**
  15058. * A shortcut to create a Notification instance of the type `next` from a
  15059. * given value.
  15060. * @param {T} value The `next` value.
  15061. * @return {Notification<T>} The "next" Notification representing the
  15062. * argument.
  15063. */
  15064. Notification.createNext = function (value) {
  15065. if (typeof value !== 'undefined') {
  15066. return new Notification('N', value);
  15067. }
  15068. return Notification.undefinedValueNotification;
  15069. };
  15070. /**
  15071. * A shortcut to create a Notification instance of the type `error` from a
  15072. * given error.
  15073. * @param {any} [err] The `error` error.
  15074. * @return {Notification<T>} The "error" Notification representing the
  15075. * argument.
  15076. */
  15077. Notification.createError = function (err) {
  15078. return new Notification('E', undefined, err);
  15079. };
  15080. /**
  15081. * A shortcut to create a Notification instance of the type `complete`.
  15082. * @return {Notification<any>} The valueless "complete" Notification.
  15083. */
  15084. Notification.createComplete = function () {
  15085. return Notification.completeNotification;
  15086. };
  15087. Notification.completeNotification = new Notification('C');
  15088. Notification.undefinedValueNotification = new Notification('N', undefined);
  15089. return Notification;
  15090. }());
  15091. exports.Notification = Notification;
  15092. //# sourceMappingURL=Notification.js.map
  15093. /***/ }),
  15094. /* 151 */
  15095. /***/ (function(module, exports, __webpack_require__) {
  15096. "use strict";
  15097. var mergeAll_1 = __webpack_require__(54);
  15098. /**
  15099. * Converts a higher-order Observable into a first-order Observable by
  15100. * concatenating the inner Observables in order.
  15101. *
  15102. * <span class="informal">Flattens an Observable-of-Observables by putting one
  15103. * inner Observable after the other.</span>
  15104. *
  15105. * <img src="./img/concatAll.png" width="100%">
  15106. *
  15107. * Joins every Observable emitted by the source (a higher-order Observable), in
  15108. * a serial fashion. It subscribes to each inner Observable only after the
  15109. * previous inner Observable has completed, and merges all of their values into
  15110. * the returned observable.
  15111. *
  15112. * __Warning:__ If the source Observable emits Observables quickly and
  15113. * endlessly, and the inner Observables it emits generally complete slower than
  15114. * the source emits, you can run into memory issues as the incoming Observables
  15115. * collect in an unbounded buffer.
  15116. *
  15117. * Note: `concatAll` is equivalent to `mergeAll` with concurrency parameter set
  15118. * to `1`.
  15119. *
  15120. * @example <caption>For each click event, tick every second from 0 to 3, with no concurrency</caption>
  15121. * var clicks = Rx.Observable.fromEvent(document, 'click');
  15122. * var higherOrder = clicks.map(ev => Rx.Observable.interval(1000).take(4));
  15123. * var firstOrder = higherOrder.concatAll();
  15124. * firstOrder.subscribe(x => console.log(x));
  15125. *
  15126. * // Results in the following:
  15127. * // (results are not concurrent)
  15128. * // For every click on the "document" it will emit values 0 to 3 spaced
  15129. * // on a 1000ms interval
  15130. * // one click = 1000ms-> 0 -1000ms-> 1 -1000ms-> 2 -1000ms-> 3
  15131. *
  15132. * @see {@link combineAll}
  15133. * @see {@link concat}
  15134. * @see {@link concatMap}
  15135. * @see {@link concatMapTo}
  15136. * @see {@link exhaust}
  15137. * @see {@link mergeAll}
  15138. * @see {@link switch}
  15139. * @see {@link zipAll}
  15140. *
  15141. * @return {Observable} An Observable emitting values from all the inner
  15142. * Observables concatenated.
  15143. * @method concatAll
  15144. * @owner Observable
  15145. */
  15146. function concatAll() {
  15147. return mergeAll_1.mergeAll(1);
  15148. }
  15149. exports.concatAll = concatAll;
  15150. //# sourceMappingURL=concatAll.js.map
  15151. /***/ }),
  15152. /* 152 */
  15153. /***/ (function(module, exports, __webpack_require__) {
  15154. "use strict";
  15155. function identity(x) {
  15156. return x;
  15157. }
  15158. exports.identity = identity;
  15159. //# sourceMappingURL=identity.js.map
  15160. /***/ }),
  15161. /* 153 */
  15162. /***/ (function(module, exports, __webpack_require__) {
  15163. "use strict";
  15164. var ArrayObservable_1 = __webpack_require__(24);
  15165. var ScalarObservable_1 = __webpack_require__(46);
  15166. var EmptyObservable_1 = __webpack_require__(28);
  15167. var concat_1 = __webpack_require__(53);
  15168. var isScheduler_1 = __webpack_require__(25);
  15169. /* tslint:enable:max-line-length */
  15170. /**
  15171. * Returns an Observable that emits the items you specify as arguments before it begins to emit
  15172. * items emitted by the source Observable.
  15173. *
  15174. * <img src="./img/startWith.png" width="100%">
  15175. *
  15176. * @param {...T} values - Items you want the modified Observable to emit first.
  15177. * @param {Scheduler} [scheduler] - A {@link IScheduler} to use for scheduling
  15178. * the emissions of the `next` notifications.
  15179. * @return {Observable} An Observable that emits the items in the specified Iterable and then emits the items
  15180. * emitted by the source Observable.
  15181. * @method startWith
  15182. * @owner Observable
  15183. */
  15184. function startWith() {
  15185. var array = [];
  15186. for (var _i = 0; _i < arguments.length; _i++) {
  15187. array[_i - 0] = arguments[_i];
  15188. }
  15189. return function (source) {
  15190. var scheduler = array[array.length - 1];
  15191. if (isScheduler_1.isScheduler(scheduler)) {
  15192. array.pop();
  15193. }
  15194. else {
  15195. scheduler = null;
  15196. }
  15197. var len = array.length;
  15198. if (len === 1) {
  15199. return concat_1.concat(new ScalarObservable_1.ScalarObservable(array[0], scheduler), source);
  15200. }
  15201. else if (len > 1) {
  15202. return concat_1.concat(new ArrayObservable_1.ArrayObservable(array, scheduler), source);
  15203. }
  15204. else {
  15205. return concat_1.concat(new EmptyObservable_1.EmptyObservable(scheduler), source);
  15206. }
  15207. };
  15208. }
  15209. exports.startWith = startWith;
  15210. //# sourceMappingURL=startWith.js.map
  15211. /***/ }),
  15212. /* 154 */
  15213. /***/ (function(module, exports, __webpack_require__) {
  15214. "use strict";
  15215. Object.defineProperty(exports, "__esModule", { value: true });
  15216. var pluck_1 = __webpack_require__(7);
  15217. var ignoreElements_1 = __webpack_require__(12);
  15218. var partition_1 = __webpack_require__(155);
  15219. var merge_1 = __webpack_require__(38);
  15220. var browser_utils_1 = __webpack_require__(23);
  15221. var tap_1 = __webpack_require__(6);
  15222. var withLatestFrom_1 = __webpack_require__(0);
  15223. var map_1 = __webpack_require__(2);
  15224. function setScrollEffect(xs, inputs) {
  15225. {
  15226. /**
  15227. * Group the incoming event with window, document & scrollProportionally argument
  15228. */
  15229. var tupleStream$ = xs.pipe(withLatestFrom_1.withLatestFrom(inputs.window$, inputs.document$, inputs.option$.pipe(pluck_1.pluck("scrollProportionally"))));
  15230. /**
  15231. * Split the stream between document scrolls and element scrolls
  15232. */
  15233. var _a = partition_1.partition(function (_a) {
  15234. var event = _a[0];
  15235. return event.tagName === "document";
  15236. })(tupleStream$), document$ = _a[0], element$ = _a[1];
  15237. /**
  15238. * Further split the element scroll between those matching in `scrollElementMapping`
  15239. * and regular element scrolls
  15240. */
  15241. var _b = partition_1.partition(function (_a) {
  15242. var event = _a[0];
  15243. return event.mappingIndex > -1;
  15244. })(element$), mapped$ = _b[0], nonMapped$ = _b[1];
  15245. return merge_1.merge(
  15246. /**
  15247. * Main window scroll
  15248. */
  15249. document$.pipe(tap_1.tap(function (incoming) {
  15250. var event = incoming[0], window = incoming[1], document = incoming[2], scrollProportionally = incoming[3];
  15251. var scrollSpace = browser_utils_1.getDocumentScrollSpace(document);
  15252. if (scrollProportionally) {
  15253. return window.scrollTo(0, scrollSpace.y * event.position.proportional); // % of y axis of scroll to px
  15254. }
  15255. return window.scrollTo(0, event.position.raw.y);
  15256. })),
  15257. /**
  15258. * Regular, non-mapped Element scrolls
  15259. */
  15260. nonMapped$.pipe(tap_1.tap(function (incoming) {
  15261. var event = incoming[0], window = incoming[1], document = incoming[2], scrollProportionally = incoming[3];
  15262. var matchingElements = document.getElementsByTagName(event.tagName);
  15263. if (matchingElements && matchingElements.length) {
  15264. var match = matchingElements[event.index];
  15265. if (match) {
  15266. return scrollElement(match, scrollProportionally, event);
  15267. }
  15268. }
  15269. })),
  15270. /**
  15271. * Element scrolls given in 'scrollElementMapping'
  15272. */
  15273. mapped$.pipe(withLatestFrom_1.withLatestFrom(inputs.option$.pipe(pluck_1.pluck("scrollElementMapping"))),
  15274. /**
  15275. * Filter the elements in the option `scrollElementMapping` so
  15276. * that it does not contain the element that triggered the event
  15277. */
  15278. map_1.map(function (_a) {
  15279. var incoming = _a[0], scrollElementMapping = _a[1];
  15280. var event = incoming[0];
  15281. return [
  15282. incoming,
  15283. scrollElementMapping.filter(function (item, index) { return index !== event.mappingIndex; })
  15284. ];
  15285. }),
  15286. /**
  15287. * Now perform the scroll on all other matching elements
  15288. */
  15289. tap_1.tap(function (_a) {
  15290. var incoming = _a[0], scrollElementMapping = _a[1];
  15291. var event = incoming[0], window = incoming[1], document = incoming[2], scrollProportionally = incoming[3];
  15292. scrollElementMapping
  15293. .map(function (selector) { return document.querySelector(selector); })
  15294. .forEach(function (element) {
  15295. scrollElement(element, scrollProportionally, event);
  15296. });
  15297. }))).pipe(ignoreElements_1.ignoreElements());
  15298. }
  15299. }
  15300. exports.setScrollEffect = setScrollEffect;
  15301. function scrollElement(element, scrollProportionally, event) {
  15302. if (scrollProportionally && element.scrollTo) {
  15303. return element.scrollTo(0, element.scrollHeight * event.position.proportional); // % of y axis of scroll to px
  15304. }
  15305. return element.scrollTo(0, event.position.raw.y);
  15306. }
  15307. /***/ }),
  15308. /* 155 */
  15309. /***/ (function(module, exports, __webpack_require__) {
  15310. "use strict";
  15311. var not_1 = __webpack_require__(156);
  15312. var filter_1 = __webpack_require__(5);
  15313. /**
  15314. * Splits the source Observable into two, one with values that satisfy a
  15315. * predicate, and another with values that don't satisfy the predicate.
  15316. *
  15317. * <span class="informal">It's like {@link filter}, but returns two Observables:
  15318. * one like the output of {@link filter}, and the other with values that did not
  15319. * pass the condition.</span>
  15320. *
  15321. * <img src="./img/partition.png" width="100%">
  15322. *
  15323. * `partition` outputs an array with two Observables that partition the values
  15324. * from the source Observable through the given `predicate` function. The first
  15325. * Observable in that array emits source values for which the predicate argument
  15326. * returns true. The second Observable emits source values for which the
  15327. * predicate returns false. The first behaves like {@link filter} and the second
  15328. * behaves like {@link filter} with the predicate negated.
  15329. *
  15330. * @example <caption>Partition click events into those on DIV elements and those elsewhere</caption>
  15331. * var clicks = Rx.Observable.fromEvent(document, 'click');
  15332. * var parts = clicks.partition(ev => ev.target.tagName === 'DIV');
  15333. * var clicksOnDivs = parts[0];
  15334. * var clicksElsewhere = parts[1];
  15335. * clicksOnDivs.subscribe(x => console.log('DIV clicked: ', x));
  15336. * clicksElsewhere.subscribe(x => console.log('Other clicked: ', x));
  15337. *
  15338. * @see {@link filter}
  15339. *
  15340. * @param {function(value: T, index: number): boolean} predicate A function that
  15341. * evaluates each value emitted by the source Observable. If it returns `true`,
  15342. * the value is emitted on the first Observable in the returned array, if
  15343. * `false` the value is emitted on the second Observable in the array. The
  15344. * `index` parameter is the number `i` for the i-th source emission that has
  15345. * happened since the subscription, starting from the number `0`.
  15346. * @param {any} [thisArg] An optional argument to determine the value of `this`
  15347. * in the `predicate` function.
  15348. * @return {[Observable<T>, Observable<T>]} An array with two Observables: one
  15349. * with values that passed the predicate, and another with values that did not
  15350. * pass the predicate.
  15351. * @method partition
  15352. * @owner Observable
  15353. */
  15354. function partition(predicate, thisArg) {
  15355. return function (source) { return [
  15356. filter_1.filter(predicate, thisArg)(source),
  15357. filter_1.filter(not_1.not(predicate, thisArg))(source)
  15358. ]; };
  15359. }
  15360. exports.partition = partition;
  15361. //# sourceMappingURL=partition.js.map
  15362. /***/ }),
  15363. /* 156 */
  15364. /***/ (function(module, exports, __webpack_require__) {
  15365. "use strict";
  15366. function not(pred, thisArg) {
  15367. function notPred() {
  15368. return !(notPred.pred.apply(notPred.thisArg, arguments));
  15369. }
  15370. notPred.pred = pred;
  15371. notPred.thisArg = thisArg;
  15372. return notPred;
  15373. }
  15374. exports.not = not;
  15375. //# sourceMappingURL=not.js.map
  15376. /***/ }),
  15377. /* 157 */
  15378. /***/ (function(module, exports, __webpack_require__) {
  15379. "use strict";
  15380. Object.defineProperty(exports, "__esModule", { value: true });
  15381. var map_1 = __webpack_require__(2);
  15382. var Log = __webpack_require__(15);
  15383. function incomingBrowserNotify(xs) {
  15384. return xs.pipe(map_1.map(function (event) { return Log.overlayInfo(event.message, event.timeout); }));
  15385. }
  15386. exports.incomingBrowserNotify = incomingBrowserNotify;
  15387. /***/ }),
  15388. /* 158 */
  15389. /***/ (function(module, exports, __webpack_require__) {
  15390. "use strict";
  15391. Object.defineProperty(exports, "__esModule", { value: true });
  15392. var pluck_1 = __webpack_require__(7);
  15393. var filter_1 = __webpack_require__(5);
  15394. var map_1 = __webpack_require__(2);
  15395. var withLatestFrom_1 = __webpack_require__(0);
  15396. var browser_set_location_effect_1 = __webpack_require__(88);
  15397. function incomingBrowserLocation(xs, inputs) {
  15398. return xs.pipe(withLatestFrom_1.withLatestFrom(inputs.option$.pipe(pluck_1.pluck("ghostMode", "location"))), filter_1.filter(function (_a) {
  15399. var canSyncLocation = _a[1];
  15400. return canSyncLocation === true;
  15401. }), map_1.map(function (_a) {
  15402. var event = _a[0];
  15403. return browser_set_location_effect_1.browserSetLocation(event);
  15404. }));
  15405. }
  15406. exports.incomingBrowserLocation = incomingBrowserLocation;
  15407. /***/ }),
  15408. /* 159 */
  15409. /***/ (function(module, exports, __webpack_require__) {
  15410. "use strict";
  15411. var SubscribeOnObservable_1 = __webpack_require__(160);
  15412. /**
  15413. * Asynchronously subscribes Observers to this Observable on the specified IScheduler.
  15414. *
  15415. * <img src="./img/subscribeOn.png" width="100%">
  15416. *
  15417. * @param {Scheduler} scheduler - The IScheduler to perform subscription actions on.
  15418. * @return {Observable<T>} The source Observable modified so that its subscriptions happen on the specified IScheduler.
  15419. .
  15420. * @method subscribeOn
  15421. * @owner Observable
  15422. */
  15423. function subscribeOn(scheduler, delay) {
  15424. if (delay === void 0) { delay = 0; }
  15425. return function subscribeOnOperatorFunction(source) {
  15426. return source.lift(new SubscribeOnOperator(scheduler, delay));
  15427. };
  15428. }
  15429. exports.subscribeOn = subscribeOn;
  15430. var SubscribeOnOperator = (function () {
  15431. function SubscribeOnOperator(scheduler, delay) {
  15432. this.scheduler = scheduler;
  15433. this.delay = delay;
  15434. }
  15435. SubscribeOnOperator.prototype.call = function (subscriber, source) {
  15436. return new SubscribeOnObservable_1.SubscribeOnObservable(source, this.delay, this.scheduler).subscribe(subscriber);
  15437. };
  15438. return SubscribeOnOperator;
  15439. }());
  15440. //# sourceMappingURL=subscribeOn.js.map
  15441. /***/ }),
  15442. /* 160 */
  15443. /***/ (function(module, exports, __webpack_require__) {
  15444. "use strict";
  15445. var __extends = (this && this.__extends) || function (d, b) {
  15446. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  15447. function __() { this.constructor = d; }
  15448. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15449. };
  15450. var Observable_1 = __webpack_require__(1);
  15451. var asap_1 = __webpack_require__(161);
  15452. var isNumeric_1 = __webpack_require__(76);
  15453. /**
  15454. * We need this JSDoc comment for affecting ESDoc.
  15455. * @extends {Ignored}
  15456. * @hide true
  15457. */
  15458. var SubscribeOnObservable = (function (_super) {
  15459. __extends(SubscribeOnObservable, _super);
  15460. function SubscribeOnObservable(source, delayTime, scheduler) {
  15461. if (delayTime === void 0) { delayTime = 0; }
  15462. if (scheduler === void 0) { scheduler = asap_1.asap; }
  15463. _super.call(this);
  15464. this.source = source;
  15465. this.delayTime = delayTime;
  15466. this.scheduler = scheduler;
  15467. if (!isNumeric_1.isNumeric(delayTime) || delayTime < 0) {
  15468. this.delayTime = 0;
  15469. }
  15470. if (!scheduler || typeof scheduler.schedule !== 'function') {
  15471. this.scheduler = asap_1.asap;
  15472. }
  15473. }
  15474. SubscribeOnObservable.create = function (source, delay, scheduler) {
  15475. if (delay === void 0) { delay = 0; }
  15476. if (scheduler === void 0) { scheduler = asap_1.asap; }
  15477. return new SubscribeOnObservable(source, delay, scheduler);
  15478. };
  15479. SubscribeOnObservable.dispatch = function (arg) {
  15480. var source = arg.source, subscriber = arg.subscriber;
  15481. return this.add(source.subscribe(subscriber));
  15482. };
  15483. /** @deprecated internal use only */ SubscribeOnObservable.prototype._subscribe = function (subscriber) {
  15484. var delay = this.delayTime;
  15485. var source = this.source;
  15486. var scheduler = this.scheduler;
  15487. return scheduler.schedule(SubscribeOnObservable.dispatch, delay, {
  15488. source: source, subscriber: subscriber
  15489. });
  15490. };
  15491. return SubscribeOnObservable;
  15492. }(Observable_1.Observable));
  15493. exports.SubscribeOnObservable = SubscribeOnObservable;
  15494. //# sourceMappingURL=SubscribeOnObservable.js.map
  15495. /***/ }),
  15496. /* 161 */
  15497. /***/ (function(module, exports, __webpack_require__) {
  15498. "use strict";
  15499. var AsapAction_1 = __webpack_require__(162);
  15500. var AsapScheduler_1 = __webpack_require__(165);
  15501. /**
  15502. *
  15503. * Asap Scheduler
  15504. *
  15505. * <span class="informal">Perform task as fast as it can be performed asynchronously</span>
  15506. *
  15507. * `asap` scheduler behaves the same as {@link async} scheduler when you use it to delay task
  15508. * in time. If however you set delay to `0`, `asap` will wait for current synchronously executing
  15509. * code to end and then it will try to execute given task as fast as possible.
  15510. *
  15511. * `asap` scheduler will do its best to minimize time between end of currently executing code
  15512. * and start of scheduled task. This makes it best candidate for performing so called "deferring".
  15513. * Traditionally this was achieved by calling `setTimeout(deferredTask, 0)`, but that technique involves
  15514. * some (although minimal) unwanted delay.
  15515. *
  15516. * Note that using `asap` scheduler does not necessarily mean that your task will be first to process
  15517. * after currently executing code. In particular, if some task was also scheduled with `asap` before,
  15518. * that task will execute first. That being said, if you need to schedule task asynchronously, but
  15519. * as soon as possible, `asap` scheduler is your best bet.
  15520. *
  15521. * @example <caption>Compare async and asap scheduler</caption>
  15522. *
  15523. * Rx.Scheduler.async.schedule(() => console.log('async')); // scheduling 'async' first...
  15524. * Rx.Scheduler.asap.schedule(() => console.log('asap'));
  15525. *
  15526. * // Logs:
  15527. * // "asap"
  15528. * // "async"
  15529. * // ... but 'asap' goes first!
  15530. *
  15531. * @static true
  15532. * @name asap
  15533. * @owner Scheduler
  15534. */
  15535. exports.asap = new AsapScheduler_1.AsapScheduler(AsapAction_1.AsapAction);
  15536. //# sourceMappingURL=asap.js.map
  15537. /***/ }),
  15538. /* 162 */
  15539. /***/ (function(module, exports, __webpack_require__) {
  15540. "use strict";
  15541. var __extends = (this && this.__extends) || function (d, b) {
  15542. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  15543. function __() { this.constructor = d; }
  15544. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15545. };
  15546. var Immediate_1 = __webpack_require__(163);
  15547. var AsyncAction_1 = __webpack_require__(78);
  15548. /**
  15549. * We need this JSDoc comment for affecting ESDoc.
  15550. * @ignore
  15551. * @extends {Ignored}
  15552. */
  15553. var AsapAction = (function (_super) {
  15554. __extends(AsapAction, _super);
  15555. function AsapAction(scheduler, work) {
  15556. _super.call(this, scheduler, work);
  15557. this.scheduler = scheduler;
  15558. this.work = work;
  15559. }
  15560. AsapAction.prototype.requestAsyncId = function (scheduler, id, delay) {
  15561. if (delay === void 0) { delay = 0; }
  15562. // If delay is greater than 0, request as an async action.
  15563. if (delay !== null && delay > 0) {
  15564. return _super.prototype.requestAsyncId.call(this, scheduler, id, delay);
  15565. }
  15566. // Push the action to the end of the scheduler queue.
  15567. scheduler.actions.push(this);
  15568. // If a microtask has already been scheduled, don't schedule another
  15569. // one. If a microtask hasn't been scheduled yet, schedule one now. Return
  15570. // the current scheduled microtask id.
  15571. return scheduler.scheduled || (scheduler.scheduled = Immediate_1.Immediate.setImmediate(scheduler.flush.bind(scheduler, null)));
  15572. };
  15573. AsapAction.prototype.recycleAsyncId = function (scheduler, id, delay) {
  15574. if (delay === void 0) { delay = 0; }
  15575. // If delay exists and is greater than 0, or if the delay is null (the
  15576. // action wasn't rescheduled) but was originally scheduled as an async
  15577. // action, then recycle as an async action.
  15578. if ((delay !== null && delay > 0) || (delay === null && this.delay > 0)) {
  15579. return _super.prototype.recycleAsyncId.call(this, scheduler, id, delay);
  15580. }
  15581. // If the scheduler queue is empty, cancel the requested microtask and
  15582. // set the scheduled flag to undefined so the next AsapAction will schedule
  15583. // its own.
  15584. if (scheduler.actions.length === 0) {
  15585. Immediate_1.Immediate.clearImmediate(id);
  15586. scheduler.scheduled = undefined;
  15587. }
  15588. // Return undefined so the action knows to request a new async id if it's rescheduled.
  15589. return undefined;
  15590. };
  15591. return AsapAction;
  15592. }(AsyncAction_1.AsyncAction));
  15593. exports.AsapAction = AsapAction;
  15594. //# sourceMappingURL=AsapAction.js.map
  15595. /***/ }),
  15596. /* 163 */
  15597. /***/ (function(module, exports, __webpack_require__) {
  15598. "use strict";
  15599. /* WEBPACK VAR INJECTION */(function(clearImmediate, setImmediate) {/**
  15600. Some credit for this helper goes to http://github.com/YuzuJS/setImmediate
  15601. */
  15602. var root_1 = __webpack_require__(8);
  15603. var ImmediateDefinition = (function () {
  15604. function ImmediateDefinition(root) {
  15605. this.root = root;
  15606. if (root.setImmediate && typeof root.setImmediate === 'function') {
  15607. this.setImmediate = root.setImmediate.bind(root);
  15608. this.clearImmediate = root.clearImmediate.bind(root);
  15609. }
  15610. else {
  15611. this.nextHandle = 1;
  15612. this.tasksByHandle = {};
  15613. this.currentlyRunningATask = false;
  15614. // Don't get fooled by e.g. browserify environments.
  15615. if (this.canUseProcessNextTick()) {
  15616. // For Node.js before 0.9
  15617. this.setImmediate = this.createProcessNextTickSetImmediate();
  15618. }
  15619. else if (this.canUsePostMessage()) {
  15620. // For non-IE10 modern browsers
  15621. this.setImmediate = this.createPostMessageSetImmediate();
  15622. }
  15623. else if (this.canUseMessageChannel()) {
  15624. // For web workers, where supported
  15625. this.setImmediate = this.createMessageChannelSetImmediate();
  15626. }
  15627. else if (this.canUseReadyStateChange()) {
  15628. // For IE 6–8
  15629. this.setImmediate = this.createReadyStateChangeSetImmediate();
  15630. }
  15631. else {
  15632. // For older browsers
  15633. this.setImmediate = this.createSetTimeoutSetImmediate();
  15634. }
  15635. var ci = function clearImmediate(handle) {
  15636. delete clearImmediate.instance.tasksByHandle[handle];
  15637. };
  15638. ci.instance = this;
  15639. this.clearImmediate = ci;
  15640. }
  15641. }
  15642. ImmediateDefinition.prototype.identify = function (o) {
  15643. return this.root.Object.prototype.toString.call(o);
  15644. };
  15645. ImmediateDefinition.prototype.canUseProcessNextTick = function () {
  15646. return this.identify(this.root.process) === '[object process]';
  15647. };
  15648. ImmediateDefinition.prototype.canUseMessageChannel = function () {
  15649. return Boolean(this.root.MessageChannel);
  15650. };
  15651. ImmediateDefinition.prototype.canUseReadyStateChange = function () {
  15652. var document = this.root.document;
  15653. return Boolean(document && 'onreadystatechange' in document.createElement('script'));
  15654. };
  15655. ImmediateDefinition.prototype.canUsePostMessage = function () {
  15656. var root = this.root;
  15657. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  15658. // where `root.postMessage` means something completely different and can't be used for this purpose.
  15659. if (root.postMessage && !root.importScripts) {
  15660. var postMessageIsAsynchronous_1 = true;
  15661. var oldOnMessage = root.onmessage;
  15662. root.onmessage = function () {
  15663. postMessageIsAsynchronous_1 = false;
  15664. };
  15665. root.postMessage('', '*');
  15666. root.onmessage = oldOnMessage;
  15667. return postMessageIsAsynchronous_1;
  15668. }
  15669. return false;
  15670. };
  15671. // This function accepts the same arguments as setImmediate, but
  15672. // returns a function that requires no arguments.
  15673. ImmediateDefinition.prototype.partiallyApplied = function (handler) {
  15674. var args = [];
  15675. for (var _i = 1; _i < arguments.length; _i++) {
  15676. args[_i - 1] = arguments[_i];
  15677. }
  15678. var fn = function result() {
  15679. var _a = result, handler = _a.handler, args = _a.args;
  15680. if (typeof handler === 'function') {
  15681. handler.apply(undefined, args);
  15682. }
  15683. else {
  15684. (new Function('' + handler))();
  15685. }
  15686. };
  15687. fn.handler = handler;
  15688. fn.args = args;
  15689. return fn;
  15690. };
  15691. ImmediateDefinition.prototype.addFromSetImmediateArguments = function (args) {
  15692. this.tasksByHandle[this.nextHandle] = this.partiallyApplied.apply(undefined, args);
  15693. return this.nextHandle++;
  15694. };
  15695. ImmediateDefinition.prototype.createProcessNextTickSetImmediate = function () {
  15696. var fn = function setImmediate() {
  15697. var instance = setImmediate.instance;
  15698. var handle = instance.addFromSetImmediateArguments(arguments);
  15699. instance.root.process.nextTick(instance.partiallyApplied(instance.runIfPresent, handle));
  15700. return handle;
  15701. };
  15702. fn.instance = this;
  15703. return fn;
  15704. };
  15705. ImmediateDefinition.prototype.createPostMessageSetImmediate = function () {
  15706. // Installs an event handler on `global` for the `message` event: see
  15707. // * https://developer.mozilla.org/en/DOM/window.postMessage
  15708. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  15709. var root = this.root;
  15710. var messagePrefix = 'setImmediate$' + root.Math.random() + '$';
  15711. var onGlobalMessage = function globalMessageHandler(event) {
  15712. var instance = globalMessageHandler.instance;
  15713. if (event.source === root &&
  15714. typeof event.data === 'string' &&
  15715. event.data.indexOf(messagePrefix) === 0) {
  15716. instance.runIfPresent(+event.data.slice(messagePrefix.length));
  15717. }
  15718. };
  15719. onGlobalMessage.instance = this;
  15720. root.addEventListener('message', onGlobalMessage, false);
  15721. var fn = function setImmediate() {
  15722. var _a = setImmediate, messagePrefix = _a.messagePrefix, instance = _a.instance;
  15723. var handle = instance.addFromSetImmediateArguments(arguments);
  15724. instance.root.postMessage(messagePrefix + handle, '*');
  15725. return handle;
  15726. };
  15727. fn.instance = this;
  15728. fn.messagePrefix = messagePrefix;
  15729. return fn;
  15730. };
  15731. ImmediateDefinition.prototype.runIfPresent = function (handle) {
  15732. // From the spec: 'Wait until any invocations of this algorithm started before this one have completed.'
  15733. // So if we're currently running a task, we'll need to delay this invocation.
  15734. if (this.currentlyRunningATask) {
  15735. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  15736. // 'too much recursion' error.
  15737. this.root.setTimeout(this.partiallyApplied(this.runIfPresent, handle), 0);
  15738. }
  15739. else {
  15740. var task = this.tasksByHandle[handle];
  15741. if (task) {
  15742. this.currentlyRunningATask = true;
  15743. try {
  15744. task();
  15745. }
  15746. finally {
  15747. this.clearImmediate(handle);
  15748. this.currentlyRunningATask = false;
  15749. }
  15750. }
  15751. }
  15752. };
  15753. ImmediateDefinition.prototype.createMessageChannelSetImmediate = function () {
  15754. var _this = this;
  15755. var channel = new this.root.MessageChannel();
  15756. channel.port1.onmessage = function (event) {
  15757. var handle = event.data;
  15758. _this.runIfPresent(handle);
  15759. };
  15760. var fn = function setImmediate() {
  15761. var _a = setImmediate, channel = _a.channel, instance = _a.instance;
  15762. var handle = instance.addFromSetImmediateArguments(arguments);
  15763. channel.port2.postMessage(handle);
  15764. return handle;
  15765. };
  15766. fn.channel = channel;
  15767. fn.instance = this;
  15768. return fn;
  15769. };
  15770. ImmediateDefinition.prototype.createReadyStateChangeSetImmediate = function () {
  15771. var fn = function setImmediate() {
  15772. var instance = setImmediate.instance;
  15773. var root = instance.root;
  15774. var doc = root.document;
  15775. var html = doc.documentElement;
  15776. var handle = instance.addFromSetImmediateArguments(arguments);
  15777. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  15778. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  15779. var script = doc.createElement('script');
  15780. script.onreadystatechange = function () {
  15781. instance.runIfPresent(handle);
  15782. script.onreadystatechange = null;
  15783. html.removeChild(script);
  15784. script = null;
  15785. };
  15786. html.appendChild(script);
  15787. return handle;
  15788. };
  15789. fn.instance = this;
  15790. return fn;
  15791. };
  15792. ImmediateDefinition.prototype.createSetTimeoutSetImmediate = function () {
  15793. var fn = function setImmediate() {
  15794. var instance = setImmediate.instance;
  15795. var handle = instance.addFromSetImmediateArguments(arguments);
  15796. instance.root.setTimeout(instance.partiallyApplied(instance.runIfPresent, handle), 0);
  15797. return handle;
  15798. };
  15799. fn.instance = this;
  15800. return fn;
  15801. };
  15802. return ImmediateDefinition;
  15803. }());
  15804. exports.ImmediateDefinition = ImmediateDefinition;
  15805. exports.Immediate = new ImmediateDefinition(root_1.root);
  15806. //# sourceMappingURL=Immediate.js.map
  15807. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(96).clearImmediate, __webpack_require__(96).setImmediate))
  15808. /***/ }),
  15809. /* 164 */
  15810. /***/ (function(module, exports, __webpack_require__) {
  15811. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  15812. "use strict";
  15813. if (global.setImmediate) {
  15814. return;
  15815. }
  15816. var nextHandle = 1; // Spec says greater than zero
  15817. var tasksByHandle = {};
  15818. var currentlyRunningATask = false;
  15819. var doc = global.document;
  15820. var registerImmediate;
  15821. function setImmediate(callback) {
  15822. // Callback can either be a function or a string
  15823. if (typeof callback !== "function") {
  15824. callback = new Function("" + callback);
  15825. }
  15826. // Copy function arguments
  15827. var args = new Array(arguments.length - 1);
  15828. for (var i = 0; i < args.length; i++) {
  15829. args[i] = arguments[i + 1];
  15830. }
  15831. // Store and register the task
  15832. var task = { callback: callback, args: args };
  15833. tasksByHandle[nextHandle] = task;
  15834. registerImmediate(nextHandle);
  15835. return nextHandle++;
  15836. }
  15837. function clearImmediate(handle) {
  15838. delete tasksByHandle[handle];
  15839. }
  15840. function run(task) {
  15841. var callback = task.callback;
  15842. var args = task.args;
  15843. switch (args.length) {
  15844. case 0:
  15845. callback();
  15846. break;
  15847. case 1:
  15848. callback(args[0]);
  15849. break;
  15850. case 2:
  15851. callback(args[0], args[1]);
  15852. break;
  15853. case 3:
  15854. callback(args[0], args[1], args[2]);
  15855. break;
  15856. default:
  15857. callback.apply(undefined, args);
  15858. break;
  15859. }
  15860. }
  15861. function runIfPresent(handle) {
  15862. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  15863. // So if we're currently running a task, we'll need to delay this invocation.
  15864. if (currentlyRunningATask) {
  15865. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  15866. // "too much recursion" error.
  15867. setTimeout(runIfPresent, 0, handle);
  15868. } else {
  15869. var task = tasksByHandle[handle];
  15870. if (task) {
  15871. currentlyRunningATask = true;
  15872. try {
  15873. run(task);
  15874. } finally {
  15875. clearImmediate(handle);
  15876. currentlyRunningATask = false;
  15877. }
  15878. }
  15879. }
  15880. }
  15881. function installNextTickImplementation() {
  15882. registerImmediate = function(handle) {
  15883. process.nextTick(function () { runIfPresent(handle); });
  15884. };
  15885. }
  15886. function canUsePostMessage() {
  15887. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  15888. // where `global.postMessage` means something completely different and can't be used for this purpose.
  15889. if (global.postMessage && !global.importScripts) {
  15890. var postMessageIsAsynchronous = true;
  15891. var oldOnMessage = global.onmessage;
  15892. global.onmessage = function() {
  15893. postMessageIsAsynchronous = false;
  15894. };
  15895. global.postMessage("", "*");
  15896. global.onmessage = oldOnMessage;
  15897. return postMessageIsAsynchronous;
  15898. }
  15899. }
  15900. function installPostMessageImplementation() {
  15901. // Installs an event handler on `global` for the `message` event: see
  15902. // * https://developer.mozilla.org/en/DOM/window.postMessage
  15903. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  15904. var messagePrefix = "setImmediate$" + Math.random() + "$";
  15905. var onGlobalMessage = function(event) {
  15906. if (event.source === global &&
  15907. typeof event.data === "string" &&
  15908. event.data.indexOf(messagePrefix) === 0) {
  15909. runIfPresent(+event.data.slice(messagePrefix.length));
  15910. }
  15911. };
  15912. if (global.addEventListener) {
  15913. global.addEventListener("message", onGlobalMessage, false);
  15914. } else {
  15915. global.attachEvent("onmessage", onGlobalMessage);
  15916. }
  15917. registerImmediate = function(handle) {
  15918. global.postMessage(messagePrefix + handle, "*");
  15919. };
  15920. }
  15921. function installMessageChannelImplementation() {
  15922. var channel = new MessageChannel();
  15923. channel.port1.onmessage = function(event) {
  15924. var handle = event.data;
  15925. runIfPresent(handle);
  15926. };
  15927. registerImmediate = function(handle) {
  15928. channel.port2.postMessage(handle);
  15929. };
  15930. }
  15931. function installReadyStateChangeImplementation() {
  15932. var html = doc.documentElement;
  15933. registerImmediate = function(handle) {
  15934. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  15935. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  15936. var script = doc.createElement("script");
  15937. script.onreadystatechange = function () {
  15938. runIfPresent(handle);
  15939. script.onreadystatechange = null;
  15940. html.removeChild(script);
  15941. script = null;
  15942. };
  15943. html.appendChild(script);
  15944. };
  15945. }
  15946. function installSetTimeoutImplementation() {
  15947. registerImmediate = function(handle) {
  15948. setTimeout(runIfPresent, 0, handle);
  15949. };
  15950. }
  15951. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  15952. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  15953. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  15954. // Don't get fooled by e.g. browserify environments.
  15955. if ({}.toString.call(global.process) === "[object process]") {
  15956. // For Node.js before 0.9
  15957. installNextTickImplementation();
  15958. } else if (canUsePostMessage()) {
  15959. // For non-IE10 modern browsers
  15960. installPostMessageImplementation();
  15961. } else if (global.MessageChannel) {
  15962. // For web workers, where supported
  15963. installMessageChannelImplementation();
  15964. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  15965. // For IE 6–8
  15966. installReadyStateChangeImplementation();
  15967. } else {
  15968. // For older browsers
  15969. installSetTimeoutImplementation();
  15970. }
  15971. attachTo.setImmediate = setImmediate;
  15972. attachTo.clearImmediate = clearImmediate;
  15973. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  15974. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(33)))
  15975. /***/ }),
  15976. /* 165 */
  15977. /***/ (function(module, exports, __webpack_require__) {
  15978. "use strict";
  15979. var __extends = (this && this.__extends) || function (d, b) {
  15980. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  15981. function __() { this.constructor = d; }
  15982. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15983. };
  15984. var AsyncScheduler_1 = __webpack_require__(79);
  15985. var AsapScheduler = (function (_super) {
  15986. __extends(AsapScheduler, _super);
  15987. function AsapScheduler() {
  15988. _super.apply(this, arguments);
  15989. }
  15990. AsapScheduler.prototype.flush = function (action) {
  15991. this.active = true;
  15992. this.scheduled = undefined;
  15993. var actions = this.actions;
  15994. var error;
  15995. var index = -1;
  15996. var count = actions.length;
  15997. action = action || actions.shift();
  15998. do {
  15999. if (error = action.execute(action.state, action.delay)) {
  16000. break;
  16001. }
  16002. } while (++index < count && (action = actions.shift()));
  16003. this.active = false;
  16004. if (error) {
  16005. while (++index < count && (action = actions.shift())) {
  16006. action.unsubscribe();
  16007. }
  16008. throw error;
  16009. }
  16010. };
  16011. return AsapScheduler;
  16012. }(AsyncScheduler_1.AsyncScheduler));
  16013. exports.AsapScheduler = AsapScheduler;
  16014. //# sourceMappingURL=AsapScheduler.js.map
  16015. /***/ }),
  16016. /* 166 */
  16017. /***/ (function(module, exports, __webpack_require__) {
  16018. "use strict";
  16019. Object.defineProperty(exports, "__esModule", { value: true });
  16020. var filter_1 = __webpack_require__(5);
  16021. var empty_1 = __webpack_require__(17);
  16022. var utils_1 = __webpack_require__(22);
  16023. var of_1 = __webpack_require__(10);
  16024. var withLatestFrom_1 = __webpack_require__(0);
  16025. var mergeMap_1 = __webpack_require__(16);
  16026. var file_reload_effect_1 = __webpack_require__(85);
  16027. var BrowserReload_1 = __webpack_require__(95);
  16028. function incomingFileReload(xs, inputs) {
  16029. return xs.pipe(withLatestFrom_1.withLatestFrom(inputs.option$), filter_1.filter(function (_a) {
  16030. var event = _a[0], options = _a[1];
  16031. return options.codeSync;
  16032. }), mergeMap_1.mergeMap(function (_a) {
  16033. var event = _a[0], options = _a[1];
  16034. if (event.url || !options.injectChanges) {
  16035. return BrowserReload_1.reloadBrowserSafe();
  16036. }
  16037. if (event.basename && event.ext && utils_1.isBlacklisted(event)) {
  16038. return empty_1.empty();
  16039. }
  16040. return of_1.of(file_reload_effect_1.fileReload(event));
  16041. }));
  16042. }
  16043. exports.incomingFileReload = incomingFileReload;
  16044. /***/ }),
  16045. /* 167 */
  16046. /***/ (function(module, exports, __webpack_require__) {
  16047. "use strict";
  16048. Object.defineProperty(exports, "__esModule", { value: true });
  16049. var pluck_1 = __webpack_require__(7);
  16050. var of_1 = __webpack_require__(10);
  16051. var Log = __webpack_require__(15);
  16052. var withLatestFrom_1 = __webpack_require__(0);
  16053. var mergeMap_1 = __webpack_require__(16);
  16054. var set_options_effect_1 = __webpack_require__(52);
  16055. function incomingConnection(xs, inputs) {
  16056. return xs.pipe(withLatestFrom_1.withLatestFrom(inputs.option$.pipe(pluck_1.pluck("logPrefix"))), mergeMap_1.mergeMap(function (_a) {
  16057. var x = _a[0], logPrefix = _a[1];
  16058. var prefix = logPrefix
  16059. ? logPrefix + ": "
  16060. : '';
  16061. return of_1.of(set_options_effect_1.setOptions(x), Log.overlayInfo(prefix + "connected"));
  16062. }));
  16063. }
  16064. exports.incomingConnection = incomingConnection;
  16065. /***/ }),
  16066. /* 168 */
  16067. /***/ (function(module, exports, __webpack_require__) {
  16068. "use strict";
  16069. Object.defineProperty(exports, "__esModule", { value: true });
  16070. var ignoreElements_1 = __webpack_require__(12);
  16071. var tap_1 = __webpack_require__(6);
  16072. function incomingDisconnect(xs) {
  16073. return xs.pipe(tap_1.tap(function (x) { return console.log(x); }), ignoreElements_1.ignoreElements());
  16074. }
  16075. exports.incomingDisconnect = incomingDisconnect;
  16076. /***/ }),
  16077. /* 169 */
  16078. /***/ (function(module, exports, __webpack_require__) {
  16079. "use strict";
  16080. Object.defineProperty(exports, "__esModule", { value: true });
  16081. var map_1 = __webpack_require__(2);
  16082. var set_options_effect_1 = __webpack_require__(52);
  16083. function incomingOptionsSet(xs) {
  16084. return xs.pipe(map_1.map(function (event) { return set_options_effect_1.setOptions(event.options); }));
  16085. }
  16086. exports.incomingOptionsSet = incomingOptionsSet;
  16087. /***/ }),
  16088. /* 170 */
  16089. /***/ (function(module, exports, __webpack_require__) {
  16090. "use strict";
  16091. Object.defineProperty(exports, "__esModule", { value: true });
  16092. var _a;
  16093. var browser_utils_1 = __webpack_require__(23);
  16094. var effects_1 = __webpack_require__(9);
  16095. var BehaviorSubject_1 = __webpack_require__(14);
  16096. var empty_1 = __webpack_require__(17);
  16097. var of_1 = __webpack_require__(10);
  16098. var Log = __webpack_require__(15);
  16099. var withLatestFrom_1 = __webpack_require__(0);
  16100. var map_1 = __webpack_require__(2);
  16101. var set_window_name_dom_effect_1 = __webpack_require__(83);
  16102. var set_scroll_dom_effect_1 = __webpack_require__(82);
  16103. exports.PREFIX = "<<BS_START>>";
  16104. exports.SUFFIX = "<<BS_START>>";
  16105. exports.regex = new RegExp(exports.PREFIX + "(.+?)" + exports.SUFFIX, "g");
  16106. function parseFromString(input) {
  16107. var match;
  16108. var last;
  16109. while ((match = exports.regex.exec(input))) {
  16110. last = match[1];
  16111. }
  16112. if (last) {
  16113. return JSON.parse(last);
  16114. }
  16115. }
  16116. function initWindowName(window) {
  16117. var saved = (function () {
  16118. /**
  16119. * On page load, check window.name for an existing
  16120. * BS json blob & parse it.
  16121. */
  16122. try {
  16123. return parseFromString(window.name);
  16124. }
  16125. catch (e) {
  16126. return {};
  16127. }
  16128. })();
  16129. /**
  16130. * Remove any existing BS json from window.name
  16131. * to ensure we don't interfere with any other
  16132. * libs who may be using it.
  16133. */
  16134. window.name = window.name.replace(exports.regex, "");
  16135. /**
  16136. * If the JSON was parsed correctly, try to
  16137. * find a scroll property and restore it.
  16138. */
  16139. if (saved && saved.bs && saved.bs.hardReload && saved.bs.scroll) {
  16140. var _a = saved.bs.scroll, x = _a.x, y = _a.y;
  16141. return of_1.of(set_scroll_dom_effect_1.setScroll(x, y), Log.consoleDebug("[ScrollRestore] x = " + x + " y = " + y));
  16142. }
  16143. return empty_1.empty();
  16144. }
  16145. exports.initWindowName = initWindowName;
  16146. exports.scrollRestoreHandlers$ = new BehaviorSubject_1.BehaviorSubject((_a = {},
  16147. // [EffectNames.SetOptions]: (xs, inputs: Inputs) => {
  16148. // return xs.pipe(
  16149. // withLatestFrom(inputs.window$),
  16150. // take(1),
  16151. // mergeMap(([options, window]) => {
  16152. // if (options.scrollRestoreTechnique === "window.name") {
  16153. // return initWindowName(window);
  16154. // }
  16155. // return empty();
  16156. // })
  16157. // );
  16158. // },
  16159. /**
  16160. * Save the current scroll position
  16161. * before the browser is reloaded (via window.location.reload(true))
  16162. * @param xs
  16163. * @param {Inputs} inputs
  16164. */
  16165. _a[effects_1.EffectNames.PreBrowserReload] = function (xs, inputs) {
  16166. return xs.pipe(withLatestFrom_1.withLatestFrom(inputs.window$, inputs.document$), map_1.map(function (_a) {
  16167. var window = _a[1], document = _a[2];
  16168. return [
  16169. window.name,
  16170. exports.PREFIX,
  16171. JSON.stringify({
  16172. bs: {
  16173. hardReload: true,
  16174. scroll: browser_utils_1.getBrowserScrollPosition(window, document)
  16175. }
  16176. }),
  16177. exports.SUFFIX
  16178. ].join("");
  16179. }), map_1.map(function (value) { return set_window_name_dom_effect_1.setWindowName(value); }));
  16180. },
  16181. _a));
  16182. /***/ }),
  16183. /* 171 */
  16184. /***/ (function(module, exports, __webpack_require__) {
  16185. "use strict";
  16186. Object.defineProperty(exports, "__esModule", { value: true });
  16187. var merge_1 = __webpack_require__(38);
  16188. var form_inputs_listener_1 = __webpack_require__(172);
  16189. var clicks_listener_1 = __webpack_require__(174);
  16190. var scroll_listener_1 = __webpack_require__(175);
  16191. var form_toggles_listener_1 = __webpack_require__(176);
  16192. function initListeners(window, document, socket$, option$) {
  16193. var merged$ = merge_1.merge(scroll_listener_1.getScrollStream(window, document, socket$, option$), clicks_listener_1.getClickStream(document, socket$, option$), form_inputs_listener_1.getFormInputStream(document, socket$, option$), form_toggles_listener_1.getFormTogglesStream(document, socket$, option$));
  16194. return merged$;
  16195. }
  16196. exports.initListeners = initListeners;
  16197. /***/ }),
  16198. /* 172 */
  16199. /***/ (function(module, exports, __webpack_require__) {
  16200. "use strict";
  16201. Object.defineProperty(exports, "__esModule", { value: true });
  16202. var socket_messages_1 = __webpack_require__(11);
  16203. var browser_utils_1 = __webpack_require__(23);
  16204. var utils_1 = __webpack_require__(22);
  16205. var KeyupEvent = __webpack_require__(94);
  16206. var filter_1 = __webpack_require__(5);
  16207. var withLatestFrom_1 = __webpack_require__(0);
  16208. var map_1 = __webpack_require__(2);
  16209. var pluck_1 = __webpack_require__(7);
  16210. var skip_1 = __webpack_require__(39);
  16211. var distinctUntilChanged_1 = __webpack_require__(40);
  16212. var switchMap_1 = __webpack_require__(21);
  16213. var empty_1 = __webpack_require__(17);
  16214. var fromEvent_1 = __webpack_require__(41);
  16215. function getFormInputStream(document, socket$, option$) {
  16216. var canSync$ = utils_1.createTimedBooleanSwitch(socket$.pipe(filter_1.filter(function (_a) {
  16217. var name = _a[0];
  16218. return name === socket_messages_1.IncomingSocketNames.Keyup;
  16219. })));
  16220. return option$.pipe(skip_1.skip(1), // initial option set before the connection event
  16221. pluck_1.pluck("ghostMode", "forms", "inputs"), distinctUntilChanged_1.distinctUntilChanged(), switchMap_1.switchMap(function (formInputs) {
  16222. if (!formInputs) {
  16223. return empty_1.empty();
  16224. }
  16225. return fromEvent_1.fromEvent(document.body, "keyup", true).pipe(map_1.map(function (e) { return e.target || e.srcElement; }), filter_1.filter(function (target) {
  16226. return target.tagName === "INPUT" ||
  16227. target.tagName === "TEXTAREA";
  16228. }), withLatestFrom_1.withLatestFrom(canSync$), filter_1.filter(function (_a) {
  16229. var canSync = _a[1];
  16230. return canSync;
  16231. }), map_1.map(function (_a) {
  16232. var eventTarget = _a[0];
  16233. var target = browser_utils_1.getElementData(eventTarget);
  16234. var value = eventTarget.value;
  16235. return KeyupEvent.outgoing(target, value);
  16236. }));
  16237. }));
  16238. }
  16239. exports.getFormInputStream = getFormInputStream;
  16240. /***/ }),
  16241. /* 173 */
  16242. /***/ (function(module, exports, __webpack_require__) {
  16243. "use strict";
  16244. var __extends = (this && this.__extends) || function (d, b) {
  16245. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  16246. function __() { this.constructor = d; }
  16247. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16248. };
  16249. var Observable_1 = __webpack_require__(1);
  16250. var tryCatch_1 = __webpack_require__(43);
  16251. var isFunction_1 = __webpack_require__(42);
  16252. var errorObject_1 = __webpack_require__(27);
  16253. var Subscription_1 = __webpack_require__(13);
  16254. var toString = Object.prototype.toString;
  16255. function isNodeStyleEventEmitter(sourceObj) {
  16256. return !!sourceObj && typeof sourceObj.addListener === 'function' && typeof sourceObj.removeListener === 'function';
  16257. }
  16258. function isJQueryStyleEventEmitter(sourceObj) {
  16259. return !!sourceObj && typeof sourceObj.on === 'function' && typeof sourceObj.off === 'function';
  16260. }
  16261. function isNodeList(sourceObj) {
  16262. return !!sourceObj && toString.call(sourceObj) === '[object NodeList]';
  16263. }
  16264. function isHTMLCollection(sourceObj) {
  16265. return !!sourceObj && toString.call(sourceObj) === '[object HTMLCollection]';
  16266. }
  16267. function isEventTarget(sourceObj) {
  16268. return !!sourceObj && typeof sourceObj.addEventListener === 'function' && typeof sourceObj.removeEventListener === 'function';
  16269. }
  16270. /**
  16271. * We need this JSDoc comment for affecting ESDoc.
  16272. * @extends {Ignored}
  16273. * @hide true
  16274. */
  16275. var FromEventObservable = (function (_super) {
  16276. __extends(FromEventObservable, _super);
  16277. function FromEventObservable(sourceObj, eventName, selector, options) {
  16278. _super.call(this);
  16279. this.sourceObj = sourceObj;
  16280. this.eventName = eventName;
  16281. this.selector = selector;
  16282. this.options = options;
  16283. }
  16284. /* tslint:enable:max-line-length */
  16285. /**
  16286. * Creates an Observable that emits events of a specific type coming from the
  16287. * given event target.
  16288. *
  16289. * <span class="informal">Creates an Observable from DOM events, or Node.js
  16290. * EventEmitter events or others.</span>
  16291. *
  16292. * <img src="./img/fromEvent.png" width="100%">
  16293. *
  16294. * `fromEvent` accepts as a first argument event target, which is an object with methods
  16295. * for registering event handler functions. As a second argument it takes string that indicates
  16296. * type of event we want to listen for. `fromEvent` supports selected types of event targets,
  16297. * which are described in detail below. If your event target does not match any of the ones listed,
  16298. * you should use {@link fromEventPattern}, which can be used on arbitrary APIs.
  16299. * When it comes to APIs supported by `fromEvent`, their methods for adding and removing event
  16300. * handler functions have different names, but they all accept a string describing event type
  16301. * and function itself, which will be called whenever said event happens.
  16302. *
  16303. * Every time resulting Observable is subscribed, event handler function will be registered
  16304. * to event target on given event type. When that event fires, value
  16305. * passed as a first argument to registered function will be emitted by output Observable.
  16306. * When Observable is unsubscribed, function will be unregistered from event target.
  16307. *
  16308. * Note that if event target calls registered function with more than one argument, second
  16309. * and following arguments will not appear in resulting stream. In order to get access to them,
  16310. * you can pass to `fromEvent` optional project function, which will be called with all arguments
  16311. * passed to event handler. Output Observable will then emit value returned by project function,
  16312. * instead of the usual value.
  16313. *
  16314. * Remember that event targets listed below are checked via duck typing. It means that
  16315. * no matter what kind of object you have and no matter what environment you work in,
  16316. * you can safely use `fromEvent` on that object if it exposes described methods (provided
  16317. * of course they behave as was described above). So for example if Node.js library exposes
  16318. * event target which has the same method names as DOM EventTarget, `fromEvent` is still
  16319. * a good choice.
  16320. *
  16321. * If the API you use is more callback then event handler oriented (subscribed
  16322. * callback function fires only once and thus there is no need to manually
  16323. * unregister it), you should use {@link bindCallback} or {@link bindNodeCallback}
  16324. * instead.
  16325. *
  16326. * `fromEvent` supports following types of event targets:
  16327. *
  16328. * **DOM EventTarget**
  16329. *
  16330. * This is an object with `addEventListener` and `removeEventListener` methods.
  16331. *
  16332. * In the browser, `addEventListener` accepts - apart from event type string and event
  16333. * handler function arguments - optional third parameter, which is either an object or boolean,
  16334. * both used for additional configuration how and when passed function will be called. When
  16335. * `fromEvent` is used with event target of that type, you can provide this values
  16336. * as third parameter as well.
  16337. *
  16338. * **Node.js EventEmitter**
  16339. *
  16340. * An object with `addListener` and `removeListener` methods.
  16341. *
  16342. * **JQuery-style event target**
  16343. *
  16344. * An object with `on` and `off` methods
  16345. *
  16346. * **DOM NodeList**
  16347. *
  16348. * List of DOM Nodes, returned for example by `document.querySelectorAll` or `Node.childNodes`.
  16349. *
  16350. * Although this collection is not event target in itself, `fromEvent` will iterate over all Nodes
  16351. * it contains and install event handler function in every of them. When returned Observable
  16352. * is unsubscribed, function will be removed from all Nodes.
  16353. *
  16354. * **DOM HtmlCollection**
  16355. *
  16356. * Just as in case of NodeList it is a collection of DOM nodes. Here as well event handler function is
  16357. * installed and removed in each of elements.
  16358. *
  16359. *
  16360. * @example <caption>Emits clicks happening on the DOM document</caption>
  16361. * var clicks = Rx.Observable.fromEvent(document, 'click');
  16362. * clicks.subscribe(x => console.log(x));
  16363. *
  16364. * // Results in:
  16365. * // MouseEvent object logged to console every time a click
  16366. * // occurs on the document.
  16367. *
  16368. *
  16369. * @example <caption>Use addEventListener with capture option</caption>
  16370. * var clicksInDocument = Rx.Observable.fromEvent(document, 'click', true); // note optional configuration parameter
  16371. * // which will be passed to addEventListener
  16372. * var clicksInDiv = Rx.Observable.fromEvent(someDivInDocument, 'click');
  16373. *
  16374. * clicksInDocument.subscribe(() => console.log('document'));
  16375. * clicksInDiv.subscribe(() => console.log('div'));
  16376. *
  16377. * // By default events bubble UP in DOM tree, so normally
  16378. * // when we would click on div in document
  16379. * // "div" would be logged first and then "document".
  16380. * // Since we specified optional `capture` option, document
  16381. * // will catch event when it goes DOWN DOM tree, so console
  16382. * // will log "document" and then "div".
  16383. *
  16384. * @see {@link bindCallback}
  16385. * @see {@link bindNodeCallback}
  16386. * @see {@link fromEventPattern}
  16387. *
  16388. * @param {EventTargetLike} target The DOM EventTarget, Node.js
  16389. * EventEmitter, JQuery-like event target, NodeList or HTMLCollection to attach the event handler to.
  16390. * @param {string} eventName The event name of interest, being emitted by the
  16391. * `target`.
  16392. * @param {EventListenerOptions} [options] Options to pass through to addEventListener
  16393. * @param {SelectorMethodSignature<T>} [selector] An optional function to
  16394. * post-process results. It takes the arguments from the event handler and
  16395. * should return a single value.
  16396. * @return {Observable<T>}
  16397. * @static true
  16398. * @name fromEvent
  16399. * @owner Observable
  16400. */
  16401. FromEventObservable.create = function (target, eventName, options, selector) {
  16402. if (isFunction_1.isFunction(options)) {
  16403. selector = options;
  16404. options = undefined;
  16405. }
  16406. return new FromEventObservable(target, eventName, selector, options);
  16407. };
  16408. FromEventObservable.setupSubscription = function (sourceObj, eventName, handler, subscriber, options) {
  16409. var unsubscribe;
  16410. if (isNodeList(sourceObj) || isHTMLCollection(sourceObj)) {
  16411. for (var i = 0, len = sourceObj.length; i < len; i++) {
  16412. FromEventObservable.setupSubscription(sourceObj[i], eventName, handler, subscriber, options);
  16413. }
  16414. }
  16415. else if (isEventTarget(sourceObj)) {
  16416. var source_1 = sourceObj;
  16417. sourceObj.addEventListener(eventName, handler, options);
  16418. unsubscribe = function () { return source_1.removeEventListener(eventName, handler, options); };
  16419. }
  16420. else if (isJQueryStyleEventEmitter(sourceObj)) {
  16421. var source_2 = sourceObj;
  16422. sourceObj.on(eventName, handler);
  16423. unsubscribe = function () { return source_2.off(eventName, handler); };
  16424. }
  16425. else if (isNodeStyleEventEmitter(sourceObj)) {
  16426. var source_3 = sourceObj;
  16427. sourceObj.addListener(eventName, handler);
  16428. unsubscribe = function () { return source_3.removeListener(eventName, handler); };
  16429. }
  16430. else {
  16431. throw new TypeError('Invalid event target');
  16432. }
  16433. subscriber.add(new Subscription_1.Subscription(unsubscribe));
  16434. };
  16435. /** @deprecated internal use only */ FromEventObservable.prototype._subscribe = function (subscriber) {
  16436. var sourceObj = this.sourceObj;
  16437. var eventName = this.eventName;
  16438. var options = this.options;
  16439. var selector = this.selector;
  16440. var handler = selector ? function () {
  16441. var args = [];
  16442. for (var _i = 0; _i < arguments.length; _i++) {
  16443. args[_i - 0] = arguments[_i];
  16444. }
  16445. var result = tryCatch_1.tryCatch(selector).apply(void 0, args);
  16446. if (result === errorObject_1.errorObject) {
  16447. subscriber.error(errorObject_1.errorObject.e);
  16448. }
  16449. else {
  16450. subscriber.next(result);
  16451. }
  16452. } : function (e) { return subscriber.next(e); };
  16453. FromEventObservable.setupSubscription(sourceObj, eventName, handler, subscriber, options);
  16454. };
  16455. return FromEventObservable;
  16456. }(Observable_1.Observable));
  16457. exports.FromEventObservable = FromEventObservable;
  16458. //# sourceMappingURL=FromEventObservable.js.map
  16459. /***/ }),
  16460. /* 174 */
  16461. /***/ (function(module, exports, __webpack_require__) {
  16462. "use strict";
  16463. Object.defineProperty(exports, "__esModule", { value: true });
  16464. var utils_1 = __webpack_require__(22);
  16465. var socket_messages_1 = __webpack_require__(11);
  16466. var browser_utils_1 = __webpack_require__(23);
  16467. var ClickEvent = __webpack_require__(93);
  16468. var withLatestFrom_1 = __webpack_require__(0);
  16469. var filter_1 = __webpack_require__(5);
  16470. var map_1 = __webpack_require__(2);
  16471. var pluck_1 = __webpack_require__(7);
  16472. var skip_1 = __webpack_require__(39);
  16473. var distinctUntilChanged_1 = __webpack_require__(40);
  16474. var switchMap_1 = __webpack_require__(21);
  16475. var fromEvent_1 = __webpack_require__(41);
  16476. var empty_1 = __webpack_require__(17);
  16477. function getClickStream(document, socket$, option$) {
  16478. var canSync$ = utils_1.createTimedBooleanSwitch(socket$.pipe(filter_1.filter(function (_a) {
  16479. var name = _a[0];
  16480. return name === socket_messages_1.IncomingSocketNames.Click;
  16481. })));
  16482. return option$.pipe(skip_1.skip(1), // initial option set before the connection event
  16483. pluck_1.pluck("ghostMode", "clicks"), distinctUntilChanged_1.distinctUntilChanged(), switchMap_1.switchMap(function (canClick) {
  16484. if (!canClick) {
  16485. return empty_1.empty();
  16486. }
  16487. return fromEvent_1.fromEvent(document, "click", true).pipe(map_1.map(function (e) { return e.target; }), filter_1.filter(function (target) {
  16488. if (target.tagName === "LABEL") {
  16489. var id = target.getAttribute("for");
  16490. if (id && document.getElementById(id)) {
  16491. return false;
  16492. }
  16493. }
  16494. return true;
  16495. }), withLatestFrom_1.withLatestFrom(canSync$), filter_1.filter(function (_a) {
  16496. var canSync = _a[1];
  16497. return canSync;
  16498. }), map_1.map(function (_a) {
  16499. var target = _a[0];
  16500. return ClickEvent.outgoing(browser_utils_1.getElementData(target));
  16501. }));
  16502. }));
  16503. }
  16504. exports.getClickStream = getClickStream;
  16505. /***/ }),
  16506. /* 175 */
  16507. /***/ (function(module, exports, __webpack_require__) {
  16508. "use strict";
  16509. Object.defineProperty(exports, "__esModule", { value: true });
  16510. var utils_1 = __webpack_require__(22);
  16511. var socket_messages_1 = __webpack_require__(11);
  16512. var browser_utils_1 = __webpack_require__(23);
  16513. var ScrollEvent = __webpack_require__(84);
  16514. var filter_1 = __webpack_require__(5);
  16515. var map_1 = __webpack_require__(2);
  16516. var withLatestFrom_1 = __webpack_require__(0);
  16517. var pluck_1 = __webpack_require__(7);
  16518. var distinctUntilChanged_1 = __webpack_require__(40);
  16519. var switchMap_1 = __webpack_require__(21);
  16520. var empty_1 = __webpack_require__(17);
  16521. var skip_1 = __webpack_require__(39);
  16522. var fromEvent_1 = __webpack_require__(41);
  16523. function getScrollStream(window, document, socket$, option$) {
  16524. var canSync$ = utils_1.createTimedBooleanSwitch(socket$.pipe(filter_1.filter(function (_a) {
  16525. var name = _a[0];
  16526. return name === socket_messages_1.IncomingSocketNames.Scroll;
  16527. })));
  16528. /**
  16529. * If the option 'scrollElementMapping' is provided
  16530. * we cache thw
  16531. * @type {Observable<(Element | null)[]>}
  16532. */
  16533. var elemMap$ = option$.pipe(pluck_1.pluck("scrollElementMapping"), map_1.map(function (selectors) {
  16534. return selectors.map(function (selector) { return document.querySelector(selector); });
  16535. }));
  16536. return option$.pipe(skip_1.skip(1), // initial option set before the connection event
  16537. pluck_1.pluck("ghostMode", "scroll"), distinctUntilChanged_1.distinctUntilChanged(), switchMap_1.switchMap(function (scroll) {
  16538. if (!scroll)
  16539. return empty_1.empty();
  16540. return fromEvent_1.fromEvent(document, "scroll", true).pipe(map_1.map(function (e) { return e.target; }), withLatestFrom_1.withLatestFrom(canSync$, elemMap$), filter_1.filter(function (_a) {
  16541. var canSync = _a[1];
  16542. return Boolean(canSync);
  16543. }), map_1.map(function (_a) {
  16544. var target = _a[0], canSync = _a[1], elemMap = _a[2];
  16545. if (target === document) {
  16546. return ScrollEvent.outgoing(browser_utils_1.getScrollPosition(window, document), "document", 0);
  16547. }
  16548. var elems = document.getElementsByTagName(target.tagName);
  16549. var index = Array.prototype.indexOf.call(elems || [], target);
  16550. return ScrollEvent.outgoing(browser_utils_1.getScrollPositionForElement(target), target.tagName, index, elemMap.indexOf(target));
  16551. }));
  16552. }));
  16553. }
  16554. exports.getScrollStream = getScrollStream;
  16555. /***/ }),
  16556. /* 176 */
  16557. /***/ (function(module, exports, __webpack_require__) {
  16558. "use strict";
  16559. Object.defineProperty(exports, "__esModule", { value: true });
  16560. var socket_messages_1 = __webpack_require__(11);
  16561. var browser_utils_1 = __webpack_require__(23);
  16562. var utils_1 = __webpack_require__(22);
  16563. var FormToggleEvent = __webpack_require__(97);
  16564. var filter_1 = __webpack_require__(5);
  16565. var skip_1 = __webpack_require__(39);
  16566. var pluck_1 = __webpack_require__(7);
  16567. var distinctUntilChanged_1 = __webpack_require__(40);
  16568. var withLatestFrom_1 = __webpack_require__(0);
  16569. var map_1 = __webpack_require__(2);
  16570. var switchMap_1 = __webpack_require__(21);
  16571. var empty_1 = __webpack_require__(17);
  16572. var fromEvent_1 = __webpack_require__(41);
  16573. function getFormTogglesStream(document, socket$, option$) {
  16574. var canSync$ = utils_1.createTimedBooleanSwitch(socket$.pipe(filter_1.filter(function (_a) {
  16575. var name = _a[0];
  16576. return name === socket_messages_1.IncomingSocketNames.InputToggle;
  16577. })));
  16578. return option$.pipe(skip_1.skip(1), pluck_1.pluck("ghostMode", "forms", "toggles"), distinctUntilChanged_1.distinctUntilChanged(), switchMap_1.switchMap(function (canToggle) {
  16579. if (!canToggle) {
  16580. return empty_1.empty();
  16581. }
  16582. return fromEvent_1.fromEvent(document, "change", true).pipe(map_1.map(function (e) { return e.target || e.srcElement; }), filter_1.filter(function (elem) { return elem.tagName === "SELECT"; }), withLatestFrom_1.withLatestFrom(canSync$), filter_1.filter(function (_a) {
  16583. var canSync = _a[1];
  16584. return canSync;
  16585. }), map_1.map(function (_a) {
  16586. var elem = _a[0], canSync = _a[1];
  16587. var data = browser_utils_1.getElementData(elem);
  16588. return FormToggleEvent.outgoing(data, {
  16589. type: elem.type,
  16590. checked: elem.checked,
  16591. value: elem.value
  16592. });
  16593. }));
  16594. }));
  16595. }
  16596. exports.getFormTogglesStream = getFormTogglesStream;
  16597. /***/ }),
  16598. /* 177 */
  16599. /***/ (function(module, exports, __webpack_require__) {
  16600. "use strict";
  16601. var __extends = (this && this.__extends) || function (d, b) {
  16602. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  16603. function __() { this.constructor = d; }
  16604. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16605. };
  16606. var Subscriber_1 = __webpack_require__(4);
  16607. var Subscription_1 = __webpack_require__(13);
  16608. var Observable_1 = __webpack_require__(1);
  16609. var Subject_1 = __webpack_require__(37);
  16610. var Map_1 = __webpack_require__(178);
  16611. var FastMap_1 = __webpack_require__(180);
  16612. /* tslint:enable:max-line-length */
  16613. /**
  16614. * Groups the items emitted by an Observable according to a specified criterion,
  16615. * and emits these grouped items as `GroupedObservables`, one
  16616. * {@link GroupedObservable} per group.
  16617. *
  16618. * <img src="./img/groupBy.png" width="100%">
  16619. *
  16620. * @example <caption>Group objects by id and return as array</caption>
  16621. * Observable.of<Obj>({id: 1, name: 'aze1'},
  16622. * {id: 2, name: 'sf2'},
  16623. * {id: 2, name: 'dg2'},
  16624. * {id: 1, name: 'erg1'},
  16625. * {id: 1, name: 'df1'},
  16626. * {id: 2, name: 'sfqfb2'},
  16627. * {id: 3, name: 'qfs3'},
  16628. * {id: 2, name: 'qsgqsfg2'}
  16629. * )
  16630. * .groupBy(p => p.id)
  16631. * .flatMap( (group$) => group$.reduce((acc, cur) => [...acc, cur], []))
  16632. * .subscribe(p => console.log(p));
  16633. *
  16634. * // displays:
  16635. * // [ { id: 1, name: 'aze1' },
  16636. * // { id: 1, name: 'erg1' },
  16637. * // { id: 1, name: 'df1' } ]
  16638. * //
  16639. * // [ { id: 2, name: 'sf2' },
  16640. * // { id: 2, name: 'dg2' },
  16641. * // { id: 2, name: 'sfqfb2' },
  16642. * // { id: 2, name: 'qsgqsfg2' } ]
  16643. * //
  16644. * // [ { id: 3, name: 'qfs3' } ]
  16645. *
  16646. * @example <caption>Pivot data on the id field</caption>
  16647. * Observable.of<Obj>({id: 1, name: 'aze1'},
  16648. * {id: 2, name: 'sf2'},
  16649. * {id: 2, name: 'dg2'},
  16650. * {id: 1, name: 'erg1'},
  16651. * {id: 1, name: 'df1'},
  16652. * {id: 2, name: 'sfqfb2'},
  16653. * {id: 3, name: 'qfs1'},
  16654. * {id: 2, name: 'qsgqsfg2'}
  16655. * )
  16656. * .groupBy(p => p.id, p => p.name)
  16657. * .flatMap( (group$) => group$.reduce((acc, cur) => [...acc, cur], ["" + group$.key]))
  16658. * .map(arr => ({'id': parseInt(arr[0]), 'values': arr.slice(1)}))
  16659. * .subscribe(p => console.log(p));
  16660. *
  16661. * // displays:
  16662. * // { id: 1, values: [ 'aze1', 'erg1', 'df1' ] }
  16663. * // { id: 2, values: [ 'sf2', 'dg2', 'sfqfb2', 'qsgqsfg2' ] }
  16664. * // { id: 3, values: [ 'qfs1' ] }
  16665. *
  16666. * @param {function(value: T): K} keySelector A function that extracts the key
  16667. * for each item.
  16668. * @param {function(value: T): R} [elementSelector] A function that extracts the
  16669. * return element for each item.
  16670. * @param {function(grouped: GroupedObservable<K,R>): Observable<any>} [durationSelector]
  16671. * A function that returns an Observable to determine how long each group should
  16672. * exist.
  16673. * @return {Observable<GroupedObservable<K,R>>} An Observable that emits
  16674. * GroupedObservables, each of which corresponds to a unique key value and each
  16675. * of which emits those items from the source Observable that share that key
  16676. * value.
  16677. * @method groupBy
  16678. * @owner Observable
  16679. */
  16680. function groupBy(keySelector, elementSelector, durationSelector, subjectSelector) {
  16681. return function (source) {
  16682. return source.lift(new GroupByOperator(keySelector, elementSelector, durationSelector, subjectSelector));
  16683. };
  16684. }
  16685. exports.groupBy = groupBy;
  16686. var GroupByOperator = (function () {
  16687. function GroupByOperator(keySelector, elementSelector, durationSelector, subjectSelector) {
  16688. this.keySelector = keySelector;
  16689. this.elementSelector = elementSelector;
  16690. this.durationSelector = durationSelector;
  16691. this.subjectSelector = subjectSelector;
  16692. }
  16693. GroupByOperator.prototype.call = function (subscriber, source) {
  16694. return source.subscribe(new GroupBySubscriber(subscriber, this.keySelector, this.elementSelector, this.durationSelector, this.subjectSelector));
  16695. };
  16696. return GroupByOperator;
  16697. }());
  16698. /**
  16699. * We need this JSDoc comment for affecting ESDoc.
  16700. * @ignore
  16701. * @extends {Ignored}
  16702. */
  16703. var GroupBySubscriber = (function (_super) {
  16704. __extends(GroupBySubscriber, _super);
  16705. function GroupBySubscriber(destination, keySelector, elementSelector, durationSelector, subjectSelector) {
  16706. _super.call(this, destination);
  16707. this.keySelector = keySelector;
  16708. this.elementSelector = elementSelector;
  16709. this.durationSelector = durationSelector;
  16710. this.subjectSelector = subjectSelector;
  16711. this.groups = null;
  16712. this.attemptedToUnsubscribe = false;
  16713. this.count = 0;
  16714. }
  16715. GroupBySubscriber.prototype._next = function (value) {
  16716. var key;
  16717. try {
  16718. key = this.keySelector(value);
  16719. }
  16720. catch (err) {
  16721. this.error(err);
  16722. return;
  16723. }
  16724. this._group(value, key);
  16725. };
  16726. GroupBySubscriber.prototype._group = function (value, key) {
  16727. var groups = this.groups;
  16728. if (!groups) {
  16729. groups = this.groups = typeof key === 'string' ? new FastMap_1.FastMap() : new Map_1.Map();
  16730. }
  16731. var group = groups.get(key);
  16732. var element;
  16733. if (this.elementSelector) {
  16734. try {
  16735. element = this.elementSelector(value);
  16736. }
  16737. catch (err) {
  16738. this.error(err);
  16739. }
  16740. }
  16741. else {
  16742. element = value;
  16743. }
  16744. if (!group) {
  16745. group = this.subjectSelector ? this.subjectSelector() : new Subject_1.Subject();
  16746. groups.set(key, group);
  16747. var groupedObservable = new GroupedObservable(key, group, this);
  16748. this.destination.next(groupedObservable);
  16749. if (this.durationSelector) {
  16750. var duration = void 0;
  16751. try {
  16752. duration = this.durationSelector(new GroupedObservable(key, group));
  16753. }
  16754. catch (err) {
  16755. this.error(err);
  16756. return;
  16757. }
  16758. this.add(duration.subscribe(new GroupDurationSubscriber(key, group, this)));
  16759. }
  16760. }
  16761. if (!group.closed) {
  16762. group.next(element);
  16763. }
  16764. };
  16765. GroupBySubscriber.prototype._error = function (err) {
  16766. var groups = this.groups;
  16767. if (groups) {
  16768. groups.forEach(function (group, key) {
  16769. group.error(err);
  16770. });
  16771. groups.clear();
  16772. }
  16773. this.destination.error(err);
  16774. };
  16775. GroupBySubscriber.prototype._complete = function () {
  16776. var groups = this.groups;
  16777. if (groups) {
  16778. groups.forEach(function (group, key) {
  16779. group.complete();
  16780. });
  16781. groups.clear();
  16782. }
  16783. this.destination.complete();
  16784. };
  16785. GroupBySubscriber.prototype.removeGroup = function (key) {
  16786. this.groups.delete(key);
  16787. };
  16788. GroupBySubscriber.prototype.unsubscribe = function () {
  16789. if (!this.closed) {
  16790. this.attemptedToUnsubscribe = true;
  16791. if (this.count === 0) {
  16792. _super.prototype.unsubscribe.call(this);
  16793. }
  16794. }
  16795. };
  16796. return GroupBySubscriber;
  16797. }(Subscriber_1.Subscriber));
  16798. /**
  16799. * We need this JSDoc comment for affecting ESDoc.
  16800. * @ignore
  16801. * @extends {Ignored}
  16802. */
  16803. var GroupDurationSubscriber = (function (_super) {
  16804. __extends(GroupDurationSubscriber, _super);
  16805. function GroupDurationSubscriber(key, group, parent) {
  16806. _super.call(this, group);
  16807. this.key = key;
  16808. this.group = group;
  16809. this.parent = parent;
  16810. }
  16811. GroupDurationSubscriber.prototype._next = function (value) {
  16812. this.complete();
  16813. };
  16814. /** @deprecated internal use only */ GroupDurationSubscriber.prototype._unsubscribe = function () {
  16815. var _a = this, parent = _a.parent, key = _a.key;
  16816. this.key = this.parent = null;
  16817. if (parent) {
  16818. parent.removeGroup(key);
  16819. }
  16820. };
  16821. return GroupDurationSubscriber;
  16822. }(Subscriber_1.Subscriber));
  16823. /**
  16824. * An Observable representing values belonging to the same group represented by
  16825. * a common key. The values emitted by a GroupedObservable come from the source
  16826. * Observable. The common key is available as the field `key` on a
  16827. * GroupedObservable instance.
  16828. *
  16829. * @class GroupedObservable<K, T>
  16830. */
  16831. var GroupedObservable = (function (_super) {
  16832. __extends(GroupedObservable, _super);
  16833. function GroupedObservable(key, groupSubject, refCountSubscription) {
  16834. _super.call(this);
  16835. this.key = key;
  16836. this.groupSubject = groupSubject;
  16837. this.refCountSubscription = refCountSubscription;
  16838. }
  16839. /** @deprecated internal use only */ GroupedObservable.prototype._subscribe = function (subscriber) {
  16840. var subscription = new Subscription_1.Subscription();
  16841. var _a = this, refCountSubscription = _a.refCountSubscription, groupSubject = _a.groupSubject;
  16842. if (refCountSubscription && !refCountSubscription.closed) {
  16843. subscription.add(new InnerRefCountSubscription(refCountSubscription));
  16844. }
  16845. subscription.add(groupSubject.subscribe(subscriber));
  16846. return subscription;
  16847. };
  16848. return GroupedObservable;
  16849. }(Observable_1.Observable));
  16850. exports.GroupedObservable = GroupedObservable;
  16851. /**
  16852. * We need this JSDoc comment for affecting ESDoc.
  16853. * @ignore
  16854. * @extends {Ignored}
  16855. */
  16856. var InnerRefCountSubscription = (function (_super) {
  16857. __extends(InnerRefCountSubscription, _super);
  16858. function InnerRefCountSubscription(parent) {
  16859. _super.call(this);
  16860. this.parent = parent;
  16861. parent.count++;
  16862. }
  16863. InnerRefCountSubscription.prototype.unsubscribe = function () {
  16864. var parent = this.parent;
  16865. if (!parent.closed && !this.closed) {
  16866. _super.prototype.unsubscribe.call(this);
  16867. parent.count -= 1;
  16868. if (parent.count === 0 && parent.attemptedToUnsubscribe) {
  16869. parent.unsubscribe();
  16870. }
  16871. }
  16872. };
  16873. return InnerRefCountSubscription;
  16874. }(Subscription_1.Subscription));
  16875. //# sourceMappingURL=groupBy.js.map
  16876. /***/ }),
  16877. /* 178 */
  16878. /***/ (function(module, exports, __webpack_require__) {
  16879. "use strict";
  16880. var root_1 = __webpack_require__(8);
  16881. var MapPolyfill_1 = __webpack_require__(179);
  16882. exports.Map = root_1.root.Map || (function () { return MapPolyfill_1.MapPolyfill; })();
  16883. //# sourceMappingURL=Map.js.map
  16884. /***/ }),
  16885. /* 179 */
  16886. /***/ (function(module, exports, __webpack_require__) {
  16887. "use strict";
  16888. var MapPolyfill = (function () {
  16889. function MapPolyfill() {
  16890. this.size = 0;
  16891. this._values = [];
  16892. this._keys = [];
  16893. }
  16894. MapPolyfill.prototype.get = function (key) {
  16895. var i = this._keys.indexOf(key);
  16896. return i === -1 ? undefined : this._values[i];
  16897. };
  16898. MapPolyfill.prototype.set = function (key, value) {
  16899. var i = this._keys.indexOf(key);
  16900. if (i === -1) {
  16901. this._keys.push(key);
  16902. this._values.push(value);
  16903. this.size++;
  16904. }
  16905. else {
  16906. this._values[i] = value;
  16907. }
  16908. return this;
  16909. };
  16910. MapPolyfill.prototype.delete = function (key) {
  16911. var i = this._keys.indexOf(key);
  16912. if (i === -1) {
  16913. return false;
  16914. }
  16915. this._values.splice(i, 1);
  16916. this._keys.splice(i, 1);
  16917. this.size--;
  16918. return true;
  16919. };
  16920. MapPolyfill.prototype.clear = function () {
  16921. this._keys.length = 0;
  16922. this._values.length = 0;
  16923. this.size = 0;
  16924. };
  16925. MapPolyfill.prototype.forEach = function (cb, thisArg) {
  16926. for (var i = 0; i < this.size; i++) {
  16927. cb.call(thisArg, this._values[i], this._keys[i]);
  16928. }
  16929. };
  16930. return MapPolyfill;
  16931. }());
  16932. exports.MapPolyfill = MapPolyfill;
  16933. //# sourceMappingURL=MapPolyfill.js.map
  16934. /***/ }),
  16935. /* 180 */
  16936. /***/ (function(module, exports, __webpack_require__) {
  16937. "use strict";
  16938. var FastMap = (function () {
  16939. function FastMap() {
  16940. this.values = {};
  16941. }
  16942. FastMap.prototype.delete = function (key) {
  16943. this.values[key] = null;
  16944. return true;
  16945. };
  16946. FastMap.prototype.set = function (key, value) {
  16947. this.values[key] = value;
  16948. return this;
  16949. };
  16950. FastMap.prototype.get = function (key) {
  16951. return this.values[key];
  16952. };
  16953. FastMap.prototype.forEach = function (cb, thisArg) {
  16954. var values = this.values;
  16955. for (var key in values) {
  16956. if (values.hasOwnProperty(key) && values[key] !== null) {
  16957. cb.call(thisArg, values[key], key);
  16958. }
  16959. }
  16960. };
  16961. FastMap.prototype.clear = function () {
  16962. this.values = {};
  16963. };
  16964. return FastMap;
  16965. }());
  16966. exports.FastMap = FastMap;
  16967. //# sourceMappingURL=FastMap.js.map
  16968. /***/ })
  16969. /******/ ]);