25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

lesspass.js 984 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727
  1. /******/ (function(modules) { // webpackBootstrap
  2. /******/ // The module cache
  3. /******/ var installedModules = {};
  4. /******/ // The require function
  5. /******/ function __webpack_require__(moduleId) {
  6. /******/ // Check if module is in cache
  7. /******/ if(installedModules[moduleId])
  8. /******/ return installedModules[moduleId].exports;
  9. /******/ // Create a new module (and put it into the cache)
  10. /******/ var module = installedModules[moduleId] = {
  11. /******/ i: moduleId,
  12. /******/ l: false,
  13. /******/ exports: {}
  14. /******/ };
  15. /******/ // Execute the module function
  16. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  17. /******/ // Flag the module as loaded
  18. /******/ module.l = true;
  19. /******/ // Return the exports of the module
  20. /******/ return module.exports;
  21. /******/ }
  22. /******/ // expose the modules object (__webpack_modules__)
  23. /******/ __webpack_require__.m = modules;
  24. /******/ // expose the module cache
  25. /******/ __webpack_require__.c = installedModules;
  26. /******/ // identity function for calling harmory imports with the correct context
  27. /******/ __webpack_require__.i = function(value) { return value; };
  28. /******/ // define getter function for harmory exports
  29. /******/ __webpack_require__.d = function(exports, name, getter) {
  30. /******/ Object.defineProperty(exports, name, {
  31. /******/ configurable: false,
  32. /******/ enumerable: true,
  33. /******/ get: getter
  34. /******/ });
  35. /******/ };
  36. /******/ // getDefaultExport function for compatibility with non-harmony modules
  37. /******/ __webpack_require__.n = function(module) {
  38. /******/ var getter = module && module.__esModule ?
  39. /******/ function getDefault() { return module['default']; } :
  40. /******/ function getModuleExports() { return module; };
  41. /******/ __webpack_require__.d(getter, 'a', getter);
  42. /******/ return getter;
  43. /******/ };
  44. /******/ // Object.prototype.hasOwnProperty.call
  45. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  46. /******/ // __webpack_public_path__
  47. /******/ __webpack_require__.p = "/dist/";
  48. /******/ // Load entry module and return exports
  49. /******/ return __webpack_require__(__webpack_require__.s = 313);
  50. /******/ })
  51. /************************************************************************/
  52. /******/ ((function(modules) {
  53. // Check all modules for deduplicated modules
  54. for(var i in modules) {
  55. if(Object.prototype.hasOwnProperty.call(modules, i)) {
  56. switch(typeof modules[i]) {
  57. case "function": break;
  58. case "object":
  59. // Module can be created from a template
  60. modules[i] = (function(_m) {
  61. var args = _m.slice(1), fn = modules[_m[0]];
  62. return function (a,b,c) {
  63. fn.apply(this, [a,b,c].concat(args));
  64. };
  65. }(modules[i]));
  66. break;
  67. default:
  68. // Module is a copy of another module
  69. modules[i] = modules[modules[i]];
  70. break;
  71. }
  72. }
  73. }
  74. return modules;
  75. }([
  76. /* 0 */
  77. /***/ function(module, exports, __webpack_require__) {
  78. "use strict";
  79. /* WEBPACK VAR INJECTION */(function(Buffer, global) {/*!
  80. * The buffer module from node.js, for the browser.
  81. *
  82. * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
  83. * @license MIT
  84. */
  85. /* eslint-disable no-proto */
  86. 'use strict'
  87. var base64 = __webpack_require__(164)
  88. var ieee754 = __webpack_require__(253)
  89. var isArray = __webpack_require__(106)
  90. exports.Buffer = Buffer
  91. exports.SlowBuffer = SlowBuffer
  92. exports.INSPECT_MAX_BYTES = 50
  93. /**
  94. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  95. * === true Use Uint8Array implementation (fastest)
  96. * === false Use Object implementation (most compatible, even IE6)
  97. *
  98. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  99. * Opera 11.6+, iOS 4.2+.
  100. *
  101. * Due to various browser bugs, sometimes the Object implementation will be used even
  102. * when the browser supports typed arrays.
  103. *
  104. * Note:
  105. *
  106. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  107. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  108. *
  109. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  110. *
  111. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  112. * incorrect length in some situations.
  113. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  114. * get the Object implementation, which is slower but behaves correctly.
  115. */
  116. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  117. ? global.TYPED_ARRAY_SUPPORT
  118. : typedArraySupport()
  119. /*
  120. * Export kMaxLength after typed array support is determined.
  121. */
  122. exports.kMaxLength = kMaxLength()
  123. function typedArraySupport () {
  124. try {
  125. var arr = new Uint8Array(1)
  126. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  127. return arr.foo() === 42 && // typed array instances can be augmented
  128. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  129. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  130. } catch (e) {
  131. return false
  132. }
  133. }
  134. function kMaxLength () {
  135. return Buffer.TYPED_ARRAY_SUPPORT
  136. ? 0x7fffffff
  137. : 0x3fffffff
  138. }
  139. function createBuffer (that, length) {
  140. if (kMaxLength() < length) {
  141. throw new RangeError('Invalid typed array length')
  142. }
  143. if (Buffer.TYPED_ARRAY_SUPPORT) {
  144. // Return an augmented `Uint8Array` instance, for best performance
  145. that = new Uint8Array(length)
  146. that.__proto__ = Buffer.prototype
  147. } else {
  148. // Fallback: Return an object instance of the Buffer class
  149. if (that === null) {
  150. that = new Buffer(length)
  151. }
  152. that.length = length
  153. }
  154. return that
  155. }
  156. /**
  157. * The Buffer constructor returns instances of `Uint8Array` that have their
  158. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  159. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  160. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  161. * returns a single octet.
  162. *
  163. * The `Uint8Array` prototype remains unmodified.
  164. */
  165. function Buffer (arg, encodingOrOffset, length) {
  166. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  167. return new Buffer(arg, encodingOrOffset, length)
  168. }
  169. // Common case.
  170. if (typeof arg === 'number') {
  171. if (typeof encodingOrOffset === 'string') {
  172. throw new Error(
  173. 'If encoding is specified then the first argument must be a string'
  174. )
  175. }
  176. return allocUnsafe(this, arg)
  177. }
  178. return from(this, arg, encodingOrOffset, length)
  179. }
  180. Buffer.poolSize = 8192 // not used by this implementation
  181. // TODO: Legacy, not needed anymore. Remove in next major version.
  182. Buffer._augment = function (arr) {
  183. arr.__proto__ = Buffer.prototype
  184. return arr
  185. }
  186. function from (that, value, encodingOrOffset, length) {
  187. if (typeof value === 'number') {
  188. throw new TypeError('"value" argument must not be a number')
  189. }
  190. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  191. return fromArrayBuffer(that, value, encodingOrOffset, length)
  192. }
  193. if (typeof value === 'string') {
  194. return fromString(that, value, encodingOrOffset)
  195. }
  196. return fromObject(that, value)
  197. }
  198. /**
  199. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  200. * if value is a number.
  201. * Buffer.from(str[, encoding])
  202. * Buffer.from(array)
  203. * Buffer.from(buffer)
  204. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  205. **/
  206. Buffer.from = function (value, encodingOrOffset, length) {
  207. return from(null, value, encodingOrOffset, length)
  208. }
  209. if (Buffer.TYPED_ARRAY_SUPPORT) {
  210. Buffer.prototype.__proto__ = Uint8Array.prototype
  211. Buffer.__proto__ = Uint8Array
  212. if (typeof Symbol !== 'undefined' && Symbol.species &&
  213. Buffer[Symbol.species] === Buffer) {
  214. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  215. Object.defineProperty(Buffer, Symbol.species, {
  216. value: null,
  217. configurable: true
  218. })
  219. }
  220. }
  221. function assertSize (size) {
  222. if (typeof size !== 'number') {
  223. throw new TypeError('"size" argument must be a number')
  224. } else if (size < 0) {
  225. throw new RangeError('"size" argument must not be negative')
  226. }
  227. }
  228. function alloc (that, size, fill, encoding) {
  229. assertSize(size)
  230. if (size <= 0) {
  231. return createBuffer(that, size)
  232. }
  233. if (fill !== undefined) {
  234. // Only pay attention to encoding if it's a string. This
  235. // prevents accidentally sending in a number that would
  236. // be interpretted as a start offset.
  237. return typeof encoding === 'string'
  238. ? createBuffer(that, size).fill(fill, encoding)
  239. : createBuffer(that, size).fill(fill)
  240. }
  241. return createBuffer(that, size)
  242. }
  243. /**
  244. * Creates a new filled Buffer instance.
  245. * alloc(size[, fill[, encoding]])
  246. **/
  247. Buffer.alloc = function (size, fill, encoding) {
  248. return alloc(null, size, fill, encoding)
  249. }
  250. function allocUnsafe (that, size) {
  251. assertSize(size)
  252. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  253. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  254. for (var i = 0; i < size; ++i) {
  255. that[i] = 0
  256. }
  257. }
  258. return that
  259. }
  260. /**
  261. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  262. * */
  263. Buffer.allocUnsafe = function (size) {
  264. return allocUnsafe(null, size)
  265. }
  266. /**
  267. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  268. */
  269. Buffer.allocUnsafeSlow = function (size) {
  270. return allocUnsafe(null, size)
  271. }
  272. function fromString (that, string, encoding) {
  273. if (typeof encoding !== 'string' || encoding === '') {
  274. encoding = 'utf8'
  275. }
  276. if (!Buffer.isEncoding(encoding)) {
  277. throw new TypeError('"encoding" must be a valid string encoding')
  278. }
  279. var length = byteLength(string, encoding) | 0
  280. that = createBuffer(that, length)
  281. var actual = that.write(string, encoding)
  282. if (actual !== length) {
  283. // Writing a hex string, for example, that contains invalid characters will
  284. // cause everything after the first invalid character to be ignored. (e.g.
  285. // 'abxxcd' will be treated as 'ab')
  286. that = that.slice(0, actual)
  287. }
  288. return that
  289. }
  290. function fromArrayLike (that, array) {
  291. var length = array.length < 0 ? 0 : checked(array.length) | 0
  292. that = createBuffer(that, length)
  293. for (var i = 0; i < length; i += 1) {
  294. that[i] = array[i] & 255
  295. }
  296. return that
  297. }
  298. function fromArrayBuffer (that, array, byteOffset, length) {
  299. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  300. if (byteOffset < 0 || array.byteLength < byteOffset) {
  301. throw new RangeError('\'offset\' is out of bounds')
  302. }
  303. if (array.byteLength < byteOffset + (length || 0)) {
  304. throw new RangeError('\'length\' is out of bounds')
  305. }
  306. if (byteOffset === undefined && length === undefined) {
  307. array = new Uint8Array(array)
  308. } else if (length === undefined) {
  309. array = new Uint8Array(array, byteOffset)
  310. } else {
  311. array = new Uint8Array(array, byteOffset, length)
  312. }
  313. if (Buffer.TYPED_ARRAY_SUPPORT) {
  314. // Return an augmented `Uint8Array` instance, for best performance
  315. that = array
  316. that.__proto__ = Buffer.prototype
  317. } else {
  318. // Fallback: Return an object instance of the Buffer class
  319. that = fromArrayLike(that, array)
  320. }
  321. return that
  322. }
  323. function fromObject (that, obj) {
  324. if (Buffer.isBuffer(obj)) {
  325. var len = checked(obj.length) | 0
  326. that = createBuffer(that, len)
  327. if (that.length === 0) {
  328. return that
  329. }
  330. obj.copy(that, 0, 0, len)
  331. return that
  332. }
  333. if (obj) {
  334. if ((typeof ArrayBuffer !== 'undefined' &&
  335. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  336. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  337. return createBuffer(that, 0)
  338. }
  339. return fromArrayLike(that, obj)
  340. }
  341. if (obj.type === 'Buffer' && isArray(obj.data)) {
  342. return fromArrayLike(that, obj.data)
  343. }
  344. }
  345. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  346. }
  347. function checked (length) {
  348. // Note: cannot use `length < kMaxLength()` here because that fails when
  349. // length is NaN (which is otherwise coerced to zero.)
  350. if (length >= kMaxLength()) {
  351. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  352. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  353. }
  354. return length | 0
  355. }
  356. function SlowBuffer (length) {
  357. if (+length != length) { // eslint-disable-line eqeqeq
  358. length = 0
  359. }
  360. return Buffer.alloc(+length)
  361. }
  362. Buffer.isBuffer = function isBuffer (b) {
  363. return !!(b != null && b._isBuffer)
  364. }
  365. Buffer.compare = function compare (a, b) {
  366. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  367. throw new TypeError('Arguments must be Buffers')
  368. }
  369. if (a === b) return 0
  370. var x = a.length
  371. var y = b.length
  372. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  373. if (a[i] !== b[i]) {
  374. x = a[i]
  375. y = b[i]
  376. break
  377. }
  378. }
  379. if (x < y) return -1
  380. if (y < x) return 1
  381. return 0
  382. }
  383. Buffer.isEncoding = function isEncoding (encoding) {
  384. switch (String(encoding).toLowerCase()) {
  385. case 'hex':
  386. case 'utf8':
  387. case 'utf-8':
  388. case 'ascii':
  389. case 'latin1':
  390. case 'binary':
  391. case 'base64':
  392. case 'ucs2':
  393. case 'ucs-2':
  394. case 'utf16le':
  395. case 'utf-16le':
  396. return true
  397. default:
  398. return false
  399. }
  400. }
  401. Buffer.concat = function concat (list, length) {
  402. if (!isArray(list)) {
  403. throw new TypeError('"list" argument must be an Array of Buffers')
  404. }
  405. if (list.length === 0) {
  406. return Buffer.alloc(0)
  407. }
  408. var i
  409. if (length === undefined) {
  410. length = 0
  411. for (i = 0; i < list.length; ++i) {
  412. length += list[i].length
  413. }
  414. }
  415. var buffer = Buffer.allocUnsafe(length)
  416. var pos = 0
  417. for (i = 0; i < list.length; ++i) {
  418. var buf = list[i]
  419. if (!Buffer.isBuffer(buf)) {
  420. throw new TypeError('"list" argument must be an Array of Buffers')
  421. }
  422. buf.copy(buffer, pos)
  423. pos += buf.length
  424. }
  425. return buffer
  426. }
  427. function byteLength (string, encoding) {
  428. if (Buffer.isBuffer(string)) {
  429. return string.length
  430. }
  431. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  432. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  433. return string.byteLength
  434. }
  435. if (typeof string !== 'string') {
  436. string = '' + string
  437. }
  438. var len = string.length
  439. if (len === 0) return 0
  440. // Use a for loop to avoid recursion
  441. var loweredCase = false
  442. for (;;) {
  443. switch (encoding) {
  444. case 'ascii':
  445. case 'latin1':
  446. case 'binary':
  447. return len
  448. case 'utf8':
  449. case 'utf-8':
  450. case undefined:
  451. return utf8ToBytes(string).length
  452. case 'ucs2':
  453. case 'ucs-2':
  454. case 'utf16le':
  455. case 'utf-16le':
  456. return len * 2
  457. case 'hex':
  458. return len >>> 1
  459. case 'base64':
  460. return base64ToBytes(string).length
  461. default:
  462. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  463. encoding = ('' + encoding).toLowerCase()
  464. loweredCase = true
  465. }
  466. }
  467. }
  468. Buffer.byteLength = byteLength
  469. function slowToString (encoding, start, end) {
  470. var loweredCase = false
  471. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  472. // property of a typed array.
  473. // This behaves neither like String nor Uint8Array in that we set start/end
  474. // to their upper/lower bounds if the value passed is out of range.
  475. // undefined is handled specially as per ECMA-262 6th Edition,
  476. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  477. if (start === undefined || start < 0) {
  478. start = 0
  479. }
  480. // Return early if start > this.length. Done here to prevent potential uint32
  481. // coercion fail below.
  482. if (start > this.length) {
  483. return ''
  484. }
  485. if (end === undefined || end > this.length) {
  486. end = this.length
  487. }
  488. if (end <= 0) {
  489. return ''
  490. }
  491. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  492. end >>>= 0
  493. start >>>= 0
  494. if (end <= start) {
  495. return ''
  496. }
  497. if (!encoding) encoding = 'utf8'
  498. while (true) {
  499. switch (encoding) {
  500. case 'hex':
  501. return hexSlice(this, start, end)
  502. case 'utf8':
  503. case 'utf-8':
  504. return utf8Slice(this, start, end)
  505. case 'ascii':
  506. return asciiSlice(this, start, end)
  507. case 'latin1':
  508. case 'binary':
  509. return latin1Slice(this, start, end)
  510. case 'base64':
  511. return base64Slice(this, start, end)
  512. case 'ucs2':
  513. case 'ucs-2':
  514. case 'utf16le':
  515. case 'utf-16le':
  516. return utf16leSlice(this, start, end)
  517. default:
  518. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  519. encoding = (encoding + '').toLowerCase()
  520. loweredCase = true
  521. }
  522. }
  523. }
  524. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  525. // Buffer instances.
  526. Buffer.prototype._isBuffer = true
  527. function swap (b, n, m) {
  528. var i = b[n]
  529. b[n] = b[m]
  530. b[m] = i
  531. }
  532. Buffer.prototype.swap16 = function swap16 () {
  533. var len = this.length
  534. if (len % 2 !== 0) {
  535. throw new RangeError('Buffer size must be a multiple of 16-bits')
  536. }
  537. for (var i = 0; i < len; i += 2) {
  538. swap(this, i, i + 1)
  539. }
  540. return this
  541. }
  542. Buffer.prototype.swap32 = function swap32 () {
  543. var len = this.length
  544. if (len % 4 !== 0) {
  545. throw new RangeError('Buffer size must be a multiple of 32-bits')
  546. }
  547. for (var i = 0; i < len; i += 4) {
  548. swap(this, i, i + 3)
  549. swap(this, i + 1, i + 2)
  550. }
  551. return this
  552. }
  553. Buffer.prototype.swap64 = function swap64 () {
  554. var len = this.length
  555. if (len % 8 !== 0) {
  556. throw new RangeError('Buffer size must be a multiple of 64-bits')
  557. }
  558. for (var i = 0; i < len; i += 8) {
  559. swap(this, i, i + 7)
  560. swap(this, i + 1, i + 6)
  561. swap(this, i + 2, i + 5)
  562. swap(this, i + 3, i + 4)
  563. }
  564. return this
  565. }
  566. Buffer.prototype.toString = function toString () {
  567. var length = this.length | 0
  568. if (length === 0) return ''
  569. if (arguments.length === 0) return utf8Slice(this, 0, length)
  570. return slowToString.apply(this, arguments)
  571. }
  572. Buffer.prototype.equals = function equals (b) {
  573. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  574. if (this === b) return true
  575. return Buffer.compare(this, b) === 0
  576. }
  577. Buffer.prototype.inspect = function inspect () {
  578. var str = ''
  579. var max = exports.INSPECT_MAX_BYTES
  580. if (this.length > 0) {
  581. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  582. if (this.length > max) str += ' ... '
  583. }
  584. return '<Buffer ' + str + '>'
  585. }
  586. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  587. if (!Buffer.isBuffer(target)) {
  588. throw new TypeError('Argument must be a Buffer')
  589. }
  590. if (start === undefined) {
  591. start = 0
  592. }
  593. if (end === undefined) {
  594. end = target ? target.length : 0
  595. }
  596. if (thisStart === undefined) {
  597. thisStart = 0
  598. }
  599. if (thisEnd === undefined) {
  600. thisEnd = this.length
  601. }
  602. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  603. throw new RangeError('out of range index')
  604. }
  605. if (thisStart >= thisEnd && start >= end) {
  606. return 0
  607. }
  608. if (thisStart >= thisEnd) {
  609. return -1
  610. }
  611. if (start >= end) {
  612. return 1
  613. }
  614. start >>>= 0
  615. end >>>= 0
  616. thisStart >>>= 0
  617. thisEnd >>>= 0
  618. if (this === target) return 0
  619. var x = thisEnd - thisStart
  620. var y = end - start
  621. var len = Math.min(x, y)
  622. var thisCopy = this.slice(thisStart, thisEnd)
  623. var targetCopy = target.slice(start, end)
  624. for (var i = 0; i < len; ++i) {
  625. if (thisCopy[i] !== targetCopy[i]) {
  626. x = thisCopy[i]
  627. y = targetCopy[i]
  628. break
  629. }
  630. }
  631. if (x < y) return -1
  632. if (y < x) return 1
  633. return 0
  634. }
  635. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  636. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  637. //
  638. // Arguments:
  639. // - buffer - a Buffer to search
  640. // - val - a string, Buffer, or number
  641. // - byteOffset - an index into `buffer`; will be clamped to an int32
  642. // - encoding - an optional encoding, relevant is val is a string
  643. // - dir - true for indexOf, false for lastIndexOf
  644. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  645. // Empty buffer means no match
  646. if (buffer.length === 0) return -1
  647. // Normalize byteOffset
  648. if (typeof byteOffset === 'string') {
  649. encoding = byteOffset
  650. byteOffset = 0
  651. } else if (byteOffset > 0x7fffffff) {
  652. byteOffset = 0x7fffffff
  653. } else if (byteOffset < -0x80000000) {
  654. byteOffset = -0x80000000
  655. }
  656. byteOffset = +byteOffset // Coerce to Number.
  657. if (isNaN(byteOffset)) {
  658. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  659. byteOffset = dir ? 0 : (buffer.length - 1)
  660. }
  661. // Normalize byteOffset: negative offsets start from the end of the buffer
  662. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  663. if (byteOffset >= buffer.length) {
  664. if (dir) return -1
  665. else byteOffset = buffer.length - 1
  666. } else if (byteOffset < 0) {
  667. if (dir) byteOffset = 0
  668. else return -1
  669. }
  670. // Normalize val
  671. if (typeof val === 'string') {
  672. val = Buffer.from(val, encoding)
  673. }
  674. // Finally, search either indexOf (if dir is true) or lastIndexOf
  675. if (Buffer.isBuffer(val)) {
  676. // Special case: looking for empty string/buffer always fails
  677. if (val.length === 0) {
  678. return -1
  679. }
  680. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  681. } else if (typeof val === 'number') {
  682. val = val & 0xFF // Search for a byte value [0-255]
  683. if (Buffer.TYPED_ARRAY_SUPPORT &&
  684. typeof Uint8Array.prototype.indexOf === 'function') {
  685. if (dir) {
  686. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  687. } else {
  688. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  689. }
  690. }
  691. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  692. }
  693. throw new TypeError('val must be string, number or Buffer')
  694. }
  695. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  696. var indexSize = 1
  697. var arrLength = arr.length
  698. var valLength = val.length
  699. if (encoding !== undefined) {
  700. encoding = String(encoding).toLowerCase()
  701. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  702. encoding === 'utf16le' || encoding === 'utf-16le') {
  703. if (arr.length < 2 || val.length < 2) {
  704. return -1
  705. }
  706. indexSize = 2
  707. arrLength /= 2
  708. valLength /= 2
  709. byteOffset /= 2
  710. }
  711. }
  712. function read (buf, i) {
  713. if (indexSize === 1) {
  714. return buf[i]
  715. } else {
  716. return buf.readUInt16BE(i * indexSize)
  717. }
  718. }
  719. var i
  720. if (dir) {
  721. var foundIndex = -1
  722. for (i = byteOffset; i < arrLength; i++) {
  723. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  724. if (foundIndex === -1) foundIndex = i
  725. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  726. } else {
  727. if (foundIndex !== -1) i -= i - foundIndex
  728. foundIndex = -1
  729. }
  730. }
  731. } else {
  732. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  733. for (i = byteOffset; i >= 0; i--) {
  734. var found = true
  735. for (var j = 0; j < valLength; j++) {
  736. if (read(arr, i + j) !== read(val, j)) {
  737. found = false
  738. break
  739. }
  740. }
  741. if (found) return i
  742. }
  743. }
  744. return -1
  745. }
  746. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  747. return this.indexOf(val, byteOffset, encoding) !== -1
  748. }
  749. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  750. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  751. }
  752. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  753. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  754. }
  755. function hexWrite (buf, string, offset, length) {
  756. offset = Number(offset) || 0
  757. var remaining = buf.length - offset
  758. if (!length) {
  759. length = remaining
  760. } else {
  761. length = Number(length)
  762. if (length > remaining) {
  763. length = remaining
  764. }
  765. }
  766. // must be an even number of digits
  767. var strLen = string.length
  768. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  769. if (length > strLen / 2) {
  770. length = strLen / 2
  771. }
  772. for (var i = 0; i < length; ++i) {
  773. var parsed = parseInt(string.substr(i * 2, 2), 16)
  774. if (isNaN(parsed)) return i
  775. buf[offset + i] = parsed
  776. }
  777. return i
  778. }
  779. function utf8Write (buf, string, offset, length) {
  780. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  781. }
  782. function asciiWrite (buf, string, offset, length) {
  783. return blitBuffer(asciiToBytes(string), buf, offset, length)
  784. }
  785. function latin1Write (buf, string, offset, length) {
  786. return asciiWrite(buf, string, offset, length)
  787. }
  788. function base64Write (buf, string, offset, length) {
  789. return blitBuffer(base64ToBytes(string), buf, offset, length)
  790. }
  791. function ucs2Write (buf, string, offset, length) {
  792. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  793. }
  794. Buffer.prototype.write = function write (string, offset, length, encoding) {
  795. // Buffer#write(string)
  796. if (offset === undefined) {
  797. encoding = 'utf8'
  798. length = this.length
  799. offset = 0
  800. // Buffer#write(string, encoding)
  801. } else if (length === undefined && typeof offset === 'string') {
  802. encoding = offset
  803. length = this.length
  804. offset = 0
  805. // Buffer#write(string, offset[, length][, encoding])
  806. } else if (isFinite(offset)) {
  807. offset = offset | 0
  808. if (isFinite(length)) {
  809. length = length | 0
  810. if (encoding === undefined) encoding = 'utf8'
  811. } else {
  812. encoding = length
  813. length = undefined
  814. }
  815. // legacy write(string, encoding, offset, length) - remove in v0.13
  816. } else {
  817. throw new Error(
  818. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  819. )
  820. }
  821. var remaining = this.length - offset
  822. if (length === undefined || length > remaining) length = remaining
  823. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  824. throw new RangeError('Attempt to write outside buffer bounds')
  825. }
  826. if (!encoding) encoding = 'utf8'
  827. var loweredCase = false
  828. for (;;) {
  829. switch (encoding) {
  830. case 'hex':
  831. return hexWrite(this, string, offset, length)
  832. case 'utf8':
  833. case 'utf-8':
  834. return utf8Write(this, string, offset, length)
  835. case 'ascii':
  836. return asciiWrite(this, string, offset, length)
  837. case 'latin1':
  838. case 'binary':
  839. return latin1Write(this, string, offset, length)
  840. case 'base64':
  841. // Warning: maxLength not taken into account in base64Write
  842. return base64Write(this, string, offset, length)
  843. case 'ucs2':
  844. case 'ucs-2':
  845. case 'utf16le':
  846. case 'utf-16le':
  847. return ucs2Write(this, string, offset, length)
  848. default:
  849. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  850. encoding = ('' + encoding).toLowerCase()
  851. loweredCase = true
  852. }
  853. }
  854. }
  855. Buffer.prototype.toJSON = function toJSON () {
  856. return {
  857. type: 'Buffer',
  858. data: Array.prototype.slice.call(this._arr || this, 0)
  859. }
  860. }
  861. function base64Slice (buf, start, end) {
  862. if (start === 0 && end === buf.length) {
  863. return base64.fromByteArray(buf)
  864. } else {
  865. return base64.fromByteArray(buf.slice(start, end))
  866. }
  867. }
  868. function utf8Slice (buf, start, end) {
  869. end = Math.min(buf.length, end)
  870. var res = []
  871. var i = start
  872. while (i < end) {
  873. var firstByte = buf[i]
  874. var codePoint = null
  875. var bytesPerSequence = (firstByte > 0xEF) ? 4
  876. : (firstByte > 0xDF) ? 3
  877. : (firstByte > 0xBF) ? 2
  878. : 1
  879. if (i + bytesPerSequence <= end) {
  880. var secondByte, thirdByte, fourthByte, tempCodePoint
  881. switch (bytesPerSequence) {
  882. case 1:
  883. if (firstByte < 0x80) {
  884. codePoint = firstByte
  885. }
  886. break
  887. case 2:
  888. secondByte = buf[i + 1]
  889. if ((secondByte & 0xC0) === 0x80) {
  890. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  891. if (tempCodePoint > 0x7F) {
  892. codePoint = tempCodePoint
  893. }
  894. }
  895. break
  896. case 3:
  897. secondByte = buf[i + 1]
  898. thirdByte = buf[i + 2]
  899. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  900. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  901. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  902. codePoint = tempCodePoint
  903. }
  904. }
  905. break
  906. case 4:
  907. secondByte = buf[i + 1]
  908. thirdByte = buf[i + 2]
  909. fourthByte = buf[i + 3]
  910. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  911. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  912. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  913. codePoint = tempCodePoint
  914. }
  915. }
  916. }
  917. }
  918. if (codePoint === null) {
  919. // we did not generate a valid codePoint so insert a
  920. // replacement char (U+FFFD) and advance only 1 byte
  921. codePoint = 0xFFFD
  922. bytesPerSequence = 1
  923. } else if (codePoint > 0xFFFF) {
  924. // encode to utf16 (surrogate pair dance)
  925. codePoint -= 0x10000
  926. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  927. codePoint = 0xDC00 | codePoint & 0x3FF
  928. }
  929. res.push(codePoint)
  930. i += bytesPerSequence
  931. }
  932. return decodeCodePointsArray(res)
  933. }
  934. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  935. // the lowest limit is Chrome, with 0x10000 args.
  936. // We go 1 magnitude less, for safety
  937. var MAX_ARGUMENTS_LENGTH = 0x1000
  938. function decodeCodePointsArray (codePoints) {
  939. var len = codePoints.length
  940. if (len <= MAX_ARGUMENTS_LENGTH) {
  941. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  942. }
  943. // Decode in chunks to avoid "call stack size exceeded".
  944. var res = ''
  945. var i = 0
  946. while (i < len) {
  947. res += String.fromCharCode.apply(
  948. String,
  949. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  950. )
  951. }
  952. return res
  953. }
  954. function asciiSlice (buf, start, end) {
  955. var ret = ''
  956. end = Math.min(buf.length, end)
  957. for (var i = start; i < end; ++i) {
  958. ret += String.fromCharCode(buf[i] & 0x7F)
  959. }
  960. return ret
  961. }
  962. function latin1Slice (buf, start, end) {
  963. var ret = ''
  964. end = Math.min(buf.length, end)
  965. for (var i = start; i < end; ++i) {
  966. ret += String.fromCharCode(buf[i])
  967. }
  968. return ret
  969. }
  970. function hexSlice (buf, start, end) {
  971. var len = buf.length
  972. if (!start || start < 0) start = 0
  973. if (!end || end < 0 || end > len) end = len
  974. var out = ''
  975. for (var i = start; i < end; ++i) {
  976. out += toHex(buf[i])
  977. }
  978. return out
  979. }
  980. function utf16leSlice (buf, start, end) {
  981. var bytes = buf.slice(start, end)
  982. var res = ''
  983. for (var i = 0; i < bytes.length; i += 2) {
  984. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  985. }
  986. return res
  987. }
  988. Buffer.prototype.slice = function slice (start, end) {
  989. var len = this.length
  990. start = ~~start
  991. end = end === undefined ? len : ~~end
  992. if (start < 0) {
  993. start += len
  994. if (start < 0) start = 0
  995. } else if (start > len) {
  996. start = len
  997. }
  998. if (end < 0) {
  999. end += len
  1000. if (end < 0) end = 0
  1001. } else if (end > len) {
  1002. end = len
  1003. }
  1004. if (end < start) end = start
  1005. var newBuf
  1006. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1007. newBuf = this.subarray(start, end)
  1008. newBuf.__proto__ = Buffer.prototype
  1009. } else {
  1010. var sliceLen = end - start
  1011. newBuf = new Buffer(sliceLen, undefined)
  1012. for (var i = 0; i < sliceLen; ++i) {
  1013. newBuf[i] = this[i + start]
  1014. }
  1015. }
  1016. return newBuf
  1017. }
  1018. /*
  1019. * Need to make sure that buffer isn't trying to write out of bounds.
  1020. */
  1021. function checkOffset (offset, ext, length) {
  1022. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  1023. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  1024. }
  1025. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  1026. offset = offset | 0
  1027. byteLength = byteLength | 0
  1028. if (!noAssert) checkOffset(offset, byteLength, this.length)
  1029. var val = this[offset]
  1030. var mul = 1
  1031. var i = 0
  1032. while (++i < byteLength && (mul *= 0x100)) {
  1033. val += this[offset + i] * mul
  1034. }
  1035. return val
  1036. }
  1037. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  1038. offset = offset | 0
  1039. byteLength = byteLength | 0
  1040. if (!noAssert) {
  1041. checkOffset(offset, byteLength, this.length)
  1042. }
  1043. var val = this[offset + --byteLength]
  1044. var mul = 1
  1045. while (byteLength > 0 && (mul *= 0x100)) {
  1046. val += this[offset + --byteLength] * mul
  1047. }
  1048. return val
  1049. }
  1050. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  1051. if (!noAssert) checkOffset(offset, 1, this.length)
  1052. return this[offset]
  1053. }
  1054. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  1055. if (!noAssert) checkOffset(offset, 2, this.length)
  1056. return this[offset] | (this[offset + 1] << 8)
  1057. }
  1058. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  1059. if (!noAssert) checkOffset(offset, 2, this.length)
  1060. return (this[offset] << 8) | this[offset + 1]
  1061. }
  1062. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  1063. if (!noAssert) checkOffset(offset, 4, this.length)
  1064. return ((this[offset]) |
  1065. (this[offset + 1] << 8) |
  1066. (this[offset + 2] << 16)) +
  1067. (this[offset + 3] * 0x1000000)
  1068. }
  1069. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  1070. if (!noAssert) checkOffset(offset, 4, this.length)
  1071. return (this[offset] * 0x1000000) +
  1072. ((this[offset + 1] << 16) |
  1073. (this[offset + 2] << 8) |
  1074. this[offset + 3])
  1075. }
  1076. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  1077. offset = offset | 0
  1078. byteLength = byteLength | 0
  1079. if (!noAssert) checkOffset(offset, byteLength, this.length)
  1080. var val = this[offset]
  1081. var mul = 1
  1082. var i = 0
  1083. while (++i < byteLength && (mul *= 0x100)) {
  1084. val += this[offset + i] * mul
  1085. }
  1086. mul *= 0x80
  1087. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  1088. return val
  1089. }
  1090. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  1091. offset = offset | 0
  1092. byteLength = byteLength | 0
  1093. if (!noAssert) checkOffset(offset, byteLength, this.length)
  1094. var i = byteLength
  1095. var mul = 1
  1096. var val = this[offset + --i]
  1097. while (i > 0 && (mul *= 0x100)) {
  1098. val += this[offset + --i] * mul
  1099. }
  1100. mul *= 0x80
  1101. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  1102. return val
  1103. }
  1104. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  1105. if (!noAssert) checkOffset(offset, 1, this.length)
  1106. if (!(this[offset] & 0x80)) return (this[offset])
  1107. return ((0xff - this[offset] + 1) * -1)
  1108. }
  1109. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  1110. if (!noAssert) checkOffset(offset, 2, this.length)
  1111. var val = this[offset] | (this[offset + 1] << 8)
  1112. return (val & 0x8000) ? val | 0xFFFF0000 : val
  1113. }
  1114. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  1115. if (!noAssert) checkOffset(offset, 2, this.length)
  1116. var val = this[offset + 1] | (this[offset] << 8)
  1117. return (val & 0x8000) ? val | 0xFFFF0000 : val
  1118. }
  1119. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  1120. if (!noAssert) checkOffset(offset, 4, this.length)
  1121. return (this[offset]) |
  1122. (this[offset + 1] << 8) |
  1123. (this[offset + 2] << 16) |
  1124. (this[offset + 3] << 24)
  1125. }
  1126. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  1127. if (!noAssert) checkOffset(offset, 4, this.length)
  1128. return (this[offset] << 24) |
  1129. (this[offset + 1] << 16) |
  1130. (this[offset + 2] << 8) |
  1131. (this[offset + 3])
  1132. }
  1133. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  1134. if (!noAssert) checkOffset(offset, 4, this.length)
  1135. return ieee754.read(this, offset, true, 23, 4)
  1136. }
  1137. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  1138. if (!noAssert) checkOffset(offset, 4, this.length)
  1139. return ieee754.read(this, offset, false, 23, 4)
  1140. }
  1141. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  1142. if (!noAssert) checkOffset(offset, 8, this.length)
  1143. return ieee754.read(this, offset, true, 52, 8)
  1144. }
  1145. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  1146. if (!noAssert) checkOffset(offset, 8, this.length)
  1147. return ieee754.read(this, offset, false, 52, 8)
  1148. }
  1149. function checkInt (buf, value, offset, ext, max, min) {
  1150. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  1151. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  1152. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  1153. }
  1154. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  1155. value = +value
  1156. offset = offset | 0
  1157. byteLength = byteLength | 0
  1158. if (!noAssert) {
  1159. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  1160. checkInt(this, value, offset, byteLength, maxBytes, 0)
  1161. }
  1162. var mul = 1
  1163. var i = 0
  1164. this[offset] = value & 0xFF
  1165. while (++i < byteLength && (mul *= 0x100)) {
  1166. this[offset + i] = (value / mul) & 0xFF
  1167. }
  1168. return offset + byteLength
  1169. }
  1170. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  1171. value = +value
  1172. offset = offset | 0
  1173. byteLength = byteLength | 0
  1174. if (!noAssert) {
  1175. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  1176. checkInt(this, value, offset, byteLength, maxBytes, 0)
  1177. }
  1178. var i = byteLength - 1
  1179. var mul = 1
  1180. this[offset + i] = value & 0xFF
  1181. while (--i >= 0 && (mul *= 0x100)) {
  1182. this[offset + i] = (value / mul) & 0xFF
  1183. }
  1184. return offset + byteLength
  1185. }
  1186. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  1187. value = +value
  1188. offset = offset | 0
  1189. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  1190. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  1191. this[offset] = (value & 0xff)
  1192. return offset + 1
  1193. }
  1194. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  1195. if (value < 0) value = 0xffff + value + 1
  1196. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  1197. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  1198. (littleEndian ? i : 1 - i) * 8
  1199. }
  1200. }
  1201. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  1202. value = +value
  1203. offset = offset | 0
  1204. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  1205. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1206. this[offset] = (value & 0xff)
  1207. this[offset + 1] = (value >>> 8)
  1208. } else {
  1209. objectWriteUInt16(this, value, offset, true)
  1210. }
  1211. return offset + 2
  1212. }
  1213. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  1214. value = +value
  1215. offset = offset | 0
  1216. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  1217. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1218. this[offset] = (value >>> 8)
  1219. this[offset + 1] = (value & 0xff)
  1220. } else {
  1221. objectWriteUInt16(this, value, offset, false)
  1222. }
  1223. return offset + 2
  1224. }
  1225. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  1226. if (value < 0) value = 0xffffffff + value + 1
  1227. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  1228. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  1229. }
  1230. }
  1231. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  1232. value = +value
  1233. offset = offset | 0
  1234. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  1235. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1236. this[offset + 3] = (value >>> 24)
  1237. this[offset + 2] = (value >>> 16)
  1238. this[offset + 1] = (value >>> 8)
  1239. this[offset] = (value & 0xff)
  1240. } else {
  1241. objectWriteUInt32(this, value, offset, true)
  1242. }
  1243. return offset + 4
  1244. }
  1245. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  1246. value = +value
  1247. offset = offset | 0
  1248. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  1249. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1250. this[offset] = (value >>> 24)
  1251. this[offset + 1] = (value >>> 16)
  1252. this[offset + 2] = (value >>> 8)
  1253. this[offset + 3] = (value & 0xff)
  1254. } else {
  1255. objectWriteUInt32(this, value, offset, false)
  1256. }
  1257. return offset + 4
  1258. }
  1259. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  1260. value = +value
  1261. offset = offset | 0
  1262. if (!noAssert) {
  1263. var limit = Math.pow(2, 8 * byteLength - 1)
  1264. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  1265. }
  1266. var i = 0
  1267. var mul = 1
  1268. var sub = 0
  1269. this[offset] = value & 0xFF
  1270. while (++i < byteLength && (mul *= 0x100)) {
  1271. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  1272. sub = 1
  1273. }
  1274. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  1275. }
  1276. return offset + byteLength
  1277. }
  1278. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  1279. value = +value
  1280. offset = offset | 0
  1281. if (!noAssert) {
  1282. var limit = Math.pow(2, 8 * byteLength - 1)
  1283. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  1284. }
  1285. var i = byteLength - 1
  1286. var mul = 1
  1287. var sub = 0
  1288. this[offset + i] = value & 0xFF
  1289. while (--i >= 0 && (mul *= 0x100)) {
  1290. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  1291. sub = 1
  1292. }
  1293. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  1294. }
  1295. return offset + byteLength
  1296. }
  1297. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  1298. value = +value
  1299. offset = offset | 0
  1300. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  1301. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  1302. if (value < 0) value = 0xff + value + 1
  1303. this[offset] = (value & 0xff)
  1304. return offset + 1
  1305. }
  1306. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  1307. value = +value
  1308. offset = offset | 0
  1309. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  1310. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1311. this[offset] = (value & 0xff)
  1312. this[offset + 1] = (value >>> 8)
  1313. } else {
  1314. objectWriteUInt16(this, value, offset, true)
  1315. }
  1316. return offset + 2
  1317. }
  1318. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  1319. value = +value
  1320. offset = offset | 0
  1321. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  1322. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1323. this[offset] = (value >>> 8)
  1324. this[offset + 1] = (value & 0xff)
  1325. } else {
  1326. objectWriteUInt16(this, value, offset, false)
  1327. }
  1328. return offset + 2
  1329. }
  1330. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  1331. value = +value
  1332. offset = offset | 0
  1333. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  1334. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1335. this[offset] = (value & 0xff)
  1336. this[offset + 1] = (value >>> 8)
  1337. this[offset + 2] = (value >>> 16)
  1338. this[offset + 3] = (value >>> 24)
  1339. } else {
  1340. objectWriteUInt32(this, value, offset, true)
  1341. }
  1342. return offset + 4
  1343. }
  1344. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  1345. value = +value
  1346. offset = offset | 0
  1347. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  1348. if (value < 0) value = 0xffffffff + value + 1
  1349. if (Buffer.TYPED_ARRAY_SUPPORT) {
  1350. this[offset] = (value >>> 24)
  1351. this[offset + 1] = (value >>> 16)
  1352. this[offset + 2] = (value >>> 8)
  1353. this[offset + 3] = (value & 0xff)
  1354. } else {
  1355. objectWriteUInt32(this, value, offset, false)
  1356. }
  1357. return offset + 4
  1358. }
  1359. function checkIEEE754 (buf, value, offset, ext, max, min) {
  1360. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  1361. if (offset < 0) throw new RangeError('Index out of range')
  1362. }
  1363. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  1364. if (!noAssert) {
  1365. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  1366. }
  1367. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  1368. return offset + 4
  1369. }
  1370. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  1371. return writeFloat(this, value, offset, true, noAssert)
  1372. }
  1373. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  1374. return writeFloat(this, value, offset, false, noAssert)
  1375. }
  1376. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  1377. if (!noAssert) {
  1378. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  1379. }
  1380. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  1381. return offset + 8
  1382. }
  1383. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  1384. return writeDouble(this, value, offset, true, noAssert)
  1385. }
  1386. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  1387. return writeDouble(this, value, offset, false, noAssert)
  1388. }
  1389. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  1390. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  1391. if (!start) start = 0
  1392. if (!end && end !== 0) end = this.length
  1393. if (targetStart >= target.length) targetStart = target.length
  1394. if (!targetStart) targetStart = 0
  1395. if (end > 0 && end < start) end = start
  1396. // Copy 0 bytes; we're done
  1397. if (end === start) return 0
  1398. if (target.length === 0 || this.length === 0) return 0
  1399. // Fatal error conditions
  1400. if (targetStart < 0) {
  1401. throw new RangeError('targetStart out of bounds')
  1402. }
  1403. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  1404. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  1405. // Are we oob?
  1406. if (end > this.length) end = this.length
  1407. if (target.length - targetStart < end - start) {
  1408. end = target.length - targetStart + start
  1409. }
  1410. var len = end - start
  1411. var i
  1412. if (this === target && start < targetStart && targetStart < end) {
  1413. // descending copy from end
  1414. for (i = len - 1; i >= 0; --i) {
  1415. target[i + targetStart] = this[i + start]
  1416. }
  1417. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  1418. // ascending copy from start
  1419. for (i = 0; i < len; ++i) {
  1420. target[i + targetStart] = this[i + start]
  1421. }
  1422. } else {
  1423. Uint8Array.prototype.set.call(
  1424. target,
  1425. this.subarray(start, start + len),
  1426. targetStart
  1427. )
  1428. }
  1429. return len
  1430. }
  1431. // Usage:
  1432. // buffer.fill(number[, offset[, end]])
  1433. // buffer.fill(buffer[, offset[, end]])
  1434. // buffer.fill(string[, offset[, end]][, encoding])
  1435. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  1436. // Handle string cases:
  1437. if (typeof val === 'string') {
  1438. if (typeof start === 'string') {
  1439. encoding = start
  1440. start = 0
  1441. end = this.length
  1442. } else if (typeof end === 'string') {
  1443. encoding = end
  1444. end = this.length
  1445. }
  1446. if (val.length === 1) {
  1447. var code = val.charCodeAt(0)
  1448. if (code < 256) {
  1449. val = code
  1450. }
  1451. }
  1452. if (encoding !== undefined && typeof encoding !== 'string') {
  1453. throw new TypeError('encoding must be a string')
  1454. }
  1455. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  1456. throw new TypeError('Unknown encoding: ' + encoding)
  1457. }
  1458. } else if (typeof val === 'number') {
  1459. val = val & 255
  1460. }
  1461. // Invalid ranges are not set to a default, so can range check early.
  1462. if (start < 0 || this.length < start || this.length < end) {
  1463. throw new RangeError('Out of range index')
  1464. }
  1465. if (end <= start) {
  1466. return this
  1467. }
  1468. start = start >>> 0
  1469. end = end === undefined ? this.length : end >>> 0
  1470. if (!val) val = 0
  1471. var i
  1472. if (typeof val === 'number') {
  1473. for (i = start; i < end; ++i) {
  1474. this[i] = val
  1475. }
  1476. } else {
  1477. var bytes = Buffer.isBuffer(val)
  1478. ? val
  1479. : utf8ToBytes(new Buffer(val, encoding).toString())
  1480. var len = bytes.length
  1481. for (i = 0; i < end - start; ++i) {
  1482. this[i + start] = bytes[i % len]
  1483. }
  1484. }
  1485. return this
  1486. }
  1487. // HELPER FUNCTIONS
  1488. // ================
  1489. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  1490. function base64clean (str) {
  1491. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  1492. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  1493. // Node converts strings with length < 2 to ''
  1494. if (str.length < 2) return ''
  1495. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  1496. while (str.length % 4 !== 0) {
  1497. str = str + '='
  1498. }
  1499. return str
  1500. }
  1501. function stringtrim (str) {
  1502. if (str.trim) return str.trim()
  1503. return str.replace(/^\s+|\s+$/g, '')
  1504. }
  1505. function toHex (n) {
  1506. if (n < 16) return '0' + n.toString(16)
  1507. return n.toString(16)
  1508. }
  1509. function utf8ToBytes (string, units) {
  1510. units = units || Infinity
  1511. var codePoint
  1512. var length = string.length
  1513. var leadSurrogate = null
  1514. var bytes = []
  1515. for (var i = 0; i < length; ++i) {
  1516. codePoint = string.charCodeAt(i)
  1517. // is surrogate component
  1518. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  1519. // last char was a lead
  1520. if (!leadSurrogate) {
  1521. // no lead yet
  1522. if (codePoint > 0xDBFF) {
  1523. // unexpected trail
  1524. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  1525. continue
  1526. } else if (i + 1 === length) {
  1527. // unpaired lead
  1528. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  1529. continue
  1530. }
  1531. // valid lead
  1532. leadSurrogate = codePoint
  1533. continue
  1534. }
  1535. // 2 leads in a row
  1536. if (codePoint < 0xDC00) {
  1537. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  1538. leadSurrogate = codePoint
  1539. continue
  1540. }
  1541. // valid surrogate pair
  1542. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  1543. } else if (leadSurrogate) {
  1544. // valid bmp char, but last char was a lead
  1545. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  1546. }
  1547. leadSurrogate = null
  1548. // encode utf8
  1549. if (codePoint < 0x80) {
  1550. if ((units -= 1) < 0) break
  1551. bytes.push(codePoint)
  1552. } else if (codePoint < 0x800) {
  1553. if ((units -= 2) < 0) break
  1554. bytes.push(
  1555. codePoint >> 0x6 | 0xC0,
  1556. codePoint & 0x3F | 0x80
  1557. )
  1558. } else if (codePoint < 0x10000) {
  1559. if ((units -= 3) < 0) break
  1560. bytes.push(
  1561. codePoint >> 0xC | 0xE0,
  1562. codePoint >> 0x6 & 0x3F | 0x80,
  1563. codePoint & 0x3F | 0x80
  1564. )
  1565. } else if (codePoint < 0x110000) {
  1566. if ((units -= 4) < 0) break
  1567. bytes.push(
  1568. codePoint >> 0x12 | 0xF0,
  1569. codePoint >> 0xC & 0x3F | 0x80,
  1570. codePoint >> 0x6 & 0x3F | 0x80,
  1571. codePoint & 0x3F | 0x80
  1572. )
  1573. } else {
  1574. throw new Error('Invalid code point')
  1575. }
  1576. }
  1577. return bytes
  1578. }
  1579. function asciiToBytes (str) {
  1580. var byteArray = []
  1581. for (var i = 0; i < str.length; ++i) {
  1582. // Node's code seems to be doing this and not & 0x7F..
  1583. byteArray.push(str.charCodeAt(i) & 0xFF)
  1584. }
  1585. return byteArray
  1586. }
  1587. function utf16leToBytes (str, units) {
  1588. var c, hi, lo
  1589. var byteArray = []
  1590. for (var i = 0; i < str.length; ++i) {
  1591. if ((units -= 2) < 0) break
  1592. c = str.charCodeAt(i)
  1593. hi = c >> 8
  1594. lo = c % 256
  1595. byteArray.push(lo)
  1596. byteArray.push(hi)
  1597. }
  1598. return byteArray
  1599. }
  1600. function base64ToBytes (str) {
  1601. return base64.toByteArray(base64clean(str))
  1602. }
  1603. function blitBuffer (src, dst, offset, length) {
  1604. for (var i = 0; i < length; ++i) {
  1605. if ((i + offset >= dst.length) || (i >= src.length)) break
  1606. dst[i + offset] = src[i]
  1607. }
  1608. return i
  1609. }
  1610. function isnan (val) {
  1611. return val !== val // eslint-disable-line no-self-compare
  1612. }
  1613. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer, __webpack_require__(32)))
  1614. /***/ },
  1615. /* 1 */
  1616. /***/ function(module, exports) {
  1617. if (typeof Object.create === 'function') {
  1618. // implementation from standard node.js 'util' module
  1619. module.exports = function inherits(ctor, superCtor) {
  1620. ctor.super_ = superCtor
  1621. ctor.prototype = Object.create(superCtor.prototype, {
  1622. constructor: {
  1623. value: ctor,
  1624. enumerable: false,
  1625. writable: true,
  1626. configurable: true
  1627. }
  1628. });
  1629. };
  1630. } else {
  1631. // old school shim for old browsers
  1632. module.exports = function inherits(ctor, superCtor) {
  1633. ctor.super_ = superCtor
  1634. var TempCtor = function () {}
  1635. TempCtor.prototype = superCtor.prototype
  1636. ctor.prototype = new TempCtor()
  1637. ctor.prototype.constructor = ctor
  1638. }
  1639. }
  1640. /***/ },
  1641. /* 2 */
  1642. /***/ function(module, exports, __webpack_require__) {
  1643. /* WEBPACK VAR INJECTION */(function(module) {(function (module, exports) {
  1644. 'use strict';
  1645. // Utils
  1646. function assert (val, msg) {
  1647. if (!val) throw new Error(msg || 'Assertion failed');
  1648. }
  1649. // Could use `inherits` module, but don't want to move from single file
  1650. // architecture yet.
  1651. function inherits (ctor, superCtor) {
  1652. ctor.super_ = superCtor;
  1653. var TempCtor = function () {};
  1654. TempCtor.prototype = superCtor.prototype;
  1655. ctor.prototype = new TempCtor();
  1656. ctor.prototype.constructor = ctor;
  1657. }
  1658. // BN
  1659. function BN (number, base, endian) {
  1660. if (BN.isBN(number)) {
  1661. return number;
  1662. }
  1663. this.negative = 0;
  1664. this.words = null;
  1665. this.length = 0;
  1666. // Reduction context
  1667. this.red = null;
  1668. if (number !== null) {
  1669. if (base === 'le' || base === 'be') {
  1670. endian = base;
  1671. base = 10;
  1672. }
  1673. this._init(number || 0, base || 10, endian || 'be');
  1674. }
  1675. }
  1676. if (typeof module === 'object') {
  1677. module.exports = BN;
  1678. } else {
  1679. exports.BN = BN;
  1680. }
  1681. BN.BN = BN;
  1682. BN.wordSize = 26;
  1683. var Buffer;
  1684. try {
  1685. Buffer = __webpack_require__(0).Buffer;
  1686. } catch (e) {
  1687. }
  1688. BN.isBN = function isBN (num) {
  1689. if (num instanceof BN) {
  1690. return true;
  1691. }
  1692. return num !== null && typeof num === 'object' &&
  1693. num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);
  1694. };
  1695. BN.max = function max (left, right) {
  1696. if (left.cmp(right) > 0) return left;
  1697. return right;
  1698. };
  1699. BN.min = function min (left, right) {
  1700. if (left.cmp(right) < 0) return left;
  1701. return right;
  1702. };
  1703. BN.prototype._init = function init (number, base, endian) {
  1704. if (typeof number === 'number') {
  1705. return this._initNumber(number, base, endian);
  1706. }
  1707. if (typeof number === 'object') {
  1708. return this._initArray(number, base, endian);
  1709. }
  1710. if (base === 'hex') {
  1711. base = 16;
  1712. }
  1713. assert(base === (base | 0) && base >= 2 && base <= 36);
  1714. number = number.toString().replace(/\s+/g, '');
  1715. var start = 0;
  1716. if (number[0] === '-') {
  1717. start++;
  1718. }
  1719. if (base === 16) {
  1720. this._parseHex(number, start);
  1721. } else {
  1722. this._parseBase(number, base, start);
  1723. }
  1724. if (number[0] === '-') {
  1725. this.negative = 1;
  1726. }
  1727. this.strip();
  1728. if (endian !== 'le') return;
  1729. this._initArray(this.toArray(), base, endian);
  1730. };
  1731. BN.prototype._initNumber = function _initNumber (number, base, endian) {
  1732. if (number < 0) {
  1733. this.negative = 1;
  1734. number = -number;
  1735. }
  1736. if (number < 0x4000000) {
  1737. this.words = [ number & 0x3ffffff ];
  1738. this.length = 1;
  1739. } else if (number < 0x10000000000000) {
  1740. this.words = [
  1741. number & 0x3ffffff,
  1742. (number / 0x4000000) & 0x3ffffff
  1743. ];
  1744. this.length = 2;
  1745. } else {
  1746. assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)
  1747. this.words = [
  1748. number & 0x3ffffff,
  1749. (number / 0x4000000) & 0x3ffffff,
  1750. 1
  1751. ];
  1752. this.length = 3;
  1753. }
  1754. if (endian !== 'le') return;
  1755. // Reverse the bytes
  1756. this._initArray(this.toArray(), base, endian);
  1757. };
  1758. BN.prototype._initArray = function _initArray (number, base, endian) {
  1759. // Perhaps a Uint8Array
  1760. assert(typeof number.length === 'number');
  1761. if (number.length <= 0) {
  1762. this.words = [ 0 ];
  1763. this.length = 1;
  1764. return this;
  1765. }
  1766. this.length = Math.ceil(number.length / 3);
  1767. this.words = new Array(this.length);
  1768. for (var i = 0; i < this.length; i++) {
  1769. this.words[i] = 0;
  1770. }
  1771. var j, w;
  1772. var off = 0;
  1773. if (endian === 'be') {
  1774. for (i = number.length - 1, j = 0; i >= 0; i -= 3) {
  1775. w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16);
  1776. this.words[j] |= (w << off) & 0x3ffffff;
  1777. this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;
  1778. off += 24;
  1779. if (off >= 26) {
  1780. off -= 26;
  1781. j++;
  1782. }
  1783. }
  1784. } else if (endian === 'le') {
  1785. for (i = 0, j = 0; i < number.length; i += 3) {
  1786. w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16);
  1787. this.words[j] |= (w << off) & 0x3ffffff;
  1788. this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;
  1789. off += 24;
  1790. if (off >= 26) {
  1791. off -= 26;
  1792. j++;
  1793. }
  1794. }
  1795. }
  1796. return this.strip();
  1797. };
  1798. function parseHex (str, start, end) {
  1799. var r = 0;
  1800. var len = Math.min(str.length, end);
  1801. for (var i = start; i < len; i++) {
  1802. var c = str.charCodeAt(i) - 48;
  1803. r <<= 4;
  1804. // 'a' - 'f'
  1805. if (c >= 49 && c <= 54) {
  1806. r |= c - 49 + 0xa;
  1807. // 'A' - 'F'
  1808. } else if (c >= 17 && c <= 22) {
  1809. r |= c - 17 + 0xa;
  1810. // '0' - '9'
  1811. } else {
  1812. r |= c & 0xf;
  1813. }
  1814. }
  1815. return r;
  1816. }
  1817. BN.prototype._parseHex = function _parseHex (number, start) {
  1818. // Create possibly bigger array to ensure that it fits the number
  1819. this.length = Math.ceil((number.length - start) / 6);
  1820. this.words = new Array(this.length);
  1821. for (var i = 0; i < this.length; i++) {
  1822. this.words[i] = 0;
  1823. }
  1824. var j, w;
  1825. // Scan 24-bit chunks and add them to the number
  1826. var off = 0;
  1827. for (i = number.length - 6, j = 0; i >= start; i -= 6) {
  1828. w = parseHex(number, i, i + 6);
  1829. this.words[j] |= (w << off) & 0x3ffffff;
  1830. // NOTE: `0x3fffff` is intentional here, 26bits max shift + 24bit hex limb
  1831. this.words[j + 1] |= w >>> (26 - off) & 0x3fffff;
  1832. off += 24;
  1833. if (off >= 26) {
  1834. off -= 26;
  1835. j++;
  1836. }
  1837. }
  1838. if (i + 6 !== start) {
  1839. w = parseHex(number, start, i + 6);
  1840. this.words[j] |= (w << off) & 0x3ffffff;
  1841. this.words[j + 1] |= w >>> (26 - off) & 0x3fffff;
  1842. }
  1843. this.strip();
  1844. };
  1845. function parseBase (str, start, end, mul) {
  1846. var r = 0;
  1847. var len = Math.min(str.length, end);
  1848. for (var i = start; i < len; i++) {
  1849. var c = str.charCodeAt(i) - 48;
  1850. r *= mul;
  1851. // 'a'
  1852. if (c >= 49) {
  1853. r += c - 49 + 0xa;
  1854. // 'A'
  1855. } else if (c >= 17) {
  1856. r += c - 17 + 0xa;
  1857. // '0' - '9'
  1858. } else {
  1859. r += c;
  1860. }
  1861. }
  1862. return r;
  1863. }
  1864. BN.prototype._parseBase = function _parseBase (number, base, start) {
  1865. // Initialize as zero
  1866. this.words = [ 0 ];
  1867. this.length = 1;
  1868. // Find length of limb in base
  1869. for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) {
  1870. limbLen++;
  1871. }
  1872. limbLen--;
  1873. limbPow = (limbPow / base) | 0;
  1874. var total = number.length - start;
  1875. var mod = total % limbLen;
  1876. var end = Math.min(total, total - mod) + start;
  1877. var word = 0;
  1878. for (var i = start; i < end; i += limbLen) {
  1879. word = parseBase(number, i, i + limbLen, base);
  1880. this.imuln(limbPow);
  1881. if (this.words[0] + word < 0x4000000) {
  1882. this.words[0] += word;
  1883. } else {
  1884. this._iaddn(word);
  1885. }
  1886. }
  1887. if (mod !== 0) {
  1888. var pow = 1;
  1889. word = parseBase(number, i, number.length, base);
  1890. for (i = 0; i < mod; i++) {
  1891. pow *= base;
  1892. }
  1893. this.imuln(pow);
  1894. if (this.words[0] + word < 0x4000000) {
  1895. this.words[0] += word;
  1896. } else {
  1897. this._iaddn(word);
  1898. }
  1899. }
  1900. };
  1901. BN.prototype.copy = function copy (dest) {
  1902. dest.words = new Array(this.length);
  1903. for (var i = 0; i < this.length; i++) {
  1904. dest.words[i] = this.words[i];
  1905. }
  1906. dest.length = this.length;
  1907. dest.negative = this.negative;
  1908. dest.red = this.red;
  1909. };
  1910. BN.prototype.clone = function clone () {
  1911. var r = new BN(null);
  1912. this.copy(r);
  1913. return r;
  1914. };
  1915. BN.prototype._expand = function _expand (size) {
  1916. while (this.length < size) {
  1917. this.words[this.length++] = 0;
  1918. }
  1919. return this;
  1920. };
  1921. // Remove leading `0` from `this`
  1922. BN.prototype.strip = function strip () {
  1923. while (this.length > 1 && this.words[this.length - 1] === 0) {
  1924. this.length--;
  1925. }
  1926. return this._normSign();
  1927. };
  1928. BN.prototype._normSign = function _normSign () {
  1929. // -0 = 0
  1930. if (this.length === 1 && this.words[0] === 0) {
  1931. this.negative = 0;
  1932. }
  1933. return this;
  1934. };
  1935. BN.prototype.inspect = function inspect () {
  1936. return (this.red ? '<BN-R: ' : '<BN: ') + this.toString(16) + '>';
  1937. };
  1938. /*
  1939. var zeros = [];
  1940. var groupSizes = [];
  1941. var groupBases = [];
  1942. var s = '';
  1943. var i = -1;
  1944. while (++i < BN.wordSize) {
  1945. zeros[i] = s;
  1946. s += '0';
  1947. }
  1948. groupSizes[0] = 0;
  1949. groupSizes[1] = 0;
  1950. groupBases[0] = 0;
  1951. groupBases[1] = 0;
  1952. var base = 2 - 1;
  1953. while (++base < 36 + 1) {
  1954. var groupSize = 0;
  1955. var groupBase = 1;
  1956. while (groupBase < (1 << BN.wordSize) / base) {
  1957. groupBase *= base;
  1958. groupSize += 1;
  1959. }
  1960. groupSizes[base] = groupSize;
  1961. groupBases[base] = groupBase;
  1962. }
  1963. */
  1964. var zeros = [
  1965. '',
  1966. '0',
  1967. '00',
  1968. '000',
  1969. '0000',
  1970. '00000',
  1971. '000000',
  1972. '0000000',
  1973. '00000000',
  1974. '000000000',
  1975. '0000000000',
  1976. '00000000000',
  1977. '000000000000',
  1978. '0000000000000',
  1979. '00000000000000',
  1980. '000000000000000',
  1981. '0000000000000000',
  1982. '00000000000000000',
  1983. '000000000000000000',
  1984. '0000000000000000000',
  1985. '00000000000000000000',
  1986. '000000000000000000000',
  1987. '0000000000000000000000',
  1988. '00000000000000000000000',
  1989. '000000000000000000000000',
  1990. '0000000000000000000000000'
  1991. ];
  1992. var groupSizes = [
  1993. 0, 0,
  1994. 25, 16, 12, 11, 10, 9, 8,
  1995. 8, 7, 7, 7, 7, 6, 6,
  1996. 6, 6, 6, 6, 6, 5, 5,
  1997. 5, 5, 5, 5, 5, 5, 5,
  1998. 5, 5, 5, 5, 5, 5, 5
  1999. ];
  2000. var groupBases = [
  2001. 0, 0,
  2002. 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216,
  2003. 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625,
  2004. 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632,
  2005. 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149,
  2006. 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176
  2007. ];
  2008. BN.prototype.toString = function toString (base, padding) {
  2009. base = base || 10;
  2010. padding = padding | 0 || 1;
  2011. var out;
  2012. if (base === 16 || base === 'hex') {
  2013. out = '';
  2014. var off = 0;
  2015. var carry = 0;
  2016. for (var i = 0; i < this.length; i++) {
  2017. var w = this.words[i];
  2018. var word = (((w << off) | carry) & 0xffffff).toString(16);
  2019. carry = (w >>> (24 - off)) & 0xffffff;
  2020. if (carry !== 0 || i !== this.length - 1) {
  2021. out = zeros[6 - word.length] + word + out;
  2022. } else {
  2023. out = word + out;
  2024. }
  2025. off += 2;
  2026. if (off >= 26) {
  2027. off -= 26;
  2028. i--;
  2029. }
  2030. }
  2031. if (carry !== 0) {
  2032. out = carry.toString(16) + out;
  2033. }
  2034. while (out.length % padding !== 0) {
  2035. out = '0' + out;
  2036. }
  2037. if (this.negative !== 0) {
  2038. out = '-' + out;
  2039. }
  2040. return out;
  2041. }
  2042. if (base === (base | 0) && base >= 2 && base <= 36) {
  2043. // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));
  2044. var groupSize = groupSizes[base];
  2045. // var groupBase = Math.pow(base, groupSize);
  2046. var groupBase = groupBases[base];
  2047. out = '';
  2048. var c = this.clone();
  2049. c.negative = 0;
  2050. while (!c.isZero()) {
  2051. var r = c.modn(groupBase).toString(base);
  2052. c = c.idivn(groupBase);
  2053. if (!c.isZero()) {
  2054. out = zeros[groupSize - r.length] + r + out;
  2055. } else {
  2056. out = r + out;
  2057. }
  2058. }
  2059. if (this.isZero()) {
  2060. out = '0' + out;
  2061. }
  2062. while (out.length % padding !== 0) {
  2063. out = '0' + out;
  2064. }
  2065. if (this.negative !== 0) {
  2066. out = '-' + out;
  2067. }
  2068. return out;
  2069. }
  2070. assert(false, 'Base should be between 2 and 36');
  2071. };
  2072. BN.prototype.toNumber = function toNumber () {
  2073. var ret = this.words[0];
  2074. if (this.length === 2) {
  2075. ret += this.words[1] * 0x4000000;
  2076. } else if (this.length === 3 && this.words[2] === 0x01) {
  2077. // NOTE: at this stage it is known that the top bit is set
  2078. ret += 0x10000000000000 + (this.words[1] * 0x4000000);
  2079. } else if (this.length > 2) {
  2080. assert(false, 'Number can only safely store up to 53 bits');
  2081. }
  2082. return (this.negative !== 0) ? -ret : ret;
  2083. };
  2084. BN.prototype.toJSON = function toJSON () {
  2085. return this.toString(16);
  2086. };
  2087. BN.prototype.toBuffer = function toBuffer (endian, length) {
  2088. assert(typeof Buffer !== 'undefined');
  2089. return this.toArrayLike(Buffer, endian, length);
  2090. };
  2091. BN.prototype.toArray = function toArray (endian, length) {
  2092. return this.toArrayLike(Array, endian, length);
  2093. };
  2094. BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) {
  2095. var byteLength = this.byteLength();
  2096. var reqLength = length || Math.max(1, byteLength);
  2097. assert(byteLength <= reqLength, 'byte array longer than desired length');
  2098. assert(reqLength > 0, 'Requested array length <= 0');
  2099. this.strip();
  2100. var littleEndian = endian === 'le';
  2101. var res = new ArrayType(reqLength);
  2102. var b, i;
  2103. var q = this.clone();
  2104. if (!littleEndian) {
  2105. // Assume big-endian
  2106. for (i = 0; i < reqLength - byteLength; i++) {
  2107. res[i] = 0;
  2108. }
  2109. for (i = 0; !q.isZero(); i++) {
  2110. b = q.andln(0xff);
  2111. q.iushrn(8);
  2112. res[reqLength - i - 1] = b;
  2113. }
  2114. } else {
  2115. for (i = 0; !q.isZero(); i++) {
  2116. b = q.andln(0xff);
  2117. q.iushrn(8);
  2118. res[i] = b;
  2119. }
  2120. for (; i < reqLength; i++) {
  2121. res[i] = 0;
  2122. }
  2123. }
  2124. return res;
  2125. };
  2126. if (Math.clz32) {
  2127. BN.prototype._countBits = function _countBits (w) {
  2128. return 32 - Math.clz32(w);
  2129. };
  2130. } else {
  2131. BN.prototype._countBits = function _countBits (w) {
  2132. var t = w;
  2133. var r = 0;
  2134. if (t >= 0x1000) {
  2135. r += 13;
  2136. t >>>= 13;
  2137. }
  2138. if (t >= 0x40) {
  2139. r += 7;
  2140. t >>>= 7;
  2141. }
  2142. if (t >= 0x8) {
  2143. r += 4;
  2144. t >>>= 4;
  2145. }
  2146. if (t >= 0x02) {
  2147. r += 2;
  2148. t >>>= 2;
  2149. }
  2150. return r + t;
  2151. };
  2152. }
  2153. BN.prototype._zeroBits = function _zeroBits (w) {
  2154. // Short-cut
  2155. if (w === 0) return 26;
  2156. var t = w;
  2157. var r = 0;
  2158. if ((t & 0x1fff) === 0) {
  2159. r += 13;
  2160. t >>>= 13;
  2161. }
  2162. if ((t & 0x7f) === 0) {
  2163. r += 7;
  2164. t >>>= 7;
  2165. }
  2166. if ((t & 0xf) === 0) {
  2167. r += 4;
  2168. t >>>= 4;
  2169. }
  2170. if ((t & 0x3) === 0) {
  2171. r += 2;
  2172. t >>>= 2;
  2173. }
  2174. if ((t & 0x1) === 0) {
  2175. r++;
  2176. }
  2177. return r;
  2178. };
  2179. // Return number of used bits in a BN
  2180. BN.prototype.bitLength = function bitLength () {
  2181. var w = this.words[this.length - 1];
  2182. var hi = this._countBits(w);
  2183. return (this.length - 1) * 26 + hi;
  2184. };
  2185. function toBitArray (num) {
  2186. var w = new Array(num.bitLength());
  2187. for (var bit = 0; bit < w.length; bit++) {
  2188. var off = (bit / 26) | 0;
  2189. var wbit = bit % 26;
  2190. w[bit] = (num.words[off] & (1 << wbit)) >>> wbit;
  2191. }
  2192. return w;
  2193. }
  2194. // Number of trailing zero bits
  2195. BN.prototype.zeroBits = function zeroBits () {
  2196. if (this.isZero()) return 0;
  2197. var r = 0;
  2198. for (var i = 0; i < this.length; i++) {
  2199. var b = this._zeroBits(this.words[i]);
  2200. r += b;
  2201. if (b !== 26) break;
  2202. }
  2203. return r;
  2204. };
  2205. BN.prototype.byteLength = function byteLength () {
  2206. return Math.ceil(this.bitLength() / 8);
  2207. };
  2208. BN.prototype.toTwos = function toTwos (width) {
  2209. if (this.negative !== 0) {
  2210. return this.abs().inotn(width).iaddn(1);
  2211. }
  2212. return this.clone();
  2213. };
  2214. BN.prototype.fromTwos = function fromTwos (width) {
  2215. if (this.testn(width - 1)) {
  2216. return this.notn(width).iaddn(1).ineg();
  2217. }
  2218. return this.clone();
  2219. };
  2220. BN.prototype.isNeg = function isNeg () {
  2221. return this.negative !== 0;
  2222. };
  2223. // Return negative clone of `this`
  2224. BN.prototype.neg = function neg () {
  2225. return this.clone().ineg();
  2226. };
  2227. BN.prototype.ineg = function ineg () {
  2228. if (!this.isZero()) {
  2229. this.negative ^= 1;
  2230. }
  2231. return this;
  2232. };
  2233. // Or `num` with `this` in-place
  2234. BN.prototype.iuor = function iuor (num) {
  2235. while (this.length < num.length) {
  2236. this.words[this.length++] = 0;
  2237. }
  2238. for (var i = 0; i < num.length; i++) {
  2239. this.words[i] = this.words[i] | num.words[i];
  2240. }
  2241. return this.strip();
  2242. };
  2243. BN.prototype.ior = function ior (num) {
  2244. assert((this.negative | num.negative) === 0);
  2245. return this.iuor(num);
  2246. };
  2247. // Or `num` with `this`
  2248. BN.prototype.or = function or (num) {
  2249. if (this.length > num.length) return this.clone().ior(num);
  2250. return num.clone().ior(this);
  2251. };
  2252. BN.prototype.uor = function uor (num) {
  2253. if (this.length > num.length) return this.clone().iuor(num);
  2254. return num.clone().iuor(this);
  2255. };
  2256. // And `num` with `this` in-place
  2257. BN.prototype.iuand = function iuand (num) {
  2258. // b = min-length(num, this)
  2259. var b;
  2260. if (this.length > num.length) {
  2261. b = num;
  2262. } else {
  2263. b = this;
  2264. }
  2265. for (var i = 0; i < b.length; i++) {
  2266. this.words[i] = this.words[i] & num.words[i];
  2267. }
  2268. this.length = b.length;
  2269. return this.strip();
  2270. };
  2271. BN.prototype.iand = function iand (num) {
  2272. assert((this.negative | num.negative) === 0);
  2273. return this.iuand(num);
  2274. };
  2275. // And `num` with `this`
  2276. BN.prototype.and = function and (num) {
  2277. if (this.length > num.length) return this.clone().iand(num);
  2278. return num.clone().iand(this);
  2279. };
  2280. BN.prototype.uand = function uand (num) {
  2281. if (this.length > num.length) return this.clone().iuand(num);
  2282. return num.clone().iuand(this);
  2283. };
  2284. // Xor `num` with `this` in-place
  2285. BN.prototype.iuxor = function iuxor (num) {
  2286. // a.length > b.length
  2287. var a;
  2288. var b;
  2289. if (this.length > num.length) {
  2290. a = this;
  2291. b = num;
  2292. } else {
  2293. a = num;
  2294. b = this;
  2295. }
  2296. for (var i = 0; i < b.length; i++) {
  2297. this.words[i] = a.words[i] ^ b.words[i];
  2298. }
  2299. if (this !== a) {
  2300. for (; i < a.length; i++) {
  2301. this.words[i] = a.words[i];
  2302. }
  2303. }
  2304. this.length = a.length;
  2305. return this.strip();
  2306. };
  2307. BN.prototype.ixor = function ixor (num) {
  2308. assert((this.negative | num.negative) === 0);
  2309. return this.iuxor(num);
  2310. };
  2311. // Xor `num` with `this`
  2312. BN.prototype.xor = function xor (num) {
  2313. if (this.length > num.length) return this.clone().ixor(num);
  2314. return num.clone().ixor(this);
  2315. };
  2316. BN.prototype.uxor = function uxor (num) {
  2317. if (this.length > num.length) return this.clone().iuxor(num);
  2318. return num.clone().iuxor(this);
  2319. };
  2320. // Not ``this`` with ``width`` bitwidth
  2321. BN.prototype.inotn = function inotn (width) {
  2322. assert(typeof width === 'number' && width >= 0);
  2323. var bytesNeeded = Math.ceil(width / 26) | 0;
  2324. var bitsLeft = width % 26;
  2325. // Extend the buffer with leading zeroes
  2326. this._expand(bytesNeeded);
  2327. if (bitsLeft > 0) {
  2328. bytesNeeded--;
  2329. }
  2330. // Handle complete words
  2331. for (var i = 0; i < bytesNeeded; i++) {
  2332. this.words[i] = ~this.words[i] & 0x3ffffff;
  2333. }
  2334. // Handle the residue
  2335. if (bitsLeft > 0) {
  2336. this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft));
  2337. }
  2338. // And remove leading zeroes
  2339. return this.strip();
  2340. };
  2341. BN.prototype.notn = function notn (width) {
  2342. return this.clone().inotn(width);
  2343. };
  2344. // Set `bit` of `this`
  2345. BN.prototype.setn = function setn (bit, val) {
  2346. assert(typeof bit === 'number' && bit >= 0);
  2347. var off = (bit / 26) | 0;
  2348. var wbit = bit % 26;
  2349. this._expand(off + 1);
  2350. if (val) {
  2351. this.words[off] = this.words[off] | (1 << wbit);
  2352. } else {
  2353. this.words[off] = this.words[off] & ~(1 << wbit);
  2354. }
  2355. return this.strip();
  2356. };
  2357. // Add `num` to `this` in-place
  2358. BN.prototype.iadd = function iadd (num) {
  2359. var r;
  2360. // negative + positive
  2361. if (this.negative !== 0 && num.negative === 0) {
  2362. this.negative = 0;
  2363. r = this.isub(num);
  2364. this.negative ^= 1;
  2365. return this._normSign();
  2366. // positive + negative
  2367. } else if (this.negative === 0 && num.negative !== 0) {
  2368. num.negative = 0;
  2369. r = this.isub(num);
  2370. num.negative = 1;
  2371. return r._normSign();
  2372. }
  2373. // a.length > b.length
  2374. var a, b;
  2375. if (this.length > num.length) {
  2376. a = this;
  2377. b = num;
  2378. } else {
  2379. a = num;
  2380. b = this;
  2381. }
  2382. var carry = 0;
  2383. for (var i = 0; i < b.length; i++) {
  2384. r = (a.words[i] | 0) + (b.words[i] | 0) + carry;
  2385. this.words[i] = r & 0x3ffffff;
  2386. carry = r >>> 26;
  2387. }
  2388. for (; carry !== 0 && i < a.length; i++) {
  2389. r = (a.words[i] | 0) + carry;
  2390. this.words[i] = r & 0x3ffffff;
  2391. carry = r >>> 26;
  2392. }
  2393. this.length = a.length;
  2394. if (carry !== 0) {
  2395. this.words[this.length] = carry;
  2396. this.length++;
  2397. // Copy the rest of the words
  2398. } else if (a !== this) {
  2399. for (; i < a.length; i++) {
  2400. this.words[i] = a.words[i];
  2401. }
  2402. }
  2403. return this;
  2404. };
  2405. // Add `num` to `this`
  2406. BN.prototype.add = function add (num) {
  2407. var res;
  2408. if (num.negative !== 0 && this.negative === 0) {
  2409. num.negative = 0;
  2410. res = this.sub(num);
  2411. num.negative ^= 1;
  2412. return res;
  2413. } else if (num.negative === 0 && this.negative !== 0) {
  2414. this.negative = 0;
  2415. res = num.sub(this);
  2416. this.negative = 1;
  2417. return res;
  2418. }
  2419. if (this.length > num.length) return this.clone().iadd(num);
  2420. return num.clone().iadd(this);
  2421. };
  2422. // Subtract `num` from `this` in-place
  2423. BN.prototype.isub = function isub (num) {
  2424. // this - (-num) = this + num
  2425. if (num.negative !== 0) {
  2426. num.negative = 0;
  2427. var r = this.iadd(num);
  2428. num.negative = 1;
  2429. return r._normSign();
  2430. // -this - num = -(this + num)
  2431. } else if (this.negative !== 0) {
  2432. this.negative = 0;
  2433. this.iadd(num);
  2434. this.negative = 1;
  2435. return this._normSign();
  2436. }
  2437. // At this point both numbers are positive
  2438. var cmp = this.cmp(num);
  2439. // Optimization - zeroify
  2440. if (cmp === 0) {
  2441. this.negative = 0;
  2442. this.length = 1;
  2443. this.words[0] = 0;
  2444. return this;
  2445. }
  2446. // a > b
  2447. var a, b;
  2448. if (cmp > 0) {
  2449. a = this;
  2450. b = num;
  2451. } else {
  2452. a = num;
  2453. b = this;
  2454. }
  2455. var carry = 0;
  2456. for (var i = 0; i < b.length; i++) {
  2457. r = (a.words[i] | 0) - (b.words[i] | 0) + carry;
  2458. carry = r >> 26;
  2459. this.words[i] = r & 0x3ffffff;
  2460. }
  2461. for (; carry !== 0 && i < a.length; i++) {
  2462. r = (a.words[i] | 0) + carry;
  2463. carry = r >> 26;
  2464. this.words[i] = r & 0x3ffffff;
  2465. }
  2466. // Copy rest of the words
  2467. if (carry === 0 && i < a.length && a !== this) {
  2468. for (; i < a.length; i++) {
  2469. this.words[i] = a.words[i];
  2470. }
  2471. }
  2472. this.length = Math.max(this.length, i);
  2473. if (a !== this) {
  2474. this.negative = 1;
  2475. }
  2476. return this.strip();
  2477. };
  2478. // Subtract `num` from `this`
  2479. BN.prototype.sub = function sub (num) {
  2480. return this.clone().isub(num);
  2481. };
  2482. function smallMulTo (self, num, out) {
  2483. out.negative = num.negative ^ self.negative;
  2484. var len = (self.length + num.length) | 0;
  2485. out.length = len;
  2486. len = (len - 1) | 0;
  2487. // Peel one iteration (compiler can't do it, because of code complexity)
  2488. var a = self.words[0] | 0;
  2489. var b = num.words[0] | 0;
  2490. var r = a * b;
  2491. var lo = r & 0x3ffffff;
  2492. var carry = (r / 0x4000000) | 0;
  2493. out.words[0] = lo;
  2494. for (var k = 1; k < len; k++) {
  2495. // Sum all words with the same `i + j = k` and accumulate `ncarry`,
  2496. // note that ncarry could be >= 0x3ffffff
  2497. var ncarry = carry >>> 26;
  2498. var rword = carry & 0x3ffffff;
  2499. var maxJ = Math.min(k, num.length - 1);
  2500. for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {
  2501. var i = (k - j) | 0;
  2502. a = self.words[i] | 0;
  2503. b = num.words[j] | 0;
  2504. r = a * b + rword;
  2505. ncarry += (r / 0x4000000) | 0;
  2506. rword = r & 0x3ffffff;
  2507. }
  2508. out.words[k] = rword | 0;
  2509. carry = ncarry | 0;
  2510. }
  2511. if (carry !== 0) {
  2512. out.words[k] = carry | 0;
  2513. } else {
  2514. out.length--;
  2515. }
  2516. return out.strip();
  2517. }
  2518. // TODO(indutny): it may be reasonable to omit it for users who don't need
  2519. // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit
  2520. // multiplication (like elliptic secp256k1).
  2521. var comb10MulTo = function comb10MulTo (self, num, out) {
  2522. var a = self.words;
  2523. var b = num.words;
  2524. var o = out.words;
  2525. var c = 0;
  2526. var lo;
  2527. var mid;
  2528. var hi;
  2529. var a0 = a[0] | 0;
  2530. var al0 = a0 & 0x1fff;
  2531. var ah0 = a0 >>> 13;
  2532. var a1 = a[1] | 0;
  2533. var al1 = a1 & 0x1fff;
  2534. var ah1 = a1 >>> 13;
  2535. var a2 = a[2] | 0;
  2536. var al2 = a2 & 0x1fff;
  2537. var ah2 = a2 >>> 13;
  2538. var a3 = a[3] | 0;
  2539. var al3 = a3 & 0x1fff;
  2540. var ah3 = a3 >>> 13;
  2541. var a4 = a[4] | 0;
  2542. var al4 = a4 & 0x1fff;
  2543. var ah4 = a4 >>> 13;
  2544. var a5 = a[5] | 0;
  2545. var al5 = a5 & 0x1fff;
  2546. var ah5 = a5 >>> 13;
  2547. var a6 = a[6] | 0;
  2548. var al6 = a6 & 0x1fff;
  2549. var ah6 = a6 >>> 13;
  2550. var a7 = a[7] | 0;
  2551. var al7 = a7 & 0x1fff;
  2552. var ah7 = a7 >>> 13;
  2553. var a8 = a[8] | 0;
  2554. var al8 = a8 & 0x1fff;
  2555. var ah8 = a8 >>> 13;
  2556. var a9 = a[9] | 0;
  2557. var al9 = a9 & 0x1fff;
  2558. var ah9 = a9 >>> 13;
  2559. var b0 = b[0] | 0;
  2560. var bl0 = b0 & 0x1fff;
  2561. var bh0 = b0 >>> 13;
  2562. var b1 = b[1] | 0;
  2563. var bl1 = b1 & 0x1fff;
  2564. var bh1 = b1 >>> 13;
  2565. var b2 = b[2] | 0;
  2566. var bl2 = b2 & 0x1fff;
  2567. var bh2 = b2 >>> 13;
  2568. var b3 = b[3] | 0;
  2569. var bl3 = b3 & 0x1fff;
  2570. var bh3 = b3 >>> 13;
  2571. var b4 = b[4] | 0;
  2572. var bl4 = b4 & 0x1fff;
  2573. var bh4 = b4 >>> 13;
  2574. var b5 = b[5] | 0;
  2575. var bl5 = b5 & 0x1fff;
  2576. var bh5 = b5 >>> 13;
  2577. var b6 = b[6] | 0;
  2578. var bl6 = b6 & 0x1fff;
  2579. var bh6 = b6 >>> 13;
  2580. var b7 = b[7] | 0;
  2581. var bl7 = b7 & 0x1fff;
  2582. var bh7 = b7 >>> 13;
  2583. var b8 = b[8] | 0;
  2584. var bl8 = b8 & 0x1fff;
  2585. var bh8 = b8 >>> 13;
  2586. var b9 = b[9] | 0;
  2587. var bl9 = b9 & 0x1fff;
  2588. var bh9 = b9 >>> 13;
  2589. out.negative = self.negative ^ num.negative;
  2590. out.length = 19;
  2591. /* k = 0 */
  2592. lo = Math.imul(al0, bl0);
  2593. mid = Math.imul(al0, bh0);
  2594. mid = (mid + Math.imul(ah0, bl0)) | 0;
  2595. hi = Math.imul(ah0, bh0);
  2596. var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  2597. c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0;
  2598. w0 &= 0x3ffffff;
  2599. /* k = 1 */
  2600. lo = Math.imul(al1, bl0);
  2601. mid = Math.imul(al1, bh0);
  2602. mid = (mid + Math.imul(ah1, bl0)) | 0;
  2603. hi = Math.imul(ah1, bh0);
  2604. lo = (lo + Math.imul(al0, bl1)) | 0;
  2605. mid = (mid + Math.imul(al0, bh1)) | 0;
  2606. mid = (mid + Math.imul(ah0, bl1)) | 0;
  2607. hi = (hi + Math.imul(ah0, bh1)) | 0;
  2608. var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  2609. c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0;
  2610. w1 &= 0x3ffffff;
  2611. /* k = 2 */
  2612. lo = Math.imul(al2, bl0);
  2613. mid = Math.imul(al2, bh0);
  2614. mid = (mid + Math.imul(ah2, bl0)) | 0;
  2615. hi = Math.imul(ah2, bh0);
  2616. lo = (lo + Math.imul(al1, bl1)) | 0;
  2617. mid = (mid + Math.imul(al1, bh1)) | 0;
  2618. mid = (mid + Math.imul(ah1, bl1)) | 0;
  2619. hi = (hi + Math.imul(ah1, bh1)) | 0;
  2620. lo = (lo + Math.imul(al0, bl2)) | 0;
  2621. mid = (mid + Math.imul(al0, bh2)) | 0;
  2622. mid = (mid + Math.imul(ah0, bl2)) | 0;
  2623. hi = (hi + Math.imul(ah0, bh2)) | 0;
  2624. var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  2625. c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0;
  2626. w2 &= 0x3ffffff;
  2627. /* k = 3 */
  2628. lo = Math.imul(al3, bl0);
  2629. mid = Math.imul(al3, bh0);
  2630. mid = (mid + Math.imul(ah3, bl0)) | 0;
  2631. hi = Math.imul(ah3, bh0);
  2632. lo = (lo + Math.imul(al2, bl1)) | 0;
  2633. mid = (mid + Math.imul(al2, bh1)) | 0;
  2634. mid = (mid + Math.imul(ah2, bl1)) | 0;
  2635. hi = (hi + Math.imul(ah2, bh1)) | 0;
  2636. lo = (lo + Math.imul(al1, bl2)) | 0;
  2637. mid = (mid + Math.imul(al1, bh2)) | 0;
  2638. mid = (mid + Math.imul(ah1, bl2)) | 0;
  2639. hi = (hi + Math.imul(ah1, bh2)) | 0;
  2640. lo = (lo + Math.imul(al0, bl3)) | 0;
  2641. mid = (mid + Math.imul(al0, bh3)) | 0;
  2642. mid = (mid + Math.imul(ah0, bl3)) | 0;
  2643. hi = (hi + Math.imul(ah0, bh3)) | 0;
  2644. var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  2645. c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0;
  2646. w3 &= 0x3ffffff;
  2647. /* k = 4 */
  2648. lo = Math.imul(al4, bl0);
  2649. mid = Math.imul(al4, bh0);
  2650. mid = (mid + Math.imul(ah4, bl0)) | 0;
  2651. hi = Math.imul(ah4, bh0);
  2652. lo = (lo + Math.imul(al3, bl1)) | 0;
  2653. mid = (mid + Math.imul(al3, bh1)) | 0;
  2654. mid = (mid + Math.imul(ah3, bl1)) | 0;
  2655. hi = (hi + Math.imul(ah3, bh1)) | 0;
  2656. lo = (lo + Math.imul(al2, bl2)) | 0;
  2657. mid = (mid + Math.imul(al2, bh2)) | 0;
  2658. mid = (mid + Math.imul(ah2, bl2)) | 0;
  2659. hi = (hi + Math.imul(ah2, bh2)) | 0;
  2660. lo = (lo + Math.imul(al1, bl3)) | 0;
  2661. mid = (mid + Math.imul(al1, bh3)) | 0;
  2662. mid = (mid + Math.imul(ah1, bl3)) | 0;
  2663. hi = (hi + Math.imul(ah1, bh3)) | 0;
  2664. lo = (lo + Math.imul(al0, bl4)) | 0;
  2665. mid = (mid + Math.imul(al0, bh4)) | 0;
  2666. mid = (mid + Math.imul(ah0, bl4)) | 0;
  2667. hi = (hi + Math.imul(ah0, bh4)) | 0;
  2668. var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  2669. c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0;
  2670. w4 &= 0x3ffffff;
  2671. /* k = 5 */
  2672. lo = Math.imul(al5, bl0);
  2673. mid = Math.imul(al5, bh0);
  2674. mid = (mid + Math.imul(ah5, bl0)) | 0;
  2675. hi = Math.imul(ah5, bh0);
  2676. lo = (lo + Math.imul(al4, bl1)) | 0;
  2677. mid = (mid + Math.imul(al4, bh1)) | 0;
  2678. mid = (mid + Math.imul(ah4, bl1)) | 0;
  2679. hi = (hi + Math.imul(ah4, bh1)) | 0;
  2680. lo = (lo + Math.imul(al3, bl2)) | 0;
  2681. mid = (mid + Math.imul(al3, bh2)) | 0;
  2682. mid = (mid + Math.imul(ah3, bl2)) | 0;
  2683. hi = (hi + Math.imul(ah3, bh2)) | 0;
  2684. lo = (lo + Math.imul(al2, bl3)) | 0;
  2685. mid = (mid + Math.imul(al2, bh3)) | 0;
  2686. mid = (mid + Math.imul(ah2, bl3)) | 0;
  2687. hi = (hi + Math.imul(ah2, bh3)) | 0;
  2688. lo = (lo + Math.imul(al1, bl4)) | 0;
  2689. mid = (mid + Math.imul(al1, bh4)) | 0;
  2690. mid = (mid + Math.imul(ah1, bl4)) | 0;
  2691. hi = (hi + Math.imul(ah1, bh4)) | 0;
  2692. lo = (lo + Math.imul(al0, bl5)) | 0;
  2693. mid = (mid + Math.imul(al0, bh5)) | 0;
  2694. mid = (mid + Math.imul(ah0, bl5)) | 0;
  2695. hi = (hi + Math.imul(ah0, bh5)) | 0;
  2696. var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  2697. c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0;
  2698. w5 &= 0x3ffffff;
  2699. /* k = 6 */
  2700. lo = Math.imul(al6, bl0);
  2701. mid = Math.imul(al6, bh0);
  2702. mid = (mid + Math.imul(ah6, bl0)) | 0;
  2703. hi = Math.imul(ah6, bh0);
  2704. lo = (lo + Math.imul(al5, bl1)) | 0;
  2705. mid = (mid + Math.imul(al5, bh1)) | 0;
  2706. mid = (mid + Math.imul(ah5, bl1)) | 0;
  2707. hi = (hi + Math.imul(ah5, bh1)) | 0;
  2708. lo = (lo + Math.imul(al4, bl2)) | 0;
  2709. mid = (mid + Math.imul(al4, bh2)) | 0;
  2710. mid = (mid + Math.imul(ah4, bl2)) | 0;
  2711. hi = (hi + Math.imul(ah4, bh2)) | 0;
  2712. lo = (lo + Math.imul(al3, bl3)) | 0;
  2713. mid = (mid + Math.imul(al3, bh3)) | 0;
  2714. mid = (mid + Math.imul(ah3, bl3)) | 0;
  2715. hi = (hi + Math.imul(ah3, bh3)) | 0;
  2716. lo = (lo + Math.imul(al2, bl4)) | 0;
  2717. mid = (mid + Math.imul(al2, bh4)) | 0;
  2718. mid = (mid + Math.imul(ah2, bl4)) | 0;
  2719. hi = (hi + Math.imul(ah2, bh4)) | 0;
  2720. lo = (lo + Math.imul(al1, bl5)) | 0;
  2721. mid = (mid + Math.imul(al1, bh5)) | 0;
  2722. mid = (mid + Math.imul(ah1, bl5)) | 0;
  2723. hi = (hi + Math.imul(ah1, bh5)) | 0;
  2724. lo = (lo + Math.imul(al0, bl6)) | 0;
  2725. mid = (mid + Math.imul(al0, bh6)) | 0;
  2726. mid = (mid + Math.imul(ah0, bl6)) | 0;
  2727. hi = (hi + Math.imul(ah0, bh6)) | 0;
  2728. var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  2729. c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0;
  2730. w6 &= 0x3ffffff;
  2731. /* k = 7 */
  2732. lo = Math.imul(al7, bl0);
  2733. mid = Math.imul(al7, bh0);
  2734. mid = (mid + Math.imul(ah7, bl0)) | 0;
  2735. hi = Math.imul(ah7, bh0);
  2736. lo = (lo + Math.imul(al6, bl1)) | 0;
  2737. mid = (mid + Math.imul(al6, bh1)) | 0;
  2738. mid = (mid + Math.imul(ah6, bl1)) | 0;
  2739. hi = (hi + Math.imul(ah6, bh1)) | 0;
  2740. lo = (lo + Math.imul(al5, bl2)) | 0;
  2741. mid = (mid + Math.imul(al5, bh2)) | 0;
  2742. mid = (mid + Math.imul(ah5, bl2)) | 0;
  2743. hi = (hi + Math.imul(ah5, bh2)) | 0;
  2744. lo = (lo + Math.imul(al4, bl3)) | 0;
  2745. mid = (mid + Math.imul(al4, bh3)) | 0;
  2746. mid = (mid + Math.imul(ah4, bl3)) | 0;
  2747. hi = (hi + Math.imul(ah4, bh3)) | 0;
  2748. lo = (lo + Math.imul(al3, bl4)) | 0;
  2749. mid = (mid + Math.imul(al3, bh4)) | 0;
  2750. mid = (mid + Math.imul(ah3, bl4)) | 0;
  2751. hi = (hi + Math.imul(ah3, bh4)) | 0;
  2752. lo = (lo + Math.imul(al2, bl5)) | 0;
  2753. mid = (mid + Math.imul(al2, bh5)) | 0;
  2754. mid = (mid + Math.imul(ah2, bl5)) | 0;
  2755. hi = (hi + Math.imul(ah2, bh5)) | 0;
  2756. lo = (lo + Math.imul(al1, bl6)) | 0;
  2757. mid = (mid + Math.imul(al1, bh6)) | 0;
  2758. mid = (mid + Math.imul(ah1, bl6)) | 0;
  2759. hi = (hi + Math.imul(ah1, bh6)) | 0;
  2760. lo = (lo + Math.imul(al0, bl7)) | 0;
  2761. mid = (mid + Math.imul(al0, bh7)) | 0;
  2762. mid = (mid + Math.imul(ah0, bl7)) | 0;
  2763. hi = (hi + Math.imul(ah0, bh7)) | 0;
  2764. var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  2765. c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0;
  2766. w7 &= 0x3ffffff;
  2767. /* k = 8 */
  2768. lo = Math.imul(al8, bl0);
  2769. mid = Math.imul(al8, bh0);
  2770. mid = (mid + Math.imul(ah8, bl0)) | 0;
  2771. hi = Math.imul(ah8, bh0);
  2772. lo = (lo + Math.imul(al7, bl1)) | 0;
  2773. mid = (mid + Math.imul(al7, bh1)) | 0;
  2774. mid = (mid + Math.imul(ah7, bl1)) | 0;
  2775. hi = (hi + Math.imul(ah7, bh1)) | 0;
  2776. lo = (lo + Math.imul(al6, bl2)) | 0;
  2777. mid = (mid + Math.imul(al6, bh2)) | 0;
  2778. mid = (mid + Math.imul(ah6, bl2)) | 0;
  2779. hi = (hi + Math.imul(ah6, bh2)) | 0;
  2780. lo = (lo + Math.imul(al5, bl3)) | 0;
  2781. mid = (mid + Math.imul(al5, bh3)) | 0;
  2782. mid = (mid + Math.imul(ah5, bl3)) | 0;
  2783. hi = (hi + Math.imul(ah5, bh3)) | 0;
  2784. lo = (lo + Math.imul(al4, bl4)) | 0;
  2785. mid = (mid + Math.imul(al4, bh4)) | 0;
  2786. mid = (mid + Math.imul(ah4, bl4)) | 0;
  2787. hi = (hi + Math.imul(ah4, bh4)) | 0;
  2788. lo = (lo + Math.imul(al3, bl5)) | 0;
  2789. mid = (mid + Math.imul(al3, bh5)) | 0;
  2790. mid = (mid + Math.imul(ah3, bl5)) | 0;
  2791. hi = (hi + Math.imul(ah3, bh5)) | 0;
  2792. lo = (lo + Math.imul(al2, bl6)) | 0;
  2793. mid = (mid + Math.imul(al2, bh6)) | 0;
  2794. mid = (mid + Math.imul(ah2, bl6)) | 0;
  2795. hi = (hi + Math.imul(ah2, bh6)) | 0;
  2796. lo = (lo + Math.imul(al1, bl7)) | 0;
  2797. mid = (mid + Math.imul(al1, bh7)) | 0;
  2798. mid = (mid + Math.imul(ah1, bl7)) | 0;
  2799. hi = (hi + Math.imul(ah1, bh7)) | 0;
  2800. lo = (lo + Math.imul(al0, bl8)) | 0;
  2801. mid = (mid + Math.imul(al0, bh8)) | 0;
  2802. mid = (mid + Math.imul(ah0, bl8)) | 0;
  2803. hi = (hi + Math.imul(ah0, bh8)) | 0;
  2804. var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  2805. c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0;
  2806. w8 &= 0x3ffffff;
  2807. /* k = 9 */
  2808. lo = Math.imul(al9, bl0);
  2809. mid = Math.imul(al9, bh0);
  2810. mid = (mid + Math.imul(ah9, bl0)) | 0;
  2811. hi = Math.imul(ah9, bh0);
  2812. lo = (lo + Math.imul(al8, bl1)) | 0;
  2813. mid = (mid + Math.imul(al8, bh1)) | 0;
  2814. mid = (mid + Math.imul(ah8, bl1)) | 0;
  2815. hi = (hi + Math.imul(ah8, bh1)) | 0;
  2816. lo = (lo + Math.imul(al7, bl2)) | 0;
  2817. mid = (mid + Math.imul(al7, bh2)) | 0;
  2818. mid = (mid + Math.imul(ah7, bl2)) | 0;
  2819. hi = (hi + Math.imul(ah7, bh2)) | 0;
  2820. lo = (lo + Math.imul(al6, bl3)) | 0;
  2821. mid = (mid + Math.imul(al6, bh3)) | 0;
  2822. mid = (mid + Math.imul(ah6, bl3)) | 0;
  2823. hi = (hi + Math.imul(ah6, bh3)) | 0;
  2824. lo = (lo + Math.imul(al5, bl4)) | 0;
  2825. mid = (mid + Math.imul(al5, bh4)) | 0;
  2826. mid = (mid + Math.imul(ah5, bl4)) | 0;
  2827. hi = (hi + Math.imul(ah5, bh4)) | 0;
  2828. lo = (lo + Math.imul(al4, bl5)) | 0;
  2829. mid = (mid + Math.imul(al4, bh5)) | 0;
  2830. mid = (mid + Math.imul(ah4, bl5)) | 0;
  2831. hi = (hi + Math.imul(ah4, bh5)) | 0;
  2832. lo = (lo + Math.imul(al3, bl6)) | 0;
  2833. mid = (mid + Math.imul(al3, bh6)) | 0;
  2834. mid = (mid + Math.imul(ah3, bl6)) | 0;
  2835. hi = (hi + Math.imul(ah3, bh6)) | 0;
  2836. lo = (lo + Math.imul(al2, bl7)) | 0;
  2837. mid = (mid + Math.imul(al2, bh7)) | 0;
  2838. mid = (mid + Math.imul(ah2, bl7)) | 0;
  2839. hi = (hi + Math.imul(ah2, bh7)) | 0;
  2840. lo = (lo + Math.imul(al1, bl8)) | 0;
  2841. mid = (mid + Math.imul(al1, bh8)) | 0;
  2842. mid = (mid + Math.imul(ah1, bl8)) | 0;
  2843. hi = (hi + Math.imul(ah1, bh8)) | 0;
  2844. lo = (lo + Math.imul(al0, bl9)) | 0;
  2845. mid = (mid + Math.imul(al0, bh9)) | 0;
  2846. mid = (mid + Math.imul(ah0, bl9)) | 0;
  2847. hi = (hi + Math.imul(ah0, bh9)) | 0;
  2848. var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  2849. c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0;
  2850. w9 &= 0x3ffffff;
  2851. /* k = 10 */
  2852. lo = Math.imul(al9, bl1);
  2853. mid = Math.imul(al9, bh1);
  2854. mid = (mid + Math.imul(ah9, bl1)) | 0;
  2855. hi = Math.imul(ah9, bh1);
  2856. lo = (lo + Math.imul(al8, bl2)) | 0;
  2857. mid = (mid + Math.imul(al8, bh2)) | 0;
  2858. mid = (mid + Math.imul(ah8, bl2)) | 0;
  2859. hi = (hi + Math.imul(ah8, bh2)) | 0;
  2860. lo = (lo + Math.imul(al7, bl3)) | 0;
  2861. mid = (mid + Math.imul(al7, bh3)) | 0;
  2862. mid = (mid + Math.imul(ah7, bl3)) | 0;
  2863. hi = (hi + Math.imul(ah7, bh3)) | 0;
  2864. lo = (lo + Math.imul(al6, bl4)) | 0;
  2865. mid = (mid + Math.imul(al6, bh4)) | 0;
  2866. mid = (mid + Math.imul(ah6, bl4)) | 0;
  2867. hi = (hi + Math.imul(ah6, bh4)) | 0;
  2868. lo = (lo + Math.imul(al5, bl5)) | 0;
  2869. mid = (mid + Math.imul(al5, bh5)) | 0;
  2870. mid = (mid + Math.imul(ah5, bl5)) | 0;
  2871. hi = (hi + Math.imul(ah5, bh5)) | 0;
  2872. lo = (lo + Math.imul(al4, bl6)) | 0;
  2873. mid = (mid + Math.imul(al4, bh6)) | 0;
  2874. mid = (mid + Math.imul(ah4, bl6)) | 0;
  2875. hi = (hi + Math.imul(ah4, bh6)) | 0;
  2876. lo = (lo + Math.imul(al3, bl7)) | 0;
  2877. mid = (mid + Math.imul(al3, bh7)) | 0;
  2878. mid = (mid + Math.imul(ah3, bl7)) | 0;
  2879. hi = (hi + Math.imul(ah3, bh7)) | 0;
  2880. lo = (lo + Math.imul(al2, bl8)) | 0;
  2881. mid = (mid + Math.imul(al2, bh8)) | 0;
  2882. mid = (mid + Math.imul(ah2, bl8)) | 0;
  2883. hi = (hi + Math.imul(ah2, bh8)) | 0;
  2884. lo = (lo + Math.imul(al1, bl9)) | 0;
  2885. mid = (mid + Math.imul(al1, bh9)) | 0;
  2886. mid = (mid + Math.imul(ah1, bl9)) | 0;
  2887. hi = (hi + Math.imul(ah1, bh9)) | 0;
  2888. var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  2889. c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0;
  2890. w10 &= 0x3ffffff;
  2891. /* k = 11 */
  2892. lo = Math.imul(al9, bl2);
  2893. mid = Math.imul(al9, bh2);
  2894. mid = (mid + Math.imul(ah9, bl2)) | 0;
  2895. hi = Math.imul(ah9, bh2);
  2896. lo = (lo + Math.imul(al8, bl3)) | 0;
  2897. mid = (mid + Math.imul(al8, bh3)) | 0;
  2898. mid = (mid + Math.imul(ah8, bl3)) | 0;
  2899. hi = (hi + Math.imul(ah8, bh3)) | 0;
  2900. lo = (lo + Math.imul(al7, bl4)) | 0;
  2901. mid = (mid + Math.imul(al7, bh4)) | 0;
  2902. mid = (mid + Math.imul(ah7, bl4)) | 0;
  2903. hi = (hi + Math.imul(ah7, bh4)) | 0;
  2904. lo = (lo + Math.imul(al6, bl5)) | 0;
  2905. mid = (mid + Math.imul(al6, bh5)) | 0;
  2906. mid = (mid + Math.imul(ah6, bl5)) | 0;
  2907. hi = (hi + Math.imul(ah6, bh5)) | 0;
  2908. lo = (lo + Math.imul(al5, bl6)) | 0;
  2909. mid = (mid + Math.imul(al5, bh6)) | 0;
  2910. mid = (mid + Math.imul(ah5, bl6)) | 0;
  2911. hi = (hi + Math.imul(ah5, bh6)) | 0;
  2912. lo = (lo + Math.imul(al4, bl7)) | 0;
  2913. mid = (mid + Math.imul(al4, bh7)) | 0;
  2914. mid = (mid + Math.imul(ah4, bl7)) | 0;
  2915. hi = (hi + Math.imul(ah4, bh7)) | 0;
  2916. lo = (lo + Math.imul(al3, bl8)) | 0;
  2917. mid = (mid + Math.imul(al3, bh8)) | 0;
  2918. mid = (mid + Math.imul(ah3, bl8)) | 0;
  2919. hi = (hi + Math.imul(ah3, bh8)) | 0;
  2920. lo = (lo + Math.imul(al2, bl9)) | 0;
  2921. mid = (mid + Math.imul(al2, bh9)) | 0;
  2922. mid = (mid + Math.imul(ah2, bl9)) | 0;
  2923. hi = (hi + Math.imul(ah2, bh9)) | 0;
  2924. var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  2925. c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0;
  2926. w11 &= 0x3ffffff;
  2927. /* k = 12 */
  2928. lo = Math.imul(al9, bl3);
  2929. mid = Math.imul(al9, bh3);
  2930. mid = (mid + Math.imul(ah9, bl3)) | 0;
  2931. hi = Math.imul(ah9, bh3);
  2932. lo = (lo + Math.imul(al8, bl4)) | 0;
  2933. mid = (mid + Math.imul(al8, bh4)) | 0;
  2934. mid = (mid + Math.imul(ah8, bl4)) | 0;
  2935. hi = (hi + Math.imul(ah8, bh4)) | 0;
  2936. lo = (lo + Math.imul(al7, bl5)) | 0;
  2937. mid = (mid + Math.imul(al7, bh5)) | 0;
  2938. mid = (mid + Math.imul(ah7, bl5)) | 0;
  2939. hi = (hi + Math.imul(ah7, bh5)) | 0;
  2940. lo = (lo + Math.imul(al6, bl6)) | 0;
  2941. mid = (mid + Math.imul(al6, bh6)) | 0;
  2942. mid = (mid + Math.imul(ah6, bl6)) | 0;
  2943. hi = (hi + Math.imul(ah6, bh6)) | 0;
  2944. lo = (lo + Math.imul(al5, bl7)) | 0;
  2945. mid = (mid + Math.imul(al5, bh7)) | 0;
  2946. mid = (mid + Math.imul(ah5, bl7)) | 0;
  2947. hi = (hi + Math.imul(ah5, bh7)) | 0;
  2948. lo = (lo + Math.imul(al4, bl8)) | 0;
  2949. mid = (mid + Math.imul(al4, bh8)) | 0;
  2950. mid = (mid + Math.imul(ah4, bl8)) | 0;
  2951. hi = (hi + Math.imul(ah4, bh8)) | 0;
  2952. lo = (lo + Math.imul(al3, bl9)) | 0;
  2953. mid = (mid + Math.imul(al3, bh9)) | 0;
  2954. mid = (mid + Math.imul(ah3, bl9)) | 0;
  2955. hi = (hi + Math.imul(ah3, bh9)) | 0;
  2956. var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  2957. c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0;
  2958. w12 &= 0x3ffffff;
  2959. /* k = 13 */
  2960. lo = Math.imul(al9, bl4);
  2961. mid = Math.imul(al9, bh4);
  2962. mid = (mid + Math.imul(ah9, bl4)) | 0;
  2963. hi = Math.imul(ah9, bh4);
  2964. lo = (lo + Math.imul(al8, bl5)) | 0;
  2965. mid = (mid + Math.imul(al8, bh5)) | 0;
  2966. mid = (mid + Math.imul(ah8, bl5)) | 0;
  2967. hi = (hi + Math.imul(ah8, bh5)) | 0;
  2968. lo = (lo + Math.imul(al7, bl6)) | 0;
  2969. mid = (mid + Math.imul(al7, bh6)) | 0;
  2970. mid = (mid + Math.imul(ah7, bl6)) | 0;
  2971. hi = (hi + Math.imul(ah7, bh6)) | 0;
  2972. lo = (lo + Math.imul(al6, bl7)) | 0;
  2973. mid = (mid + Math.imul(al6, bh7)) | 0;
  2974. mid = (mid + Math.imul(ah6, bl7)) | 0;
  2975. hi = (hi + Math.imul(ah6, bh7)) | 0;
  2976. lo = (lo + Math.imul(al5, bl8)) | 0;
  2977. mid = (mid + Math.imul(al5, bh8)) | 0;
  2978. mid = (mid + Math.imul(ah5, bl8)) | 0;
  2979. hi = (hi + Math.imul(ah5, bh8)) | 0;
  2980. lo = (lo + Math.imul(al4, bl9)) | 0;
  2981. mid = (mid + Math.imul(al4, bh9)) | 0;
  2982. mid = (mid + Math.imul(ah4, bl9)) | 0;
  2983. hi = (hi + Math.imul(ah4, bh9)) | 0;
  2984. var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  2985. c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0;
  2986. w13 &= 0x3ffffff;
  2987. /* k = 14 */
  2988. lo = Math.imul(al9, bl5);
  2989. mid = Math.imul(al9, bh5);
  2990. mid = (mid + Math.imul(ah9, bl5)) | 0;
  2991. hi = Math.imul(ah9, bh5);
  2992. lo = (lo + Math.imul(al8, bl6)) | 0;
  2993. mid = (mid + Math.imul(al8, bh6)) | 0;
  2994. mid = (mid + Math.imul(ah8, bl6)) | 0;
  2995. hi = (hi + Math.imul(ah8, bh6)) | 0;
  2996. lo = (lo + Math.imul(al7, bl7)) | 0;
  2997. mid = (mid + Math.imul(al7, bh7)) | 0;
  2998. mid = (mid + Math.imul(ah7, bl7)) | 0;
  2999. hi = (hi + Math.imul(ah7, bh7)) | 0;
  3000. lo = (lo + Math.imul(al6, bl8)) | 0;
  3001. mid = (mid + Math.imul(al6, bh8)) | 0;
  3002. mid = (mid + Math.imul(ah6, bl8)) | 0;
  3003. hi = (hi + Math.imul(ah6, bh8)) | 0;
  3004. lo = (lo + Math.imul(al5, bl9)) | 0;
  3005. mid = (mid + Math.imul(al5, bh9)) | 0;
  3006. mid = (mid + Math.imul(ah5, bl9)) | 0;
  3007. hi = (hi + Math.imul(ah5, bh9)) | 0;
  3008. var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  3009. c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0;
  3010. w14 &= 0x3ffffff;
  3011. /* k = 15 */
  3012. lo = Math.imul(al9, bl6);
  3013. mid = Math.imul(al9, bh6);
  3014. mid = (mid + Math.imul(ah9, bl6)) | 0;
  3015. hi = Math.imul(ah9, bh6);
  3016. lo = (lo + Math.imul(al8, bl7)) | 0;
  3017. mid = (mid + Math.imul(al8, bh7)) | 0;
  3018. mid = (mid + Math.imul(ah8, bl7)) | 0;
  3019. hi = (hi + Math.imul(ah8, bh7)) | 0;
  3020. lo = (lo + Math.imul(al7, bl8)) | 0;
  3021. mid = (mid + Math.imul(al7, bh8)) | 0;
  3022. mid = (mid + Math.imul(ah7, bl8)) | 0;
  3023. hi = (hi + Math.imul(ah7, bh8)) | 0;
  3024. lo = (lo + Math.imul(al6, bl9)) | 0;
  3025. mid = (mid + Math.imul(al6, bh9)) | 0;
  3026. mid = (mid + Math.imul(ah6, bl9)) | 0;
  3027. hi = (hi + Math.imul(ah6, bh9)) | 0;
  3028. var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  3029. c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0;
  3030. w15 &= 0x3ffffff;
  3031. /* k = 16 */
  3032. lo = Math.imul(al9, bl7);
  3033. mid = Math.imul(al9, bh7);
  3034. mid = (mid + Math.imul(ah9, bl7)) | 0;
  3035. hi = Math.imul(ah9, bh7);
  3036. lo = (lo + Math.imul(al8, bl8)) | 0;
  3037. mid = (mid + Math.imul(al8, bh8)) | 0;
  3038. mid = (mid + Math.imul(ah8, bl8)) | 0;
  3039. hi = (hi + Math.imul(ah8, bh8)) | 0;
  3040. lo = (lo + Math.imul(al7, bl9)) | 0;
  3041. mid = (mid + Math.imul(al7, bh9)) | 0;
  3042. mid = (mid + Math.imul(ah7, bl9)) | 0;
  3043. hi = (hi + Math.imul(ah7, bh9)) | 0;
  3044. var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  3045. c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0;
  3046. w16 &= 0x3ffffff;
  3047. /* k = 17 */
  3048. lo = Math.imul(al9, bl8);
  3049. mid = Math.imul(al9, bh8);
  3050. mid = (mid + Math.imul(ah9, bl8)) | 0;
  3051. hi = Math.imul(ah9, bh8);
  3052. lo = (lo + Math.imul(al8, bl9)) | 0;
  3053. mid = (mid + Math.imul(al8, bh9)) | 0;
  3054. mid = (mid + Math.imul(ah8, bl9)) | 0;
  3055. hi = (hi + Math.imul(ah8, bh9)) | 0;
  3056. var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  3057. c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0;
  3058. w17 &= 0x3ffffff;
  3059. /* k = 18 */
  3060. lo = Math.imul(al9, bl9);
  3061. mid = Math.imul(al9, bh9);
  3062. mid = (mid + Math.imul(ah9, bl9)) | 0;
  3063. hi = Math.imul(ah9, bh9);
  3064. var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;
  3065. c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0;
  3066. w18 &= 0x3ffffff;
  3067. o[0] = w0;
  3068. o[1] = w1;
  3069. o[2] = w2;
  3070. o[3] = w3;
  3071. o[4] = w4;
  3072. o[5] = w5;
  3073. o[6] = w6;
  3074. o[7] = w7;
  3075. o[8] = w8;
  3076. o[9] = w9;
  3077. o[10] = w10;
  3078. o[11] = w11;
  3079. o[12] = w12;
  3080. o[13] = w13;
  3081. o[14] = w14;
  3082. o[15] = w15;
  3083. o[16] = w16;
  3084. o[17] = w17;
  3085. o[18] = w18;
  3086. if (c !== 0) {
  3087. o[19] = c;
  3088. out.length++;
  3089. }
  3090. return out;
  3091. };
  3092. // Polyfill comb
  3093. if (!Math.imul) {
  3094. comb10MulTo = smallMulTo;
  3095. }
  3096. function bigMulTo (self, num, out) {
  3097. out.negative = num.negative ^ self.negative;
  3098. out.length = self.length + num.length;
  3099. var carry = 0;
  3100. var hncarry = 0;
  3101. for (var k = 0; k < out.length - 1; k++) {
  3102. // Sum all words with the same `i + j = k` and accumulate `ncarry`,
  3103. // note that ncarry could be >= 0x3ffffff
  3104. var ncarry = hncarry;
  3105. hncarry = 0;
  3106. var rword = carry & 0x3ffffff;
  3107. var maxJ = Math.min(k, num.length - 1);
  3108. for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {
  3109. var i = k - j;
  3110. var a = self.words[i] | 0;
  3111. var b = num.words[j] | 0;
  3112. var r = a * b;
  3113. var lo = r & 0x3ffffff;
  3114. ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0;
  3115. lo = (lo + rword) | 0;
  3116. rword = lo & 0x3ffffff;
  3117. ncarry = (ncarry + (lo >>> 26)) | 0;
  3118. hncarry += ncarry >>> 26;
  3119. ncarry &= 0x3ffffff;
  3120. }
  3121. out.words[k] = rword;
  3122. carry = ncarry;
  3123. ncarry = hncarry;
  3124. }
  3125. if (carry !== 0) {
  3126. out.words[k] = carry;
  3127. } else {
  3128. out.length--;
  3129. }
  3130. return out.strip();
  3131. }
  3132. function jumboMulTo (self, num, out) {
  3133. var fftm = new FFTM();
  3134. return fftm.mulp(self, num, out);
  3135. }
  3136. BN.prototype.mulTo = function mulTo (num, out) {
  3137. var res;
  3138. var len = this.length + num.length;
  3139. if (this.length === 10 && num.length === 10) {
  3140. res = comb10MulTo(this, num, out);
  3141. } else if (len < 63) {
  3142. res = smallMulTo(this, num, out);
  3143. } else if (len < 1024) {
  3144. res = bigMulTo(this, num, out);
  3145. } else {
  3146. res = jumboMulTo(this, num, out);
  3147. }
  3148. return res;
  3149. };
  3150. // Cooley-Tukey algorithm for FFT
  3151. // slightly revisited to rely on looping instead of recursion
  3152. function FFTM (x, y) {
  3153. this.x = x;
  3154. this.y = y;
  3155. }
  3156. FFTM.prototype.makeRBT = function makeRBT (N) {
  3157. var t = new Array(N);
  3158. var l = BN.prototype._countBits(N) - 1;
  3159. for (var i = 0; i < N; i++) {
  3160. t[i] = this.revBin(i, l, N);
  3161. }
  3162. return t;
  3163. };
  3164. // Returns binary-reversed representation of `x`
  3165. FFTM.prototype.revBin = function revBin (x, l, N) {
  3166. if (x === 0 || x === N - 1) return x;
  3167. var rb = 0;
  3168. for (var i = 0; i < l; i++) {
  3169. rb |= (x & 1) << (l - i - 1);
  3170. x >>= 1;
  3171. }
  3172. return rb;
  3173. };
  3174. // Performs "tweedling" phase, therefore 'emulating'
  3175. // behaviour of the recursive algorithm
  3176. FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) {
  3177. for (var i = 0; i < N; i++) {
  3178. rtws[i] = rws[rbt[i]];
  3179. itws[i] = iws[rbt[i]];
  3180. }
  3181. };
  3182. FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) {
  3183. this.permute(rbt, rws, iws, rtws, itws, N);
  3184. for (var s = 1; s < N; s <<= 1) {
  3185. var l = s << 1;
  3186. var rtwdf = Math.cos(2 * Math.PI / l);
  3187. var itwdf = Math.sin(2 * Math.PI / l);
  3188. for (var p = 0; p < N; p += l) {
  3189. var rtwdf_ = rtwdf;
  3190. var itwdf_ = itwdf;
  3191. for (var j = 0; j < s; j++) {
  3192. var re = rtws[p + j];
  3193. var ie = itws[p + j];
  3194. var ro = rtws[p + j + s];
  3195. var io = itws[p + j + s];
  3196. var rx = rtwdf_ * ro - itwdf_ * io;
  3197. io = rtwdf_ * io + itwdf_ * ro;
  3198. ro = rx;
  3199. rtws[p + j] = re + ro;
  3200. itws[p + j] = ie + io;
  3201. rtws[p + j + s] = re - ro;
  3202. itws[p + j + s] = ie - io;
  3203. /* jshint maxdepth : false */
  3204. if (j !== l) {
  3205. rx = rtwdf * rtwdf_ - itwdf * itwdf_;
  3206. itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;
  3207. rtwdf_ = rx;
  3208. }
  3209. }
  3210. }
  3211. }
  3212. };
  3213. FFTM.prototype.guessLen13b = function guessLen13b (n, m) {
  3214. var N = Math.max(m, n) | 1;
  3215. var odd = N & 1;
  3216. var i = 0;
  3217. for (N = N / 2 | 0; N; N = N >>> 1) {
  3218. i++;
  3219. }
  3220. return 1 << i + 1 + odd;
  3221. };
  3222. FFTM.prototype.conjugate = function conjugate (rws, iws, N) {
  3223. if (N <= 1) return;
  3224. for (var i = 0; i < N / 2; i++) {
  3225. var t = rws[i];
  3226. rws[i] = rws[N - i - 1];
  3227. rws[N - i - 1] = t;
  3228. t = iws[i];
  3229. iws[i] = -iws[N - i - 1];
  3230. iws[N - i - 1] = -t;
  3231. }
  3232. };
  3233. FFTM.prototype.normalize13b = function normalize13b (ws, N) {
  3234. var carry = 0;
  3235. for (var i = 0; i < N / 2; i++) {
  3236. var w = Math.round(ws[2 * i + 1] / N) * 0x2000 +
  3237. Math.round(ws[2 * i] / N) +
  3238. carry;
  3239. ws[i] = w & 0x3ffffff;
  3240. if (w < 0x4000000) {
  3241. carry = 0;
  3242. } else {
  3243. carry = w / 0x4000000 | 0;
  3244. }
  3245. }
  3246. return ws;
  3247. };
  3248. FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) {
  3249. var carry = 0;
  3250. for (var i = 0; i < len; i++) {
  3251. carry = carry + (ws[i] | 0);
  3252. rws[2 * i] = carry & 0x1fff; carry = carry >>> 13;
  3253. rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13;
  3254. }
  3255. // Pad with zeroes
  3256. for (i = 2 * len; i < N; ++i) {
  3257. rws[i] = 0;
  3258. }
  3259. assert(carry === 0);
  3260. assert((carry & ~0x1fff) === 0);
  3261. };
  3262. FFTM.prototype.stub = function stub (N) {
  3263. var ph = new Array(N);
  3264. for (var i = 0; i < N; i++) {
  3265. ph[i] = 0;
  3266. }
  3267. return ph;
  3268. };
  3269. FFTM.prototype.mulp = function mulp (x, y, out) {
  3270. var N = 2 * this.guessLen13b(x.length, y.length);
  3271. var rbt = this.makeRBT(N);
  3272. var _ = this.stub(N);
  3273. var rws = new Array(N);
  3274. var rwst = new Array(N);
  3275. var iwst = new Array(N);
  3276. var nrws = new Array(N);
  3277. var nrwst = new Array(N);
  3278. var niwst = new Array(N);
  3279. var rmws = out.words;
  3280. rmws.length = N;
  3281. this.convert13b(x.words, x.length, rws, N);
  3282. this.convert13b(y.words, y.length, nrws, N);
  3283. this.transform(rws, _, rwst, iwst, N, rbt);
  3284. this.transform(nrws, _, nrwst, niwst, N, rbt);
  3285. for (var i = 0; i < N; i++) {
  3286. var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];
  3287. iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];
  3288. rwst[i] = rx;
  3289. }
  3290. this.conjugate(rwst, iwst, N);
  3291. this.transform(rwst, iwst, rmws, _, N, rbt);
  3292. this.conjugate(rmws, _, N);
  3293. this.normalize13b(rmws, N);
  3294. out.negative = x.negative ^ y.negative;
  3295. out.length = x.length + y.length;
  3296. return out.strip();
  3297. };
  3298. // Multiply `this` by `num`
  3299. BN.prototype.mul = function mul (num) {
  3300. var out = new BN(null);
  3301. out.words = new Array(this.length + num.length);
  3302. return this.mulTo(num, out);
  3303. };
  3304. // Multiply employing FFT
  3305. BN.prototype.mulf = function mulf (num) {
  3306. var out = new BN(null);
  3307. out.words = new Array(this.length + num.length);
  3308. return jumboMulTo(this, num, out);
  3309. };
  3310. // In-place Multiplication
  3311. BN.prototype.imul = function imul (num) {
  3312. return this.clone().mulTo(num, this);
  3313. };
  3314. BN.prototype.imuln = function imuln (num) {
  3315. assert(typeof num === 'number');
  3316. assert(num < 0x4000000);
  3317. // Carry
  3318. var carry = 0;
  3319. for (var i = 0; i < this.length; i++) {
  3320. var w = (this.words[i] | 0) * num;
  3321. var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);
  3322. carry >>= 26;
  3323. carry += (w / 0x4000000) | 0;
  3324. // NOTE: lo is 27bit maximum
  3325. carry += lo >>> 26;
  3326. this.words[i] = lo & 0x3ffffff;
  3327. }
  3328. if (carry !== 0) {
  3329. this.words[i] = carry;
  3330. this.length++;
  3331. }
  3332. return this;
  3333. };
  3334. BN.prototype.muln = function muln (num) {
  3335. return this.clone().imuln(num);
  3336. };
  3337. // `this` * `this`
  3338. BN.prototype.sqr = function sqr () {
  3339. return this.mul(this);
  3340. };
  3341. // `this` * `this` in-place
  3342. BN.prototype.isqr = function isqr () {
  3343. return this.imul(this.clone());
  3344. };
  3345. // Math.pow(`this`, `num`)
  3346. BN.prototype.pow = function pow (num) {
  3347. var w = toBitArray(num);
  3348. if (w.length === 0) return new BN(1);
  3349. // Skip leading zeroes
  3350. var res = this;
  3351. for (var i = 0; i < w.length; i++, res = res.sqr()) {
  3352. if (w[i] !== 0) break;
  3353. }
  3354. if (++i < w.length) {
  3355. for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {
  3356. if (w[i] === 0) continue;
  3357. res = res.mul(q);
  3358. }
  3359. }
  3360. return res;
  3361. };
  3362. // Shift-left in-place
  3363. BN.prototype.iushln = function iushln (bits) {
  3364. assert(typeof bits === 'number' && bits >= 0);
  3365. var r = bits % 26;
  3366. var s = (bits - r) / 26;
  3367. var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r);
  3368. var i;
  3369. if (r !== 0) {
  3370. var carry = 0;
  3371. for (i = 0; i < this.length; i++) {
  3372. var newCarry = this.words[i] & carryMask;
  3373. var c = ((this.words[i] | 0) - newCarry) << r;
  3374. this.words[i] = c | carry;
  3375. carry = newCarry >>> (26 - r);
  3376. }
  3377. if (carry) {
  3378. this.words[i] = carry;
  3379. this.length++;
  3380. }
  3381. }
  3382. if (s !== 0) {
  3383. for (i = this.length - 1; i >= 0; i--) {
  3384. this.words[i + s] = this.words[i];
  3385. }
  3386. for (i = 0; i < s; i++) {
  3387. this.words[i] = 0;
  3388. }
  3389. this.length += s;
  3390. }
  3391. return this.strip();
  3392. };
  3393. BN.prototype.ishln = function ishln (bits) {
  3394. // TODO(indutny): implement me
  3395. assert(this.negative === 0);
  3396. return this.iushln(bits);
  3397. };
  3398. // Shift-right in-place
  3399. // NOTE: `hint` is a lowest bit before trailing zeroes
  3400. // NOTE: if `extended` is present - it will be filled with destroyed bits
  3401. BN.prototype.iushrn = function iushrn (bits, hint, extended) {
  3402. assert(typeof bits === 'number' && bits >= 0);
  3403. var h;
  3404. if (hint) {
  3405. h = (hint - (hint % 26)) / 26;
  3406. } else {
  3407. h = 0;
  3408. }
  3409. var r = bits % 26;
  3410. var s = Math.min((bits - r) / 26, this.length);
  3411. var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);
  3412. var maskedWords = extended;
  3413. h -= s;
  3414. h = Math.max(0, h);
  3415. // Extended mode, copy masked part
  3416. if (maskedWords) {
  3417. for (var i = 0; i < s; i++) {
  3418. maskedWords.words[i] = this.words[i];
  3419. }
  3420. maskedWords.length = s;
  3421. }
  3422. if (s === 0) {
  3423. // No-op, we should not move anything at all
  3424. } else if (this.length > s) {
  3425. this.length -= s;
  3426. for (i = 0; i < this.length; i++) {
  3427. this.words[i] = this.words[i + s];
  3428. }
  3429. } else {
  3430. this.words[0] = 0;
  3431. this.length = 1;
  3432. }
  3433. var carry = 0;
  3434. for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {
  3435. var word = this.words[i] | 0;
  3436. this.words[i] = (carry << (26 - r)) | (word >>> r);
  3437. carry = word & mask;
  3438. }
  3439. // Push carried bits as a mask
  3440. if (maskedWords && carry !== 0) {
  3441. maskedWords.words[maskedWords.length++] = carry;
  3442. }
  3443. if (this.length === 0) {
  3444. this.words[0] = 0;
  3445. this.length = 1;
  3446. }
  3447. return this.strip();
  3448. };
  3449. BN.prototype.ishrn = function ishrn (bits, hint, extended) {
  3450. // TODO(indutny): implement me
  3451. assert(this.negative === 0);
  3452. return this.iushrn(bits, hint, extended);
  3453. };
  3454. // Shift-left
  3455. BN.prototype.shln = function shln (bits) {
  3456. return this.clone().ishln(bits);
  3457. };
  3458. BN.prototype.ushln = function ushln (bits) {
  3459. return this.clone().iushln(bits);
  3460. };
  3461. // Shift-right
  3462. BN.prototype.shrn = function shrn (bits) {
  3463. return this.clone().ishrn(bits);
  3464. };
  3465. BN.prototype.ushrn = function ushrn (bits) {
  3466. return this.clone().iushrn(bits);
  3467. };
  3468. // Test if n bit is set
  3469. BN.prototype.testn = function testn (bit) {
  3470. assert(typeof bit === 'number' && bit >= 0);
  3471. var r = bit % 26;
  3472. var s = (bit - r) / 26;
  3473. var q = 1 << r;
  3474. // Fast case: bit is much higher than all existing words
  3475. if (this.length <= s) return false;
  3476. // Check bit and return
  3477. var w = this.words[s];
  3478. return !!(w & q);
  3479. };
  3480. // Return only lowers bits of number (in-place)
  3481. BN.prototype.imaskn = function imaskn (bits) {
  3482. assert(typeof bits === 'number' && bits >= 0);
  3483. var r = bits % 26;
  3484. var s = (bits - r) / 26;
  3485. assert(this.negative === 0, 'imaskn works only with positive numbers');
  3486. if (this.length <= s) {
  3487. return this;
  3488. }
  3489. if (r !== 0) {
  3490. s++;
  3491. }
  3492. this.length = Math.min(s, this.length);
  3493. if (r !== 0) {
  3494. var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);
  3495. this.words[this.length - 1] &= mask;
  3496. }
  3497. return this.strip();
  3498. };
  3499. // Return only lowers bits of number
  3500. BN.prototype.maskn = function maskn (bits) {
  3501. return this.clone().imaskn(bits);
  3502. };
  3503. // Add plain number `num` to `this`
  3504. BN.prototype.iaddn = function iaddn (num) {
  3505. assert(typeof num === 'number');
  3506. assert(num < 0x4000000);
  3507. if (num < 0) return this.isubn(-num);
  3508. // Possible sign change
  3509. if (this.negative !== 0) {
  3510. if (this.length === 1 && (this.words[0] | 0) < num) {
  3511. this.words[0] = num - (this.words[0] | 0);
  3512. this.negative = 0;
  3513. return this;
  3514. }
  3515. this.negative = 0;
  3516. this.isubn(num);
  3517. this.negative = 1;
  3518. return this;
  3519. }
  3520. // Add without checks
  3521. return this._iaddn(num);
  3522. };
  3523. BN.prototype._iaddn = function _iaddn (num) {
  3524. this.words[0] += num;
  3525. // Carry
  3526. for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {
  3527. this.words[i] -= 0x4000000;
  3528. if (i === this.length - 1) {
  3529. this.words[i + 1] = 1;
  3530. } else {
  3531. this.words[i + 1]++;
  3532. }
  3533. }
  3534. this.length = Math.max(this.length, i + 1);
  3535. return this;
  3536. };
  3537. // Subtract plain number `num` from `this`
  3538. BN.prototype.isubn = function isubn (num) {
  3539. assert(typeof num === 'number');
  3540. assert(num < 0x4000000);
  3541. if (num < 0) return this.iaddn(-num);
  3542. if (this.negative !== 0) {
  3543. this.negative = 0;
  3544. this.iaddn(num);
  3545. this.negative = 1;
  3546. return this;
  3547. }
  3548. this.words[0] -= num;
  3549. if (this.length === 1 && this.words[0] < 0) {
  3550. this.words[0] = -this.words[0];
  3551. this.negative = 1;
  3552. } else {
  3553. // Carry
  3554. for (var i = 0; i < this.length && this.words[i] < 0; i++) {
  3555. this.words[i] += 0x4000000;
  3556. this.words[i + 1] -= 1;
  3557. }
  3558. }
  3559. return this.strip();
  3560. };
  3561. BN.prototype.addn = function addn (num) {
  3562. return this.clone().iaddn(num);
  3563. };
  3564. BN.prototype.subn = function subn (num) {
  3565. return this.clone().isubn(num);
  3566. };
  3567. BN.prototype.iabs = function iabs () {
  3568. this.negative = 0;
  3569. return this;
  3570. };
  3571. BN.prototype.abs = function abs () {
  3572. return this.clone().iabs();
  3573. };
  3574. BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) {
  3575. var len = num.length + shift;
  3576. var i;
  3577. this._expand(len);
  3578. var w;
  3579. var carry = 0;
  3580. for (i = 0; i < num.length; i++) {
  3581. w = (this.words[i + shift] | 0) + carry;
  3582. var right = (num.words[i] | 0) * mul;
  3583. w -= right & 0x3ffffff;
  3584. carry = (w >> 26) - ((right / 0x4000000) | 0);
  3585. this.words[i + shift] = w & 0x3ffffff;
  3586. }
  3587. for (; i < this.length - shift; i++) {
  3588. w = (this.words[i + shift] | 0) + carry;
  3589. carry = w >> 26;
  3590. this.words[i + shift] = w & 0x3ffffff;
  3591. }
  3592. if (carry === 0) return this.strip();
  3593. // Subtraction overflow
  3594. assert(carry === -1);
  3595. carry = 0;
  3596. for (i = 0; i < this.length; i++) {
  3597. w = -(this.words[i] | 0) + carry;
  3598. carry = w >> 26;
  3599. this.words[i] = w & 0x3ffffff;
  3600. }
  3601. this.negative = 1;
  3602. return this.strip();
  3603. };
  3604. BN.prototype._wordDiv = function _wordDiv (num, mode) {
  3605. var shift = this.length - num.length;
  3606. var a = this.clone();
  3607. var b = num;
  3608. // Normalize
  3609. var bhi = b.words[b.length - 1] | 0;
  3610. var bhiBits = this._countBits(bhi);
  3611. shift = 26 - bhiBits;
  3612. if (shift !== 0) {
  3613. b = b.ushln(shift);
  3614. a.iushln(shift);
  3615. bhi = b.words[b.length - 1] | 0;
  3616. }
  3617. // Initialize quotient
  3618. var m = a.length - b.length;
  3619. var q;
  3620. if (mode !== 'mod') {
  3621. q = new BN(null);
  3622. q.length = m + 1;
  3623. q.words = new Array(q.length);
  3624. for (var i = 0; i < q.length; i++) {
  3625. q.words[i] = 0;
  3626. }
  3627. }
  3628. var diff = a.clone()._ishlnsubmul(b, 1, m);
  3629. if (diff.negative === 0) {
  3630. a = diff;
  3631. if (q) {
  3632. q.words[m] = 1;
  3633. }
  3634. }
  3635. for (var j = m - 1; j >= 0; j--) {
  3636. var qj = (a.words[b.length + j] | 0) * 0x4000000 +
  3637. (a.words[b.length + j - 1] | 0);
  3638. // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max
  3639. // (0x7ffffff)
  3640. qj = Math.min((qj / bhi) | 0, 0x3ffffff);
  3641. a._ishlnsubmul(b, qj, j);
  3642. while (a.negative !== 0) {
  3643. qj--;
  3644. a.negative = 0;
  3645. a._ishlnsubmul(b, 1, j);
  3646. if (!a.isZero()) {
  3647. a.negative ^= 1;
  3648. }
  3649. }
  3650. if (q) {
  3651. q.words[j] = qj;
  3652. }
  3653. }
  3654. if (q) {
  3655. q.strip();
  3656. }
  3657. a.strip();
  3658. // Denormalize
  3659. if (mode !== 'div' && shift !== 0) {
  3660. a.iushrn(shift);
  3661. }
  3662. return {
  3663. div: q || null,
  3664. mod: a
  3665. };
  3666. };
  3667. // NOTE: 1) `mode` can be set to `mod` to request mod only,
  3668. // to `div` to request div only, or be absent to
  3669. // request both div & mod
  3670. // 2) `positive` is true if unsigned mod is requested
  3671. BN.prototype.divmod = function divmod (num, mode, positive) {
  3672. assert(!num.isZero());
  3673. if (this.isZero()) {
  3674. return {
  3675. div: new BN(0),
  3676. mod: new BN(0)
  3677. };
  3678. }
  3679. var div, mod, res;
  3680. if (this.negative !== 0 && num.negative === 0) {
  3681. res = this.neg().divmod(num, mode);
  3682. if (mode !== 'mod') {
  3683. div = res.div.neg();
  3684. }
  3685. if (mode !== 'div') {
  3686. mod = res.mod.neg();
  3687. if (positive && mod.negative !== 0) {
  3688. mod.iadd(num);
  3689. }
  3690. }
  3691. return {
  3692. div: div,
  3693. mod: mod
  3694. };
  3695. }
  3696. if (this.negative === 0 && num.negative !== 0) {
  3697. res = this.divmod(num.neg(), mode);
  3698. if (mode !== 'mod') {
  3699. div = res.div.neg();
  3700. }
  3701. return {
  3702. div: div,
  3703. mod: res.mod
  3704. };
  3705. }
  3706. if ((this.negative & num.negative) !== 0) {
  3707. res = this.neg().divmod(num.neg(), mode);
  3708. if (mode !== 'div') {
  3709. mod = res.mod.neg();
  3710. if (positive && mod.negative !== 0) {
  3711. mod.isub(num);
  3712. }
  3713. }
  3714. return {
  3715. div: res.div,
  3716. mod: mod
  3717. };
  3718. }
  3719. // Both numbers are positive at this point
  3720. // Strip both numbers to approximate shift value
  3721. if (num.length > this.length || this.cmp(num) < 0) {
  3722. return {
  3723. div: new BN(0),
  3724. mod: this
  3725. };
  3726. }
  3727. // Very short reduction
  3728. if (num.length === 1) {
  3729. if (mode === 'div') {
  3730. return {
  3731. div: this.divn(num.words[0]),
  3732. mod: null
  3733. };
  3734. }
  3735. if (mode === 'mod') {
  3736. return {
  3737. div: null,
  3738. mod: new BN(this.modn(num.words[0]))
  3739. };
  3740. }
  3741. return {
  3742. div: this.divn(num.words[0]),
  3743. mod: new BN(this.modn(num.words[0]))
  3744. };
  3745. }
  3746. return this._wordDiv(num, mode);
  3747. };
  3748. // Find `this` / `num`
  3749. BN.prototype.div = function div (num) {
  3750. return this.divmod(num, 'div', false).div;
  3751. };
  3752. // Find `this` % `num`
  3753. BN.prototype.mod = function mod (num) {
  3754. return this.divmod(num, 'mod', false).mod;
  3755. };
  3756. BN.prototype.umod = function umod (num) {
  3757. return this.divmod(num, 'mod', true).mod;
  3758. };
  3759. // Find Round(`this` / `num`)
  3760. BN.prototype.divRound = function divRound (num) {
  3761. var dm = this.divmod(num);
  3762. // Fast case - exact division
  3763. if (dm.mod.isZero()) return dm.div;
  3764. var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;
  3765. var half = num.ushrn(1);
  3766. var r2 = num.andln(1);
  3767. var cmp = mod.cmp(half);
  3768. // Round down
  3769. if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div;
  3770. // Round up
  3771. return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);
  3772. };
  3773. BN.prototype.modn = function modn (num) {
  3774. assert(num <= 0x3ffffff);
  3775. var p = (1 << 26) % num;
  3776. var acc = 0;
  3777. for (var i = this.length - 1; i >= 0; i--) {
  3778. acc = (p * acc + (this.words[i] | 0)) % num;
  3779. }
  3780. return acc;
  3781. };
  3782. // In-place division by number
  3783. BN.prototype.idivn = function idivn (num) {
  3784. assert(num <= 0x3ffffff);
  3785. var carry = 0;
  3786. for (var i = this.length - 1; i >= 0; i--) {
  3787. var w = (this.words[i] | 0) + carry * 0x4000000;
  3788. this.words[i] = (w / num) | 0;
  3789. carry = w % num;
  3790. }
  3791. return this.strip();
  3792. };
  3793. BN.prototype.divn = function divn (num) {
  3794. return this.clone().idivn(num);
  3795. };
  3796. BN.prototype.egcd = function egcd (p) {
  3797. assert(p.negative === 0);
  3798. assert(!p.isZero());
  3799. var x = this;
  3800. var y = p.clone();
  3801. if (x.negative !== 0) {
  3802. x = x.umod(p);
  3803. } else {
  3804. x = x.clone();
  3805. }
  3806. // A * x + B * y = x
  3807. var A = new BN(1);
  3808. var B = new BN(0);
  3809. // C * x + D * y = y
  3810. var C = new BN(0);
  3811. var D = new BN(1);
  3812. var g = 0;
  3813. while (x.isEven() && y.isEven()) {
  3814. x.iushrn(1);
  3815. y.iushrn(1);
  3816. ++g;
  3817. }
  3818. var yp = y.clone();
  3819. var xp = x.clone();
  3820. while (!x.isZero()) {
  3821. for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
  3822. if (i > 0) {
  3823. x.iushrn(i);
  3824. while (i-- > 0) {
  3825. if (A.isOdd() || B.isOdd()) {
  3826. A.iadd(yp);
  3827. B.isub(xp);
  3828. }
  3829. A.iushrn(1);
  3830. B.iushrn(1);
  3831. }
  3832. }
  3833. for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
  3834. if (j > 0) {
  3835. y.iushrn(j);
  3836. while (j-- > 0) {
  3837. if (C.isOdd() || D.isOdd()) {
  3838. C.iadd(yp);
  3839. D.isub(xp);
  3840. }
  3841. C.iushrn(1);
  3842. D.iushrn(1);
  3843. }
  3844. }
  3845. if (x.cmp(y) >= 0) {
  3846. x.isub(y);
  3847. A.isub(C);
  3848. B.isub(D);
  3849. } else {
  3850. y.isub(x);
  3851. C.isub(A);
  3852. D.isub(B);
  3853. }
  3854. }
  3855. return {
  3856. a: C,
  3857. b: D,
  3858. gcd: y.iushln(g)
  3859. };
  3860. };
  3861. // This is reduced incarnation of the binary EEA
  3862. // above, designated to invert members of the
  3863. // _prime_ fields F(p) at a maximal speed
  3864. BN.prototype._invmp = function _invmp (p) {
  3865. assert(p.negative === 0);
  3866. assert(!p.isZero());
  3867. var a = this;
  3868. var b = p.clone();
  3869. if (a.negative !== 0) {
  3870. a = a.umod(p);
  3871. } else {
  3872. a = a.clone();
  3873. }
  3874. var x1 = new BN(1);
  3875. var x2 = new BN(0);
  3876. var delta = b.clone();
  3877. while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {
  3878. for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);
  3879. if (i > 0) {
  3880. a.iushrn(i);
  3881. while (i-- > 0) {
  3882. if (x1.isOdd()) {
  3883. x1.iadd(delta);
  3884. }
  3885. x1.iushrn(1);
  3886. }
  3887. }
  3888. for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);
  3889. if (j > 0) {
  3890. b.iushrn(j);
  3891. while (j-- > 0) {
  3892. if (x2.isOdd()) {
  3893. x2.iadd(delta);
  3894. }
  3895. x2.iushrn(1);
  3896. }
  3897. }
  3898. if (a.cmp(b) >= 0) {
  3899. a.isub(b);
  3900. x1.isub(x2);
  3901. } else {
  3902. b.isub(a);
  3903. x2.isub(x1);
  3904. }
  3905. }
  3906. var res;
  3907. if (a.cmpn(1) === 0) {
  3908. res = x1;
  3909. } else {
  3910. res = x2;
  3911. }
  3912. if (res.cmpn(0) < 0) {
  3913. res.iadd(p);
  3914. }
  3915. return res;
  3916. };
  3917. BN.prototype.gcd = function gcd (num) {
  3918. if (this.isZero()) return num.abs();
  3919. if (num.isZero()) return this.abs();
  3920. var a = this.clone();
  3921. var b = num.clone();
  3922. a.negative = 0;
  3923. b.negative = 0;
  3924. // Remove common factor of two
  3925. for (var shift = 0; a.isEven() && b.isEven(); shift++) {
  3926. a.iushrn(1);
  3927. b.iushrn(1);
  3928. }
  3929. do {
  3930. while (a.isEven()) {
  3931. a.iushrn(1);
  3932. }
  3933. while (b.isEven()) {
  3934. b.iushrn(1);
  3935. }
  3936. var r = a.cmp(b);
  3937. if (r < 0) {
  3938. // Swap `a` and `b` to make `a` always bigger than `b`
  3939. var t = a;
  3940. a = b;
  3941. b = t;
  3942. } else if (r === 0 || b.cmpn(1) === 0) {
  3943. break;
  3944. }
  3945. a.isub(b);
  3946. } while (true);
  3947. return b.iushln(shift);
  3948. };
  3949. // Invert number in the field F(num)
  3950. BN.prototype.invm = function invm (num) {
  3951. return this.egcd(num).a.umod(num);
  3952. };
  3953. BN.prototype.isEven = function isEven () {
  3954. return (this.words[0] & 1) === 0;
  3955. };
  3956. BN.prototype.isOdd = function isOdd () {
  3957. return (this.words[0] & 1) === 1;
  3958. };
  3959. // And first word and num
  3960. BN.prototype.andln = function andln (num) {
  3961. return this.words[0] & num;
  3962. };
  3963. // Increment at the bit position in-line
  3964. BN.prototype.bincn = function bincn (bit) {
  3965. assert(typeof bit === 'number');
  3966. var r = bit % 26;
  3967. var s = (bit - r) / 26;
  3968. var q = 1 << r;
  3969. // Fast case: bit is much higher than all existing words
  3970. if (this.length <= s) {
  3971. this._expand(s + 1);
  3972. this.words[s] |= q;
  3973. return this;
  3974. }
  3975. // Add bit and propagate, if needed
  3976. var carry = q;
  3977. for (var i = s; carry !== 0 && i < this.length; i++) {
  3978. var w = this.words[i] | 0;
  3979. w += carry;
  3980. carry = w >>> 26;
  3981. w &= 0x3ffffff;
  3982. this.words[i] = w;
  3983. }
  3984. if (carry !== 0) {
  3985. this.words[i] = carry;
  3986. this.length++;
  3987. }
  3988. return this;
  3989. };
  3990. BN.prototype.isZero = function isZero () {
  3991. return this.length === 1 && this.words[0] === 0;
  3992. };
  3993. BN.prototype.cmpn = function cmpn (num) {
  3994. var negative = num < 0;
  3995. if (this.negative !== 0 && !negative) return -1;
  3996. if (this.negative === 0 && negative) return 1;
  3997. this.strip();
  3998. var res;
  3999. if (this.length > 1) {
  4000. res = 1;
  4001. } else {
  4002. if (negative) {
  4003. num = -num;
  4004. }
  4005. assert(num <= 0x3ffffff, 'Number is too big');
  4006. var w = this.words[0] | 0;
  4007. res = w === num ? 0 : w < num ? -1 : 1;
  4008. }
  4009. if (this.negative !== 0) return -res | 0;
  4010. return res;
  4011. };
  4012. // Compare two numbers and return:
  4013. // 1 - if `this` > `num`
  4014. // 0 - if `this` == `num`
  4015. // -1 - if `this` < `num`
  4016. BN.prototype.cmp = function cmp (num) {
  4017. if (this.negative !== 0 && num.negative === 0) return -1;
  4018. if (this.negative === 0 && num.negative !== 0) return 1;
  4019. var res = this.ucmp(num);
  4020. if (this.negative !== 0) return -res | 0;
  4021. return res;
  4022. };
  4023. // Unsigned comparison
  4024. BN.prototype.ucmp = function ucmp (num) {
  4025. // At this point both numbers have the same sign
  4026. if (this.length > num.length) return 1;
  4027. if (this.length < num.length) return -1;
  4028. var res = 0;
  4029. for (var i = this.length - 1; i >= 0; i--) {
  4030. var a = this.words[i] | 0;
  4031. var b = num.words[i] | 0;
  4032. if (a === b) continue;
  4033. if (a < b) {
  4034. res = -1;
  4035. } else if (a > b) {
  4036. res = 1;
  4037. }
  4038. break;
  4039. }
  4040. return res;
  4041. };
  4042. BN.prototype.gtn = function gtn (num) {
  4043. return this.cmpn(num) === 1;
  4044. };
  4045. BN.prototype.gt = function gt (num) {
  4046. return this.cmp(num) === 1;
  4047. };
  4048. BN.prototype.gten = function gten (num) {
  4049. return this.cmpn(num) >= 0;
  4050. };
  4051. BN.prototype.gte = function gte (num) {
  4052. return this.cmp(num) >= 0;
  4053. };
  4054. BN.prototype.ltn = function ltn (num) {
  4055. return this.cmpn(num) === -1;
  4056. };
  4057. BN.prototype.lt = function lt (num) {
  4058. return this.cmp(num) === -1;
  4059. };
  4060. BN.prototype.lten = function lten (num) {
  4061. return this.cmpn(num) <= 0;
  4062. };
  4063. BN.prototype.lte = function lte (num) {
  4064. return this.cmp(num) <= 0;
  4065. };
  4066. BN.prototype.eqn = function eqn (num) {
  4067. return this.cmpn(num) === 0;
  4068. };
  4069. BN.prototype.eq = function eq (num) {
  4070. return this.cmp(num) === 0;
  4071. };
  4072. //
  4073. // A reduce context, could be using montgomery or something better, depending
  4074. // on the `m` itself.
  4075. //
  4076. BN.red = function red (num) {
  4077. return new Red(num);
  4078. };
  4079. BN.prototype.toRed = function toRed (ctx) {
  4080. assert(!this.red, 'Already a number in reduction context');
  4081. assert(this.negative === 0, 'red works only with positives');
  4082. return ctx.convertTo(this)._forceRed(ctx);
  4083. };
  4084. BN.prototype.fromRed = function fromRed () {
  4085. assert(this.red, 'fromRed works only with numbers in reduction context');
  4086. return this.red.convertFrom(this);
  4087. };
  4088. BN.prototype._forceRed = function _forceRed (ctx) {
  4089. this.red = ctx;
  4090. return this;
  4091. };
  4092. BN.prototype.forceRed = function forceRed (ctx) {
  4093. assert(!this.red, 'Already a number in reduction context');
  4094. return this._forceRed(ctx);
  4095. };
  4096. BN.prototype.redAdd = function redAdd (num) {
  4097. assert(this.red, 'redAdd works only with red numbers');
  4098. return this.red.add(this, num);
  4099. };
  4100. BN.prototype.redIAdd = function redIAdd (num) {
  4101. assert(this.red, 'redIAdd works only with red numbers');
  4102. return this.red.iadd(this, num);
  4103. };
  4104. BN.prototype.redSub = function redSub (num) {
  4105. assert(this.red, 'redSub works only with red numbers');
  4106. return this.red.sub(this, num);
  4107. };
  4108. BN.prototype.redISub = function redISub (num) {
  4109. assert(this.red, 'redISub works only with red numbers');
  4110. return this.red.isub(this, num);
  4111. };
  4112. BN.prototype.redShl = function redShl (num) {
  4113. assert(this.red, 'redShl works only with red numbers');
  4114. return this.red.shl(this, num);
  4115. };
  4116. BN.prototype.redMul = function redMul (num) {
  4117. assert(this.red, 'redMul works only with red numbers');
  4118. this.red._verify2(this, num);
  4119. return this.red.mul(this, num);
  4120. };
  4121. BN.prototype.redIMul = function redIMul (num) {
  4122. assert(this.red, 'redMul works only with red numbers');
  4123. this.red._verify2(this, num);
  4124. return this.red.imul(this, num);
  4125. };
  4126. BN.prototype.redSqr = function redSqr () {
  4127. assert(this.red, 'redSqr works only with red numbers');
  4128. this.red._verify1(this);
  4129. return this.red.sqr(this);
  4130. };
  4131. BN.prototype.redISqr = function redISqr () {
  4132. assert(this.red, 'redISqr works only with red numbers');
  4133. this.red._verify1(this);
  4134. return this.red.isqr(this);
  4135. };
  4136. // Square root over p
  4137. BN.prototype.redSqrt = function redSqrt () {
  4138. assert(this.red, 'redSqrt works only with red numbers');
  4139. this.red._verify1(this);
  4140. return this.red.sqrt(this);
  4141. };
  4142. BN.prototype.redInvm = function redInvm () {
  4143. assert(this.red, 'redInvm works only with red numbers');
  4144. this.red._verify1(this);
  4145. return this.red.invm(this);
  4146. };
  4147. // Return negative clone of `this` % `red modulo`
  4148. BN.prototype.redNeg = function redNeg () {
  4149. assert(this.red, 'redNeg works only with red numbers');
  4150. this.red._verify1(this);
  4151. return this.red.neg(this);
  4152. };
  4153. BN.prototype.redPow = function redPow (num) {
  4154. assert(this.red && !num.red, 'redPow(normalNum)');
  4155. this.red._verify1(this);
  4156. return this.red.pow(this, num);
  4157. };
  4158. // Prime numbers with efficient reduction
  4159. var primes = {
  4160. k256: null,
  4161. p224: null,
  4162. p192: null,
  4163. p25519: null
  4164. };
  4165. // Pseudo-Mersenne prime
  4166. function MPrime (name, p) {
  4167. // P = 2 ^ N - K
  4168. this.name = name;
  4169. this.p = new BN(p, 16);
  4170. this.n = this.p.bitLength();
  4171. this.k = new BN(1).iushln(this.n).isub(this.p);
  4172. this.tmp = this._tmp();
  4173. }
  4174. MPrime.prototype._tmp = function _tmp () {
  4175. var tmp = new BN(null);
  4176. tmp.words = new Array(Math.ceil(this.n / 13));
  4177. return tmp;
  4178. };
  4179. MPrime.prototype.ireduce = function ireduce (num) {
  4180. // Assumes that `num` is less than `P^2`
  4181. // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)
  4182. var r = num;
  4183. var rlen;
  4184. do {
  4185. this.split(r, this.tmp);
  4186. r = this.imulK(r);
  4187. r = r.iadd(this.tmp);
  4188. rlen = r.bitLength();
  4189. } while (rlen > this.n);
  4190. var cmp = rlen < this.n ? -1 : r.ucmp(this.p);
  4191. if (cmp === 0) {
  4192. r.words[0] = 0;
  4193. r.length = 1;
  4194. } else if (cmp > 0) {
  4195. r.isub(this.p);
  4196. } else {
  4197. r.strip();
  4198. }
  4199. return r;
  4200. };
  4201. MPrime.prototype.split = function split (input, out) {
  4202. input.iushrn(this.n, 0, out);
  4203. };
  4204. MPrime.prototype.imulK = function imulK (num) {
  4205. return num.imul(this.k);
  4206. };
  4207. function K256 () {
  4208. MPrime.call(
  4209. this,
  4210. 'k256',
  4211. 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');
  4212. }
  4213. inherits(K256, MPrime);
  4214. K256.prototype.split = function split (input, output) {
  4215. // 256 = 9 * 26 + 22
  4216. var mask = 0x3fffff;
  4217. var outLen = Math.min(input.length, 9);
  4218. for (var i = 0; i < outLen; i++) {
  4219. output.words[i] = input.words[i];
  4220. }
  4221. output.length = outLen;
  4222. if (input.length <= 9) {
  4223. input.words[0] = 0;
  4224. input.length = 1;
  4225. return;
  4226. }
  4227. // Shift by 9 limbs
  4228. var prev = input.words[9];
  4229. output.words[output.length++] = prev & mask;
  4230. for (i = 10; i < input.length; i++) {
  4231. var next = input.words[i] | 0;
  4232. input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22);
  4233. prev = next;
  4234. }
  4235. prev >>>= 22;
  4236. input.words[i - 10] = prev;
  4237. if (prev === 0 && input.length > 10) {
  4238. input.length -= 10;
  4239. } else {
  4240. input.length -= 9;
  4241. }
  4242. };
  4243. K256.prototype.imulK = function imulK (num) {
  4244. // K = 0x1000003d1 = [ 0x40, 0x3d1 ]
  4245. num.words[num.length] = 0;
  4246. num.words[num.length + 1] = 0;
  4247. num.length += 2;
  4248. // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390
  4249. var lo = 0;
  4250. for (var i = 0; i < num.length; i++) {
  4251. var w = num.words[i] | 0;
  4252. lo += w * 0x3d1;
  4253. num.words[i] = lo & 0x3ffffff;
  4254. lo = w * 0x40 + ((lo / 0x4000000) | 0);
  4255. }
  4256. // Fast length reduction
  4257. if (num.words[num.length - 1] === 0) {
  4258. num.length--;
  4259. if (num.words[num.length - 1] === 0) {
  4260. num.length--;
  4261. }
  4262. }
  4263. return num;
  4264. };
  4265. function P224 () {
  4266. MPrime.call(
  4267. this,
  4268. 'p224',
  4269. 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');
  4270. }
  4271. inherits(P224, MPrime);
  4272. function P192 () {
  4273. MPrime.call(
  4274. this,
  4275. 'p192',
  4276. 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');
  4277. }
  4278. inherits(P192, MPrime);
  4279. function P25519 () {
  4280. // 2 ^ 255 - 19
  4281. MPrime.call(
  4282. this,
  4283. '25519',
  4284. '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');
  4285. }
  4286. inherits(P25519, MPrime);
  4287. P25519.prototype.imulK = function imulK (num) {
  4288. // K = 0x13
  4289. var carry = 0;
  4290. for (var i = 0; i < num.length; i++) {
  4291. var hi = (num.words[i] | 0) * 0x13 + carry;
  4292. var lo = hi & 0x3ffffff;
  4293. hi >>>= 26;
  4294. num.words[i] = lo;
  4295. carry = hi;
  4296. }
  4297. if (carry !== 0) {
  4298. num.words[num.length++] = carry;
  4299. }
  4300. return num;
  4301. };
  4302. // Exported mostly for testing purposes, use plain name instead
  4303. BN._prime = function prime (name) {
  4304. // Cached version of prime
  4305. if (primes[name]) return primes[name];
  4306. var prime;
  4307. if (name === 'k256') {
  4308. prime = new K256();
  4309. } else if (name === 'p224') {
  4310. prime = new P224();
  4311. } else if (name === 'p192') {
  4312. prime = new P192();
  4313. } else if (name === 'p25519') {
  4314. prime = new P25519();
  4315. } else {
  4316. throw new Error('Unknown prime ' + name);
  4317. }
  4318. primes[name] = prime;
  4319. return prime;
  4320. };
  4321. //
  4322. // Base reduction engine
  4323. //
  4324. function Red (m) {
  4325. if (typeof m === 'string') {
  4326. var prime = BN._prime(m);
  4327. this.m = prime.p;
  4328. this.prime = prime;
  4329. } else {
  4330. assert(m.gtn(1), 'modulus must be greater than 1');
  4331. this.m = m;
  4332. this.prime = null;
  4333. }
  4334. }
  4335. Red.prototype._verify1 = function _verify1 (a) {
  4336. assert(a.negative === 0, 'red works only with positives');
  4337. assert(a.red, 'red works only with red numbers');
  4338. };
  4339. Red.prototype._verify2 = function _verify2 (a, b) {
  4340. assert((a.negative | b.negative) === 0, 'red works only with positives');
  4341. assert(a.red && a.red === b.red,
  4342. 'red works only with red numbers');
  4343. };
  4344. Red.prototype.imod = function imod (a) {
  4345. if (this.prime) return this.prime.ireduce(a)._forceRed(this);
  4346. return a.umod(this.m)._forceRed(this);
  4347. };
  4348. Red.prototype.neg = function neg (a) {
  4349. if (a.isZero()) {
  4350. return a.clone();
  4351. }
  4352. return this.m.sub(a)._forceRed(this);
  4353. };
  4354. Red.prototype.add = function add (a, b) {
  4355. this._verify2(a, b);
  4356. var res = a.add(b);
  4357. if (res.cmp(this.m) >= 0) {
  4358. res.isub(this.m);
  4359. }
  4360. return res._forceRed(this);
  4361. };
  4362. Red.prototype.iadd = function iadd (a, b) {
  4363. this._verify2(a, b);
  4364. var res = a.iadd(b);
  4365. if (res.cmp(this.m) >= 0) {
  4366. res.isub(this.m);
  4367. }
  4368. return res;
  4369. };
  4370. Red.prototype.sub = function sub (a, b) {
  4371. this._verify2(a, b);
  4372. var res = a.sub(b);
  4373. if (res.cmpn(0) < 0) {
  4374. res.iadd(this.m);
  4375. }
  4376. return res._forceRed(this);
  4377. };
  4378. Red.prototype.isub = function isub (a, b) {
  4379. this._verify2(a, b);
  4380. var res = a.isub(b);
  4381. if (res.cmpn(0) < 0) {
  4382. res.iadd(this.m);
  4383. }
  4384. return res;
  4385. };
  4386. Red.prototype.shl = function shl (a, num) {
  4387. this._verify1(a);
  4388. return this.imod(a.ushln(num));
  4389. };
  4390. Red.prototype.imul = function imul (a, b) {
  4391. this._verify2(a, b);
  4392. return this.imod(a.imul(b));
  4393. };
  4394. Red.prototype.mul = function mul (a, b) {
  4395. this._verify2(a, b);
  4396. return this.imod(a.mul(b));
  4397. };
  4398. Red.prototype.isqr = function isqr (a) {
  4399. return this.imul(a, a.clone());
  4400. };
  4401. Red.prototype.sqr = function sqr (a) {
  4402. return this.mul(a, a);
  4403. };
  4404. Red.prototype.sqrt = function sqrt (a) {
  4405. if (a.isZero()) return a.clone();
  4406. var mod3 = this.m.andln(3);
  4407. assert(mod3 % 2 === 1);
  4408. // Fast case
  4409. if (mod3 === 3) {
  4410. var pow = this.m.add(new BN(1)).iushrn(2);
  4411. return this.pow(a, pow);
  4412. }
  4413. // Tonelli-Shanks algorithm (Totally unoptimized and slow)
  4414. //
  4415. // Find Q and S, that Q * 2 ^ S = (P - 1)
  4416. var q = this.m.subn(1);
  4417. var s = 0;
  4418. while (!q.isZero() && q.andln(1) === 0) {
  4419. s++;
  4420. q.iushrn(1);
  4421. }
  4422. assert(!q.isZero());
  4423. var one = new BN(1).toRed(this);
  4424. var nOne = one.redNeg();
  4425. // Find quadratic non-residue
  4426. // NOTE: Max is such because of generalized Riemann hypothesis.
  4427. var lpow = this.m.subn(1).iushrn(1);
  4428. var z = this.m.bitLength();
  4429. z = new BN(2 * z * z).toRed(this);
  4430. while (this.pow(z, lpow).cmp(nOne) !== 0) {
  4431. z.redIAdd(nOne);
  4432. }
  4433. var c = this.pow(z, q);
  4434. var r = this.pow(a, q.addn(1).iushrn(1));
  4435. var t = this.pow(a, q);
  4436. var m = s;
  4437. while (t.cmp(one) !== 0) {
  4438. var tmp = t;
  4439. for (var i = 0; tmp.cmp(one) !== 0; i++) {
  4440. tmp = tmp.redSqr();
  4441. }
  4442. assert(i < m);
  4443. var b = this.pow(c, new BN(1).iushln(m - i - 1));
  4444. r = r.redMul(b);
  4445. c = b.redSqr();
  4446. t = t.redMul(c);
  4447. m = i;
  4448. }
  4449. return r;
  4450. };
  4451. Red.prototype.invm = function invm (a) {
  4452. var inv = a._invmp(this.m);
  4453. if (inv.negative !== 0) {
  4454. inv.negative = 0;
  4455. return this.imod(inv).redNeg();
  4456. } else {
  4457. return this.imod(inv);
  4458. }
  4459. };
  4460. Red.prototype.pow = function pow (a, num) {
  4461. if (num.isZero()) return new BN(1);
  4462. if (num.cmpn(1) === 0) return a.clone();
  4463. var windowSize = 4;
  4464. var wnd = new Array(1 << windowSize);
  4465. wnd[0] = new BN(1).toRed(this);
  4466. wnd[1] = a;
  4467. for (var i = 2; i < wnd.length; i++) {
  4468. wnd[i] = this.mul(wnd[i - 1], a);
  4469. }
  4470. var res = wnd[0];
  4471. var current = 0;
  4472. var currentLen = 0;
  4473. var start = num.bitLength() % 26;
  4474. if (start === 0) {
  4475. start = 26;
  4476. }
  4477. for (i = num.length - 1; i >= 0; i--) {
  4478. var word = num.words[i];
  4479. for (var j = start - 1; j >= 0; j--) {
  4480. var bit = (word >> j) & 1;
  4481. if (res !== wnd[0]) {
  4482. res = this.sqr(res);
  4483. }
  4484. if (bit === 0 && current === 0) {
  4485. currentLen = 0;
  4486. continue;
  4487. }
  4488. current <<= 1;
  4489. current |= bit;
  4490. currentLen++;
  4491. if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;
  4492. res = this.mul(res, wnd[current]);
  4493. currentLen = 0;
  4494. current = 0;
  4495. }
  4496. start = 26;
  4497. }
  4498. return res;
  4499. };
  4500. Red.prototype.convertTo = function convertTo (num) {
  4501. var r = num.umod(this.m);
  4502. return r === num ? r.clone() : r;
  4503. };
  4504. Red.prototype.convertFrom = function convertFrom (num) {
  4505. var res = num.clone();
  4506. res.red = null;
  4507. return res;
  4508. };
  4509. //
  4510. // Montgomery method engine
  4511. //
  4512. BN.mont = function mont (num) {
  4513. return new Mont(num);
  4514. };
  4515. function Mont (m) {
  4516. Red.call(this, m);
  4517. this.shift = this.m.bitLength();
  4518. if (this.shift % 26 !== 0) {
  4519. this.shift += 26 - (this.shift % 26);
  4520. }
  4521. this.r = new BN(1).iushln(this.shift);
  4522. this.r2 = this.imod(this.r.sqr());
  4523. this.rinv = this.r._invmp(this.m);
  4524. this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);
  4525. this.minv = this.minv.umod(this.r);
  4526. this.minv = this.r.sub(this.minv);
  4527. }
  4528. inherits(Mont, Red);
  4529. Mont.prototype.convertTo = function convertTo (num) {
  4530. return this.imod(num.ushln(this.shift));
  4531. };
  4532. Mont.prototype.convertFrom = function convertFrom (num) {
  4533. var r = this.imod(num.mul(this.rinv));
  4534. r.red = null;
  4535. return r;
  4536. };
  4537. Mont.prototype.imul = function imul (a, b) {
  4538. if (a.isZero() || b.isZero()) {
  4539. a.words[0] = 0;
  4540. a.length = 1;
  4541. return a;
  4542. }
  4543. var t = a.imul(b);
  4544. var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);
  4545. var u = t.isub(c).iushrn(this.shift);
  4546. var res = u;
  4547. if (u.cmp(this.m) >= 0) {
  4548. res = u.isub(this.m);
  4549. } else if (u.cmpn(0) < 0) {
  4550. res = u.iadd(this.m);
  4551. }
  4552. return res._forceRed(this);
  4553. };
  4554. Mont.prototype.mul = function mul (a, b) {
  4555. if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);
  4556. var t = a.mul(b);
  4557. var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);
  4558. var u = t.isub(c).iushrn(this.shift);
  4559. var res = u;
  4560. if (u.cmp(this.m) >= 0) {
  4561. res = u.isub(this.m);
  4562. } else if (u.cmpn(0) < 0) {
  4563. res = u.iadd(this.m);
  4564. }
  4565. return res._forceRed(this);
  4566. };
  4567. Mont.prototype.invm = function invm (a) {
  4568. // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R
  4569. var res = this.imod(a._invmp(this.m).mul(this.r2));
  4570. return res._forceRed(this);
  4571. };
  4572. })(typeof module === 'undefined' || module, this);
  4573. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(310)(module)))
  4574. /***/ },
  4575. /* 3 */
  4576. /***/ function(module, exports, __webpack_require__) {
  4577. "use strict";
  4578. 'use strict';
  4579. var elliptic = exports;
  4580. elliptic.version = __webpack_require__(256).version;
  4581. elliptic.utils = __webpack_require__(245);
  4582. elliptic.rand = __webpack_require__(81);
  4583. elliptic.hmacDRBG = __webpack_require__(243);
  4584. elliptic.curve = __webpack_require__(43);
  4585. elliptic.curves = __webpack_require__(236);
  4586. // Protocols
  4587. elliptic.ec = __webpack_require__(237);
  4588. elliptic.eddsa = __webpack_require__(240);
  4589. /***/ },
  4590. /* 4 */
  4591. /***/ function(module, exports, __webpack_require__) {
  4592. "use strict";
  4593. 'use strict';
  4594. var bind = __webpack_require__(77);
  4595. /*global toString:true*/
  4596. // utils is a library of generic helper functions non-specific to axios
  4597. var toString = Object.prototype.toString;
  4598. /**
  4599. * Determine if a value is an Array
  4600. *
  4601. * @param {Object} val The value to test
  4602. * @returns {boolean} True if value is an Array, otherwise false
  4603. */
  4604. function isArray(val) {
  4605. return toString.call(val) === '[object Array]';
  4606. }
  4607. /**
  4608. * Determine if a value is an ArrayBuffer
  4609. *
  4610. * @param {Object} val The value to test
  4611. * @returns {boolean} True if value is an ArrayBuffer, otherwise false
  4612. */
  4613. function isArrayBuffer(val) {
  4614. return toString.call(val) === '[object ArrayBuffer]';
  4615. }
  4616. /**
  4617. * Determine if a value is a FormData
  4618. *
  4619. * @param {Object} val The value to test
  4620. * @returns {boolean} True if value is an FormData, otherwise false
  4621. */
  4622. function isFormData(val) {
  4623. return (typeof FormData !== 'undefined') && (val instanceof FormData);
  4624. }
  4625. /**
  4626. * Determine if a value is a view on an ArrayBuffer
  4627. *
  4628. * @param {Object} val The value to test
  4629. * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false
  4630. */
  4631. function isArrayBufferView(val) {
  4632. var result;
  4633. if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {
  4634. result = ArrayBuffer.isView(val);
  4635. } else {
  4636. result = (val) && (val.buffer) && (val.buffer instanceof ArrayBuffer);
  4637. }
  4638. return result;
  4639. }
  4640. /**
  4641. * Determine if a value is a String
  4642. *
  4643. * @param {Object} val The value to test
  4644. * @returns {boolean} True if value is a String, otherwise false
  4645. */
  4646. function isString(val) {
  4647. return typeof val === 'string';
  4648. }
  4649. /**
  4650. * Determine if a value is a Number
  4651. *
  4652. * @param {Object} val The value to test
  4653. * @returns {boolean} True if value is a Number, otherwise false
  4654. */
  4655. function isNumber(val) {
  4656. return typeof val === 'number';
  4657. }
  4658. /**
  4659. * Determine if a value is undefined
  4660. *
  4661. * @param {Object} val The value to test
  4662. * @returns {boolean} True if the value is undefined, otherwise false
  4663. */
  4664. function isUndefined(val) {
  4665. return typeof val === 'undefined';
  4666. }
  4667. /**
  4668. * Determine if a value is an Object
  4669. *
  4670. * @param {Object} val The value to test
  4671. * @returns {boolean} True if value is an Object, otherwise false
  4672. */
  4673. function isObject(val) {
  4674. return val !== null && typeof val === 'object';
  4675. }
  4676. /**
  4677. * Determine if a value is a Date
  4678. *
  4679. * @param {Object} val The value to test
  4680. * @returns {boolean} True if value is a Date, otherwise false
  4681. */
  4682. function isDate(val) {
  4683. return toString.call(val) === '[object Date]';
  4684. }
  4685. /**
  4686. * Determine if a value is a File
  4687. *
  4688. * @param {Object} val The value to test
  4689. * @returns {boolean} True if value is a File, otherwise false
  4690. */
  4691. function isFile(val) {
  4692. return toString.call(val) === '[object File]';
  4693. }
  4694. /**
  4695. * Determine if a value is a Blob
  4696. *
  4697. * @param {Object} val The value to test
  4698. * @returns {boolean} True if value is a Blob, otherwise false
  4699. */
  4700. function isBlob(val) {
  4701. return toString.call(val) === '[object Blob]';
  4702. }
  4703. /**
  4704. * Determine if a value is a Function
  4705. *
  4706. * @param {Object} val The value to test
  4707. * @returns {boolean} True if value is a Function, otherwise false
  4708. */
  4709. function isFunction(val) {
  4710. return toString.call(val) === '[object Function]';
  4711. }
  4712. /**
  4713. * Determine if a value is a Stream
  4714. *
  4715. * @param {Object} val The value to test
  4716. * @returns {boolean} True if value is a Stream, otherwise false
  4717. */
  4718. function isStream(val) {
  4719. return isObject(val) && isFunction(val.pipe);
  4720. }
  4721. /**
  4722. * Determine if a value is a URLSearchParams object
  4723. *
  4724. * @param {Object} val The value to test
  4725. * @returns {boolean} True if value is a URLSearchParams object, otherwise false
  4726. */
  4727. function isURLSearchParams(val) {
  4728. return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams;
  4729. }
  4730. /**
  4731. * Trim excess whitespace off the beginning and end of a string
  4732. *
  4733. * @param {String} str The String to trim
  4734. * @returns {String} The String freed of excess whitespace
  4735. */
  4736. function trim(str) {
  4737. return str.replace(/^\s*/, '').replace(/\s*$/, '');
  4738. }
  4739. /**
  4740. * Determine if we're running in a standard browser environment
  4741. *
  4742. * This allows axios to run in a web worker, and react-native.
  4743. * Both environments support XMLHttpRequest, but not fully standard globals.
  4744. *
  4745. * web workers:
  4746. * typeof window -> undefined
  4747. * typeof document -> undefined
  4748. *
  4749. * react-native:
  4750. * typeof document.createElement -> undefined
  4751. */
  4752. function isStandardBrowserEnv() {
  4753. return (
  4754. typeof window !== 'undefined' &&
  4755. typeof document !== 'undefined' &&
  4756. typeof document.createElement === 'function'
  4757. );
  4758. }
  4759. /**
  4760. * Iterate over an Array or an Object invoking a function for each item.
  4761. *
  4762. * If `obj` is an Array callback will be called passing
  4763. * the value, index, and complete array for each item.
  4764. *
  4765. * If 'obj' is an Object callback will be called passing
  4766. * the value, key, and complete object for each property.
  4767. *
  4768. * @param {Object|Array} obj The object to iterate
  4769. * @param {Function} fn The callback to invoke for each item
  4770. */
  4771. function forEach(obj, fn) {
  4772. // Don't bother if no value provided
  4773. if (obj === null || typeof obj === 'undefined') {
  4774. return;
  4775. }
  4776. // Force an array if not already something iterable
  4777. if (typeof obj !== 'object' && !isArray(obj)) {
  4778. /*eslint no-param-reassign:0*/
  4779. obj = [obj];
  4780. }
  4781. if (isArray(obj)) {
  4782. // Iterate over array values
  4783. for (var i = 0, l = obj.length; i < l; i++) {
  4784. fn.call(null, obj[i], i, obj);
  4785. }
  4786. } else {
  4787. // Iterate over object keys
  4788. for (var key in obj) {
  4789. if (Object.prototype.hasOwnProperty.call(obj, key)) {
  4790. fn.call(null, obj[key], key, obj);
  4791. }
  4792. }
  4793. }
  4794. }
  4795. /**
  4796. * Accepts varargs expecting each argument to be an object, then
  4797. * immutably merges the properties of each object and returns result.
  4798. *
  4799. * When multiple objects contain the same key the later object in
  4800. * the arguments list will take precedence.
  4801. *
  4802. * Example:
  4803. *
  4804. * ```js
  4805. * var result = merge({foo: 123}, {foo: 456});
  4806. * console.log(result.foo); // outputs 456
  4807. * ```
  4808. *
  4809. * @param {Object} obj1 Object to merge
  4810. * @returns {Object} Result of all merge properties
  4811. */
  4812. function merge(/* obj1, obj2, obj3, ... */) {
  4813. var result = {};
  4814. function assignValue(val, key) {
  4815. if (typeof result[key] === 'object' && typeof val === 'object') {
  4816. result[key] = merge(result[key], val);
  4817. } else {
  4818. result[key] = val;
  4819. }
  4820. }
  4821. for (var i = 0, l = arguments.length; i < l; i++) {
  4822. forEach(arguments[i], assignValue);
  4823. }
  4824. return result;
  4825. }
  4826. /**
  4827. * Extends object a by mutably adding to it the properties of object b.
  4828. *
  4829. * @param {Object} a The object to be extended
  4830. * @param {Object} b The object to copy properties from
  4831. * @param {Object} thisArg The object to bind function to
  4832. * @return {Object} The resulting value of object a
  4833. */
  4834. function extend(a, b, thisArg) {
  4835. forEach(b, function assignValue(val, key) {
  4836. if (thisArg && typeof val === 'function') {
  4837. a[key] = bind(val, thisArg);
  4838. } else {
  4839. a[key] = val;
  4840. }
  4841. });
  4842. return a;
  4843. }
  4844. module.exports = {
  4845. isArray: isArray,
  4846. isArrayBuffer: isArrayBuffer,
  4847. isFormData: isFormData,
  4848. isArrayBufferView: isArrayBufferView,
  4849. isString: isString,
  4850. isNumber: isNumber,
  4851. isObject: isObject,
  4852. isUndefined: isUndefined,
  4853. isDate: isDate,
  4854. isFile: isFile,
  4855. isBlob: isBlob,
  4856. isFunction: isFunction,
  4857. isStream: isStream,
  4858. isURLSearchParams: isURLSearchParams,
  4859. isStandardBrowserEnv: isStandardBrowserEnv,
  4860. forEach: forEach,
  4861. merge: merge,
  4862. extend: extend,
  4863. trim: trim
  4864. };
  4865. /***/ },
  4866. /* 5 */
  4867. /***/ function(module, exports, __webpack_require__) {
  4868. var store = __webpack_require__(99)('wks')
  4869. , uid = __webpack_require__(103)
  4870. , Symbol = __webpack_require__(6).Symbol
  4871. , USE_SYMBOL = typeof Symbol == 'function';
  4872. var $exports = module.exports = function(name){
  4873. return store[name] || (store[name] =
  4874. USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
  4875. };
  4876. $exports.store = store;
  4877. /***/ },
  4878. /* 6 */
  4879. /***/ function(module, exports) {
  4880. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  4881. var global = module.exports = typeof window != 'undefined' && window.Math == Math
  4882. ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
  4883. if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef
  4884. /***/ },
  4885. /* 7 */
  4886. /***/ function(module, exports) {
  4887. // shim for using process in browser
  4888. var process = module.exports = {};
  4889. // cached from whatever global is present so that test runners that stub it
  4890. // don't break things. But we need to wrap it in a try catch in case it is
  4891. // wrapped in strict mode code which doesn't define any globals. It's inside a
  4892. // function because try/catches deoptimize in certain engines.
  4893. var cachedSetTimeout;
  4894. var cachedClearTimeout;
  4895. function defaultSetTimout() {
  4896. throw new Error('setTimeout has not been defined');
  4897. }
  4898. function defaultClearTimeout () {
  4899. throw new Error('clearTimeout has not been defined');
  4900. }
  4901. (function () {
  4902. try {
  4903. if (typeof setTimeout === 'function') {
  4904. cachedSetTimeout = setTimeout;
  4905. } else {
  4906. cachedSetTimeout = defaultSetTimout;
  4907. }
  4908. } catch (e) {
  4909. cachedSetTimeout = defaultSetTimout;
  4910. }
  4911. try {
  4912. if (typeof clearTimeout === 'function') {
  4913. cachedClearTimeout = clearTimeout;
  4914. } else {
  4915. cachedClearTimeout = defaultClearTimeout;
  4916. }
  4917. } catch (e) {
  4918. cachedClearTimeout = defaultClearTimeout;
  4919. }
  4920. } ())
  4921. function runTimeout(fun) {
  4922. if (cachedSetTimeout === setTimeout) {
  4923. //normal enviroments in sane situations
  4924. return setTimeout(fun, 0);
  4925. }
  4926. // if setTimeout wasn't available but was latter defined
  4927. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  4928. cachedSetTimeout = setTimeout;
  4929. return setTimeout(fun, 0);
  4930. }
  4931. try {
  4932. // when when somebody has screwed with setTimeout but no I.E. maddness
  4933. return cachedSetTimeout(fun, 0);
  4934. } catch(e){
  4935. try {
  4936. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  4937. return cachedSetTimeout.call(null, fun, 0);
  4938. } catch(e){
  4939. // 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
  4940. return cachedSetTimeout.call(this, fun, 0);
  4941. }
  4942. }
  4943. }
  4944. function runClearTimeout(marker) {
  4945. if (cachedClearTimeout === clearTimeout) {
  4946. //normal enviroments in sane situations
  4947. return clearTimeout(marker);
  4948. }
  4949. // if clearTimeout wasn't available but was latter defined
  4950. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  4951. cachedClearTimeout = clearTimeout;
  4952. return clearTimeout(marker);
  4953. }
  4954. try {
  4955. // when when somebody has screwed with setTimeout but no I.E. maddness
  4956. return cachedClearTimeout(marker);
  4957. } catch (e){
  4958. try {
  4959. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  4960. return cachedClearTimeout.call(null, marker);
  4961. } catch (e){
  4962. // 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.
  4963. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  4964. return cachedClearTimeout.call(this, marker);
  4965. }
  4966. }
  4967. }
  4968. var queue = [];
  4969. var draining = false;
  4970. var currentQueue;
  4971. var queueIndex = -1;
  4972. function cleanUpNextTick() {
  4973. if (!draining || !currentQueue) {
  4974. return;
  4975. }
  4976. draining = false;
  4977. if (currentQueue.length) {
  4978. queue = currentQueue.concat(queue);
  4979. } else {
  4980. queueIndex = -1;
  4981. }
  4982. if (queue.length) {
  4983. drainQueue();
  4984. }
  4985. }
  4986. function drainQueue() {
  4987. if (draining) {
  4988. return;
  4989. }
  4990. var timeout = runTimeout(cleanUpNextTick);
  4991. draining = true;
  4992. var len = queue.length;
  4993. while(len) {
  4994. currentQueue = queue;
  4995. queue = [];
  4996. while (++queueIndex < len) {
  4997. if (currentQueue) {
  4998. currentQueue[queueIndex].run();
  4999. }
  5000. }
  5001. queueIndex = -1;
  5002. len = queue.length;
  5003. }
  5004. currentQueue = null;
  5005. draining = false;
  5006. runClearTimeout(timeout);
  5007. }
  5008. process.nextTick = function (fun) {
  5009. var args = new Array(arguments.length - 1);
  5010. if (arguments.length > 1) {
  5011. for (var i = 1; i < arguments.length; i++) {
  5012. args[i - 1] = arguments[i];
  5013. }
  5014. }
  5015. queue.push(new Item(fun, args));
  5016. if (queue.length === 1 && !draining) {
  5017. runTimeout(drainQueue);
  5018. }
  5019. };
  5020. // v8 likes predictible objects
  5021. function Item(fun, array) {
  5022. this.fun = fun;
  5023. this.array = array;
  5024. }
  5025. Item.prototype.run = function () {
  5026. this.fun.apply(null, this.array);
  5027. };
  5028. process.title = 'browser';
  5029. process.browser = true;
  5030. process.env = {};
  5031. process.argv = [];
  5032. process.version = ''; // empty string to avoid regexp issues
  5033. process.versions = {};
  5034. function noop() {}
  5035. process.on = noop;
  5036. process.addListener = noop;
  5037. process.once = noop;
  5038. process.off = noop;
  5039. process.removeListener = noop;
  5040. process.removeAllListeners = noop;
  5041. process.emit = noop;
  5042. process.binding = function (name) {
  5043. throw new Error('process.binding is not supported');
  5044. };
  5045. process.cwd = function () { return '/' };
  5046. process.chdir = function (dir) {
  5047. throw new Error('process.chdir is not supported');
  5048. };
  5049. process.umask = function() { return 0; };
  5050. /***/ },
  5051. /* 8 */
  5052. /***/ function(module, exports) {
  5053. var core = module.exports = {version: '2.4.0'};
  5054. if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
  5055. /***/ },
  5056. /* 9 */
  5057. /***/ function(module, exports, __webpack_require__) {
  5058. var hash = exports;
  5059. hash.utils = __webpack_require__(252);
  5060. hash.common = __webpack_require__(248);
  5061. hash.sha = __webpack_require__(251);
  5062. hash.ripemd = __webpack_require__(250);
  5063. hash.hmac = __webpack_require__(249);
  5064. // Proxy hash functions to the main object
  5065. hash.sha1 = hash.sha.sha1;
  5066. hash.sha256 = hash.sha.sha256;
  5067. hash.sha224 = hash.sha.sha224;
  5068. hash.sha384 = hash.sha.sha384;
  5069. hash.sha512 = hash.sha.sha512;
  5070. hash.ripemd160 = hash.ripemd.ripemd160;
  5071. /***/ },
  5072. /* 10 */
  5073. /***/ function(module, exports, __webpack_require__) {
  5074. "use strict";
  5075. // a duplex stream is just a stream that is both readable and writable.
  5076. // Since JS doesn't have multiple prototypal inheritance, this class
  5077. // prototypally inherits from Readable, and then parasitically from
  5078. // Writable.
  5079. 'use strict';
  5080. /*<replacement>*/
  5081. var objectKeys = Object.keys || function (obj) {
  5082. var keys = [];
  5083. for (var key in obj) {
  5084. keys.push(key);
  5085. }return keys;
  5086. };
  5087. /*</replacement>*/
  5088. module.exports = Duplex;
  5089. /*<replacement>*/
  5090. var processNextTick = __webpack_require__(62);
  5091. /*</replacement>*/
  5092. /*<replacement>*/
  5093. var util = __webpack_require__(29);
  5094. util.inherits = __webpack_require__(1);
  5095. /*</replacement>*/
  5096. var Readable = __webpack_require__(115);
  5097. var Writable = __webpack_require__(64);
  5098. util.inherits(Duplex, Readable);
  5099. var keys = objectKeys(Writable.prototype);
  5100. for (var v = 0; v < keys.length; v++) {
  5101. var method = keys[v];
  5102. if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
  5103. }
  5104. function Duplex(options) {
  5105. if (!(this instanceof Duplex)) return new Duplex(options);
  5106. Readable.call(this, options);
  5107. Writable.call(this, options);
  5108. if (options && options.readable === false) this.readable = false;
  5109. if (options && options.writable === false) this.writable = false;
  5110. this.allowHalfOpen = true;
  5111. if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;
  5112. this.once('end', onend);
  5113. }
  5114. // the no-half-open enforcer
  5115. function onend() {
  5116. // if we allow half-open state, or if the writable side ended,
  5117. // then we're ok.
  5118. if (this.allowHalfOpen || this._writableState.ended) return;
  5119. // no more data can be written.
  5120. // But allow more writes to happen in this tick.
  5121. processNextTick(onEndNT, this);
  5122. }
  5123. function onEndNT(self) {
  5124. self.end();
  5125. }
  5126. function forEach(xs, f) {
  5127. for (var i = 0, l = xs.length; i < l; i++) {
  5128. f(xs[i], i);
  5129. }
  5130. }
  5131. /***/ },
  5132. /* 11 */
  5133. /***/ function(module, exports, __webpack_require__) {
  5134. /**
  5135. * vuex v2.0.0
  5136. * (c) 2016 Evan You
  5137. * @license MIT
  5138. */
  5139. (function (global, factory) {
  5140. true ? module.exports = factory() :
  5141. typeof define === 'function' && define.amd ? define(factory) :
  5142. (global.Vuex = factory());
  5143. }(this, (function () { 'use strict';
  5144. var devtoolHook =
  5145. typeof window !== 'undefined' &&
  5146. window.__VUE_DEVTOOLS_GLOBAL_HOOK__
  5147. function devtoolPlugin (store) {
  5148. if (!devtoolHook) { return }
  5149. store._devtoolHook = devtoolHook
  5150. devtoolHook.emit('vuex:init', store)
  5151. devtoolHook.on('vuex:travel-to-state', function (targetState) {
  5152. store.replaceState(targetState)
  5153. })
  5154. store.subscribe(function (mutation, state) {
  5155. devtoolHook.emit('vuex:mutation', mutation, state)
  5156. })
  5157. }
  5158. function applyMixin (Vue) {
  5159. var version = Number(Vue.version.split('.')[0])
  5160. if (version >= 2) {
  5161. var usesInit = Vue.config._lifecycleHooks.indexOf('init') > -1
  5162. Vue.mixin(usesInit ? { init: vuexInit } : { beforeCreate: vuexInit })
  5163. } else {
  5164. // override init and inject vuex init procedure
  5165. // for 1.x backwards compatibility.
  5166. var _init = Vue.prototype._init
  5167. Vue.prototype._init = function (options) {
  5168. if ( options === void 0 ) options = {};
  5169. options.init = options.init
  5170. ? [vuexInit].concat(options.init)
  5171. : vuexInit
  5172. _init.call(this, options)
  5173. }
  5174. }
  5175. /**
  5176. * Vuex init hook, injected into each instances init hooks list.
  5177. */
  5178. function vuexInit () {
  5179. var options = this.$options
  5180. // store injection
  5181. if (options.store) {
  5182. this.$store = options.store
  5183. } else if (options.parent && options.parent.$store) {
  5184. this.$store = options.parent.$store
  5185. }
  5186. }
  5187. }
  5188. function mapState (states) {
  5189. var res = {}
  5190. normalizeMap(states).forEach(function (ref) {
  5191. var key = ref.key;
  5192. var val = ref.val;
  5193. res[key] = function mappedState () {
  5194. return typeof val === 'function'
  5195. ? val.call(this, this.$store.state, this.$store.getters)
  5196. : this.$store.state[val]
  5197. }
  5198. })
  5199. return res
  5200. }
  5201. function mapMutations (mutations) {
  5202. var res = {}
  5203. normalizeMap(mutations).forEach(function (ref) {
  5204. var key = ref.key;
  5205. var val = ref.val;
  5206. res[key] = function mappedMutation () {
  5207. var args = [], len = arguments.length;
  5208. while ( len-- ) args[ len ] = arguments[ len ];
  5209. return this.$store.commit.apply(this.$store, [val].concat(args))
  5210. }
  5211. })
  5212. return res
  5213. }
  5214. function mapGetters (getters) {
  5215. var res = {}
  5216. normalizeMap(getters).forEach(function (ref) {
  5217. var key = ref.key;
  5218. var val = ref.val;
  5219. res[key] = function mappedGetter () {
  5220. if (!(val in this.$store.getters)) {
  5221. console.error(("[vuex] unknown getter: " + val))
  5222. }
  5223. return this.$store.getters[val]
  5224. }
  5225. })
  5226. return res
  5227. }
  5228. function mapActions (actions) {
  5229. var res = {}
  5230. normalizeMap(actions).forEach(function (ref) {
  5231. var key = ref.key;
  5232. var val = ref.val;
  5233. res[key] = function mappedAction () {
  5234. var args = [], len = arguments.length;
  5235. while ( len-- ) args[ len ] = arguments[ len ];
  5236. return this.$store.dispatch.apply(this.$store, [val].concat(args))
  5237. }
  5238. })
  5239. return res
  5240. }
  5241. function normalizeMap (map) {
  5242. return Array.isArray(map)
  5243. ? map.map(function (key) { return ({ key: key, val: key }); })
  5244. : Object.keys(map).map(function (key) { return ({ key: key, val: map[key] }); })
  5245. }
  5246. function isObject (obj) {
  5247. return obj !== null && typeof obj === 'object'
  5248. }
  5249. function isPromise (val) {
  5250. return val && typeof val.then === 'function'
  5251. }
  5252. function assert (condition, msg) {
  5253. if (!condition) { throw new Error(("[vuex] " + msg)) }
  5254. }
  5255. var Vue // bind on install
  5256. var Store = function Store (options) {
  5257. var this$1 = this;
  5258. if ( options === void 0 ) options = {};
  5259. assert(Vue, "must call Vue.use(Vuex) before creating a store instance.")
  5260. assert(typeof Promise !== 'undefined', "vuex requires a Promise polyfill in this browser.")
  5261. var state = options.state; if ( state === void 0 ) state = {};
  5262. var plugins = options.plugins; if ( plugins === void 0 ) plugins = [];
  5263. var strict = options.strict; if ( strict === void 0 ) strict = false;
  5264. // store internal state
  5265. this._options = options
  5266. this._committing = false
  5267. this._actions = Object.create(null)
  5268. this._mutations = Object.create(null)
  5269. this._wrappedGetters = Object.create(null)
  5270. this._runtimeModules = Object.create(null)
  5271. this._subscribers = []
  5272. this._watcherVM = new Vue()
  5273. // bind commit and dispatch to self
  5274. var store = this
  5275. var ref = this;
  5276. var dispatch = ref.dispatch;
  5277. var commit = ref.commit;
  5278. this.dispatch = function boundDispatch (type, payload) {
  5279. return dispatch.call(store, type, payload)
  5280. }
  5281. this.commit = function boundCommit (type, payload, options) {
  5282. return commit.call(store, type, payload, options)
  5283. }
  5284. // strict mode
  5285. this.strict = strict
  5286. // init root module.
  5287. // this also recursively registers all sub-modules
  5288. // and collects all module getters inside this._wrappedGetters
  5289. installModule(this, state, [], options)
  5290. // initialize the store vm, which is responsible for the reactivity
  5291. // (also registers _wrappedGetters as computed properties)
  5292. resetStoreVM(this, state)
  5293. // apply plugins
  5294. plugins.concat(devtoolPlugin).forEach(function (plugin) { return plugin(this$1); })
  5295. };
  5296. var prototypeAccessors = { state: {} };
  5297. prototypeAccessors.state.get = function () {
  5298. return this._vm.state
  5299. };
  5300. prototypeAccessors.state.set = function (v) {
  5301. assert(false, "Use store.replaceState() to explicit replace store state.")
  5302. };
  5303. Store.prototype.commit = function commit (type, payload, options) {
  5304. var this$1 = this;
  5305. // check object-style commit
  5306. if (isObject(type) && type.type) {
  5307. options = payload
  5308. payload = type
  5309. type = type.type
  5310. }
  5311. var mutation = { type: type, payload: payload }
  5312. var entry = this._mutations[type]
  5313. if (!entry) {
  5314. console.error(("[vuex] unknown mutation type: " + type))
  5315. return
  5316. }
  5317. this._withCommit(function () {
  5318. entry.forEach(function commitIterator (handler) {
  5319. handler(payload)
  5320. })
  5321. })
  5322. if (!options || !options.silent) {
  5323. this._subscribers.forEach(function (sub) { return sub(mutation, this$1.state); })
  5324. }
  5325. };
  5326. Store.prototype.dispatch = function dispatch (type, payload) {
  5327. // check object-style dispatch
  5328. if (isObject(type) && type.type) {
  5329. payload = type
  5330. type = type.type
  5331. }
  5332. var entry = this._actions[type]
  5333. if (!entry) {
  5334. console.error(("[vuex] unknown action type: " + type))
  5335. return
  5336. }
  5337. return entry.length > 1
  5338. ? Promise.all(entry.map(function (handler) { return handler(payload); }))
  5339. : entry[0](payload)
  5340. };
  5341. Store.prototype.subscribe = function subscribe (fn) {
  5342. var subs = this._subscribers
  5343. if (subs.indexOf(fn) < 0) {
  5344. subs.push(fn)
  5345. }
  5346. return function () {
  5347. var i = subs.indexOf(fn)
  5348. if (i > -1) {
  5349. subs.splice(i, 1)
  5350. }
  5351. }
  5352. };
  5353. Store.prototype.watch = function watch (getter, cb, options) {
  5354. var this$1 = this;
  5355. assert(typeof getter === 'function', "store.watch only accepts a function.")
  5356. return this._watcherVM.$watch(function () { return getter(this$1.state); }, cb, options)
  5357. };
  5358. Store.prototype.replaceState = function replaceState (state) {
  5359. var this$1 = this;
  5360. this._withCommit(function () {
  5361. this$1._vm.state = state
  5362. })
  5363. };
  5364. Store.prototype.registerModule = function registerModule (path, module) {
  5365. if (typeof path === 'string') { path = [path] }
  5366. assert(Array.isArray(path), "module path must be a string or an Array.")
  5367. this._runtimeModules[path.join('.')] = module
  5368. installModule(this, this.state, path, module)
  5369. // reset store to update getters...
  5370. resetStoreVM(this, this.state)
  5371. };
  5372. Store.prototype.unregisterModule = function unregisterModule (path) {
  5373. var this$1 = this;
  5374. if (typeof path === 'string') { path = [path] }
  5375. assert(Array.isArray(path), "module path must be a string or an Array.")
  5376. delete this._runtimeModules[path.join('.')]
  5377. this._withCommit(function () {
  5378. var parentState = getNestedState(this$1.state, path.slice(0, -1))
  5379. Vue.delete(parentState, path[path.length - 1])
  5380. })
  5381. resetStore(this)
  5382. };
  5383. Store.prototype.hotUpdate = function hotUpdate (newOptions) {
  5384. updateModule(this._options, newOptions)
  5385. resetStore(this)
  5386. };
  5387. Store.prototype._withCommit = function _withCommit (fn) {
  5388. var committing = this._committing
  5389. this._committing = true
  5390. fn()
  5391. this._committing = committing
  5392. };
  5393. Object.defineProperties( Store.prototype, prototypeAccessors );
  5394. function updateModule (targetModule, newModule) {
  5395. if (newModule.actions) {
  5396. targetModule.actions = newModule.actions
  5397. }
  5398. if (newModule.mutations) {
  5399. targetModule.mutations = newModule.mutations
  5400. }
  5401. if (newModule.getters) {
  5402. targetModule.getters = newModule.getters
  5403. }
  5404. if (newModule.modules) {
  5405. for (var key in newModule.modules) {
  5406. if (!(targetModule.modules && targetModule.modules[key])) {
  5407. console.warn(
  5408. "[vuex] trying to add a new module '" + key + "' on hot reloading, " +
  5409. 'manual reload is needed'
  5410. )
  5411. return
  5412. }
  5413. updateModule(targetModule.modules[key], newModule.modules[key])
  5414. }
  5415. }
  5416. }
  5417. function resetStore (store) {
  5418. store._actions = Object.create(null)
  5419. store._mutations = Object.create(null)
  5420. store._wrappedGetters = Object.create(null)
  5421. var state = store.state
  5422. // init root module
  5423. installModule(store, state, [], store._options, true)
  5424. // init all runtime modules
  5425. Object.keys(store._runtimeModules).forEach(function (key) {
  5426. installModule(store, state, key.split('.'), store._runtimeModules[key], true)
  5427. })
  5428. // reset vm
  5429. resetStoreVM(store, state)
  5430. }
  5431. function resetStoreVM (store, state) {
  5432. var oldVm = store._vm
  5433. // bind store public getters
  5434. store.getters = {}
  5435. var wrappedGetters = store._wrappedGetters
  5436. var computed = {}
  5437. Object.keys(wrappedGetters).forEach(function (key) {
  5438. var fn = wrappedGetters[key]
  5439. // use computed to leverage its lazy-caching mechanism
  5440. computed[key] = function () { return fn(store); }
  5441. Object.defineProperty(store.getters, key, {
  5442. get: function () { return store._vm[key]; }
  5443. })
  5444. })
  5445. // use a Vue instance to store the state tree
  5446. // suppress warnings just in case the user has added
  5447. // some funky global mixins
  5448. var silent = Vue.config.silent
  5449. Vue.config.silent = true
  5450. store._vm = new Vue({
  5451. data: { state: state },
  5452. computed: computed
  5453. })
  5454. Vue.config.silent = silent
  5455. // enable strict mode for new vm
  5456. if (store.strict) {
  5457. enableStrictMode(store)
  5458. }
  5459. if (oldVm) {
  5460. // dispatch changes in all subscribed watchers
  5461. // to force getter re-evaluation.
  5462. store._withCommit(function () {
  5463. oldVm.state = null
  5464. })
  5465. Vue.nextTick(function () { return oldVm.$destroy(); })
  5466. }
  5467. }
  5468. function installModule (store, rootState, path, module, hot) {
  5469. var isRoot = !path.length
  5470. var state = module.state;
  5471. var actions = module.actions;
  5472. var mutations = module.mutations;
  5473. var getters = module.getters;
  5474. var modules = module.modules;
  5475. // set state
  5476. if (!isRoot && !hot) {
  5477. var parentState = getNestedState(rootState, path.slice(0, -1))
  5478. var moduleName = path[path.length - 1]
  5479. store._withCommit(function () {
  5480. Vue.set(parentState, moduleName, state || {})
  5481. })
  5482. }
  5483. if (mutations) {
  5484. Object.keys(mutations).forEach(function (key) {
  5485. registerMutation(store, key, mutations[key], path)
  5486. })
  5487. }
  5488. if (actions) {
  5489. Object.keys(actions).forEach(function (key) {
  5490. registerAction(store, key, actions[key], path)
  5491. })
  5492. }
  5493. if (getters) {
  5494. wrapGetters(store, getters, path)
  5495. }
  5496. if (modules) {
  5497. Object.keys(modules).forEach(function (key) {
  5498. installModule(store, rootState, path.concat(key), modules[key], hot)
  5499. })
  5500. }
  5501. }
  5502. function registerMutation (store, type, handler, path) {
  5503. if ( path === void 0 ) path = [];
  5504. var entry = store._mutations[type] || (store._mutations[type] = [])
  5505. entry.push(function wrappedMutationHandler (payload) {
  5506. handler(getNestedState(store.state, path), payload)
  5507. })
  5508. }
  5509. function registerAction (store, type, handler, path) {
  5510. if ( path === void 0 ) path = [];
  5511. var entry = store._actions[type] || (store._actions[type] = [])
  5512. var dispatch = store.dispatch;
  5513. var commit = store.commit;
  5514. entry.push(function wrappedActionHandler (payload, cb) {
  5515. var res = handler({
  5516. dispatch: dispatch,
  5517. commit: commit,
  5518. getters: store.getters,
  5519. state: getNestedState(store.state, path),
  5520. rootState: store.state
  5521. }, payload, cb)
  5522. if (!isPromise(res)) {
  5523. res = Promise.resolve(res)
  5524. }
  5525. if (store._devtoolHook) {
  5526. return res.catch(function (err) {
  5527. store._devtoolHook.emit('vuex:error', err)
  5528. throw err
  5529. })
  5530. } else {
  5531. return res
  5532. }
  5533. })
  5534. }
  5535. function wrapGetters (store, moduleGetters, modulePath) {
  5536. Object.keys(moduleGetters).forEach(function (getterKey) {
  5537. var rawGetter = moduleGetters[getterKey]
  5538. if (store._wrappedGetters[getterKey]) {
  5539. console.error(("[vuex] duplicate getter key: " + getterKey))
  5540. return
  5541. }
  5542. store._wrappedGetters[getterKey] = function wrappedGetter (store) {
  5543. return rawGetter(
  5544. getNestedState(store.state, modulePath), // local state
  5545. store.getters, // getters
  5546. store.state // root state
  5547. )
  5548. }
  5549. })
  5550. }
  5551. function enableStrictMode (store) {
  5552. store._vm.$watch('state', function () {
  5553. assert(store._committing, "Do not mutate vuex store state outside mutation handlers.")
  5554. }, { deep: true, sync: true })
  5555. }
  5556. function getNestedState (state, path) {
  5557. return path.length
  5558. ? path.reduce(function (state, key) { return state[key]; }, state)
  5559. : state
  5560. }
  5561. function install (_Vue) {
  5562. if (Vue) {
  5563. console.error(
  5564. '[vuex] already installed. Vue.use(Vuex) should be called only once.'
  5565. )
  5566. return
  5567. }
  5568. Vue = _Vue
  5569. applyMixin(Vue)
  5570. }
  5571. // auto install in dist mode
  5572. if (typeof window !== 'undefined' && window.Vue) {
  5573. install(window.Vue)
  5574. }
  5575. var index = {
  5576. Store: Store,
  5577. install: install,
  5578. mapState: mapState,
  5579. mapMutations: mapMutations,
  5580. mapGetters: mapGetters,
  5581. mapActions: mapActions
  5582. }
  5583. return index;
  5584. })));
  5585. /***/ },
  5586. /* 12 */
  5587. /***/ function(module, exports, __webpack_require__) {
  5588. /* WEBPACK VAR INJECTION */(function(Buffer) {var Transform = __webpack_require__(19).Transform
  5589. var inherits = __webpack_require__(1)
  5590. var StringDecoder = __webpack_require__(65).StringDecoder
  5591. module.exports = CipherBase
  5592. inherits(CipherBase, Transform)
  5593. function CipherBase (hashMode) {
  5594. Transform.call(this)
  5595. this.hashMode = typeof hashMode === 'string'
  5596. if (this.hashMode) {
  5597. this[hashMode] = this._finalOrDigest
  5598. } else {
  5599. this.final = this._finalOrDigest
  5600. }
  5601. this._decoder = null
  5602. this._encoding = null
  5603. }
  5604. CipherBase.prototype.update = function (data, inputEnc, outputEnc) {
  5605. if (typeof data === 'string') {
  5606. data = new Buffer(data, inputEnc)
  5607. }
  5608. var outData = this._update(data)
  5609. if (this.hashMode) {
  5610. return this
  5611. }
  5612. if (outputEnc) {
  5613. outData = this._toString(outData, outputEnc)
  5614. }
  5615. return outData
  5616. }
  5617. CipherBase.prototype.setAutoPadding = function () {}
  5618. CipherBase.prototype.getAuthTag = function () {
  5619. throw new Error('trying to get auth tag in unsupported state')
  5620. }
  5621. CipherBase.prototype.setAuthTag = function () {
  5622. throw new Error('trying to set auth tag in unsupported state')
  5623. }
  5624. CipherBase.prototype.setAAD = function () {
  5625. throw new Error('trying to set aad in unsupported state')
  5626. }
  5627. CipherBase.prototype._transform = function (data, _, next) {
  5628. var err
  5629. try {
  5630. if (this.hashMode) {
  5631. this._update(data)
  5632. } else {
  5633. this.push(this._update(data))
  5634. }
  5635. } catch (e) {
  5636. err = e
  5637. } finally {
  5638. next(err)
  5639. }
  5640. }
  5641. CipherBase.prototype._flush = function (done) {
  5642. var err
  5643. try {
  5644. this.push(this._final())
  5645. } catch (e) {
  5646. err = e
  5647. } finally {
  5648. done(err)
  5649. }
  5650. }
  5651. CipherBase.prototype._finalOrDigest = function (outputEnc) {
  5652. var outData = this._final() || new Buffer('')
  5653. if (outputEnc) {
  5654. outData = this._toString(outData, outputEnc, true)
  5655. }
  5656. return outData
  5657. }
  5658. CipherBase.prototype._toString = function (value, enc, fin) {
  5659. if (!this._decoder) {
  5660. this._decoder = new StringDecoder(enc)
  5661. this._encoding = enc
  5662. }
  5663. if (this._encoding !== enc) {
  5664. throw new Error('can\'t switch encodings')
  5665. }
  5666. var out = this._decoder.write(value)
  5667. if (fin) {
  5668. out += this._decoder.end()
  5669. }
  5670. return out
  5671. }
  5672. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  5673. /***/ },
  5674. /* 13 */
  5675. /***/ function(module, exports, __webpack_require__) {
  5676. var isObject = __webpack_require__(42);
  5677. module.exports = function(it){
  5678. if(!isObject(it))throw TypeError(it + ' is not an object!');
  5679. return it;
  5680. };
  5681. /***/ },
  5682. /* 14 */
  5683. /***/ function(module, exports, __webpack_require__) {
  5684. // Thank's IE8 for his funny defineProperty
  5685. module.exports = !__webpack_require__(55)(function(){
  5686. return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;
  5687. });
  5688. /***/ },
  5689. /* 15 */
  5690. /***/ function(module, exports, __webpack_require__) {
  5691. var dP = __webpack_require__(28)
  5692. , createDesc = __webpack_require__(98);
  5693. module.exports = __webpack_require__(14) ? function(object, key, value){
  5694. return dP.f(object, key, createDesc(1, value));
  5695. } : function(object, key, value){
  5696. object[key] = value;
  5697. return object;
  5698. };
  5699. /***/ },
  5700. /* 16 */
  5701. /***/ function(module, exports, __webpack_require__) {
  5702. "use strict";
  5703. /* WEBPACK VAR INJECTION */(function(Buffer) {'use strict';
  5704. var inherits = __webpack_require__(1)
  5705. var md5 = __webpack_require__(104)
  5706. var rmd160 = __webpack_require__(274)
  5707. var sha = __webpack_require__(276)
  5708. var Base = __webpack_require__(12)
  5709. function HashNoConstructor(hash) {
  5710. Base.call(this, 'digest')
  5711. this._hash = hash
  5712. this.buffers = []
  5713. }
  5714. inherits(HashNoConstructor, Base)
  5715. HashNoConstructor.prototype._update = function (data) {
  5716. this.buffers.push(data)
  5717. }
  5718. HashNoConstructor.prototype._final = function () {
  5719. var buf = Buffer.concat(this.buffers)
  5720. var r = this._hash(buf)
  5721. this.buffers = null
  5722. return r
  5723. }
  5724. function Hash(hash) {
  5725. Base.call(this, 'digest')
  5726. this._hash = hash
  5727. }
  5728. inherits(Hash, Base)
  5729. Hash.prototype._update = function (data) {
  5730. this._hash.update(data)
  5731. }
  5732. Hash.prototype._final = function () {
  5733. return this._hash.digest()
  5734. }
  5735. module.exports = function createHash (alg) {
  5736. alg = alg.toLowerCase()
  5737. if ('md5' === alg) return new HashNoConstructor(md5)
  5738. if ('rmd160' === alg || 'ripemd160' === alg) return new HashNoConstructor(rmd160)
  5739. return new Hash(sha(alg))
  5740. }
  5741. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  5742. /***/ },
  5743. /* 17 */
  5744. /***/ function(module, exports) {
  5745. /*
  5746. MIT License http://www.opensource.org/licenses/mit-license.php
  5747. Author Tobias Koppers @sokra
  5748. */
  5749. // css base code, injected by the css-loader
  5750. module.exports = function() {
  5751. var list = [];
  5752. // return the list of modules as css string
  5753. list.toString = function toString() {
  5754. var result = [];
  5755. for(var i = 0; i < this.length; i++) {
  5756. var item = this[i];
  5757. if(item[2]) {
  5758. result.push("@media " + item[2] + "{" + item[1] + "}");
  5759. } else {
  5760. result.push(item[1]);
  5761. }
  5762. }
  5763. return result.join("");
  5764. };
  5765. // import a list of modules into the list
  5766. list.i = function(modules, mediaQuery) {
  5767. if(typeof modules === "string")
  5768. modules = [[null, modules, ""]];
  5769. var alreadyImportedModules = {};
  5770. for(var i = 0; i < this.length; i++) {
  5771. var id = this[i][0];
  5772. if(typeof id === "number")
  5773. alreadyImportedModules[id] = true;
  5774. }
  5775. for(i = 0; i < modules.length; i++) {
  5776. var item = modules[i];
  5777. // skip already imported module
  5778. // this implementation is not 100% perfect for weird media query combinations
  5779. // when a module is imported multiple times with different media queries.
  5780. // I hope this will never occur (Hey this way we have smaller bundles)
  5781. if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
  5782. if(mediaQuery && !item[2]) {
  5783. item[2] = mediaQuery;
  5784. } else if(mediaQuery) {
  5785. item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
  5786. }
  5787. list.push(item);
  5788. }
  5789. }
  5790. };
  5791. return list;
  5792. };
  5793. /***/ },
  5794. /* 18 */
  5795. /***/ function(module, exports, __webpack_require__) {
  5796. /* WEBPACK VAR INJECTION */(function(Buffer) {// prototype class for hash functions
  5797. function Hash (blockSize, finalSize) {
  5798. this._block = new Buffer(blockSize)
  5799. this._finalSize = finalSize
  5800. this._blockSize = blockSize
  5801. this._len = 0
  5802. this._s = 0
  5803. }
  5804. Hash.prototype.update = function (data, enc) {
  5805. if (typeof data === 'string') {
  5806. enc = enc || 'utf8'
  5807. data = new Buffer(data, enc)
  5808. }
  5809. var l = this._len += data.length
  5810. var s = this._s || 0
  5811. var f = 0
  5812. var buffer = this._block
  5813. while (s < l) {
  5814. var t = Math.min(data.length, f + this._blockSize - (s % this._blockSize))
  5815. var ch = (t - f)
  5816. for (var i = 0; i < ch; i++) {
  5817. buffer[(s % this._blockSize) + i] = data[i + f]
  5818. }
  5819. s += ch
  5820. f += ch
  5821. if ((s % this._blockSize) === 0) {
  5822. this._update(buffer)
  5823. }
  5824. }
  5825. this._s = s
  5826. return this
  5827. }
  5828. Hash.prototype.digest = function (enc) {
  5829. // Suppose the length of the message M, in bits, is l
  5830. var l = this._len * 8
  5831. // Append the bit 1 to the end of the message
  5832. this._block[this._len % this._blockSize] = 0x80
  5833. // and then k zero bits, where k is the smallest non-negative solution to the equation (l + 1 + k) === finalSize mod blockSize
  5834. this._block.fill(0, this._len % this._blockSize + 1)
  5835. if (l % (this._blockSize * 8) >= this._finalSize * 8) {
  5836. this._update(this._block)
  5837. this._block.fill(0)
  5838. }
  5839. // to this append the block which is equal to the number l written in binary
  5840. // TODO: handle case where l is > Math.pow(2, 29)
  5841. this._block.writeInt32BE(l, this._blockSize - 4)
  5842. var hash = this._update(this._block) || this._hash()
  5843. return enc ? hash.toString(enc) : hash
  5844. }
  5845. Hash.prototype._update = function () {
  5846. throw new Error('_update must be implemented by subclass')
  5847. }
  5848. module.exports = Hash
  5849. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  5850. /***/ },
  5851. /* 19 */
  5852. /***/ function(module, exports, __webpack_require__) {
  5853. // Copyright Joyent, Inc. and other Node contributors.
  5854. //
  5855. // Permission is hereby granted, free of charge, to any person obtaining a
  5856. // copy of this software and associated documentation files (the
  5857. // "Software"), to deal in the Software without restriction, including
  5858. // without limitation the rights to use, copy, modify, merge, publish,
  5859. // distribute, sublicense, and/or sell copies of the Software, and to permit
  5860. // persons to whom the Software is furnished to do so, subject to the
  5861. // following conditions:
  5862. //
  5863. // The above copyright notice and this permission notice shall be included
  5864. // in all copies or substantial portions of the Software.
  5865. //
  5866. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  5867. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  5868. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  5869. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  5870. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  5871. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  5872. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  5873. module.exports = Stream;
  5874. var EE = __webpack_require__(44).EventEmitter;
  5875. var inherits = __webpack_require__(1);
  5876. inherits(Stream, EE);
  5877. Stream.Readable = __webpack_require__(271);
  5878. Stream.Writable = __webpack_require__(273);
  5879. Stream.Duplex = __webpack_require__(268);
  5880. Stream.Transform = __webpack_require__(272);
  5881. Stream.PassThrough = __webpack_require__(270);
  5882. // Backwards-compat with node 0.4.x
  5883. Stream.Stream = Stream;
  5884. // old-style streams. Note that the pipe method (the only relevant
  5885. // part of this class) is overridden in the Readable class.
  5886. function Stream() {
  5887. EE.call(this);
  5888. }
  5889. Stream.prototype.pipe = function(dest, options) {
  5890. var source = this;
  5891. function ondata(chunk) {
  5892. if (dest.writable) {
  5893. if (false === dest.write(chunk) && source.pause) {
  5894. source.pause();
  5895. }
  5896. }
  5897. }
  5898. source.on('data', ondata);
  5899. function ondrain() {
  5900. if (source.readable && source.resume) {
  5901. source.resume();
  5902. }
  5903. }
  5904. dest.on('drain', ondrain);
  5905. // If the 'end' option is not supplied, dest.end() will be called when
  5906. // source gets the 'end' or 'close' events. Only dest.end() once.
  5907. if (!dest._isStdio && (!options || options.end !== false)) {
  5908. source.on('end', onend);
  5909. source.on('close', onclose);
  5910. }
  5911. var didOnEnd = false;
  5912. function onend() {
  5913. if (didOnEnd) return;
  5914. didOnEnd = true;
  5915. dest.end();
  5916. }
  5917. function onclose() {
  5918. if (didOnEnd) return;
  5919. didOnEnd = true;
  5920. if (typeof dest.destroy === 'function') dest.destroy();
  5921. }
  5922. // don't leave dangling pipes when there are errors.
  5923. function onerror(er) {
  5924. cleanup();
  5925. if (EE.listenerCount(this, 'error') === 0) {
  5926. throw er; // Unhandled stream error in pipe.
  5927. }
  5928. }
  5929. source.on('error', onerror);
  5930. dest.on('error', onerror);
  5931. // remove all the event listeners that were added.
  5932. function cleanup() {
  5933. source.removeListener('data', ondata);
  5934. dest.removeListener('drain', ondrain);
  5935. source.removeListener('end', onend);
  5936. source.removeListener('close', onclose);
  5937. source.removeListener('error', onerror);
  5938. dest.removeListener('error', onerror);
  5939. source.removeListener('end', cleanup);
  5940. source.removeListener('close', cleanup);
  5941. dest.removeListener('close', cleanup);
  5942. }
  5943. source.on('end', cleanup);
  5944. source.on('close', cleanup);
  5945. dest.on('close', cleanup);
  5946. dest.emit('pipe', source);
  5947. // Allow for unix-like usage: A.pipe(B).pipe(C)
  5948. return dest;
  5949. };
  5950. /***/ },
  5951. /* 20 */
  5952. /***/ function(module, exports) {
  5953. /*
  5954. MIT License http://www.opensource.org/licenses/mit-license.php
  5955. Author Tobias Koppers @sokra
  5956. */
  5957. var stylesInDom = {},
  5958. memoize = function(fn) {
  5959. var memo;
  5960. return function () {
  5961. if (typeof memo === "undefined") memo = fn.apply(this, arguments);
  5962. return memo;
  5963. };
  5964. },
  5965. isOldIE = memoize(function() {
  5966. return /msie [6-9]\b/.test(window.navigator.userAgent.toLowerCase());
  5967. }),
  5968. getHeadElement = memoize(function () {
  5969. return document.head || document.getElementsByTagName("head")[0];
  5970. }),
  5971. singletonElement = null,
  5972. singletonCounter = 0,
  5973. styleElementsInsertedAtTop = [];
  5974. module.exports = function(list, options) {
  5975. if(typeof DEBUG !== "undefined" && DEBUG) {
  5976. if(typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
  5977. }
  5978. options = options || {};
  5979. // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
  5980. // tags it will allow on a page
  5981. if (typeof options.singleton === "undefined") options.singleton = isOldIE();
  5982. // By default, add <style> tags to the bottom of <head>.
  5983. if (typeof options.insertAt === "undefined") options.insertAt = "bottom";
  5984. var styles = listToStyles(list);
  5985. addStylesToDom(styles, options);
  5986. return function update(newList) {
  5987. var mayRemove = [];
  5988. for(var i = 0; i < styles.length; i++) {
  5989. var item = styles[i];
  5990. var domStyle = stylesInDom[item.id];
  5991. domStyle.refs--;
  5992. mayRemove.push(domStyle);
  5993. }
  5994. if(newList) {
  5995. var newStyles = listToStyles(newList);
  5996. addStylesToDom(newStyles, options);
  5997. }
  5998. for(var i = 0; i < mayRemove.length; i++) {
  5999. var domStyle = mayRemove[i];
  6000. if(domStyle.refs === 0) {
  6001. for(var j = 0; j < domStyle.parts.length; j++)
  6002. domStyle.parts[j]();
  6003. delete stylesInDom[domStyle.id];
  6004. }
  6005. }
  6006. };
  6007. }
  6008. function addStylesToDom(styles, options) {
  6009. for(var i = 0; i < styles.length; i++) {
  6010. var item = styles[i];
  6011. var domStyle = stylesInDom[item.id];
  6012. if(domStyle) {
  6013. domStyle.refs++;
  6014. for(var j = 0; j < domStyle.parts.length; j++) {
  6015. domStyle.parts[j](item.parts[j]);
  6016. }
  6017. for(; j < item.parts.length; j++) {
  6018. domStyle.parts.push(addStyle(item.parts[j], options));
  6019. }
  6020. } else {
  6021. var parts = [];
  6022. for(var j = 0; j < item.parts.length; j++) {
  6023. parts.push(addStyle(item.parts[j], options));
  6024. }
  6025. stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
  6026. }
  6027. }
  6028. }
  6029. function listToStyles(list) {
  6030. var styles = [];
  6031. var newStyles = {};
  6032. for(var i = 0; i < list.length; i++) {
  6033. var item = list[i];
  6034. var id = item[0];
  6035. var css = item[1];
  6036. var media = item[2];
  6037. var sourceMap = item[3];
  6038. var part = {css: css, media: media, sourceMap: sourceMap};
  6039. if(!newStyles[id])
  6040. styles.push(newStyles[id] = {id: id, parts: [part]});
  6041. else
  6042. newStyles[id].parts.push(part);
  6043. }
  6044. return styles;
  6045. }
  6046. function insertStyleElement(options, styleElement) {
  6047. var head = getHeadElement();
  6048. var lastStyleElementInsertedAtTop = styleElementsInsertedAtTop[styleElementsInsertedAtTop.length - 1];
  6049. if (options.insertAt === "top") {
  6050. if(!lastStyleElementInsertedAtTop) {
  6051. head.insertBefore(styleElement, head.firstChild);
  6052. } else if(lastStyleElementInsertedAtTop.nextSibling) {
  6053. head.insertBefore(styleElement, lastStyleElementInsertedAtTop.nextSibling);
  6054. } else {
  6055. head.appendChild(styleElement);
  6056. }
  6057. styleElementsInsertedAtTop.push(styleElement);
  6058. } else if (options.insertAt === "bottom") {
  6059. head.appendChild(styleElement);
  6060. } else {
  6061. throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");
  6062. }
  6063. }
  6064. function removeStyleElement(styleElement) {
  6065. styleElement.parentNode.removeChild(styleElement);
  6066. var idx = styleElementsInsertedAtTop.indexOf(styleElement);
  6067. if(idx >= 0) {
  6068. styleElementsInsertedAtTop.splice(idx, 1);
  6069. }
  6070. }
  6071. function createStyleElement(options) {
  6072. var styleElement = document.createElement("style");
  6073. styleElement.type = "text/css";
  6074. insertStyleElement(options, styleElement);
  6075. return styleElement;
  6076. }
  6077. function addStyle(obj, options) {
  6078. var styleElement, update, remove;
  6079. if (options.singleton) {
  6080. var styleIndex = singletonCounter++;
  6081. styleElement = singletonElement || (singletonElement = createStyleElement(options));
  6082. update = applyToSingletonTag.bind(null, styleElement, styleIndex, false);
  6083. remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true);
  6084. } else {
  6085. styleElement = createStyleElement(options);
  6086. update = applyToTag.bind(null, styleElement);
  6087. remove = function() {
  6088. removeStyleElement(styleElement);
  6089. };
  6090. }
  6091. update(obj);
  6092. return function updateStyle(newObj) {
  6093. if(newObj) {
  6094. if(newObj.css === obj.css && newObj.media === obj.media && newObj.sourceMap === obj.sourceMap)
  6095. return;
  6096. update(obj = newObj);
  6097. } else {
  6098. remove();
  6099. }
  6100. };
  6101. }
  6102. var replaceText = (function () {
  6103. var textStore = [];
  6104. return function (index, replacement) {
  6105. textStore[index] = replacement;
  6106. return textStore.filter(Boolean).join('\n');
  6107. };
  6108. })();
  6109. function applyToSingletonTag(styleElement, index, remove, obj) {
  6110. var css = remove ? "" : obj.css;
  6111. if (styleElement.styleSheet) {
  6112. styleElement.styleSheet.cssText = replaceText(index, css);
  6113. } else {
  6114. var cssNode = document.createTextNode(css);
  6115. var childNodes = styleElement.childNodes;
  6116. if (childNodes[index]) styleElement.removeChild(childNodes[index]);
  6117. if (childNodes.length) {
  6118. styleElement.insertBefore(cssNode, childNodes[index]);
  6119. } else {
  6120. styleElement.appendChild(cssNode);
  6121. }
  6122. }
  6123. }
  6124. function applyToTag(styleElement, obj) {
  6125. var css = obj.css;
  6126. var media = obj.media;
  6127. var sourceMap = obj.sourceMap;
  6128. if (media) {
  6129. styleElement.setAttribute("media", media);
  6130. }
  6131. if (sourceMap) {
  6132. // https://developer.chrome.com/devtools/docs/javascript-debugging
  6133. // this makes source maps inside style tags work properly in Chrome
  6134. css += '\n/*# sourceURL=' + sourceMap.sources[0] + ' */';
  6135. // http://stackoverflow.com/a/26603875
  6136. css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
  6137. }
  6138. if (styleElement.styleSheet) {
  6139. styleElement.styleSheet.cssText = css;
  6140. } else {
  6141. while(styleElement.firstChild) {
  6142. styleElement.removeChild(styleElement.firstChild);
  6143. }
  6144. styleElement.appendChild(document.createTextNode(css));
  6145. }
  6146. }
  6147. /***/ },
  6148. /* 21 */
  6149. /***/ function(module, exports, __webpack_require__) {
  6150. var base = exports;
  6151. base.Reporter = __webpack_require__(126).Reporter;
  6152. base.DecoderBuffer = __webpack_require__(67).DecoderBuffer;
  6153. base.EncoderBuffer = __webpack_require__(67).EncoderBuffer;
  6154. base.Node = __webpack_require__(125);
  6155. /***/ },
  6156. /* 22 */
  6157. /***/ function(module, exports, __webpack_require__) {
  6158. "use strict";
  6159. 'use strict';
  6160. Object.defineProperty(exports, "__esModule", {
  6161. value: true
  6162. });
  6163. exports.TOKEN_KEY = exports.LOCAL_STORAGE_KEY = undefined;
  6164. var _defineProperty2 = __webpack_require__(163);
  6165. var _defineProperty3 = _interopRequireDefault(_defineProperty2);
  6166. var _stringify = __webpack_require__(162);
  6167. var _stringify2 = _interopRequireDefault(_stringify);
  6168. var _assign = __webpack_require__(48);
  6169. var _assign2 = _interopRequireDefault(_assign);
  6170. var _classCallCheck2 = __webpack_require__(23);
  6171. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  6172. var _createClass2 = __webpack_require__(24);
  6173. var _createClass3 = _interopRequireDefault(_createClass2);
  6174. var _token = __webpack_require__(159);
  6175. var _token2 = _interopRequireDefault(_token);
  6176. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6177. var LOCAL_STORAGE_KEY = exports.LOCAL_STORAGE_KEY = 'lesspass';
  6178. var TOKEN_KEY = exports.TOKEN_KEY = 'jwt';
  6179. var Storage = function () {
  6180. function Storage() {
  6181. var storage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.localStorage;
  6182. (0, _classCallCheck3.default)(this, Storage);
  6183. this.storage = storage;
  6184. }
  6185. (0, _createClass3.default)(Storage, [{
  6186. key: '_getLocalStorage',
  6187. value: function _getLocalStorage() {
  6188. return JSON.parse(this.storage.getItem(LOCAL_STORAGE_KEY) || '{}');
  6189. }
  6190. }, {
  6191. key: 'json',
  6192. value: function json() {
  6193. var defaultStorage = {
  6194. baseURL: 'https://lesspass.com',
  6195. timeout: 5000
  6196. };
  6197. var localStorage = this._getLocalStorage();
  6198. return (0, _assign2.default)(defaultStorage, localStorage);
  6199. }
  6200. }, {
  6201. key: 'save',
  6202. value: function save(data) {
  6203. var newData = (0, _assign2.default)(this._getLocalStorage(), data);
  6204. this.storage.setItem(LOCAL_STORAGE_KEY, (0, _stringify2.default)(newData));
  6205. }
  6206. }, {
  6207. key: 'clear',
  6208. value: function clear() {
  6209. this.storage.clear();
  6210. }
  6211. }, {
  6212. key: 'getToken',
  6213. value: function getToken() {
  6214. var storage = this.json();
  6215. if (TOKEN_KEY in storage) {
  6216. return new _token2.default(storage[TOKEN_KEY]);
  6217. }
  6218. return new _token2.default();
  6219. }
  6220. }, {
  6221. key: 'saveToken',
  6222. value: function saveToken(token) {
  6223. this.save((0, _defineProperty3.default)({}, TOKEN_KEY, token));
  6224. }
  6225. }]);
  6226. return Storage;
  6227. }();
  6228. exports.default = Storage;
  6229. /***/ },
  6230. /* 23 */
  6231. /***/ function(module, exports) {
  6232. "use strict";
  6233. "use strict";
  6234. exports.__esModule = true;
  6235. exports.default = function (instance, Constructor) {
  6236. if (!(instance instanceof Constructor)) {
  6237. throw new TypeError("Cannot call a class as a function");
  6238. }
  6239. };
  6240. /***/ },
  6241. /* 24 */
  6242. /***/ function(module, exports, __webpack_require__) {
  6243. "use strict";
  6244. "use strict";
  6245. exports.__esModule = true;
  6246. var _defineProperty = __webpack_require__(79);
  6247. var _defineProperty2 = _interopRequireDefault(_defineProperty);
  6248. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6249. exports.default = function () {
  6250. function defineProperties(target, props) {
  6251. for (var i = 0; i < props.length; i++) {
  6252. var descriptor = props[i];
  6253. descriptor.enumerable = descriptor.enumerable || false;
  6254. descriptor.configurable = true;
  6255. if ("value" in descriptor) descriptor.writable = true;
  6256. (0, _defineProperty2.default)(target, descriptor.key, descriptor);
  6257. }
  6258. }
  6259. return function (Constructor, protoProps, staticProps) {
  6260. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  6261. if (staticProps) defineProperties(Constructor, staticProps);
  6262. return Constructor;
  6263. };
  6264. }();
  6265. /***/ },
  6266. /* 25 */
  6267. /***/ function(module, exports, __webpack_require__) {
  6268. "use strict";
  6269. "use strict";
  6270. exports.__esModule = true;
  6271. var _assign = __webpack_require__(48);
  6272. var _assign2 = _interopRequireDefault(_assign);
  6273. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6274. exports.default = _assign2.default || function (target) {
  6275. for (var i = 1; i < arguments.length; i++) {
  6276. var source = arguments[i];
  6277. for (var key in source) {
  6278. if (Object.prototype.hasOwnProperty.call(source, key)) {
  6279. target[key] = source[key];
  6280. }
  6281. }
  6282. }
  6283. return target;
  6284. };
  6285. /***/ },
  6286. /* 26 */
  6287. /***/ function(module, exports, __webpack_require__) {
  6288. /* WEBPACK VAR INJECTION */(function(Buffer) {module.exports = function xor (a, b) {
  6289. var length = Math.min(a.length, b.length)
  6290. var buffer = new Buffer(length)
  6291. for (var i = 0; i < length; ++i) {
  6292. buffer[i] = a[i] ^ b[i]
  6293. }
  6294. return buffer
  6295. }
  6296. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  6297. /***/ },
  6298. /* 27 */
  6299. /***/ function(module, exports) {
  6300. module.exports = {};
  6301. /***/ },
  6302. /* 28 */
  6303. /***/ function(module, exports, __webpack_require__) {
  6304. var anObject = __webpack_require__(13)
  6305. , IE8_DOM_DEFINE = __webpack_require__(184)
  6306. , toPrimitive = __webpack_require__(205)
  6307. , dP = Object.defineProperty;
  6308. exports.f = __webpack_require__(14) ? Object.defineProperty : function defineProperty(O, P, Attributes){
  6309. anObject(O);
  6310. P = toPrimitive(P, true);
  6311. anObject(Attributes);
  6312. if(IE8_DOM_DEFINE)try {
  6313. return dP(O, P, Attributes);
  6314. } catch(e){ /* empty */ }
  6315. if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');
  6316. if('value' in Attributes)O[P] = Attributes.value;
  6317. return O;
  6318. };
  6319. /***/ },
  6320. /* 29 */
  6321. /***/ function(module, exports, __webpack_require__) {
  6322. /* WEBPACK VAR INJECTION */(function(Buffer) {// Copyright Joyent, Inc. and other Node contributors.
  6323. //
  6324. // Permission is hereby granted, free of charge, to any person obtaining a
  6325. // copy of this software and associated documentation files (the
  6326. // "Software"), to deal in the Software without restriction, including
  6327. // without limitation the rights to use, copy, modify, merge, publish,
  6328. // distribute, sublicense, and/or sell copies of the Software, and to permit
  6329. // persons to whom the Software is furnished to do so, subject to the
  6330. // following conditions:
  6331. //
  6332. // The above copyright notice and this permission notice shall be included
  6333. // in all copies or substantial portions of the Software.
  6334. //
  6335. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  6336. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  6337. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  6338. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  6339. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  6340. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  6341. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  6342. // NOTE: These type checking functions intentionally don't use `instanceof`
  6343. // because it is fragile and can be easily faked with `Object.create()`.
  6344. function isArray(arg) {
  6345. if (Array.isArray) {
  6346. return Array.isArray(arg);
  6347. }
  6348. return objectToString(arg) === '[object Array]';
  6349. }
  6350. exports.isArray = isArray;
  6351. function isBoolean(arg) {
  6352. return typeof arg === 'boolean';
  6353. }
  6354. exports.isBoolean = isBoolean;
  6355. function isNull(arg) {
  6356. return arg === null;
  6357. }
  6358. exports.isNull = isNull;
  6359. function isNullOrUndefined(arg) {
  6360. return arg == null;
  6361. }
  6362. exports.isNullOrUndefined = isNullOrUndefined;
  6363. function isNumber(arg) {
  6364. return typeof arg === 'number';
  6365. }
  6366. exports.isNumber = isNumber;
  6367. function isString(arg) {
  6368. return typeof arg === 'string';
  6369. }
  6370. exports.isString = isString;
  6371. function isSymbol(arg) {
  6372. return typeof arg === 'symbol';
  6373. }
  6374. exports.isSymbol = isSymbol;
  6375. function isUndefined(arg) {
  6376. return arg === void 0;
  6377. }
  6378. exports.isUndefined = isUndefined;
  6379. function isRegExp(re) {
  6380. return objectToString(re) === '[object RegExp]';
  6381. }
  6382. exports.isRegExp = isRegExp;
  6383. function isObject(arg) {
  6384. return typeof arg === 'object' && arg !== null;
  6385. }
  6386. exports.isObject = isObject;
  6387. function isDate(d) {
  6388. return objectToString(d) === '[object Date]';
  6389. }
  6390. exports.isDate = isDate;
  6391. function isError(e) {
  6392. return (objectToString(e) === '[object Error]' || e instanceof Error);
  6393. }
  6394. exports.isError = isError;
  6395. function isFunction(arg) {
  6396. return typeof arg === 'function';
  6397. }
  6398. exports.isFunction = isFunction;
  6399. function isPrimitive(arg) {
  6400. return arg === null ||
  6401. typeof arg === 'boolean' ||
  6402. typeof arg === 'number' ||
  6403. typeof arg === 'string' ||
  6404. typeof arg === 'symbol' || // ES6 symbol
  6405. typeof arg === 'undefined';
  6406. }
  6407. exports.isPrimitive = isPrimitive;
  6408. exports.isBuffer = Buffer.isBuffer;
  6409. function objectToString(o) {
  6410. return Object.prototype.toString.call(o);
  6411. }
  6412. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  6413. /***/ },
  6414. /* 30 */
  6415. /***/ function(module, exports) {
  6416. module.exports = assert;
  6417. function assert(val, msg) {
  6418. if (!val)
  6419. throw new Error(msg || 'Assertion failed');
  6420. }
  6421. assert.equal = function assertEqual(l, r, msg) {
  6422. if (l != r)
  6423. throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r));
  6424. };
  6425. /***/ },
  6426. /* 31 */
  6427. /***/ function(module, exports, __webpack_require__) {
  6428. "use strict";
  6429. /* WEBPACK VAR INJECTION */(function(global, Buffer, process) {'use strict'
  6430. function oldBrowser () {
  6431. throw new Error('secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11')
  6432. }
  6433. var crypto = global.crypto || global.msCrypto
  6434. if (crypto && crypto.getRandomValues) {
  6435. module.exports = randomBytes
  6436. } else {
  6437. module.exports = oldBrowser
  6438. }
  6439. function randomBytes (size, cb) {
  6440. // phantomjs needs to throw
  6441. if (size > 65536) throw new Error('requested too many random bytes')
  6442. // in case browserify isn't using the Uint8Array version
  6443. var rawBytes = new global.Uint8Array(size)
  6444. // This will not work in older browsers.
  6445. // See https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues
  6446. if (size > 0) { // getRandomValues fails on IE if size == 0
  6447. crypto.getRandomValues(rawBytes)
  6448. }
  6449. // phantomjs doesn't like a buffer being passed here
  6450. var bytes = new Buffer(rawBytes.buffer)
  6451. if (typeof cb === 'function') {
  6452. return process.nextTick(function () {
  6453. cb(null, bytes)
  6454. })
  6455. }
  6456. return bytes
  6457. }
  6458. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(32), __webpack_require__(0).Buffer, __webpack_require__(7)))
  6459. /***/ },
  6460. /* 32 */
  6461. /***/ function(module, exports) {
  6462. var g;
  6463. // This works in non-strict mode
  6464. g = (function() { return this; })();
  6465. try {
  6466. // This works if eval is allowed (see CSP)
  6467. g = g || Function("return this")() || (1,eval)("this");
  6468. } catch(e) {
  6469. // This works if the window reference is available
  6470. if(typeof window === "object")
  6471. g = window;
  6472. }
  6473. // g can still be undefined, but nothing to do about it...
  6474. // We return undefined, instead of nothing here, so it's
  6475. // easier to handle this case. if(!global) { ...}
  6476. module.exports = g;
  6477. /***/ },
  6478. /* 33 */
  6479. /***/ function(module, exports, __webpack_require__) {
  6480. var asn1 = exports;
  6481. asn1.bignum = __webpack_require__(2);
  6482. asn1.define = __webpack_require__(124).define;
  6483. asn1.base = __webpack_require__(21);
  6484. asn1.constants = __webpack_require__(68);
  6485. asn1.decoders = __webpack_require__(128);
  6486. asn1.encoders = __webpack_require__(130);
  6487. /***/ },
  6488. /* 34 */
  6489. /***/ function(module, exports, __webpack_require__) {
  6490. "use strict";
  6491. 'use strict';
  6492. Object.defineProperty(exports, "__esModule", {
  6493. value: true
  6494. });
  6495. var _promise = __webpack_require__(80);
  6496. var _promise2 = _interopRequireDefault(_promise);
  6497. var _classCallCheck2 = __webpack_require__(23);
  6498. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  6499. var _createClass2 = __webpack_require__(24);
  6500. var _createClass3 = _interopRequireDefault(_createClass2);
  6501. var _axios = __webpack_require__(71);
  6502. var _axios2 = _interopRequireDefault(_axios);
  6503. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6504. var Auth = function () {
  6505. function Auth(storage) {
  6506. (0, _classCallCheck3.default)(this, Auth);
  6507. this.user = {
  6508. authenticated: false
  6509. };
  6510. this.storage = storage;
  6511. }
  6512. (0, _createClass3.default)(Auth, [{
  6513. key: 'isAuthenticated',
  6514. value: function isAuthenticated() {
  6515. var token = this.storage.getToken();
  6516. if (token.stillValid()) {
  6517. this.user.authenticated = true;
  6518. return true;
  6519. }
  6520. this.user.authenticated = false;
  6521. return false;
  6522. }
  6523. }, {
  6524. key: 'isGuest',
  6525. value: function isGuest() {
  6526. return !this.isAuthenticated();
  6527. }
  6528. }, {
  6529. key: 'logout',
  6530. value: function logout() {
  6531. var _this = this;
  6532. return new _promise2.default(function (resolve) {
  6533. _this.storage.clear();
  6534. _this.user.authenticated = false;
  6535. resolve();
  6536. });
  6537. }
  6538. }, {
  6539. key: 'login',
  6540. value: function login(user, baseURL) {
  6541. var _this2 = this;
  6542. var config = this.storage.json();
  6543. if (baseURL) {
  6544. config.baseURL = baseURL;
  6545. }
  6546. return Auth._requestToken(user, config).then(function (token) {
  6547. _this2.storage.saveToken(token);
  6548. });
  6549. }
  6550. }, {
  6551. key: 'refreshToken',
  6552. value: function refreshToken() {
  6553. var _this3 = this;
  6554. var config = this.storage.json();
  6555. var token = this.storage.getToken();
  6556. return Auth._requestNewToken({ token: token.name }, config).then(function (token) {
  6557. _this3.storage.saveToken(token);
  6558. });
  6559. }
  6560. }, {
  6561. key: 'register',
  6562. value: function register(user, baseURL) {
  6563. var config = this.storage.json();
  6564. if (baseURL) {
  6565. config.baseURL = baseURL;
  6566. }
  6567. return _axios2.default.post('/api/auth/register/', user, config).then(function (response) {
  6568. return response.data;
  6569. });
  6570. }
  6571. }, {
  6572. key: 'resetPassword',
  6573. value: function resetPassword(email, baseURL) {
  6574. var config = this.storage.json();
  6575. if (baseURL) {
  6576. config.baseURL = baseURL;
  6577. }
  6578. return _axios2.default.post('/api/auth/password/reset/', email, config);
  6579. }
  6580. }, {
  6581. key: 'confirmResetPassword',
  6582. value: function confirmResetPassword(password, baseURL) {
  6583. var config = this.storage.json();
  6584. if (baseURL) {
  6585. config.baseURL = baseURL;
  6586. }
  6587. return _axios2.default.post('/api/auth/password/reset/confirm/', password, config);
  6588. }
  6589. }], [{
  6590. key: '_requestToken',
  6591. value: function _requestToken(user) {
  6592. var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  6593. return _axios2.default.post('/api/tokens/auth/', user, config).then(function (response) {
  6594. return response.data.token;
  6595. });
  6596. }
  6597. }, {
  6598. key: '_requestNewToken',
  6599. value: function _requestNewToken(token) {
  6600. var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  6601. return _axios2.default.post('/api/tokens/refresh/', token, config).then(function (response) {
  6602. return response.data.token;
  6603. });
  6604. }
  6605. }]);
  6606. return Auth;
  6607. }();
  6608. exports.default = Auth;
  6609. /***/ },
  6610. /* 35 */
  6611. /***/ function(module, exports, __webpack_require__) {
  6612. /* WEBPACK VAR INJECTION */(function(Buffer) {// based on the aes implimentation in triple sec
  6613. // https://github.com/keybase/triplesec
  6614. // which is in turn based on the one from crypto-js
  6615. // https://code.google.com/p/crypto-js/
  6616. var uint_max = Math.pow(2, 32)
  6617. function fixup_uint32 (x) {
  6618. var ret, x_pos
  6619. ret = x > uint_max || x < 0 ? (x_pos = Math.abs(x) % uint_max, x < 0 ? uint_max - x_pos : x_pos) : x
  6620. return ret
  6621. }
  6622. function scrub_vec (v) {
  6623. for (var i = 0; i < v.length; v++) {
  6624. v[i] = 0
  6625. }
  6626. return false
  6627. }
  6628. function Global () {
  6629. this.SBOX = []
  6630. this.INV_SBOX = []
  6631. this.SUB_MIX = [[], [], [], []]
  6632. this.INV_SUB_MIX = [[], [], [], []]
  6633. this.init()
  6634. this.RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]
  6635. }
  6636. Global.prototype.init = function () {
  6637. var d, i, sx, t, x, x2, x4, x8, xi, _i
  6638. d = (function () {
  6639. var _i, _results
  6640. _results = []
  6641. for (i = _i = 0; _i < 256; i = ++_i) {
  6642. if (i < 128) {
  6643. _results.push(i << 1)
  6644. } else {
  6645. _results.push((i << 1) ^ 0x11b)
  6646. }
  6647. }
  6648. return _results
  6649. })()
  6650. x = 0
  6651. xi = 0
  6652. for (i = _i = 0; _i < 256; i = ++_i) {
  6653. sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4)
  6654. sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63
  6655. this.SBOX[x] = sx
  6656. this.INV_SBOX[sx] = x
  6657. x2 = d[x]
  6658. x4 = d[x2]
  6659. x8 = d[x4]
  6660. t = (d[sx] * 0x101) ^ (sx * 0x1010100)
  6661. this.SUB_MIX[0][x] = (t << 24) | (t >>> 8)
  6662. this.SUB_MIX[1][x] = (t << 16) | (t >>> 16)
  6663. this.SUB_MIX[2][x] = (t << 8) | (t >>> 24)
  6664. this.SUB_MIX[3][x] = t
  6665. t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100)
  6666. this.INV_SUB_MIX[0][sx] = (t << 24) | (t >>> 8)
  6667. this.INV_SUB_MIX[1][sx] = (t << 16) | (t >>> 16)
  6668. this.INV_SUB_MIX[2][sx] = (t << 8) | (t >>> 24)
  6669. this.INV_SUB_MIX[3][sx] = t
  6670. if (x === 0) {
  6671. x = xi = 1
  6672. } else {
  6673. x = x2 ^ d[d[d[x8 ^ x2]]]
  6674. xi ^= d[d[xi]]
  6675. }
  6676. }
  6677. return true
  6678. }
  6679. var G = new Global()
  6680. AES.blockSize = 4 * 4
  6681. AES.prototype.blockSize = AES.blockSize
  6682. AES.keySize = 256 / 8
  6683. AES.prototype.keySize = AES.keySize
  6684. function bufferToArray (buf) {
  6685. var len = buf.length / 4
  6686. var out = new Array(len)
  6687. var i = -1
  6688. while (++i < len) {
  6689. out[i] = buf.readUInt32BE(i * 4)
  6690. }
  6691. return out
  6692. }
  6693. function AES (key) {
  6694. this._key = bufferToArray(key)
  6695. this._doReset()
  6696. }
  6697. AES.prototype._doReset = function () {
  6698. var invKsRow, keySize, keyWords, ksRow, ksRows, t
  6699. keyWords = this._key
  6700. keySize = keyWords.length
  6701. this._nRounds = keySize + 6
  6702. ksRows = (this._nRounds + 1) * 4
  6703. this._keySchedule = []
  6704. for (ksRow = 0; ksRow < ksRows; ksRow++) {
  6705. this._keySchedule[ksRow] = ksRow < keySize ? keyWords[ksRow] : (t = this._keySchedule[ksRow - 1], (ksRow % keySize) === 0 ? (t = (t << 8) | (t >>> 24), t = (G.SBOX[t >>> 24] << 24) | (G.SBOX[(t >>> 16) & 0xff] << 16) | (G.SBOX[(t >>> 8) & 0xff] << 8) | G.SBOX[t & 0xff], t ^= G.RCON[(ksRow / keySize) | 0] << 24) : keySize > 6 && ksRow % keySize === 4 ? t = (G.SBOX[t >>> 24] << 24) | (G.SBOX[(t >>> 16) & 0xff] << 16) | (G.SBOX[(t >>> 8) & 0xff] << 8) | G.SBOX[t & 0xff] : void 0, this._keySchedule[ksRow - keySize] ^ t)
  6706. }
  6707. this._invKeySchedule = []
  6708. for (invKsRow = 0; invKsRow < ksRows; invKsRow++) {
  6709. ksRow = ksRows - invKsRow
  6710. t = this._keySchedule[ksRow - (invKsRow % 4 ? 0 : 4)]
  6711. this._invKeySchedule[invKsRow] = invKsRow < 4 || ksRow <= 4 ? t : G.INV_SUB_MIX[0][G.SBOX[t >>> 24]] ^ G.INV_SUB_MIX[1][G.SBOX[(t >>> 16) & 0xff]] ^ G.INV_SUB_MIX[2][G.SBOX[(t >>> 8) & 0xff]] ^ G.INV_SUB_MIX[3][G.SBOX[t & 0xff]]
  6712. }
  6713. return true
  6714. }
  6715. AES.prototype.encryptBlock = function (M) {
  6716. M = bufferToArray(new Buffer(M))
  6717. var out = this._doCryptBlock(M, this._keySchedule, G.SUB_MIX, G.SBOX)
  6718. var buf = new Buffer(16)
  6719. buf.writeUInt32BE(out[0], 0)
  6720. buf.writeUInt32BE(out[1], 4)
  6721. buf.writeUInt32BE(out[2], 8)
  6722. buf.writeUInt32BE(out[3], 12)
  6723. return buf
  6724. }
  6725. AES.prototype.decryptBlock = function (M) {
  6726. M = bufferToArray(new Buffer(M))
  6727. var temp = [M[3], M[1]]
  6728. M[1] = temp[0]
  6729. M[3] = temp[1]
  6730. var out = this._doCryptBlock(M, this._invKeySchedule, G.INV_SUB_MIX, G.INV_SBOX)
  6731. var buf = new Buffer(16)
  6732. buf.writeUInt32BE(out[0], 0)
  6733. buf.writeUInt32BE(out[3], 4)
  6734. buf.writeUInt32BE(out[2], 8)
  6735. buf.writeUInt32BE(out[1], 12)
  6736. return buf
  6737. }
  6738. AES.prototype.scrub = function () {
  6739. scrub_vec(this._keySchedule)
  6740. scrub_vec(this._invKeySchedule)
  6741. scrub_vec(this._key)
  6742. }
  6743. AES.prototype._doCryptBlock = function (M, keySchedule, SUB_MIX, SBOX) {
  6744. var ksRow, s0, s1, s2, s3, t0, t1, t2, t3
  6745. s0 = M[0] ^ keySchedule[0]
  6746. s1 = M[1] ^ keySchedule[1]
  6747. s2 = M[2] ^ keySchedule[2]
  6748. s3 = M[3] ^ keySchedule[3]
  6749. ksRow = 4
  6750. for (var round = 1; round < this._nRounds; round++) {
  6751. t0 = SUB_MIX[0][s0 >>> 24] ^ SUB_MIX[1][(s1 >>> 16) & 0xff] ^ SUB_MIX[2][(s2 >>> 8) & 0xff] ^ SUB_MIX[3][s3 & 0xff] ^ keySchedule[ksRow++]
  6752. t1 = SUB_MIX[0][s1 >>> 24] ^ SUB_MIX[1][(s2 >>> 16) & 0xff] ^ SUB_MIX[2][(s3 >>> 8) & 0xff] ^ SUB_MIX[3][s0 & 0xff] ^ keySchedule[ksRow++]
  6753. t2 = SUB_MIX[0][s2 >>> 24] ^ SUB_MIX[1][(s3 >>> 16) & 0xff] ^ SUB_MIX[2][(s0 >>> 8) & 0xff] ^ SUB_MIX[3][s1 & 0xff] ^ keySchedule[ksRow++]
  6754. t3 = SUB_MIX[0][s3 >>> 24] ^ SUB_MIX[1][(s0 >>> 16) & 0xff] ^ SUB_MIX[2][(s1 >>> 8) & 0xff] ^ SUB_MIX[3][s2 & 0xff] ^ keySchedule[ksRow++]
  6755. s0 = t0
  6756. s1 = t1
  6757. s2 = t2
  6758. s3 = t3
  6759. }
  6760. t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]
  6761. t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]
  6762. t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]
  6763. t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]
  6764. return [
  6765. fixup_uint32(t0),
  6766. fixup_uint32(t1),
  6767. fixup_uint32(t2),
  6768. fixup_uint32(t3)
  6769. ]
  6770. }
  6771. exports.AES = AES
  6772. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  6773. /***/ },
  6774. /* 36 */
  6775. /***/ function(module, exports) {
  6776. exports['aes-128-ecb'] = {
  6777. cipher: 'AES',
  6778. key: 128,
  6779. iv: 0,
  6780. mode: 'ECB',
  6781. type: 'block'
  6782. }
  6783. exports['aes-192-ecb'] = {
  6784. cipher: 'AES',
  6785. key: 192,
  6786. iv: 0,
  6787. mode: 'ECB',
  6788. type: 'block'
  6789. }
  6790. exports['aes-256-ecb'] = {
  6791. cipher: 'AES',
  6792. key: 256,
  6793. iv: 0,
  6794. mode: 'ECB',
  6795. type: 'block'
  6796. }
  6797. exports['aes-128-cbc'] = {
  6798. cipher: 'AES',
  6799. key: 128,
  6800. iv: 16,
  6801. mode: 'CBC',
  6802. type: 'block'
  6803. }
  6804. exports['aes-192-cbc'] = {
  6805. cipher: 'AES',
  6806. key: 192,
  6807. iv: 16,
  6808. mode: 'CBC',
  6809. type: 'block'
  6810. }
  6811. exports['aes-256-cbc'] = {
  6812. cipher: 'AES',
  6813. key: 256,
  6814. iv: 16,
  6815. mode: 'CBC',
  6816. type: 'block'
  6817. }
  6818. exports['aes128'] = exports['aes-128-cbc']
  6819. exports['aes192'] = exports['aes-192-cbc']
  6820. exports['aes256'] = exports['aes-256-cbc']
  6821. exports['aes-128-cfb'] = {
  6822. cipher: 'AES',
  6823. key: 128,
  6824. iv: 16,
  6825. mode: 'CFB',
  6826. type: 'stream'
  6827. }
  6828. exports['aes-192-cfb'] = {
  6829. cipher: 'AES',
  6830. key: 192,
  6831. iv: 16,
  6832. mode: 'CFB',
  6833. type: 'stream'
  6834. }
  6835. exports['aes-256-cfb'] = {
  6836. cipher: 'AES',
  6837. key: 256,
  6838. iv: 16,
  6839. mode: 'CFB',
  6840. type: 'stream'
  6841. }
  6842. exports['aes-128-cfb8'] = {
  6843. cipher: 'AES',
  6844. key: 128,
  6845. iv: 16,
  6846. mode: 'CFB8',
  6847. type: 'stream'
  6848. }
  6849. exports['aes-192-cfb8'] = {
  6850. cipher: 'AES',
  6851. key: 192,
  6852. iv: 16,
  6853. mode: 'CFB8',
  6854. type: 'stream'
  6855. }
  6856. exports['aes-256-cfb8'] = {
  6857. cipher: 'AES',
  6858. key: 256,
  6859. iv: 16,
  6860. mode: 'CFB8',
  6861. type: 'stream'
  6862. }
  6863. exports['aes-128-cfb1'] = {
  6864. cipher: 'AES',
  6865. key: 128,
  6866. iv: 16,
  6867. mode: 'CFB1',
  6868. type: 'stream'
  6869. }
  6870. exports['aes-192-cfb1'] = {
  6871. cipher: 'AES',
  6872. key: 192,
  6873. iv: 16,
  6874. mode: 'CFB1',
  6875. type: 'stream'
  6876. }
  6877. exports['aes-256-cfb1'] = {
  6878. cipher: 'AES',
  6879. key: 256,
  6880. iv: 16,
  6881. mode: 'CFB1',
  6882. type: 'stream'
  6883. }
  6884. exports['aes-128-ofb'] = {
  6885. cipher: 'AES',
  6886. key: 128,
  6887. iv: 16,
  6888. mode: 'OFB',
  6889. type: 'stream'
  6890. }
  6891. exports['aes-192-ofb'] = {
  6892. cipher: 'AES',
  6893. key: 192,
  6894. iv: 16,
  6895. mode: 'OFB',
  6896. type: 'stream'
  6897. }
  6898. exports['aes-256-ofb'] = {
  6899. cipher: 'AES',
  6900. key: 256,
  6901. iv: 16,
  6902. mode: 'OFB',
  6903. type: 'stream'
  6904. }
  6905. exports['aes-128-ctr'] = {
  6906. cipher: 'AES',
  6907. key: 128,
  6908. iv: 16,
  6909. mode: 'CTR',
  6910. type: 'stream'
  6911. }
  6912. exports['aes-192-ctr'] = {
  6913. cipher: 'AES',
  6914. key: 192,
  6915. iv: 16,
  6916. mode: 'CTR',
  6917. type: 'stream'
  6918. }
  6919. exports['aes-256-ctr'] = {
  6920. cipher: 'AES',
  6921. key: 256,
  6922. iv: 16,
  6923. mode: 'CTR',
  6924. type: 'stream'
  6925. }
  6926. exports['aes-128-gcm'] = {
  6927. cipher: 'AES',
  6928. key: 128,
  6929. iv: 12,
  6930. mode: 'GCM',
  6931. type: 'auth'
  6932. }
  6933. exports['aes-192-gcm'] = {
  6934. cipher: 'AES',
  6935. key: 192,
  6936. iv: 12,
  6937. mode: 'GCM',
  6938. type: 'auth'
  6939. }
  6940. exports['aes-256-gcm'] = {
  6941. cipher: 'AES',
  6942. key: 256,
  6943. iv: 12,
  6944. mode: 'GCM',
  6945. type: 'auth'
  6946. }
  6947. /***/ },
  6948. /* 37 */
  6949. /***/ function(module, exports, __webpack_require__) {
  6950. /* WEBPACK VAR INJECTION */(function(Buffer) {var xor = __webpack_require__(26)
  6951. function incr32 (iv) {
  6952. var len = iv.length
  6953. var item
  6954. while (len--) {
  6955. item = iv.readUInt8(len)
  6956. if (item === 255) {
  6957. iv.writeUInt8(0, len)
  6958. } else {
  6959. item++
  6960. iv.writeUInt8(item, len)
  6961. break
  6962. }
  6963. }
  6964. }
  6965. function getBlock (self) {
  6966. var out = self._cipher.encryptBlock(self._prev)
  6967. incr32(self._prev)
  6968. return out
  6969. }
  6970. exports.encrypt = function (self, chunk) {
  6971. while (self._cache.length < chunk.length) {
  6972. self._cache = Buffer.concat([self._cache, getBlock(self)])
  6973. }
  6974. var pad = self._cache.slice(0, chunk.length)
  6975. self._cache = self._cache.slice(chunk.length)
  6976. return xor(chunk, pad)
  6977. }
  6978. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  6979. /***/ },
  6980. /* 38 */
  6981. /***/ function(module, exports) {
  6982. var toString = {}.toString;
  6983. module.exports = function(it){
  6984. return toString.call(it).slice(8, -1);
  6985. };
  6986. /***/ },
  6987. /* 39 */
  6988. /***/ function(module, exports, __webpack_require__) {
  6989. // optional / simple context binding
  6990. var aFunction = __webpack_require__(52);
  6991. module.exports = function(fn, that, length){
  6992. aFunction(fn);
  6993. if(that === undefined)return fn;
  6994. switch(length){
  6995. case 1: return function(a){
  6996. return fn.call(that, a);
  6997. };
  6998. case 2: return function(a, b){
  6999. return fn.call(that, a, b);
  7000. };
  7001. case 3: return function(a, b, c){
  7002. return fn.call(that, a, b, c);
  7003. };
  7004. }
  7005. return function(/* ...args */){
  7006. return fn.apply(that, arguments);
  7007. };
  7008. };
  7009. /***/ },
  7010. /* 40 */
  7011. /***/ function(module, exports, __webpack_require__) {
  7012. var global = __webpack_require__(6)
  7013. , core = __webpack_require__(8)
  7014. , ctx = __webpack_require__(39)
  7015. , hide = __webpack_require__(15)
  7016. , PROTOTYPE = 'prototype';
  7017. var $export = function(type, name, source){
  7018. var IS_FORCED = type & $export.F
  7019. , IS_GLOBAL = type & $export.G
  7020. , IS_STATIC = type & $export.S
  7021. , IS_PROTO = type & $export.P
  7022. , IS_BIND = type & $export.B
  7023. , IS_WRAP = type & $export.W
  7024. , exports = IS_GLOBAL ? core : core[name] || (core[name] = {})
  7025. , expProto = exports[PROTOTYPE]
  7026. , target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]
  7027. , key, own, out;
  7028. if(IS_GLOBAL)source = name;
  7029. for(key in source){
  7030. // contains in native
  7031. own = !IS_FORCED && target && target[key] !== undefined;
  7032. if(own && key in exports)continue;
  7033. // export native or passed
  7034. out = own ? target[key] : source[key];
  7035. // prevent global pollution for namespaces
  7036. exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
  7037. // bind timers to global for call from export context
  7038. : IS_BIND && own ? ctx(out, global)
  7039. // wrap global constructors for prevent change them in library
  7040. : IS_WRAP && target[key] == out ? (function(C){
  7041. var F = function(a, b, c){
  7042. if(this instanceof C){
  7043. switch(arguments.length){
  7044. case 0: return new C;
  7045. case 1: return new C(a);
  7046. case 2: return new C(a, b);
  7047. } return new C(a, b, c);
  7048. } return C.apply(this, arguments);
  7049. };
  7050. F[PROTOTYPE] = C[PROTOTYPE];
  7051. return F;
  7052. // make static versions for prototype methods
  7053. })(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
  7054. // export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
  7055. if(IS_PROTO){
  7056. (exports.virtual || (exports.virtual = {}))[key] = out;
  7057. // export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
  7058. if(type & $export.R && expProto && !expProto[key])hide(expProto, key, out);
  7059. }
  7060. }
  7061. };
  7062. // type bitmap
  7063. $export.F = 1; // forced
  7064. $export.G = 2; // global
  7065. $export.S = 4; // static
  7066. $export.P = 8; // proto
  7067. $export.B = 16; // bind
  7068. $export.W = 32; // wrap
  7069. $export.U = 64; // safe
  7070. $export.R = 128; // real proto method for `library`
  7071. module.exports = $export;
  7072. /***/ },
  7073. /* 41 */
  7074. /***/ function(module, exports) {
  7075. var hasOwnProperty = {}.hasOwnProperty;
  7076. module.exports = function(it, key){
  7077. return hasOwnProperty.call(it, key);
  7078. };
  7079. /***/ },
  7080. /* 42 */
  7081. /***/ function(module, exports) {
  7082. module.exports = function(it){
  7083. return typeof it === 'object' ? it !== null : typeof it === 'function';
  7084. };
  7085. /***/ },
  7086. /* 43 */
  7087. /***/ function(module, exports, __webpack_require__) {
  7088. "use strict";
  7089. 'use strict';
  7090. var curve = exports;
  7091. curve.base = __webpack_require__(232);
  7092. curve.short = __webpack_require__(235);
  7093. curve.mont = __webpack_require__(234);
  7094. curve.edwards = __webpack_require__(233);
  7095. /***/ },
  7096. /* 44 */
  7097. /***/ function(module, exports) {
  7098. // Copyright Joyent, Inc. and other Node contributors.
  7099. //
  7100. // Permission is hereby granted, free of charge, to any person obtaining a
  7101. // copy of this software and associated documentation files (the
  7102. // "Software"), to deal in the Software without restriction, including
  7103. // without limitation the rights to use, copy, modify, merge, publish,
  7104. // distribute, sublicense, and/or sell copies of the Software, and to permit
  7105. // persons to whom the Software is furnished to do so, subject to the
  7106. // following conditions:
  7107. //
  7108. // The above copyright notice and this permission notice shall be included
  7109. // in all copies or substantial portions of the Software.
  7110. //
  7111. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  7112. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  7113. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  7114. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  7115. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  7116. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  7117. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  7118. function EventEmitter() {
  7119. this._events = this._events || {};
  7120. this._maxListeners = this._maxListeners || undefined;
  7121. }
  7122. module.exports = EventEmitter;
  7123. // Backwards-compat with node 0.10.x
  7124. EventEmitter.EventEmitter = EventEmitter;
  7125. EventEmitter.prototype._events = undefined;
  7126. EventEmitter.prototype._maxListeners = undefined;
  7127. // By default EventEmitters will print a warning if more than 10 listeners are
  7128. // added to it. This is a useful default which helps finding memory leaks.
  7129. EventEmitter.defaultMaxListeners = 10;
  7130. // Obviously not all Emitters should be limited to 10. This function allows
  7131. // that to be increased. Set to zero for unlimited.
  7132. EventEmitter.prototype.setMaxListeners = function(n) {
  7133. if (!isNumber(n) || n < 0 || isNaN(n))
  7134. throw TypeError('n must be a positive number');
  7135. this._maxListeners = n;
  7136. return this;
  7137. };
  7138. EventEmitter.prototype.emit = function(type) {
  7139. var er, handler, len, args, i, listeners;
  7140. if (!this._events)
  7141. this._events = {};
  7142. // If there is no 'error' event listener then throw.
  7143. if (type === 'error') {
  7144. if (!this._events.error ||
  7145. (isObject(this._events.error) && !this._events.error.length)) {
  7146. er = arguments[1];
  7147. if (er instanceof Error) {
  7148. throw er; // Unhandled 'error' event
  7149. } else {
  7150. // At least give some kind of context to the user
  7151. var err = new Error('Uncaught, unspecified "error" event. (' + er + ')');
  7152. err.context = er;
  7153. throw err;
  7154. }
  7155. }
  7156. }
  7157. handler = this._events[type];
  7158. if (isUndefined(handler))
  7159. return false;
  7160. if (isFunction(handler)) {
  7161. switch (arguments.length) {
  7162. // fast cases
  7163. case 1:
  7164. handler.call(this);
  7165. break;
  7166. case 2:
  7167. handler.call(this, arguments[1]);
  7168. break;
  7169. case 3:
  7170. handler.call(this, arguments[1], arguments[2]);
  7171. break;
  7172. // slower
  7173. default:
  7174. args = Array.prototype.slice.call(arguments, 1);
  7175. handler.apply(this, args);
  7176. }
  7177. } else if (isObject(handler)) {
  7178. args = Array.prototype.slice.call(arguments, 1);
  7179. listeners = handler.slice();
  7180. len = listeners.length;
  7181. for (i = 0; i < len; i++)
  7182. listeners[i].apply(this, args);
  7183. }
  7184. return true;
  7185. };
  7186. EventEmitter.prototype.addListener = function(type, listener) {
  7187. var m;
  7188. if (!isFunction(listener))
  7189. throw TypeError('listener must be a function');
  7190. if (!this._events)
  7191. this._events = {};
  7192. // To avoid recursion in the case that type === "newListener"! Before
  7193. // adding it to the listeners, first emit "newListener".
  7194. if (this._events.newListener)
  7195. this.emit('newListener', type,
  7196. isFunction(listener.listener) ?
  7197. listener.listener : listener);
  7198. if (!this._events[type])
  7199. // Optimize the case of one listener. Don't need the extra array object.
  7200. this._events[type] = listener;
  7201. else if (isObject(this._events[type]))
  7202. // If we've already got an array, just append.
  7203. this._events[type].push(listener);
  7204. else
  7205. // Adding the second element, need to change to array.
  7206. this._events[type] = [this._events[type], listener];
  7207. // Check for listener leak
  7208. if (isObject(this._events[type]) && !this._events[type].warned) {
  7209. if (!isUndefined(this._maxListeners)) {
  7210. m = this._maxListeners;
  7211. } else {
  7212. m = EventEmitter.defaultMaxListeners;
  7213. }
  7214. if (m && m > 0 && this._events[type].length > m) {
  7215. this._events[type].warned = true;
  7216. console.error('(node) warning: possible EventEmitter memory ' +
  7217. 'leak detected. %d listeners added. ' +
  7218. 'Use emitter.setMaxListeners() to increase limit.',
  7219. this._events[type].length);
  7220. if (typeof console.trace === 'function') {
  7221. // not supported in IE 10
  7222. console.trace();
  7223. }
  7224. }
  7225. }
  7226. return this;
  7227. };
  7228. EventEmitter.prototype.on = EventEmitter.prototype.addListener;
  7229. EventEmitter.prototype.once = function(type, listener) {
  7230. if (!isFunction(listener))
  7231. throw TypeError('listener must be a function');
  7232. var fired = false;
  7233. function g() {
  7234. this.removeListener(type, g);
  7235. if (!fired) {
  7236. fired = true;
  7237. listener.apply(this, arguments);
  7238. }
  7239. }
  7240. g.listener = listener;
  7241. this.on(type, g);
  7242. return this;
  7243. };
  7244. // emits a 'removeListener' event iff the listener was removed
  7245. EventEmitter.prototype.removeListener = function(type, listener) {
  7246. var list, position, length, i;
  7247. if (!isFunction(listener))
  7248. throw TypeError('listener must be a function');
  7249. if (!this._events || !this._events[type])
  7250. return this;
  7251. list = this._events[type];
  7252. length = list.length;
  7253. position = -1;
  7254. if (list === listener ||
  7255. (isFunction(list.listener) && list.listener === listener)) {
  7256. delete this._events[type];
  7257. if (this._events.removeListener)
  7258. this.emit('removeListener', type, listener);
  7259. } else if (isObject(list)) {
  7260. for (i = length; i-- > 0;) {
  7261. if (list[i] === listener ||
  7262. (list[i].listener && list[i].listener === listener)) {
  7263. position = i;
  7264. break;
  7265. }
  7266. }
  7267. if (position < 0)
  7268. return this;
  7269. if (list.length === 1) {
  7270. list.length = 0;
  7271. delete this._events[type];
  7272. } else {
  7273. list.splice(position, 1);
  7274. }
  7275. if (this._events.removeListener)
  7276. this.emit('removeListener', type, listener);
  7277. }
  7278. return this;
  7279. };
  7280. EventEmitter.prototype.removeAllListeners = function(type) {
  7281. var key, listeners;
  7282. if (!this._events)
  7283. return this;
  7284. // not listening for removeListener, no need to emit
  7285. if (!this._events.removeListener) {
  7286. if (arguments.length === 0)
  7287. this._events = {};
  7288. else if (this._events[type])
  7289. delete this._events[type];
  7290. return this;
  7291. }
  7292. // emit removeListener for all listeners on all events
  7293. if (arguments.length === 0) {
  7294. for (key in this._events) {
  7295. if (key === 'removeListener') continue;
  7296. this.removeAllListeners(key);
  7297. }
  7298. this.removeAllListeners('removeListener');
  7299. this._events = {};
  7300. return this;
  7301. }
  7302. listeners = this._events[type];
  7303. if (isFunction(listeners)) {
  7304. this.removeListener(type, listeners);
  7305. } else if (listeners) {
  7306. // LIFO order
  7307. while (listeners.length)
  7308. this.removeListener(type, listeners[listeners.length - 1]);
  7309. }
  7310. delete this._events[type];
  7311. return this;
  7312. };
  7313. EventEmitter.prototype.listeners = function(type) {
  7314. var ret;
  7315. if (!this._events || !this._events[type])
  7316. ret = [];
  7317. else if (isFunction(this._events[type]))
  7318. ret = [this._events[type]];
  7319. else
  7320. ret = this._events[type].slice();
  7321. return ret;
  7322. };
  7323. EventEmitter.prototype.listenerCount = function(type) {
  7324. if (this._events) {
  7325. var evlistener = this._events[type];
  7326. if (isFunction(evlistener))
  7327. return 1;
  7328. else if (evlistener)
  7329. return evlistener.length;
  7330. }
  7331. return 0;
  7332. };
  7333. EventEmitter.listenerCount = function(emitter, type) {
  7334. return emitter.listenerCount(type);
  7335. };
  7336. function isFunction(arg) {
  7337. return typeof arg === 'function';
  7338. }
  7339. function isNumber(arg) {
  7340. return typeof arg === 'number';
  7341. }
  7342. function isObject(arg) {
  7343. return typeof arg === 'object' && arg !== null;
  7344. }
  7345. function isUndefined(arg) {
  7346. return arg === void 0;
  7347. }
  7348. /***/ },
  7349. /* 45 */
  7350. /***/ function(module, exports, __webpack_require__) {
  7351. /* WEBPACK VAR INJECTION */(function(Buffer) {var md5 = __webpack_require__(104)
  7352. module.exports = EVP_BytesToKey
  7353. function EVP_BytesToKey (password, salt, keyLen, ivLen) {
  7354. if (!Buffer.isBuffer(password)) {
  7355. password = new Buffer(password, 'binary')
  7356. }
  7357. if (salt && !Buffer.isBuffer(salt)) {
  7358. salt = new Buffer(salt, 'binary')
  7359. }
  7360. keyLen = keyLen / 8
  7361. ivLen = ivLen || 0
  7362. var ki = 0
  7363. var ii = 0
  7364. var key = new Buffer(keyLen)
  7365. var iv = new Buffer(ivLen)
  7366. var addmd = 0
  7367. var md_buf
  7368. var i
  7369. var bufs = []
  7370. while (true) {
  7371. if (addmd++ > 0) {
  7372. bufs.push(md_buf)
  7373. }
  7374. bufs.push(password)
  7375. if (salt) {
  7376. bufs.push(salt)
  7377. }
  7378. md_buf = md5(Buffer.concat(bufs))
  7379. bufs = []
  7380. i = 0
  7381. if (keyLen > 0) {
  7382. while (true) {
  7383. if (keyLen === 0) {
  7384. break
  7385. }
  7386. if (i === md_buf.length) {
  7387. break
  7388. }
  7389. key[ki++] = md_buf[i]
  7390. keyLen--
  7391. i++
  7392. }
  7393. }
  7394. if (ivLen > 0 && i !== md_buf.length) {
  7395. while (true) {
  7396. if (ivLen === 0) {
  7397. break
  7398. }
  7399. if (i === md_buf.length) {
  7400. break
  7401. }
  7402. iv[ii++] = md_buf[i]
  7403. ivLen--
  7404. i++
  7405. }
  7406. }
  7407. if (keyLen === 0 && ivLen === 0) {
  7408. break
  7409. }
  7410. }
  7411. for (i = 0; i < md_buf.length; i++) {
  7412. md_buf[i] = 0
  7413. }
  7414. return {
  7415. key: key,
  7416. iv: iv
  7417. }
  7418. }
  7419. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  7420. /***/ },
  7421. /* 46 */
  7422. /***/ function(module, exports, __webpack_require__) {
  7423. /* WEBPACK VAR INJECTION */(function(Buffer) {var asn1 = __webpack_require__(262)
  7424. var aesid = __webpack_require__(257)
  7425. var fixProc = __webpack_require__(263)
  7426. var ciphers = __webpack_require__(49)
  7427. var compat = __webpack_require__(110)
  7428. module.exports = parseKeys
  7429. function parseKeys (buffer) {
  7430. var password
  7431. if (typeof buffer === 'object' && !Buffer.isBuffer(buffer)) {
  7432. password = buffer.passphrase
  7433. buffer = buffer.key
  7434. }
  7435. if (typeof buffer === 'string') {
  7436. buffer = new Buffer(buffer)
  7437. }
  7438. var stripped = fixProc(buffer, password)
  7439. var type = stripped.tag
  7440. var data = stripped.data
  7441. var subtype, ndata
  7442. switch (type) {
  7443. case 'PUBLIC KEY':
  7444. ndata = asn1.PublicKey.decode(data, 'der')
  7445. subtype = ndata.algorithm.algorithm.join('.')
  7446. switch (subtype) {
  7447. case '1.2.840.113549.1.1.1':
  7448. return asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data, 'der')
  7449. case '1.2.840.10045.2.1':
  7450. ndata.subjectPrivateKey = ndata.subjectPublicKey
  7451. return {
  7452. type: 'ec',
  7453. data: ndata
  7454. }
  7455. case '1.2.840.10040.4.1':
  7456. ndata.algorithm.params.pub_key = asn1.DSAparam.decode(ndata.subjectPublicKey.data, 'der')
  7457. return {
  7458. type: 'dsa',
  7459. data: ndata.algorithm.params
  7460. }
  7461. default: throw new Error('unknown key id ' + subtype)
  7462. }
  7463. throw new Error('unknown key type ' + type)
  7464. case 'ENCRYPTED PRIVATE KEY':
  7465. data = asn1.EncryptedPrivateKey.decode(data, 'der')
  7466. data = decrypt(data, password)
  7467. // falls through
  7468. case 'PRIVATE KEY':
  7469. ndata = asn1.PrivateKey.decode(data, 'der')
  7470. subtype = ndata.algorithm.algorithm.join('.')
  7471. switch (subtype) {
  7472. case '1.2.840.113549.1.1.1':
  7473. return asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey, 'der')
  7474. case '1.2.840.10045.2.1':
  7475. return {
  7476. curve: ndata.algorithm.curve,
  7477. privateKey: asn1.ECPrivateKey.decode(ndata.subjectPrivateKey, 'der').privateKey
  7478. }
  7479. case '1.2.840.10040.4.1':
  7480. ndata.algorithm.params.priv_key = asn1.DSAparam.decode(ndata.subjectPrivateKey, 'der')
  7481. return {
  7482. type: 'dsa',
  7483. params: ndata.algorithm.params
  7484. }
  7485. default: throw new Error('unknown key id ' + subtype)
  7486. }
  7487. throw new Error('unknown key type ' + type)
  7488. case 'RSA PUBLIC KEY':
  7489. return asn1.RSAPublicKey.decode(data, 'der')
  7490. case 'RSA PRIVATE KEY':
  7491. return asn1.RSAPrivateKey.decode(data, 'der')
  7492. case 'DSA PRIVATE KEY':
  7493. return {
  7494. type: 'dsa',
  7495. params: asn1.DSAPrivateKey.decode(data, 'der')
  7496. }
  7497. case 'EC PRIVATE KEY':
  7498. data = asn1.ECPrivateKey.decode(data, 'der')
  7499. return {
  7500. curve: data.parameters.value,
  7501. privateKey: data.privateKey
  7502. }
  7503. default: throw new Error('unknown key type ' + type)
  7504. }
  7505. }
  7506. parseKeys.signature = asn1.signature
  7507. function decrypt (data, password) {
  7508. var salt = data.algorithm.decrypt.kde.kdeparams.salt
  7509. var iters = parseInt(data.algorithm.decrypt.kde.kdeparams.iters.toString(), 10)
  7510. var algo = aesid[data.algorithm.decrypt.cipher.algo.join('.')]
  7511. var iv = data.algorithm.decrypt.cipher.iv
  7512. var cipherText = data.subjectPrivateKey
  7513. var keylen = parseInt(algo.split('-')[1], 10) / 8
  7514. var key = compat.pbkdf2Sync(password, salt, iters, keylen)
  7515. var cipher = ciphers.createDecipheriv(algo, key, iv)
  7516. var out = []
  7517. out.push(cipher.update(cipherText))
  7518. out.push(cipher.final())
  7519. return Buffer.concat(out)
  7520. }
  7521. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  7522. /***/ },
  7523. /* 47 */
  7524. /***/ function(module, exports, __webpack_require__) {
  7525. "use strict";
  7526. /* WEBPACK VAR INJECTION */(function(process) {/*!
  7527. * Vue.js v2.0.3
  7528. * (c) 2014-2016 Evan You
  7529. * Released under the MIT License.
  7530. */
  7531. 'use strict';
  7532. /* */
  7533. /**
  7534. * Convert a value to a string that is actually rendered.
  7535. */
  7536. function _toString (val) {
  7537. return val == null
  7538. ? ''
  7539. : typeof val === 'object'
  7540. ? JSON.stringify(val, null, 2)
  7541. : String(val)
  7542. }
  7543. /**
  7544. * Convert a input value to a number for persistence.
  7545. * If the conversion fails, return original string.
  7546. */
  7547. function toNumber (val) {
  7548. var n = parseFloat(val, 10);
  7549. return (n || n === 0) ? n : val
  7550. }
  7551. /**
  7552. * Make a map and return a function for checking if a key
  7553. * is in that map.
  7554. */
  7555. function makeMap (
  7556. str,
  7557. expectsLowerCase
  7558. ) {
  7559. var map = Object.create(null);
  7560. var list = str.split(',');
  7561. for (var i = 0; i < list.length; i++) {
  7562. map[list[i]] = true;
  7563. }
  7564. return expectsLowerCase
  7565. ? function (val) { return map[val.toLowerCase()]; }
  7566. : function (val) { return map[val]; }
  7567. }
  7568. /**
  7569. * Check if a tag is a built-in tag.
  7570. */
  7571. var isBuiltInTag = makeMap('slot,component', true);
  7572. /**
  7573. * Remove an item from an array
  7574. */
  7575. function remove$1 (arr, item) {
  7576. if (arr.length) {
  7577. var index = arr.indexOf(item);
  7578. if (index > -1) {
  7579. return arr.splice(index, 1)
  7580. }
  7581. }
  7582. }
  7583. /**
  7584. * Check whether the object has the property.
  7585. */
  7586. var hasOwnProperty = Object.prototype.hasOwnProperty;
  7587. function hasOwn (obj, key) {
  7588. return hasOwnProperty.call(obj, key)
  7589. }
  7590. /**
  7591. * Check if value is primitive
  7592. */
  7593. function isPrimitive (value) {
  7594. return typeof value === 'string' || typeof value === 'number'
  7595. }
  7596. /**
  7597. * Create a cached version of a pure function.
  7598. */
  7599. function cached (fn) {
  7600. var cache = Object.create(null);
  7601. return function cachedFn (str) {
  7602. var hit = cache[str];
  7603. return hit || (cache[str] = fn(str))
  7604. }
  7605. }
  7606. /**
  7607. * Camelize a hyphen-delmited string.
  7608. */
  7609. var camelizeRE = /-(\w)/g;
  7610. var camelize = cached(function (str) {
  7611. return str.replace(camelizeRE, function (_, c) { return c ? c.toUpperCase() : ''; })
  7612. });
  7613. /**
  7614. * Capitalize a string.
  7615. */
  7616. var capitalize = cached(function (str) {
  7617. return str.charAt(0).toUpperCase() + str.slice(1)
  7618. });
  7619. /**
  7620. * Hyphenate a camelCase string.
  7621. */
  7622. var hyphenateRE = /([^-])([A-Z])/g;
  7623. var hyphenate = cached(function (str) {
  7624. return str
  7625. .replace(hyphenateRE, '$1-$2')
  7626. .replace(hyphenateRE, '$1-$2')
  7627. .toLowerCase()
  7628. });
  7629. /**
  7630. * Simple bind, faster than native
  7631. */
  7632. function bind$1 (fn, ctx) {
  7633. function boundFn (a) {
  7634. var l = arguments.length;
  7635. return l
  7636. ? l > 1
  7637. ? fn.apply(ctx, arguments)
  7638. : fn.call(ctx, a)
  7639. : fn.call(ctx)
  7640. }
  7641. // record original fn length
  7642. boundFn._length = fn.length;
  7643. return boundFn
  7644. }
  7645. /**
  7646. * Convert an Array-like object to a real Array.
  7647. */
  7648. function toArray (list, start) {
  7649. start = start || 0;
  7650. var i = list.length - start;
  7651. var ret = new Array(i);
  7652. while (i--) {
  7653. ret[i] = list[i + start];
  7654. }
  7655. return ret
  7656. }
  7657. /**
  7658. * Mix properties into target object.
  7659. */
  7660. function extend (to, _from) {
  7661. for (var key in _from) {
  7662. to[key] = _from[key];
  7663. }
  7664. return to
  7665. }
  7666. /**
  7667. * Quick object check - this is primarily used to tell
  7668. * Objects from primitive values when we know the value
  7669. * is a JSON-compliant type.
  7670. */
  7671. function isObject (obj) {
  7672. return obj !== null && typeof obj === 'object'
  7673. }
  7674. /**
  7675. * Strict object type check. Only returns true
  7676. * for plain JavaScript objects.
  7677. */
  7678. var toString = Object.prototype.toString;
  7679. var OBJECT_STRING = '[object Object]';
  7680. function isPlainObject (obj) {
  7681. return toString.call(obj) === OBJECT_STRING
  7682. }
  7683. /**
  7684. * Merge an Array of Objects into a single Object.
  7685. */
  7686. function toObject (arr) {
  7687. var res = {};
  7688. for (var i = 0; i < arr.length; i++) {
  7689. if (arr[i]) {
  7690. extend(res, arr[i]);
  7691. }
  7692. }
  7693. return res
  7694. }
  7695. /**
  7696. * Perform no operation.
  7697. */
  7698. function noop () {}
  7699. /**
  7700. * Always return false.
  7701. */
  7702. var no = function () { return false; };
  7703. /**
  7704. * Generate a static keys string from compiler modules.
  7705. */
  7706. function genStaticKeys (modules) {
  7707. return modules.reduce(function (keys, m) {
  7708. return keys.concat(m.staticKeys || [])
  7709. }, []).join(',')
  7710. }
  7711. /**
  7712. * Check if two values are loosely equal - that is,
  7713. * if they are plain objects, do they have the same shape?
  7714. */
  7715. function looseEqual (a, b) {
  7716. /* eslint-disable eqeqeq */
  7717. return a == b || (
  7718. isObject(a) && isObject(b)
  7719. ? JSON.stringify(a) === JSON.stringify(b)
  7720. : false
  7721. )
  7722. /* eslint-enable eqeqeq */
  7723. }
  7724. function looseIndexOf (arr, val) {
  7725. for (var i = 0; i < arr.length; i++) {
  7726. if (looseEqual(arr[i], val)) { return i }
  7727. }
  7728. return -1
  7729. }
  7730. /* */
  7731. var config = {
  7732. /**
  7733. * Option merge strategies (used in core/util/options)
  7734. */
  7735. optionMergeStrategies: Object.create(null),
  7736. /**
  7737. * Whether to suppress warnings.
  7738. */
  7739. silent: false,
  7740. /**
  7741. * Whether to enable devtools
  7742. */
  7743. devtools: process.env.NODE_ENV !== 'production',
  7744. /**
  7745. * Error handler for watcher errors
  7746. */
  7747. errorHandler: null,
  7748. /**
  7749. * Ignore certain custom elements
  7750. */
  7751. ignoredElements: null,
  7752. /**
  7753. * Custom user key aliases for v-on
  7754. */
  7755. keyCodes: Object.create(null),
  7756. /**
  7757. * Check if a tag is reserved so that it cannot be registered as a
  7758. * component. This is platform-dependent and may be overwritten.
  7759. */
  7760. isReservedTag: no,
  7761. /**
  7762. * Check if a tag is an unknown element.
  7763. * Platform-dependent.
  7764. */
  7765. isUnknownElement: no,
  7766. /**
  7767. * Get the namespace of an element
  7768. */
  7769. getTagNamespace: noop,
  7770. /**
  7771. * Check if an attribute must be bound using property, e.g. value
  7772. * Platform-dependent.
  7773. */
  7774. mustUseProp: no,
  7775. /**
  7776. * List of asset types that a component can own.
  7777. */
  7778. _assetTypes: [
  7779. 'component',
  7780. 'directive',
  7781. 'filter'
  7782. ],
  7783. /**
  7784. * List of lifecycle hooks.
  7785. */
  7786. _lifecycleHooks: [
  7787. 'beforeCreate',
  7788. 'created',
  7789. 'beforeMount',
  7790. 'mounted',
  7791. 'beforeUpdate',
  7792. 'updated',
  7793. 'beforeDestroy',
  7794. 'destroyed',
  7795. 'activated',
  7796. 'deactivated'
  7797. ],
  7798. /**
  7799. * Max circular updates allowed in a scheduler flush cycle.
  7800. */
  7801. _maxUpdateCount: 100,
  7802. /**
  7803. * Server rendering?
  7804. */
  7805. _isServer: process.env.VUE_ENV === 'server'
  7806. };
  7807. /* */
  7808. /**
  7809. * Check if a string starts with $ or _
  7810. */
  7811. function isReserved (str) {
  7812. var c = (str + '').charCodeAt(0);
  7813. return c === 0x24 || c === 0x5F
  7814. }
  7815. /**
  7816. * Define a property.
  7817. */
  7818. function def (obj, key, val, enumerable) {
  7819. Object.defineProperty(obj, key, {
  7820. value: val,
  7821. enumerable: !!enumerable,
  7822. writable: true,
  7823. configurable: true
  7824. });
  7825. }
  7826. /**
  7827. * Parse simple path.
  7828. */
  7829. var bailRE = /[^\w\.\$]/;
  7830. function parsePath (path) {
  7831. if (bailRE.test(path)) {
  7832. return
  7833. } else {
  7834. var segments = path.split('.');
  7835. return function (obj) {
  7836. for (var i = 0; i < segments.length; i++) {
  7837. if (!obj) { return }
  7838. obj = obj[segments[i]];
  7839. }
  7840. return obj
  7841. }
  7842. }
  7843. }
  7844. /* */
  7845. /* globals MutationObserver */
  7846. // can we use __proto__?
  7847. var hasProto = '__proto__' in {};
  7848. // Browser environment sniffing
  7849. var inBrowser =
  7850. typeof window !== 'undefined' &&
  7851. Object.prototype.toString.call(window) !== '[object Object]';
  7852. var UA = inBrowser && window.navigator.userAgent.toLowerCase();
  7853. var isIE = UA && /msie|trident/.test(UA);
  7854. var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
  7855. var isEdge = UA && UA.indexOf('edge/') > 0;
  7856. var isAndroid = UA && UA.indexOf('android') > 0;
  7857. var isIOS = UA && /iphone|ipad|ipod|ios/.test(UA);
  7858. // detect devtools
  7859. var devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__;
  7860. /* istanbul ignore next */
  7861. function isNative (Ctor) {
  7862. return /native code/.test(Ctor.toString())
  7863. }
  7864. /**
  7865. * Defer a task to execute it asynchronously.
  7866. */
  7867. var nextTick = (function () {
  7868. var callbacks = [];
  7869. var pending = false;
  7870. var timerFunc;
  7871. function nextTickHandler () {
  7872. pending = false;
  7873. var copies = callbacks.slice(0);
  7874. callbacks.length = 0;
  7875. for (var i = 0; i < copies.length; i++) {
  7876. copies[i]();
  7877. }
  7878. }
  7879. // the nextTick behavior leverages the microtask queue, which can be accessed
  7880. // via either native Promise.then or MutationObserver.
  7881. // MutationObserver has wider support, however it is seriously bugged in
  7882. // UIWebView in iOS >= 9.3.3 when triggered in touch event handlers. It
  7883. // completely stops working after triggering a few times... so, if native
  7884. // Promise is available, we will use it:
  7885. /* istanbul ignore if */
  7886. if (typeof Promise !== 'undefined' && isNative(Promise)) {
  7887. var p = Promise.resolve();
  7888. timerFunc = function () {
  7889. p.then(nextTickHandler);
  7890. // in problematic UIWebViews, Promise.then doesn't completely break, but
  7891. // it can get stuck in a weird state where callbacks are pushed into the
  7892. // microtask queue but the queue isn't being flushed, until the browser
  7893. // needs to do some other work, e.g. handle a timer. Therefore we can
  7894. // "force" the microtask queue to be flushed by adding an empty timer.
  7895. if (isIOS) { setTimeout(noop); }
  7896. };
  7897. } else if (typeof MutationObserver !== 'undefined' && (
  7898. isNative(MutationObserver) ||
  7899. // PhantomJS and iOS 7.x
  7900. MutationObserver.toString() === '[object MutationObserverConstructor]'
  7901. )) {
  7902. // use MutationObserver where native Promise is not available,
  7903. // e.g. PhantomJS IE11, iOS7, Android 4.4
  7904. var counter = 1;
  7905. var observer = new MutationObserver(nextTickHandler);
  7906. var textNode = document.createTextNode(String(counter));
  7907. observer.observe(textNode, {
  7908. characterData: true
  7909. });
  7910. timerFunc = function () {
  7911. counter = (counter + 1) % 2;
  7912. textNode.data = String(counter);
  7913. };
  7914. } else {
  7915. // fallback to setTimeout
  7916. /* istanbul ignore next */
  7917. timerFunc = function () {
  7918. setTimeout(nextTickHandler, 0);
  7919. };
  7920. }
  7921. return function queueNextTick (cb, ctx) {
  7922. var func = ctx
  7923. ? function () { cb.call(ctx); }
  7924. : cb;
  7925. callbacks.push(func);
  7926. if (!pending) {
  7927. pending = true;
  7928. timerFunc();
  7929. }
  7930. }
  7931. })();
  7932. var _Set;
  7933. /* istanbul ignore if */
  7934. if (typeof Set !== 'undefined' && isNative(Set)) {
  7935. // use native Set when available.
  7936. _Set = Set;
  7937. } else {
  7938. // a non-standard Set polyfill that only works with primitive keys.
  7939. _Set = (function () {
  7940. function Set () {
  7941. this.set = Object.create(null);
  7942. }
  7943. Set.prototype.has = function has (key) {
  7944. return this.set[key] !== undefined
  7945. };
  7946. Set.prototype.add = function add (key) {
  7947. this.set[key] = 1;
  7948. };
  7949. Set.prototype.clear = function clear () {
  7950. this.set = Object.create(null);
  7951. };
  7952. return Set;
  7953. }());
  7954. }
  7955. /* not type checking this file because flow doesn't play well with Proxy */
  7956. var hasProxy;
  7957. var proxyHandlers;
  7958. var initProxy;
  7959. if (process.env.NODE_ENV !== 'production') {
  7960. var allowedGlobals = makeMap(
  7961. 'Infinity,undefined,NaN,isFinite,isNaN,' +
  7962. 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
  7963. 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
  7964. 'require' // for Webpack/Browserify
  7965. );
  7966. hasProxy =
  7967. typeof Proxy !== 'undefined' &&
  7968. Proxy.toString().match(/native code/);
  7969. proxyHandlers = {
  7970. has: function has (target, key) {
  7971. var has = key in target;
  7972. var isAllowed = allowedGlobals(key) || key.charAt(0) === '_';
  7973. if (!has && !isAllowed) {
  7974. warn(
  7975. "Property or method \"" + key + "\" is not defined on the instance but " +
  7976. "referenced during render. Make sure to declare reactive data " +
  7977. "properties in the data option.",
  7978. target
  7979. );
  7980. }
  7981. return has || !isAllowed
  7982. }
  7983. };
  7984. initProxy = function initProxy (vm) {
  7985. if (hasProxy) {
  7986. vm._renderProxy = new Proxy(vm, proxyHandlers);
  7987. } else {
  7988. vm._renderProxy = vm;
  7989. }
  7990. };
  7991. }
  7992. /* */
  7993. var uid$2 = 0;
  7994. /**
  7995. * A dep is an observable that can have multiple
  7996. * directives subscribing to it.
  7997. */
  7998. var Dep = function Dep () {
  7999. this.id = uid$2++;
  8000. this.subs = [];
  8001. };
  8002. Dep.prototype.addSub = function addSub (sub) {
  8003. this.subs.push(sub);
  8004. };
  8005. Dep.prototype.removeSub = function removeSub (sub) {
  8006. remove$1(this.subs, sub);
  8007. };
  8008. Dep.prototype.depend = function depend () {
  8009. if (Dep.target) {
  8010. Dep.target.addDep(this);
  8011. }
  8012. };
  8013. Dep.prototype.notify = function notify () {
  8014. // stablize the subscriber list first
  8015. var subs = this.subs.slice();
  8016. for (var i = 0, l = subs.length; i < l; i++) {
  8017. subs[i].update();
  8018. }
  8019. };
  8020. // the current target watcher being evaluated.
  8021. // this is globally unique because there could be only one
  8022. // watcher being evaluated at any time.
  8023. Dep.target = null;
  8024. var targetStack = [];
  8025. function pushTarget (_target) {
  8026. if (Dep.target) { targetStack.push(Dep.target); }
  8027. Dep.target = _target;
  8028. }
  8029. function popTarget () {
  8030. Dep.target = targetStack.pop();
  8031. }
  8032. /* */
  8033. var queue = [];
  8034. var has$1 = {};
  8035. var circular = {};
  8036. var waiting = false;
  8037. var flushing = false;
  8038. var index = 0;
  8039. /**
  8040. * Reset the scheduler's state.
  8041. */
  8042. function resetSchedulerState () {
  8043. queue.length = 0;
  8044. has$1 = {};
  8045. if (process.env.NODE_ENV !== 'production') {
  8046. circular = {};
  8047. }
  8048. waiting = flushing = false;
  8049. }
  8050. /**
  8051. * Flush both queues and run the watchers.
  8052. */
  8053. function flushSchedulerQueue () {
  8054. flushing = true;
  8055. // Sort queue before flush.
  8056. // This ensures that:
  8057. // 1. Components are updated from parent to child. (because parent is always
  8058. // created before the child)
  8059. // 2. A component's user watchers are run before its render watcher (because
  8060. // user watchers are created before the render watcher)
  8061. // 3. If a component is destroyed during a parent component's watcher run,
  8062. // its watchers can be skipped.
  8063. queue.sort(function (a, b) { return a.id - b.id; });
  8064. // do not cache length because more watchers might be pushed
  8065. // as we run existing watchers
  8066. for (index = 0; index < queue.length; index++) {
  8067. var watcher = queue[index];
  8068. var id = watcher.id;
  8069. has$1[id] = null;
  8070. watcher.run();
  8071. // in dev build, check and stop circular updates.
  8072. if (process.env.NODE_ENV !== 'production' && has$1[id] != null) {
  8073. circular[id] = (circular[id] || 0) + 1;
  8074. if (circular[id] > config._maxUpdateCount) {
  8075. warn(
  8076. 'You may have an infinite update loop ' + (
  8077. watcher.user
  8078. ? ("in watcher with expression \"" + (watcher.expression) + "\"")
  8079. : "in a component render function."
  8080. ),
  8081. watcher.vm
  8082. );
  8083. break
  8084. }
  8085. }
  8086. }
  8087. // devtool hook
  8088. /* istanbul ignore if */
  8089. if (devtools && config.devtools) {
  8090. devtools.emit('flush');
  8091. }
  8092. resetSchedulerState();
  8093. }
  8094. /**
  8095. * Push a watcher into the watcher queue.
  8096. * Jobs with duplicate IDs will be skipped unless it's
  8097. * pushed when the queue is being flushed.
  8098. */
  8099. function queueWatcher (watcher) {
  8100. var id = watcher.id;
  8101. if (has$1[id] == null) {
  8102. has$1[id] = true;
  8103. if (!flushing) {
  8104. queue.push(watcher);
  8105. } else {
  8106. // if already flushing, splice the watcher based on its id
  8107. // if already past its id, it will be run next immediately.
  8108. var i = queue.length - 1;
  8109. while (i >= 0 && queue[i].id > watcher.id) {
  8110. i--;
  8111. }
  8112. queue.splice(Math.max(i, index) + 1, 0, watcher);
  8113. }
  8114. // queue the flush
  8115. if (!waiting) {
  8116. waiting = true;
  8117. nextTick(flushSchedulerQueue);
  8118. }
  8119. }
  8120. }
  8121. /* */
  8122. var uid$1 = 0;
  8123. /**
  8124. * A watcher parses an expression, collects dependencies,
  8125. * and fires callback when the expression value changes.
  8126. * This is used for both the $watch() api and directives.
  8127. */
  8128. var Watcher = function Watcher (
  8129. vm,
  8130. expOrFn,
  8131. cb,
  8132. options
  8133. ) {
  8134. if ( options === void 0 ) options = {};
  8135. this.vm = vm;
  8136. vm._watchers.push(this);
  8137. // options
  8138. this.deep = !!options.deep;
  8139. this.user = !!options.user;
  8140. this.lazy = !!options.lazy;
  8141. this.sync = !!options.sync;
  8142. this.expression = expOrFn.toString();
  8143. this.cb = cb;
  8144. this.id = ++uid$1; // uid for batching
  8145. this.active = true;
  8146. this.dirty = this.lazy; // for lazy watchers
  8147. this.deps = [];
  8148. this.newDeps = [];
  8149. this.depIds = new _Set();
  8150. this.newDepIds = new _Set();
  8151. // parse expression for getter
  8152. if (typeof expOrFn === 'function') {
  8153. this.getter = expOrFn;
  8154. } else {
  8155. this.getter = parsePath(expOrFn);
  8156. if (!this.getter) {
  8157. this.getter = function () {};
  8158. process.env.NODE_ENV !== 'production' && warn(
  8159. "Failed watching path: \"" + expOrFn + "\" " +
  8160. 'Watcher only accepts simple dot-delimited paths. ' +
  8161. 'For full control, use a function instead.',
  8162. vm
  8163. );
  8164. }
  8165. }
  8166. this.value = this.lazy
  8167. ? undefined
  8168. : this.get();
  8169. };
  8170. /**
  8171. * Evaluate the getter, and re-collect dependencies.
  8172. */
  8173. Watcher.prototype.get = function get () {
  8174. pushTarget(this);
  8175. var value = this.getter.call(this.vm, this.vm);
  8176. // "touch" every property so they are all tracked as
  8177. // dependencies for deep watching
  8178. if (this.deep) {
  8179. traverse(value);
  8180. }
  8181. popTarget();
  8182. this.cleanupDeps();
  8183. return value
  8184. };
  8185. /**
  8186. * Add a dependency to this directive.
  8187. */
  8188. Watcher.prototype.addDep = function addDep (dep) {
  8189. var id = dep.id;
  8190. if (!this.newDepIds.has(id)) {
  8191. this.newDepIds.add(id);
  8192. this.newDeps.push(dep);
  8193. if (!this.depIds.has(id)) {
  8194. dep.addSub(this);
  8195. }
  8196. }
  8197. };
  8198. /**
  8199. * Clean up for dependency collection.
  8200. */
  8201. Watcher.prototype.cleanupDeps = function cleanupDeps () {
  8202. var this$1 = this;
  8203. var i = this.deps.length;
  8204. while (i--) {
  8205. var dep = this$1.deps[i];
  8206. if (!this$1.newDepIds.has(dep.id)) {
  8207. dep.removeSub(this$1);
  8208. }
  8209. }
  8210. var tmp = this.depIds;
  8211. this.depIds = this.newDepIds;
  8212. this.newDepIds = tmp;
  8213. this.newDepIds.clear();
  8214. tmp = this.deps;
  8215. this.deps = this.newDeps;
  8216. this.newDeps = tmp;
  8217. this.newDeps.length = 0;
  8218. };
  8219. /**
  8220. * Subscriber interface.
  8221. * Will be called when a dependency changes.
  8222. */
  8223. Watcher.prototype.update = function update () {
  8224. /* istanbul ignore else */
  8225. if (this.lazy) {
  8226. this.dirty = true;
  8227. } else if (this.sync) {
  8228. this.run();
  8229. } else {
  8230. queueWatcher(this);
  8231. }
  8232. };
  8233. /**
  8234. * Scheduler job interface.
  8235. * Will be called by the scheduler.
  8236. */
  8237. Watcher.prototype.run = function run () {
  8238. if (this.active) {
  8239. var value = this.get();
  8240. if (
  8241. value !== this.value ||
  8242. // Deep watchers and watchers on Object/Arrays should fire even
  8243. // when the value is the same, because the value may
  8244. // have mutated.
  8245. isObject(value) ||
  8246. this.deep
  8247. ) {
  8248. // set new value
  8249. var oldValue = this.value;
  8250. this.value = value;
  8251. if (this.user) {
  8252. try {
  8253. this.cb.call(this.vm, value, oldValue);
  8254. } catch (e) {
  8255. process.env.NODE_ENV !== 'production' && warn(
  8256. ("Error in watcher \"" + (this.expression) + "\""),
  8257. this.vm
  8258. );
  8259. /* istanbul ignore else */
  8260. if (config.errorHandler) {
  8261. config.errorHandler.call(null, e, this.vm);
  8262. } else {
  8263. throw e
  8264. }
  8265. }
  8266. } else {
  8267. this.cb.call(this.vm, value, oldValue);
  8268. }
  8269. }
  8270. }
  8271. };
  8272. /**
  8273. * Evaluate the value of the watcher.
  8274. * This only gets called for lazy watchers.
  8275. */
  8276. Watcher.prototype.evaluate = function evaluate () {
  8277. this.value = this.get();
  8278. this.dirty = false;
  8279. };
  8280. /**
  8281. * Depend on all deps collected by this watcher.
  8282. */
  8283. Watcher.prototype.depend = function depend () {
  8284. var this$1 = this;
  8285. var i = this.deps.length;
  8286. while (i--) {
  8287. this$1.deps[i].depend();
  8288. }
  8289. };
  8290. /**
  8291. * Remove self from all dependencies' subcriber list.
  8292. */
  8293. Watcher.prototype.teardown = function teardown () {
  8294. var this$1 = this;
  8295. if (this.active) {
  8296. // remove self from vm's watcher list
  8297. // this is a somewhat expensive operation so we skip it
  8298. // if the vm is being destroyed or is performing a v-for
  8299. // re-render (the watcher list is then filtered by v-for).
  8300. if (!this.vm._isBeingDestroyed && !this.vm._vForRemoving) {
  8301. remove$1(this.vm._watchers, this);
  8302. }
  8303. var i = this.deps.length;
  8304. while (i--) {
  8305. this$1.deps[i].removeSub(this$1);
  8306. }
  8307. this.active = false;
  8308. }
  8309. };
  8310. /**
  8311. * Recursively traverse an object to evoke all converted
  8312. * getters, so that every nested property inside the object
  8313. * is collected as a "deep" dependency.
  8314. */
  8315. var seenObjects = new _Set();
  8316. function traverse (val, seen) {
  8317. var i, keys;
  8318. if (!seen) {
  8319. seen = seenObjects;
  8320. seen.clear();
  8321. }
  8322. var isA = Array.isArray(val);
  8323. var isO = isObject(val);
  8324. if ((isA || isO) && Object.isExtensible(val)) {
  8325. if (val.__ob__) {
  8326. var depId = val.__ob__.dep.id;
  8327. if (seen.has(depId)) {
  8328. return
  8329. } else {
  8330. seen.add(depId);
  8331. }
  8332. }
  8333. if (isA) {
  8334. i = val.length;
  8335. while (i--) { traverse(val[i], seen); }
  8336. } else if (isO) {
  8337. keys = Object.keys(val);
  8338. i = keys.length;
  8339. while (i--) { traverse(val[keys[i]], seen); }
  8340. }
  8341. }
  8342. }
  8343. /*
  8344. * not type checking this file because flow doesn't play well with
  8345. * dynamically accessing methods on Array prototype
  8346. */
  8347. var arrayProto = Array.prototype;
  8348. var arrayMethods = Object.create(arrayProto);[
  8349. 'push',
  8350. 'pop',
  8351. 'shift',
  8352. 'unshift',
  8353. 'splice',
  8354. 'sort',
  8355. 'reverse'
  8356. ]
  8357. .forEach(function (method) {
  8358. // cache original method
  8359. var original = arrayProto[method];
  8360. def(arrayMethods, method, function mutator () {
  8361. var arguments$1 = arguments;
  8362. // avoid leaking arguments:
  8363. // http://jsperf.com/closure-with-arguments
  8364. var i = arguments.length;
  8365. var args = new Array(i);
  8366. while (i--) {
  8367. args[i] = arguments$1[i];
  8368. }
  8369. var result = original.apply(this, args);
  8370. var ob = this.__ob__;
  8371. var inserted;
  8372. switch (method) {
  8373. case 'push':
  8374. inserted = args;
  8375. break
  8376. case 'unshift':
  8377. inserted = args;
  8378. break
  8379. case 'splice':
  8380. inserted = args.slice(2);
  8381. break
  8382. }
  8383. if (inserted) { ob.observeArray(inserted); }
  8384. // notify change
  8385. ob.dep.notify();
  8386. return result
  8387. });
  8388. });
  8389. /* */
  8390. var arrayKeys = Object.getOwnPropertyNames(arrayMethods);
  8391. /**
  8392. * By default, when a reactive property is set, the new value is
  8393. * also converted to become reactive. However when passing down props,
  8394. * we don't want to force conversion because the value may be a nested value
  8395. * under a frozen data structure. Converting it would defeat the optimization.
  8396. */
  8397. var observerState = {
  8398. shouldConvert: true,
  8399. isSettingProps: false
  8400. };
  8401. /**
  8402. * Observer class that are attached to each observed
  8403. * object. Once attached, the observer converts target
  8404. * object's property keys into getter/setters that
  8405. * collect dependencies and dispatches updates.
  8406. */
  8407. var Observer = function Observer (value) {
  8408. this.value = value;
  8409. this.dep = new Dep();
  8410. this.vmCount = 0;
  8411. def(value, '__ob__', this);
  8412. if (Array.isArray(value)) {
  8413. var augment = hasProto
  8414. ? protoAugment
  8415. : copyAugment;
  8416. augment(value, arrayMethods, arrayKeys);
  8417. this.observeArray(value);
  8418. } else {
  8419. this.walk(value);
  8420. }
  8421. };
  8422. /**
  8423. * Walk through each property and convert them into
  8424. * getter/setters. This method should only be called when
  8425. * value type is Object.
  8426. */
  8427. Observer.prototype.walk = function walk (obj) {
  8428. var keys = Object.keys(obj);
  8429. for (var i = 0; i < keys.length; i++) {
  8430. defineReactive$$1(obj, keys[i], obj[keys[i]]);
  8431. }
  8432. };
  8433. /**
  8434. * Observe a list of Array items.
  8435. */
  8436. Observer.prototype.observeArray = function observeArray (items) {
  8437. for (var i = 0, l = items.length; i < l; i++) {
  8438. observe(items[i]);
  8439. }
  8440. };
  8441. // helpers
  8442. /**
  8443. * Augment an target Object or Array by intercepting
  8444. * the prototype chain using __proto__
  8445. */
  8446. function protoAugment (target, src) {
  8447. /* eslint-disable no-proto */
  8448. target.__proto__ = src;
  8449. /* eslint-enable no-proto */
  8450. }
  8451. /**
  8452. * Augment an target Object or Array by defining
  8453. * hidden properties.
  8454. *
  8455. * istanbul ignore next
  8456. */
  8457. function copyAugment (target, src, keys) {
  8458. for (var i = 0, l = keys.length; i < l; i++) {
  8459. var key = keys[i];
  8460. def(target, key, src[key]);
  8461. }
  8462. }
  8463. /**
  8464. * Attempt to create an observer instance for a value,
  8465. * returns the new observer if successfully observed,
  8466. * or the existing observer if the value already has one.
  8467. */
  8468. function observe (value) {
  8469. if (!isObject(value)) {
  8470. return
  8471. }
  8472. var ob;
  8473. if (hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) {
  8474. ob = value.__ob__;
  8475. } else if (
  8476. observerState.shouldConvert &&
  8477. !config._isServer &&
  8478. (Array.isArray(value) || isPlainObject(value)) &&
  8479. Object.isExtensible(value) &&
  8480. !value._isVue
  8481. ) {
  8482. ob = new Observer(value);
  8483. }
  8484. return ob
  8485. }
  8486. /**
  8487. * Define a reactive property on an Object.
  8488. */
  8489. function defineReactive$$1 (
  8490. obj,
  8491. key,
  8492. val,
  8493. customSetter
  8494. ) {
  8495. var dep = new Dep();
  8496. var property = Object.getOwnPropertyDescriptor(obj, key);
  8497. if (property && property.configurable === false) {
  8498. return
  8499. }
  8500. // cater for pre-defined getter/setters
  8501. var getter = property && property.get;
  8502. var setter = property && property.set;
  8503. var childOb = observe(val);
  8504. Object.defineProperty(obj, key, {
  8505. enumerable: true,
  8506. configurable: true,
  8507. get: function reactiveGetter () {
  8508. var value = getter ? getter.call(obj) : val;
  8509. if (Dep.target) {
  8510. dep.depend();
  8511. if (childOb) {
  8512. childOb.dep.depend();
  8513. }
  8514. if (Array.isArray(value)) {
  8515. dependArray(value);
  8516. }
  8517. }
  8518. return value
  8519. },
  8520. set: function reactiveSetter (newVal) {
  8521. var value = getter ? getter.call(obj) : val;
  8522. if (newVal === value) {
  8523. return
  8524. }
  8525. if (process.env.NODE_ENV !== 'production' && customSetter) {
  8526. customSetter();
  8527. }
  8528. if (setter) {
  8529. setter.call(obj, newVal);
  8530. } else {
  8531. val = newVal;
  8532. }
  8533. childOb = observe(newVal);
  8534. dep.notify();
  8535. }
  8536. });
  8537. }
  8538. /**
  8539. * Set a property on an object. Adds the new property and
  8540. * triggers change notification if the property doesn't
  8541. * already exist.
  8542. */
  8543. function set (obj, key, val) {
  8544. if (Array.isArray(obj)) {
  8545. obj.splice(key, 1, val);
  8546. return val
  8547. }
  8548. if (hasOwn(obj, key)) {
  8549. obj[key] = val;
  8550. return
  8551. }
  8552. var ob = obj.__ob__;
  8553. if (obj._isVue || (ob && ob.vmCount)) {
  8554. process.env.NODE_ENV !== 'production' && warn(
  8555. 'Avoid adding reactive properties to a Vue instance or its root $data ' +
  8556. 'at runtime - declare it upfront in the data option.'
  8557. );
  8558. return
  8559. }
  8560. if (!ob) {
  8561. obj[key] = val;
  8562. return
  8563. }
  8564. defineReactive$$1(ob.value, key, val);
  8565. ob.dep.notify();
  8566. return val
  8567. }
  8568. /**
  8569. * Delete a property and trigger change if necessary.
  8570. */
  8571. function del (obj, key) {
  8572. var ob = obj.__ob__;
  8573. if (obj._isVue || (ob && ob.vmCount)) {
  8574. process.env.NODE_ENV !== 'production' && warn(
  8575. 'Avoid deleting properties on a Vue instance or its root $data ' +
  8576. '- just set it to null.'
  8577. );
  8578. return
  8579. }
  8580. if (!hasOwn(obj, key)) {
  8581. return
  8582. }
  8583. delete obj[key];
  8584. if (!ob) {
  8585. return
  8586. }
  8587. ob.dep.notify();
  8588. }
  8589. /**
  8590. * Collect dependencies on array elements when the array is touched, since
  8591. * we cannot intercept array element access like property getters.
  8592. */
  8593. function dependArray (value) {
  8594. for (var e = void 0, i = 0, l = value.length; i < l; i++) {
  8595. e = value[i];
  8596. e && e.__ob__ && e.__ob__.dep.depend();
  8597. if (Array.isArray(e)) {
  8598. dependArray(e);
  8599. }
  8600. }
  8601. }
  8602. /* */
  8603. function initState (vm) {
  8604. vm._watchers = [];
  8605. initProps(vm);
  8606. initData(vm);
  8607. initComputed(vm);
  8608. initMethods(vm);
  8609. initWatch(vm);
  8610. }
  8611. function initProps (vm) {
  8612. var props = vm.$options.props;
  8613. if (props) {
  8614. var propsData = vm.$options.propsData || {};
  8615. var keys = vm.$options._propKeys = Object.keys(props);
  8616. var isRoot = !vm.$parent;
  8617. // root instance props should be converted
  8618. observerState.shouldConvert = isRoot;
  8619. var loop = function ( i ) {
  8620. var key = keys[i];
  8621. /* istanbul ignore else */
  8622. if (process.env.NODE_ENV !== 'production') {
  8623. defineReactive$$1(vm, key, validateProp(key, props, propsData, vm), function () {
  8624. if (vm.$parent && !observerState.isSettingProps) {
  8625. warn(
  8626. "Avoid mutating a prop directly since the value will be " +
  8627. "overwritten whenever the parent component re-renders. " +
  8628. "Instead, use a data or computed property based on the prop's " +
  8629. "value. Prop being mutated: \"" + key + "\"",
  8630. vm
  8631. );
  8632. }
  8633. });
  8634. } else {
  8635. defineReactive$$1(vm, key, validateProp(key, props, propsData, vm));
  8636. }
  8637. };
  8638. for (var i = 0; i < keys.length; i++) loop( i );
  8639. observerState.shouldConvert = true;
  8640. }
  8641. }
  8642. function initData (vm) {
  8643. var data = vm.$options.data;
  8644. data = vm._data = typeof data === 'function'
  8645. ? data.call(vm)
  8646. : data || {};
  8647. if (!isPlainObject(data)) {
  8648. data = {};
  8649. process.env.NODE_ENV !== 'production' && warn(
  8650. 'data functions should return an object.',
  8651. vm
  8652. );
  8653. }
  8654. // proxy data on instance
  8655. var keys = Object.keys(data);
  8656. var props = vm.$options.props;
  8657. var i = keys.length;
  8658. while (i--) {
  8659. if (props && hasOwn(props, keys[i])) {
  8660. process.env.NODE_ENV !== 'production' && warn(
  8661. "The data property \"" + (keys[i]) + "\" is already declared as a prop. " +
  8662. "Use prop default value instead.",
  8663. vm
  8664. );
  8665. } else {
  8666. proxy(vm, keys[i]);
  8667. }
  8668. }
  8669. // observe data
  8670. observe(data);
  8671. data.__ob__ && data.__ob__.vmCount++;
  8672. }
  8673. var computedSharedDefinition = {
  8674. enumerable: true,
  8675. configurable: true,
  8676. get: noop,
  8677. set: noop
  8678. };
  8679. function initComputed (vm) {
  8680. var computed = vm.$options.computed;
  8681. if (computed) {
  8682. for (var key in computed) {
  8683. var userDef = computed[key];
  8684. if (typeof userDef === 'function') {
  8685. computedSharedDefinition.get = makeComputedGetter(userDef, vm);
  8686. computedSharedDefinition.set = noop;
  8687. } else {
  8688. computedSharedDefinition.get = userDef.get
  8689. ? userDef.cache !== false
  8690. ? makeComputedGetter(userDef.get, vm)
  8691. : bind$1(userDef.get, vm)
  8692. : noop;
  8693. computedSharedDefinition.set = userDef.set
  8694. ? bind$1(userDef.set, vm)
  8695. : noop;
  8696. }
  8697. Object.defineProperty(vm, key, computedSharedDefinition);
  8698. }
  8699. }
  8700. }
  8701. function makeComputedGetter (getter, owner) {
  8702. var watcher = new Watcher(owner, getter, noop, {
  8703. lazy: true
  8704. });
  8705. return function computedGetter () {
  8706. if (watcher.dirty) {
  8707. watcher.evaluate();
  8708. }
  8709. if (Dep.target) {
  8710. watcher.depend();
  8711. }
  8712. return watcher.value
  8713. }
  8714. }
  8715. function initMethods (vm) {
  8716. var methods = vm.$options.methods;
  8717. if (methods) {
  8718. for (var key in methods) {
  8719. vm[key] = methods[key] == null ? noop : bind$1(methods[key], vm);
  8720. if (process.env.NODE_ENV !== 'production' && methods[key] == null) {
  8721. warn(
  8722. "method \"" + key + "\" has an undefined value in the component definition. " +
  8723. "Did you reference the function correctly?",
  8724. vm
  8725. );
  8726. }
  8727. }
  8728. }
  8729. }
  8730. function initWatch (vm) {
  8731. var watch = vm.$options.watch;
  8732. if (watch) {
  8733. for (var key in watch) {
  8734. var handler = watch[key];
  8735. if (Array.isArray(handler)) {
  8736. for (var i = 0; i < handler.length; i++) {
  8737. createWatcher(vm, key, handler[i]);
  8738. }
  8739. } else {
  8740. createWatcher(vm, key, handler);
  8741. }
  8742. }
  8743. }
  8744. }
  8745. function createWatcher (vm, key, handler) {
  8746. var options;
  8747. if (isPlainObject(handler)) {
  8748. options = handler;
  8749. handler = handler.handler;
  8750. }
  8751. if (typeof handler === 'string') {
  8752. handler = vm[handler];
  8753. }
  8754. vm.$watch(key, handler, options);
  8755. }
  8756. function stateMixin (Vue) {
  8757. // flow somehow has problems with directly declared definition object
  8758. // when using Object.defineProperty, so we have to procedurally build up
  8759. // the object here.
  8760. var dataDef = {};
  8761. dataDef.get = function () {
  8762. return this._data
  8763. };
  8764. if (process.env.NODE_ENV !== 'production') {
  8765. dataDef.set = function (newData) {
  8766. warn(
  8767. 'Avoid replacing instance root $data. ' +
  8768. 'Use nested data properties instead.',
  8769. this
  8770. );
  8771. };
  8772. }
  8773. Object.defineProperty(Vue.prototype, '$data', dataDef);
  8774. Vue.prototype.$set = set;
  8775. Vue.prototype.$delete = del;
  8776. Vue.prototype.$watch = function (
  8777. expOrFn,
  8778. cb,
  8779. options
  8780. ) {
  8781. var vm = this;
  8782. options = options || {};
  8783. options.user = true;
  8784. var watcher = new Watcher(vm, expOrFn, cb, options);
  8785. if (options.immediate) {
  8786. cb.call(vm, watcher.value);
  8787. }
  8788. return function unwatchFn () {
  8789. watcher.teardown();
  8790. }
  8791. };
  8792. }
  8793. function proxy (vm, key) {
  8794. if (!isReserved(key)) {
  8795. Object.defineProperty(vm, key, {
  8796. configurable: true,
  8797. enumerable: true,
  8798. get: function proxyGetter () {
  8799. return vm._data[key]
  8800. },
  8801. set: function proxySetter (val) {
  8802. vm._data[key] = val;
  8803. }
  8804. });
  8805. }
  8806. }
  8807. /* */
  8808. var VNode = function VNode (
  8809. tag,
  8810. data,
  8811. children,
  8812. text,
  8813. elm,
  8814. ns,
  8815. context,
  8816. componentOptions
  8817. ) {
  8818. this.tag = tag;
  8819. this.data = data;
  8820. this.children = children;
  8821. this.text = text;
  8822. this.elm = elm;
  8823. this.ns = ns;
  8824. this.context = context;
  8825. this.functionalContext = undefined;
  8826. this.key = data && data.key;
  8827. this.componentOptions = componentOptions;
  8828. this.child = undefined;
  8829. this.parent = undefined;
  8830. this.raw = false;
  8831. this.isStatic = false;
  8832. this.isRootInsert = true;
  8833. this.isComment = false;
  8834. this.isCloned = false;
  8835. };
  8836. var emptyVNode = function () {
  8837. var node = new VNode();
  8838. node.text = '';
  8839. node.isComment = true;
  8840. return node
  8841. };
  8842. // optimized shallow clone
  8843. // used for static nodes and slot nodes because they may be reused across
  8844. // multiple renders, cloning them avoids errors when DOM manipulations rely
  8845. // on their elm reference.
  8846. function cloneVNode (vnode) {
  8847. var cloned = new VNode(
  8848. vnode.tag,
  8849. vnode.data,
  8850. vnode.children,
  8851. vnode.text,
  8852. vnode.elm,
  8853. vnode.ns,
  8854. vnode.context,
  8855. vnode.componentOptions
  8856. );
  8857. cloned.isStatic = vnode.isStatic;
  8858. cloned.key = vnode.key;
  8859. cloned.isCloned = true;
  8860. return cloned
  8861. }
  8862. function cloneVNodes (vnodes) {
  8863. var res = new Array(vnodes.length);
  8864. for (var i = 0; i < vnodes.length; i++) {
  8865. res[i] = cloneVNode(vnodes[i]);
  8866. }
  8867. return res
  8868. }
  8869. /* */
  8870. function mergeVNodeHook (def, hookKey, hook, key) {
  8871. key = key + hookKey;
  8872. var injectedHash = def.__injected || (def.__injected = {});
  8873. if (!injectedHash[key]) {
  8874. injectedHash[key] = true;
  8875. var oldHook = def[hookKey];
  8876. if (oldHook) {
  8877. def[hookKey] = function () {
  8878. oldHook.apply(this, arguments);
  8879. hook.apply(this, arguments);
  8880. };
  8881. } else {
  8882. def[hookKey] = hook;
  8883. }
  8884. }
  8885. }
  8886. /* */
  8887. function updateListeners (
  8888. on,
  8889. oldOn,
  8890. add,
  8891. remove$$1,
  8892. vm
  8893. ) {
  8894. var name, cur, old, fn, event, capture;
  8895. for (name in on) {
  8896. cur = on[name];
  8897. old = oldOn[name];
  8898. if (!cur) {
  8899. process.env.NODE_ENV !== 'production' && warn(
  8900. "Invalid handler for event \"" + name + "\": got " + String(cur),
  8901. vm
  8902. );
  8903. } else if (!old) {
  8904. capture = name.charAt(0) === '!';
  8905. event = capture ? name.slice(1) : name;
  8906. if (Array.isArray(cur)) {
  8907. add(event, (cur.invoker = arrInvoker(cur)), capture);
  8908. } else {
  8909. if (!cur.invoker) {
  8910. fn = cur;
  8911. cur = on[name] = {};
  8912. cur.fn = fn;
  8913. cur.invoker = fnInvoker(cur);
  8914. }
  8915. add(event, cur.invoker, capture);
  8916. }
  8917. } else if (cur !== old) {
  8918. if (Array.isArray(old)) {
  8919. old.length = cur.length;
  8920. for (var i = 0; i < old.length; i++) { old[i] = cur[i]; }
  8921. on[name] = old;
  8922. } else {
  8923. old.fn = cur;
  8924. on[name] = old;
  8925. }
  8926. }
  8927. }
  8928. for (name in oldOn) {
  8929. if (!on[name]) {
  8930. event = name.charAt(0) === '!' ? name.slice(1) : name;
  8931. remove$$1(event, oldOn[name].invoker);
  8932. }
  8933. }
  8934. }
  8935. function arrInvoker (arr) {
  8936. return function (ev) {
  8937. var arguments$1 = arguments;
  8938. var single = arguments.length === 1;
  8939. for (var i = 0; i < arr.length; i++) {
  8940. single ? arr[i](ev) : arr[i].apply(null, arguments$1);
  8941. }
  8942. }
  8943. }
  8944. function fnInvoker (o) {
  8945. return function (ev) {
  8946. var single = arguments.length === 1;
  8947. single ? o.fn(ev) : o.fn.apply(null, arguments);
  8948. }
  8949. }
  8950. /* */
  8951. function normalizeChildren (
  8952. children,
  8953. ns,
  8954. nestedIndex
  8955. ) {
  8956. if (isPrimitive(children)) {
  8957. return [createTextVNode(children)]
  8958. }
  8959. if (Array.isArray(children)) {
  8960. var res = [];
  8961. for (var i = 0, l = children.length; i < l; i++) {
  8962. var c = children[i];
  8963. var last = res[res.length - 1];
  8964. // nested
  8965. if (Array.isArray(c)) {
  8966. res.push.apply(res, normalizeChildren(c, ns, ((nestedIndex || '') + "_" + i)));
  8967. } else if (isPrimitive(c)) {
  8968. if (last && last.text) {
  8969. last.text += String(c);
  8970. } else if (c !== '') {
  8971. // convert primitive to vnode
  8972. res.push(createTextVNode(c));
  8973. }
  8974. } else if (c instanceof VNode) {
  8975. if (c.text && last && last.text) {
  8976. last.text += c.text;
  8977. } else {
  8978. // inherit parent namespace
  8979. if (ns) {
  8980. applyNS(c, ns);
  8981. }
  8982. // default key for nested array children (likely generated by v-for)
  8983. if (c.tag && c.key == null && nestedIndex != null) {
  8984. c.key = "__vlist" + nestedIndex + "_" + i + "__";
  8985. }
  8986. res.push(c);
  8987. }
  8988. }
  8989. }
  8990. return res
  8991. }
  8992. }
  8993. function createTextVNode (val) {
  8994. return new VNode(undefined, undefined, undefined, String(val))
  8995. }
  8996. function applyNS (vnode, ns) {
  8997. if (vnode.tag && !vnode.ns) {
  8998. vnode.ns = ns;
  8999. if (vnode.children) {
  9000. for (var i = 0, l = vnode.children.length; i < l; i++) {
  9001. applyNS(vnode.children[i], ns);
  9002. }
  9003. }
  9004. }
  9005. }
  9006. /* */
  9007. function getFirstComponentChild (children) {
  9008. return children && children.filter(function (c) { return c && c.componentOptions; })[0]
  9009. }
  9010. /* */
  9011. var activeInstance = null;
  9012. function initLifecycle (vm) {
  9013. var options = vm.$options;
  9014. // locate first non-abstract parent
  9015. var parent = options.parent;
  9016. if (parent && !options.abstract) {
  9017. while (parent.$options.abstract && parent.$parent) {
  9018. parent = parent.$parent;
  9019. }
  9020. parent.$children.push(vm);
  9021. }
  9022. vm.$parent = parent;
  9023. vm.$root = parent ? parent.$root : vm;
  9024. vm.$children = [];
  9025. vm.$refs = {};
  9026. vm._watcher = null;
  9027. vm._inactive = false;
  9028. vm._isMounted = false;
  9029. vm._isDestroyed = false;
  9030. vm._isBeingDestroyed = false;
  9031. }
  9032. function lifecycleMixin (Vue) {
  9033. Vue.prototype._mount = function (
  9034. el,
  9035. hydrating
  9036. ) {
  9037. var vm = this;
  9038. vm.$el = el;
  9039. if (!vm.$options.render) {
  9040. vm.$options.render = emptyVNode;
  9041. if (process.env.NODE_ENV !== 'production') {
  9042. /* istanbul ignore if */
  9043. if (vm.$options.template) {
  9044. warn(
  9045. 'You are using the runtime-only build of Vue where the template ' +
  9046. 'option is not available. Either pre-compile the templates into ' +
  9047. 'render functions, or use the compiler-included build.',
  9048. vm
  9049. );
  9050. } else {
  9051. warn(
  9052. 'Failed to mount component: template or render function not defined.',
  9053. vm
  9054. );
  9055. }
  9056. }
  9057. }
  9058. callHook(vm, 'beforeMount');
  9059. vm._watcher = new Watcher(vm, function () {
  9060. vm._update(vm._render(), hydrating);
  9061. }, noop);
  9062. hydrating = false;
  9063. // manually mounted instance, call mounted on self
  9064. // mounted is called for render-created child components in its inserted hook
  9065. if (vm.$vnode == null) {
  9066. vm._isMounted = true;
  9067. callHook(vm, 'mounted');
  9068. }
  9069. return vm
  9070. };
  9071. Vue.prototype._update = function (vnode, hydrating) {
  9072. var vm = this;
  9073. if (vm._isMounted) {
  9074. callHook(vm, 'beforeUpdate');
  9075. }
  9076. var prevEl = vm.$el;
  9077. var prevActiveInstance = activeInstance;
  9078. activeInstance = vm;
  9079. var prevVnode = vm._vnode;
  9080. vm._vnode = vnode;
  9081. if (!prevVnode) {
  9082. // Vue.prototype.__patch__ is injected in entry points
  9083. // based on the rendering backend used.
  9084. vm.$el = vm.__patch__(vm.$el, vnode, hydrating);
  9085. } else {
  9086. vm.$el = vm.__patch__(prevVnode, vnode);
  9087. }
  9088. activeInstance = prevActiveInstance;
  9089. // update __vue__ reference
  9090. if (prevEl) {
  9091. prevEl.__vue__ = null;
  9092. }
  9093. if (vm.$el) {
  9094. vm.$el.__vue__ = vm;
  9095. }
  9096. // if parent is an HOC, update its $el as well
  9097. if (vm.$vnode && vm.$parent && vm.$vnode === vm.$parent._vnode) {
  9098. vm.$parent.$el = vm.$el;
  9099. }
  9100. if (vm._isMounted) {
  9101. callHook(vm, 'updated');
  9102. }
  9103. };
  9104. Vue.prototype._updateFromParent = function (
  9105. propsData,
  9106. listeners,
  9107. parentVnode,
  9108. renderChildren
  9109. ) {
  9110. var vm = this;
  9111. var hasChildren = !!(vm.$options._renderChildren || renderChildren);
  9112. vm.$options._parentVnode = parentVnode;
  9113. vm.$options._renderChildren = renderChildren;
  9114. // update props
  9115. if (propsData && vm.$options.props) {
  9116. observerState.shouldConvert = false;
  9117. if (process.env.NODE_ENV !== 'production') {
  9118. observerState.isSettingProps = true;
  9119. }
  9120. var propKeys = vm.$options._propKeys || [];
  9121. for (var i = 0; i < propKeys.length; i++) {
  9122. var key = propKeys[i];
  9123. vm[key] = validateProp(key, vm.$options.props, propsData, vm);
  9124. }
  9125. observerState.shouldConvert = true;
  9126. if (process.env.NODE_ENV !== 'production') {
  9127. observerState.isSettingProps = false;
  9128. }
  9129. }
  9130. // update listeners
  9131. if (listeners) {
  9132. var oldListeners = vm.$options._parentListeners;
  9133. vm.$options._parentListeners = listeners;
  9134. vm._updateListeners(listeners, oldListeners);
  9135. }
  9136. // resolve slots + force update if has children
  9137. if (hasChildren) {
  9138. vm.$slots = resolveSlots(renderChildren, vm._renderContext);
  9139. vm.$forceUpdate();
  9140. }
  9141. };
  9142. Vue.prototype.$forceUpdate = function () {
  9143. var vm = this;
  9144. if (vm._watcher) {
  9145. vm._watcher.update();
  9146. }
  9147. };
  9148. Vue.prototype.$destroy = function () {
  9149. var vm = this;
  9150. if (vm._isBeingDestroyed) {
  9151. return
  9152. }
  9153. callHook(vm, 'beforeDestroy');
  9154. vm._isBeingDestroyed = true;
  9155. // remove self from parent
  9156. var parent = vm.$parent;
  9157. if (parent && !parent._isBeingDestroyed && !vm.$options.abstract) {
  9158. remove$1(parent.$children, vm);
  9159. }
  9160. // teardown watchers
  9161. if (vm._watcher) {
  9162. vm._watcher.teardown();
  9163. }
  9164. var i = vm._watchers.length;
  9165. while (i--) {
  9166. vm._watchers[i].teardown();
  9167. }
  9168. // remove reference from data ob
  9169. // frozen object may not have observer.
  9170. if (vm._data.__ob__) {
  9171. vm._data.__ob__.vmCount--;
  9172. }
  9173. // call the last hook...
  9174. vm._isDestroyed = true;
  9175. callHook(vm, 'destroyed');
  9176. // turn off all instance listeners.
  9177. vm.$off();
  9178. // remove __vue__ reference
  9179. if (vm.$el) {
  9180. vm.$el.__vue__ = null;
  9181. }
  9182. // invoke destroy hooks on current rendered tree
  9183. vm.__patch__(vm._vnode, null);
  9184. };
  9185. }
  9186. function callHook (vm, hook) {
  9187. var handlers = vm.$options[hook];
  9188. if (handlers) {
  9189. for (var i = 0, j = handlers.length; i < j; i++) {
  9190. handlers[i].call(vm);
  9191. }
  9192. }
  9193. vm.$emit('hook:' + hook);
  9194. }
  9195. /* */
  9196. var hooks = { init: init, prepatch: prepatch, insert: insert, destroy: destroy$1 };
  9197. var hooksToMerge = Object.keys(hooks);
  9198. function createComponent (
  9199. Ctor,
  9200. data,
  9201. context,
  9202. children,
  9203. tag
  9204. ) {
  9205. if (!Ctor) {
  9206. return
  9207. }
  9208. if (isObject(Ctor)) {
  9209. Ctor = Vue$2.extend(Ctor);
  9210. }
  9211. if (typeof Ctor !== 'function') {
  9212. if (process.env.NODE_ENV !== 'production') {
  9213. warn(("Invalid Component definition: " + (String(Ctor))), context);
  9214. }
  9215. return
  9216. }
  9217. // async component
  9218. if (!Ctor.cid) {
  9219. if (Ctor.resolved) {
  9220. Ctor = Ctor.resolved;
  9221. } else {
  9222. Ctor = resolveAsyncComponent(Ctor, function () {
  9223. // it's ok to queue this on every render because
  9224. // $forceUpdate is buffered by the scheduler.
  9225. context.$forceUpdate();
  9226. });
  9227. if (!Ctor) {
  9228. // return nothing if this is indeed an async component
  9229. // wait for the callback to trigger parent update.
  9230. return
  9231. }
  9232. }
  9233. }
  9234. data = data || {};
  9235. // extract props
  9236. var propsData = extractProps(data, Ctor);
  9237. // functional component
  9238. if (Ctor.options.functional) {
  9239. return createFunctionalComponent(Ctor, propsData, data, context, children)
  9240. }
  9241. // extract listeners, since these needs to be treated as
  9242. // child component listeners instead of DOM listeners
  9243. var listeners = data.on;
  9244. // replace with listeners with .native modifier
  9245. data.on = data.nativeOn;
  9246. if (Ctor.options.abstract) {
  9247. // abstract components do not keep anything
  9248. // other than props & listeners
  9249. data = {};
  9250. }
  9251. // merge component management hooks onto the placeholder node
  9252. mergeHooks(data);
  9253. // return a placeholder vnode
  9254. var name = Ctor.options.name || tag;
  9255. var vnode = new VNode(
  9256. ("vue-component-" + (Ctor.cid) + (name ? ("-" + name) : '')),
  9257. data, undefined, undefined, undefined, undefined, context,
  9258. { Ctor: Ctor, propsData: propsData, listeners: listeners, tag: tag, children: children }
  9259. );
  9260. return vnode
  9261. }
  9262. function createFunctionalComponent (
  9263. Ctor,
  9264. propsData,
  9265. data,
  9266. context,
  9267. children
  9268. ) {
  9269. var props = {};
  9270. var propOptions = Ctor.options.props;
  9271. if (propOptions) {
  9272. for (var key in propOptions) {
  9273. props[key] = validateProp(key, propOptions, propsData);
  9274. }
  9275. }
  9276. var vnode = Ctor.options.render.call(
  9277. null,
  9278. // ensure the createElement function in functional components
  9279. // gets a unique context - this is necessary for correct named slot check
  9280. bind$1(createElement, { _self: Object.create(context) }),
  9281. {
  9282. props: props,
  9283. data: data,
  9284. parent: context,
  9285. children: normalizeChildren(children),
  9286. slots: function () { return resolveSlots(children, context); }
  9287. }
  9288. );
  9289. if (vnode instanceof VNode) {
  9290. vnode.functionalContext = context;
  9291. if (data.slot) {
  9292. (vnode.data || (vnode.data = {})).slot = data.slot;
  9293. }
  9294. }
  9295. return vnode
  9296. }
  9297. function createComponentInstanceForVnode (
  9298. vnode, // we know it's MountedComponentVNode but flow doesn't
  9299. parent // activeInstance in lifecycle state
  9300. ) {
  9301. var vnodeComponentOptions = vnode.componentOptions;
  9302. var options = {
  9303. _isComponent: true,
  9304. parent: parent,
  9305. propsData: vnodeComponentOptions.propsData,
  9306. _componentTag: vnodeComponentOptions.tag,
  9307. _parentVnode: vnode,
  9308. _parentListeners: vnodeComponentOptions.listeners,
  9309. _renderChildren: vnodeComponentOptions.children
  9310. };
  9311. // check inline-template render functions
  9312. var inlineTemplate = vnode.data.inlineTemplate;
  9313. if (inlineTemplate) {
  9314. options.render = inlineTemplate.render;
  9315. options.staticRenderFns = inlineTemplate.staticRenderFns;
  9316. }
  9317. return new vnodeComponentOptions.Ctor(options)
  9318. }
  9319. function init (vnode, hydrating) {
  9320. if (!vnode.child || vnode.child._isDestroyed) {
  9321. var child = vnode.child = createComponentInstanceForVnode(vnode, activeInstance);
  9322. child.$mount(hydrating ? vnode.elm : undefined, hydrating);
  9323. }
  9324. }
  9325. function prepatch (
  9326. oldVnode,
  9327. vnode
  9328. ) {
  9329. var options = vnode.componentOptions;
  9330. var child = vnode.child = oldVnode.child;
  9331. child._updateFromParent(
  9332. options.propsData, // updated props
  9333. options.listeners, // updated listeners
  9334. vnode, // new parent vnode
  9335. options.children // new children
  9336. );
  9337. }
  9338. function insert (vnode) {
  9339. if (!vnode.child._isMounted) {
  9340. vnode.child._isMounted = true;
  9341. callHook(vnode.child, 'mounted');
  9342. }
  9343. if (vnode.data.keepAlive) {
  9344. vnode.child._inactive = false;
  9345. callHook(vnode.child, 'activated');
  9346. }
  9347. }
  9348. function destroy$1 (vnode) {
  9349. if (!vnode.child._isDestroyed) {
  9350. if (!vnode.data.keepAlive) {
  9351. vnode.child.$destroy();
  9352. } else {
  9353. vnode.child._inactive = true;
  9354. callHook(vnode.child, 'deactivated');
  9355. }
  9356. }
  9357. }
  9358. function resolveAsyncComponent (
  9359. factory,
  9360. cb
  9361. ) {
  9362. if (factory.requested) {
  9363. // pool callbacks
  9364. factory.pendingCallbacks.push(cb);
  9365. } else {
  9366. factory.requested = true;
  9367. var cbs = factory.pendingCallbacks = [cb];
  9368. var sync = true;
  9369. var resolve = function (res) {
  9370. if (isObject(res)) {
  9371. res = Vue$2.extend(res);
  9372. }
  9373. // cache resolved
  9374. factory.resolved = res;
  9375. // invoke callbacks only if this is not a synchronous resolve
  9376. // (async resolves are shimmed as synchronous during SSR)
  9377. if (!sync) {
  9378. for (var i = 0, l = cbs.length; i < l; i++) {
  9379. cbs[i](res);
  9380. }
  9381. }
  9382. };
  9383. var reject = function (reason) {
  9384. process.env.NODE_ENV !== 'production' && warn(
  9385. "Failed to resolve async component: " + (String(factory)) +
  9386. (reason ? ("\nReason: " + reason) : '')
  9387. );
  9388. };
  9389. var res = factory(resolve, reject);
  9390. // handle promise
  9391. if (res && typeof res.then === 'function' && !factory.resolved) {
  9392. res.then(resolve, reject);
  9393. }
  9394. sync = false;
  9395. // return in case resolved synchronously
  9396. return factory.resolved
  9397. }
  9398. }
  9399. function extractProps (data, Ctor) {
  9400. // we are only extrating raw values here.
  9401. // validation and default values are handled in the child
  9402. // component itself.
  9403. var propOptions = Ctor.options.props;
  9404. if (!propOptions) {
  9405. return
  9406. }
  9407. var res = {};
  9408. var attrs = data.attrs;
  9409. var props = data.props;
  9410. var domProps = data.domProps;
  9411. if (attrs || props || domProps) {
  9412. for (var key in propOptions) {
  9413. var altKey = hyphenate(key);
  9414. checkProp(res, props, key, altKey, true) ||
  9415. checkProp(res, attrs, key, altKey) ||
  9416. checkProp(res, domProps, key, altKey);
  9417. }
  9418. }
  9419. return res
  9420. }
  9421. function checkProp (
  9422. res,
  9423. hash,
  9424. key,
  9425. altKey,
  9426. preserve
  9427. ) {
  9428. if (hash) {
  9429. if (hasOwn(hash, key)) {
  9430. res[key] = hash[key];
  9431. if (!preserve) {
  9432. delete hash[key];
  9433. }
  9434. return true
  9435. } else if (hasOwn(hash, altKey)) {
  9436. res[key] = hash[altKey];
  9437. if (!preserve) {
  9438. delete hash[altKey];
  9439. }
  9440. return true
  9441. }
  9442. }
  9443. return false
  9444. }
  9445. function mergeHooks (data) {
  9446. if (!data.hook) {
  9447. data.hook = {};
  9448. }
  9449. for (var i = 0; i < hooksToMerge.length; i++) {
  9450. var key = hooksToMerge[i];
  9451. var fromParent = data.hook[key];
  9452. var ours = hooks[key];
  9453. data.hook[key] = fromParent ? mergeHook$1(ours, fromParent) : ours;
  9454. }
  9455. }
  9456. function mergeHook$1 (a, b) {
  9457. // since all hooks have at most two args, use fixed args
  9458. // to avoid having to use fn.apply().
  9459. return function (_, __) {
  9460. a(_, __);
  9461. b(_, __);
  9462. }
  9463. }
  9464. /* */
  9465. // wrapper function for providing a more flexible interface
  9466. // without getting yelled at by flow
  9467. function createElement (
  9468. tag,
  9469. data,
  9470. children
  9471. ) {
  9472. if (data && (Array.isArray(data) || typeof data !== 'object')) {
  9473. children = data;
  9474. data = undefined;
  9475. }
  9476. // make sure to use real instance instead of proxy as context
  9477. return _createElement(this._self, tag, data, children)
  9478. }
  9479. function _createElement (
  9480. context,
  9481. tag,
  9482. data,
  9483. children
  9484. ) {
  9485. if (data && data.__ob__) {
  9486. process.env.NODE_ENV !== 'production' && warn(
  9487. "Avoid using observed data object as vnode data: " + (JSON.stringify(data)) + "\n" +
  9488. 'Always create fresh vnode data objects in each render!',
  9489. context
  9490. );
  9491. return
  9492. }
  9493. if (!tag) {
  9494. // in case of component :is set to falsy value
  9495. return emptyVNode()
  9496. }
  9497. if (typeof tag === 'string') {
  9498. var Ctor;
  9499. var ns = config.getTagNamespace(tag);
  9500. if (config.isReservedTag(tag)) {
  9501. // platform built-in elements
  9502. return new VNode(
  9503. tag, data, normalizeChildren(children, ns),
  9504. undefined, undefined, ns, context
  9505. )
  9506. } else if ((Ctor = resolveAsset(context.$options, 'components', tag))) {
  9507. // component
  9508. return createComponent(Ctor, data, context, children, tag)
  9509. } else {
  9510. // unknown or unlisted namespaced elements
  9511. // check at runtime because it may get assigned a namespace when its
  9512. // parent normalizes children
  9513. return new VNode(
  9514. tag, data, normalizeChildren(children, ns),
  9515. undefined, undefined, ns, context
  9516. )
  9517. }
  9518. } else {
  9519. // direct component options / constructor
  9520. return createComponent(tag, data, context, children)
  9521. }
  9522. }
  9523. /* */
  9524. function initRender (vm) {
  9525. vm.$vnode = null; // the placeholder node in parent tree
  9526. vm._vnode = null; // the root of the child tree
  9527. vm._staticTrees = null;
  9528. vm._renderContext = vm.$options._parentVnode && vm.$options._parentVnode.context;
  9529. vm.$slots = resolveSlots(vm.$options._renderChildren, vm._renderContext);
  9530. // bind the public createElement fn to this instance
  9531. // so that we get proper render context inside it.
  9532. vm.$createElement = bind$1(createElement, vm);
  9533. if (vm.$options.el) {
  9534. vm.$mount(vm.$options.el);
  9535. }
  9536. }
  9537. function renderMixin (Vue) {
  9538. Vue.prototype.$nextTick = function (fn) {
  9539. nextTick(fn, this);
  9540. };
  9541. Vue.prototype._render = function () {
  9542. var vm = this;
  9543. var ref = vm.$options;
  9544. var render = ref.render;
  9545. var staticRenderFns = ref.staticRenderFns;
  9546. var _parentVnode = ref._parentVnode;
  9547. if (vm._isMounted) {
  9548. // clone slot nodes on re-renders
  9549. for (var key in vm.$slots) {
  9550. vm.$slots[key] = cloneVNodes(vm.$slots[key]);
  9551. }
  9552. }
  9553. if (staticRenderFns && !vm._staticTrees) {
  9554. vm._staticTrees = [];
  9555. }
  9556. // set parent vnode. this allows render functions to have access
  9557. // to the data on the placeholder node.
  9558. vm.$vnode = _parentVnode;
  9559. // render self
  9560. var vnode;
  9561. try {
  9562. vnode = render.call(vm._renderProxy, vm.$createElement);
  9563. } catch (e) {
  9564. if (process.env.NODE_ENV !== 'production') {
  9565. warn(("Error when rendering " + (formatComponentName(vm)) + ":"));
  9566. }
  9567. /* istanbul ignore else */
  9568. if (config.errorHandler) {
  9569. config.errorHandler.call(null, e, vm);
  9570. } else {
  9571. if (config._isServer) {
  9572. throw e
  9573. } else {
  9574. setTimeout(function () { throw e }, 0);
  9575. }
  9576. }
  9577. // return previous vnode to prevent render error causing blank component
  9578. vnode = vm._vnode;
  9579. }
  9580. // return empty vnode in case the render function errored out
  9581. if (!(vnode instanceof VNode)) {
  9582. if (process.env.NODE_ENV !== 'production' && Array.isArray(vnode)) {
  9583. warn(
  9584. 'Multiple root nodes returned from render function. Render function ' +
  9585. 'should return a single root node.',
  9586. vm
  9587. );
  9588. }
  9589. vnode = emptyVNode();
  9590. }
  9591. // set parent
  9592. vnode.parent = _parentVnode;
  9593. return vnode
  9594. };
  9595. // shorthands used in render functions
  9596. Vue.prototype._h = createElement;
  9597. // toString for mustaches
  9598. Vue.prototype._s = _toString;
  9599. // number conversion
  9600. Vue.prototype._n = toNumber;
  9601. // empty vnode
  9602. Vue.prototype._e = emptyVNode;
  9603. // loose equal
  9604. Vue.prototype._q = looseEqual;
  9605. // loose indexOf
  9606. Vue.prototype._i = looseIndexOf;
  9607. // render static tree by index
  9608. Vue.prototype._m = function renderStatic (
  9609. index,
  9610. isInFor
  9611. ) {
  9612. var tree = this._staticTrees[index];
  9613. // if has already-rendered static tree and not inside v-for,
  9614. // we can reuse the same tree by doing a shallow clone.
  9615. if (tree && !isInFor) {
  9616. return Array.isArray(tree)
  9617. ? cloneVNodes(tree)
  9618. : cloneVNode(tree)
  9619. }
  9620. // otherwise, render a fresh tree.
  9621. tree = this._staticTrees[index] = this.$options.staticRenderFns[index].call(this._renderProxy);
  9622. if (Array.isArray(tree)) {
  9623. for (var i = 0; i < tree.length; i++) {
  9624. if (typeof tree[i] !== 'string') {
  9625. tree[i].isStatic = true;
  9626. tree[i].key = "__static__" + index + "_" + i;
  9627. }
  9628. }
  9629. } else {
  9630. tree.isStatic = true;
  9631. tree.key = "__static__" + index;
  9632. }
  9633. return tree
  9634. };
  9635. // filter resolution helper
  9636. var identity = function (_) { return _; };
  9637. Vue.prototype._f = function resolveFilter (id) {
  9638. return resolveAsset(this.$options, 'filters', id, true) || identity
  9639. };
  9640. // render v-for
  9641. Vue.prototype._l = function renderList (
  9642. val,
  9643. render
  9644. ) {
  9645. var ret, i, l, keys, key;
  9646. if (Array.isArray(val)) {
  9647. ret = new Array(val.length);
  9648. for (i = 0, l = val.length; i < l; i++) {
  9649. ret[i] = render(val[i], i);
  9650. }
  9651. } else if (typeof val === 'number') {
  9652. ret = new Array(val);
  9653. for (i = 0; i < val; i++) {
  9654. ret[i] = render(i + 1, i);
  9655. }
  9656. } else if (isObject(val)) {
  9657. keys = Object.keys(val);
  9658. ret = new Array(keys.length);
  9659. for (i = 0, l = keys.length; i < l; i++) {
  9660. key = keys[i];
  9661. ret[i] = render(val[key], key, i);
  9662. }
  9663. }
  9664. return ret
  9665. };
  9666. // renderSlot
  9667. Vue.prototype._t = function (
  9668. name,
  9669. fallback
  9670. ) {
  9671. var slotNodes = this.$slots[name];
  9672. // warn duplicate slot usage
  9673. if (slotNodes && process.env.NODE_ENV !== 'production') {
  9674. slotNodes._rendered && warn(
  9675. "Duplicate presence of slot \"" + name + "\" found in the same render tree " +
  9676. "- this will likely cause render errors.",
  9677. this
  9678. );
  9679. slotNodes._rendered = true;
  9680. }
  9681. return slotNodes || fallback
  9682. };
  9683. // apply v-bind object
  9684. Vue.prototype._b = function bindProps (
  9685. data,
  9686. value,
  9687. asProp
  9688. ) {
  9689. if (value) {
  9690. if (!isObject(value)) {
  9691. process.env.NODE_ENV !== 'production' && warn(
  9692. 'v-bind without argument expects an Object or Array value',
  9693. this
  9694. );
  9695. } else {
  9696. if (Array.isArray(value)) {
  9697. value = toObject(value);
  9698. }
  9699. for (var key in value) {
  9700. if (key === 'class' || key === 'style') {
  9701. data[key] = value[key];
  9702. } else {
  9703. var hash = asProp || config.mustUseProp(key)
  9704. ? data.domProps || (data.domProps = {})
  9705. : data.attrs || (data.attrs = {});
  9706. hash[key] = value[key];
  9707. }
  9708. }
  9709. }
  9710. }
  9711. return data
  9712. };
  9713. // expose v-on keyCodes
  9714. Vue.prototype._k = function getKeyCodes (key) {
  9715. return config.keyCodes[key]
  9716. };
  9717. }
  9718. function resolveSlots (
  9719. renderChildren,
  9720. context
  9721. ) {
  9722. var slots = {};
  9723. if (!renderChildren) {
  9724. return slots
  9725. }
  9726. var children = normalizeChildren(renderChildren) || [];
  9727. var defaultSlot = [];
  9728. var name, child;
  9729. for (var i = 0, l = children.length; i < l; i++) {
  9730. child = children[i];
  9731. // named slots should only be respected if the vnode was rendered in the
  9732. // same context.
  9733. if ((child.context === context || child.functionalContext === context) &&
  9734. child.data && (name = child.data.slot)) {
  9735. var slot = (slots[name] || (slots[name] = []));
  9736. if (child.tag === 'template') {
  9737. slot.push.apply(slot, child.children);
  9738. } else {
  9739. slot.push(child);
  9740. }
  9741. } else {
  9742. defaultSlot.push(child);
  9743. }
  9744. }
  9745. // ignore single whitespace
  9746. if (defaultSlot.length && !(
  9747. defaultSlot.length === 1 &&
  9748. (defaultSlot[0].text === ' ' || defaultSlot[0].isComment)
  9749. )) {
  9750. slots.default = defaultSlot;
  9751. }
  9752. return slots
  9753. }
  9754. /* */
  9755. function initEvents (vm) {
  9756. vm._events = Object.create(null);
  9757. // init parent attached events
  9758. var listeners = vm.$options._parentListeners;
  9759. var on = bind$1(vm.$on, vm);
  9760. var off = bind$1(vm.$off, vm);
  9761. vm._updateListeners = function (listeners, oldListeners) {
  9762. updateListeners(listeners, oldListeners || {}, on, off, vm);
  9763. };
  9764. if (listeners) {
  9765. vm._updateListeners(listeners);
  9766. }
  9767. }
  9768. function eventsMixin (Vue) {
  9769. Vue.prototype.$on = function (event, fn) {
  9770. var vm = this;(vm._events[event] || (vm._events[event] = [])).push(fn);
  9771. return vm
  9772. };
  9773. Vue.prototype.$once = function (event, fn) {
  9774. var vm = this;
  9775. function on () {
  9776. vm.$off(event, on);
  9777. fn.apply(vm, arguments);
  9778. }
  9779. on.fn = fn;
  9780. vm.$on(event, on);
  9781. return vm
  9782. };
  9783. Vue.prototype.$off = function (event, fn) {
  9784. var vm = this;
  9785. // all
  9786. if (!arguments.length) {
  9787. vm._events = Object.create(null);
  9788. return vm
  9789. }
  9790. // specific event
  9791. var cbs = vm._events[event];
  9792. if (!cbs) {
  9793. return vm
  9794. }
  9795. if (arguments.length === 1) {
  9796. vm._events[event] = null;
  9797. return vm
  9798. }
  9799. // specific handler
  9800. var cb;
  9801. var i = cbs.length;
  9802. while (i--) {
  9803. cb = cbs[i];
  9804. if (cb === fn || cb.fn === fn) {
  9805. cbs.splice(i, 1);
  9806. break
  9807. }
  9808. }
  9809. return vm
  9810. };
  9811. Vue.prototype.$emit = function (event) {
  9812. var vm = this;
  9813. var cbs = vm._events[event];
  9814. if (cbs) {
  9815. cbs = cbs.length > 1 ? toArray(cbs) : cbs;
  9816. var args = toArray(arguments, 1);
  9817. for (var i = 0, l = cbs.length; i < l; i++) {
  9818. cbs[i].apply(vm, args);
  9819. }
  9820. }
  9821. return vm
  9822. };
  9823. }
  9824. /* */
  9825. var uid = 0;
  9826. function initMixin (Vue) {
  9827. Vue.prototype._init = function (options) {
  9828. var vm = this;
  9829. // a uid
  9830. vm._uid = uid++;
  9831. // a flag to avoid this being observed
  9832. vm._isVue = true;
  9833. // merge options
  9834. if (options && options._isComponent) {
  9835. // optimize internal component instantiation
  9836. // since dynamic options merging is pretty slow, and none of the
  9837. // internal component options needs special treatment.
  9838. initInternalComponent(vm, options);
  9839. } else {
  9840. vm.$options = mergeOptions(
  9841. resolveConstructorOptions(vm),
  9842. options || {},
  9843. vm
  9844. );
  9845. }
  9846. /* istanbul ignore else */
  9847. if (process.env.NODE_ENV !== 'production') {
  9848. initProxy(vm);
  9849. } else {
  9850. vm._renderProxy = vm;
  9851. }
  9852. // expose real self
  9853. vm._self = vm;
  9854. initLifecycle(vm);
  9855. initEvents(vm);
  9856. callHook(vm, 'beforeCreate');
  9857. initState(vm);
  9858. callHook(vm, 'created');
  9859. initRender(vm);
  9860. };
  9861. function initInternalComponent (vm, options) {
  9862. var opts = vm.$options = Object.create(resolveConstructorOptions(vm));
  9863. // doing this because it's faster than dynamic enumeration.
  9864. opts.parent = options.parent;
  9865. opts.propsData = options.propsData;
  9866. opts._parentVnode = options._parentVnode;
  9867. opts._parentListeners = options._parentListeners;
  9868. opts._renderChildren = options._renderChildren;
  9869. opts._componentTag = options._componentTag;
  9870. if (options.render) {
  9871. opts.render = options.render;
  9872. opts.staticRenderFns = options.staticRenderFns;
  9873. }
  9874. }
  9875. function resolveConstructorOptions (vm) {
  9876. var Ctor = vm.constructor;
  9877. var options = Ctor.options;
  9878. if (Ctor.super) {
  9879. var superOptions = Ctor.super.options;
  9880. var cachedSuperOptions = Ctor.superOptions;
  9881. if (superOptions !== cachedSuperOptions) {
  9882. // super option changed
  9883. Ctor.superOptions = superOptions;
  9884. options = Ctor.options = mergeOptions(superOptions, Ctor.extendOptions);
  9885. if (options.name) {
  9886. options.components[options.name] = Ctor;
  9887. }
  9888. }
  9889. }
  9890. return options
  9891. }
  9892. }
  9893. function Vue$2 (options) {
  9894. if (process.env.NODE_ENV !== 'production' &&
  9895. !(this instanceof Vue$2)) {
  9896. warn('Vue is a constructor and should be called with the `new` keyword');
  9897. }
  9898. this._init(options);
  9899. }
  9900. initMixin(Vue$2);
  9901. stateMixin(Vue$2);
  9902. eventsMixin(Vue$2);
  9903. lifecycleMixin(Vue$2);
  9904. renderMixin(Vue$2);
  9905. var warn = noop;
  9906. var formatComponentName;
  9907. if (process.env.NODE_ENV !== 'production') {
  9908. var hasConsole = typeof console !== 'undefined';
  9909. warn = function (msg, vm) {
  9910. if (hasConsole && (!config.silent)) {
  9911. console.error("[Vue warn]: " + msg + " " + (
  9912. vm ? formatLocation(formatComponentName(vm)) : ''
  9913. ));
  9914. }
  9915. };
  9916. formatComponentName = function (vm) {
  9917. if (vm.$root === vm) {
  9918. return 'root instance'
  9919. }
  9920. var name = vm._isVue
  9921. ? vm.$options.name || vm.$options._componentTag
  9922. : vm.name;
  9923. return (
  9924. (name ? ("component <" + name + ">") : "anonymous component") +
  9925. (vm._isVue && vm.$options.__file ? (" at " + (vm.$options.__file)) : '')
  9926. )
  9927. };
  9928. var formatLocation = function (str) {
  9929. if (str === 'anonymous component') {
  9930. str += " - use the \"name\" option for better debugging messages.";
  9931. }
  9932. return ("\n(found in " + str + ")")
  9933. };
  9934. }
  9935. /* */
  9936. /**
  9937. * Option overwriting strategies are functions that handle
  9938. * how to merge a parent option value and a child option
  9939. * value into the final value.
  9940. */
  9941. var strats = config.optionMergeStrategies;
  9942. /**
  9943. * Options with restrictions
  9944. */
  9945. if (process.env.NODE_ENV !== 'production') {
  9946. strats.el = strats.propsData = function (parent, child, vm, key) {
  9947. if (!vm) {
  9948. warn(
  9949. "option \"" + key + "\" can only be used during instance " +
  9950. 'creation with the `new` keyword.'
  9951. );
  9952. }
  9953. return defaultStrat(parent, child)
  9954. };
  9955. }
  9956. /**
  9957. * Helper that recursively merges two data objects together.
  9958. */
  9959. function mergeData (to, from) {
  9960. var key, toVal, fromVal;
  9961. for (key in from) {
  9962. toVal = to[key];
  9963. fromVal = from[key];
  9964. if (!hasOwn(to, key)) {
  9965. set(to, key, fromVal);
  9966. } else if (isObject(toVal) && isObject(fromVal)) {
  9967. mergeData(toVal, fromVal);
  9968. }
  9969. }
  9970. return to
  9971. }
  9972. /**
  9973. * Data
  9974. */
  9975. strats.data = function (
  9976. parentVal,
  9977. childVal,
  9978. vm
  9979. ) {
  9980. if (!vm) {
  9981. // in a Vue.extend merge, both should be functions
  9982. if (!childVal) {
  9983. return parentVal
  9984. }
  9985. if (typeof childVal !== 'function') {
  9986. process.env.NODE_ENV !== 'production' && warn(
  9987. 'The "data" option should be a function ' +
  9988. 'that returns a per-instance value in component ' +
  9989. 'definitions.',
  9990. vm
  9991. );
  9992. return parentVal
  9993. }
  9994. if (!parentVal) {
  9995. return childVal
  9996. }
  9997. // when parentVal & childVal are both present,
  9998. // we need to return a function that returns the
  9999. // merged result of both functions... no need to
  10000. // check if parentVal is a function here because
  10001. // it has to be a function to pass previous merges.
  10002. return function mergedDataFn () {
  10003. return mergeData(
  10004. childVal.call(this),
  10005. parentVal.call(this)
  10006. )
  10007. }
  10008. } else if (parentVal || childVal) {
  10009. return function mergedInstanceDataFn () {
  10010. // instance merge
  10011. var instanceData = typeof childVal === 'function'
  10012. ? childVal.call(vm)
  10013. : childVal;
  10014. var defaultData = typeof parentVal === 'function'
  10015. ? parentVal.call(vm)
  10016. : undefined;
  10017. if (instanceData) {
  10018. return mergeData(instanceData, defaultData)
  10019. } else {
  10020. return defaultData
  10021. }
  10022. }
  10023. }
  10024. };
  10025. /**
  10026. * Hooks and param attributes are merged as arrays.
  10027. */
  10028. function mergeHook (
  10029. parentVal,
  10030. childVal
  10031. ) {
  10032. return childVal
  10033. ? parentVal
  10034. ? parentVal.concat(childVal)
  10035. : Array.isArray(childVal)
  10036. ? childVal
  10037. : [childVal]
  10038. : parentVal
  10039. }
  10040. config._lifecycleHooks.forEach(function (hook) {
  10041. strats[hook] = mergeHook;
  10042. });
  10043. /**
  10044. * Assets
  10045. *
  10046. * When a vm is present (instance creation), we need to do
  10047. * a three-way merge between constructor options, instance
  10048. * options and parent options.
  10049. */
  10050. function mergeAssets (parentVal, childVal) {
  10051. var res = Object.create(parentVal || null);
  10052. return childVal
  10053. ? extend(res, childVal)
  10054. : res
  10055. }
  10056. config._assetTypes.forEach(function (type) {
  10057. strats[type + 's'] = mergeAssets;
  10058. });
  10059. /**
  10060. * Watchers.
  10061. *
  10062. * Watchers hashes should not overwrite one
  10063. * another, so we merge them as arrays.
  10064. */
  10065. strats.watch = function (parentVal, childVal) {
  10066. /* istanbul ignore if */
  10067. if (!childVal) { return parentVal }
  10068. if (!parentVal) { return childVal }
  10069. var ret = {};
  10070. extend(ret, parentVal);
  10071. for (var key in childVal) {
  10072. var parent = ret[key];
  10073. var child = childVal[key];
  10074. if (parent && !Array.isArray(parent)) {
  10075. parent = [parent];
  10076. }
  10077. ret[key] = parent
  10078. ? parent.concat(child)
  10079. : [child];
  10080. }
  10081. return ret
  10082. };
  10083. /**
  10084. * Other object hashes.
  10085. */
  10086. strats.props =
  10087. strats.methods =
  10088. strats.computed = function (parentVal, childVal) {
  10089. if (!childVal) { return parentVal }
  10090. if (!parentVal) { return childVal }
  10091. var ret = Object.create(null);
  10092. extend(ret, parentVal);
  10093. extend(ret, childVal);
  10094. return ret
  10095. };
  10096. /**
  10097. * Default strategy.
  10098. */
  10099. var defaultStrat = function (parentVal, childVal) {
  10100. return childVal === undefined
  10101. ? parentVal
  10102. : childVal
  10103. };
  10104. /**
  10105. * Make sure component options get converted to actual
  10106. * constructors.
  10107. */
  10108. function normalizeComponents (options) {
  10109. if (options.components) {
  10110. var components = options.components;
  10111. var def;
  10112. for (var key in components) {
  10113. var lower = key.toLowerCase();
  10114. if (isBuiltInTag(lower) || config.isReservedTag(lower)) {
  10115. process.env.NODE_ENV !== 'production' && warn(
  10116. 'Do not use built-in or reserved HTML elements as component ' +
  10117. 'id: ' + key
  10118. );
  10119. continue
  10120. }
  10121. def = components[key];
  10122. if (isPlainObject(def)) {
  10123. components[key] = Vue$2.extend(def);
  10124. }
  10125. }
  10126. }
  10127. }
  10128. /**
  10129. * Ensure all props option syntax are normalized into the
  10130. * Object-based format.
  10131. */
  10132. function normalizeProps (options) {
  10133. var props = options.props;
  10134. if (!props) { return }
  10135. var res = {};
  10136. var i, val, name;
  10137. if (Array.isArray(props)) {
  10138. i = props.length;
  10139. while (i--) {
  10140. val = props[i];
  10141. if (typeof val === 'string') {
  10142. name = camelize(val);
  10143. res[name] = { type: null };
  10144. } else if (process.env.NODE_ENV !== 'production') {
  10145. warn('props must be strings when using array syntax.');
  10146. }
  10147. }
  10148. } else if (isPlainObject(props)) {
  10149. for (var key in props) {
  10150. val = props[key];
  10151. name = camelize(key);
  10152. res[name] = isPlainObject(val)
  10153. ? val
  10154. : { type: val };
  10155. }
  10156. }
  10157. options.props = res;
  10158. }
  10159. /**
  10160. * Normalize raw function directives into object format.
  10161. */
  10162. function normalizeDirectives (options) {
  10163. var dirs = options.directives;
  10164. if (dirs) {
  10165. for (var key in dirs) {
  10166. var def = dirs[key];
  10167. if (typeof def === 'function') {
  10168. dirs[key] = { bind: def, update: def };
  10169. }
  10170. }
  10171. }
  10172. }
  10173. /**
  10174. * Merge two option objects into a new one.
  10175. * Core utility used in both instantiation and inheritance.
  10176. */
  10177. function mergeOptions (
  10178. parent,
  10179. child,
  10180. vm
  10181. ) {
  10182. normalizeComponents(child);
  10183. normalizeProps(child);
  10184. normalizeDirectives(child);
  10185. var extendsFrom = child.extends;
  10186. if (extendsFrom) {
  10187. parent = typeof extendsFrom === 'function'
  10188. ? mergeOptions(parent, extendsFrom.options, vm)
  10189. : mergeOptions(parent, extendsFrom, vm);
  10190. }
  10191. if (child.mixins) {
  10192. for (var i = 0, l = child.mixins.length; i < l; i++) {
  10193. var mixin = child.mixins[i];
  10194. if (mixin.prototype instanceof Vue$2) {
  10195. mixin = mixin.options;
  10196. }
  10197. parent = mergeOptions(parent, mixin, vm);
  10198. }
  10199. }
  10200. var options = {};
  10201. var key;
  10202. for (key in parent) {
  10203. mergeField(key);
  10204. }
  10205. for (key in child) {
  10206. if (!hasOwn(parent, key)) {
  10207. mergeField(key);
  10208. }
  10209. }
  10210. function mergeField (key) {
  10211. var strat = strats[key] || defaultStrat;
  10212. options[key] = strat(parent[key], child[key], vm, key);
  10213. }
  10214. return options
  10215. }
  10216. /**
  10217. * Resolve an asset.
  10218. * This function is used because child instances need access
  10219. * to assets defined in its ancestor chain.
  10220. */
  10221. function resolveAsset (
  10222. options,
  10223. type,
  10224. id,
  10225. warnMissing
  10226. ) {
  10227. /* istanbul ignore if */
  10228. if (typeof id !== 'string') {
  10229. return
  10230. }
  10231. var assets = options[type];
  10232. var res = assets[id] ||
  10233. // camelCase ID
  10234. assets[camelize(id)] ||
  10235. // Pascal Case ID
  10236. assets[capitalize(camelize(id))];
  10237. if (process.env.NODE_ENV !== 'production' && warnMissing && !res) {
  10238. warn(
  10239. 'Failed to resolve ' + type.slice(0, -1) + ': ' + id,
  10240. options
  10241. );
  10242. }
  10243. return res
  10244. }
  10245. /* */
  10246. function validateProp (
  10247. key,
  10248. propOptions,
  10249. propsData,
  10250. vm
  10251. ) {
  10252. var prop = propOptions[key];
  10253. var absent = !hasOwn(propsData, key);
  10254. var value = propsData[key];
  10255. // handle boolean props
  10256. if (isBooleanType(prop.type)) {
  10257. if (absent && !hasOwn(prop, 'default')) {
  10258. value = false;
  10259. } else if (value === '' || value === hyphenate(key)) {
  10260. value = true;
  10261. }
  10262. }
  10263. // check default value
  10264. if (value === undefined) {
  10265. value = getPropDefaultValue(vm, prop, key);
  10266. // since the default value is a fresh copy,
  10267. // make sure to observe it.
  10268. var prevShouldConvert = observerState.shouldConvert;
  10269. observerState.shouldConvert = true;
  10270. observe(value);
  10271. observerState.shouldConvert = prevShouldConvert;
  10272. }
  10273. if (process.env.NODE_ENV !== 'production') {
  10274. assertProp(prop, key, value, vm, absent);
  10275. }
  10276. return value
  10277. }
  10278. /**
  10279. * Get the default value of a prop.
  10280. */
  10281. function getPropDefaultValue (vm, prop, name) {
  10282. // no default, return undefined
  10283. if (!hasOwn(prop, 'default')) {
  10284. return undefined
  10285. }
  10286. var def = prop.default;
  10287. // warn against non-factory defaults for Object & Array
  10288. if (isObject(def)) {
  10289. process.env.NODE_ENV !== 'production' && warn(
  10290. 'Invalid default value for prop "' + name + '": ' +
  10291. 'Props with type Object/Array must use a factory function ' +
  10292. 'to return the default value.',
  10293. vm
  10294. );
  10295. }
  10296. // call factory function for non-Function types
  10297. return typeof def === 'function' && prop.type !== Function
  10298. ? def.call(vm)
  10299. : def
  10300. }
  10301. /**
  10302. * Assert whether a prop is valid.
  10303. */
  10304. function assertProp (
  10305. prop,
  10306. name,
  10307. value,
  10308. vm,
  10309. absent
  10310. ) {
  10311. if (prop.required && absent) {
  10312. warn(
  10313. 'Missing required prop: "' + name + '"',
  10314. vm
  10315. );
  10316. return
  10317. }
  10318. if (value == null && !prop.required) {
  10319. return
  10320. }
  10321. var type = prop.type;
  10322. var valid = !type || type === true;
  10323. var expectedTypes = [];
  10324. if (type) {
  10325. if (!Array.isArray(type)) {
  10326. type = [type];
  10327. }
  10328. for (var i = 0; i < type.length && !valid; i++) {
  10329. var assertedType = assertType(value, type[i]);
  10330. expectedTypes.push(assertedType.expectedType);
  10331. valid = assertedType.valid;
  10332. }
  10333. }
  10334. if (!valid) {
  10335. warn(
  10336. 'Invalid prop: type check failed for prop "' + name + '".' +
  10337. ' Expected ' + expectedTypes.map(capitalize).join(', ') +
  10338. ', got ' + Object.prototype.toString.call(value).slice(8, -1) + '.',
  10339. vm
  10340. );
  10341. return
  10342. }
  10343. var validator = prop.validator;
  10344. if (validator) {
  10345. if (!validator(value)) {
  10346. warn(
  10347. 'Invalid prop: custom validator check failed for prop "' + name + '".',
  10348. vm
  10349. );
  10350. }
  10351. }
  10352. }
  10353. /**
  10354. * Assert the type of a value
  10355. */
  10356. function assertType (value, type) {
  10357. var valid;
  10358. var expectedType = getType(type);
  10359. if (expectedType === 'String') {
  10360. valid = typeof value === (expectedType = 'string');
  10361. } else if (expectedType === 'Number') {
  10362. valid = typeof value === (expectedType = 'number');
  10363. } else if (expectedType === 'Boolean') {
  10364. valid = typeof value === (expectedType = 'boolean');
  10365. } else if (expectedType === 'Function') {
  10366. valid = typeof value === (expectedType = 'function');
  10367. } else if (expectedType === 'Object') {
  10368. valid = isPlainObject(value);
  10369. } else if (expectedType === 'Array') {
  10370. valid = Array.isArray(value);
  10371. } else {
  10372. valid = value instanceof type;
  10373. }
  10374. return {
  10375. valid: valid,
  10376. expectedType: expectedType
  10377. }
  10378. }
  10379. /**
  10380. * Use function string name to check built-in types,
  10381. * because a simple equality check will fail when running
  10382. * across different vms / iframes.
  10383. */
  10384. function getType (fn) {
  10385. var match = fn && fn.toString().match(/^\s*function (\w+)/);
  10386. return match && match[1]
  10387. }
  10388. function isBooleanType (fn) {
  10389. if (!Array.isArray(fn)) {
  10390. return getType(fn) === 'Boolean'
  10391. }
  10392. for (var i = 0, len = fn.length; i < len; i++) {
  10393. if (getType(fn[i]) === 'Boolean') {
  10394. return true
  10395. }
  10396. }
  10397. /* istanbul ignore next */
  10398. return false
  10399. }
  10400. var util = Object.freeze({
  10401. defineReactive: defineReactive$$1,
  10402. _toString: _toString,
  10403. toNumber: toNumber,
  10404. makeMap: makeMap,
  10405. isBuiltInTag: isBuiltInTag,
  10406. remove: remove$1,
  10407. hasOwn: hasOwn,
  10408. isPrimitive: isPrimitive,
  10409. cached: cached,
  10410. camelize: camelize,
  10411. capitalize: capitalize,
  10412. hyphenate: hyphenate,
  10413. bind: bind$1,
  10414. toArray: toArray,
  10415. extend: extend,
  10416. isObject: isObject,
  10417. isPlainObject: isPlainObject,
  10418. toObject: toObject,
  10419. noop: noop,
  10420. no: no,
  10421. genStaticKeys: genStaticKeys,
  10422. looseEqual: looseEqual,
  10423. looseIndexOf: looseIndexOf,
  10424. isReserved: isReserved,
  10425. def: def,
  10426. parsePath: parsePath,
  10427. hasProto: hasProto,
  10428. inBrowser: inBrowser,
  10429. UA: UA,
  10430. isIE: isIE,
  10431. isIE9: isIE9,
  10432. isEdge: isEdge,
  10433. isAndroid: isAndroid,
  10434. isIOS: isIOS,
  10435. devtools: devtools,
  10436. nextTick: nextTick,
  10437. get _Set () { return _Set; },
  10438. mergeOptions: mergeOptions,
  10439. resolveAsset: resolveAsset,
  10440. get warn () { return warn; },
  10441. get formatComponentName () { return formatComponentName; },
  10442. validateProp: validateProp
  10443. });
  10444. /* */
  10445. function initUse (Vue) {
  10446. Vue.use = function (plugin) {
  10447. /* istanbul ignore if */
  10448. if (plugin.installed) {
  10449. return
  10450. }
  10451. // additional parameters
  10452. var args = toArray(arguments, 1);
  10453. args.unshift(this);
  10454. if (typeof plugin.install === 'function') {
  10455. plugin.install.apply(plugin, args);
  10456. } else {
  10457. plugin.apply(null, args);
  10458. }
  10459. plugin.installed = true;
  10460. return this
  10461. };
  10462. }
  10463. /* */
  10464. function initMixin$1 (Vue) {
  10465. Vue.mixin = function (mixin) {
  10466. Vue.options = mergeOptions(Vue.options, mixin);
  10467. };
  10468. }
  10469. /* */
  10470. function initExtend (Vue) {
  10471. /**
  10472. * Each instance constructor, including Vue, has a unique
  10473. * cid. This enables us to create wrapped "child
  10474. * constructors" for prototypal inheritance and cache them.
  10475. */
  10476. Vue.cid = 0;
  10477. var cid = 1;
  10478. /**
  10479. * Class inheritance
  10480. */
  10481. Vue.extend = function (extendOptions) {
  10482. extendOptions = extendOptions || {};
  10483. var Super = this;
  10484. var isFirstExtend = Super.cid === 0;
  10485. if (isFirstExtend && extendOptions._Ctor) {
  10486. return extendOptions._Ctor
  10487. }
  10488. var name = extendOptions.name || Super.options.name;
  10489. if (process.env.NODE_ENV !== 'production') {
  10490. if (!/^[a-zA-Z][\w-]*$/.test(name)) {
  10491. warn(
  10492. 'Invalid component name: "' + name + '". Component names ' +
  10493. 'can only contain alphanumeric characaters and the hyphen.'
  10494. );
  10495. name = null;
  10496. }
  10497. }
  10498. var Sub = function VueComponent (options) {
  10499. this._init(options);
  10500. };
  10501. Sub.prototype = Object.create(Super.prototype);
  10502. Sub.prototype.constructor = Sub;
  10503. Sub.cid = cid++;
  10504. Sub.options = mergeOptions(
  10505. Super.options,
  10506. extendOptions
  10507. );
  10508. Sub['super'] = Super;
  10509. // allow further extension
  10510. Sub.extend = Super.extend;
  10511. // create asset registers, so extended classes
  10512. // can have their private assets too.
  10513. config._assetTypes.forEach(function (type) {
  10514. Sub[type] = Super[type];
  10515. });
  10516. // enable recursive self-lookup
  10517. if (name) {
  10518. Sub.options.components[name] = Sub;
  10519. }
  10520. // keep a reference to the super options at extension time.
  10521. // later at instantiation we can check if Super's options have
  10522. // been updated.
  10523. Sub.superOptions = Super.options;
  10524. Sub.extendOptions = extendOptions;
  10525. // cache constructor
  10526. if (isFirstExtend) {
  10527. extendOptions._Ctor = Sub;
  10528. }
  10529. return Sub
  10530. };
  10531. }
  10532. /* */
  10533. function initAssetRegisters (Vue) {
  10534. /**
  10535. * Create asset registration methods.
  10536. */
  10537. config._assetTypes.forEach(function (type) {
  10538. Vue[type] = function (
  10539. id,
  10540. definition
  10541. ) {
  10542. if (!definition) {
  10543. return this.options[type + 's'][id]
  10544. } else {
  10545. /* istanbul ignore if */
  10546. if (process.env.NODE_ENV !== 'production') {
  10547. if (type === 'component' && config.isReservedTag(id)) {
  10548. warn(
  10549. 'Do not use built-in or reserved HTML elements as component ' +
  10550. 'id: ' + id
  10551. );
  10552. }
  10553. }
  10554. if (type === 'component' && isPlainObject(definition)) {
  10555. definition.name = definition.name || id;
  10556. definition = Vue.extend(definition);
  10557. }
  10558. if (type === 'directive' && typeof definition === 'function') {
  10559. definition = { bind: definition, update: definition };
  10560. }
  10561. this.options[type + 's'][id] = definition;
  10562. return definition
  10563. }
  10564. };
  10565. });
  10566. }
  10567. var KeepAlive = {
  10568. name: 'keep-alive',
  10569. abstract: true,
  10570. created: function created () {
  10571. this.cache = Object.create(null);
  10572. },
  10573. render: function render () {
  10574. var vnode = getFirstComponentChild(this.$slots.default);
  10575. if (vnode && vnode.componentOptions) {
  10576. var opts = vnode.componentOptions;
  10577. var key = vnode.key == null
  10578. // same constructor may get registered as different local components
  10579. // so cid alone is not enough (#3269)
  10580. ? opts.Ctor.cid + '::' + opts.tag
  10581. : vnode.key;
  10582. if (this.cache[key]) {
  10583. vnode.child = this.cache[key].child;
  10584. } else {
  10585. this.cache[key] = vnode;
  10586. }
  10587. vnode.data.keepAlive = true;
  10588. }
  10589. return vnode
  10590. },
  10591. destroyed: function destroyed () {
  10592. var this$1 = this;
  10593. for (var key in this.cache) {
  10594. var vnode = this$1.cache[key];
  10595. callHook(vnode.child, 'deactivated');
  10596. vnode.child.$destroy();
  10597. }
  10598. }
  10599. };
  10600. var builtInComponents = {
  10601. KeepAlive: KeepAlive
  10602. };
  10603. /* */
  10604. function initGlobalAPI (Vue) {
  10605. // config
  10606. var configDef = {};
  10607. configDef.get = function () { return config; };
  10608. if (process.env.NODE_ENV !== 'production') {
  10609. configDef.set = function () {
  10610. warn(
  10611. 'Do not replace the Vue.config object, set individual fields instead.'
  10612. );
  10613. };
  10614. }
  10615. Object.defineProperty(Vue, 'config', configDef);
  10616. Vue.util = util;
  10617. Vue.set = set;
  10618. Vue.delete = del;
  10619. Vue.nextTick = nextTick;
  10620. Vue.options = Object.create(null);
  10621. config._assetTypes.forEach(function (type) {
  10622. Vue.options[type + 's'] = Object.create(null);
  10623. });
  10624. extend(Vue.options.components, builtInComponents);
  10625. initUse(Vue);
  10626. initMixin$1(Vue);
  10627. initExtend(Vue);
  10628. initAssetRegisters(Vue);
  10629. }
  10630. initGlobalAPI(Vue$2);
  10631. Object.defineProperty(Vue$2.prototype, '$isServer', {
  10632. get: function () { return config._isServer; }
  10633. });
  10634. Vue$2.version = '2.0.3';
  10635. /* */
  10636. // attributes that should be using props for binding
  10637. var mustUseProp = makeMap('value,selected,checked,muted');
  10638. var isEnumeratedAttr = makeMap('contenteditable,draggable,spellcheck');
  10639. var isBooleanAttr = makeMap(
  10640. 'allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,' +
  10641. 'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
  10642. 'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
  10643. 'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
  10644. 'required,reversed,scoped,seamless,selected,sortable,translate,' +
  10645. 'truespeed,typemustmatch,visible'
  10646. );
  10647. var isAttr = makeMap(
  10648. 'accept,accept-charset,accesskey,action,align,alt,async,autocomplete,' +
  10649. 'autofocus,autoplay,autosave,bgcolor,border,buffered,challenge,charset,' +
  10650. 'checked,cite,class,code,codebase,color,cols,colspan,content,http-equiv,' +
  10651. 'name,contenteditable,contextmenu,controls,coords,data,datetime,default,' +
  10652. 'defer,dir,dirname,disabled,download,draggable,dropzone,enctype,method,for,' +
  10653. 'form,formaction,headers,<th>,height,hidden,high,href,hreflang,http-equiv,' +
  10654. 'icon,id,ismap,itemprop,keytype,kind,label,lang,language,list,loop,low,' +
  10655. 'manifest,max,maxlength,media,method,GET,POST,min,multiple,email,file,' +
  10656. 'muted,name,novalidate,open,optimum,pattern,ping,placeholder,poster,' +
  10657. 'preload,radiogroup,readonly,rel,required,reversed,rows,rowspan,sandbox,' +
  10658. 'scope,scoped,seamless,selected,shape,size,type,text,password,sizes,span,' +
  10659. 'spellcheck,src,srcdoc,srclang,srcset,start,step,style,summary,tabindex,' +
  10660. 'target,title,type,usemap,value,width,wrap'
  10661. );
  10662. var xlinkNS = 'http://www.w3.org/1999/xlink';
  10663. var isXlink = function (name) {
  10664. return name.charAt(5) === ':' && name.slice(0, 5) === 'xlink'
  10665. };
  10666. var getXlinkProp = function (name) {
  10667. return isXlink(name) ? name.slice(6, name.length) : ''
  10668. };
  10669. var isFalsyAttrValue = function (val) {
  10670. return val == null || val === false
  10671. };
  10672. /* */
  10673. function genClassForVnode (vnode) {
  10674. var data = vnode.data;
  10675. var parentNode = vnode;
  10676. var childNode = vnode;
  10677. while (childNode.child) {
  10678. childNode = childNode.child._vnode;
  10679. if (childNode.data) {
  10680. data = mergeClassData(childNode.data, data);
  10681. }
  10682. }
  10683. while ((parentNode = parentNode.parent)) {
  10684. if (parentNode.data) {
  10685. data = mergeClassData(data, parentNode.data);
  10686. }
  10687. }
  10688. return genClassFromData(data)
  10689. }
  10690. function mergeClassData (child, parent) {
  10691. return {
  10692. staticClass: concat(child.staticClass, parent.staticClass),
  10693. class: child.class
  10694. ? [child.class, parent.class]
  10695. : parent.class
  10696. }
  10697. }
  10698. function genClassFromData (data) {
  10699. var dynamicClass = data.class;
  10700. var staticClass = data.staticClass;
  10701. if (staticClass || dynamicClass) {
  10702. return concat(staticClass, stringifyClass(dynamicClass))
  10703. }
  10704. /* istanbul ignore next */
  10705. return ''
  10706. }
  10707. function concat (a, b) {
  10708. return a ? b ? (a + ' ' + b) : a : (b || '')
  10709. }
  10710. function stringifyClass (value) {
  10711. var res = '';
  10712. if (!value) {
  10713. return res
  10714. }
  10715. if (typeof value === 'string') {
  10716. return value
  10717. }
  10718. if (Array.isArray(value)) {
  10719. var stringified;
  10720. for (var i = 0, l = value.length; i < l; i++) {
  10721. if (value[i]) {
  10722. if ((stringified = stringifyClass(value[i]))) {
  10723. res += stringified + ' ';
  10724. }
  10725. }
  10726. }
  10727. return res.slice(0, -1)
  10728. }
  10729. if (isObject(value)) {
  10730. for (var key in value) {
  10731. if (value[key]) { res += key + ' '; }
  10732. }
  10733. return res.slice(0, -1)
  10734. }
  10735. /* istanbul ignore next */
  10736. return res
  10737. }
  10738. /* */
  10739. var namespaceMap = {
  10740. svg: 'http://www.w3.org/2000/svg',
  10741. math: 'http://www.w3.org/1998/Math/MathML'
  10742. };
  10743. var isHTMLTag = makeMap(
  10744. 'html,body,base,head,link,meta,style,title,' +
  10745. 'address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,' +
  10746. 'div,dd,dl,dt,figcaption,figure,hr,img,li,main,ol,p,pre,ul,' +
  10747. 'a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,' +
  10748. 's,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,' +
  10749. 'embed,object,param,source,canvas,script,noscript,del,ins,' +
  10750. 'caption,col,colgroup,table,thead,tbody,td,th,tr,' +
  10751. 'button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,' +
  10752. 'output,progress,select,textarea,' +
  10753. 'details,dialog,menu,menuitem,summary,' +
  10754. 'content,element,shadow,template'
  10755. );
  10756. var isUnaryTag = makeMap(
  10757. 'area,base,br,col,embed,frame,hr,img,input,isindex,keygen,' +
  10758. 'link,meta,param,source,track,wbr',
  10759. true
  10760. );
  10761. // Elements that you can, intentionally, leave open
  10762. // (and which close themselves)
  10763. var canBeLeftOpenTag = makeMap(
  10764. 'colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source',
  10765. true
  10766. );
  10767. // HTML5 tags https://html.spec.whatwg.org/multipage/indices.html#elements-3
  10768. // Phrasing Content https://html.spec.whatwg.org/multipage/dom.html#phrasing-content
  10769. var isNonPhrasingTag = makeMap(
  10770. 'address,article,aside,base,blockquote,body,caption,col,colgroup,dd,' +
  10771. 'details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,' +
  10772. 'h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,' +
  10773. 'optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,' +
  10774. 'title,tr,track',
  10775. true
  10776. );
  10777. // this map is intentionally selective, only covering SVG elements that may
  10778. // contain child elements.
  10779. var isSVG = makeMap(
  10780. 'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font,' +
  10781. 'font-face,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
  10782. 'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
  10783. true
  10784. );
  10785. var isReservedTag = function (tag) {
  10786. return isHTMLTag(tag) || isSVG(tag)
  10787. };
  10788. function getTagNamespace (tag) {
  10789. if (isSVG(tag)) {
  10790. return 'svg'
  10791. }
  10792. // basic support for MathML
  10793. // note it doesn't support other MathML elements being component roots
  10794. if (tag === 'math') {
  10795. return 'math'
  10796. }
  10797. }
  10798. var unknownElementCache = Object.create(null);
  10799. function isUnknownElement (tag) {
  10800. /* istanbul ignore if */
  10801. if (!inBrowser) {
  10802. return true
  10803. }
  10804. if (isReservedTag(tag)) {
  10805. return false
  10806. }
  10807. tag = tag.toLowerCase();
  10808. /* istanbul ignore if */
  10809. if (unknownElementCache[tag] != null) {
  10810. return unknownElementCache[tag]
  10811. }
  10812. var el = document.createElement(tag);
  10813. if (tag.indexOf('-') > -1) {
  10814. // http://stackoverflow.com/a/28210364/1070244
  10815. return (unknownElementCache[tag] = (
  10816. el.constructor === window.HTMLUnknownElement ||
  10817. el.constructor === window.HTMLElement
  10818. ))
  10819. } else {
  10820. return (unknownElementCache[tag] = /HTMLUnknownElement/.test(el.toString()))
  10821. }
  10822. }
  10823. /* */
  10824. /**
  10825. * Query an element selector if it's not an element already.
  10826. */
  10827. function query (el) {
  10828. if (typeof el === 'string') {
  10829. var selector = el;
  10830. el = document.querySelector(el);
  10831. if (!el) {
  10832. process.env.NODE_ENV !== 'production' && warn(
  10833. 'Cannot find element: ' + selector
  10834. );
  10835. return document.createElement('div')
  10836. }
  10837. }
  10838. return el
  10839. }
  10840. /* */
  10841. function createElement$1 (tagName, vnode) {
  10842. var elm = document.createElement(tagName);
  10843. if (tagName !== 'select') {
  10844. return elm
  10845. }
  10846. if (vnode.data && vnode.data.attrs && 'multiple' in vnode.data.attrs) {
  10847. elm.setAttribute('multiple', 'multiple');
  10848. }
  10849. return elm
  10850. }
  10851. function createElementNS (namespace, tagName) {
  10852. return document.createElementNS(namespaceMap[namespace], tagName)
  10853. }
  10854. function createTextNode (text) {
  10855. return document.createTextNode(text)
  10856. }
  10857. function createComment (text) {
  10858. return document.createComment(text)
  10859. }
  10860. function insertBefore (parentNode, newNode, referenceNode) {
  10861. parentNode.insertBefore(newNode, referenceNode);
  10862. }
  10863. function removeChild (node, child) {
  10864. node.removeChild(child);
  10865. }
  10866. function appendChild (node, child) {
  10867. node.appendChild(child);
  10868. }
  10869. function parentNode (node) {
  10870. return node.parentNode
  10871. }
  10872. function nextSibling (node) {
  10873. return node.nextSibling
  10874. }
  10875. function tagName (node) {
  10876. return node.tagName
  10877. }
  10878. function setTextContent (node, text) {
  10879. node.textContent = text;
  10880. }
  10881. function childNodes (node) {
  10882. return node.childNodes
  10883. }
  10884. function setAttribute (node, key, val) {
  10885. node.setAttribute(key, val);
  10886. }
  10887. var nodeOps = Object.freeze({
  10888. createElement: createElement$1,
  10889. createElementNS: createElementNS,
  10890. createTextNode: createTextNode,
  10891. createComment: createComment,
  10892. insertBefore: insertBefore,
  10893. removeChild: removeChild,
  10894. appendChild: appendChild,
  10895. parentNode: parentNode,
  10896. nextSibling: nextSibling,
  10897. tagName: tagName,
  10898. setTextContent: setTextContent,
  10899. childNodes: childNodes,
  10900. setAttribute: setAttribute
  10901. });
  10902. /* */
  10903. var ref = {
  10904. create: function create (_, vnode) {
  10905. registerRef(vnode);
  10906. },
  10907. update: function update (oldVnode, vnode) {
  10908. if (oldVnode.data.ref !== vnode.data.ref) {
  10909. registerRef(oldVnode, true);
  10910. registerRef(vnode);
  10911. }
  10912. },
  10913. destroy: function destroy (vnode) {
  10914. registerRef(vnode, true);
  10915. }
  10916. };
  10917. function registerRef (vnode, isRemoval) {
  10918. var key = vnode.data.ref;
  10919. if (!key) { return }
  10920. var vm = vnode.context;
  10921. var ref = vnode.child || vnode.elm;
  10922. var refs = vm.$refs;
  10923. if (isRemoval) {
  10924. if (Array.isArray(refs[key])) {
  10925. remove$1(refs[key], ref);
  10926. } else if (refs[key] === ref) {
  10927. refs[key] = undefined;
  10928. }
  10929. } else {
  10930. if (vnode.data.refInFor) {
  10931. if (Array.isArray(refs[key])) {
  10932. refs[key].push(ref);
  10933. } else {
  10934. refs[key] = [ref];
  10935. }
  10936. } else {
  10937. refs[key] = ref;
  10938. }
  10939. }
  10940. }
  10941. /**
  10942. * Virtual DOM patching algorithm based on Snabbdom by
  10943. * Simon Friis Vindum (@paldepind)
  10944. * Licensed under the MIT License
  10945. * https://github.com/paldepind/snabbdom/blob/master/LICENSE
  10946. *
  10947. * modified by Evan You (@yyx990803)
  10948. *
  10949. /*
  10950. * Not type-checking this because this file is perf-critical and the cost
  10951. * of making flow understand it is not worth it.
  10952. */
  10953. var emptyNode = new VNode('', {}, []);
  10954. var hooks$1 = ['create', 'update', 'remove', 'destroy'];
  10955. function isUndef (s) {
  10956. return s == null
  10957. }
  10958. function isDef (s) {
  10959. return s != null
  10960. }
  10961. function sameVnode (vnode1, vnode2) {
  10962. return (
  10963. vnode1.key === vnode2.key &&
  10964. vnode1.tag === vnode2.tag &&
  10965. vnode1.isComment === vnode2.isComment &&
  10966. !vnode1.data === !vnode2.data
  10967. )
  10968. }
  10969. function createKeyToOldIdx (children, beginIdx, endIdx) {
  10970. var i, key;
  10971. var map = {};
  10972. for (i = beginIdx; i <= endIdx; ++i) {
  10973. key = children[i].key;
  10974. if (isDef(key)) { map[key] = i; }
  10975. }
  10976. return map
  10977. }
  10978. function createPatchFunction (backend) {
  10979. var i, j;
  10980. var cbs = {};
  10981. var modules = backend.modules;
  10982. var nodeOps = backend.nodeOps;
  10983. for (i = 0; i < hooks$1.length; ++i) {
  10984. cbs[hooks$1[i]] = [];
  10985. for (j = 0; j < modules.length; ++j) {
  10986. if (modules[j][hooks$1[i]] !== undefined) { cbs[hooks$1[i]].push(modules[j][hooks$1[i]]); }
  10987. }
  10988. }
  10989. function emptyNodeAt (elm) {
  10990. return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
  10991. }
  10992. function createRmCb (childElm, listeners) {
  10993. function remove$$1 () {
  10994. if (--remove$$1.listeners === 0) {
  10995. removeElement(childElm);
  10996. }
  10997. }
  10998. remove$$1.listeners = listeners;
  10999. return remove$$1
  11000. }
  11001. function removeElement (el) {
  11002. var parent = nodeOps.parentNode(el);
  11003. nodeOps.removeChild(parent, el);
  11004. }
  11005. function createElm (vnode, insertedVnodeQueue, nested) {
  11006. var i;
  11007. var data = vnode.data;
  11008. vnode.isRootInsert = !nested;
  11009. if (isDef(data)) {
  11010. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode); }
  11011. // after calling the init hook, if the vnode is a child component
  11012. // it should've created a child instance and mounted it. the child
  11013. // component also has set the placeholder vnode's elm.
  11014. // in that case we can just return the element and be done.
  11015. if (isDef(i = vnode.child)) {
  11016. initComponent(vnode, insertedVnodeQueue);
  11017. return vnode.elm
  11018. }
  11019. }
  11020. var children = vnode.children;
  11021. var tag = vnode.tag;
  11022. if (isDef(tag)) {
  11023. if (process.env.NODE_ENV !== 'production') {
  11024. if (
  11025. !vnode.ns &&
  11026. !(config.ignoredElements && config.ignoredElements.indexOf(tag) > -1) &&
  11027. config.isUnknownElement(tag)
  11028. ) {
  11029. warn(
  11030. 'Unknown custom element: <' + tag + '> - did you ' +
  11031. 'register the component correctly? For recursive components, ' +
  11032. 'make sure to provide the "name" option.',
  11033. vnode.context
  11034. );
  11035. }
  11036. }
  11037. vnode.elm = vnode.ns
  11038. ? nodeOps.createElementNS(vnode.ns, tag)
  11039. : nodeOps.createElement(tag, vnode);
  11040. setScope(vnode);
  11041. createChildren(vnode, children, insertedVnodeQueue);
  11042. if (isDef(data)) {
  11043. invokeCreateHooks(vnode, insertedVnodeQueue);
  11044. }
  11045. } else if (vnode.isComment) {
  11046. vnode.elm = nodeOps.createComment(vnode.text);
  11047. } else {
  11048. vnode.elm = nodeOps.createTextNode(vnode.text);
  11049. }
  11050. return vnode.elm
  11051. }
  11052. function createChildren (vnode, children, insertedVnodeQueue) {
  11053. if (Array.isArray(children)) {
  11054. for (var i = 0; i < children.length; ++i) {
  11055. nodeOps.appendChild(vnode.elm, createElm(children[i], insertedVnodeQueue, true));
  11056. }
  11057. } else if (isPrimitive(vnode.text)) {
  11058. nodeOps.appendChild(vnode.elm, nodeOps.createTextNode(vnode.text));
  11059. }
  11060. }
  11061. function isPatchable (vnode) {
  11062. while (vnode.child) {
  11063. vnode = vnode.child._vnode;
  11064. }
  11065. return isDef(vnode.tag)
  11066. }
  11067. function invokeCreateHooks (vnode, insertedVnodeQueue) {
  11068. for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {
  11069. cbs.create[i$1](emptyNode, vnode);
  11070. }
  11071. i = vnode.data.hook; // Reuse variable
  11072. if (isDef(i)) {
  11073. if (i.create) { i.create(emptyNode, vnode); }
  11074. if (i.insert) { insertedVnodeQueue.push(vnode); }
  11075. }
  11076. }
  11077. function initComponent (vnode, insertedVnodeQueue) {
  11078. if (vnode.data.pendingInsert) {
  11079. insertedVnodeQueue.push.apply(insertedVnodeQueue, vnode.data.pendingInsert);
  11080. }
  11081. vnode.elm = vnode.child.$el;
  11082. if (isPatchable(vnode)) {
  11083. invokeCreateHooks(vnode, insertedVnodeQueue);
  11084. setScope(vnode);
  11085. } else {
  11086. // empty component root.
  11087. // skip all element-related modules except for ref (#3455)
  11088. registerRef(vnode);
  11089. // make sure to invoke the insert hook
  11090. insertedVnodeQueue.push(vnode);
  11091. }
  11092. }
  11093. // set scope id attribute for scoped CSS.
  11094. // this is implemented as a special case to avoid the overhead
  11095. // of going through the normal attribute patching process.
  11096. function setScope (vnode) {
  11097. var i;
  11098. if (isDef(i = vnode.context) && isDef(i = i.$options._scopeId)) {
  11099. nodeOps.setAttribute(vnode.elm, i, '');
  11100. }
  11101. if (isDef(i = activeInstance) &&
  11102. i !== vnode.context &&
  11103. isDef(i = i.$options._scopeId)) {
  11104. nodeOps.setAttribute(vnode.elm, i, '');
  11105. }
  11106. }
  11107. function addVnodes (parentElm, before, vnodes, startIdx, endIdx, insertedVnodeQueue) {
  11108. for (; startIdx <= endIdx; ++startIdx) {
  11109. nodeOps.insertBefore(parentElm, createElm(vnodes[startIdx], insertedVnodeQueue), before);
  11110. }
  11111. }
  11112. function invokeDestroyHook (vnode) {
  11113. var i, j;
  11114. var data = vnode.data;
  11115. if (isDef(data)) {
  11116. if (isDef(i = data.hook) && isDef(i = i.destroy)) { i(vnode); }
  11117. for (i = 0; i < cbs.destroy.length; ++i) { cbs.destroy[i](vnode); }
  11118. }
  11119. if (isDef(i = vnode.children)) {
  11120. for (j = 0; j < vnode.children.length; ++j) {
  11121. invokeDestroyHook(vnode.children[j]);
  11122. }
  11123. }
  11124. }
  11125. function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
  11126. for (; startIdx <= endIdx; ++startIdx) {
  11127. var ch = vnodes[startIdx];
  11128. if (isDef(ch)) {
  11129. if (isDef(ch.tag)) {
  11130. removeAndInvokeRemoveHook(ch);
  11131. invokeDestroyHook(ch);
  11132. } else { // Text node
  11133. nodeOps.removeChild(parentElm, ch.elm);
  11134. }
  11135. }
  11136. }
  11137. }
  11138. function removeAndInvokeRemoveHook (vnode, rm) {
  11139. if (rm || isDef(vnode.data)) {
  11140. var listeners = cbs.remove.length + 1;
  11141. if (!rm) {
  11142. // directly removing
  11143. rm = createRmCb(vnode.elm, listeners);
  11144. } else {
  11145. // we have a recursively passed down rm callback
  11146. // increase the listeners count
  11147. rm.listeners += listeners;
  11148. }
  11149. // recursively invoke hooks on child component root node
  11150. if (isDef(i = vnode.child) && isDef(i = i._vnode) && isDef(i.data)) {
  11151. removeAndInvokeRemoveHook(i, rm);
  11152. }
  11153. for (i = 0; i < cbs.remove.length; ++i) {
  11154. cbs.remove[i](vnode, rm);
  11155. }
  11156. if (isDef(i = vnode.data.hook) && isDef(i = i.remove)) {
  11157. i(vnode, rm);
  11158. } else {
  11159. rm();
  11160. }
  11161. } else {
  11162. removeElement(vnode.elm);
  11163. }
  11164. }
  11165. function updateChildren (parentElm, oldCh, newCh, insertedVnodeQueue, removeOnly) {
  11166. var oldStartIdx = 0;
  11167. var newStartIdx = 0;
  11168. var oldEndIdx = oldCh.length - 1;
  11169. var oldStartVnode = oldCh[0];
  11170. var oldEndVnode = oldCh[oldEndIdx];
  11171. var newEndIdx = newCh.length - 1;
  11172. var newStartVnode = newCh[0];
  11173. var newEndVnode = newCh[newEndIdx];
  11174. var oldKeyToIdx, idxInOld, elmToMove, before;
  11175. // removeOnly is a special flag used only by <transition-group>
  11176. // to ensure removed elements stay in correct relative positions
  11177. // during leaving transitions
  11178. var canMove = !removeOnly;
  11179. while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
  11180. if (isUndef(oldStartVnode)) {
  11181. oldStartVnode = oldCh[++oldStartIdx]; // Vnode has been moved left
  11182. } else if (isUndef(oldEndVnode)) {
  11183. oldEndVnode = oldCh[--oldEndIdx];
  11184. } else if (sameVnode(oldStartVnode, newStartVnode)) {
  11185. patchVnode(oldStartVnode, newStartVnode, insertedVnodeQueue);
  11186. oldStartVnode = oldCh[++oldStartIdx];
  11187. newStartVnode = newCh[++newStartIdx];
  11188. } else if (sameVnode(oldEndVnode, newEndVnode)) {
  11189. patchVnode(oldEndVnode, newEndVnode, insertedVnodeQueue);
  11190. oldEndVnode = oldCh[--oldEndIdx];
  11191. newEndVnode = newCh[--newEndIdx];
  11192. } else if (sameVnode(oldStartVnode, newEndVnode)) { // Vnode moved right
  11193. patchVnode(oldStartVnode, newEndVnode, insertedVnodeQueue);
  11194. canMove && nodeOps.insertBefore(parentElm, oldStartVnode.elm, nodeOps.nextSibling(oldEndVnode.elm));
  11195. oldStartVnode = oldCh[++oldStartIdx];
  11196. newEndVnode = newCh[--newEndIdx];
  11197. } else if (sameVnode(oldEndVnode, newStartVnode)) { // Vnode moved left
  11198. patchVnode(oldEndVnode, newStartVnode, insertedVnodeQueue);
  11199. canMove && nodeOps.insertBefore(parentElm, oldEndVnode.elm, oldStartVnode.elm);
  11200. oldEndVnode = oldCh[--oldEndIdx];
  11201. newStartVnode = newCh[++newStartIdx];
  11202. } else {
  11203. if (isUndef(oldKeyToIdx)) { oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx); }
  11204. idxInOld = isDef(newStartVnode.key) ? oldKeyToIdx[newStartVnode.key] : null;
  11205. if (isUndef(idxInOld)) { // New element
  11206. nodeOps.insertBefore(parentElm, createElm(newStartVnode, insertedVnodeQueue), oldStartVnode.elm);
  11207. newStartVnode = newCh[++newStartIdx];
  11208. } else {
  11209. elmToMove = oldCh[idxInOld];
  11210. /* istanbul ignore if */
  11211. if (process.env.NODE_ENV !== 'production' && !elmToMove) {
  11212. warn(
  11213. 'It seems there are duplicate keys that is causing an update error. ' +
  11214. 'Make sure each v-for item has a unique key.'
  11215. );
  11216. }
  11217. if (elmToMove.tag !== newStartVnode.tag) {
  11218. // same key but different element. treat as new element
  11219. nodeOps.insertBefore(parentElm, createElm(newStartVnode, insertedVnodeQueue), oldStartVnode.elm);
  11220. newStartVnode = newCh[++newStartIdx];
  11221. } else {
  11222. patchVnode(elmToMove, newStartVnode, insertedVnodeQueue);
  11223. oldCh[idxInOld] = undefined;
  11224. canMove && nodeOps.insertBefore(parentElm, newStartVnode.elm, oldStartVnode.elm);
  11225. newStartVnode = newCh[++newStartIdx];
  11226. }
  11227. }
  11228. }
  11229. }
  11230. if (oldStartIdx > oldEndIdx) {
  11231. before = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
  11232. addVnodes(parentElm, before, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
  11233. } else if (newStartIdx > newEndIdx) {
  11234. removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
  11235. }
  11236. }
  11237. function patchVnode (oldVnode, vnode, insertedVnodeQueue, removeOnly) {
  11238. if (oldVnode === vnode) {
  11239. return
  11240. }
  11241. // reuse element for static trees.
  11242. // note we only do this if the vnode is cloned -
  11243. // if the new node is not cloned it means the render functions have been
  11244. // reset by the hot-reload-api and we need to do a proper re-render.
  11245. if (vnode.isStatic &&
  11246. oldVnode.isStatic &&
  11247. vnode.key === oldVnode.key &&
  11248. vnode.isCloned) {
  11249. vnode.elm = oldVnode.elm;
  11250. return
  11251. }
  11252. var i;
  11253. var data = vnode.data;
  11254. var hasData = isDef(data);
  11255. if (hasData && isDef(i = data.hook) && isDef(i = i.prepatch)) {
  11256. i(oldVnode, vnode);
  11257. }
  11258. var elm = vnode.elm = oldVnode.elm;
  11259. var oldCh = oldVnode.children;
  11260. var ch = vnode.children;
  11261. if (hasData && isPatchable(vnode)) {
  11262. for (i = 0; i < cbs.update.length; ++i) { cbs.update[i](oldVnode, vnode); }
  11263. if (isDef(i = data.hook) && isDef(i = i.update)) { i(oldVnode, vnode); }
  11264. }
  11265. if (isUndef(vnode.text)) {
  11266. if (isDef(oldCh) && isDef(ch)) {
  11267. if (oldCh !== ch) { updateChildren(elm, oldCh, ch, insertedVnodeQueue, removeOnly); }
  11268. } else if (isDef(ch)) {
  11269. if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
  11270. addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
  11271. } else if (isDef(oldCh)) {
  11272. removeVnodes(elm, oldCh, 0, oldCh.length - 1);
  11273. } else if (isDef(oldVnode.text)) {
  11274. nodeOps.setTextContent(elm, '');
  11275. }
  11276. } else if (oldVnode.text !== vnode.text) {
  11277. nodeOps.setTextContent(elm, vnode.text);
  11278. }
  11279. if (hasData) {
  11280. if (isDef(i = data.hook) && isDef(i = i.postpatch)) { i(oldVnode, vnode); }
  11281. }
  11282. }
  11283. function invokeInsertHook (vnode, queue, initial) {
  11284. // delay insert hooks for component root nodes, invoke them after the
  11285. // element is really inserted
  11286. if (initial && vnode.parent) {
  11287. vnode.parent.data.pendingInsert = queue;
  11288. } else {
  11289. for (var i = 0; i < queue.length; ++i) {
  11290. queue[i].data.hook.insert(queue[i]);
  11291. }
  11292. }
  11293. }
  11294. var bailed = false;
  11295. function hydrate (elm, vnode, insertedVnodeQueue) {
  11296. if (process.env.NODE_ENV !== 'production') {
  11297. if (!assertNodeMatch(elm, vnode)) {
  11298. return false
  11299. }
  11300. }
  11301. vnode.elm = elm;
  11302. var tag = vnode.tag;
  11303. var data = vnode.data;
  11304. var children = vnode.children;
  11305. if (isDef(data)) {
  11306. if (isDef(i = data.hook) && isDef(i = i.init)) { i(vnode, true /* hydrating */); }
  11307. if (isDef(i = vnode.child)) {
  11308. // child component. it should have hydrated its own tree.
  11309. initComponent(vnode, insertedVnodeQueue);
  11310. return true
  11311. }
  11312. }
  11313. if (isDef(tag)) {
  11314. if (isDef(children)) {
  11315. var childNodes = nodeOps.childNodes(elm);
  11316. // empty element, allow client to pick up and populate children
  11317. if (!childNodes.length) {
  11318. createChildren(vnode, children, insertedVnodeQueue);
  11319. } else {
  11320. var childrenMatch = true;
  11321. if (childNodes.length !== children.length) {
  11322. childrenMatch = false;
  11323. } else {
  11324. for (var i$1 = 0; i$1 < children.length; i$1++) {
  11325. if (!hydrate(childNodes[i$1], children[i$1], insertedVnodeQueue)) {
  11326. childrenMatch = false;
  11327. break
  11328. }
  11329. }
  11330. }
  11331. if (!childrenMatch) {
  11332. if (process.env.NODE_ENV !== 'production' &&
  11333. typeof console !== 'undefined' &&
  11334. !bailed) {
  11335. bailed = true;
  11336. console.warn('Parent: ', elm);
  11337. console.warn('Mismatching childNodes vs. VNodes: ', childNodes, children);
  11338. }
  11339. return false
  11340. }
  11341. }
  11342. }
  11343. if (isDef(data)) {
  11344. invokeCreateHooks(vnode, insertedVnodeQueue);
  11345. }
  11346. }
  11347. return true
  11348. }
  11349. function assertNodeMatch (node, vnode) {
  11350. if (vnode.tag) {
  11351. return (
  11352. vnode.tag.indexOf('vue-component') === 0 ||
  11353. vnode.tag === nodeOps.tagName(node).toLowerCase()
  11354. )
  11355. } else {
  11356. return _toString(vnode.text) === node.data
  11357. }
  11358. }
  11359. return function patch (oldVnode, vnode, hydrating, removeOnly) {
  11360. if (!vnode) {
  11361. if (oldVnode) { invokeDestroyHook(oldVnode); }
  11362. return
  11363. }
  11364. var elm, parent;
  11365. var isInitialPatch = false;
  11366. var insertedVnodeQueue = [];
  11367. if (!oldVnode) {
  11368. // empty mount, create new root element
  11369. isInitialPatch = true;
  11370. createElm(vnode, insertedVnodeQueue);
  11371. } else {
  11372. var isRealElement = isDef(oldVnode.nodeType);
  11373. if (!isRealElement && sameVnode(oldVnode, vnode)) {
  11374. patchVnode(oldVnode, vnode, insertedVnodeQueue, removeOnly);
  11375. } else {
  11376. if (isRealElement) {
  11377. // mounting to a real element
  11378. // check if this is server-rendered content and if we can perform
  11379. // a successful hydration.
  11380. if (oldVnode.nodeType === 1 && oldVnode.hasAttribute('server-rendered')) {
  11381. oldVnode.removeAttribute('server-rendered');
  11382. hydrating = true;
  11383. }
  11384. if (hydrating) {
  11385. if (hydrate(oldVnode, vnode, insertedVnodeQueue)) {
  11386. invokeInsertHook(vnode, insertedVnodeQueue, true);
  11387. return oldVnode
  11388. } else if (process.env.NODE_ENV !== 'production') {
  11389. warn(
  11390. 'The client-side rendered virtual DOM tree is not matching ' +
  11391. 'server-rendered content. This is likely caused by incorrect ' +
  11392. 'HTML markup, for example nesting block-level elements inside ' +
  11393. '<p>, or missing <tbody>. Bailing hydration and performing ' +
  11394. 'full client-side render.'
  11395. );
  11396. }
  11397. }
  11398. // either not server-rendered, or hydration failed.
  11399. // create an empty node and replace it
  11400. oldVnode = emptyNodeAt(oldVnode);
  11401. }
  11402. elm = oldVnode.elm;
  11403. parent = nodeOps.parentNode(elm);
  11404. createElm(vnode, insertedVnodeQueue);
  11405. // component root element replaced.
  11406. // update parent placeholder node element.
  11407. if (vnode.parent) {
  11408. vnode.parent.elm = vnode.elm;
  11409. if (isPatchable(vnode)) {
  11410. for (var i = 0; i < cbs.create.length; ++i) {
  11411. cbs.create[i](emptyNode, vnode.parent);
  11412. }
  11413. }
  11414. }
  11415. if (parent !== null) {
  11416. nodeOps.insertBefore(parent, vnode.elm, nodeOps.nextSibling(elm));
  11417. removeVnodes(parent, [oldVnode], 0, 0);
  11418. } else if (isDef(oldVnode.tag)) {
  11419. invokeDestroyHook(oldVnode);
  11420. }
  11421. }
  11422. }
  11423. invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);
  11424. return vnode.elm
  11425. }
  11426. }
  11427. /* */
  11428. var directives = {
  11429. create: updateDirectives,
  11430. update: updateDirectives,
  11431. destroy: function unbindDirectives (vnode) {
  11432. updateDirectives(vnode, emptyNode);
  11433. }
  11434. };
  11435. function updateDirectives (
  11436. oldVnode,
  11437. vnode
  11438. ) {
  11439. if (!oldVnode.data.directives && !vnode.data.directives) {
  11440. return
  11441. }
  11442. var isCreate = oldVnode === emptyNode;
  11443. var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);
  11444. var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);
  11445. var dirsWithInsert = [];
  11446. var dirsWithPostpatch = [];
  11447. var key, oldDir, dir;
  11448. for (key in newDirs) {
  11449. oldDir = oldDirs[key];
  11450. dir = newDirs[key];
  11451. if (!oldDir) {
  11452. // new directive, bind
  11453. callHook$1(dir, 'bind', vnode, oldVnode);
  11454. if (dir.def && dir.def.inserted) {
  11455. dirsWithInsert.push(dir);
  11456. }
  11457. } else {
  11458. // existing directive, update
  11459. dir.oldValue = oldDir.value;
  11460. callHook$1(dir, 'update', vnode, oldVnode);
  11461. if (dir.def && dir.def.componentUpdated) {
  11462. dirsWithPostpatch.push(dir);
  11463. }
  11464. }
  11465. }
  11466. if (dirsWithInsert.length) {
  11467. var callInsert = function () {
  11468. dirsWithInsert.forEach(function (dir) {
  11469. callHook$1(dir, 'inserted', vnode, oldVnode);
  11470. });
  11471. };
  11472. if (isCreate) {
  11473. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', callInsert, 'dir-insert');
  11474. } else {
  11475. callInsert();
  11476. }
  11477. }
  11478. if (dirsWithPostpatch.length) {
  11479. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'postpatch', function () {
  11480. dirsWithPostpatch.forEach(function (dir) {
  11481. callHook$1(dir, 'componentUpdated', vnode, oldVnode);
  11482. });
  11483. }, 'dir-postpatch');
  11484. }
  11485. if (!isCreate) {
  11486. for (key in oldDirs) {
  11487. if (!newDirs[key]) {
  11488. // no longer present, unbind
  11489. callHook$1(oldDirs[key], 'unbind', oldVnode);
  11490. }
  11491. }
  11492. }
  11493. }
  11494. var emptyModifiers = Object.create(null);
  11495. function normalizeDirectives$1 (
  11496. dirs,
  11497. vm
  11498. ) {
  11499. var res = Object.create(null);
  11500. if (!dirs) {
  11501. return res
  11502. }
  11503. var i, dir;
  11504. for (i = 0; i < dirs.length; i++) {
  11505. dir = dirs[i];
  11506. if (!dir.modifiers) {
  11507. dir.modifiers = emptyModifiers;
  11508. }
  11509. res[getRawDirName(dir)] = dir;
  11510. dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);
  11511. }
  11512. return res
  11513. }
  11514. function getRawDirName (dir) {
  11515. return dir.rawName || ((dir.name) + "." + (Object.keys(dir.modifiers || {}).join('.')))
  11516. }
  11517. function callHook$1 (dir, hook, vnode, oldVnode) {
  11518. var fn = dir.def && dir.def[hook];
  11519. if (fn) {
  11520. fn(vnode.elm, dir, vnode, oldVnode);
  11521. }
  11522. }
  11523. var baseModules = [
  11524. ref,
  11525. directives
  11526. ];
  11527. /* */
  11528. function updateAttrs (oldVnode, vnode) {
  11529. if (!oldVnode.data.attrs && !vnode.data.attrs) {
  11530. return
  11531. }
  11532. var key, cur, old;
  11533. var elm = vnode.elm;
  11534. var oldAttrs = oldVnode.data.attrs || {};
  11535. var attrs = vnode.data.attrs || {};
  11536. // clone observed objects, as the user probably wants to mutate it
  11537. if (attrs.__ob__) {
  11538. attrs = vnode.data.attrs = extend({}, attrs);
  11539. }
  11540. for (key in attrs) {
  11541. cur = attrs[key];
  11542. old = oldAttrs[key];
  11543. if (old !== cur) {
  11544. setAttr(elm, key, cur);
  11545. }
  11546. }
  11547. for (key in oldAttrs) {
  11548. if (attrs[key] == null) {
  11549. if (isXlink(key)) {
  11550. elm.removeAttributeNS(xlinkNS, getXlinkProp(key));
  11551. } else if (!isEnumeratedAttr(key)) {
  11552. elm.removeAttribute(key);
  11553. }
  11554. }
  11555. }
  11556. }
  11557. function setAttr (el, key, value) {
  11558. if (isBooleanAttr(key)) {
  11559. // set attribute for blank value
  11560. // e.g. <option disabled>Select one</option>
  11561. if (isFalsyAttrValue(value)) {
  11562. el.removeAttribute(key);
  11563. } else {
  11564. el.setAttribute(key, key);
  11565. }
  11566. } else if (isEnumeratedAttr(key)) {
  11567. el.setAttribute(key, isFalsyAttrValue(value) || value === 'false' ? 'false' : 'true');
  11568. } else if (isXlink(key)) {
  11569. if (isFalsyAttrValue(value)) {
  11570. el.removeAttributeNS(xlinkNS, getXlinkProp(key));
  11571. } else {
  11572. el.setAttributeNS(xlinkNS, key, value);
  11573. }
  11574. } else {
  11575. if (isFalsyAttrValue(value)) {
  11576. el.removeAttribute(key);
  11577. } else {
  11578. el.setAttribute(key, value);
  11579. }
  11580. }
  11581. }
  11582. var attrs = {
  11583. create: updateAttrs,
  11584. update: updateAttrs
  11585. };
  11586. /* */
  11587. function updateClass (oldVnode, vnode) {
  11588. var el = vnode.elm;
  11589. var data = vnode.data;
  11590. var oldData = oldVnode.data;
  11591. if (!data.staticClass && !data.class &&
  11592. (!oldData || (!oldData.staticClass && !oldData.class))) {
  11593. return
  11594. }
  11595. var cls = genClassForVnode(vnode);
  11596. // handle transition classes
  11597. var transitionClass = el._transitionClasses;
  11598. if (transitionClass) {
  11599. cls = concat(cls, stringifyClass(transitionClass));
  11600. }
  11601. // set the class
  11602. if (cls !== el._prevClass) {
  11603. el.setAttribute('class', cls);
  11604. el._prevClass = cls;
  11605. }
  11606. }
  11607. var klass = {
  11608. create: updateClass,
  11609. update: updateClass
  11610. };
  11611. // skip type checking this file because we need to attach private properties
  11612. // to elements
  11613. function updateDOMListeners (oldVnode, vnode) {
  11614. if (!oldVnode.data.on && !vnode.data.on) {
  11615. return
  11616. }
  11617. var on = vnode.data.on || {};
  11618. var oldOn = oldVnode.data.on || {};
  11619. var add = vnode.elm._v_add || (vnode.elm._v_add = function (event, handler, capture) {
  11620. vnode.elm.addEventListener(event, handler, capture);
  11621. });
  11622. var remove = vnode.elm._v_remove || (vnode.elm._v_remove = function (event, handler) {
  11623. vnode.elm.removeEventListener(event, handler);
  11624. });
  11625. updateListeners(on, oldOn, add, remove, vnode.context);
  11626. }
  11627. var events = {
  11628. create: updateDOMListeners,
  11629. update: updateDOMListeners
  11630. };
  11631. /* */
  11632. function updateDOMProps (oldVnode, vnode) {
  11633. if (!oldVnode.data.domProps && !vnode.data.domProps) {
  11634. return
  11635. }
  11636. var key, cur;
  11637. var elm = vnode.elm;
  11638. var oldProps = oldVnode.data.domProps || {};
  11639. var props = vnode.data.domProps || {};
  11640. // clone observed objects, as the user probably wants to mutate it
  11641. if (props.__ob__) {
  11642. props = vnode.data.domProps = extend({}, props);
  11643. }
  11644. for (key in oldProps) {
  11645. if (props[key] == null) {
  11646. elm[key] = undefined;
  11647. }
  11648. }
  11649. for (key in props) {
  11650. // ignore children if the node has textContent or innerHTML,
  11651. // as these will throw away existing DOM nodes and cause removal errors
  11652. // on subsequent patches (#3360)
  11653. if ((key === 'textContent' || key === 'innerHTML') && vnode.children) {
  11654. vnode.children.length = 0;
  11655. }
  11656. cur = props[key];
  11657. if (key === 'value') {
  11658. // store value as _value as well since
  11659. // non-string values will be stringified
  11660. elm._value = cur;
  11661. // avoid resetting cursor position when value is the same
  11662. var strCur = cur == null ? '' : String(cur);
  11663. if (elm.value !== strCur && !elm.composing) {
  11664. elm.value = strCur;
  11665. }
  11666. } else {
  11667. elm[key] = cur;
  11668. }
  11669. }
  11670. }
  11671. var domProps = {
  11672. create: updateDOMProps,
  11673. update: updateDOMProps
  11674. };
  11675. /* */
  11676. var prefixes = ['Webkit', 'Moz', 'ms'];
  11677. var testEl;
  11678. var normalize = cached(function (prop) {
  11679. testEl = testEl || document.createElement('div');
  11680. prop = camelize(prop);
  11681. if (prop !== 'filter' && (prop in testEl.style)) {
  11682. return prop
  11683. }
  11684. var upper = prop.charAt(0).toUpperCase() + prop.slice(1);
  11685. for (var i = 0; i < prefixes.length; i++) {
  11686. var prefixed = prefixes[i] + upper;
  11687. if (prefixed in testEl.style) {
  11688. return prefixed
  11689. }
  11690. }
  11691. });
  11692. function updateStyle (oldVnode, vnode) {
  11693. if ((!oldVnode.data || !oldVnode.data.style) && !vnode.data.style) {
  11694. return
  11695. }
  11696. var cur, name;
  11697. var el = vnode.elm;
  11698. var oldStyle = oldVnode.data.style || {};
  11699. var style = vnode.data.style || {};
  11700. // handle string
  11701. if (typeof style === 'string') {
  11702. el.style.cssText = style;
  11703. return
  11704. }
  11705. var needClone = style.__ob__;
  11706. // handle array syntax
  11707. if (Array.isArray(style)) {
  11708. style = vnode.data.style = toObject(style);
  11709. }
  11710. // clone the style for future updates,
  11711. // in case the user mutates the style object in-place.
  11712. if (needClone) {
  11713. style = vnode.data.style = extend({}, style);
  11714. }
  11715. for (name in oldStyle) {
  11716. if (style[name] == null) {
  11717. el.style[normalize(name)] = '';
  11718. }
  11719. }
  11720. for (name in style) {
  11721. cur = style[name];
  11722. if (cur !== oldStyle[name]) {
  11723. // ie9 setting to null has no effect, must use empty string
  11724. el.style[normalize(name)] = cur == null ? '' : cur;
  11725. }
  11726. }
  11727. }
  11728. var style = {
  11729. create: updateStyle,
  11730. update: updateStyle
  11731. };
  11732. /* */
  11733. /**
  11734. * Add class with compatibility for SVG since classList is not supported on
  11735. * SVG elements in IE
  11736. */
  11737. function addClass (el, cls) {
  11738. /* istanbul ignore else */
  11739. if (el.classList) {
  11740. if (cls.indexOf(' ') > -1) {
  11741. cls.split(/\s+/).forEach(function (c) { return el.classList.add(c); });
  11742. } else {
  11743. el.classList.add(cls);
  11744. }
  11745. } else {
  11746. var cur = ' ' + el.getAttribute('class') + ' ';
  11747. if (cur.indexOf(' ' + cls + ' ') < 0) {
  11748. el.setAttribute('class', (cur + cls).trim());
  11749. }
  11750. }
  11751. }
  11752. /**
  11753. * Remove class with compatibility for SVG since classList is not supported on
  11754. * SVG elements in IE
  11755. */
  11756. function removeClass (el, cls) {
  11757. /* istanbul ignore else */
  11758. if (el.classList) {
  11759. if (cls.indexOf(' ') > -1) {
  11760. cls.split(/\s+/).forEach(function (c) { return el.classList.remove(c); });
  11761. } else {
  11762. el.classList.remove(cls);
  11763. }
  11764. } else {
  11765. var cur = ' ' + el.getAttribute('class') + ' ';
  11766. var tar = ' ' + cls + ' ';
  11767. while (cur.indexOf(tar) >= 0) {
  11768. cur = cur.replace(tar, ' ');
  11769. }
  11770. el.setAttribute('class', cur.trim());
  11771. }
  11772. }
  11773. /* */
  11774. var hasTransition = inBrowser && !isIE9;
  11775. var TRANSITION = 'transition';
  11776. var ANIMATION = 'animation';
  11777. // Transition property/event sniffing
  11778. var transitionProp = 'transition';
  11779. var transitionEndEvent = 'transitionend';
  11780. var animationProp = 'animation';
  11781. var animationEndEvent = 'animationend';
  11782. if (hasTransition) {
  11783. /* istanbul ignore if */
  11784. if (window.ontransitionend === undefined &&
  11785. window.onwebkittransitionend !== undefined) {
  11786. transitionProp = 'WebkitTransition';
  11787. transitionEndEvent = 'webkitTransitionEnd';
  11788. }
  11789. if (window.onanimationend === undefined &&
  11790. window.onwebkitanimationend !== undefined) {
  11791. animationProp = 'WebkitAnimation';
  11792. animationEndEvent = 'webkitAnimationEnd';
  11793. }
  11794. }
  11795. var raf = (inBrowser && window.requestAnimationFrame) || setTimeout;
  11796. function nextFrame (fn) {
  11797. raf(function () {
  11798. raf(fn);
  11799. });
  11800. }
  11801. function addTransitionClass (el, cls) {
  11802. (el._transitionClasses || (el._transitionClasses = [])).push(cls);
  11803. addClass(el, cls);
  11804. }
  11805. function removeTransitionClass (el, cls) {
  11806. if (el._transitionClasses) {
  11807. remove$1(el._transitionClasses, cls);
  11808. }
  11809. removeClass(el, cls);
  11810. }
  11811. function whenTransitionEnds (
  11812. el,
  11813. expectedType,
  11814. cb
  11815. ) {
  11816. var ref = getTransitionInfo(el, expectedType);
  11817. var type = ref.type;
  11818. var timeout = ref.timeout;
  11819. var propCount = ref.propCount;
  11820. if (!type) { return cb() }
  11821. var event = type === TRANSITION ? transitionEndEvent : animationEndEvent;
  11822. var ended = 0;
  11823. var end = function () {
  11824. el.removeEventListener(event, onEnd);
  11825. cb();
  11826. };
  11827. var onEnd = function (e) {
  11828. if (e.target === el) {
  11829. if (++ended >= propCount) {
  11830. end();
  11831. }
  11832. }
  11833. };
  11834. setTimeout(function () {
  11835. if (ended < propCount) {
  11836. end();
  11837. }
  11838. }, timeout + 1);
  11839. el.addEventListener(event, onEnd);
  11840. }
  11841. var transformRE = /\b(transform|all)(,|$)/;
  11842. function getTransitionInfo (el, expectedType) {
  11843. var styles = window.getComputedStyle(el);
  11844. var transitioneDelays = styles[transitionProp + 'Delay'].split(', ');
  11845. var transitionDurations = styles[transitionProp + 'Duration'].split(', ');
  11846. var transitionTimeout = getTimeout(transitioneDelays, transitionDurations);
  11847. var animationDelays = styles[animationProp + 'Delay'].split(', ');
  11848. var animationDurations = styles[animationProp + 'Duration'].split(', ');
  11849. var animationTimeout = getTimeout(animationDelays, animationDurations);
  11850. var type;
  11851. var timeout = 0;
  11852. var propCount = 0;
  11853. /* istanbul ignore if */
  11854. if (expectedType === TRANSITION) {
  11855. if (transitionTimeout > 0) {
  11856. type = TRANSITION;
  11857. timeout = transitionTimeout;
  11858. propCount = transitionDurations.length;
  11859. }
  11860. } else if (expectedType === ANIMATION) {
  11861. if (animationTimeout > 0) {
  11862. type = ANIMATION;
  11863. timeout = animationTimeout;
  11864. propCount = animationDurations.length;
  11865. }
  11866. } else {
  11867. timeout = Math.max(transitionTimeout, animationTimeout);
  11868. type = timeout > 0
  11869. ? transitionTimeout > animationTimeout
  11870. ? TRANSITION
  11871. : ANIMATION
  11872. : null;
  11873. propCount = type
  11874. ? type === TRANSITION
  11875. ? transitionDurations.length
  11876. : animationDurations.length
  11877. : 0;
  11878. }
  11879. var hasTransform =
  11880. type === TRANSITION &&
  11881. transformRE.test(styles[transitionProp + 'Property']);
  11882. return {
  11883. type: type,
  11884. timeout: timeout,
  11885. propCount: propCount,
  11886. hasTransform: hasTransform
  11887. }
  11888. }
  11889. function getTimeout (delays, durations) {
  11890. return Math.max.apply(null, durations.map(function (d, i) {
  11891. return toMs(d) + toMs(delays[i])
  11892. }))
  11893. }
  11894. function toMs (s) {
  11895. return Number(s.slice(0, -1)) * 1000
  11896. }
  11897. /* */
  11898. function enter (vnode) {
  11899. var el = vnode.elm;
  11900. // call leave callback now
  11901. if (el._leaveCb) {
  11902. el._leaveCb.cancelled = true;
  11903. el._leaveCb();
  11904. }
  11905. var data = resolveTransition(vnode.data.transition);
  11906. if (!data) {
  11907. return
  11908. }
  11909. /* istanbul ignore if */
  11910. if (el._enterCb || el.nodeType !== 1) {
  11911. return
  11912. }
  11913. var css = data.css;
  11914. var type = data.type;
  11915. var enterClass = data.enterClass;
  11916. var enterActiveClass = data.enterActiveClass;
  11917. var appearClass = data.appearClass;
  11918. var appearActiveClass = data.appearActiveClass;
  11919. var beforeEnter = data.beforeEnter;
  11920. var enter = data.enter;
  11921. var afterEnter = data.afterEnter;
  11922. var enterCancelled = data.enterCancelled;
  11923. var beforeAppear = data.beforeAppear;
  11924. var appear = data.appear;
  11925. var afterAppear = data.afterAppear;
  11926. var appearCancelled = data.appearCancelled;
  11927. // activeInstance will always be the <transition> component managing this
  11928. // transition. One edge case to check is when the <transition> is placed
  11929. // as the root node of a child component. In that case we need to check
  11930. // <transition>'s parent for appear check.
  11931. var transitionNode = activeInstance.$vnode;
  11932. var context = transitionNode && transitionNode.parent
  11933. ? transitionNode.parent.context
  11934. : activeInstance;
  11935. var isAppear = !context._isMounted || !vnode.isRootInsert;
  11936. if (isAppear && !appear && appear !== '') {
  11937. return
  11938. }
  11939. var startClass = isAppear ? appearClass : enterClass;
  11940. var activeClass = isAppear ? appearActiveClass : enterActiveClass;
  11941. var beforeEnterHook = isAppear ? (beforeAppear || beforeEnter) : beforeEnter;
  11942. var enterHook = isAppear ? (typeof appear === 'function' ? appear : enter) : enter;
  11943. var afterEnterHook = isAppear ? (afterAppear || afterEnter) : afterEnter;
  11944. var enterCancelledHook = isAppear ? (appearCancelled || enterCancelled) : enterCancelled;
  11945. var expectsCSS = css !== false && !isIE9;
  11946. var userWantsControl =
  11947. enterHook &&
  11948. // enterHook may be a bound method which exposes
  11949. // the length of original fn as _length
  11950. (enterHook._length || enterHook.length) > 1;
  11951. var cb = el._enterCb = once(function () {
  11952. if (expectsCSS) {
  11953. removeTransitionClass(el, activeClass);
  11954. }
  11955. if (cb.cancelled) {
  11956. if (expectsCSS) {
  11957. removeTransitionClass(el, startClass);
  11958. }
  11959. enterCancelledHook && enterCancelledHook(el);
  11960. } else {
  11961. afterEnterHook && afterEnterHook(el);
  11962. }
  11963. el._enterCb = null;
  11964. });
  11965. if (!vnode.data.show) {
  11966. // remove pending leave element on enter by injecting an insert hook
  11967. mergeVNodeHook(vnode.data.hook || (vnode.data.hook = {}), 'insert', function () {
  11968. var parent = el.parentNode;
  11969. var pendingNode = parent && parent._pending && parent._pending[vnode.key];
  11970. if (pendingNode && pendingNode.tag === vnode.tag && pendingNode.elm._leaveCb) {
  11971. pendingNode.elm._leaveCb();
  11972. }
  11973. enterHook && enterHook(el, cb);
  11974. }, 'transition-insert');
  11975. }
  11976. // start enter transition
  11977. beforeEnterHook && beforeEnterHook(el);
  11978. if (expectsCSS) {
  11979. addTransitionClass(el, startClass);
  11980. addTransitionClass(el, activeClass);
  11981. nextFrame(function () {
  11982. removeTransitionClass(el, startClass);
  11983. if (!cb.cancelled && !userWantsControl) {
  11984. whenTransitionEnds(el, type, cb);
  11985. }
  11986. });
  11987. }
  11988. if (vnode.data.show) {
  11989. enterHook && enterHook(el, cb);
  11990. }
  11991. if (!expectsCSS && !userWantsControl) {
  11992. cb();
  11993. }
  11994. }
  11995. function leave (vnode, rm) {
  11996. var el = vnode.elm;
  11997. // call enter callback now
  11998. if (el._enterCb) {
  11999. el._enterCb.cancelled = true;
  12000. el._enterCb();
  12001. }
  12002. var data = resolveTransition(vnode.data.transition);
  12003. if (!data) {
  12004. return rm()
  12005. }
  12006. /* istanbul ignore if */
  12007. if (el._leaveCb || el.nodeType !== 1) {
  12008. return
  12009. }
  12010. var css = data.css;
  12011. var type = data.type;
  12012. var leaveClass = data.leaveClass;
  12013. var leaveActiveClass = data.leaveActiveClass;
  12014. var beforeLeave = data.beforeLeave;
  12015. var leave = data.leave;
  12016. var afterLeave = data.afterLeave;
  12017. var leaveCancelled = data.leaveCancelled;
  12018. var delayLeave = data.delayLeave;
  12019. var expectsCSS = css !== false && !isIE9;
  12020. var userWantsControl =
  12021. leave &&
  12022. // leave hook may be a bound method which exposes
  12023. // the length of original fn as _length
  12024. (leave._length || leave.length) > 1;
  12025. var cb = el._leaveCb = once(function () {
  12026. if (el.parentNode && el.parentNode._pending) {
  12027. el.parentNode._pending[vnode.key] = null;
  12028. }
  12029. if (expectsCSS) {
  12030. removeTransitionClass(el, leaveActiveClass);
  12031. }
  12032. if (cb.cancelled) {
  12033. if (expectsCSS) {
  12034. removeTransitionClass(el, leaveClass);
  12035. }
  12036. leaveCancelled && leaveCancelled(el);
  12037. } else {
  12038. rm();
  12039. afterLeave && afterLeave(el);
  12040. }
  12041. el._leaveCb = null;
  12042. });
  12043. if (delayLeave) {
  12044. delayLeave(performLeave);
  12045. } else {
  12046. performLeave();
  12047. }
  12048. function performLeave () {
  12049. // the delayed leave may have already been cancelled
  12050. if (cb.cancelled) {
  12051. return
  12052. }
  12053. // record leaving element
  12054. if (!vnode.data.show) {
  12055. (el.parentNode._pending || (el.parentNode._pending = {}))[vnode.key] = vnode;
  12056. }
  12057. beforeLeave && beforeLeave(el);
  12058. if (expectsCSS) {
  12059. addTransitionClass(el, leaveClass);
  12060. addTransitionClass(el, leaveActiveClass);
  12061. nextFrame(function () {
  12062. removeTransitionClass(el, leaveClass);
  12063. if (!cb.cancelled && !userWantsControl) {
  12064. whenTransitionEnds(el, type, cb);
  12065. }
  12066. });
  12067. }
  12068. leave && leave(el, cb);
  12069. if (!expectsCSS && !userWantsControl) {
  12070. cb();
  12071. }
  12072. }
  12073. }
  12074. function resolveTransition (def$$1) {
  12075. if (!def$$1) {
  12076. return
  12077. }
  12078. /* istanbul ignore else */
  12079. if (typeof def$$1 === 'object') {
  12080. var res = {};
  12081. if (def$$1.css !== false) {
  12082. extend(res, autoCssTransition(def$$1.name || 'v'));
  12083. }
  12084. extend(res, def$$1);
  12085. return res
  12086. } else if (typeof def$$1 === 'string') {
  12087. return autoCssTransition(def$$1)
  12088. }
  12089. }
  12090. var autoCssTransition = cached(function (name) {
  12091. return {
  12092. enterClass: (name + "-enter"),
  12093. leaveClass: (name + "-leave"),
  12094. appearClass: (name + "-enter"),
  12095. enterActiveClass: (name + "-enter-active"),
  12096. leaveActiveClass: (name + "-leave-active"),
  12097. appearActiveClass: (name + "-enter-active")
  12098. }
  12099. });
  12100. function once (fn) {
  12101. var called = false;
  12102. return function () {
  12103. if (!called) {
  12104. called = true;
  12105. fn();
  12106. }
  12107. }
  12108. }
  12109. var transition = inBrowser ? {
  12110. create: function create (_, vnode) {
  12111. if (!vnode.data.show) {
  12112. enter(vnode);
  12113. }
  12114. },
  12115. remove: function remove (vnode, rm) {
  12116. /* istanbul ignore else */
  12117. if (!vnode.data.show) {
  12118. leave(vnode, rm);
  12119. } else {
  12120. rm();
  12121. }
  12122. }
  12123. } : {};
  12124. var platformModules = [
  12125. attrs,
  12126. klass,
  12127. events,
  12128. domProps,
  12129. style,
  12130. transition
  12131. ];
  12132. /* */
  12133. // the directive module should be applied last, after all
  12134. // built-in modules have been applied.
  12135. var modules = platformModules.concat(baseModules);
  12136. var patch$1 = createPatchFunction({ nodeOps: nodeOps, modules: modules });
  12137. /**
  12138. * Not type checking this file because flow doesn't like attaching
  12139. * properties to Elements.
  12140. */
  12141. var modelableTagRE = /^input|select|textarea|vue-component-[0-9]+(-[0-9a-zA-Z_\-]*)?$/;
  12142. /* istanbul ignore if */
  12143. if (isIE9) {
  12144. // http://www.matts411.com/post/internet-explorer-9-oninput/
  12145. document.addEventListener('selectionchange', function () {
  12146. var el = document.activeElement;
  12147. if (el && el.vmodel) {
  12148. trigger(el, 'input');
  12149. }
  12150. });
  12151. }
  12152. var model = {
  12153. inserted: function inserted (el, binding, vnode) {
  12154. if (process.env.NODE_ENV !== 'production') {
  12155. if (!modelableTagRE.test(vnode.tag)) {
  12156. warn(
  12157. "v-model is not supported on element type: <" + (vnode.tag) + ">. " +
  12158. 'If you are working with contenteditable, it\'s recommended to ' +
  12159. 'wrap a library dedicated for that purpose inside a custom component.',
  12160. vnode.context
  12161. );
  12162. }
  12163. }
  12164. if (vnode.tag === 'select') {
  12165. var cb = function () {
  12166. setSelected(el, binding, vnode.context);
  12167. };
  12168. cb();
  12169. /* istanbul ignore if */
  12170. if (isIE || isEdge) {
  12171. setTimeout(cb, 0);
  12172. }
  12173. } else if (
  12174. (vnode.tag === 'textarea' || el.type === 'text') &&
  12175. !binding.modifiers.lazy
  12176. ) {
  12177. if (!isAndroid) {
  12178. el.addEventListener('compositionstart', onCompositionStart);
  12179. el.addEventListener('compositionend', onCompositionEnd);
  12180. }
  12181. /* istanbul ignore if */
  12182. if (isIE9) {
  12183. el.vmodel = true;
  12184. }
  12185. }
  12186. },
  12187. componentUpdated: function componentUpdated (el, binding, vnode) {
  12188. if (vnode.tag === 'select') {
  12189. setSelected(el, binding, vnode.context);
  12190. // in case the options rendered by v-for have changed,
  12191. // it's possible that the value is out-of-sync with the rendered options.
  12192. // detect such cases and filter out values that no longer has a matchig
  12193. // option in the DOM.
  12194. var needReset = el.multiple
  12195. ? binding.value.some(function (v) { return hasNoMatchingOption(v, el.options); })
  12196. : binding.value !== binding.oldValue && hasNoMatchingOption(binding.value, el.options);
  12197. if (needReset) {
  12198. trigger(el, 'change');
  12199. }
  12200. }
  12201. }
  12202. };
  12203. function setSelected (el, binding, vm) {
  12204. var value = binding.value;
  12205. var isMultiple = el.multiple;
  12206. if (isMultiple && !Array.isArray(value)) {
  12207. process.env.NODE_ENV !== 'production' && warn(
  12208. "<select multiple v-model=\"" + (binding.expression) + "\"> " +
  12209. "expects an Array value for its binding, but got " + (Object.prototype.toString.call(value).slice(8, -1)),
  12210. vm
  12211. );
  12212. return
  12213. }
  12214. var selected, option;
  12215. for (var i = 0, l = el.options.length; i < l; i++) {
  12216. option = el.options[i];
  12217. if (isMultiple) {
  12218. selected = looseIndexOf(value, getValue(option)) > -1;
  12219. if (option.selected !== selected) {
  12220. option.selected = selected;
  12221. }
  12222. } else {
  12223. if (looseEqual(getValue(option), value)) {
  12224. if (el.selectedIndex !== i) {
  12225. el.selectedIndex = i;
  12226. }
  12227. return
  12228. }
  12229. }
  12230. }
  12231. if (!isMultiple) {
  12232. el.selectedIndex = -1;
  12233. }
  12234. }
  12235. function hasNoMatchingOption (value, options) {
  12236. for (var i = 0, l = options.length; i < l; i++) {
  12237. if (looseEqual(getValue(options[i]), value)) {
  12238. return false
  12239. }
  12240. }
  12241. return true
  12242. }
  12243. function getValue (option) {
  12244. return '_value' in option
  12245. ? option._value
  12246. : option.value
  12247. }
  12248. function onCompositionStart (e) {
  12249. e.target.composing = true;
  12250. }
  12251. function onCompositionEnd (e) {
  12252. e.target.composing = false;
  12253. trigger(e.target, 'input');
  12254. }
  12255. function trigger (el, type) {
  12256. var e = document.createEvent('HTMLEvents');
  12257. e.initEvent(type, true, true);
  12258. el.dispatchEvent(e);
  12259. }
  12260. /* */
  12261. // recursively search for possible transition defined inside the component root
  12262. function locateNode (vnode) {
  12263. return vnode.child && (!vnode.data || !vnode.data.transition)
  12264. ? locateNode(vnode.child._vnode)
  12265. : vnode
  12266. }
  12267. var show = {
  12268. bind: function bind (el, ref, vnode) {
  12269. var value = ref.value;
  12270. vnode = locateNode(vnode);
  12271. var transition = vnode.data && vnode.data.transition;
  12272. if (value && transition && !isIE9) {
  12273. enter(vnode);
  12274. }
  12275. var originalDisplay = el.style.display === 'none' ? '' : el.style.display;
  12276. el.style.display = value ? originalDisplay : 'none';
  12277. el.__vOriginalDisplay = originalDisplay;
  12278. },
  12279. update: function update (el, ref, vnode) {
  12280. var value = ref.value;
  12281. var oldValue = ref.oldValue;
  12282. /* istanbul ignore if */
  12283. if (value === oldValue) { return }
  12284. vnode = locateNode(vnode);
  12285. var transition = vnode.data && vnode.data.transition;
  12286. if (transition && !isIE9) {
  12287. if (value) {
  12288. enter(vnode);
  12289. el.style.display = el.__vOriginalDisplay;
  12290. } else {
  12291. leave(vnode, function () {
  12292. el.style.display = 'none';
  12293. });
  12294. }
  12295. } else {
  12296. el.style.display = value ? el.__vOriginalDisplay : 'none';
  12297. }
  12298. }
  12299. };
  12300. var platformDirectives = {
  12301. model: model,
  12302. show: show
  12303. };
  12304. /* */
  12305. // Provides transition support for a single element/component.
  12306. // supports transition mode (out-in / in-out)
  12307. var transitionProps = {
  12308. name: String,
  12309. appear: Boolean,
  12310. css: Boolean,
  12311. mode: String,
  12312. type: String,
  12313. enterClass: String,
  12314. leaveClass: String,
  12315. enterActiveClass: String,
  12316. leaveActiveClass: String,
  12317. appearClass: String,
  12318. appearActiveClass: String
  12319. };
  12320. // in case the child is also an abstract component, e.g. <keep-alive>
  12321. // we want to recrusively retrieve the real component to be rendered
  12322. function getRealChild (vnode) {
  12323. var compOptions = vnode && vnode.componentOptions;
  12324. if (compOptions && compOptions.Ctor.options.abstract) {
  12325. return getRealChild(getFirstComponentChild(compOptions.children))
  12326. } else {
  12327. return vnode
  12328. }
  12329. }
  12330. function extractTransitionData (comp) {
  12331. var data = {};
  12332. var options = comp.$options;
  12333. // props
  12334. for (var key in options.propsData) {
  12335. data[key] = comp[key];
  12336. }
  12337. // events.
  12338. // extract listeners and pass them directly to the transition methods
  12339. var listeners = options._parentListeners;
  12340. for (var key$1 in listeners) {
  12341. data[camelize(key$1)] = listeners[key$1].fn;
  12342. }
  12343. return data
  12344. }
  12345. function placeholder (h, rawChild) {
  12346. return /\d-keep-alive$/.test(rawChild.tag)
  12347. ? h('keep-alive')
  12348. : null
  12349. }
  12350. function hasParentTransition (vnode) {
  12351. while ((vnode = vnode.parent)) {
  12352. if (vnode.data.transition) {
  12353. return true
  12354. }
  12355. }
  12356. }
  12357. var Transition = {
  12358. name: 'transition',
  12359. props: transitionProps,
  12360. abstract: true,
  12361. render: function render (h) {
  12362. var this$1 = this;
  12363. var children = this.$slots.default;
  12364. if (!children) {
  12365. return
  12366. }
  12367. // filter out text nodes (possible whitespaces)
  12368. children = children.filter(function (c) { return c.tag; });
  12369. /* istanbul ignore if */
  12370. if (!children.length) {
  12371. return
  12372. }
  12373. // warn multiple elements
  12374. if (process.env.NODE_ENV !== 'production' && children.length > 1) {
  12375. warn(
  12376. '<transition> can only be used on a single element. Use ' +
  12377. '<transition-group> for lists.',
  12378. this.$parent
  12379. );
  12380. }
  12381. var mode = this.mode;
  12382. // warn invalid mode
  12383. if (process.env.NODE_ENV !== 'production' &&
  12384. mode && mode !== 'in-out' && mode !== 'out-in') {
  12385. warn(
  12386. 'invalid <transition> mode: ' + mode,
  12387. this.$parent
  12388. );
  12389. }
  12390. var rawChild = children[0];
  12391. // if this is a component root node and the component's
  12392. // parent container node also has transition, skip.
  12393. if (hasParentTransition(this.$vnode)) {
  12394. return rawChild
  12395. }
  12396. // apply transition data to child
  12397. // use getRealChild() to ignore abstract components e.g. keep-alive
  12398. var child = getRealChild(rawChild);
  12399. /* istanbul ignore if */
  12400. if (!child) {
  12401. return rawChild
  12402. }
  12403. if (this._leaving) {
  12404. return placeholder(h, rawChild)
  12405. }
  12406. var key = child.key = child.key == null || child.isStatic
  12407. ? ("__v" + (child.tag + this._uid) + "__")
  12408. : child.key;
  12409. var data = (child.data || (child.data = {})).transition = extractTransitionData(this);
  12410. var oldRawChild = this._vnode;
  12411. var oldChild = getRealChild(oldRawChild);
  12412. // mark v-show
  12413. // so that the transition module can hand over the control to the directive
  12414. if (child.data.directives && child.data.directives.some(function (d) { return d.name === 'show'; })) {
  12415. child.data.show = true;
  12416. }
  12417. if (oldChild && oldChild.data && oldChild.key !== key) {
  12418. // replace old child transition data with fresh one
  12419. // important for dynamic transitions!
  12420. var oldData = oldChild.data.transition = extend({}, data);
  12421. // handle transition mode
  12422. if (mode === 'out-in') {
  12423. // return placeholder node and queue update when leave finishes
  12424. this._leaving = true;
  12425. mergeVNodeHook(oldData, 'afterLeave', function () {
  12426. this$1._leaving = false;
  12427. this$1.$forceUpdate();
  12428. }, key);
  12429. return placeholder(h, rawChild)
  12430. } else if (mode === 'in-out') {
  12431. var delayedLeave;
  12432. var performLeave = function () { delayedLeave(); };
  12433. mergeVNodeHook(data, 'afterEnter', performLeave, key);
  12434. mergeVNodeHook(data, 'enterCancelled', performLeave, key);
  12435. mergeVNodeHook(oldData, 'delayLeave', function (leave) {
  12436. delayedLeave = leave;
  12437. }, key);
  12438. }
  12439. }
  12440. return rawChild
  12441. }
  12442. };
  12443. /* */
  12444. // Provides transition support for list items.
  12445. // supports move transitions using the FLIP technique.
  12446. // Because the vdom's children update algorithm is "unstable" - i.e.
  12447. // it doesn't guarantee the relative positioning of removed elements,
  12448. // we force transition-group to update its children into two passes:
  12449. // in the first pass, we remove all nodes that need to be removed,
  12450. // triggering their leaving transition; in the second pass, we insert/move
  12451. // into the final disired state. This way in the second pass removed
  12452. // nodes will remain where they should be.
  12453. var props = extend({
  12454. tag: String,
  12455. moveClass: String
  12456. }, transitionProps);
  12457. delete props.mode;
  12458. var TransitionGroup = {
  12459. props: props,
  12460. render: function render (h) {
  12461. var tag = this.tag || this.$vnode.data.tag || 'span';
  12462. var map = Object.create(null);
  12463. var prevChildren = this.prevChildren = this.children;
  12464. var rawChildren = this.$slots.default || [];
  12465. var children = this.children = [];
  12466. var transitionData = extractTransitionData(this);
  12467. for (var i = 0; i < rawChildren.length; i++) {
  12468. var c = rawChildren[i];
  12469. if (c.tag) {
  12470. if (c.key != null && String(c.key).indexOf('__vlist') !== 0) {
  12471. children.push(c);
  12472. map[c.key] = c
  12473. ;(c.data || (c.data = {})).transition = transitionData;
  12474. } else if (process.env.NODE_ENV !== 'production') {
  12475. var opts = c.componentOptions;
  12476. var name = opts
  12477. ? (opts.Ctor.options.name || opts.tag)
  12478. : c.tag;
  12479. warn(("<transition-group> children must be keyed: <" + name + ">"));
  12480. }
  12481. }
  12482. }
  12483. if (prevChildren) {
  12484. var kept = [];
  12485. var removed = [];
  12486. for (var i$1 = 0; i$1 < prevChildren.length; i$1++) {
  12487. var c$1 = prevChildren[i$1];
  12488. c$1.data.transition = transitionData;
  12489. c$1.data.pos = c$1.elm.getBoundingClientRect();
  12490. if (map[c$1.key]) {
  12491. kept.push(c$1);
  12492. } else {
  12493. removed.push(c$1);
  12494. }
  12495. }
  12496. this.kept = h(tag, null, kept);
  12497. this.removed = removed;
  12498. }
  12499. return h(tag, null, children)
  12500. },
  12501. beforeUpdate: function beforeUpdate () {
  12502. // force removing pass
  12503. this.__patch__(
  12504. this._vnode,
  12505. this.kept,
  12506. false, // hydrating
  12507. true // removeOnly (!important, avoids unnecessary moves)
  12508. );
  12509. this._vnode = this.kept;
  12510. },
  12511. updated: function updated () {
  12512. var children = this.prevChildren;
  12513. var moveClass = this.moveClass || (this.name + '-move');
  12514. if (!children.length || !this.hasMove(children[0].elm, moveClass)) {
  12515. return
  12516. }
  12517. // we divide the work into three loops to avoid mixing DOM reads and writes
  12518. // in each iteration - which helps prevent layout thrashing.
  12519. children.forEach(callPendingCbs);
  12520. children.forEach(recordPosition);
  12521. children.forEach(applyTranslation);
  12522. // force reflow to put everything in position
  12523. var f = document.body.offsetHeight; // eslint-disable-line
  12524. children.forEach(function (c) {
  12525. if (c.data.moved) {
  12526. var el = c.elm;
  12527. var s = el.style;
  12528. addTransitionClass(el, moveClass);
  12529. s.transform = s.WebkitTransform = s.transitionDuration = '';
  12530. el.addEventListener(transitionEndEvent, el._moveCb = function cb (e) {
  12531. if (!e || /transform$/.test(e.propertyName)) {
  12532. el.removeEventListener(transitionEndEvent, cb);
  12533. el._moveCb = null;
  12534. removeTransitionClass(el, moveClass);
  12535. }
  12536. });
  12537. }
  12538. });
  12539. },
  12540. methods: {
  12541. hasMove: function hasMove (el, moveClass) {
  12542. /* istanbul ignore if */
  12543. if (!hasTransition) {
  12544. return false
  12545. }
  12546. if (this._hasMove != null) {
  12547. return this._hasMove
  12548. }
  12549. addTransitionClass(el, moveClass);
  12550. var info = getTransitionInfo(el);
  12551. removeTransitionClass(el, moveClass);
  12552. return (this._hasMove = info.hasTransform)
  12553. }
  12554. }
  12555. };
  12556. function callPendingCbs (c) {
  12557. /* istanbul ignore if */
  12558. if (c.elm._moveCb) {
  12559. c.elm._moveCb();
  12560. }
  12561. /* istanbul ignore if */
  12562. if (c.elm._enterCb) {
  12563. c.elm._enterCb();
  12564. }
  12565. }
  12566. function recordPosition (c) {
  12567. c.data.newPos = c.elm.getBoundingClientRect();
  12568. }
  12569. function applyTranslation (c) {
  12570. var oldPos = c.data.pos;
  12571. var newPos = c.data.newPos;
  12572. var dx = oldPos.left - newPos.left;
  12573. var dy = oldPos.top - newPos.top;
  12574. if (dx || dy) {
  12575. c.data.moved = true;
  12576. var s = c.elm.style;
  12577. s.transform = s.WebkitTransform = "translate(" + dx + "px," + dy + "px)";
  12578. s.transitionDuration = '0s';
  12579. }
  12580. }
  12581. var platformComponents = {
  12582. Transition: Transition,
  12583. TransitionGroup: TransitionGroup
  12584. };
  12585. /* */
  12586. // install platform specific utils
  12587. Vue$2.config.isUnknownElement = isUnknownElement;
  12588. Vue$2.config.isReservedTag = isReservedTag;
  12589. Vue$2.config.getTagNamespace = getTagNamespace;
  12590. Vue$2.config.mustUseProp = mustUseProp;
  12591. // install platform runtime directives & components
  12592. extend(Vue$2.options.directives, platformDirectives);
  12593. extend(Vue$2.options.components, platformComponents);
  12594. // install platform patch function
  12595. Vue$2.prototype.__patch__ = config._isServer ? noop : patch$1;
  12596. // wrap mount
  12597. Vue$2.prototype.$mount = function (
  12598. el,
  12599. hydrating
  12600. ) {
  12601. el = el && !config._isServer ? query(el) : undefined;
  12602. return this._mount(el, hydrating)
  12603. };
  12604. // devtools global hook
  12605. /* istanbul ignore next */
  12606. setTimeout(function () {
  12607. if (config.devtools) {
  12608. if (devtools) {
  12609. devtools.emit('init', Vue$2);
  12610. } else if (
  12611. process.env.NODE_ENV !== 'production' &&
  12612. inBrowser && /Chrome\/\d+/.test(window.navigator.userAgent)
  12613. ) {
  12614. console.log(
  12615. 'Download the Vue Devtools for a better development experience:\n' +
  12616. 'https://github.com/vuejs/vue-devtools'
  12617. );
  12618. }
  12619. }
  12620. }, 0);
  12621. module.exports = Vue$2;
  12622. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7)))
  12623. /***/ },
  12624. /* 48 */
  12625. /***/ function(module, exports, __webpack_require__) {
  12626. module.exports = { "default": __webpack_require__(177), __esModule: true };
  12627. /***/ },
  12628. /* 49 */
  12629. /***/ function(module, exports, __webpack_require__) {
  12630. var ciphers = __webpack_require__(166)
  12631. exports.createCipher = exports.Cipher = ciphers.createCipher
  12632. exports.createCipheriv = exports.Cipheriv = ciphers.createCipheriv
  12633. var deciphers = __webpack_require__(165)
  12634. exports.createDecipher = exports.Decipher = deciphers.createDecipher
  12635. exports.createDecipheriv = exports.Decipheriv = deciphers.createDecipheriv
  12636. var modes = __webpack_require__(36)
  12637. function getCiphers () {
  12638. return Object.keys(modes)
  12639. }
  12640. exports.listCiphers = exports.getCiphers = getCiphers
  12641. /***/ },
  12642. /* 50 */
  12643. /***/ function(module, exports, __webpack_require__) {
  12644. /* WEBPACK VAR INJECTION */(function(Buffer) {var bn = __webpack_require__(2);
  12645. var randomBytes = __webpack_require__(31);
  12646. module.exports = crt;
  12647. function blind(priv) {
  12648. var r = getr(priv);
  12649. var blinder = r.toRed(bn.mont(priv.modulus))
  12650. .redPow(new bn(priv.publicExponent)).fromRed();
  12651. return {
  12652. blinder: blinder,
  12653. unblinder:r.invm(priv.modulus)
  12654. };
  12655. }
  12656. function crt(msg, priv) {
  12657. var blinds = blind(priv);
  12658. var len = priv.modulus.byteLength();
  12659. var mod = bn.mont(priv.modulus);
  12660. var blinded = new bn(msg).mul(blinds.blinder).umod(priv.modulus);
  12661. var c1 = blinded.toRed(bn.mont(priv.prime1));
  12662. var c2 = blinded.toRed(bn.mont(priv.prime2));
  12663. var qinv = priv.coefficient;
  12664. var p = priv.prime1;
  12665. var q = priv.prime2;
  12666. var m1 = c1.redPow(priv.exponent1);
  12667. var m2 = c2.redPow(priv.exponent2);
  12668. m1 = m1.fromRed();
  12669. m2 = m2.fromRed();
  12670. var h = m1.isub(m2).imul(qinv).umod(p);
  12671. h.imul(q);
  12672. m2.iadd(h);
  12673. return new Buffer(m2.imul(blinds.unblinder).umod(priv.modulus).toArray(false, len));
  12674. }
  12675. crt.getr = getr;
  12676. function getr(priv) {
  12677. var len = priv.modulus.byteLength();
  12678. var r = new bn(randomBytes(len));
  12679. while (r.cmp(priv.modulus) >= 0 || !r.umod(priv.prime1) || !r.umod(priv.prime2)) {
  12680. r = new bn(randomBytes(len));
  12681. }
  12682. return r;
  12683. }
  12684. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  12685. /***/ },
  12686. /* 51 */
  12687. /***/ function(module, exports, __webpack_require__) {
  12688. "use strict";
  12689. /* WEBPACK VAR INJECTION */(function(global) {'use strict';
  12690. var buffer = __webpack_require__(0);
  12691. var Buffer = buffer.Buffer;
  12692. var SlowBuffer = buffer.SlowBuffer;
  12693. var MAX_LEN = buffer.kMaxLength || 2147483647;
  12694. exports.alloc = function alloc(size, fill, encoding) {
  12695. if (typeof Buffer.alloc === 'function') {
  12696. return Buffer.alloc(size, fill, encoding);
  12697. }
  12698. if (typeof encoding === 'number') {
  12699. throw new TypeError('encoding must not be number');
  12700. }
  12701. if (typeof size !== 'number') {
  12702. throw new TypeError('size must be a number');
  12703. }
  12704. if (size > MAX_LEN) {
  12705. throw new RangeError('size is too large');
  12706. }
  12707. var enc = encoding;
  12708. var _fill = fill;
  12709. if (_fill === undefined) {
  12710. enc = undefined;
  12711. _fill = 0;
  12712. }
  12713. var buf = new Buffer(size);
  12714. if (typeof _fill === 'string') {
  12715. var fillBuf = new Buffer(_fill, enc);
  12716. var flen = fillBuf.length;
  12717. var i = -1;
  12718. while (++i < size) {
  12719. buf[i] = fillBuf[i % flen];
  12720. }
  12721. } else {
  12722. buf.fill(_fill);
  12723. }
  12724. return buf;
  12725. }
  12726. exports.allocUnsafe = function allocUnsafe(size) {
  12727. if (typeof Buffer.allocUnsafe === 'function') {
  12728. return Buffer.allocUnsafe(size);
  12729. }
  12730. if (typeof size !== 'number') {
  12731. throw new TypeError('size must be a number');
  12732. }
  12733. if (size > MAX_LEN) {
  12734. throw new RangeError('size is too large');
  12735. }
  12736. return new Buffer(size);
  12737. }
  12738. exports.from = function from(value, encodingOrOffset, length) {
  12739. if (typeof Buffer.from === 'function' && (!global.Uint8Array || Uint8Array.from !== Buffer.from)) {
  12740. return Buffer.from(value, encodingOrOffset, length);
  12741. }
  12742. if (typeof value === 'number') {
  12743. throw new TypeError('"value" argument must not be a number');
  12744. }
  12745. if (typeof value === 'string') {
  12746. return new Buffer(value, encodingOrOffset);
  12747. }
  12748. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  12749. var offset = encodingOrOffset;
  12750. if (arguments.length === 1) {
  12751. return new Buffer(value);
  12752. }
  12753. if (typeof offset === 'undefined') {
  12754. offset = 0;
  12755. }
  12756. var len = length;
  12757. if (typeof len === 'undefined') {
  12758. len = value.byteLength - offset;
  12759. }
  12760. if (offset >= value.byteLength) {
  12761. throw new RangeError('\'offset\' is out of bounds');
  12762. }
  12763. if (len > value.byteLength - offset) {
  12764. throw new RangeError('\'length\' is out of bounds');
  12765. }
  12766. return new Buffer(value.slice(offset, offset + len));
  12767. }
  12768. if (Buffer.isBuffer(value)) {
  12769. var out = new Buffer(value.length);
  12770. value.copy(out, 0, 0, value.length);
  12771. return out;
  12772. }
  12773. if (value) {
  12774. if (Array.isArray(value) || (typeof ArrayBuffer !== 'undefined' && value.buffer instanceof ArrayBuffer) || 'length' in value) {
  12775. return new Buffer(value);
  12776. }
  12777. if (value.type === 'Buffer' && Array.isArray(value.data)) {
  12778. return new Buffer(value.data);
  12779. }
  12780. }
  12781. throw new TypeError('First argument must be a string, Buffer, ' + 'ArrayBuffer, Array, or array-like object.');
  12782. }
  12783. exports.allocUnsafeSlow = function allocUnsafeSlow(size) {
  12784. if (typeof Buffer.allocUnsafeSlow === 'function') {
  12785. return Buffer.allocUnsafeSlow(size);
  12786. }
  12787. if (typeof size !== 'number') {
  12788. throw new TypeError('size must be a number');
  12789. }
  12790. if (size >= MAX_LEN) {
  12791. throw new RangeError('size is too large');
  12792. }
  12793. return new SlowBuffer(size);
  12794. }
  12795. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(32)))
  12796. /***/ },
  12797. /* 52 */
  12798. /***/ function(module, exports) {
  12799. module.exports = function(it){
  12800. if(typeof it != 'function')throw TypeError(it + ' is not a function!');
  12801. return it;
  12802. };
  12803. /***/ },
  12804. /* 53 */
  12805. /***/ function(module, exports) {
  12806. // 7.2.1 RequireObjectCoercible(argument)
  12807. module.exports = function(it){
  12808. if(it == undefined)throw TypeError("Can't call method on " + it);
  12809. return it;
  12810. };
  12811. /***/ },
  12812. /* 54 */
  12813. /***/ function(module, exports, __webpack_require__) {
  12814. var isObject = __webpack_require__(42)
  12815. , document = __webpack_require__(6).document
  12816. // in old IE typeof document.createElement is 'object'
  12817. , is = isObject(document) && isObject(document.createElement);
  12818. module.exports = function(it){
  12819. return is ? document.createElement(it) : {};
  12820. };
  12821. /***/ },
  12822. /* 55 */
  12823. /***/ function(module, exports) {
  12824. module.exports = function(exec){
  12825. try {
  12826. return !!exec();
  12827. } catch(e){
  12828. return true;
  12829. }
  12830. };
  12831. /***/ },
  12832. /* 56 */
  12833. /***/ function(module, exports, __webpack_require__) {
  12834. var def = __webpack_require__(28).f
  12835. , has = __webpack_require__(41)
  12836. , TAG = __webpack_require__(5)('toStringTag');
  12837. module.exports = function(it, tag, stat){
  12838. if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag});
  12839. };
  12840. /***/ },
  12841. /* 57 */
  12842. /***/ function(module, exports, __webpack_require__) {
  12843. var shared = __webpack_require__(99)('keys')
  12844. , uid = __webpack_require__(103);
  12845. module.exports = function(key){
  12846. return shared[key] || (shared[key] = uid(key));
  12847. };
  12848. /***/ },
  12849. /* 58 */
  12850. /***/ function(module, exports) {
  12851. // 7.1.4 ToInteger
  12852. var ceil = Math.ceil
  12853. , floor = Math.floor;
  12854. module.exports = function(it){
  12855. return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
  12856. };
  12857. /***/ },
  12858. /* 59 */
  12859. /***/ function(module, exports, __webpack_require__) {
  12860. // to indexed object, toObject with fallback for non-array-like ES3 strings
  12861. var IObject = __webpack_require__(94)
  12862. , defined = __webpack_require__(53);
  12863. module.exports = function(it){
  12864. return IObject(defined(it));
  12865. };
  12866. /***/ },
  12867. /* 60 */
  12868. /***/ function(module, exports, __webpack_require__) {
  12869. "use strict";
  12870. /* WEBPACK VAR INJECTION */(function(Buffer) {'use strict';
  12871. var createHash = __webpack_require__(16);
  12872. var inherits = __webpack_require__(1)
  12873. var Transform = __webpack_require__(19).Transform
  12874. var ZEROS = new Buffer(128)
  12875. ZEROS.fill(0)
  12876. function Hmac(alg, key) {
  12877. Transform.call(this)
  12878. alg = alg.toLowerCase()
  12879. if (typeof key === 'string') {
  12880. key = new Buffer(key)
  12881. }
  12882. var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64
  12883. this._alg = alg
  12884. this._key = key
  12885. if (key.length > blocksize) {
  12886. key = createHash(alg).update(key).digest()
  12887. } else if (key.length < blocksize) {
  12888. key = Buffer.concat([key, ZEROS], blocksize)
  12889. }
  12890. var ipad = this._ipad = new Buffer(blocksize)
  12891. var opad = this._opad = new Buffer(blocksize)
  12892. for (var i = 0; i < blocksize; i++) {
  12893. ipad[i] = key[i] ^ 0x36
  12894. opad[i] = key[i] ^ 0x5C
  12895. }
  12896. this._hash = createHash(alg).update(ipad)
  12897. }
  12898. inherits(Hmac, Transform)
  12899. Hmac.prototype.update = function (data, enc) {
  12900. this._hash.update(data, enc)
  12901. return this
  12902. }
  12903. Hmac.prototype._transform = function (data, _, next) {
  12904. this._hash.update(data)
  12905. next()
  12906. }
  12907. Hmac.prototype._flush = function (next) {
  12908. this.push(this.digest())
  12909. next()
  12910. }
  12911. Hmac.prototype.digest = function (enc) {
  12912. var h = this._hash.digest()
  12913. return createHash(this._alg).update(this._opad).update(h).digest(enc)
  12914. }
  12915. module.exports = function createHmac(alg, key) {
  12916. return new Hmac(alg, key)
  12917. }
  12918. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  12919. /***/ },
  12920. /* 61 */
  12921. /***/ function(module, exports, __webpack_require__) {
  12922. "use strict";
  12923. 'use strict';
  12924. exports.utils = __webpack_require__(229);
  12925. exports.Cipher = __webpack_require__(226);
  12926. exports.DES = __webpack_require__(227);
  12927. exports.CBC = __webpack_require__(225);
  12928. exports.EDE = __webpack_require__(228);
  12929. /***/ },
  12930. /* 62 */
  12931. /***/ function(module, exports, __webpack_require__) {
  12932. "use strict";
  12933. /* WEBPACK VAR INJECTION */(function(process) {'use strict';
  12934. if (!process.version ||
  12935. process.version.indexOf('v0.') === 0 ||
  12936. process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
  12937. module.exports = nextTick;
  12938. } else {
  12939. module.exports = process.nextTick;
  12940. }
  12941. function nextTick(fn, arg1, arg2, arg3) {
  12942. if (typeof fn !== 'function') {
  12943. throw new TypeError('"callback" argument must be a function');
  12944. }
  12945. var len = arguments.length;
  12946. var args, i;
  12947. switch (len) {
  12948. case 0:
  12949. case 1:
  12950. return process.nextTick(fn);
  12951. case 2:
  12952. return process.nextTick(function afterTickOne() {
  12953. fn.call(null, arg1);
  12954. });
  12955. case 3:
  12956. return process.nextTick(function afterTickTwo() {
  12957. fn.call(null, arg1, arg2);
  12958. });
  12959. case 4:
  12960. return process.nextTick(function afterTickThree() {
  12961. fn.call(null, arg1, arg2, arg3);
  12962. });
  12963. default:
  12964. args = new Array(len - 1);
  12965. i = 0;
  12966. while (i < args.length) {
  12967. args[i++] = arguments[i];
  12968. }
  12969. return process.nextTick(function afterTick() {
  12970. fn.apply(null, args);
  12971. });
  12972. }
  12973. }
  12974. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7)))
  12975. /***/ },
  12976. /* 63 */
  12977. /***/ function(module, exports, __webpack_require__) {
  12978. "use strict";
  12979. // a transform stream is a readable/writable stream where you do
  12980. // something with the data. Sometimes it's called a "filter",
  12981. // but that's not a great name for it, since that implies a thing where
  12982. // some bits pass through, and others are simply ignored. (That would
  12983. // be a valid example of a transform, of course.)
  12984. //
  12985. // While the output is causally related to the input, it's not a
  12986. // necessarily symmetric or synchronous transformation. For example,
  12987. // a zlib stream might take multiple plain-text writes(), and then
  12988. // emit a single compressed chunk some time in the future.
  12989. //
  12990. // Here's how this works:
  12991. //
  12992. // The Transform stream has all the aspects of the readable and writable
  12993. // stream classes. When you write(chunk), that calls _write(chunk,cb)
  12994. // internally, and returns false if there's a lot of pending writes
  12995. // buffered up. When you call read(), that calls _read(n) until
  12996. // there's enough pending readable data buffered up.
  12997. //
  12998. // In a transform stream, the written data is placed in a buffer. When
  12999. // _read(n) is called, it transforms the queued up data, calling the
  13000. // buffered _write cb's as it consumes chunks. If consuming a single
  13001. // written chunk would result in multiple output chunks, then the first
  13002. // outputted bit calls the readcb, and subsequent chunks just go into
  13003. // the read buffer, and will cause it to emit 'readable' if necessary.
  13004. //
  13005. // This way, back-pressure is actually determined by the reading side,
  13006. // since _read has to be called to start processing a new chunk. However,
  13007. // a pathological inflate type of transform can cause excessive buffering
  13008. // here. For example, imagine a stream where every byte of input is
  13009. // interpreted as an integer from 0-255, and then results in that many
  13010. // bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in
  13011. // 1kb of data being output. In this case, you could write a very small
  13012. // amount of input, and end up with a very large amount of output. In
  13013. // such a pathological inflating mechanism, there'd be no way to tell
  13014. // the system to stop doing the transform. A single 4MB write could
  13015. // cause the system to run out of memory.
  13016. //
  13017. // However, even in such a pathological case, only a single written chunk
  13018. // would be consumed, and then the rest would wait (un-transformed) until
  13019. // the results of the previous transformed chunk were consumed.
  13020. 'use strict';
  13021. module.exports = Transform;
  13022. var Duplex = __webpack_require__(10);
  13023. /*<replacement>*/
  13024. var util = __webpack_require__(29);
  13025. util.inherits = __webpack_require__(1);
  13026. /*</replacement>*/
  13027. util.inherits(Transform, Duplex);
  13028. function TransformState(stream) {
  13029. this.afterTransform = function (er, data) {
  13030. return afterTransform(stream, er, data);
  13031. };
  13032. this.needTransform = false;
  13033. this.transforming = false;
  13034. this.writecb = null;
  13035. this.writechunk = null;
  13036. this.writeencoding = null;
  13037. }
  13038. function afterTransform(stream, er, data) {
  13039. var ts = stream._transformState;
  13040. ts.transforming = false;
  13041. var cb = ts.writecb;
  13042. if (!cb) return stream.emit('error', new Error('no writecb in Transform class'));
  13043. ts.writechunk = null;
  13044. ts.writecb = null;
  13045. if (data !== null && data !== undefined) stream.push(data);
  13046. cb(er);
  13047. var rs = stream._readableState;
  13048. rs.reading = false;
  13049. if (rs.needReadable || rs.length < rs.highWaterMark) {
  13050. stream._read(rs.highWaterMark);
  13051. }
  13052. }
  13053. function Transform(options) {
  13054. if (!(this instanceof Transform)) return new Transform(options);
  13055. Duplex.call(this, options);
  13056. this._transformState = new TransformState(this);
  13057. // when the writable side finishes, then flush out anything remaining.
  13058. var stream = this;
  13059. // start out asking for a readable event once data is transformed.
  13060. this._readableState.needReadable = true;
  13061. // we have implemented the _read method, and done the other things
  13062. // that Readable wants before the first _read call, so unset the
  13063. // sync guard flag.
  13064. this._readableState.sync = false;
  13065. if (options) {
  13066. if (typeof options.transform === 'function') this._transform = options.transform;
  13067. if (typeof options.flush === 'function') this._flush = options.flush;
  13068. }
  13069. this.once('prefinish', function () {
  13070. if (typeof this._flush === 'function') this._flush(function (er) {
  13071. done(stream, er);
  13072. });else done(stream);
  13073. });
  13074. }
  13075. Transform.prototype.push = function (chunk, encoding) {
  13076. this._transformState.needTransform = false;
  13077. return Duplex.prototype.push.call(this, chunk, encoding);
  13078. };
  13079. // This is the part where you do stuff!
  13080. // override this function in implementation classes.
  13081. // 'chunk' is an input chunk.
  13082. //
  13083. // Call `push(newChunk)` to pass along transformed output
  13084. // to the readable side. You may call 'push' zero or more times.
  13085. //
  13086. // Call `cb(err)` when you are done with this chunk. If you pass
  13087. // an error, then that'll put the hurt on the whole operation. If you
  13088. // never call cb(), then you'll never get another chunk.
  13089. Transform.prototype._transform = function (chunk, encoding, cb) {
  13090. throw new Error('Not implemented');
  13091. };
  13092. Transform.prototype._write = function (chunk, encoding, cb) {
  13093. var ts = this._transformState;
  13094. ts.writecb = cb;
  13095. ts.writechunk = chunk;
  13096. ts.writeencoding = encoding;
  13097. if (!ts.transforming) {
  13098. var rs = this._readableState;
  13099. if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
  13100. }
  13101. };
  13102. // Doesn't matter what the args are here.
  13103. // _transform does all the work.
  13104. // That we got here means that the readable side wants more data.
  13105. Transform.prototype._read = function (n) {
  13106. var ts = this._transformState;
  13107. if (ts.writechunk !== null && ts.writecb && !ts.transforming) {
  13108. ts.transforming = true;
  13109. this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
  13110. } else {
  13111. // mark that we need a transform, so that any data that comes in
  13112. // will get processed, now that we've asked for it.
  13113. ts.needTransform = true;
  13114. }
  13115. };
  13116. function done(stream, er) {
  13117. if (er) return stream.emit('error', er);
  13118. // if there's nothing in the write buffer, then that means
  13119. // that nothing more will ever be provided
  13120. var ws = stream._writableState;
  13121. var ts = stream._transformState;
  13122. if (ws.length) throw new Error('Calling transform done when ws.length != 0');
  13123. if (ts.transforming) throw new Error('Calling transform done when still transforming');
  13124. return stream.push(null);
  13125. }
  13126. /***/ },
  13127. /* 64 */
  13128. /***/ function(module, exports, __webpack_require__) {
  13129. "use strict";
  13130. /* WEBPACK VAR INJECTION */(function(process, setImmediate) {// A bit simpler than readable streams.
  13131. // Implement an async ._write(chunk, encoding, cb), and it'll handle all
  13132. // the drain event emission and buffering.
  13133. 'use strict';
  13134. module.exports = Writable;
  13135. /*<replacement>*/
  13136. var processNextTick = __webpack_require__(62);
  13137. /*</replacement>*/
  13138. /*<replacement>*/
  13139. var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick;
  13140. /*</replacement>*/
  13141. Writable.WritableState = WritableState;
  13142. /*<replacement>*/
  13143. var util = __webpack_require__(29);
  13144. util.inherits = __webpack_require__(1);
  13145. /*</replacement>*/
  13146. /*<replacement>*/
  13147. var internalUtil = {
  13148. deprecate: __webpack_require__(282)
  13149. };
  13150. /*</replacement>*/
  13151. /*<replacement>*/
  13152. var Stream;
  13153. (function () {
  13154. try {
  13155. Stream = __webpack_require__(19);
  13156. } catch (_) {} finally {
  13157. if (!Stream) Stream = __webpack_require__(44).EventEmitter;
  13158. }
  13159. })();
  13160. /*</replacement>*/
  13161. var Buffer = __webpack_require__(0).Buffer;
  13162. /*<replacement>*/
  13163. var bufferShim = __webpack_require__(51);
  13164. /*</replacement>*/
  13165. util.inherits(Writable, Stream);
  13166. function nop() {}
  13167. function WriteReq(chunk, encoding, cb) {
  13168. this.chunk = chunk;
  13169. this.encoding = encoding;
  13170. this.callback = cb;
  13171. this.next = null;
  13172. }
  13173. var Duplex;
  13174. function WritableState(options, stream) {
  13175. Duplex = Duplex || __webpack_require__(10);
  13176. options = options || {};
  13177. // object stream flag to indicate whether or not this stream
  13178. // contains buffers or objects.
  13179. this.objectMode = !!options.objectMode;
  13180. if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
  13181. // the point at which write() starts returning false
  13182. // Note: 0 is a valid value, means that we always return false if
  13183. // the entire buffer is not flushed immediately on write()
  13184. var hwm = options.highWaterMark;
  13185. var defaultHwm = this.objectMode ? 16 : 16 * 1024;
  13186. this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
  13187. // cast to ints.
  13188. this.highWaterMark = ~ ~this.highWaterMark;
  13189. this.needDrain = false;
  13190. // at the start of calling end()
  13191. this.ending = false;
  13192. // when end() has been called, and returned
  13193. this.ended = false;
  13194. // when 'finish' is emitted
  13195. this.finished = false;
  13196. // should we decode strings into buffers before passing to _write?
  13197. // this is here so that some node-core streams can optimize string
  13198. // handling at a lower level.
  13199. var noDecode = options.decodeStrings === false;
  13200. this.decodeStrings = !noDecode;
  13201. // Crypto is kind of old and crusty. Historically, its default string
  13202. // encoding is 'binary' so we have to make this configurable.
  13203. // Everything else in the universe uses 'utf8', though.
  13204. this.defaultEncoding = options.defaultEncoding || 'utf8';
  13205. // not an actual buffer we keep track of, but a measurement
  13206. // of how much we're waiting to get pushed to some underlying
  13207. // socket or file.
  13208. this.length = 0;
  13209. // a flag to see when we're in the middle of a write.
  13210. this.writing = false;
  13211. // when true all writes will be buffered until .uncork() call
  13212. this.corked = 0;
  13213. // a flag to be able to tell if the onwrite cb is called immediately,
  13214. // or on a later tick. We set this to true at first, because any
  13215. // actions that shouldn't happen until "later" should generally also
  13216. // not happen before the first write call.
  13217. this.sync = true;
  13218. // a flag to know if we're processing previously buffered items, which
  13219. // may call the _write() callback in the same tick, so that we don't
  13220. // end up in an overlapped onwrite situation.
  13221. this.bufferProcessing = false;
  13222. // the callback that's passed to _write(chunk,cb)
  13223. this.onwrite = function (er) {
  13224. onwrite(stream, er);
  13225. };
  13226. // the callback that the user supplies to write(chunk,encoding,cb)
  13227. this.writecb = null;
  13228. // the amount that is being written when _write is called.
  13229. this.writelen = 0;
  13230. this.bufferedRequest = null;
  13231. this.lastBufferedRequest = null;
  13232. // number of pending user-supplied write callbacks
  13233. // this must be 0 before 'finish' can be emitted
  13234. this.pendingcb = 0;
  13235. // emit prefinish if the only thing we're waiting for is _write cbs
  13236. // This is relevant for synchronous Transform streams
  13237. this.prefinished = false;
  13238. // True if the error was already emitted and should not be thrown again
  13239. this.errorEmitted = false;
  13240. // count buffered requests
  13241. this.bufferedRequestCount = 0;
  13242. // allocate the first CorkedRequest, there is always
  13243. // one allocated and free to use, and we maintain at most two
  13244. this.corkedRequestsFree = new CorkedRequest(this);
  13245. }
  13246. WritableState.prototype.getBuffer = function writableStateGetBuffer() {
  13247. var current = this.bufferedRequest;
  13248. var out = [];
  13249. while (current) {
  13250. out.push(current);
  13251. current = current.next;
  13252. }
  13253. return out;
  13254. };
  13255. (function () {
  13256. try {
  13257. Object.defineProperty(WritableState.prototype, 'buffer', {
  13258. get: internalUtil.deprecate(function () {
  13259. return this.getBuffer();
  13260. }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.')
  13261. });
  13262. } catch (_) {}
  13263. })();
  13264. var Duplex;
  13265. function Writable(options) {
  13266. Duplex = Duplex || __webpack_require__(10);
  13267. // Writable ctor is applied to Duplexes, though they're not
  13268. // instanceof Writable, they're instanceof Readable.
  13269. if (!(this instanceof Writable) && !(this instanceof Duplex)) return new Writable(options);
  13270. this._writableState = new WritableState(options, this);
  13271. // legacy.
  13272. this.writable = true;
  13273. if (options) {
  13274. if (typeof options.write === 'function') this._write = options.write;
  13275. if (typeof options.writev === 'function') this._writev = options.writev;
  13276. }
  13277. Stream.call(this);
  13278. }
  13279. // Otherwise people can pipe Writable streams, which is just wrong.
  13280. Writable.prototype.pipe = function () {
  13281. this.emit('error', new Error('Cannot pipe, not readable'));
  13282. };
  13283. function writeAfterEnd(stream, cb) {
  13284. var er = new Error('write after end');
  13285. // TODO: defer error events consistently everywhere, not just the cb
  13286. stream.emit('error', er);
  13287. processNextTick(cb, er);
  13288. }
  13289. // If we get something that is not a buffer, string, null, or undefined,
  13290. // and we're not in objectMode, then that's an error.
  13291. // Otherwise stream chunks are all considered to be of length=1, and the
  13292. // watermarks determine how many objects to keep in the buffer, rather than
  13293. // how many bytes or characters.
  13294. function validChunk(stream, state, chunk, cb) {
  13295. var valid = true;
  13296. var er = false;
  13297. // Always throw error if a null is written
  13298. // if we are not in object mode then throw
  13299. // if it is not a buffer, string, or undefined.
  13300. if (chunk === null) {
  13301. er = new TypeError('May not write null values to stream');
  13302. } else if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
  13303. er = new TypeError('Invalid non-string/buffer chunk');
  13304. }
  13305. if (er) {
  13306. stream.emit('error', er);
  13307. processNextTick(cb, er);
  13308. valid = false;
  13309. }
  13310. return valid;
  13311. }
  13312. Writable.prototype.write = function (chunk, encoding, cb) {
  13313. var state = this._writableState;
  13314. var ret = false;
  13315. if (typeof encoding === 'function') {
  13316. cb = encoding;
  13317. encoding = null;
  13318. }
  13319. if (Buffer.isBuffer(chunk)) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
  13320. if (typeof cb !== 'function') cb = nop;
  13321. if (state.ended) writeAfterEnd(this, cb);else if (validChunk(this, state, chunk, cb)) {
  13322. state.pendingcb++;
  13323. ret = writeOrBuffer(this, state, chunk, encoding, cb);
  13324. }
  13325. return ret;
  13326. };
  13327. Writable.prototype.cork = function () {
  13328. var state = this._writableState;
  13329. state.corked++;
  13330. };
  13331. Writable.prototype.uncork = function () {
  13332. var state = this._writableState;
  13333. if (state.corked) {
  13334. state.corked--;
  13335. if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
  13336. }
  13337. };
  13338. Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
  13339. // node::ParseEncoding() requires lower case.
  13340. if (typeof encoding === 'string') encoding = encoding.toLowerCase();
  13341. if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);
  13342. this._writableState.defaultEncoding = encoding;
  13343. return this;
  13344. };
  13345. function decodeChunk(state, chunk, encoding) {
  13346. if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
  13347. chunk = bufferShim.from(chunk, encoding);
  13348. }
  13349. return chunk;
  13350. }
  13351. // if we're already writing something, then just put this
  13352. // in the queue, and wait our turn. Otherwise, call _write
  13353. // If we return false, then we need a drain event, so set that flag.
  13354. function writeOrBuffer(stream, state, chunk, encoding, cb) {
  13355. chunk = decodeChunk(state, chunk, encoding);
  13356. if (Buffer.isBuffer(chunk)) encoding = 'buffer';
  13357. var len = state.objectMode ? 1 : chunk.length;
  13358. state.length += len;
  13359. var ret = state.length < state.highWaterMark;
  13360. // we must ensure that previous needDrain will not be reset to false.
  13361. if (!ret) state.needDrain = true;
  13362. if (state.writing || state.corked) {
  13363. var last = state.lastBufferedRequest;
  13364. state.lastBufferedRequest = new WriteReq(chunk, encoding, cb);
  13365. if (last) {
  13366. last.next = state.lastBufferedRequest;
  13367. } else {
  13368. state.bufferedRequest = state.lastBufferedRequest;
  13369. }
  13370. state.bufferedRequestCount += 1;
  13371. } else {
  13372. doWrite(stream, state, false, len, chunk, encoding, cb);
  13373. }
  13374. return ret;
  13375. }
  13376. function doWrite(stream, state, writev, len, chunk, encoding, cb) {
  13377. state.writelen = len;
  13378. state.writecb = cb;
  13379. state.writing = true;
  13380. state.sync = true;
  13381. if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
  13382. state.sync = false;
  13383. }
  13384. function onwriteError(stream, state, sync, er, cb) {
  13385. --state.pendingcb;
  13386. if (sync) processNextTick(cb, er);else cb(er);
  13387. stream._writableState.errorEmitted = true;
  13388. stream.emit('error', er);
  13389. }
  13390. function onwriteStateUpdate(state) {
  13391. state.writing = false;
  13392. state.writecb = null;
  13393. state.length -= state.writelen;
  13394. state.writelen = 0;
  13395. }
  13396. function onwrite(stream, er) {
  13397. var state = stream._writableState;
  13398. var sync = state.sync;
  13399. var cb = state.writecb;
  13400. onwriteStateUpdate(state);
  13401. if (er) onwriteError(stream, state, sync, er, cb);else {
  13402. // Check if we're actually ready to finish, but don't emit yet
  13403. var finished = needFinish(state);
  13404. if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
  13405. clearBuffer(stream, state);
  13406. }
  13407. if (sync) {
  13408. /*<replacement>*/
  13409. asyncWrite(afterWrite, stream, state, finished, cb);
  13410. /*</replacement>*/
  13411. } else {
  13412. afterWrite(stream, state, finished, cb);
  13413. }
  13414. }
  13415. }
  13416. function afterWrite(stream, state, finished, cb) {
  13417. if (!finished) onwriteDrain(stream, state);
  13418. state.pendingcb--;
  13419. cb();
  13420. finishMaybe(stream, state);
  13421. }
  13422. // Must force callback to be called on nextTick, so that we don't
  13423. // emit 'drain' before the write() consumer gets the 'false' return
  13424. // value, and has a chance to attach a 'drain' listener.
  13425. function onwriteDrain(stream, state) {
  13426. if (state.length === 0 && state.needDrain) {
  13427. state.needDrain = false;
  13428. stream.emit('drain');
  13429. }
  13430. }
  13431. // if there's something in the buffer waiting, then process it
  13432. function clearBuffer(stream, state) {
  13433. state.bufferProcessing = true;
  13434. var entry = state.bufferedRequest;
  13435. if (stream._writev && entry && entry.next) {
  13436. // Fast case, write everything using _writev()
  13437. var l = state.bufferedRequestCount;
  13438. var buffer = new Array(l);
  13439. var holder = state.corkedRequestsFree;
  13440. holder.entry = entry;
  13441. var count = 0;
  13442. while (entry) {
  13443. buffer[count] = entry;
  13444. entry = entry.next;
  13445. count += 1;
  13446. }
  13447. doWrite(stream, state, true, state.length, buffer, '', holder.finish);
  13448. // doWrite is almost always async, defer these to save a bit of time
  13449. // as the hot path ends with doWrite
  13450. state.pendingcb++;
  13451. state.lastBufferedRequest = null;
  13452. if (holder.next) {
  13453. state.corkedRequestsFree = holder.next;
  13454. holder.next = null;
  13455. } else {
  13456. state.corkedRequestsFree = new CorkedRequest(state);
  13457. }
  13458. } else {
  13459. // Slow case, write chunks one-by-one
  13460. while (entry) {
  13461. var chunk = entry.chunk;
  13462. var encoding = entry.encoding;
  13463. var cb = entry.callback;
  13464. var len = state.objectMode ? 1 : chunk.length;
  13465. doWrite(stream, state, false, len, chunk, encoding, cb);
  13466. entry = entry.next;
  13467. // if we didn't call the onwrite immediately, then
  13468. // it means that we need to wait until it does.
  13469. // also, that means that the chunk and cb are currently
  13470. // being processed, so move the buffer counter past them.
  13471. if (state.writing) {
  13472. break;
  13473. }
  13474. }
  13475. if (entry === null) state.lastBufferedRequest = null;
  13476. }
  13477. state.bufferedRequestCount = 0;
  13478. state.bufferedRequest = entry;
  13479. state.bufferProcessing = false;
  13480. }
  13481. Writable.prototype._write = function (chunk, encoding, cb) {
  13482. cb(new Error('not implemented'));
  13483. };
  13484. Writable.prototype._writev = null;
  13485. Writable.prototype.end = function (chunk, encoding, cb) {
  13486. var state = this._writableState;
  13487. if (typeof chunk === 'function') {
  13488. cb = chunk;
  13489. chunk = null;
  13490. encoding = null;
  13491. } else if (typeof encoding === 'function') {
  13492. cb = encoding;
  13493. encoding = null;
  13494. }
  13495. if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
  13496. // .end() fully uncorks
  13497. if (state.corked) {
  13498. state.corked = 1;
  13499. this.uncork();
  13500. }
  13501. // ignore unnecessary end() calls.
  13502. if (!state.ending && !state.finished) endWritable(this, state, cb);
  13503. };
  13504. function needFinish(state) {
  13505. return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
  13506. }
  13507. function prefinish(stream, state) {
  13508. if (!state.prefinished) {
  13509. state.prefinished = true;
  13510. stream.emit('prefinish');
  13511. }
  13512. }
  13513. function finishMaybe(stream, state) {
  13514. var need = needFinish(state);
  13515. if (need) {
  13516. if (state.pendingcb === 0) {
  13517. prefinish(stream, state);
  13518. state.finished = true;
  13519. stream.emit('finish');
  13520. } else {
  13521. prefinish(stream, state);
  13522. }
  13523. }
  13524. return need;
  13525. }
  13526. function endWritable(stream, state, cb) {
  13527. state.ending = true;
  13528. finishMaybe(stream, state);
  13529. if (cb) {
  13530. if (state.finished) processNextTick(cb);else stream.once('finish', cb);
  13531. }
  13532. state.ended = true;
  13533. stream.writable = false;
  13534. }
  13535. // It seems a linked list but it is not
  13536. // there will be only 2 of these for each stream
  13537. function CorkedRequest(state) {
  13538. var _this = this;
  13539. this.next = null;
  13540. this.entry = null;
  13541. this.finish = function (err) {
  13542. var entry = _this.entry;
  13543. _this.entry = null;
  13544. while (entry) {
  13545. var cb = entry.callback;
  13546. state.pendingcb--;
  13547. cb(err);
  13548. entry = entry.next;
  13549. }
  13550. if (state.corkedRequestsFree) {
  13551. state.corkedRequestsFree.next = _this;
  13552. } else {
  13553. state.corkedRequestsFree = _this;
  13554. }
  13555. };
  13556. }
  13557. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7), __webpack_require__(66).setImmediate))
  13558. /***/ },
  13559. /* 65 */
  13560. /***/ function(module, exports, __webpack_require__) {
  13561. // Copyright Joyent, Inc. and other Node contributors.
  13562. //
  13563. // Permission is hereby granted, free of charge, to any person obtaining a
  13564. // copy of this software and associated documentation files (the
  13565. // "Software"), to deal in the Software without restriction, including
  13566. // without limitation the rights to use, copy, modify, merge, publish,
  13567. // distribute, sublicense, and/or sell copies of the Software, and to permit
  13568. // persons to whom the Software is furnished to do so, subject to the
  13569. // following conditions:
  13570. //
  13571. // The above copyright notice and this permission notice shall be included
  13572. // in all copies or substantial portions of the Software.
  13573. //
  13574. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  13575. // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  13576. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
  13577. // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  13578. // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  13579. // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  13580. // USE OR OTHER DEALINGS IN THE SOFTWARE.
  13581. var Buffer = __webpack_require__(0).Buffer;
  13582. var isBufferEncoding = Buffer.isEncoding
  13583. || function(encoding) {
  13584. switch (encoding && encoding.toLowerCase()) {
  13585. case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true;
  13586. default: return false;
  13587. }
  13588. }
  13589. function assertEncoding(encoding) {
  13590. if (encoding && !isBufferEncoding(encoding)) {
  13591. throw new Error('Unknown encoding: ' + encoding);
  13592. }
  13593. }
  13594. // StringDecoder provides an interface for efficiently splitting a series of
  13595. // buffers into a series of JS strings without breaking apart multi-byte
  13596. // characters. CESU-8 is handled as part of the UTF-8 encoding.
  13597. //
  13598. // @TODO Handling all encodings inside a single object makes it very difficult
  13599. // to reason about this code, so it should be split up in the future.
  13600. // @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code
  13601. // points as used by CESU-8.
  13602. var StringDecoder = exports.StringDecoder = function(encoding) {
  13603. this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, '');
  13604. assertEncoding(encoding);
  13605. switch (this.encoding) {
  13606. case 'utf8':
  13607. // CESU-8 represents each of Surrogate Pair by 3-bytes
  13608. this.surrogateSize = 3;
  13609. break;
  13610. case 'ucs2':
  13611. case 'utf16le':
  13612. // UTF-16 represents each of Surrogate Pair by 2-bytes
  13613. this.surrogateSize = 2;
  13614. this.detectIncompleteChar = utf16DetectIncompleteChar;
  13615. break;
  13616. case 'base64':
  13617. // Base-64 stores 3 bytes in 4 chars, and pads the remainder.
  13618. this.surrogateSize = 3;
  13619. this.detectIncompleteChar = base64DetectIncompleteChar;
  13620. break;
  13621. default:
  13622. this.write = passThroughWrite;
  13623. return;
  13624. }
  13625. // Enough space to store all bytes of a single character. UTF-8 needs 4
  13626. // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate).
  13627. this.charBuffer = new Buffer(6);
  13628. // Number of bytes received for the current incomplete multi-byte character.
  13629. this.charReceived = 0;
  13630. // Number of bytes expected for the current incomplete multi-byte character.
  13631. this.charLength = 0;
  13632. };
  13633. // write decodes the given buffer and returns it as JS string that is
  13634. // guaranteed to not contain any partial multi-byte characters. Any partial
  13635. // character found at the end of the buffer is buffered up, and will be
  13636. // returned when calling write again with the remaining bytes.
  13637. //
  13638. // Note: Converting a Buffer containing an orphan surrogate to a String
  13639. // currently works, but converting a String to a Buffer (via `new Buffer`, or
  13640. // Buffer#write) will replace incomplete surrogates with the unicode
  13641. // replacement character. See https://codereview.chromium.org/121173009/ .
  13642. StringDecoder.prototype.write = function(buffer) {
  13643. var charStr = '';
  13644. // if our last write ended with an incomplete multibyte character
  13645. while (this.charLength) {
  13646. // determine how many remaining bytes this buffer has to offer for this char
  13647. var available = (buffer.length >= this.charLength - this.charReceived) ?
  13648. this.charLength - this.charReceived :
  13649. buffer.length;
  13650. // add the new bytes to the char buffer
  13651. buffer.copy(this.charBuffer, this.charReceived, 0, available);
  13652. this.charReceived += available;
  13653. if (this.charReceived < this.charLength) {
  13654. // still not enough chars in this buffer? wait for more ...
  13655. return '';
  13656. }
  13657. // remove bytes belonging to the current character from the buffer
  13658. buffer = buffer.slice(available, buffer.length);
  13659. // get the character that was split
  13660. charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding);
  13661. // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
  13662. var charCode = charStr.charCodeAt(charStr.length - 1);
  13663. if (charCode >= 0xD800 && charCode <= 0xDBFF) {
  13664. this.charLength += this.surrogateSize;
  13665. charStr = '';
  13666. continue;
  13667. }
  13668. this.charReceived = this.charLength = 0;
  13669. // if there are no more bytes in this buffer, just emit our char
  13670. if (buffer.length === 0) {
  13671. return charStr;
  13672. }
  13673. break;
  13674. }
  13675. // determine and set charLength / charReceived
  13676. this.detectIncompleteChar(buffer);
  13677. var end = buffer.length;
  13678. if (this.charLength) {
  13679. // buffer the incomplete character bytes we got
  13680. buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end);
  13681. end -= this.charReceived;
  13682. }
  13683. charStr += buffer.toString(this.encoding, 0, end);
  13684. var end = charStr.length - 1;
  13685. var charCode = charStr.charCodeAt(end);
  13686. // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
  13687. if (charCode >= 0xD800 && charCode <= 0xDBFF) {
  13688. var size = this.surrogateSize;
  13689. this.charLength += size;
  13690. this.charReceived += size;
  13691. this.charBuffer.copy(this.charBuffer, size, 0, size);
  13692. buffer.copy(this.charBuffer, 0, 0, size);
  13693. return charStr.substring(0, end);
  13694. }
  13695. // or just emit the charStr
  13696. return charStr;
  13697. };
  13698. // detectIncompleteChar determines if there is an incomplete UTF-8 character at
  13699. // the end of the given buffer. If so, it sets this.charLength to the byte
  13700. // length that character, and sets this.charReceived to the number of bytes
  13701. // that are available for this character.
  13702. StringDecoder.prototype.detectIncompleteChar = function(buffer) {
  13703. // determine how many bytes we have to check at the end of this buffer
  13704. var i = (buffer.length >= 3) ? 3 : buffer.length;
  13705. // Figure out if one of the last i bytes of our buffer announces an
  13706. // incomplete char.
  13707. for (; i > 0; i--) {
  13708. var c = buffer[buffer.length - i];
  13709. // See http://en.wikipedia.org/wiki/UTF-8#Description
  13710. // 110XXXXX
  13711. if (i == 1 && c >> 5 == 0x06) {
  13712. this.charLength = 2;
  13713. break;
  13714. }
  13715. // 1110XXXX
  13716. if (i <= 2 && c >> 4 == 0x0E) {
  13717. this.charLength = 3;
  13718. break;
  13719. }
  13720. // 11110XXX
  13721. if (i <= 3 && c >> 3 == 0x1E) {
  13722. this.charLength = 4;
  13723. break;
  13724. }
  13725. }
  13726. this.charReceived = i;
  13727. };
  13728. StringDecoder.prototype.end = function(buffer) {
  13729. var res = '';
  13730. if (buffer && buffer.length)
  13731. res = this.write(buffer);
  13732. if (this.charReceived) {
  13733. var cr = this.charReceived;
  13734. var buf = this.charBuffer;
  13735. var enc = this.encoding;
  13736. res += buf.slice(0, cr).toString(enc);
  13737. }
  13738. return res;
  13739. };
  13740. function passThroughWrite(buffer) {
  13741. return buffer.toString(this.encoding);
  13742. }
  13743. function utf16DetectIncompleteChar(buffer) {
  13744. this.charReceived = buffer.length % 2;
  13745. this.charLength = this.charReceived ? 2 : 0;
  13746. }
  13747. function base64DetectIncompleteChar(buffer) {
  13748. this.charReceived = buffer.length % 3;
  13749. this.charLength = this.charReceived ? 3 : 0;
  13750. }
  13751. /***/ },
  13752. /* 66 */
  13753. /***/ function(module, exports, __webpack_require__) {
  13754. /* WEBPACK VAR INJECTION */(function(setImmediate, clearImmediate) {var nextTick = __webpack_require__(7).nextTick;
  13755. var apply = Function.prototype.apply;
  13756. var slice = Array.prototype.slice;
  13757. var immediateIds = {};
  13758. var nextImmediateId = 0;
  13759. // DOM APIs, for completeness
  13760. exports.setTimeout = function() {
  13761. return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);
  13762. };
  13763. exports.setInterval = function() {
  13764. return new Timeout(apply.call(setInterval, window, arguments), clearInterval);
  13765. };
  13766. exports.clearTimeout =
  13767. exports.clearInterval = function(timeout) { timeout.close(); };
  13768. function Timeout(id, clearFn) {
  13769. this._id = id;
  13770. this._clearFn = clearFn;
  13771. }
  13772. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  13773. Timeout.prototype.close = function() {
  13774. this._clearFn.call(window, this._id);
  13775. };
  13776. // Does not start the time, just sets up the members needed.
  13777. exports.enroll = function(item, msecs) {
  13778. clearTimeout(item._idleTimeoutId);
  13779. item._idleTimeout = msecs;
  13780. };
  13781. exports.unenroll = function(item) {
  13782. clearTimeout(item._idleTimeoutId);
  13783. item._idleTimeout = -1;
  13784. };
  13785. exports._unrefActive = exports.active = function(item) {
  13786. clearTimeout(item._idleTimeoutId);
  13787. var msecs = item._idleTimeout;
  13788. if (msecs >= 0) {
  13789. item._idleTimeoutId = setTimeout(function onTimeout() {
  13790. if (item._onTimeout)
  13791. item._onTimeout();
  13792. }, msecs);
  13793. }
  13794. };
  13795. // That's not how node.js implements it but the exposed api is the same.
  13796. exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) {
  13797. var id = nextImmediateId++;
  13798. var args = arguments.length < 2 ? false : slice.call(arguments, 1);
  13799. immediateIds[id] = true;
  13800. nextTick(function onNextTick() {
  13801. if (immediateIds[id]) {
  13802. // fn.call() is faster so we optimize for the common use-case
  13803. // @see http://jsperf.com/call-apply-segu
  13804. if (args) {
  13805. fn.apply(null, args);
  13806. } else {
  13807. fn.call(null);
  13808. }
  13809. // Prevent ids from leaking
  13810. exports.clearImmediate(id);
  13811. }
  13812. });
  13813. return id;
  13814. };
  13815. exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) {
  13816. delete immediateIds[id];
  13817. };
  13818. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(66).setImmediate, __webpack_require__(66).clearImmediate))
  13819. /***/ },
  13820. /* 67 */
  13821. /***/ function(module, exports, __webpack_require__) {
  13822. var inherits = __webpack_require__(1);
  13823. var Reporter = __webpack_require__(21).Reporter;
  13824. var Buffer = __webpack_require__(0).Buffer;
  13825. function DecoderBuffer(base, options) {
  13826. Reporter.call(this, options);
  13827. if (!Buffer.isBuffer(base)) {
  13828. this.error('Input not Buffer');
  13829. return;
  13830. }
  13831. this.base = base;
  13832. this.offset = 0;
  13833. this.length = base.length;
  13834. }
  13835. inherits(DecoderBuffer, Reporter);
  13836. exports.DecoderBuffer = DecoderBuffer;
  13837. DecoderBuffer.prototype.save = function save() {
  13838. return { offset: this.offset, reporter: Reporter.prototype.save.call(this) };
  13839. };
  13840. DecoderBuffer.prototype.restore = function restore(save) {
  13841. // Return skipped data
  13842. var res = new DecoderBuffer(this.base);
  13843. res.offset = save.offset;
  13844. res.length = this.offset;
  13845. this.offset = save.offset;
  13846. Reporter.prototype.restore.call(this, save.reporter);
  13847. return res;
  13848. };
  13849. DecoderBuffer.prototype.isEmpty = function isEmpty() {
  13850. return this.offset === this.length;
  13851. };
  13852. DecoderBuffer.prototype.readUInt8 = function readUInt8(fail) {
  13853. if (this.offset + 1 <= this.length)
  13854. return this.base.readUInt8(this.offset++, true);
  13855. else
  13856. return this.error(fail || 'DecoderBuffer overrun');
  13857. }
  13858. DecoderBuffer.prototype.skip = function skip(bytes, fail) {
  13859. if (!(this.offset + bytes <= this.length))
  13860. return this.error(fail || 'DecoderBuffer overrun');
  13861. var res = new DecoderBuffer(this.base);
  13862. // Share reporter state
  13863. res._reporterState = this._reporterState;
  13864. res.offset = this.offset;
  13865. res.length = this.offset + bytes;
  13866. this.offset += bytes;
  13867. return res;
  13868. }
  13869. DecoderBuffer.prototype.raw = function raw(save) {
  13870. return this.base.slice(save ? save.offset : this.offset, this.length);
  13871. }
  13872. function EncoderBuffer(value, reporter) {
  13873. if (Array.isArray(value)) {
  13874. this.length = 0;
  13875. this.value = value.map(function(item) {
  13876. if (!(item instanceof EncoderBuffer))
  13877. item = new EncoderBuffer(item, reporter);
  13878. this.length += item.length;
  13879. return item;
  13880. }, this);
  13881. } else if (typeof value === 'number') {
  13882. if (!(0 <= value && value <= 0xff))
  13883. return reporter.error('non-byte EncoderBuffer value');
  13884. this.value = value;
  13885. this.length = 1;
  13886. } else if (typeof value === 'string') {
  13887. this.value = value;
  13888. this.length = Buffer.byteLength(value);
  13889. } else if (Buffer.isBuffer(value)) {
  13890. this.value = value;
  13891. this.length = value.length;
  13892. } else {
  13893. return reporter.error('Unsupported type: ' + typeof value);
  13894. }
  13895. }
  13896. exports.EncoderBuffer = EncoderBuffer;
  13897. EncoderBuffer.prototype.join = function join(out, offset) {
  13898. if (!out)
  13899. out = new Buffer(this.length);
  13900. if (!offset)
  13901. offset = 0;
  13902. if (this.length === 0)
  13903. return out;
  13904. if (Array.isArray(this.value)) {
  13905. this.value.forEach(function(item) {
  13906. item.join(out, offset);
  13907. offset += item.length;
  13908. });
  13909. } else {
  13910. if (typeof this.value === 'number')
  13911. out[offset] = this.value;
  13912. else if (typeof this.value === 'string')
  13913. out.write(this.value, offset);
  13914. else if (Buffer.isBuffer(this.value))
  13915. this.value.copy(out, offset);
  13916. offset += this.length;
  13917. }
  13918. return out;
  13919. };
  13920. /***/ },
  13921. /* 68 */
  13922. /***/ function(module, exports, __webpack_require__) {
  13923. var constants = exports;
  13924. // Helper
  13925. constants._reverse = function reverse(map) {
  13926. var res = {};
  13927. Object.keys(map).forEach(function(key) {
  13928. // Convert key to integer if it is stringified
  13929. if ((key | 0) == key)
  13930. key = key | 0;
  13931. var value = map[key];
  13932. res[value] = key;
  13933. });
  13934. return res;
  13935. };
  13936. constants.der = __webpack_require__(127);
  13937. /***/ },
  13938. /* 69 */
  13939. /***/ function(module, exports, __webpack_require__) {
  13940. var inherits = __webpack_require__(1);
  13941. var asn1 = __webpack_require__(33);
  13942. var base = asn1.base;
  13943. var bignum = asn1.bignum;
  13944. // Import DER constants
  13945. var der = asn1.constants.der;
  13946. function DERDecoder(entity) {
  13947. this.enc = 'der';
  13948. this.name = entity.name;
  13949. this.entity = entity;
  13950. // Construct base tree
  13951. this.tree = new DERNode();
  13952. this.tree._init(entity.body);
  13953. };
  13954. module.exports = DERDecoder;
  13955. DERDecoder.prototype.decode = function decode(data, options) {
  13956. if (!(data instanceof base.DecoderBuffer))
  13957. data = new base.DecoderBuffer(data, options);
  13958. return this.tree._decode(data, options);
  13959. };
  13960. // Tree methods
  13961. function DERNode(parent) {
  13962. base.Node.call(this, 'der', parent);
  13963. }
  13964. inherits(DERNode, base.Node);
  13965. DERNode.prototype._peekTag = function peekTag(buffer, tag, any) {
  13966. if (buffer.isEmpty())
  13967. return false;
  13968. var state = buffer.save();
  13969. var decodedTag = derDecodeTag(buffer, 'Failed to peek tag: "' + tag + '"');
  13970. if (buffer.isError(decodedTag))
  13971. return decodedTag;
  13972. buffer.restore(state);
  13973. return decodedTag.tag === tag || decodedTag.tagStr === tag ||
  13974. (decodedTag.tagStr + 'of') === tag || any;
  13975. };
  13976. DERNode.prototype._decodeTag = function decodeTag(buffer, tag, any) {
  13977. var decodedTag = derDecodeTag(buffer,
  13978. 'Failed to decode tag of "' + tag + '"');
  13979. if (buffer.isError(decodedTag))
  13980. return decodedTag;
  13981. var len = derDecodeLen(buffer,
  13982. decodedTag.primitive,
  13983. 'Failed to get length of "' + tag + '"');
  13984. // Failure
  13985. if (buffer.isError(len))
  13986. return len;
  13987. if (!any &&
  13988. decodedTag.tag !== tag &&
  13989. decodedTag.tagStr !== tag &&
  13990. decodedTag.tagStr + 'of' !== tag) {
  13991. return buffer.error('Failed to match tag: "' + tag + '"');
  13992. }
  13993. if (decodedTag.primitive || len !== null)
  13994. return buffer.skip(len, 'Failed to match body of: "' + tag + '"');
  13995. // Indefinite length... find END tag
  13996. var state = buffer.save();
  13997. var res = this._skipUntilEnd(
  13998. buffer,
  13999. 'Failed to skip indefinite length body: "' + this.tag + '"');
  14000. if (buffer.isError(res))
  14001. return res;
  14002. len = buffer.offset - state.offset;
  14003. buffer.restore(state);
  14004. return buffer.skip(len, 'Failed to match body of: "' + tag + '"');
  14005. };
  14006. DERNode.prototype._skipUntilEnd = function skipUntilEnd(buffer, fail) {
  14007. while (true) {
  14008. var tag = derDecodeTag(buffer, fail);
  14009. if (buffer.isError(tag))
  14010. return tag;
  14011. var len = derDecodeLen(buffer, tag.primitive, fail);
  14012. if (buffer.isError(len))
  14013. return len;
  14014. var res;
  14015. if (tag.primitive || len !== null)
  14016. res = buffer.skip(len)
  14017. else
  14018. res = this._skipUntilEnd(buffer, fail);
  14019. // Failure
  14020. if (buffer.isError(res))
  14021. return res;
  14022. if (tag.tagStr === 'end')
  14023. break;
  14024. }
  14025. };
  14026. DERNode.prototype._decodeList = function decodeList(buffer, tag, decoder,
  14027. options) {
  14028. var result = [];
  14029. while (!buffer.isEmpty()) {
  14030. var possibleEnd = this._peekTag(buffer, 'end');
  14031. if (buffer.isError(possibleEnd))
  14032. return possibleEnd;
  14033. var res = decoder.decode(buffer, 'der', options);
  14034. if (buffer.isError(res) && possibleEnd)
  14035. break;
  14036. result.push(res);
  14037. }
  14038. return result;
  14039. };
  14040. DERNode.prototype._decodeStr = function decodeStr(buffer, tag) {
  14041. if (tag === 'bitstr') {
  14042. var unused = buffer.readUInt8();
  14043. if (buffer.isError(unused))
  14044. return unused;
  14045. return { unused: unused, data: buffer.raw() };
  14046. } else if (tag === 'bmpstr') {
  14047. var raw = buffer.raw();
  14048. if (raw.length % 2 === 1)
  14049. return buffer.error('Decoding of string type: bmpstr length mismatch');
  14050. var str = '';
  14051. for (var i = 0; i < raw.length / 2; i++) {
  14052. str += String.fromCharCode(raw.readUInt16BE(i * 2));
  14053. }
  14054. return str;
  14055. } else if (tag === 'numstr') {
  14056. var numstr = buffer.raw().toString('ascii');
  14057. if (!this._isNumstr(numstr)) {
  14058. return buffer.error('Decoding of string type: ' +
  14059. 'numstr unsupported characters');
  14060. }
  14061. return numstr;
  14062. } else if (tag === 'octstr') {
  14063. return buffer.raw();
  14064. } else if (tag === 'printstr') {
  14065. var printstr = buffer.raw().toString('ascii');
  14066. if (!this._isPrintstr(printstr)) {
  14067. return buffer.error('Decoding of string type: ' +
  14068. 'printstr unsupported characters');
  14069. }
  14070. return printstr;
  14071. } else if (/str$/.test(tag)) {
  14072. return buffer.raw().toString();
  14073. } else {
  14074. return buffer.error('Decoding of string type: ' + tag + ' unsupported');
  14075. }
  14076. };
  14077. DERNode.prototype._decodeObjid = function decodeObjid(buffer, values, relative) {
  14078. var result;
  14079. var identifiers = [];
  14080. var ident = 0;
  14081. while (!buffer.isEmpty()) {
  14082. var subident = buffer.readUInt8();
  14083. ident <<= 7;
  14084. ident |= subident & 0x7f;
  14085. if ((subident & 0x80) === 0) {
  14086. identifiers.push(ident);
  14087. ident = 0;
  14088. }
  14089. }
  14090. if (subident & 0x80)
  14091. identifiers.push(ident);
  14092. var first = (identifiers[0] / 40) | 0;
  14093. var second = identifiers[0] % 40;
  14094. if (relative)
  14095. result = identifiers;
  14096. else
  14097. result = [first, second].concat(identifiers.slice(1));
  14098. if (values) {
  14099. var tmp = values[result.join(' ')];
  14100. if (tmp === undefined)
  14101. tmp = values[result.join('.')];
  14102. if (tmp !== undefined)
  14103. result = tmp;
  14104. }
  14105. return result;
  14106. };
  14107. DERNode.prototype._decodeTime = function decodeTime(buffer, tag) {
  14108. var str = buffer.raw().toString();
  14109. if (tag === 'gentime') {
  14110. var year = str.slice(0, 4) | 0;
  14111. var mon = str.slice(4, 6) | 0;
  14112. var day = str.slice(6, 8) | 0;
  14113. var hour = str.slice(8, 10) | 0;
  14114. var min = str.slice(10, 12) | 0;
  14115. var sec = str.slice(12, 14) | 0;
  14116. } else if (tag === 'utctime') {
  14117. var year = str.slice(0, 2) | 0;
  14118. var mon = str.slice(2, 4) | 0;
  14119. var day = str.slice(4, 6) | 0;
  14120. var hour = str.slice(6, 8) | 0;
  14121. var min = str.slice(8, 10) | 0;
  14122. var sec = str.slice(10, 12) | 0;
  14123. if (year < 70)
  14124. year = 2000 + year;
  14125. else
  14126. year = 1900 + year;
  14127. } else {
  14128. return buffer.error('Decoding ' + tag + ' time is not supported yet');
  14129. }
  14130. return Date.UTC(year, mon - 1, day, hour, min, sec, 0);
  14131. };
  14132. DERNode.prototype._decodeNull = function decodeNull(buffer) {
  14133. return null;
  14134. };
  14135. DERNode.prototype._decodeBool = function decodeBool(buffer) {
  14136. var res = buffer.readUInt8();
  14137. if (buffer.isError(res))
  14138. return res;
  14139. else
  14140. return res !== 0;
  14141. };
  14142. DERNode.prototype._decodeInt = function decodeInt(buffer, values) {
  14143. // Bigint, return as it is (assume big endian)
  14144. var raw = buffer.raw();
  14145. var res = new bignum(raw);
  14146. if (values)
  14147. res = values[res.toString(10)] || res;
  14148. return res;
  14149. };
  14150. DERNode.prototype._use = function use(entity, obj) {
  14151. if (typeof entity === 'function')
  14152. entity = entity(obj);
  14153. return entity._getDecoder('der').tree;
  14154. };
  14155. // Utility methods
  14156. function derDecodeTag(buf, fail) {
  14157. var tag = buf.readUInt8(fail);
  14158. if (buf.isError(tag))
  14159. return tag;
  14160. var cls = der.tagClass[tag >> 6];
  14161. var primitive = (tag & 0x20) === 0;
  14162. // Multi-octet tag - load
  14163. if ((tag & 0x1f) === 0x1f) {
  14164. var oct = tag;
  14165. tag = 0;
  14166. while ((oct & 0x80) === 0x80) {
  14167. oct = buf.readUInt8(fail);
  14168. if (buf.isError(oct))
  14169. return oct;
  14170. tag <<= 7;
  14171. tag |= oct & 0x7f;
  14172. }
  14173. } else {
  14174. tag &= 0x1f;
  14175. }
  14176. var tagStr = der.tag[tag];
  14177. return {
  14178. cls: cls,
  14179. primitive: primitive,
  14180. tag: tag,
  14181. tagStr: tagStr
  14182. };
  14183. }
  14184. function derDecodeLen(buf, primitive, fail) {
  14185. var len = buf.readUInt8(fail);
  14186. if (buf.isError(len))
  14187. return len;
  14188. // Indefinite form
  14189. if (!primitive && len === 0x80)
  14190. return null;
  14191. // Definite form
  14192. if ((len & 0x80) === 0) {
  14193. // Short form
  14194. return len;
  14195. }
  14196. // Long form
  14197. var num = len & 0x7f;
  14198. if (num >= 4)
  14199. return buf.error('length octect is too long');
  14200. len = 0;
  14201. for (var i = 0; i < num; i++) {
  14202. len <<= 8;
  14203. var j = buf.readUInt8(fail);
  14204. if (buf.isError(j))
  14205. return j;
  14206. len |= j;
  14207. }
  14208. return len;
  14209. }
  14210. /***/ },
  14211. /* 70 */
  14212. /***/ function(module, exports, __webpack_require__) {
  14213. var inherits = __webpack_require__(1);
  14214. var Buffer = __webpack_require__(0).Buffer;
  14215. var asn1 = __webpack_require__(33);
  14216. var base = asn1.base;
  14217. // Import DER constants
  14218. var der = asn1.constants.der;
  14219. function DEREncoder(entity) {
  14220. this.enc = 'der';
  14221. this.name = entity.name;
  14222. this.entity = entity;
  14223. // Construct base tree
  14224. this.tree = new DERNode();
  14225. this.tree._init(entity.body);
  14226. };
  14227. module.exports = DEREncoder;
  14228. DEREncoder.prototype.encode = function encode(data, reporter) {
  14229. return this.tree._encode(data, reporter).join();
  14230. };
  14231. // Tree methods
  14232. function DERNode(parent) {
  14233. base.Node.call(this, 'der', parent);
  14234. }
  14235. inherits(DERNode, base.Node);
  14236. DERNode.prototype._encodeComposite = function encodeComposite(tag,
  14237. primitive,
  14238. cls,
  14239. content) {
  14240. var encodedTag = encodeTag(tag, primitive, cls, this.reporter);
  14241. // Short form
  14242. if (content.length < 0x80) {
  14243. var header = new Buffer(2);
  14244. header[0] = encodedTag;
  14245. header[1] = content.length;
  14246. return this._createEncoderBuffer([ header, content ]);
  14247. }
  14248. // Long form
  14249. // Count octets required to store length
  14250. var lenOctets = 1;
  14251. for (var i = content.length; i >= 0x100; i >>= 8)
  14252. lenOctets++;
  14253. var header = new Buffer(1 + 1 + lenOctets);
  14254. header[0] = encodedTag;
  14255. header[1] = 0x80 | lenOctets;
  14256. for (var i = 1 + lenOctets, j = content.length; j > 0; i--, j >>= 8)
  14257. header[i] = j & 0xff;
  14258. return this._createEncoderBuffer([ header, content ]);
  14259. };
  14260. DERNode.prototype._encodeStr = function encodeStr(str, tag) {
  14261. if (tag === 'bitstr') {
  14262. return this._createEncoderBuffer([ str.unused | 0, str.data ]);
  14263. } else if (tag === 'bmpstr') {
  14264. var buf = new Buffer(str.length * 2);
  14265. for (var i = 0; i < str.length; i++) {
  14266. buf.writeUInt16BE(str.charCodeAt(i), i * 2);
  14267. }
  14268. return this._createEncoderBuffer(buf);
  14269. } else if (tag === 'numstr') {
  14270. if (!this._isNumstr(str)) {
  14271. return this.reporter.error('Encoding of string type: numstr supports ' +
  14272. 'only digits and space');
  14273. }
  14274. return this._createEncoderBuffer(str);
  14275. } else if (tag === 'printstr') {
  14276. if (!this._isPrintstr(str)) {
  14277. return this.reporter.error('Encoding of string type: printstr supports ' +
  14278. 'only latin upper and lower case letters, ' +
  14279. 'digits, space, apostrophe, left and rigth ' +
  14280. 'parenthesis, plus sign, comma, hyphen, ' +
  14281. 'dot, slash, colon, equal sign, ' +
  14282. 'question mark');
  14283. }
  14284. return this._createEncoderBuffer(str);
  14285. } else if (/str$/.test(tag)) {
  14286. return this._createEncoderBuffer(str);
  14287. } else {
  14288. return this.reporter.error('Encoding of string type: ' + tag +
  14289. ' unsupported');
  14290. }
  14291. };
  14292. DERNode.prototype._encodeObjid = function encodeObjid(id, values, relative) {
  14293. if (typeof id === 'string') {
  14294. if (!values)
  14295. return this.reporter.error('string objid given, but no values map found');
  14296. if (!values.hasOwnProperty(id))
  14297. return this.reporter.error('objid not found in values map');
  14298. id = values[id].split(/[\s\.]+/g);
  14299. for (var i = 0; i < id.length; i++)
  14300. id[i] |= 0;
  14301. } else if (Array.isArray(id)) {
  14302. id = id.slice();
  14303. for (var i = 0; i < id.length; i++)
  14304. id[i] |= 0;
  14305. }
  14306. if (!Array.isArray(id)) {
  14307. return this.reporter.error('objid() should be either array or string, ' +
  14308. 'got: ' + JSON.stringify(id));
  14309. }
  14310. if (!relative) {
  14311. if (id[1] >= 40)
  14312. return this.reporter.error('Second objid identifier OOB');
  14313. id.splice(0, 2, id[0] * 40 + id[1]);
  14314. }
  14315. // Count number of octets
  14316. var size = 0;
  14317. for (var i = 0; i < id.length; i++) {
  14318. var ident = id[i];
  14319. for (size++; ident >= 0x80; ident >>= 7)
  14320. size++;
  14321. }
  14322. var objid = new Buffer(size);
  14323. var offset = objid.length - 1;
  14324. for (var i = id.length - 1; i >= 0; i--) {
  14325. var ident = id[i];
  14326. objid[offset--] = ident & 0x7f;
  14327. while ((ident >>= 7) > 0)
  14328. objid[offset--] = 0x80 | (ident & 0x7f);
  14329. }
  14330. return this._createEncoderBuffer(objid);
  14331. };
  14332. function two(num) {
  14333. if (num < 10)
  14334. return '0' + num;
  14335. else
  14336. return num;
  14337. }
  14338. DERNode.prototype._encodeTime = function encodeTime(time, tag) {
  14339. var str;
  14340. var date = new Date(time);
  14341. if (tag === 'gentime') {
  14342. str = [
  14343. two(date.getFullYear()),
  14344. two(date.getUTCMonth() + 1),
  14345. two(date.getUTCDate()),
  14346. two(date.getUTCHours()),
  14347. two(date.getUTCMinutes()),
  14348. two(date.getUTCSeconds()),
  14349. 'Z'
  14350. ].join('');
  14351. } else if (tag === 'utctime') {
  14352. str = [
  14353. two(date.getFullYear() % 100),
  14354. two(date.getUTCMonth() + 1),
  14355. two(date.getUTCDate()),
  14356. two(date.getUTCHours()),
  14357. two(date.getUTCMinutes()),
  14358. two(date.getUTCSeconds()),
  14359. 'Z'
  14360. ].join('');
  14361. } else {
  14362. this.reporter.error('Encoding ' + tag + ' time is not supported yet');
  14363. }
  14364. return this._encodeStr(str, 'octstr');
  14365. };
  14366. DERNode.prototype._encodeNull = function encodeNull() {
  14367. return this._createEncoderBuffer('');
  14368. };
  14369. DERNode.prototype._encodeInt = function encodeInt(num, values) {
  14370. if (typeof num === 'string') {
  14371. if (!values)
  14372. return this.reporter.error('String int or enum given, but no values map');
  14373. if (!values.hasOwnProperty(num)) {
  14374. return this.reporter.error('Values map doesn\'t contain: ' +
  14375. JSON.stringify(num));
  14376. }
  14377. num = values[num];
  14378. }
  14379. // Bignum, assume big endian
  14380. if (typeof num !== 'number' && !Buffer.isBuffer(num)) {
  14381. var numArray = num.toArray();
  14382. if (!num.sign && numArray[0] & 0x80) {
  14383. numArray.unshift(0);
  14384. }
  14385. num = new Buffer(numArray);
  14386. }
  14387. if (Buffer.isBuffer(num)) {
  14388. var size = num.length;
  14389. if (num.length === 0)
  14390. size++;
  14391. var out = new Buffer(size);
  14392. num.copy(out);
  14393. if (num.length === 0)
  14394. out[0] = 0
  14395. return this._createEncoderBuffer(out);
  14396. }
  14397. if (num < 0x80)
  14398. return this._createEncoderBuffer(num);
  14399. if (num < 0x100)
  14400. return this._createEncoderBuffer([0, num]);
  14401. var size = 1;
  14402. for (var i = num; i >= 0x100; i >>= 8)
  14403. size++;
  14404. var out = new Array(size);
  14405. for (var i = out.length - 1; i >= 0; i--) {
  14406. out[i] = num & 0xff;
  14407. num >>= 8;
  14408. }
  14409. if(out[0] & 0x80) {
  14410. out.unshift(0);
  14411. }
  14412. return this._createEncoderBuffer(new Buffer(out));
  14413. };
  14414. DERNode.prototype._encodeBool = function encodeBool(value) {
  14415. return this._createEncoderBuffer(value ? 0xff : 0);
  14416. };
  14417. DERNode.prototype._use = function use(entity, obj) {
  14418. if (typeof entity === 'function')
  14419. entity = entity(obj);
  14420. return entity._getEncoder('der').tree;
  14421. };
  14422. DERNode.prototype._skipDefault = function skipDefault(dataBuffer, reporter, parent) {
  14423. var state = this._baseState;
  14424. var i;
  14425. if (state['default'] === null)
  14426. return false;
  14427. var data = dataBuffer.join();
  14428. if (state.defaultBuffer === undefined)
  14429. state.defaultBuffer = this._encodeValue(state['default'], reporter, parent).join();
  14430. if (data.length !== state.defaultBuffer.length)
  14431. return false;
  14432. for (i=0; i < data.length; i++)
  14433. if (data[i] !== state.defaultBuffer[i])
  14434. return false;
  14435. return true;
  14436. };
  14437. // Utility methods
  14438. function encodeTag(tag, primitive, cls, reporter) {
  14439. var res;
  14440. if (tag === 'seqof')
  14441. tag = 'seq';
  14442. else if (tag === 'setof')
  14443. tag = 'set';
  14444. if (der.tagByName.hasOwnProperty(tag))
  14445. res = der.tagByName[tag];
  14446. else if (typeof tag === 'number' && (tag | 0) === tag)
  14447. res = tag;
  14448. else
  14449. return reporter.error('Unknown tag: ' + tag);
  14450. if (res >= 0x1f)
  14451. return reporter.error('Multi-octet tag encoding unsupported');
  14452. if (!primitive)
  14453. res |= 0x20;
  14454. res |= (der.tagClassByName[cls || 'universal'] << 6);
  14455. return res;
  14456. }
  14457. /***/ },
  14458. /* 71 */
  14459. /***/ function(module, exports, __webpack_require__) {
  14460. module.exports = __webpack_require__(132);
  14461. /***/ },
  14462. /* 72 */
  14463. /***/ function(module, exports, __webpack_require__) {
  14464. "use strict";
  14465. /* WEBPACK VAR INJECTION */(function(process) {'use strict';
  14466. var utils = __webpack_require__(4);
  14467. var settle = __webpack_require__(138);
  14468. var buildURL = __webpack_require__(141);
  14469. var parseHeaders = __webpack_require__(147);
  14470. var isURLSameOrigin = __webpack_require__(145);
  14471. var createError = __webpack_require__(75);
  14472. var btoa = (typeof window !== 'undefined' && window.btoa) || __webpack_require__(140);
  14473. module.exports = function xhrAdapter(config) {
  14474. return new Promise(function dispatchXhrRequest(resolve, reject) {
  14475. var requestData = config.data;
  14476. var requestHeaders = config.headers;
  14477. if (utils.isFormData(requestData)) {
  14478. delete requestHeaders['Content-Type']; // Let the browser set it
  14479. }
  14480. var request = new XMLHttpRequest();
  14481. var loadEvent = 'onreadystatechange';
  14482. var xDomain = false;
  14483. // For IE 8/9 CORS support
  14484. // Only supports POST and GET calls and doesn't returns the response headers.
  14485. // DON'T do this for testing b/c XMLHttpRequest is mocked, not XDomainRequest.
  14486. if (process.env.NODE_ENV !== 'test' &&
  14487. typeof window !== 'undefined' &&
  14488. window.XDomainRequest && !('withCredentials' in request) &&
  14489. !isURLSameOrigin(config.url)) {
  14490. request = new window.XDomainRequest();
  14491. loadEvent = 'onload';
  14492. xDomain = true;
  14493. request.onprogress = function handleProgress() {};
  14494. request.ontimeout = function handleTimeout() {};
  14495. }
  14496. // HTTP basic authentication
  14497. if (config.auth) {
  14498. var username = config.auth.username || '';
  14499. var password = config.auth.password || '';
  14500. requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);
  14501. }
  14502. request.open(config.method.toUpperCase(), buildURL(config.url, config.params, config.paramsSerializer), true);
  14503. // Set the request timeout in MS
  14504. request.timeout = config.timeout;
  14505. // Listen for ready state
  14506. request[loadEvent] = function handleLoad() {
  14507. if (!request || (request.readyState !== 4 && !xDomain)) {
  14508. return;
  14509. }
  14510. // The request errored out and we didn't get a response, this will be
  14511. // handled by onerror instead
  14512. // With one exception: request that using file: protocol, most browsers
  14513. // will return status as 0 even though it's a successful request
  14514. if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {
  14515. return;
  14516. }
  14517. // Prepare the response
  14518. var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;
  14519. var responseData = !config.responseType || config.responseType === 'text' ? request.responseText : request.response;
  14520. var response = {
  14521. data: responseData,
  14522. // IE sends 1223 instead of 204 (https://github.com/mzabriskie/axios/issues/201)
  14523. status: request.status === 1223 ? 204 : request.status,
  14524. statusText: request.status === 1223 ? 'No Content' : request.statusText,
  14525. headers: responseHeaders,
  14526. config: config,
  14527. request: request
  14528. };
  14529. settle(resolve, reject, response);
  14530. // Clean up request
  14531. request = null;
  14532. };
  14533. // Handle low level network errors
  14534. request.onerror = function handleError() {
  14535. // Real errors are hidden from us by the browser
  14536. // onerror should only fire if it's a network error
  14537. reject(createError('Network Error', config));
  14538. // Clean up request
  14539. request = null;
  14540. };
  14541. // Handle timeout
  14542. request.ontimeout = function handleTimeout() {
  14543. reject(createError('timeout of ' + config.timeout + 'ms exceeded', config, 'ECONNABORTED'));
  14544. // Clean up request
  14545. request = null;
  14546. };
  14547. // Add xsrf header
  14548. // This is only done if running in a standard browser environment.
  14549. // Specifically not if we're in a web worker, or react-native.
  14550. if (utils.isStandardBrowserEnv()) {
  14551. var cookies = __webpack_require__(143);
  14552. // Add xsrf header
  14553. var xsrfValue = (config.withCredentials || isURLSameOrigin(config.url)) && config.xsrfCookieName ?
  14554. cookies.read(config.xsrfCookieName) :
  14555. undefined;
  14556. if (xsrfValue) {
  14557. requestHeaders[config.xsrfHeaderName] = xsrfValue;
  14558. }
  14559. }
  14560. // Add headers to the request
  14561. if ('setRequestHeader' in request) {
  14562. utils.forEach(requestHeaders, function setRequestHeader(val, key) {
  14563. if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {
  14564. // Remove Content-Type if data is undefined
  14565. delete requestHeaders[key];
  14566. } else {
  14567. // Otherwise add header to the request
  14568. request.setRequestHeader(key, val);
  14569. }
  14570. });
  14571. }
  14572. // Add withCredentials to request if needed
  14573. if (config.withCredentials) {
  14574. request.withCredentials = true;
  14575. }
  14576. // Add responseType to request if needed
  14577. if (config.responseType) {
  14578. try {
  14579. request.responseType = config.responseType;
  14580. } catch (e) {
  14581. if (request.responseType !== 'json') {
  14582. throw e;
  14583. }
  14584. }
  14585. }
  14586. // Handle progress if needed
  14587. if (typeof config.onDownloadProgress === 'function') {
  14588. request.addEventListener('progress', config.onDownloadProgress);
  14589. }
  14590. // Not all browsers support upload events
  14591. if (typeof config.onUploadProgress === 'function' && request.upload) {
  14592. request.upload.addEventListener('progress', config.onUploadProgress);
  14593. }
  14594. if (config.cancelToken) {
  14595. // Handle cancellation
  14596. config.cancelToken.promise.then(function onCanceled(cancel) {
  14597. if (!request) {
  14598. return;
  14599. }
  14600. request.abort();
  14601. reject(cancel);
  14602. // Clean up request
  14603. request = null;
  14604. });
  14605. }
  14606. if (requestData === undefined) {
  14607. requestData = null;
  14608. }
  14609. // Send the request
  14610. request.send(requestData);
  14611. });
  14612. };
  14613. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7)))
  14614. /***/ },
  14615. /* 73 */
  14616. /***/ function(module, exports) {
  14617. "use strict";
  14618. 'use strict';
  14619. /**
  14620. * A `Cancel` is an object that is thrown when an operation is canceled.
  14621. *
  14622. * @class
  14623. * @param {string=} message The message.
  14624. */
  14625. function Cancel(message) {
  14626. this.message = message;
  14627. }
  14628. Cancel.prototype.toString = function toString() {
  14629. return 'Cancel' + (this.message ? ': ' + this.message : '');
  14630. };
  14631. Cancel.prototype.__CANCEL__ = true;
  14632. module.exports = Cancel;
  14633. /***/ },
  14634. /* 74 */
  14635. /***/ function(module, exports) {
  14636. "use strict";
  14637. 'use strict';
  14638. module.exports = function isCancel(value) {
  14639. return !!(value && value.__CANCEL__);
  14640. };
  14641. /***/ },
  14642. /* 75 */
  14643. /***/ function(module, exports, __webpack_require__) {
  14644. "use strict";
  14645. 'use strict';
  14646. var enhanceError = __webpack_require__(137);
  14647. /**
  14648. * Create an Error with the specified message, config, error code, and response.
  14649. *
  14650. * @param {string} message The error message.
  14651. * @param {Object} config The config.
  14652. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  14653. @ @param {Object} [response] The response.
  14654. * @returns {Error} The created error.
  14655. */
  14656. module.exports = function createError(message, config, code, response) {
  14657. var error = new Error(message);
  14658. return enhanceError(error, config, code, response);
  14659. };
  14660. /***/ },
  14661. /* 76 */
  14662. /***/ function(module, exports, __webpack_require__) {
  14663. "use strict";
  14664. /* WEBPACK VAR INJECTION */(function(process) {'use strict';
  14665. var utils = __webpack_require__(4);
  14666. var normalizeHeaderName = __webpack_require__(146);
  14667. var PROTECTION_PREFIX = /^\)\]\}',?\n/;
  14668. var DEFAULT_CONTENT_TYPE = {
  14669. 'Content-Type': 'application/x-www-form-urlencoded'
  14670. };
  14671. function setContentTypeIfUnset(headers, value) {
  14672. if (!utils.isUndefined(headers) && utils.isUndefined(headers['Content-Type'])) {
  14673. headers['Content-Type'] = value;
  14674. }
  14675. }
  14676. function getDefaultAdapter() {
  14677. var adapter;
  14678. if (typeof XMLHttpRequest !== 'undefined') {
  14679. // For browsers use XHR adapter
  14680. adapter = __webpack_require__(72);
  14681. } else if (typeof process !== 'undefined') {
  14682. // For node use HTTP adapter
  14683. adapter = __webpack_require__(72);
  14684. }
  14685. return adapter;
  14686. }
  14687. module.exports = {
  14688. adapter: getDefaultAdapter(),
  14689. transformRequest: [function transformRequest(data, headers) {
  14690. normalizeHeaderName(headers, 'Content-Type');
  14691. if (utils.isFormData(data) ||
  14692. utils.isArrayBuffer(data) ||
  14693. utils.isStream(data) ||
  14694. utils.isFile(data) ||
  14695. utils.isBlob(data)
  14696. ) {
  14697. return data;
  14698. }
  14699. if (utils.isArrayBufferView(data)) {
  14700. return data.buffer;
  14701. }
  14702. if (utils.isURLSearchParams(data)) {
  14703. setContentTypeIfUnset(headers, 'application/x-www-form-urlencoded;charset=utf-8');
  14704. return data.toString();
  14705. }
  14706. if (utils.isObject(data)) {
  14707. setContentTypeIfUnset(headers, 'application/json;charset=utf-8');
  14708. return JSON.stringify(data);
  14709. }
  14710. return data;
  14711. }],
  14712. transformResponse: [function transformResponse(data) {
  14713. /*eslint no-param-reassign:0*/
  14714. if (typeof data === 'string') {
  14715. data = data.replace(PROTECTION_PREFIX, '');
  14716. try {
  14717. data = JSON.parse(data);
  14718. } catch (e) { /* Ignore */ }
  14719. }
  14720. return data;
  14721. }],
  14722. headers: {
  14723. common: {
  14724. 'Accept': 'application/json, text/plain, */*'
  14725. },
  14726. patch: utils.merge(DEFAULT_CONTENT_TYPE),
  14727. post: utils.merge(DEFAULT_CONTENT_TYPE),
  14728. put: utils.merge(DEFAULT_CONTENT_TYPE)
  14729. },
  14730. timeout: 0,
  14731. xsrfCookieName: 'XSRF-TOKEN',
  14732. xsrfHeaderName: 'X-XSRF-TOKEN',
  14733. maxContentLength: -1,
  14734. validateStatus: function validateStatus(status) {
  14735. return status >= 200 && status < 300;
  14736. }
  14737. };
  14738. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7)))
  14739. /***/ },
  14740. /* 77 */
  14741. /***/ function(module, exports) {
  14742. "use strict";
  14743. 'use strict';
  14744. module.exports = function bind(fn, thisArg) {
  14745. return function wrap() {
  14746. var args = new Array(arguments.length);
  14747. for (var i = 0; i < args.length; i++) {
  14748. args[i] = arguments[i];
  14749. }
  14750. return fn.apply(thisArg, args);
  14751. };
  14752. };
  14753. /***/ },
  14754. /* 78 */
  14755. /***/ function(module, exports, __webpack_require__) {
  14756. "use strict";
  14757. "use strict";
  14758. Object.defineProperty(exports, "__esModule", {
  14759. value: true
  14760. });
  14761. var _classCallCheck2 = __webpack_require__(23);
  14762. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  14763. var _createClass2 = __webpack_require__(24);
  14764. var _createClass3 = _interopRequireDefault(_createClass2);
  14765. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14766. var Password = function () {
  14767. function Password(password) {
  14768. (0, _classCallCheck3.default)(this, Password);
  14769. this.password = password;
  14770. this.options = {
  14771. uppercase: password.uppercase,
  14772. lowercase: password.lowercase,
  14773. numbers: password.numbers,
  14774. symbols: password.symbols,
  14775. length: password.length,
  14776. counter: password.counter
  14777. };
  14778. }
  14779. (0, _createClass3.default)(Password, [{
  14780. key: "isNewPassword",
  14781. value: function isNewPassword(passwords) {
  14782. var _this = this;
  14783. var isNew = true;
  14784. passwords.forEach(function (pwd) {
  14785. if (pwd.site === _this.password.site && pwd.login === _this.password.login) {
  14786. isNew = false;
  14787. }
  14788. });
  14789. return isNew;
  14790. }
  14791. }, {
  14792. key: "json",
  14793. value: function json() {
  14794. return this.password;
  14795. }
  14796. }]);
  14797. return Password;
  14798. }();
  14799. exports.default = Password;
  14800. /***/ },
  14801. /* 79 */
  14802. /***/ function(module, exports, __webpack_require__) {
  14803. module.exports = { "default": __webpack_require__(178), __esModule: true };
  14804. /***/ },
  14805. /* 80 */
  14806. /***/ function(module, exports, __webpack_require__) {
  14807. module.exports = { "default": __webpack_require__(179), __esModule: true };
  14808. /***/ },
  14809. /* 81 */
  14810. /***/ function(module, exports, __webpack_require__) {
  14811. var r;
  14812. module.exports = function rand(len) {
  14813. if (!r)
  14814. r = new Rand(null);
  14815. return r.generate(len);
  14816. };
  14817. function Rand(rand) {
  14818. this.rand = rand;
  14819. }
  14820. module.exports.Rand = Rand;
  14821. Rand.prototype.generate = function generate(len) {
  14822. return this._rand(len);
  14823. };
  14824. if (typeof window === 'object') {
  14825. if (window.crypto && window.crypto.getRandomValues) {
  14826. // Modern browsers
  14827. Rand.prototype._rand = function _rand(n) {
  14828. var arr = new Uint8Array(n);
  14829. window.crypto.getRandomValues(arr);
  14830. return arr;
  14831. };
  14832. } else if (window.msCrypto && window.msCrypto.getRandomValues) {
  14833. // IE
  14834. Rand.prototype._rand = function _rand(n) {
  14835. var arr = new Uint8Array(n);
  14836. window.msCrypto.getRandomValues(arr);
  14837. return arr;
  14838. };
  14839. } else {
  14840. // Old junk
  14841. Rand.prototype._rand = function() {
  14842. throw new Error('Not implemented yet');
  14843. };
  14844. }
  14845. } else {
  14846. // Node.js or Web worker
  14847. try {
  14848. var crypto = __webpack_require__(311);
  14849. Rand.prototype._rand = function _rand(n) {
  14850. return crypto.randomBytes(n);
  14851. };
  14852. } catch (e) {
  14853. // Emulate crypto API using randy
  14854. Rand.prototype._rand = function _rand(n) {
  14855. var res = new Uint8Array(n);
  14856. for (var i = 0; i < res.length; i++)
  14857. res[i] = this.rand.getByte();
  14858. return res;
  14859. };
  14860. }
  14861. }
  14862. /***/ },
  14863. /* 82 */
  14864. /***/ function(module, exports, __webpack_require__) {
  14865. /* WEBPACK VAR INJECTION */(function(Buffer) {var aes = __webpack_require__(35)
  14866. var Transform = __webpack_require__(12)
  14867. var inherits = __webpack_require__(1)
  14868. var GHASH = __webpack_require__(167)
  14869. var xor = __webpack_require__(26)
  14870. inherits(StreamCipher, Transform)
  14871. module.exports = StreamCipher
  14872. function StreamCipher (mode, key, iv, decrypt) {
  14873. if (!(this instanceof StreamCipher)) {
  14874. return new StreamCipher(mode, key, iv)
  14875. }
  14876. Transform.call(this)
  14877. this._finID = Buffer.concat([iv, new Buffer([0, 0, 0, 1])])
  14878. iv = Buffer.concat([iv, new Buffer([0, 0, 0, 2])])
  14879. this._cipher = new aes.AES(key)
  14880. this._prev = new Buffer(iv.length)
  14881. this._cache = new Buffer('')
  14882. this._secCache = new Buffer('')
  14883. this._decrypt = decrypt
  14884. this._alen = 0
  14885. this._len = 0
  14886. iv.copy(this._prev)
  14887. this._mode = mode
  14888. var h = new Buffer(4)
  14889. h.fill(0)
  14890. this._ghash = new GHASH(this._cipher.encryptBlock(h))
  14891. this._authTag = null
  14892. this._called = false
  14893. }
  14894. StreamCipher.prototype._update = function (chunk) {
  14895. if (!this._called && this._alen) {
  14896. var rump = 16 - (this._alen % 16)
  14897. if (rump < 16) {
  14898. rump = new Buffer(rump)
  14899. rump.fill(0)
  14900. this._ghash.update(rump)
  14901. }
  14902. }
  14903. this._called = true
  14904. var out = this._mode.encrypt(this, chunk)
  14905. if (this._decrypt) {
  14906. this._ghash.update(chunk)
  14907. } else {
  14908. this._ghash.update(out)
  14909. }
  14910. this._len += chunk.length
  14911. return out
  14912. }
  14913. StreamCipher.prototype._final = function () {
  14914. if (this._decrypt && !this._authTag) {
  14915. throw new Error('Unsupported state or unable to authenticate data')
  14916. }
  14917. var tag = xor(this._ghash.final(this._alen * 8, this._len * 8), this._cipher.encryptBlock(this._finID))
  14918. if (this._decrypt) {
  14919. if (xorTest(tag, this._authTag)) {
  14920. throw new Error('Unsupported state or unable to authenticate data')
  14921. }
  14922. } else {
  14923. this._authTag = tag
  14924. }
  14925. this._cipher.scrub()
  14926. }
  14927. StreamCipher.prototype.getAuthTag = function getAuthTag () {
  14928. if (!this._decrypt && Buffer.isBuffer(this._authTag)) {
  14929. return this._authTag
  14930. } else {
  14931. throw new Error('Attempting to get auth tag in unsupported state')
  14932. }
  14933. }
  14934. StreamCipher.prototype.setAuthTag = function setAuthTag (tag) {
  14935. if (this._decrypt) {
  14936. this._authTag = tag
  14937. } else {
  14938. throw new Error('Attempting to set auth tag in unsupported state')
  14939. }
  14940. }
  14941. StreamCipher.prototype.setAAD = function setAAD (buf) {
  14942. if (!this._called) {
  14943. this._ghash.update(buf)
  14944. this._alen += buf.length
  14945. } else {
  14946. throw new Error('Attempting to set AAD in unsupported state')
  14947. }
  14948. }
  14949. function xorTest (a, b) {
  14950. var out = 0
  14951. if (a.length !== b.length) {
  14952. out++
  14953. }
  14954. var len = Math.min(a.length, b.length)
  14955. var i = -1
  14956. while (++i < len) {
  14957. out += (a[i] ^ b[i])
  14958. }
  14959. return out
  14960. }
  14961. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  14962. /***/ },
  14963. /* 83 */
  14964. /***/ function(module, exports, __webpack_require__) {
  14965. var xor = __webpack_require__(26)
  14966. exports.encrypt = function (self, block) {
  14967. var data = xor(block, self._prev)
  14968. self._prev = self._cipher.encryptBlock(data)
  14969. return self._prev
  14970. }
  14971. exports.decrypt = function (self, block) {
  14972. var pad = self._prev
  14973. self._prev = block
  14974. var out = self._cipher.decryptBlock(block)
  14975. return xor(out, pad)
  14976. }
  14977. /***/ },
  14978. /* 84 */
  14979. /***/ function(module, exports, __webpack_require__) {
  14980. /* WEBPACK VAR INJECTION */(function(Buffer) {var xor = __webpack_require__(26)
  14981. exports.encrypt = function (self, data, decrypt) {
  14982. var out = new Buffer('')
  14983. var len
  14984. while (data.length) {
  14985. if (self._cache.length === 0) {
  14986. self._cache = self._cipher.encryptBlock(self._prev)
  14987. self._prev = new Buffer('')
  14988. }
  14989. if (self._cache.length <= data.length) {
  14990. len = self._cache.length
  14991. out = Buffer.concat([out, encryptStart(self, data.slice(0, len), decrypt)])
  14992. data = data.slice(len)
  14993. } else {
  14994. out = Buffer.concat([out, encryptStart(self, data, decrypt)])
  14995. break
  14996. }
  14997. }
  14998. return out
  14999. }
  15000. function encryptStart (self, data, decrypt) {
  15001. var len = data.length
  15002. var out = xor(data, self._cache)
  15003. self._cache = self._cache.slice(len)
  15004. self._prev = Buffer.concat([self._prev, decrypt ? data : out])
  15005. return out
  15006. }
  15007. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  15008. /***/ },
  15009. /* 85 */
  15010. /***/ function(module, exports, __webpack_require__) {
  15011. /* WEBPACK VAR INJECTION */(function(Buffer) {function encryptByte (self, byteParam, decrypt) {
  15012. var pad
  15013. var i = -1
  15014. var len = 8
  15015. var out = 0
  15016. var bit, value
  15017. while (++i < len) {
  15018. pad = self._cipher.encryptBlock(self._prev)
  15019. bit = (byteParam & (1 << (7 - i))) ? 0x80 : 0
  15020. value = pad[0] ^ bit
  15021. out += ((value & 0x80) >> (i % 8))
  15022. self._prev = shiftIn(self._prev, decrypt ? bit : value)
  15023. }
  15024. return out
  15025. }
  15026. exports.encrypt = function (self, chunk, decrypt) {
  15027. var len = chunk.length
  15028. var out = new Buffer(len)
  15029. var i = -1
  15030. while (++i < len) {
  15031. out[i] = encryptByte(self, chunk[i], decrypt)
  15032. }
  15033. return out
  15034. }
  15035. function shiftIn (buffer, value) {
  15036. var len = buffer.length
  15037. var i = -1
  15038. var out = new Buffer(buffer.length)
  15039. buffer = Buffer.concat([buffer, new Buffer([value])])
  15040. while (++i < len) {
  15041. out[i] = buffer[i] << 1 | buffer[i + 1] >> (7)
  15042. }
  15043. return out
  15044. }
  15045. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  15046. /***/ },
  15047. /* 86 */
  15048. /***/ function(module, exports, __webpack_require__) {
  15049. /* WEBPACK VAR INJECTION */(function(Buffer) {function encryptByte (self, byteParam, decrypt) {
  15050. var pad = self._cipher.encryptBlock(self._prev)
  15051. var out = pad[0] ^ byteParam
  15052. self._prev = Buffer.concat([self._prev.slice(1), new Buffer([decrypt ? byteParam : out])])
  15053. return out
  15054. }
  15055. exports.encrypt = function (self, chunk, decrypt) {
  15056. var len = chunk.length
  15057. var out = new Buffer(len)
  15058. var i = -1
  15059. while (++i < len) {
  15060. out[i] = encryptByte(self, chunk[i], decrypt)
  15061. }
  15062. return out
  15063. }
  15064. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  15065. /***/ },
  15066. /* 87 */
  15067. /***/ function(module, exports) {
  15068. exports.encrypt = function (self, block) {
  15069. return self._cipher.encryptBlock(block)
  15070. }
  15071. exports.decrypt = function (self, block) {
  15072. return self._cipher.decryptBlock(block)
  15073. }
  15074. /***/ },
  15075. /* 88 */
  15076. /***/ function(module, exports, __webpack_require__) {
  15077. /* WEBPACK VAR INJECTION */(function(Buffer) {var xor = __webpack_require__(26)
  15078. function getBlock (self) {
  15079. self._prev = self._cipher.encryptBlock(self._prev)
  15080. return self._prev
  15081. }
  15082. exports.encrypt = function (self, chunk) {
  15083. while (self._cache.length < chunk.length) {
  15084. self._cache = Buffer.concat([self._cache, getBlock(self)])
  15085. }
  15086. var pad = self._cache.slice(0, chunk.length)
  15087. self._cache = self._cache.slice(chunk.length)
  15088. return xor(chunk, pad)
  15089. }
  15090. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  15091. /***/ },
  15092. /* 89 */
  15093. /***/ function(module, exports, __webpack_require__) {
  15094. /* WEBPACK VAR INJECTION */(function(Buffer) {var aes = __webpack_require__(35)
  15095. var Transform = __webpack_require__(12)
  15096. var inherits = __webpack_require__(1)
  15097. inherits(StreamCipher, Transform)
  15098. module.exports = StreamCipher
  15099. function StreamCipher (mode, key, iv, decrypt) {
  15100. if (!(this instanceof StreamCipher)) {
  15101. return new StreamCipher(mode, key, iv)
  15102. }
  15103. Transform.call(this)
  15104. this._cipher = new aes.AES(key)
  15105. this._prev = new Buffer(iv.length)
  15106. this._cache = new Buffer('')
  15107. this._secCache = new Buffer('')
  15108. this._decrypt = decrypt
  15109. iv.copy(this._prev)
  15110. this._mode = mode
  15111. }
  15112. StreamCipher.prototype._update = function (chunk) {
  15113. return this._mode.encrypt(this, chunk, this._decrypt)
  15114. }
  15115. StreamCipher.prototype._final = function () {
  15116. this._cipher.scrub()
  15117. }
  15118. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  15119. /***/ },
  15120. /* 90 */
  15121. /***/ function(module, exports) {
  15122. "use strict";
  15123. 'use strict'
  15124. exports['1.3.132.0.10'] = 'secp256k1'
  15125. exports['1.3.132.0.33'] = 'p224'
  15126. exports['1.2.840.10045.3.1.1'] = 'p192'
  15127. exports['1.2.840.10045.3.1.7'] = 'p256'
  15128. exports['1.3.132.0.34'] = 'p384'
  15129. exports['1.3.132.0.35'] = 'p521'
  15130. /***/ },
  15131. /* 91 */
  15132. /***/ function(module, exports, __webpack_require__) {
  15133. // getting tag from 19.1.3.6 Object.prototype.toString()
  15134. var cof = __webpack_require__(38)
  15135. , TAG = __webpack_require__(5)('toStringTag')
  15136. // ES3 wrong here
  15137. , ARG = cof(function(){ return arguments; }()) == 'Arguments';
  15138. // fallback for IE11 Script Access Denied error
  15139. var tryGet = function(it, key){
  15140. try {
  15141. return it[key];
  15142. } catch(e){ /* empty */ }
  15143. };
  15144. module.exports = function(it){
  15145. var O, T, B;
  15146. return it === undefined ? 'Undefined' : it === null ? 'Null'
  15147. // @@toStringTag case
  15148. : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
  15149. // builtinTag case
  15150. : ARG ? cof(O)
  15151. // ES3 arguments fallback
  15152. : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
  15153. };
  15154. /***/ },
  15155. /* 92 */
  15156. /***/ function(module, exports) {
  15157. // IE 8- don't enum bug keys
  15158. module.exports = (
  15159. 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
  15160. ).split(',');
  15161. /***/ },
  15162. /* 93 */
  15163. /***/ function(module, exports, __webpack_require__) {
  15164. module.exports = __webpack_require__(6).document && document.documentElement;
  15165. /***/ },
  15166. /* 94 */
  15167. /***/ function(module, exports, __webpack_require__) {
  15168. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  15169. var cof = __webpack_require__(38);
  15170. module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){
  15171. return cof(it) == 'String' ? it.split('') : Object(it);
  15172. };
  15173. /***/ },
  15174. /* 95 */
  15175. /***/ function(module, exports, __webpack_require__) {
  15176. "use strict";
  15177. 'use strict';
  15178. var LIBRARY = __webpack_require__(96)
  15179. , $export = __webpack_require__(40)
  15180. , redefine = __webpack_require__(200)
  15181. , hide = __webpack_require__(15)
  15182. , has = __webpack_require__(41)
  15183. , Iterators = __webpack_require__(27)
  15184. , $iterCreate = __webpack_require__(188)
  15185. , setToStringTag = __webpack_require__(56)
  15186. , getPrototypeOf = __webpack_require__(196)
  15187. , ITERATOR = __webpack_require__(5)('iterator')
  15188. , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next`
  15189. , FF_ITERATOR = '@@iterator'
  15190. , KEYS = 'keys'
  15191. , VALUES = 'values';
  15192. var returnThis = function(){ return this; };
  15193. module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){
  15194. $iterCreate(Constructor, NAME, next);
  15195. var getMethod = function(kind){
  15196. if(!BUGGY && kind in proto)return proto[kind];
  15197. switch(kind){
  15198. case KEYS: return function keys(){ return new Constructor(this, kind); };
  15199. case VALUES: return function values(){ return new Constructor(this, kind); };
  15200. } return function entries(){ return new Constructor(this, kind); };
  15201. };
  15202. var TAG = NAME + ' Iterator'
  15203. , DEF_VALUES = DEFAULT == VALUES
  15204. , VALUES_BUG = false
  15205. , proto = Base.prototype
  15206. , $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]
  15207. , $default = $native || getMethod(DEFAULT)
  15208. , $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined
  15209. , $anyNative = NAME == 'Array' ? proto.entries || $native : $native
  15210. , methods, key, IteratorPrototype;
  15211. // Fix native
  15212. if($anyNative){
  15213. IteratorPrototype = getPrototypeOf($anyNative.call(new Base));
  15214. if(IteratorPrototype !== Object.prototype){
  15215. // Set @@toStringTag to native iterators
  15216. setToStringTag(IteratorPrototype, TAG, true);
  15217. // fix for some old engines
  15218. if(!LIBRARY && !has(IteratorPrototype, ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis);
  15219. }
  15220. }
  15221. // fix Array#{values, @@iterator}.name in V8 / FF
  15222. if(DEF_VALUES && $native && $native.name !== VALUES){
  15223. VALUES_BUG = true;
  15224. $default = function values(){ return $native.call(this); };
  15225. }
  15226. // Define iterator
  15227. if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){
  15228. hide(proto, ITERATOR, $default);
  15229. }
  15230. // Plug for library
  15231. Iterators[NAME] = $default;
  15232. Iterators[TAG] = returnThis;
  15233. if(DEFAULT){
  15234. methods = {
  15235. values: DEF_VALUES ? $default : getMethod(VALUES),
  15236. keys: IS_SET ? $default : getMethod(KEYS),
  15237. entries: $entries
  15238. };
  15239. if(FORCED)for(key in methods){
  15240. if(!(key in proto))redefine(proto, key, methods[key]);
  15241. } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
  15242. }
  15243. return methods;
  15244. };
  15245. /***/ },
  15246. /* 96 */
  15247. /***/ function(module, exports) {
  15248. module.exports = true;
  15249. /***/ },
  15250. /* 97 */
  15251. /***/ function(module, exports, __webpack_require__) {
  15252. // 19.1.2.14 / 15.2.3.14 Object.keys(O)
  15253. var $keys = __webpack_require__(197)
  15254. , enumBugKeys = __webpack_require__(92);
  15255. module.exports = Object.keys || function keys(O){
  15256. return $keys(O, enumBugKeys);
  15257. };
  15258. /***/ },
  15259. /* 98 */
  15260. /***/ function(module, exports) {
  15261. module.exports = function(bitmap, value){
  15262. return {
  15263. enumerable : !(bitmap & 1),
  15264. configurable: !(bitmap & 2),
  15265. writable : !(bitmap & 4),
  15266. value : value
  15267. };
  15268. };
  15269. /***/ },
  15270. /* 99 */
  15271. /***/ function(module, exports, __webpack_require__) {
  15272. var global = __webpack_require__(6)
  15273. , SHARED = '__core-js_shared__'
  15274. , store = global[SHARED] || (global[SHARED] = {});
  15275. module.exports = function(key){
  15276. return store[key] || (store[key] = {});
  15277. };
  15278. /***/ },
  15279. /* 100 */
  15280. /***/ function(module, exports, __webpack_require__) {
  15281. var ctx = __webpack_require__(39)
  15282. , invoke = __webpack_require__(185)
  15283. , html = __webpack_require__(93)
  15284. , cel = __webpack_require__(54)
  15285. , global = __webpack_require__(6)
  15286. , process = global.process
  15287. , setTask = global.setImmediate
  15288. , clearTask = global.clearImmediate
  15289. , MessageChannel = global.MessageChannel
  15290. , counter = 0
  15291. , queue = {}
  15292. , ONREADYSTATECHANGE = 'onreadystatechange'
  15293. , defer, channel, port;
  15294. var run = function(){
  15295. var id = +this;
  15296. if(queue.hasOwnProperty(id)){
  15297. var fn = queue[id];
  15298. delete queue[id];
  15299. fn();
  15300. }
  15301. };
  15302. var listener = function(event){
  15303. run.call(event.data);
  15304. };
  15305. // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
  15306. if(!setTask || !clearTask){
  15307. setTask = function setImmediate(fn){
  15308. var args = [], i = 1;
  15309. while(arguments.length > i)args.push(arguments[i++]);
  15310. queue[++counter] = function(){
  15311. invoke(typeof fn == 'function' ? fn : Function(fn), args);
  15312. };
  15313. defer(counter);
  15314. return counter;
  15315. };
  15316. clearTask = function clearImmediate(id){
  15317. delete queue[id];
  15318. };
  15319. // Node.js 0.8-
  15320. if(__webpack_require__(38)(process) == 'process'){
  15321. defer = function(id){
  15322. process.nextTick(ctx(run, id, 1));
  15323. };
  15324. // Browsers with MessageChannel, includes WebWorkers
  15325. } else if(MessageChannel){
  15326. channel = new MessageChannel;
  15327. port = channel.port2;
  15328. channel.port1.onmessage = listener;
  15329. defer = ctx(port.postMessage, port, 1);
  15330. // Browsers with postMessage, skip WebWorkers
  15331. // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
  15332. } else if(global.addEventListener && typeof postMessage == 'function' && !global.importScripts){
  15333. defer = function(id){
  15334. global.postMessage(id + '', '*');
  15335. };
  15336. global.addEventListener('message', listener, false);
  15337. // IE8-
  15338. } else if(ONREADYSTATECHANGE in cel('script')){
  15339. defer = function(id){
  15340. html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function(){
  15341. html.removeChild(this);
  15342. run.call(id);
  15343. };
  15344. };
  15345. // Rest old browsers
  15346. } else {
  15347. defer = function(id){
  15348. setTimeout(ctx(run, id, 1), 0);
  15349. };
  15350. }
  15351. }
  15352. module.exports = {
  15353. set: setTask,
  15354. clear: clearTask
  15355. };
  15356. /***/ },
  15357. /* 101 */
  15358. /***/ function(module, exports, __webpack_require__) {
  15359. // 7.1.15 ToLength
  15360. var toInteger = __webpack_require__(58)
  15361. , min = Math.min;
  15362. module.exports = function(it){
  15363. return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
  15364. };
  15365. /***/ },
  15366. /* 102 */
  15367. /***/ function(module, exports, __webpack_require__) {
  15368. // 7.1.13 ToObject(argument)
  15369. var defined = __webpack_require__(53);
  15370. module.exports = function(it){
  15371. return Object(defined(it));
  15372. };
  15373. /***/ },
  15374. /* 103 */
  15375. /***/ function(module, exports) {
  15376. var id = 0
  15377. , px = Math.random();
  15378. module.exports = function(key){
  15379. return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
  15380. };
  15381. /***/ },
  15382. /* 104 */
  15383. /***/ function(module, exports, __webpack_require__) {
  15384. "use strict";
  15385. 'use strict';
  15386. /*
  15387. * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
  15388. * Digest Algorithm, as defined in RFC 1321.
  15389. * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002.
  15390. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
  15391. * Distributed under the BSD License
  15392. * See http://pajhome.org.uk/crypt/md5 for more info.
  15393. */
  15394. var helpers = __webpack_require__(215);
  15395. /*
  15396. * Calculate the MD5 of an array of little-endian words, and a bit length
  15397. */
  15398. function core_md5(x, len)
  15399. {
  15400. /* append padding */
  15401. x[len >> 5] |= 0x80 << ((len) % 32);
  15402. x[(((len + 64) >>> 9) << 4) + 14] = len;
  15403. var a = 1732584193;
  15404. var b = -271733879;
  15405. var c = -1732584194;
  15406. var d = 271733878;
  15407. for(var i = 0; i < x.length; i += 16)
  15408. {
  15409. var olda = a;
  15410. var oldb = b;
  15411. var oldc = c;
  15412. var oldd = d;
  15413. a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
  15414. d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
  15415. c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819);
  15416. b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
  15417. a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
  15418. d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426);
  15419. c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
  15420. b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
  15421. a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416);
  15422. d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
  15423. c = md5_ff(c, d, a, b, x[i+10], 17, -42063);
  15424. b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
  15425. a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682);
  15426. d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
  15427. c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
  15428. b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329);
  15429. a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
  15430. d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
  15431. c = md5_gg(c, d, a, b, x[i+11], 14, 643717713);
  15432. b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
  15433. a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
  15434. d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083);
  15435. c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);
  15436. b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
  15437. a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438);
  15438. d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
  15439. c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
  15440. b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501);
  15441. a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
  15442. d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
  15443. c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473);
  15444. b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);
  15445. a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
  15446. d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
  15447. c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562);
  15448. b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);
  15449. a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
  15450. d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353);
  15451. c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
  15452. b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
  15453. a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174);
  15454. d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
  15455. c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
  15456. b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189);
  15457. a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
  15458. d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);
  15459. c = md5_hh(c, d, a, b, x[i+15], 16, 530742520);
  15460. b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);
  15461. a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
  15462. d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415);
  15463. c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
  15464. b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
  15465. a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571);
  15466. d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
  15467. c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);
  15468. b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
  15469. a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359);
  15470. d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);
  15471. c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
  15472. b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649);
  15473. a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
  15474. d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
  15475. c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259);
  15476. b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);
  15477. a = safe_add(a, olda);
  15478. b = safe_add(b, oldb);
  15479. c = safe_add(c, oldc);
  15480. d = safe_add(d, oldd);
  15481. }
  15482. return Array(a, b, c, d);
  15483. }
  15484. /*
  15485. * These functions implement the four basic operations the algorithm uses.
  15486. */
  15487. function md5_cmn(q, a, b, x, s, t)
  15488. {
  15489. return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);
  15490. }
  15491. function md5_ff(a, b, c, d, x, s, t)
  15492. {
  15493. return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
  15494. }
  15495. function md5_gg(a, b, c, d, x, s, t)
  15496. {
  15497. return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
  15498. }
  15499. function md5_hh(a, b, c, d, x, s, t)
  15500. {
  15501. return md5_cmn(b ^ c ^ d, a, b, x, s, t);
  15502. }
  15503. function md5_ii(a, b, c, d, x, s, t)
  15504. {
  15505. return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
  15506. }
  15507. /*
  15508. * Add integers, wrapping at 2^32. This uses 16-bit operations internally
  15509. * to work around bugs in some JS interpreters.
  15510. */
  15511. function safe_add(x, y)
  15512. {
  15513. var lsw = (x & 0xFFFF) + (y & 0xFFFF);
  15514. var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
  15515. return (msw << 16) | (lsw & 0xFFFF);
  15516. }
  15517. /*
  15518. * Bitwise rotate a 32-bit number to the left.
  15519. */
  15520. function bit_rol(num, cnt)
  15521. {
  15522. return (num << cnt) | (num >>> (32 - cnt));
  15523. }
  15524. module.exports = function md5(buf) {
  15525. return helpers.hash(buf, core_md5, 16);
  15526. };
  15527. /***/ },
  15528. /* 105 */
  15529. /***/ function(module, exports, __webpack_require__) {
  15530. var randomBytes = __webpack_require__(31);
  15531. module.exports = findPrime;
  15532. findPrime.simpleSieve = simpleSieve;
  15533. findPrime.fermatTest = fermatTest;
  15534. var BN = __webpack_require__(2);
  15535. var TWENTYFOUR = new BN(24);
  15536. var MillerRabin = __webpack_require__(109);
  15537. var millerRabin = new MillerRabin();
  15538. var ONE = new BN(1);
  15539. var TWO = new BN(2);
  15540. var FIVE = new BN(5);
  15541. var SIXTEEN = new BN(16);
  15542. var EIGHT = new BN(8);
  15543. var TEN = new BN(10);
  15544. var THREE = new BN(3);
  15545. var SEVEN = new BN(7);
  15546. var ELEVEN = new BN(11);
  15547. var FOUR = new BN(4);
  15548. var TWELVE = new BN(12);
  15549. var primes = null;
  15550. function _getPrimes() {
  15551. if (primes !== null)
  15552. return primes;
  15553. var limit = 0x100000;
  15554. var res = [];
  15555. res[0] = 2;
  15556. for (var i = 1, k = 3; k < limit; k += 2) {
  15557. var sqrt = Math.ceil(Math.sqrt(k));
  15558. for (var j = 0; j < i && res[j] <= sqrt; j++)
  15559. if (k % res[j] === 0)
  15560. break;
  15561. if (i !== j && res[j] <= sqrt)
  15562. continue;
  15563. res[i++] = k;
  15564. }
  15565. primes = res;
  15566. return res;
  15567. }
  15568. function simpleSieve(p) {
  15569. var primes = _getPrimes();
  15570. for (var i = 0; i < primes.length; i++)
  15571. if (p.modn(primes[i]) === 0) {
  15572. if (p.cmpn(primes[i]) === 0) {
  15573. return true;
  15574. } else {
  15575. return false;
  15576. }
  15577. }
  15578. return true;
  15579. }
  15580. function fermatTest(p) {
  15581. var red = BN.mont(p);
  15582. return TWO.toRed(red).redPow(p.subn(1)).fromRed().cmpn(1) === 0;
  15583. }
  15584. function findPrime(bits, gen) {
  15585. if (bits < 16) {
  15586. // this is what openssl does
  15587. if (gen === 2 || gen === 5) {
  15588. return new BN([0x8c, 0x7b]);
  15589. } else {
  15590. return new BN([0x8c, 0x27]);
  15591. }
  15592. }
  15593. gen = new BN(gen);
  15594. var num, n2;
  15595. while (true) {
  15596. num = new BN(randomBytes(Math.ceil(bits / 8)));
  15597. while (num.bitLength() > bits) {
  15598. num.ishrn(1);
  15599. }
  15600. if (num.isEven()) {
  15601. num.iadd(ONE);
  15602. }
  15603. if (!num.testn(1)) {
  15604. num.iadd(TWO);
  15605. }
  15606. if (!gen.cmp(TWO)) {
  15607. while (num.mod(TWENTYFOUR).cmp(ELEVEN)) {
  15608. num.iadd(FOUR);
  15609. }
  15610. } else if (!gen.cmp(FIVE)) {
  15611. while (num.mod(TEN).cmp(THREE)) {
  15612. num.iadd(FOUR);
  15613. }
  15614. }
  15615. n2 = num.shrn(1);
  15616. if (simpleSieve(n2) && simpleSieve(num) &&
  15617. fermatTest(n2) && fermatTest(num) &&
  15618. millerRabin.test(n2) && millerRabin.test(num)) {
  15619. return num;
  15620. }
  15621. }
  15622. }
  15623. /***/ },
  15624. /* 106 */
  15625. /***/ function(module, exports) {
  15626. var toString = {}.toString;
  15627. module.exports = Array.isArray || function (arr) {
  15628. return toString.call(arr) == '[object Array]';
  15629. };
  15630. /***/ },
  15631. /* 107 */
  15632. /***/ function(module, exports) {
  15633. module.exports = {
  15634. "sha1": "da39a3ee 5e6b4b0d 3255bfef 95601890 afd80709",
  15635. "sha224": "d14a028c 2a3a2bc9 476102bb 288234c4 15a2b01f 828ea62a c5b3e42f",
  15636. "sha256": "e3b0c442 98fc1c14 9afbf4c8 996fb924 27ae41e4 649b934c a495991b 7852b855",
  15637. "sha384": "38b060a7 51ac9638 4cd9327e b1b1e36a 21fdb711 14be0743 4c0cc7bf 63f6e1da 274edebf e76f65fb d51ad2f1 4898b95b",
  15638. "sha512": "cf83e135 7eefb8bd f1542850 d66d8007 d620e405 0b5715dc 83f4a921 d36ce9ce 47d0d13c 5d85f2b0 ff8318d2 877eec2f 63b931bd 47417a81 a538327a f927da3e",
  15639. "sha512/224": "6ed0dd02 806fa89e 25de060c 19d3ac86 cabb87d6 a0ddd05c 333b84f4",
  15640. "sha512/256": "c672b8d1 ef56ed28 ab87c362 2c511406 9bdd3ad7 b8f97374 98d0c01e cef0967a"
  15641. };
  15642. /***/ },
  15643. /* 108 */
  15644. /***/ function(module, exports, __webpack_require__) {
  15645. "use strict";
  15646. 'use strict';
  15647. var _crypto = __webpack_require__(216);
  15648. var _crypto2 = _interopRequireDefault(_crypto);
  15649. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15650. module.exports = {
  15651. encryptLogin: _encryptLogin,
  15652. renderPassword: _renderPassword,
  15653. createFingerprint: createFingerprint,
  15654. _deriveEncryptedLogin: _deriveEncryptedLogin,
  15655. _getPasswordTemplate: _getPasswordTemplate,
  15656. _prettyPrint: _prettyPrint,
  15657. _string2charCodes: _string2charCodes,
  15658. _getCharType: _getCharType,
  15659. _getPasswordChar: _getPasswordChar,
  15660. _createHmac: _createHmac
  15661. };
  15662. function _encryptLogin(login, masterPassword) {
  15663. return new Promise(function (resolve, reject) {
  15664. if (!login || !masterPassword) {
  15665. reject('login and master password parameters could not be empty');
  15666. }
  15667. var iterations = 8192;
  15668. var keylen = 32;
  15669. _crypto2.default.pbkdf2(masterPassword, login, iterations, keylen, 'sha256', function (error, key) {
  15670. if (error) {
  15671. reject('error in pbkdf2');
  15672. } else {
  15673. resolve(key.toString('hex'));
  15674. }
  15675. });
  15676. });
  15677. }
  15678. function _renderPassword(encryptedLogin, site, passwordOptions) {
  15679. return _deriveEncryptedLogin(encryptedLogin, site, passwordOptions).then(function (derivedEncryptedLogin) {
  15680. var template = _getPasswordTemplate(passwordOptions);
  15681. return _prettyPrint(derivedEncryptedLogin, template);
  15682. });
  15683. }
  15684. function _createHmac(encryptedLogin, salt) {
  15685. return new Promise(function (resolve) {
  15686. resolve(_crypto2.default.createHmac('sha256', encryptedLogin).update(salt).digest('hex'));
  15687. });
  15688. }
  15689. function _deriveEncryptedLogin(encryptedLogin, site) {
  15690. var passwordOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { length: 12, counter: 1 };
  15691. var salt = site + passwordOptions.counter.toString();
  15692. return _createHmac(encryptedLogin, salt).then(function (derivedHash) {
  15693. return derivedHash.substring(0, passwordOptions.length);
  15694. });
  15695. }
  15696. function _getPasswordTemplate(passwordTypes) {
  15697. var templates = {
  15698. lowercase: 'vc',
  15699. uppercase: 'VC',
  15700. numbers: 'n',
  15701. symbols: 's'
  15702. };
  15703. var template = '';
  15704. for (var templateKey in templates) {
  15705. if (passwordTypes.hasOwnProperty(templateKey) && passwordTypes[templateKey]) {
  15706. template += templates[templateKey];
  15707. }
  15708. }
  15709. return template;
  15710. }
  15711. function _prettyPrint(hash, template) {
  15712. var password = '';
  15713. _string2charCodes(hash).forEach(function (charCode, index) {
  15714. var charType = _getCharType(template, index);
  15715. password += _getPasswordChar(charType, charCode);
  15716. });
  15717. return password;
  15718. }
  15719. function _string2charCodes(text) {
  15720. var charCodes = [];
  15721. for (var i = 0; i < text.length; i++) {
  15722. charCodes.push(text.charCodeAt(i));
  15723. }
  15724. return charCodes;
  15725. }
  15726. function _getCharType(template, index) {
  15727. return template[index % template.length];
  15728. }
  15729. function _getPasswordChar(charType, index) {
  15730. var passwordsChars = {
  15731. V: 'AEIOUY',
  15732. C: 'BCDFGHJKLMNPQRSTVWXZ',
  15733. v: 'aeiouy',
  15734. c: 'bcdfghjklmnpqrstvwxz',
  15735. A: 'AEIOUYBCDFGHJKLMNPQRSTVWXZ',
  15736. a: 'AEIOUYaeiouyBCDFGHJKLMNPQRSTVWXZbcdfghjklmnpqrstvwxz',
  15737. n: '0123456789',
  15738. s: '@&%?,=[]_:-+*$#!\'^~;()/.',
  15739. x: 'AEIOUYaeiouyBCDFGHJKLMNPQRSTVWXZbcdfghjklmnpqrstvwxz0123456789@&%?,=[]_:-+*$#!\'^~;()/.'
  15740. };
  15741. var passwordChar = passwordsChars[charType];
  15742. return passwordChar[index % passwordChar.length];
  15743. }
  15744. function createFingerprint(str) {
  15745. return new Promise(function (resolve) {
  15746. resolve(_crypto2.default.createHmac('sha256', str).digest('hex'));
  15747. });
  15748. }
  15749. /***/ },
  15750. /* 109 */
  15751. /***/ function(module, exports, __webpack_require__) {
  15752. var bn = __webpack_require__(2);
  15753. var brorand = __webpack_require__(81);
  15754. function MillerRabin(rand) {
  15755. this.rand = rand || new brorand.Rand();
  15756. }
  15757. module.exports = MillerRabin;
  15758. MillerRabin.create = function create(rand) {
  15759. return new MillerRabin(rand);
  15760. };
  15761. MillerRabin.prototype._rand = function _rand(n) {
  15762. var len = n.bitLength();
  15763. var buf = this.rand.generate(Math.ceil(len / 8));
  15764. // Set low bits
  15765. buf[0] |= 3;
  15766. // Mask high bits
  15767. var mask = len & 0x7;
  15768. if (mask !== 0)
  15769. buf[buf.length - 1] >>= 7 - mask;
  15770. return new bn(buf);
  15771. }
  15772. MillerRabin.prototype.test = function test(n, k, cb) {
  15773. var len = n.bitLength();
  15774. var red = bn.mont(n);
  15775. var rone = new bn(1).toRed(red);
  15776. if (!k)
  15777. k = Math.max(1, (len / 48) | 0);
  15778. // Find d and s, (n - 1) = (2 ^ s) * d;
  15779. var n1 = n.subn(1);
  15780. var n2 = n1.subn(1);
  15781. for (var s = 0; !n1.testn(s); s++) {}
  15782. var d = n.shrn(s);
  15783. var rn1 = n1.toRed(red);
  15784. var prime = true;
  15785. for (; k > 0; k--) {
  15786. var a = this._rand(n2);
  15787. if (cb)
  15788. cb(a);
  15789. var x = a.toRed(red).redPow(d);
  15790. if (x.cmp(rone) === 0 || x.cmp(rn1) === 0)
  15791. continue;
  15792. for (var i = 1; i < s; i++) {
  15793. x = x.redSqr();
  15794. if (x.cmp(rone) === 0)
  15795. return false;
  15796. if (x.cmp(rn1) === 0)
  15797. break;
  15798. }
  15799. if (i === s)
  15800. return false;
  15801. }
  15802. return prime;
  15803. };
  15804. MillerRabin.prototype.getDivisor = function getDivisor(n, k) {
  15805. var len = n.bitLength();
  15806. var red = bn.mont(n);
  15807. var rone = new bn(1).toRed(red);
  15808. if (!k)
  15809. k = Math.max(1, (len / 48) | 0);
  15810. // Find d and s, (n - 1) = (2 ^ s) * d;
  15811. var n1 = n.subn(1);
  15812. var n2 = n1.subn(1);
  15813. for (var s = 0; !n1.testn(s); s++) {}
  15814. var d = n.shrn(s);
  15815. var rn1 = n1.toRed(red);
  15816. for (; k > 0; k--) {
  15817. var a = this._rand(n2);
  15818. var g = n.gcd(a);
  15819. if (g.cmpn(1) !== 0)
  15820. return g;
  15821. var x = a.toRed(red).redPow(d);
  15822. if (x.cmp(rone) === 0 || x.cmp(rn1) === 0)
  15823. continue;
  15824. for (var i = 1; i < s; i++) {
  15825. x = x.redSqr();
  15826. if (x.cmp(rone) === 0)
  15827. return x.fromRed().subn(1).gcd(n);
  15828. if (x.cmp(rn1) === 0)
  15829. break;
  15830. }
  15831. if (i === s) {
  15832. x = x.redSqr();
  15833. return x.fromRed().subn(1).gcd(n);
  15834. }
  15835. }
  15836. return false;
  15837. };
  15838. /***/ },
  15839. /* 110 */
  15840. /***/ function(module, exports, __webpack_require__) {
  15841. /* WEBPACK VAR INJECTION */(function(process, Buffer) {var createHmac = __webpack_require__(60)
  15842. var checkParameters = __webpack_require__(264)
  15843. exports.pbkdf2 = function (password, salt, iterations, keylen, digest, callback) {
  15844. if (typeof digest === 'function') {
  15845. callback = digest
  15846. digest = undefined
  15847. }
  15848. checkParameters(iterations, keylen)
  15849. if (typeof callback !== 'function') throw new Error('No callback provided to pbkdf2')
  15850. setTimeout(function () {
  15851. callback(null, exports.pbkdf2Sync(password, salt, iterations, keylen, digest))
  15852. })
  15853. }
  15854. var defaultEncoding
  15855. if (process.browser) {
  15856. defaultEncoding = 'utf-8'
  15857. } else {
  15858. var pVersionMajor = parseInt(process.version.split('.')[0].slice(1), 10)
  15859. defaultEncoding = pVersionMajor >= 6 ? 'utf-8' : 'binary'
  15860. }
  15861. exports.pbkdf2Sync = function (password, salt, iterations, keylen, digest) {
  15862. if (!Buffer.isBuffer(password)) password = new Buffer(password, defaultEncoding)
  15863. if (!Buffer.isBuffer(salt)) salt = new Buffer(salt, defaultEncoding)
  15864. checkParameters(iterations, keylen)
  15865. digest = digest || 'sha1'
  15866. var hLen
  15867. var l = 1
  15868. var DK = new Buffer(keylen)
  15869. var block1 = new Buffer(salt.length + 4)
  15870. salt.copy(block1, 0, 0, salt.length)
  15871. var r
  15872. var T
  15873. for (var i = 1; i <= l; i++) {
  15874. block1.writeUInt32BE(i, salt.length)
  15875. var U = createHmac(digest, password).update(block1).digest()
  15876. if (!hLen) {
  15877. hLen = U.length
  15878. T = new Buffer(hLen)
  15879. l = Math.ceil(keylen / hLen)
  15880. r = keylen - (l - 1) * hLen
  15881. }
  15882. U.copy(T, 0, 0, hLen)
  15883. for (var j = 1; j < iterations; j++) {
  15884. U = createHmac(digest, password).update(U).digest()
  15885. for (var k = 0; k < hLen; k++) T[k] ^= U[k]
  15886. }
  15887. var destPos = (i - 1) * hLen
  15888. var len = (i === l ? r : hLen)
  15889. T.copy(DK, destPos, 0, len)
  15890. }
  15891. return DK
  15892. }
  15893. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7), __webpack_require__(0).Buffer))
  15894. /***/ },
  15895. /* 111 */
  15896. /***/ function(module, exports, __webpack_require__) {
  15897. /* WEBPACK VAR INJECTION */(function(Buffer) {var createHash = __webpack_require__(16);
  15898. module.exports = function (seed, len) {
  15899. var t = new Buffer('');
  15900. var i = 0, c;
  15901. while (t.length < len) {
  15902. c = i2ops(i++);
  15903. t = Buffer.concat([t, createHash('sha1').update(seed).update(c).digest()]);
  15904. }
  15905. return t.slice(0, len);
  15906. };
  15907. function i2ops(c) {
  15908. var out = new Buffer(4);
  15909. out.writeUInt32BE(c,0);
  15910. return out;
  15911. }
  15912. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  15913. /***/ },
  15914. /* 112 */
  15915. /***/ function(module, exports, __webpack_require__) {
  15916. /* WEBPACK VAR INJECTION */(function(Buffer) {var bn = __webpack_require__(2);
  15917. function withPublic(paddedMsg, key) {
  15918. return new Buffer(paddedMsg
  15919. .toRed(bn.mont(key.modulus))
  15920. .redPow(new bn(key.publicExponent))
  15921. .fromRed()
  15922. .toArray());
  15923. }
  15924. module.exports = withPublic;
  15925. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  15926. /***/ },
  15927. /* 113 */
  15928. /***/ function(module, exports) {
  15929. module.exports = function xor(a, b) {
  15930. var len = a.length;
  15931. var i = -1;
  15932. while (++i < len) {
  15933. a[i] ^= b[i];
  15934. }
  15935. return a
  15936. };
  15937. /***/ },
  15938. /* 114 */
  15939. /***/ function(module, exports, __webpack_require__) {
  15940. "use strict";
  15941. // a passthrough stream.
  15942. // basically just the most minimal sort of Transform stream.
  15943. // Every written chunk gets output as-is.
  15944. 'use strict';
  15945. module.exports = PassThrough;
  15946. var Transform = __webpack_require__(63);
  15947. /*<replacement>*/
  15948. var util = __webpack_require__(29);
  15949. util.inherits = __webpack_require__(1);
  15950. /*</replacement>*/
  15951. util.inherits(PassThrough, Transform);
  15952. function PassThrough(options) {
  15953. if (!(this instanceof PassThrough)) return new PassThrough(options);
  15954. Transform.call(this, options);
  15955. }
  15956. PassThrough.prototype._transform = function (chunk, encoding, cb) {
  15957. cb(null, chunk);
  15958. };
  15959. /***/ },
  15960. /* 115 */
  15961. /***/ function(module, exports, __webpack_require__) {
  15962. "use strict";
  15963. /* WEBPACK VAR INJECTION */(function(process) {'use strict';
  15964. module.exports = Readable;
  15965. /*<replacement>*/
  15966. var processNextTick = __webpack_require__(62);
  15967. /*</replacement>*/
  15968. /*<replacement>*/
  15969. var isArray = __webpack_require__(106);
  15970. /*</replacement>*/
  15971. Readable.ReadableState = ReadableState;
  15972. /*<replacement>*/
  15973. var EE = __webpack_require__(44).EventEmitter;
  15974. var EElistenerCount = function (emitter, type) {
  15975. return emitter.listeners(type).length;
  15976. };
  15977. /*</replacement>*/
  15978. /*<replacement>*/
  15979. var Stream;
  15980. (function () {
  15981. try {
  15982. Stream = __webpack_require__(19);
  15983. } catch (_) {} finally {
  15984. if (!Stream) Stream = __webpack_require__(44).EventEmitter;
  15985. }
  15986. })();
  15987. /*</replacement>*/
  15988. var Buffer = __webpack_require__(0).Buffer;
  15989. /*<replacement>*/
  15990. var bufferShim = __webpack_require__(51);
  15991. /*</replacement>*/
  15992. /*<replacement>*/
  15993. var util = __webpack_require__(29);
  15994. util.inherits = __webpack_require__(1);
  15995. /*</replacement>*/
  15996. /*<replacement>*/
  15997. var debugUtil = __webpack_require__(312);
  15998. var debug = void 0;
  15999. if (debugUtil && debugUtil.debuglog) {
  16000. debug = debugUtil.debuglog('stream');
  16001. } else {
  16002. debug = function () {};
  16003. }
  16004. /*</replacement>*/
  16005. var BufferList = __webpack_require__(269);
  16006. var StringDecoder;
  16007. util.inherits(Readable, Stream);
  16008. function prependListener(emitter, event, fn) {
  16009. if (typeof emitter.prependListener === 'function') {
  16010. return emitter.prependListener(event, fn);
  16011. } else {
  16012. // This is a hack to make sure that our error handler is attached before any
  16013. // userland ones. NEVER DO THIS. This is here only because this code needs
  16014. // to continue to work with older versions of Node.js that do not include
  16015. // the prependListener() method. The goal is to eventually remove this hack.
  16016. if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
  16017. }
  16018. }
  16019. var Duplex;
  16020. function ReadableState(options, stream) {
  16021. Duplex = Duplex || __webpack_require__(10);
  16022. options = options || {};
  16023. // object stream flag. Used to make read(n) ignore n and to
  16024. // make all the buffer merging and length checks go away
  16025. this.objectMode = !!options.objectMode;
  16026. if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
  16027. // the point at which it stops calling _read() to fill the buffer
  16028. // Note: 0 is a valid value, means "don't call _read preemptively ever"
  16029. var hwm = options.highWaterMark;
  16030. var defaultHwm = this.objectMode ? 16 : 16 * 1024;
  16031. this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm;
  16032. // cast to ints.
  16033. this.highWaterMark = ~ ~this.highWaterMark;
  16034. // A linked list is used to store data chunks instead of an array because the
  16035. // linked list can remove elements from the beginning faster than
  16036. // array.shift()
  16037. this.buffer = new BufferList();
  16038. this.length = 0;
  16039. this.pipes = null;
  16040. this.pipesCount = 0;
  16041. this.flowing = null;
  16042. this.ended = false;
  16043. this.endEmitted = false;
  16044. this.reading = false;
  16045. // a flag to be able to tell if the onwrite cb is called immediately,
  16046. // or on a later tick. We set this to true at first, because any
  16047. // actions that shouldn't happen until "later" should generally also
  16048. // not happen before the first write call.
  16049. this.sync = true;
  16050. // whenever we return null, then we set a flag to say
  16051. // that we're awaiting a 'readable' event emission.
  16052. this.needReadable = false;
  16053. this.emittedReadable = false;
  16054. this.readableListening = false;
  16055. this.resumeScheduled = false;
  16056. // Crypto is kind of old and crusty. Historically, its default string
  16057. // encoding is 'binary' so we have to make this configurable.
  16058. // Everything else in the universe uses 'utf8', though.
  16059. this.defaultEncoding = options.defaultEncoding || 'utf8';
  16060. // when piping, we only care about 'readable' events that happen
  16061. // after read()ing all the bytes and not getting any pushback.
  16062. this.ranOut = false;
  16063. // the number of writers that are awaiting a drain event in .pipe()s
  16064. this.awaitDrain = 0;
  16065. // if true, a maybeReadMore has been scheduled
  16066. this.readingMore = false;
  16067. this.decoder = null;
  16068. this.encoding = null;
  16069. if (options.encoding) {
  16070. if (!StringDecoder) StringDecoder = __webpack_require__(65).StringDecoder;
  16071. this.decoder = new StringDecoder(options.encoding);
  16072. this.encoding = options.encoding;
  16073. }
  16074. }
  16075. var Duplex;
  16076. function Readable(options) {
  16077. Duplex = Duplex || __webpack_require__(10);
  16078. if (!(this instanceof Readable)) return new Readable(options);
  16079. this._readableState = new ReadableState(options, this);
  16080. // legacy
  16081. this.readable = true;
  16082. if (options && typeof options.read === 'function') this._read = options.read;
  16083. Stream.call(this);
  16084. }
  16085. // Manually shove something into the read() buffer.
  16086. // This returns true if the highWaterMark has not been hit yet,
  16087. // similar to how Writable.write() returns true if you should
  16088. // write() some more.
  16089. Readable.prototype.push = function (chunk, encoding) {
  16090. var state = this._readableState;
  16091. if (!state.objectMode && typeof chunk === 'string') {
  16092. encoding = encoding || state.defaultEncoding;
  16093. if (encoding !== state.encoding) {
  16094. chunk = bufferShim.from(chunk, encoding);
  16095. encoding = '';
  16096. }
  16097. }
  16098. return readableAddChunk(this, state, chunk, encoding, false);
  16099. };
  16100. // Unshift should *always* be something directly out of read()
  16101. Readable.prototype.unshift = function (chunk) {
  16102. var state = this._readableState;
  16103. return readableAddChunk(this, state, chunk, '', true);
  16104. };
  16105. Readable.prototype.isPaused = function () {
  16106. return this._readableState.flowing === false;
  16107. };
  16108. function readableAddChunk(stream, state, chunk, encoding, addToFront) {
  16109. var er = chunkInvalid(state, chunk);
  16110. if (er) {
  16111. stream.emit('error', er);
  16112. } else if (chunk === null) {
  16113. state.reading = false;
  16114. onEofChunk(stream, state);
  16115. } else if (state.objectMode || chunk && chunk.length > 0) {
  16116. if (state.ended && !addToFront) {
  16117. var e = new Error('stream.push() after EOF');
  16118. stream.emit('error', e);
  16119. } else if (state.endEmitted && addToFront) {
  16120. var _e = new Error('stream.unshift() after end event');
  16121. stream.emit('error', _e);
  16122. } else {
  16123. var skipAdd;
  16124. if (state.decoder && !addToFront && !encoding) {
  16125. chunk = state.decoder.write(chunk);
  16126. skipAdd = !state.objectMode && chunk.length === 0;
  16127. }
  16128. if (!addToFront) state.reading = false;
  16129. // Don't add to the buffer if we've decoded to an empty string chunk and
  16130. // we're not in object mode
  16131. if (!skipAdd) {
  16132. // if we want the data now, just emit it.
  16133. if (state.flowing && state.length === 0 && !state.sync) {
  16134. stream.emit('data', chunk);
  16135. stream.read(0);
  16136. } else {
  16137. // update the buffer info.
  16138. state.length += state.objectMode ? 1 : chunk.length;
  16139. if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
  16140. if (state.needReadable) emitReadable(stream);
  16141. }
  16142. }
  16143. maybeReadMore(stream, state);
  16144. }
  16145. } else if (!addToFront) {
  16146. state.reading = false;
  16147. }
  16148. return needMoreData(state);
  16149. }
  16150. // if it's past the high water mark, we can push in some more.
  16151. // Also, if we have no data yet, we can stand some
  16152. // more bytes. This is to work around cases where hwm=0,
  16153. // such as the repl. Also, if the push() triggered a
  16154. // readable event, and the user called read(largeNumber) such that
  16155. // needReadable was set, then we ought to push more, so that another
  16156. // 'readable' event will be triggered.
  16157. function needMoreData(state) {
  16158. return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);
  16159. }
  16160. // backwards compatibility.
  16161. Readable.prototype.setEncoding = function (enc) {
  16162. if (!StringDecoder) StringDecoder = __webpack_require__(65).StringDecoder;
  16163. this._readableState.decoder = new StringDecoder(enc);
  16164. this._readableState.encoding = enc;
  16165. return this;
  16166. };
  16167. // Don't raise the hwm > 8MB
  16168. var MAX_HWM = 0x800000;
  16169. function computeNewHighWaterMark(n) {
  16170. if (n >= MAX_HWM) {
  16171. n = MAX_HWM;
  16172. } else {
  16173. // Get the next highest power of 2 to prevent increasing hwm excessively in
  16174. // tiny amounts
  16175. n--;
  16176. n |= n >>> 1;
  16177. n |= n >>> 2;
  16178. n |= n >>> 4;
  16179. n |= n >>> 8;
  16180. n |= n >>> 16;
  16181. n++;
  16182. }
  16183. return n;
  16184. }
  16185. // This function is designed to be inlinable, so please take care when making
  16186. // changes to the function body.
  16187. function howMuchToRead(n, state) {
  16188. if (n <= 0 || state.length === 0 && state.ended) return 0;
  16189. if (state.objectMode) return 1;
  16190. if (n !== n) {
  16191. // Only flow one buffer at a time
  16192. if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
  16193. }
  16194. // If we're asking for more than the current hwm, then raise the hwm.
  16195. if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
  16196. if (n <= state.length) return n;
  16197. // Don't have enough
  16198. if (!state.ended) {
  16199. state.needReadable = true;
  16200. return 0;
  16201. }
  16202. return state.length;
  16203. }
  16204. // you can override either this method, or the async _read(n) below.
  16205. Readable.prototype.read = function (n) {
  16206. debug('read', n);
  16207. n = parseInt(n, 10);
  16208. var state = this._readableState;
  16209. var nOrig = n;
  16210. if (n !== 0) state.emittedReadable = false;
  16211. // if we're doing read(0) to trigger a readable event, but we
  16212. // already have a bunch of data in the buffer, then just trigger
  16213. // the 'readable' event and move on.
  16214. if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {
  16215. debug('read: emitReadable', state.length, state.ended);
  16216. if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
  16217. return null;
  16218. }
  16219. n = howMuchToRead(n, state);
  16220. // if we've ended, and we're now clear, then finish it up.
  16221. if (n === 0 && state.ended) {
  16222. if (state.length === 0) endReadable(this);
  16223. return null;
  16224. }
  16225. // All the actual chunk generation logic needs to be
  16226. // *below* the call to _read. The reason is that in certain
  16227. // synthetic stream cases, such as passthrough streams, _read
  16228. // may be a completely synchronous operation which may change
  16229. // the state of the read buffer, providing enough data when
  16230. // before there was *not* enough.
  16231. //
  16232. // So, the steps are:
  16233. // 1. Figure out what the state of things will be after we do
  16234. // a read from the buffer.
  16235. //
  16236. // 2. If that resulting state will trigger a _read, then call _read.
  16237. // Note that this may be asynchronous, or synchronous. Yes, it is
  16238. // deeply ugly to write APIs this way, but that still doesn't mean
  16239. // that the Readable class should behave improperly, as streams are
  16240. // designed to be sync/async agnostic.
  16241. // Take note if the _read call is sync or async (ie, if the read call
  16242. // has returned yet), so that we know whether or not it's safe to emit
  16243. // 'readable' etc.
  16244. //
  16245. // 3. Actually pull the requested chunks out of the buffer and return.
  16246. // if we need a readable event, then we need to do some reading.
  16247. var doRead = state.needReadable;
  16248. debug('need readable', doRead);
  16249. // if we currently have less than the highWaterMark, then also read some
  16250. if (state.length === 0 || state.length - n < state.highWaterMark) {
  16251. doRead = true;
  16252. debug('length less than watermark', doRead);
  16253. }
  16254. // however, if we've ended, then there's no point, and if we're already
  16255. // reading, then it's unnecessary.
  16256. if (state.ended || state.reading) {
  16257. doRead = false;
  16258. debug('reading or ended', doRead);
  16259. } else if (doRead) {
  16260. debug('do read');
  16261. state.reading = true;
  16262. state.sync = true;
  16263. // if the length is currently zero, then we *need* a readable event.
  16264. if (state.length === 0) state.needReadable = true;
  16265. // call internal read method
  16266. this._read(state.highWaterMark);
  16267. state.sync = false;
  16268. // If _read pushed data synchronously, then `reading` will be false,
  16269. // and we need to re-evaluate how much data we can return to the user.
  16270. if (!state.reading) n = howMuchToRead(nOrig, state);
  16271. }
  16272. var ret;
  16273. if (n > 0) ret = fromList(n, state);else ret = null;
  16274. if (ret === null) {
  16275. state.needReadable = true;
  16276. n = 0;
  16277. } else {
  16278. state.length -= n;
  16279. }
  16280. if (state.length === 0) {
  16281. // If we have nothing in the buffer, then we want to know
  16282. // as soon as we *do* get something into the buffer.
  16283. if (!state.ended) state.needReadable = true;
  16284. // If we tried to read() past the EOF, then emit end on the next tick.
  16285. if (nOrig !== n && state.ended) endReadable(this);
  16286. }
  16287. if (ret !== null) this.emit('data', ret);
  16288. return ret;
  16289. };
  16290. function chunkInvalid(state, chunk) {
  16291. var er = null;
  16292. if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) {
  16293. er = new TypeError('Invalid non-string/buffer chunk');
  16294. }
  16295. return er;
  16296. }
  16297. function onEofChunk(stream, state) {
  16298. if (state.ended) return;
  16299. if (state.decoder) {
  16300. var chunk = state.decoder.end();
  16301. if (chunk && chunk.length) {
  16302. state.buffer.push(chunk);
  16303. state.length += state.objectMode ? 1 : chunk.length;
  16304. }
  16305. }
  16306. state.ended = true;
  16307. // emit 'readable' now to make sure it gets picked up.
  16308. emitReadable(stream);
  16309. }
  16310. // Don't emit readable right away in sync mode, because this can trigger
  16311. // another read() call => stack overflow. This way, it might trigger
  16312. // a nextTick recursion warning, but that's not so bad.
  16313. function emitReadable(stream) {
  16314. var state = stream._readableState;
  16315. state.needReadable = false;
  16316. if (!state.emittedReadable) {
  16317. debug('emitReadable', state.flowing);
  16318. state.emittedReadable = true;
  16319. if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream);
  16320. }
  16321. }
  16322. function emitReadable_(stream) {
  16323. debug('emit readable');
  16324. stream.emit('readable');
  16325. flow(stream);
  16326. }
  16327. // at this point, the user has presumably seen the 'readable' event,
  16328. // and called read() to consume some data. that may have triggered
  16329. // in turn another _read(n) call, in which case reading = true if
  16330. // it's in progress.
  16331. // However, if we're not ended, or reading, and the length < hwm,
  16332. // then go ahead and try to read some more preemptively.
  16333. function maybeReadMore(stream, state) {
  16334. if (!state.readingMore) {
  16335. state.readingMore = true;
  16336. processNextTick(maybeReadMore_, stream, state);
  16337. }
  16338. }
  16339. function maybeReadMore_(stream, state) {
  16340. var len = state.length;
  16341. while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {
  16342. debug('maybeReadMore read 0');
  16343. stream.read(0);
  16344. if (len === state.length)
  16345. // didn't get any data, stop spinning.
  16346. break;else len = state.length;
  16347. }
  16348. state.readingMore = false;
  16349. }
  16350. // abstract method. to be overridden in specific implementation classes.
  16351. // call cb(er, data) where data is <= n in length.
  16352. // for virtual (non-string, non-buffer) streams, "length" is somewhat
  16353. // arbitrary, and perhaps not very meaningful.
  16354. Readable.prototype._read = function (n) {
  16355. this.emit('error', new Error('not implemented'));
  16356. };
  16357. Readable.prototype.pipe = function (dest, pipeOpts) {
  16358. var src = this;
  16359. var state = this._readableState;
  16360. switch (state.pipesCount) {
  16361. case 0:
  16362. state.pipes = dest;
  16363. break;
  16364. case 1:
  16365. state.pipes = [state.pipes, dest];
  16366. break;
  16367. default:
  16368. state.pipes.push(dest);
  16369. break;
  16370. }
  16371. state.pipesCount += 1;
  16372. debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
  16373. var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
  16374. var endFn = doEnd ? onend : cleanup;
  16375. if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn);
  16376. dest.on('unpipe', onunpipe);
  16377. function onunpipe(readable) {
  16378. debug('onunpipe');
  16379. if (readable === src) {
  16380. cleanup();
  16381. }
  16382. }
  16383. function onend() {
  16384. debug('onend');
  16385. dest.end();
  16386. }
  16387. // when the dest drains, it reduces the awaitDrain counter
  16388. // on the source. This would be more elegant with a .once()
  16389. // handler in flow(), but adding and removing repeatedly is
  16390. // too slow.
  16391. var ondrain = pipeOnDrain(src);
  16392. dest.on('drain', ondrain);
  16393. var cleanedUp = false;
  16394. function cleanup() {
  16395. debug('cleanup');
  16396. // cleanup event handlers once the pipe is broken
  16397. dest.removeListener('close', onclose);
  16398. dest.removeListener('finish', onfinish);
  16399. dest.removeListener('drain', ondrain);
  16400. dest.removeListener('error', onerror);
  16401. dest.removeListener('unpipe', onunpipe);
  16402. src.removeListener('end', onend);
  16403. src.removeListener('end', cleanup);
  16404. src.removeListener('data', ondata);
  16405. cleanedUp = true;
  16406. // if the reader is waiting for a drain event from this
  16407. // specific writer, then it would cause it to never start
  16408. // flowing again.
  16409. // So, if this is awaiting a drain, then we just call it now.
  16410. // If we don't know, then assume that we are waiting for one.
  16411. if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
  16412. }
  16413. // If the user pushes more data while we're writing to dest then we'll end up
  16414. // in ondata again. However, we only want to increase awaitDrain once because
  16415. // dest will only emit one 'drain' event for the multiple writes.
  16416. // => Introduce a guard on increasing awaitDrain.
  16417. var increasedAwaitDrain = false;
  16418. src.on('data', ondata);
  16419. function ondata(chunk) {
  16420. debug('ondata');
  16421. increasedAwaitDrain = false;
  16422. var ret = dest.write(chunk);
  16423. if (false === ret && !increasedAwaitDrain) {
  16424. // If the user unpiped during `dest.write()`, it is possible
  16425. // to get stuck in a permanently paused state if that write
  16426. // also returned false.
  16427. // => Check whether `dest` is still a piping destination.
  16428. if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
  16429. debug('false write response, pause', src._readableState.awaitDrain);
  16430. src._readableState.awaitDrain++;
  16431. increasedAwaitDrain = true;
  16432. }
  16433. src.pause();
  16434. }
  16435. }
  16436. // if the dest has an error, then stop piping into it.
  16437. // however, don't suppress the throwing behavior for this.
  16438. function onerror(er) {
  16439. debug('onerror', er);
  16440. unpipe();
  16441. dest.removeListener('error', onerror);
  16442. if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);
  16443. }
  16444. // Make sure our error handler is attached before userland ones.
  16445. prependListener(dest, 'error', onerror);
  16446. // Both close and finish should trigger unpipe, but only once.
  16447. function onclose() {
  16448. dest.removeListener('finish', onfinish);
  16449. unpipe();
  16450. }
  16451. dest.once('close', onclose);
  16452. function onfinish() {
  16453. debug('onfinish');
  16454. dest.removeListener('close', onclose);
  16455. unpipe();
  16456. }
  16457. dest.once('finish', onfinish);
  16458. function unpipe() {
  16459. debug('unpipe');
  16460. src.unpipe(dest);
  16461. }
  16462. // tell the dest that it's being piped to
  16463. dest.emit('pipe', src);
  16464. // start the flow if it hasn't been started already.
  16465. if (!state.flowing) {
  16466. debug('pipe resume');
  16467. src.resume();
  16468. }
  16469. return dest;
  16470. };
  16471. function pipeOnDrain(src) {
  16472. return function () {
  16473. var state = src._readableState;
  16474. debug('pipeOnDrain', state.awaitDrain);
  16475. if (state.awaitDrain) state.awaitDrain--;
  16476. if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
  16477. state.flowing = true;
  16478. flow(src);
  16479. }
  16480. };
  16481. }
  16482. Readable.prototype.unpipe = function (dest) {
  16483. var state = this._readableState;
  16484. // if we're not piping anywhere, then do nothing.
  16485. if (state.pipesCount === 0) return this;
  16486. // just one destination. most common case.
  16487. if (state.pipesCount === 1) {
  16488. // passed in one, but it's not the right one.
  16489. if (dest && dest !== state.pipes) return this;
  16490. if (!dest) dest = state.pipes;
  16491. // got a match.
  16492. state.pipes = null;
  16493. state.pipesCount = 0;
  16494. state.flowing = false;
  16495. if (dest) dest.emit('unpipe', this);
  16496. return this;
  16497. }
  16498. // slow case. multiple pipe destinations.
  16499. if (!dest) {
  16500. // remove all.
  16501. var dests = state.pipes;
  16502. var len = state.pipesCount;
  16503. state.pipes = null;
  16504. state.pipesCount = 0;
  16505. state.flowing = false;
  16506. for (var _i = 0; _i < len; _i++) {
  16507. dests[_i].emit('unpipe', this);
  16508. }return this;
  16509. }
  16510. // try to find the right one.
  16511. var i = indexOf(state.pipes, dest);
  16512. if (i === -1) return this;
  16513. state.pipes.splice(i, 1);
  16514. state.pipesCount -= 1;
  16515. if (state.pipesCount === 1) state.pipes = state.pipes[0];
  16516. dest.emit('unpipe', this);
  16517. return this;
  16518. };
  16519. // set up data events if they are asked for
  16520. // Ensure readable listeners eventually get something
  16521. Readable.prototype.on = function (ev, fn) {
  16522. var res = Stream.prototype.on.call(this, ev, fn);
  16523. if (ev === 'data') {
  16524. // Start flowing on next tick if stream isn't explicitly paused
  16525. if (this._readableState.flowing !== false) this.resume();
  16526. } else if (ev === 'readable') {
  16527. var state = this._readableState;
  16528. if (!state.endEmitted && !state.readableListening) {
  16529. state.readableListening = state.needReadable = true;
  16530. state.emittedReadable = false;
  16531. if (!state.reading) {
  16532. processNextTick(nReadingNextTick, this);
  16533. } else if (state.length) {
  16534. emitReadable(this, state);
  16535. }
  16536. }
  16537. }
  16538. return res;
  16539. };
  16540. Readable.prototype.addListener = Readable.prototype.on;
  16541. function nReadingNextTick(self) {
  16542. debug('readable nexttick read 0');
  16543. self.read(0);
  16544. }
  16545. // pause() and resume() are remnants of the legacy readable stream API
  16546. // If the user uses them, then switch into old mode.
  16547. Readable.prototype.resume = function () {
  16548. var state = this._readableState;
  16549. if (!state.flowing) {
  16550. debug('resume');
  16551. state.flowing = true;
  16552. resume(this, state);
  16553. }
  16554. return this;
  16555. };
  16556. function resume(stream, state) {
  16557. if (!state.resumeScheduled) {
  16558. state.resumeScheduled = true;
  16559. processNextTick(resume_, stream, state);
  16560. }
  16561. }
  16562. function resume_(stream, state) {
  16563. if (!state.reading) {
  16564. debug('resume read 0');
  16565. stream.read(0);
  16566. }
  16567. state.resumeScheduled = false;
  16568. state.awaitDrain = 0;
  16569. stream.emit('resume');
  16570. flow(stream);
  16571. if (state.flowing && !state.reading) stream.read(0);
  16572. }
  16573. Readable.prototype.pause = function () {
  16574. debug('call pause flowing=%j', this._readableState.flowing);
  16575. if (false !== this._readableState.flowing) {
  16576. debug('pause');
  16577. this._readableState.flowing = false;
  16578. this.emit('pause');
  16579. }
  16580. return this;
  16581. };
  16582. function flow(stream) {
  16583. var state = stream._readableState;
  16584. debug('flow', state.flowing);
  16585. while (state.flowing && stream.read() !== null) {}
  16586. }
  16587. // wrap an old-style stream as the async data source.
  16588. // This is *not* part of the readable stream interface.
  16589. // It is an ugly unfortunate mess of history.
  16590. Readable.prototype.wrap = function (stream) {
  16591. var state = this._readableState;
  16592. var paused = false;
  16593. var self = this;
  16594. stream.on('end', function () {
  16595. debug('wrapped end');
  16596. if (state.decoder && !state.ended) {
  16597. var chunk = state.decoder.end();
  16598. if (chunk && chunk.length) self.push(chunk);
  16599. }
  16600. self.push(null);
  16601. });
  16602. stream.on('data', function (chunk) {
  16603. debug('wrapped data');
  16604. if (state.decoder) chunk = state.decoder.write(chunk);
  16605. // don't skip over falsy values in objectMode
  16606. if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
  16607. var ret = self.push(chunk);
  16608. if (!ret) {
  16609. paused = true;
  16610. stream.pause();
  16611. }
  16612. });
  16613. // proxy all the other methods.
  16614. // important when wrapping filters and duplexes.
  16615. for (var i in stream) {
  16616. if (this[i] === undefined && typeof stream[i] === 'function') {
  16617. this[i] = function (method) {
  16618. return function () {
  16619. return stream[method].apply(stream, arguments);
  16620. };
  16621. }(i);
  16622. }
  16623. }
  16624. // proxy certain important events.
  16625. var events = ['error', 'close', 'destroy', 'pause', 'resume'];
  16626. forEach(events, function (ev) {
  16627. stream.on(ev, self.emit.bind(self, ev));
  16628. });
  16629. // when we try to consume some more bytes, simply unpause the
  16630. // underlying stream.
  16631. self._read = function (n) {
  16632. debug('wrapped _read', n);
  16633. if (paused) {
  16634. paused = false;
  16635. stream.resume();
  16636. }
  16637. };
  16638. return self;
  16639. };
  16640. // exposed for testing purposes only.
  16641. Readable._fromList = fromList;
  16642. // Pluck off n bytes from an array of buffers.
  16643. // Length is the combined lengths of all the buffers in the list.
  16644. // This function is designed to be inlinable, so please take care when making
  16645. // changes to the function body.
  16646. function fromList(n, state) {
  16647. // nothing buffered
  16648. if (state.length === 0) return null;
  16649. var ret;
  16650. if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
  16651. // read it all, truncate the list
  16652. if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
  16653. state.buffer.clear();
  16654. } else {
  16655. // read part of list
  16656. ret = fromListPartial(n, state.buffer, state.decoder);
  16657. }
  16658. return ret;
  16659. }
  16660. // Extracts only enough buffered data to satisfy the amount requested.
  16661. // This function is designed to be inlinable, so please take care when making
  16662. // changes to the function body.
  16663. function fromListPartial(n, list, hasStrings) {
  16664. var ret;
  16665. if (n < list.head.data.length) {
  16666. // slice is the same for buffers and strings
  16667. ret = list.head.data.slice(0, n);
  16668. list.head.data = list.head.data.slice(n);
  16669. } else if (n === list.head.data.length) {
  16670. // first chunk is a perfect match
  16671. ret = list.shift();
  16672. } else {
  16673. // result spans more than one buffer
  16674. ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
  16675. }
  16676. return ret;
  16677. }
  16678. // Copies a specified amount of characters from the list of buffered data
  16679. // chunks.
  16680. // This function is designed to be inlinable, so please take care when making
  16681. // changes to the function body.
  16682. function copyFromBufferString(n, list) {
  16683. var p = list.head;
  16684. var c = 1;
  16685. var ret = p.data;
  16686. n -= ret.length;
  16687. while (p = p.next) {
  16688. var str = p.data;
  16689. var nb = n > str.length ? str.length : n;
  16690. if (nb === str.length) ret += str;else ret += str.slice(0, n);
  16691. n -= nb;
  16692. if (n === 0) {
  16693. if (nb === str.length) {
  16694. ++c;
  16695. if (p.next) list.head = p.next;else list.head = list.tail = null;
  16696. } else {
  16697. list.head = p;
  16698. p.data = str.slice(nb);
  16699. }
  16700. break;
  16701. }
  16702. ++c;
  16703. }
  16704. list.length -= c;
  16705. return ret;
  16706. }
  16707. // Copies a specified amount of bytes from the list of buffered data chunks.
  16708. // This function is designed to be inlinable, so please take care when making
  16709. // changes to the function body.
  16710. function copyFromBuffer(n, list) {
  16711. var ret = bufferShim.allocUnsafe(n);
  16712. var p = list.head;
  16713. var c = 1;
  16714. p.data.copy(ret);
  16715. n -= p.data.length;
  16716. while (p = p.next) {
  16717. var buf = p.data;
  16718. var nb = n > buf.length ? buf.length : n;
  16719. buf.copy(ret, ret.length - n, 0, nb);
  16720. n -= nb;
  16721. if (n === 0) {
  16722. if (nb === buf.length) {
  16723. ++c;
  16724. if (p.next) list.head = p.next;else list.head = list.tail = null;
  16725. } else {
  16726. list.head = p;
  16727. p.data = buf.slice(nb);
  16728. }
  16729. break;
  16730. }
  16731. ++c;
  16732. }
  16733. list.length -= c;
  16734. return ret;
  16735. }
  16736. function endReadable(stream) {
  16737. var state = stream._readableState;
  16738. // If we get here before consuming all the bytes, then that is a
  16739. // bug in node. Should never happen.
  16740. if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream');
  16741. if (!state.endEmitted) {
  16742. state.ended = true;
  16743. processNextTick(endReadableNT, state, stream);
  16744. }
  16745. }
  16746. function endReadableNT(state, stream) {
  16747. // Check that we didn't get one last unshift.
  16748. if (!state.endEmitted && state.length === 0) {
  16749. state.endEmitted = true;
  16750. stream.readable = false;
  16751. stream.emit('end');
  16752. }
  16753. }
  16754. function forEach(xs, f) {
  16755. for (var i = 0, l = xs.length; i < l; i++) {
  16756. f(xs[i], i);
  16757. }
  16758. }
  16759. function indexOf(xs, x) {
  16760. for (var i = 0, l = xs.length; i < l; i++) {
  16761. if (xs[i] === x) return i;
  16762. }
  16763. return -1;
  16764. }
  16765. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7)))
  16766. /***/ },
  16767. /* 116 */
  16768. /***/ function(module, exports, __webpack_require__) {
  16769. /* WEBPACK VAR INJECTION */(function(Buffer) {/**
  16770. * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
  16771. * in FIPS 180-2
  16772. * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
  16773. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
  16774. *
  16775. */
  16776. var inherits = __webpack_require__(1)
  16777. var Hash = __webpack_require__(18)
  16778. var K = [
  16779. 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5,
  16780. 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5,
  16781. 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3,
  16782. 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174,
  16783. 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC,
  16784. 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA,
  16785. 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7,
  16786. 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967,
  16787. 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13,
  16788. 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85,
  16789. 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3,
  16790. 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070,
  16791. 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5,
  16792. 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3,
  16793. 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208,
  16794. 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2
  16795. ]
  16796. var W = new Array(64)
  16797. function Sha256 () {
  16798. this.init()
  16799. this._w = W // new Array(64)
  16800. Hash.call(this, 64, 56)
  16801. }
  16802. inherits(Sha256, Hash)
  16803. Sha256.prototype.init = function () {
  16804. this._a = 0x6a09e667
  16805. this._b = 0xbb67ae85
  16806. this._c = 0x3c6ef372
  16807. this._d = 0xa54ff53a
  16808. this._e = 0x510e527f
  16809. this._f = 0x9b05688c
  16810. this._g = 0x1f83d9ab
  16811. this._h = 0x5be0cd19
  16812. return this
  16813. }
  16814. function ch (x, y, z) {
  16815. return z ^ (x & (y ^ z))
  16816. }
  16817. function maj (x, y, z) {
  16818. return (x & y) | (z & (x | y))
  16819. }
  16820. function sigma0 (x) {
  16821. return (x >>> 2 | x << 30) ^ (x >>> 13 | x << 19) ^ (x >>> 22 | x << 10)
  16822. }
  16823. function sigma1 (x) {
  16824. return (x >>> 6 | x << 26) ^ (x >>> 11 | x << 21) ^ (x >>> 25 | x << 7)
  16825. }
  16826. function gamma0 (x) {
  16827. return (x >>> 7 | x << 25) ^ (x >>> 18 | x << 14) ^ (x >>> 3)
  16828. }
  16829. function gamma1 (x) {
  16830. return (x >>> 17 | x << 15) ^ (x >>> 19 | x << 13) ^ (x >>> 10)
  16831. }
  16832. Sha256.prototype._update = function (M) {
  16833. var W = this._w
  16834. var a = this._a | 0
  16835. var b = this._b | 0
  16836. var c = this._c | 0
  16837. var d = this._d | 0
  16838. var e = this._e | 0
  16839. var f = this._f | 0
  16840. var g = this._g | 0
  16841. var h = this._h | 0
  16842. for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
  16843. for (; i < 64; ++i) W[i] = (gamma1(W[i - 2]) + W[i - 7] + gamma0(W[i - 15]) + W[i - 16]) | 0
  16844. for (var j = 0; j < 64; ++j) {
  16845. var T1 = (h + sigma1(e) + ch(e, f, g) + K[j] + W[j]) | 0
  16846. var T2 = (sigma0(a) + maj(a, b, c)) | 0
  16847. h = g
  16848. g = f
  16849. f = e
  16850. e = (d + T1) | 0
  16851. d = c
  16852. c = b
  16853. b = a
  16854. a = (T1 + T2) | 0
  16855. }
  16856. this._a = (a + this._a) | 0
  16857. this._b = (b + this._b) | 0
  16858. this._c = (c + this._c) | 0
  16859. this._d = (d + this._d) | 0
  16860. this._e = (e + this._e) | 0
  16861. this._f = (f + this._f) | 0
  16862. this._g = (g + this._g) | 0
  16863. this._h = (h + this._h) | 0
  16864. }
  16865. Sha256.prototype._hash = function () {
  16866. var H = new Buffer(32)
  16867. H.writeInt32BE(this._a, 0)
  16868. H.writeInt32BE(this._b, 4)
  16869. H.writeInt32BE(this._c, 8)
  16870. H.writeInt32BE(this._d, 12)
  16871. H.writeInt32BE(this._e, 16)
  16872. H.writeInt32BE(this._f, 20)
  16873. H.writeInt32BE(this._g, 24)
  16874. H.writeInt32BE(this._h, 28)
  16875. return H
  16876. }
  16877. module.exports = Sha256
  16878. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  16879. /***/ },
  16880. /* 117 */
  16881. /***/ function(module, exports, __webpack_require__) {
  16882. /* WEBPACK VAR INJECTION */(function(Buffer) {var inherits = __webpack_require__(1)
  16883. var Hash = __webpack_require__(18)
  16884. var K = [
  16885. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  16886. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  16887. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  16888. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  16889. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  16890. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  16891. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  16892. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  16893. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  16894. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  16895. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  16896. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  16897. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  16898. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  16899. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  16900. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  16901. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  16902. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  16903. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  16904. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  16905. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  16906. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  16907. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  16908. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  16909. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  16910. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  16911. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  16912. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  16913. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  16914. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  16915. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  16916. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  16917. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  16918. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  16919. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  16920. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  16921. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  16922. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  16923. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  16924. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  16925. ]
  16926. var W = new Array(160)
  16927. function Sha512 () {
  16928. this.init()
  16929. this._w = W
  16930. Hash.call(this, 128, 112)
  16931. }
  16932. inherits(Sha512, Hash)
  16933. Sha512.prototype.init = function () {
  16934. this._ah = 0x6a09e667
  16935. this._bh = 0xbb67ae85
  16936. this._ch = 0x3c6ef372
  16937. this._dh = 0xa54ff53a
  16938. this._eh = 0x510e527f
  16939. this._fh = 0x9b05688c
  16940. this._gh = 0x1f83d9ab
  16941. this._hh = 0x5be0cd19
  16942. this._al = 0xf3bcc908
  16943. this._bl = 0x84caa73b
  16944. this._cl = 0xfe94f82b
  16945. this._dl = 0x5f1d36f1
  16946. this._el = 0xade682d1
  16947. this._fl = 0x2b3e6c1f
  16948. this._gl = 0xfb41bd6b
  16949. this._hl = 0x137e2179
  16950. return this
  16951. }
  16952. function Ch (x, y, z) {
  16953. return z ^ (x & (y ^ z))
  16954. }
  16955. function maj (x, y, z) {
  16956. return (x & y) | (z & (x | y))
  16957. }
  16958. function sigma0 (x, xl) {
  16959. return (x >>> 28 | xl << 4) ^ (xl >>> 2 | x << 30) ^ (xl >>> 7 | x << 25)
  16960. }
  16961. function sigma1 (x, xl) {
  16962. return (x >>> 14 | xl << 18) ^ (x >>> 18 | xl << 14) ^ (xl >>> 9 | x << 23)
  16963. }
  16964. function Gamma0 (x, xl) {
  16965. return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7)
  16966. }
  16967. function Gamma0l (x, xl) {
  16968. return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7 | xl << 25)
  16969. }
  16970. function Gamma1 (x, xl) {
  16971. return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6)
  16972. }
  16973. function Gamma1l (x, xl) {
  16974. return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6 | xl << 26)
  16975. }
  16976. function getCarry (a, b) {
  16977. return (a >>> 0) < (b >>> 0) ? 1 : 0
  16978. }
  16979. Sha512.prototype._update = function (M) {
  16980. var W = this._w
  16981. var ah = this._ah | 0
  16982. var bh = this._bh | 0
  16983. var ch = this._ch | 0
  16984. var dh = this._dh | 0
  16985. var eh = this._eh | 0
  16986. var fh = this._fh | 0
  16987. var gh = this._gh | 0
  16988. var hh = this._hh | 0
  16989. var al = this._al | 0
  16990. var bl = this._bl | 0
  16991. var cl = this._cl | 0
  16992. var dl = this._dl | 0
  16993. var el = this._el | 0
  16994. var fl = this._fl | 0
  16995. var gl = this._gl | 0
  16996. var hl = this._hl | 0
  16997. for (var i = 0; i < 32; i += 2) {
  16998. W[i] = M.readInt32BE(i * 4)
  16999. W[i + 1] = M.readInt32BE(i * 4 + 4)
  17000. }
  17001. for (; i < 160; i += 2) {
  17002. var xh = W[i - 15 * 2]
  17003. var xl = W[i - 15 * 2 + 1]
  17004. var gamma0 = Gamma0(xh, xl)
  17005. var gamma0l = Gamma0l(xl, xh)
  17006. xh = W[i - 2 * 2]
  17007. xl = W[i - 2 * 2 + 1]
  17008. var gamma1 = Gamma1(xh, xl)
  17009. var gamma1l = Gamma1l(xl, xh)
  17010. // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]
  17011. var Wi7h = W[i - 7 * 2]
  17012. var Wi7l = W[i - 7 * 2 + 1]
  17013. var Wi16h = W[i - 16 * 2]
  17014. var Wi16l = W[i - 16 * 2 + 1]
  17015. var Wil = (gamma0l + Wi7l) | 0
  17016. var Wih = (gamma0 + Wi7h + getCarry(Wil, gamma0l)) | 0
  17017. Wil = (Wil + gamma1l) | 0
  17018. Wih = (Wih + gamma1 + getCarry(Wil, gamma1l)) | 0
  17019. Wil = (Wil + Wi16l) | 0
  17020. Wih = (Wih + Wi16h + getCarry(Wil, Wi16l)) | 0
  17021. W[i] = Wih
  17022. W[i + 1] = Wil
  17023. }
  17024. for (var j = 0; j < 160; j += 2) {
  17025. Wih = W[j]
  17026. Wil = W[j + 1]
  17027. var majh = maj(ah, bh, ch)
  17028. var majl = maj(al, bl, cl)
  17029. var sigma0h = sigma0(ah, al)
  17030. var sigma0l = sigma0(al, ah)
  17031. var sigma1h = sigma1(eh, el)
  17032. var sigma1l = sigma1(el, eh)
  17033. // t1 = h + sigma1 + ch + K[j] + W[j]
  17034. var Kih = K[j]
  17035. var Kil = K[j + 1]
  17036. var chh = Ch(eh, fh, gh)
  17037. var chl = Ch(el, fl, gl)
  17038. var t1l = (hl + sigma1l) | 0
  17039. var t1h = (hh + sigma1h + getCarry(t1l, hl)) | 0
  17040. t1l = (t1l + chl) | 0
  17041. t1h = (t1h + chh + getCarry(t1l, chl)) | 0
  17042. t1l = (t1l + Kil) | 0
  17043. t1h = (t1h + Kih + getCarry(t1l, Kil)) | 0
  17044. t1l = (t1l + Wil) | 0
  17045. t1h = (t1h + Wih + getCarry(t1l, Wil)) | 0
  17046. // t2 = sigma0 + maj
  17047. var t2l = (sigma0l + majl) | 0
  17048. var t2h = (sigma0h + majh + getCarry(t2l, sigma0l)) | 0
  17049. hh = gh
  17050. hl = gl
  17051. gh = fh
  17052. gl = fl
  17053. fh = eh
  17054. fl = el
  17055. el = (dl + t1l) | 0
  17056. eh = (dh + t1h + getCarry(el, dl)) | 0
  17057. dh = ch
  17058. dl = cl
  17059. ch = bh
  17060. cl = bl
  17061. bh = ah
  17062. bl = al
  17063. al = (t1l + t2l) | 0
  17064. ah = (t1h + t2h + getCarry(al, t1l)) | 0
  17065. }
  17066. this._al = (this._al + al) | 0
  17067. this._bl = (this._bl + bl) | 0
  17068. this._cl = (this._cl + cl) | 0
  17069. this._dl = (this._dl + dl) | 0
  17070. this._el = (this._el + el) | 0
  17071. this._fl = (this._fl + fl) | 0
  17072. this._gl = (this._gl + gl) | 0
  17073. this._hl = (this._hl + hl) | 0
  17074. this._ah = (this._ah + ah + getCarry(this._al, al)) | 0
  17075. this._bh = (this._bh + bh + getCarry(this._bl, bl)) | 0
  17076. this._ch = (this._ch + ch + getCarry(this._cl, cl)) | 0
  17077. this._dh = (this._dh + dh + getCarry(this._dl, dl)) | 0
  17078. this._eh = (this._eh + eh + getCarry(this._el, el)) | 0
  17079. this._fh = (this._fh + fh + getCarry(this._fl, fl)) | 0
  17080. this._gh = (this._gh + gh + getCarry(this._gl, gl)) | 0
  17081. this._hh = (this._hh + hh + getCarry(this._hl, hl)) | 0
  17082. }
  17083. Sha512.prototype._hash = function () {
  17084. var H = new Buffer(64)
  17085. function writeInt64BE (h, l, offset) {
  17086. H.writeInt32BE(h, offset)
  17087. H.writeInt32BE(l, offset + 4)
  17088. }
  17089. writeInt64BE(this._ah, this._al, 0)
  17090. writeInt64BE(this._bh, this._bl, 8)
  17091. writeInt64BE(this._ch, this._cl, 16)
  17092. writeInt64BE(this._dh, this._dl, 24)
  17093. writeInt64BE(this._eh, this._el, 32)
  17094. writeInt64BE(this._fh, this._fl, 40)
  17095. writeInt64BE(this._gh, this._gl, 48)
  17096. writeInt64BE(this._hh, this._hl, 56)
  17097. return H
  17098. }
  17099. module.exports = Sha512
  17100. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  17101. /***/ },
  17102. /* 118 */
  17103. /***/ function(module, exports, __webpack_require__) {
  17104. "use strict";
  17105. 'use strict';
  17106. Object.defineProperty(exports, "__esModule", {
  17107. value: true
  17108. });
  17109. var _vue = __webpack_require__(47);
  17110. var _vue2 = _interopRequireDefault(_vue);
  17111. var _vueRouter = __webpack_require__(303);
  17112. var _vueRouter2 = _interopRequireDefault(_vueRouter);
  17113. var _PasswordGenerator = __webpack_require__(289);
  17114. var _PasswordGenerator2 = _interopRequireDefault(_PasswordGenerator);
  17115. var _Login = __webpack_require__(288);
  17116. var _Login2 = _interopRequireDefault(_Login);
  17117. var _PasswordReset = __webpack_require__(290);
  17118. var _PasswordReset2 = _interopRequireDefault(_PasswordReset);
  17119. var _PasswordResetConfirm = __webpack_require__(291);
  17120. var _PasswordResetConfirm2 = _interopRequireDefault(_PasswordResetConfirm);
  17121. var _Passwords = __webpack_require__(292);
  17122. var _Passwords2 = _interopRequireDefault(_Passwords);
  17123. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17124. _vue2.default.use(_vueRouter2.default);
  17125. var routes = [{ path: '/', name: 'home', component: _PasswordGenerator2.default }, { path: '/login', name: 'login', component: _Login2.default }, { path: '/passwords/', name: 'passwords', component: _Passwords2.default }, { path: '/passwords/:id', name: 'password', component: _PasswordGenerator2.default }, { path: '/password/reset', name: 'passwordReset', component: _PasswordReset2.default }, { path: '/password/reset/confirm/:uid/:token', name: 'passwordResetConfirm', component: _PasswordResetConfirm2.default }];
  17126. var router = new _vueRouter2.default({
  17127. routes: routes
  17128. });
  17129. exports.default = router;
  17130. /***/ },
  17131. /* 119 */
  17132. /***/ function(module, exports, __webpack_require__) {
  17133. "use strict";
  17134. 'use strict';
  17135. Object.defineProperty(exports, "__esModule", {
  17136. value: true
  17137. });
  17138. var _assign = __webpack_require__(48);
  17139. var _assign2 = _interopRequireDefault(_assign);
  17140. var _extends2 = __webpack_require__(25);
  17141. var _extends3 = _interopRequireDefault(_extends2);
  17142. var _vue = __webpack_require__(47);
  17143. var _vue2 = _interopRequireDefault(_vue);
  17144. var _vuex = __webpack_require__(11);
  17145. var _vuex2 = _interopRequireDefault(_vuex);
  17146. var _auth = __webpack_require__(34);
  17147. var _auth2 = _interopRequireDefault(_auth);
  17148. var _http = __webpack_require__(158);
  17149. var _http2 = _interopRequireDefault(_http);
  17150. var _storage = __webpack_require__(22);
  17151. var _storage2 = _interopRequireDefault(_storage);
  17152. var _password = __webpack_require__(78);
  17153. var _password2 = _interopRequireDefault(_password);
  17154. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17155. _vue2.default.use(_vuex2.default);
  17156. var storage = new _storage2.default();
  17157. var auth = new _auth2.default(storage);
  17158. var PasswordsAPI = new _http2.default('passwords', storage);
  17159. var defaultPassword = {
  17160. id: '',
  17161. site: '',
  17162. login: '',
  17163. uppercase: true,
  17164. lowercase: true,
  17165. numbers: true,
  17166. symbols: true,
  17167. length: 12,
  17168. counter: 1
  17169. };
  17170. var state = {
  17171. authenticated: auth.isAuthenticated(),
  17172. email: '',
  17173. passwordStatus: 'CLEAN',
  17174. passwords: [],
  17175. baseURL: 'https://lesspass.com',
  17176. password: (0, _extends3.default)({}, defaultPassword)
  17177. };
  17178. var mutations = {
  17179. LOGOUT: function LOGOUT(state) {
  17180. state.authenticated = false;
  17181. },
  17182. USER_AUTHENTICATED: function USER_AUTHENTICATED(state, user) {
  17183. state.authenticated = true;
  17184. state.email = user.email;
  17185. },
  17186. SET_PASSWORDS: function SET_PASSWORDS(state, passwords) {
  17187. state.passwords = passwords;
  17188. },
  17189. SET_PASSWORD: function SET_PASSWORD(state, _ref) {
  17190. var password = _ref.password;
  17191. state.password = password;
  17192. },
  17193. DELETE_PASSWORD: function DELETE_PASSWORD(state, _ref2) {
  17194. var id = _ref2.id;
  17195. var passwords = state.passwords;
  17196. state.passwords = passwords.filter(function (password) {
  17197. return password.id !== id;
  17198. });
  17199. if (state.password.id === id) {
  17200. state.password = state.defaultPassword;
  17201. }
  17202. },
  17203. PASSWORD_CLEAN: function PASSWORD_CLEAN(state) {
  17204. setTimeout(function () {
  17205. state.passwordStatus = 'CLEAN';
  17206. }, 5000);
  17207. },
  17208. CHANGE_PASSWORD_STATUS: function CHANGE_PASSWORD_STATUS(state, status) {
  17209. state.passwordStatus = status;
  17210. },
  17211. SET_DEFAULT_PASSWORD: function SET_DEFAULT_PASSWORD(state) {
  17212. state.password = (0, _assign2.default)({}, defaultPassword);
  17213. },
  17214. UPDATE_SITE: function UPDATE_SITE(state, _ref3) {
  17215. var site = _ref3.site;
  17216. state.password.site = site;
  17217. },
  17218. UPDATE_BASE_URL: function UPDATE_BASE_URL(state, _ref4) {
  17219. var baseURL = _ref4.baseURL;
  17220. state.baseURL = baseURL;
  17221. },
  17222. UPDATE_EMAIL: function UPDATE_EMAIL(state, _ref5) {
  17223. var email = _ref5.email;
  17224. state.email = email;
  17225. }
  17226. };
  17227. var actions = {
  17228. USER_AUTHENTICATED: function USER_AUTHENTICATED(_ref6, user) {
  17229. var commit = _ref6.commit;
  17230. return commit('USER_AUTHENTICATED', user);
  17231. },
  17232. LOGOUT: function LOGOUT(_ref7) {
  17233. var commit = _ref7.commit;
  17234. auth.logout();
  17235. commit('LOGOUT');
  17236. },
  17237. SAVE_OR_UPDATE_PASSWORD: function SAVE_OR_UPDATE_PASSWORD(_ref8) {
  17238. var commit = _ref8.commit,
  17239. state = _ref8.state,
  17240. dispatch = _ref8.dispatch;
  17241. var password = new _password2.default(state.password);
  17242. if (password.isNewPassword(state.passwords)) {
  17243. PasswordsAPI.create(password.json()).then(function () {
  17244. commit('CHANGE_PASSWORD_STATUS', 'CREATED');
  17245. commit('PASSWORD_CLEAN');
  17246. dispatch('FETCH_PASSWORDS');
  17247. });
  17248. } else {
  17249. PasswordsAPI.update(password.json()).then(function () {
  17250. commit('CHANGE_PASSWORD_STATUS', 'UPDATED');
  17251. commit('PASSWORD_CLEAN');
  17252. dispatch('FETCH_PASSWORDS');
  17253. });
  17254. }
  17255. },
  17256. REFRESH_TOKEN: function REFRESH_TOKEN(_ref9) {
  17257. var commit = _ref9.commit;
  17258. if (auth.isAuthenticated()) {
  17259. auth.refreshToken().catch(function () {
  17260. commit('LOGOUT');
  17261. });
  17262. }
  17263. },
  17264. PASSWORD_CHANGE: function PASSWORD_CHANGE(_ref10, _ref11) {
  17265. var commit = _ref10.commit;
  17266. var password = _ref11.password;
  17267. commit('SET_PASSWORD', { password: password });
  17268. },
  17269. PASSWORD_GENERATED: function PASSWORD_GENERATED(_ref12) {
  17270. var commit = _ref12.commit;
  17271. commit('CHANGE_PASSWORD_STATUS', 'DIRTY');
  17272. },
  17273. FETCH_PASSWORDS: function FETCH_PASSWORDS(_ref13) {
  17274. var commit = _ref13.commit;
  17275. if (auth.isAuthenticated()) {
  17276. PasswordsAPI.all().then(function (response) {
  17277. return commit('SET_PASSWORDS', response.data.results);
  17278. });
  17279. }
  17280. },
  17281. FETCH_PASSWORD: function FETCH_PASSWORD(_ref14, _ref15) {
  17282. var commit = _ref14.commit;
  17283. var id = _ref15.id;
  17284. PasswordsAPI.get({ id: id }).then(function (response) {
  17285. return commit('SET_PASSWORD', { password: response.data });
  17286. });
  17287. },
  17288. DELETE_PASSWORD: function DELETE_PASSWORD(_ref16, _ref17) {
  17289. var commit = _ref16.commit;
  17290. var id = _ref17.id;
  17291. PasswordsAPI.remove({ id: id }).then(function () {
  17292. commit('DELETE_PASSWORD', { id: id });
  17293. });
  17294. },
  17295. LOAD_DEFAULT_PASSWORD: function LOAD_DEFAULT_PASSWORD(_ref18) {
  17296. var commit = _ref18.commit;
  17297. commit('SET_DEFAULT_PASSWORD');
  17298. }
  17299. };
  17300. var getters = {
  17301. passwords: function passwords(state) {
  17302. return state.passwords;
  17303. },
  17304. password: function password(state) {
  17305. return state.password;
  17306. },
  17307. isAuthenticated: function isAuthenticated(state) {
  17308. return state.authenticated;
  17309. },
  17310. isGuest: function isGuest(state) {
  17311. return !state.authenticated;
  17312. },
  17313. passwordStatus: function passwordStatus(state) {
  17314. return state.passwordStatus;
  17315. },
  17316. email: function email(state) {
  17317. return state.email;
  17318. }
  17319. };
  17320. exports.default = new _vuex2.default.Store({
  17321. state: (0, _assign2.default)(state, storage.json()),
  17322. getters: getters,
  17323. actions: actions,
  17324. mutations: mutations
  17325. });
  17326. /***/ },
  17327. /* 120 */
  17328. /***/ function(module, exports) {
  17329. // removed by extract-text-webpack-plugin
  17330. /***/ },
  17331. /* 121 */
  17332. 120,
  17333. /* 122 */
  17334. 120,
  17335. /* 123 */
  17336. /***/ function(module, exports, __webpack_require__) {
  17337. var __vue_exports__, __vue_options__
  17338. /* styles */
  17339. __webpack_require__(307)
  17340. /* script */
  17341. __vue_exports__ = __webpack_require__(149)
  17342. /* template */
  17343. var __vue_template__ = __webpack_require__(298)
  17344. __vue_options__ = __vue_exports__ = __vue_exports__ || {}
  17345. if (
  17346. typeof __vue_exports__.default === "object" ||
  17347. typeof __vue_exports__.default === "function"
  17348. ) {
  17349. __vue_options__ = __vue_exports__ = __vue_exports__.default
  17350. }
  17351. if (typeof __vue_options__ === "function") {
  17352. __vue_options__ = __vue_options__.options
  17353. }
  17354. __vue_options__.render = __vue_template__.render
  17355. __vue_options__.staticRenderFns = __vue_template__.staticRenderFns
  17356. module.exports = __vue_exports__
  17357. /***/ },
  17358. /* 124 */
  17359. /***/ function(module, exports, __webpack_require__) {
  17360. var asn1 = __webpack_require__(33);
  17361. var inherits = __webpack_require__(1);
  17362. var api = exports;
  17363. api.define = function define(name, body) {
  17364. return new Entity(name, body);
  17365. };
  17366. function Entity(name, body) {
  17367. this.name = name;
  17368. this.body = body;
  17369. this.decoders = {};
  17370. this.encoders = {};
  17371. };
  17372. Entity.prototype._createNamed = function createNamed(base) {
  17373. var named;
  17374. try {
  17375. named = __webpack_require__(283).runInThisContext(
  17376. '(function ' + this.name + '(entity) {\n' +
  17377. ' this._initNamed(entity);\n' +
  17378. '})'
  17379. );
  17380. } catch (e) {
  17381. named = function (entity) {
  17382. this._initNamed(entity);
  17383. };
  17384. }
  17385. inherits(named, base);
  17386. named.prototype._initNamed = function initnamed(entity) {
  17387. base.call(this, entity);
  17388. };
  17389. return new named(this);
  17390. };
  17391. Entity.prototype._getDecoder = function _getDecoder(enc) {
  17392. enc = enc || 'der';
  17393. // Lazily create decoder
  17394. if (!this.decoders.hasOwnProperty(enc))
  17395. this.decoders[enc] = this._createNamed(asn1.decoders[enc]);
  17396. return this.decoders[enc];
  17397. };
  17398. Entity.prototype.decode = function decode(data, enc, options) {
  17399. return this._getDecoder(enc).decode(data, options);
  17400. };
  17401. Entity.prototype._getEncoder = function _getEncoder(enc) {
  17402. enc = enc || 'der';
  17403. // Lazily create encoder
  17404. if (!this.encoders.hasOwnProperty(enc))
  17405. this.encoders[enc] = this._createNamed(asn1.encoders[enc]);
  17406. return this.encoders[enc];
  17407. };
  17408. Entity.prototype.encode = function encode(data, enc, /* internal */ reporter) {
  17409. return this._getEncoder(enc).encode(data, reporter);
  17410. };
  17411. /***/ },
  17412. /* 125 */
  17413. /***/ function(module, exports, __webpack_require__) {
  17414. var Reporter = __webpack_require__(21).Reporter;
  17415. var EncoderBuffer = __webpack_require__(21).EncoderBuffer;
  17416. var DecoderBuffer = __webpack_require__(21).DecoderBuffer;
  17417. var assert = __webpack_require__(30);
  17418. // Supported tags
  17419. var tags = [
  17420. 'seq', 'seqof', 'set', 'setof', 'objid', 'bool',
  17421. 'gentime', 'utctime', 'null_', 'enum', 'int',
  17422. 'bitstr', 'bmpstr', 'charstr', 'genstr', 'graphstr', 'ia5str', 'iso646str',
  17423. 'numstr', 'octstr', 'printstr', 't61str', 'unistr', 'utf8str', 'videostr'
  17424. ];
  17425. // Public methods list
  17426. var methods = [
  17427. 'key', 'obj', 'use', 'optional', 'explicit', 'implicit', 'def', 'choice',
  17428. 'any', 'contains'
  17429. ].concat(tags);
  17430. // Overrided methods list
  17431. var overrided = [
  17432. '_peekTag', '_decodeTag', '_use',
  17433. '_decodeStr', '_decodeObjid', '_decodeTime',
  17434. '_decodeNull', '_decodeInt', '_decodeBool', '_decodeList',
  17435. '_encodeComposite', '_encodeStr', '_encodeObjid', '_encodeTime',
  17436. '_encodeNull', '_encodeInt', '_encodeBool'
  17437. ];
  17438. function Node(enc, parent) {
  17439. var state = {};
  17440. this._baseState = state;
  17441. state.enc = enc;
  17442. state.parent = parent || null;
  17443. state.children = null;
  17444. // State
  17445. state.tag = null;
  17446. state.args = null;
  17447. state.reverseArgs = null;
  17448. state.choice = null;
  17449. state.optional = false;
  17450. state.any = false;
  17451. state.obj = false;
  17452. state.use = null;
  17453. state.useDecoder = null;
  17454. state.key = null;
  17455. state['default'] = null;
  17456. state.explicit = null;
  17457. state.implicit = null;
  17458. state.contains = null;
  17459. // Should create new instance on each method
  17460. if (!state.parent) {
  17461. state.children = [];
  17462. this._wrap();
  17463. }
  17464. }
  17465. module.exports = Node;
  17466. var stateProps = [
  17467. 'enc', 'parent', 'children', 'tag', 'args', 'reverseArgs', 'choice',
  17468. 'optional', 'any', 'obj', 'use', 'alteredUse', 'key', 'default', 'explicit',
  17469. 'implicit', 'contains'
  17470. ];
  17471. Node.prototype.clone = function clone() {
  17472. var state = this._baseState;
  17473. var cstate = {};
  17474. stateProps.forEach(function(prop) {
  17475. cstate[prop] = state[prop];
  17476. });
  17477. var res = new this.constructor(cstate.parent);
  17478. res._baseState = cstate;
  17479. return res;
  17480. };
  17481. Node.prototype._wrap = function wrap() {
  17482. var state = this._baseState;
  17483. methods.forEach(function(method) {
  17484. this[method] = function _wrappedMethod() {
  17485. var clone = new this.constructor(this);
  17486. state.children.push(clone);
  17487. return clone[method].apply(clone, arguments);
  17488. };
  17489. }, this);
  17490. };
  17491. Node.prototype._init = function init(body) {
  17492. var state = this._baseState;
  17493. assert(state.parent === null);
  17494. body.call(this);
  17495. // Filter children
  17496. state.children = state.children.filter(function(child) {
  17497. return child._baseState.parent === this;
  17498. }, this);
  17499. assert.equal(state.children.length, 1, 'Root node can have only one child');
  17500. };
  17501. Node.prototype._useArgs = function useArgs(args) {
  17502. var state = this._baseState;
  17503. // Filter children and args
  17504. var children = args.filter(function(arg) {
  17505. return arg instanceof this.constructor;
  17506. }, this);
  17507. args = args.filter(function(arg) {
  17508. return !(arg instanceof this.constructor);
  17509. }, this);
  17510. if (children.length !== 0) {
  17511. assert(state.children === null);
  17512. state.children = children;
  17513. // Replace parent to maintain backward link
  17514. children.forEach(function(child) {
  17515. child._baseState.parent = this;
  17516. }, this);
  17517. }
  17518. if (args.length !== 0) {
  17519. assert(state.args === null);
  17520. state.args = args;
  17521. state.reverseArgs = args.map(function(arg) {
  17522. if (typeof arg !== 'object' || arg.constructor !== Object)
  17523. return arg;
  17524. var res = {};
  17525. Object.keys(arg).forEach(function(key) {
  17526. if (key == (key | 0))
  17527. key |= 0;
  17528. var value = arg[key];
  17529. res[value] = key;
  17530. });
  17531. return res;
  17532. });
  17533. }
  17534. };
  17535. //
  17536. // Overrided methods
  17537. //
  17538. overrided.forEach(function(method) {
  17539. Node.prototype[method] = function _overrided() {
  17540. var state = this._baseState;
  17541. throw new Error(method + ' not implemented for encoding: ' + state.enc);
  17542. };
  17543. });
  17544. //
  17545. // Public methods
  17546. //
  17547. tags.forEach(function(tag) {
  17548. Node.prototype[tag] = function _tagMethod() {
  17549. var state = this._baseState;
  17550. var args = Array.prototype.slice.call(arguments);
  17551. assert(state.tag === null);
  17552. state.tag = tag;
  17553. this._useArgs(args);
  17554. return this;
  17555. };
  17556. });
  17557. Node.prototype.use = function use(item) {
  17558. var state = this._baseState;
  17559. assert(state.use === null);
  17560. state.use = item;
  17561. return this;
  17562. };
  17563. Node.prototype.optional = function optional() {
  17564. var state = this._baseState;
  17565. state.optional = true;
  17566. return this;
  17567. };
  17568. Node.prototype.def = function def(val) {
  17569. var state = this._baseState;
  17570. assert(state['default'] === null);
  17571. state['default'] = val;
  17572. state.optional = true;
  17573. return this;
  17574. };
  17575. Node.prototype.explicit = function explicit(num) {
  17576. var state = this._baseState;
  17577. assert(state.explicit === null && state.implicit === null);
  17578. state.explicit = num;
  17579. return this;
  17580. };
  17581. Node.prototype.implicit = function implicit(num) {
  17582. var state = this._baseState;
  17583. assert(state.explicit === null && state.implicit === null);
  17584. state.implicit = num;
  17585. return this;
  17586. };
  17587. Node.prototype.obj = function obj() {
  17588. var state = this._baseState;
  17589. var args = Array.prototype.slice.call(arguments);
  17590. state.obj = true;
  17591. if (args.length !== 0)
  17592. this._useArgs(args);
  17593. return this;
  17594. };
  17595. Node.prototype.key = function key(newKey) {
  17596. var state = this._baseState;
  17597. assert(state.key === null);
  17598. state.key = newKey;
  17599. return this;
  17600. };
  17601. Node.prototype.any = function any() {
  17602. var state = this._baseState;
  17603. state.any = true;
  17604. return this;
  17605. };
  17606. Node.prototype.choice = function choice(obj) {
  17607. var state = this._baseState;
  17608. assert(state.choice === null);
  17609. state.choice = obj;
  17610. this._useArgs(Object.keys(obj).map(function(key) {
  17611. return obj[key];
  17612. }));
  17613. return this;
  17614. };
  17615. Node.prototype.contains = function contains(item) {
  17616. var state = this._baseState;
  17617. assert(state.use === null);
  17618. state.contains = item;
  17619. return this;
  17620. };
  17621. //
  17622. // Decoding
  17623. //
  17624. Node.prototype._decode = function decode(input, options) {
  17625. var state = this._baseState;
  17626. // Decode root node
  17627. if (state.parent === null)
  17628. return input.wrapResult(state.children[0]._decode(input, options));
  17629. var result = state['default'];
  17630. var present = true;
  17631. var prevKey = null;
  17632. if (state.key !== null)
  17633. prevKey = input.enterKey(state.key);
  17634. // Check if tag is there
  17635. if (state.optional) {
  17636. var tag = null;
  17637. if (state.explicit !== null)
  17638. tag = state.explicit;
  17639. else if (state.implicit !== null)
  17640. tag = state.implicit;
  17641. else if (state.tag !== null)
  17642. tag = state.tag;
  17643. if (tag === null && !state.any) {
  17644. // Trial and Error
  17645. var save = input.save();
  17646. try {
  17647. if (state.choice === null)
  17648. this._decodeGeneric(state.tag, input, options);
  17649. else
  17650. this._decodeChoice(input, options);
  17651. present = true;
  17652. } catch (e) {
  17653. present = false;
  17654. }
  17655. input.restore(save);
  17656. } else {
  17657. present = this._peekTag(input, tag, state.any);
  17658. if (input.isError(present))
  17659. return present;
  17660. }
  17661. }
  17662. // Push object on stack
  17663. var prevObj;
  17664. if (state.obj && present)
  17665. prevObj = input.enterObject();
  17666. if (present) {
  17667. // Unwrap explicit values
  17668. if (state.explicit !== null) {
  17669. var explicit = this._decodeTag(input, state.explicit);
  17670. if (input.isError(explicit))
  17671. return explicit;
  17672. input = explicit;
  17673. }
  17674. var start = input.offset;
  17675. // Unwrap implicit and normal values
  17676. if (state.use === null && state.choice === null) {
  17677. if (state.any)
  17678. var save = input.save();
  17679. var body = this._decodeTag(
  17680. input,
  17681. state.implicit !== null ? state.implicit : state.tag,
  17682. state.any
  17683. );
  17684. if (input.isError(body))
  17685. return body;
  17686. if (state.any)
  17687. result = input.raw(save);
  17688. else
  17689. input = body;
  17690. }
  17691. if (options && options.track && state.tag !== null)
  17692. options.track(input.path(), start, input.length, 'tagged');
  17693. if (options && options.track && state.tag !== null)
  17694. options.track(input.path(), input.offset, input.length, 'content');
  17695. // Select proper method for tag
  17696. if (state.any)
  17697. result = result;
  17698. else if (state.choice === null)
  17699. result = this._decodeGeneric(state.tag, input, options);
  17700. else
  17701. result = this._decodeChoice(input, options);
  17702. if (input.isError(result))
  17703. return result;
  17704. // Decode children
  17705. if (!state.any && state.choice === null && state.children !== null) {
  17706. state.children.forEach(function decodeChildren(child) {
  17707. // NOTE: We are ignoring errors here, to let parser continue with other
  17708. // parts of encoded data
  17709. child._decode(input, options);
  17710. });
  17711. }
  17712. // Decode contained/encoded by schema, only in bit or octet strings
  17713. if (state.contains && (state.tag === 'octstr' || state.tag === 'bitstr')) {
  17714. var data = new DecoderBuffer(result);
  17715. result = this._getUse(state.contains, input._reporterState.obj)
  17716. ._decode(data, options);
  17717. }
  17718. }
  17719. // Pop object
  17720. if (state.obj && present)
  17721. result = input.leaveObject(prevObj);
  17722. // Set key
  17723. if (state.key !== null && (result !== null || present === true))
  17724. input.leaveKey(prevKey, state.key, result);
  17725. else if (prevKey !== null)
  17726. input.exitKey(prevKey);
  17727. return result;
  17728. };
  17729. Node.prototype._decodeGeneric = function decodeGeneric(tag, input, options) {
  17730. var state = this._baseState;
  17731. if (tag === 'seq' || tag === 'set')
  17732. return null;
  17733. if (tag === 'seqof' || tag === 'setof')
  17734. return this._decodeList(input, tag, state.args[0], options);
  17735. else if (/str$/.test(tag))
  17736. return this._decodeStr(input, tag, options);
  17737. else if (tag === 'objid' && state.args)
  17738. return this._decodeObjid(input, state.args[0], state.args[1], options);
  17739. else if (tag === 'objid')
  17740. return this._decodeObjid(input, null, null, options);
  17741. else if (tag === 'gentime' || tag === 'utctime')
  17742. return this._decodeTime(input, tag, options);
  17743. else if (tag === 'null_')
  17744. return this._decodeNull(input, options);
  17745. else if (tag === 'bool')
  17746. return this._decodeBool(input, options);
  17747. else if (tag === 'int' || tag === 'enum')
  17748. return this._decodeInt(input, state.args && state.args[0], options);
  17749. if (state.use !== null) {
  17750. return this._getUse(state.use, input._reporterState.obj)
  17751. ._decode(input, options);
  17752. } else {
  17753. return input.error('unknown tag: ' + tag);
  17754. }
  17755. };
  17756. Node.prototype._getUse = function _getUse(entity, obj) {
  17757. var state = this._baseState;
  17758. // Create altered use decoder if implicit is set
  17759. state.useDecoder = this._use(entity, obj);
  17760. assert(state.useDecoder._baseState.parent === null);
  17761. state.useDecoder = state.useDecoder._baseState.children[0];
  17762. if (state.implicit !== state.useDecoder._baseState.implicit) {
  17763. state.useDecoder = state.useDecoder.clone();
  17764. state.useDecoder._baseState.implicit = state.implicit;
  17765. }
  17766. return state.useDecoder;
  17767. };
  17768. Node.prototype._decodeChoice = function decodeChoice(input, options) {
  17769. var state = this._baseState;
  17770. var result = null;
  17771. var match = false;
  17772. Object.keys(state.choice).some(function(key) {
  17773. var save = input.save();
  17774. var node = state.choice[key];
  17775. try {
  17776. var value = node._decode(input, options);
  17777. if (input.isError(value))
  17778. return false;
  17779. result = { type: key, value: value };
  17780. match = true;
  17781. } catch (e) {
  17782. input.restore(save);
  17783. return false;
  17784. }
  17785. return true;
  17786. }, this);
  17787. if (!match)
  17788. return input.error('Choice not matched');
  17789. return result;
  17790. };
  17791. //
  17792. // Encoding
  17793. //
  17794. Node.prototype._createEncoderBuffer = function createEncoderBuffer(data) {
  17795. return new EncoderBuffer(data, this.reporter);
  17796. };
  17797. Node.prototype._encode = function encode(data, reporter, parent) {
  17798. var state = this._baseState;
  17799. if (state['default'] !== null && state['default'] === data)
  17800. return;
  17801. var result = this._encodeValue(data, reporter, parent);
  17802. if (result === undefined)
  17803. return;
  17804. if (this._skipDefault(result, reporter, parent))
  17805. return;
  17806. return result;
  17807. };
  17808. Node.prototype._encodeValue = function encode(data, reporter, parent) {
  17809. var state = this._baseState;
  17810. // Decode root node
  17811. if (state.parent === null)
  17812. return state.children[0]._encode(data, reporter || new Reporter());
  17813. var result = null;
  17814. // Set reporter to share it with a child class
  17815. this.reporter = reporter;
  17816. // Check if data is there
  17817. if (state.optional && data === undefined) {
  17818. if (state['default'] !== null)
  17819. data = state['default']
  17820. else
  17821. return;
  17822. }
  17823. // Encode children first
  17824. var content = null;
  17825. var primitive = false;
  17826. if (state.any) {
  17827. // Anything that was given is translated to buffer
  17828. result = this._createEncoderBuffer(data);
  17829. } else if (state.choice) {
  17830. result = this._encodeChoice(data, reporter);
  17831. } else if (state.contains) {
  17832. content = this._getUse(state.contains, parent)._encode(data, reporter);
  17833. primitive = true;
  17834. } else if (state.children) {
  17835. content = state.children.map(function(child) {
  17836. if (child._baseState.tag === 'null_')
  17837. return child._encode(null, reporter, data);
  17838. if (child._baseState.key === null)
  17839. return reporter.error('Child should have a key');
  17840. var prevKey = reporter.enterKey(child._baseState.key);
  17841. if (typeof data !== 'object')
  17842. return reporter.error('Child expected, but input is not object');
  17843. var res = child._encode(data[child._baseState.key], reporter, data);
  17844. reporter.leaveKey(prevKey);
  17845. return res;
  17846. }, this).filter(function(child) {
  17847. return child;
  17848. });
  17849. content = this._createEncoderBuffer(content);
  17850. } else {
  17851. if (state.tag === 'seqof' || state.tag === 'setof') {
  17852. // TODO(indutny): this should be thrown on DSL level
  17853. if (!(state.args && state.args.length === 1))
  17854. return reporter.error('Too many args for : ' + state.tag);
  17855. if (!Array.isArray(data))
  17856. return reporter.error('seqof/setof, but data is not Array');
  17857. var child = this.clone();
  17858. child._baseState.implicit = null;
  17859. content = this._createEncoderBuffer(data.map(function(item) {
  17860. var state = this._baseState;
  17861. return this._getUse(state.args[0], data)._encode(item, reporter);
  17862. }, child));
  17863. } else if (state.use !== null) {
  17864. result = this._getUse(state.use, parent)._encode(data, reporter);
  17865. } else {
  17866. content = this._encodePrimitive(state.tag, data);
  17867. primitive = true;
  17868. }
  17869. }
  17870. // Encode data itself
  17871. var result;
  17872. if (!state.any && state.choice === null) {
  17873. var tag = state.implicit !== null ? state.implicit : state.tag;
  17874. var cls = state.implicit === null ? 'universal' : 'context';
  17875. if (tag === null) {
  17876. if (state.use === null)
  17877. reporter.error('Tag could be ommited only for .use()');
  17878. } else {
  17879. if (state.use === null)
  17880. result = this._encodeComposite(tag, primitive, cls, content);
  17881. }
  17882. }
  17883. // Wrap in explicit
  17884. if (state.explicit !== null)
  17885. result = this._encodeComposite(state.explicit, false, 'context', result);
  17886. return result;
  17887. };
  17888. Node.prototype._encodeChoice = function encodeChoice(data, reporter) {
  17889. var state = this._baseState;
  17890. var node = state.choice[data.type];
  17891. if (!node) {
  17892. assert(
  17893. false,
  17894. data.type + ' not found in ' +
  17895. JSON.stringify(Object.keys(state.choice)));
  17896. }
  17897. return node._encode(data.value, reporter);
  17898. };
  17899. Node.prototype._encodePrimitive = function encodePrimitive(tag, data) {
  17900. var state = this._baseState;
  17901. if (/str$/.test(tag))
  17902. return this._encodeStr(data, tag);
  17903. else if (tag === 'objid' && state.args)
  17904. return this._encodeObjid(data, state.reverseArgs[0], state.args[1]);
  17905. else if (tag === 'objid')
  17906. return this._encodeObjid(data, null, null);
  17907. else if (tag === 'gentime' || tag === 'utctime')
  17908. return this._encodeTime(data, tag);
  17909. else if (tag === 'null_')
  17910. return this._encodeNull();
  17911. else if (tag === 'int' || tag === 'enum')
  17912. return this._encodeInt(data, state.args && state.reverseArgs[0]);
  17913. else if (tag === 'bool')
  17914. return this._encodeBool(data);
  17915. else
  17916. throw new Error('Unsupported tag: ' + tag);
  17917. };
  17918. Node.prototype._isNumstr = function isNumstr(str) {
  17919. return /^[0-9 ]*$/.test(str);
  17920. };
  17921. Node.prototype._isPrintstr = function isPrintstr(str) {
  17922. return /^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(str);
  17923. };
  17924. /***/ },
  17925. /* 126 */
  17926. /***/ function(module, exports, __webpack_require__) {
  17927. var inherits = __webpack_require__(1);
  17928. function Reporter(options) {
  17929. this._reporterState = {
  17930. obj: null,
  17931. path: [],
  17932. options: options || {},
  17933. errors: []
  17934. };
  17935. }
  17936. exports.Reporter = Reporter;
  17937. Reporter.prototype.isError = function isError(obj) {
  17938. return obj instanceof ReporterError;
  17939. };
  17940. Reporter.prototype.save = function save() {
  17941. var state = this._reporterState;
  17942. return { obj: state.obj, pathLen: state.path.length };
  17943. };
  17944. Reporter.prototype.restore = function restore(data) {
  17945. var state = this._reporterState;
  17946. state.obj = data.obj;
  17947. state.path = state.path.slice(0, data.pathLen);
  17948. };
  17949. Reporter.prototype.enterKey = function enterKey(key) {
  17950. return this._reporterState.path.push(key);
  17951. };
  17952. Reporter.prototype.exitKey = function exitKey(index) {
  17953. var state = this._reporterState;
  17954. state.path = state.path.slice(0, index - 1);
  17955. };
  17956. Reporter.prototype.leaveKey = function leaveKey(index, key, value) {
  17957. var state = this._reporterState;
  17958. this.exitKey(index);
  17959. if (state.obj !== null)
  17960. state.obj[key] = value;
  17961. };
  17962. Reporter.prototype.path = function path() {
  17963. return this._reporterState.path.join('/');
  17964. };
  17965. Reporter.prototype.enterObject = function enterObject() {
  17966. var state = this._reporterState;
  17967. var prev = state.obj;
  17968. state.obj = {};
  17969. return prev;
  17970. };
  17971. Reporter.prototype.leaveObject = function leaveObject(prev) {
  17972. var state = this._reporterState;
  17973. var now = state.obj;
  17974. state.obj = prev;
  17975. return now;
  17976. };
  17977. Reporter.prototype.error = function error(msg) {
  17978. var err;
  17979. var state = this._reporterState;
  17980. var inherited = msg instanceof ReporterError;
  17981. if (inherited) {
  17982. err = msg;
  17983. } else {
  17984. err = new ReporterError(state.path.map(function(elem) {
  17985. return '[' + JSON.stringify(elem) + ']';
  17986. }).join(''), msg.message || msg, msg.stack);
  17987. }
  17988. if (!state.options.partial)
  17989. throw err;
  17990. if (!inherited)
  17991. state.errors.push(err);
  17992. return err;
  17993. };
  17994. Reporter.prototype.wrapResult = function wrapResult(result) {
  17995. var state = this._reporterState;
  17996. if (!state.options.partial)
  17997. return result;
  17998. return {
  17999. result: this.isError(result) ? null : result,
  18000. errors: state.errors
  18001. };
  18002. };
  18003. function ReporterError(path, msg) {
  18004. this.path = path;
  18005. this.rethrow(msg);
  18006. };
  18007. inherits(ReporterError, Error);
  18008. ReporterError.prototype.rethrow = function rethrow(msg) {
  18009. this.message = msg + ' at: ' + (this.path || '(shallow)');
  18010. if (Error.captureStackTrace)
  18011. Error.captureStackTrace(this, ReporterError);
  18012. if (!this.stack) {
  18013. try {
  18014. // IE only adds stack when thrown
  18015. throw new Error(this.message);
  18016. } catch (e) {
  18017. this.stack = e.stack;
  18018. }
  18019. }
  18020. return this;
  18021. };
  18022. /***/ },
  18023. /* 127 */
  18024. /***/ function(module, exports, __webpack_require__) {
  18025. var constants = __webpack_require__(68);
  18026. exports.tagClass = {
  18027. 0: 'universal',
  18028. 1: 'application',
  18029. 2: 'context',
  18030. 3: 'private'
  18031. };
  18032. exports.tagClassByName = constants._reverse(exports.tagClass);
  18033. exports.tag = {
  18034. 0x00: 'end',
  18035. 0x01: 'bool',
  18036. 0x02: 'int',
  18037. 0x03: 'bitstr',
  18038. 0x04: 'octstr',
  18039. 0x05: 'null_',
  18040. 0x06: 'objid',
  18041. 0x07: 'objDesc',
  18042. 0x08: 'external',
  18043. 0x09: 'real',
  18044. 0x0a: 'enum',
  18045. 0x0b: 'embed',
  18046. 0x0c: 'utf8str',
  18047. 0x0d: 'relativeOid',
  18048. 0x10: 'seq',
  18049. 0x11: 'set',
  18050. 0x12: 'numstr',
  18051. 0x13: 'printstr',
  18052. 0x14: 't61str',
  18053. 0x15: 'videostr',
  18054. 0x16: 'ia5str',
  18055. 0x17: 'utctime',
  18056. 0x18: 'gentime',
  18057. 0x19: 'graphstr',
  18058. 0x1a: 'iso646str',
  18059. 0x1b: 'genstr',
  18060. 0x1c: 'unistr',
  18061. 0x1d: 'charstr',
  18062. 0x1e: 'bmpstr'
  18063. };
  18064. exports.tagByName = constants._reverse(exports.tag);
  18065. /***/ },
  18066. /* 128 */
  18067. /***/ function(module, exports, __webpack_require__) {
  18068. var decoders = exports;
  18069. decoders.der = __webpack_require__(69);
  18070. decoders.pem = __webpack_require__(129);
  18071. /***/ },
  18072. /* 129 */
  18073. /***/ function(module, exports, __webpack_require__) {
  18074. var inherits = __webpack_require__(1);
  18075. var Buffer = __webpack_require__(0).Buffer;
  18076. var DERDecoder = __webpack_require__(69);
  18077. function PEMDecoder(entity) {
  18078. DERDecoder.call(this, entity);
  18079. this.enc = 'pem';
  18080. };
  18081. inherits(PEMDecoder, DERDecoder);
  18082. module.exports = PEMDecoder;
  18083. PEMDecoder.prototype.decode = function decode(data, options) {
  18084. var lines = data.toString().split(/[\r\n]+/g);
  18085. var label = options.label.toUpperCase();
  18086. var re = /^-----(BEGIN|END) ([^-]+)-----$/;
  18087. var start = -1;
  18088. var end = -1;
  18089. for (var i = 0; i < lines.length; i++) {
  18090. var match = lines[i].match(re);
  18091. if (match === null)
  18092. continue;
  18093. if (match[2] !== label)
  18094. continue;
  18095. if (start === -1) {
  18096. if (match[1] !== 'BEGIN')
  18097. break;
  18098. start = i;
  18099. } else {
  18100. if (match[1] !== 'END')
  18101. break;
  18102. end = i;
  18103. break;
  18104. }
  18105. }
  18106. if (start === -1 || end === -1)
  18107. throw new Error('PEM section not found for: ' + label);
  18108. var base64 = lines.slice(start + 1, end).join('');
  18109. // Remove excessive symbols
  18110. base64.replace(/[^a-z0-9\+\/=]+/gi, '');
  18111. var input = new Buffer(base64, 'base64');
  18112. return DERDecoder.prototype.decode.call(this, input, options);
  18113. };
  18114. /***/ },
  18115. /* 130 */
  18116. /***/ function(module, exports, __webpack_require__) {
  18117. var encoders = exports;
  18118. encoders.der = __webpack_require__(70);
  18119. encoders.pem = __webpack_require__(131);
  18120. /***/ },
  18121. /* 131 */
  18122. /***/ function(module, exports, __webpack_require__) {
  18123. var inherits = __webpack_require__(1);
  18124. var DEREncoder = __webpack_require__(70);
  18125. function PEMEncoder(entity) {
  18126. DEREncoder.call(this, entity);
  18127. this.enc = 'pem';
  18128. };
  18129. inherits(PEMEncoder, DEREncoder);
  18130. module.exports = PEMEncoder;
  18131. PEMEncoder.prototype.encode = function encode(data, options) {
  18132. var buf = DEREncoder.prototype.encode.call(this, data);
  18133. var p = buf.toString('base64');
  18134. var out = [ '-----BEGIN ' + options.label + '-----' ];
  18135. for (var i = 0; i < p.length; i += 64)
  18136. out.push(p.slice(i, i + 64));
  18137. out.push('-----END ' + options.label + '-----');
  18138. return out.join('\n');
  18139. };
  18140. /***/ },
  18141. /* 132 */
  18142. /***/ function(module, exports, __webpack_require__) {
  18143. "use strict";
  18144. 'use strict';
  18145. var utils = __webpack_require__(4);
  18146. var bind = __webpack_require__(77);
  18147. var Axios = __webpack_require__(134);
  18148. /**
  18149. * Create an instance of Axios
  18150. *
  18151. * @param {Object} defaultConfig The default config for the instance
  18152. * @return {Axios} A new instance of Axios
  18153. */
  18154. function createInstance(defaultConfig) {
  18155. var context = new Axios(defaultConfig);
  18156. var instance = bind(Axios.prototype.request, context);
  18157. // Copy axios.prototype to instance
  18158. utils.extend(instance, Axios.prototype, context);
  18159. // Copy context to instance
  18160. utils.extend(instance, context);
  18161. return instance;
  18162. }
  18163. // Create the default instance to be exported
  18164. var axios = createInstance();
  18165. // Expose Axios class to allow class inheritance
  18166. axios.Axios = Axios;
  18167. // Factory for creating new instances
  18168. axios.create = function create(defaultConfig) {
  18169. return createInstance(defaultConfig);
  18170. };
  18171. // Expose Cancel & CancelToken
  18172. axios.Cancel = __webpack_require__(73);
  18173. axios.CancelToken = __webpack_require__(133);
  18174. axios.isCancel = __webpack_require__(74);
  18175. // Expose all/spread
  18176. axios.all = function all(promises) {
  18177. return Promise.all(promises);
  18178. };
  18179. axios.spread = __webpack_require__(148);
  18180. module.exports = axios;
  18181. // Allow use of default import syntax in TypeScript
  18182. module.exports.default = axios;
  18183. /***/ },
  18184. /* 133 */
  18185. /***/ function(module, exports, __webpack_require__) {
  18186. "use strict";
  18187. 'use strict';
  18188. var Cancel = __webpack_require__(73);
  18189. /**
  18190. * A `CancelToken` is an object that can be used to request cancellation of an operation.
  18191. *
  18192. * @class
  18193. * @param {Function} executor The executor function.
  18194. */
  18195. function CancelToken(executor) {
  18196. if (typeof executor !== 'function') {
  18197. throw new TypeError('executor must be a function.');
  18198. }
  18199. var resolvePromise;
  18200. this.promise = new Promise(function promiseExecutor(resolve) {
  18201. resolvePromise = resolve;
  18202. });
  18203. var token = this;
  18204. executor(function cancel(message) {
  18205. if (token.reason) {
  18206. // Cancellation has already been requested
  18207. return;
  18208. }
  18209. token.reason = new Cancel(message);
  18210. resolvePromise(token.reason);
  18211. });
  18212. }
  18213. /**
  18214. * Throws a `Cancel` if cancellation has been requested.
  18215. */
  18216. CancelToken.prototype.throwIfRequested = function throwIfRequested() {
  18217. if (this.reason) {
  18218. throw this.reason;
  18219. }
  18220. };
  18221. /**
  18222. * Returns an object that contains a new `CancelToken` and a function that, when called,
  18223. * cancels the `CancelToken`.
  18224. */
  18225. CancelToken.source = function source() {
  18226. var cancel;
  18227. var token = new CancelToken(function executor(c) {
  18228. cancel = c;
  18229. });
  18230. return {
  18231. token: token,
  18232. cancel: cancel
  18233. };
  18234. };
  18235. module.exports = CancelToken;
  18236. /***/ },
  18237. /* 134 */
  18238. /***/ function(module, exports, __webpack_require__) {
  18239. "use strict";
  18240. 'use strict';
  18241. var defaults = __webpack_require__(76);
  18242. var utils = __webpack_require__(4);
  18243. var InterceptorManager = __webpack_require__(135);
  18244. var dispatchRequest = __webpack_require__(136);
  18245. var isAbsoluteURL = __webpack_require__(144);
  18246. var combineURLs = __webpack_require__(142);
  18247. /**
  18248. * Create a new instance of Axios
  18249. *
  18250. * @param {Object} defaultConfig The default config for the instance
  18251. */
  18252. function Axios(defaultConfig) {
  18253. this.defaults = utils.merge(defaults, defaultConfig);
  18254. this.interceptors = {
  18255. request: new InterceptorManager(),
  18256. response: new InterceptorManager()
  18257. };
  18258. }
  18259. /**
  18260. * Dispatch a request
  18261. *
  18262. * @param {Object} config The config specific for this request (merged with this.defaults)
  18263. */
  18264. Axios.prototype.request = function request(config) {
  18265. /*eslint no-param-reassign:0*/
  18266. // Allow for axios('example/url'[, config]) a la fetch API
  18267. if (typeof config === 'string') {
  18268. config = utils.merge({
  18269. url: arguments[0]
  18270. }, arguments[1]);
  18271. }
  18272. config = utils.merge(defaults, this.defaults, { method: 'get' }, config);
  18273. // Support baseURL config
  18274. if (config.baseURL && !isAbsoluteURL(config.url)) {
  18275. config.url = combineURLs(config.baseURL, config.url);
  18276. }
  18277. // Hook up interceptors middleware
  18278. var chain = [dispatchRequest, undefined];
  18279. var promise = Promise.resolve(config);
  18280. this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {
  18281. chain.unshift(interceptor.fulfilled, interceptor.rejected);
  18282. });
  18283. this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {
  18284. chain.push(interceptor.fulfilled, interceptor.rejected);
  18285. });
  18286. while (chain.length) {
  18287. promise = promise.then(chain.shift(), chain.shift());
  18288. }
  18289. return promise;
  18290. };
  18291. // Provide aliases for supported request methods
  18292. utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
  18293. /*eslint func-names:0*/
  18294. Axios.prototype[method] = function(url, config) {
  18295. return this.request(utils.merge(config || {}, {
  18296. method: method,
  18297. url: url
  18298. }));
  18299. };
  18300. });
  18301. utils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {
  18302. /*eslint func-names:0*/
  18303. Axios.prototype[method] = function(url, data, config) {
  18304. return this.request(utils.merge(config || {}, {
  18305. method: method,
  18306. url: url,
  18307. data: data
  18308. }));
  18309. };
  18310. });
  18311. module.exports = Axios;
  18312. /***/ },
  18313. /* 135 */
  18314. /***/ function(module, exports, __webpack_require__) {
  18315. "use strict";
  18316. 'use strict';
  18317. var utils = __webpack_require__(4);
  18318. function InterceptorManager() {
  18319. this.handlers = [];
  18320. }
  18321. /**
  18322. * Add a new interceptor to the stack
  18323. *
  18324. * @param {Function} fulfilled The function to handle `then` for a `Promise`
  18325. * @param {Function} rejected The function to handle `reject` for a `Promise`
  18326. *
  18327. * @return {Number} An ID used to remove interceptor later
  18328. */
  18329. InterceptorManager.prototype.use = function use(fulfilled, rejected) {
  18330. this.handlers.push({
  18331. fulfilled: fulfilled,
  18332. rejected: rejected
  18333. });
  18334. return this.handlers.length - 1;
  18335. };
  18336. /**
  18337. * Remove an interceptor from the stack
  18338. *
  18339. * @param {Number} id The ID that was returned by `use`
  18340. */
  18341. InterceptorManager.prototype.eject = function eject(id) {
  18342. if (this.handlers[id]) {
  18343. this.handlers[id] = null;
  18344. }
  18345. };
  18346. /**
  18347. * Iterate over all the registered interceptors
  18348. *
  18349. * This method is particularly useful for skipping over any
  18350. * interceptors that may have become `null` calling `eject`.
  18351. *
  18352. * @param {Function} fn The function to call for each interceptor
  18353. */
  18354. InterceptorManager.prototype.forEach = function forEach(fn) {
  18355. utils.forEach(this.handlers, function forEachHandler(h) {
  18356. if (h !== null) {
  18357. fn(h);
  18358. }
  18359. });
  18360. };
  18361. module.exports = InterceptorManager;
  18362. /***/ },
  18363. /* 136 */
  18364. /***/ function(module, exports, __webpack_require__) {
  18365. "use strict";
  18366. 'use strict';
  18367. var utils = __webpack_require__(4);
  18368. var transformData = __webpack_require__(139);
  18369. var isCancel = __webpack_require__(74);
  18370. var defaults = __webpack_require__(76);
  18371. /**
  18372. * Throws a `Cancel` if cancellation has been requested.
  18373. */
  18374. function throwIfCancellationRequested(config) {
  18375. if (config.cancelToken) {
  18376. config.cancelToken.throwIfRequested();
  18377. }
  18378. }
  18379. /**
  18380. * Dispatch a request to the server using the configured adapter.
  18381. *
  18382. * @param {object} config The config that is to be used for the request
  18383. * @returns {Promise} The Promise to be fulfilled
  18384. */
  18385. module.exports = function dispatchRequest(config) {
  18386. throwIfCancellationRequested(config);
  18387. // Ensure headers exist
  18388. config.headers = config.headers || {};
  18389. // Transform request data
  18390. config.data = transformData(
  18391. config.data,
  18392. config.headers,
  18393. config.transformRequest
  18394. );
  18395. // Flatten headers
  18396. config.headers = utils.merge(
  18397. config.headers.common || {},
  18398. config.headers[config.method] || {},
  18399. config.headers || {}
  18400. );
  18401. utils.forEach(
  18402. ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],
  18403. function cleanHeaderConfig(method) {
  18404. delete config.headers[method];
  18405. }
  18406. );
  18407. var adapter = config.adapter || defaults.adapter;
  18408. return adapter(config).then(function onAdapterResolution(response) {
  18409. throwIfCancellationRequested(config);
  18410. // Transform response data
  18411. response.data = transformData(
  18412. response.data,
  18413. response.headers,
  18414. config.transformResponse
  18415. );
  18416. return response;
  18417. }, function onAdapterRejection(reason) {
  18418. if (!isCancel(reason)) {
  18419. throwIfCancellationRequested(config);
  18420. // Transform response data
  18421. if (reason && reason.response) {
  18422. reason.response.data = transformData(
  18423. reason.response.data,
  18424. reason.response.headers,
  18425. config.transformResponse
  18426. );
  18427. }
  18428. }
  18429. return Promise.reject(reason);
  18430. });
  18431. };
  18432. /***/ },
  18433. /* 137 */
  18434. /***/ function(module, exports) {
  18435. "use strict";
  18436. 'use strict';
  18437. /**
  18438. * Update an Error with the specified config, error code, and response.
  18439. *
  18440. * @param {Error} error The error to update.
  18441. * @param {Object} config The config.
  18442. * @param {string} [code] The error code (for example, 'ECONNABORTED').
  18443. @ @param {Object} [response] The response.
  18444. * @returns {Error} The error.
  18445. */
  18446. module.exports = function enhanceError(error, config, code, response) {
  18447. error.config = config;
  18448. if (code) {
  18449. error.code = code;
  18450. }
  18451. error.response = response;
  18452. return error;
  18453. };
  18454. /***/ },
  18455. /* 138 */
  18456. /***/ function(module, exports, __webpack_require__) {
  18457. "use strict";
  18458. 'use strict';
  18459. var createError = __webpack_require__(75);
  18460. /**
  18461. * Resolve or reject a Promise based on response status.
  18462. *
  18463. * @param {Function} resolve A function that resolves the promise.
  18464. * @param {Function} reject A function that rejects the promise.
  18465. * @param {object} response The response.
  18466. */
  18467. module.exports = function settle(resolve, reject, response) {
  18468. var validateStatus = response.config.validateStatus;
  18469. // Note: status is not exposed by XDomainRequest
  18470. if (!response.status || !validateStatus || validateStatus(response.status)) {
  18471. resolve(response);
  18472. } else {
  18473. reject(createError(
  18474. 'Request failed with status code ' + response.status,
  18475. response.config,
  18476. null,
  18477. response
  18478. ));
  18479. }
  18480. };
  18481. /***/ },
  18482. /* 139 */
  18483. /***/ function(module, exports, __webpack_require__) {
  18484. "use strict";
  18485. 'use strict';
  18486. var utils = __webpack_require__(4);
  18487. /**
  18488. * Transform the data for a request or a response
  18489. *
  18490. * @param {Object|String} data The data to be transformed
  18491. * @param {Array} headers The headers for the request or response
  18492. * @param {Array|Function} fns A single function or Array of functions
  18493. * @returns {*} The resulting transformed data
  18494. */
  18495. module.exports = function transformData(data, headers, fns) {
  18496. /*eslint no-param-reassign:0*/
  18497. utils.forEach(fns, function transform(fn) {
  18498. data = fn(data, headers);
  18499. });
  18500. return data;
  18501. };
  18502. /***/ },
  18503. /* 140 */
  18504. /***/ function(module, exports) {
  18505. "use strict";
  18506. 'use strict';
  18507. // btoa polyfill for IE<10 courtesy https://github.com/davidchambers/Base64.js
  18508. var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  18509. function E() {
  18510. this.message = 'String contains an invalid character';
  18511. }
  18512. E.prototype = new Error;
  18513. E.prototype.code = 5;
  18514. E.prototype.name = 'InvalidCharacterError';
  18515. function btoa(input) {
  18516. var str = String(input);
  18517. var output = '';
  18518. for (
  18519. // initialize result and counter
  18520. var block, charCode, idx = 0, map = chars;
  18521. // if the next str index does not exist:
  18522. // change the mapping table to "="
  18523. // check if d has no fractional digits
  18524. str.charAt(idx | 0) || (map = '=', idx % 1);
  18525. // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8
  18526. output += map.charAt(63 & block >> 8 - idx % 1 * 8)
  18527. ) {
  18528. charCode = str.charCodeAt(idx += 3 / 4);
  18529. if (charCode > 0xFF) {
  18530. throw new E();
  18531. }
  18532. block = block << 8 | charCode;
  18533. }
  18534. return output;
  18535. }
  18536. module.exports = btoa;
  18537. /***/ },
  18538. /* 141 */
  18539. /***/ function(module, exports, __webpack_require__) {
  18540. "use strict";
  18541. 'use strict';
  18542. var utils = __webpack_require__(4);
  18543. function encode(val) {
  18544. return encodeURIComponent(val).
  18545. replace(/%40/gi, '@').
  18546. replace(/%3A/gi, ':').
  18547. replace(/%24/g, '$').
  18548. replace(/%2C/gi, ',').
  18549. replace(/%20/g, '+').
  18550. replace(/%5B/gi, '[').
  18551. replace(/%5D/gi, ']');
  18552. }
  18553. /**
  18554. * Build a URL by appending params to the end
  18555. *
  18556. * @param {string} url The base of the url (e.g., http://www.google.com)
  18557. * @param {object} [params] The params to be appended
  18558. * @returns {string} The formatted url
  18559. */
  18560. module.exports = function buildURL(url, params, paramsSerializer) {
  18561. /*eslint no-param-reassign:0*/
  18562. if (!params) {
  18563. return url;
  18564. }
  18565. var serializedParams;
  18566. if (paramsSerializer) {
  18567. serializedParams = paramsSerializer(params);
  18568. } else if (utils.isURLSearchParams(params)) {
  18569. serializedParams = params.toString();
  18570. } else {
  18571. var parts = [];
  18572. utils.forEach(params, function serialize(val, key) {
  18573. if (val === null || typeof val === 'undefined') {
  18574. return;
  18575. }
  18576. if (utils.isArray(val)) {
  18577. key = key + '[]';
  18578. }
  18579. if (!utils.isArray(val)) {
  18580. val = [val];
  18581. }
  18582. utils.forEach(val, function parseValue(v) {
  18583. if (utils.isDate(v)) {
  18584. v = v.toISOString();
  18585. } else if (utils.isObject(v)) {
  18586. v = JSON.stringify(v);
  18587. }
  18588. parts.push(encode(key) + '=' + encode(v));
  18589. });
  18590. });
  18591. serializedParams = parts.join('&');
  18592. }
  18593. if (serializedParams) {
  18594. url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
  18595. }
  18596. return url;
  18597. };
  18598. /***/ },
  18599. /* 142 */
  18600. /***/ function(module, exports) {
  18601. "use strict";
  18602. 'use strict';
  18603. /**
  18604. * Creates a new URL by combining the specified URLs
  18605. *
  18606. * @param {string} baseURL The base URL
  18607. * @param {string} relativeURL The relative URL
  18608. * @returns {string} The combined URL
  18609. */
  18610. module.exports = function combineURLs(baseURL, relativeURL) {
  18611. return baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '');
  18612. };
  18613. /***/ },
  18614. /* 143 */
  18615. /***/ function(module, exports, __webpack_require__) {
  18616. "use strict";
  18617. 'use strict';
  18618. var utils = __webpack_require__(4);
  18619. module.exports = (
  18620. utils.isStandardBrowserEnv() ?
  18621. // Standard browser envs support document.cookie
  18622. (function standardBrowserEnv() {
  18623. return {
  18624. write: function write(name, value, expires, path, domain, secure) {
  18625. var cookie = [];
  18626. cookie.push(name + '=' + encodeURIComponent(value));
  18627. if (utils.isNumber(expires)) {
  18628. cookie.push('expires=' + new Date(expires).toGMTString());
  18629. }
  18630. if (utils.isString(path)) {
  18631. cookie.push('path=' + path);
  18632. }
  18633. if (utils.isString(domain)) {
  18634. cookie.push('domain=' + domain);
  18635. }
  18636. if (secure === true) {
  18637. cookie.push('secure');
  18638. }
  18639. document.cookie = cookie.join('; ');
  18640. },
  18641. read: function read(name) {
  18642. var match = document.cookie.match(new RegExp('(^|;\\s*)(' + name + ')=([^;]*)'));
  18643. return (match ? decodeURIComponent(match[3]) : null);
  18644. },
  18645. remove: function remove(name) {
  18646. this.write(name, '', Date.now() - 86400000);
  18647. }
  18648. };
  18649. })() :
  18650. // Non standard browser env (web workers, react-native) lack needed support.
  18651. (function nonStandardBrowserEnv() {
  18652. return {
  18653. write: function write() {},
  18654. read: function read() { return null; },
  18655. remove: function remove() {}
  18656. };
  18657. })()
  18658. );
  18659. /***/ },
  18660. /* 144 */
  18661. /***/ function(module, exports) {
  18662. "use strict";
  18663. 'use strict';
  18664. /**
  18665. * Determines whether the specified URL is absolute
  18666. *
  18667. * @param {string} url The URL to test
  18668. * @returns {boolean} True if the specified URL is absolute, otherwise false
  18669. */
  18670. module.exports = function isAbsoluteURL(url) {
  18671. // A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
  18672. // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
  18673. // by any combination of letters, digits, plus, period, or hyphen.
  18674. return /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url);
  18675. };
  18676. /***/ },
  18677. /* 145 */
  18678. /***/ function(module, exports, __webpack_require__) {
  18679. "use strict";
  18680. 'use strict';
  18681. var utils = __webpack_require__(4);
  18682. module.exports = (
  18683. utils.isStandardBrowserEnv() ?
  18684. // Standard browser envs have full support of the APIs needed to test
  18685. // whether the request URL is of the same origin as current location.
  18686. (function standardBrowserEnv() {
  18687. var msie = /(msie|trident)/i.test(navigator.userAgent);
  18688. var urlParsingNode = document.createElement('a');
  18689. var originURL;
  18690. /**
  18691. * Parse a URL to discover it's components
  18692. *
  18693. * @param {String} url The URL to be parsed
  18694. * @returns {Object}
  18695. */
  18696. function resolveURL(url) {
  18697. var href = url;
  18698. if (msie) {
  18699. // IE needs attribute set twice to normalize properties
  18700. urlParsingNode.setAttribute('href', href);
  18701. href = urlParsingNode.href;
  18702. }
  18703. urlParsingNode.setAttribute('href', href);
  18704. // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
  18705. return {
  18706. href: urlParsingNode.href,
  18707. protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
  18708. host: urlParsingNode.host,
  18709. search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
  18710. hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
  18711. hostname: urlParsingNode.hostname,
  18712. port: urlParsingNode.port,
  18713. pathname: (urlParsingNode.pathname.charAt(0) === '/') ?
  18714. urlParsingNode.pathname :
  18715. '/' + urlParsingNode.pathname
  18716. };
  18717. }
  18718. originURL = resolveURL(window.location.href);
  18719. /**
  18720. * Determine if a URL shares the same origin as the current location
  18721. *
  18722. * @param {String} requestURL The URL to test
  18723. * @returns {boolean} True if URL shares the same origin, otherwise false
  18724. */
  18725. return function isURLSameOrigin(requestURL) {
  18726. var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;
  18727. return (parsed.protocol === originURL.protocol &&
  18728. parsed.host === originURL.host);
  18729. };
  18730. })() :
  18731. // Non standard browser envs (web workers, react-native) lack needed support.
  18732. (function nonStandardBrowserEnv() {
  18733. return function isURLSameOrigin() {
  18734. return true;
  18735. };
  18736. })()
  18737. );
  18738. /***/ },
  18739. /* 146 */
  18740. /***/ function(module, exports, __webpack_require__) {
  18741. "use strict";
  18742. 'use strict';
  18743. var utils = __webpack_require__(4);
  18744. module.exports = function normalizeHeaderName(headers, normalizedName) {
  18745. utils.forEach(headers, function processHeader(value, name) {
  18746. if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {
  18747. headers[normalizedName] = value;
  18748. delete headers[name];
  18749. }
  18750. });
  18751. };
  18752. /***/ },
  18753. /* 147 */
  18754. /***/ function(module, exports, __webpack_require__) {
  18755. "use strict";
  18756. 'use strict';
  18757. var utils = __webpack_require__(4);
  18758. /**
  18759. * Parse headers into an object
  18760. *
  18761. * ```
  18762. * Date: Wed, 27 Aug 2014 08:58:49 GMT
  18763. * Content-Type: application/json
  18764. * Connection: keep-alive
  18765. * Transfer-Encoding: chunked
  18766. * ```
  18767. *
  18768. * @param {String} headers Headers needing to be parsed
  18769. * @returns {Object} Headers parsed into an object
  18770. */
  18771. module.exports = function parseHeaders(headers) {
  18772. var parsed = {};
  18773. var key;
  18774. var val;
  18775. var i;
  18776. if (!headers) { return parsed; }
  18777. utils.forEach(headers.split('\n'), function parser(line) {
  18778. i = line.indexOf(':');
  18779. key = utils.trim(line.substr(0, i)).toLowerCase();
  18780. val = utils.trim(line.substr(i + 1));
  18781. if (key) {
  18782. parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
  18783. }
  18784. });
  18785. return parsed;
  18786. };
  18787. /***/ },
  18788. /* 148 */
  18789. /***/ function(module, exports) {
  18790. "use strict";
  18791. 'use strict';
  18792. /**
  18793. * Syntactic sugar for invoking a function and expanding an array for arguments.
  18794. *
  18795. * Common use case would be to use `Function.prototype.apply`.
  18796. *
  18797. * ```js
  18798. * function f(x, y, z) {}
  18799. * var args = [1, 2, 3];
  18800. * f.apply(null, args);
  18801. * ```
  18802. *
  18803. * With `spread` this example can be re-written.
  18804. *
  18805. * ```js
  18806. * spread(function(x, y, z) {})([1, 2, 3]);
  18807. * ```
  18808. *
  18809. * @param {Function} callback
  18810. * @returns {Function}
  18811. */
  18812. module.exports = function spread(callback) {
  18813. return function wrap(arr) {
  18814. return callback.apply(null, arr);
  18815. };
  18816. };
  18817. /***/ },
  18818. /* 149 */
  18819. /***/ function(module, exports, __webpack_require__) {
  18820. "use strict";
  18821. 'use strict';
  18822. Object.defineProperty(exports, "__esModule", {
  18823. value: true
  18824. });
  18825. var _Menu = __webpack_require__(286);
  18826. var _Menu2 = _interopRequireDefault(_Menu);
  18827. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18828. exports.default = {
  18829. name: 'LessPass',
  18830. components: {
  18831. 'lesspass-menu': _Menu2.default
  18832. },
  18833. created: function created() {
  18834. var _this = this;
  18835. var fiveMinutes = 1000 * 60 * 5;
  18836. this.$store.dispatch('REFRESH_TOKEN');
  18837. setInterval(function () {
  18838. _this.$store.dispatch('REFRESH_TOKEN');
  18839. }, fiveMinutes);
  18840. }
  18841. };
  18842. /***/ },
  18843. /* 150 */
  18844. /***/ function(module, exports) {
  18845. "use strict";
  18846. "use strict";
  18847. Object.defineProperty(exports, "__esModule", {
  18848. value: true
  18849. });
  18850. exports.default = {
  18851. data: function data() {
  18852. return {
  18853. pending: false
  18854. };
  18855. },
  18856. props: {
  18857. action: { type: Function, required: true },
  18858. text: { type: String, required: true },
  18859. object: { type: Object, required: true }
  18860. },
  18861. methods: {
  18862. confirm: function (_confirm) {
  18863. function confirm() {
  18864. return _confirm.apply(this, arguments);
  18865. }
  18866. confirm.toString = function () {
  18867. return _confirm.toString();
  18868. };
  18869. return confirm;
  18870. }(function () {
  18871. this.pending = true;
  18872. var response = confirm(this.text);
  18873. if (response == true) {
  18874. this.action(this.object);
  18875. }
  18876. })
  18877. }
  18878. };
  18879. /***/ },
  18880. /* 151 */
  18881. /***/ function(module, exports, __webpack_require__) {
  18882. "use strict";
  18883. 'use strict';
  18884. Object.defineProperty(exports, "__esModule", {
  18885. value: true
  18886. });
  18887. var _lesspass = __webpack_require__(108);
  18888. var _lesspass2 = _interopRequireDefault(_lesspass);
  18889. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18890. exports.default = {
  18891. data: function data() {
  18892. return {
  18893. icon1: '',
  18894. icon2: '',
  18895. icon3: '',
  18896. color1: '',
  18897. color2: '',
  18898. color3: ''
  18899. };
  18900. },
  18901. props: ['fingerprint'],
  18902. watch: {
  18903. fingerprint: function fingerprint(newFingerprint) {
  18904. var _this = this;
  18905. if (!newFingerprint) {
  18906. return;
  18907. }
  18908. _lesspass2.default.createFingerprint(newFingerprint).then(function (sha256) {
  18909. var hash1 = sha256.substring(0, 6);
  18910. var hash2 = sha256.substring(6, 12);
  18911. var hash3 = sha256.substring(12, 18);
  18912. _this.icon1 = _this.getIcon(hash1);
  18913. _this.icon2 = _this.getIcon(hash2);
  18914. _this.icon3 = _this.getIcon(hash3);
  18915. _this.color1 = _this.getColor(hash1);
  18916. _this.color2 = _this.getColor(hash2);
  18917. _this.color3 = _this.getColor(hash3);
  18918. });
  18919. }
  18920. },
  18921. methods: {
  18922. getColor: function getColor(color) {
  18923. var colors = ['#000000', '#074750', '#009191', '#FF6CB6', '#FFB5DA', '#490092', '#006CDB', '#B66DFF', '#6DB5FE', '#B5DAFE', '#920000', '#924900', '#DB6D00', '#24FE23'];
  18924. var index = parseInt(color, 16) % colors.length;
  18925. return colors[index];
  18926. },
  18927. getIcon: function getIcon(hash) {
  18928. var icons = ['fa-hashtag', 'fa-heart', 'fa-hotel', 'fa-university', 'fa-plug', 'fa-ambulance', 'fa-bus', 'fa-car', 'fa-plane', 'fa-rocket', 'fa-ship', 'fa-subway', 'fa-truck', 'fa-jpy', 'fa-eur', 'fa-btc', 'fa-usd', 'fa-gbp', 'fa-archive', 'fa-area-chart', 'fa-bed', 'fa-beer', 'fa-bell', 'fa-binoculars', 'fa-birthday-cake', 'fa-bomb', 'fa-briefcase', 'fa-bug', 'fa-camera', 'fa-cart-plus', 'fa-certificate', 'fa-coffee', 'fa-cloud', 'fa-coffee', 'fa-comment', 'fa-cube', 'fa-cutlery', 'fa-database', 'fa-diamond', 'fa-exclamation-circle', 'fa-eye', 'fa-flag', 'fa-flask', 'fa-futbol-o', 'fa-gamepad', 'fa-graduation-cap'];
  18929. var index = parseInt(hash, 16) % icons.length;
  18930. return icons[index];
  18931. }
  18932. }
  18933. };
  18934. /***/ },
  18935. /* 152 */
  18936. /***/ function(module, exports, __webpack_require__) {
  18937. "use strict";
  18938. 'use strict';
  18939. Object.defineProperty(exports, "__esModule", {
  18940. value: true
  18941. });
  18942. var _vuex = __webpack_require__(11);
  18943. exports.default = {
  18944. methods: {
  18945. logout: function logout() {
  18946. this.$store.dispatch('LOGOUT');
  18947. this.$router.push({ name: 'home' });
  18948. },
  18949. saveOrUpdatePassword: function saveOrUpdatePassword() {
  18950. this.$store.dispatch('SAVE_OR_UPDATE_PASSWORD');
  18951. }
  18952. },
  18953. computed: (0, _vuex.mapGetters)(['isAuthenticated', 'isGuest', 'email', 'passwordStatus'])
  18954. };
  18955. /***/ },
  18956. /* 153 */
  18957. /***/ function(module, exports, __webpack_require__) {
  18958. "use strict";
  18959. 'use strict';
  18960. Object.defineProperty(exports, "__esModule", {
  18961. value: true
  18962. });
  18963. var _extends2 = __webpack_require__(25);
  18964. var _extends3 = _interopRequireDefault(_extends2);
  18965. var _auth = __webpack_require__(34);
  18966. var _auth2 = _interopRequireDefault(_auth);
  18967. var _storage = __webpack_require__(22);
  18968. var _storage2 = _interopRequireDefault(_storage);
  18969. var _vuex = __webpack_require__(11);
  18970. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18971. var defaultErrors = {
  18972. userNameAlreadyExist: false,
  18973. baseURLRequired: false,
  18974. emailRequired: false,
  18975. passwordRequired: false
  18976. };
  18977. exports.default = {
  18978. data: function data() {
  18979. var storage = new _storage2.default();
  18980. var auth = new _auth2.default(storage);
  18981. return {
  18982. auth: auth,
  18983. storage: storage,
  18984. password: '',
  18985. showError: false,
  18986. errorMessage: '',
  18987. loadingRegister: false,
  18988. loadingSignIn: false,
  18989. errors: (0, _extends3.default)({}, defaultErrors)
  18990. };
  18991. },
  18992. methods: {
  18993. noErrors: function noErrors() {
  18994. return !(this.errors.userNameAlreadyExist || this.errors.emailRequired || this.errors.passwordRequired || this.errors.baseURLRequired || this.showError);
  18995. },
  18996. formIsValid: function formIsValid() {
  18997. this.cleanErrors();
  18998. var formIsValid = true;
  18999. if (!this.email) {
  19000. this.errors.emailRequired = true;
  19001. formIsValid = false;
  19002. }
  19003. if (!this.password) {
  19004. this.errors.passwordRequired = true;
  19005. formIsValid = false;
  19006. }
  19007. if (!this.baseURL) {
  19008. this.errors.baseURLRequired = true;
  19009. formIsValid = false;
  19010. }
  19011. return formIsValid;
  19012. },
  19013. cleanErrors: function cleanErrors() {
  19014. this.loadingRegister = false;
  19015. this.loadingSignIn = false;
  19016. this.showError = false;
  19017. this.errorMessage = '';
  19018. this.errors = (0, _extends3.default)({}, defaultErrors);
  19019. },
  19020. signIn: function signIn() {
  19021. var _this = this;
  19022. if (this.formIsValid()) {
  19023. (function () {
  19024. _this.loadingSignIn = true;
  19025. var email = _this.email;
  19026. var password = _this.password;
  19027. var baseURL = _this.baseURL;
  19028. _this.auth.login({ email: email, password: password }, baseURL).then(function () {
  19029. _this.loadingSignIn = false;
  19030. _this.storage.save({ baseURL: baseURL, email: email });
  19031. _this.$store.dispatch('USER_AUTHENTICATED', { email: email });
  19032. _this.$router.push({ name: 'home' });
  19033. }).catch(function (err) {
  19034. _this.cleanErrors();
  19035. if (err.response === undefined) {
  19036. if (baseURL === "https://lesspass.com") {
  19037. _this.showErrorMessage();
  19038. } else {
  19039. _this.showErrorMessage('Your LessPass Database is not running');
  19040. }
  19041. } else if (err.response.status === 400) {
  19042. _this.showErrorMessage('Your email and/or password is not good. Do you have an account ?');
  19043. } else {
  19044. _this.showErrorMessage();
  19045. }
  19046. });
  19047. })();
  19048. }
  19049. },
  19050. register: function register() {
  19051. var _this2 = this;
  19052. if (this.formIsValid()) {
  19053. this.loadingRegister = true;
  19054. var email = this.email;
  19055. var password = this.password;
  19056. var baseURL = this.baseURL;
  19057. this.auth.register({ email: email, password: password }, baseURL).then(function () {
  19058. _this2.loadingRegister = false;
  19059. _this2.signIn();
  19060. }).catch(function (err) {
  19061. _this2.cleanErrors();
  19062. if (err.response && err.response.data.email[0].indexOf('already exists') !== -1) {
  19063. _this2.errors.userNameAlreadyExist = true;
  19064. } else {
  19065. _this2.showErrorMessage();
  19066. }
  19067. });
  19068. }
  19069. },
  19070. showErrorMessage: function showErrorMessage() {
  19071. var errorMessage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Oops! Something went wrong. Retry in a few minutes.';
  19072. this.errorMessage = errorMessage;
  19073. this.showError = true;
  19074. }
  19075. },
  19076. computed: {
  19077. baseURL: {
  19078. get: function get() {
  19079. return this.$store.state.baseURL;
  19080. },
  19081. set: function set(baseURL) {
  19082. this.$store.commit('UPDATE_BASE_URL', { baseURL: baseURL });
  19083. }
  19084. },
  19085. email: {
  19086. get: function get() {
  19087. return this.$store.state.email;
  19088. },
  19089. set: function set(email) {
  19090. this.$store.commit('UPDATE_EMAIL', { email: email });
  19091. }
  19092. }
  19093. }
  19094. };
  19095. /***/ },
  19096. /* 154 */
  19097. /***/ function(module, exports, __webpack_require__) {
  19098. "use strict";
  19099. 'use strict';
  19100. Object.defineProperty(exports, "__esModule", {
  19101. value: true
  19102. });
  19103. var _extends2 = __webpack_require__(25);
  19104. var _extends3 = _interopRequireDefault(_extends2);
  19105. var _lesspass = __webpack_require__(108);
  19106. var _lesspass2 = _interopRequireDefault(_lesspass);
  19107. var _vuex = __webpack_require__(11);
  19108. var _clipboard = __webpack_require__(175);
  19109. var _clipboard2 = _interopRequireDefault(_clipboard);
  19110. var _lodash = __webpack_require__(261);
  19111. var _lodash2 = _interopRequireDefault(_lodash);
  19112. var _tooltip = __webpack_require__(160);
  19113. var _password = __webpack_require__(78);
  19114. var _password2 = _interopRequireDefault(_password);
  19115. var _urlParser = __webpack_require__(161);
  19116. var _RemoveAutoComplete = __webpack_require__(287);
  19117. var _RemoveAutoComplete2 = _interopRequireDefault(_RemoveAutoComplete);
  19118. var _Fingerprint = __webpack_require__(285);
  19119. var _Fingerprint2 = _interopRequireDefault(_Fingerprint);
  19120. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19121. function fetchPasswords(store) {
  19122. return store.dispatch('FETCH_PASSWORDS');
  19123. }
  19124. exports.default = {
  19125. name: 'password-generator-view',
  19126. components: {
  19127. RemoveAutoComplete: _RemoveAutoComplete2.default,
  19128. Fingerprint: _Fingerprint2.default
  19129. },
  19130. computed: (0, _vuex.mapGetters)(['passwords', 'password']),
  19131. preFetch: fetchPasswords,
  19132. beforeMount: function beforeMount() {
  19133. var _this = this;
  19134. var id = this.$route.params.id;
  19135. if (id) {
  19136. this.$store.dispatch('FETCH_PASSWORD', { id: id });
  19137. } else {
  19138. fetchPasswords(this.$store);
  19139. }
  19140. (0, _urlParser.getSite)().then(function (site) {
  19141. if (site) {
  19142. _this.$store.commit('UPDATE_SITE', { site: site });
  19143. }
  19144. });
  19145. var clipboard = new _clipboard2.default('#copyPasswordButton');
  19146. clipboard.on('success', function (event) {
  19147. if (event.text) {
  19148. (0, _tooltip.showTooltip)(event.trigger, 'copied !');
  19149. }
  19150. });
  19151. },
  19152. data: function data() {
  19153. return {
  19154. masterPassword: '',
  19155. encryptedLogin: '',
  19156. generatedPassword: '',
  19157. cleanTimeout: null
  19158. };
  19159. },
  19160. watch: {
  19161. 'password.site': function passwordSite(newValue) {
  19162. var values = newValue.split(" | ");
  19163. if (values.length === 2) {
  19164. var site = values[0];
  19165. var login = values[1];
  19166. var passwords = this.passwords;
  19167. for (var i = 0; i < passwords.length; i++) {
  19168. var password = passwords[i];
  19169. if (password.site === site && password.login === login) {
  19170. this.$store.dispatch('PASSWORD_CHANGE', { password: (0, _extends3.default)({}, password) });
  19171. this.$refs.masterPassword.focus();
  19172. break;
  19173. }
  19174. }
  19175. }
  19176. this.renderPassword();
  19177. },
  19178. 'password.login': function passwordLogin() {
  19179. this.encryptedLogin = '';
  19180. this.encryptLogin();
  19181. },
  19182. 'password.uppercase': function passwordUppercase() {
  19183. this.renderPassword();
  19184. },
  19185. 'password.lowercase': function passwordLowercase() {
  19186. this.renderPassword();
  19187. },
  19188. 'password.numbers': function passwordNumbers() {
  19189. this.renderPassword();
  19190. },
  19191. 'password.symbols': function passwordSymbols() {
  19192. this.renderPassword();
  19193. },
  19194. 'password.length': function passwordLength() {
  19195. this.renderPassword();
  19196. },
  19197. 'password.counter': function passwordCounter() {
  19198. this.renderPassword();
  19199. },
  19200. 'masterPassword': function masterPassword() {
  19201. this.encryptedLogin = '';
  19202. this.encryptLogin();
  19203. },
  19204. 'encryptedLogin': function encryptedLogin() {
  19205. this.renderPassword();
  19206. },
  19207. 'generatedPassword': function generatedPassword() {
  19208. this.cleanFormInSeconds(30);
  19209. }
  19210. },
  19211. methods: {
  19212. encryptLogin: (0, _lodash2.default)(function () {
  19213. var _this2 = this;
  19214. if (this.password.login && this.masterPassword) {
  19215. _lesspass2.default.encryptLogin(this.password.login, this.masterPassword).then(function (encryptedLogin) {
  19216. _this2.encryptedLogin = encryptedLogin;
  19217. });
  19218. }
  19219. }, 500),
  19220. showMasterPassword: function showMasterPassword() {
  19221. if (this.$refs.masterPassword.type === 'password') {
  19222. this.$refs.masterPassword.type = 'text';
  19223. } else {
  19224. this.$refs.masterPassword.type = 'password';
  19225. }
  19226. },
  19227. cleanFormInSeconds: function cleanFormInSeconds(seconds) {
  19228. var _this3 = this;
  19229. clearTimeout(this.cleanTimeout);
  19230. this.cleanTimeout = setTimeout(function () {
  19231. _this3.$store.commit('PASSWORD_CLEAN');
  19232. _this3.masterPassword = '';
  19233. _this3.encryptedLogin = '';
  19234. _this3.generatedPassword = '';
  19235. }, 1000 * seconds);
  19236. },
  19237. renderPassword: function renderPassword() {
  19238. var _this4 = this;
  19239. if (!this.encryptedLogin || !this.password.site) {
  19240. this.generatedPassword = '';
  19241. return;
  19242. }
  19243. var password = new _password2.default(this.password);
  19244. _lesspass2.default.renderPassword(this.encryptedLogin, this.password.site, password.options).then(function (generatedPassword) {
  19245. _this4.$store.dispatch('PASSWORD_GENERATED');
  19246. _this4.generatedPassword = generatedPassword;
  19247. });
  19248. }
  19249. }
  19250. };
  19251. /***/ },
  19252. /* 155 */
  19253. /***/ function(module, exports, __webpack_require__) {
  19254. "use strict";
  19255. 'use strict';
  19256. Object.defineProperty(exports, "__esModule", {
  19257. value: true
  19258. });
  19259. var _auth = __webpack_require__(34);
  19260. var _auth2 = _interopRequireDefault(_auth);
  19261. var _storage = __webpack_require__(22);
  19262. var _storage2 = _interopRequireDefault(_storage);
  19263. var _vuex = __webpack_require__(11);
  19264. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19265. exports.default = {
  19266. data: function data() {
  19267. var storage = new _storage2.default();
  19268. var auth = new _auth2.default(storage);
  19269. return {
  19270. auth: auth,
  19271. storage: storage,
  19272. email: '',
  19273. emailRequired: false,
  19274. showError: false,
  19275. loading: false,
  19276. successMessage: false
  19277. };
  19278. },
  19279. methods: {
  19280. cleanErrors: function cleanErrors() {
  19281. this.loading = false;
  19282. this.emailRequired = false;
  19283. this.showError = false;
  19284. this.successMessage = false;
  19285. },
  19286. noErrors: function noErrors() {
  19287. return !(this.emailRequired || this.showError);
  19288. },
  19289. resetPassword: function resetPassword() {
  19290. var _this = this;
  19291. this.cleanErrors();
  19292. if (!this.email) {
  19293. this.emailRequired = true;
  19294. return;
  19295. }
  19296. this.loading = true;
  19297. this.auth.resetPassword({ email: this.email }).then(function () {
  19298. _this.cleanErrors();
  19299. _this.successMessage = true;
  19300. }).catch(function () {
  19301. _this.cleanErrors();
  19302. _this.showError = true;
  19303. });
  19304. }
  19305. }
  19306. };
  19307. /***/ },
  19308. /* 156 */
  19309. /***/ function(module, exports, __webpack_require__) {
  19310. "use strict";
  19311. 'use strict';
  19312. Object.defineProperty(exports, "__esModule", {
  19313. value: true
  19314. });
  19315. var _auth = __webpack_require__(34);
  19316. var _auth2 = _interopRequireDefault(_auth);
  19317. var _storage = __webpack_require__(22);
  19318. var _storage2 = _interopRequireDefault(_storage);
  19319. var _vuex = __webpack_require__(11);
  19320. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19321. exports.default = {
  19322. data: function data() {
  19323. var storage = new _storage2.default();
  19324. var auth = new _auth2.default(storage);
  19325. return {
  19326. auth: auth,
  19327. storage: storage,
  19328. new_password: '',
  19329. passwordRequired: false,
  19330. showError: false,
  19331. successMessage: false,
  19332. errorMessage: 'Oops! Something went wrong. Retry in a few minutes.'
  19333. };
  19334. },
  19335. methods: {
  19336. cleanErrors: function cleanErrors() {
  19337. this.passwordRequired = false;
  19338. this.showError = false;
  19339. this.successMessage = false;
  19340. },
  19341. noErrors: function noErrors() {
  19342. return !(this.passwordRequired || this.showError);
  19343. },
  19344. resetPasswordConfirm: function resetPasswordConfirm() {
  19345. var _this = this;
  19346. this.cleanErrors();
  19347. if (!this.new_password) {
  19348. this.passwordRequired = true;
  19349. return;
  19350. }
  19351. this.auth.confirmResetPassword({
  19352. uid: this.$route.params.uid,
  19353. token: this.$route.params.token,
  19354. new_password: this.new_password
  19355. }).then(function () {
  19356. _this.successMessage = true;
  19357. }).catch(function (err) {
  19358. if (err.response.status === 400) {
  19359. _this.errorMessage = 'This password reset link become invalid.';
  19360. }
  19361. _this.showError = true;
  19362. });
  19363. }
  19364. }
  19365. };
  19366. /***/ },
  19367. /* 157 */
  19368. /***/ function(module, exports, __webpack_require__) {
  19369. "use strict";
  19370. 'use strict';
  19371. Object.defineProperty(exports, "__esModule", {
  19372. value: true
  19373. });
  19374. var _extends2 = __webpack_require__(25);
  19375. var _extends3 = _interopRequireDefault(_extends2);
  19376. var _DeleteButton = __webpack_require__(284);
  19377. var _DeleteButton2 = _interopRequireDefault(_DeleteButton);
  19378. var _vuex = __webpack_require__(11);
  19379. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19380. function fetchPasswords(store) {
  19381. return store.dispatch('FETCH_PASSWORDS');
  19382. }
  19383. exports.default = {
  19384. name: 'passwords-view',
  19385. data: function data() {
  19386. return {
  19387. searchQuery: ''
  19388. };
  19389. },
  19390. components: { DeleteButton: _DeleteButton2.default },
  19391. computed: (0, _extends3.default)({}, (0, _vuex.mapGetters)(['passwords', 'email']), {
  19392. filteredPasswords: function filteredPasswords() {
  19393. var _this = this;
  19394. return this.passwords.filter(function (password) {
  19395. return password.site.indexOf(_this.searchQuery) > -1 || password.login.indexOf(_this.searchQuery) > -1;
  19396. });
  19397. }
  19398. }),
  19399. preFetch: fetchPasswords,
  19400. beforeMount: function beforeMount() {
  19401. fetchPasswords(this.$store);
  19402. },
  19403. methods: {
  19404. deletePassword: function deletePassword(password) {
  19405. return this.$store.dispatch('DELETE_PASSWORD', { id: password.id });
  19406. }
  19407. }
  19408. };
  19409. /***/ },
  19410. /* 158 */
  19411. /***/ function(module, exports, __webpack_require__) {
  19412. "use strict";
  19413. 'use strict';
  19414. Object.defineProperty(exports, "__esModule", {
  19415. value: true
  19416. });
  19417. var _extends2 = __webpack_require__(25);
  19418. var _extends3 = _interopRequireDefault(_extends2);
  19419. var _classCallCheck2 = __webpack_require__(23);
  19420. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  19421. var _createClass2 = __webpack_require__(24);
  19422. var _createClass3 = _interopRequireDefault(_createClass2);
  19423. var _axios = __webpack_require__(71);
  19424. var _axios2 = _interopRequireDefault(_axios);
  19425. var _storage = __webpack_require__(22);
  19426. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19427. var HTTP = function () {
  19428. function HTTP(resource, storage) {
  19429. (0, _classCallCheck3.default)(this, HTTP);
  19430. this.storage = storage;
  19431. this.resource = resource;
  19432. }
  19433. (0, _createClass3.default)(HTTP, [{
  19434. key: 'getRequestConfig',
  19435. value: function getRequestConfig() {
  19436. var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  19437. var config = this.storage.json();
  19438. return (0, _extends3.default)({}, params, {
  19439. baseURL: config.baseURL,
  19440. headers: { Authorization: 'JWT ' + config[_storage.TOKEN_KEY] }
  19441. });
  19442. }
  19443. }, {
  19444. key: 'create',
  19445. value: function create(resource) {
  19446. var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  19447. return _axios2.default.post('/api/' + this.resource + '/', resource, this.getRequestConfig(params));
  19448. }
  19449. }, {
  19450. key: 'all',
  19451. value: function all() {
  19452. var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  19453. return _axios2.default.get('/api/' + this.resource + '/', this.getRequestConfig(params));
  19454. }
  19455. }, {
  19456. key: 'get',
  19457. value: function get(resource) {
  19458. var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  19459. return _axios2.default.get('/api/' + this.resource + '/' + resource.id + '/', this.getRequestConfig(params));
  19460. }
  19461. }, {
  19462. key: 'update',
  19463. value: function update(resource) {
  19464. var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  19465. return _axios2.default.put('/api/' + this.resource + '/' + resource.id + '/', resource, this.getRequestConfig(params));
  19466. }
  19467. }, {
  19468. key: 'remove',
  19469. value: function remove(resource) {
  19470. var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  19471. return _axios2.default.delete('/api/' + this.resource + '/' + resource.id + '/', this.getRequestConfig(params));
  19472. }
  19473. }]);
  19474. return HTTP;
  19475. }();
  19476. exports.default = HTTP;
  19477. /***/ },
  19478. /* 159 */
  19479. /***/ function(module, exports, __webpack_require__) {
  19480. "use strict";
  19481. 'use strict';
  19482. Object.defineProperty(exports, "__esModule", {
  19483. value: true
  19484. });
  19485. exports.TOKEN_KEY = undefined;
  19486. var _classCallCheck2 = __webpack_require__(23);
  19487. var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
  19488. var _createClass2 = __webpack_require__(24);
  19489. var _createClass3 = _interopRequireDefault(_createClass2);
  19490. var _jwtDecode = __webpack_require__(260);
  19491. var _jwtDecode2 = _interopRequireDefault(_jwtDecode);
  19492. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19493. var TOKEN_KEY = exports.TOKEN_KEY = 'jwt';
  19494. var Token = function () {
  19495. function Token(tokenName) {
  19496. (0, _classCallCheck3.default)(this, Token);
  19497. this.name = tokenName;
  19498. }
  19499. (0, _createClass3.default)(Token, [{
  19500. key: 'stillValid',
  19501. value: function stillValid() {
  19502. var now = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Date();
  19503. try {
  19504. return this._expirationDateSuperiorTo(now);
  19505. } catch (err) {
  19506. return false;
  19507. }
  19508. }
  19509. }, {
  19510. key: 'expiresInMinutes',
  19511. value: function expiresInMinutes(minutes) {
  19512. var now = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Date();
  19513. try {
  19514. var nowPlusDuration = new Date(now.getTime() + minutes * 60000);
  19515. return this._expirationDateInferiorTo(nowPlusDuration);
  19516. } catch (err) {
  19517. return false;
  19518. }
  19519. }
  19520. }, {
  19521. key: '_expirationDateInferiorTo',
  19522. value: function _expirationDateInferiorTo(date) {
  19523. var expireDate = this._getTokenExpirationDate();
  19524. return expireDate < date;
  19525. }
  19526. }, {
  19527. key: '_expirationDateSuperiorTo',
  19528. value: function _expirationDateSuperiorTo(date) {
  19529. return !this._expirationDateInferiorTo(date);
  19530. }
  19531. }, {
  19532. key: '_getTokenExpirationDate',
  19533. value: function _getTokenExpirationDate() {
  19534. var decodedToken = (0, _jwtDecode2.default)(this.name);
  19535. return new Date(decodedToken.exp * 1000);
  19536. }
  19537. }]);
  19538. return Token;
  19539. }();
  19540. exports.default = Token;
  19541. /***/ },
  19542. /* 160 */
  19543. /***/ function(module, exports) {
  19544. "use strict";
  19545. 'use strict';
  19546. Object.defineProperty(exports, "__esModule", {
  19547. value: true
  19548. });
  19549. exports.showTooltip = showTooltip;
  19550. function showTooltip(elem, msg) {
  19551. var classNames = elem.className;
  19552. elem.setAttribute('class', classNames + ' hint--top');
  19553. elem.setAttribute('aria-label', msg);
  19554. setTimeout(function () {
  19555. elem.setAttribute('class', classNames);
  19556. }, 2000);
  19557. }
  19558. /***/ },
  19559. /* 161 */
  19560. /***/ function(module, exports, __webpack_require__) {
  19561. "use strict";
  19562. 'use strict';
  19563. Object.defineProperty(exports, "__esModule", {
  19564. value: true
  19565. });
  19566. exports.getSite = exports.getCurrentUrl = exports.isWebExtension = exports._ipIsValid = exports.getDomainName = undefined;
  19567. var _promise = __webpack_require__(80);
  19568. var _promise2 = _interopRequireDefault(_promise);
  19569. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19570. function _ipIsValid(ipAddress) {
  19571. return Boolean(/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(ipAddress));
  19572. }
  19573. function getDomainName(urlStr) {
  19574. var matches = urlStr.match(/^https?\:\/\/([^\/?#]+)(?:[\/?#]|$)/i);
  19575. return matches && matches[1];
  19576. }
  19577. function isWebExtension() {
  19578. if (typeof chrome !== 'undefined' && typeof chrome.tabs !== 'undefined') {
  19579. return typeof chrome.tabs.query === 'function';
  19580. }
  19581. return false;
  19582. }
  19583. function getCurrentUrl() {
  19584. return new _promise2.default(function (resolve) {
  19585. chrome.tabs.query({ active: true, currentWindow: true }, function (tabs) {
  19586. resolve(tabs[0].url);
  19587. });
  19588. });
  19589. }
  19590. function getSite() {
  19591. if (isWebExtension()) {
  19592. return getCurrentUrl().then(function (currentUrl) {
  19593. return getDomainName(currentUrl);
  19594. });
  19595. }
  19596. return new _promise2.default(function (resolve) {
  19597. resolve('');
  19598. });
  19599. }
  19600. exports.getDomainName = getDomainName;
  19601. exports._ipIsValid = _ipIsValid;
  19602. exports.isWebExtension = isWebExtension;
  19603. exports.getCurrentUrl = getCurrentUrl;
  19604. exports.getSite = getSite;
  19605. /***/ },
  19606. /* 162 */
  19607. /***/ function(module, exports, __webpack_require__) {
  19608. module.exports = { "default": __webpack_require__(176), __esModule: true };
  19609. /***/ },
  19610. /* 163 */
  19611. /***/ function(module, exports, __webpack_require__) {
  19612. "use strict";
  19613. "use strict";
  19614. exports.__esModule = true;
  19615. var _defineProperty = __webpack_require__(79);
  19616. var _defineProperty2 = _interopRequireDefault(_defineProperty);
  19617. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19618. exports.default = function (obj, key, value) {
  19619. if (key in obj) {
  19620. (0, _defineProperty2.default)(obj, key, {
  19621. value: value,
  19622. enumerable: true,
  19623. configurable: true,
  19624. writable: true
  19625. });
  19626. } else {
  19627. obj[key] = value;
  19628. }
  19629. return obj;
  19630. };
  19631. /***/ },
  19632. /* 164 */
  19633. /***/ function(module, exports) {
  19634. "use strict";
  19635. 'use strict'
  19636. exports.byteLength = byteLength
  19637. exports.toByteArray = toByteArray
  19638. exports.fromByteArray = fromByteArray
  19639. var lookup = []
  19640. var revLookup = []
  19641. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  19642. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  19643. for (var i = 0, len = code.length; i < len; ++i) {
  19644. lookup[i] = code[i]
  19645. revLookup[code.charCodeAt(i)] = i
  19646. }
  19647. revLookup['-'.charCodeAt(0)] = 62
  19648. revLookup['_'.charCodeAt(0)] = 63
  19649. function placeHoldersCount (b64) {
  19650. var len = b64.length
  19651. if (len % 4 > 0) {
  19652. throw new Error('Invalid string. Length must be a multiple of 4')
  19653. }
  19654. // the number of equal signs (place holders)
  19655. // if there are two placeholders, than the two characters before it
  19656. // represent one byte
  19657. // if there is only one, then the three characters before it represent 2 bytes
  19658. // this is just a cheap hack to not do indexOf twice
  19659. return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0
  19660. }
  19661. function byteLength (b64) {
  19662. // base64 is 4/3 + up to two characters of the original data
  19663. return b64.length * 3 / 4 - placeHoldersCount(b64)
  19664. }
  19665. function toByteArray (b64) {
  19666. var i, j, l, tmp, placeHolders, arr
  19667. var len = b64.length
  19668. placeHolders = placeHoldersCount(b64)
  19669. arr = new Arr(len * 3 / 4 - placeHolders)
  19670. // if there are placeholders, only get up to the last complete 4 chars
  19671. l = placeHolders > 0 ? len - 4 : len
  19672. var L = 0
  19673. for (i = 0, j = 0; i < l; i += 4, j += 3) {
  19674. tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)]
  19675. arr[L++] = (tmp >> 16) & 0xFF
  19676. arr[L++] = (tmp >> 8) & 0xFF
  19677. arr[L++] = tmp & 0xFF
  19678. }
  19679. if (placeHolders === 2) {
  19680. tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4)
  19681. arr[L++] = tmp & 0xFF
  19682. } else if (placeHolders === 1) {
  19683. tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2)
  19684. arr[L++] = (tmp >> 8) & 0xFF
  19685. arr[L++] = tmp & 0xFF
  19686. }
  19687. return arr
  19688. }
  19689. function tripletToBase64 (num) {
  19690. return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F]
  19691. }
  19692. function encodeChunk (uint8, start, end) {
  19693. var tmp
  19694. var output = []
  19695. for (var i = start; i < end; i += 3) {
  19696. tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2])
  19697. output.push(tripletToBase64(tmp))
  19698. }
  19699. return output.join('')
  19700. }
  19701. function fromByteArray (uint8) {
  19702. var tmp
  19703. var len = uint8.length
  19704. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  19705. var output = ''
  19706. var parts = []
  19707. var maxChunkLength = 16383 // must be multiple of 3
  19708. // go through the array every three bytes, we'll deal with trailing stuff later
  19709. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  19710. parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))
  19711. }
  19712. // pad the end with zeros, but make sure to not forget the extra bytes
  19713. if (extraBytes === 1) {
  19714. tmp = uint8[len - 1]
  19715. output += lookup[tmp >> 2]
  19716. output += lookup[(tmp << 4) & 0x3F]
  19717. output += '=='
  19718. } else if (extraBytes === 2) {
  19719. tmp = (uint8[len - 2] << 8) + (uint8[len - 1])
  19720. output += lookup[tmp >> 10]
  19721. output += lookup[(tmp >> 4) & 0x3F]
  19722. output += lookup[(tmp << 2) & 0x3F]
  19723. output += '='
  19724. }
  19725. parts.push(output)
  19726. return parts.join('')
  19727. }
  19728. /***/ },
  19729. /* 165 */
  19730. /***/ function(module, exports, __webpack_require__) {
  19731. /* WEBPACK VAR INJECTION */(function(Buffer) {var aes = __webpack_require__(35)
  19732. var Transform = __webpack_require__(12)
  19733. var inherits = __webpack_require__(1)
  19734. var modes = __webpack_require__(36)
  19735. var StreamCipher = __webpack_require__(89)
  19736. var AuthCipher = __webpack_require__(82)
  19737. var ebtk = __webpack_require__(45)
  19738. inherits(Decipher, Transform)
  19739. function Decipher (mode, key, iv) {
  19740. if (!(this instanceof Decipher)) {
  19741. return new Decipher(mode, key, iv)
  19742. }
  19743. Transform.call(this)
  19744. this._cache = new Splitter()
  19745. this._last = void 0
  19746. this._cipher = new aes.AES(key)
  19747. this._prev = new Buffer(iv.length)
  19748. iv.copy(this._prev)
  19749. this._mode = mode
  19750. this._autopadding = true
  19751. }
  19752. Decipher.prototype._update = function (data) {
  19753. this._cache.add(data)
  19754. var chunk
  19755. var thing
  19756. var out = []
  19757. while ((chunk = this._cache.get(this._autopadding))) {
  19758. thing = this._mode.decrypt(this, chunk)
  19759. out.push(thing)
  19760. }
  19761. return Buffer.concat(out)
  19762. }
  19763. Decipher.prototype._final = function () {
  19764. var chunk = this._cache.flush()
  19765. if (this._autopadding) {
  19766. return unpad(this._mode.decrypt(this, chunk))
  19767. } else if (chunk) {
  19768. throw new Error('data not multiple of block length')
  19769. }
  19770. }
  19771. Decipher.prototype.setAutoPadding = function (setTo) {
  19772. this._autopadding = !!setTo
  19773. return this
  19774. }
  19775. function Splitter () {
  19776. if (!(this instanceof Splitter)) {
  19777. return new Splitter()
  19778. }
  19779. this.cache = new Buffer('')
  19780. }
  19781. Splitter.prototype.add = function (data) {
  19782. this.cache = Buffer.concat([this.cache, data])
  19783. }
  19784. Splitter.prototype.get = function (autoPadding) {
  19785. var out
  19786. if (autoPadding) {
  19787. if (this.cache.length > 16) {
  19788. out = this.cache.slice(0, 16)
  19789. this.cache = this.cache.slice(16)
  19790. return out
  19791. }
  19792. } else {
  19793. if (this.cache.length >= 16) {
  19794. out = this.cache.slice(0, 16)
  19795. this.cache = this.cache.slice(16)
  19796. return out
  19797. }
  19798. }
  19799. return null
  19800. }
  19801. Splitter.prototype.flush = function () {
  19802. if (this.cache.length) {
  19803. return this.cache
  19804. }
  19805. }
  19806. function unpad (last) {
  19807. var padded = last[15]
  19808. var i = -1
  19809. while (++i < padded) {
  19810. if (last[(i + (16 - padded))] !== padded) {
  19811. throw new Error('unable to decrypt data')
  19812. }
  19813. }
  19814. if (padded === 16) {
  19815. return
  19816. }
  19817. return last.slice(0, 16 - padded)
  19818. }
  19819. var modelist = {
  19820. ECB: __webpack_require__(87),
  19821. CBC: __webpack_require__(83),
  19822. CFB: __webpack_require__(84),
  19823. CFB8: __webpack_require__(86),
  19824. CFB1: __webpack_require__(85),
  19825. OFB: __webpack_require__(88),
  19826. CTR: __webpack_require__(37),
  19827. GCM: __webpack_require__(37)
  19828. }
  19829. function createDecipheriv (suite, password, iv) {
  19830. var config = modes[suite.toLowerCase()]
  19831. if (!config) {
  19832. throw new TypeError('invalid suite type')
  19833. }
  19834. if (typeof iv === 'string') {
  19835. iv = new Buffer(iv)
  19836. }
  19837. if (typeof password === 'string') {
  19838. password = new Buffer(password)
  19839. }
  19840. if (password.length !== config.key / 8) {
  19841. throw new TypeError('invalid key length ' + password.length)
  19842. }
  19843. if (iv.length !== config.iv) {
  19844. throw new TypeError('invalid iv length ' + iv.length)
  19845. }
  19846. if (config.type === 'stream') {
  19847. return new StreamCipher(modelist[config.mode], password, iv, true)
  19848. } else if (config.type === 'auth') {
  19849. return new AuthCipher(modelist[config.mode], password, iv, true)
  19850. }
  19851. return new Decipher(modelist[config.mode], password, iv)
  19852. }
  19853. function createDecipher (suite, password) {
  19854. var config = modes[suite.toLowerCase()]
  19855. if (!config) {
  19856. throw new TypeError('invalid suite type')
  19857. }
  19858. var keys = ebtk(password, false, config.key, config.iv)
  19859. return createDecipheriv(suite, keys.key, keys.iv)
  19860. }
  19861. exports.createDecipher = createDecipher
  19862. exports.createDecipheriv = createDecipheriv
  19863. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  19864. /***/ },
  19865. /* 166 */
  19866. /***/ function(module, exports, __webpack_require__) {
  19867. /* WEBPACK VAR INJECTION */(function(Buffer) {var aes = __webpack_require__(35)
  19868. var Transform = __webpack_require__(12)
  19869. var inherits = __webpack_require__(1)
  19870. var modes = __webpack_require__(36)
  19871. var ebtk = __webpack_require__(45)
  19872. var StreamCipher = __webpack_require__(89)
  19873. var AuthCipher = __webpack_require__(82)
  19874. inherits(Cipher, Transform)
  19875. function Cipher (mode, key, iv) {
  19876. if (!(this instanceof Cipher)) {
  19877. return new Cipher(mode, key, iv)
  19878. }
  19879. Transform.call(this)
  19880. this._cache = new Splitter()
  19881. this._cipher = new aes.AES(key)
  19882. this._prev = new Buffer(iv.length)
  19883. iv.copy(this._prev)
  19884. this._mode = mode
  19885. this._autopadding = true
  19886. }
  19887. Cipher.prototype._update = function (data) {
  19888. this._cache.add(data)
  19889. var chunk
  19890. var thing
  19891. var out = []
  19892. while ((chunk = this._cache.get())) {
  19893. thing = this._mode.encrypt(this, chunk)
  19894. out.push(thing)
  19895. }
  19896. return Buffer.concat(out)
  19897. }
  19898. Cipher.prototype._final = function () {
  19899. var chunk = this._cache.flush()
  19900. if (this._autopadding) {
  19901. chunk = this._mode.encrypt(this, chunk)
  19902. this._cipher.scrub()
  19903. return chunk
  19904. } else if (chunk.toString('hex') !== '10101010101010101010101010101010') {
  19905. this._cipher.scrub()
  19906. throw new Error('data not multiple of block length')
  19907. }
  19908. }
  19909. Cipher.prototype.setAutoPadding = function (setTo) {
  19910. this._autopadding = !!setTo
  19911. return this
  19912. }
  19913. function Splitter () {
  19914. if (!(this instanceof Splitter)) {
  19915. return new Splitter()
  19916. }
  19917. this.cache = new Buffer('')
  19918. }
  19919. Splitter.prototype.add = function (data) {
  19920. this.cache = Buffer.concat([this.cache, data])
  19921. }
  19922. Splitter.prototype.get = function () {
  19923. if (this.cache.length > 15) {
  19924. var out = this.cache.slice(0, 16)
  19925. this.cache = this.cache.slice(16)
  19926. return out
  19927. }
  19928. return null
  19929. }
  19930. Splitter.prototype.flush = function () {
  19931. var len = 16 - this.cache.length
  19932. var padBuff = new Buffer(len)
  19933. var i = -1
  19934. while (++i < len) {
  19935. padBuff.writeUInt8(len, i)
  19936. }
  19937. var out = Buffer.concat([this.cache, padBuff])
  19938. return out
  19939. }
  19940. var modelist = {
  19941. ECB: __webpack_require__(87),
  19942. CBC: __webpack_require__(83),
  19943. CFB: __webpack_require__(84),
  19944. CFB8: __webpack_require__(86),
  19945. CFB1: __webpack_require__(85),
  19946. OFB: __webpack_require__(88),
  19947. CTR: __webpack_require__(37),
  19948. GCM: __webpack_require__(37)
  19949. }
  19950. function createCipheriv (suite, password, iv) {
  19951. var config = modes[suite.toLowerCase()]
  19952. if (!config) {
  19953. throw new TypeError('invalid suite type')
  19954. }
  19955. if (typeof iv === 'string') {
  19956. iv = new Buffer(iv)
  19957. }
  19958. if (typeof password === 'string') {
  19959. password = new Buffer(password)
  19960. }
  19961. if (password.length !== config.key / 8) {
  19962. throw new TypeError('invalid key length ' + password.length)
  19963. }
  19964. if (iv.length !== config.iv) {
  19965. throw new TypeError('invalid iv length ' + iv.length)
  19966. }
  19967. if (config.type === 'stream') {
  19968. return new StreamCipher(modelist[config.mode], password, iv)
  19969. } else if (config.type === 'auth') {
  19970. return new AuthCipher(modelist[config.mode], password, iv)
  19971. }
  19972. return new Cipher(modelist[config.mode], password, iv)
  19973. }
  19974. function createCipher (suite, password) {
  19975. var config = modes[suite.toLowerCase()]
  19976. if (!config) {
  19977. throw new TypeError('invalid suite type')
  19978. }
  19979. var keys = ebtk(password, false, config.key, config.iv)
  19980. return createCipheriv(suite, keys.key, keys.iv)
  19981. }
  19982. exports.createCipheriv = createCipheriv
  19983. exports.createCipher = createCipher
  19984. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  19985. /***/ },
  19986. /* 167 */
  19987. /***/ function(module, exports, __webpack_require__) {
  19988. /* WEBPACK VAR INJECTION */(function(Buffer) {var zeros = new Buffer(16)
  19989. zeros.fill(0)
  19990. module.exports = GHASH
  19991. function GHASH (key) {
  19992. this.h = key
  19993. this.state = new Buffer(16)
  19994. this.state.fill(0)
  19995. this.cache = new Buffer('')
  19996. }
  19997. // from http://bitwiseshiftleft.github.io/sjcl/doc/symbols/src/core_gcm.js.html
  19998. // by Juho Vähä-Herttua
  19999. GHASH.prototype.ghash = function (block) {
  20000. var i = -1
  20001. while (++i < block.length) {
  20002. this.state[i] ^= block[i]
  20003. }
  20004. this._multiply()
  20005. }
  20006. GHASH.prototype._multiply = function () {
  20007. var Vi = toArray(this.h)
  20008. var Zi = [0, 0, 0, 0]
  20009. var j, xi, lsb_Vi
  20010. var i = -1
  20011. while (++i < 128) {
  20012. xi = (this.state[~~(i / 8)] & (1 << (7 - i % 8))) !== 0
  20013. if (xi) {
  20014. // Z_i+1 = Z_i ^ V_i
  20015. Zi = xor(Zi, Vi)
  20016. }
  20017. // Store the value of LSB(V_i)
  20018. lsb_Vi = (Vi[3] & 1) !== 0
  20019. // V_i+1 = V_i >> 1
  20020. for (j = 3; j > 0; j--) {
  20021. Vi[j] = (Vi[j] >>> 1) | ((Vi[j - 1] & 1) << 31)
  20022. }
  20023. Vi[0] = Vi[0] >>> 1
  20024. // If LSB(V_i) is 1, V_i+1 = (V_i >> 1) ^ R
  20025. if (lsb_Vi) {
  20026. Vi[0] = Vi[0] ^ (0xe1 << 24)
  20027. }
  20028. }
  20029. this.state = fromArray(Zi)
  20030. }
  20031. GHASH.prototype.update = function (buf) {
  20032. this.cache = Buffer.concat([this.cache, buf])
  20033. var chunk
  20034. while (this.cache.length >= 16) {
  20035. chunk = this.cache.slice(0, 16)
  20036. this.cache = this.cache.slice(16)
  20037. this.ghash(chunk)
  20038. }
  20039. }
  20040. GHASH.prototype.final = function (abl, bl) {
  20041. if (this.cache.length) {
  20042. this.ghash(Buffer.concat([this.cache, zeros], 16))
  20043. }
  20044. this.ghash(fromArray([
  20045. 0, abl,
  20046. 0, bl
  20047. ]))
  20048. return this.state
  20049. }
  20050. function toArray (buf) {
  20051. return [
  20052. buf.readUInt32BE(0),
  20053. buf.readUInt32BE(4),
  20054. buf.readUInt32BE(8),
  20055. buf.readUInt32BE(12)
  20056. ]
  20057. }
  20058. function fromArray (out) {
  20059. out = out.map(fixup_uint32)
  20060. var buf = new Buffer(16)
  20061. buf.writeUInt32BE(out[0], 0)
  20062. buf.writeUInt32BE(out[1], 4)
  20063. buf.writeUInt32BE(out[2], 8)
  20064. buf.writeUInt32BE(out[3], 12)
  20065. return buf
  20066. }
  20067. var uint_max = Math.pow(2, 32)
  20068. function fixup_uint32 (x) {
  20069. var ret, x_pos
  20070. ret = x > uint_max || x < 0 ? (x_pos = Math.abs(x) % uint_max, x < 0 ? uint_max - x_pos : x_pos) : x
  20071. return ret
  20072. }
  20073. function xor (a, b) {
  20074. return [
  20075. a[0] ^ b[0],
  20076. a[1] ^ b[1],
  20077. a[2] ^ b[2],
  20078. a[3] ^ b[3]
  20079. ]
  20080. }
  20081. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  20082. /***/ },
  20083. /* 168 */
  20084. /***/ function(module, exports, __webpack_require__) {
  20085. var ebtk = __webpack_require__(45)
  20086. var aes = __webpack_require__(49)
  20087. var DES = __webpack_require__(169)
  20088. var desModes = __webpack_require__(170)
  20089. var aesModes = __webpack_require__(36)
  20090. function createCipher (suite, password) {
  20091. var keyLen, ivLen
  20092. suite = suite.toLowerCase()
  20093. if (aesModes[suite]) {
  20094. keyLen = aesModes[suite].key
  20095. ivLen = aesModes[suite].iv
  20096. } else if (desModes[suite]) {
  20097. keyLen = desModes[suite].key * 8
  20098. ivLen = desModes[suite].iv
  20099. } else {
  20100. throw new TypeError('invalid suite type')
  20101. }
  20102. var keys = ebtk(password, false, keyLen, ivLen)
  20103. return createCipheriv(suite, keys.key, keys.iv)
  20104. }
  20105. function createDecipher (suite, password) {
  20106. var keyLen, ivLen
  20107. suite = suite.toLowerCase()
  20108. if (aesModes[suite]) {
  20109. keyLen = aesModes[suite].key
  20110. ivLen = aesModes[suite].iv
  20111. } else if (desModes[suite]) {
  20112. keyLen = desModes[suite].key * 8
  20113. ivLen = desModes[suite].iv
  20114. } else {
  20115. throw new TypeError('invalid suite type')
  20116. }
  20117. var keys = ebtk(password, false, keyLen, ivLen)
  20118. return createDecipheriv(suite, keys.key, keys.iv)
  20119. }
  20120. function createCipheriv (suite, key, iv) {
  20121. suite = suite.toLowerCase()
  20122. if (aesModes[suite]) {
  20123. return aes.createCipheriv(suite, key, iv)
  20124. } else if (desModes[suite]) {
  20125. return new DES({
  20126. key: key,
  20127. iv: iv,
  20128. mode: suite
  20129. })
  20130. } else {
  20131. throw new TypeError('invalid suite type')
  20132. }
  20133. }
  20134. function createDecipheriv (suite, key, iv) {
  20135. suite = suite.toLowerCase()
  20136. if (aesModes[suite]) {
  20137. return aes.createDecipheriv(suite, key, iv)
  20138. } else if (desModes[suite]) {
  20139. return new DES({
  20140. key: key,
  20141. iv: iv,
  20142. mode: suite,
  20143. decrypt: true
  20144. })
  20145. } else {
  20146. throw new TypeError('invalid suite type')
  20147. }
  20148. }
  20149. exports.createCipher = exports.Cipher = createCipher
  20150. exports.createCipheriv = exports.Cipheriv = createCipheriv
  20151. exports.createDecipher = exports.Decipher = createDecipher
  20152. exports.createDecipheriv = exports.Decipheriv = createDecipheriv
  20153. function getCiphers () {
  20154. return Object.keys(desModes).concat(aes.getCiphers())
  20155. }
  20156. exports.listCiphers = exports.getCiphers = getCiphers
  20157. /***/ },
  20158. /* 169 */
  20159. /***/ function(module, exports, __webpack_require__) {
  20160. /* WEBPACK VAR INJECTION */(function(Buffer) {var CipherBase = __webpack_require__(12)
  20161. var des = __webpack_require__(61)
  20162. var inherits = __webpack_require__(1)
  20163. var modes = {
  20164. 'des-ede3-cbc': des.CBC.instantiate(des.EDE),
  20165. 'des-ede3': des.EDE,
  20166. 'des-ede-cbc': des.CBC.instantiate(des.EDE),
  20167. 'des-ede': des.EDE,
  20168. 'des-cbc': des.CBC.instantiate(des.DES),
  20169. 'des-ecb': des.DES
  20170. }
  20171. modes.des = modes['des-cbc']
  20172. modes.des3 = modes['des-ede3-cbc']
  20173. module.exports = DES
  20174. inherits(DES, CipherBase)
  20175. function DES (opts) {
  20176. CipherBase.call(this)
  20177. var modeName = opts.mode.toLowerCase()
  20178. var mode = modes[modeName]
  20179. var type
  20180. if (opts.decrypt) {
  20181. type = 'decrypt'
  20182. } else {
  20183. type = 'encrypt'
  20184. }
  20185. var key = opts.key
  20186. if (modeName === 'des-ede' || modeName === 'des-ede-cbc') {
  20187. key = Buffer.concat([key, key.slice(0, 8)])
  20188. }
  20189. var iv = opts.iv
  20190. this._des = mode.create({
  20191. key: key,
  20192. iv: iv,
  20193. type: type
  20194. })
  20195. }
  20196. DES.prototype._update = function (data) {
  20197. return new Buffer(this._des.update(data))
  20198. }
  20199. DES.prototype._final = function () {
  20200. return new Buffer(this._des.final())
  20201. }
  20202. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  20203. /***/ },
  20204. /* 170 */
  20205. /***/ function(module, exports) {
  20206. exports['des-ecb'] = {
  20207. key: 8,
  20208. iv: 0
  20209. }
  20210. exports['des-cbc'] = exports.des = {
  20211. key: 8,
  20212. iv: 8
  20213. }
  20214. exports['des-ede3-cbc'] = exports.des3 = {
  20215. key: 24,
  20216. iv: 8
  20217. }
  20218. exports['des-ede3'] = {
  20219. key: 24,
  20220. iv: 0
  20221. }
  20222. exports['des-ede-cbc'] = {
  20223. key: 16,
  20224. iv: 8
  20225. }
  20226. exports['des-ede'] = {
  20227. key: 16,
  20228. iv: 0
  20229. }
  20230. /***/ },
  20231. /* 171 */
  20232. /***/ function(module, exports, __webpack_require__) {
  20233. /* WEBPACK VAR INJECTION */(function(Buffer) {var _algos = __webpack_require__(107)
  20234. var createHash = __webpack_require__(16)
  20235. var inherits = __webpack_require__(1)
  20236. var sign = __webpack_require__(172)
  20237. var stream = __webpack_require__(19)
  20238. var verify = __webpack_require__(173)
  20239. var algos = {}
  20240. Object.keys(_algos).forEach(function (key) {
  20241. algos[key] = algos[key.toLowerCase()] = _algos[key]
  20242. })
  20243. function Sign (algorithm) {
  20244. stream.Writable.call(this)
  20245. var data = algos[algorithm]
  20246. if (!data) {
  20247. throw new Error('Unknown message digest')
  20248. }
  20249. this._hashType = data.hash
  20250. this._hash = createHash(data.hash)
  20251. this._tag = data.id
  20252. this._signType = data.sign
  20253. }
  20254. inherits(Sign, stream.Writable)
  20255. Sign.prototype._write = function _write (data, _, done) {
  20256. this._hash.update(data)
  20257. done()
  20258. }
  20259. Sign.prototype.update = function update (data, enc) {
  20260. if (typeof data === 'string') {
  20261. data = new Buffer(data, enc)
  20262. }
  20263. this._hash.update(data)
  20264. return this
  20265. }
  20266. Sign.prototype.sign = function signMethod (key, enc) {
  20267. this.end()
  20268. var hash = this._hash.digest()
  20269. var sig = sign(Buffer.concat([this._tag, hash]), key, this._hashType, this._signType)
  20270. return enc ? sig.toString(enc) : sig
  20271. }
  20272. function Verify (algorithm) {
  20273. stream.Writable.call(this)
  20274. var data = algos[algorithm]
  20275. if (!data) {
  20276. throw new Error('Unknown message digest')
  20277. }
  20278. this._hash = createHash(data.hash)
  20279. this._tag = data.id
  20280. this._signType = data.sign
  20281. }
  20282. inherits(Verify, stream.Writable)
  20283. Verify.prototype._write = function _write (data, _, done) {
  20284. this._hash.update(data)
  20285. done()
  20286. }
  20287. Verify.prototype.update = function update (data, enc) {
  20288. if (typeof data === 'string') {
  20289. data = new Buffer(data, enc)
  20290. }
  20291. this._hash.update(data)
  20292. return this
  20293. }
  20294. Verify.prototype.verify = function verifyMethod (key, sig, enc) {
  20295. if (typeof sig === 'string') {
  20296. sig = new Buffer(sig, enc)
  20297. }
  20298. this.end()
  20299. var hash = this._hash.digest()
  20300. return verify(sig, Buffer.concat([this._tag, hash]), key, this._signType)
  20301. }
  20302. function createSign (algorithm) {
  20303. return new Sign(algorithm)
  20304. }
  20305. function createVerify (algorithm) {
  20306. return new Verify(algorithm)
  20307. }
  20308. module.exports = {
  20309. Sign: createSign,
  20310. Verify: createVerify,
  20311. createSign: createSign,
  20312. createVerify: createVerify
  20313. }
  20314. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  20315. /***/ },
  20316. /* 172 */
  20317. /***/ function(module, exports, __webpack_require__) {
  20318. /* WEBPACK VAR INJECTION */(function(Buffer) {// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js
  20319. var createHmac = __webpack_require__(60)
  20320. var crt = __webpack_require__(50)
  20321. var curves = __webpack_require__(90)
  20322. var elliptic = __webpack_require__(3)
  20323. var parseKeys = __webpack_require__(46)
  20324. var BN = __webpack_require__(2)
  20325. var EC = elliptic.ec
  20326. function sign (hash, key, hashType, signType) {
  20327. var priv = parseKeys(key)
  20328. if (priv.curve) {
  20329. if (signType !== 'ecdsa') throw new Error('wrong private key type')
  20330. return ecSign(hash, priv)
  20331. } else if (priv.type === 'dsa') {
  20332. if (signType !== 'dsa') {
  20333. throw new Error('wrong private key type')
  20334. }
  20335. return dsaSign(hash, priv, hashType)
  20336. } else {
  20337. if (signType !== 'rsa') throw new Error('wrong private key type')
  20338. }
  20339. var len = priv.modulus.byteLength()
  20340. var pad = [ 0, 1 ]
  20341. while (hash.length + pad.length + 1 < len) {
  20342. pad.push(0xff)
  20343. }
  20344. pad.push(0x00)
  20345. var i = -1
  20346. while (++i < hash.length) {
  20347. pad.push(hash[i])
  20348. }
  20349. var out = crt(pad, priv)
  20350. return out
  20351. }
  20352. function ecSign (hash, priv) {
  20353. var curveId = curves[priv.curve.join('.')]
  20354. if (!curveId) throw new Error('unknown curve ' + priv.curve.join('.'))
  20355. var curve = new EC(curveId)
  20356. var key = curve.genKeyPair()
  20357. key._importPrivate(priv.privateKey)
  20358. var out = key.sign(hash)
  20359. return new Buffer(out.toDER())
  20360. }
  20361. function dsaSign (hash, priv, algo) {
  20362. var x = priv.params.priv_key
  20363. var p = priv.params.p
  20364. var q = priv.params.q
  20365. var g = priv.params.g
  20366. var r = new BN(0)
  20367. var k
  20368. var H = bits2int(hash, q).mod(q)
  20369. var s = false
  20370. var kv = getKey(x, q, hash, algo)
  20371. while (s === false) {
  20372. k = makeKey(q, kv, algo)
  20373. r = makeR(g, k, p, q)
  20374. s = k.invm(q).imul(H.add(x.mul(r))).mod(q)
  20375. if (!s.cmpn(0)) {
  20376. s = false
  20377. r = new BN(0)
  20378. }
  20379. }
  20380. return toDER(r, s)
  20381. }
  20382. function toDER (r, s) {
  20383. r = r.toArray()
  20384. s = s.toArray()
  20385. // Pad values
  20386. if (r[0] & 0x80) {
  20387. r = [ 0 ].concat(r)
  20388. }
  20389. // Pad values
  20390. if (s[0] & 0x80) {
  20391. s = [0].concat(s)
  20392. }
  20393. var total = r.length + s.length + 4
  20394. var res = [ 0x30, total, 0x02, r.length ]
  20395. res = res.concat(r, [ 0x02, s.length ], s)
  20396. return new Buffer(res)
  20397. }
  20398. function getKey (x, q, hash, algo) {
  20399. x = new Buffer(x.toArray())
  20400. if (x.length < q.byteLength()) {
  20401. var zeros = new Buffer(q.byteLength() - x.length)
  20402. zeros.fill(0)
  20403. x = Buffer.concat([zeros, x])
  20404. }
  20405. var hlen = hash.length
  20406. var hbits = bits2octets(hash, q)
  20407. var v = new Buffer(hlen)
  20408. v.fill(1)
  20409. var k = new Buffer(hlen)
  20410. k.fill(0)
  20411. k = createHmac(algo, k)
  20412. .update(v)
  20413. .update(new Buffer([0]))
  20414. .update(x)
  20415. .update(hbits)
  20416. .digest()
  20417. v = createHmac(algo, k)
  20418. .update(v)
  20419. .digest()
  20420. k = createHmac(algo, k)
  20421. .update(v)
  20422. .update(new Buffer([1]))
  20423. .update(x)
  20424. .update(hbits)
  20425. .digest()
  20426. v = createHmac(algo, k)
  20427. .update(v)
  20428. .digest()
  20429. return {
  20430. k: k,
  20431. v: v
  20432. }
  20433. }
  20434. function bits2int (obits, q) {
  20435. var bits = new BN(obits)
  20436. var shift = (obits.length << 3) - q.bitLength()
  20437. if (shift > 0) {
  20438. bits.ishrn(shift)
  20439. }
  20440. return bits
  20441. }
  20442. function bits2octets (bits, q) {
  20443. bits = bits2int(bits, q)
  20444. bits = bits.mod(q)
  20445. var out = new Buffer(bits.toArray())
  20446. if (out.length < q.byteLength()) {
  20447. var zeros = new Buffer(q.byteLength() - out.length)
  20448. zeros.fill(0)
  20449. out = Buffer.concat([zeros, out])
  20450. }
  20451. return out
  20452. }
  20453. function makeKey (q, kv, algo) {
  20454. var t, k
  20455. do {
  20456. t = new Buffer('')
  20457. while (t.length * 8 < q.bitLength()) {
  20458. kv.v = createHmac(algo, kv.k)
  20459. .update(kv.v)
  20460. .digest()
  20461. t = Buffer.concat([t, kv.v])
  20462. }
  20463. k = bits2int(t, q)
  20464. kv.k = createHmac(algo, kv.k)
  20465. .update(kv.v)
  20466. .update(new Buffer([0]))
  20467. .digest()
  20468. kv.v = createHmac(algo, kv.k)
  20469. .update(kv.v)
  20470. .digest()
  20471. } while (k.cmp(q) !== -1)
  20472. return k
  20473. }
  20474. function makeR (g, k, p, q) {
  20475. return g.toRed(BN.mont(p)).redPow(k).fromRed().mod(q)
  20476. }
  20477. module.exports = sign
  20478. module.exports.getKey = getKey
  20479. module.exports.makeKey = makeKey
  20480. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  20481. /***/ },
  20482. /* 173 */
  20483. /***/ function(module, exports, __webpack_require__) {
  20484. /* WEBPACK VAR INJECTION */(function(Buffer) {// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js
  20485. var curves = __webpack_require__(90)
  20486. var elliptic = __webpack_require__(3)
  20487. var parseKeys = __webpack_require__(46)
  20488. var BN = __webpack_require__(2)
  20489. var EC = elliptic.ec
  20490. function verify (sig, hash, key, signType) {
  20491. var pub = parseKeys(key)
  20492. if (pub.type === 'ec') {
  20493. if (signType !== 'ecdsa') {
  20494. throw new Error('wrong public key type')
  20495. }
  20496. return ecVerify(sig, hash, pub)
  20497. } else if (pub.type === 'dsa') {
  20498. if (signType !== 'dsa') {
  20499. throw new Error('wrong public key type')
  20500. }
  20501. return dsaVerify(sig, hash, pub)
  20502. } else {
  20503. if (signType !== 'rsa') {
  20504. throw new Error('wrong public key type')
  20505. }
  20506. }
  20507. var len = pub.modulus.byteLength()
  20508. var pad = [ 1 ]
  20509. var padNum = 0
  20510. while (hash.length + pad.length + 2 < len) {
  20511. pad.push(0xff)
  20512. padNum++
  20513. }
  20514. pad.push(0x00)
  20515. var i = -1
  20516. while (++i < hash.length) {
  20517. pad.push(hash[i])
  20518. }
  20519. pad = new Buffer(pad)
  20520. var red = BN.mont(pub.modulus)
  20521. sig = new BN(sig).toRed(red)
  20522. sig = sig.redPow(new BN(pub.publicExponent))
  20523. sig = new Buffer(sig.fromRed().toArray())
  20524. var out = 0
  20525. if (padNum < 8) {
  20526. out = 1
  20527. }
  20528. len = Math.min(sig.length, pad.length)
  20529. if (sig.length !== pad.length) {
  20530. out = 1
  20531. }
  20532. i = -1
  20533. while (++i < len) {
  20534. out |= (sig[i] ^ pad[i])
  20535. }
  20536. return out === 0
  20537. }
  20538. function ecVerify (sig, hash, pub) {
  20539. var curveId = curves[pub.data.algorithm.curve.join('.')]
  20540. if (!curveId) throw new Error('unknown curve ' + pub.data.algorithm.curve.join('.'))
  20541. var curve = new EC(curveId)
  20542. var pubkey = pub.data.subjectPrivateKey.data
  20543. return curve.verify(hash, sig, pubkey)
  20544. }
  20545. function dsaVerify (sig, hash, pub) {
  20546. var p = pub.data.p
  20547. var q = pub.data.q
  20548. var g = pub.data.g
  20549. var y = pub.data.pub_key
  20550. var unpacked = parseKeys.signature.decode(sig, 'der')
  20551. var s = unpacked.s
  20552. var r = unpacked.r
  20553. checkValue(s, q)
  20554. checkValue(r, q)
  20555. var montp = BN.mont(p)
  20556. var w = s.invm(q)
  20557. var v = g.toRed(montp)
  20558. .redPow(new BN(hash).mul(w).mod(q))
  20559. .fromRed()
  20560. .mul(
  20561. y.toRed(montp)
  20562. .redPow(r.mul(w).mod(q))
  20563. .fromRed()
  20564. ).mod(p).mod(q)
  20565. return !v.cmp(r)
  20566. }
  20567. function checkValue (b, q) {
  20568. if (b.cmpn(0) <= 0) {
  20569. throw new Error('invalid sig')
  20570. }
  20571. if (b.cmp(q) >= q) {
  20572. throw new Error('invalid sig')
  20573. }
  20574. }
  20575. module.exports = verify
  20576. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  20577. /***/ },
  20578. /* 174 */
  20579. /***/ function(module, exports, __webpack_require__) {
  20580. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
  20581. if (true) {
  20582. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, __webpack_require__(275)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  20583. } else if (typeof exports !== "undefined") {
  20584. factory(module, require('select'));
  20585. } else {
  20586. var mod = {
  20587. exports: {}
  20588. };
  20589. factory(mod, global.select);
  20590. global.clipboardAction = mod.exports;
  20591. }
  20592. })(this, function (module, _select) {
  20593. 'use strict';
  20594. var _select2 = _interopRequireDefault(_select);
  20595. function _interopRequireDefault(obj) {
  20596. return obj && obj.__esModule ? obj : {
  20597. default: obj
  20598. };
  20599. }
  20600. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
  20601. return typeof obj;
  20602. } : function (obj) {
  20603. return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  20604. };
  20605. function _classCallCheck(instance, Constructor) {
  20606. if (!(instance instanceof Constructor)) {
  20607. throw new TypeError("Cannot call a class as a function");
  20608. }
  20609. }
  20610. var _createClass = function () {
  20611. function defineProperties(target, props) {
  20612. for (var i = 0; i < props.length; i++) {
  20613. var descriptor = props[i];
  20614. descriptor.enumerable = descriptor.enumerable || false;
  20615. descriptor.configurable = true;
  20616. if ("value" in descriptor) descriptor.writable = true;
  20617. Object.defineProperty(target, descriptor.key, descriptor);
  20618. }
  20619. }
  20620. return function (Constructor, protoProps, staticProps) {
  20621. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  20622. if (staticProps) defineProperties(Constructor, staticProps);
  20623. return Constructor;
  20624. };
  20625. }();
  20626. var ClipboardAction = function () {
  20627. /**
  20628. * @param {Object} options
  20629. */
  20630. function ClipboardAction(options) {
  20631. _classCallCheck(this, ClipboardAction);
  20632. this.resolveOptions(options);
  20633. this.initSelection();
  20634. }
  20635. /**
  20636. * Defines base properties passed from constructor.
  20637. * @param {Object} options
  20638. */
  20639. _createClass(ClipboardAction, [{
  20640. key: 'resolveOptions',
  20641. value: function resolveOptions() {
  20642. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  20643. this.action = options.action;
  20644. this.emitter = options.emitter;
  20645. this.target = options.target;
  20646. this.text = options.text;
  20647. this.trigger = options.trigger;
  20648. this.selectedText = '';
  20649. }
  20650. }, {
  20651. key: 'initSelection',
  20652. value: function initSelection() {
  20653. if (this.text) {
  20654. this.selectFake();
  20655. } else if (this.target) {
  20656. this.selectTarget();
  20657. }
  20658. }
  20659. }, {
  20660. key: 'selectFake',
  20661. value: function selectFake() {
  20662. var _this = this;
  20663. var isRTL = document.documentElement.getAttribute('dir') == 'rtl';
  20664. this.removeFake();
  20665. this.fakeHandlerCallback = function () {
  20666. return _this.removeFake();
  20667. };
  20668. this.fakeHandler = document.body.addEventListener('click', this.fakeHandlerCallback) || true;
  20669. this.fakeElem = document.createElement('textarea');
  20670. // Prevent zooming on iOS
  20671. this.fakeElem.style.fontSize = '12pt';
  20672. // Reset box model
  20673. this.fakeElem.style.border = '0';
  20674. this.fakeElem.style.padding = '0';
  20675. this.fakeElem.style.margin = '0';
  20676. // Move element out of screen horizontally
  20677. this.fakeElem.style.position = 'absolute';
  20678. this.fakeElem.style[isRTL ? 'right' : 'left'] = '-9999px';
  20679. // Move element to the same position vertically
  20680. var yPosition = window.pageYOffset || document.documentElement.scrollTop;
  20681. this.fakeElem.addEventListener('focus', window.scrollTo(0, yPosition));
  20682. this.fakeElem.style.top = yPosition + 'px';
  20683. this.fakeElem.setAttribute('readonly', '');
  20684. this.fakeElem.value = this.text;
  20685. document.body.appendChild(this.fakeElem);
  20686. this.selectedText = (0, _select2.default)(this.fakeElem);
  20687. this.copyText();
  20688. }
  20689. }, {
  20690. key: 'removeFake',
  20691. value: function removeFake() {
  20692. if (this.fakeHandler) {
  20693. document.body.removeEventListener('click', this.fakeHandlerCallback);
  20694. this.fakeHandler = null;
  20695. this.fakeHandlerCallback = null;
  20696. }
  20697. if (this.fakeElem) {
  20698. document.body.removeChild(this.fakeElem);
  20699. this.fakeElem = null;
  20700. }
  20701. }
  20702. }, {
  20703. key: 'selectTarget',
  20704. value: function selectTarget() {
  20705. this.selectedText = (0, _select2.default)(this.target);
  20706. this.copyText();
  20707. }
  20708. }, {
  20709. key: 'copyText',
  20710. value: function copyText() {
  20711. var succeeded = void 0;
  20712. try {
  20713. succeeded = document.execCommand(this.action);
  20714. } catch (err) {
  20715. succeeded = false;
  20716. }
  20717. this.handleResult(succeeded);
  20718. }
  20719. }, {
  20720. key: 'handleResult',
  20721. value: function handleResult(succeeded) {
  20722. this.emitter.emit(succeeded ? 'success' : 'error', {
  20723. action: this.action,
  20724. text: this.selectedText,
  20725. trigger: this.trigger,
  20726. clearSelection: this.clearSelection.bind(this)
  20727. });
  20728. }
  20729. }, {
  20730. key: 'clearSelection',
  20731. value: function clearSelection() {
  20732. if (this.target) {
  20733. this.target.blur();
  20734. }
  20735. window.getSelection().removeAllRanges();
  20736. }
  20737. }, {
  20738. key: 'destroy',
  20739. value: function destroy() {
  20740. this.removeFake();
  20741. }
  20742. }, {
  20743. key: 'action',
  20744. set: function set() {
  20745. var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'copy';
  20746. this._action = action;
  20747. if (this._action !== 'copy' && this._action !== 'cut') {
  20748. throw new Error('Invalid "action" value, use either "copy" or "cut"');
  20749. }
  20750. },
  20751. get: function get() {
  20752. return this._action;
  20753. }
  20754. }, {
  20755. key: 'target',
  20756. set: function set(target) {
  20757. if (target !== undefined) {
  20758. if (target && (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target.nodeType === 1) {
  20759. if (this.action === 'copy' && target.hasAttribute('disabled')) {
  20760. throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');
  20761. }
  20762. if (this.action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {
  20763. throw new Error('Invalid "target" attribute. You can\'t cut text from elements with "readonly" or "disabled" attributes');
  20764. }
  20765. this._target = target;
  20766. } else {
  20767. throw new Error('Invalid "target" value, use a valid Element');
  20768. }
  20769. }
  20770. },
  20771. get: function get() {
  20772. return this._target;
  20773. }
  20774. }]);
  20775. return ClipboardAction;
  20776. }();
  20777. module.exports = ClipboardAction;
  20778. });
  20779. /***/ },
  20780. /* 175 */
  20781. /***/ function(module, exports, __webpack_require__) {
  20782. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
  20783. if (true) {
  20784. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, __webpack_require__(174), __webpack_require__(281), __webpack_require__(247)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  20785. } else if (typeof exports !== "undefined") {
  20786. factory(module, require('./clipboard-action'), require('tiny-emitter'), require('good-listener'));
  20787. } else {
  20788. var mod = {
  20789. exports: {}
  20790. };
  20791. factory(mod, global.clipboardAction, global.tinyEmitter, global.goodListener);
  20792. global.clipboard = mod.exports;
  20793. }
  20794. })(this, function (module, _clipboardAction, _tinyEmitter, _goodListener) {
  20795. 'use strict';
  20796. var _clipboardAction2 = _interopRequireDefault(_clipboardAction);
  20797. var _tinyEmitter2 = _interopRequireDefault(_tinyEmitter);
  20798. var _goodListener2 = _interopRequireDefault(_goodListener);
  20799. function _interopRequireDefault(obj) {
  20800. return obj && obj.__esModule ? obj : {
  20801. default: obj
  20802. };
  20803. }
  20804. function _classCallCheck(instance, Constructor) {
  20805. if (!(instance instanceof Constructor)) {
  20806. throw new TypeError("Cannot call a class as a function");
  20807. }
  20808. }
  20809. var _createClass = function () {
  20810. function defineProperties(target, props) {
  20811. for (var i = 0; i < props.length; i++) {
  20812. var descriptor = props[i];
  20813. descriptor.enumerable = descriptor.enumerable || false;
  20814. descriptor.configurable = true;
  20815. if ("value" in descriptor) descriptor.writable = true;
  20816. Object.defineProperty(target, descriptor.key, descriptor);
  20817. }
  20818. }
  20819. return function (Constructor, protoProps, staticProps) {
  20820. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  20821. if (staticProps) defineProperties(Constructor, staticProps);
  20822. return Constructor;
  20823. };
  20824. }();
  20825. function _possibleConstructorReturn(self, call) {
  20826. if (!self) {
  20827. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  20828. }
  20829. return call && (typeof call === "object" || typeof call === "function") ? call : self;
  20830. }
  20831. function _inherits(subClass, superClass) {
  20832. if (typeof superClass !== "function" && superClass !== null) {
  20833. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  20834. }
  20835. subClass.prototype = Object.create(superClass && superClass.prototype, {
  20836. constructor: {
  20837. value: subClass,
  20838. enumerable: false,
  20839. writable: true,
  20840. configurable: true
  20841. }
  20842. });
  20843. if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  20844. }
  20845. var Clipboard = function (_Emitter) {
  20846. _inherits(Clipboard, _Emitter);
  20847. /**
  20848. * @param {String|HTMLElement|HTMLCollection|NodeList} trigger
  20849. * @param {Object} options
  20850. */
  20851. function Clipboard(trigger, options) {
  20852. _classCallCheck(this, Clipboard);
  20853. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this));
  20854. _this.resolveOptions(options);
  20855. _this.listenClick(trigger);
  20856. return _this;
  20857. }
  20858. /**
  20859. * Defines if attributes would be resolved using internal setter functions
  20860. * or custom functions that were passed in the constructor.
  20861. * @param {Object} options
  20862. */
  20863. _createClass(Clipboard, [{
  20864. key: 'resolveOptions',
  20865. value: function resolveOptions() {
  20866. var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  20867. this.action = typeof options.action === 'function' ? options.action : this.defaultAction;
  20868. this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;
  20869. this.text = typeof options.text === 'function' ? options.text : this.defaultText;
  20870. }
  20871. }, {
  20872. key: 'listenClick',
  20873. value: function listenClick(trigger) {
  20874. var _this2 = this;
  20875. this.listener = (0, _goodListener2.default)(trigger, 'click', function (e) {
  20876. return _this2.onClick(e);
  20877. });
  20878. }
  20879. }, {
  20880. key: 'onClick',
  20881. value: function onClick(e) {
  20882. var trigger = e.delegateTarget || e.currentTarget;
  20883. if (this.clipboardAction) {
  20884. this.clipboardAction = null;
  20885. }
  20886. this.clipboardAction = new _clipboardAction2.default({
  20887. action: this.action(trigger),
  20888. target: this.target(trigger),
  20889. text: this.text(trigger),
  20890. trigger: trigger,
  20891. emitter: this
  20892. });
  20893. }
  20894. }, {
  20895. key: 'defaultAction',
  20896. value: function defaultAction(trigger) {
  20897. return getAttributeValue('action', trigger);
  20898. }
  20899. }, {
  20900. key: 'defaultTarget',
  20901. value: function defaultTarget(trigger) {
  20902. var selector = getAttributeValue('target', trigger);
  20903. if (selector) {
  20904. return document.querySelector(selector);
  20905. }
  20906. }
  20907. }, {
  20908. key: 'defaultText',
  20909. value: function defaultText(trigger) {
  20910. return getAttributeValue('text', trigger);
  20911. }
  20912. }, {
  20913. key: 'destroy',
  20914. value: function destroy() {
  20915. this.listener.destroy();
  20916. if (this.clipboardAction) {
  20917. this.clipboardAction.destroy();
  20918. this.clipboardAction = null;
  20919. }
  20920. }
  20921. }]);
  20922. return Clipboard;
  20923. }(_tinyEmitter2.default);
  20924. /**
  20925. * Helper function to retrieve attribute value.
  20926. * @param {String} suffix
  20927. * @param {Element} element
  20928. */
  20929. function getAttributeValue(suffix, element) {
  20930. var attribute = 'data-clipboard-' + suffix;
  20931. if (!element.hasAttribute(attribute)) {
  20932. return;
  20933. }
  20934. return element.getAttribute(attribute);
  20935. }
  20936. module.exports = Clipboard;
  20937. });
  20938. /***/ },
  20939. /* 176 */
  20940. /***/ function(module, exports, __webpack_require__) {
  20941. var core = __webpack_require__(8)
  20942. , $JSON = core.JSON || (core.JSON = {stringify: JSON.stringify});
  20943. module.exports = function stringify(it){ // eslint-disable-line no-unused-vars
  20944. return $JSON.stringify.apply($JSON, arguments);
  20945. };
  20946. /***/ },
  20947. /* 177 */
  20948. /***/ function(module, exports, __webpack_require__) {
  20949. __webpack_require__(208);
  20950. module.exports = __webpack_require__(8).Object.assign;
  20951. /***/ },
  20952. /* 178 */
  20953. /***/ function(module, exports, __webpack_require__) {
  20954. __webpack_require__(209);
  20955. var $Object = __webpack_require__(8).Object;
  20956. module.exports = function defineProperty(it, key, desc){
  20957. return $Object.defineProperty(it, key, desc);
  20958. };
  20959. /***/ },
  20960. /* 179 */
  20961. /***/ function(module, exports, __webpack_require__) {
  20962. __webpack_require__(210);
  20963. __webpack_require__(212);
  20964. __webpack_require__(213);
  20965. __webpack_require__(211);
  20966. module.exports = __webpack_require__(8).Promise;
  20967. /***/ },
  20968. /* 180 */
  20969. /***/ function(module, exports) {
  20970. module.exports = function(){ /* empty */ };
  20971. /***/ },
  20972. /* 181 */
  20973. /***/ function(module, exports) {
  20974. module.exports = function(it, Constructor, name, forbiddenField){
  20975. if(!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)){
  20976. throw TypeError(name + ': incorrect invocation!');
  20977. } return it;
  20978. };
  20979. /***/ },
  20980. /* 182 */
  20981. /***/ function(module, exports, __webpack_require__) {
  20982. // false -> Array#indexOf
  20983. // true -> Array#includes
  20984. var toIObject = __webpack_require__(59)
  20985. , toLength = __webpack_require__(101)
  20986. , toIndex = __webpack_require__(204);
  20987. module.exports = function(IS_INCLUDES){
  20988. return function($this, el, fromIndex){
  20989. var O = toIObject($this)
  20990. , length = toLength(O.length)
  20991. , index = toIndex(fromIndex, length)
  20992. , value;
  20993. // Array#includes uses SameValueZero equality algorithm
  20994. if(IS_INCLUDES && el != el)while(length > index){
  20995. value = O[index++];
  20996. if(value != value)return true;
  20997. // Array#toIndex ignores holes, Array#includes - not
  20998. } else for(;length > index; index++)if(IS_INCLUDES || index in O){
  20999. if(O[index] === el)return IS_INCLUDES || index || 0;
  21000. } return !IS_INCLUDES && -1;
  21001. };
  21002. };
  21003. /***/ },
  21004. /* 183 */
  21005. /***/ function(module, exports, __webpack_require__) {
  21006. var ctx = __webpack_require__(39)
  21007. , call = __webpack_require__(187)
  21008. , isArrayIter = __webpack_require__(186)
  21009. , anObject = __webpack_require__(13)
  21010. , toLength = __webpack_require__(101)
  21011. , getIterFn = __webpack_require__(206)
  21012. , BREAK = {}
  21013. , RETURN = {};
  21014. var exports = module.exports = function(iterable, entries, fn, that, ITERATOR){
  21015. var iterFn = ITERATOR ? function(){ return iterable; } : getIterFn(iterable)
  21016. , f = ctx(fn, that, entries ? 2 : 1)
  21017. , index = 0
  21018. , length, step, iterator, result;
  21019. if(typeof iterFn != 'function')throw TypeError(iterable + ' is not iterable!');
  21020. // fast case for arrays with default iterator
  21021. if(isArrayIter(iterFn))for(length = toLength(iterable.length); length > index; index++){
  21022. result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
  21023. if(result === BREAK || result === RETURN)return result;
  21024. } else for(iterator = iterFn.call(iterable); !(step = iterator.next()).done; ){
  21025. result = call(iterator, f, step.value, entries);
  21026. if(result === BREAK || result === RETURN)return result;
  21027. }
  21028. };
  21029. exports.BREAK = BREAK;
  21030. exports.RETURN = RETURN;
  21031. /***/ },
  21032. /* 184 */
  21033. /***/ function(module, exports, __webpack_require__) {
  21034. module.exports = !__webpack_require__(14) && !__webpack_require__(55)(function(){
  21035. return Object.defineProperty(__webpack_require__(54)('div'), 'a', {get: function(){ return 7; }}).a != 7;
  21036. });
  21037. /***/ },
  21038. /* 185 */
  21039. /***/ function(module, exports) {
  21040. // fast apply, http://jsperf.lnkit.com/fast-apply/5
  21041. module.exports = function(fn, args, that){
  21042. var un = that === undefined;
  21043. switch(args.length){
  21044. case 0: return un ? fn()
  21045. : fn.call(that);
  21046. case 1: return un ? fn(args[0])
  21047. : fn.call(that, args[0]);
  21048. case 2: return un ? fn(args[0], args[1])
  21049. : fn.call(that, args[0], args[1]);
  21050. case 3: return un ? fn(args[0], args[1], args[2])
  21051. : fn.call(that, args[0], args[1], args[2]);
  21052. case 4: return un ? fn(args[0], args[1], args[2], args[3])
  21053. : fn.call(that, args[0], args[1], args[2], args[3]);
  21054. } return fn.apply(that, args);
  21055. };
  21056. /***/ },
  21057. /* 186 */
  21058. /***/ function(module, exports, __webpack_require__) {
  21059. // check on default Array iterator
  21060. var Iterators = __webpack_require__(27)
  21061. , ITERATOR = __webpack_require__(5)('iterator')
  21062. , ArrayProto = Array.prototype;
  21063. module.exports = function(it){
  21064. return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
  21065. };
  21066. /***/ },
  21067. /* 187 */
  21068. /***/ function(module, exports, __webpack_require__) {
  21069. // call something on iterator step with safe closing on error
  21070. var anObject = __webpack_require__(13);
  21071. module.exports = function(iterator, fn, value, entries){
  21072. try {
  21073. return entries ? fn(anObject(value)[0], value[1]) : fn(value);
  21074. // 7.4.6 IteratorClose(iterator, completion)
  21075. } catch(e){
  21076. var ret = iterator['return'];
  21077. if(ret !== undefined)anObject(ret.call(iterator));
  21078. throw e;
  21079. }
  21080. };
  21081. /***/ },
  21082. /* 188 */
  21083. /***/ function(module, exports, __webpack_require__) {
  21084. "use strict";
  21085. 'use strict';
  21086. var create = __webpack_require__(193)
  21087. , descriptor = __webpack_require__(98)
  21088. , setToStringTag = __webpack_require__(56)
  21089. , IteratorPrototype = {};
  21090. // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
  21091. __webpack_require__(15)(IteratorPrototype, __webpack_require__(5)('iterator'), function(){ return this; });
  21092. module.exports = function(Constructor, NAME, next){
  21093. Constructor.prototype = create(IteratorPrototype, {next: descriptor(1, next)});
  21094. setToStringTag(Constructor, NAME + ' Iterator');
  21095. };
  21096. /***/ },
  21097. /* 189 */
  21098. /***/ function(module, exports, __webpack_require__) {
  21099. var ITERATOR = __webpack_require__(5)('iterator')
  21100. , SAFE_CLOSING = false;
  21101. try {
  21102. var riter = [7][ITERATOR]();
  21103. riter['return'] = function(){ SAFE_CLOSING = true; };
  21104. Array.from(riter, function(){ throw 2; });
  21105. } catch(e){ /* empty */ }
  21106. module.exports = function(exec, skipClosing){
  21107. if(!skipClosing && !SAFE_CLOSING)return false;
  21108. var safe = false;
  21109. try {
  21110. var arr = [7]
  21111. , iter = arr[ITERATOR]();
  21112. iter.next = function(){ return {done: safe = true}; };
  21113. arr[ITERATOR] = function(){ return iter; };
  21114. exec(arr);
  21115. } catch(e){ /* empty */ }
  21116. return safe;
  21117. };
  21118. /***/ },
  21119. /* 190 */
  21120. /***/ function(module, exports) {
  21121. module.exports = function(done, value){
  21122. return {value: value, done: !!done};
  21123. };
  21124. /***/ },
  21125. /* 191 */
  21126. /***/ function(module, exports, __webpack_require__) {
  21127. var global = __webpack_require__(6)
  21128. , macrotask = __webpack_require__(100).set
  21129. , Observer = global.MutationObserver || global.WebKitMutationObserver
  21130. , process = global.process
  21131. , Promise = global.Promise
  21132. , isNode = __webpack_require__(38)(process) == 'process';
  21133. module.exports = function(){
  21134. var head, last, notify;
  21135. var flush = function(){
  21136. var parent, fn;
  21137. if(isNode && (parent = process.domain))parent.exit();
  21138. while(head){
  21139. fn = head.fn;
  21140. head = head.next;
  21141. try {
  21142. fn();
  21143. } catch(e){
  21144. if(head)notify();
  21145. else last = undefined;
  21146. throw e;
  21147. }
  21148. } last = undefined;
  21149. if(parent)parent.enter();
  21150. };
  21151. // Node.js
  21152. if(isNode){
  21153. notify = function(){
  21154. process.nextTick(flush);
  21155. };
  21156. // browsers with MutationObserver
  21157. } else if(Observer){
  21158. var toggle = true
  21159. , node = document.createTextNode('');
  21160. new Observer(flush).observe(node, {characterData: true}); // eslint-disable-line no-new
  21161. notify = function(){
  21162. node.data = toggle = !toggle;
  21163. };
  21164. // environments with maybe non-completely correct, but existent Promise
  21165. } else if(Promise && Promise.resolve){
  21166. var promise = Promise.resolve();
  21167. notify = function(){
  21168. promise.then(flush);
  21169. };
  21170. // for other environments - macrotask based on:
  21171. // - setImmediate
  21172. // - MessageChannel
  21173. // - window.postMessag
  21174. // - onreadystatechange
  21175. // - setTimeout
  21176. } else {
  21177. notify = function(){
  21178. // strange IE + webpack dev server bug - use .call(global)
  21179. macrotask.call(global, flush);
  21180. };
  21181. }
  21182. return function(fn){
  21183. var task = {fn: fn, next: undefined};
  21184. if(last)last.next = task;
  21185. if(!head){
  21186. head = task;
  21187. notify();
  21188. } last = task;
  21189. };
  21190. };
  21191. /***/ },
  21192. /* 192 */
  21193. /***/ function(module, exports, __webpack_require__) {
  21194. "use strict";
  21195. 'use strict';
  21196. // 19.1.2.1 Object.assign(target, source, ...)
  21197. var getKeys = __webpack_require__(97)
  21198. , gOPS = __webpack_require__(195)
  21199. , pIE = __webpack_require__(198)
  21200. , toObject = __webpack_require__(102)
  21201. , IObject = __webpack_require__(94)
  21202. , $assign = Object.assign;
  21203. // should work with symbols and should have deterministic property order (V8 bug)
  21204. module.exports = !$assign || __webpack_require__(55)(function(){
  21205. var A = {}
  21206. , B = {}
  21207. , S = Symbol()
  21208. , K = 'abcdefghijklmnopqrst';
  21209. A[S] = 7;
  21210. K.split('').forEach(function(k){ B[k] = k; });
  21211. return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
  21212. }) ? function assign(target, source){ // eslint-disable-line no-unused-vars
  21213. var T = toObject(target)
  21214. , aLen = arguments.length
  21215. , index = 1
  21216. , getSymbols = gOPS.f
  21217. , isEnum = pIE.f;
  21218. while(aLen > index){
  21219. var S = IObject(arguments[index++])
  21220. , keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S)
  21221. , length = keys.length
  21222. , j = 0
  21223. , key;
  21224. while(length > j)if(isEnum.call(S, key = keys[j++]))T[key] = S[key];
  21225. } return T;
  21226. } : $assign;
  21227. /***/ },
  21228. /* 193 */
  21229. /***/ function(module, exports, __webpack_require__) {
  21230. // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
  21231. var anObject = __webpack_require__(13)
  21232. , dPs = __webpack_require__(194)
  21233. , enumBugKeys = __webpack_require__(92)
  21234. , IE_PROTO = __webpack_require__(57)('IE_PROTO')
  21235. , Empty = function(){ /* empty */ }
  21236. , PROTOTYPE = 'prototype';
  21237. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  21238. var createDict = function(){
  21239. // Thrash, waste and sodomy: IE GC bug
  21240. var iframe = __webpack_require__(54)('iframe')
  21241. , i = enumBugKeys.length
  21242. , lt = '<'
  21243. , gt = '>'
  21244. , iframeDocument;
  21245. iframe.style.display = 'none';
  21246. __webpack_require__(93).appendChild(iframe);
  21247. iframe.src = 'javascript:'; // eslint-disable-line no-script-url
  21248. // createDict = iframe.contentWindow.Object;
  21249. // html.removeChild(iframe);
  21250. iframeDocument = iframe.contentWindow.document;
  21251. iframeDocument.open();
  21252. iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
  21253. iframeDocument.close();
  21254. createDict = iframeDocument.F;
  21255. while(i--)delete createDict[PROTOTYPE][enumBugKeys[i]];
  21256. return createDict();
  21257. };
  21258. module.exports = Object.create || function create(O, Properties){
  21259. var result;
  21260. if(O !== null){
  21261. Empty[PROTOTYPE] = anObject(O);
  21262. result = new Empty;
  21263. Empty[PROTOTYPE] = null;
  21264. // add "__proto__" for Object.getPrototypeOf polyfill
  21265. result[IE_PROTO] = O;
  21266. } else result = createDict();
  21267. return Properties === undefined ? result : dPs(result, Properties);
  21268. };
  21269. /***/ },
  21270. /* 194 */
  21271. /***/ function(module, exports, __webpack_require__) {
  21272. var dP = __webpack_require__(28)
  21273. , anObject = __webpack_require__(13)
  21274. , getKeys = __webpack_require__(97);
  21275. module.exports = __webpack_require__(14) ? Object.defineProperties : function defineProperties(O, Properties){
  21276. anObject(O);
  21277. var keys = getKeys(Properties)
  21278. , length = keys.length
  21279. , i = 0
  21280. , P;
  21281. while(length > i)dP.f(O, P = keys[i++], Properties[P]);
  21282. return O;
  21283. };
  21284. /***/ },
  21285. /* 195 */
  21286. /***/ function(module, exports) {
  21287. exports.f = Object.getOwnPropertySymbols;
  21288. /***/ },
  21289. /* 196 */
  21290. /***/ function(module, exports, __webpack_require__) {
  21291. // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
  21292. var has = __webpack_require__(41)
  21293. , toObject = __webpack_require__(102)
  21294. , IE_PROTO = __webpack_require__(57)('IE_PROTO')
  21295. , ObjectProto = Object.prototype;
  21296. module.exports = Object.getPrototypeOf || function(O){
  21297. O = toObject(O);
  21298. if(has(O, IE_PROTO))return O[IE_PROTO];
  21299. if(typeof O.constructor == 'function' && O instanceof O.constructor){
  21300. return O.constructor.prototype;
  21301. } return O instanceof Object ? ObjectProto : null;
  21302. };
  21303. /***/ },
  21304. /* 197 */
  21305. /***/ function(module, exports, __webpack_require__) {
  21306. var has = __webpack_require__(41)
  21307. , toIObject = __webpack_require__(59)
  21308. , arrayIndexOf = __webpack_require__(182)(false)
  21309. , IE_PROTO = __webpack_require__(57)('IE_PROTO');
  21310. module.exports = function(object, names){
  21311. var O = toIObject(object)
  21312. , i = 0
  21313. , result = []
  21314. , key;
  21315. for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key);
  21316. // Don't enum bug & hidden keys
  21317. while(names.length > i)if(has(O, key = names[i++])){
  21318. ~arrayIndexOf(result, key) || result.push(key);
  21319. }
  21320. return result;
  21321. };
  21322. /***/ },
  21323. /* 198 */
  21324. /***/ function(module, exports) {
  21325. exports.f = {}.propertyIsEnumerable;
  21326. /***/ },
  21327. /* 199 */
  21328. /***/ function(module, exports, __webpack_require__) {
  21329. var hide = __webpack_require__(15);
  21330. module.exports = function(target, src, safe){
  21331. for(var key in src){
  21332. if(safe && target[key])target[key] = src[key];
  21333. else hide(target, key, src[key]);
  21334. } return target;
  21335. };
  21336. /***/ },
  21337. /* 200 */
  21338. /***/ function(module, exports, __webpack_require__) {
  21339. module.exports = __webpack_require__(15);
  21340. /***/ },
  21341. /* 201 */
  21342. /***/ function(module, exports, __webpack_require__) {
  21343. "use strict";
  21344. 'use strict';
  21345. var global = __webpack_require__(6)
  21346. , core = __webpack_require__(8)
  21347. , dP = __webpack_require__(28)
  21348. , DESCRIPTORS = __webpack_require__(14)
  21349. , SPECIES = __webpack_require__(5)('species');
  21350. module.exports = function(KEY){
  21351. var C = typeof core[KEY] == 'function' ? core[KEY] : global[KEY];
  21352. if(DESCRIPTORS && C && !C[SPECIES])dP.f(C, SPECIES, {
  21353. configurable: true,
  21354. get: function(){ return this; }
  21355. });
  21356. };
  21357. /***/ },
  21358. /* 202 */
  21359. /***/ function(module, exports, __webpack_require__) {
  21360. // 7.3.20 SpeciesConstructor(O, defaultConstructor)
  21361. var anObject = __webpack_require__(13)
  21362. , aFunction = __webpack_require__(52)
  21363. , SPECIES = __webpack_require__(5)('species');
  21364. module.exports = function(O, D){
  21365. var C = anObject(O).constructor, S;
  21366. return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);
  21367. };
  21368. /***/ },
  21369. /* 203 */
  21370. /***/ function(module, exports, __webpack_require__) {
  21371. var toInteger = __webpack_require__(58)
  21372. , defined = __webpack_require__(53);
  21373. // true -> String#at
  21374. // false -> String#codePointAt
  21375. module.exports = function(TO_STRING){
  21376. return function(that, pos){
  21377. var s = String(defined(that))
  21378. , i = toInteger(pos)
  21379. , l = s.length
  21380. , a, b;
  21381. if(i < 0 || i >= l)return TO_STRING ? '' : undefined;
  21382. a = s.charCodeAt(i);
  21383. return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
  21384. ? TO_STRING ? s.charAt(i) : a
  21385. : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
  21386. };
  21387. };
  21388. /***/ },
  21389. /* 204 */
  21390. /***/ function(module, exports, __webpack_require__) {
  21391. var toInteger = __webpack_require__(58)
  21392. , max = Math.max
  21393. , min = Math.min;
  21394. module.exports = function(index, length){
  21395. index = toInteger(index);
  21396. return index < 0 ? max(index + length, 0) : min(index, length);
  21397. };
  21398. /***/ },
  21399. /* 205 */
  21400. /***/ function(module, exports, __webpack_require__) {
  21401. // 7.1.1 ToPrimitive(input [, PreferredType])
  21402. var isObject = __webpack_require__(42);
  21403. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  21404. // and the second argument - flag - preferred type is a string
  21405. module.exports = function(it, S){
  21406. if(!isObject(it))return it;
  21407. var fn, val;
  21408. if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
  21409. if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val;
  21410. if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
  21411. throw TypeError("Can't convert object to primitive value");
  21412. };
  21413. /***/ },
  21414. /* 206 */
  21415. /***/ function(module, exports, __webpack_require__) {
  21416. var classof = __webpack_require__(91)
  21417. , ITERATOR = __webpack_require__(5)('iterator')
  21418. , Iterators = __webpack_require__(27);
  21419. module.exports = __webpack_require__(8).getIteratorMethod = function(it){
  21420. if(it != undefined)return it[ITERATOR]
  21421. || it['@@iterator']
  21422. || Iterators[classof(it)];
  21423. };
  21424. /***/ },
  21425. /* 207 */
  21426. /***/ function(module, exports, __webpack_require__) {
  21427. "use strict";
  21428. 'use strict';
  21429. var addToUnscopables = __webpack_require__(180)
  21430. , step = __webpack_require__(190)
  21431. , Iterators = __webpack_require__(27)
  21432. , toIObject = __webpack_require__(59);
  21433. // 22.1.3.4 Array.prototype.entries()
  21434. // 22.1.3.13 Array.prototype.keys()
  21435. // 22.1.3.29 Array.prototype.values()
  21436. // 22.1.3.30 Array.prototype[@@iterator]()
  21437. module.exports = __webpack_require__(95)(Array, 'Array', function(iterated, kind){
  21438. this._t = toIObject(iterated); // target
  21439. this._i = 0; // next index
  21440. this._k = kind; // kind
  21441. // 22.1.5.2.1 %ArrayIteratorPrototype%.next()
  21442. }, function(){
  21443. var O = this._t
  21444. , kind = this._k
  21445. , index = this._i++;
  21446. if(!O || index >= O.length){
  21447. this._t = undefined;
  21448. return step(1);
  21449. }
  21450. if(kind == 'keys' )return step(0, index);
  21451. if(kind == 'values')return step(0, O[index]);
  21452. return step(0, [index, O[index]]);
  21453. }, 'values');
  21454. // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
  21455. Iterators.Arguments = Iterators.Array;
  21456. addToUnscopables('keys');
  21457. addToUnscopables('values');
  21458. addToUnscopables('entries');
  21459. /***/ },
  21460. /* 208 */
  21461. /***/ function(module, exports, __webpack_require__) {
  21462. // 19.1.3.1 Object.assign(target, source)
  21463. var $export = __webpack_require__(40);
  21464. $export($export.S + $export.F, 'Object', {assign: __webpack_require__(192)});
  21465. /***/ },
  21466. /* 209 */
  21467. /***/ function(module, exports, __webpack_require__) {
  21468. var $export = __webpack_require__(40);
  21469. // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
  21470. $export($export.S + $export.F * !__webpack_require__(14), 'Object', {defineProperty: __webpack_require__(28).f});
  21471. /***/ },
  21472. /* 210 */
  21473. /***/ function(module, exports) {
  21474. /***/ },
  21475. /* 211 */
  21476. /***/ function(module, exports, __webpack_require__) {
  21477. "use strict";
  21478. 'use strict';
  21479. var LIBRARY = __webpack_require__(96)
  21480. , global = __webpack_require__(6)
  21481. , ctx = __webpack_require__(39)
  21482. , classof = __webpack_require__(91)
  21483. , $export = __webpack_require__(40)
  21484. , isObject = __webpack_require__(42)
  21485. , aFunction = __webpack_require__(52)
  21486. , anInstance = __webpack_require__(181)
  21487. , forOf = __webpack_require__(183)
  21488. , speciesConstructor = __webpack_require__(202)
  21489. , task = __webpack_require__(100).set
  21490. , microtask = __webpack_require__(191)()
  21491. , PROMISE = 'Promise'
  21492. , TypeError = global.TypeError
  21493. , process = global.process
  21494. , $Promise = global[PROMISE]
  21495. , process = global.process
  21496. , isNode = classof(process) == 'process'
  21497. , empty = function(){ /* empty */ }
  21498. , Internal, GenericPromiseCapability, Wrapper;
  21499. var USE_NATIVE = !!function(){
  21500. try {
  21501. // correct subclassing with @@species support
  21502. var promise = $Promise.resolve(1)
  21503. , FakePromise = (promise.constructor = {})[__webpack_require__(5)('species')] = function(exec){ exec(empty, empty); };
  21504. // unhandled rejections tracking support, NodeJS Promise without it fails @@species test
  21505. return (isNode || typeof PromiseRejectionEvent == 'function') && promise.then(empty) instanceof FakePromise;
  21506. } catch(e){ /* empty */ }
  21507. }();
  21508. // helpers
  21509. var sameConstructor = function(a, b){
  21510. // with library wrapper special case
  21511. return a === b || a === $Promise && b === Wrapper;
  21512. };
  21513. var isThenable = function(it){
  21514. var then;
  21515. return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
  21516. };
  21517. var newPromiseCapability = function(C){
  21518. return sameConstructor($Promise, C)
  21519. ? new PromiseCapability(C)
  21520. : new GenericPromiseCapability(C);
  21521. };
  21522. var PromiseCapability = GenericPromiseCapability = function(C){
  21523. var resolve, reject;
  21524. this.promise = new C(function($$resolve, $$reject){
  21525. if(resolve !== undefined || reject !== undefined)throw TypeError('Bad Promise constructor');
  21526. resolve = $$resolve;
  21527. reject = $$reject;
  21528. });
  21529. this.resolve = aFunction(resolve);
  21530. this.reject = aFunction(reject);
  21531. };
  21532. var perform = function(exec){
  21533. try {
  21534. exec();
  21535. } catch(e){
  21536. return {error: e};
  21537. }
  21538. };
  21539. var notify = function(promise, isReject){
  21540. if(promise._n)return;
  21541. promise._n = true;
  21542. var chain = promise._c;
  21543. microtask(function(){
  21544. var value = promise._v
  21545. , ok = promise._s == 1
  21546. , i = 0;
  21547. var run = function(reaction){
  21548. var handler = ok ? reaction.ok : reaction.fail
  21549. , resolve = reaction.resolve
  21550. , reject = reaction.reject
  21551. , domain = reaction.domain
  21552. , result, then;
  21553. try {
  21554. if(handler){
  21555. if(!ok){
  21556. if(promise._h == 2)onHandleUnhandled(promise);
  21557. promise._h = 1;
  21558. }
  21559. if(handler === true)result = value;
  21560. else {
  21561. if(domain)domain.enter();
  21562. result = handler(value);
  21563. if(domain)domain.exit();
  21564. }
  21565. if(result === reaction.promise){
  21566. reject(TypeError('Promise-chain cycle'));
  21567. } else if(then = isThenable(result)){
  21568. then.call(result, resolve, reject);
  21569. } else resolve(result);
  21570. } else reject(value);
  21571. } catch(e){
  21572. reject(e);
  21573. }
  21574. };
  21575. while(chain.length > i)run(chain[i++]); // variable length - can't use forEach
  21576. promise._c = [];
  21577. promise._n = false;
  21578. if(isReject && !promise._h)onUnhandled(promise);
  21579. });
  21580. };
  21581. var onUnhandled = function(promise){
  21582. task.call(global, function(){
  21583. var value = promise._v
  21584. , abrupt, handler, console;
  21585. if(isUnhandled(promise)){
  21586. abrupt = perform(function(){
  21587. if(isNode){
  21588. process.emit('unhandledRejection', value, promise);
  21589. } else if(handler = global.onunhandledrejection){
  21590. handler({promise: promise, reason: value});
  21591. } else if((console = global.console) && console.error){
  21592. console.error('Unhandled promise rejection', value);
  21593. }
  21594. });
  21595. // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
  21596. promise._h = isNode || isUnhandled(promise) ? 2 : 1;
  21597. } promise._a = undefined;
  21598. if(abrupt)throw abrupt.error;
  21599. });
  21600. };
  21601. var isUnhandled = function(promise){
  21602. if(promise._h == 1)return false;
  21603. var chain = promise._a || promise._c
  21604. , i = 0
  21605. , reaction;
  21606. while(chain.length > i){
  21607. reaction = chain[i++];
  21608. if(reaction.fail || !isUnhandled(reaction.promise))return false;
  21609. } return true;
  21610. };
  21611. var onHandleUnhandled = function(promise){
  21612. task.call(global, function(){
  21613. var handler;
  21614. if(isNode){
  21615. process.emit('rejectionHandled', promise);
  21616. } else if(handler = global.onrejectionhandled){
  21617. handler({promise: promise, reason: promise._v});
  21618. }
  21619. });
  21620. };
  21621. var $reject = function(value){
  21622. var promise = this;
  21623. if(promise._d)return;
  21624. promise._d = true;
  21625. promise = promise._w || promise; // unwrap
  21626. promise._v = value;
  21627. promise._s = 2;
  21628. if(!promise._a)promise._a = promise._c.slice();
  21629. notify(promise, true);
  21630. };
  21631. var $resolve = function(value){
  21632. var promise = this
  21633. , then;
  21634. if(promise._d)return;
  21635. promise._d = true;
  21636. promise = promise._w || promise; // unwrap
  21637. try {
  21638. if(promise === value)throw TypeError("Promise can't be resolved itself");
  21639. if(then = isThenable(value)){
  21640. microtask(function(){
  21641. var wrapper = {_w: promise, _d: false}; // wrap
  21642. try {
  21643. then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));
  21644. } catch(e){
  21645. $reject.call(wrapper, e);
  21646. }
  21647. });
  21648. } else {
  21649. promise._v = value;
  21650. promise._s = 1;
  21651. notify(promise, false);
  21652. }
  21653. } catch(e){
  21654. $reject.call({_w: promise, _d: false}, e); // wrap
  21655. }
  21656. };
  21657. // constructor polyfill
  21658. if(!USE_NATIVE){
  21659. // 25.4.3.1 Promise(executor)
  21660. $Promise = function Promise(executor){
  21661. anInstance(this, $Promise, PROMISE, '_h');
  21662. aFunction(executor);
  21663. Internal.call(this);
  21664. try {
  21665. executor(ctx($resolve, this, 1), ctx($reject, this, 1));
  21666. } catch(err){
  21667. $reject.call(this, err);
  21668. }
  21669. };
  21670. Internal = function Promise(executor){
  21671. this._c = []; // <- awaiting reactions
  21672. this._a = undefined; // <- checked in isUnhandled reactions
  21673. this._s = 0; // <- state
  21674. this._d = false; // <- done
  21675. this._v = undefined; // <- value
  21676. this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled
  21677. this._n = false; // <- notify
  21678. };
  21679. Internal.prototype = __webpack_require__(199)($Promise.prototype, {
  21680. // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
  21681. then: function then(onFulfilled, onRejected){
  21682. var reaction = newPromiseCapability(speciesConstructor(this, $Promise));
  21683. reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
  21684. reaction.fail = typeof onRejected == 'function' && onRejected;
  21685. reaction.domain = isNode ? process.domain : undefined;
  21686. this._c.push(reaction);
  21687. if(this._a)this._a.push(reaction);
  21688. if(this._s)notify(this, false);
  21689. return reaction.promise;
  21690. },
  21691. // 25.4.5.1 Promise.prototype.catch(onRejected)
  21692. 'catch': function(onRejected){
  21693. return this.then(undefined, onRejected);
  21694. }
  21695. });
  21696. PromiseCapability = function(){
  21697. var promise = new Internal;
  21698. this.promise = promise;
  21699. this.resolve = ctx($resolve, promise, 1);
  21700. this.reject = ctx($reject, promise, 1);
  21701. };
  21702. }
  21703. $export($export.G + $export.W + $export.F * !USE_NATIVE, {Promise: $Promise});
  21704. __webpack_require__(56)($Promise, PROMISE);
  21705. __webpack_require__(201)(PROMISE);
  21706. Wrapper = __webpack_require__(8)[PROMISE];
  21707. // statics
  21708. $export($export.S + $export.F * !USE_NATIVE, PROMISE, {
  21709. // 25.4.4.5 Promise.reject(r)
  21710. reject: function reject(r){
  21711. var capability = newPromiseCapability(this)
  21712. , $$reject = capability.reject;
  21713. $$reject(r);
  21714. return capability.promise;
  21715. }
  21716. });
  21717. $export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, {
  21718. // 25.4.4.6 Promise.resolve(x)
  21719. resolve: function resolve(x){
  21720. // instanceof instead of internal slot check because we should fix it without replacement native Promise core
  21721. if(x instanceof $Promise && sameConstructor(x.constructor, this))return x;
  21722. var capability = newPromiseCapability(this)
  21723. , $$resolve = capability.resolve;
  21724. $$resolve(x);
  21725. return capability.promise;
  21726. }
  21727. });
  21728. $export($export.S + $export.F * !(USE_NATIVE && __webpack_require__(189)(function(iter){
  21729. $Promise.all(iter)['catch'](empty);
  21730. })), PROMISE, {
  21731. // 25.4.4.1 Promise.all(iterable)
  21732. all: function all(iterable){
  21733. var C = this
  21734. , capability = newPromiseCapability(C)
  21735. , resolve = capability.resolve
  21736. , reject = capability.reject;
  21737. var abrupt = perform(function(){
  21738. var values = []
  21739. , index = 0
  21740. , remaining = 1;
  21741. forOf(iterable, false, function(promise){
  21742. var $index = index++
  21743. , alreadyCalled = false;
  21744. values.push(undefined);
  21745. remaining++;
  21746. C.resolve(promise).then(function(value){
  21747. if(alreadyCalled)return;
  21748. alreadyCalled = true;
  21749. values[$index] = value;
  21750. --remaining || resolve(values);
  21751. }, reject);
  21752. });
  21753. --remaining || resolve(values);
  21754. });
  21755. if(abrupt)reject(abrupt.error);
  21756. return capability.promise;
  21757. },
  21758. // 25.4.4.4 Promise.race(iterable)
  21759. race: function race(iterable){
  21760. var C = this
  21761. , capability = newPromiseCapability(C)
  21762. , reject = capability.reject;
  21763. var abrupt = perform(function(){
  21764. forOf(iterable, false, function(promise){
  21765. C.resolve(promise).then(capability.resolve, reject);
  21766. });
  21767. });
  21768. if(abrupt)reject(abrupt.error);
  21769. return capability.promise;
  21770. }
  21771. });
  21772. /***/ },
  21773. /* 212 */
  21774. /***/ function(module, exports, __webpack_require__) {
  21775. "use strict";
  21776. 'use strict';
  21777. var $at = __webpack_require__(203)(true);
  21778. // 21.1.3.27 String.prototype[@@iterator]()
  21779. __webpack_require__(95)(String, 'String', function(iterated){
  21780. this._t = String(iterated); // target
  21781. this._i = 0; // next index
  21782. // 21.1.5.2.1 %StringIteratorPrototype%.next()
  21783. }, function(){
  21784. var O = this._t
  21785. , index = this._i
  21786. , point;
  21787. if(index >= O.length)return {value: undefined, done: true};
  21788. point = $at(O, index);
  21789. this._i += point.length;
  21790. return {value: point, done: false};
  21791. });
  21792. /***/ },
  21793. /* 213 */
  21794. /***/ function(module, exports, __webpack_require__) {
  21795. __webpack_require__(207);
  21796. var global = __webpack_require__(6)
  21797. , hide = __webpack_require__(15)
  21798. , Iterators = __webpack_require__(27)
  21799. , TO_STRING_TAG = __webpack_require__(5)('toStringTag');
  21800. for(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){
  21801. var NAME = collections[i]
  21802. , Collection = global[NAME]
  21803. , proto = Collection && Collection.prototype;
  21804. if(proto && !proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME);
  21805. Iterators[NAME] = Iterators.Array;
  21806. }
  21807. /***/ },
  21808. /* 214 */
  21809. /***/ function(module, exports, __webpack_require__) {
  21810. /* WEBPACK VAR INJECTION */(function(Buffer) {var elliptic = __webpack_require__(3);
  21811. var BN = __webpack_require__(2);
  21812. module.exports = function createECDH(curve) {
  21813. return new ECDH(curve);
  21814. };
  21815. var aliases = {
  21816. secp256k1: {
  21817. name: 'secp256k1',
  21818. byteLength: 32
  21819. },
  21820. secp224r1: {
  21821. name: 'p224',
  21822. byteLength: 28
  21823. },
  21824. prime256v1: {
  21825. name: 'p256',
  21826. byteLength: 32
  21827. },
  21828. prime192v1: {
  21829. name: 'p192',
  21830. byteLength: 24
  21831. },
  21832. ed25519: {
  21833. name: 'ed25519',
  21834. byteLength: 32
  21835. },
  21836. secp384r1: {
  21837. name: 'p384',
  21838. byteLength: 48
  21839. },
  21840. secp521r1: {
  21841. name: 'p521',
  21842. byteLength: 66
  21843. }
  21844. };
  21845. aliases.p224 = aliases.secp224r1;
  21846. aliases.p256 = aliases.secp256r1 = aliases.prime256v1;
  21847. aliases.p192 = aliases.secp192r1 = aliases.prime192v1;
  21848. aliases.p384 = aliases.secp384r1;
  21849. aliases.p521 = aliases.secp521r1;
  21850. function ECDH(curve) {
  21851. this.curveType = aliases[curve];
  21852. if (!this.curveType ) {
  21853. this.curveType = {
  21854. name: curve
  21855. };
  21856. }
  21857. this.curve = new elliptic.ec(this.curveType.name);
  21858. this.keys = void 0;
  21859. }
  21860. ECDH.prototype.generateKeys = function (enc, format) {
  21861. this.keys = this.curve.genKeyPair();
  21862. return this.getPublicKey(enc, format);
  21863. };
  21864. ECDH.prototype.computeSecret = function (other, inenc, enc) {
  21865. inenc = inenc || 'utf8';
  21866. if (!Buffer.isBuffer(other)) {
  21867. other = new Buffer(other, inenc);
  21868. }
  21869. var otherPub = this.curve.keyFromPublic(other).getPublic();
  21870. var out = otherPub.mul(this.keys.getPrivate()).getX();
  21871. return formatReturnValue(out, enc, this.curveType.byteLength);
  21872. };
  21873. ECDH.prototype.getPublicKey = function (enc, format) {
  21874. var key = this.keys.getPublic(format === 'compressed', true);
  21875. if (format === 'hybrid') {
  21876. if (key[key.length - 1] % 2) {
  21877. key[0] = 7;
  21878. } else {
  21879. key [0] = 6;
  21880. }
  21881. }
  21882. return formatReturnValue(key, enc);
  21883. };
  21884. ECDH.prototype.getPrivateKey = function (enc) {
  21885. return formatReturnValue(this.keys.getPrivate(), enc);
  21886. };
  21887. ECDH.prototype.setPublicKey = function (pub, enc) {
  21888. enc = enc || 'utf8';
  21889. if (!Buffer.isBuffer(pub)) {
  21890. pub = new Buffer(pub, enc);
  21891. }
  21892. this.keys._importPublic(pub);
  21893. return this;
  21894. };
  21895. ECDH.prototype.setPrivateKey = function (priv, enc) {
  21896. enc = enc || 'utf8';
  21897. if (!Buffer.isBuffer(priv)) {
  21898. priv = new Buffer(priv, enc);
  21899. }
  21900. var _priv = new BN(priv);
  21901. _priv = _priv.toString(16);
  21902. this.keys._importPrivate(_priv);
  21903. return this;
  21904. };
  21905. function formatReturnValue(bn, enc, len) {
  21906. if (!Array.isArray(bn)) {
  21907. bn = bn.toArray();
  21908. }
  21909. var buf = new Buffer(bn);
  21910. if (len && buf.length < len) {
  21911. var zeros = new Buffer(len - buf.length);
  21912. zeros.fill(0);
  21913. buf = Buffer.concat([zeros, buf]);
  21914. }
  21915. if (!enc) {
  21916. return buf;
  21917. } else {
  21918. return buf.toString(enc);
  21919. }
  21920. }
  21921. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  21922. /***/ },
  21923. /* 215 */
  21924. /***/ function(module, exports, __webpack_require__) {
  21925. "use strict";
  21926. /* WEBPACK VAR INJECTION */(function(Buffer) {'use strict';
  21927. var intSize = 4;
  21928. var zeroBuffer = new Buffer(intSize); zeroBuffer.fill(0);
  21929. var chrsz = 8;
  21930. function toArray(buf, bigEndian) {
  21931. if ((buf.length % intSize) !== 0) {
  21932. var len = buf.length + (intSize - (buf.length % intSize));
  21933. buf = Buffer.concat([buf, zeroBuffer], len);
  21934. }
  21935. var arr = [];
  21936. var fn = bigEndian ? buf.readInt32BE : buf.readInt32LE;
  21937. for (var i = 0; i < buf.length; i += intSize) {
  21938. arr.push(fn.call(buf, i));
  21939. }
  21940. return arr;
  21941. }
  21942. function toBuffer(arr, size, bigEndian) {
  21943. var buf = new Buffer(size);
  21944. var fn = bigEndian ? buf.writeInt32BE : buf.writeInt32LE;
  21945. for (var i = 0; i < arr.length; i++) {
  21946. fn.call(buf, arr[i], i * 4, true);
  21947. }
  21948. return buf;
  21949. }
  21950. function hash(buf, fn, hashSize, bigEndian) {
  21951. if (!Buffer.isBuffer(buf)) buf = new Buffer(buf);
  21952. var arr = fn(toArray(buf, bigEndian), buf.length * chrsz);
  21953. return toBuffer(arr, hashSize, bigEndian);
  21954. }
  21955. exports.hash = hash;
  21956. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  21957. /***/ },
  21958. /* 216 */
  21959. /***/ function(module, exports, __webpack_require__) {
  21960. "use strict";
  21961. 'use strict'
  21962. exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = __webpack_require__(31)
  21963. exports.createHash = exports.Hash = __webpack_require__(16)
  21964. exports.createHmac = exports.Hmac = __webpack_require__(60)
  21965. var hashes = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'].concat(Object.keys(__webpack_require__(107)))
  21966. exports.getHashes = function () {
  21967. return hashes
  21968. }
  21969. var p = __webpack_require__(110)
  21970. exports.pbkdf2 = p.pbkdf2
  21971. exports.pbkdf2Sync = p.pbkdf2Sync
  21972. var aes = __webpack_require__(168)
  21973. ;[
  21974. 'Cipher',
  21975. 'createCipher',
  21976. 'Cipheriv',
  21977. 'createCipheriv',
  21978. 'Decipher',
  21979. 'createDecipher',
  21980. 'Decipheriv',
  21981. 'createDecipheriv',
  21982. 'getCiphers',
  21983. 'listCiphers'
  21984. ].forEach(function (key) {
  21985. exports[key] = aes[key]
  21986. })
  21987. var dh = __webpack_require__(230)
  21988. ;[
  21989. 'DiffieHellmanGroup',
  21990. 'createDiffieHellmanGroup',
  21991. 'getDiffieHellman',
  21992. 'createDiffieHellman',
  21993. 'DiffieHellman'
  21994. ].forEach(function (key) {
  21995. exports[key] = dh[key]
  21996. })
  21997. var sign = __webpack_require__(171)
  21998. ;[
  21999. 'createSign',
  22000. 'Sign',
  22001. 'createVerify',
  22002. 'Verify'
  22003. ].forEach(function (key) {
  22004. exports[key] = sign[key]
  22005. })
  22006. exports.createECDH = __webpack_require__(214)
  22007. var publicEncrypt = __webpack_require__(265)
  22008. ;[
  22009. 'publicEncrypt',
  22010. 'privateEncrypt',
  22011. 'publicDecrypt',
  22012. 'privateDecrypt'
  22013. ].forEach(function (key) {
  22014. exports[key] = publicEncrypt[key]
  22015. })
  22016. // the least I can do is make error messages for the rest of the node.js/crypto api.
  22017. ;[
  22018. 'createCredentials'
  22019. ].forEach(function (name) {
  22020. exports[name] = function () {
  22021. throw new Error([
  22022. 'sorry, ' + name + ' is not implemented yet',
  22023. 'we accept pull requests',
  22024. 'https://github.com/crypto-browserify/crypto-browserify'
  22025. ].join('\n'))
  22026. }
  22027. })
  22028. /***/ },
  22029. /* 217 */
  22030. /***/ function(module, exports, __webpack_require__) {
  22031. exports = module.exports = __webpack_require__(17)();
  22032. // imports
  22033. // module
  22034. exports.push([module.i, "\n#fingerprint {\n min-width: 90px;\n text-align: center;\n background-color: transparent;\n color: white;\n}\n#fingerprint i {\n color: black;\n position: relative;\n padding: 0;\n text-shadow: 1px 1px 0 white;\n font-size: 1.3em;\n}\n", ""]);
  22035. // exports
  22036. /***/ },
  22037. /* 218 */
  22038. /***/ function(module, exports, __webpack_require__) {
  22039. exports = module.exports = __webpack_require__(17)();
  22040. // imports
  22041. // module
  22042. exports.push([module.i, "\n#passwords {\n max-height: 320px;\n overflow-y: scroll;\n overflow-x: hidden;\n}\n", ""]);
  22043. // exports
  22044. /***/ },
  22045. /* 219 */
  22046. /***/ function(module, exports, __webpack_require__) {
  22047. exports = module.exports = __webpack_require__(17)();
  22048. // imports
  22049. // module
  22050. exports.push([module.i, "\n#password-generator {\n color: #555;\n}\n.inner-addon i {\n position: absolute;\n padding: 10px;\n pointer-events: none;\n z-index: 10;\n}\n.inner-addon {\n position: relative;\n}\n.left-addon i {\n left: 0;\n}\n.right-addon i {\n right: 0;\n}\n.left-addon input {\n padding-left: 30px;\n}\n.right-addon input {\n padding-right: 30px;\n}\n", ""]);
  22051. // exports
  22052. /***/ },
  22053. /* 220 */
  22054. /***/ function(module, exports, __webpack_require__) {
  22055. exports = module.exports = __webpack_require__(17)();
  22056. // imports
  22057. // module
  22058. exports.push([module.i, "\n#lesspass .white-link {\n color: white;\n}\n#lesspass .white-link:hover, #lesspass .white-link:focus, #lesspass .white-link:active {\n text-decoration: none;\n color: white;\n}\n#lesspass, #lesspass * {\n border-radius: 0 !important;\n}\n", ""]);
  22059. // exports
  22060. /***/ },
  22061. /* 221 */
  22062. /***/ function(module, exports, __webpack_require__) {
  22063. exports = module.exports = __webpack_require__(17)();
  22064. // imports
  22065. // module
  22066. exports.push([module.i, "\n.fa-white {\n color: #ffffff;\n}\n", ""]);
  22067. // exports
  22068. /***/ },
  22069. /* 222 */
  22070. /***/ function(module, exports, __webpack_require__) {
  22071. exports = module.exports = __webpack_require__(17)();
  22072. // imports
  22073. // module
  22074. exports.push([module.i, "\n.card-header-dark {\n background-color: #555;\n border-color: #555;\n color: #FFF;\n}\n.grey-link {\n color: #373a3c;\n text-decoration: none;\n}\n.grey-link:hover, .grey-link:focus, .grey-link:active {\n color: #373a3c;\n text-decoration: none;\n}\n.white-link {\n color: white;\n}\n.white-link:hover, .white-link:focus, .white-link:active {\n text-decoration: none;\n color: white;\n}\n.fa-clickable {\n cursor: pointer;\n}\n", ""]);
  22075. // exports
  22076. /***/ },
  22077. /* 223 */
  22078. /***/ function(module, exports) {
  22079. /**
  22080. * A polyfill for Element.matches()
  22081. */
  22082. if (Element && !Element.prototype.matches) {
  22083. var proto = Element.prototype;
  22084. proto.matches = proto.matchesSelector ||
  22085. proto.mozMatchesSelector ||
  22086. proto.msMatchesSelector ||
  22087. proto.oMatchesSelector ||
  22088. proto.webkitMatchesSelector;
  22089. }
  22090. /**
  22091. * Finds the closest parent that matches a selector.
  22092. *
  22093. * @param {Element} element
  22094. * @param {String} selector
  22095. * @return {Function}
  22096. */
  22097. function closest (element, selector) {
  22098. while (element && element !== document) {
  22099. if (element.matches(selector)) return element;
  22100. element = element.parentNode;
  22101. }
  22102. }
  22103. module.exports = closest;
  22104. /***/ },
  22105. /* 224 */
  22106. /***/ function(module, exports, __webpack_require__) {
  22107. var closest = __webpack_require__(223);
  22108. /**
  22109. * Delegates event to a selector.
  22110. *
  22111. * @param {Element} element
  22112. * @param {String} selector
  22113. * @param {String} type
  22114. * @param {Function} callback
  22115. * @param {Boolean} useCapture
  22116. * @return {Object}
  22117. */
  22118. function delegate(element, selector, type, callback, useCapture) {
  22119. var listenerFn = listener.apply(this, arguments);
  22120. element.addEventListener(type, listenerFn, useCapture);
  22121. return {
  22122. destroy: function() {
  22123. element.removeEventListener(type, listenerFn, useCapture);
  22124. }
  22125. }
  22126. }
  22127. /**
  22128. * Finds closest match and invokes callback.
  22129. *
  22130. * @param {Element} element
  22131. * @param {String} selector
  22132. * @param {String} type
  22133. * @param {Function} callback
  22134. * @return {Function}
  22135. */
  22136. function listener(element, selector, type, callback) {
  22137. return function(e) {
  22138. e.delegateTarget = closest(e.target, selector);
  22139. if (e.delegateTarget) {
  22140. callback.call(element, e);
  22141. }
  22142. }
  22143. }
  22144. module.exports = delegate;
  22145. /***/ },
  22146. /* 225 */
  22147. /***/ function(module, exports, __webpack_require__) {
  22148. "use strict";
  22149. 'use strict';
  22150. var assert = __webpack_require__(30);
  22151. var inherits = __webpack_require__(1);
  22152. var proto = {};
  22153. function CBCState(iv) {
  22154. assert.equal(iv.length, 8, 'Invalid IV length');
  22155. this.iv = new Array(8);
  22156. for (var i = 0; i < this.iv.length; i++)
  22157. this.iv[i] = iv[i];
  22158. }
  22159. function instantiate(Base) {
  22160. function CBC(options) {
  22161. Base.call(this, options);
  22162. this._cbcInit();
  22163. }
  22164. inherits(CBC, Base);
  22165. var keys = Object.keys(proto);
  22166. for (var i = 0; i < keys.length; i++) {
  22167. var key = keys[i];
  22168. CBC.prototype[key] = proto[key];
  22169. }
  22170. CBC.create = function create(options) {
  22171. return new CBC(options);
  22172. };
  22173. return CBC;
  22174. }
  22175. exports.instantiate = instantiate;
  22176. proto._cbcInit = function _cbcInit() {
  22177. var state = new CBCState(this.options.iv);
  22178. this._cbcState = state;
  22179. };
  22180. proto._update = function _update(inp, inOff, out, outOff) {
  22181. var state = this._cbcState;
  22182. var superProto = this.constructor.super_.prototype;
  22183. var iv = state.iv;
  22184. if (this.type === 'encrypt') {
  22185. for (var i = 0; i < this.blockSize; i++)
  22186. iv[i] ^= inp[inOff + i];
  22187. superProto._update.call(this, iv, 0, out, outOff);
  22188. for (var i = 0; i < this.blockSize; i++)
  22189. iv[i] = out[outOff + i];
  22190. } else {
  22191. superProto._update.call(this, inp, inOff, out, outOff);
  22192. for (var i = 0; i < this.blockSize; i++)
  22193. out[outOff + i] ^= iv[i];
  22194. for (var i = 0; i < this.blockSize; i++)
  22195. iv[i] = inp[inOff + i];
  22196. }
  22197. };
  22198. /***/ },
  22199. /* 226 */
  22200. /***/ function(module, exports, __webpack_require__) {
  22201. "use strict";
  22202. 'use strict';
  22203. var assert = __webpack_require__(30);
  22204. function Cipher(options) {
  22205. this.options = options;
  22206. this.type = this.options.type;
  22207. this.blockSize = 8;
  22208. this._init();
  22209. this.buffer = new Array(this.blockSize);
  22210. this.bufferOff = 0;
  22211. }
  22212. module.exports = Cipher;
  22213. Cipher.prototype._init = function _init() {
  22214. // Might be overrided
  22215. };
  22216. Cipher.prototype.update = function update(data) {
  22217. if (data.length === 0)
  22218. return [];
  22219. if (this.type === 'decrypt')
  22220. return this._updateDecrypt(data);
  22221. else
  22222. return this._updateEncrypt(data);
  22223. };
  22224. Cipher.prototype._buffer = function _buffer(data, off) {
  22225. // Append data to buffer
  22226. var min = Math.min(this.buffer.length - this.bufferOff, data.length - off);
  22227. for (var i = 0; i < min; i++)
  22228. this.buffer[this.bufferOff + i] = data[off + i];
  22229. this.bufferOff += min;
  22230. // Shift next
  22231. return min;
  22232. };
  22233. Cipher.prototype._flushBuffer = function _flushBuffer(out, off) {
  22234. this._update(this.buffer, 0, out, off);
  22235. this.bufferOff = 0;
  22236. return this.blockSize;
  22237. };
  22238. Cipher.prototype._updateEncrypt = function _updateEncrypt(data) {
  22239. var inputOff = 0;
  22240. var outputOff = 0;
  22241. var count = ((this.bufferOff + data.length) / this.blockSize) | 0;
  22242. var out = new Array(count * this.blockSize);
  22243. if (this.bufferOff !== 0) {
  22244. inputOff += this._buffer(data, inputOff);
  22245. if (this.bufferOff === this.buffer.length)
  22246. outputOff += this._flushBuffer(out, outputOff);
  22247. }
  22248. // Write blocks
  22249. var max = data.length - ((data.length - inputOff) % this.blockSize);
  22250. for (; inputOff < max; inputOff += this.blockSize) {
  22251. this._update(data, inputOff, out, outputOff);
  22252. outputOff += this.blockSize;
  22253. }
  22254. // Queue rest
  22255. for (; inputOff < data.length; inputOff++, this.bufferOff++)
  22256. this.buffer[this.bufferOff] = data[inputOff];
  22257. return out;
  22258. };
  22259. Cipher.prototype._updateDecrypt = function _updateDecrypt(data) {
  22260. var inputOff = 0;
  22261. var outputOff = 0;
  22262. var count = Math.ceil((this.bufferOff + data.length) / this.blockSize) - 1;
  22263. var out = new Array(count * this.blockSize);
  22264. // TODO(indutny): optimize it, this is far from optimal
  22265. for (; count > 0; count--) {
  22266. inputOff += this._buffer(data, inputOff);
  22267. outputOff += this._flushBuffer(out, outputOff);
  22268. }
  22269. // Buffer rest of the input
  22270. inputOff += this._buffer(data, inputOff);
  22271. return out;
  22272. };
  22273. Cipher.prototype.final = function final(buffer) {
  22274. var first;
  22275. if (buffer)
  22276. first = this.update(buffer);
  22277. var last;
  22278. if (this.type === 'encrypt')
  22279. last = this._finalEncrypt();
  22280. else
  22281. last = this._finalDecrypt();
  22282. if (first)
  22283. return first.concat(last);
  22284. else
  22285. return last;
  22286. };
  22287. Cipher.prototype._pad = function _pad(buffer, off) {
  22288. if (off === 0)
  22289. return false;
  22290. while (off < buffer.length)
  22291. buffer[off++] = 0;
  22292. return true;
  22293. };
  22294. Cipher.prototype._finalEncrypt = function _finalEncrypt() {
  22295. if (!this._pad(this.buffer, this.bufferOff))
  22296. return [];
  22297. var out = new Array(this.blockSize);
  22298. this._update(this.buffer, 0, out, 0);
  22299. return out;
  22300. };
  22301. Cipher.prototype._unpad = function _unpad(buffer) {
  22302. return buffer;
  22303. };
  22304. Cipher.prototype._finalDecrypt = function _finalDecrypt() {
  22305. assert.equal(this.bufferOff, this.blockSize, 'Not enough data to decrypt');
  22306. var out = new Array(this.blockSize);
  22307. this._flushBuffer(out, 0);
  22308. return this._unpad(out);
  22309. };
  22310. /***/ },
  22311. /* 227 */
  22312. /***/ function(module, exports, __webpack_require__) {
  22313. "use strict";
  22314. 'use strict';
  22315. var assert = __webpack_require__(30);
  22316. var inherits = __webpack_require__(1);
  22317. var des = __webpack_require__(61);
  22318. var utils = des.utils;
  22319. var Cipher = des.Cipher;
  22320. function DESState() {
  22321. this.tmp = new Array(2);
  22322. this.keys = null;
  22323. }
  22324. function DES(options) {
  22325. Cipher.call(this, options);
  22326. var state = new DESState();
  22327. this._desState = state;
  22328. this.deriveKeys(state, options.key);
  22329. }
  22330. inherits(DES, Cipher);
  22331. module.exports = DES;
  22332. DES.create = function create(options) {
  22333. return new DES(options);
  22334. };
  22335. var shiftTable = [
  22336. 1, 1, 2, 2, 2, 2, 2, 2,
  22337. 1, 2, 2, 2, 2, 2, 2, 1
  22338. ];
  22339. DES.prototype.deriveKeys = function deriveKeys(state, key) {
  22340. state.keys = new Array(16 * 2);
  22341. assert.equal(key.length, this.blockSize, 'Invalid key length');
  22342. var kL = utils.readUInt32BE(key, 0);
  22343. var kR = utils.readUInt32BE(key, 4);
  22344. utils.pc1(kL, kR, state.tmp, 0);
  22345. kL = state.tmp[0];
  22346. kR = state.tmp[1];
  22347. for (var i = 0; i < state.keys.length; i += 2) {
  22348. var shift = shiftTable[i >>> 1];
  22349. kL = utils.r28shl(kL, shift);
  22350. kR = utils.r28shl(kR, shift);
  22351. utils.pc2(kL, kR, state.keys, i);
  22352. }
  22353. };
  22354. DES.prototype._update = function _update(inp, inOff, out, outOff) {
  22355. var state = this._desState;
  22356. var l = utils.readUInt32BE(inp, inOff);
  22357. var r = utils.readUInt32BE(inp, inOff + 4);
  22358. // Initial Permutation
  22359. utils.ip(l, r, state.tmp, 0);
  22360. l = state.tmp[0];
  22361. r = state.tmp[1];
  22362. if (this.type === 'encrypt')
  22363. this._encrypt(state, l, r, state.tmp, 0);
  22364. else
  22365. this._decrypt(state, l, r, state.tmp, 0);
  22366. l = state.tmp[0];
  22367. r = state.tmp[1];
  22368. utils.writeUInt32BE(out, l, outOff);
  22369. utils.writeUInt32BE(out, r, outOff + 4);
  22370. };
  22371. DES.prototype._pad = function _pad(buffer, off) {
  22372. var value = buffer.length - off;
  22373. for (var i = off; i < buffer.length; i++)
  22374. buffer[i] = value;
  22375. return true;
  22376. };
  22377. DES.prototype._unpad = function _unpad(buffer) {
  22378. var pad = buffer[buffer.length - 1];
  22379. for (var i = buffer.length - pad; i < buffer.length; i++)
  22380. assert.equal(buffer[i], pad);
  22381. return buffer.slice(0, buffer.length - pad);
  22382. };
  22383. DES.prototype._encrypt = function _encrypt(state, lStart, rStart, out, off) {
  22384. var l = lStart;
  22385. var r = rStart;
  22386. // Apply f() x16 times
  22387. for (var i = 0; i < state.keys.length; i += 2) {
  22388. var keyL = state.keys[i];
  22389. var keyR = state.keys[i + 1];
  22390. // f(r, k)
  22391. utils.expand(r, state.tmp, 0);
  22392. keyL ^= state.tmp[0];
  22393. keyR ^= state.tmp[1];
  22394. var s = utils.substitute(keyL, keyR);
  22395. var f = utils.permute(s);
  22396. var t = r;
  22397. r = (l ^ f) >>> 0;
  22398. l = t;
  22399. }
  22400. // Reverse Initial Permutation
  22401. utils.rip(r, l, out, off);
  22402. };
  22403. DES.prototype._decrypt = function _decrypt(state, lStart, rStart, out, off) {
  22404. var l = rStart;
  22405. var r = lStart;
  22406. // Apply f() x16 times
  22407. for (var i = state.keys.length - 2; i >= 0; i -= 2) {
  22408. var keyL = state.keys[i];
  22409. var keyR = state.keys[i + 1];
  22410. // f(r, k)
  22411. utils.expand(l, state.tmp, 0);
  22412. keyL ^= state.tmp[0];
  22413. keyR ^= state.tmp[1];
  22414. var s = utils.substitute(keyL, keyR);
  22415. var f = utils.permute(s);
  22416. var t = l;
  22417. l = (r ^ f) >>> 0;
  22418. r = t;
  22419. }
  22420. // Reverse Initial Permutation
  22421. utils.rip(l, r, out, off);
  22422. };
  22423. /***/ },
  22424. /* 228 */
  22425. /***/ function(module, exports, __webpack_require__) {
  22426. "use strict";
  22427. 'use strict';
  22428. var assert = __webpack_require__(30);
  22429. var inherits = __webpack_require__(1);
  22430. var des = __webpack_require__(61);
  22431. var Cipher = des.Cipher;
  22432. var DES = des.DES;
  22433. function EDEState(type, key) {
  22434. assert.equal(key.length, 24, 'Invalid key length');
  22435. var k1 = key.slice(0, 8);
  22436. var k2 = key.slice(8, 16);
  22437. var k3 = key.slice(16, 24);
  22438. if (type === 'encrypt') {
  22439. this.ciphers = [
  22440. DES.create({ type: 'encrypt', key: k1 }),
  22441. DES.create({ type: 'decrypt', key: k2 }),
  22442. DES.create({ type: 'encrypt', key: k3 })
  22443. ];
  22444. } else {
  22445. this.ciphers = [
  22446. DES.create({ type: 'decrypt', key: k3 }),
  22447. DES.create({ type: 'encrypt', key: k2 }),
  22448. DES.create({ type: 'decrypt', key: k1 })
  22449. ];
  22450. }
  22451. }
  22452. function EDE(options) {
  22453. Cipher.call(this, options);
  22454. var state = new EDEState(this.type, this.options.key);
  22455. this._edeState = state;
  22456. }
  22457. inherits(EDE, Cipher);
  22458. module.exports = EDE;
  22459. EDE.create = function create(options) {
  22460. return new EDE(options);
  22461. };
  22462. EDE.prototype._update = function _update(inp, inOff, out, outOff) {
  22463. var state = this._edeState;
  22464. state.ciphers[0]._update(inp, inOff, out, outOff);
  22465. state.ciphers[1]._update(out, outOff, out, outOff);
  22466. state.ciphers[2]._update(out, outOff, out, outOff);
  22467. };
  22468. EDE.prototype._pad = DES.prototype._pad;
  22469. EDE.prototype._unpad = DES.prototype._unpad;
  22470. /***/ },
  22471. /* 229 */
  22472. /***/ function(module, exports) {
  22473. "use strict";
  22474. 'use strict';
  22475. exports.readUInt32BE = function readUInt32BE(bytes, off) {
  22476. var res = (bytes[0 + off] << 24) |
  22477. (bytes[1 + off] << 16) |
  22478. (bytes[2 + off] << 8) |
  22479. bytes[3 + off];
  22480. return res >>> 0;
  22481. };
  22482. exports.writeUInt32BE = function writeUInt32BE(bytes, value, off) {
  22483. bytes[0 + off] = value >>> 24;
  22484. bytes[1 + off] = (value >>> 16) & 0xff;
  22485. bytes[2 + off] = (value >>> 8) & 0xff;
  22486. bytes[3 + off] = value & 0xff;
  22487. };
  22488. exports.ip = function ip(inL, inR, out, off) {
  22489. var outL = 0;
  22490. var outR = 0;
  22491. for (var i = 6; i >= 0; i -= 2) {
  22492. for (var j = 0; j <= 24; j += 8) {
  22493. outL <<= 1;
  22494. outL |= (inR >>> (j + i)) & 1;
  22495. }
  22496. for (var j = 0; j <= 24; j += 8) {
  22497. outL <<= 1;
  22498. outL |= (inL >>> (j + i)) & 1;
  22499. }
  22500. }
  22501. for (var i = 6; i >= 0; i -= 2) {
  22502. for (var j = 1; j <= 25; j += 8) {
  22503. outR <<= 1;
  22504. outR |= (inR >>> (j + i)) & 1;
  22505. }
  22506. for (var j = 1; j <= 25; j += 8) {
  22507. outR <<= 1;
  22508. outR |= (inL >>> (j + i)) & 1;
  22509. }
  22510. }
  22511. out[off + 0] = outL >>> 0;
  22512. out[off + 1] = outR >>> 0;
  22513. };
  22514. exports.rip = function rip(inL, inR, out, off) {
  22515. var outL = 0;
  22516. var outR = 0;
  22517. for (var i = 0; i < 4; i++) {
  22518. for (var j = 24; j >= 0; j -= 8) {
  22519. outL <<= 1;
  22520. outL |= (inR >>> (j + i)) & 1;
  22521. outL <<= 1;
  22522. outL |= (inL >>> (j + i)) & 1;
  22523. }
  22524. }
  22525. for (var i = 4; i < 8; i++) {
  22526. for (var j = 24; j >= 0; j -= 8) {
  22527. outR <<= 1;
  22528. outR |= (inR >>> (j + i)) & 1;
  22529. outR <<= 1;
  22530. outR |= (inL >>> (j + i)) & 1;
  22531. }
  22532. }
  22533. out[off + 0] = outL >>> 0;
  22534. out[off + 1] = outR >>> 0;
  22535. };
  22536. exports.pc1 = function pc1(inL, inR, out, off) {
  22537. var outL = 0;
  22538. var outR = 0;
  22539. // 7, 15, 23, 31, 39, 47, 55, 63
  22540. // 6, 14, 22, 30, 39, 47, 55, 63
  22541. // 5, 13, 21, 29, 39, 47, 55, 63
  22542. // 4, 12, 20, 28
  22543. for (var i = 7; i >= 5; i--) {
  22544. for (var j = 0; j <= 24; j += 8) {
  22545. outL <<= 1;
  22546. outL |= (inR >> (j + i)) & 1;
  22547. }
  22548. for (var j = 0; j <= 24; j += 8) {
  22549. outL <<= 1;
  22550. outL |= (inL >> (j + i)) & 1;
  22551. }
  22552. }
  22553. for (var j = 0; j <= 24; j += 8) {
  22554. outL <<= 1;
  22555. outL |= (inR >> (j + i)) & 1;
  22556. }
  22557. // 1, 9, 17, 25, 33, 41, 49, 57
  22558. // 2, 10, 18, 26, 34, 42, 50, 58
  22559. // 3, 11, 19, 27, 35, 43, 51, 59
  22560. // 36, 44, 52, 60
  22561. for (var i = 1; i <= 3; i++) {
  22562. for (var j = 0; j <= 24; j += 8) {
  22563. outR <<= 1;
  22564. outR |= (inR >> (j + i)) & 1;
  22565. }
  22566. for (var j = 0; j <= 24; j += 8) {
  22567. outR <<= 1;
  22568. outR |= (inL >> (j + i)) & 1;
  22569. }
  22570. }
  22571. for (var j = 0; j <= 24; j += 8) {
  22572. outR <<= 1;
  22573. outR |= (inL >> (j + i)) & 1;
  22574. }
  22575. out[off + 0] = outL >>> 0;
  22576. out[off + 1] = outR >>> 0;
  22577. };
  22578. exports.r28shl = function r28shl(num, shift) {
  22579. return ((num << shift) & 0xfffffff) | (num >>> (28 - shift));
  22580. };
  22581. var pc2table = [
  22582. // inL => outL
  22583. 14, 11, 17, 4, 27, 23, 25, 0,
  22584. 13, 22, 7, 18, 5, 9, 16, 24,
  22585. 2, 20, 12, 21, 1, 8, 15, 26,
  22586. // inR => outR
  22587. 15, 4, 25, 19, 9, 1, 26, 16,
  22588. 5, 11, 23, 8, 12, 7, 17, 0,
  22589. 22, 3, 10, 14, 6, 20, 27, 24
  22590. ];
  22591. exports.pc2 = function pc2(inL, inR, out, off) {
  22592. var outL = 0;
  22593. var outR = 0;
  22594. var len = pc2table.length >>> 1;
  22595. for (var i = 0; i < len; i++) {
  22596. outL <<= 1;
  22597. outL |= (inL >>> pc2table[i]) & 0x1;
  22598. }
  22599. for (var i = len; i < pc2table.length; i++) {
  22600. outR <<= 1;
  22601. outR |= (inR >>> pc2table[i]) & 0x1;
  22602. }
  22603. out[off + 0] = outL >>> 0;
  22604. out[off + 1] = outR >>> 0;
  22605. };
  22606. exports.expand = function expand(r, out, off) {
  22607. var outL = 0;
  22608. var outR = 0;
  22609. outL = ((r & 1) << 5) | (r >>> 27);
  22610. for (var i = 23; i >= 15; i -= 4) {
  22611. outL <<= 6;
  22612. outL |= (r >>> i) & 0x3f;
  22613. }
  22614. for (var i = 11; i >= 3; i -= 4) {
  22615. outR |= (r >>> i) & 0x3f;
  22616. outR <<= 6;
  22617. }
  22618. outR |= ((r & 0x1f) << 1) | (r >>> 31);
  22619. out[off + 0] = outL >>> 0;
  22620. out[off + 1] = outR >>> 0;
  22621. };
  22622. var sTable = [
  22623. 14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1,
  22624. 3, 10, 10, 6, 6, 12, 12, 11, 5, 9, 9, 5, 0, 3, 7, 8,
  22625. 4, 15, 1, 12, 14, 8, 8, 2, 13, 4, 6, 9, 2, 1, 11, 7,
  22626. 15, 5, 12, 11, 9, 3, 7, 14, 3, 10, 10, 0, 5, 6, 0, 13,
  22627. 15, 3, 1, 13, 8, 4, 14, 7, 6, 15, 11, 2, 3, 8, 4, 14,
  22628. 9, 12, 7, 0, 2, 1, 13, 10, 12, 6, 0, 9, 5, 11, 10, 5,
  22629. 0, 13, 14, 8, 7, 10, 11, 1, 10, 3, 4, 15, 13, 4, 1, 2,
  22630. 5, 11, 8, 6, 12, 7, 6, 12, 9, 0, 3, 5, 2, 14, 15, 9,
  22631. 10, 13, 0, 7, 9, 0, 14, 9, 6, 3, 3, 4, 15, 6, 5, 10,
  22632. 1, 2, 13, 8, 12, 5, 7, 14, 11, 12, 4, 11, 2, 15, 8, 1,
  22633. 13, 1, 6, 10, 4, 13, 9, 0, 8, 6, 15, 9, 3, 8, 0, 7,
  22634. 11, 4, 1, 15, 2, 14, 12, 3, 5, 11, 10, 5, 14, 2, 7, 12,
  22635. 7, 13, 13, 8, 14, 11, 3, 5, 0, 6, 6, 15, 9, 0, 10, 3,
  22636. 1, 4, 2, 7, 8, 2, 5, 12, 11, 1, 12, 10, 4, 14, 15, 9,
  22637. 10, 3, 6, 15, 9, 0, 0, 6, 12, 10, 11, 1, 7, 13, 13, 8,
  22638. 15, 9, 1, 4, 3, 5, 14, 11, 5, 12, 2, 7, 8, 2, 4, 14,
  22639. 2, 14, 12, 11, 4, 2, 1, 12, 7, 4, 10, 7, 11, 13, 6, 1,
  22640. 8, 5, 5, 0, 3, 15, 15, 10, 13, 3, 0, 9, 14, 8, 9, 6,
  22641. 4, 11, 2, 8, 1, 12, 11, 7, 10, 1, 13, 14, 7, 2, 8, 13,
  22642. 15, 6, 9, 15, 12, 0, 5, 9, 6, 10, 3, 4, 0, 5, 14, 3,
  22643. 12, 10, 1, 15, 10, 4, 15, 2, 9, 7, 2, 12, 6, 9, 8, 5,
  22644. 0, 6, 13, 1, 3, 13, 4, 14, 14, 0, 7, 11, 5, 3, 11, 8,
  22645. 9, 4, 14, 3, 15, 2, 5, 12, 2, 9, 8, 5, 12, 15, 3, 10,
  22646. 7, 11, 0, 14, 4, 1, 10, 7, 1, 6, 13, 0, 11, 8, 6, 13,
  22647. 4, 13, 11, 0, 2, 11, 14, 7, 15, 4, 0, 9, 8, 1, 13, 10,
  22648. 3, 14, 12, 3, 9, 5, 7, 12, 5, 2, 10, 15, 6, 8, 1, 6,
  22649. 1, 6, 4, 11, 11, 13, 13, 8, 12, 1, 3, 4, 7, 10, 14, 7,
  22650. 10, 9, 15, 5, 6, 0, 8, 15, 0, 14, 5, 2, 9, 3, 2, 12,
  22651. 13, 1, 2, 15, 8, 13, 4, 8, 6, 10, 15, 3, 11, 7, 1, 4,
  22652. 10, 12, 9, 5, 3, 6, 14, 11, 5, 0, 0, 14, 12, 9, 7, 2,
  22653. 7, 2, 11, 1, 4, 14, 1, 7, 9, 4, 12, 10, 14, 8, 2, 13,
  22654. 0, 15, 6, 12, 10, 9, 13, 0, 15, 3, 3, 5, 5, 6, 8, 11
  22655. ];
  22656. exports.substitute = function substitute(inL, inR) {
  22657. var out = 0;
  22658. for (var i = 0; i < 4; i++) {
  22659. var b = (inL >>> (18 - i * 6)) & 0x3f;
  22660. var sb = sTable[i * 0x40 + b];
  22661. out <<= 4;
  22662. out |= sb;
  22663. }
  22664. for (var i = 0; i < 4; i++) {
  22665. var b = (inR >>> (18 - i * 6)) & 0x3f;
  22666. var sb = sTable[4 * 0x40 + i * 0x40 + b];
  22667. out <<= 4;
  22668. out |= sb;
  22669. }
  22670. return out >>> 0;
  22671. };
  22672. var permuteTable = [
  22673. 16, 25, 12, 11, 3, 20, 4, 15, 31, 17, 9, 6, 27, 14, 1, 22,
  22674. 30, 24, 8, 18, 0, 5, 29, 23, 13, 19, 2, 26, 10, 21, 28, 7
  22675. ];
  22676. exports.permute = function permute(num) {
  22677. var out = 0;
  22678. for (var i = 0; i < permuteTable.length; i++) {
  22679. out <<= 1;
  22680. out |= (num >>> permuteTable[i]) & 0x1;
  22681. }
  22682. return out >>> 0;
  22683. };
  22684. exports.padSplit = function padSplit(num, size, group) {
  22685. var str = num.toString(2);
  22686. while (str.length < size)
  22687. str = '0' + str;
  22688. var out = [];
  22689. for (var i = 0; i < size; i += group)
  22690. out.push(str.slice(i, i + group));
  22691. return out.join(' ');
  22692. };
  22693. /***/ },
  22694. /* 230 */
  22695. /***/ function(module, exports, __webpack_require__) {
  22696. /* WEBPACK VAR INJECTION */(function(Buffer) {var generatePrime = __webpack_require__(105)
  22697. var primes = __webpack_require__(255)
  22698. var DH = __webpack_require__(231)
  22699. function getDiffieHellman (mod) {
  22700. var prime = new Buffer(primes[mod].prime, 'hex')
  22701. var gen = new Buffer(primes[mod].gen, 'hex')
  22702. return new DH(prime, gen)
  22703. }
  22704. var ENCODINGS = {
  22705. 'binary': true, 'hex': true, 'base64': true
  22706. }
  22707. function createDiffieHellman (prime, enc, generator, genc) {
  22708. if (Buffer.isBuffer(enc) || ENCODINGS[enc] === undefined) {
  22709. return createDiffieHellman(prime, 'binary', enc, generator)
  22710. }
  22711. enc = enc || 'binary'
  22712. genc = genc || 'binary'
  22713. generator = generator || new Buffer([2])
  22714. if (!Buffer.isBuffer(generator)) {
  22715. generator = new Buffer(generator, genc)
  22716. }
  22717. if (typeof prime === 'number') {
  22718. return new DH(generatePrime(prime, generator), generator, true)
  22719. }
  22720. if (!Buffer.isBuffer(prime)) {
  22721. prime = new Buffer(prime, enc)
  22722. }
  22723. return new DH(prime, generator, true)
  22724. }
  22725. exports.DiffieHellmanGroup = exports.createDiffieHellmanGroup = exports.getDiffieHellman = getDiffieHellman
  22726. exports.createDiffieHellman = exports.DiffieHellman = createDiffieHellman
  22727. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  22728. /***/ },
  22729. /* 231 */
  22730. /***/ function(module, exports, __webpack_require__) {
  22731. /* WEBPACK VAR INJECTION */(function(Buffer) {var BN = __webpack_require__(2);
  22732. var MillerRabin = __webpack_require__(109);
  22733. var millerRabin = new MillerRabin();
  22734. var TWENTYFOUR = new BN(24);
  22735. var ELEVEN = new BN(11);
  22736. var TEN = new BN(10);
  22737. var THREE = new BN(3);
  22738. var SEVEN = new BN(7);
  22739. var primes = __webpack_require__(105);
  22740. var randomBytes = __webpack_require__(31);
  22741. module.exports = DH;
  22742. function setPublicKey(pub, enc) {
  22743. enc = enc || 'utf8';
  22744. if (!Buffer.isBuffer(pub)) {
  22745. pub = new Buffer(pub, enc);
  22746. }
  22747. this._pub = new BN(pub);
  22748. return this;
  22749. }
  22750. function setPrivateKey(priv, enc) {
  22751. enc = enc || 'utf8';
  22752. if (!Buffer.isBuffer(priv)) {
  22753. priv = new Buffer(priv, enc);
  22754. }
  22755. this._priv = new BN(priv);
  22756. return this;
  22757. }
  22758. var primeCache = {};
  22759. function checkPrime(prime, generator) {
  22760. var gen = generator.toString('hex');
  22761. var hex = [gen, prime.toString(16)].join('_');
  22762. if (hex in primeCache) {
  22763. return primeCache[hex];
  22764. }
  22765. var error = 0;
  22766. if (prime.isEven() ||
  22767. !primes.simpleSieve ||
  22768. !primes.fermatTest(prime) ||
  22769. !millerRabin.test(prime)) {
  22770. //not a prime so +1
  22771. error += 1;
  22772. if (gen === '02' || gen === '05') {
  22773. // we'd be able to check the generator
  22774. // it would fail so +8
  22775. error += 8;
  22776. } else {
  22777. //we wouldn't be able to test the generator
  22778. // so +4
  22779. error += 4;
  22780. }
  22781. primeCache[hex] = error;
  22782. return error;
  22783. }
  22784. if (!millerRabin.test(prime.shrn(1))) {
  22785. //not a safe prime
  22786. error += 2;
  22787. }
  22788. var rem;
  22789. switch (gen) {
  22790. case '02':
  22791. if (prime.mod(TWENTYFOUR).cmp(ELEVEN)) {
  22792. // unsuidable generator
  22793. error += 8;
  22794. }
  22795. break;
  22796. case '05':
  22797. rem = prime.mod(TEN);
  22798. if (rem.cmp(THREE) && rem.cmp(SEVEN)) {
  22799. // prime mod 10 needs to equal 3 or 7
  22800. error += 8;
  22801. }
  22802. break;
  22803. default:
  22804. error += 4;
  22805. }
  22806. primeCache[hex] = error;
  22807. return error;
  22808. }
  22809. function DH(prime, generator, malleable) {
  22810. this.setGenerator(generator);
  22811. this.__prime = new BN(prime);
  22812. this._prime = BN.mont(this.__prime);
  22813. this._primeLen = prime.length;
  22814. this._pub = undefined;
  22815. this._priv = undefined;
  22816. this._primeCode = undefined;
  22817. if (malleable) {
  22818. this.setPublicKey = setPublicKey;
  22819. this.setPrivateKey = setPrivateKey;
  22820. } else {
  22821. this._primeCode = 8;
  22822. }
  22823. }
  22824. Object.defineProperty(DH.prototype, 'verifyError', {
  22825. enumerable: true,
  22826. get: function () {
  22827. if (typeof this._primeCode !== 'number') {
  22828. this._primeCode = checkPrime(this.__prime, this.__gen);
  22829. }
  22830. return this._primeCode;
  22831. }
  22832. });
  22833. DH.prototype.generateKeys = function () {
  22834. if (!this._priv) {
  22835. this._priv = new BN(randomBytes(this._primeLen));
  22836. }
  22837. this._pub = this._gen.toRed(this._prime).redPow(this._priv).fromRed();
  22838. return this.getPublicKey();
  22839. };
  22840. DH.prototype.computeSecret = function (other) {
  22841. other = new BN(other);
  22842. other = other.toRed(this._prime);
  22843. var secret = other.redPow(this._priv).fromRed();
  22844. var out = new Buffer(secret.toArray());
  22845. var prime = this.getPrime();
  22846. if (out.length < prime.length) {
  22847. var front = new Buffer(prime.length - out.length);
  22848. front.fill(0);
  22849. out = Buffer.concat([front, out]);
  22850. }
  22851. return out;
  22852. };
  22853. DH.prototype.getPublicKey = function getPublicKey(enc) {
  22854. return formatReturnValue(this._pub, enc);
  22855. };
  22856. DH.prototype.getPrivateKey = function getPrivateKey(enc) {
  22857. return formatReturnValue(this._priv, enc);
  22858. };
  22859. DH.prototype.getPrime = function (enc) {
  22860. return formatReturnValue(this.__prime, enc);
  22861. };
  22862. DH.prototype.getGenerator = function (enc) {
  22863. return formatReturnValue(this._gen, enc);
  22864. };
  22865. DH.prototype.setGenerator = function (gen, enc) {
  22866. enc = enc || 'utf8';
  22867. if (!Buffer.isBuffer(gen)) {
  22868. gen = new Buffer(gen, enc);
  22869. }
  22870. this.__gen = gen;
  22871. this._gen = new BN(gen);
  22872. return this;
  22873. };
  22874. function formatReturnValue(bn, enc) {
  22875. var buf = new Buffer(bn.toArray());
  22876. if (!enc) {
  22877. return buf;
  22878. } else {
  22879. return buf.toString(enc);
  22880. }
  22881. }
  22882. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  22883. /***/ },
  22884. /* 232 */
  22885. /***/ function(module, exports, __webpack_require__) {
  22886. "use strict";
  22887. 'use strict';
  22888. var BN = __webpack_require__(2);
  22889. var elliptic = __webpack_require__(3);
  22890. var utils = elliptic.utils;
  22891. var getNAF = utils.getNAF;
  22892. var getJSF = utils.getJSF;
  22893. var assert = utils.assert;
  22894. function BaseCurve(type, conf) {
  22895. this.type = type;
  22896. this.p = new BN(conf.p, 16);
  22897. // Use Montgomery, when there is no fast reduction for the prime
  22898. this.red = conf.prime ? BN.red(conf.prime) : BN.mont(this.p);
  22899. // Useful for many curves
  22900. this.zero = new BN(0).toRed(this.red);
  22901. this.one = new BN(1).toRed(this.red);
  22902. this.two = new BN(2).toRed(this.red);
  22903. // Curve configuration, optional
  22904. this.n = conf.n && new BN(conf.n, 16);
  22905. this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed);
  22906. // Temporary arrays
  22907. this._wnafT1 = new Array(4);
  22908. this._wnafT2 = new Array(4);
  22909. this._wnafT3 = new Array(4);
  22910. this._wnafT4 = new Array(4);
  22911. // Generalized Greg Maxwell's trick
  22912. var adjustCount = this.n && this.p.div(this.n);
  22913. if (!adjustCount || adjustCount.cmpn(100) > 0) {
  22914. this.redN = null;
  22915. } else {
  22916. this._maxwellTrick = true;
  22917. this.redN = this.n.toRed(this.red);
  22918. }
  22919. }
  22920. module.exports = BaseCurve;
  22921. BaseCurve.prototype.point = function point() {
  22922. throw new Error('Not implemented');
  22923. };
  22924. BaseCurve.prototype.validate = function validate() {
  22925. throw new Error('Not implemented');
  22926. };
  22927. BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) {
  22928. assert(p.precomputed);
  22929. var doubles = p._getDoubles();
  22930. var naf = getNAF(k, 1);
  22931. var I = (1 << (doubles.step + 1)) - (doubles.step % 2 === 0 ? 2 : 1);
  22932. I /= 3;
  22933. // Translate into more windowed form
  22934. var repr = [];
  22935. for (var j = 0; j < naf.length; j += doubles.step) {
  22936. var nafW = 0;
  22937. for (var k = j + doubles.step - 1; k >= j; k--)
  22938. nafW = (nafW << 1) + naf[k];
  22939. repr.push(nafW);
  22940. }
  22941. var a = this.jpoint(null, null, null);
  22942. var b = this.jpoint(null, null, null);
  22943. for (var i = I; i > 0; i--) {
  22944. for (var j = 0; j < repr.length; j++) {
  22945. var nafW = repr[j];
  22946. if (nafW === i)
  22947. b = b.mixedAdd(doubles.points[j]);
  22948. else if (nafW === -i)
  22949. b = b.mixedAdd(doubles.points[j].neg());
  22950. }
  22951. a = a.add(b);
  22952. }
  22953. return a.toP();
  22954. };
  22955. BaseCurve.prototype._wnafMul = function _wnafMul(p, k) {
  22956. var w = 4;
  22957. // Precompute window
  22958. var nafPoints = p._getNAFPoints(w);
  22959. w = nafPoints.wnd;
  22960. var wnd = nafPoints.points;
  22961. // Get NAF form
  22962. var naf = getNAF(k, w);
  22963. // Add `this`*(N+1) for every w-NAF index
  22964. var acc = this.jpoint(null, null, null);
  22965. for (var i = naf.length - 1; i >= 0; i--) {
  22966. // Count zeroes
  22967. for (var k = 0; i >= 0 && naf[i] === 0; i--)
  22968. k++;
  22969. if (i >= 0)
  22970. k++;
  22971. acc = acc.dblp(k);
  22972. if (i < 0)
  22973. break;
  22974. var z = naf[i];
  22975. assert(z !== 0);
  22976. if (p.type === 'affine') {
  22977. // J +- P
  22978. if (z > 0)
  22979. acc = acc.mixedAdd(wnd[(z - 1) >> 1]);
  22980. else
  22981. acc = acc.mixedAdd(wnd[(-z - 1) >> 1].neg());
  22982. } else {
  22983. // J +- J
  22984. if (z > 0)
  22985. acc = acc.add(wnd[(z - 1) >> 1]);
  22986. else
  22987. acc = acc.add(wnd[(-z - 1) >> 1].neg());
  22988. }
  22989. }
  22990. return p.type === 'affine' ? acc.toP() : acc;
  22991. };
  22992. BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW,
  22993. points,
  22994. coeffs,
  22995. len,
  22996. jacobianResult) {
  22997. var wndWidth = this._wnafT1;
  22998. var wnd = this._wnafT2;
  22999. var naf = this._wnafT3;
  23000. // Fill all arrays
  23001. var max = 0;
  23002. for (var i = 0; i < len; i++) {
  23003. var p = points[i];
  23004. var nafPoints = p._getNAFPoints(defW);
  23005. wndWidth[i] = nafPoints.wnd;
  23006. wnd[i] = nafPoints.points;
  23007. }
  23008. // Comb small window NAFs
  23009. for (var i = len - 1; i >= 1; i -= 2) {
  23010. var a = i - 1;
  23011. var b = i;
  23012. if (wndWidth[a] !== 1 || wndWidth[b] !== 1) {
  23013. naf[a] = getNAF(coeffs[a], wndWidth[a]);
  23014. naf[b] = getNAF(coeffs[b], wndWidth[b]);
  23015. max = Math.max(naf[a].length, max);
  23016. max = Math.max(naf[b].length, max);
  23017. continue;
  23018. }
  23019. var comb = [
  23020. points[a], /* 1 */
  23021. null, /* 3 */
  23022. null, /* 5 */
  23023. points[b] /* 7 */
  23024. ];
  23025. // Try to avoid Projective points, if possible
  23026. if (points[a].y.cmp(points[b].y) === 0) {
  23027. comb[1] = points[a].add(points[b]);
  23028. comb[2] = points[a].toJ().mixedAdd(points[b].neg());
  23029. } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) {
  23030. comb[1] = points[a].toJ().mixedAdd(points[b]);
  23031. comb[2] = points[a].add(points[b].neg());
  23032. } else {
  23033. comb[1] = points[a].toJ().mixedAdd(points[b]);
  23034. comb[2] = points[a].toJ().mixedAdd(points[b].neg());
  23035. }
  23036. var index = [
  23037. -3, /* -1 -1 */
  23038. -1, /* -1 0 */
  23039. -5, /* -1 1 */
  23040. -7, /* 0 -1 */
  23041. 0, /* 0 0 */
  23042. 7, /* 0 1 */
  23043. 5, /* 1 -1 */
  23044. 1, /* 1 0 */
  23045. 3 /* 1 1 */
  23046. ];
  23047. var jsf = getJSF(coeffs[a], coeffs[b]);
  23048. max = Math.max(jsf[0].length, max);
  23049. naf[a] = new Array(max);
  23050. naf[b] = new Array(max);
  23051. for (var j = 0; j < max; j++) {
  23052. var ja = jsf[0][j] | 0;
  23053. var jb = jsf[1][j] | 0;
  23054. naf[a][j] = index[(ja + 1) * 3 + (jb + 1)];
  23055. naf[b][j] = 0;
  23056. wnd[a] = comb;
  23057. }
  23058. }
  23059. var acc = this.jpoint(null, null, null);
  23060. var tmp = this._wnafT4;
  23061. for (var i = max; i >= 0; i--) {
  23062. var k = 0;
  23063. while (i >= 0) {
  23064. var zero = true;
  23065. for (var j = 0; j < len; j++) {
  23066. tmp[j] = naf[j][i] | 0;
  23067. if (tmp[j] !== 0)
  23068. zero = false;
  23069. }
  23070. if (!zero)
  23071. break;
  23072. k++;
  23073. i--;
  23074. }
  23075. if (i >= 0)
  23076. k++;
  23077. acc = acc.dblp(k);
  23078. if (i < 0)
  23079. break;
  23080. for (var j = 0; j < len; j++) {
  23081. var z = tmp[j];
  23082. var p;
  23083. if (z === 0)
  23084. continue;
  23085. else if (z > 0)
  23086. p = wnd[j][(z - 1) >> 1];
  23087. else if (z < 0)
  23088. p = wnd[j][(-z - 1) >> 1].neg();
  23089. if (p.type === 'affine')
  23090. acc = acc.mixedAdd(p);
  23091. else
  23092. acc = acc.add(p);
  23093. }
  23094. }
  23095. // Zeroify references
  23096. for (var i = 0; i < len; i++)
  23097. wnd[i] = null;
  23098. if (jacobianResult)
  23099. return acc;
  23100. else
  23101. return acc.toP();
  23102. };
  23103. function BasePoint(curve, type) {
  23104. this.curve = curve;
  23105. this.type = type;
  23106. this.precomputed = null;
  23107. }
  23108. BaseCurve.BasePoint = BasePoint;
  23109. BasePoint.prototype.eq = function eq(/*other*/) {
  23110. throw new Error('Not implemented');
  23111. };
  23112. BasePoint.prototype.validate = function validate() {
  23113. return this.curve.validate(this);
  23114. };
  23115. BaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) {
  23116. bytes = utils.toArray(bytes, enc);
  23117. var len = this.p.byteLength();
  23118. // uncompressed, hybrid-odd, hybrid-even
  23119. if ((bytes[0] === 0x04 || bytes[0] === 0x06 || bytes[0] === 0x07) &&
  23120. bytes.length - 1 === 2 * len) {
  23121. if (bytes[0] === 0x06)
  23122. assert(bytes[bytes.length - 1] % 2 === 0);
  23123. else if (bytes[0] === 0x07)
  23124. assert(bytes[bytes.length - 1] % 2 === 1);
  23125. var res = this.point(bytes.slice(1, 1 + len),
  23126. bytes.slice(1 + len, 1 + 2 * len));
  23127. return res;
  23128. } else if ((bytes[0] === 0x02 || bytes[0] === 0x03) &&
  23129. bytes.length - 1 === len) {
  23130. return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 0x03);
  23131. }
  23132. throw new Error('Unknown point format');
  23133. };
  23134. BasePoint.prototype.encodeCompressed = function encodeCompressed(enc) {
  23135. return this.encode(enc, true);
  23136. };
  23137. BasePoint.prototype._encode = function _encode(compact) {
  23138. var len = this.curve.p.byteLength();
  23139. var x = this.getX().toArray('be', len);
  23140. if (compact)
  23141. return [ this.getY().isEven() ? 0x02 : 0x03 ].concat(x);
  23142. return [ 0x04 ].concat(x, this.getY().toArray('be', len)) ;
  23143. };
  23144. BasePoint.prototype.encode = function encode(enc, compact) {
  23145. return utils.encode(this._encode(compact), enc);
  23146. };
  23147. BasePoint.prototype.precompute = function precompute(power) {
  23148. if (this.precomputed)
  23149. return this;
  23150. var precomputed = {
  23151. doubles: null,
  23152. naf: null,
  23153. beta: null
  23154. };
  23155. precomputed.naf = this._getNAFPoints(8);
  23156. precomputed.doubles = this._getDoubles(4, power);
  23157. precomputed.beta = this._getBeta();
  23158. this.precomputed = precomputed;
  23159. return this;
  23160. };
  23161. BasePoint.prototype._hasDoubles = function _hasDoubles(k) {
  23162. if (!this.precomputed)
  23163. return false;
  23164. var doubles = this.precomputed.doubles;
  23165. if (!doubles)
  23166. return false;
  23167. return doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step);
  23168. };
  23169. BasePoint.prototype._getDoubles = function _getDoubles(step, power) {
  23170. if (this.precomputed && this.precomputed.doubles)
  23171. return this.precomputed.doubles;
  23172. var doubles = [ this ];
  23173. var acc = this;
  23174. for (var i = 0; i < power; i += step) {
  23175. for (var j = 0; j < step; j++)
  23176. acc = acc.dbl();
  23177. doubles.push(acc);
  23178. }
  23179. return {
  23180. step: step,
  23181. points: doubles
  23182. };
  23183. };
  23184. BasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) {
  23185. if (this.precomputed && this.precomputed.naf)
  23186. return this.precomputed.naf;
  23187. var res = [ this ];
  23188. var max = (1 << wnd) - 1;
  23189. var dbl = max === 1 ? null : this.dbl();
  23190. for (var i = 1; i < max; i++)
  23191. res[i] = res[i - 1].add(dbl);
  23192. return {
  23193. wnd: wnd,
  23194. points: res
  23195. };
  23196. };
  23197. BasePoint.prototype._getBeta = function _getBeta() {
  23198. return null;
  23199. };
  23200. BasePoint.prototype.dblp = function dblp(k) {
  23201. var r = this;
  23202. for (var i = 0; i < k; i++)
  23203. r = r.dbl();
  23204. return r;
  23205. };
  23206. /***/ },
  23207. /* 233 */
  23208. /***/ function(module, exports, __webpack_require__) {
  23209. "use strict";
  23210. 'use strict';
  23211. var curve = __webpack_require__(43);
  23212. var elliptic = __webpack_require__(3);
  23213. var BN = __webpack_require__(2);
  23214. var inherits = __webpack_require__(1);
  23215. var Base = curve.base;
  23216. var assert = elliptic.utils.assert;
  23217. function EdwardsCurve(conf) {
  23218. // NOTE: Important as we are creating point in Base.call()
  23219. this.twisted = (conf.a | 0) !== 1;
  23220. this.mOneA = this.twisted && (conf.a | 0) === -1;
  23221. this.extended = this.mOneA;
  23222. Base.call(this, 'edwards', conf);
  23223. this.a = new BN(conf.a, 16).umod(this.red.m);
  23224. this.a = this.a.toRed(this.red);
  23225. this.c = new BN(conf.c, 16).toRed(this.red);
  23226. this.c2 = this.c.redSqr();
  23227. this.d = new BN(conf.d, 16).toRed(this.red);
  23228. this.dd = this.d.redAdd(this.d);
  23229. assert(!this.twisted || this.c.fromRed().cmpn(1) === 0);
  23230. this.oneC = (conf.c | 0) === 1;
  23231. }
  23232. inherits(EdwardsCurve, Base);
  23233. module.exports = EdwardsCurve;
  23234. EdwardsCurve.prototype._mulA = function _mulA(num) {
  23235. if (this.mOneA)
  23236. return num.redNeg();
  23237. else
  23238. return this.a.redMul(num);
  23239. };
  23240. EdwardsCurve.prototype._mulC = function _mulC(num) {
  23241. if (this.oneC)
  23242. return num;
  23243. else
  23244. return this.c.redMul(num);
  23245. };
  23246. // Just for compatibility with Short curve
  23247. EdwardsCurve.prototype.jpoint = function jpoint(x, y, z, t) {
  23248. return this.point(x, y, z, t);
  23249. };
  23250. EdwardsCurve.prototype.pointFromX = function pointFromX(x, odd) {
  23251. x = new BN(x, 16);
  23252. if (!x.red)
  23253. x = x.toRed(this.red);
  23254. var x2 = x.redSqr();
  23255. var rhs = this.c2.redSub(this.a.redMul(x2));
  23256. var lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2));
  23257. var y2 = rhs.redMul(lhs.redInvm());
  23258. var y = y2.redSqrt();
  23259. if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)
  23260. throw new Error('invalid point');
  23261. var isOdd = y.fromRed().isOdd();
  23262. if (odd && !isOdd || !odd && isOdd)
  23263. y = y.redNeg();
  23264. return this.point(x, y);
  23265. };
  23266. EdwardsCurve.prototype.pointFromY = function pointFromY(y, odd) {
  23267. y = new BN(y, 16);
  23268. if (!y.red)
  23269. y = y.toRed(this.red);
  23270. // x^2 = (y^2 - 1) / (d y^2 + 1)
  23271. var y2 = y.redSqr();
  23272. var lhs = y2.redSub(this.one);
  23273. var rhs = y2.redMul(this.d).redAdd(this.one);
  23274. var x2 = lhs.redMul(rhs.redInvm());
  23275. if (x2.cmp(this.zero) === 0) {
  23276. if (odd)
  23277. throw new Error('invalid point');
  23278. else
  23279. return this.point(this.zero, y);
  23280. }
  23281. var x = x2.redSqrt();
  23282. if (x.redSqr().redSub(x2).cmp(this.zero) !== 0)
  23283. throw new Error('invalid point');
  23284. if (x.isOdd() !== odd)
  23285. x = x.redNeg();
  23286. return this.point(x, y);
  23287. };
  23288. EdwardsCurve.prototype.validate = function validate(point) {
  23289. if (point.isInfinity())
  23290. return true;
  23291. // Curve: A * X^2 + Y^2 = C^2 * (1 + D * X^2 * Y^2)
  23292. point.normalize();
  23293. var x2 = point.x.redSqr();
  23294. var y2 = point.y.redSqr();
  23295. var lhs = x2.redMul(this.a).redAdd(y2);
  23296. var rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2)));
  23297. return lhs.cmp(rhs) === 0;
  23298. };
  23299. function Point(curve, x, y, z, t) {
  23300. Base.BasePoint.call(this, curve, 'projective');
  23301. if (x === null && y === null && z === null) {
  23302. this.x = this.curve.zero;
  23303. this.y = this.curve.one;
  23304. this.z = this.curve.one;
  23305. this.t = this.curve.zero;
  23306. this.zOne = true;
  23307. } else {
  23308. this.x = new BN(x, 16);
  23309. this.y = new BN(y, 16);
  23310. this.z = z ? new BN(z, 16) : this.curve.one;
  23311. this.t = t && new BN(t, 16);
  23312. if (!this.x.red)
  23313. this.x = this.x.toRed(this.curve.red);
  23314. if (!this.y.red)
  23315. this.y = this.y.toRed(this.curve.red);
  23316. if (!this.z.red)
  23317. this.z = this.z.toRed(this.curve.red);
  23318. if (this.t && !this.t.red)
  23319. this.t = this.t.toRed(this.curve.red);
  23320. this.zOne = this.z === this.curve.one;
  23321. // Use extended coordinates
  23322. if (this.curve.extended && !this.t) {
  23323. this.t = this.x.redMul(this.y);
  23324. if (!this.zOne)
  23325. this.t = this.t.redMul(this.z.redInvm());
  23326. }
  23327. }
  23328. }
  23329. inherits(Point, Base.BasePoint);
  23330. EdwardsCurve.prototype.pointFromJSON = function pointFromJSON(obj) {
  23331. return Point.fromJSON(this, obj);
  23332. };
  23333. EdwardsCurve.prototype.point = function point(x, y, z, t) {
  23334. return new Point(this, x, y, z, t);
  23335. };
  23336. Point.fromJSON = function fromJSON(curve, obj) {
  23337. return new Point(curve, obj[0], obj[1], obj[2]);
  23338. };
  23339. Point.prototype.inspect = function inspect() {
  23340. if (this.isInfinity())
  23341. return '<EC Point Infinity>';
  23342. return '<EC Point x: ' + this.x.fromRed().toString(16, 2) +
  23343. ' y: ' + this.y.fromRed().toString(16, 2) +
  23344. ' z: ' + this.z.fromRed().toString(16, 2) + '>';
  23345. };
  23346. Point.prototype.isInfinity = function isInfinity() {
  23347. // XXX This code assumes that zero is always zero in red
  23348. return this.x.cmpn(0) === 0 &&
  23349. this.y.cmp(this.z) === 0;
  23350. };
  23351. Point.prototype._extDbl = function _extDbl() {
  23352. // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html
  23353. // #doubling-dbl-2008-hwcd
  23354. // 4M + 4S
  23355. // A = X1^2
  23356. var a = this.x.redSqr();
  23357. // B = Y1^2
  23358. var b = this.y.redSqr();
  23359. // C = 2 * Z1^2
  23360. var c = this.z.redSqr();
  23361. c = c.redIAdd(c);
  23362. // D = a * A
  23363. var d = this.curve._mulA(a);
  23364. // E = (X1 + Y1)^2 - A - B
  23365. var e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b);
  23366. // G = D + B
  23367. var g = d.redAdd(b);
  23368. // F = G - C
  23369. var f = g.redSub(c);
  23370. // H = D - B
  23371. var h = d.redSub(b);
  23372. // X3 = E * F
  23373. var nx = e.redMul(f);
  23374. // Y3 = G * H
  23375. var ny = g.redMul(h);
  23376. // T3 = E * H
  23377. var nt = e.redMul(h);
  23378. // Z3 = F * G
  23379. var nz = f.redMul(g);
  23380. return this.curve.point(nx, ny, nz, nt);
  23381. };
  23382. Point.prototype._projDbl = function _projDbl() {
  23383. // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html
  23384. // #doubling-dbl-2008-bbjlp
  23385. // #doubling-dbl-2007-bl
  23386. // and others
  23387. // Generally 3M + 4S or 2M + 4S
  23388. // B = (X1 + Y1)^2
  23389. var b = this.x.redAdd(this.y).redSqr();
  23390. // C = X1^2
  23391. var c = this.x.redSqr();
  23392. // D = Y1^2
  23393. var d = this.y.redSqr();
  23394. var nx;
  23395. var ny;
  23396. var nz;
  23397. if (this.curve.twisted) {
  23398. // E = a * C
  23399. var e = this.curve._mulA(c);
  23400. // F = E + D
  23401. var f = e.redAdd(d);
  23402. if (this.zOne) {
  23403. // X3 = (B - C - D) * (F - 2)
  23404. nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two));
  23405. // Y3 = F * (E - D)
  23406. ny = f.redMul(e.redSub(d));
  23407. // Z3 = F^2 - 2 * F
  23408. nz = f.redSqr().redSub(f).redSub(f);
  23409. } else {
  23410. // H = Z1^2
  23411. var h = this.z.redSqr();
  23412. // J = F - 2 * H
  23413. var j = f.redSub(h).redISub(h);
  23414. // X3 = (B-C-D)*J
  23415. nx = b.redSub(c).redISub(d).redMul(j);
  23416. // Y3 = F * (E - D)
  23417. ny = f.redMul(e.redSub(d));
  23418. // Z3 = F * J
  23419. nz = f.redMul(j);
  23420. }
  23421. } else {
  23422. // E = C + D
  23423. var e = c.redAdd(d);
  23424. // H = (c * Z1)^2
  23425. var h = this.curve._mulC(this.c.redMul(this.z)).redSqr();
  23426. // J = E - 2 * H
  23427. var j = e.redSub(h).redSub(h);
  23428. // X3 = c * (B - E) * J
  23429. nx = this.curve._mulC(b.redISub(e)).redMul(j);
  23430. // Y3 = c * E * (C - D)
  23431. ny = this.curve._mulC(e).redMul(c.redISub(d));
  23432. // Z3 = E * J
  23433. nz = e.redMul(j);
  23434. }
  23435. return this.curve.point(nx, ny, nz);
  23436. };
  23437. Point.prototype.dbl = function dbl() {
  23438. if (this.isInfinity())
  23439. return this;
  23440. // Double in extended coordinates
  23441. if (this.curve.extended)
  23442. return this._extDbl();
  23443. else
  23444. return this._projDbl();
  23445. };
  23446. Point.prototype._extAdd = function _extAdd(p) {
  23447. // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html
  23448. // #addition-add-2008-hwcd-3
  23449. // 8M
  23450. // A = (Y1 - X1) * (Y2 - X2)
  23451. var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x));
  23452. // B = (Y1 + X1) * (Y2 + X2)
  23453. var b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x));
  23454. // C = T1 * k * T2
  23455. var c = this.t.redMul(this.curve.dd).redMul(p.t);
  23456. // D = Z1 * 2 * Z2
  23457. var d = this.z.redMul(p.z.redAdd(p.z));
  23458. // E = B - A
  23459. var e = b.redSub(a);
  23460. // F = D - C
  23461. var f = d.redSub(c);
  23462. // G = D + C
  23463. var g = d.redAdd(c);
  23464. // H = B + A
  23465. var h = b.redAdd(a);
  23466. // X3 = E * F
  23467. var nx = e.redMul(f);
  23468. // Y3 = G * H
  23469. var ny = g.redMul(h);
  23470. // T3 = E * H
  23471. var nt = e.redMul(h);
  23472. // Z3 = F * G
  23473. var nz = f.redMul(g);
  23474. return this.curve.point(nx, ny, nz, nt);
  23475. };
  23476. Point.prototype._projAdd = function _projAdd(p) {
  23477. // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html
  23478. // #addition-add-2008-bbjlp
  23479. // #addition-add-2007-bl
  23480. // 10M + 1S
  23481. // A = Z1 * Z2
  23482. var a = this.z.redMul(p.z);
  23483. // B = A^2
  23484. var b = a.redSqr();
  23485. // C = X1 * X2
  23486. var c = this.x.redMul(p.x);
  23487. // D = Y1 * Y2
  23488. var d = this.y.redMul(p.y);
  23489. // E = d * C * D
  23490. var e = this.curve.d.redMul(c).redMul(d);
  23491. // F = B - E
  23492. var f = b.redSub(e);
  23493. // G = B + E
  23494. var g = b.redAdd(e);
  23495. // X3 = A * F * ((X1 + Y1) * (X2 + Y2) - C - D)
  23496. var tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d);
  23497. var nx = a.redMul(f).redMul(tmp);
  23498. var ny;
  23499. var nz;
  23500. if (this.curve.twisted) {
  23501. // Y3 = A * G * (D - a * C)
  23502. ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c)));
  23503. // Z3 = F * G
  23504. nz = f.redMul(g);
  23505. } else {
  23506. // Y3 = A * G * (D - C)
  23507. ny = a.redMul(g).redMul(d.redSub(c));
  23508. // Z3 = c * F * G
  23509. nz = this.curve._mulC(f).redMul(g);
  23510. }
  23511. return this.curve.point(nx, ny, nz);
  23512. };
  23513. Point.prototype.add = function add(p) {
  23514. if (this.isInfinity())
  23515. return p;
  23516. if (p.isInfinity())
  23517. return this;
  23518. if (this.curve.extended)
  23519. return this._extAdd(p);
  23520. else
  23521. return this._projAdd(p);
  23522. };
  23523. Point.prototype.mul = function mul(k) {
  23524. if (this._hasDoubles(k))
  23525. return this.curve._fixedNafMul(this, k);
  23526. else
  23527. return this.curve._wnafMul(this, k);
  23528. };
  23529. Point.prototype.mulAdd = function mulAdd(k1, p, k2) {
  23530. return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, false);
  23531. };
  23532. Point.prototype.jmulAdd = function jmulAdd(k1, p, k2) {
  23533. return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, true);
  23534. };
  23535. Point.prototype.normalize = function normalize() {
  23536. if (this.zOne)
  23537. return this;
  23538. // Normalize coordinates
  23539. var zi = this.z.redInvm();
  23540. this.x = this.x.redMul(zi);
  23541. this.y = this.y.redMul(zi);
  23542. if (this.t)
  23543. this.t = this.t.redMul(zi);
  23544. this.z = this.curve.one;
  23545. this.zOne = true;
  23546. return this;
  23547. };
  23548. Point.prototype.neg = function neg() {
  23549. return this.curve.point(this.x.redNeg(),
  23550. this.y,
  23551. this.z,
  23552. this.t && this.t.redNeg());
  23553. };
  23554. Point.prototype.getX = function getX() {
  23555. this.normalize();
  23556. return this.x.fromRed();
  23557. };
  23558. Point.prototype.getY = function getY() {
  23559. this.normalize();
  23560. return this.y.fromRed();
  23561. };
  23562. Point.prototype.eq = function eq(other) {
  23563. return this === other ||
  23564. this.getX().cmp(other.getX()) === 0 &&
  23565. this.getY().cmp(other.getY()) === 0;
  23566. };
  23567. Point.prototype.eqXToP = function eqXToP(x) {
  23568. var rx = x.toRed(this.curve.red).redMul(this.z);
  23569. if (this.x.cmp(rx) === 0)
  23570. return true;
  23571. var xc = x.clone();
  23572. var t = this.curve.redN.redMul(this.z);
  23573. for (;;) {
  23574. xc.iadd(this.curve.n);
  23575. if (xc.cmp(this.curve.p) >= 0)
  23576. return false;
  23577. rx.redIAdd(t);
  23578. if (this.x.cmp(rx) === 0)
  23579. return true;
  23580. }
  23581. return false;
  23582. };
  23583. // Compatibility with BaseCurve
  23584. Point.prototype.toP = Point.prototype.normalize;
  23585. Point.prototype.mixedAdd = Point.prototype.add;
  23586. /***/ },
  23587. /* 234 */
  23588. /***/ function(module, exports, __webpack_require__) {
  23589. "use strict";
  23590. 'use strict';
  23591. var curve = __webpack_require__(43);
  23592. var BN = __webpack_require__(2);
  23593. var inherits = __webpack_require__(1);
  23594. var Base = curve.base;
  23595. var elliptic = __webpack_require__(3);
  23596. var utils = elliptic.utils;
  23597. function MontCurve(conf) {
  23598. Base.call(this, 'mont', conf);
  23599. this.a = new BN(conf.a, 16).toRed(this.red);
  23600. this.b = new BN(conf.b, 16).toRed(this.red);
  23601. this.i4 = new BN(4).toRed(this.red).redInvm();
  23602. this.two = new BN(2).toRed(this.red);
  23603. this.a24 = this.i4.redMul(this.a.redAdd(this.two));
  23604. }
  23605. inherits(MontCurve, Base);
  23606. module.exports = MontCurve;
  23607. MontCurve.prototype.validate = function validate(point) {
  23608. var x = point.normalize().x;
  23609. var x2 = x.redSqr();
  23610. var rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x);
  23611. var y = rhs.redSqrt();
  23612. return y.redSqr().cmp(rhs) === 0;
  23613. };
  23614. function Point(curve, x, z) {
  23615. Base.BasePoint.call(this, curve, 'projective');
  23616. if (x === null && z === null) {
  23617. this.x = this.curve.one;
  23618. this.z = this.curve.zero;
  23619. } else {
  23620. this.x = new BN(x, 16);
  23621. this.z = new BN(z, 16);
  23622. if (!this.x.red)
  23623. this.x = this.x.toRed(this.curve.red);
  23624. if (!this.z.red)
  23625. this.z = this.z.toRed(this.curve.red);
  23626. }
  23627. }
  23628. inherits(Point, Base.BasePoint);
  23629. MontCurve.prototype.decodePoint = function decodePoint(bytes, enc) {
  23630. return this.point(utils.toArray(bytes, enc), 1);
  23631. };
  23632. MontCurve.prototype.point = function point(x, z) {
  23633. return new Point(this, x, z);
  23634. };
  23635. MontCurve.prototype.pointFromJSON = function pointFromJSON(obj) {
  23636. return Point.fromJSON(this, obj);
  23637. };
  23638. Point.prototype.precompute = function precompute() {
  23639. // No-op
  23640. };
  23641. Point.prototype._encode = function _encode() {
  23642. return this.getX().toArray('be', this.curve.p.byteLength());
  23643. };
  23644. Point.fromJSON = function fromJSON(curve, obj) {
  23645. return new Point(curve, obj[0], obj[1] || curve.one);
  23646. };
  23647. Point.prototype.inspect = function inspect() {
  23648. if (this.isInfinity())
  23649. return '<EC Point Infinity>';
  23650. return '<EC Point x: ' + this.x.fromRed().toString(16, 2) +
  23651. ' z: ' + this.z.fromRed().toString(16, 2) + '>';
  23652. };
  23653. Point.prototype.isInfinity = function isInfinity() {
  23654. // XXX This code assumes that zero is always zero in red
  23655. return this.z.cmpn(0) === 0;
  23656. };
  23657. Point.prototype.dbl = function dbl() {
  23658. // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#doubling-dbl-1987-m-3
  23659. // 2M + 2S + 4A
  23660. // A = X1 + Z1
  23661. var a = this.x.redAdd(this.z);
  23662. // AA = A^2
  23663. var aa = a.redSqr();
  23664. // B = X1 - Z1
  23665. var b = this.x.redSub(this.z);
  23666. // BB = B^2
  23667. var bb = b.redSqr();
  23668. // C = AA - BB
  23669. var c = aa.redSub(bb);
  23670. // X3 = AA * BB
  23671. var nx = aa.redMul(bb);
  23672. // Z3 = C * (BB + A24 * C)
  23673. var nz = c.redMul(bb.redAdd(this.curve.a24.redMul(c)));
  23674. return this.curve.point(nx, nz);
  23675. };
  23676. Point.prototype.add = function add() {
  23677. throw new Error('Not supported on Montgomery curve');
  23678. };
  23679. Point.prototype.diffAdd = function diffAdd(p, diff) {
  23680. // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#diffadd-dadd-1987-m-3
  23681. // 4M + 2S + 6A
  23682. // A = X2 + Z2
  23683. var a = this.x.redAdd(this.z);
  23684. // B = X2 - Z2
  23685. var b = this.x.redSub(this.z);
  23686. // C = X3 + Z3
  23687. var c = p.x.redAdd(p.z);
  23688. // D = X3 - Z3
  23689. var d = p.x.redSub(p.z);
  23690. // DA = D * A
  23691. var da = d.redMul(a);
  23692. // CB = C * B
  23693. var cb = c.redMul(b);
  23694. // X5 = Z1 * (DA + CB)^2
  23695. var nx = diff.z.redMul(da.redAdd(cb).redSqr());
  23696. // Z5 = X1 * (DA - CB)^2
  23697. var nz = diff.x.redMul(da.redISub(cb).redSqr());
  23698. return this.curve.point(nx, nz);
  23699. };
  23700. Point.prototype.mul = function mul(k) {
  23701. var t = k.clone();
  23702. var a = this; // (N / 2) * Q + Q
  23703. var b = this.curve.point(null, null); // (N / 2) * Q
  23704. var c = this; // Q
  23705. for (var bits = []; t.cmpn(0) !== 0; t.iushrn(1))
  23706. bits.push(t.andln(1));
  23707. for (var i = bits.length - 1; i >= 0; i--) {
  23708. if (bits[i] === 0) {
  23709. // N * Q + Q = ((N / 2) * Q + Q)) + (N / 2) * Q
  23710. a = a.diffAdd(b, c);
  23711. // N * Q = 2 * ((N / 2) * Q + Q))
  23712. b = b.dbl();
  23713. } else {
  23714. // N * Q = ((N / 2) * Q + Q) + ((N / 2) * Q)
  23715. b = a.diffAdd(b, c);
  23716. // N * Q + Q = 2 * ((N / 2) * Q + Q)
  23717. a = a.dbl();
  23718. }
  23719. }
  23720. return b;
  23721. };
  23722. Point.prototype.mulAdd = function mulAdd() {
  23723. throw new Error('Not supported on Montgomery curve');
  23724. };
  23725. Point.prototype.jumlAdd = function jumlAdd() {
  23726. throw new Error('Not supported on Montgomery curve');
  23727. };
  23728. Point.prototype.eq = function eq(other) {
  23729. return this.getX().cmp(other.getX()) === 0;
  23730. };
  23731. Point.prototype.normalize = function normalize() {
  23732. this.x = this.x.redMul(this.z.redInvm());
  23733. this.z = this.curve.one;
  23734. return this;
  23735. };
  23736. Point.prototype.getX = function getX() {
  23737. // Normalize coordinates
  23738. this.normalize();
  23739. return this.x.fromRed();
  23740. };
  23741. /***/ },
  23742. /* 235 */
  23743. /***/ function(module, exports, __webpack_require__) {
  23744. "use strict";
  23745. 'use strict';
  23746. var curve = __webpack_require__(43);
  23747. var elliptic = __webpack_require__(3);
  23748. var BN = __webpack_require__(2);
  23749. var inherits = __webpack_require__(1);
  23750. var Base = curve.base;
  23751. var assert = elliptic.utils.assert;
  23752. function ShortCurve(conf) {
  23753. Base.call(this, 'short', conf);
  23754. this.a = new BN(conf.a, 16).toRed(this.red);
  23755. this.b = new BN(conf.b, 16).toRed(this.red);
  23756. this.tinv = this.two.redInvm();
  23757. this.zeroA = this.a.fromRed().cmpn(0) === 0;
  23758. this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0;
  23759. // If the curve is endomorphic, precalculate beta and lambda
  23760. this.endo = this._getEndomorphism(conf);
  23761. this._endoWnafT1 = new Array(4);
  23762. this._endoWnafT2 = new Array(4);
  23763. }
  23764. inherits(ShortCurve, Base);
  23765. module.exports = ShortCurve;
  23766. ShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) {
  23767. // No efficient endomorphism
  23768. if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1)
  23769. return;
  23770. // Compute beta and lambda, that lambda * P = (beta * Px; Py)
  23771. var beta;
  23772. var lambda;
  23773. if (conf.beta) {
  23774. beta = new BN(conf.beta, 16).toRed(this.red);
  23775. } else {
  23776. var betas = this._getEndoRoots(this.p);
  23777. // Choose the smallest beta
  23778. beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1];
  23779. beta = beta.toRed(this.red);
  23780. }
  23781. if (conf.lambda) {
  23782. lambda = new BN(conf.lambda, 16);
  23783. } else {
  23784. // Choose the lambda that is matching selected beta
  23785. var lambdas = this._getEndoRoots(this.n);
  23786. if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) {
  23787. lambda = lambdas[0];
  23788. } else {
  23789. lambda = lambdas[1];
  23790. assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0);
  23791. }
  23792. }
  23793. // Get basis vectors, used for balanced length-two representation
  23794. var basis;
  23795. if (conf.basis) {
  23796. basis = conf.basis.map(function(vec) {
  23797. return {
  23798. a: new BN(vec.a, 16),
  23799. b: new BN(vec.b, 16)
  23800. };
  23801. });
  23802. } else {
  23803. basis = this._getEndoBasis(lambda);
  23804. }
  23805. return {
  23806. beta: beta,
  23807. lambda: lambda,
  23808. basis: basis
  23809. };
  23810. };
  23811. ShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) {
  23812. // Find roots of for x^2 + x + 1 in F
  23813. // Root = (-1 +- Sqrt(-3)) / 2
  23814. //
  23815. var red = num === this.p ? this.red : BN.mont(num);
  23816. var tinv = new BN(2).toRed(red).redInvm();
  23817. var ntinv = tinv.redNeg();
  23818. var s = new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv);
  23819. var l1 = ntinv.redAdd(s).fromRed();
  23820. var l2 = ntinv.redSub(s).fromRed();
  23821. return [ l1, l2 ];
  23822. };
  23823. ShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) {
  23824. // aprxSqrt >= sqrt(this.n)
  23825. var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2));
  23826. // 3.74
  23827. // Run EGCD, until r(L + 1) < aprxSqrt
  23828. var u = lambda;
  23829. var v = this.n.clone();
  23830. var x1 = new BN(1);
  23831. var y1 = new BN(0);
  23832. var x2 = new BN(0);
  23833. var y2 = new BN(1);
  23834. // NOTE: all vectors are roots of: a + b * lambda = 0 (mod n)
  23835. var a0;
  23836. var b0;
  23837. // First vector
  23838. var a1;
  23839. var b1;
  23840. // Second vector
  23841. var a2;
  23842. var b2;
  23843. var prevR;
  23844. var i = 0;
  23845. var r;
  23846. var x;
  23847. while (u.cmpn(0) !== 0) {
  23848. var q = v.div(u);
  23849. r = v.sub(q.mul(u));
  23850. x = x2.sub(q.mul(x1));
  23851. var y = y2.sub(q.mul(y1));
  23852. if (!a1 && r.cmp(aprxSqrt) < 0) {
  23853. a0 = prevR.neg();
  23854. b0 = x1;
  23855. a1 = r.neg();
  23856. b1 = x;
  23857. } else if (a1 && ++i === 2) {
  23858. break;
  23859. }
  23860. prevR = r;
  23861. v = u;
  23862. u = r;
  23863. x2 = x1;
  23864. x1 = x;
  23865. y2 = y1;
  23866. y1 = y;
  23867. }
  23868. a2 = r.neg();
  23869. b2 = x;
  23870. var len1 = a1.sqr().add(b1.sqr());
  23871. var len2 = a2.sqr().add(b2.sqr());
  23872. if (len2.cmp(len1) >= 0) {
  23873. a2 = a0;
  23874. b2 = b0;
  23875. }
  23876. // Normalize signs
  23877. if (a1.negative) {
  23878. a1 = a1.neg();
  23879. b1 = b1.neg();
  23880. }
  23881. if (a2.negative) {
  23882. a2 = a2.neg();
  23883. b2 = b2.neg();
  23884. }
  23885. return [
  23886. { a: a1, b: b1 },
  23887. { a: a2, b: b2 }
  23888. ];
  23889. };
  23890. ShortCurve.prototype._endoSplit = function _endoSplit(k) {
  23891. var basis = this.endo.basis;
  23892. var v1 = basis[0];
  23893. var v2 = basis[1];
  23894. var c1 = v2.b.mul(k).divRound(this.n);
  23895. var c2 = v1.b.neg().mul(k).divRound(this.n);
  23896. var p1 = c1.mul(v1.a);
  23897. var p2 = c2.mul(v2.a);
  23898. var q1 = c1.mul(v1.b);
  23899. var q2 = c2.mul(v2.b);
  23900. // Calculate answer
  23901. var k1 = k.sub(p1).sub(p2);
  23902. var k2 = q1.add(q2).neg();
  23903. return { k1: k1, k2: k2 };
  23904. };
  23905. ShortCurve.prototype.pointFromX = function pointFromX(x, odd) {
  23906. x = new BN(x, 16);
  23907. if (!x.red)
  23908. x = x.toRed(this.red);
  23909. var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b);
  23910. var y = y2.redSqrt();
  23911. if (y.redSqr().redSub(y2).cmp(this.zero) !== 0)
  23912. throw new Error('invalid point');
  23913. // XXX Is there any way to tell if the number is odd without converting it
  23914. // to non-red form?
  23915. var isOdd = y.fromRed().isOdd();
  23916. if (odd && !isOdd || !odd && isOdd)
  23917. y = y.redNeg();
  23918. return this.point(x, y);
  23919. };
  23920. ShortCurve.prototype.validate = function validate(point) {
  23921. if (point.inf)
  23922. return true;
  23923. var x = point.x;
  23924. var y = point.y;
  23925. var ax = this.a.redMul(x);
  23926. var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);
  23927. return y.redSqr().redISub(rhs).cmpn(0) === 0;
  23928. };
  23929. ShortCurve.prototype._endoWnafMulAdd =
  23930. function _endoWnafMulAdd(points, coeffs, jacobianResult) {
  23931. var npoints = this._endoWnafT1;
  23932. var ncoeffs = this._endoWnafT2;
  23933. for (var i = 0; i < points.length; i++) {
  23934. var split = this._endoSplit(coeffs[i]);
  23935. var p = points[i];
  23936. var beta = p._getBeta();
  23937. if (split.k1.negative) {
  23938. split.k1.ineg();
  23939. p = p.neg(true);
  23940. }
  23941. if (split.k2.negative) {
  23942. split.k2.ineg();
  23943. beta = beta.neg(true);
  23944. }
  23945. npoints[i * 2] = p;
  23946. npoints[i * 2 + 1] = beta;
  23947. ncoeffs[i * 2] = split.k1;
  23948. ncoeffs[i * 2 + 1] = split.k2;
  23949. }
  23950. var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult);
  23951. // Clean-up references to points and coefficients
  23952. for (var j = 0; j < i * 2; j++) {
  23953. npoints[j] = null;
  23954. ncoeffs[j] = null;
  23955. }
  23956. return res;
  23957. };
  23958. function Point(curve, x, y, isRed) {
  23959. Base.BasePoint.call(this, curve, 'affine');
  23960. if (x === null && y === null) {
  23961. this.x = null;
  23962. this.y = null;
  23963. this.inf = true;
  23964. } else {
  23965. this.x = new BN(x, 16);
  23966. this.y = new BN(y, 16);
  23967. // Force redgomery representation when loading from JSON
  23968. if (isRed) {
  23969. this.x.forceRed(this.curve.red);
  23970. this.y.forceRed(this.curve.red);
  23971. }
  23972. if (!this.x.red)
  23973. this.x = this.x.toRed(this.curve.red);
  23974. if (!this.y.red)
  23975. this.y = this.y.toRed(this.curve.red);
  23976. this.inf = false;
  23977. }
  23978. }
  23979. inherits(Point, Base.BasePoint);
  23980. ShortCurve.prototype.point = function point(x, y, isRed) {
  23981. return new Point(this, x, y, isRed);
  23982. };
  23983. ShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) {
  23984. return Point.fromJSON(this, obj, red);
  23985. };
  23986. Point.prototype._getBeta = function _getBeta() {
  23987. if (!this.curve.endo)
  23988. return;
  23989. var pre = this.precomputed;
  23990. if (pre && pre.beta)
  23991. return pre.beta;
  23992. var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y);
  23993. if (pre) {
  23994. var curve = this.curve;
  23995. var endoMul = function(p) {
  23996. return curve.point(p.x.redMul(curve.endo.beta), p.y);
  23997. };
  23998. pre.beta = beta;
  23999. beta.precomputed = {
  24000. beta: null,
  24001. naf: pre.naf && {
  24002. wnd: pre.naf.wnd,
  24003. points: pre.naf.points.map(endoMul)
  24004. },
  24005. doubles: pre.doubles && {
  24006. step: pre.doubles.step,
  24007. points: pre.doubles.points.map(endoMul)
  24008. }
  24009. };
  24010. }
  24011. return beta;
  24012. };
  24013. Point.prototype.toJSON = function toJSON() {
  24014. if (!this.precomputed)
  24015. return [ this.x, this.y ];
  24016. return [ this.x, this.y, this.precomputed && {
  24017. doubles: this.precomputed.doubles && {
  24018. step: this.precomputed.doubles.step,
  24019. points: this.precomputed.doubles.points.slice(1)
  24020. },
  24021. naf: this.precomputed.naf && {
  24022. wnd: this.precomputed.naf.wnd,
  24023. points: this.precomputed.naf.points.slice(1)
  24024. }
  24025. } ];
  24026. };
  24027. Point.fromJSON = function fromJSON(curve, obj, red) {
  24028. if (typeof obj === 'string')
  24029. obj = JSON.parse(obj);
  24030. var res = curve.point(obj[0], obj[1], red);
  24031. if (!obj[2])
  24032. return res;
  24033. function obj2point(obj) {
  24034. return curve.point(obj[0], obj[1], red);
  24035. }
  24036. var pre = obj[2];
  24037. res.precomputed = {
  24038. beta: null,
  24039. doubles: pre.doubles && {
  24040. step: pre.doubles.step,
  24041. points: [ res ].concat(pre.doubles.points.map(obj2point))
  24042. },
  24043. naf: pre.naf && {
  24044. wnd: pre.naf.wnd,
  24045. points: [ res ].concat(pre.naf.points.map(obj2point))
  24046. }
  24047. };
  24048. return res;
  24049. };
  24050. Point.prototype.inspect = function inspect() {
  24051. if (this.isInfinity())
  24052. return '<EC Point Infinity>';
  24053. return '<EC Point x: ' + this.x.fromRed().toString(16, 2) +
  24054. ' y: ' + this.y.fromRed().toString(16, 2) + '>';
  24055. };
  24056. Point.prototype.isInfinity = function isInfinity() {
  24057. return this.inf;
  24058. };
  24059. Point.prototype.add = function add(p) {
  24060. // O + P = P
  24061. if (this.inf)
  24062. return p;
  24063. // P + O = P
  24064. if (p.inf)
  24065. return this;
  24066. // P + P = 2P
  24067. if (this.eq(p))
  24068. return this.dbl();
  24069. // P + (-P) = O
  24070. if (this.neg().eq(p))
  24071. return this.curve.point(null, null);
  24072. // P + Q = O
  24073. if (this.x.cmp(p.x) === 0)
  24074. return this.curve.point(null, null);
  24075. var c = this.y.redSub(p.y);
  24076. if (c.cmpn(0) !== 0)
  24077. c = c.redMul(this.x.redSub(p.x).redInvm());
  24078. var nx = c.redSqr().redISub(this.x).redISub(p.x);
  24079. var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);
  24080. return this.curve.point(nx, ny);
  24081. };
  24082. Point.prototype.dbl = function dbl() {
  24083. if (this.inf)
  24084. return this;
  24085. // 2P = O
  24086. var ys1 = this.y.redAdd(this.y);
  24087. if (ys1.cmpn(0) === 0)
  24088. return this.curve.point(null, null);
  24089. var a = this.curve.a;
  24090. var x2 = this.x.redSqr();
  24091. var dyinv = ys1.redInvm();
  24092. var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv);
  24093. var nx = c.redSqr().redISub(this.x.redAdd(this.x));
  24094. var ny = c.redMul(this.x.redSub(nx)).redISub(this.y);
  24095. return this.curve.point(nx, ny);
  24096. };
  24097. Point.prototype.getX = function getX() {
  24098. return this.x.fromRed();
  24099. };
  24100. Point.prototype.getY = function getY() {
  24101. return this.y.fromRed();
  24102. };
  24103. Point.prototype.mul = function mul(k) {
  24104. k = new BN(k, 16);
  24105. if (this._hasDoubles(k))
  24106. return this.curve._fixedNafMul(this, k);
  24107. else if (this.curve.endo)
  24108. return this.curve._endoWnafMulAdd([ this ], [ k ]);
  24109. else
  24110. return this.curve._wnafMul(this, k);
  24111. };
  24112. Point.prototype.mulAdd = function mulAdd(k1, p2, k2) {
  24113. var points = [ this, p2 ];
  24114. var coeffs = [ k1, k2 ];
  24115. if (this.curve.endo)
  24116. return this.curve._endoWnafMulAdd(points, coeffs);
  24117. else
  24118. return this.curve._wnafMulAdd(1, points, coeffs, 2);
  24119. };
  24120. Point.prototype.jmulAdd = function jmulAdd(k1, p2, k2) {
  24121. var points = [ this, p2 ];
  24122. var coeffs = [ k1, k2 ];
  24123. if (this.curve.endo)
  24124. return this.curve._endoWnafMulAdd(points, coeffs, true);
  24125. else
  24126. return this.curve._wnafMulAdd(1, points, coeffs, 2, true);
  24127. };
  24128. Point.prototype.eq = function eq(p) {
  24129. return this === p ||
  24130. this.inf === p.inf &&
  24131. (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0);
  24132. };
  24133. Point.prototype.neg = function neg(_precompute) {
  24134. if (this.inf)
  24135. return this;
  24136. var res = this.curve.point(this.x, this.y.redNeg());
  24137. if (_precompute && this.precomputed) {
  24138. var pre = this.precomputed;
  24139. var negate = function(p) {
  24140. return p.neg();
  24141. };
  24142. res.precomputed = {
  24143. naf: pre.naf && {
  24144. wnd: pre.naf.wnd,
  24145. points: pre.naf.points.map(negate)
  24146. },
  24147. doubles: pre.doubles && {
  24148. step: pre.doubles.step,
  24149. points: pre.doubles.points.map(negate)
  24150. }
  24151. };
  24152. }
  24153. return res;
  24154. };
  24155. Point.prototype.toJ = function toJ() {
  24156. if (this.inf)
  24157. return this.curve.jpoint(null, null, null);
  24158. var res = this.curve.jpoint(this.x, this.y, this.curve.one);
  24159. return res;
  24160. };
  24161. function JPoint(curve, x, y, z) {
  24162. Base.BasePoint.call(this, curve, 'jacobian');
  24163. if (x === null && y === null && z === null) {
  24164. this.x = this.curve.one;
  24165. this.y = this.curve.one;
  24166. this.z = new BN(0);
  24167. } else {
  24168. this.x = new BN(x, 16);
  24169. this.y = new BN(y, 16);
  24170. this.z = new BN(z, 16);
  24171. }
  24172. if (!this.x.red)
  24173. this.x = this.x.toRed(this.curve.red);
  24174. if (!this.y.red)
  24175. this.y = this.y.toRed(this.curve.red);
  24176. if (!this.z.red)
  24177. this.z = this.z.toRed(this.curve.red);
  24178. this.zOne = this.z === this.curve.one;
  24179. }
  24180. inherits(JPoint, Base.BasePoint);
  24181. ShortCurve.prototype.jpoint = function jpoint(x, y, z) {
  24182. return new JPoint(this, x, y, z);
  24183. };
  24184. JPoint.prototype.toP = function toP() {
  24185. if (this.isInfinity())
  24186. return this.curve.point(null, null);
  24187. var zinv = this.z.redInvm();
  24188. var zinv2 = zinv.redSqr();
  24189. var ax = this.x.redMul(zinv2);
  24190. var ay = this.y.redMul(zinv2).redMul(zinv);
  24191. return this.curve.point(ax, ay);
  24192. };
  24193. JPoint.prototype.neg = function neg() {
  24194. return this.curve.jpoint(this.x, this.y.redNeg(), this.z);
  24195. };
  24196. JPoint.prototype.add = function add(p) {
  24197. // O + P = P
  24198. if (this.isInfinity())
  24199. return p;
  24200. // P + O = P
  24201. if (p.isInfinity())
  24202. return this;
  24203. // 12M + 4S + 7A
  24204. var pz2 = p.z.redSqr();
  24205. var z2 = this.z.redSqr();
  24206. var u1 = this.x.redMul(pz2);
  24207. var u2 = p.x.redMul(z2);
  24208. var s1 = this.y.redMul(pz2.redMul(p.z));
  24209. var s2 = p.y.redMul(z2.redMul(this.z));
  24210. var h = u1.redSub(u2);
  24211. var r = s1.redSub(s2);
  24212. if (h.cmpn(0) === 0) {
  24213. if (r.cmpn(0) !== 0)
  24214. return this.curve.jpoint(null, null, null);
  24215. else
  24216. return this.dbl();
  24217. }
  24218. var h2 = h.redSqr();
  24219. var h3 = h2.redMul(h);
  24220. var v = u1.redMul(h2);
  24221. var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);
  24222. var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));
  24223. var nz = this.z.redMul(p.z).redMul(h);
  24224. return this.curve.jpoint(nx, ny, nz);
  24225. };
  24226. JPoint.prototype.mixedAdd = function mixedAdd(p) {
  24227. // O + P = P
  24228. if (this.isInfinity())
  24229. return p.toJ();
  24230. // P + O = P
  24231. if (p.isInfinity())
  24232. return this;
  24233. // 8M + 3S + 7A
  24234. var z2 = this.z.redSqr();
  24235. var u1 = this.x;
  24236. var u2 = p.x.redMul(z2);
  24237. var s1 = this.y;
  24238. var s2 = p.y.redMul(z2).redMul(this.z);
  24239. var h = u1.redSub(u2);
  24240. var r = s1.redSub(s2);
  24241. if (h.cmpn(0) === 0) {
  24242. if (r.cmpn(0) !== 0)
  24243. return this.curve.jpoint(null, null, null);
  24244. else
  24245. return this.dbl();
  24246. }
  24247. var h2 = h.redSqr();
  24248. var h3 = h2.redMul(h);
  24249. var v = u1.redMul(h2);
  24250. var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v);
  24251. var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3));
  24252. var nz = this.z.redMul(h);
  24253. return this.curve.jpoint(nx, ny, nz);
  24254. };
  24255. JPoint.prototype.dblp = function dblp(pow) {
  24256. if (pow === 0)
  24257. return this;
  24258. if (this.isInfinity())
  24259. return this;
  24260. if (!pow)
  24261. return this.dbl();
  24262. if (this.curve.zeroA || this.curve.threeA) {
  24263. var r = this;
  24264. for (var i = 0; i < pow; i++)
  24265. r = r.dbl();
  24266. return r;
  24267. }
  24268. // 1M + 2S + 1A + N * (4S + 5M + 8A)
  24269. // N = 1 => 6M + 6S + 9A
  24270. var a = this.curve.a;
  24271. var tinv = this.curve.tinv;
  24272. var jx = this.x;
  24273. var jy = this.y;
  24274. var jz = this.z;
  24275. var jz4 = jz.redSqr().redSqr();
  24276. // Reuse results
  24277. var jyd = jy.redAdd(jy);
  24278. for (var i = 0; i < pow; i++) {
  24279. var jx2 = jx.redSqr();
  24280. var jyd2 = jyd.redSqr();
  24281. var jyd4 = jyd2.redSqr();
  24282. var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));
  24283. var t1 = jx.redMul(jyd2);
  24284. var nx = c.redSqr().redISub(t1.redAdd(t1));
  24285. var t2 = t1.redISub(nx);
  24286. var dny = c.redMul(t2);
  24287. dny = dny.redIAdd(dny).redISub(jyd4);
  24288. var nz = jyd.redMul(jz);
  24289. if (i + 1 < pow)
  24290. jz4 = jz4.redMul(jyd4);
  24291. jx = nx;
  24292. jz = nz;
  24293. jyd = dny;
  24294. }
  24295. return this.curve.jpoint(jx, jyd.redMul(tinv), jz);
  24296. };
  24297. JPoint.prototype.dbl = function dbl() {
  24298. if (this.isInfinity())
  24299. return this;
  24300. if (this.curve.zeroA)
  24301. return this._zeroDbl();
  24302. else if (this.curve.threeA)
  24303. return this._threeDbl();
  24304. else
  24305. return this._dbl();
  24306. };
  24307. JPoint.prototype._zeroDbl = function _zeroDbl() {
  24308. var nx;
  24309. var ny;
  24310. var nz;
  24311. // Z = 1
  24312. if (this.zOne) {
  24313. // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html
  24314. // #doubling-mdbl-2007-bl
  24315. // 1M + 5S + 14A
  24316. // XX = X1^2
  24317. var xx = this.x.redSqr();
  24318. // YY = Y1^2
  24319. var yy = this.y.redSqr();
  24320. // YYYY = YY^2
  24321. var yyyy = yy.redSqr();
  24322. // S = 2 * ((X1 + YY)^2 - XX - YYYY)
  24323. var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
  24324. s = s.redIAdd(s);
  24325. // M = 3 * XX + a; a = 0
  24326. var m = xx.redAdd(xx).redIAdd(xx);
  24327. // T = M ^ 2 - 2*S
  24328. var t = m.redSqr().redISub(s).redISub(s);
  24329. // 8 * YYYY
  24330. var yyyy8 = yyyy.redIAdd(yyyy);
  24331. yyyy8 = yyyy8.redIAdd(yyyy8);
  24332. yyyy8 = yyyy8.redIAdd(yyyy8);
  24333. // X3 = T
  24334. nx = t;
  24335. // Y3 = M * (S - T) - 8 * YYYY
  24336. ny = m.redMul(s.redISub(t)).redISub(yyyy8);
  24337. // Z3 = 2*Y1
  24338. nz = this.y.redAdd(this.y);
  24339. } else {
  24340. // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html
  24341. // #doubling-dbl-2009-l
  24342. // 2M + 5S + 13A
  24343. // A = X1^2
  24344. var a = this.x.redSqr();
  24345. // B = Y1^2
  24346. var b = this.y.redSqr();
  24347. // C = B^2
  24348. var c = b.redSqr();
  24349. // D = 2 * ((X1 + B)^2 - A - C)
  24350. var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c);
  24351. d = d.redIAdd(d);
  24352. // E = 3 * A
  24353. var e = a.redAdd(a).redIAdd(a);
  24354. // F = E^2
  24355. var f = e.redSqr();
  24356. // 8 * C
  24357. var c8 = c.redIAdd(c);
  24358. c8 = c8.redIAdd(c8);
  24359. c8 = c8.redIAdd(c8);
  24360. // X3 = F - 2 * D
  24361. nx = f.redISub(d).redISub(d);
  24362. // Y3 = E * (D - X3) - 8 * C
  24363. ny = e.redMul(d.redISub(nx)).redISub(c8);
  24364. // Z3 = 2 * Y1 * Z1
  24365. nz = this.y.redMul(this.z);
  24366. nz = nz.redIAdd(nz);
  24367. }
  24368. return this.curve.jpoint(nx, ny, nz);
  24369. };
  24370. JPoint.prototype._threeDbl = function _threeDbl() {
  24371. var nx;
  24372. var ny;
  24373. var nz;
  24374. // Z = 1
  24375. if (this.zOne) {
  24376. // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html
  24377. // #doubling-mdbl-2007-bl
  24378. // 1M + 5S + 15A
  24379. // XX = X1^2
  24380. var xx = this.x.redSqr();
  24381. // YY = Y1^2
  24382. var yy = this.y.redSqr();
  24383. // YYYY = YY^2
  24384. var yyyy = yy.redSqr();
  24385. // S = 2 * ((X1 + YY)^2 - XX - YYYY)
  24386. var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
  24387. s = s.redIAdd(s);
  24388. // M = 3 * XX + a
  24389. var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a);
  24390. // T = M^2 - 2 * S
  24391. var t = m.redSqr().redISub(s).redISub(s);
  24392. // X3 = T
  24393. nx = t;
  24394. // Y3 = M * (S - T) - 8 * YYYY
  24395. var yyyy8 = yyyy.redIAdd(yyyy);
  24396. yyyy8 = yyyy8.redIAdd(yyyy8);
  24397. yyyy8 = yyyy8.redIAdd(yyyy8);
  24398. ny = m.redMul(s.redISub(t)).redISub(yyyy8);
  24399. // Z3 = 2 * Y1
  24400. nz = this.y.redAdd(this.y);
  24401. } else {
  24402. // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b
  24403. // 3M + 5S
  24404. // delta = Z1^2
  24405. var delta = this.z.redSqr();
  24406. // gamma = Y1^2
  24407. var gamma = this.y.redSqr();
  24408. // beta = X1 * gamma
  24409. var beta = this.x.redMul(gamma);
  24410. // alpha = 3 * (X1 - delta) * (X1 + delta)
  24411. var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta));
  24412. alpha = alpha.redAdd(alpha).redIAdd(alpha);
  24413. // X3 = alpha^2 - 8 * beta
  24414. var beta4 = beta.redIAdd(beta);
  24415. beta4 = beta4.redIAdd(beta4);
  24416. var beta8 = beta4.redAdd(beta4);
  24417. nx = alpha.redSqr().redISub(beta8);
  24418. // Z3 = (Y1 + Z1)^2 - gamma - delta
  24419. nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta);
  24420. // Y3 = alpha * (4 * beta - X3) - 8 * gamma^2
  24421. var ggamma8 = gamma.redSqr();
  24422. ggamma8 = ggamma8.redIAdd(ggamma8);
  24423. ggamma8 = ggamma8.redIAdd(ggamma8);
  24424. ggamma8 = ggamma8.redIAdd(ggamma8);
  24425. ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8);
  24426. }
  24427. return this.curve.jpoint(nx, ny, nz);
  24428. };
  24429. JPoint.prototype._dbl = function _dbl() {
  24430. var a = this.curve.a;
  24431. // 4M + 6S + 10A
  24432. var jx = this.x;
  24433. var jy = this.y;
  24434. var jz = this.z;
  24435. var jz4 = jz.redSqr().redSqr();
  24436. var jx2 = jx.redSqr();
  24437. var jy2 = jy.redSqr();
  24438. var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4));
  24439. var jxd4 = jx.redAdd(jx);
  24440. jxd4 = jxd4.redIAdd(jxd4);
  24441. var t1 = jxd4.redMul(jy2);
  24442. var nx = c.redSqr().redISub(t1.redAdd(t1));
  24443. var t2 = t1.redISub(nx);
  24444. var jyd8 = jy2.redSqr();
  24445. jyd8 = jyd8.redIAdd(jyd8);
  24446. jyd8 = jyd8.redIAdd(jyd8);
  24447. jyd8 = jyd8.redIAdd(jyd8);
  24448. var ny = c.redMul(t2).redISub(jyd8);
  24449. var nz = jy.redAdd(jy).redMul(jz);
  24450. return this.curve.jpoint(nx, ny, nz);
  24451. };
  24452. JPoint.prototype.trpl = function trpl() {
  24453. if (!this.curve.zeroA)
  24454. return this.dbl().add(this);
  24455. // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl
  24456. // 5M + 10S + ...
  24457. // XX = X1^2
  24458. var xx = this.x.redSqr();
  24459. // YY = Y1^2
  24460. var yy = this.y.redSqr();
  24461. // ZZ = Z1^2
  24462. var zz = this.z.redSqr();
  24463. // YYYY = YY^2
  24464. var yyyy = yy.redSqr();
  24465. // M = 3 * XX + a * ZZ2; a = 0
  24466. var m = xx.redAdd(xx).redIAdd(xx);
  24467. // MM = M^2
  24468. var mm = m.redSqr();
  24469. // E = 6 * ((X1 + YY)^2 - XX - YYYY) - MM
  24470. var e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
  24471. e = e.redIAdd(e);
  24472. e = e.redAdd(e).redIAdd(e);
  24473. e = e.redISub(mm);
  24474. // EE = E^2
  24475. var ee = e.redSqr();
  24476. // T = 16*YYYY
  24477. var t = yyyy.redIAdd(yyyy);
  24478. t = t.redIAdd(t);
  24479. t = t.redIAdd(t);
  24480. t = t.redIAdd(t);
  24481. // U = (M + E)^2 - MM - EE - T
  24482. var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t);
  24483. // X3 = 4 * (X1 * EE - 4 * YY * U)
  24484. var yyu4 = yy.redMul(u);
  24485. yyu4 = yyu4.redIAdd(yyu4);
  24486. yyu4 = yyu4.redIAdd(yyu4);
  24487. var nx = this.x.redMul(ee).redISub(yyu4);
  24488. nx = nx.redIAdd(nx);
  24489. nx = nx.redIAdd(nx);
  24490. // Y3 = 8 * Y1 * (U * (T - U) - E * EE)
  24491. var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee)));
  24492. ny = ny.redIAdd(ny);
  24493. ny = ny.redIAdd(ny);
  24494. ny = ny.redIAdd(ny);
  24495. // Z3 = (Z1 + E)^2 - ZZ - EE
  24496. var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee);
  24497. return this.curve.jpoint(nx, ny, nz);
  24498. };
  24499. JPoint.prototype.mul = function mul(k, kbase) {
  24500. k = new BN(k, kbase);
  24501. return this.curve._wnafMul(this, k);
  24502. };
  24503. JPoint.prototype.eq = function eq(p) {
  24504. if (p.type === 'affine')
  24505. return this.eq(p.toJ());
  24506. if (this === p)
  24507. return true;
  24508. // x1 * z2^2 == x2 * z1^2
  24509. var z2 = this.z.redSqr();
  24510. var pz2 = p.z.redSqr();
  24511. if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0)
  24512. return false;
  24513. // y1 * z2^3 == y2 * z1^3
  24514. var z3 = z2.redMul(this.z);
  24515. var pz3 = pz2.redMul(p.z);
  24516. return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0;
  24517. };
  24518. JPoint.prototype.eqXToP = function eqXToP(x) {
  24519. var zs = this.z.redSqr();
  24520. var rx = x.toRed(this.curve.red).redMul(zs);
  24521. if (this.x.cmp(rx) === 0)
  24522. return true;
  24523. var xc = x.clone();
  24524. var t = this.curve.redN.redMul(zs);
  24525. for (;;) {
  24526. xc.iadd(this.curve.n);
  24527. if (xc.cmp(this.curve.p) >= 0)
  24528. return false;
  24529. rx.redIAdd(t);
  24530. if (this.x.cmp(rx) === 0)
  24531. return true;
  24532. }
  24533. return false;
  24534. };
  24535. JPoint.prototype.inspect = function inspect() {
  24536. if (this.isInfinity())
  24537. return '<EC JPoint Infinity>';
  24538. return '<EC JPoint x: ' + this.x.toString(16, 2) +
  24539. ' y: ' + this.y.toString(16, 2) +
  24540. ' z: ' + this.z.toString(16, 2) + '>';
  24541. };
  24542. JPoint.prototype.isInfinity = function isInfinity() {
  24543. // XXX This code assumes that zero is always zero in red
  24544. return this.z.cmpn(0) === 0;
  24545. };
  24546. /***/ },
  24547. /* 236 */
  24548. /***/ function(module, exports, __webpack_require__) {
  24549. "use strict";
  24550. 'use strict';
  24551. var curves = exports;
  24552. var hash = __webpack_require__(9);
  24553. var elliptic = __webpack_require__(3);
  24554. var assert = elliptic.utils.assert;
  24555. function PresetCurve(options) {
  24556. if (options.type === 'short')
  24557. this.curve = new elliptic.curve.short(options);
  24558. else if (options.type === 'edwards')
  24559. this.curve = new elliptic.curve.edwards(options);
  24560. else
  24561. this.curve = new elliptic.curve.mont(options);
  24562. this.g = this.curve.g;
  24563. this.n = this.curve.n;
  24564. this.hash = options.hash;
  24565. assert(this.g.validate(), 'Invalid curve');
  24566. assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O');
  24567. }
  24568. curves.PresetCurve = PresetCurve;
  24569. function defineCurve(name, options) {
  24570. Object.defineProperty(curves, name, {
  24571. configurable: true,
  24572. enumerable: true,
  24573. get: function() {
  24574. var curve = new PresetCurve(options);
  24575. Object.defineProperty(curves, name, {
  24576. configurable: true,
  24577. enumerable: true,
  24578. value: curve
  24579. });
  24580. return curve;
  24581. }
  24582. });
  24583. }
  24584. defineCurve('p192', {
  24585. type: 'short',
  24586. prime: 'p192',
  24587. p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff',
  24588. a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc',
  24589. b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1',
  24590. n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831',
  24591. hash: hash.sha256,
  24592. gRed: false,
  24593. g: [
  24594. '188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012',
  24595. '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811'
  24596. ]
  24597. });
  24598. defineCurve('p224', {
  24599. type: 'short',
  24600. prime: 'p224',
  24601. p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001',
  24602. a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe',
  24603. b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4',
  24604. n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d',
  24605. hash: hash.sha256,
  24606. gRed: false,
  24607. g: [
  24608. 'b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21',
  24609. 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34'
  24610. ]
  24611. });
  24612. defineCurve('p256', {
  24613. type: 'short',
  24614. prime: null,
  24615. p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff',
  24616. a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc',
  24617. b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b',
  24618. n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551',
  24619. hash: hash.sha256,
  24620. gRed: false,
  24621. g: [
  24622. '6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296',
  24623. '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5'
  24624. ]
  24625. });
  24626. defineCurve('p384', {
  24627. type: 'short',
  24628. prime: null,
  24629. p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  24630. 'fffffffe ffffffff 00000000 00000000 ffffffff',
  24631. a: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  24632. 'fffffffe ffffffff 00000000 00000000 fffffffc',
  24633. b: 'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f ' +
  24634. '5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef',
  24635. n: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 ' +
  24636. 'f4372ddf 581a0db2 48b0a77a ecec196a ccc52973',
  24637. hash: hash.sha384,
  24638. gRed: false,
  24639. g: [
  24640. 'aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 ' +
  24641. '5502f25d bf55296c 3a545e38 72760ab7',
  24642. '3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 ' +
  24643. '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f'
  24644. ]
  24645. });
  24646. defineCurve('p521', {
  24647. type: 'short',
  24648. prime: null,
  24649. p: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  24650. 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  24651. 'ffffffff ffffffff ffffffff ffffffff ffffffff',
  24652. a: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  24653. 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  24654. 'ffffffff ffffffff ffffffff ffffffff fffffffc',
  24655. b: '00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b ' +
  24656. '99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd ' +
  24657. '3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00',
  24658. n: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +
  24659. 'ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 ' +
  24660. 'f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409',
  24661. hash: hash.sha512,
  24662. gRed: false,
  24663. g: [
  24664. '000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 ' +
  24665. '053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 ' +
  24666. 'a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66',
  24667. '00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 ' +
  24668. '579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 ' +
  24669. '3fad0761 353c7086 a272c240 88be9476 9fd16650'
  24670. ]
  24671. });
  24672. defineCurve('curve25519', {
  24673. type: 'mont',
  24674. prime: 'p25519',
  24675. p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',
  24676. a: '76d06',
  24677. b: '0',
  24678. n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',
  24679. hash: hash.sha256,
  24680. gRed: false,
  24681. g: [
  24682. '9'
  24683. ]
  24684. });
  24685. defineCurve('ed25519', {
  24686. type: 'edwards',
  24687. prime: 'p25519',
  24688. p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',
  24689. a: '-1',
  24690. c: '1',
  24691. // -121665 * (121666^(-1)) (mod P)
  24692. d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3',
  24693. n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',
  24694. hash: hash.sha256,
  24695. gRed: false,
  24696. g: [
  24697. '216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a',
  24698. // 4/5
  24699. '6666666666666666666666666666666666666666666666666666666666666658'
  24700. ]
  24701. });
  24702. var pre;
  24703. try {
  24704. pre = __webpack_require__(244);
  24705. } catch (e) {
  24706. pre = undefined;
  24707. }
  24708. defineCurve('secp256k1', {
  24709. type: 'short',
  24710. prime: 'k256',
  24711. p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f',
  24712. a: '0',
  24713. b: '7',
  24714. n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141',
  24715. h: '1',
  24716. hash: hash.sha256,
  24717. // Precomputed endomorphism
  24718. beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee',
  24719. lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72',
  24720. basis: [
  24721. {
  24722. a: '3086d221a7d46bcde86c90e49284eb15',
  24723. b: '-e4437ed6010e88286f547fa90abfe4c3'
  24724. },
  24725. {
  24726. a: '114ca50f7a8e2f3f657c1108d9d44cfd8',
  24727. b: '3086d221a7d46bcde86c90e49284eb15'
  24728. }
  24729. ],
  24730. gRed: false,
  24731. g: [
  24732. '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',
  24733. '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8',
  24734. pre
  24735. ]
  24736. });
  24737. /***/ },
  24738. /* 237 */
  24739. /***/ function(module, exports, __webpack_require__) {
  24740. "use strict";
  24741. 'use strict';
  24742. var BN = __webpack_require__(2);
  24743. var elliptic = __webpack_require__(3);
  24744. var utils = elliptic.utils;
  24745. var assert = utils.assert;
  24746. var KeyPair = __webpack_require__(238);
  24747. var Signature = __webpack_require__(239);
  24748. function EC(options) {
  24749. if (!(this instanceof EC))
  24750. return new EC(options);
  24751. // Shortcut `elliptic.ec(curve-name)`
  24752. if (typeof options === 'string') {
  24753. assert(elliptic.curves.hasOwnProperty(options), 'Unknown curve ' + options);
  24754. options = elliptic.curves[options];
  24755. }
  24756. // Shortcut for `elliptic.ec(elliptic.curves.curveName)`
  24757. if (options instanceof elliptic.curves.PresetCurve)
  24758. options = { curve: options };
  24759. this.curve = options.curve.curve;
  24760. this.n = this.curve.n;
  24761. this.nh = this.n.ushrn(1);
  24762. this.g = this.curve.g;
  24763. // Point on curve
  24764. this.g = options.curve.g;
  24765. this.g.precompute(options.curve.n.bitLength() + 1);
  24766. // Hash for function for DRBG
  24767. this.hash = options.hash || options.curve.hash;
  24768. }
  24769. module.exports = EC;
  24770. EC.prototype.keyPair = function keyPair(options) {
  24771. return new KeyPair(this, options);
  24772. };
  24773. EC.prototype.keyFromPrivate = function keyFromPrivate(priv, enc) {
  24774. return KeyPair.fromPrivate(this, priv, enc);
  24775. };
  24776. EC.prototype.keyFromPublic = function keyFromPublic(pub, enc) {
  24777. return KeyPair.fromPublic(this, pub, enc);
  24778. };
  24779. EC.prototype.genKeyPair = function genKeyPair(options) {
  24780. if (!options)
  24781. options = {};
  24782. // Instantiate Hmac_DRBG
  24783. var drbg = new elliptic.hmacDRBG({
  24784. hash: this.hash,
  24785. pers: options.pers,
  24786. entropy: options.entropy || elliptic.rand(this.hash.hmacStrength),
  24787. nonce: this.n.toArray()
  24788. });
  24789. var bytes = this.n.byteLength();
  24790. var ns2 = this.n.sub(new BN(2));
  24791. do {
  24792. var priv = new BN(drbg.generate(bytes));
  24793. if (priv.cmp(ns2) > 0)
  24794. continue;
  24795. priv.iaddn(1);
  24796. return this.keyFromPrivate(priv);
  24797. } while (true);
  24798. };
  24799. EC.prototype._truncateToN = function truncateToN(msg, truncOnly) {
  24800. var delta = msg.byteLength() * 8 - this.n.bitLength();
  24801. if (delta > 0)
  24802. msg = msg.ushrn(delta);
  24803. if (!truncOnly && msg.cmp(this.n) >= 0)
  24804. return msg.sub(this.n);
  24805. else
  24806. return msg;
  24807. };
  24808. EC.prototype.sign = function sign(msg, key, enc, options) {
  24809. if (typeof enc === 'object') {
  24810. options = enc;
  24811. enc = null;
  24812. }
  24813. if (!options)
  24814. options = {};
  24815. key = this.keyFromPrivate(key, enc);
  24816. msg = this._truncateToN(new BN(msg, 16));
  24817. // Zero-extend key to provide enough entropy
  24818. var bytes = this.n.byteLength();
  24819. var bkey = key.getPrivate().toArray('be', bytes);
  24820. // Zero-extend nonce to have the same byte size as N
  24821. var nonce = msg.toArray('be', bytes);
  24822. // Instantiate Hmac_DRBG
  24823. var drbg = new elliptic.hmacDRBG({
  24824. hash: this.hash,
  24825. entropy: bkey,
  24826. nonce: nonce,
  24827. pers: options.pers,
  24828. persEnc: options.persEnc
  24829. });
  24830. // Number of bytes to generate
  24831. var ns1 = this.n.sub(new BN(1));
  24832. for (var iter = 0; true; iter++) {
  24833. var k = options.k ?
  24834. options.k(iter) :
  24835. new BN(drbg.generate(this.n.byteLength()));
  24836. k = this._truncateToN(k, true);
  24837. if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0)
  24838. continue;
  24839. var kp = this.g.mul(k);
  24840. if (kp.isInfinity())
  24841. continue;
  24842. var kpX = kp.getX();
  24843. var r = kpX.umod(this.n);
  24844. if (r.cmpn(0) === 0)
  24845. continue;
  24846. var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg));
  24847. s = s.umod(this.n);
  24848. if (s.cmpn(0) === 0)
  24849. continue;
  24850. var recoveryParam = (kp.getY().isOdd() ? 1 : 0) |
  24851. (kpX.cmp(r) !== 0 ? 2 : 0);
  24852. // Use complement of `s`, if it is > `n / 2`
  24853. if (options.canonical && s.cmp(this.nh) > 0) {
  24854. s = this.n.sub(s);
  24855. recoveryParam ^= 1;
  24856. }
  24857. return new Signature({ r: r, s: s, recoveryParam: recoveryParam });
  24858. }
  24859. };
  24860. EC.prototype.verify = function verify(msg, signature, key, enc) {
  24861. msg = this._truncateToN(new BN(msg, 16));
  24862. key = this.keyFromPublic(key, enc);
  24863. signature = new Signature(signature, 'hex');
  24864. // Perform primitive values validation
  24865. var r = signature.r;
  24866. var s = signature.s;
  24867. if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0)
  24868. return false;
  24869. if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0)
  24870. return false;
  24871. // Validate signature
  24872. var sinv = s.invm(this.n);
  24873. var u1 = sinv.mul(msg).umod(this.n);
  24874. var u2 = sinv.mul(r).umod(this.n);
  24875. if (!this.curve._maxwellTrick) {
  24876. var p = this.g.mulAdd(u1, key.getPublic(), u2);
  24877. if (p.isInfinity())
  24878. return false;
  24879. return p.getX().umod(this.n).cmp(r) === 0;
  24880. }
  24881. // NOTE: Greg Maxwell's trick, inspired by:
  24882. // https://git.io/vad3K
  24883. var p = this.g.jmulAdd(u1, key.getPublic(), u2);
  24884. if (p.isInfinity())
  24885. return false;
  24886. // Compare `p.x` of Jacobian point with `r`,
  24887. // this will do `p.x == r * p.z^2` instead of multiplying `p.x` by the
  24888. // inverse of `p.z^2`
  24889. return p.eqXToP(r);
  24890. };
  24891. EC.prototype.recoverPubKey = function(msg, signature, j, enc) {
  24892. assert((3 & j) === j, 'The recovery param is more than two bits');
  24893. signature = new Signature(signature, enc);
  24894. var n = this.n;
  24895. var e = new BN(msg);
  24896. var r = signature.r;
  24897. var s = signature.s;
  24898. // A set LSB signifies that the y-coordinate is odd
  24899. var isYOdd = j & 1;
  24900. var isSecondKey = j >> 1;
  24901. if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey)
  24902. throw new Error('Unable to find sencond key candinate');
  24903. // 1.1. Let x = r + jn.
  24904. if (isSecondKey)
  24905. r = this.curve.pointFromX(r.add(this.curve.n), isYOdd);
  24906. else
  24907. r = this.curve.pointFromX(r, isYOdd);
  24908. var rInv = signature.r.invm(n);
  24909. var s1 = n.sub(e).mul(rInv).umod(n);
  24910. var s2 = s.mul(rInv).umod(n);
  24911. // 1.6.1 Compute Q = r^-1 (sR - eG)
  24912. // Q = r^-1 (sR + -eG)
  24913. return this.g.mulAdd(s1, r, s2);
  24914. };
  24915. EC.prototype.getKeyRecoveryParam = function(e, signature, Q, enc) {
  24916. signature = new Signature(signature, enc);
  24917. if (signature.recoveryParam !== null)
  24918. return signature.recoveryParam;
  24919. for (var i = 0; i < 4; i++) {
  24920. var Qprime;
  24921. try {
  24922. Qprime = this.recoverPubKey(e, signature, i);
  24923. } catch (e) {
  24924. continue;
  24925. }
  24926. if (Qprime.eq(Q))
  24927. return i;
  24928. }
  24929. throw new Error('Unable to find valid recovery factor');
  24930. };
  24931. /***/ },
  24932. /* 238 */
  24933. /***/ function(module, exports, __webpack_require__) {
  24934. "use strict";
  24935. 'use strict';
  24936. var BN = __webpack_require__(2);
  24937. function KeyPair(ec, options) {
  24938. this.ec = ec;
  24939. this.priv = null;
  24940. this.pub = null;
  24941. // KeyPair(ec, { priv: ..., pub: ... })
  24942. if (options.priv)
  24943. this._importPrivate(options.priv, options.privEnc);
  24944. if (options.pub)
  24945. this._importPublic(options.pub, options.pubEnc);
  24946. }
  24947. module.exports = KeyPair;
  24948. KeyPair.fromPublic = function fromPublic(ec, pub, enc) {
  24949. if (pub instanceof KeyPair)
  24950. return pub;
  24951. return new KeyPair(ec, {
  24952. pub: pub,
  24953. pubEnc: enc
  24954. });
  24955. };
  24956. KeyPair.fromPrivate = function fromPrivate(ec, priv, enc) {
  24957. if (priv instanceof KeyPair)
  24958. return priv;
  24959. return new KeyPair(ec, {
  24960. priv: priv,
  24961. privEnc: enc
  24962. });
  24963. };
  24964. KeyPair.prototype.validate = function validate() {
  24965. var pub = this.getPublic();
  24966. if (pub.isInfinity())
  24967. return { result: false, reason: 'Invalid public key' };
  24968. if (!pub.validate())
  24969. return { result: false, reason: 'Public key is not a point' };
  24970. if (!pub.mul(this.ec.curve.n).isInfinity())
  24971. return { result: false, reason: 'Public key * N != O' };
  24972. return { result: true, reason: null };
  24973. };
  24974. KeyPair.prototype.getPublic = function getPublic(compact, enc) {
  24975. // compact is optional argument
  24976. if (typeof compact === 'string') {
  24977. enc = compact;
  24978. compact = null;
  24979. }
  24980. if (!this.pub)
  24981. this.pub = this.ec.g.mul(this.priv);
  24982. if (!enc)
  24983. return this.pub;
  24984. return this.pub.encode(enc, compact);
  24985. };
  24986. KeyPair.prototype.getPrivate = function getPrivate(enc) {
  24987. if (enc === 'hex')
  24988. return this.priv.toString(16, 2);
  24989. else
  24990. return this.priv;
  24991. };
  24992. KeyPair.prototype._importPrivate = function _importPrivate(key, enc) {
  24993. this.priv = new BN(key, enc || 16);
  24994. // Ensure that the priv won't be bigger than n, otherwise we may fail
  24995. // in fixed multiplication method
  24996. this.priv = this.priv.umod(this.ec.curve.n);
  24997. };
  24998. KeyPair.prototype._importPublic = function _importPublic(key, enc) {
  24999. if (key.x || key.y) {
  25000. this.pub = this.ec.curve.point(key.x, key.y);
  25001. return;
  25002. }
  25003. this.pub = this.ec.curve.decodePoint(key, enc);
  25004. };
  25005. // ECDH
  25006. KeyPair.prototype.derive = function derive(pub) {
  25007. return pub.mul(this.priv).getX();
  25008. };
  25009. // ECDSA
  25010. KeyPair.prototype.sign = function sign(msg, enc, options) {
  25011. return this.ec.sign(msg, this, enc, options);
  25012. };
  25013. KeyPair.prototype.verify = function verify(msg, signature) {
  25014. return this.ec.verify(msg, signature, this);
  25015. };
  25016. KeyPair.prototype.inspect = function inspect() {
  25017. return '<Key priv: ' + (this.priv && this.priv.toString(16, 2)) +
  25018. ' pub: ' + (this.pub && this.pub.inspect()) + ' >';
  25019. };
  25020. /***/ },
  25021. /* 239 */
  25022. /***/ function(module, exports, __webpack_require__) {
  25023. "use strict";
  25024. 'use strict';
  25025. var BN = __webpack_require__(2);
  25026. var elliptic = __webpack_require__(3);
  25027. var utils = elliptic.utils;
  25028. var assert = utils.assert;
  25029. function Signature(options, enc) {
  25030. if (options instanceof Signature)
  25031. return options;
  25032. if (this._importDER(options, enc))
  25033. return;
  25034. assert(options.r && options.s, 'Signature without r or s');
  25035. this.r = new BN(options.r, 16);
  25036. this.s = new BN(options.s, 16);
  25037. if (options.recoveryParam === undefined)
  25038. this.recoveryParam = null;
  25039. else
  25040. this.recoveryParam = options.recoveryParam;
  25041. }
  25042. module.exports = Signature;
  25043. function Position() {
  25044. this.place = 0;
  25045. }
  25046. function getLength(buf, p) {
  25047. var initial = buf[p.place++];
  25048. if (!(initial & 0x80)) {
  25049. return initial;
  25050. }
  25051. var octetLen = initial & 0xf;
  25052. var val = 0;
  25053. for (var i = 0, off = p.place; i < octetLen; i++, off++) {
  25054. val <<= 8;
  25055. val |= buf[off];
  25056. }
  25057. p.place = off;
  25058. return val;
  25059. }
  25060. function rmPadding(buf) {
  25061. var i = 0;
  25062. var len = buf.length - 1;
  25063. while (!buf[i] && !(buf[i + 1] & 0x80) && i < len) {
  25064. i++;
  25065. }
  25066. if (i === 0) {
  25067. return buf;
  25068. }
  25069. return buf.slice(i);
  25070. }
  25071. Signature.prototype._importDER = function _importDER(data, enc) {
  25072. data = utils.toArray(data, enc);
  25073. var p = new Position();
  25074. if (data[p.place++] !== 0x30) {
  25075. return false;
  25076. }
  25077. var len = getLength(data, p);
  25078. if ((len + p.place) !== data.length) {
  25079. return false;
  25080. }
  25081. if (data[p.place++] !== 0x02) {
  25082. return false;
  25083. }
  25084. var rlen = getLength(data, p);
  25085. var r = data.slice(p.place, rlen + p.place);
  25086. p.place += rlen;
  25087. if (data[p.place++] !== 0x02) {
  25088. return false;
  25089. }
  25090. var slen = getLength(data, p);
  25091. if (data.length !== slen + p.place) {
  25092. return false;
  25093. }
  25094. var s = data.slice(p.place, slen + p.place);
  25095. if (r[0] === 0 && (r[1] & 0x80)) {
  25096. r = r.slice(1);
  25097. }
  25098. if (s[0] === 0 && (s[1] & 0x80)) {
  25099. s = s.slice(1);
  25100. }
  25101. this.r = new BN(r);
  25102. this.s = new BN(s);
  25103. this.recoveryParam = null;
  25104. return true;
  25105. };
  25106. function constructLength(arr, len) {
  25107. if (len < 0x80) {
  25108. arr.push(len);
  25109. return;
  25110. }
  25111. var octets = 1 + (Math.log(len) / Math.LN2 >>> 3);
  25112. arr.push(octets | 0x80);
  25113. while (--octets) {
  25114. arr.push((len >>> (octets << 3)) & 0xff);
  25115. }
  25116. arr.push(len);
  25117. }
  25118. Signature.prototype.toDER = function toDER(enc) {
  25119. var r = this.r.toArray();
  25120. var s = this.s.toArray();
  25121. // Pad values
  25122. if (r[0] & 0x80)
  25123. r = [ 0 ].concat(r);
  25124. // Pad values
  25125. if (s[0] & 0x80)
  25126. s = [ 0 ].concat(s);
  25127. r = rmPadding(r);
  25128. s = rmPadding(s);
  25129. while (!s[0] && !(s[1] & 0x80)) {
  25130. s = s.slice(1);
  25131. }
  25132. var arr = [ 0x02 ];
  25133. constructLength(arr, r.length);
  25134. arr = arr.concat(r);
  25135. arr.push(0x02);
  25136. constructLength(arr, s.length);
  25137. var backHalf = arr.concat(s);
  25138. var res = [ 0x30 ];
  25139. constructLength(res, backHalf.length);
  25140. res = res.concat(backHalf);
  25141. return utils.encode(res, enc);
  25142. };
  25143. /***/ },
  25144. /* 240 */
  25145. /***/ function(module, exports, __webpack_require__) {
  25146. "use strict";
  25147. 'use strict';
  25148. var hash = __webpack_require__(9);
  25149. var elliptic = __webpack_require__(3);
  25150. var utils = elliptic.utils;
  25151. var assert = utils.assert;
  25152. var parseBytes = utils.parseBytes;
  25153. var KeyPair = __webpack_require__(241);
  25154. var Signature = __webpack_require__(242);
  25155. function EDDSA(curve) {
  25156. assert(curve === 'ed25519', 'only tested with ed25519 so far');
  25157. if (!(this instanceof EDDSA))
  25158. return new EDDSA(curve);
  25159. var curve = elliptic.curves[curve].curve;
  25160. this.curve = curve;
  25161. this.g = curve.g;
  25162. this.g.precompute(curve.n.bitLength() + 1);
  25163. this.pointClass = curve.point().constructor;
  25164. this.encodingLength = Math.ceil(curve.n.bitLength() / 8);
  25165. this.hash = hash.sha512;
  25166. }
  25167. module.exports = EDDSA;
  25168. /**
  25169. * @param {Array|String} message - message bytes
  25170. * @param {Array|String|KeyPair} secret - secret bytes or a keypair
  25171. * @returns {Signature} - signature
  25172. */
  25173. EDDSA.prototype.sign = function sign(message, secret) {
  25174. message = parseBytes(message);
  25175. var key = this.keyFromSecret(secret);
  25176. var r = this.hashInt(key.messagePrefix(), message);
  25177. var R = this.g.mul(r);
  25178. var Rencoded = this.encodePoint(R);
  25179. var s_ = this.hashInt(Rencoded, key.pubBytes(), message)
  25180. .mul(key.priv());
  25181. var S = r.add(s_).umod(this.curve.n);
  25182. return this.makeSignature({ R: R, S: S, Rencoded: Rencoded });
  25183. };
  25184. /**
  25185. * @param {Array} message - message bytes
  25186. * @param {Array|String|Signature} sig - sig bytes
  25187. * @param {Array|String|Point|KeyPair} pub - public key
  25188. * @returns {Boolean} - true if public key matches sig of message
  25189. */
  25190. EDDSA.prototype.verify = function verify(message, sig, pub) {
  25191. message = parseBytes(message);
  25192. sig = this.makeSignature(sig);
  25193. var key = this.keyFromPublic(pub);
  25194. var h = this.hashInt(sig.Rencoded(), key.pubBytes(), message);
  25195. var SG = this.g.mul(sig.S());
  25196. var RplusAh = sig.R().add(key.pub().mul(h));
  25197. return RplusAh.eq(SG);
  25198. };
  25199. EDDSA.prototype.hashInt = function hashInt() {
  25200. var hash = this.hash();
  25201. for (var i = 0; i < arguments.length; i++)
  25202. hash.update(arguments[i]);
  25203. return utils.intFromLE(hash.digest()).umod(this.curve.n);
  25204. };
  25205. EDDSA.prototype.keyFromPublic = function keyFromPublic(pub) {
  25206. return KeyPair.fromPublic(this, pub);
  25207. };
  25208. EDDSA.prototype.keyFromSecret = function keyFromSecret(secret) {
  25209. return KeyPair.fromSecret(this, secret);
  25210. };
  25211. EDDSA.prototype.makeSignature = function makeSignature(sig) {
  25212. if (sig instanceof Signature)
  25213. return sig;
  25214. return new Signature(this, sig);
  25215. };
  25216. /**
  25217. * * https://tools.ietf.org/html/draft-josefsson-eddsa-ed25519-03#section-5.2
  25218. *
  25219. * EDDSA defines methods for encoding and decoding points and integers. These are
  25220. * helper convenience methods, that pass along to utility functions implied
  25221. * parameters.
  25222. *
  25223. */
  25224. EDDSA.prototype.encodePoint = function encodePoint(point) {
  25225. var enc = point.getY().toArray('le', this.encodingLength);
  25226. enc[this.encodingLength - 1] |= point.getX().isOdd() ? 0x80 : 0;
  25227. return enc;
  25228. };
  25229. EDDSA.prototype.decodePoint = function decodePoint(bytes) {
  25230. bytes = utils.parseBytes(bytes);
  25231. var lastIx = bytes.length - 1;
  25232. var normed = bytes.slice(0, lastIx).concat(bytes[lastIx] & ~0x80);
  25233. var xIsOdd = (bytes[lastIx] & 0x80) !== 0;
  25234. var y = utils.intFromLE(normed);
  25235. return this.curve.pointFromY(y, xIsOdd);
  25236. };
  25237. EDDSA.prototype.encodeInt = function encodeInt(num) {
  25238. return num.toArray('le', this.encodingLength);
  25239. };
  25240. EDDSA.prototype.decodeInt = function decodeInt(bytes) {
  25241. return utils.intFromLE(bytes);
  25242. };
  25243. EDDSA.prototype.isPoint = function isPoint(val) {
  25244. return val instanceof this.pointClass;
  25245. };
  25246. /***/ },
  25247. /* 241 */
  25248. /***/ function(module, exports, __webpack_require__) {
  25249. "use strict";
  25250. 'use strict';
  25251. var elliptic = __webpack_require__(3);
  25252. var utils = elliptic.utils;
  25253. var assert = utils.assert;
  25254. var parseBytes = utils.parseBytes;
  25255. var cachedProperty = utils.cachedProperty;
  25256. /**
  25257. * @param {EDDSA} eddsa - instance
  25258. * @param {Object} params - public/private key parameters
  25259. *
  25260. * @param {Array<Byte>} [params.secret] - secret seed bytes
  25261. * @param {Point} [params.pub] - public key point (aka `A` in eddsa terms)
  25262. * @param {Array<Byte>} [params.pub] - public key point encoded as bytes
  25263. *
  25264. */
  25265. function KeyPair(eddsa, params) {
  25266. this.eddsa = eddsa;
  25267. this._secret = parseBytes(params.secret);
  25268. if (eddsa.isPoint(params.pub))
  25269. this._pub = params.pub;
  25270. else
  25271. this._pubBytes = parseBytes(params.pub);
  25272. }
  25273. KeyPair.fromPublic = function fromPublic(eddsa, pub) {
  25274. if (pub instanceof KeyPair)
  25275. return pub;
  25276. return new KeyPair(eddsa, { pub: pub });
  25277. };
  25278. KeyPair.fromSecret = function fromSecret(eddsa, secret) {
  25279. if (secret instanceof KeyPair)
  25280. return secret;
  25281. return new KeyPair(eddsa, { secret: secret });
  25282. };
  25283. KeyPair.prototype.secret = function secret() {
  25284. return this._secret;
  25285. };
  25286. cachedProperty(KeyPair, 'pubBytes', function pubBytes() {
  25287. return this.eddsa.encodePoint(this.pub());
  25288. });
  25289. cachedProperty(KeyPair, 'pub', function pub() {
  25290. if (this._pubBytes)
  25291. return this.eddsa.decodePoint(this._pubBytes);
  25292. return this.eddsa.g.mul(this.priv());
  25293. });
  25294. cachedProperty(KeyPair, 'privBytes', function privBytes() {
  25295. var eddsa = this.eddsa;
  25296. var hash = this.hash();
  25297. var lastIx = eddsa.encodingLength - 1;
  25298. var a = hash.slice(0, eddsa.encodingLength);
  25299. a[0] &= 248;
  25300. a[lastIx] &= 127;
  25301. a[lastIx] |= 64;
  25302. return a;
  25303. });
  25304. cachedProperty(KeyPair, 'priv', function priv() {
  25305. return this.eddsa.decodeInt(this.privBytes());
  25306. });
  25307. cachedProperty(KeyPair, 'hash', function hash() {
  25308. return this.eddsa.hash().update(this.secret()).digest();
  25309. });
  25310. cachedProperty(KeyPair, 'messagePrefix', function messagePrefix() {
  25311. return this.hash().slice(this.eddsa.encodingLength);
  25312. });
  25313. KeyPair.prototype.sign = function sign(message) {
  25314. assert(this._secret, 'KeyPair can only verify');
  25315. return this.eddsa.sign(message, this);
  25316. };
  25317. KeyPair.prototype.verify = function verify(message, sig) {
  25318. return this.eddsa.verify(message, sig, this);
  25319. };
  25320. KeyPair.prototype.getSecret = function getSecret(enc) {
  25321. assert(this._secret, 'KeyPair is public only');
  25322. return utils.encode(this.secret(), enc);
  25323. };
  25324. KeyPair.prototype.getPublic = function getPublic(enc) {
  25325. return utils.encode(this.pubBytes(), enc);
  25326. };
  25327. module.exports = KeyPair;
  25328. /***/ },
  25329. /* 242 */
  25330. /***/ function(module, exports, __webpack_require__) {
  25331. "use strict";
  25332. 'use strict';
  25333. var BN = __webpack_require__(2);
  25334. var elliptic = __webpack_require__(3);
  25335. var utils = elliptic.utils;
  25336. var assert = utils.assert;
  25337. var cachedProperty = utils.cachedProperty;
  25338. var parseBytes = utils.parseBytes;
  25339. /**
  25340. * @param {EDDSA} eddsa - eddsa instance
  25341. * @param {Array<Bytes>|Object} sig -
  25342. * @param {Array<Bytes>|Point} [sig.R] - R point as Point or bytes
  25343. * @param {Array<Bytes>|bn} [sig.S] - S scalar as bn or bytes
  25344. * @param {Array<Bytes>} [sig.Rencoded] - R point encoded
  25345. * @param {Array<Bytes>} [sig.Sencoded] - S scalar encoded
  25346. */
  25347. function Signature(eddsa, sig) {
  25348. this.eddsa = eddsa;
  25349. if (typeof sig !== 'object')
  25350. sig = parseBytes(sig);
  25351. if (Array.isArray(sig)) {
  25352. sig = {
  25353. R: sig.slice(0, eddsa.encodingLength),
  25354. S: sig.slice(eddsa.encodingLength)
  25355. };
  25356. }
  25357. assert(sig.R && sig.S, 'Signature without R or S');
  25358. if (eddsa.isPoint(sig.R))
  25359. this._R = sig.R;
  25360. if (sig.S instanceof BN)
  25361. this._S = sig.S;
  25362. this._Rencoded = Array.isArray(sig.R) ? sig.R : sig.Rencoded;
  25363. this._Sencoded = Array.isArray(sig.S) ? sig.S : sig.Sencoded;
  25364. }
  25365. cachedProperty(Signature, 'S', function S() {
  25366. return this.eddsa.decodeInt(this.Sencoded());
  25367. });
  25368. cachedProperty(Signature, 'R', function R() {
  25369. return this.eddsa.decodePoint(this.Rencoded());
  25370. });
  25371. cachedProperty(Signature, 'Rencoded', function Rencoded() {
  25372. return this.eddsa.encodePoint(this.R());
  25373. });
  25374. cachedProperty(Signature, 'Sencoded', function Sencoded() {
  25375. return this.eddsa.encodeInt(this.S());
  25376. });
  25377. Signature.prototype.toBytes = function toBytes() {
  25378. return this.Rencoded().concat(this.Sencoded());
  25379. };
  25380. Signature.prototype.toHex = function toHex() {
  25381. return utils.encode(this.toBytes(), 'hex').toUpperCase();
  25382. };
  25383. module.exports = Signature;
  25384. /***/ },
  25385. /* 243 */
  25386. /***/ function(module, exports, __webpack_require__) {
  25387. "use strict";
  25388. 'use strict';
  25389. var hash = __webpack_require__(9);
  25390. var elliptic = __webpack_require__(3);
  25391. var utils = elliptic.utils;
  25392. var assert = utils.assert;
  25393. function HmacDRBG(options) {
  25394. if (!(this instanceof HmacDRBG))
  25395. return new HmacDRBG(options);
  25396. this.hash = options.hash;
  25397. this.predResist = !!options.predResist;
  25398. this.outLen = this.hash.outSize;
  25399. this.minEntropy = options.minEntropy || this.hash.hmacStrength;
  25400. this.reseed = null;
  25401. this.reseedInterval = null;
  25402. this.K = null;
  25403. this.V = null;
  25404. var entropy = utils.toArray(options.entropy, options.entropyEnc);
  25405. var nonce = utils.toArray(options.nonce, options.nonceEnc);
  25406. var pers = utils.toArray(options.pers, options.persEnc);
  25407. assert(entropy.length >= (this.minEntropy / 8),
  25408. 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');
  25409. this._init(entropy, nonce, pers);
  25410. }
  25411. module.exports = HmacDRBG;
  25412. HmacDRBG.prototype._init = function init(entropy, nonce, pers) {
  25413. var seed = entropy.concat(nonce).concat(pers);
  25414. this.K = new Array(this.outLen / 8);
  25415. this.V = new Array(this.outLen / 8);
  25416. for (var i = 0; i < this.V.length; i++) {
  25417. this.K[i] = 0x00;
  25418. this.V[i] = 0x01;
  25419. }
  25420. this._update(seed);
  25421. this.reseed = 1;
  25422. this.reseedInterval = 0x1000000000000; // 2^48
  25423. };
  25424. HmacDRBG.prototype._hmac = function hmac() {
  25425. return new hash.hmac(this.hash, this.K);
  25426. };
  25427. HmacDRBG.prototype._update = function update(seed) {
  25428. var kmac = this._hmac()
  25429. .update(this.V)
  25430. .update([ 0x00 ]);
  25431. if (seed)
  25432. kmac = kmac.update(seed);
  25433. this.K = kmac.digest();
  25434. this.V = this._hmac().update(this.V).digest();
  25435. if (!seed)
  25436. return;
  25437. this.K = this._hmac()
  25438. .update(this.V)
  25439. .update([ 0x01 ])
  25440. .update(seed)
  25441. .digest();
  25442. this.V = this._hmac().update(this.V).digest();
  25443. };
  25444. HmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) {
  25445. // Optional entropy enc
  25446. if (typeof entropyEnc !== 'string') {
  25447. addEnc = add;
  25448. add = entropyEnc;
  25449. entropyEnc = null;
  25450. }
  25451. entropy = utils.toBuffer(entropy, entropyEnc);
  25452. add = utils.toBuffer(add, addEnc);
  25453. assert(entropy.length >= (this.minEntropy / 8),
  25454. 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits');
  25455. this._update(entropy.concat(add || []));
  25456. this.reseed = 1;
  25457. };
  25458. HmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) {
  25459. if (this.reseed > this.reseedInterval)
  25460. throw new Error('Reseed is required');
  25461. // Optional encoding
  25462. if (typeof enc !== 'string') {
  25463. addEnc = add;
  25464. add = enc;
  25465. enc = null;
  25466. }
  25467. // Optional additional data
  25468. if (add) {
  25469. add = utils.toArray(add, addEnc);
  25470. this._update(add);
  25471. }
  25472. var temp = [];
  25473. while (temp.length < len) {
  25474. this.V = this._hmac().update(this.V).digest();
  25475. temp = temp.concat(this.V);
  25476. }
  25477. var res = temp.slice(0, len);
  25478. this._update(add);
  25479. this.reseed++;
  25480. return utils.encode(res, enc);
  25481. };
  25482. /***/ },
  25483. /* 244 */
  25484. /***/ function(module, exports) {
  25485. module.exports = {
  25486. doubles: {
  25487. step: 4,
  25488. points: [
  25489. [
  25490. 'e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a',
  25491. 'f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821'
  25492. ],
  25493. [
  25494. '8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508',
  25495. '11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf'
  25496. ],
  25497. [
  25498. '175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739',
  25499. 'd3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695'
  25500. ],
  25501. [
  25502. '363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640',
  25503. '4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9'
  25504. ],
  25505. [
  25506. '8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c',
  25507. '4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36'
  25508. ],
  25509. [
  25510. '723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda',
  25511. '96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f'
  25512. ],
  25513. [
  25514. 'eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa',
  25515. '5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999'
  25516. ],
  25517. [
  25518. '100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0',
  25519. 'cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09'
  25520. ],
  25521. [
  25522. 'e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d',
  25523. '9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d'
  25524. ],
  25525. [
  25526. 'feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d',
  25527. 'e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088'
  25528. ],
  25529. [
  25530. 'da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1',
  25531. '9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d'
  25532. ],
  25533. [
  25534. '53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0',
  25535. '5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8'
  25536. ],
  25537. [
  25538. '8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047',
  25539. '10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a'
  25540. ],
  25541. [
  25542. '385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862',
  25543. '283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453'
  25544. ],
  25545. [
  25546. '6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7',
  25547. '7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160'
  25548. ],
  25549. [
  25550. '3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd',
  25551. '56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0'
  25552. ],
  25553. [
  25554. '85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83',
  25555. '7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6'
  25556. ],
  25557. [
  25558. '948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a',
  25559. '53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589'
  25560. ],
  25561. [
  25562. '6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8',
  25563. 'bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17'
  25564. ],
  25565. [
  25566. 'e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d',
  25567. '4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda'
  25568. ],
  25569. [
  25570. 'e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725',
  25571. '7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd'
  25572. ],
  25573. [
  25574. '213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754',
  25575. '4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2'
  25576. ],
  25577. [
  25578. '4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c',
  25579. '17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6'
  25580. ],
  25581. [
  25582. 'fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6',
  25583. '6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f'
  25584. ],
  25585. [
  25586. '76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39',
  25587. 'c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01'
  25588. ],
  25589. [
  25590. 'c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891',
  25591. '893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3'
  25592. ],
  25593. [
  25594. 'd895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b',
  25595. 'febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f'
  25596. ],
  25597. [
  25598. 'b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03',
  25599. '2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7'
  25600. ],
  25601. [
  25602. 'e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d',
  25603. 'eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78'
  25604. ],
  25605. [
  25606. 'a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070',
  25607. '7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1'
  25608. ],
  25609. [
  25610. '90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4',
  25611. 'e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150'
  25612. ],
  25613. [
  25614. '8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da',
  25615. '662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82'
  25616. ],
  25617. [
  25618. 'e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11',
  25619. '1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc'
  25620. ],
  25621. [
  25622. '8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e',
  25623. 'efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b'
  25624. ],
  25625. [
  25626. 'e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41',
  25627. '2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51'
  25628. ],
  25629. [
  25630. 'b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef',
  25631. '67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45'
  25632. ],
  25633. [
  25634. 'd68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8',
  25635. 'db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120'
  25636. ],
  25637. [
  25638. '324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d',
  25639. '648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84'
  25640. ],
  25641. [
  25642. '4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96',
  25643. '35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d'
  25644. ],
  25645. [
  25646. '9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd',
  25647. 'ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d'
  25648. ],
  25649. [
  25650. '6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5',
  25651. '9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8'
  25652. ],
  25653. [
  25654. 'a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266',
  25655. '40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8'
  25656. ],
  25657. [
  25658. '7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71',
  25659. '34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac'
  25660. ],
  25661. [
  25662. '928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac',
  25663. 'c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f'
  25664. ],
  25665. [
  25666. '85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751',
  25667. '1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962'
  25668. ],
  25669. [
  25670. 'ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e',
  25671. '493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907'
  25672. ],
  25673. [
  25674. '827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241',
  25675. 'c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec'
  25676. ],
  25677. [
  25678. 'eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3',
  25679. 'be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d'
  25680. ],
  25681. [
  25682. 'e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f',
  25683. '4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414'
  25684. ],
  25685. [
  25686. '1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19',
  25687. 'aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd'
  25688. ],
  25689. [
  25690. '146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be',
  25691. 'b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0'
  25692. ],
  25693. [
  25694. 'fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9',
  25695. '6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811'
  25696. ],
  25697. [
  25698. 'da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2',
  25699. '8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1'
  25700. ],
  25701. [
  25702. 'a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13',
  25703. '7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c'
  25704. ],
  25705. [
  25706. '174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c',
  25707. 'ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73'
  25708. ],
  25709. [
  25710. '959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba',
  25711. '2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd'
  25712. ],
  25713. [
  25714. 'd2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151',
  25715. 'e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405'
  25716. ],
  25717. [
  25718. '64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073',
  25719. 'd99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589'
  25720. ],
  25721. [
  25722. '8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458',
  25723. '38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e'
  25724. ],
  25725. [
  25726. '13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b',
  25727. '69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27'
  25728. ],
  25729. [
  25730. 'bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366',
  25731. 'd3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1'
  25732. ],
  25733. [
  25734. '8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa',
  25735. '40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482'
  25736. ],
  25737. [
  25738. '8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0',
  25739. '620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945'
  25740. ],
  25741. [
  25742. 'dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787',
  25743. '7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573'
  25744. ],
  25745. [
  25746. 'f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e',
  25747. 'ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82'
  25748. ]
  25749. ]
  25750. },
  25751. naf: {
  25752. wnd: 7,
  25753. points: [
  25754. [
  25755. 'f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9',
  25756. '388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672'
  25757. ],
  25758. [
  25759. '2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4',
  25760. 'd8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6'
  25761. ],
  25762. [
  25763. '5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc',
  25764. '6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da'
  25765. ],
  25766. [
  25767. 'acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe',
  25768. 'cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37'
  25769. ],
  25770. [
  25771. '774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb',
  25772. 'd984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b'
  25773. ],
  25774. [
  25775. 'f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8',
  25776. 'ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81'
  25777. ],
  25778. [
  25779. 'd7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e',
  25780. '581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58'
  25781. ],
  25782. [
  25783. 'defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34',
  25784. '4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77'
  25785. ],
  25786. [
  25787. '2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c',
  25788. '85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a'
  25789. ],
  25790. [
  25791. '352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5',
  25792. '321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c'
  25793. ],
  25794. [
  25795. '2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f',
  25796. '2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67'
  25797. ],
  25798. [
  25799. '9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714',
  25800. '73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402'
  25801. ],
  25802. [
  25803. 'daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729',
  25804. 'a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55'
  25805. ],
  25806. [
  25807. 'c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db',
  25808. '2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482'
  25809. ],
  25810. [
  25811. '6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4',
  25812. 'e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82'
  25813. ],
  25814. [
  25815. '1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5',
  25816. 'b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396'
  25817. ],
  25818. [
  25819. '605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479',
  25820. '2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49'
  25821. ],
  25822. [
  25823. '62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d',
  25824. '80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf'
  25825. ],
  25826. [
  25827. '80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f',
  25828. '1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a'
  25829. ],
  25830. [
  25831. '7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb',
  25832. 'd0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7'
  25833. ],
  25834. [
  25835. 'd528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9',
  25836. 'eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933'
  25837. ],
  25838. [
  25839. '49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963',
  25840. '758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a'
  25841. ],
  25842. [
  25843. '77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74',
  25844. '958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6'
  25845. ],
  25846. [
  25847. 'f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530',
  25848. 'e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37'
  25849. ],
  25850. [
  25851. '463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b',
  25852. '5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e'
  25853. ],
  25854. [
  25855. 'f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247',
  25856. 'cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6'
  25857. ],
  25858. [
  25859. 'caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1',
  25860. 'cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476'
  25861. ],
  25862. [
  25863. '2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120',
  25864. '4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40'
  25865. ],
  25866. [
  25867. '7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435',
  25868. '91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61'
  25869. ],
  25870. [
  25871. '754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18',
  25872. '673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683'
  25873. ],
  25874. [
  25875. 'e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8',
  25876. '59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5'
  25877. ],
  25878. [
  25879. '186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb',
  25880. '3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b'
  25881. ],
  25882. [
  25883. 'df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f',
  25884. '55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417'
  25885. ],
  25886. [
  25887. '5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143',
  25888. 'efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868'
  25889. ],
  25890. [
  25891. '290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba',
  25892. 'e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a'
  25893. ],
  25894. [
  25895. 'af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45',
  25896. 'f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6'
  25897. ],
  25898. [
  25899. '766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a',
  25900. '744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996'
  25901. ],
  25902. [
  25903. '59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e',
  25904. 'c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e'
  25905. ],
  25906. [
  25907. 'f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8',
  25908. 'e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d'
  25909. ],
  25910. [
  25911. '7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c',
  25912. '30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2'
  25913. ],
  25914. [
  25915. '948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519',
  25916. 'e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e'
  25917. ],
  25918. [
  25919. '7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab',
  25920. '100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437'
  25921. ],
  25922. [
  25923. '3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca',
  25924. 'ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311'
  25925. ],
  25926. [
  25927. 'd3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf',
  25928. '8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4'
  25929. ],
  25930. [
  25931. '1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610',
  25932. '68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575'
  25933. ],
  25934. [
  25935. '733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4',
  25936. 'f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d'
  25937. ],
  25938. [
  25939. '15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c',
  25940. 'd56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d'
  25941. ],
  25942. [
  25943. 'a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940',
  25944. 'edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629'
  25945. ],
  25946. [
  25947. 'e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980',
  25948. 'a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06'
  25949. ],
  25950. [
  25951. '311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3',
  25952. '66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374'
  25953. ],
  25954. [
  25955. '34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf',
  25956. '9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee'
  25957. ],
  25958. [
  25959. 'f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63',
  25960. '4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1'
  25961. ],
  25962. [
  25963. 'd7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448',
  25964. 'fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b'
  25965. ],
  25966. [
  25967. '32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf',
  25968. '5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661'
  25969. ],
  25970. [
  25971. '7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5',
  25972. '8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6'
  25973. ],
  25974. [
  25975. 'ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6',
  25976. '8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e'
  25977. ],
  25978. [
  25979. '16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5',
  25980. '5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d'
  25981. ],
  25982. [
  25983. 'eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99',
  25984. 'f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc'
  25985. ],
  25986. [
  25987. '78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51',
  25988. 'f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4'
  25989. ],
  25990. [
  25991. '494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5',
  25992. '42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c'
  25993. ],
  25994. [
  25995. 'a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5',
  25996. '204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b'
  25997. ],
  25998. [
  25999. 'c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997',
  26000. '4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913'
  26001. ],
  26002. [
  26003. '841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881',
  26004. '73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154'
  26005. ],
  26006. [
  26007. '5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5',
  26008. '39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865'
  26009. ],
  26010. [
  26011. '36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66',
  26012. 'd2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc'
  26013. ],
  26014. [
  26015. '336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726',
  26016. 'ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224'
  26017. ],
  26018. [
  26019. '8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede',
  26020. '6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e'
  26021. ],
  26022. [
  26023. '1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94',
  26024. '60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6'
  26025. ],
  26026. [
  26027. '85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31',
  26028. '3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511'
  26029. ],
  26030. [
  26031. '29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51',
  26032. 'b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b'
  26033. ],
  26034. [
  26035. 'a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252',
  26036. 'ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2'
  26037. ],
  26038. [
  26039. '4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5',
  26040. 'cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c'
  26041. ],
  26042. [
  26043. 'd24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b',
  26044. '6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3'
  26045. ],
  26046. [
  26047. 'ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4',
  26048. '322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d'
  26049. ],
  26050. [
  26051. 'af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f',
  26052. '6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700'
  26053. ],
  26054. [
  26055. 'e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889',
  26056. '2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4'
  26057. ],
  26058. [
  26059. '591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246',
  26060. 'b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196'
  26061. ],
  26062. [
  26063. '11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984',
  26064. '998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4'
  26065. ],
  26066. [
  26067. '3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a',
  26068. 'b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257'
  26069. ],
  26070. [
  26071. 'cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030',
  26072. 'bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13'
  26073. ],
  26074. [
  26075. 'c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197',
  26076. '6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096'
  26077. ],
  26078. [
  26079. 'c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593',
  26080. 'c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38'
  26081. ],
  26082. [
  26083. 'a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef',
  26084. '21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f'
  26085. ],
  26086. [
  26087. '347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38',
  26088. '60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448'
  26089. ],
  26090. [
  26091. 'da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a',
  26092. '49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a'
  26093. ],
  26094. [
  26095. 'c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111',
  26096. '5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4'
  26097. ],
  26098. [
  26099. '4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502',
  26100. '7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437'
  26101. ],
  26102. [
  26103. '3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea',
  26104. 'be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7'
  26105. ],
  26106. [
  26107. 'cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26',
  26108. '8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d'
  26109. ],
  26110. [
  26111. 'b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986',
  26112. '39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a'
  26113. ],
  26114. [
  26115. 'd4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e',
  26116. '62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54'
  26117. ],
  26118. [
  26119. '48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4',
  26120. '25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77'
  26121. ],
  26122. [
  26123. 'dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda',
  26124. 'ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517'
  26125. ],
  26126. [
  26127. '6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859',
  26128. 'cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10'
  26129. ],
  26130. [
  26131. 'e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f',
  26132. 'f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125'
  26133. ],
  26134. [
  26135. 'eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c',
  26136. '6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e'
  26137. ],
  26138. [
  26139. '13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942',
  26140. 'fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1'
  26141. ],
  26142. [
  26143. 'ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a',
  26144. '1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2'
  26145. ],
  26146. [
  26147. 'b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80',
  26148. '5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423'
  26149. ],
  26150. [
  26151. 'ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d',
  26152. '438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8'
  26153. ],
  26154. [
  26155. '8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1',
  26156. 'cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758'
  26157. ],
  26158. [
  26159. '52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63',
  26160. 'c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375'
  26161. ],
  26162. [
  26163. 'e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352',
  26164. '6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d'
  26165. ],
  26166. [
  26167. '7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193',
  26168. 'ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec'
  26169. ],
  26170. [
  26171. '5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00',
  26172. '9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0'
  26173. ],
  26174. [
  26175. '32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58',
  26176. 'ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c'
  26177. ],
  26178. [
  26179. 'e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7',
  26180. 'd3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4'
  26181. ],
  26182. [
  26183. '8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8',
  26184. 'c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f'
  26185. ],
  26186. [
  26187. '4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e',
  26188. '67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649'
  26189. ],
  26190. [
  26191. '3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d',
  26192. 'cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826'
  26193. ],
  26194. [
  26195. '674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b',
  26196. '299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5'
  26197. ],
  26198. [
  26199. 'd32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f',
  26200. 'f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87'
  26201. ],
  26202. [
  26203. '30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6',
  26204. '462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b'
  26205. ],
  26206. [
  26207. 'be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297',
  26208. '62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc'
  26209. ],
  26210. [
  26211. '93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a',
  26212. '7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c'
  26213. ],
  26214. [
  26215. 'b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c',
  26216. 'ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f'
  26217. ],
  26218. [
  26219. 'd5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52',
  26220. '4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a'
  26221. ],
  26222. [
  26223. 'd3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb',
  26224. 'bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46'
  26225. ],
  26226. [
  26227. '463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065',
  26228. 'bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f'
  26229. ],
  26230. [
  26231. '7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917',
  26232. '603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03'
  26233. ],
  26234. [
  26235. '74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9',
  26236. 'cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08'
  26237. ],
  26238. [
  26239. '30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3',
  26240. '553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8'
  26241. ],
  26242. [
  26243. '9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57',
  26244. '712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373'
  26245. ],
  26246. [
  26247. '176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66',
  26248. 'ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3'
  26249. ],
  26250. [
  26251. '75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8',
  26252. '9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8'
  26253. ],
  26254. [
  26255. '809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721',
  26256. '9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1'
  26257. ],
  26258. [
  26259. '1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180',
  26260. '4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9'
  26261. ]
  26262. ]
  26263. }
  26264. };
  26265. /***/ },
  26266. /* 245 */
  26267. /***/ function(module, exports, __webpack_require__) {
  26268. "use strict";
  26269. 'use strict';
  26270. var utils = exports;
  26271. var BN = __webpack_require__(2);
  26272. utils.assert = function assert(val, msg) {
  26273. if (!val)
  26274. throw new Error(msg || 'Assertion failed');
  26275. };
  26276. function toArray(msg, enc) {
  26277. if (Array.isArray(msg))
  26278. return msg.slice();
  26279. if (!msg)
  26280. return [];
  26281. var res = [];
  26282. if (typeof msg !== 'string') {
  26283. for (var i = 0; i < msg.length; i++)
  26284. res[i] = msg[i] | 0;
  26285. return res;
  26286. }
  26287. if (!enc) {
  26288. for (var i = 0; i < msg.length; i++) {
  26289. var c = msg.charCodeAt(i);
  26290. var hi = c >> 8;
  26291. var lo = c & 0xff;
  26292. if (hi)
  26293. res.push(hi, lo);
  26294. else
  26295. res.push(lo);
  26296. }
  26297. } else if (enc === 'hex') {
  26298. msg = msg.replace(/[^a-z0-9]+/ig, '');
  26299. if (msg.length % 2 !== 0)
  26300. msg = '0' + msg;
  26301. for (var i = 0; i < msg.length; i += 2)
  26302. res.push(parseInt(msg[i] + msg[i + 1], 16));
  26303. }
  26304. return res;
  26305. }
  26306. utils.toArray = toArray;
  26307. function zero2(word) {
  26308. if (word.length === 1)
  26309. return '0' + word;
  26310. else
  26311. return word;
  26312. }
  26313. utils.zero2 = zero2;
  26314. function toHex(msg) {
  26315. var res = '';
  26316. for (var i = 0; i < msg.length; i++)
  26317. res += zero2(msg[i].toString(16));
  26318. return res;
  26319. }
  26320. utils.toHex = toHex;
  26321. utils.encode = function encode(arr, enc) {
  26322. if (enc === 'hex')
  26323. return toHex(arr);
  26324. else
  26325. return arr;
  26326. };
  26327. // Represent num in a w-NAF form
  26328. function getNAF(num, w) {
  26329. var naf = [];
  26330. var ws = 1 << (w + 1);
  26331. var k = num.clone();
  26332. while (k.cmpn(1) >= 0) {
  26333. var z;
  26334. if (k.isOdd()) {
  26335. var mod = k.andln(ws - 1);
  26336. if (mod > (ws >> 1) - 1)
  26337. z = (ws >> 1) - mod;
  26338. else
  26339. z = mod;
  26340. k.isubn(z);
  26341. } else {
  26342. z = 0;
  26343. }
  26344. naf.push(z);
  26345. // Optimization, shift by word if possible
  26346. var shift = (k.cmpn(0) !== 0 && k.andln(ws - 1) === 0) ? (w + 1) : 1;
  26347. for (var i = 1; i < shift; i++)
  26348. naf.push(0);
  26349. k.iushrn(shift);
  26350. }
  26351. return naf;
  26352. }
  26353. utils.getNAF = getNAF;
  26354. // Represent k1, k2 in a Joint Sparse Form
  26355. function getJSF(k1, k2) {
  26356. var jsf = [
  26357. [],
  26358. []
  26359. ];
  26360. k1 = k1.clone();
  26361. k2 = k2.clone();
  26362. var d1 = 0;
  26363. var d2 = 0;
  26364. while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) {
  26365. // First phase
  26366. var m14 = (k1.andln(3) + d1) & 3;
  26367. var m24 = (k2.andln(3) + d2) & 3;
  26368. if (m14 === 3)
  26369. m14 = -1;
  26370. if (m24 === 3)
  26371. m24 = -1;
  26372. var u1;
  26373. if ((m14 & 1) === 0) {
  26374. u1 = 0;
  26375. } else {
  26376. var m8 = (k1.andln(7) + d1) & 7;
  26377. if ((m8 === 3 || m8 === 5) && m24 === 2)
  26378. u1 = -m14;
  26379. else
  26380. u1 = m14;
  26381. }
  26382. jsf[0].push(u1);
  26383. var u2;
  26384. if ((m24 & 1) === 0) {
  26385. u2 = 0;
  26386. } else {
  26387. var m8 = (k2.andln(7) + d2) & 7;
  26388. if ((m8 === 3 || m8 === 5) && m14 === 2)
  26389. u2 = -m24;
  26390. else
  26391. u2 = m24;
  26392. }
  26393. jsf[1].push(u2);
  26394. // Second phase
  26395. if (2 * d1 === u1 + 1)
  26396. d1 = 1 - d1;
  26397. if (2 * d2 === u2 + 1)
  26398. d2 = 1 - d2;
  26399. k1.iushrn(1);
  26400. k2.iushrn(1);
  26401. }
  26402. return jsf;
  26403. }
  26404. utils.getJSF = getJSF;
  26405. function cachedProperty(obj, name, computer) {
  26406. var key = '_' + name;
  26407. obj.prototype[name] = function cachedProperty() {
  26408. return this[key] !== undefined ? this[key] :
  26409. this[key] = computer.call(this);
  26410. };
  26411. }
  26412. utils.cachedProperty = cachedProperty;
  26413. function parseBytes(bytes) {
  26414. return typeof bytes === 'string' ? utils.toArray(bytes, 'hex') :
  26415. bytes;
  26416. }
  26417. utils.parseBytes = parseBytes;
  26418. function intFromLE(bytes) {
  26419. return new BN(bytes, 'hex', 'le');
  26420. }
  26421. utils.intFromLE = intFromLE;
  26422. /***/ },
  26423. /* 246 */
  26424. /***/ function(module, exports) {
  26425. /**
  26426. * Check if argument is a HTML element.
  26427. *
  26428. * @param {Object} value
  26429. * @return {Boolean}
  26430. */
  26431. exports.node = function(value) {
  26432. return value !== undefined
  26433. && value instanceof HTMLElement
  26434. && value.nodeType === 1;
  26435. };
  26436. /**
  26437. * Check if argument is a list of HTML elements.
  26438. *
  26439. * @param {Object} value
  26440. * @return {Boolean}
  26441. */
  26442. exports.nodeList = function(value) {
  26443. var type = Object.prototype.toString.call(value);
  26444. return value !== undefined
  26445. && (type === '[object NodeList]' || type === '[object HTMLCollection]')
  26446. && ('length' in value)
  26447. && (value.length === 0 || exports.node(value[0]));
  26448. };
  26449. /**
  26450. * Check if argument is a string.
  26451. *
  26452. * @param {Object} value
  26453. * @return {Boolean}
  26454. */
  26455. exports.string = function(value) {
  26456. return typeof value === 'string'
  26457. || value instanceof String;
  26458. };
  26459. /**
  26460. * Check if argument is a function.
  26461. *
  26462. * @param {Object} value
  26463. * @return {Boolean}
  26464. */
  26465. exports.fn = function(value) {
  26466. var type = Object.prototype.toString.call(value);
  26467. return type === '[object Function]';
  26468. };
  26469. /***/ },
  26470. /* 247 */
  26471. /***/ function(module, exports, __webpack_require__) {
  26472. var is = __webpack_require__(246);
  26473. var delegate = __webpack_require__(224);
  26474. /**
  26475. * Validates all params and calls the right
  26476. * listener function based on its target type.
  26477. *
  26478. * @param {String|HTMLElement|HTMLCollection|NodeList} target
  26479. * @param {String} type
  26480. * @param {Function} callback
  26481. * @return {Object}
  26482. */
  26483. function listen(target, type, callback) {
  26484. if (!target && !type && !callback) {
  26485. throw new Error('Missing required arguments');
  26486. }
  26487. if (!is.string(type)) {
  26488. throw new TypeError('Second argument must be a String');
  26489. }
  26490. if (!is.fn(callback)) {
  26491. throw new TypeError('Third argument must be a Function');
  26492. }
  26493. if (is.node(target)) {
  26494. return listenNode(target, type, callback);
  26495. }
  26496. else if (is.nodeList(target)) {
  26497. return listenNodeList(target, type, callback);
  26498. }
  26499. else if (is.string(target)) {
  26500. return listenSelector(target, type, callback);
  26501. }
  26502. else {
  26503. throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');
  26504. }
  26505. }
  26506. /**
  26507. * Adds an event listener to a HTML element
  26508. * and returns a remove listener function.
  26509. *
  26510. * @param {HTMLElement} node
  26511. * @param {String} type
  26512. * @param {Function} callback
  26513. * @return {Object}
  26514. */
  26515. function listenNode(node, type, callback) {
  26516. node.addEventListener(type, callback);
  26517. return {
  26518. destroy: function() {
  26519. node.removeEventListener(type, callback);
  26520. }
  26521. }
  26522. }
  26523. /**
  26524. * Add an event listener to a list of HTML elements
  26525. * and returns a remove listener function.
  26526. *
  26527. * @param {NodeList|HTMLCollection} nodeList
  26528. * @param {String} type
  26529. * @param {Function} callback
  26530. * @return {Object}
  26531. */
  26532. function listenNodeList(nodeList, type, callback) {
  26533. Array.prototype.forEach.call(nodeList, function(node) {
  26534. node.addEventListener(type, callback);
  26535. });
  26536. return {
  26537. destroy: function() {
  26538. Array.prototype.forEach.call(nodeList, function(node) {
  26539. node.removeEventListener(type, callback);
  26540. });
  26541. }
  26542. }
  26543. }
  26544. /**
  26545. * Add an event listener to a selector
  26546. * and returns a remove listener function.
  26547. *
  26548. * @param {String} selector
  26549. * @param {String} type
  26550. * @param {Function} callback
  26551. * @return {Object}
  26552. */
  26553. function listenSelector(selector, type, callback) {
  26554. return delegate(document.body, selector, type, callback);
  26555. }
  26556. module.exports = listen;
  26557. /***/ },
  26558. /* 248 */
  26559. /***/ function(module, exports, __webpack_require__) {
  26560. var hash = __webpack_require__(9);
  26561. var utils = hash.utils;
  26562. var assert = utils.assert;
  26563. function BlockHash() {
  26564. this.pending = null;
  26565. this.pendingTotal = 0;
  26566. this.blockSize = this.constructor.blockSize;
  26567. this.outSize = this.constructor.outSize;
  26568. this.hmacStrength = this.constructor.hmacStrength;
  26569. this.padLength = this.constructor.padLength / 8;
  26570. this.endian = 'big';
  26571. this._delta8 = this.blockSize / 8;
  26572. this._delta32 = this.blockSize / 32;
  26573. }
  26574. exports.BlockHash = BlockHash;
  26575. BlockHash.prototype.update = function update(msg, enc) {
  26576. // Convert message to array, pad it, and join into 32bit blocks
  26577. msg = utils.toArray(msg, enc);
  26578. if (!this.pending)
  26579. this.pending = msg;
  26580. else
  26581. this.pending = this.pending.concat(msg);
  26582. this.pendingTotal += msg.length;
  26583. // Enough data, try updating
  26584. if (this.pending.length >= this._delta8) {
  26585. msg = this.pending;
  26586. // Process pending data in blocks
  26587. var r = msg.length % this._delta8;
  26588. this.pending = msg.slice(msg.length - r, msg.length);
  26589. if (this.pending.length === 0)
  26590. this.pending = null;
  26591. msg = utils.join32(msg, 0, msg.length - r, this.endian);
  26592. for (var i = 0; i < msg.length; i += this._delta32)
  26593. this._update(msg, i, i + this._delta32);
  26594. }
  26595. return this;
  26596. };
  26597. BlockHash.prototype.digest = function digest(enc) {
  26598. this.update(this._pad());
  26599. assert(this.pending === null);
  26600. return this._digest(enc);
  26601. };
  26602. BlockHash.prototype._pad = function pad() {
  26603. var len = this.pendingTotal;
  26604. var bytes = this._delta8;
  26605. var k = bytes - ((len + this.padLength) % bytes);
  26606. var res = new Array(k + this.padLength);
  26607. res[0] = 0x80;
  26608. for (var i = 1; i < k; i++)
  26609. res[i] = 0;
  26610. // Append length
  26611. len <<= 3;
  26612. if (this.endian === 'big') {
  26613. for (var t = 8; t < this.padLength; t++)
  26614. res[i++] = 0;
  26615. res[i++] = 0;
  26616. res[i++] = 0;
  26617. res[i++] = 0;
  26618. res[i++] = 0;
  26619. res[i++] = (len >>> 24) & 0xff;
  26620. res[i++] = (len >>> 16) & 0xff;
  26621. res[i++] = (len >>> 8) & 0xff;
  26622. res[i++] = len & 0xff;
  26623. } else {
  26624. res[i++] = len & 0xff;
  26625. res[i++] = (len >>> 8) & 0xff;
  26626. res[i++] = (len >>> 16) & 0xff;
  26627. res[i++] = (len >>> 24) & 0xff;
  26628. res[i++] = 0;
  26629. res[i++] = 0;
  26630. res[i++] = 0;
  26631. res[i++] = 0;
  26632. for (var t = 8; t < this.padLength; t++)
  26633. res[i++] = 0;
  26634. }
  26635. return res;
  26636. };
  26637. /***/ },
  26638. /* 249 */
  26639. /***/ function(module, exports, __webpack_require__) {
  26640. var hmac = exports;
  26641. var hash = __webpack_require__(9);
  26642. var utils = hash.utils;
  26643. var assert = utils.assert;
  26644. function Hmac(hash, key, enc) {
  26645. if (!(this instanceof Hmac))
  26646. return new Hmac(hash, key, enc);
  26647. this.Hash = hash;
  26648. this.blockSize = hash.blockSize / 8;
  26649. this.outSize = hash.outSize / 8;
  26650. this.inner = null;
  26651. this.outer = null;
  26652. this._init(utils.toArray(key, enc));
  26653. }
  26654. module.exports = Hmac;
  26655. Hmac.prototype._init = function init(key) {
  26656. // Shorten key, if needed
  26657. if (key.length > this.blockSize)
  26658. key = new this.Hash().update(key).digest();
  26659. assert(key.length <= this.blockSize);
  26660. // Add padding to key
  26661. for (var i = key.length; i < this.blockSize; i++)
  26662. key.push(0);
  26663. for (var i = 0; i < key.length; i++)
  26664. key[i] ^= 0x36;
  26665. this.inner = new this.Hash().update(key);
  26666. // 0x36 ^ 0x5c = 0x6a
  26667. for (var i = 0; i < key.length; i++)
  26668. key[i] ^= 0x6a;
  26669. this.outer = new this.Hash().update(key);
  26670. };
  26671. Hmac.prototype.update = function update(msg, enc) {
  26672. this.inner.update(msg, enc);
  26673. return this;
  26674. };
  26675. Hmac.prototype.digest = function digest(enc) {
  26676. this.outer.update(this.inner.digest());
  26677. return this.outer.digest(enc);
  26678. };
  26679. /***/ },
  26680. /* 250 */
  26681. /***/ function(module, exports, __webpack_require__) {
  26682. var hash = __webpack_require__(9);
  26683. var utils = hash.utils;
  26684. var rotl32 = utils.rotl32;
  26685. var sum32 = utils.sum32;
  26686. var sum32_3 = utils.sum32_3;
  26687. var sum32_4 = utils.sum32_4;
  26688. var BlockHash = hash.common.BlockHash;
  26689. function RIPEMD160() {
  26690. if (!(this instanceof RIPEMD160))
  26691. return new RIPEMD160();
  26692. BlockHash.call(this);
  26693. this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ];
  26694. this.endian = 'little';
  26695. }
  26696. utils.inherits(RIPEMD160, BlockHash);
  26697. exports.ripemd160 = RIPEMD160;
  26698. RIPEMD160.blockSize = 512;
  26699. RIPEMD160.outSize = 160;
  26700. RIPEMD160.hmacStrength = 192;
  26701. RIPEMD160.padLength = 64;
  26702. RIPEMD160.prototype._update = function update(msg, start) {
  26703. var A = this.h[0];
  26704. var B = this.h[1];
  26705. var C = this.h[2];
  26706. var D = this.h[3];
  26707. var E = this.h[4];
  26708. var Ah = A;
  26709. var Bh = B;
  26710. var Ch = C;
  26711. var Dh = D;
  26712. var Eh = E;
  26713. for (var j = 0; j < 80; j++) {
  26714. var T = sum32(
  26715. rotl32(
  26716. sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)),
  26717. s[j]),
  26718. E);
  26719. A = E;
  26720. E = D;
  26721. D = rotl32(C, 10);
  26722. C = B;
  26723. B = T;
  26724. T = sum32(
  26725. rotl32(
  26726. sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)),
  26727. sh[j]),
  26728. Eh);
  26729. Ah = Eh;
  26730. Eh = Dh;
  26731. Dh = rotl32(Ch, 10);
  26732. Ch = Bh;
  26733. Bh = T;
  26734. }
  26735. T = sum32_3(this.h[1], C, Dh);
  26736. this.h[1] = sum32_3(this.h[2], D, Eh);
  26737. this.h[2] = sum32_3(this.h[3], E, Ah);
  26738. this.h[3] = sum32_3(this.h[4], A, Bh);
  26739. this.h[4] = sum32_3(this.h[0], B, Ch);
  26740. this.h[0] = T;
  26741. };
  26742. RIPEMD160.prototype._digest = function digest(enc) {
  26743. if (enc === 'hex')
  26744. return utils.toHex32(this.h, 'little');
  26745. else
  26746. return utils.split32(this.h, 'little');
  26747. };
  26748. function f(j, x, y, z) {
  26749. if (j <= 15)
  26750. return x ^ y ^ z;
  26751. else if (j <= 31)
  26752. return (x & y) | ((~x) & z);
  26753. else if (j <= 47)
  26754. return (x | (~y)) ^ z;
  26755. else if (j <= 63)
  26756. return (x & z) | (y & (~z));
  26757. else
  26758. return x ^ (y | (~z));
  26759. }
  26760. function K(j) {
  26761. if (j <= 15)
  26762. return 0x00000000;
  26763. else if (j <= 31)
  26764. return 0x5a827999;
  26765. else if (j <= 47)
  26766. return 0x6ed9eba1;
  26767. else if (j <= 63)
  26768. return 0x8f1bbcdc;
  26769. else
  26770. return 0xa953fd4e;
  26771. }
  26772. function Kh(j) {
  26773. if (j <= 15)
  26774. return 0x50a28be6;
  26775. else if (j <= 31)
  26776. return 0x5c4dd124;
  26777. else if (j <= 47)
  26778. return 0x6d703ef3;
  26779. else if (j <= 63)
  26780. return 0x7a6d76e9;
  26781. else
  26782. return 0x00000000;
  26783. }
  26784. var r = [
  26785. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
  26786. 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
  26787. 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
  26788. 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
  26789. 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
  26790. ];
  26791. var rh = [
  26792. 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
  26793. 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
  26794. 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
  26795. 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
  26796. 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
  26797. ];
  26798. var s = [
  26799. 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
  26800. 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
  26801. 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
  26802. 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
  26803. 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
  26804. ];
  26805. var sh = [
  26806. 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
  26807. 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
  26808. 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
  26809. 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
  26810. 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
  26811. ];
  26812. /***/ },
  26813. /* 251 */
  26814. /***/ function(module, exports, __webpack_require__) {
  26815. var hash = __webpack_require__(9);
  26816. var utils = hash.utils;
  26817. var assert = utils.assert;
  26818. var rotr32 = utils.rotr32;
  26819. var rotl32 = utils.rotl32;
  26820. var sum32 = utils.sum32;
  26821. var sum32_4 = utils.sum32_4;
  26822. var sum32_5 = utils.sum32_5;
  26823. var rotr64_hi = utils.rotr64_hi;
  26824. var rotr64_lo = utils.rotr64_lo;
  26825. var shr64_hi = utils.shr64_hi;
  26826. var shr64_lo = utils.shr64_lo;
  26827. var sum64 = utils.sum64;
  26828. var sum64_hi = utils.sum64_hi;
  26829. var sum64_lo = utils.sum64_lo;
  26830. var sum64_4_hi = utils.sum64_4_hi;
  26831. var sum64_4_lo = utils.sum64_4_lo;
  26832. var sum64_5_hi = utils.sum64_5_hi;
  26833. var sum64_5_lo = utils.sum64_5_lo;
  26834. var BlockHash = hash.common.BlockHash;
  26835. var sha256_K = [
  26836. 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
  26837. 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
  26838. 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
  26839. 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
  26840. 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,
  26841. 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
  26842. 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,
  26843. 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
  26844. 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,
  26845. 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
  26846. 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,
  26847. 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
  26848. 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,
  26849. 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
  26850. 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,
  26851. 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
  26852. ];
  26853. var sha512_K = [
  26854. 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,
  26855. 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,
  26856. 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,
  26857. 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,
  26858. 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,
  26859. 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,
  26860. 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,
  26861. 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,
  26862. 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,
  26863. 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,
  26864. 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,
  26865. 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,
  26866. 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,
  26867. 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,
  26868. 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,
  26869. 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,
  26870. 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,
  26871. 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,
  26872. 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,
  26873. 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,
  26874. 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,
  26875. 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,
  26876. 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,
  26877. 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,
  26878. 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,
  26879. 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,
  26880. 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,
  26881. 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,
  26882. 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,
  26883. 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,
  26884. 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,
  26885. 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,
  26886. 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,
  26887. 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,
  26888. 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,
  26889. 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,
  26890. 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,
  26891. 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,
  26892. 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,
  26893. 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817
  26894. ];
  26895. var sha1_K = [
  26896. 0x5A827999, 0x6ED9EBA1,
  26897. 0x8F1BBCDC, 0xCA62C1D6
  26898. ];
  26899. function SHA256() {
  26900. if (!(this instanceof SHA256))
  26901. return new SHA256();
  26902. BlockHash.call(this);
  26903. this.h = [ 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,
  26904. 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 ];
  26905. this.k = sha256_K;
  26906. this.W = new Array(64);
  26907. }
  26908. utils.inherits(SHA256, BlockHash);
  26909. exports.sha256 = SHA256;
  26910. SHA256.blockSize = 512;
  26911. SHA256.outSize = 256;
  26912. SHA256.hmacStrength = 192;
  26913. SHA256.padLength = 64;
  26914. SHA256.prototype._update = function _update(msg, start) {
  26915. var W = this.W;
  26916. for (var i = 0; i < 16; i++)
  26917. W[i] = msg[start + i];
  26918. for (; i < W.length; i++)
  26919. W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]);
  26920. var a = this.h[0];
  26921. var b = this.h[1];
  26922. var c = this.h[2];
  26923. var d = this.h[3];
  26924. var e = this.h[4];
  26925. var f = this.h[5];
  26926. var g = this.h[6];
  26927. var h = this.h[7];
  26928. assert(this.k.length === W.length);
  26929. for (var i = 0; i < W.length; i++) {
  26930. var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]);
  26931. var T2 = sum32(s0_256(a), maj32(a, b, c));
  26932. h = g;
  26933. g = f;
  26934. f = e;
  26935. e = sum32(d, T1);
  26936. d = c;
  26937. c = b;
  26938. b = a;
  26939. a = sum32(T1, T2);
  26940. }
  26941. this.h[0] = sum32(this.h[0], a);
  26942. this.h[1] = sum32(this.h[1], b);
  26943. this.h[2] = sum32(this.h[2], c);
  26944. this.h[3] = sum32(this.h[3], d);
  26945. this.h[4] = sum32(this.h[4], e);
  26946. this.h[5] = sum32(this.h[5], f);
  26947. this.h[6] = sum32(this.h[6], g);
  26948. this.h[7] = sum32(this.h[7], h);
  26949. };
  26950. SHA256.prototype._digest = function digest(enc) {
  26951. if (enc === 'hex')
  26952. return utils.toHex32(this.h, 'big');
  26953. else
  26954. return utils.split32(this.h, 'big');
  26955. };
  26956. function SHA224() {
  26957. if (!(this instanceof SHA224))
  26958. return new SHA224();
  26959. SHA256.call(this);
  26960. this.h = [ 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939,
  26961. 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 ];
  26962. }
  26963. utils.inherits(SHA224, SHA256);
  26964. exports.sha224 = SHA224;
  26965. SHA224.blockSize = 512;
  26966. SHA224.outSize = 224;
  26967. SHA224.hmacStrength = 192;
  26968. SHA224.padLength = 64;
  26969. SHA224.prototype._digest = function digest(enc) {
  26970. // Just truncate output
  26971. if (enc === 'hex')
  26972. return utils.toHex32(this.h.slice(0, 7), 'big');
  26973. else
  26974. return utils.split32(this.h.slice(0, 7), 'big');
  26975. };
  26976. function SHA512() {
  26977. if (!(this instanceof SHA512))
  26978. return new SHA512();
  26979. BlockHash.call(this);
  26980. this.h = [ 0x6a09e667, 0xf3bcc908,
  26981. 0xbb67ae85, 0x84caa73b,
  26982. 0x3c6ef372, 0xfe94f82b,
  26983. 0xa54ff53a, 0x5f1d36f1,
  26984. 0x510e527f, 0xade682d1,
  26985. 0x9b05688c, 0x2b3e6c1f,
  26986. 0x1f83d9ab, 0xfb41bd6b,
  26987. 0x5be0cd19, 0x137e2179 ];
  26988. this.k = sha512_K;
  26989. this.W = new Array(160);
  26990. }
  26991. utils.inherits(SHA512, BlockHash);
  26992. exports.sha512 = SHA512;
  26993. SHA512.blockSize = 1024;
  26994. SHA512.outSize = 512;
  26995. SHA512.hmacStrength = 192;
  26996. SHA512.padLength = 128;
  26997. SHA512.prototype._prepareBlock = function _prepareBlock(msg, start) {
  26998. var W = this.W;
  26999. // 32 x 32bit words
  27000. for (var i = 0; i < 32; i++)
  27001. W[i] = msg[start + i];
  27002. for (; i < W.length; i += 2) {
  27003. var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2
  27004. var c0_lo = g1_512_lo(W[i - 4], W[i - 3]);
  27005. var c1_hi = W[i - 14]; // i - 7
  27006. var c1_lo = W[i - 13];
  27007. var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15
  27008. var c2_lo = g0_512_lo(W[i - 30], W[i - 29]);
  27009. var c3_hi = W[i - 32]; // i - 16
  27010. var c3_lo = W[i - 31];
  27011. W[i] = sum64_4_hi(c0_hi, c0_lo,
  27012. c1_hi, c1_lo,
  27013. c2_hi, c2_lo,
  27014. c3_hi, c3_lo);
  27015. W[i + 1] = sum64_4_lo(c0_hi, c0_lo,
  27016. c1_hi, c1_lo,
  27017. c2_hi, c2_lo,
  27018. c3_hi, c3_lo);
  27019. }
  27020. };
  27021. SHA512.prototype._update = function _update(msg, start) {
  27022. this._prepareBlock(msg, start);
  27023. var W = this.W;
  27024. var ah = this.h[0];
  27025. var al = this.h[1];
  27026. var bh = this.h[2];
  27027. var bl = this.h[3];
  27028. var ch = this.h[4];
  27029. var cl = this.h[5];
  27030. var dh = this.h[6];
  27031. var dl = this.h[7];
  27032. var eh = this.h[8];
  27033. var el = this.h[9];
  27034. var fh = this.h[10];
  27035. var fl = this.h[11];
  27036. var gh = this.h[12];
  27037. var gl = this.h[13];
  27038. var hh = this.h[14];
  27039. var hl = this.h[15];
  27040. assert(this.k.length === W.length);
  27041. for (var i = 0; i < W.length; i += 2) {
  27042. var c0_hi = hh;
  27043. var c0_lo = hl;
  27044. var c1_hi = s1_512_hi(eh, el);
  27045. var c1_lo = s1_512_lo(eh, el);
  27046. var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl);
  27047. var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl);
  27048. var c3_hi = this.k[i];
  27049. var c3_lo = this.k[i + 1];
  27050. var c4_hi = W[i];
  27051. var c4_lo = W[i + 1];
  27052. var T1_hi = sum64_5_hi(c0_hi, c0_lo,
  27053. c1_hi, c1_lo,
  27054. c2_hi, c2_lo,
  27055. c3_hi, c3_lo,
  27056. c4_hi, c4_lo);
  27057. var T1_lo = sum64_5_lo(c0_hi, c0_lo,
  27058. c1_hi, c1_lo,
  27059. c2_hi, c2_lo,
  27060. c3_hi, c3_lo,
  27061. c4_hi, c4_lo);
  27062. var c0_hi = s0_512_hi(ah, al);
  27063. var c0_lo = s0_512_lo(ah, al);
  27064. var c1_hi = maj64_hi(ah, al, bh, bl, ch, cl);
  27065. var c1_lo = maj64_lo(ah, al, bh, bl, ch, cl);
  27066. var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo);
  27067. var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo);
  27068. hh = gh;
  27069. hl = gl;
  27070. gh = fh;
  27071. gl = fl;
  27072. fh = eh;
  27073. fl = el;
  27074. eh = sum64_hi(dh, dl, T1_hi, T1_lo);
  27075. el = sum64_lo(dl, dl, T1_hi, T1_lo);
  27076. dh = ch;
  27077. dl = cl;
  27078. ch = bh;
  27079. cl = bl;
  27080. bh = ah;
  27081. bl = al;
  27082. ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo);
  27083. al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo);
  27084. }
  27085. sum64(this.h, 0, ah, al);
  27086. sum64(this.h, 2, bh, bl);
  27087. sum64(this.h, 4, ch, cl);
  27088. sum64(this.h, 6, dh, dl);
  27089. sum64(this.h, 8, eh, el);
  27090. sum64(this.h, 10, fh, fl);
  27091. sum64(this.h, 12, gh, gl);
  27092. sum64(this.h, 14, hh, hl);
  27093. };
  27094. SHA512.prototype._digest = function digest(enc) {
  27095. if (enc === 'hex')
  27096. return utils.toHex32(this.h, 'big');
  27097. else
  27098. return utils.split32(this.h, 'big');
  27099. };
  27100. function SHA384() {
  27101. if (!(this instanceof SHA384))
  27102. return new SHA384();
  27103. SHA512.call(this);
  27104. this.h = [ 0xcbbb9d5d, 0xc1059ed8,
  27105. 0x629a292a, 0x367cd507,
  27106. 0x9159015a, 0x3070dd17,
  27107. 0x152fecd8, 0xf70e5939,
  27108. 0x67332667, 0xffc00b31,
  27109. 0x8eb44a87, 0x68581511,
  27110. 0xdb0c2e0d, 0x64f98fa7,
  27111. 0x47b5481d, 0xbefa4fa4 ];
  27112. }
  27113. utils.inherits(SHA384, SHA512);
  27114. exports.sha384 = SHA384;
  27115. SHA384.blockSize = 1024;
  27116. SHA384.outSize = 384;
  27117. SHA384.hmacStrength = 192;
  27118. SHA384.padLength = 128;
  27119. SHA384.prototype._digest = function digest(enc) {
  27120. if (enc === 'hex')
  27121. return utils.toHex32(this.h.slice(0, 12), 'big');
  27122. else
  27123. return utils.split32(this.h.slice(0, 12), 'big');
  27124. };
  27125. function SHA1() {
  27126. if (!(this instanceof SHA1))
  27127. return new SHA1();
  27128. BlockHash.call(this);
  27129. this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe,
  27130. 0x10325476, 0xc3d2e1f0 ];
  27131. this.W = new Array(80);
  27132. }
  27133. utils.inherits(SHA1, BlockHash);
  27134. exports.sha1 = SHA1;
  27135. SHA1.blockSize = 512;
  27136. SHA1.outSize = 160;
  27137. SHA1.hmacStrength = 80;
  27138. SHA1.padLength = 64;
  27139. SHA1.prototype._update = function _update(msg, start) {
  27140. var W = this.W;
  27141. for (var i = 0; i < 16; i++)
  27142. W[i] = msg[start + i];
  27143. for(; i < W.length; i++)
  27144. W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1);
  27145. var a = this.h[0];
  27146. var b = this.h[1];
  27147. var c = this.h[2];
  27148. var d = this.h[3];
  27149. var e = this.h[4];
  27150. for (var i = 0; i < W.length; i++) {
  27151. var s = ~~(i / 20);
  27152. var t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]);
  27153. e = d;
  27154. d = c;
  27155. c = rotl32(b, 30);
  27156. b = a;
  27157. a = t;
  27158. }
  27159. this.h[0] = sum32(this.h[0], a);
  27160. this.h[1] = sum32(this.h[1], b);
  27161. this.h[2] = sum32(this.h[2], c);
  27162. this.h[3] = sum32(this.h[3], d);
  27163. this.h[4] = sum32(this.h[4], e);
  27164. };
  27165. SHA1.prototype._digest = function digest(enc) {
  27166. if (enc === 'hex')
  27167. return utils.toHex32(this.h, 'big');
  27168. else
  27169. return utils.split32(this.h, 'big');
  27170. };
  27171. function ch32(x, y, z) {
  27172. return (x & y) ^ ((~x) & z);
  27173. }
  27174. function maj32(x, y, z) {
  27175. return (x & y) ^ (x & z) ^ (y & z);
  27176. }
  27177. function p32(x, y, z) {
  27178. return x ^ y ^ z;
  27179. }
  27180. function s0_256(x) {
  27181. return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22);
  27182. }
  27183. function s1_256(x) {
  27184. return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25);
  27185. }
  27186. function g0_256(x) {
  27187. return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3);
  27188. }
  27189. function g1_256(x) {
  27190. return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10);
  27191. }
  27192. function ft_1(s, x, y, z) {
  27193. if (s === 0)
  27194. return ch32(x, y, z);
  27195. if (s === 1 || s === 3)
  27196. return p32(x, y, z);
  27197. if (s === 2)
  27198. return maj32(x, y, z);
  27199. }
  27200. function ch64_hi(xh, xl, yh, yl, zh, zl) {
  27201. var r = (xh & yh) ^ ((~xh) & zh);
  27202. if (r < 0)
  27203. r += 0x100000000;
  27204. return r;
  27205. }
  27206. function ch64_lo(xh, xl, yh, yl, zh, zl) {
  27207. var r = (xl & yl) ^ ((~xl) & zl);
  27208. if (r < 0)
  27209. r += 0x100000000;
  27210. return r;
  27211. }
  27212. function maj64_hi(xh, xl, yh, yl, zh, zl) {
  27213. var r = (xh & yh) ^ (xh & zh) ^ (yh & zh);
  27214. if (r < 0)
  27215. r += 0x100000000;
  27216. return r;
  27217. }
  27218. function maj64_lo(xh, xl, yh, yl, zh, zl) {
  27219. var r = (xl & yl) ^ (xl & zl) ^ (yl & zl);
  27220. if (r < 0)
  27221. r += 0x100000000;
  27222. return r;
  27223. }
  27224. function s0_512_hi(xh, xl) {
  27225. var c0_hi = rotr64_hi(xh, xl, 28);
  27226. var c1_hi = rotr64_hi(xl, xh, 2); // 34
  27227. var c2_hi = rotr64_hi(xl, xh, 7); // 39
  27228. var r = c0_hi ^ c1_hi ^ c2_hi;
  27229. if (r < 0)
  27230. r += 0x100000000;
  27231. return r;
  27232. }
  27233. function s0_512_lo(xh, xl) {
  27234. var c0_lo = rotr64_lo(xh, xl, 28);
  27235. var c1_lo = rotr64_lo(xl, xh, 2); // 34
  27236. var c2_lo = rotr64_lo(xl, xh, 7); // 39
  27237. var r = c0_lo ^ c1_lo ^ c2_lo;
  27238. if (r < 0)
  27239. r += 0x100000000;
  27240. return r;
  27241. }
  27242. function s1_512_hi(xh, xl) {
  27243. var c0_hi = rotr64_hi(xh, xl, 14);
  27244. var c1_hi = rotr64_hi(xh, xl, 18);
  27245. var c2_hi = rotr64_hi(xl, xh, 9); // 41
  27246. var r = c0_hi ^ c1_hi ^ c2_hi;
  27247. if (r < 0)
  27248. r += 0x100000000;
  27249. return r;
  27250. }
  27251. function s1_512_lo(xh, xl) {
  27252. var c0_lo = rotr64_lo(xh, xl, 14);
  27253. var c1_lo = rotr64_lo(xh, xl, 18);
  27254. var c2_lo = rotr64_lo(xl, xh, 9); // 41
  27255. var r = c0_lo ^ c1_lo ^ c2_lo;
  27256. if (r < 0)
  27257. r += 0x100000000;
  27258. return r;
  27259. }
  27260. function g0_512_hi(xh, xl) {
  27261. var c0_hi = rotr64_hi(xh, xl, 1);
  27262. var c1_hi = rotr64_hi(xh, xl, 8);
  27263. var c2_hi = shr64_hi(xh, xl, 7);
  27264. var r = c0_hi ^ c1_hi ^ c2_hi;
  27265. if (r < 0)
  27266. r += 0x100000000;
  27267. return r;
  27268. }
  27269. function g0_512_lo(xh, xl) {
  27270. var c0_lo = rotr64_lo(xh, xl, 1);
  27271. var c1_lo = rotr64_lo(xh, xl, 8);
  27272. var c2_lo = shr64_lo(xh, xl, 7);
  27273. var r = c0_lo ^ c1_lo ^ c2_lo;
  27274. if (r < 0)
  27275. r += 0x100000000;
  27276. return r;
  27277. }
  27278. function g1_512_hi(xh, xl) {
  27279. var c0_hi = rotr64_hi(xh, xl, 19);
  27280. var c1_hi = rotr64_hi(xl, xh, 29); // 61
  27281. var c2_hi = shr64_hi(xh, xl, 6);
  27282. var r = c0_hi ^ c1_hi ^ c2_hi;
  27283. if (r < 0)
  27284. r += 0x100000000;
  27285. return r;
  27286. }
  27287. function g1_512_lo(xh, xl) {
  27288. var c0_lo = rotr64_lo(xh, xl, 19);
  27289. var c1_lo = rotr64_lo(xl, xh, 29); // 61
  27290. var c2_lo = shr64_lo(xh, xl, 6);
  27291. var r = c0_lo ^ c1_lo ^ c2_lo;
  27292. if (r < 0)
  27293. r += 0x100000000;
  27294. return r;
  27295. }
  27296. /***/ },
  27297. /* 252 */
  27298. /***/ function(module, exports, __webpack_require__) {
  27299. var utils = exports;
  27300. var inherits = __webpack_require__(1);
  27301. function toArray(msg, enc) {
  27302. if (Array.isArray(msg))
  27303. return msg.slice();
  27304. if (!msg)
  27305. return [];
  27306. var res = [];
  27307. if (typeof msg === 'string') {
  27308. if (!enc) {
  27309. for (var i = 0; i < msg.length; i++) {
  27310. var c = msg.charCodeAt(i);
  27311. var hi = c >> 8;
  27312. var lo = c & 0xff;
  27313. if (hi)
  27314. res.push(hi, lo);
  27315. else
  27316. res.push(lo);
  27317. }
  27318. } else if (enc === 'hex') {
  27319. msg = msg.replace(/[^a-z0-9]+/ig, '');
  27320. if (msg.length % 2 !== 0)
  27321. msg = '0' + msg;
  27322. for (var i = 0; i < msg.length; i += 2)
  27323. res.push(parseInt(msg[i] + msg[i + 1], 16));
  27324. }
  27325. } else {
  27326. for (var i = 0; i < msg.length; i++)
  27327. res[i] = msg[i] | 0;
  27328. }
  27329. return res;
  27330. }
  27331. utils.toArray = toArray;
  27332. function toHex(msg) {
  27333. var res = '';
  27334. for (var i = 0; i < msg.length; i++)
  27335. res += zero2(msg[i].toString(16));
  27336. return res;
  27337. }
  27338. utils.toHex = toHex;
  27339. function htonl(w) {
  27340. var res = (w >>> 24) |
  27341. ((w >>> 8) & 0xff00) |
  27342. ((w << 8) & 0xff0000) |
  27343. ((w & 0xff) << 24);
  27344. return res >>> 0;
  27345. }
  27346. utils.htonl = htonl;
  27347. function toHex32(msg, endian) {
  27348. var res = '';
  27349. for (var i = 0; i < msg.length; i++) {
  27350. var w = msg[i];
  27351. if (endian === 'little')
  27352. w = htonl(w);
  27353. res += zero8(w.toString(16));
  27354. }
  27355. return res;
  27356. }
  27357. utils.toHex32 = toHex32;
  27358. function zero2(word) {
  27359. if (word.length === 1)
  27360. return '0' + word;
  27361. else
  27362. return word;
  27363. }
  27364. utils.zero2 = zero2;
  27365. function zero8(word) {
  27366. if (word.length === 7)
  27367. return '0' + word;
  27368. else if (word.length === 6)
  27369. return '00' + word;
  27370. else if (word.length === 5)
  27371. return '000' + word;
  27372. else if (word.length === 4)
  27373. return '0000' + word;
  27374. else if (word.length === 3)
  27375. return '00000' + word;
  27376. else if (word.length === 2)
  27377. return '000000' + word;
  27378. else if (word.length === 1)
  27379. return '0000000' + word;
  27380. else
  27381. return word;
  27382. }
  27383. utils.zero8 = zero8;
  27384. function join32(msg, start, end, endian) {
  27385. var len = end - start;
  27386. assert(len % 4 === 0);
  27387. var res = new Array(len / 4);
  27388. for (var i = 0, k = start; i < res.length; i++, k += 4) {
  27389. var w;
  27390. if (endian === 'big')
  27391. w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3];
  27392. else
  27393. w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k];
  27394. res[i] = w >>> 0;
  27395. }
  27396. return res;
  27397. }
  27398. utils.join32 = join32;
  27399. function split32(msg, endian) {
  27400. var res = new Array(msg.length * 4);
  27401. for (var i = 0, k = 0; i < msg.length; i++, k += 4) {
  27402. var m = msg[i];
  27403. if (endian === 'big') {
  27404. res[k] = m >>> 24;
  27405. res[k + 1] = (m >>> 16) & 0xff;
  27406. res[k + 2] = (m >>> 8) & 0xff;
  27407. res[k + 3] = m & 0xff;
  27408. } else {
  27409. res[k + 3] = m >>> 24;
  27410. res[k + 2] = (m >>> 16) & 0xff;
  27411. res[k + 1] = (m >>> 8) & 0xff;
  27412. res[k] = m & 0xff;
  27413. }
  27414. }
  27415. return res;
  27416. }
  27417. utils.split32 = split32;
  27418. function rotr32(w, b) {
  27419. return (w >>> b) | (w << (32 - b));
  27420. }
  27421. utils.rotr32 = rotr32;
  27422. function rotl32(w, b) {
  27423. return (w << b) | (w >>> (32 - b));
  27424. }
  27425. utils.rotl32 = rotl32;
  27426. function sum32(a, b) {
  27427. return (a + b) >>> 0;
  27428. }
  27429. utils.sum32 = sum32;
  27430. function sum32_3(a, b, c) {
  27431. return (a + b + c) >>> 0;
  27432. }
  27433. utils.sum32_3 = sum32_3;
  27434. function sum32_4(a, b, c, d) {
  27435. return (a + b + c + d) >>> 0;
  27436. }
  27437. utils.sum32_4 = sum32_4;
  27438. function sum32_5(a, b, c, d, e) {
  27439. return (a + b + c + d + e) >>> 0;
  27440. }
  27441. utils.sum32_5 = sum32_5;
  27442. function assert(cond, msg) {
  27443. if (!cond)
  27444. throw new Error(msg || 'Assertion failed');
  27445. }
  27446. utils.assert = assert;
  27447. utils.inherits = inherits;
  27448. function sum64(buf, pos, ah, al) {
  27449. var bh = buf[pos];
  27450. var bl = buf[pos + 1];
  27451. var lo = (al + bl) >>> 0;
  27452. var hi = (lo < al ? 1 : 0) + ah + bh;
  27453. buf[pos] = hi >>> 0;
  27454. buf[pos + 1] = lo;
  27455. }
  27456. exports.sum64 = sum64;
  27457. function sum64_hi(ah, al, bh, bl) {
  27458. var lo = (al + bl) >>> 0;
  27459. var hi = (lo < al ? 1 : 0) + ah + bh;
  27460. return hi >>> 0;
  27461. };
  27462. exports.sum64_hi = sum64_hi;
  27463. function sum64_lo(ah, al, bh, bl) {
  27464. var lo = al + bl;
  27465. return lo >>> 0;
  27466. };
  27467. exports.sum64_lo = sum64_lo;
  27468. function sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) {
  27469. var carry = 0;
  27470. var lo = al;
  27471. lo = (lo + bl) >>> 0;
  27472. carry += lo < al ? 1 : 0;
  27473. lo = (lo + cl) >>> 0;
  27474. carry += lo < cl ? 1 : 0;
  27475. lo = (lo + dl) >>> 0;
  27476. carry += lo < dl ? 1 : 0;
  27477. var hi = ah + bh + ch + dh + carry;
  27478. return hi >>> 0;
  27479. };
  27480. exports.sum64_4_hi = sum64_4_hi;
  27481. function sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) {
  27482. var lo = al + bl + cl + dl;
  27483. return lo >>> 0;
  27484. };
  27485. exports.sum64_4_lo = sum64_4_lo;
  27486. function sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
  27487. var carry = 0;
  27488. var lo = al;
  27489. lo = (lo + bl) >>> 0;
  27490. carry += lo < al ? 1 : 0;
  27491. lo = (lo + cl) >>> 0;
  27492. carry += lo < cl ? 1 : 0;
  27493. lo = (lo + dl) >>> 0;
  27494. carry += lo < dl ? 1 : 0;
  27495. lo = (lo + el) >>> 0;
  27496. carry += lo < el ? 1 : 0;
  27497. var hi = ah + bh + ch + dh + eh + carry;
  27498. return hi >>> 0;
  27499. };
  27500. exports.sum64_5_hi = sum64_5_hi;
  27501. function sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
  27502. var lo = al + bl + cl + dl + el;
  27503. return lo >>> 0;
  27504. };
  27505. exports.sum64_5_lo = sum64_5_lo;
  27506. function rotr64_hi(ah, al, num) {
  27507. var r = (al << (32 - num)) | (ah >>> num);
  27508. return r >>> 0;
  27509. };
  27510. exports.rotr64_hi = rotr64_hi;
  27511. function rotr64_lo(ah, al, num) {
  27512. var r = (ah << (32 - num)) | (al >>> num);
  27513. return r >>> 0;
  27514. };
  27515. exports.rotr64_lo = rotr64_lo;
  27516. function shr64_hi(ah, al, num) {
  27517. return ah >>> num;
  27518. };
  27519. exports.shr64_hi = shr64_hi;
  27520. function shr64_lo(ah, al, num) {
  27521. var r = (ah << (32 - num)) | (al >>> num);
  27522. return r >>> 0;
  27523. };
  27524. exports.shr64_lo = shr64_lo;
  27525. /***/ },
  27526. /* 253 */
  27527. /***/ function(module, exports) {
  27528. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  27529. var e, m
  27530. var eLen = nBytes * 8 - mLen - 1
  27531. var eMax = (1 << eLen) - 1
  27532. var eBias = eMax >> 1
  27533. var nBits = -7
  27534. var i = isLE ? (nBytes - 1) : 0
  27535. var d = isLE ? -1 : 1
  27536. var s = buffer[offset + i]
  27537. i += d
  27538. e = s & ((1 << (-nBits)) - 1)
  27539. s >>= (-nBits)
  27540. nBits += eLen
  27541. for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {}
  27542. m = e & ((1 << (-nBits)) - 1)
  27543. e >>= (-nBits)
  27544. nBits += mLen
  27545. for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {}
  27546. if (e === 0) {
  27547. e = 1 - eBias
  27548. } else if (e === eMax) {
  27549. return m ? NaN : ((s ? -1 : 1) * Infinity)
  27550. } else {
  27551. m = m + Math.pow(2, mLen)
  27552. e = e - eBias
  27553. }
  27554. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  27555. }
  27556. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  27557. var e, m, c
  27558. var eLen = nBytes * 8 - mLen - 1
  27559. var eMax = (1 << eLen) - 1
  27560. var eBias = eMax >> 1
  27561. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  27562. var i = isLE ? 0 : (nBytes - 1)
  27563. var d = isLE ? 1 : -1
  27564. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  27565. value = Math.abs(value)
  27566. if (isNaN(value) || value === Infinity) {
  27567. m = isNaN(value) ? 1 : 0
  27568. e = eMax
  27569. } else {
  27570. e = Math.floor(Math.log(value) / Math.LN2)
  27571. if (value * (c = Math.pow(2, -e)) < 1) {
  27572. e--
  27573. c *= 2
  27574. }
  27575. if (e + eBias >= 1) {
  27576. value += rt / c
  27577. } else {
  27578. value += rt * Math.pow(2, 1 - eBias)
  27579. }
  27580. if (value * c >= 2) {
  27581. e++
  27582. c /= 2
  27583. }
  27584. if (e + eBias >= eMax) {
  27585. m = 0
  27586. e = eMax
  27587. } else if (e + eBias >= 1) {
  27588. m = (value * c - 1) * Math.pow(2, mLen)
  27589. e = e + eBias
  27590. } else {
  27591. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  27592. e = 0
  27593. }
  27594. }
  27595. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  27596. e = (e << mLen) | m
  27597. eLen += mLen
  27598. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  27599. buffer[offset + i - d] |= s * 128
  27600. }
  27601. /***/ },
  27602. /* 254 */
  27603. /***/ function(module, exports) {
  27604. var indexOf = [].indexOf;
  27605. module.exports = function(arr, obj){
  27606. if (indexOf) return arr.indexOf(obj);
  27607. for (var i = 0; i < arr.length; ++i) {
  27608. if (arr[i] === obj) return i;
  27609. }
  27610. return -1;
  27611. };
  27612. /***/ },
  27613. /* 255 */
  27614. /***/ function(module, exports) {
  27615. module.exports = {
  27616. "modp1": {
  27617. "gen": "02",
  27618. "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"
  27619. },
  27620. "modp2": {
  27621. "gen": "02",
  27622. "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"
  27623. },
  27624. "modp5": {
  27625. "gen": "02",
  27626. "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"
  27627. },
  27628. "modp14": {
  27629. "gen": "02",
  27630. "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"
  27631. },
  27632. "modp15": {
  27633. "gen": "02",
  27634. "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"
  27635. },
  27636. "modp16": {
  27637. "gen": "02",
  27638. "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"
  27639. },
  27640. "modp17": {
  27641. "gen": "02",
  27642. "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"
  27643. },
  27644. "modp18": {
  27645. "gen": "02",
  27646. "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"
  27647. }
  27648. };
  27649. /***/ },
  27650. /* 256 */
  27651. /***/ function(module, exports) {
  27652. module.exports = {
  27653. "_args": [
  27654. [
  27655. {
  27656. "raw": "elliptic@^6.0.0",
  27657. "scope": null,
  27658. "escapedName": "elliptic",
  27659. "name": "elliptic",
  27660. "rawSpec": "^6.0.0",
  27661. "spec": ">=6.0.0 <7.0.0",
  27662. "type": "range"
  27663. },
  27664. "/home/guillaume/workspace/lesspass/pure/node_modules/browserify-sign"
  27665. ]
  27666. ],
  27667. "_from": "elliptic@>=6.0.0 <7.0.0",
  27668. "_id": "elliptic@6.3.2",
  27669. "_inCache": true,
  27670. "_location": "/elliptic",
  27671. "_nodeVersion": "6.3.0",
  27672. "_npmOperationalInternal": {
  27673. "host": "packages-16-east.internal.npmjs.com",
  27674. "tmp": "tmp/elliptic-6.3.2.tgz_1473938837205_0.3108903462998569"
  27675. },
  27676. "_npmUser": {
  27677. "name": "indutny",
  27678. "email": "fedor@indutny.com"
  27679. },
  27680. "_npmVersion": "3.10.3",
  27681. "_phantomChildren": {},
  27682. "_requested": {
  27683. "raw": "elliptic@^6.0.0",
  27684. "scope": null,
  27685. "escapedName": "elliptic",
  27686. "name": "elliptic",
  27687. "rawSpec": "^6.0.0",
  27688. "spec": ">=6.0.0 <7.0.0",
  27689. "type": "range"
  27690. },
  27691. "_requiredBy": [
  27692. "/browserify-sign",
  27693. "/create-ecdh"
  27694. ],
  27695. "_resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.3.2.tgz",
  27696. "_shasum": "e4c81e0829cf0a65ab70e998b8232723b5c1bc48",
  27697. "_shrinkwrap": null,
  27698. "_spec": "elliptic@^6.0.0",
  27699. "_where": "/home/guillaume/workspace/lesspass/pure/node_modules/browserify-sign",
  27700. "author": {
  27701. "name": "Fedor Indutny",
  27702. "email": "fedor@indutny.com"
  27703. },
  27704. "bugs": {
  27705. "url": "https://github.com/indutny/elliptic/issues"
  27706. },
  27707. "dependencies": {
  27708. "bn.js": "^4.4.0",
  27709. "brorand": "^1.0.1",
  27710. "hash.js": "^1.0.0",
  27711. "inherits": "^2.0.1"
  27712. },
  27713. "description": "EC cryptography",
  27714. "devDependencies": {
  27715. "brfs": "^1.4.3",
  27716. "coveralls": "^2.11.3",
  27717. "grunt": "^0.4.5",
  27718. "grunt-browserify": "^5.0.0",
  27719. "grunt-contrib-connect": "^1.0.0",
  27720. "grunt-contrib-copy": "^1.0.0",
  27721. "grunt-contrib-uglify": "^1.0.1",
  27722. "grunt-mocha-istanbul": "^3.0.1",
  27723. "grunt-saucelabs": "^8.6.2",
  27724. "istanbul": "^0.4.2",
  27725. "jscs": "^2.9.0",
  27726. "jshint": "^2.6.0",
  27727. "mocha": "^2.1.0"
  27728. },
  27729. "directories": {},
  27730. "dist": {
  27731. "shasum": "e4c81e0829cf0a65ab70e998b8232723b5c1bc48",
  27732. "tarball": "https://registry.npmjs.org/elliptic/-/elliptic-6.3.2.tgz"
  27733. },
  27734. "files": [
  27735. "lib"
  27736. ],
  27737. "gitHead": "cbace4683a4a548dc0306ef36756151a20299cd5",
  27738. "homepage": "https://github.com/indutny/elliptic",
  27739. "keywords": [
  27740. "EC",
  27741. "Elliptic",
  27742. "curve",
  27743. "Cryptography"
  27744. ],
  27745. "license": "MIT",
  27746. "main": "lib/elliptic.js",
  27747. "maintainers": [
  27748. {
  27749. "name": "indutny",
  27750. "email": "fedor@indutny.com"
  27751. }
  27752. ],
  27753. "name": "elliptic",
  27754. "optionalDependencies": {},
  27755. "readme": "ERROR: No README data found!",
  27756. "repository": {
  27757. "type": "git",
  27758. "url": "git+ssh://git@github.com/indutny/elliptic.git"
  27759. },
  27760. "scripts": {
  27761. "jscs": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",
  27762. "jshint": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",
  27763. "lint": "npm run jscs && npm run jshint",
  27764. "test": "npm run lint && npm run unit",
  27765. "unit": "istanbul test _mocha --reporter=spec test/index.js",
  27766. "version": "grunt dist && git add dist/"
  27767. },
  27768. "version": "6.3.2"
  27769. };
  27770. /***/ },
  27771. /* 257 */
  27772. /***/ function(module, exports) {
  27773. module.exports = {
  27774. "2.16.840.1.101.3.4.1.1": "aes-128-ecb",
  27775. "2.16.840.1.101.3.4.1.2": "aes-128-cbc",
  27776. "2.16.840.1.101.3.4.1.3": "aes-128-ofb",
  27777. "2.16.840.1.101.3.4.1.4": "aes-128-cfb",
  27778. "2.16.840.1.101.3.4.1.21": "aes-192-ecb",
  27779. "2.16.840.1.101.3.4.1.22": "aes-192-cbc",
  27780. "2.16.840.1.101.3.4.1.23": "aes-192-ofb",
  27781. "2.16.840.1.101.3.4.1.24": "aes-192-cfb",
  27782. "2.16.840.1.101.3.4.1.41": "aes-256-ecb",
  27783. "2.16.840.1.101.3.4.1.42": "aes-256-cbc",
  27784. "2.16.840.1.101.3.4.1.43": "aes-256-ofb",
  27785. "2.16.840.1.101.3.4.1.44": "aes-256-cfb"
  27786. };
  27787. /***/ },
  27788. /* 258 */
  27789. /***/ function(module, exports) {
  27790. /**
  27791. * The code was extracted from:
  27792. * https://github.com/davidchambers/Base64.js
  27793. */
  27794. var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
  27795. function InvalidCharacterError(message) {
  27796. this.message = message;
  27797. }
  27798. InvalidCharacterError.prototype = new Error();
  27799. InvalidCharacterError.prototype.name = 'InvalidCharacterError';
  27800. function polyfill (input) {
  27801. var str = String(input).replace(/=+$/, '');
  27802. if (str.length % 4 == 1) {
  27803. throw new InvalidCharacterError("'atob' failed: The string to be decoded is not correctly encoded.");
  27804. }
  27805. for (
  27806. // initialize result and counters
  27807. var bc = 0, bs, buffer, idx = 0, output = '';
  27808. // get next character
  27809. buffer = str.charAt(idx++);
  27810. // character found in table? initialize bit storage and add its ascii value;
  27811. ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer,
  27812. // and if not first of each 4 characters,
  27813. // convert the first 8 bits to one ascii character
  27814. bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0
  27815. ) {
  27816. // try to find character in table (0-63, not found => -1)
  27817. buffer = chars.indexOf(buffer);
  27818. }
  27819. return output;
  27820. }
  27821. module.exports = typeof window !== 'undefined' && window.atob && window.atob.bind(window) || polyfill;
  27822. /***/ },
  27823. /* 259 */
  27824. /***/ function(module, exports, __webpack_require__) {
  27825. var atob = __webpack_require__(258);
  27826. function b64DecodeUnicode(str) {
  27827. return decodeURIComponent(atob(str).replace(/(.)/g, function (m, p) {
  27828. var code = p.charCodeAt(0).toString(16).toUpperCase();
  27829. if (code.length < 2) {
  27830. code = '0' + code;
  27831. }
  27832. return '%' + code;
  27833. }));
  27834. }
  27835. module.exports = function(str) {
  27836. var output = str.replace(/-/g, "+").replace(/_/g, "/");
  27837. switch (output.length % 4) {
  27838. case 0:
  27839. break;
  27840. case 2:
  27841. output += "==";
  27842. break;
  27843. case 3:
  27844. output += "=";
  27845. break;
  27846. default:
  27847. throw "Illegal base64url string!";
  27848. }
  27849. try{
  27850. return b64DecodeUnicode(output);
  27851. } catch (err) {
  27852. return atob(output);
  27853. }
  27854. };
  27855. /***/ },
  27856. /* 260 */
  27857. /***/ function(module, exports, __webpack_require__) {
  27858. "use strict";
  27859. 'use strict';
  27860. var base64_url_decode = __webpack_require__(259);
  27861. module.exports = function (token,options) {
  27862. if (typeof token !== 'string') {
  27863. throw new Error('Invalid token specified');
  27864. }
  27865. options = options || {};
  27866. var pos = options.header === true ? 0 : 1;
  27867. return JSON.parse(base64_url_decode(token.split('.')[pos]));
  27868. };
  27869. /***/ },
  27870. /* 261 */
  27871. /***/ function(module, exports, __webpack_require__) {
  27872. /* WEBPACK VAR INJECTION */(function(global) {/**
  27873. * lodash (Custom Build) <https://lodash.com/>
  27874. * Build: `lodash modularize exports="npm" -o ./`
  27875. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  27876. * Released under MIT license <https://lodash.com/license>
  27877. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  27878. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  27879. */
  27880. /** Used as the `TypeError` message for "Functions" methods. */
  27881. var FUNC_ERROR_TEXT = 'Expected a function';
  27882. /** Used as references for various `Number` constants. */
  27883. var NAN = 0 / 0;
  27884. /** `Object#toString` result references. */
  27885. var symbolTag = '[object Symbol]';
  27886. /** Used to match leading and trailing whitespace. */
  27887. var reTrim = /^\s+|\s+$/g;
  27888. /** Used to detect bad signed hexadecimal string values. */
  27889. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  27890. /** Used to detect binary string values. */
  27891. var reIsBinary = /^0b[01]+$/i;
  27892. /** Used to detect octal string values. */
  27893. var reIsOctal = /^0o[0-7]+$/i;
  27894. /** Built-in method references without a dependency on `root`. */
  27895. var freeParseInt = parseInt;
  27896. /** Detect free variable `global` from Node.js. */
  27897. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  27898. /** Detect free variable `self`. */
  27899. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  27900. /** Used as a reference to the global object. */
  27901. var root = freeGlobal || freeSelf || Function('return this')();
  27902. /** Used for built-in method references. */
  27903. var objectProto = Object.prototype;
  27904. /**
  27905. * Used to resolve the
  27906. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  27907. * of values.
  27908. */
  27909. var objectToString = objectProto.toString;
  27910. /* Built-in method references for those with the same name as other `lodash` methods. */
  27911. var nativeMax = Math.max,
  27912. nativeMin = Math.min;
  27913. /**
  27914. * Gets the timestamp of the number of milliseconds that have elapsed since
  27915. * the Unix epoch (1 January 1970 00:00:00 UTC).
  27916. *
  27917. * @static
  27918. * @memberOf _
  27919. * @since 2.4.0
  27920. * @category Date
  27921. * @returns {number} Returns the timestamp.
  27922. * @example
  27923. *
  27924. * _.defer(function(stamp) {
  27925. * console.log(_.now() - stamp);
  27926. * }, _.now());
  27927. * // => Logs the number of milliseconds it took for the deferred invocation.
  27928. */
  27929. var now = function() {
  27930. return root.Date.now();
  27931. };
  27932. /**
  27933. * Creates a debounced function that delays invoking `func` until after `wait`
  27934. * milliseconds have elapsed since the last time the debounced function was
  27935. * invoked. The debounced function comes with a `cancel` method to cancel
  27936. * delayed `func` invocations and a `flush` method to immediately invoke them.
  27937. * Provide `options` to indicate whether `func` should be invoked on the
  27938. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  27939. * with the last arguments provided to the debounced function. Subsequent
  27940. * calls to the debounced function return the result of the last `func`
  27941. * invocation.
  27942. *
  27943. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  27944. * invoked on the trailing edge of the timeout only if the debounced function
  27945. * is invoked more than once during the `wait` timeout.
  27946. *
  27947. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  27948. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  27949. *
  27950. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  27951. * for details over the differences between `_.debounce` and `_.throttle`.
  27952. *
  27953. * @static
  27954. * @memberOf _
  27955. * @since 0.1.0
  27956. * @category Function
  27957. * @param {Function} func The function to debounce.
  27958. * @param {number} [wait=0] The number of milliseconds to delay.
  27959. * @param {Object} [options={}] The options object.
  27960. * @param {boolean} [options.leading=false]
  27961. * Specify invoking on the leading edge of the timeout.
  27962. * @param {number} [options.maxWait]
  27963. * The maximum time `func` is allowed to be delayed before it's invoked.
  27964. * @param {boolean} [options.trailing=true]
  27965. * Specify invoking on the trailing edge of the timeout.
  27966. * @returns {Function} Returns the new debounced function.
  27967. * @example
  27968. *
  27969. * // Avoid costly calculations while the window size is in flux.
  27970. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  27971. *
  27972. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  27973. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  27974. * 'leading': true,
  27975. * 'trailing': false
  27976. * }));
  27977. *
  27978. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  27979. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  27980. * var source = new EventSource('/stream');
  27981. * jQuery(source).on('message', debounced);
  27982. *
  27983. * // Cancel the trailing debounced invocation.
  27984. * jQuery(window).on('popstate', debounced.cancel);
  27985. */
  27986. function debounce(func, wait, options) {
  27987. var lastArgs,
  27988. lastThis,
  27989. maxWait,
  27990. result,
  27991. timerId,
  27992. lastCallTime,
  27993. lastInvokeTime = 0,
  27994. leading = false,
  27995. maxing = false,
  27996. trailing = true;
  27997. if (typeof func != 'function') {
  27998. throw new TypeError(FUNC_ERROR_TEXT);
  27999. }
  28000. wait = toNumber(wait) || 0;
  28001. if (isObject(options)) {
  28002. leading = !!options.leading;
  28003. maxing = 'maxWait' in options;
  28004. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  28005. trailing = 'trailing' in options ? !!options.trailing : trailing;
  28006. }
  28007. function invokeFunc(time) {
  28008. var args = lastArgs,
  28009. thisArg = lastThis;
  28010. lastArgs = lastThis = undefined;
  28011. lastInvokeTime = time;
  28012. result = func.apply(thisArg, args);
  28013. return result;
  28014. }
  28015. function leadingEdge(time) {
  28016. // Reset any `maxWait` timer.
  28017. lastInvokeTime = time;
  28018. // Start the timer for the trailing edge.
  28019. timerId = setTimeout(timerExpired, wait);
  28020. // Invoke the leading edge.
  28021. return leading ? invokeFunc(time) : result;
  28022. }
  28023. function remainingWait(time) {
  28024. var timeSinceLastCall = time - lastCallTime,
  28025. timeSinceLastInvoke = time - lastInvokeTime,
  28026. result = wait - timeSinceLastCall;
  28027. return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
  28028. }
  28029. function shouldInvoke(time) {
  28030. var timeSinceLastCall = time - lastCallTime,
  28031. timeSinceLastInvoke = time - lastInvokeTime;
  28032. // Either this is the first call, activity has stopped and we're at the
  28033. // trailing edge, the system time has gone backwards and we're treating
  28034. // it as the trailing edge, or we've hit the `maxWait` limit.
  28035. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  28036. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  28037. }
  28038. function timerExpired() {
  28039. var time = now();
  28040. if (shouldInvoke(time)) {
  28041. return trailingEdge(time);
  28042. }
  28043. // Restart the timer.
  28044. timerId = setTimeout(timerExpired, remainingWait(time));
  28045. }
  28046. function trailingEdge(time) {
  28047. timerId = undefined;
  28048. // Only invoke if we have `lastArgs` which means `func` has been
  28049. // debounced at least once.
  28050. if (trailing && lastArgs) {
  28051. return invokeFunc(time);
  28052. }
  28053. lastArgs = lastThis = undefined;
  28054. return result;
  28055. }
  28056. function cancel() {
  28057. if (timerId !== undefined) {
  28058. clearTimeout(timerId);
  28059. }
  28060. lastInvokeTime = 0;
  28061. lastArgs = lastCallTime = lastThis = timerId = undefined;
  28062. }
  28063. function flush() {
  28064. return timerId === undefined ? result : trailingEdge(now());
  28065. }
  28066. function debounced() {
  28067. var time = now(),
  28068. isInvoking = shouldInvoke(time);
  28069. lastArgs = arguments;
  28070. lastThis = this;
  28071. lastCallTime = time;
  28072. if (isInvoking) {
  28073. if (timerId === undefined) {
  28074. return leadingEdge(lastCallTime);
  28075. }
  28076. if (maxing) {
  28077. // Handle invocations in a tight loop.
  28078. timerId = setTimeout(timerExpired, wait);
  28079. return invokeFunc(lastCallTime);
  28080. }
  28081. }
  28082. if (timerId === undefined) {
  28083. timerId = setTimeout(timerExpired, wait);
  28084. }
  28085. return result;
  28086. }
  28087. debounced.cancel = cancel;
  28088. debounced.flush = flush;
  28089. return debounced;
  28090. }
  28091. /**
  28092. * Checks if `value` is the
  28093. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  28094. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  28095. *
  28096. * @static
  28097. * @memberOf _
  28098. * @since 0.1.0
  28099. * @category Lang
  28100. * @param {*} value The value to check.
  28101. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  28102. * @example
  28103. *
  28104. * _.isObject({});
  28105. * // => true
  28106. *
  28107. * _.isObject([1, 2, 3]);
  28108. * // => true
  28109. *
  28110. * _.isObject(_.noop);
  28111. * // => true
  28112. *
  28113. * _.isObject(null);
  28114. * // => false
  28115. */
  28116. function isObject(value) {
  28117. var type = typeof value;
  28118. return !!value && (type == 'object' || type == 'function');
  28119. }
  28120. /**
  28121. * Checks if `value` is object-like. A value is object-like if it's not `null`
  28122. * and has a `typeof` result of "object".
  28123. *
  28124. * @static
  28125. * @memberOf _
  28126. * @since 4.0.0
  28127. * @category Lang
  28128. * @param {*} value The value to check.
  28129. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  28130. * @example
  28131. *
  28132. * _.isObjectLike({});
  28133. * // => true
  28134. *
  28135. * _.isObjectLike([1, 2, 3]);
  28136. * // => true
  28137. *
  28138. * _.isObjectLike(_.noop);
  28139. * // => false
  28140. *
  28141. * _.isObjectLike(null);
  28142. * // => false
  28143. */
  28144. function isObjectLike(value) {
  28145. return !!value && typeof value == 'object';
  28146. }
  28147. /**
  28148. * Checks if `value` is classified as a `Symbol` primitive or object.
  28149. *
  28150. * @static
  28151. * @memberOf _
  28152. * @since 4.0.0
  28153. * @category Lang
  28154. * @param {*} value The value to check.
  28155. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  28156. * @example
  28157. *
  28158. * _.isSymbol(Symbol.iterator);
  28159. * // => true
  28160. *
  28161. * _.isSymbol('abc');
  28162. * // => false
  28163. */
  28164. function isSymbol(value) {
  28165. return typeof value == 'symbol' ||
  28166. (isObjectLike(value) && objectToString.call(value) == symbolTag);
  28167. }
  28168. /**
  28169. * Converts `value` to a number.
  28170. *
  28171. * @static
  28172. * @memberOf _
  28173. * @since 4.0.0
  28174. * @category Lang
  28175. * @param {*} value The value to process.
  28176. * @returns {number} Returns the number.
  28177. * @example
  28178. *
  28179. * _.toNumber(3.2);
  28180. * // => 3.2
  28181. *
  28182. * _.toNumber(Number.MIN_VALUE);
  28183. * // => 5e-324
  28184. *
  28185. * _.toNumber(Infinity);
  28186. * // => Infinity
  28187. *
  28188. * _.toNumber('3.2');
  28189. * // => 3.2
  28190. */
  28191. function toNumber(value) {
  28192. if (typeof value == 'number') {
  28193. return value;
  28194. }
  28195. if (isSymbol(value)) {
  28196. return NAN;
  28197. }
  28198. if (isObject(value)) {
  28199. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  28200. value = isObject(other) ? (other + '') : other;
  28201. }
  28202. if (typeof value != 'string') {
  28203. return value === 0 ? value : +value;
  28204. }
  28205. value = value.replace(reTrim, '');
  28206. var isBinary = reIsBinary.test(value);
  28207. return (isBinary || reIsOctal.test(value))
  28208. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  28209. : (reIsBadHex.test(value) ? NAN : +value);
  28210. }
  28211. module.exports = debounce;
  28212. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(32)))
  28213. /***/ },
  28214. /* 262 */
  28215. /***/ function(module, exports, __webpack_require__) {
  28216. // from https://github.com/indutny/self-signed/blob/gh-pages/lib/asn1.js
  28217. // Fedor, you are amazing.
  28218. var asn1 = __webpack_require__(33)
  28219. var RSAPrivateKey = asn1.define('RSAPrivateKey', function () {
  28220. this.seq().obj(
  28221. this.key('version').int(),
  28222. this.key('modulus').int(),
  28223. this.key('publicExponent').int(),
  28224. this.key('privateExponent').int(),
  28225. this.key('prime1').int(),
  28226. this.key('prime2').int(),
  28227. this.key('exponent1').int(),
  28228. this.key('exponent2').int(),
  28229. this.key('coefficient').int()
  28230. )
  28231. })
  28232. exports.RSAPrivateKey = RSAPrivateKey
  28233. var RSAPublicKey = asn1.define('RSAPublicKey', function () {
  28234. this.seq().obj(
  28235. this.key('modulus').int(),
  28236. this.key('publicExponent').int()
  28237. )
  28238. })
  28239. exports.RSAPublicKey = RSAPublicKey
  28240. var PublicKey = asn1.define('SubjectPublicKeyInfo', function () {
  28241. this.seq().obj(
  28242. this.key('algorithm').use(AlgorithmIdentifier),
  28243. this.key('subjectPublicKey').bitstr()
  28244. )
  28245. })
  28246. exports.PublicKey = PublicKey
  28247. var AlgorithmIdentifier = asn1.define('AlgorithmIdentifier', function () {
  28248. this.seq().obj(
  28249. this.key('algorithm').objid(),
  28250. this.key('none').null_().optional(),
  28251. this.key('curve').objid().optional(),
  28252. this.key('params').seq().obj(
  28253. this.key('p').int(),
  28254. this.key('q').int(),
  28255. this.key('g').int()
  28256. ).optional()
  28257. )
  28258. })
  28259. var PrivateKeyInfo = asn1.define('PrivateKeyInfo', function () {
  28260. this.seq().obj(
  28261. this.key('version').int(),
  28262. this.key('algorithm').use(AlgorithmIdentifier),
  28263. this.key('subjectPrivateKey').octstr()
  28264. )
  28265. })
  28266. exports.PrivateKey = PrivateKeyInfo
  28267. var EncryptedPrivateKeyInfo = asn1.define('EncryptedPrivateKeyInfo', function () {
  28268. this.seq().obj(
  28269. this.key('algorithm').seq().obj(
  28270. this.key('id').objid(),
  28271. this.key('decrypt').seq().obj(
  28272. this.key('kde').seq().obj(
  28273. this.key('id').objid(),
  28274. this.key('kdeparams').seq().obj(
  28275. this.key('salt').octstr(),
  28276. this.key('iters').int()
  28277. )
  28278. ),
  28279. this.key('cipher').seq().obj(
  28280. this.key('algo').objid(),
  28281. this.key('iv').octstr()
  28282. )
  28283. )
  28284. ),
  28285. this.key('subjectPrivateKey').octstr()
  28286. )
  28287. })
  28288. exports.EncryptedPrivateKey = EncryptedPrivateKeyInfo
  28289. var DSAPrivateKey = asn1.define('DSAPrivateKey', function () {
  28290. this.seq().obj(
  28291. this.key('version').int(),
  28292. this.key('p').int(),
  28293. this.key('q').int(),
  28294. this.key('g').int(),
  28295. this.key('pub_key').int(),
  28296. this.key('priv_key').int()
  28297. )
  28298. })
  28299. exports.DSAPrivateKey = DSAPrivateKey
  28300. exports.DSAparam = asn1.define('DSAparam', function () {
  28301. this.int()
  28302. })
  28303. var ECPrivateKey = asn1.define('ECPrivateKey', function () {
  28304. this.seq().obj(
  28305. this.key('version').int(),
  28306. this.key('privateKey').octstr(),
  28307. this.key('parameters').optional().explicit(0).use(ECParameters),
  28308. this.key('publicKey').optional().explicit(1).bitstr()
  28309. )
  28310. })
  28311. exports.ECPrivateKey = ECPrivateKey
  28312. var ECParameters = asn1.define('ECParameters', function () {
  28313. this.choice({
  28314. namedCurve: this.objid()
  28315. })
  28316. })
  28317. exports.signature = asn1.define('signature', function () {
  28318. this.seq().obj(
  28319. this.key('r').int(),
  28320. this.key('s').int()
  28321. )
  28322. })
  28323. /***/ },
  28324. /* 263 */
  28325. /***/ function(module, exports, __webpack_require__) {
  28326. /* WEBPACK VAR INJECTION */(function(Buffer) {// adapted from https://github.com/apatil/pemstrip
  28327. var findProc = /Proc-Type: 4,ENCRYPTED\r?\nDEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)\r?\n\r?\n([0-9A-z\n\r\+\/\=]+)\r?\n/m
  28328. var startRegex = /^-----BEGIN (.*) KEY-----\r?\n/m
  28329. var fullRegex = /^-----BEGIN (.*) KEY-----\r?\n([0-9A-z\n\r\+\/\=]+)\r?\n-----END \1 KEY-----$/m
  28330. var evp = __webpack_require__(45)
  28331. var ciphers = __webpack_require__(49)
  28332. module.exports = function (okey, password) {
  28333. var key = okey.toString()
  28334. var match = key.match(findProc)
  28335. var decrypted
  28336. if (!match) {
  28337. var match2 = key.match(fullRegex)
  28338. decrypted = new Buffer(match2[2].replace(/\r?\n/g, ''), 'base64')
  28339. } else {
  28340. var suite = 'aes' + match[1]
  28341. var iv = new Buffer(match[2], 'hex')
  28342. var cipherText = new Buffer(match[3].replace(/\r?\n/g, ''), 'base64')
  28343. var cipherKey = evp(password, iv.slice(0, 8), parseInt(match[1], 10)).key
  28344. var out = []
  28345. var cipher = ciphers.createDecipheriv(suite, cipherKey, iv)
  28346. out.push(cipher.update(cipherText))
  28347. out.push(cipher.final())
  28348. decrypted = Buffer.concat(out)
  28349. }
  28350. var tag = key.match(startRegex)[1] + ' KEY'
  28351. return {
  28352. tag: tag,
  28353. data: decrypted
  28354. }
  28355. }
  28356. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  28357. /***/ },
  28358. /* 264 */
  28359. /***/ function(module, exports) {
  28360. var MAX_ALLOC = Math.pow(2, 30) - 1 // default in iojs
  28361. module.exports = function (iterations, keylen) {
  28362. if (typeof iterations !== 'number') {
  28363. throw new TypeError('Iterations not a number')
  28364. }
  28365. if (iterations < 0) {
  28366. throw new TypeError('Bad iterations')
  28367. }
  28368. if (typeof keylen !== 'number') {
  28369. throw new TypeError('Key length not a number')
  28370. }
  28371. if (keylen < 0 || keylen > MAX_ALLOC || keylen !== keylen) { /* eslint no-self-compare: 0 */
  28372. throw new TypeError('Bad key length')
  28373. }
  28374. }
  28375. /***/ },
  28376. /* 265 */
  28377. /***/ function(module, exports, __webpack_require__) {
  28378. exports.publicEncrypt = __webpack_require__(267);
  28379. exports.privateDecrypt = __webpack_require__(266);
  28380. exports.privateEncrypt = function privateEncrypt(key, buf) {
  28381. return exports.publicEncrypt(key, buf, true);
  28382. };
  28383. exports.publicDecrypt = function publicDecrypt(key, buf) {
  28384. return exports.privateDecrypt(key, buf, true);
  28385. };
  28386. /***/ },
  28387. /* 266 */
  28388. /***/ function(module, exports, __webpack_require__) {
  28389. /* WEBPACK VAR INJECTION */(function(Buffer) {var parseKeys = __webpack_require__(46);
  28390. var mgf = __webpack_require__(111);
  28391. var xor = __webpack_require__(113);
  28392. var bn = __webpack_require__(2);
  28393. var crt = __webpack_require__(50);
  28394. var createHash = __webpack_require__(16);
  28395. var withPublic = __webpack_require__(112);
  28396. module.exports = function privateDecrypt(private_key, enc, reverse) {
  28397. var padding;
  28398. if (private_key.padding) {
  28399. padding = private_key.padding;
  28400. } else if (reverse) {
  28401. padding = 1;
  28402. } else {
  28403. padding = 4;
  28404. }
  28405. var key = parseKeys(private_key);
  28406. var k = key.modulus.byteLength();
  28407. if (enc.length > k || new bn(enc).cmp(key.modulus) >= 0) {
  28408. throw new Error('decryption error');
  28409. }
  28410. var msg;
  28411. if (reverse) {
  28412. msg = withPublic(new bn(enc), key);
  28413. } else {
  28414. msg = crt(enc, key);
  28415. }
  28416. var zBuffer = new Buffer(k - msg.length);
  28417. zBuffer.fill(0);
  28418. msg = Buffer.concat([zBuffer, msg], k);
  28419. if (padding === 4) {
  28420. return oaep(key, msg);
  28421. } else if (padding === 1) {
  28422. return pkcs1(key, msg, reverse);
  28423. } else if (padding === 3) {
  28424. return msg;
  28425. } else {
  28426. throw new Error('unknown padding');
  28427. }
  28428. };
  28429. function oaep(key, msg){
  28430. var n = key.modulus;
  28431. var k = key.modulus.byteLength();
  28432. var mLen = msg.length;
  28433. var iHash = createHash('sha1').update(new Buffer('')).digest();
  28434. var hLen = iHash.length;
  28435. var hLen2 = 2 * hLen;
  28436. if (msg[0] !== 0) {
  28437. throw new Error('decryption error');
  28438. }
  28439. var maskedSeed = msg.slice(1, hLen + 1);
  28440. var maskedDb = msg.slice(hLen + 1);
  28441. var seed = xor(maskedSeed, mgf(maskedDb, hLen));
  28442. var db = xor(maskedDb, mgf(seed, k - hLen - 1));
  28443. if (compare(iHash, db.slice(0, hLen))) {
  28444. throw new Error('decryption error');
  28445. }
  28446. var i = hLen;
  28447. while (db[i] === 0) {
  28448. i++;
  28449. }
  28450. if (db[i++] !== 1) {
  28451. throw new Error('decryption error');
  28452. }
  28453. return db.slice(i);
  28454. }
  28455. function pkcs1(key, msg, reverse){
  28456. var p1 = msg.slice(0, 2);
  28457. var i = 2;
  28458. var status = 0;
  28459. while (msg[i++] !== 0) {
  28460. if (i >= msg.length) {
  28461. status++;
  28462. break;
  28463. }
  28464. }
  28465. var ps = msg.slice(2, i - 1);
  28466. var p2 = msg.slice(i - 1, i);
  28467. if ((p1.toString('hex') !== '0002' && !reverse) || (p1.toString('hex') !== '0001' && reverse)){
  28468. status++;
  28469. }
  28470. if (ps.length < 8) {
  28471. status++;
  28472. }
  28473. if (status) {
  28474. throw new Error('decryption error');
  28475. }
  28476. return msg.slice(i);
  28477. }
  28478. function compare(a, b){
  28479. a = new Buffer(a);
  28480. b = new Buffer(b);
  28481. var dif = 0;
  28482. var len = a.length;
  28483. if (a.length !== b.length) {
  28484. dif++;
  28485. len = Math.min(a.length, b.length);
  28486. }
  28487. var i = -1;
  28488. while (++i < len) {
  28489. dif += (a[i] ^ b[i]);
  28490. }
  28491. return dif;
  28492. }
  28493. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  28494. /***/ },
  28495. /* 267 */
  28496. /***/ function(module, exports, __webpack_require__) {
  28497. /* WEBPACK VAR INJECTION */(function(Buffer) {var parseKeys = __webpack_require__(46);
  28498. var randomBytes = __webpack_require__(31);
  28499. var createHash = __webpack_require__(16);
  28500. var mgf = __webpack_require__(111);
  28501. var xor = __webpack_require__(113);
  28502. var bn = __webpack_require__(2);
  28503. var withPublic = __webpack_require__(112);
  28504. var crt = __webpack_require__(50);
  28505. var constants = {
  28506. RSA_PKCS1_OAEP_PADDING: 4,
  28507. RSA_PKCS1_PADDIN: 1,
  28508. RSA_NO_PADDING: 3
  28509. };
  28510. module.exports = function publicEncrypt(public_key, msg, reverse) {
  28511. var padding;
  28512. if (public_key.padding) {
  28513. padding = public_key.padding;
  28514. } else if (reverse) {
  28515. padding = 1;
  28516. } else {
  28517. padding = 4;
  28518. }
  28519. var key = parseKeys(public_key);
  28520. var paddedMsg;
  28521. if (padding === 4) {
  28522. paddedMsg = oaep(key, msg);
  28523. } else if (padding === 1) {
  28524. paddedMsg = pkcs1(key, msg, reverse);
  28525. } else if (padding === 3) {
  28526. paddedMsg = new bn(msg);
  28527. if (paddedMsg.cmp(key.modulus) >= 0) {
  28528. throw new Error('data too long for modulus');
  28529. }
  28530. } else {
  28531. throw new Error('unknown padding');
  28532. }
  28533. if (reverse) {
  28534. return crt(paddedMsg, key);
  28535. } else {
  28536. return withPublic(paddedMsg, key);
  28537. }
  28538. };
  28539. function oaep(key, msg){
  28540. var k = key.modulus.byteLength();
  28541. var mLen = msg.length;
  28542. var iHash = createHash('sha1').update(new Buffer('')).digest();
  28543. var hLen = iHash.length;
  28544. var hLen2 = 2 * hLen;
  28545. if (mLen > k - hLen2 - 2) {
  28546. throw new Error('message too long');
  28547. }
  28548. var ps = new Buffer(k - mLen - hLen2 - 2);
  28549. ps.fill(0);
  28550. var dblen = k - hLen - 1;
  28551. var seed = randomBytes(hLen);
  28552. var maskedDb = xor(Buffer.concat([iHash, ps, new Buffer([1]), msg], dblen), mgf(seed, dblen));
  28553. var maskedSeed = xor(seed, mgf(maskedDb, hLen));
  28554. return new bn(Buffer.concat([new Buffer([0]), maskedSeed, maskedDb], k));
  28555. }
  28556. function pkcs1(key, msg, reverse){
  28557. var mLen = msg.length;
  28558. var k = key.modulus.byteLength();
  28559. if (mLen > k - 11) {
  28560. throw new Error('message too long');
  28561. }
  28562. var ps;
  28563. if (reverse) {
  28564. ps = new Buffer(k - mLen - 3);
  28565. ps.fill(0xff);
  28566. } else {
  28567. ps = nonZero(k - mLen - 3);
  28568. }
  28569. return new bn(Buffer.concat([new Buffer([0, reverse?1:2]), ps, new Buffer([0]), msg], k));
  28570. }
  28571. function nonZero(len, crypto) {
  28572. var out = new Buffer(len);
  28573. var i = 0;
  28574. var cache = randomBytes(len*2);
  28575. var cur = 0;
  28576. var num;
  28577. while (i < len) {
  28578. if (cur === cache.length) {
  28579. cache = randomBytes(len*2);
  28580. cur = 0;
  28581. }
  28582. num = cache[cur++];
  28583. if (num) {
  28584. out[i++] = num;
  28585. }
  28586. }
  28587. return out;
  28588. }
  28589. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  28590. /***/ },
  28591. /* 268 */
  28592. /***/ function(module, exports, __webpack_require__) {
  28593. module.exports = __webpack_require__(10)
  28594. /***/ },
  28595. /* 269 */
  28596. /***/ function(module, exports, __webpack_require__) {
  28597. "use strict";
  28598. 'use strict';
  28599. var Buffer = __webpack_require__(0).Buffer;
  28600. /*<replacement>*/
  28601. var bufferShim = __webpack_require__(51);
  28602. /*</replacement>*/
  28603. module.exports = BufferList;
  28604. function BufferList() {
  28605. this.head = null;
  28606. this.tail = null;
  28607. this.length = 0;
  28608. }
  28609. BufferList.prototype.push = function (v) {
  28610. var entry = { data: v, next: null };
  28611. if (this.length > 0) this.tail.next = entry;else this.head = entry;
  28612. this.tail = entry;
  28613. ++this.length;
  28614. };
  28615. BufferList.prototype.unshift = function (v) {
  28616. var entry = { data: v, next: this.head };
  28617. if (this.length === 0) this.tail = entry;
  28618. this.head = entry;
  28619. ++this.length;
  28620. };
  28621. BufferList.prototype.shift = function () {
  28622. if (this.length === 0) return;
  28623. var ret = this.head.data;
  28624. if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
  28625. --this.length;
  28626. return ret;
  28627. };
  28628. BufferList.prototype.clear = function () {
  28629. this.head = this.tail = null;
  28630. this.length = 0;
  28631. };
  28632. BufferList.prototype.join = function (s) {
  28633. if (this.length === 0) return '';
  28634. var p = this.head;
  28635. var ret = '' + p.data;
  28636. while (p = p.next) {
  28637. ret += s + p.data;
  28638. }return ret;
  28639. };
  28640. BufferList.prototype.concat = function (n) {
  28641. if (this.length === 0) return bufferShim.alloc(0);
  28642. if (this.length === 1) return this.head.data;
  28643. var ret = bufferShim.allocUnsafe(n >>> 0);
  28644. var p = this.head;
  28645. var i = 0;
  28646. while (p) {
  28647. p.data.copy(ret, i);
  28648. i += p.data.length;
  28649. p = p.next;
  28650. }
  28651. return ret;
  28652. };
  28653. /***/ },
  28654. /* 270 */
  28655. /***/ function(module, exports, __webpack_require__) {
  28656. module.exports = __webpack_require__(114)
  28657. /***/ },
  28658. /* 271 */
  28659. /***/ function(module, exports, __webpack_require__) {
  28660. /* WEBPACK VAR INJECTION */(function(process) {var Stream = (function (){
  28661. try {
  28662. return __webpack_require__(19); // hack to fix a circular dependency issue when used with browserify
  28663. } catch(_){}
  28664. }());
  28665. exports = module.exports = __webpack_require__(115);
  28666. exports.Stream = Stream || exports;
  28667. exports.Readable = exports;
  28668. exports.Writable = __webpack_require__(64);
  28669. exports.Duplex = __webpack_require__(10);
  28670. exports.Transform = __webpack_require__(63);
  28671. exports.PassThrough = __webpack_require__(114);
  28672. if (!process.browser && process.env.READABLE_STREAM === 'disable' && Stream) {
  28673. module.exports = Stream;
  28674. }
  28675. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7)))
  28676. /***/ },
  28677. /* 272 */
  28678. /***/ function(module, exports, __webpack_require__) {
  28679. module.exports = __webpack_require__(63)
  28680. /***/ },
  28681. /* 273 */
  28682. /***/ function(module, exports, __webpack_require__) {
  28683. module.exports = __webpack_require__(64)
  28684. /***/ },
  28685. /* 274 */
  28686. /***/ function(module, exports, __webpack_require__) {
  28687. /* WEBPACK VAR INJECTION */(function(Buffer) {/*
  28688. CryptoJS v3.1.2
  28689. code.google.com/p/crypto-js
  28690. (c) 2009-2013 by Jeff Mott. All rights reserved.
  28691. code.google.com/p/crypto-js/wiki/License
  28692. */
  28693. /** @preserve
  28694. (c) 2012 by Cédric Mesnil. All rights reserved.
  28695. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
  28696. - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  28697. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  28698. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28699. */
  28700. // constants table
  28701. var zl = [
  28702. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
  28703. 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,
  28704. 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,
  28705. 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,
  28706. 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13
  28707. ]
  28708. var zr = [
  28709. 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,
  28710. 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,
  28711. 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,
  28712. 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,
  28713. 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
  28714. ]
  28715. var sl = [
  28716. 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,
  28717. 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,
  28718. 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,
  28719. 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,
  28720. 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
  28721. ]
  28722. var sr = [
  28723. 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,
  28724. 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,
  28725. 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,
  28726. 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,
  28727. 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
  28728. ]
  28729. var hl = [0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]
  28730. var hr = [0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]
  28731. function bytesToWords (bytes) {
  28732. var words = []
  28733. for (var i = 0, b = 0; i < bytes.length; i++, b += 8) {
  28734. words[b >>> 5] |= bytes[i] << (24 - b % 32)
  28735. }
  28736. return words
  28737. }
  28738. function wordsToBytes (words) {
  28739. var bytes = []
  28740. for (var b = 0; b < words.length * 32; b += 8) {
  28741. bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF)
  28742. }
  28743. return bytes
  28744. }
  28745. function processBlock (H, M, offset) {
  28746. // swap endian
  28747. for (var i = 0; i < 16; i++) {
  28748. var offset_i = offset + i
  28749. var M_offset_i = M[offset_i]
  28750. // Swap
  28751. M[offset_i] = (
  28752. (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |
  28753. (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)
  28754. )
  28755. }
  28756. // Working variables
  28757. var al, bl, cl, dl, el
  28758. var ar, br, cr, dr, er
  28759. ar = al = H[0]
  28760. br = bl = H[1]
  28761. cr = cl = H[2]
  28762. dr = dl = H[3]
  28763. er = el = H[4]
  28764. // computation
  28765. var t
  28766. for (i = 0; i < 80; i += 1) {
  28767. t = (al + M[offset + zl[i]]) | 0
  28768. if (i < 16) {
  28769. t += f1(bl, cl, dl) + hl[0]
  28770. } else if (i < 32) {
  28771. t += f2(bl, cl, dl) + hl[1]
  28772. } else if (i < 48) {
  28773. t += f3(bl, cl, dl) + hl[2]
  28774. } else if (i < 64) {
  28775. t += f4(bl, cl, dl) + hl[3]
  28776. } else {// if (i<80) {
  28777. t += f5(bl, cl, dl) + hl[4]
  28778. }
  28779. t = t | 0
  28780. t = rotl(t, sl[i])
  28781. t = (t + el) | 0
  28782. al = el
  28783. el = dl
  28784. dl = rotl(cl, 10)
  28785. cl = bl
  28786. bl = t
  28787. t = (ar + M[offset + zr[i]]) | 0
  28788. if (i < 16) {
  28789. t += f5(br, cr, dr) + hr[0]
  28790. } else if (i < 32) {
  28791. t += f4(br, cr, dr) + hr[1]
  28792. } else if (i < 48) {
  28793. t += f3(br, cr, dr) + hr[2]
  28794. } else if (i < 64) {
  28795. t += f2(br, cr, dr) + hr[3]
  28796. } else {// if (i<80) {
  28797. t += f1(br, cr, dr) + hr[4]
  28798. }
  28799. t = t | 0
  28800. t = rotl(t, sr[i])
  28801. t = (t + er) | 0
  28802. ar = er
  28803. er = dr
  28804. dr = rotl(cr, 10)
  28805. cr = br
  28806. br = t
  28807. }
  28808. // intermediate hash value
  28809. t = (H[1] + cl + dr) | 0
  28810. H[1] = (H[2] + dl + er) | 0
  28811. H[2] = (H[3] + el + ar) | 0
  28812. H[3] = (H[4] + al + br) | 0
  28813. H[4] = (H[0] + bl + cr) | 0
  28814. H[0] = t
  28815. }
  28816. function f1 (x, y, z) {
  28817. return ((x) ^ (y) ^ (z))
  28818. }
  28819. function f2 (x, y, z) {
  28820. return (((x) & (y)) | ((~x) & (z)))
  28821. }
  28822. function f3 (x, y, z) {
  28823. return (((x) | (~(y))) ^ (z))
  28824. }
  28825. function f4 (x, y, z) {
  28826. return (((x) & (z)) | ((y) & (~(z))))
  28827. }
  28828. function f5 (x, y, z) {
  28829. return ((x) ^ ((y) | (~(z))))
  28830. }
  28831. function rotl (x, n) {
  28832. return (x << n) | (x >>> (32 - n))
  28833. }
  28834. function ripemd160 (message) {
  28835. var H = [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]
  28836. if (typeof message === 'string') {
  28837. message = new Buffer(message, 'utf8')
  28838. }
  28839. var m = bytesToWords(message)
  28840. var nBitsLeft = message.length * 8
  28841. var nBitsTotal = message.length * 8
  28842. // Add padding
  28843. m[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32)
  28844. m[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (
  28845. (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) |
  28846. (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00)
  28847. )
  28848. for (var i = 0; i < m.length; i += 16) {
  28849. processBlock(H, m, i)
  28850. }
  28851. // swap endian
  28852. for (i = 0; i < 5; i++) {
  28853. // shortcut
  28854. var H_i = H[i]
  28855. // Swap
  28856. H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |
  28857. (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00)
  28858. }
  28859. var digestbytes = wordsToBytes(H)
  28860. return new Buffer(digestbytes)
  28861. }
  28862. module.exports = ripemd160
  28863. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  28864. /***/ },
  28865. /* 275 */
  28866. /***/ function(module, exports) {
  28867. function select(element) {
  28868. var selectedText;
  28869. if (element.nodeName === 'SELECT') {
  28870. element.focus();
  28871. selectedText = element.value;
  28872. }
  28873. else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {
  28874. element.focus();
  28875. element.setSelectionRange(0, element.value.length);
  28876. selectedText = element.value;
  28877. }
  28878. else {
  28879. if (element.hasAttribute('contenteditable')) {
  28880. element.focus();
  28881. }
  28882. var selection = window.getSelection();
  28883. var range = document.createRange();
  28884. range.selectNodeContents(element);
  28885. selection.removeAllRanges();
  28886. selection.addRange(range);
  28887. selectedText = selection.toString();
  28888. }
  28889. return selectedText;
  28890. }
  28891. module.exports = select;
  28892. /***/ },
  28893. /* 276 */
  28894. /***/ function(module, exports, __webpack_require__) {
  28895. var exports = module.exports = function SHA (algorithm) {
  28896. algorithm = algorithm.toLowerCase()
  28897. var Algorithm = exports[algorithm]
  28898. if (!Algorithm) throw new Error(algorithm + ' is not supported (we accept pull requests)')
  28899. return new Algorithm()
  28900. }
  28901. exports.sha = __webpack_require__(277)
  28902. exports.sha1 = __webpack_require__(278)
  28903. exports.sha224 = __webpack_require__(279)
  28904. exports.sha256 = __webpack_require__(116)
  28905. exports.sha384 = __webpack_require__(280)
  28906. exports.sha512 = __webpack_require__(117)
  28907. /***/ },
  28908. /* 277 */
  28909. /***/ function(module, exports, __webpack_require__) {
  28910. /* WEBPACK VAR INJECTION */(function(Buffer) {/*
  28911. * A JavaScript implementation of the Secure Hash Algorithm, SHA-0, as defined
  28912. * in FIPS PUB 180-1
  28913. * This source code is derived from sha1.js of the same repository.
  28914. * The difference between SHA-0 and SHA-1 is just a bitwise rotate left
  28915. * operation was added.
  28916. */
  28917. var inherits = __webpack_require__(1)
  28918. var Hash = __webpack_require__(18)
  28919. var K = [
  28920. 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0
  28921. ]
  28922. var W = new Array(80)
  28923. function Sha () {
  28924. this.init()
  28925. this._w = W
  28926. Hash.call(this, 64, 56)
  28927. }
  28928. inherits(Sha, Hash)
  28929. Sha.prototype.init = function () {
  28930. this._a = 0x67452301
  28931. this._b = 0xefcdab89
  28932. this._c = 0x98badcfe
  28933. this._d = 0x10325476
  28934. this._e = 0xc3d2e1f0
  28935. return this
  28936. }
  28937. function rotl5 (num) {
  28938. return (num << 5) | (num >>> 27)
  28939. }
  28940. function rotl30 (num) {
  28941. return (num << 30) | (num >>> 2)
  28942. }
  28943. function ft (s, b, c, d) {
  28944. if (s === 0) return (b & c) | ((~b) & d)
  28945. if (s === 2) return (b & c) | (b & d) | (c & d)
  28946. return b ^ c ^ d
  28947. }
  28948. Sha.prototype._update = function (M) {
  28949. var W = this._w
  28950. var a = this._a | 0
  28951. var b = this._b | 0
  28952. var c = this._c | 0
  28953. var d = this._d | 0
  28954. var e = this._e | 0
  28955. for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
  28956. for (; i < 80; ++i) W[i] = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]
  28957. for (var j = 0; j < 80; ++j) {
  28958. var s = ~~(j / 20)
  28959. var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0
  28960. e = d
  28961. d = c
  28962. c = rotl30(b)
  28963. b = a
  28964. a = t
  28965. }
  28966. this._a = (a + this._a) | 0
  28967. this._b = (b + this._b) | 0
  28968. this._c = (c + this._c) | 0
  28969. this._d = (d + this._d) | 0
  28970. this._e = (e + this._e) | 0
  28971. }
  28972. Sha.prototype._hash = function () {
  28973. var H = new Buffer(20)
  28974. H.writeInt32BE(this._a | 0, 0)
  28975. H.writeInt32BE(this._b | 0, 4)
  28976. H.writeInt32BE(this._c | 0, 8)
  28977. H.writeInt32BE(this._d | 0, 12)
  28978. H.writeInt32BE(this._e | 0, 16)
  28979. return H
  28980. }
  28981. module.exports = Sha
  28982. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  28983. /***/ },
  28984. /* 278 */
  28985. /***/ function(module, exports, __webpack_require__) {
  28986. /* WEBPACK VAR INJECTION */(function(Buffer) {/*
  28987. * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
  28988. * in FIPS PUB 180-1
  28989. * Version 2.1a Copyright Paul Johnston 2000 - 2002.
  28990. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
  28991. * Distributed under the BSD License
  28992. * See http://pajhome.org.uk/crypt/md5 for details.
  28993. */
  28994. var inherits = __webpack_require__(1)
  28995. var Hash = __webpack_require__(18)
  28996. var K = [
  28997. 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0
  28998. ]
  28999. var W = new Array(80)
  29000. function Sha1 () {
  29001. this.init()
  29002. this._w = W
  29003. Hash.call(this, 64, 56)
  29004. }
  29005. inherits(Sha1, Hash)
  29006. Sha1.prototype.init = function () {
  29007. this._a = 0x67452301
  29008. this._b = 0xefcdab89
  29009. this._c = 0x98badcfe
  29010. this._d = 0x10325476
  29011. this._e = 0xc3d2e1f0
  29012. return this
  29013. }
  29014. function rotl1 (num) {
  29015. return (num << 1) | (num >>> 31)
  29016. }
  29017. function rotl5 (num) {
  29018. return (num << 5) | (num >>> 27)
  29019. }
  29020. function rotl30 (num) {
  29021. return (num << 30) | (num >>> 2)
  29022. }
  29023. function ft (s, b, c, d) {
  29024. if (s === 0) return (b & c) | ((~b) & d)
  29025. if (s === 2) return (b & c) | (b & d) | (c & d)
  29026. return b ^ c ^ d
  29027. }
  29028. Sha1.prototype._update = function (M) {
  29029. var W = this._w
  29030. var a = this._a | 0
  29031. var b = this._b | 0
  29032. var c = this._c | 0
  29033. var d = this._d | 0
  29034. var e = this._e | 0
  29035. for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)
  29036. for (; i < 80; ++i) W[i] = rotl1(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16])
  29037. for (var j = 0; j < 80; ++j) {
  29038. var s = ~~(j / 20)
  29039. var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0
  29040. e = d
  29041. d = c
  29042. c = rotl30(b)
  29043. b = a
  29044. a = t
  29045. }
  29046. this._a = (a + this._a) | 0
  29047. this._b = (b + this._b) | 0
  29048. this._c = (c + this._c) | 0
  29049. this._d = (d + this._d) | 0
  29050. this._e = (e + this._e) | 0
  29051. }
  29052. Sha1.prototype._hash = function () {
  29053. var H = new Buffer(20)
  29054. H.writeInt32BE(this._a | 0, 0)
  29055. H.writeInt32BE(this._b | 0, 4)
  29056. H.writeInt32BE(this._c | 0, 8)
  29057. H.writeInt32BE(this._d | 0, 12)
  29058. H.writeInt32BE(this._e | 0, 16)
  29059. return H
  29060. }
  29061. module.exports = Sha1
  29062. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  29063. /***/ },
  29064. /* 279 */
  29065. /***/ function(module, exports, __webpack_require__) {
  29066. /* WEBPACK VAR INJECTION */(function(Buffer) {/**
  29067. * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined
  29068. * in FIPS 180-2
  29069. * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.
  29070. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
  29071. *
  29072. */
  29073. var inherits = __webpack_require__(1)
  29074. var Sha256 = __webpack_require__(116)
  29075. var Hash = __webpack_require__(18)
  29076. var W = new Array(64)
  29077. function Sha224 () {
  29078. this.init()
  29079. this._w = W // new Array(64)
  29080. Hash.call(this, 64, 56)
  29081. }
  29082. inherits(Sha224, Sha256)
  29083. Sha224.prototype.init = function () {
  29084. this._a = 0xc1059ed8
  29085. this._b = 0x367cd507
  29086. this._c = 0x3070dd17
  29087. this._d = 0xf70e5939
  29088. this._e = 0xffc00b31
  29089. this._f = 0x68581511
  29090. this._g = 0x64f98fa7
  29091. this._h = 0xbefa4fa4
  29092. return this
  29093. }
  29094. Sha224.prototype._hash = function () {
  29095. var H = new Buffer(28)
  29096. H.writeInt32BE(this._a, 0)
  29097. H.writeInt32BE(this._b, 4)
  29098. H.writeInt32BE(this._c, 8)
  29099. H.writeInt32BE(this._d, 12)
  29100. H.writeInt32BE(this._e, 16)
  29101. H.writeInt32BE(this._f, 20)
  29102. H.writeInt32BE(this._g, 24)
  29103. return H
  29104. }
  29105. module.exports = Sha224
  29106. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  29107. /***/ },
  29108. /* 280 */
  29109. /***/ function(module, exports, __webpack_require__) {
  29110. /* WEBPACK VAR INJECTION */(function(Buffer) {var inherits = __webpack_require__(1)
  29111. var SHA512 = __webpack_require__(117)
  29112. var Hash = __webpack_require__(18)
  29113. var W = new Array(160)
  29114. function Sha384 () {
  29115. this.init()
  29116. this._w = W
  29117. Hash.call(this, 128, 112)
  29118. }
  29119. inherits(Sha384, SHA512)
  29120. Sha384.prototype.init = function () {
  29121. this._ah = 0xcbbb9d5d
  29122. this._bh = 0x629a292a
  29123. this._ch = 0x9159015a
  29124. this._dh = 0x152fecd8
  29125. this._eh = 0x67332667
  29126. this._fh = 0x8eb44a87
  29127. this._gh = 0xdb0c2e0d
  29128. this._hh = 0x47b5481d
  29129. this._al = 0xc1059ed8
  29130. this._bl = 0x367cd507
  29131. this._cl = 0x3070dd17
  29132. this._dl = 0xf70e5939
  29133. this._el = 0xffc00b31
  29134. this._fl = 0x68581511
  29135. this._gl = 0x64f98fa7
  29136. this._hl = 0xbefa4fa4
  29137. return this
  29138. }
  29139. Sha384.prototype._hash = function () {
  29140. var H = new Buffer(48)
  29141. function writeInt64BE (h, l, offset) {
  29142. H.writeInt32BE(h, offset)
  29143. H.writeInt32BE(l, offset + 4)
  29144. }
  29145. writeInt64BE(this._ah, this._al, 0)
  29146. writeInt64BE(this._bh, this._bl, 8)
  29147. writeInt64BE(this._ch, this._cl, 16)
  29148. writeInt64BE(this._dh, this._dl, 24)
  29149. writeInt64BE(this._eh, this._el, 32)
  29150. writeInt64BE(this._fh, this._fl, 40)
  29151. return H
  29152. }
  29153. module.exports = Sha384
  29154. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer))
  29155. /***/ },
  29156. /* 281 */
  29157. /***/ function(module, exports) {
  29158. function E () {
  29159. // Keep this empty so it's easier to inherit from
  29160. // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
  29161. }
  29162. E.prototype = {
  29163. on: function (name, callback, ctx) {
  29164. var e = this.e || (this.e = {});
  29165. (e[name] || (e[name] = [])).push({
  29166. fn: callback,
  29167. ctx: ctx
  29168. });
  29169. return this;
  29170. },
  29171. once: function (name, callback, ctx) {
  29172. var self = this;
  29173. function listener () {
  29174. self.off(name, listener);
  29175. callback.apply(ctx, arguments);
  29176. };
  29177. listener._ = callback
  29178. return this.on(name, listener, ctx);
  29179. },
  29180. emit: function (name) {
  29181. var data = [].slice.call(arguments, 1);
  29182. var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
  29183. var i = 0;
  29184. var len = evtArr.length;
  29185. for (i; i < len; i++) {
  29186. evtArr[i].fn.apply(evtArr[i].ctx, data);
  29187. }
  29188. return this;
  29189. },
  29190. off: function (name, callback) {
  29191. var e = this.e || (this.e = {});
  29192. var evts = e[name];
  29193. var liveEvents = [];
  29194. if (evts && callback) {
  29195. for (var i = 0, len = evts.length; i < len; i++) {
  29196. if (evts[i].fn !== callback && evts[i].fn._ !== callback)
  29197. liveEvents.push(evts[i]);
  29198. }
  29199. }
  29200. // Remove event from queue to prevent memory leak
  29201. // Suggested by https://github.com/lazd
  29202. // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
  29203. (liveEvents.length)
  29204. ? e[name] = liveEvents
  29205. : delete e[name];
  29206. return this;
  29207. }
  29208. };
  29209. module.exports = E;
  29210. /***/ },
  29211. /* 282 */
  29212. /***/ function(module, exports, __webpack_require__) {
  29213. /* WEBPACK VAR INJECTION */(function(global) {
  29214. /**
  29215. * Module exports.
  29216. */
  29217. module.exports = deprecate;
  29218. /**
  29219. * Mark that a method should not be used.
  29220. * Returns a modified function which warns once by default.
  29221. *
  29222. * If `localStorage.noDeprecation = true` is set, then it is a no-op.
  29223. *
  29224. * If `localStorage.throwDeprecation = true` is set, then deprecated functions
  29225. * will throw an Error when invoked.
  29226. *
  29227. * If `localStorage.traceDeprecation = true` is set, then deprecated functions
  29228. * will invoke `console.trace()` instead of `console.error()`.
  29229. *
  29230. * @param {Function} fn - the function to deprecate
  29231. * @param {String} msg - the string to print to the console when `fn` is invoked
  29232. * @returns {Function} a new "deprecated" version of `fn`
  29233. * @api public
  29234. */
  29235. function deprecate (fn, msg) {
  29236. if (config('noDeprecation')) {
  29237. return fn;
  29238. }
  29239. var warned = false;
  29240. function deprecated() {
  29241. if (!warned) {
  29242. if (config('throwDeprecation')) {
  29243. throw new Error(msg);
  29244. } else if (config('traceDeprecation')) {
  29245. console.trace(msg);
  29246. } else {
  29247. console.warn(msg);
  29248. }
  29249. warned = true;
  29250. }
  29251. return fn.apply(this, arguments);
  29252. }
  29253. return deprecated;
  29254. }
  29255. /**
  29256. * Checks `localStorage` for boolean values for the given `name`.
  29257. *
  29258. * @param {String} name
  29259. * @returns {Boolean}
  29260. * @api private
  29261. */
  29262. function config (name) {
  29263. // accessing global.localStorage can trigger a DOMException in sandboxed iframes
  29264. try {
  29265. if (!global.localStorage) return false;
  29266. } catch (_) {
  29267. return false;
  29268. }
  29269. var val = global.localStorage[name];
  29270. if (null == val) return false;
  29271. return String(val).toLowerCase() === 'true';
  29272. }
  29273. /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(32)))
  29274. /***/ },
  29275. /* 283 */
  29276. /***/ function(module, exports, __webpack_require__) {
  29277. var indexOf = __webpack_require__(254);
  29278. var Object_keys = function (obj) {
  29279. if (Object.keys) return Object.keys(obj)
  29280. else {
  29281. var res = [];
  29282. for (var key in obj) res.push(key)
  29283. return res;
  29284. }
  29285. };
  29286. var forEach = function (xs, fn) {
  29287. if (xs.forEach) return xs.forEach(fn)
  29288. else for (var i = 0; i < xs.length; i++) {
  29289. fn(xs[i], i, xs);
  29290. }
  29291. };
  29292. var defineProp = (function() {
  29293. try {
  29294. Object.defineProperty({}, '_', {});
  29295. return function(obj, name, value) {
  29296. Object.defineProperty(obj, name, {
  29297. writable: true,
  29298. enumerable: false,
  29299. configurable: true,
  29300. value: value
  29301. })
  29302. };
  29303. } catch(e) {
  29304. return function(obj, name, value) {
  29305. obj[name] = value;
  29306. };
  29307. }
  29308. }());
  29309. var globals = ['Array', 'Boolean', 'Date', 'Error', 'EvalError', 'Function',
  29310. 'Infinity', 'JSON', 'Math', 'NaN', 'Number', 'Object', 'RangeError',
  29311. 'ReferenceError', 'RegExp', 'String', 'SyntaxError', 'TypeError', 'URIError',
  29312. 'decodeURI', 'decodeURIComponent', 'encodeURI', 'encodeURIComponent', 'escape',
  29313. 'eval', 'isFinite', 'isNaN', 'parseFloat', 'parseInt', 'undefined', 'unescape'];
  29314. function Context() {}
  29315. Context.prototype = {};
  29316. var Script = exports.Script = function NodeScript (code) {
  29317. if (!(this instanceof Script)) return new Script(code);
  29318. this.code = code;
  29319. };
  29320. Script.prototype.runInContext = function (context) {
  29321. if (!(context instanceof Context)) {
  29322. throw new TypeError("needs a 'context' argument.");
  29323. }
  29324. var iframe = document.createElement('iframe');
  29325. if (!iframe.style) iframe.style = {};
  29326. iframe.style.display = 'none';
  29327. document.body.appendChild(iframe);
  29328. var win = iframe.contentWindow;
  29329. var wEval = win.eval, wExecScript = win.execScript;
  29330. if (!wEval && wExecScript) {
  29331. // win.eval() magically appears when this is called in IE:
  29332. wExecScript.call(win, 'null');
  29333. wEval = win.eval;
  29334. }
  29335. forEach(Object_keys(context), function (key) {
  29336. win[key] = context[key];
  29337. });
  29338. forEach(globals, function (key) {
  29339. if (context[key]) {
  29340. win[key] = context[key];
  29341. }
  29342. });
  29343. var winKeys = Object_keys(win);
  29344. var res = wEval.call(win, this.code);
  29345. forEach(Object_keys(win), function (key) {
  29346. // Avoid copying circular objects like `top` and `window` by only
  29347. // updating existing context properties or new properties in the `win`
  29348. // that was only introduced after the eval.
  29349. if (key in context || indexOf(winKeys, key) === -1) {
  29350. context[key] = win[key];
  29351. }
  29352. });
  29353. forEach(globals, function (key) {
  29354. if (!(key in context)) {
  29355. defineProp(context, key, win[key]);
  29356. }
  29357. });
  29358. document.body.removeChild(iframe);
  29359. return res;
  29360. };
  29361. Script.prototype.runInThisContext = function () {
  29362. return eval(this.code); // maybe...
  29363. };
  29364. Script.prototype.runInNewContext = function (context) {
  29365. var ctx = Script.createContext(context);
  29366. var res = this.runInContext(ctx);
  29367. forEach(Object_keys(ctx), function (key) {
  29368. context[key] = ctx[key];
  29369. });
  29370. return res;
  29371. };
  29372. forEach(Object_keys(Script.prototype), function (name) {
  29373. exports[name] = Script[name] = function (code) {
  29374. var s = Script(code);
  29375. return s[name].apply(s, [].slice.call(arguments, 1));
  29376. };
  29377. });
  29378. exports.createScript = function (code) {
  29379. return exports.Script(code);
  29380. };
  29381. exports.createContext = Script.createContext = function (context) {
  29382. var copy = new Context();
  29383. if(typeof context === 'object') {
  29384. forEach(Object_keys(context), function (key) {
  29385. copy[key] = context[key];
  29386. });
  29387. }
  29388. return copy;
  29389. };
  29390. /***/ },
  29391. /* 284 */
  29392. /***/ function(module, exports, __webpack_require__) {
  29393. var __vue_exports__, __vue_options__
  29394. /* styles */
  29395. __webpack_require__(308)
  29396. /* script */
  29397. __vue_exports__ = __webpack_require__(150)
  29398. /* template */
  29399. var __vue_template__ = __webpack_require__(300)
  29400. __vue_options__ = __vue_exports__ = __vue_exports__ || {}
  29401. if (
  29402. typeof __vue_exports__.default === "object" ||
  29403. typeof __vue_exports__.default === "function"
  29404. ) {
  29405. __vue_options__ = __vue_exports__ = __vue_exports__.default
  29406. }
  29407. if (typeof __vue_options__ === "function") {
  29408. __vue_options__ = __vue_options__.options
  29409. }
  29410. __vue_options__.render = __vue_template__.render
  29411. __vue_options__.staticRenderFns = __vue_template__.staticRenderFns
  29412. module.exports = __vue_exports__
  29413. /***/ },
  29414. /* 285 */
  29415. /***/ function(module, exports, __webpack_require__) {
  29416. var __vue_exports__, __vue_options__
  29417. /* styles */
  29418. __webpack_require__(304)
  29419. /* script */
  29420. __vue_exports__ = __webpack_require__(151)
  29421. /* template */
  29422. var __vue_template__ = __webpack_require__(295)
  29423. __vue_options__ = __vue_exports__ = __vue_exports__ || {}
  29424. if (
  29425. typeof __vue_exports__.default === "object" ||
  29426. typeof __vue_exports__.default === "function"
  29427. ) {
  29428. __vue_options__ = __vue_exports__ = __vue_exports__.default
  29429. }
  29430. if (typeof __vue_options__ === "function") {
  29431. __vue_options__ = __vue_options__.options
  29432. }
  29433. __vue_options__.render = __vue_template__.render
  29434. __vue_options__.staticRenderFns = __vue_template__.staticRenderFns
  29435. module.exports = __vue_exports__
  29436. /***/ },
  29437. /* 286 */
  29438. /***/ function(module, exports, __webpack_require__) {
  29439. var __vue_exports__, __vue_options__
  29440. /* styles */
  29441. __webpack_require__(309)
  29442. /* script */
  29443. __vue_exports__ = __webpack_require__(152)
  29444. /* template */
  29445. var __vue_template__ = __webpack_require__(302)
  29446. __vue_options__ = __vue_exports__ = __vue_exports__ || {}
  29447. if (
  29448. typeof __vue_exports__.default === "object" ||
  29449. typeof __vue_exports__.default === "function"
  29450. ) {
  29451. __vue_options__ = __vue_exports__ = __vue_exports__.default
  29452. }
  29453. if (typeof __vue_options__ === "function") {
  29454. __vue_options__ = __vue_options__.options
  29455. }
  29456. __vue_options__.render = __vue_template__.render
  29457. __vue_options__.staticRenderFns = __vue_template__.staticRenderFns
  29458. module.exports = __vue_exports__
  29459. /***/ },
  29460. /* 287 */
  29461. /***/ function(module, exports, __webpack_require__) {
  29462. var __vue_exports__, __vue_options__
  29463. /* template */
  29464. var __vue_template__ = __webpack_require__(293)
  29465. __vue_options__ = __vue_exports__ = __vue_exports__ || {}
  29466. if (
  29467. typeof __vue_exports__.default === "object" ||
  29468. typeof __vue_exports__.default === "function"
  29469. ) {
  29470. __vue_options__ = __vue_exports__ = __vue_exports__.default
  29471. }
  29472. if (typeof __vue_options__ === "function") {
  29473. __vue_options__ = __vue_options__.options
  29474. }
  29475. __vue_options__.render = __vue_template__.render
  29476. __vue_options__.staticRenderFns = __vue_template__.staticRenderFns
  29477. module.exports = __vue_exports__
  29478. /***/ },
  29479. /* 288 */
  29480. /***/ function(module, exports, __webpack_require__) {
  29481. var __vue_exports__, __vue_options__
  29482. /* script */
  29483. __vue_exports__ = __webpack_require__(153)
  29484. /* template */
  29485. var __vue_template__ = __webpack_require__(294)
  29486. __vue_options__ = __vue_exports__ = __vue_exports__ || {}
  29487. if (
  29488. typeof __vue_exports__.default === "object" ||
  29489. typeof __vue_exports__.default === "function"
  29490. ) {
  29491. __vue_options__ = __vue_exports__ = __vue_exports__.default
  29492. }
  29493. if (typeof __vue_options__ === "function") {
  29494. __vue_options__ = __vue_options__.options
  29495. }
  29496. __vue_options__.render = __vue_template__.render
  29497. __vue_options__.staticRenderFns = __vue_template__.staticRenderFns
  29498. module.exports = __vue_exports__
  29499. /***/ },
  29500. /* 289 */
  29501. /***/ function(module, exports, __webpack_require__) {
  29502. var __vue_exports__, __vue_options__
  29503. /* styles */
  29504. __webpack_require__(306)
  29505. /* script */
  29506. __vue_exports__ = __webpack_require__(154)
  29507. /* template */
  29508. var __vue_template__ = __webpack_require__(297)
  29509. __vue_options__ = __vue_exports__ = __vue_exports__ || {}
  29510. if (
  29511. typeof __vue_exports__.default === "object" ||
  29512. typeof __vue_exports__.default === "function"
  29513. ) {
  29514. __vue_options__ = __vue_exports__ = __vue_exports__.default
  29515. }
  29516. if (typeof __vue_options__ === "function") {
  29517. __vue_options__ = __vue_options__.options
  29518. }
  29519. __vue_options__.render = __vue_template__.render
  29520. __vue_options__.staticRenderFns = __vue_template__.staticRenderFns
  29521. module.exports = __vue_exports__
  29522. /***/ },
  29523. /* 290 */
  29524. /***/ function(module, exports, __webpack_require__) {
  29525. var __vue_exports__, __vue_options__
  29526. /* script */
  29527. __vue_exports__ = __webpack_require__(155)
  29528. /* template */
  29529. var __vue_template__ = __webpack_require__(299)
  29530. __vue_options__ = __vue_exports__ = __vue_exports__ || {}
  29531. if (
  29532. typeof __vue_exports__.default === "object" ||
  29533. typeof __vue_exports__.default === "function"
  29534. ) {
  29535. __vue_options__ = __vue_exports__ = __vue_exports__.default
  29536. }
  29537. if (typeof __vue_options__ === "function") {
  29538. __vue_options__ = __vue_options__.options
  29539. }
  29540. __vue_options__.render = __vue_template__.render
  29541. __vue_options__.staticRenderFns = __vue_template__.staticRenderFns
  29542. module.exports = __vue_exports__
  29543. /***/ },
  29544. /* 291 */
  29545. /***/ function(module, exports, __webpack_require__) {
  29546. var __vue_exports__, __vue_options__
  29547. /* script */
  29548. __vue_exports__ = __webpack_require__(156)
  29549. /* template */
  29550. var __vue_template__ = __webpack_require__(301)
  29551. __vue_options__ = __vue_exports__ = __vue_exports__ || {}
  29552. if (
  29553. typeof __vue_exports__.default === "object" ||
  29554. typeof __vue_exports__.default === "function"
  29555. ) {
  29556. __vue_options__ = __vue_exports__ = __vue_exports__.default
  29557. }
  29558. if (typeof __vue_options__ === "function") {
  29559. __vue_options__ = __vue_options__.options
  29560. }
  29561. __vue_options__.render = __vue_template__.render
  29562. __vue_options__.staticRenderFns = __vue_template__.staticRenderFns
  29563. module.exports = __vue_exports__
  29564. /***/ },
  29565. /* 292 */
  29566. /***/ function(module, exports, __webpack_require__) {
  29567. var __vue_exports__, __vue_options__
  29568. /* styles */
  29569. __webpack_require__(305)
  29570. /* script */
  29571. __vue_exports__ = __webpack_require__(157)
  29572. /* template */
  29573. var __vue_template__ = __webpack_require__(296)
  29574. __vue_options__ = __vue_exports__ = __vue_exports__ || {}
  29575. if (
  29576. typeof __vue_exports__.default === "object" ||
  29577. typeof __vue_exports__.default === "function"
  29578. ) {
  29579. __vue_options__ = __vue_exports__ = __vue_exports__.default
  29580. }
  29581. if (typeof __vue_options__ === "function") {
  29582. __vue_options__ = __vue_options__.options
  29583. }
  29584. __vue_options__.render = __vue_template__.render
  29585. __vue_options__.staticRenderFns = __vue_template__.staticRenderFns
  29586. module.exports = __vue_exports__
  29587. /***/ },
  29588. /* 293 */
  29589. /***/ function(module, exports) {
  29590. module.exports={render:function (){with(this) {
  29591. return _m(0)
  29592. }},staticRenderFns: [function (){with(this) {
  29593. return _h('div', {
  29594. attrs: {
  29595. "style": "display: none;"
  29596. }
  29597. }, [_h('label', {
  29598. attrs: {
  29599. "for": "username"
  29600. }
  29601. }, [_h('input', {
  29602. attrs: {
  29603. "type": "text",
  29604. "id": "username",
  29605. "name": "username",
  29606. "autocomplete": "username"
  29607. }
  29608. })]), " ", _h('label', {
  29609. attrs: {
  29610. "for": "password"
  29611. }
  29612. }, [_h('input', {
  29613. attrs: {
  29614. "type": "password",
  29615. "id": "password",
  29616. "name": "password",
  29617. "autocomplete": "current-password"
  29618. }
  29619. })])])
  29620. }}]}
  29621. /***/ },
  29622. /* 294 */
  29623. /***/ function(module, exports) {
  29624. module.exports={render:function (){with(this) {
  29625. return _h('form', [(showError) ? _h('div', {
  29626. staticClass: "form-group row"
  29627. }, [_h('div', {
  29628. staticClass: "col-xs-12 text-muted text-danger"
  29629. }, ["\n " + _s(errorMessage) + "\n "])]) : _e(), " ", _h('div', {
  29630. staticClass: "form-group row"
  29631. }, [_h('div', {
  29632. staticClass: "col-xs-12"
  29633. }, [_h('div', {
  29634. staticClass: "inner-addon left-addon"
  29635. }, [_m(0), " ", _h('input', {
  29636. directives: [{
  29637. name: "model",
  29638. rawName: "v-model",
  29639. value: (email),
  29640. expression: "email"
  29641. }],
  29642. staticClass: "form-control",
  29643. attrs: {
  29644. "id": "email",
  29645. "name": "login",
  29646. "type": "email",
  29647. "placeholder": "Email",
  29648. "required": ""
  29649. },
  29650. domProps: {
  29651. "value": _s(email)
  29652. },
  29653. on: {
  29654. "input": function($event) {
  29655. if ($event.target.composing) return;
  29656. email = $event.target.value
  29657. }
  29658. }
  29659. }), " ", _h('small', {
  29660. staticClass: "form-text text-muted text-danger"
  29661. }, [(errors.userNameAlreadyExist) ? _h('span', ["Someone already use that username. Do you want to sign in ?"]) : _e(), " ", (errors.emailRequired) ? _h('span', ["An email is required"]) : _e()])])])]), " ", _h('div', {
  29662. staticClass: "form-group row"
  29663. }, [_h('div', {
  29664. staticClass: "col-xs-12"
  29665. }, [_h('div', {
  29666. staticClass: "inner-addon left-addon"
  29667. }, [_m(1), " ", _h('input', {
  29668. directives: [{
  29669. name: "model",
  29670. rawName: "v-model",
  29671. value: (password),
  29672. expression: "password"
  29673. }],
  29674. staticClass: "form-control",
  29675. attrs: {
  29676. "id": "password",
  29677. "name": "password",
  29678. "type": "password",
  29679. "required": "",
  29680. "placeholder": "LessPass password"
  29681. },
  29682. domProps: {
  29683. "value": _s(password)
  29684. },
  29685. on: {
  29686. "input": function($event) {
  29687. if ($event.target.composing) return;
  29688. password = $event.target.value
  29689. }
  29690. }
  29691. }), " ", _h('small', {
  29692. staticClass: "form-text text-muted"
  29693. }, [(noErrors()) ? _h('span', {
  29694. staticClass: "text-warning"
  29695. }, ["Do not use your master password here"]) : _e(), " ", (errors.passwordRequired) ? _h('span', {
  29696. staticClass: "text-danger"
  29697. }, ["A password is required"]) : _e()])])])]), " ", _h('div', {
  29698. staticClass: "form-group row"
  29699. }, [_h('div', {
  29700. staticClass: "col-xs-12 hint--bottom",
  29701. attrs: {
  29702. "aria-label": "You can use your self hosted LessPass Database"
  29703. }
  29704. }, [_h('div', {
  29705. staticClass: "inner-addon left-addon"
  29706. }, [_m(2), " ", _h('input', {
  29707. directives: [{
  29708. name: "model",
  29709. rawName: "v-model",
  29710. value: (baseURL),
  29711. expression: "baseURL"
  29712. }],
  29713. staticClass: "form-control",
  29714. attrs: {
  29715. "id": "baseURL",
  29716. "type": "text",
  29717. "placeholder": "LessPass Database (https://...)"
  29718. },
  29719. domProps: {
  29720. "value": _s(baseURL)
  29721. },
  29722. on: {
  29723. "input": function($event) {
  29724. if ($event.target.composing) return;
  29725. baseURL = $event.target.value
  29726. }
  29727. }
  29728. }), " ", _h('small', {
  29729. staticClass: "form-text text-muted"
  29730. }, [(noErrors()) ? _h('span', ["You can use your self hosted LessPass Database"]) : _e(), " ", (errors.baseURLRequired) ? _h('span', {
  29731. staticClass: "text-danger"
  29732. }, ["\n A LessPass database url is required\n "]) : _e()])])])]), " ", _h('div', {
  29733. staticClass: "form-group row"
  29734. }, [_h('div', {
  29735. staticClass: "col-xs-12"
  29736. }, [_h('button', {
  29737. staticClass: "btn btn-primary",
  29738. attrs: {
  29739. "id": "signInButton",
  29740. "type": "button"
  29741. },
  29742. on: {
  29743. "click": signIn
  29744. }
  29745. }, [(loadingSignIn) ? _h('span', [_m(3)]) : _e(), "\n Sign In\n "]), " ", _h('button', {
  29746. staticClass: "btn btn-secondary",
  29747. attrs: {
  29748. "id": "registerButton",
  29749. "type": "button"
  29750. },
  29751. on: {
  29752. "click": register
  29753. }
  29754. }, [(loadingRegister) ? _h('span', [_m(4)]) : _e(), "\n Register\n "])])]), " ", _h('div', {
  29755. staticClass: "form-group row"
  29756. }, [_h('div', {
  29757. staticClass: "col-xs-12"
  29758. }, [_h('router-link', {
  29759. attrs: {
  29760. "to": {
  29761. name: 'passwordReset'
  29762. }
  29763. }
  29764. }, ["\n Forgot you password ?\n "])])])])
  29765. }},staticRenderFns: [function (){with(this) {
  29766. return _h('i', {
  29767. staticClass: "fa fa-user"
  29768. })
  29769. }},function (){with(this) {
  29770. return _h('i', {
  29771. staticClass: "fa fa-lock"
  29772. })
  29773. }},function (){with(this) {
  29774. return _h('i', {
  29775. staticClass: "fa fa-globe"
  29776. })
  29777. }},function (){with(this) {
  29778. return _h('i', {
  29779. staticClass: "fa fa-spinner fa-pulse fa-fw"
  29780. })
  29781. }},function (){with(this) {
  29782. return _h('i', {
  29783. staticClass: "fa fa-spinner fa-pulse fa-fw"
  29784. })
  29785. }}]}
  29786. /***/ },
  29787. /* 295 */
  29788. /***/ function(module, exports) {
  29789. module.exports={render:function (){with(this) {
  29790. return (fingerprint) ? _h('span', {
  29791. staticClass: "input-group-btn"
  29792. }, [_h('button', {
  29793. staticClass: "btn",
  29794. attrs: {
  29795. "id": "fingerprint",
  29796. "type": "button",
  29797. "tabindex": "-1"
  29798. }
  29799. }, [_h('small', {
  29800. staticClass: "hint--left",
  29801. attrs: {
  29802. "aria-label": "master password fingerprint"
  29803. }
  29804. }, [_h('i', {
  29805. staticClass: "fa fa-fw",
  29806. class: [icon1],
  29807. style: ({
  29808. color: color1
  29809. })
  29810. }), " ", _h('i', {
  29811. staticClass: "fa fa-fw",
  29812. class: [icon2],
  29813. style: ({
  29814. color: color2
  29815. })
  29816. }), " ", _h('i', {
  29817. staticClass: "fa fa-fw",
  29818. class: [icon3],
  29819. style: ({
  29820. color: color3
  29821. })
  29822. })])])]) : _e()
  29823. }},staticRenderFns: []}
  29824. /***/ },
  29825. /* 296 */
  29826. /***/ function(module, exports) {
  29827. module.exports={render:function (){with(this) {
  29828. return _h('div', [_h('form', [_h('div', {
  29829. staticClass: "form-group row"
  29830. }, [_h('div', {
  29831. staticClass: "col-sm-7"
  29832. }, [_h('div', {
  29833. staticClass: "inner-addon left-addon"
  29834. }, [_m(0), " ", _h('input', {
  29835. directives: [{
  29836. name: "model",
  29837. rawName: "v-model",
  29838. value: (searchQuery),
  29839. expression: "searchQuery"
  29840. }],
  29841. staticClass: "form-control",
  29842. attrs: {
  29843. "name": "search",
  29844. "placeholder": "Search"
  29845. },
  29846. domProps: {
  29847. "value": _s(searchQuery)
  29848. },
  29849. on: {
  29850. "input": function($event) {
  29851. if ($event.target.composing) return;
  29852. searchQuery = $event.target.value
  29853. }
  29854. }
  29855. })])])])]), " ", _h('div', {
  29856. staticClass: "row",
  29857. attrs: {
  29858. "id": "passwords"
  29859. }
  29860. }, [_h('div', {
  29861. staticClass: "col-xs-12"
  29862. }, [_h('table', {
  29863. staticClass: "table"
  29864. }, [_h('tbody', [(passwords.length === 0) ? _h('tr', [_h('td', ["\n You don't have any passwords saved in your database.\n ", _m(1), " ", _h('router-link', {
  29865. attrs: {
  29866. "to": {
  29867. name: 'home'
  29868. }
  29869. }
  29870. }, ["Would you like to create one ?"])])]) : _e(), " ", _l((filteredPasswords), function(password) {
  29871. return _h('tr', [_h('td', [_h('router-link', {
  29872. attrs: {
  29873. "to": {
  29874. name: 'password',
  29875. params: {
  29876. id: password.id
  29877. }
  29878. }
  29879. }
  29880. }, ["\n " + _s(password.site) + "\n "]), " ", _m(2, true), "\n " + _s(password.login) + "\n "]), " ", _h('td', {
  29881. staticClass: "text-xs-right"
  29882. }, [_h('delete-button', {
  29883. attrs: {
  29884. "action": deletePassword,
  29885. "object": password,
  29886. "text": "Are you sure you want to delete this password ?"
  29887. }
  29888. })])])
  29889. })])])])])])
  29890. }},staticRenderFns: [function (){with(this) {
  29891. return _h('i', {
  29892. staticClass: "fa fa-search"
  29893. })
  29894. }},function (){with(this) {
  29895. return _h('br')
  29896. }},function (){with(this) {
  29897. return _h('br')
  29898. }}]}
  29899. /***/ },
  29900. /* 297 */
  29901. /***/ function(module, exports) {
  29902. module.exports={render:function (){with(this) {
  29903. return _h('form', {
  29904. attrs: {
  29905. "id": "password-generator"
  29906. }
  29907. }, [_h('div', {
  29908. staticClass: "form-group row"
  29909. }, [_h('div', {
  29910. staticClass: "col-xs-12"
  29911. }, [_h('div', {
  29912. staticClass: "inner-addon left-addon"
  29913. }, [_m(0), " ", _h('input', {
  29914. directives: [{
  29915. name: "model",
  29916. rawName: "v-model",
  29917. value: (password.site),
  29918. expression: "password.site"
  29919. }],
  29920. ref: "site",
  29921. staticClass: "form-control",
  29922. attrs: {
  29923. "id": "site",
  29924. "name": "site",
  29925. "type": "text",
  29926. "placeholder": "Site",
  29927. "list": "savedSites",
  29928. "autocorrect": "off",
  29929. "autocapitalize": "none"
  29930. },
  29931. domProps: {
  29932. "value": _s(password.site)
  29933. },
  29934. on: {
  29935. "input": function($event) {
  29936. if ($event.target.composing) return;
  29937. password.site = $event.target.value
  29938. }
  29939. }
  29940. }), " ", _h('datalist', {
  29941. attrs: {
  29942. "id": "savedSites"
  29943. }
  29944. }, [_l((passwords), function(pwd) {
  29945. return _h('option', ["\n " + _s(pwd.site) + " | " + _s(pwd.login) + "\n "])
  29946. })])])])]), " ", _h('remove-auto-complete'), " ", _h('div', {
  29947. staticClass: "form-group row"
  29948. }, [_h('div', {
  29949. staticClass: "col-xs-12"
  29950. }, [_h('div', {
  29951. staticClass: "inner-addon left-addon"
  29952. }, [_m(1), " ", _m(2), " ", _h('input', {
  29953. directives: [{
  29954. name: "model",
  29955. rawName: "v-model",
  29956. value: (password.login),
  29957. expression: "password.login"
  29958. }],
  29959. staticClass: "form-control",
  29960. attrs: {
  29961. "id": "login",
  29962. "name": "login",
  29963. "type": "text",
  29964. "placeholder": "Login",
  29965. "autocomplete": "off",
  29966. "autocorrect": "off",
  29967. "autocapitalize": "none"
  29968. },
  29969. domProps: {
  29970. "value": _s(password.login)
  29971. },
  29972. on: {
  29973. "input": function($event) {
  29974. if ($event.target.composing) return;
  29975. password.login = $event.target.value
  29976. }
  29977. }
  29978. })])])]), " ", _h('div', {
  29979. staticClass: "form-group row"
  29980. }, [_h('div', {
  29981. staticClass: "col-xs-12"
  29982. }, [_h('div', {
  29983. staticClass: "inner-addon left-addon input-group"
  29984. }, [_m(3), " ", _m(4), " ", _h('input', {
  29985. directives: [{
  29986. name: "model",
  29987. rawName: "v-model",
  29988. value: (masterPassword),
  29989. expression: "masterPassword"
  29990. }],
  29991. ref: "masterPassword",
  29992. staticClass: "form-control",
  29993. attrs: {
  29994. "id": "masterPassword",
  29995. "name": "masterPassword",
  29996. "type": "password",
  29997. "placeholder": "Master password",
  29998. "autocomplete": "new-password",
  29999. "autocorrect": "off",
  30000. "autocapitalize": "none"
  30001. },
  30002. domProps: {
  30003. "value": _s(masterPassword)
  30004. },
  30005. on: {
  30006. "input": function($event) {
  30007. if ($event.target.composing) return;
  30008. masterPassword = $event.target.value
  30009. }
  30010. }
  30011. }), " ", _h('fingerprint', {
  30012. attrs: {
  30013. "fingerprint": masterPassword
  30014. },
  30015. nativeOn: {
  30016. "click": function($event) {
  30017. showMasterPassword($event)
  30018. }
  30019. }
  30020. })])])]), " ", _h('div', {
  30021. staticClass: "form-group row"
  30022. }, [_h('div', {
  30023. staticClass: "col-xs-12"
  30024. }, [_h('div', {
  30025. staticClass: "input-group"
  30026. }, [_m(5), " ", _h('input', {
  30027. directives: [{
  30028. name: "model",
  30029. rawName: "v-model",
  30030. value: (generatedPassword),
  30031. expression: "generatedPassword"
  30032. }],
  30033. staticClass: "form-control",
  30034. attrs: {
  30035. "id": "generatedPassword",
  30036. "name": "generatedPassword",
  30037. "type": "text",
  30038. "tabindex": "-1",
  30039. "readonly": ""
  30040. },
  30041. domProps: {
  30042. "value": _s(generatedPassword)
  30043. },
  30044. on: {
  30045. "input": function($event) {
  30046. if ($event.target.composing) return;
  30047. generatedPassword = $event.target.value
  30048. }
  30049. }
  30050. }), " ", _h('span', {
  30051. staticClass: "input-group-btn"
  30052. }, [_h('button', {
  30053. staticClass: "btn-copy btn btn-primary",
  30054. attrs: {
  30055. "id": "copyPasswordButton",
  30056. "disabled": !generatedPassword,
  30057. "type": "button",
  30058. "data-clipboard-target": "#generatedPassword"
  30059. },
  30060. on: {
  30061. "click": function($event) {
  30062. cleanFormInSeconds(10)
  30063. }
  30064. }
  30065. }, [_m(6), " Copy\n "])])])])]), " ", _m(7), " ", _h('div', {
  30066. staticClass: "form-group row"
  30067. }, [_h('div', {
  30068. staticClass: "col-xs-12"
  30069. }, [_h('label', {
  30070. staticClass: "form-check-inline"
  30071. }, [_h('input', {
  30072. directives: [{
  30073. name: "model",
  30074. rawName: "v-model",
  30075. value: (password.lowercase),
  30076. expression: "password.lowercase"
  30077. }],
  30078. staticClass: "form-check-input",
  30079. attrs: {
  30080. "type": "checkbox",
  30081. "id": "lowercase"
  30082. },
  30083. domProps: {
  30084. "checked": Array.isArray(password.lowercase) ? _i(password.lowercase, null) > -1 : _q(password.lowercase, true)
  30085. },
  30086. on: {
  30087. "change": function($event) {
  30088. var $$a = password.lowercase,
  30089. $$el = $event.target,
  30090. $$c = $$el.checked ? (true) : (false);
  30091. if (Array.isArray($$a)) {
  30092. var $$v = null,
  30093. $$i = _i($$a, $$v);
  30094. if ($$c) {
  30095. $$i < 0 && (password.lowercase = $$a.concat($$v))
  30096. } else {
  30097. $$i > -1 && (password.lowercase = $$a.slice(0, $$i).concat($$a.slice($$i + 1)))
  30098. }
  30099. } else {
  30100. password.lowercase = $$c
  30101. }
  30102. }
  30103. }
  30104. }), " abc\n "]), " ", _h('label', {
  30105. staticClass: "form-check-inline"
  30106. }, [_h('input', {
  30107. directives: [{
  30108. name: "model",
  30109. rawName: "v-model",
  30110. value: (password.uppercase),
  30111. expression: "password.uppercase"
  30112. }],
  30113. staticClass: "form-check-input",
  30114. attrs: {
  30115. "type": "checkbox",
  30116. "id": "uppercase"
  30117. },
  30118. domProps: {
  30119. "checked": Array.isArray(password.uppercase) ? _i(password.uppercase, null) > -1 : _q(password.uppercase, true)
  30120. },
  30121. on: {
  30122. "change": function($event) {
  30123. var $$a = password.uppercase,
  30124. $$el = $event.target,
  30125. $$c = $$el.checked ? (true) : (false);
  30126. if (Array.isArray($$a)) {
  30127. var $$v = null,
  30128. $$i = _i($$a, $$v);
  30129. if ($$c) {
  30130. $$i < 0 && (password.uppercase = $$a.concat($$v))
  30131. } else {
  30132. $$i > -1 && (password.uppercase = $$a.slice(0, $$i).concat($$a.slice($$i + 1)))
  30133. }
  30134. } else {
  30135. password.uppercase = $$c
  30136. }
  30137. }
  30138. }
  30139. }), " ABC\n "]), " ", _h('label', {
  30140. staticClass: "form-check-inline"
  30141. }, [_h('input', {
  30142. directives: [{
  30143. name: "model",
  30144. rawName: "v-model",
  30145. value: (password.numbers),
  30146. expression: "password.numbers"
  30147. }],
  30148. staticClass: "form-check-input",
  30149. attrs: {
  30150. "type": "checkbox",
  30151. "id": "numbers"
  30152. },
  30153. domProps: {
  30154. "checked": Array.isArray(password.numbers) ? _i(password.numbers, null) > -1 : _q(password.numbers, true)
  30155. },
  30156. on: {
  30157. "change": function($event) {
  30158. var $$a = password.numbers,
  30159. $$el = $event.target,
  30160. $$c = $$el.checked ? (true) : (false);
  30161. if (Array.isArray($$a)) {
  30162. var $$v = null,
  30163. $$i = _i($$a, $$v);
  30164. if ($$c) {
  30165. $$i < 0 && (password.numbers = $$a.concat($$v))
  30166. } else {
  30167. $$i > -1 && (password.numbers = $$a.slice(0, $$i).concat($$a.slice($$i + 1)))
  30168. }
  30169. } else {
  30170. password.numbers = $$c
  30171. }
  30172. }
  30173. }
  30174. }), "\n 123\n "]), " ", _h('label', {
  30175. staticClass: "form-check-inline"
  30176. }, [_h('input', {
  30177. directives: [{
  30178. name: "model",
  30179. rawName: "v-model",
  30180. value: (password.symbols),
  30181. expression: "password.symbols"
  30182. }],
  30183. staticClass: "form-check-input",
  30184. attrs: {
  30185. "type": "checkbox",
  30186. "id": "symbols"
  30187. },
  30188. domProps: {
  30189. "checked": Array.isArray(password.symbols) ? _i(password.symbols, null) > -1 : _q(password.symbols, true)
  30190. },
  30191. on: {
  30192. "change": function($event) {
  30193. var $$a = password.symbols,
  30194. $$el = $event.target,
  30195. $$c = $$el.checked ? (true) : (false);
  30196. if (Array.isArray($$a)) {
  30197. var $$v = null,
  30198. $$i = _i($$a, $$v);
  30199. if ($$c) {
  30200. $$i < 0 && (password.symbols = $$a.concat($$v))
  30201. } else {
  30202. $$i > -1 && (password.symbols = $$a.slice(0, $$i).concat($$a.slice($$i + 1)))
  30203. }
  30204. } else {
  30205. password.symbols = $$c
  30206. }
  30207. }
  30208. }
  30209. }), "\n %!@\n "])])]), " ", _h('div', {
  30210. staticClass: "form-group row"
  30211. }, [_m(8), " ", _h('div', {
  30212. staticClass: "col-xs-3 pl-0"
  30213. }, [_h('input', {
  30214. directives: [{
  30215. name: "model",
  30216. rawName: "v-model",
  30217. value: (password.length),
  30218. expression: "password.length"
  30219. }],
  30220. staticClass: "form-control",
  30221. attrs: {
  30222. "type": "number",
  30223. "id": "passwordLength",
  30224. "min": "6"
  30225. },
  30226. domProps: {
  30227. "value": _s(password.length)
  30228. },
  30229. on: {
  30230. "input": function($event) {
  30231. if ($event.target.composing) return;
  30232. password.length = _n($event.target.value)
  30233. }
  30234. }
  30235. })]), " ", _m(9), " ", _h('div', {
  30236. staticClass: "col-xs-3 pl-0"
  30237. }, [_h('input', {
  30238. directives: [{
  30239. name: "model",
  30240. rawName: "v-model",
  30241. value: (password.counter),
  30242. expression: "password.counter"
  30243. }],
  30244. staticClass: "form-control",
  30245. attrs: {
  30246. "type": "number",
  30247. "id": "passwordCounter",
  30248. "min": "1"
  30249. },
  30250. domProps: {
  30251. "value": _s(password.counter)
  30252. },
  30253. on: {
  30254. "input": function($event) {
  30255. if ($event.target.composing) return;
  30256. password.counter = _n($event.target.value)
  30257. }
  30258. }
  30259. })])])])
  30260. }},staticRenderFns: [function (){with(this) {
  30261. return _h('i', {
  30262. staticClass: "fa fa-globe"
  30263. })
  30264. }},function (){with(this) {
  30265. return _h('i', {
  30266. staticClass: "fa fa-user"
  30267. })
  30268. }},function (){with(this) {
  30269. return _h('label', {
  30270. staticClass: "sr-only",
  30271. attrs: {
  30272. "for": "login"
  30273. }
  30274. }, ["Login"])
  30275. }},function (){with(this) {
  30276. return _h('label', {
  30277. staticClass: "sr-only",
  30278. attrs: {
  30279. "for": "masterPassword"
  30280. }
  30281. }, ["Password"])
  30282. }},function (){with(this) {
  30283. return _h('i', {
  30284. staticClass: "fa fa-lock"
  30285. })
  30286. }},function (){with(this) {
  30287. return _h('label', {
  30288. staticClass: "sr-only",
  30289. attrs: {
  30290. "for": "generatedPassword"
  30291. }
  30292. }, ["Password Generated"])
  30293. }},function (){with(this) {
  30294. return _h('i', {
  30295. staticClass: "fa fa-clipboard white"
  30296. })
  30297. }},function (){with(this) {
  30298. return _h('div', {
  30299. staticClass: "form-group row"
  30300. }, [_h('div', {
  30301. staticClass: "col-xs-12"
  30302. }, ["\n Password options\n ", _h('hr', {
  30303. attrs: {
  30304. "style": "margin:0;"
  30305. }
  30306. })])])
  30307. }},function (){with(this) {
  30308. return _h('label', {
  30309. staticClass: "col-xs-3 col-form-label",
  30310. attrs: {
  30311. "for": "passwordLength"
  30312. }
  30313. }, ["Length"])
  30314. }},function (){with(this) {
  30315. return _h('label', {
  30316. staticClass: "col-xs-3 col-form-label",
  30317. attrs: {
  30318. "for": "passwordCounter"
  30319. }
  30320. }, ["Counter"])
  30321. }}]}
  30322. /***/ },
  30323. /* 298 */
  30324. /***/ function(module, exports) {
  30325. module.exports={render:function (){with(this) {
  30326. return _h('div', {
  30327. staticClass: "card",
  30328. attrs: {
  30329. "id": "lesspass",
  30330. "style": "border:none;"
  30331. }
  30332. }, [_h('lesspass-menu'), " ", _h('div', {
  30333. staticClass: "card-block",
  30334. attrs: {
  30335. "style": "min-height: 400px;"
  30336. }
  30337. }, [_h('router-view')])])
  30338. }},staticRenderFns: []}
  30339. /***/ },
  30340. /* 299 */
  30341. /***/ function(module, exports) {
  30342. module.exports={render:function (){with(this) {
  30343. return _h('form', {
  30344. on: {
  30345. "submit": function($event) {
  30346. $event.preventDefault();
  30347. resetPassword($event)
  30348. }
  30349. }
  30350. }, [(showError) ? _h('div', {
  30351. staticClass: "form-group row"
  30352. }, [_m(0)]) : _e(), " ", (successMessage) ? _h('div', {
  30353. staticClass: "form-group row"
  30354. }, [_m(1)]) : _e(), " ", _h('div', {
  30355. staticClass: "form-group row"
  30356. }, [_h('div', {
  30357. staticClass: "col-xs-12"
  30358. }, [_h('div', {
  30359. staticClass: "inner-addon left-addon"
  30360. }, [_m(2), " ", _h('input', {
  30361. directives: [{
  30362. name: "model",
  30363. rawName: "v-model",
  30364. value: (email),
  30365. expression: "email"
  30366. }],
  30367. staticClass: "form-control",
  30368. attrs: {
  30369. "id": "email",
  30370. "name": "email",
  30371. "type": "email",
  30372. "placeholder": "Email"
  30373. },
  30374. domProps: {
  30375. "value": _s(email)
  30376. },
  30377. on: {
  30378. "input": function($event) {
  30379. if ($event.target.composing) return;
  30380. email = $event.target.value
  30381. }
  30382. }
  30383. }), " ", _h('small', {
  30384. staticClass: "form-text text-muted text-danger"
  30385. }, [(emailRequired) ? _h('span', ["An email is required"]) : _e()])])])]), " ", _h('div', {
  30386. staticClass: "form-group row"
  30387. }, [_h('div', {
  30388. staticClass: "col-xs-12"
  30389. }, [_h('button', {
  30390. staticClass: "btn btn-primary",
  30391. attrs: {
  30392. "id": "loginButton",
  30393. "type": "submit"
  30394. }
  30395. }, [(loading) ? _h('span', [_m(3)]) : _e(), "\n Send me a reset link\n "])])])])
  30396. }},staticRenderFns: [function (){with(this) {
  30397. return _h('div', {
  30398. staticClass: "col-xs-12 text-muted text-danger"
  30399. }, ["\n Oops! Something went wrong. Retry in a few minutes.\n "])
  30400. }},function (){with(this) {
  30401. return _h('div', {
  30402. staticClass: "col-xs-12 text-muted text-success"
  30403. }, ["\n If a matching account was found an email was sent to allow you to reset your password.\n "])
  30404. }},function (){with(this) {
  30405. return _h('i', {
  30406. staticClass: "fa fa-user"
  30407. })
  30408. }},function (){with(this) {
  30409. return _h('i', {
  30410. staticClass: "fa fa-spinner fa-pulse fa-fw"
  30411. })
  30412. }}]}
  30413. /***/ },
  30414. /* 300 */
  30415. /***/ function(module, exports) {
  30416. module.exports={render:function (){with(this) {
  30417. return _h('div', {
  30418. attrs: {
  30419. "id": "delete-button"
  30420. }
  30421. }, [_h('button', {
  30422. staticClass: "btn btn-danger",
  30423. attrs: {
  30424. "type": "button"
  30425. },
  30426. on: {
  30427. "click": confirm
  30428. }
  30429. }, [_m(0)])])
  30430. }},staticRenderFns: [function (){with(this) {
  30431. return _h('i', {
  30432. staticClass: "fa-white fa fa-trash"
  30433. })
  30434. }}]}
  30435. /***/ },
  30436. /* 301 */
  30437. /***/ function(module, exports) {
  30438. module.exports={render:function (){with(this) {
  30439. return _h('form', {
  30440. on: {
  30441. "submit": function($event) {
  30442. $event.preventDefault();
  30443. resetPasswordConfirm($event)
  30444. }
  30445. }
  30446. }, [(showError) ? _h('div', {
  30447. staticClass: "form-group row"
  30448. }, [_h('div', {
  30449. staticClass: "col-xs-12 text-muted text-danger"
  30450. }, ["\n " + _s(errorMessage) + "\n "])]) : _e(), " ", (successMessage) ? _h('div', {
  30451. staticClass: "form-group row"
  30452. }, [_h('div', {
  30453. staticClass: "col-xs-12 text-muted text-success"
  30454. }, ["\n You're password was reset successfully.\n ", _h('router-link', {
  30455. attrs: {
  30456. "to": {
  30457. name: 'login'
  30458. }
  30459. }
  30460. }, ["Do you want to login ?"])])]) : _e(), " ", _h('div', {
  30461. staticClass: "form-group row"
  30462. }, [_h('div', {
  30463. staticClass: "col-xs-12"
  30464. }, [_h('div', {
  30465. staticClass: "inner-addon left-addon"
  30466. }, [_m(0), " ", _h('input', {
  30467. directives: [{
  30468. name: "model",
  30469. rawName: "v-model",
  30470. value: (new_password),
  30471. expression: "new_password"
  30472. }],
  30473. staticClass: "form-control",
  30474. attrs: {
  30475. "id": "new-password",
  30476. "name": "new-password",
  30477. "type": "password",
  30478. "autocomplete": "new-password",
  30479. "placeholder": "New Password"
  30480. },
  30481. domProps: {
  30482. "value": _s(new_password)
  30483. },
  30484. on: {
  30485. "input": function($event) {
  30486. if ($event.target.composing) return;
  30487. new_password = $event.target.value
  30488. }
  30489. }
  30490. }), " ", _h('small', {
  30491. staticClass: "form-text text-muted text-danger"
  30492. }, [(passwordRequired) ? _h('span', ["A password is required"]) : _e()])])])]), " ", _m(1)])
  30493. }},staticRenderFns: [function (){with(this) {
  30494. return _h('i', {
  30495. staticClass: "fa fa-lock"
  30496. })
  30497. }},function (){with(this) {
  30498. return _h('div', {
  30499. staticClass: "form-group row"
  30500. }, [_h('div', {
  30501. staticClass: "col-xs-12"
  30502. }, [_h('button', {
  30503. staticClass: "btn btn-primary",
  30504. attrs: {
  30505. "id": "loginButton",
  30506. "type": "submit"
  30507. }
  30508. }, ["\n Reset my password\n "])])])
  30509. }}]}
  30510. /***/ },
  30511. /* 302 */
  30512. /***/ function(module, exports) {
  30513. module.exports={render:function (){with(this) {
  30514. return _h('div', {
  30515. attrs: {
  30516. "id": "menu"
  30517. }
  30518. }, [_h('div', {
  30519. directives: [{
  30520. name: "show",
  30521. rawName: "v-show",
  30522. value: (isAuthenticated),
  30523. expression: "isAuthenticated"
  30524. }],
  30525. staticClass: "card-header"
  30526. }, [_h('div', {
  30527. staticClass: "row"
  30528. }, [_h('div', {
  30529. staticClass: "col-xs-6"
  30530. }, [_h('router-link', {
  30531. staticClass: "grey-link",
  30532. attrs: {
  30533. "to": {
  30534. name: 'home'
  30535. }
  30536. }
  30537. }, ["LessPass"]), " ", _h('span', {
  30538. staticClass: " hint--right",
  30539. attrs: {
  30540. "aria-label": "Save password"
  30541. },
  30542. on: {
  30543. "click": saveOrUpdatePassword
  30544. }
  30545. }, [(passwordStatus == 'DIRTY') ? _h('i', {
  30546. staticClass: "fa fa-save ml-1 fa-clickable"
  30547. }) : _e()]), " ", (passwordStatus == 'CREATED') ? _h('span', {
  30548. staticClass: "text-success"
  30549. }, [_m(0), " saved\n "]) : _e(), " ", (passwordStatus == 'UPDATED') ? _h('span', {
  30550. staticClass: "text-success"
  30551. }, [_m(1), " updated\n "]) : _e()]), " ", _h('div', {
  30552. staticClass: "col-xs-6 text-xs-right"
  30553. }, [_h('router-link', {
  30554. staticClass: "grey-link ml-1",
  30555. attrs: {
  30556. "to": {
  30557. name: 'passwords'
  30558. }
  30559. }
  30560. }, [_m(2)]), " ", _h('button', {
  30561. staticClass: "grey-link ml-1 btn btn-link p-0 m-0",
  30562. attrs: {
  30563. "type": "button"
  30564. },
  30565. on: {
  30566. "click": logout
  30567. }
  30568. }, [_m(3)])])])]), " ", _h('div', {
  30569. directives: [{
  30570. name: "show",
  30571. rawName: "v-show",
  30572. value: (isGuest),
  30573. expression: "isGuest"
  30574. }],
  30575. staticClass: "card-header card-header-dark"
  30576. }, [_h('div', {
  30577. staticClass: "row"
  30578. }, [_h('div', {
  30579. staticClass: "index-header"
  30580. }, [_h('div', {
  30581. staticClass: "col-xs-6"
  30582. }, [_h('router-link', {
  30583. staticClass: "white-link",
  30584. attrs: {
  30585. "to": {
  30586. name: 'home'
  30587. }
  30588. }
  30589. }, ["LessPass"])]), " ", _h('div', {
  30590. staticClass: "col-xs-6 text-xs-right"
  30591. }, [_h('router-link', {
  30592. staticClass: "white-link",
  30593. attrs: {
  30594. "to": {
  30595. name: 'login'
  30596. }
  30597. }
  30598. }, [_m(4)])])])])])])
  30599. }},staticRenderFns: [function (){with(this) {
  30600. return _h('i', {
  30601. staticClass: "fa fa-check ml-1 text-success"
  30602. })
  30603. }},function (){with(this) {
  30604. return _h('i', {
  30605. staticClass: "fa fa-check ml-1 text-success"
  30606. })
  30607. }},function (){with(this) {
  30608. return _h('i', {
  30609. staticClass: "fa fa-key",
  30610. attrs: {
  30611. "aria-hidden": "true"
  30612. }
  30613. })
  30614. }},function (){with(this) {
  30615. return _h('i', {
  30616. staticClass: "fa fa-sign-out",
  30617. attrs: {
  30618. "aria-hidden": "true"
  30619. }
  30620. })
  30621. }},function (){with(this) {
  30622. return _h('i', {
  30623. staticClass: "fa fa-user-secret white",
  30624. attrs: {
  30625. "aria-hidden": "true"
  30626. }
  30627. })
  30628. }}]}
  30629. /***/ },
  30630. /* 303 */
  30631. /***/ function(module, exports, __webpack_require__) {
  30632. /**
  30633. * vue-router v2.0.1
  30634. * (c) 2016 Evan You
  30635. * @license MIT
  30636. */
  30637. (function (global, factory) {
  30638. true ? module.exports = factory() :
  30639. typeof define === 'function' && define.amd ? define(factory) :
  30640. (global.VueRouter = factory());
  30641. }(this, (function () { 'use strict';
  30642. var View = {
  30643. name: 'router-view',
  30644. functional: true,
  30645. props: {
  30646. name: {
  30647. type: String,
  30648. default: 'default'
  30649. }
  30650. },
  30651. render: function render (h, ref) {
  30652. var props = ref.props;
  30653. var children = ref.children;
  30654. var parent = ref.parent;
  30655. var data = ref.data;
  30656. data.routerView = true
  30657. var route = parent.$route
  30658. var cache = parent._routerViewCache || (parent._routerViewCache = {})
  30659. var depth = 0
  30660. var inactive = false
  30661. while (parent) {
  30662. if (parent.$vnode && parent.$vnode.data.routerView) {
  30663. depth++
  30664. }
  30665. if (parent._inactive) {
  30666. inactive = true
  30667. }
  30668. parent = parent.$parent
  30669. }
  30670. data.routerViewDepth = depth
  30671. var matched = route.matched[depth]
  30672. if (!matched) {
  30673. return h()
  30674. }
  30675. var name = props.name
  30676. var component = inactive
  30677. ? cache[name]
  30678. : (cache[name] = matched.components[name])
  30679. if (!inactive) {
  30680. var hooks = data.hook || (data.hook = {})
  30681. hooks.init = function (vnode) {
  30682. matched.instances[name] = vnode.child
  30683. }
  30684. hooks.destroy = function (vnode) {
  30685. if (matched.instances[name] === vnode.child) {
  30686. matched.instances[name] = undefined
  30687. }
  30688. }
  30689. }
  30690. return h(component, data, children)
  30691. }
  30692. }
  30693. /* */
  30694. function resolvePath (
  30695. relative,
  30696. base,
  30697. append
  30698. ) {
  30699. if (relative.charAt(0) === '/') {
  30700. return relative
  30701. }
  30702. if (relative.charAt(0) === '?' || relative.charAt(0) === '#') {
  30703. return base + relative
  30704. }
  30705. var stack = base.split('/')
  30706. // remove trailing segment if:
  30707. // - not appending
  30708. // - appending to trailing slash (last segment is empty)
  30709. if (!append || !stack[stack.length - 1]) {
  30710. stack.pop()
  30711. }
  30712. // resolve relative path
  30713. var segments = relative.replace(/^\//, '').split('/')
  30714. for (var i = 0; i < segments.length; i++) {
  30715. var segment = segments[i]
  30716. if (segment === '.') {
  30717. continue
  30718. } else if (segment === '..') {
  30719. stack.pop()
  30720. } else {
  30721. stack.push(segment)
  30722. }
  30723. }
  30724. // ensure leading slash
  30725. if (stack[0] !== '') {
  30726. stack.unshift('')
  30727. }
  30728. return stack.join('/')
  30729. }
  30730. function parsePath (path) {
  30731. var hash = ''
  30732. var query = ''
  30733. var hashIndex = path.indexOf('#')
  30734. if (hashIndex >= 0) {
  30735. hash = path.slice(hashIndex)
  30736. path = path.slice(0, hashIndex)
  30737. }
  30738. var queryIndex = path.indexOf('?')
  30739. if (queryIndex >= 0) {
  30740. query = path.slice(queryIndex + 1)
  30741. path = path.slice(0, queryIndex)
  30742. }
  30743. return {
  30744. path: path,
  30745. query: query,
  30746. hash: hash
  30747. }
  30748. }
  30749. function cleanPath (path) {
  30750. return path.replace(/\/\//g, '/')
  30751. }
  30752. /* */
  30753. function assert (condition, message) {
  30754. if (!condition) {
  30755. throw new Error(("[vue-router] " + message))
  30756. }
  30757. }
  30758. function warn (condition, message) {
  30759. if (!condition) {
  30760. typeof console !== 'undefined' && console.warn(("[vue-router] " + message))
  30761. }
  30762. }
  30763. /* */
  30764. var encode = encodeURIComponent
  30765. var decode = decodeURIComponent
  30766. function resolveQuery (
  30767. query,
  30768. extraQuery
  30769. ) {
  30770. if ( extraQuery === void 0 ) extraQuery = {};
  30771. if (query) {
  30772. var parsedQuery
  30773. try {
  30774. parsedQuery = parseQuery(query)
  30775. } catch (e) {
  30776. warn(false, e.message)
  30777. parsedQuery = {}
  30778. }
  30779. for (var key in extraQuery) {
  30780. parsedQuery[key] = extraQuery[key]
  30781. }
  30782. return parsedQuery
  30783. } else {
  30784. return extraQuery
  30785. }
  30786. }
  30787. function parseQuery (query) {
  30788. var res = Object.create(null)
  30789. query = query.trim().replace(/^(\?|#|&)/, '')
  30790. if (!query) {
  30791. return res
  30792. }
  30793. query.split('&').forEach(function (param) {
  30794. var parts = param.replace(/\+/g, ' ').split('=')
  30795. var key = decode(parts.shift())
  30796. var val = parts.length > 0
  30797. ? decode(parts.join('='))
  30798. : null
  30799. if (res[key] === undefined) {
  30800. res[key] = val
  30801. } else if (Array.isArray(res[key])) {
  30802. res[key].push(val)
  30803. } else {
  30804. res[key] = [res[key], val]
  30805. }
  30806. })
  30807. return res
  30808. }
  30809. function stringifyQuery (obj) {
  30810. var res = obj ? Object.keys(obj).sort().map(function (key) {
  30811. var val = obj[key]
  30812. if (val === undefined) {
  30813. return ''
  30814. }
  30815. if (val === null) {
  30816. return encode(key)
  30817. }
  30818. if (Array.isArray(val)) {
  30819. var result = []
  30820. val.slice().forEach(function (val2) {
  30821. if (val2 === undefined) {
  30822. return
  30823. }
  30824. if (val2 === null) {
  30825. result.push(encode(key))
  30826. } else {
  30827. result.push(encode(key) + '=' + encode(val2))
  30828. }
  30829. })
  30830. return result.join('&')
  30831. }
  30832. return encode(key) + '=' + encode(val)
  30833. }).filter(function (x) { return x.length > 0; }).join('&') : null
  30834. return res ? ("?" + res) : ''
  30835. }
  30836. /* */
  30837. function createRoute (
  30838. record,
  30839. location,
  30840. redirectedFrom
  30841. ) {
  30842. var route = {
  30843. name: location.name || (record && record.name),
  30844. meta: (record && record.meta) || {},
  30845. path: location.path || '/',
  30846. hash: location.hash || '',
  30847. query: location.query || {},
  30848. params: location.params || {},
  30849. fullPath: getFullPath(location),
  30850. matched: record ? formatMatch(record) : []
  30851. }
  30852. if (redirectedFrom) {
  30853. route.redirectedFrom = getFullPath(redirectedFrom)
  30854. }
  30855. return Object.freeze(route)
  30856. }
  30857. // the starting route that represents the initial state
  30858. var START = createRoute(null, {
  30859. path: '/'
  30860. })
  30861. function formatMatch (record) {
  30862. var res = []
  30863. while (record) {
  30864. res.unshift(record)
  30865. record = record.parent
  30866. }
  30867. return res
  30868. }
  30869. function getFullPath (ref) {
  30870. var path = ref.path;
  30871. var query = ref.query; if ( query === void 0 ) query = {};
  30872. var hash = ref.hash; if ( hash === void 0 ) hash = '';
  30873. return (path || '/') + stringifyQuery(query) + hash
  30874. }
  30875. var trailingSlashRE = /\/$/
  30876. function isSameRoute (a, b) {
  30877. if (b === START) {
  30878. return a === b
  30879. } else if (!b) {
  30880. return false
  30881. } else if (a.path && b.path) {
  30882. return (
  30883. a.path.replace(trailingSlashRE, '') === b.path.replace(trailingSlashRE, '') &&
  30884. a.hash === b.hash &&
  30885. isObjectEqual(a.query, b.query)
  30886. )
  30887. } else if (a.name && b.name) {
  30888. return (
  30889. a.name === b.name &&
  30890. a.hash === b.hash &&
  30891. isObjectEqual(a.query, b.query) &&
  30892. isObjectEqual(a.params, b.params)
  30893. )
  30894. } else {
  30895. return false
  30896. }
  30897. }
  30898. function isObjectEqual (a, b) {
  30899. if ( a === void 0 ) a = {};
  30900. if ( b === void 0 ) b = {};
  30901. var aKeys = Object.keys(a)
  30902. var bKeys = Object.keys(b)
  30903. if (aKeys.length !== bKeys.length) {
  30904. return false
  30905. }
  30906. return aKeys.every(function (key) { return String(a[key]) === String(b[key]); })
  30907. }
  30908. function isIncludedRoute (current, target) {
  30909. return (
  30910. current.path.indexOf(target.path) === 0 &&
  30911. (!target.hash || current.hash === target.hash) &&
  30912. queryIncludes(current.query, target.query)
  30913. )
  30914. }
  30915. function queryIncludes (current, target) {
  30916. for (var key in target) {
  30917. if (!(key in current)) {
  30918. return false
  30919. }
  30920. }
  30921. return true
  30922. }
  30923. /* */
  30924. function normalizeLocation (
  30925. raw,
  30926. current,
  30927. append
  30928. ) {
  30929. var next = typeof raw === 'string' ? { path: raw } : raw
  30930. if (next.name || next._normalized) {
  30931. return next
  30932. }
  30933. var parsedPath = parsePath(next.path || '')
  30934. var basePath = (current && current.path) || '/'
  30935. var path = parsedPath.path
  30936. ? resolvePath(parsedPath.path, basePath, append)
  30937. : (current && current.path) || '/'
  30938. var query = resolveQuery(parsedPath.query, next.query)
  30939. var hash = next.hash || parsedPath.hash
  30940. if (hash && hash.charAt(0) !== '#') {
  30941. hash = "#" + hash
  30942. }
  30943. return {
  30944. _normalized: true,
  30945. path: path,
  30946. query: query,
  30947. hash: hash
  30948. }
  30949. }
  30950. /* */
  30951. // work around weird flow bug
  30952. var toTypes = [String, Object]
  30953. var Link = {
  30954. name: 'router-link',
  30955. props: {
  30956. to: {
  30957. type: toTypes,
  30958. required: true
  30959. },
  30960. tag: {
  30961. type: String,
  30962. default: 'a'
  30963. },
  30964. exact: Boolean,
  30965. append: Boolean,
  30966. replace: Boolean,
  30967. activeClass: String
  30968. },
  30969. render: function render (h) {
  30970. var this$1 = this;
  30971. var router = this.$router
  30972. var current = this.$route
  30973. var to = normalizeLocation(this.to, current, this.append)
  30974. var resolved = router.match(to)
  30975. var fullPath = resolved.redirectedFrom || resolved.fullPath
  30976. var base = router.history.base
  30977. var href = base ? cleanPath(base + fullPath) : fullPath
  30978. var classes = {}
  30979. var activeClass = this.activeClass || router.options.linkActiveClass || 'router-link-active'
  30980. var compareTarget = to.path ? createRoute(null, to) : resolved
  30981. classes[activeClass] = this.exact
  30982. ? isSameRoute(current, compareTarget)
  30983. : isIncludedRoute(current, compareTarget)
  30984. var on = {
  30985. click: function (e) {
  30986. // don't redirect with control keys
  30987. /* istanbul ignore if */
  30988. if (e.metaKey || e.ctrlKey || e.shiftKey) { return }
  30989. // don't redirect when preventDefault called
  30990. /* istanbul ignore if */
  30991. if (e.defaultPrevented) { return }
  30992. // don't redirect on right click
  30993. /* istanbul ignore if */
  30994. if (e.button !== 0) { return }
  30995. e.preventDefault()
  30996. if (this$1.replace) {
  30997. router.replace(to)
  30998. } else {
  30999. router.push(to)
  31000. }
  31001. }
  31002. }
  31003. var data = {
  31004. class: classes
  31005. }
  31006. if (this.tag === 'a') {
  31007. data.on = on
  31008. data.attrs = { href: href }
  31009. } else {
  31010. // find the first <a> child and apply listener and href
  31011. var a = findAnchor(this.$slots.default)
  31012. if (a) {
  31013. var aData = a.data || (a.data = {})
  31014. aData.on = on
  31015. var aAttrs = aData.attrs || (aData.attrs = {})
  31016. aAttrs.href = href
  31017. } else {
  31018. // doesn't have <a> child, apply listener to self
  31019. data.on = on
  31020. }
  31021. }
  31022. return h(this.tag, data, this.$slots.default)
  31023. }
  31024. }
  31025. function findAnchor (children) {
  31026. if (children) {
  31027. var child
  31028. for (var i = 0; i < children.length; i++) {
  31029. child = children[i]
  31030. if (child.tag === 'a') {
  31031. return child
  31032. }
  31033. if (child.children && (child = findAnchor(child.children))) {
  31034. return child
  31035. }
  31036. }
  31037. }
  31038. }
  31039. function install (Vue) {
  31040. if (install.installed) { return }
  31041. install.installed = true
  31042. Object.defineProperty(Vue.prototype, '$router', {
  31043. get: function get () { return this.$root._router }
  31044. })
  31045. Object.defineProperty(Vue.prototype, '$route', {
  31046. get: function get$1 () { return this.$root._route }
  31047. })
  31048. Vue.mixin({
  31049. beforeCreate: function beforeCreate () {
  31050. if (this.$options.router) {
  31051. this._router = this.$options.router
  31052. this._router.init(this)
  31053. Vue.util.defineReactive(this, '_route', this._router.history.current)
  31054. }
  31055. }
  31056. })
  31057. Vue.component('router-view', View)
  31058. Vue.component('router-link', Link)
  31059. }
  31060. var __moduleExports = Array.isArray || function (arr) {
  31061. return Object.prototype.toString.call(arr) == '[object Array]';
  31062. };
  31063. var isarray = __moduleExports
  31064. /**
  31065. * Expose `pathToRegexp`.
  31066. */
  31067. var index = pathToRegexp
  31068. var parse_1 = parse
  31069. var compile_1 = compile
  31070. var tokensToFunction_1 = tokensToFunction
  31071. var tokensToRegExp_1 = tokensToRegExp
  31072. /**
  31073. * The main path matching regexp utility.
  31074. *
  31075. * @type {RegExp}
  31076. */
  31077. var PATH_REGEXP = new RegExp([
  31078. // Match escaped characters that would otherwise appear in future matches.
  31079. // This allows the user to escape special characters that won't transform.
  31080. '(\\\\.)',
  31081. // Match Express-style parameters and un-named parameters with a prefix
  31082. // and optional suffixes. Matches appear as:
  31083. //
  31084. // "/:test(\\d+)?" => ["/", "test", "\d+", undefined, "?", undefined]
  31085. // "/route(\\d+)" => [undefined, undefined, undefined, "\d+", undefined, undefined]
  31086. // "/*" => ["/", undefined, undefined, undefined, undefined, "*"]
  31087. '([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))'
  31088. ].join('|'), 'g')
  31089. /**
  31090. * Parse a string for the raw tokens.
  31091. *
  31092. * @param {string} str
  31093. * @return {!Array}
  31094. */
  31095. function parse (str) {
  31096. var tokens = []
  31097. var key = 0
  31098. var index = 0
  31099. var path = ''
  31100. var res
  31101. while ((res = PATH_REGEXP.exec(str)) != null) {
  31102. var m = res[0]
  31103. var escaped = res[1]
  31104. var offset = res.index
  31105. path += str.slice(index, offset)
  31106. index = offset + m.length
  31107. // Ignore already escaped sequences.
  31108. if (escaped) {
  31109. path += escaped[1]
  31110. continue
  31111. }
  31112. var next = str[index]
  31113. var prefix = res[2]
  31114. var name = res[3]
  31115. var capture = res[4]
  31116. var group = res[5]
  31117. var modifier = res[6]
  31118. var asterisk = res[7]
  31119. // Push the current path onto the tokens.
  31120. if (path) {
  31121. tokens.push(path)
  31122. path = ''
  31123. }
  31124. var partial = prefix != null && next != null && next !== prefix
  31125. var repeat = modifier === '+' || modifier === '*'
  31126. var optional = modifier === '?' || modifier === '*'
  31127. var delimiter = res[2] || '/'
  31128. var pattern = capture || group || (asterisk ? '.*' : '[^' + delimiter + ']+?')
  31129. tokens.push({
  31130. name: name || key++,
  31131. prefix: prefix || '',
  31132. delimiter: delimiter,
  31133. optional: optional,
  31134. repeat: repeat,
  31135. partial: partial,
  31136. asterisk: !!asterisk,
  31137. pattern: escapeGroup(pattern)
  31138. })
  31139. }
  31140. // Match any characters still remaining.
  31141. if (index < str.length) {
  31142. path += str.substr(index)
  31143. }
  31144. // If the path exists, push it onto the end.
  31145. if (path) {
  31146. tokens.push(path)
  31147. }
  31148. return tokens
  31149. }
  31150. /**
  31151. * Compile a string to a template function for the path.
  31152. *
  31153. * @param {string} str
  31154. * @return {!function(Object=, Object=)}
  31155. */
  31156. function compile (str) {
  31157. return tokensToFunction(parse(str))
  31158. }
  31159. /**
  31160. * Prettier encoding of URI path segments.
  31161. *
  31162. * @param {string}
  31163. * @return {string}
  31164. */
  31165. function encodeURIComponentPretty (str) {
  31166. return encodeURI(str).replace(/[\/?#]/g, function (c) {
  31167. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  31168. })
  31169. }
  31170. /**
  31171. * Encode the asterisk parameter. Similar to `pretty`, but allows slashes.
  31172. *
  31173. * @param {string}
  31174. * @return {string}
  31175. */
  31176. function encodeAsterisk (str) {
  31177. return encodeURI(str).replace(/[?#]/g, function (c) {
  31178. return '%' + c.charCodeAt(0).toString(16).toUpperCase()
  31179. })
  31180. }
  31181. /**
  31182. * Expose a method for transforming tokens into the path function.
  31183. */
  31184. function tokensToFunction (tokens) {
  31185. // Compile all the tokens into regexps.
  31186. var matches = new Array(tokens.length)
  31187. // Compile all the patterns before compilation.
  31188. for (var i = 0; i < tokens.length; i++) {
  31189. if (typeof tokens[i] === 'object') {
  31190. matches[i] = new RegExp('^(?:' + tokens[i].pattern + ')$')
  31191. }
  31192. }
  31193. return function (obj, opts) {
  31194. var path = ''
  31195. var data = obj || {}
  31196. var options = opts || {}
  31197. var encode = options.pretty ? encodeURIComponentPretty : encodeURIComponent
  31198. for (var i = 0; i < tokens.length; i++) {
  31199. var token = tokens[i]
  31200. if (typeof token === 'string') {
  31201. path += token
  31202. continue
  31203. }
  31204. var value = data[token.name]
  31205. var segment
  31206. if (value == null) {
  31207. if (token.optional) {
  31208. // Prepend partial segment prefixes.
  31209. if (token.partial) {
  31210. path += token.prefix
  31211. }
  31212. continue
  31213. } else {
  31214. throw new TypeError('Expected "' + token.name + '" to be defined')
  31215. }
  31216. }
  31217. if (isarray(value)) {
  31218. if (!token.repeat) {
  31219. throw new TypeError('Expected "' + token.name + '" to not repeat, but received `' + JSON.stringify(value) + '`')
  31220. }
  31221. if (value.length === 0) {
  31222. if (token.optional) {
  31223. continue
  31224. } else {
  31225. throw new TypeError('Expected "' + token.name + '" to not be empty')
  31226. }
  31227. }
  31228. for (var j = 0; j < value.length; j++) {
  31229. segment = encode(value[j])
  31230. if (!matches[i].test(segment)) {
  31231. throw new TypeError('Expected all "' + token.name + '" to match "' + token.pattern + '", but received `' + JSON.stringify(segment) + '`')
  31232. }
  31233. path += (j === 0 ? token.prefix : token.delimiter) + segment
  31234. }
  31235. continue
  31236. }
  31237. segment = token.asterisk ? encodeAsterisk(value) : encode(value)
  31238. if (!matches[i].test(segment)) {
  31239. throw new TypeError('Expected "' + token.name + '" to match "' + token.pattern + '", but received "' + segment + '"')
  31240. }
  31241. path += token.prefix + segment
  31242. }
  31243. return path
  31244. }
  31245. }
  31246. /**
  31247. * Escape a regular expression string.
  31248. *
  31249. * @param {string} str
  31250. * @return {string}
  31251. */
  31252. function escapeString (str) {
  31253. return str.replace(/([.+*?=^!:${}()[\]|\/\\])/g, '\\$1')
  31254. }
  31255. /**
  31256. * Escape the capturing group by escaping special characters and meaning.
  31257. *
  31258. * @param {string} group
  31259. * @return {string}
  31260. */
  31261. function escapeGroup (group) {
  31262. return group.replace(/([=!:$\/()])/g, '\\$1')
  31263. }
  31264. /**
  31265. * Attach the keys as a property of the regexp.
  31266. *
  31267. * @param {!RegExp} re
  31268. * @param {Array} keys
  31269. * @return {!RegExp}
  31270. */
  31271. function attachKeys (re, keys) {
  31272. re.keys = keys
  31273. return re
  31274. }
  31275. /**
  31276. * Get the flags for a regexp from the options.
  31277. *
  31278. * @param {Object} options
  31279. * @return {string}
  31280. */
  31281. function flags (options) {
  31282. return options.sensitive ? '' : 'i'
  31283. }
  31284. /**
  31285. * Pull out keys from a regexp.
  31286. *
  31287. * @param {!RegExp} path
  31288. * @param {!Array} keys
  31289. * @return {!RegExp}
  31290. */
  31291. function regexpToRegexp (path, keys) {
  31292. // Use a negative lookahead to match only capturing groups.
  31293. var groups = path.source.match(/\((?!\?)/g)
  31294. if (groups) {
  31295. for (var i = 0; i < groups.length; i++) {
  31296. keys.push({
  31297. name: i,
  31298. prefix: null,
  31299. delimiter: null,
  31300. optional: false,
  31301. repeat: false,
  31302. partial: false,
  31303. asterisk: false,
  31304. pattern: null
  31305. })
  31306. }
  31307. }
  31308. return attachKeys(path, keys)
  31309. }
  31310. /**
  31311. * Transform an array into a regexp.
  31312. *
  31313. * @param {!Array} path
  31314. * @param {Array} keys
  31315. * @param {!Object} options
  31316. * @return {!RegExp}
  31317. */
  31318. function arrayToRegexp (path, keys, options) {
  31319. var parts = []
  31320. for (var i = 0; i < path.length; i++) {
  31321. parts.push(pathToRegexp(path[i], keys, options).source)
  31322. }
  31323. var regexp = new RegExp('(?:' + parts.join('|') + ')', flags(options))
  31324. return attachKeys(regexp, keys)
  31325. }
  31326. /**
  31327. * Create a path regexp from string input.
  31328. *
  31329. * @param {string} path
  31330. * @param {!Array} keys
  31331. * @param {!Object} options
  31332. * @return {!RegExp}
  31333. */
  31334. function stringToRegexp (path, keys, options) {
  31335. var tokens = parse(path)
  31336. var re = tokensToRegExp(tokens, options)
  31337. // Attach keys back to the regexp.
  31338. for (var i = 0; i < tokens.length; i++) {
  31339. if (typeof tokens[i] !== 'string') {
  31340. keys.push(tokens[i])
  31341. }
  31342. }
  31343. return attachKeys(re, keys)
  31344. }
  31345. /**
  31346. * Expose a function for taking tokens and returning a RegExp.
  31347. *
  31348. * @param {!Array} tokens
  31349. * @param {Object=} options
  31350. * @return {!RegExp}
  31351. */
  31352. function tokensToRegExp (tokens, options) {
  31353. options = options || {}
  31354. var strict = options.strict
  31355. var end = options.end !== false
  31356. var route = ''
  31357. var lastToken = tokens[tokens.length - 1]
  31358. var endsWithSlash = typeof lastToken === 'string' && /\/$/.test(lastToken)
  31359. // Iterate over the tokens and create our regexp string.
  31360. for (var i = 0; i < tokens.length; i++) {
  31361. var token = tokens[i]
  31362. if (typeof token === 'string') {
  31363. route += escapeString(token)
  31364. } else {
  31365. var prefix = escapeString(token.prefix)
  31366. var capture = '(?:' + token.pattern + ')'
  31367. if (token.repeat) {
  31368. capture += '(?:' + prefix + capture + ')*'
  31369. }
  31370. if (token.optional) {
  31371. if (!token.partial) {
  31372. capture = '(?:' + prefix + '(' + capture + '))?'
  31373. } else {
  31374. capture = prefix + '(' + capture + ')?'
  31375. }
  31376. } else {
  31377. capture = prefix + '(' + capture + ')'
  31378. }
  31379. route += capture
  31380. }
  31381. }
  31382. // In non-strict mode we allow a slash at the end of match. If the path to
  31383. // match already ends with a slash, we remove it for consistency. The slash
  31384. // is valid at the end of a path match, not in the middle. This is important
  31385. // in non-ending mode, where "/test/" shouldn't match "/test//route".
  31386. if (!strict) {
  31387. route = (endsWithSlash ? route.slice(0, -2) : route) + '(?:\\/(?=$))?'
  31388. }
  31389. if (end) {
  31390. route += '$'
  31391. } else {
  31392. // In non-ending mode, we need the capturing groups to match as much as
  31393. // possible by using a positive lookahead to the end or next path segment.
  31394. route += strict && endsWithSlash ? '' : '(?=\\/|$)'
  31395. }
  31396. return new RegExp('^' + route, flags(options))
  31397. }
  31398. /**
  31399. * Normalize the given path string, returning a regular expression.
  31400. *
  31401. * An empty array can be passed in for the keys, which will hold the
  31402. * placeholder key descriptions. For example, using `/user/:id`, `keys` will
  31403. * contain `[{ name: 'id', delimiter: '/', optional: false, repeat: false }]`.
  31404. *
  31405. * @param {(string|RegExp|Array)} path
  31406. * @param {(Array|Object)=} keys
  31407. * @param {Object=} options
  31408. * @return {!RegExp}
  31409. */
  31410. function pathToRegexp (path, keys, options) {
  31411. keys = keys || []
  31412. if (!isarray(keys)) {
  31413. options = /** @type {!Object} */ (keys)
  31414. keys = []
  31415. } else if (!options) {
  31416. options = {}
  31417. }
  31418. if (path instanceof RegExp) {
  31419. return regexpToRegexp(path, /** @type {!Array} */ (keys))
  31420. }
  31421. if (isarray(path)) {
  31422. return arrayToRegexp(/** @type {!Array} */ (path), /** @type {!Array} */ (keys), options)
  31423. }
  31424. return stringToRegexp(/** @type {string} */ (path), /** @type {!Array} */ (keys), options)
  31425. }
  31426. index.parse = parse_1;
  31427. index.compile = compile_1;
  31428. index.tokensToFunction = tokensToFunction_1;
  31429. index.tokensToRegExp = tokensToRegExp_1;
  31430. /* */
  31431. function createRouteMap (routes) {
  31432. var pathMap = Object.create(null)
  31433. var nameMap = Object.create(null)
  31434. routes.forEach(function (route) {
  31435. addRouteRecord(pathMap, nameMap, route)
  31436. })
  31437. return {
  31438. pathMap: pathMap,
  31439. nameMap: nameMap
  31440. }
  31441. }
  31442. function addRouteRecord (
  31443. pathMap,
  31444. nameMap,
  31445. route,
  31446. parent,
  31447. matchAs
  31448. ) {
  31449. var path = route.path;
  31450. var name = route.name;
  31451. assert(path != null, "\"path\" is required in a route configuration.")
  31452. var record = {
  31453. path: normalizePath(path, parent),
  31454. components: route.components || { default: route.component },
  31455. instances: {},
  31456. name: name,
  31457. parent: parent,
  31458. matchAs: matchAs,
  31459. redirect: route.redirect,
  31460. beforeEnter: route.beforeEnter,
  31461. meta: route.meta || {}
  31462. }
  31463. if (route.children) {
  31464. // Warn if route is named and has a default child route.
  31465. // If users navigate to this route by name, the default child will
  31466. // not be rendered (GH Issue #629)
  31467. if (false) {}
  31468. route.children.forEach(function (child) {
  31469. addRouteRecord(pathMap, nameMap, child, record)
  31470. })
  31471. }
  31472. if (route.alias) {
  31473. if (Array.isArray(route.alias)) {
  31474. route.alias.forEach(function (alias) {
  31475. addRouteRecord(pathMap, nameMap, { path: alias }, parent, record.path)
  31476. })
  31477. } else {
  31478. addRouteRecord(pathMap, nameMap, { path: route.alias }, parent, record.path)
  31479. }
  31480. }
  31481. pathMap[record.path] = record
  31482. if (name) { nameMap[name] = record }
  31483. }
  31484. function normalizePath (path, parent) {
  31485. path = path.replace(/\/$/, '')
  31486. if (path[0] === '/') { return path }
  31487. if (parent == null) { return path }
  31488. return cleanPath(((parent.path) + "/" + path))
  31489. }
  31490. /* */
  31491. var regexpCache = Object.create(null)
  31492. var regexpCompileCache = Object.create(null)
  31493. function createMatcher (routes) {
  31494. var ref = createRouteMap(routes);
  31495. var pathMap = ref.pathMap;
  31496. var nameMap = ref.nameMap;
  31497. function match (
  31498. raw,
  31499. currentRoute,
  31500. redirectedFrom
  31501. ) {
  31502. var location = normalizeLocation(raw, currentRoute)
  31503. var name = location.name;
  31504. if (name) {
  31505. var record = nameMap[name]
  31506. if (record) {
  31507. location.path = fillParams(record.path, location.params, ("named route \"" + name + "\""))
  31508. return _createRoute(record, location, redirectedFrom)
  31509. }
  31510. } else if (location.path) {
  31511. location.params = {}
  31512. for (var path in pathMap) {
  31513. if (matchRoute(path, location.params, location.path)) {
  31514. return _createRoute(pathMap[path], location, redirectedFrom)
  31515. }
  31516. }
  31517. }
  31518. // no match
  31519. return _createRoute(null, location)
  31520. }
  31521. function redirect (
  31522. record,
  31523. location
  31524. ) {
  31525. var originalRedirect = record.redirect
  31526. var redirect = typeof originalRedirect === 'function'
  31527. ? originalRedirect(createRoute(record, location))
  31528. : originalRedirect
  31529. if (typeof redirect === 'string') {
  31530. redirect = { path: redirect }
  31531. }
  31532. if (!redirect || typeof redirect !== 'object') {
  31533. warn(false, ("invalid redirect option: " + (JSON.stringify(redirect))))
  31534. return _createRoute(null, location)
  31535. }
  31536. var re = redirect
  31537. var name = re.name;
  31538. var path = re.path;
  31539. var query = location.query;
  31540. var hash = location.hash;
  31541. var params = location.params;
  31542. query = re.hasOwnProperty('query') ? re.query : query
  31543. hash = re.hasOwnProperty('hash') ? re.hash : hash
  31544. params = re.hasOwnProperty('params') ? re.params : params
  31545. if (name) {
  31546. // resolved named direct
  31547. var targetRecord = nameMap[name]
  31548. assert(targetRecord, ("redirect failed: named route \"" + name + "\" not found."))
  31549. return match({
  31550. _normalized: true,
  31551. name: name,
  31552. query: query,
  31553. hash: hash,
  31554. params: params
  31555. }, undefined, location)
  31556. } else if (path) {
  31557. // 1. resolve relative redirect
  31558. var rawPath = resolveRecordPath(path, record)
  31559. // 2. resolve params
  31560. var resolvedPath = fillParams(rawPath, params, ("redirect route with path \"" + rawPath + "\""))
  31561. // 3. rematch with existing query and hash
  31562. return match({
  31563. _normalized: true,
  31564. path: resolvedPath,
  31565. query: query,
  31566. hash: hash
  31567. }, undefined, location)
  31568. } else {
  31569. warn(false, ("invalid redirect option: " + (JSON.stringify(redirect))))
  31570. return _createRoute(null, location)
  31571. }
  31572. }
  31573. function alias (
  31574. record,
  31575. location,
  31576. matchAs
  31577. ) {
  31578. var aliasedPath = fillParams(matchAs, location.params, ("aliased route with path \"" + matchAs + "\""))
  31579. var aliasedMatch = match({
  31580. _normalized: true,
  31581. path: aliasedPath
  31582. })
  31583. if (aliasedMatch) {
  31584. var matched = aliasedMatch.matched
  31585. var aliasedRecord = matched[matched.length - 1]
  31586. location.params = aliasedMatch.params
  31587. return _createRoute(aliasedRecord, location)
  31588. }
  31589. return _createRoute(null, location)
  31590. }
  31591. function _createRoute (
  31592. record,
  31593. location,
  31594. redirectedFrom
  31595. ) {
  31596. if (record && record.redirect) {
  31597. return redirect(record, redirectedFrom || location)
  31598. }
  31599. if (record && record.matchAs) {
  31600. return alias(record, location, record.matchAs)
  31601. }
  31602. return createRoute(record, location, redirectedFrom)
  31603. }
  31604. return match
  31605. }
  31606. function matchRoute (
  31607. path,
  31608. params,
  31609. pathname
  31610. ) {
  31611. var keys, regexp
  31612. var hit = regexpCache[path]
  31613. if (hit) {
  31614. keys = hit.keys
  31615. regexp = hit.regexp
  31616. } else {
  31617. keys = []
  31618. regexp = index(path, keys)
  31619. regexpCache[path] = { keys: keys, regexp: regexp }
  31620. }
  31621. var m = pathname.match(regexp)
  31622. if (!m) {
  31623. return false
  31624. } else if (!params) {
  31625. return true
  31626. }
  31627. for (var i = 1, len = m.length; i < len; ++i) {
  31628. var key = keys[i - 1]
  31629. var val = typeof m[i] === 'string' ? decodeURIComponent(m[i]) : m[i]
  31630. if (key) { params[key.name] = val }
  31631. }
  31632. return true
  31633. }
  31634. function fillParams (
  31635. path,
  31636. params,
  31637. routeMsg
  31638. ) {
  31639. try {
  31640. var filler =
  31641. regexpCompileCache[path] ||
  31642. (regexpCompileCache[path] = index.compile(path))
  31643. return filler(params || {}, { pretty: true })
  31644. } catch (e) {
  31645. assert(false, ("missing param for " + routeMsg + ": " + (e.message)))
  31646. return ''
  31647. }
  31648. }
  31649. function resolveRecordPath (path, record) {
  31650. return resolvePath(path, record.parent ? record.parent.path : '/', true)
  31651. }
  31652. /* */
  31653. var inBrowser = typeof window !== 'undefined'
  31654. var supportsHistory = inBrowser && (function () {
  31655. var ua = window.navigator.userAgent
  31656. if (
  31657. (ua.indexOf('Android 2.') !== -1 || ua.indexOf('Android 4.0') !== -1) &&
  31658. ua.indexOf('Mobile Safari') !== -1 &&
  31659. ua.indexOf('Chrome') === -1 &&
  31660. ua.indexOf('Windows Phone') === -1
  31661. ) {
  31662. return false
  31663. }
  31664. return window.history && 'pushState' in window.history
  31665. })()
  31666. /* */
  31667. function runQueue (queue, fn, cb) {
  31668. var step = function (index) {
  31669. if (index >= queue.length) {
  31670. cb()
  31671. } else {
  31672. if (queue[index]) {
  31673. fn(queue[index], function () {
  31674. step(index + 1)
  31675. })
  31676. } else {
  31677. step(index + 1)
  31678. }
  31679. }
  31680. }
  31681. step(0)
  31682. }
  31683. /* */
  31684. var History = function History (router, base) {
  31685. this.router = router
  31686. this.base = normalizeBase(base)
  31687. // start with a route object that stands for "nowhere"
  31688. this.current = START
  31689. this.pending = null
  31690. };
  31691. History.prototype.listen = function listen (cb) {
  31692. this.cb = cb
  31693. };
  31694. History.prototype.transitionTo = function transitionTo (location, cb) {
  31695. var this$1 = this;
  31696. var route = this.router.match(location, this.current)
  31697. this.confirmTransition(route, function () {
  31698. this$1.updateRoute(route)
  31699. cb && cb(route)
  31700. this$1.ensureURL()
  31701. })
  31702. };
  31703. History.prototype.confirmTransition = function confirmTransition (route, cb) {
  31704. var this$1 = this;
  31705. var current = this.current
  31706. if (isSameRoute(route, current)) {
  31707. this.ensureURL()
  31708. return
  31709. }
  31710. var ref = resolveQueue(this.current.matched, route.matched);
  31711. var deactivated = ref.deactivated;
  31712. var activated = ref.activated;
  31713. var queue = [].concat(
  31714. // in-component leave guards
  31715. extractLeaveGuards(deactivated),
  31716. // global before hooks
  31717. this.router.beforeHooks,
  31718. // enter guards
  31719. activated.map(function (m) { return m.beforeEnter; }),
  31720. // async components
  31721. resolveAsyncComponents(activated)
  31722. )
  31723. this.pending = route
  31724. var iterator = function (hook, next) {
  31725. if (this$1.pending !== route) { return }
  31726. hook(route, current, function (to) {
  31727. if (to === false) {
  31728. // next(false) -> abort navigation, ensure current URL
  31729. this$1.ensureURL()
  31730. } else if (typeof to === 'string' || typeof to === 'object') {
  31731. // next('/') or next({ path: '/' }) -> redirect
  31732. this$1.push(to)
  31733. } else {
  31734. // confirm transition and pass on the value
  31735. next(to)
  31736. }
  31737. })
  31738. }
  31739. runQueue(queue, iterator, function () {
  31740. var postEnterCbs = []
  31741. var enterGuards = extractEnterGuards(activated, postEnterCbs, function () {
  31742. return this$1.current === route
  31743. })
  31744. // wait until async components are resolved before
  31745. // extracting in-component enter guards
  31746. runQueue(enterGuards, iterator, function () {
  31747. if (this$1.pending === route) {
  31748. this$1.pending = null
  31749. cb(route)
  31750. this$1.router.app.$nextTick(function () {
  31751. postEnterCbs.forEach(function (cb) { return cb(); })
  31752. })
  31753. }
  31754. })
  31755. })
  31756. };
  31757. History.prototype.updateRoute = function updateRoute (route) {
  31758. var prev = this.current
  31759. this.current = route
  31760. this.cb && this.cb(route)
  31761. this.router.afterHooks.forEach(function (hook) {
  31762. hook && hook(route, prev)
  31763. })
  31764. };
  31765. function normalizeBase (base) {
  31766. if (!base) {
  31767. if (inBrowser) {
  31768. // respect <base> tag
  31769. var baseEl = document.querySelector('base')
  31770. base = baseEl ? baseEl.getAttribute('href') : '/'
  31771. } else {
  31772. base = '/'
  31773. }
  31774. }
  31775. // make sure there's the starting slash
  31776. if (base.charAt(0) !== '/') {
  31777. base = '/' + base
  31778. }
  31779. // remove trailing slash
  31780. return base.replace(/\/$/, '')
  31781. }
  31782. function resolveQueue (
  31783. current,
  31784. next
  31785. ) {
  31786. var i
  31787. var max = Math.max(current.length, next.length)
  31788. for (i = 0; i < max; i++) {
  31789. if (current[i] !== next[i]) {
  31790. break
  31791. }
  31792. }
  31793. return {
  31794. activated: next.slice(i),
  31795. deactivated: current.slice(i)
  31796. }
  31797. }
  31798. function extractLeaveGuards (matched) {
  31799. return flatMapComponents(matched, function (def, instance) {
  31800. var guard = def && def.beforeRouteLeave
  31801. if (guard) {
  31802. return function routeLeaveGuard () {
  31803. return guard.apply(instance, arguments)
  31804. }
  31805. }
  31806. }).reverse()
  31807. }
  31808. function extractEnterGuards (
  31809. matched,
  31810. cbs,
  31811. isValid
  31812. ) {
  31813. return flatMapComponents(matched, function (def, _, match, key) {
  31814. var guard = def && def.beforeRouteEnter
  31815. if (guard) {
  31816. return function routeEnterGuard (to, from, next) {
  31817. return guard(to, from, function (cb) {
  31818. next(cb)
  31819. if (typeof cb === 'function') {
  31820. cbs.push(function () {
  31821. // #750
  31822. // if a router-view is wrapped with an out-in transition,
  31823. // the instance may not have been registered at this time.
  31824. // we will need to poll for registration until current route
  31825. // is no longer valid.
  31826. poll(cb, match.instances, key, isValid)
  31827. })
  31828. }
  31829. })
  31830. }
  31831. }
  31832. })
  31833. }
  31834. function poll (cb, instances, key, isValid) {
  31835. if (instances[key]) {
  31836. cb(instances[key])
  31837. } else if (isValid()) {
  31838. setTimeout(function () {
  31839. poll(cb, instances, key, isValid)
  31840. }, 16)
  31841. }
  31842. }
  31843. function resolveAsyncComponents (matched) {
  31844. return flatMapComponents(matched, function (def, _, match, key) {
  31845. // if it's a function and doesn't have Vue options attached,
  31846. // assume it's an async component resolve function.
  31847. // we are not using Vue's default async resolving mechanism because
  31848. // we want to halt the navigation until the incoming component has been
  31849. // resolved.
  31850. if (typeof def === 'function' && !def.options) {
  31851. return function (to, from, next) {
  31852. var resolve = function (resolvedDef) {
  31853. match.components[key] = resolvedDef
  31854. next()
  31855. }
  31856. var reject = function (reason) {
  31857. warn(false, ("Failed to resolve async component " + key + ": " + reason))
  31858. next(false)
  31859. }
  31860. var res = def(resolve, reject)
  31861. if (res && typeof res.then === 'function') {
  31862. res.then(resolve, reject)
  31863. }
  31864. }
  31865. }
  31866. })
  31867. }
  31868. function flatMapComponents (
  31869. matched,
  31870. fn
  31871. ) {
  31872. return Array.prototype.concat.apply([], matched.map(function (m) {
  31873. return Object.keys(m.components).map(function (key) { return fn(
  31874. m.components[key],
  31875. m.instances[key],
  31876. m, key
  31877. ); })
  31878. }))
  31879. }
  31880. /* */
  31881. function saveScrollPosition (key) {
  31882. if (!key) { return }
  31883. window.sessionStorage.setItem(key, JSON.stringify({
  31884. x: window.pageXOffset,
  31885. y: window.pageYOffset
  31886. }))
  31887. }
  31888. function getScrollPosition (key) {
  31889. if (!key) { return }
  31890. return JSON.parse(window.sessionStorage.getItem(key))
  31891. }
  31892. function getElementPosition (el) {
  31893. var docRect = document.documentElement.getBoundingClientRect()
  31894. var elRect = el.getBoundingClientRect()
  31895. return {
  31896. x: elRect.left - docRect.left,
  31897. y: elRect.top - docRect.top
  31898. }
  31899. }
  31900. function isValidPosition (obj) {
  31901. return isNumber(obj.x) || isNumber(obj.y)
  31902. }
  31903. function normalizePosition (obj) {
  31904. return {
  31905. x: isNumber(obj.x) ? obj.x : window.pageXOffset,
  31906. y: isNumber(obj.y) ? obj.y : window.pageYOffset
  31907. }
  31908. }
  31909. function isNumber (v) {
  31910. return typeof v === 'number'
  31911. }
  31912. /* */
  31913. var genKey = function () { return String(Date.now()); }
  31914. var _key = genKey()
  31915. var HTML5History = (function (History) {
  31916. function HTML5History (router, base) {
  31917. var this$1 = this;
  31918. History.call(this, router, base)
  31919. this.transitionTo(getLocation(this.base))
  31920. var expectScroll = router.options.scrollBehavior
  31921. window.addEventListener('popstate', function (e) {
  31922. _key = e.state && e.state.key
  31923. var current = this$1.current
  31924. this$1.transitionTo(getLocation(this$1.base), function (next) {
  31925. if (expectScroll) {
  31926. this$1.handleScroll(next, current, true)
  31927. }
  31928. })
  31929. })
  31930. if (expectScroll) {
  31931. window.addEventListener('scroll', function () {
  31932. saveScrollPosition(_key)
  31933. })
  31934. }
  31935. }
  31936. if ( History ) HTML5History.__proto__ = History;
  31937. HTML5History.prototype = Object.create( History && History.prototype );
  31938. HTML5History.prototype.constructor = HTML5History;
  31939. HTML5History.prototype.go = function go (n) {
  31940. window.history.go(n)
  31941. };
  31942. HTML5History.prototype.push = function push (location) {
  31943. var this$1 = this;
  31944. var current = this.current
  31945. this.transitionTo(location, function (route) {
  31946. pushState(cleanPath(this$1.base + route.fullPath))
  31947. this$1.handleScroll(route, current, false)
  31948. })
  31949. };
  31950. HTML5History.prototype.replace = function replace (location) {
  31951. var this$1 = this;
  31952. var current = this.current
  31953. this.transitionTo(location, function (route) {
  31954. replaceState(cleanPath(this$1.base + route.fullPath))
  31955. this$1.handleScroll(route, current, false)
  31956. })
  31957. };
  31958. HTML5History.prototype.ensureURL = function ensureURL () {
  31959. if (getLocation(this.base) !== this.current.fullPath) {
  31960. replaceState(cleanPath(this.base + this.current.fullPath))
  31961. }
  31962. };
  31963. HTML5History.prototype.handleScroll = function handleScroll (to, from, isPop) {
  31964. var router = this.router
  31965. if (!router.app) {
  31966. return
  31967. }
  31968. var behavior = router.options.scrollBehavior
  31969. if (!behavior) {
  31970. return
  31971. }
  31972. assert(typeof behavior === 'function', "scrollBehavior must be a function")
  31973. // wait until re-render finishes before scrolling
  31974. router.app.$nextTick(function () {
  31975. var position = getScrollPosition(_key)
  31976. var shouldScroll = behavior(to, from, isPop ? position : null)
  31977. if (!shouldScroll) {
  31978. return
  31979. }
  31980. var isObject = typeof shouldScroll === 'object'
  31981. if (isObject && typeof shouldScroll.selector === 'string') {
  31982. var el = document.querySelector(shouldScroll.selector)
  31983. if (el) {
  31984. position = getElementPosition(el)
  31985. } else if (isValidPosition(shouldScroll)) {
  31986. position = normalizePosition(shouldScroll)
  31987. }
  31988. } else if (isObject && isValidPosition(shouldScroll)) {
  31989. position = normalizePosition(shouldScroll)
  31990. }
  31991. if (position) {
  31992. window.scrollTo(position.x, position.y)
  31993. }
  31994. })
  31995. };
  31996. return HTML5History;
  31997. }(History));
  31998. function getLocation (base) {
  31999. var path = window.location.pathname
  32000. if (base && path.indexOf(base) === 0) {
  32001. path = path.slice(base.length)
  32002. }
  32003. return (path || '/') + window.location.search + window.location.hash
  32004. }
  32005. function pushState (url, replace) {
  32006. // try...catch the pushState call to get around Safari
  32007. // DOM Exception 18 where it limits to 100 pushState calls
  32008. var history = window.history
  32009. try {
  32010. if (replace) {
  32011. history.replaceState({ key: _key }, '', url)
  32012. } else {
  32013. _key = genKey()
  32014. history.pushState({ key: _key }, '', url)
  32015. }
  32016. saveScrollPosition(_key)
  32017. } catch (e) {
  32018. window.location[replace ? 'assign' : 'replace'](url)
  32019. }
  32020. }
  32021. function replaceState (url) {
  32022. pushState(url, true)
  32023. }
  32024. /* */
  32025. var HashHistory = (function (History) {
  32026. function HashHistory (router, base, fallback) {
  32027. var this$1 = this;
  32028. History.call(this, router, base)
  32029. // check history fallback deeplinking
  32030. if (fallback && this.checkFallback()) {
  32031. return
  32032. }
  32033. ensureSlash()
  32034. this.transitionTo(getHash(), function () {
  32035. window.addEventListener('hashchange', function () {
  32036. this$1.onHashChange()
  32037. })
  32038. })
  32039. }
  32040. if ( History ) HashHistory.__proto__ = History;
  32041. HashHistory.prototype = Object.create( History && History.prototype );
  32042. HashHistory.prototype.constructor = HashHistory;
  32043. HashHistory.prototype.checkFallback = function checkFallback () {
  32044. var location = getLocation(this.base)
  32045. if (!/^\/#/.test(location)) {
  32046. window.location.replace(
  32047. cleanPath(this.base + '/#' + location)
  32048. )
  32049. return true
  32050. }
  32051. };
  32052. HashHistory.prototype.onHashChange = function onHashChange () {
  32053. if (!ensureSlash()) {
  32054. return
  32055. }
  32056. this.transitionTo(getHash(), function (route) {
  32057. replaceHash(route.fullPath)
  32058. })
  32059. };
  32060. HashHistory.prototype.push = function push (location) {
  32061. this.transitionTo(location, function (route) {
  32062. pushHash(route.fullPath)
  32063. })
  32064. };
  32065. HashHistory.prototype.replace = function replace (location) {
  32066. this.transitionTo(location, function (route) {
  32067. replaceHash(route.fullPath)
  32068. })
  32069. };
  32070. HashHistory.prototype.go = function go (n) {
  32071. window.history.go(n)
  32072. };
  32073. HashHistory.prototype.ensureURL = function ensureURL () {
  32074. if (getHash() !== this.current.fullPath) {
  32075. replaceHash(this.current.fullPath)
  32076. }
  32077. };
  32078. return HashHistory;
  32079. }(History));
  32080. function ensureSlash () {
  32081. var path = getHash()
  32082. if (path.charAt(0) === '/') {
  32083. return true
  32084. }
  32085. replaceHash('/' + path)
  32086. return false
  32087. }
  32088. function getHash () {
  32089. // We can't use window.location.hash here because it's not
  32090. // consistent across browsers - Firefox will pre-decode it!
  32091. var href = window.location.href
  32092. var index = href.indexOf('#')
  32093. return index === -1 ? '' : href.slice(index + 1)
  32094. }
  32095. function pushHash (path) {
  32096. window.location.hash = path
  32097. }
  32098. function replaceHash (path) {
  32099. var i = window.location.href.indexOf('#')
  32100. window.location.replace(
  32101. window.location.href.slice(0, i >= 0 ? i : 0) + '#' + path
  32102. )
  32103. }
  32104. /* */
  32105. var AbstractHistory = (function (History) {
  32106. function AbstractHistory (router) {
  32107. History.call(this, router)
  32108. this.stack = []
  32109. this.index = -1
  32110. }
  32111. if ( History ) AbstractHistory.__proto__ = History;
  32112. AbstractHistory.prototype = Object.create( History && History.prototype );
  32113. AbstractHistory.prototype.constructor = AbstractHistory;
  32114. AbstractHistory.prototype.push = function push (location) {
  32115. var this$1 = this;
  32116. this.transitionTo(location, function (route) {
  32117. this$1.stack = this$1.stack.slice(0, this$1.index + 1).concat(route)
  32118. this$1.index++
  32119. })
  32120. };
  32121. AbstractHistory.prototype.replace = function replace (location) {
  32122. var this$1 = this;
  32123. this.transitionTo(location, function (route) {
  32124. this$1.stack = this$1.stack.slice(0, this$1.index).concat(route)
  32125. })
  32126. };
  32127. AbstractHistory.prototype.go = function go (n) {
  32128. var this$1 = this;
  32129. var targetIndex = this.index + n
  32130. if (targetIndex < 0 || targetIndex >= this.stack.length) {
  32131. return
  32132. }
  32133. var route = this.stack[targetIndex]
  32134. this.confirmTransition(route, function () {
  32135. this$1.index = targetIndex
  32136. this$1.updateRoute(route)
  32137. })
  32138. };
  32139. AbstractHistory.prototype.ensureURL = function ensureURL () {
  32140. // noop
  32141. };
  32142. return AbstractHistory;
  32143. }(History));
  32144. /* */
  32145. var VueRouter = function VueRouter (options) {
  32146. if ( options === void 0 ) options = {};
  32147. this.app = null
  32148. this.options = options
  32149. this.beforeHooks = []
  32150. this.afterHooks = []
  32151. this.match = createMatcher(options.routes || [])
  32152. var mode = options.mode || 'hash'
  32153. this.fallback = mode === 'history' && !supportsHistory
  32154. if (this.fallback) {
  32155. mode = 'hash'
  32156. }
  32157. if (!inBrowser) {
  32158. mode = 'abstract'
  32159. }
  32160. this.mode = mode
  32161. };
  32162. var prototypeAccessors = { currentRoute: {} };
  32163. prototypeAccessors.currentRoute.get = function () {
  32164. return this.history && this.history.current
  32165. };
  32166. VueRouter.prototype.init = function init (app /* Vue component instance */) {
  32167. var this$1 = this;
  32168. assert(
  32169. install.installed,
  32170. "not installed. Make sure to call `Vue.use(VueRouter)` " +
  32171. "before creating root instance."
  32172. )
  32173. this.app = app
  32174. var ref = this;
  32175. var mode = ref.mode;
  32176. var options = ref.options;
  32177. var fallback = ref.fallback;
  32178. switch (mode) {
  32179. case 'history':
  32180. this.history = new HTML5History(this, options.base)
  32181. break
  32182. case 'hash':
  32183. this.history = new HashHistory(this, options.base, fallback)
  32184. break
  32185. case 'abstract':
  32186. this.history = new AbstractHistory(this)
  32187. break
  32188. default:
  32189. assert(false, ("invalid mode: " + mode))
  32190. }
  32191. this.history.listen(function (route) {
  32192. this$1.app._route = route
  32193. })
  32194. };
  32195. VueRouter.prototype.beforeEach = function beforeEach (fn) {
  32196. this.beforeHooks.push(fn)
  32197. };
  32198. VueRouter.prototype.afterEach = function afterEach (fn) {
  32199. this.afterHooks.push(fn)
  32200. };
  32201. VueRouter.prototype.push = function push (location) {
  32202. this.history.push(location)
  32203. };
  32204. VueRouter.prototype.replace = function replace (location) {
  32205. this.history.replace(location)
  32206. };
  32207. VueRouter.prototype.go = function go (n) {
  32208. this.history.go(n)
  32209. };
  32210. VueRouter.prototype.back = function back () {
  32211. this.go(-1)
  32212. };
  32213. VueRouter.prototype.forward = function forward () {
  32214. this.go(1)
  32215. };
  32216. VueRouter.prototype.getMatchedComponents = function getMatchedComponents () {
  32217. if (!this.currentRoute) {
  32218. return []
  32219. }
  32220. return [].concat.apply([], this.currentRoute.matched.map(function (m) {
  32221. return Object.keys(m.components).map(function (key) {
  32222. return m.components[key]
  32223. })
  32224. }))
  32225. };
  32226. Object.defineProperties( VueRouter.prototype, prototypeAccessors );
  32227. VueRouter.install = install
  32228. if (inBrowser && window.Vue) {
  32229. window.Vue.use(VueRouter)
  32230. }
  32231. return VueRouter;
  32232. })));
  32233. /***/ },
  32234. /* 304 */
  32235. /***/ function(module, exports, __webpack_require__) {
  32236. // style-loader: Adds some css to the DOM by adding a <style> tag
  32237. // load the styles
  32238. var content = __webpack_require__(217);
  32239. if(typeof content === 'string') content = [[module.i, content, '']];
  32240. // add the styles to the DOM
  32241. var update = __webpack_require__(20)(content, {});
  32242. if(content.locals) module.exports = content.locals;
  32243. // Hot Module Replacement
  32244. if(false) {
  32245. // When the styles change, update the <style> tags
  32246. if(!content.locals) {
  32247. module.hot.accept("!!./../../node_modules/css-loader/index.js!./../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-28c275d9!./../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Fingerprint.vue", function() {
  32248. var newContent = require("!!./../../node_modules/css-loader/index.js!./../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-28c275d9!./../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Fingerprint.vue");
  32249. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  32250. update(newContent);
  32251. });
  32252. }
  32253. // When the module is disposed, remove the <style> tags
  32254. module.hot.dispose(function() { update(); });
  32255. }
  32256. /***/ },
  32257. /* 305 */
  32258. /***/ function(module, exports, __webpack_require__) {
  32259. // style-loader: Adds some css to the DOM by adding a <style> tag
  32260. // load the styles
  32261. var content = __webpack_require__(218);
  32262. if(typeof content === 'string') content = [[module.i, content, '']];
  32263. // add the styles to the DOM
  32264. var update = __webpack_require__(20)(content, {});
  32265. if(content.locals) module.exports = content.locals;
  32266. // Hot Module Replacement
  32267. if(false) {
  32268. // When the styles change, update the <style> tags
  32269. if(!content.locals) {
  32270. module.hot.accept("!!./../../node_modules/css-loader/index.js!./../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-3e659d19!./../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Passwords.vue", function() {
  32271. var newContent = require("!!./../../node_modules/css-loader/index.js!./../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-3e659d19!./../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Passwords.vue");
  32272. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  32273. update(newContent);
  32274. });
  32275. }
  32276. // When the module is disposed, remove the <style> tags
  32277. module.hot.dispose(function() { update(); });
  32278. }
  32279. /***/ },
  32280. /* 306 */
  32281. /***/ function(module, exports, __webpack_require__) {
  32282. // style-loader: Adds some css to the DOM by adding a <style> tag
  32283. // load the styles
  32284. var content = __webpack_require__(219);
  32285. if(typeof content === 'string') content = [[module.i, content, '']];
  32286. // add the styles to the DOM
  32287. var update = __webpack_require__(20)(content, {});
  32288. if(content.locals) module.exports = content.locals;
  32289. // Hot Module Replacement
  32290. if(false) {
  32291. // When the styles change, update the <style> tags
  32292. if(!content.locals) {
  32293. module.hot.accept("!!./../../node_modules/css-loader/index.js!./../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-4e146d4e!./../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./PasswordGenerator.vue", function() {
  32294. var newContent = require("!!./../../node_modules/css-loader/index.js!./../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-4e146d4e!./../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./PasswordGenerator.vue");
  32295. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  32296. update(newContent);
  32297. });
  32298. }
  32299. // When the module is disposed, remove the <style> tags
  32300. module.hot.dispose(function() { update(); });
  32301. }
  32302. /***/ },
  32303. /* 307 */
  32304. /***/ function(module, exports, __webpack_require__) {
  32305. // style-loader: Adds some css to the DOM by adding a <style> tag
  32306. // load the styles
  32307. var content = __webpack_require__(220);
  32308. if(typeof content === 'string') content = [[module.i, content, '']];
  32309. // add the styles to the DOM
  32310. var update = __webpack_require__(20)(content, {});
  32311. if(content.locals) module.exports = content.locals;
  32312. // Hot Module Replacement
  32313. if(false) {
  32314. // When the styles change, update the <style> tags
  32315. if(!content.locals) {
  32316. module.hot.accept("!!./../node_modules/css-loader/index.js!./../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-7d2a5ef8!./../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./LessPass.vue", function() {
  32317. var newContent = require("!!./../node_modules/css-loader/index.js!./../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-7d2a5ef8!./../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./LessPass.vue");
  32318. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  32319. update(newContent);
  32320. });
  32321. }
  32322. // When the module is disposed, remove the <style> tags
  32323. module.hot.dispose(function() { update(); });
  32324. }
  32325. /***/ },
  32326. /* 308 */
  32327. /***/ function(module, exports, __webpack_require__) {
  32328. // style-loader: Adds some css to the DOM by adding a <style> tag
  32329. // load the styles
  32330. var content = __webpack_require__(221);
  32331. if(typeof content === 'string') content = [[module.i, content, '']];
  32332. // add the styles to the DOM
  32333. var update = __webpack_require__(20)(content, {});
  32334. if(content.locals) module.exports = content.locals;
  32335. // Hot Module Replacement
  32336. if(false) {
  32337. // When the styles change, update the <style> tags
  32338. if(!content.locals) {
  32339. module.hot.accept("!!./../../node_modules/css-loader/index.js!./../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-e2e1cfd0!./../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./DeleteButton.vue", function() {
  32340. var newContent = require("!!./../../node_modules/css-loader/index.js!./../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-e2e1cfd0!./../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./DeleteButton.vue");
  32341. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  32342. update(newContent);
  32343. });
  32344. }
  32345. // When the module is disposed, remove the <style> tags
  32346. module.hot.dispose(function() { update(); });
  32347. }
  32348. /***/ },
  32349. /* 309 */
  32350. /***/ function(module, exports, __webpack_require__) {
  32351. // style-loader: Adds some css to the DOM by adding a <style> tag
  32352. // load the styles
  32353. var content = __webpack_require__(222);
  32354. if(typeof content === 'string') content = [[module.i, content, '']];
  32355. // add the styles to the DOM
  32356. var update = __webpack_require__(20)(content, {});
  32357. if(content.locals) module.exports = content.locals;
  32358. // Hot Module Replacement
  32359. if(false) {
  32360. // When the styles change, update the <style> tags
  32361. if(!content.locals) {
  32362. module.hot.accept("!!./../../node_modules/css-loader/index.js!./../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-eabada8c!./../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Menu.vue", function() {
  32363. var newContent = require("!!./../../node_modules/css-loader/index.js!./../../node_modules/vue-loader/lib/style-rewriter.js?id=data-v-eabada8c!./../../node_modules/vue-loader/lib/selector.js?type=styles&index=0!./Menu.vue");
  32364. if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
  32365. update(newContent);
  32366. });
  32367. }
  32368. // When the module is disposed, remove the <style> tags
  32369. module.hot.dispose(function() { update(); });
  32370. }
  32371. /***/ },
  32372. /* 310 */
  32373. /***/ function(module, exports) {
  32374. module.exports = function(module) {
  32375. if(!module.webpackPolyfill) {
  32376. module.deprecate = function() {};
  32377. module.paths = [];
  32378. // module.parent = undefined by default
  32379. if(!module.children) module.children = [];
  32380. Object.defineProperty(module, "loaded", {
  32381. enumerable: true,
  32382. configurable: false,
  32383. get: function() { return module.l; }
  32384. });
  32385. Object.defineProperty(module, "id", {
  32386. enumerable: true,
  32387. configurable: false,
  32388. get: function() { return module.i; }
  32389. });
  32390. module.webpackPolyfill = 1;
  32391. }
  32392. return module;
  32393. }
  32394. /***/ },
  32395. /* 311 */
  32396. /***/ function(module, exports) {
  32397. /* (ignored) */
  32398. /***/ },
  32399. /* 312 */
  32400. 311,
  32401. /* 313 */
  32402. /***/ function(module, exports, __webpack_require__) {
  32403. "use strict";
  32404. 'use strict';
  32405. var _vue = __webpack_require__(47);
  32406. var _vue2 = _interopRequireDefault(_vue);
  32407. __webpack_require__(120);
  32408. __webpack_require__(121);
  32409. __webpack_require__(122);
  32410. var _LessPass = __webpack_require__(123);
  32411. var _LessPass2 = _interopRequireDefault(_LessPass);
  32412. var _store = __webpack_require__(119);
  32413. var _store2 = _interopRequireDefault(_store);
  32414. var _router = __webpack_require__(118);
  32415. var _router2 = _interopRequireDefault(_router);
  32416. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  32417. new _vue2.default({
  32418. el: '#lesspass',
  32419. store: _store2.default,
  32420. router: _router2.default,
  32421. render: function render(h) {
  32422. return h(_LessPass2.default);
  32423. }
  32424. });
  32425. /***/ }
  32426. /******/ ])));